yepanywhere 0.9.0 → 0.9.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 (502) hide show
  1. package/bundled/@yep-anywhere/shared/dist/__tests__/long-context-effort-warning.test.js +19 -0
  2. package/bundled/@yep-anywhere/shared/dist/__tests__/long-context-effort-warning.test.js.map +1 -1
  3. package/bundled/@yep-anywhere/shared/dist/__tests__/model-prices.test.js +12 -0
  4. package/bundled/@yep-anywhere/shared/dist/__tests__/model-prices.test.js.map +1 -1
  5. package/bundled/@yep-anywhere/shared/dist/app-types.d.ts +2 -2
  6. package/bundled/@yep-anywhere/shared/dist/app-types.d.ts.map +1 -1
  7. package/bundled/@yep-anywhere/shared/dist/app-types.js +5 -5
  8. package/bundled/@yep-anywhere/shared/dist/app-types.js.map +1 -1
  9. package/bundled/@yep-anywhere/shared/dist/artifact-viewer.d.ts +21 -0
  10. package/bundled/@yep-anywhere/shared/dist/artifact-viewer.d.ts.map +1 -1
  11. package/bundled/@yep-anywhere/shared/dist/artifact-viewer.js +22 -1
  12. package/bundled/@yep-anywhere/shared/dist/artifact-viewer.js.map +1 -1
  13. package/bundled/@yep-anywhere/shared/dist/capability-ids.d.ts +6 -0
  14. package/bundled/@yep-anywhere/shared/dist/capability-ids.d.ts.map +1 -1
  15. package/bundled/@yep-anywhere/shared/dist/capability-ids.js +6 -0
  16. package/bundled/@yep-anywhere/shared/dist/capability-ids.js.map +1 -1
  17. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/ToolResultSchemas.d.ts +2 -2
  18. package/bundled/@yep-anywhere/shared/dist/find/documentFind.d.ts +41 -0
  19. package/bundled/@yep-anywhere/shared/dist/find/documentFind.d.ts.map +1 -0
  20. package/bundled/@yep-anywhere/shared/dist/find/documentFind.js +280 -0
  21. package/bundled/@yep-anywhere/shared/dist/find/documentFind.js.map +1 -0
  22. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.d.ts +2 -0
  23. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.d.ts.map +1 -0
  24. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.generated.d.ts +2 -0
  25. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.generated.d.ts.map +1 -0
  26. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.generated.js +5 -0
  27. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.generated.js.map +1 -0
  28. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.js +59 -0
  29. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.js.map +1 -0
  30. package/bundled/@yep-anywhere/shared/dist/find/protocol.d.ts +46 -0
  31. package/bundled/@yep-anywhere/shared/dist/find/protocol.d.ts.map +1 -0
  32. package/bundled/@yep-anywhere/shared/dist/find/protocol.js +45 -0
  33. package/bundled/@yep-anywhere/shared/dist/find/protocol.js.map +1 -0
  34. package/bundled/@yep-anywhere/shared/dist/index.d.ts +4 -2
  35. package/bundled/@yep-anywhere/shared/dist/index.d.ts.map +1 -1
  36. package/bundled/@yep-anywhere/shared/dist/index.js +3 -1
  37. package/bundled/@yep-anywhere/shared/dist/index.js.map +1 -1
  38. package/bundled/@yep-anywhere/shared/dist/long-context-effort-warning.d.ts +11 -11
  39. package/bundled/@yep-anywhere/shared/dist/long-context-effort-warning.d.ts.map +1 -1
  40. package/bundled/@yep-anywhere/shared/dist/long-context-effort-warning.js +26 -9
  41. package/bundled/@yep-anywhere/shared/dist/long-context-effort-warning.js.map +1 -1
  42. package/bundled/@yep-anywhere/shared/dist/model-prices.d.ts.map +1 -1
  43. package/bundled/@yep-anywhere/shared/dist/model-prices.js +9 -2
  44. package/bundled/@yep-anywhere/shared/dist/model-prices.js.map +1 -1
  45. package/bundled/@yep-anywhere/shared/dist/pdfjs.d.ts +7 -0
  46. package/bundled/@yep-anywhere/shared/dist/pdfjs.d.ts.map +1 -0
  47. package/bundled/@yep-anywhere/shared/dist/pdfjs.js +7 -0
  48. package/bundled/@yep-anywhere/shared/dist/pdfjs.js.map +1 -0
  49. package/bundled/@yep-anywhere/shared/dist/server-capabilities.d.ts +20 -0
  50. package/bundled/@yep-anywhere/shared/dist/server-capabilities.d.ts.map +1 -1
  51. package/bundled/@yep-anywhere/shared/dist/server-capabilities.js +22 -0
  52. package/bundled/@yep-anywhere/shared/dist/server-capabilities.js.map +1 -1
  53. package/bundled/@yep-anywhere/shared/dist/skill-invocations.d.ts.map +1 -1
  54. package/bundled/@yep-anywhere/shared/dist/skill-invocations.js +7 -10
  55. package/bundled/@yep-anywhere/shared/dist/skill-invocations.js.map +1 -1
  56. package/bundled/@yep-anywhere/shared/dist/types.d.ts +7 -0
  57. package/bundled/@yep-anywhere/shared/dist/types.d.ts.map +1 -1
  58. package/bundled/@yep-anywhere/shared/dist/types.js.map +1 -1
  59. package/bundled/@yep-anywhere/shared/package.json +1 -1
  60. package/client-dist/assets/AboutSettings-CCzudbSj.js +1 -0
  61. package/client-dist/assets/{ActivityPage-FgSG_9Sl.js → ActivityPage-Bn0LbMgE.js} +1 -1
  62. package/client-dist/assets/{AgentContextSettings-BfTCI7qG.js → AgentContextSettings-DI8jQVIx.js} +3 -3
  63. package/client-dist/assets/AgentsPage-Ci_iJt8T.js +2 -0
  64. package/client-dist/assets/App-rFnK5pnF.js +2 -0
  65. package/client-dist/assets/AppearanceSettings-DTYVt0W5.js +2 -0
  66. package/client-dist/assets/AppsSettings-hbh_sguk.js +1 -0
  67. package/client-dist/assets/AttachmentChip-BFve3lTD.js +1 -0
  68. package/client-dist/assets/{AuthContext-CVsoMulX.js → AuthContext-DmXjW0be.js} +1 -1
  69. package/client-dist/assets/{BangCommandDisplayObject-B8KrHDzH.js → BangCommandDisplayObject-BH2KRGnc.js} +1 -1
  70. package/client-dist/assets/BangCommandsPage-MfkuL8yS.js +1 -0
  71. package/client-dist/assets/BrowserDebugToolbarButton-BPghQu17.js +1 -0
  72. package/client-dist/assets/{CacheMissBillingSettings-Bfqlk9rA.js → CacheMissBillingSettings-rUgC-_DD.js} +2 -2
  73. package/client-dist/assets/{CodexUpdatePrompt-ChHtbla-.js → CodexUpdatePrompt-mT9K-f1e.js} +1 -1
  74. package/client-dist/assets/{CommittedRangeInput-C3Z7YUlS.js → CommittedRangeInput-BwuV6Q6c.js} +1 -1
  75. package/client-dist/assets/{CommittedRangeNumberInput-D497_5ff.js → CommittedRangeNumberInput-C5YSVltB.js} +1 -1
  76. package/client-dist/assets/ComputerControlSettings-MWIdP7SS.js +1 -0
  77. package/client-dist/assets/{ConversationPreviewPage-CTWx9N3v.js → ConversationPreviewPage-B47r7mUF.js} +2 -2
  78. package/client-dist/assets/DevelopmentSettings-BEAy_xq-.js +1 -0
  79. package/client-dist/assets/DevicesSettings-DKQOZkRN.js +1 -0
  80. package/client-dist/assets/EmulatorPage-DlsPq3nR.js +1 -0
  81. package/client-dist/assets/EmulatorSettings-C6Ye1k_Y.js +1 -0
  82. package/client-dist/assets/EnvironmentSettings-ou8UNqTa.js +1 -0
  83. package/client-dist/assets/FilePage-Cw2PaO5H.js +1 -0
  84. package/client-dist/assets/FilterDropdown-CACc6ysA.js +1 -0
  85. package/client-dist/assets/FilterDropdown-D11gXriH.css +1 -0
  86. package/client-dist/assets/FloatingActionButton-Bl1Eumxh.js +1 -0
  87. package/client-dist/assets/{GitStatusPage-879aktqc.js → GitStatusPage-CLTkgnDI.js} +3 -3
  88. package/client-dist/assets/GlobalSessionsPage-Bvzs4zmW.js +2 -0
  89. package/client-dist/assets/GlobalSessionsPage-dlTB6crv.css +1 -0
  90. package/client-dist/assets/{HeartbeatTextArea-CKxL-bdJ.js → HeartbeatTextArea-CtP5kx9R.js} +1 -1
  91. package/client-dist/assets/HostIdentityContext-DA7dMF-y.js +1 -0
  92. package/client-dist/assets/HostsPage-CBOYGC2-.js +1 -0
  93. package/client-dist/assets/{InboxContext-opkOiXDB.js → InboxContext-8PXoTbK1.js} +1 -1
  94. package/client-dist/assets/InboxPage-DWl7uzdw.js +1 -0
  95. package/client-dist/assets/IssueSettings-BVljRpuD.js +1 -0
  96. package/client-dist/assets/IssuesPage-BFxgsMkf.js +1 -0
  97. package/client-dist/assets/LifecycleWebhooksSettings-Qw_dN3F3.js +1 -0
  98. package/client-dist/assets/{LocalAccessSettings-BpmNC9pI.js → LocalAccessSettings-SWirs75o.js} +3 -3
  99. package/client-dist/assets/LocalMediaModal-B3KXtyEB.css +1 -0
  100. package/client-dist/assets/LocalMediaModal-B9eHVx6y.js +14 -0
  101. package/client-dist/assets/{LoginPage-Cu7cX9wS.js → LoginPage-CYWqVJ95.js} +1 -1
  102. package/client-dist/assets/{MessageAge-Cd1C0-Kr.js → MessageAge-CaPpa1nH.js} +1 -1
  103. package/client-dist/assets/{MessageDeliverySettings-B_9VqCMP.js → MessageDeliverySettings-BUSuGKlc.js} +2 -2
  104. package/client-dist/assets/MessageInput-a13ZPAHv.js +3 -0
  105. package/client-dist/assets/MessageInputToolbar-BIL_6i7G.css +1 -0
  106. package/client-dist/assets/MessageInputToolbar-CQGTnVea.js +58 -0
  107. package/client-dist/assets/MessageList-C7kAuWKg.js +4 -0
  108. package/client-dist/assets/MessageList-rD5OPsAJ.css +1 -0
  109. package/client-dist/assets/Modal-ClSjJagX.js +15 -0
  110. package/client-dist/assets/ModelSettings-Dnd4yzmI.js +1 -0
  111. package/client-dist/assets/NavigationLayout-BTFsWVtE.js +2 -0
  112. package/client-dist/assets/NewSessionPage-BfiAS-Mo.js +1 -0
  113. package/client-dist/assets/NotificationsSettings-B1ugQIp-.js +1 -0
  114. package/client-dist/assets/PageHeader-BjwH2pWD.js +1 -0
  115. package/client-dist/assets/PerformanceSettings-jJYF9SPY.js +1 -0
  116. package/client-dist/assets/{ProjectSessionDefaultsModal-Dq2_xDka.js → ProjectSessionDefaultsModal-G_0uxJEv.js} +1 -1
  117. package/client-dist/assets/ProjectTemplatesSettings-BQTCV3-3.js +1 -0
  118. package/client-dist/assets/ProjectsPage-suTd8s9l.js +1 -0
  119. package/client-dist/assets/ProviderBadge-P0VTI71n.js +1 -0
  120. package/client-dist/assets/{ProviderChildSessionDetail-tWrpaB_X.js → ProviderChildSessionDetail-D0472EW8.js} +35 -35
  121. package/client-dist/assets/ProviderChildSessionPage-9__sgY14.js +1 -0
  122. package/client-dist/assets/ProvidersSettings-Bwzy73Rk.js +1 -0
  123. package/client-dist/assets/{RecapAfterSecondsControl-qU0RMrUX.js → RecapAfterSecondsControl-CxuXyFSr.js} +1 -1
  124. package/client-dist/assets/{RelayProtocol-DjpPJk64.js → RelayProtocol-BpdH0COG.js} +1 -1
  125. package/client-dist/assets/RemoteAccessSettings-Dn7KB5nK.js +1 -0
  126. package/client-dist/assets/RemoteExecutorsSettings-Cjl4Y2rB.js +1 -0
  127. package/client-dist/assets/SchemaValidationContext-57RCj4c4.js +1 -0
  128. package/client-dist/assets/{SearchPreview-B25ksFLA.js → SearchPreview-OzVFWPJZ.js} +1 -1
  129. package/client-dist/assets/{SessionHeader.module-Co9s-JR3.js → SessionHeader.module-BpaFAQ-S.js} +1 -1
  130. package/client-dist/assets/SessionPage-BYthaEfZ.js +50 -0
  131. package/client-dist/assets/SessionPage-CXXEAwu2.css +1 -0
  132. package/client-dist/assets/{SettingsItem-B_rM9Vhi.js → SettingsItem-C9Vh5p7F.js} +1 -1
  133. package/client-dist/assets/{SettingsSection-DOwc_RwX.js → SettingsSection-BaPzETK6.js} +1 -1
  134. package/client-dist/assets/SourceControlSettings-DnqLg0db.js +1 -0
  135. package/client-dist/assets/{SourceFileHeaderActions-3_76js_o.js → SourceFileHeaderActions-PjhUGnn6.js} +1 -1
  136. package/client-dist/assets/SpeechControlMenu-BYVdEa3C.js +2 -0
  137. package/client-dist/assets/{SpeechSettings-BT4TnSgr.js → SpeechSettings-B6LkqfSK.js} +2 -2
  138. package/client-dist/assets/{SpeechSmartTurnControls-vIZ8a7Lb.js → SpeechSmartTurnControls-LPq9wBaM.js} +1 -1
  139. package/client-dist/assets/StorageSettings-DtsJnYaz.js +1 -0
  140. package/client-dist/assets/{ThinkingControls-CbZcYobp.js → ThinkingControls-DXbxdJRi.js} +1 -1
  141. package/client-dist/assets/ToolbarSettings-Nb2BKpnk.js +1 -0
  142. package/client-dist/assets/UsersSettings-BdvqmyqK.js +1 -0
  143. package/client-dist/assets/ViewerModePage-CfJJA5GL.css +1 -0
  144. package/client-dist/assets/ViewerModePage-DzRIpuYF.js +1 -0
  145. package/client-dist/assets/{VoiceInputButton-japn0Kx_.js → VoiceInputButton-CCgovfyf.js} +1 -1
  146. package/client-dist/assets/WorkstreamsPage-dlEUllSL.js +1 -0
  147. package/client-dist/assets/{YaServerProvider-OSxrnpr9.js → YaServerProvider-CN3tC5UL.js} +1 -1
  148. package/client-dist/assets/{YepAnywhereLogo-OH70DoR4.js → YepAnywhereLogo-5zFKWjQq.js} +1 -1
  149. package/client-dist/assets/{abnfDiagram-VCTEODGH-BK2byNq2.js → abnfDiagram-VCTEODGH-BWHUBcV3.js} +1 -1
  150. package/client-dist/assets/{arc-BZ7613Gf.js → arc-DKsIJWGD.js} +1 -1
  151. package/client-dist/assets/{architectureDiagram-5GKGNRK7-WEjy-r-z.js → architectureDiagram-5GKGNRK7-BuLImqW3.js} +1 -1
  152. package/client-dist/assets/{attachmentFileNames-BfFUuufi.js → attachmentFileNames-CBV_5g65.js} +1 -1
  153. package/client-dist/assets/{blockDiagram-I7D4REHJ-BOsYYXyW.js → blockDiagram-I7D4REHJ-CJ4Gh6sL.js} +1 -1
  154. package/client-dist/assets/{c4Diagram-7LVT6UL2-BRrAUZLE.js → c4Diagram-7LVT6UL2-WR43XvCI.js} +1 -1
  155. package/client-dist/assets/channel-PV8AAsuo.js +1 -0
  156. package/client-dist/assets/{chunk-2Q5K7J3B-ikUS9MZO.js → chunk-2Q5K7J3B-CiP4m_EA.js} +1 -1
  157. package/client-dist/assets/{chunk-5VM5RSS4-DqxRtuTQ.js → chunk-5VM5RSS4-BUAhj1h9.js} +1 -1
  158. package/client-dist/assets/{chunk-F27PBJKO-DQAhMVEw.js → chunk-F27PBJKO-BUZNwiGx.js} +1 -1
  159. package/client-dist/assets/{chunk-IMKFNOWR-B2QXI9W-.js → chunk-IMKFNOWR-CX1a0BCE.js} +1 -1
  160. package/client-dist/assets/{chunk-JWPE2WC7-Px4jgxzE.js → chunk-JWPE2WC7-C6tL-mLF.js} +1 -1
  161. package/client-dist/assets/{chunk-POPQ4Y6H-BTrXHY42.js → chunk-POPQ4Y6H-BzijGGWv.js} +1 -1
  162. package/client-dist/assets/{chunk-SVP7TREG-DufcbLSM.js → chunk-SVP7TREG-CsZImJKI.js} +1 -1
  163. package/client-dist/assets/{chunk-TICWLB2K-C6xArrXi.js → chunk-TICWLB2K-TwCtuDc1.js} +1 -1
  164. package/client-dist/assets/{chunk-XXDRQBXY-CtTuQMK6.js → chunk-XXDRQBXY-C-2EoNns.js} +1 -1
  165. package/client-dist/assets/classDiagram-ZZMXUADV-DvtSxfma.js +1 -0
  166. package/client-dist/assets/classDiagram-v2-VYDZK3BY-DvtSxfma.js +1 -0
  167. package/client-dist/assets/{client-sN_tbfxh.js → client-Ci_HPGfl.js} +2 -2
  168. package/client-dist/assets/{compactSettingsControls-BjKplkgf.js → compactSettingsControls-C9mLZh5H.js} +1 -1
  169. package/client-dist/assets/{cose-bilkent-JH36ORCC-Cn15YJGj.js → cose-bilkent-JH36ORCC-CmbEx2jT.js} +1 -1
  170. package/client-dist/assets/{cynefin-OW5HDTMX-CJkFJ0DX.js → cynefin-OW5HDTMX-BSQHHXFU.js} +1 -1
  171. package/client-dist/assets/{cynefinDiagram-5FMLGOSQ-CVX2L_eF.js → cynefinDiagram-5FMLGOSQ-C-62JZJD.js} +1 -1
  172. package/client-dist/assets/{dagre-GXQ25YYZ-BMbYVbaU.js → dagre-GXQ25YYZ-BBERQe_A.js} +1 -1
  173. package/client-dist/assets/de-Cgdxe5vX.js +6 -0
  174. package/client-dist/assets/{diagram-S7CK7UJ4-DTZ_P_Fh.js → diagram-S7CK7UJ4-muw11lmG.js} +1 -1
  175. package/client-dist/assets/{diagram-UQ7AKVKN-C6cgxro0.js → diagram-UQ7AKVKN-DpePWzAe.js} +1 -1
  176. package/client-dist/assets/{diagram-VSXAHHWV-MzNPAr2n.js → diagram-VSXAHHWV-DHX6AHUY.js} +1 -1
  177. package/client-dist/assets/{diagram-VX7I27RA-BZN6iloV.js → diagram-VX7I27RA-DYmR6NH_.js} +1 -1
  178. package/client-dist/assets/{diagram-Z3DM3KII-CtTiorxp.js → diagram-Z3DM3KII-BC1SenHB.js} +1 -1
  179. package/client-dist/assets/{ebnfDiagram-PWID7BFC-B28XYdqt.js → ebnfDiagram-PWID7BFC-EVpri6Ma.js} +1 -1
  180. package/client-dist/assets/{erDiagram-RLTQ6QDP-DlMmHWyy.js → erDiagram-RLTQ6QDP-DthztUaa.js} +1 -1
  181. package/client-dist/assets/es-gyRk85dY.js +6 -0
  182. package/client-dist/assets/{flowDiagram-HODETNUW-C5mVciwL.js → flowDiagram-HODETNUW-DEpC5nMx.js} +1 -1
  183. package/client-dist/assets/fr-Dx9lA8u-.js +6 -0
  184. package/client-dist/assets/{frontendReload-DT6MOpjg.js → frontendReload-CBdyvvdy.js} +1 -1
  185. package/client-dist/assets/{ganttDiagram-EL5Y4UJY-BTl7ZRTR.js → ganttDiagram-EL5Y4UJY-Csqji8t1.js} +1 -1
  186. package/client-dist/assets/{gitGraphDiagram-WWUBYQGX-BsG6KEKe.js → gitGraphDiagram-WWUBYQGX-DVX1SDIE.js} +1 -1
  187. package/client-dist/assets/{hostStorage-BoEdRarg.js → hostStorage-D1KAm3U1.js} +1 -1
  188. package/client-dist/assets/{index-D7q51uJV.js → index-BESqiBDI.js} +1 -1
  189. package/client-dist/assets/index-BkOdUxq4.js +2 -0
  190. package/client-dist/assets/index-CPb-36gi.css +1 -0
  191. package/client-dist/assets/index-CoR-vzsb.js +2 -0
  192. package/client-dist/assets/index-Cv3tQXyE.js +1 -0
  193. package/client-dist/assets/{index-CkZXrIi5.js → index-DSFMItgO.js} +1 -1
  194. package/client-dist/assets/index-umZg0LZ6.js +81 -0
  195. package/client-dist/assets/{infoDiagram-27XIBGKW-CkZcthz-.js → infoDiagram-27XIBGKW-CHm3qsd2.js} +1 -1
  196. package/client-dist/assets/{ishikawaDiagram-5VMMS53U-Cvqitz5U.js → ishikawaDiagram-5VMMS53U-tBRZwz-_.js} +1 -1
  197. package/client-dist/assets/ja-BOj7smkY.js +6 -0
  198. package/client-dist/assets/{journeyDiagram-3NMN7TZE-vCw00Cqy.js → journeyDiagram-3NMN7TZE-EJic7nqD.js} +1 -1
  199. package/client-dist/assets/{kanban-definition-UXKFOSKX-BZGCo-wX.js → kanban-definition-UXKFOSKX-DtzL6eeO.js} +1 -1
  200. package/client-dist/assets/{layout-D7JRfual.js → layout-gb-Axsoq.js} +1 -1
  201. package/client-dist/assets/{linear-O9cHRsA5.js → linear-CAe4xGbR.js} +1 -1
  202. package/client-dist/assets/long-context-effort-warning-C6XHizE1.js +1 -0
  203. package/client-dist/assets/{mermaid.core-CdC8AeOx.js → mermaid.core-BCu1nv8H.js} +5 -5
  204. package/client-dist/assets/{mindmap-definition-YA3MSWOX-CczC57z0.js → mindmap-definition-YA3MSWOX-C7-KSPtJ.js} +1 -1
  205. package/client-dist/assets/newSessionPrefill-DKcy0abh.js +1 -0
  206. package/client-dist/assets/{pegDiagram-XKGWAZYB-jTm4iBWK.js → pegDiagram-XKGWAZYB-iWVH9rbY.js} +1 -1
  207. package/client-dist/assets/{pieDiagram-E7YTZNPT-DfkDPuJg.js → pieDiagram-E7YTZNPT-VKD6PLHa.js} +1 -1
  208. package/client-dist/assets/providerChildSessions-Cd7oK6KQ.css +1 -0
  209. package/client-dist/assets/providerChildSessions-DbLFSybt.js +77 -0
  210. package/client-dist/assets/{quadrantDiagram-AXDQQJYC--bBZSIt1.js → quadrantDiagram-AXDQQJYC-AXFugcFl.js} +1 -1
  211. package/client-dist/assets/{railroadDiagram-O6MQD6OU-gbkMdGN6.js → railroadDiagram-O6MQD6OU-D6oZy6Al.js} +1 -1
  212. package/client-dist/assets/{recentProjectPathLinks-Ba20jx5b.js → recentProjectPathLinks-D0Dx6YXT.js} +2 -2
  213. package/client-dist/assets/{registerServiceWorker-CGxgV4Yi.js → registerServiceWorker-B8K2KVOY.js} +1 -1
  214. package/client-dist/assets/{relayEndpoints-0oIbn4eU.js → relayEndpoints-BTq9xppf.js} +1 -1
  215. package/client-dist/assets/{remoteRoutePaths-CiDZeM2I.js → remoteRoutePaths-D8htA0xa.js} +1 -1
  216. package/client-dist/assets/{requirementDiagram-BXWQKSXE-WfLCTewk.js → requirementDiagram-BXWQKSXE-Eqtb74It.js} +1 -1
  217. package/client-dist/assets/{sankeyDiagram-P5KCCOFB-BhJkx_M1.js → sankeyDiagram-P5KCCOFB-CxvDiZ1R.js} +1 -1
  218. package/client-dist/assets/{sequenceDiagram-WJ2MYXX4-_S-ZN-hK.js → sequenceDiagram-WJ2MYXX4-BbpkgW2L.js} +1 -1
  219. package/client-dist/assets/sessionHistorySearch.worker-DCkPlfGO.js +61 -0
  220. package/client-dist/assets/{sessionNavigationState-DKXD1sTS.js → sessionNavigationState-BXejf2ZW.js} +1 -1
  221. package/client-dist/assets/sessionRouteLayer-D9T2QT8G.js +1 -0
  222. package/client-dist/assets/{sizeCapture-INFHLROL-YfaR_7-Y.js → sizeCapture-INFHLROL-DcuwWD5r.js} +1 -1
  223. package/client-dist/assets/{sourceControlNavigationState-lyZ29oaF.js → sourceControlNavigationState-BJbTzWTE.js} +1 -1
  224. package/client-dist/assets/{speechDraftTransaction-zyWVCYTF.js → speechDraftTransaction-WhqFE1h9.js} +1 -1
  225. package/client-dist/assets/{stateDiagram-D77RDMKH-_N9FdD6m.js → stateDiagram-D77RDMKH-Cidpq73w.js} +1 -1
  226. package/client-dist/assets/stateDiagram-v2-MP3YSRHH-DFqKXxjz.js +1 -0
  227. package/client-dist/assets/{swimlanes-42K2YHIH-DUl5jFZz.js → swimlanes-42K2YHIH-Ba8C7MwG.js} +1 -1
  228. package/client-dist/assets/swimlanesDiagram-VR7AAH4N-3pW2TcAt.js +8 -0
  229. package/client-dist/assets/{timeline-definition-24CTP7MA-DtYzRl63.js → timeline-definition-24CTP7MA-CKefGvUK.js} +1 -1
  230. package/client-dist/assets/useAcliCommentarySetting-CBKAl7qr.js +9 -0
  231. package/client-dist/assets/useActivityBusState-C0dor9p7.js +1 -0
  232. package/client-dist/assets/{useBackgroundRevalidation-CULom4_W.js → useBackgroundRevalidation-C79HAUP3.js} +1 -1
  233. package/client-dist/assets/{useCodexUpdateStatus-BIDehnvt.js → useCodexUpdateStatus-CEZO_f2Y.js} +1 -1
  234. package/client-dist/assets/{useConnectedDevices-kBo43kbz.js → useConnectedDevices-Ds-DuUDc.js} +1 -1
  235. package/client-dist/assets/{useDocumentTitle-C06qawRj.js → useDocumentTitle-Xz5t-nlB.js} +1 -1
  236. package/client-dist/assets/{useEmulators-Bz8194e3.js → useEmulators-qS_cCZ3I.js} +1 -1
  237. package/client-dist/assets/{useFileActivity-CwkGwsQt.js → useFileActivity-BoW4X3DY.js} +1 -1
  238. package/client-dist/assets/{useFloatingActionButtonEnabled-C31rfHtR.js → useFloatingActionButtonEnabled-2_hw7nSa.js} +1 -1
  239. package/client-dist/assets/{useForkSummaryAutoOpen-D_SvtmbE.js → useForkSummaryAutoOpen-CS33Irpf.js} +1 -1
  240. package/client-dist/assets/{useGeneratedTitleLength-Cu-SoQ6T.js → useGeneratedTitleLength-D856ktVg.js} +1 -1
  241. package/client-dist/assets/{useKeepMobileKeyboardOpenAfterDelivery-C-cYLaEU.js → useKeepMobileKeyboardOpenAfterDelivery-Ba77SbWF.js} +1 -1
  242. package/client-dist/assets/useModelSettings-BdlYk1DT.js +1 -0
  243. package/client-dist/assets/{useNotifyInApp-BcLZ8ie_.js → useNotifyInApp-DcWe3dh4.js} +1 -1
  244. package/client-dist/assets/{useOnboarding-CYgE-Xsg.js → useOnboarding-CoE3WF8a.js} +1 -1
  245. package/client-dist/assets/{useProviders-C6kBPWYX.js → useProviders-CeN1PclA.js} +1 -1
  246. package/client-dist/assets/{useQuestionAsideSetting-6Excl6Pm.js → useQuestionAsideSetting-CPFw1u0y.js} +1 -1
  247. package/client-dist/assets/{useRecentSessions-CsmsGemq.js → useRecentSessions-ieTzzJu4.js} +2 -2
  248. package/client-dist/assets/{useRelativeNow-BdLaPgKO.js → useRelativeNow-Ca6QGcPa.js} +1 -1
  249. package/client-dist/assets/{useReloadNotifications-B0egr2ys.js → useReloadNotifications-Dm1jmdIb.js} +1 -1
  250. package/client-dist/assets/{useRemoteExecutors-Bgjgzif1.js → useRemoteExecutors-zBAQnQXH.js} +1 -1
  251. package/client-dist/assets/{useSidebarWidth-ut6NNk5Y.js → useSidebarWidth-CBCcbSLg.js} +1 -1
  252. package/client-dist/assets/{useSourceControlCleanLanding-DxrwogwF.js → useSourceControlCleanLanding-VDlft5tr.js} +1 -1
  253. package/client-dist/assets/{useStableToolPreviewRendering-CcrkchTG.js → useStableToolPreviewRendering-hbVp38Jd.js} +1 -1
  254. package/client-dist/assets/{useStreamingEnabled-EdvW04Vz.js → useStreamingEnabled-hU1g8i7_.js} +1 -1
  255. package/client-dist/assets/{useTabTitleActivityPreference-B0suFUHK.js → useTabTitleActivityPreference-DhREY7m2.js} +1 -1
  256. package/client-dist/assets/{useVhostAccess-2ZKr0Lcl.js → useVhostAccess-DUtn_sH1.js} +1 -1
  257. package/client-dist/assets/{useWorkflowTags-_4F_41YI.js → useWorkflowTags-DxbEBqtf.js} +1 -1
  258. package/client-dist/assets/{vennDiagram-4TSXK5OY-26XZDUe6.js → vennDiagram-4TSXK5OY-CSGBq-Ur.js} +1 -1
  259. package/client-dist/assets/{wardleyDiagram-VM6X3IG4-YvZ37BJ7.js → wardleyDiagram-VM6X3IG4-DIMvcaMb.js} +1 -1
  260. package/client-dist/assets/{xychartDiagram-S5SC5T6Z-BMT0MEGz.js → xychartDiagram-S5SC5T6Z-TYXSqT3w.js} +1 -1
  261. package/client-dist/assets/zh-CN-DadySLj9.js +7 -0
  262. package/client-dist/index.html +3 -3
  263. package/dist/app.d.ts.map +1 -1
  264. package/dist/app.js +29 -10
  265. package/dist/app.js.map +1 -1
  266. package/dist/artifacts/ArtifactServer.d.ts +2 -0
  267. package/dist/artifacts/ArtifactServer.d.ts.map +1 -1
  268. package/dist/artifacts/ArtifactServer.js +79 -1
  269. package/dist/artifacts/ArtifactServer.js.map +1 -1
  270. package/dist/auth/limitedUserPolicy.d.ts +9 -5
  271. package/dist/auth/limitedUserPolicy.d.ts.map +1 -1
  272. package/dist/auth/limitedUserPolicy.js +64 -35
  273. package/dist/auth/limitedUserPolicy.js.map +1 -1
  274. package/dist/auth/principal.d.ts +6 -0
  275. package/dist/auth/principal.d.ts.map +1 -1
  276. package/dist/auth/principal.js +6 -0
  277. package/dist/auth/principal.js.map +1 -1
  278. package/dist/frontend/static.d.ts.map +1 -1
  279. package/dist/frontend/static.js +2 -1
  280. package/dist/frontend/static.js.map +1 -1
  281. package/dist/middleware/authenticated-transport.d.ts +13 -0
  282. package/dist/middleware/authenticated-transport.d.ts.map +1 -1
  283. package/dist/middleware/authenticated-transport.js +12 -0
  284. package/dist/middleware/authenticated-transport.js.map +1 -1
  285. package/dist/middleware/limited-users.d.ts +9 -5
  286. package/dist/middleware/limited-users.d.ts.map +1 -1
  287. package/dist/middleware/limited-users.js +37 -23
  288. package/dist/middleware/limited-users.js.map +1 -1
  289. package/dist/routes/file-edit.d.ts +18 -0
  290. package/dist/routes/file-edit.d.ts.map +1 -0
  291. package/dist/routes/file-edit.js +244 -0
  292. package/dist/routes/file-edit.js.map +1 -0
  293. package/dist/routes/files.d.ts.map +1 -1
  294. package/dist/routes/files.js +34 -9
  295. package/dist/routes/files.js.map +1 -1
  296. package/dist/routes/pdfjs.d.ts +9 -0
  297. package/dist/routes/pdfjs.d.ts.map +1 -0
  298. package/dist/routes/pdfjs.js +34 -0
  299. package/dist/routes/pdfjs.js.map +1 -0
  300. package/dist/routes/public-file-shares.d.ts +6 -0
  301. package/dist/routes/public-file-shares.d.ts.map +1 -1
  302. package/dist/routes/public-file-shares.js +22 -10
  303. package/dist/routes/public-file-shares.js.map +1 -1
  304. package/dist/routes/public-shares.d.ts.map +1 -1
  305. package/dist/routes/public-shares.js +18 -1
  306. package/dist/routes/public-shares.js.map +1 -1
  307. package/dist/routes/recents.d.ts +4 -1
  308. package/dist/routes/recents.d.ts.map +1 -1
  309. package/dist/routes/recents.js +7 -0
  310. package/dist/routes/recents.js.map +1 -1
  311. package/dist/routes/sessions.d.ts.map +1 -1
  312. package/dist/routes/sessions.js +4 -0
  313. package/dist/routes/sessions.js.map +1 -1
  314. package/dist/routes/settings.d.ts +7 -2
  315. package/dist/routes/settings.d.ts.map +1 -1
  316. package/dist/routes/settings.js +43 -1
  317. package/dist/routes/settings.js.map +1 -1
  318. package/dist/routes/version.d.ts.map +1 -1
  319. package/dist/routes/version.js +1 -0
  320. package/dist/routes/version.js.map +1 -1
  321. package/dist/routes/ws-relay-handlers.d.ts +12 -0
  322. package/dist/routes/ws-relay-handlers.d.ts.map +1 -1
  323. package/dist/routes/ws-relay-handlers.js +25 -4
  324. package/dist/routes/ws-relay-handlers.js.map +1 -1
  325. package/dist/routes/ws-relay.d.ts.map +1 -1
  326. package/dist/routes/ws-relay.js +8 -0
  327. package/dist/routes/ws-relay.js.map +1 -1
  328. package/dist/sdk/providers/agent-self.js +1 -1
  329. package/dist/sdk/providers/agent-self.js.map +1 -1
  330. package/dist/sdk/providers/claude.d.ts +1 -0
  331. package/dist/sdk/providers/claude.d.ts.map +1 -1
  332. package/dist/sdk/providers/claude.js +7 -0
  333. package/dist/sdk/providers/claude.js.map +1 -1
  334. package/dist/sdk/providers/codex-model-catalog.d.ts.map +1 -1
  335. package/dist/sdk/providers/codex-model-catalog.js +5 -3
  336. package/dist/sdk/providers/codex-model-catalog.js.map +1 -1
  337. package/dist/sdk/providers/codex-protocol/generated/ContentItem.d.ts +4 -1
  338. package/dist/sdk/providers/codex-protocol/generated/ContentItem.d.ts.map +1 -1
  339. package/dist/sdk/providers/codex-protocol/generated/FunctionCallOutputContentItem.d.ts +4 -1
  340. package/dist/sdk/providers/codex-protocol/generated/FunctionCallOutputContentItem.d.ts.map +1 -1
  341. package/dist/sdk/providers/codex-protocol/generated/Personality.d.ts +3 -0
  342. package/dist/sdk/providers/codex-protocol/generated/Personality.d.ts.map +1 -1
  343. package/dist/sdk/providers/codex-protocol/generated/v2/McpAppDisplayMode.d.ts +2 -0
  344. package/dist/sdk/providers/codex-protocol/generated/v2/McpAppDisplayMode.d.ts.map +1 -0
  345. package/dist/sdk/providers/codex-protocol/generated/v2/{ThreadRollbackParams.js → McpAppDisplayMode.js} +1 -1
  346. package/dist/sdk/providers/codex-protocol/generated/v2/McpAppDisplayMode.js.map +1 -0
  347. package/dist/sdk/providers/codex-protocol/generated/v2/McpAppUi.d.ts +9 -0
  348. package/dist/sdk/providers/codex-protocol/generated/v2/McpAppUi.d.ts.map +1 -0
  349. package/dist/sdk/providers/codex-protocol/generated/v2/{ThreadRollbackResponse.js → McpAppUi.js} +1 -1
  350. package/dist/sdk/providers/codex-protocol/generated/v2/McpAppUi.js.map +1 -0
  351. package/dist/sdk/providers/codex-protocol/generated/v2/Thread.d.ts +1 -1
  352. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadForkResponse.d.ts +4 -0
  353. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadForkResponse.d.ts.map +1 -1
  354. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadItem.d.ts +6 -1
  355. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadItem.d.ts.map +1 -1
  356. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeParams.d.ts +4 -0
  357. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeParams.d.ts.map +1 -1
  358. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeResponse.d.ts +9 -0
  359. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeResponse.d.ts.map +1 -1
  360. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadStartParams.d.ts +9 -0
  361. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadStartParams.d.ts.map +1 -1
  362. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadStartResponse.d.ts +4 -0
  363. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadStartResponse.d.ts.map +1 -1
  364. package/dist/sdk/providers/codex-protocol/generated/v2/TurnStartParams.d.ts +7 -1
  365. package/dist/sdk/providers/codex-protocol/generated/v2/TurnStartParams.d.ts.map +1 -1
  366. package/dist/sdk/providers/codex-protocol/generated/v2/UserInput.d.ts +3 -0
  367. package/dist/sdk/providers/codex-protocol/generated/v2/UserInput.d.ts.map +1 -1
  368. package/dist/sdk/providers/codex-protocol/index.d.ts +0 -2
  369. package/dist/sdk/providers/codex-protocol/index.d.ts.map +1 -1
  370. package/dist/sdk/providers/codex.d.ts +23 -2
  371. package/dist/sdk/providers/codex.d.ts.map +1 -1
  372. package/dist/sdk/providers/codex.js +55 -22
  373. package/dist/sdk/providers/codex.js.map +1 -1
  374. package/dist/sdk/providers/index.d.ts.map +1 -1
  375. package/dist/sdk/providers/index.js +4 -1
  376. package/dist/sdk/providers/index.js.map +1 -1
  377. package/dist/sdk/providers/opencode.d.ts +9 -0
  378. package/dist/sdk/providers/opencode.d.ts.map +1 -1
  379. package/dist/sdk/providers/opencode.js +129 -76
  380. package/dist/sdk/providers/opencode.js.map +1 -1
  381. package/dist/sdk/providers/provider-session-owner.d.ts +9 -0
  382. package/dist/sdk/providers/provider-session-owner.d.ts.map +1 -1
  383. package/dist/sdk/providers/provider-session-owner.js +39 -3
  384. package/dist/sdk/providers/provider-session-owner.js.map +1 -1
  385. package/dist/sdk/providers/types.d.ts +13 -0
  386. package/dist/sdk/providers/types.d.ts.map +1 -1
  387. package/dist/sdk/providers/types.js.map +1 -1
  388. package/dist/services/ArtifactRebuildService.d.ts +67 -0
  389. package/dist/services/ArtifactRebuildService.d.ts.map +1 -0
  390. package/dist/services/ArtifactRebuildService.js +229 -0
  391. package/dist/services/ArtifactRebuildService.js.map +1 -0
  392. package/dist/services/DirtyFileEditorService.d.ts +2 -0
  393. package/dist/services/DirtyFileEditorService.d.ts.map +1 -1
  394. package/dist/services/DirtyFileEditorService.js +20 -1
  395. package/dist/services/DirtyFileEditorService.js.map +1 -1
  396. package/dist/services/PdfjsAssetCache.d.ts +20 -0
  397. package/dist/services/PdfjsAssetCache.d.ts.map +1 -0
  398. package/dist/services/PdfjsAssetCache.js +131 -0
  399. package/dist/services/PdfjsAssetCache.js.map +1 -0
  400. package/dist/services/SessionCatalogService.d.ts +27 -0
  401. package/dist/services/SessionCatalogService.d.ts.map +1 -1
  402. package/dist/services/SessionCatalogService.js +129 -34
  403. package/dist/services/SessionCatalogService.js.map +1 -1
  404. package/dist/sessions/opencode-reader.d.ts +2 -1
  405. package/dist/sessions/opencode-reader.d.ts.map +1 -1
  406. package/dist/sessions/opencode-reader.js +30 -1
  407. package/dist/sessions/opencode-reader.js.map +1 -1
  408. package/dist/sessions/types.d.ts +6 -0
  409. package/dist/sessions/types.d.ts.map +1 -1
  410. package/dist/supervisor/Process.d.ts +7 -0
  411. package/dist/supervisor/Process.d.ts.map +1 -1
  412. package/dist/supervisor/Process.js +48 -3
  413. package/dist/supervisor/Process.js.map +1 -1
  414. package/dist/supervisor/Supervisor.d.ts.map +1 -1
  415. package/dist/supervisor/Supervisor.js +11 -0
  416. package/dist/supervisor/Supervisor.js.map +1 -1
  417. package/dist/supervisor/types.d.ts +3 -1
  418. package/dist/supervisor/types.d.ts.map +1 -1
  419. package/dist/supervisor/types.js.map +1 -1
  420. package/package.json +3 -3
  421. package/client-dist/assets/AboutSettings-BlEONE7w.js +0 -1
  422. package/client-dist/assets/AgentsPage-CBku9RWz.js +0 -2
  423. package/client-dist/assets/App-DWHvFKob.js +0 -2
  424. package/client-dist/assets/AppearanceSettings-BSEBjSjr.js +0 -2
  425. package/client-dist/assets/AppsSettings-iDL6Xuaa.js +0 -1
  426. package/client-dist/assets/AttachmentChip-DHKr4EfG.js +0 -1
  427. package/client-dist/assets/BangCommandsPage-yX8grXp9.js +0 -1
  428. package/client-dist/assets/BrowserDebugToolbarButton-B-b7N4cr.js +0 -1
  429. package/client-dist/assets/ComputerControlSettings-DzRDwfJ1.js +0 -1
  430. package/client-dist/assets/DevelopmentSettings-Bf9gyeU0.js +0 -1
  431. package/client-dist/assets/DevicesSettings-dbZHFEEc.js +0 -1
  432. package/client-dist/assets/EmulatorPage-CKJwVTFq.js +0 -1
  433. package/client-dist/assets/EmulatorSettings-BV9Bg3Xk.js +0 -1
  434. package/client-dist/assets/EnvironmentSettings-DmOTuSwm.js +0 -1
  435. package/client-dist/assets/FilePage-DnPW5Pbc.js +0 -1
  436. package/client-dist/assets/FilterDropdown-CB_tRt6g.css +0 -1
  437. package/client-dist/assets/FilterDropdown-DpS1eMEf.js +0 -1
  438. package/client-dist/assets/FloatingActionButton-DBIoFwff.js +0 -1
  439. package/client-dist/assets/GlobalSessionsPage-Dbnuis89.css +0 -1
  440. package/client-dist/assets/GlobalSessionsPage-DcmQcX7q.js +0 -2
  441. package/client-dist/assets/HostIdentityContext-D5aBdejC.js +0 -1
  442. package/client-dist/assets/HostsPage-C1ZTrhJv.js +0 -1
  443. package/client-dist/assets/InboxPage-Cepu8VGM.js +0 -1
  444. package/client-dist/assets/IssueSettings-xRU8E-xR.js +0 -1
  445. package/client-dist/assets/IssuesPage-c6PUStFT.js +0 -1
  446. package/client-dist/assets/LifecycleWebhooksSettings-CZcZATjJ.js +0 -1
  447. package/client-dist/assets/MessageInput-B0t6b_Hd.js +0 -3
  448. package/client-dist/assets/MessageInputToolbar-DdP4tB2S.css +0 -1
  449. package/client-dist/assets/MessageInputToolbar-rhYW1xGJ.js +0 -58
  450. package/client-dist/assets/MessageList-Dcvfxbeq.css +0 -1
  451. package/client-dist/assets/MessageList-dH63bflu.js +0 -4
  452. package/client-dist/assets/Modal-QUinFhBP.js +0 -16
  453. package/client-dist/assets/ModelSettings-CcWkVSEK.js +0 -1
  454. package/client-dist/assets/NavigationLayout-BkOsag-J.js +0 -2
  455. package/client-dist/assets/NewSessionPage-DcZ9YjmC.js +0 -1
  456. package/client-dist/assets/NotificationsSettings-DoVzfeME.js +0 -1
  457. package/client-dist/assets/PageHeader-BaYMLVHI.js +0 -1
  458. package/client-dist/assets/PerformanceSettings-dwoVtUlX.js +0 -1
  459. package/client-dist/assets/ProjectTemplatesSettings-BlMWq1wb.js +0 -1
  460. package/client-dist/assets/ProjectsPage-B5VBairc.js +0 -1
  461. package/client-dist/assets/ProviderChildSessionPage-B3eTTTjF.js +0 -1
  462. package/client-dist/assets/ProvidersSettings-OUKp5-Hb.js +0 -1
  463. package/client-dist/assets/RemoteAccessSettings-Bn0ng7s4.js +0 -1
  464. package/client-dist/assets/RemoteExecutorsSettings-2Qh-9Qv_.js +0 -1
  465. package/client-dist/assets/SchemaValidationContext-CIAd7icg.js +0 -1
  466. package/client-dist/assets/SessionPage-B1g1UFEV.js +0 -49
  467. package/client-dist/assets/SessionPage-BiV0X3n1.css +0 -1
  468. package/client-dist/assets/SourceControlSettings-BQfC1KbV.js +0 -1
  469. package/client-dist/assets/SpeechControlMenu-BIv0O1la.js +0 -2
  470. package/client-dist/assets/StorageSettings-DQcG9Mbq.js +0 -1
  471. package/client-dist/assets/ToolbarSettings-CmHVAejU.js +0 -1
  472. package/client-dist/assets/UsersSettings-COgiiV9D.js +0 -1
  473. package/client-dist/assets/WorkstreamsPage-DKLRDEAp.js +0 -1
  474. package/client-dist/assets/channel-C-7AVqtf.js +0 -1
  475. package/client-dist/assets/classDiagram-ZZMXUADV-DkRr8VcO.js +0 -1
  476. package/client-dist/assets/classDiagram-v2-VYDZK3BY-DkRr8VcO.js +0 -1
  477. package/client-dist/assets/de-DKHK9Tu3.js +0 -6
  478. package/client-dist/assets/es-XSkBrKBg.js +0 -6
  479. package/client-dist/assets/fr-DKUJaPhN.js +0 -6
  480. package/client-dist/assets/index-BBpZzMBa.js +0 -2
  481. package/client-dist/assets/index-BUrcmRdN.js +0 -76
  482. package/client-dist/assets/index-CA-BRFYh.js +0 -1
  483. package/client-dist/assets/index-wA2zlxt-.css +0 -1
  484. package/client-dist/assets/ja-BDnQUlyD.js +0 -6
  485. package/client-dist/assets/long-context-effort-warning-BGls6uvf.js +0 -1
  486. package/client-dist/assets/newSessionPrefill-DkkSfnYR.js +0 -1
  487. package/client-dist/assets/providerChildSessions-ClrSXOQr.js +0 -80
  488. package/client-dist/assets/providerChildSessions-D2O1SLei.css +0 -1
  489. package/client-dist/assets/sessionHistorySearch.worker-BGlVvPYq.js +0 -60
  490. package/client-dist/assets/stateDiagram-v2-MP3YSRHH-CBvcZngO.js +0 -1
  491. package/client-dist/assets/swimlanesDiagram-VR7AAH4N-DKVyQBDp.js +0 -8
  492. package/client-dist/assets/useAcliCommentarySetting-DxndlmkH.js +0 -9
  493. package/client-dist/assets/useActivityBusState-CINl9yjP.js +0 -1
  494. package/client-dist/assets/useModelSettings-DoDJRymT.js +0 -1
  495. package/client-dist/assets/zh-CN-FVXKSeP_.js +0 -7
  496. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackParams.d.ts +0 -14
  497. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackParams.d.ts.map +0 -1
  498. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackParams.js.map +0 -1
  499. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackResponse.d.ts +0 -12
  500. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackResponse.d.ts.map +0 -1
  501. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackResponse.js.map +0 -1
  502. /package/client-dist/assets/{Modal-EC-u4IZ7.css → index-EC-u4IZ7.css} +0 -0
@@ -1,80 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-CdC8AeOx.js","assets/index-BUrcmRdN.js","assets/react-runtime-D-UPQ57m.js","assets/index-wA2zlxt-.css"])))=>i.map(i=>d[i]);
2
- var Sl=Object.defineProperty;var _l=(e,t,n)=>t in e?Sl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oe=(e,t,n)=>_l(e,typeof t!="symbol"?t+"":t,n);import{r as c,h as ws,U as Ee,ck as El,cl as Cl,cm as Rr,cn as wo,aG as kl,j as a,g as tt,by as Ll,bz as Rl,s as Vt,G as Ml,co as Ki,bb as Al,aC as yo,f as vo,bE as jl,cp as Tl,bv as Gi,ax as $e,u as xe,aK as fe,cq as Qi,i as Pl,bs as Rt,cr as Nl,c9 as Il,d as $l,p as Dl,cs as Xi,F as Yi,ct as Bl,cu as Fl,cv as Ol,cw as Hl,cx as Ul,cy as Vl,cz as zl,cA as ql,cB as Kr,cC as Wl,cD as Kl,bp as Gl,bt as Ql}from"./index-BUrcmRdN.js";import{b as vn,a as ue,F as Xl,ab as Yl,C as Ji}from"./client-sN_tbfxh.js";import{a as Zi,c as ea,d as ta,t as na,y as Jl,b as ct,f as ra,x as Zl,z as eu,s as tu,h as bn,A as sn,B as hr,D as nu,E as bo,F as sa,S as ru,G as su,u as lt,Q as Jn,M as xn,H as oa,I as ia,J as ys,K as ou,L as iu,N as xo,C as au}from"./Modal-QUinFhBP.js";import{k as cu}from"./katex-Dv2p4YRM.js";import{a as yt}from"./appHref-ByaEnJGJ.js";import{p as aa}from"./remoteRoutePaths-CiDZeM2I.js";import{P as lu,p as uu,q as du,s as fu}from"./newSessionPrefill-DkkSfnYR.js";const vS=32,bS=64*1024;function xS(e){const t=e.trim().replace(/^#\s*/,""),n=/^acli: 1(?:\s+(.*))?$/.exec(t),r=/^acli-capabilities:\s+(.+)$/.exec(t),s=((n==null?void 0:n[1])??(r==null?void 0:r[1])??"").split(/\s+/);return s.includes(n?"+commentary-lines":"commentary-lines/1")?"lines":s.includes(n?"+commentary":"commentary/1")?"json":null}function hu(e){JSON.parse(e);const t=/\s*("(?:\\.|[^"\\])*"|[{}[\],:]|[^\s{}[\],:]+)/y;let n=0;const r=()=>{t.lastIndex=n;const o=t.exec(e);if(!o)throw new Error("Missing JSON token");return n=t.lastIndex,{text:o[1],start:n-o[1].length}},s=o=>{if(o>128)throw new Error("JSON nesting exceeds commentary limit");const i=r(),l={start:i.start,end:n};if(i.text==="{"){l.members=[];const u=new Set;for(;;){const d=r();if(d.text==="}")break;const h=JSON.parse(d.text);if(u.has(h))throw new Error("Ambiguous duplicate JSON member");if(u.add(h),r(),l.members.push({key:h,start:d.start,value:s(o+1)}),r().text==="}")break}l.end=n}else if(i.text==="["){l.items=[];const u=n;if(r().text!=="]"){n=u;do l.items.push(s(o+1));while(r().text!=="]")}l.end=n}return l};return s(0)}function So(e,t){const n=JSON.parse(e.slice(t.start,t.end));if(!n||Array.isArray(n)||typeof n!="object"||Object.keys(n).length!==1||!Array.isArray(n.commentary)||n.commentary.length===0)return null;const r=[];for(const s of n.commentary){if(!s||typeof s!="object"||Array.isArray(s)||Object.keys(s).length!==1||typeof s.text!="string"||!s.text.trim())return null;r.push(s.text)}return r}function ca(e,t){const n=[];let r=t.start;for(const s of e.removed)s.start<t.start||s.end>t.end||(n.push(e.source.slice(r,s.start)),r=s.end);return n.push(e.source.slice(r,t.end)),n.join("")}function SS(e,t){return t.context?ca(e,t.context):null}function _S(e){const t={source:e,data:e,commentary:[],removed:[],metadataOnly:!1};if(e.length>1024*1024)return t;if(!e.includes("_acli")&&!e.includes("\\")){try{JSON.parse(e),t.json=!0}catch{}return t}let n;try{n=hu(e)}catch{return t}t.json=!0;const r=o=>{var i;return((i=o.members)==null?void 0:i.length)===1&&o.members[0].key==="_acli"&&So(e,o.members[0].value)!==null},s=(o,i,l)=>{var u;if(o.items){let d=null;o.items.forEach((h,f)=>{s(h,`${i}/${f}`,d),r(h)||(d=h)})}(u=o.members)==null||u.forEach((d,h,f)=>{if(d.key!=="_acli"){s(d.value,`${i}/${d.key.replace(/~/g,"~0").replace(/\//g,"~1")}`,null);return}const g=So(e,d.value);if(!g)return;const m=r(o)?l:o===n?null:o;g.forEach((b,v)=>{t.commentary.push({id:`${i}/_acli/commentary/${v}`,text:b,context:m})});const p=f[h+1],y=f[h-1];t.removed.push({start:!p&&y?y.value.end:d.start,end:p?p.start:d.value.end})})};return s(n,"",null),t.removed.sort((o,i)=>o.start-i.start),t.metadataOnly=r(n),t.data=ca(t,{start:0,end:e.length}),t}function ES(e){const t="# _acli.commentary: ",n=e.startsWith(t)?e.slice(t.length).replace(/\r?\n$/,""):"",r=e.length<=1024*1024&&!!n.trim();return{source:e,data:r?"":e,commentary:r?[{id:"line",text:n,context:null}]:[],removed:r?[{start:0,end:e.length}]:[],metadataOnly:r}}class mu{constructor(t="json"){oe(this,"fragments",[]);oe(this,"depth",0);oe(this,"quoted",!1);oe(this,"escaped",!1);oe(this,"json",!1);oe(this,"started",!1);this.format=t}append(t){const n=[];let r=0;for(let s=0;s<t.length;s++){const o=t[s];!this.started&&!/\s/.test(o)&&(this.started=!0,this.json=this.format==="json"&&(o==="{"||o==="[")),this.json&&(this.quoted?this.escaped?this.escaped=!1:o==="\\"?this.escaped=!0:o==='"'&&(this.quoted=!1):o==='"'?this.quoted=!0:o==="{"||o==="["?this.depth++:(o==="}"||o==="]")&&this.depth--),o===`
3
- `&&(!this.json||!this.quoted&&this.depth<=0)&&(this.fragments.push(t.slice(r,s+1)),n.push(...this.finish()),r=s+1)}return r<t.length&&this.fragments.push(t.slice(r)),n}finish(){const t=this.fragments.join("");return this.fragments=[],this.depth=0,this.quoted=!1,this.escaped=!1,this.json=!1,this.started=!1,t?[t]:[]}}const pu=8e3,gu=120,wu=3;function CS(e){return(e.split(/\r?\n/u).map(n=>n.trim()).find(Boolean)??"Source review").slice(0,gu)}function yu(e,t,n=wu,r="new"){if(!Number.isInteger(t)||t<0)return null;let s=0;for(const o of e){if(t<s+o.lines.length)return vu(o,t-s,n,r);s+=o.lines.length}return null}function vu(e,t,n,r){var f,g;let s=e.oldStart,o=e.newStart;for(let m=0;m<t;m++){const p=(f=e.lines[m])==null?void 0:f[0];p==="-"?s++:(p==="+"||s++,o++)}const i=(g=e.lines[t])==null?void 0:g[0];let l,u,d;i==="-"?(l="old",u=s,d=null):i==="+"?(l="new",u=null,d=o):(l=r,u=s,d=o);const h=Math.max(0,t-n);return{side:l,oldLine:u,newLine:d,snippet:bu(e.lines,t,n),snippetAnchorOffset:t-h}}function bu(e,t,n){const r=Math.max(0,t-n),s=Math.min(e.length,t+n+1),o=[];for(let i=r;i<s;i++)o.push((e[i]??"").slice(1));return o.join(`
4
- `).slice(0,pu)}function la(e){const t=e.match(/^(.+?):(\d+)(?::(\d+))?$/);return t!=null&&t[1]&&t[2]?{path:t[1],line:Number.parseInt(t[2],10),column:t[3]?Number.parseInt(t[3],10):void 0}:{path:e}}const xu=new Set(["markdown","md","mdown","mdx","mkd","mkdn","qmd"]);function Su(e){const t=e.split(/[?#]/,1)[0]??"",n=t.split(/[\\/]/).pop()??t;return n.includes(".")?n.slice(n.lastIndexOf(".")+1).toLowerCase():""}function pn(e){return e?xu.has(Su(e)):!1}const _u="http://localhost",Eu=new Set(["apng","avif","png","jpg","jpeg","gif","webp","bmp","ico","tiff","tif","svg"]),Cu=new Set(["mp4","webm","mov","avi","mkv","ogv"]);function pt(e){if(!e)return;const t=Number(e);return Number.isInteger(t)&&t>0?t:void 0}function dn(e){if(e==null||e==="")return;const t=e.toLowerCase();if(t==="1"||t==="true")return!0;if(t==="0"||t==="false")return!1}function ku(e){return e.length>1?e.replace(/\/+$/,""):e}function Lu(e,t){try{return new URL(e,t??_u)}catch{return null}}function _o(e){try{return decodeURIComponent(e)}catch{return null}}function Ru(e,t,n){const r=la(e);return{path:r.path,lineNumber:t??r.line,columnNumber:n??r.column}}function ua(e){var n,r;const t=(r=(n=e.split(/[\\/]/).pop())==null?void 0:n.split(".").pop())==null?void 0:r.toLowerCase();if(t){if(Eu.has(t))return"image";if(Cu.has(t))return"video"}}function Mu(e){switch(e){case"local-file":case"local-media":case"project-file":case"project-raw-file":return e;default:return null}}function Au(e){switch(e){case"image":case"video":return e;default:return}}function ju(e,t={}){const n=Lu(e,t.currentHref);if(!n)return null;const r=ku(n.pathname);if(r==="/api/local-file"){const i=n.searchParams.get("path");if(!i)return null;const l=Ru(i,pt(n.searchParams.get("line")),pt(n.searchParams.get("column")));return{kind:"local-file",path:l.path,lineNumber:l.lineNumber,columnNumber:l.columnNumber,renderMarkdown:dn(n.searchParams.get("render")),download:dn(n.searchParams.get("download"))}}if(r==="/api/local-image"){const i=n.searchParams.get("path");return i?{kind:"local-media",path:i,mediaType:ua(i)}:null}const s=/(?:^|\/)projects\/([^/]+)\/file$/.exec(r);if(s!=null&&s[1]){const i=_o(s[1]),l=n.searchParams.get("path");return!i||!l?null:{kind:"project-file",projectId:i,path:l,lineNumber:pt(n.searchParams.get("line")),lineEnd:pt(n.searchParams.get("lineEnd")),columnNumber:pt(n.searchParams.get("column"))}}const o=/^\/api\/projects\/([^/]+)\/files\/raw$/.exec(r);if(o!=null&&o[1]){const i=_o(o[1]),l=n.searchParams.get("path");return!i||!l?null:{kind:"project-raw-file",projectId:i,path:l,download:dn(n.searchParams.get("download"))}}return null}function Tu(e){const t=Mu(e["data-ya-resource"]),n=e["data-ya-path"];if(!t||!n)return null;const r=e["data-ya-project-id"]??void 0;return(t==="project-file"||t==="project-raw-file")&&!r?null:{kind:t,path:n,projectId:r,lineNumber:pt(e["data-ya-line"]),lineEnd:pt(e["data-ya-line-end"]),columnNumber:pt(e["data-ya-column"]),renderMarkdown:dn(e["data-ya-render-markdown"]),download:dn(e["data-ya-download"]),mediaType:Au(e["data-ya-media-type"])??(t==="local-media"?ua(n):void 0)}}function Eo(e,t={}){if(e.attributes){const n=Tu(e.attributes);if(n)return n}return e.href?ju(e.href,t):null}const Pu=/^([\w.-]+)\[(\d+)\]\{([^}]*)\}:\s*$/;function Nu(e){const t=[];let n="",r=!1,s=!1;for(let o=0;o<e.length;o+=1){const i=e[o];if(r)i==='"'?e[o+1]==='"'?(n+='"',o+=1):(r=!1,s=!0):n+=i;else if(s){if(i!==",")return null;t.push(n),n="",s=!1}else if(i==='"'&&n==="")r=!0;else{if(i==='"')return null;i===","?(t.push(n),n=""):n+=i}}return r?null:(t.push(n),t)}function Iu(e){var s,o;const t=e.trim().split(`
5
- `),n=[];let r=0;for(;r<t.length;){if(!((s=t[r])!=null&&s.trim())){r+=1;continue}const i=(o=t[r])==null?void 0:o.trim().match(Pu);if(!i)return null;const l=Number(i[2]),u=(i[3]??"").split(",").map(h=>h.trim());if(u.length===0||u.some(h=>!h))return null;r+=1;const d=[];for(let h=0;h<l;h+=1,r+=1){const f=t[r];if(f===void 0||!f.trim())return null;const g=Nu(f.trim());if(!g||g.length!==u.length)return null;d.push(g)}n.push({name:i[1]??"",columns:u,rows:d})}return n.length>0?n:null}function zt(e){return/^[A-Za-z0-9_-]+$/.test(e)&&e.length>0}function kS(e){const t=new TextEncoder().encode(e);return btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function mr(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";const n=atob(t),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return new TextDecoder().decode(r)}const Mr=/[^\s"'`<>&,:;()[\]{}=|]+/g,Ar=/(?:^|\s)((?:\/(?!\/)|[A-Za-z]:[\\/])\S+)/g,$u=/[.!?]+$/;function Du(e){const t=[];Ar.lastIndex=0;let n=Ar.exec(e);for(;n!==null;){const i=n[1];if(i){const l=n.index+n[0].length-i.length;t.push({end:l+i.length,kind:"absolute",start:l,text:i})}n=Ar.exec(e)}const r=[...t];let s=0;Mr.lastIndex=0;let o=Mr.exec(e);for(;o!==null;){const l=o[0].replace($u,""),u=o.index,d=u+l.length;for(;t[s]&&t[s].end<=u;)s+=1;const h=t[s],f=!!h&&u<h.end&&d>h.start;l&&!l.startsWith("/")&&!f&&r.push({end:d,kind:"relative",start:u,text:l}),o=Mr.exec(e)}return r.sort((i,l)=>i.start-l.start)}const jr=typeof Intl.Segmenter=="function"?new Intl.Segmenter("und",{granularity:"grapheme"}):null,Co=String.fromCodePoint(8205);function Bu(e){for(let t=0;t<e.length;t+=1)if(e.charCodeAt(t)>127)return!1;return!0}function Fu(e,t){const n=[],r=[],s=[];let o=null;for(let i=0;i<e.length;i+=1){const l=e.charCodeAt(i);if(l===32||l>=9&&l<=13){o??(o=i);continue}o!==null&&(n.push(" "),r.push(o),s.push(i),o=null),n.push(t&&l>=65&&l<=90?String.fromCharCode(l+32):e[i]),r.push(i),s.push(i+1)}return o!==null&&(n.push(" "),r.push(o),s.push(e.length)),{chars:n,ends:s,starts:r}}function ko(e){return e>=4352&&e<=4447||e>=43360&&e<=43388?"L":e>=4448&&e<=4519||e>=55216&&e<=55238?"V":e>=4520&&e<=4607||e>=55243&&e<=55291?"T":e>=44032&&e<=55203?(e-44032)%28===0?"LV":"LVT":null}function Ou(e){const t=[];let n="",r=0,s;for(const o of e){const i=r+n.length,l=s?ko(s.codePointAt(0)):null,u=ko(o.codePointAt(0)),d=l==="L"&&(u==="L"||u==="V"||u==="LV"||u==="LVT")||(l==="LV"||l==="V")&&(u==="V"||u==="T")||(l==="LVT"||l==="T")&&u==="T";!(n.length>0&&(new RegExp("\\p{Mark}","u").test(o)||o===Co||s===Co||d))&&n&&(t.push({index:r,segment:n}),r+=n.length,n="",s=void 0),n||(r=i),n+=o,s=o}return n&&t.push({index:r,segment:n}),t}function Hu(e){return(jr==null?void 0:jr.segment(e))??Ou(e)}function Uu(e,t){const n=e.normalize("NFKC");return t?n.toLowerCase().replaceAll("ς","σ"):n}function da(e,t){if(Bu(e))return Fu(e,t);const n=[],r=[],s=[];let o=null,i=0;const l=()=>{o!==null&&(n.push(" "),r.push(o),s.push(i),o=null)};for(const u of Hu(e)){const d=u.index,h=d+u.segment.length;if(/^\s+$/u.test(u.segment)){o??(o=d),i=h;continue}l();for(const f of Uu(u.segment,t))n.push(f),r.push(d),s.push(h)}return l(),{chars:n,ends:s,starts:r}}function Vu(e){return da(e,!0)}function zu(e){return da(e,!1).chars.join("").trim()}function Lo(e){return e===void 0||!/[-\u2010\u2011]/u.test(e)&&/[\p{White_Space}\p{P}]/u.test(e)}class qu{constructor(t){oe(this,"boundaryIndexes");oe(this,"occupiedSegments");const n=Array.from(new Set(t.flatMap(r=>[r.start,r.end]))).sort((r,s)=>r-s);this.boundaryIndexes=new Map(n.map((r,s)=>[r,s])),this.occupiedSegments=new Uint32Array(n.length+1)}overlaps(t,n){const r=this.boundaryIndexes.get(t),s=this.boundaryIndexes.get(n);return this.prefixSum(s)>this.prefixSum(r)}add(t,n){const r=this.boundaryIndexes.get(t),s=this.boundaryIndexes.get(n);for(let o=r;o<s;o+=1)this.addSegment(o)}addSegment(t){for(let n=t+1;n<this.occupiedSegments.length;n+=n&-n)this.occupiedSegments[n]+=1}prefixSum(t){let n=0;for(let r=t;r>0;r-=r&-r)n+=this.occupiedSegments[r]??0;return n}}function Wu(e,t){return t.visibleCodePoints-e.visibleCodePoints||t.requiredBoldCodePoints-e.requiredBoldCodePoints||e.glossaryOrder-t.glossaryOrder||e.rowOrder-t.rowOrder||e.alternativeOrder-t.alternativeOrder||e.start-t.start||e.end-t.end}function Ku(e,t){var u,d,h,f,g,m;if(!e||t.nodes.length===0||t.terminals.length===0)return[];const n=Vu(e),r=[],s=new Map;let o=0;for(let p=0;p<n.chars.length;p+=1){const y=n.chars[p];if(y!==void 0){for(;o!==0&&((u=t.nodes[o])==null?void 0:u.transitions[y])===void 0;)o=((d=t.nodes[o])==null?void 0:d.failure)??0;o=((h=t.nodes[o])==null?void 0:h.transitions[y])??((f=t.nodes[0])==null?void 0:f.transitions[y])??0;for(const b of((g=t.nodes[o])==null?void 0:g.outputs)??[]){const v=t.terminals[b];if(!v)continue;const _=p-v.codePointLength+1;if(_<0||!Lo(n.chars[_-1])||!Lo(n.chars[p+1]))continue;const C=n.starts[_],S=n.ends[p];if(C===void 0||S===void 0)continue;const L=e.slice(C,S);if((m=v.caseSensitiveForms)!=null&&m.length){let x=s.get(b);if(x||(x=new Set(v.caseSensitiveForms),s.set(b,x)),!x.has(zu(L)))continue}r.push({alternativeOrder:v.alternativeOrder,definitionText:v.definitionText,end:S,glossaryOrder:v.glossaryOrder,requiredBoldCodePoints:v.requiredBoldCodePoints,rowOrder:v.rowOrder,start:C,terminalIndex:b,visibleCodePoints:Array.from(L).length})}}}r.sort(Wu);const i=[],l=new qu(r);for(const p of r)l.overlaps(p.start,p.end)||(l.add(p.start,p.end),i.push(p));return i.sort((p,y)=>p.start-y.start||p.end-y.end),i.map(({definitionText:p,end:y,start:b,terminalIndex:v})=>({definitionText:p,end:y,start:b,terminalIndex:v}))}const Gu=5e3,fa={status:null,error:null},ha=ta({endpoint:"public-shares/status"}),Qu=["refresh","reconnect"],Zn=new Map,Gr=new Set,Tr=new Map;function ma(){for(const e of Array.from(Gr))e()}function Xu(e){return Gr.add(e),()=>{Gr.delete(e)}}function pa(e){return Zn.get(e)??fa}function Yu(e,t,n){const r=Zn.get(e);(r==null?void 0:r.observedAt)!==void 0&&r.observedAt>n||r!==void 0&&JSON.stringify(r.status)===JSON.stringify(t)&&r.error===null||(Zn.set(e,{status:t,observedAt:n,error:null}),ma())}function Ju(e,t){const n=pa(e);Zn.set(e,{...n,error:t instanceof Error?t.message:"Failed to load share status"}),ma()}function ga(){return ue.getPublicShareStatus()}function wa(e,t){Yu(t.sourceKey,e,t.requestStartedAt)}function Zu(e,t){return na({sourceKey:e,key:ha,force:t,fetcher:ga,applySnapshot:wa})}function ya(e,t){t.retainedCount<=0||t.timer||(t.timer=setTimeout(()=>{t.timer=null,Zu(e,!0).catch(n=>{Ju(e,n)}).finally(()=>{ya(e,t)})},Gu))}function ed(e){let t=Tr.get(e);t||(t={retainedCount:0,timer:null},Tr.set(e,t)),t.retainedCount+=1,ya(e,t);let n=!1;return()=>{n||(n=!0,t.retainedCount=Math.max(0,t.retainedCount-1),t.retainedCount===0&&(t.timer&&clearTimeout(t.timer),Tr.delete(e)))}}function td(e){return c.useSyncExternalStore(Xu,()=>pa(e),()=>fa)}function nd(e={}){const{poll:t=!1}=e,n=vn();Zi();const r=!0,s=td(n);c.useEffect(()=>{if(!(!t||!r))return ed(n)},[t,r,n]);const{loading:o,error:i,refetch:l}=ea({sourceKey:n,key:ha,bootstrapTier:"supplementary",ready:r,hasData:s.observedAt!==void 0,revalidateOn:Qu,fetcher:ga,applySnapshot:wa});return{status:s.status,loading:o,error:s.error??(i?i.message:null),refresh:async()=>{await l()}}}const Wn=ws(Ee.questionReminderTurns,3,e=>{const t=Number(e);return Number.isInteger(t)&&t>=0&&t<=12?t:void 0});function LS(e){if(!Number.isInteger(e)||e<0||e>12)throw new RangeError("Question reminder turns must be an integer from 0 to 12");Wn.set(e)}function rd(){return c.useSyncExternalStore(Wn.subscribe,Wn.read,Wn.read)}const sd=El({draft:wo(),dismissed:Rr(),seen:Rr(),answer:wo().nullable(),quoted:Rr().optional(),edits:Cl().nonnegative()}),Qr={draft:"",dismissed:!1,seen:!1,answer:null,edits:0};function vs(e){return(e==null?void 0:e.answer)!=null||(e==null?void 0:e.quoted)===!0}const Xr=new Map,va=new Set;let ba=0,Ro=0;function RS(e,t){return`yep-async-questions:${e}:${t}`}function bs(e){if(e)try{const t=sd.safeParse(JSON.parse(e));return t.success?t.data:void 0}catch{return}}function od(e){const t={};try{for(let n=0;n<localStorage.length;n++){const r=localStorage.key(n);if(!(r!=null&&r.startsWith(`${e}:`)))continue;const s=bs(localStorage.getItem(r));s&&(t[r.slice(e.length+1)]=s)}}catch{}return t}function qt(e){let t=Xr.get(e);return t||(t={records:od(e),listeners:new Set},Xr.set(e,t)),t}function Yr(e,t,n=!0){const r=qt(e);r.records=t;for(const s of r.listeners)s();if(n){ba++;for(const s of va)s()}}function Mo(e){var t;if(!(e.key!==null&&!e.key.startsWith("yep-async-questions:"))){for(const n of Xr.keys())if(e.key===null)Yr(n,{});else if(e.key.startsWith(`${n}:`)){const r=e.key.slice(n.length+1),s={...qt(n).records},o=bs(e.newValue);o?s[r]={...o,edits:Math.max(o.edits,((t=s[r])==null?void 0:t.edits)??0)}:delete s[r],Yr(n,s)}}}function xa(e,t){return Ro++===0&&window.addEventListener("storage",Mo),e.add(t),()=>{e.delete(t),--Ro===0&&window.removeEventListener("storage",Mo)}}function MS(e){return qt(e).records}function id(e,t,n){const r=qt(e),s=r.records[t]??Qr;let o=s;try{o=bs(localStorage.getItem(`${e}:${t}`))??o}catch{}const i={...o,...n,edits:Math.max(s.edits,o.edits,n.edits??0)};try{localStorage.setItem(`${e}:${t}`,JSON.stringify(i))}catch{}const l={...r.records,[t]:i},u=s.answer!==i.answer||s.quoted!==i.quoted||s.dismissed!==i.dismissed||s.seen!==i.seen||s.edits!==i.edits;return Yr(e,l,u),l}function ad(e){return c.useSyncExternalStore(t=>xa(qt(e).listeners,t),()=>qt(e).records)}const cd=e=>xa(va,e),ld=()=>ba;function AS(){return c.useSyncExternalStore(cd,ld)}function ud(e){return{countTurns:e,countEdits:Math.round(e*160/3),overflowTurns:Math.ceil(e*8/3),overflowEdits:e*200}}function er(e,t,n=3){const r=ud(n);return e>=r.overflowTurns||t>=r.overflowEdits?"retired":e>=r.countTurns||t>=r.countEdits?"quiet":"recent"}function dd(e){const t=[],n=new Set,r=new Set;for(let s=e.length-1;s>=0;s--){const o=e[s];if(o.type==="user_prompt"&&r.add(o.id),o.type==="text")for(const i of o.sourceMessages){const l=Xl(i);if(!l||i.codexAgentMessageDelivery!=="async")continue;const u=i.codexAsyncQuestions;if(u)for(let d=u.length-1;d>=0;d--){const h=u[d],f=JSON.stringify([l,d]);n.has(f)||(n.add(f),t.push({id:f,messageId:l,renderId:o.id,index:d,title:h.title,options:h.options??[],age:r.size}))}}}return t.reverse()}function Jr(e){return e.split(`
6
- `).map(t=>`> ${t}`).join(`
7
- `)}function tr(e){const t=e.sourceElement.closest("[data-render-id]"),n=t==null?void 0:t.dataset.renderId,s=(t?Array.from(t.querySelectorAll('[data-markdown-copy-source="true"]')):[]).indexOf(e.sourceElement);return{id:kl(),sourceElement:e.sourceElement,...n?{renderId:n}:{},...s>=0?{sourceIndex:s}:{},range:e.range,selectedText:e.selectedText,quotedText:Jr(e.markdown),lineSignatures:gd(e.markdown),sourceStart:e.sourceStart,sourceEnd:e.sourceEnd,sourceLocation:e.sourceLocation}}function fd(e,t){if(e.sourceElement.isConnected)return!0;if(!t||!e.renderId||e.sourceIndex===void 0)return!1;const n=Array.from(t.querySelectorAll("[data-render-id]")).find(s=>s.dataset.renderId===e.renderId),r=n==null?void 0:n.querySelectorAll('[data-markdown-copy-source="true"]')[e.sourceIndex];return r?(e.sourceElement=r,!0):!1}function hd(e){if(e.sourceStart!==void 0&&e.sourceEnd!==void 0){const t=Jl(e.sourceElement,{start:e.sourceStart,end:e.sourceEnd});if(t)return t}return vd(e.range)?e.range:xd(e.sourceElement,e.selectedText)}function md(e){return new Set(e.split(`
8
- `).filter(wd).map(Sa).filter(Boolean))}function pd(e,t){return t.lineSignatures.length===0?!1:t.lineSignatures.some(n=>e.has(n))}function jS(e,t,n){var i;if(e===t)return{mayAffectQuoteAnchors:!1};if(!n||(i=n.inputType)!=null&&i.startsWith("history"))return{mayAffectQuoteAnchors:!0};const r=gn(n.start,e.length),s=Math.max(r,gn(n.end,e.length)),o=n.insertedText;return{mayAffectQuoteAnchors:Ao(e,r,s)||Ao(t,r,r+o.length)}}function gd(e){return e.split(`
9
- `).map(Sa).filter(Boolean)}function wd(e){return/^[\t ]*>/.test(e)}function Sa(e){return e.replace(/^[\t ]*>\s?/,"").replace(/\s+/g," ").trim()}function gn(e,t){return Number.isFinite(e)?Math.max(0,Math.min(t,Math.trunc(e))):0}function Ao(e,t,n){if(!e)return!1;const r=gn(t,e.length),s=Math.max(r,gn(n,e.length));if(Pn(e,r)||s>r&&Pn(e,s-1)||s<e.length&&Pn(e,s))return!0;for(let o=r;o<s;o+=1)if(e[o]===`
10
- `&&Pn(e,o+1))return!0;return!1}function Pn(e,t){if(!e)return!1;const n=gn(t,e.length),r=Math.max(0,n-1),s=e.lastIndexOf(`
11
- `,r)+1;return yd(e,s)}function yd(e,t){for(let n=t;n<e.length;n+=1){const r=e[n];if(!(r===" "||r===" "))return r===">"}return!1}function vd(e){return e.collapsed||!e.startContainer.isConnected||!e.endContainer.isConnected?!1:typeof e.getClientRects!="function"?!0:e.getClientRects().length>0}function bd(e){const n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:o=>o.textContent&&o.textContent.length>0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT});let r="";const s=[];for(let o=n.nextNode();o;o=n.nextNode()){const i=o,l=i.textContent??"";for(let u=0;u<=l.length;u+=1)s[r.length+u]={node:i,offset:u};r+=l}return r?{text:r,positions:s}:null}function xd(e,t){if(!e.isConnected)return null;const n=bd(e);if(!n)return null;const r=n.text.indexOf(t);if(r>=0)return jo(e,n.positions,r,r+t.length);const s=To(n.text),o=To(t);if(!o.text)return null;const i=s.text.indexOf(o.text);if(i<0)return null;const l=i+o.text.length-1,u=s.map[i],d=s.map[l];return u===void 0||d===void 0?null:jo(e,n.positions,u,d+1)}function jo(e,t,n,r){const s=t[n],o=t[r];if(!s||!o)return null;const i=e.ownerDocument.createRange();return i.setStart(s.node,s.offset),i.setEnd(o.node,o.offset),i}function To(e){let t="";const n=[];let r=null;for(let s=0;s<e.length;s+=1){const o=e[s]??"";if(/\s/.test(o)){t.length>0&&r===null&&(r=s);continue}r!==null&&(t+=" ",n.push(r),r=null),t+=o,n.push(s)}return{text:t,map:n}}const _a=c.createContext(null),xs=()=>c.useContext(_a);function TS({storageKey:e,draftSignal:t,send:n,quote:r,focusComposer:s,target:o,children:i}){const l=rd(),[u,d]=c.useState([]),h=ad(e),f=c.useRef(h);c.useEffect(()=>{var T,Q;const F={...h};for(const G of L.current)F[G]={...F[G]??Qr,edits:Math.max(((T=F[G])==null?void 0:T.edits)??0,((Q=f.current[G])==null?void 0:Q.edits)??0)};f.current=F},[h]);const g=c.useRef(u),[m,p]=c.useState(null),[y,b]=c.useState(null),[v,_]=c.useState(null),C=c.useRef(!1),S=c.useRef(0),L=c.useRef(new Set),[x,E]=c.useState(!1),w=c.useRef(null),R=c.useRef(null),[j,N]=c.useState(null),A=c.useRef({send:n,quote:r,focusComposer:s});A.current={send:n,quote:r,focusComposer:s};const k=c.useCallback((F,T)=>{var G;const Q=id(e,F,{...T,edits:Math.max(((G=f.current[F])==null?void 0:G.edits)??0,T.edits??0)});f.current={...f.current,[F]:Q[F]},L.current.delete(F)},[e]),M=c.useCallback(()=>{for(const F of L.current)k(F,{edits:f.current[F].edits})},[k]),P=c.useCallback((F,T)=>{k(F,T)},[k]),I=c.useCallback(F=>{const T=dd(F);JSON.stringify(T)!==JSON.stringify(g.current)&&(g.current=T,d(T))},[]);c.useEffect(()=>{let F=t.getDraft();return t.subscribeDraftChanges(({text:T})=>{const Q=T!==F;if(F=T,!Q||!T)return;let G=!1;const X={...f.current};for(const B of g.current){const q=X[B.id]??Qr;if(q.dismissed||vs(q))continue;const Z=Math.min(2400,q.edits+1);Z!==q.edits&&(L.current.add(B.id),G||(G=er(B.age,Z,l)!==er(B.age,q.edits,l)),X[B.id]={...q,edits:Z})}f.current=X,G&&M()})},[t,M,l]),c.useEffect(()=>{M()},[l,M]),c.useEffect(()=>{const F=()=>{document.hidden&&M()};return document.addEventListener("visibilitychange",F),window.addEventListener("pagehide",M),()=>{M(),document.removeEventListener("visibilitychange",F),window.removeEventListener("pagehide",M)}},[M]);const $=c.useCallback(F=>{var T,Q,G;S.current++,R.current??(R.current=((T=w.current)==null?void 0:T.capture())??null),N(((G=(Q=R.current)==null?void 0:Q.anchor)==null?void 0:G.id)??null),E(!1),p(F.id),b({renderId:F.renderId,questionId:F.id,token:S.current})},[]),H=c.useRef(null);c.useEffect(()=>{if(!o||H.current===o.token)return;const F=u.find(T=>T.messageId===o.messageId&&T.index===o.index);F&&(H.current=o.token,R.current={atBottom:!0,following:!0,scrollTop:0,scrollHeight:0,clientHeight:0,updatedAtMs:Date.now()},$(F))},[o,u,$]);const V=c.useCallback(()=>{var T;S.current++,p(null),b(null);const F=R.current;R.current=null,N(null),F&&((T=w.current)==null||T.restore(F)),A.current.focusComposer()},[]),O=c.useCallback(async(F,T)=>{var B;if(!T.trim()||C.current)return!1;const Q=S.current;R.current??(R.current=((B=w.current)==null?void 0:B.capture())??null),C.current=!0,_(F.id);let G=!1;const X=q=>{var ne;const Z=q.target;Z instanceof Element&&q.type!=="wheel"&&((ne=Z.closest("[data-async-question-reply]"))==null?void 0:ne.dataset.asyncQuestionReply)===F.id||(G=!0)};document.addEventListener("pointerdown",X,!0),document.addEventListener("focusin",X,!0),document.addEventListener("wheel",X,{capture:!0,passive:!0});try{const q=await A.current.send(`${Jr(F.title)}
12
-
13
- ${T}`);return q&&(P(F.id,{answer:T,draft:"",seen:!0}),!G&&Q===S.current?V():Q===S.current&&(p(null),b(null),N(null),R.current=null)),q}finally{C.current=!1,_(null),document.removeEventListener("pointerdown",X,!0),document.removeEventListener("focusin",X,!0),document.removeEventListener("wheel",X,!0)}},[V,P]),K=c.useCallback(F=>{$(F),p(null),N(null),R.current=null,A.current.quote(`${Jr(F.title)}
14
-
15
- `),P(F.id,{quoted:!0,seen:!0})},[$,P]),Y=c.useMemo(()=>{const F=u.find(T=>T.id===m);return[...F?[F.renderId]:[],...j?[j]:[]]},[u,m,j]),te=c.useMemo(()=>({reminderTurns:l,questions:u,records:h,activeId:m,navigationTarget:y,submittingId:v,menuOpen:x,retainedRenderIds:Y,setMenuOpen:E,observe:I,navigation:w,open:$,returnToPrevious:V,update:P,submit:O,quote:K}),[l,u,h,m,y,v,x,Y,I,$,V,P,O,K]);return a.jsx(_a.Provider,{value:te,children:i})}const Sd="_indicator_u9558_1",_d="_recent_u9558_17",Ed="_overflowEntry_u9558_22",Cd="_menu_u9558_28",kd="_menuHeading_u9558_42",Ld="_groupHeading_u9558_48",Rd="_questionList_u9558_53",Md="_menuRow_u9558_60",Ad="_turnAge_u9558_67",jd="_previewBox_u9558_73",Td="_preview_u9558_73",Pd="_previewText_u9558_95",Nd="_unseen_u9558_100",Id="_dismiss_u9558_106",$d="_rowMenu_u9558_117",Dd="_secondary_u9558_134",Bd="_inlineQuestion_u9558_144",Fd="_activeQuestion_u9558_151",Od="_questionTitle_u9558_154",Hd="_hint_u9558_158",Ud="_options_u9558_163",Vd="_iconAction_u9558_190",zd="_replyForm_u9558_201",qd="_replyActions_u9558_216",Wd="_send_u9558_222",Kd="_sent_u9558_230",Gd="_error_u9558_235",re={indicator:Sd,recent:_d,overflowEntry:Ed,menu:Cd,menuHeading:kd,groupHeading:Ld,questionList:Rd,menuRow:Md,turnAge:Ad,previewBox:jd,preview:Td,previewText:Pd,unseen:Nd,dismiss:Id,rowMenu:$d,secondary:Dd,inlineQuestion:Bd,activeQuestion:Fd,questionTitle:Od,hint:Hd,options:Ud,iconAction:Vd,replyForm:zd,replyActions:qd,send:Wd,sent:Kd,error:Gd},Nn=tt(Ee.glossaryHints,!1);function Qd(){return{glossaryHintsEnabled:c.useSyncExternalStore(Nn.subscribe,Nn.read,Nn.read),setGlossaryHintsEnabled:Nn.set}}const Xd="",Yd=32,Jd=32*1024*1024,In={state:"idle"};function Po(e,t){return e!==null&&t!==null&&e.epoch===t.epoch&&e.sequence===t.sequence}function Pr(e){if(e===void 0)return Xd;const t=e.replaceAll("\\","/").replace(/^\.\//,"");if(!t||t.startsWith("/")||t.includes("\0"))return null;const n=[];for(const r of t.split("/"))if(!(!r||r===".")){if(r==="..")return null;n.push(r)}return n.join("/")||null}function Zd(e){const t="/GLOSSARY.md";return e.endsWith(t)?e.slice(0,-t.length):""}function ef(e,t){return t?e===t||(e==null?void 0:e.startsWith(`${t}/`))===!0:!0}function tf(e){if(!e||typeof e!="object"||!("type"in e))return!1;const t=e.type;return t==="glossary-paths-snapshot"||t==="glossary-path-changed"}function nf(e){return e===void 0?0:new TextEncoder().encode(JSON.stringify(e)).byteLength}class rf{constructor(t={}){oe(this,"active",null);oe(this,"stream",null);oe(this,"paths",new Set);oe(this,"pathsReady",!1);oe(this,"generation",null);oe(this,"entries",new Map);oe(this,"listeners",new Map);oe(this,"activationSerial",0);oe(this,"accessSerial",0);oe(this,"maxInactiveArtifacts");oe(this,"maxInactiveBytes");this.maxInactiveArtifacts=Math.max(0,Math.floor(t.maxInactiveArtifacts??Yd)),this.maxInactiveBytes=Math.max(0,Math.floor(t.maxInactiveBytes??Jd))}activate(t,n){var s;if(((s=this.active)==null?void 0:s.projectId)===t&&this.active.transport===n)return;this.active&&this.deactivate();const r=++this.activationSerial;this.active={projectId:t,transport:n,activationSerial:r},this.stream=Ll(n,{subscribe:({transport:o,handlers:i})=>o.subscribeGlossary(t,i),onEvent:o=>{var i;((i=this.active)==null?void 0:i.activationSerial)===r&&tf(o.data)&&this.handleSubscriptionEvent(o.data)}},{inactivityTimeoutMs:Rl})}deactivate(){var t;(t=this.stream)==null||t.close(),this.stream=null,this.active=null,this.paths.clear(),this.pathsReady=!1,this.generation=null;for(const n of this.entries.values())n.requestSerial+=1;this.entries.clear(),this.emitAll()}getSnapshot(t){const n=Pr(t);if(n===null)return In;const r=this.entries.get(n);return r?(this.touch(r),r.snapshot):In}subscribe(t,n){const r=Pr(t);if(r===null)return()=>{};let s=this.listeners.get(r);s||(s=new Set,this.listeners.set(r,s)),s.add(n);const o=this.entries.get(r);return o&&this.touch(o),()=>{const i=this.listeners.get(r);if(i&&(i.delete(n),i.size===0)){this.listeners.delete(r);const l=this.entries.get(r);l&&(l.requested=!1,this.touch(l)),this.pruneInactiveEntries()}}}ensure(t){const n=Pr(t);if(n===null)return;const r=this.getOrCreateEntry(n);r.requested=!0,this.touch(r),this.ensureEntry(n,r)}diagnostics(){var r;let t=0,n=0;for(const[s,o]of this.entries)this.isPinned(s,o)||(t+=1,n+=o.estimatedBytes);return{activeProjectId:((r=this.active)==null?void 0:r.projectId)??null,artifacts:this.entries.size,glossaryPaths:this.paths.size,inactiveArtifacts:t,inactiveBytes:n,pathsReady:this.pathsReady}}handleSubscriptionEvent(t){t.type==="glossary-paths-snapshot"?this.handleSnapshot(t):this.handlePathChange(t)}handleSnapshot(t){const n=this.pathsReady,r=n&&!Po(this.generation,t.generation);this.paths=new Set(t.paths),this.pathsReady=!0,this.generation=t.generation,n?r&&this.invalidateEntries(()=>!0):this.invalidateEntries(s=>s.snapshot.state==="loading"),this.ensureRequestedEntries(),this.pruneInactiveEntries()}handlePathChange(t){var s;const n=(((s=this.generation)==null?void 0:s.sequence)??-1)+1,r=!this.generation||this.generation.epoch!==t.generation.epoch||t.generation.sequence!==n;if(t.changeType==="delete"?this.paths.delete(t.path):this.paths.add(t.path),this.pathsReady=!0,this.generation=t.generation,r||t.changeType==="create")this.invalidateEntries(()=>!0);else{const o=Zd(t.path);this.invalidateEntries(i=>(i.snapshot.result&&"dependencies"in i.snapshot.result?i.snapshot.result.dependencies:[]).some(d=>d.path===t.path)||t.changeType==="delete"&&ef(i.sourcePath,o))}this.ensureRequestedEntries(),this.pruneInactiveEntries()}invalidateEntries(t){for(const[n,r]of this.entries)t(r)&&(r.requestSerial+=1,r.snapshot=In,r.estimatedBytes=0,this.emit(n))}ensureRequestedEntries(){for(const[t,n]of this.entries)n.requested&&this.ensureEntry(t,n)}ensureEntry(t,n){if(!this.active||n.snapshot.state==="loading"||n.snapshot.state==="ready"||n.snapshot.state==="none"||n.snapshot.state==="disabled")return;const r=this.findReusableRootEntry(n);if(r){n.snapshot=r.snapshot,n.estimatedBytes=r.estimatedBytes,this.touch(n),this.emit(t);return}const s=this.active,o=this.generation,i=++n.requestSerial;n.snapshot={state:"loading"},n.estimatedBytes=0,this.emit(t);const l=new URLSearchParams;n.sourcePath!==void 0&&l.set("sourcePath",n.sourcePath);const u=l.size>0?`?${l.toString()}`:"";s.transport.fetch(`/projects/${encodeURIComponent(s.projectId)}/glossary-artifact${u}`).then(d=>{this.active!==s||n.requestSerial!==i||o!==null&&!Po(o,this.generation)||(n.snapshot={state:d.status,result:d},n.estimatedBytes=nf(d),this.touch(n),this.emit(t),this.pruneInactiveEntries())}).catch(d=>{this.active!==s||n.requestSerial!==i||(n.snapshot={state:"error",error:d instanceof Error?d:new Error(String(d))},n.estimatedBytes=0,this.touch(n),this.emit(t),this.pruneInactiveEntries())})}findReusableRootEntry(t){if(t.sourcePath!==void 0||!this.pathsReady)return null;for(const n of this.entries.values()){if(n===t)continue;const r=n.snapshot.result;if((n.snapshot.state==="ready"||n.snapshot.state==="disabled")&&r&&"governingPath"in r&&r.governingPath==="GLOSSARY.md")return n}return null}getOrCreateEntry(t){const n=this.entries.get(t);if(n)return n;const r={sourcePath:t||void 0,snapshot:In,requested:!1,requestSerial:0,lastUsedSerial:++this.accessSerial,estimatedBytes:0};return this.entries.set(t,r),r}touch(t){t.lastUsedSerial=++this.accessSerial}isPinned(t,n){return n.requested||n.snapshot.state==="loading"||this.listeners.has(t)}pruneInactiveEntries(){const t=Array.from(this.entries.entries()).filter(([s,o])=>!this.isPinned(s,o)).sort(([,s],[,o])=>s.lastUsedSerial-o.lastUsedSerial);let n=t.length,r=t.reduce((s,[,o])=>s+o.estimatedBytes,0);for(const[s,o]of t){if(n<=this.maxInactiveArtifacts&&r<=this.maxInactiveBytes)break;this.entries.delete(s),n-=1,r-=o.estimatedBytes}}emit(t){for(const n of this.listeners.get(t)??[])n()}emitAll(){for(const t of this.listeners.values())for(const n of t)n()}}const sf={state:"idle"},Zr=c.createContext(null);function of(e,t){if(!t||!zt(e))return t;const n=t.replaceAll("\\","/"),r=mr(e).replaceAll("\\","/");if(n.startsWith(`${r}/`))return n.slice(r.length+1);if(!(n.startsWith("/")||/^[A-Za-z]:\//.test(n)))return t}function af({children:e,enabled:t=!0,projectId:n}){const r=c.useContext(Zr),s=ct(),{glossaryHintsEnabled:o}=Qd(),{version:i}=ra(),l=c.useMemo(()=>new rf,[]),u=(r==null?void 0:r.projectId)===n?r.store:null,h=u===null&&t&&o&&zt(n)&&Vt(i,Ml);c.useLayoutEffect(()=>{if(!h||!zt(n)){l.deactivate();return}return l.activate(n,s.transport),()=>l.deactivate()},[l,h,n,s.transport]);const f=c.useMemo(()=>u?{projectId:n,store:u}:h?{projectId:n,store:l}:null,[u,l,h,n]);return a.jsx(Zr.Provider,{value:f,children:e})}function No({children:e,projectId:t}){return a.jsx(af,{projectId:t,children:e})}function Ea(e){const t=c.useContext(Zr),n=of((t==null?void 0:t.projectId)??"",e),r=c.useCallback(i=>(t==null?void 0:t.store.subscribe(n,i))??(()=>{}),[t,n]),s=c.useCallback(()=>(t==null?void 0:t.store.getSnapshot(n))??sf,[t,n]),o=c.useSyncExternalStore(r,s,s);return c.useEffect(()=>{t==null||t.store.ensure(n)},[t,n]),o}const cf="_host_n1tgc_4",lf={host:cf},Ca='<svg class="render-mode-glyph" width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true"><text x="8" y="8.1" text-anchor="middle" dominant-baseline="central" font-family="KaTeX_Main, Times New Roman, serif" font-size="12.5" font-weight="500" fill="currentColor">Σ</text></svg>';function uf(){return a.jsx("span",{className:lf.host,dangerouslySetInnerHTML:{__html:Ca}})}const df={dark:"dark",light:"neutral"};let Nr=null,Io=null,ff=0;async function hf(){return Nr||(Nr=Al(()=>import("./mermaid.core-CdC8AeOx.js").then(e=>e.cb),__vite__mapDeps([0,1,2,3])).then(e=>e.default)),Nr}function mf(e,t){Io!==t&&(e.initialize({startOnLoad:!1,securityLevel:"strict",theme:df[t]}),Io=t)}function pf(e){for(const t of document.querySelectorAll(`#${e}, #d${e}`))t.remove()}const gf={language:"mermaid",renderedNoun:"diagram",async render(e){const t=await hf();mf(t,Ki());const n=`ya-mermaid-${++ff}`;try{const{svg:r}=await t.render(n,e);return r}catch{return null}finally{pf(n)}}},ka=new Map;function wf(e){ka.set(e.language,e)}function yf(e){return ka.get(e)}wf(gf);const vf="_root_1l3gc_4",bf={root:vf},xf=bf.root,Sf="pre > code[class*='language-']",_f=/(?:^|\s)language-(\S+)/,Ef=2500,nr="data-ya-code-block",$o="data-ya-code-rendered",Ss="data-ya-code-toggle",Cf=50,on=new Map;function kf(e,t){for(on.set(e,t);on.size>Cf;){const n=on.keys().next();if(n.done)return;on.delete(n.value)}}function Lf(e,t,n){return`${e.language}|${n}|${t.length}|${t}`}function Rf(e,t){e.dataset.yaCodeLanguage!==t&&(e.dataset.yaCodeLanguage=t,e.setAttribute("aria-label",`${t} code block`))}function Mf(e,t){const n=e.createElement("button");return n.type="button",n.setAttribute(Ss,""),n.innerHTML=Ca,n.dataset.yaRenderedNoun=t.renderedNoun,n}function Af(e,t){const n=e.dataset.yaRenderedNoun??"rendered view",r=t?`Show ${n} source`:`Show ${n}`;e.setAttribute("aria-pressed",String(t)),e.setAttribute("aria-label",r),e.title=r}function La(e,t){e.dataset.yaCodeView=t;const n=e.querySelector(`[${Ss}]`);n&&Af(n,t==="rendered")}function jf(e,t,n,r){const s=e.ownerDocument,o=e.parentElement;let i=(o==null?void 0:o.hasAttribute(nr))===!0?o:void 0;i||(i=s.createElement("div"),i.setAttribute(nr,""),e.replaceWith(i),i.append(e),i.append(Mf(s,r)));let l=i.querySelector(`[${$o}]`);l||(l=s.createElement("div"),l.setAttribute($o,""),i.insertBefore(l,e)),l.innerHTML=t,i.dataset.yaRenderKey=n,La(i,i.dataset.yaCodeView==="source"?"source":"rendered")}async function Tf(e,t,n){const r=t.textContent??"";if(r.trim()==="")return;const s=Lf(n,r,Ki()),o=e.closest(`[${nr}]`);if(o instanceof HTMLElement&&o.dataset.yaRenderKey===s||e.dataset.yaRenderAttempt===s)return;e.dataset.yaRenderAttempt=s;let i=on.get(s);i===void 0&&(i=await n.render(r),kf(s,i)),!(i===null||!e.isConnected)&&jf(e,i,s,n)}function Pf(e){var t,n;for(const r of e.querySelectorAll(Sf)){const s=r.parentElement;if(!s)continue;const o=(n=(t=_f.exec(r.className))==null?void 0:t[1])==null?void 0:n.toLowerCase();if(!o)continue;Rf(s,o);const i=yf(o);i&&Tf(s,r,i)}}function Nf(e){c.useEffect(()=>{var h,f,g;const t=e.current;if(!t)return;let n=!1,r;const s=()=>{n=!1,Pf(t)},o=()=>{n||(n=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(s):window.setTimeout(s,0))},i=m=>{const p=m.target;if(!(p instanceof Element))return;const y=p.closest(`[${Ss}]`),b=y==null?void 0:y.closest(`[${nr}]`);if(y&&b instanceof HTMLElement){m.stopPropagation(),m.preventDefault(),La(b,b.dataset.yaCodeView==="source"?"rendered":"source");return}const v=p.closest("pre[data-ya-code-language]");if(v){for(const _ of t.querySelectorAll("pre[data-ya-code-language-shown]"))delete _.dataset.yaCodeLanguageShown;v.dataset.yaCodeLanguageShown="1",window.clearTimeout(r),r=window.setTimeout(()=>{delete v.dataset.yaCodeLanguageShown},Ef)}};s(),t.addEventListener("click",i);const l=new MutationObserver(o);l.observe(t,{childList:!0,subtree:!0});const u=new MutationObserver(o);u.observe(t.ownerDocument.documentElement,{attributeFilter:["data-theme"],attributes:!0});const d=(f=(h=t.ownerDocument.defaultView)==null?void 0:h.matchMedia)==null?void 0:f.call(h,"(prefers-color-scheme: dark)");return(g=d==null?void 0:d.addEventListener)==null||g.call(d,"change",o),()=>{var m;l.disconnect(),u.disconnect(),(m=d==null?void 0:d.removeEventListener)==null||m.call(d,"change",o),t.removeEventListener("click",i),window.clearTimeout(r)}},[e])}const If="_term_a5syx_1",$f={term:If},Df=["a","button","code","input","kbd","pre","samp","script","select","style","textarea","[data-glossary-term]","[data-tooltip]","[title]",".katex"].join(","),Bf=new Set(["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DD","DIV","DL","DT","FIGCAPTION","FIGURE","FOOTER","H1","H2","H3","H4","H5","H6","HEADER","HR","LI","MAIN","NAV","OL","P","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"]);function Ff(e){const t=[];let n=[],r="";const s=()=>{r&&t.push({segments:n,text:r}),n=[],r=""},o=i=>{if(i instanceof Text){if(!i.data)return;const u=r.length;r+=i.data,n.push({start:u,end:r.length,node:i});return}if(!(i instanceof Element))return;if(i.matches(Df)){s();return}const l=Bf.has(i.tagName)||i.tagName==="BR";l&&s();for(const u of i.childNodes)o(u);l&&s()};for(const i of e.childNodes)o(i);return s(),t}function Of(e,t,n,r,s,o){const i=Math.max(t,e.start)-e.start,l=Math.min(n,e.end)-e.start;if(i>=l)return;e.node.splitText(l);const u=e.node.splitText(i),d=document.createElement("span");d.className=$f.term,d.dataset.glossaryTerm="true",d.dataset.glossaryMatch=o,d.title=r,s&&(d.setAttribute("role","button"),d.tabIndex=0),u.replaceWith(d),d.append(u)}function Ra(e,t){if(!t||typeof document>"u"||!e)return{changed:!1,html:e};const n=document.createElement("template");n.innerHTML=e;const r=Ff(n.content);let s=0,o=!1;for(const i of r){const l=Ku(i.text,t);for(let u=l.length-1;u>=0;u-=1){const d=l[u];if(!d)continue;const h=i.segments.filter(g=>g.start<d.end&&d.start<g.end);if(h.length===0)continue;const f=`g${s++}`;for(let g=h.length-1;g>=0;g-=1){const m=h[g];m&&Of(m,d.start,d.end,d.definitionText,g===0,f)}o=!0}}return{changed:o,html:o?n.innerHTML:e}}const es="yep-anywhere-file-viewer-density-zoom",Ma=-4,Aa=6,Hf=.5,Uf=1,Vf={fontSizeOffsetPx:-1,verticalSpacingOffsetPx:-2},zf={fontSizeOffsetPx:0,verticalSpacingOffsetPx:0};function ja(e){return Math.min(Aa,Math.max(Ma,e))}function qf(){if(typeof sessionStorage>"u")return 0;try{const e=Number(sessionStorage.getItem(es));return Number.isFinite(e)?ja(e):0}catch{return 0}}function Wf(e){if(!(typeof sessionStorage>"u"))try{e===0?sessionStorage.removeItem(es):sessionStorage.setItem(es,String(e))}catch{}}function Do(e,t){return{fontSizeOffsetPx:(e.fontSizeOffsetPx??0)+(t.fontSizeOffsetPx??0),verticalSpacingOffsetPx:(e.verticalSpacingOffsetPx??0)+(t.verticalSpacingOffsetPx??0)}}function Kf({fontSizeOffsetPx:e=0,verticalSpacingOffsetPx:t=0}={}){return{"--markdown-preview-font-size-offset":`${e}px`,"--markdown-preview-vspace-offset":`${t}px`}}function Gf({fontSizeOffsetPx:e=0,verticalSpacingOffsetPx:t=0}={}){return{"--source-font-size-offset":`${e}px`,"--source-vspace-offset":`${t}px`}}function Qf(){const[e,t]=c.useState(qf),n=c.useMemo(()=>({fontSizeOffsetPx:e*Hf,verticalSpacingOffsetPx:e*Uf}),[e]),r=c.useCallback(s=>{const o=ja(s);t(o),Wf(o)},[]);return{canZoomIn:e<Aa,canZoomOut:e>Ma,density:n,zoom:e,zoomIn:()=>r(e+1),zoomOut:()=>r(e-1)}}const _s=c.memo(c.forwardRef(function({ariaLabel:t,className:n,density:r,html:s,onClick:o,onContextMenu:i,onKeyDown:l,sourcePath:u},d){const h=["markdown-preview",n].filter(Boolean).join(" "),f=Ea(u),g=c.useMemo(()=>{var y;return f.state!=="ready"||((y=f.result)==null?void 0:y.status)!=="ready"?s:Ra(s,f.result.artifact).html},[f,s]),m=c.useMemo(()=>({__html:g}),[g]),p=c.useRef(null);return Nf(p),a.jsx("div",{className:h,role:"region","aria-label":t??"Markdown preview",onClick:o,onContextMenu:i,onKeyDown:l,ref:d,style:Kf(r),children:a.jsx("div",{className:`markdown-rendered ${xf}`,ref:p,dangerouslySetInnerHTML:m})})}));function Xf({canZoomIn:e,canZoomOut:t,onZoomIn:n,onZoomOut:r,zoom:s}){return a.jsxs("div",{className:"file-viewer-density-controls",role:"group","aria-label":"Source zoom",children:[a.jsx("button",{type:"button",className:"file-viewer-action",onClick:r,disabled:!t,title:"Zoom source and preview out","aria-label":"Zoom source and preview out",children:a.jsx(Yf,{})}),a.jsx("span",{className:"file-viewer-density-value","aria-hidden":"true",children:s>0?`+${s}`:s}),a.jsx("button",{type:"button",className:"file-viewer-action",onClick:n,disabled:!e,title:"Zoom source and preview in","aria-label":"Zoom source and preview in",children:a.jsx(Jf,{})})]})}function Yf(){return a.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:a.jsx("path",{d:"M3 8h10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})}function Jf(){return a.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:a.jsx("path",{d:"M8 3v10M3 8h10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})}function PS(e,t=60){return e.length>t?`${e.slice(0,t)}…`:e}const Ta=/^[a-zA-Z]:\//,Bo=/^([a-zA-Z]):/;function Zf(e){return Ta.test(e)||e.startsWith("//")}function Ue(e){return e.replace(/\\/g,"/").replace(/^\/([a-zA-Z]:\/)/,"$1")}function Wt(e){const t=Ue(e);return t==="/"||/^[a-zA-Z]:\/$/.test(t)?t.replace(Bo,(n,r)=>`${r.toUpperCase()}:`):t.replace(Bo,(n,r)=>`${r.toUpperCase()}:`).replace(/\/+$/,"")}function Fo(e){return Wt(e.trim())}function Oo(e){return Zf(e)?e.toLowerCase():e}function et(e){const t=Ue(e);return t.startsWith("/")||t.startsWith("//")||Ta.test(t)}function pr(e,t){return et(e)?e:t?`${Wt(t)}/${Ue(e).replace(/^\.\/+/,"")}`:null}function eh(e){return Ue(e).replace(/^\.\/+/,"")}function At(e,t){if(!t)return null;const n=Fo(e),r=Fo(t);if(!n||!r)return null;const s=Oo(n),o=Oo(r);if(s===o)return".";const i=`${r}/`,l=`${o}/`;return s.startsWith(l)?n.slice(i.length):null}function Ot(e){const t=Wt(e);if(!t)return e;if(/^[a-zA-Z]:\/$/.test(t)||t==="/")return t;const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n>=0&&t.slice(n+1)||t}function NS(e){const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?{dir:e.slice(0,t+1),name:e.slice(t+1)}:{dir:"",name:e}}function th(e){const t=Ue(e),n=[/^\/home\/[^/]+/,/^\/Users\/[^/]+/,/^[a-zA-Z]:\/Users\/[^/]+/];for(const r of n)if(r.test(t))return t.replace(r,"~");return et(e)?e:eh(e)}function gr(e,t){const n=At(e,t);return n!==null?n:th(e)}const nh=c.createContext(null);function vt(){return c.useContext(nh)}function Ho(e){const t=[];for(const n of e.replaceAll("\\","/").split("/"))if(!(!n||n===".")){if(n===".."){if(t.length===0)return null;t.pop();continue}t.push(n)}return t.length>0?t.join("/"):null}function rh(e){if(!e||!zt(e))return null;try{return Wt(mr(e))}catch{return null}}function Uo(e){try{return decodeURIComponent(e)}catch{return null}}function sh(e){return/(?:^|[\\/])projects\/[a-f0-9]{32}\/attachments(?:[\\/]|$)/i.test(e)}function Lt(e,t){const n=la(e),r=Ue(n.path);if(sh(r))return{lineNumber:n.line,path:r};const s=rh(t),o=At(r,s);if(o===".")return null;if(o!==null){const l=Ho(o);return l?{lineNumber:n.line,path:l}:null}if(r.startsWith("/")||/^[a-zA-Z]:\//.test(r))return null;const i=Ho(r);return i?{lineNumber:n.line,path:i}:null}function Sn(e,t){const n=Lt(t.filePath,e.projectId);if(!n)return null;const r=new URL(`/share/${encodeURIComponent(e.secret)}/file`,t.currentHref??window.location.href);r.searchParams.set("path",n.path),r.searchParams.set("h",e.relayUsername),r.searchParams.set("r",e.relayUrl),e.projectId&&r.searchParams.set("projectId",e.projectId),e.viewerId&&r.searchParams.set("viewerId",e.viewerId),e.standaloneFile&&r.searchParams.set("standalone","1");const s=t.lineNumber??n.lineNumber;return s!==void 0&&r.searchParams.set("line",String(s)),t.lineEnd!==void 0&&r.searchParams.set("lineEnd",String(t.lineEnd)),t.columnNumber!==void 0&&r.searchParams.set("column",String(t.columnNumber)),t.viewMode==="range"&&r.searchParams.set("view","range"),`${r.pathname}${r.search}`}function Pa(e,t,n=window.location.href){let r;try{r=new URL(e,n)}catch{return null}const s=new URL(n);if(r.origin!==s.origin||r.pathname===`/share/${encodeURIComponent(t.secret)}/file`||r.pathname===`/remote/share/${encodeURIComponent(t.secret)}/file`)return null;const o=/^\/projects\/([^/]+)\/file$/.exec(r.pathname);if(o!=null&&o[1]){const l=Uo(o[1]);if(!l||t.projectId&&l!==t.projectId)return null;const u=r.searchParams.get("path");if(!u)return null;const d=Lt(u,t.projectId);return d?{path:d.path,lineEnd:tn(r.searchParams.get("lineEnd")),lineNumber:tn(r.searchParams.get("line"))??d.lineNumber,viewMode:r.searchParams.get("view")==="range"?"range":void 0}:null}const i=/^\/api\/projects\/([^/]+)\/files\/raw$/.exec(r.pathname);if(i!=null&&i[1]){const l=Uo(i[1]);if(!l||t.projectId&&l!==t.projectId)return null;const u=r.searchParams.get("path");if(!u)return null;const d=Lt(u,t.projectId);return d?{path:d.path}:null}if(r.pathname==="/api/local-file"||r.pathname==="/api/local-image"){const l=r.searchParams.get("path");if(!l)return null;const u=Lt(l,t.projectId);return u?{path:u.path,columnNumber:tn(r.searchParams.get("column")),lineEnd:tn(r.searchParams.get("lineEnd")),lineNumber:tn(r.searchParams.get("line"))??u.lineNumber,viewMode:r.searchParams.get("view")==="range"?"range":void 0}:null}return null}function oh(e,t,n=window.location.href){const r=Pa(e,t,n);return r?Sn(t,{currentHref:n,filePath:r.path,columnNumber:r.columnNumber,lineEnd:r.lineEnd,lineNumber:r.lineNumber,viewMode:r.viewMode}):null}function ih(e,t){const n=Lt(t,e.projectId);if(!n)return null;const r=new URLSearchParams({path:n.path});return e.viewerId&&r.set("viewerId",e.viewerId),`/public-api/shares/${encodeURIComponent(e.secret)}/files/raw?${r}`}function ah(e,t,n=window.location.href){for(const r of Array.from(e.querySelectorAll('a[data-ya-private-project-file-link="true"]'))){const s=r.ownerDocument.createElement("code");s.textContent=r.textContent??"",r.replaceWith(s)}for(const r of Array.from(e.querySelectorAll("a[href]"))){const s=r.getAttribute("href");if(!s)continue;const o=oh(s,t,n);o&&s!==o&&(r.setAttribute("href",o),r.setAttribute("data-public-share-file-link","true"))}for(const r of Array.from(e.querySelectorAll("img[src]"))){const s=r.getAttribute("src");if(!s)continue;const o=Pa(s,t,n);o&&r.setAttribute("data-public-share-src-path",o.path)}for(const r of Array.from(e.querySelectorAll(".local-media-inline-preview"))){const s=r.getAttribute("data-media-path");if(!s)continue;const o=Lt(s,t.projectId);o&&r.setAttribute("data-public-share-src-path",o.path)}}function tn(e){if(!e)return;const t=Number(e);return Number.isInteger(t)&&t>0?t:void 0}const Na=c.createContext(null),ch=[];function IS({children:e}){const[t,n]=c.useState("rendered"),[r,s]=c.useState(()=>new Set),[o,i]=c.useState(0),l=c.useCallback((h,f)=>{s(g=>{const m=g.has(h);if(f===m)return g;const p=new Set(g);return f?p.add(h):p.delete(h),p})},[]),u=c.useCallback(()=>{n(h=>h==="rendered"?"source":"rendered"),s(()=>new Set),i(h=>h+1)},[]);c.useEffect(()=>{const h=f=>{f.defaultPrevented||f.isComposing||(f.ctrlKey||f.metaKey)&&f.shiftKey&&!f.altKey&&f.key.toLowerCase()==="m"&&(f.preventDefault(),u())};return window.addEventListener("keydown",h,!0),()=>window.removeEventListener("keydown",h,!0)},[u]);const d=c.useMemo(()=>({globalMode:t,state:r.size>0?"mixed":t,resetVersion:o,toggleGlobalMode:u,setOverrideActive:l}),[t,r.size,o,l,u]);return a.jsx(Na.Provider,{value:d,children:e})}function lh(){return c.useContext(Na)}function uh(e,t={}){const n=lh(),r=t.participateInGlobalMode??!0,s=r&&n?n.globalMode:"rendered",o=r&&n?n.resetVersion:0,i=t.renderWhenDisabled??!0,l=t.resetDependencies??ch,u=c.useRef(l);u.current=l;const d=c.useId(),[h,f]=c.useState(()=>t.initialMode&&t.initialMode!==s?t.initialMode:null),g=c.useRef([e,o,...l]);c.useEffect(()=>{const y=[e,o,...u.current],b=g.current;g.current=y,(y.length!==b.length||y.some((v,_)=>!Object.is(v,b[_])))&&f(null)},[e,o,...l]),c.useEffect(()=>{if(!n||!r)return;const y=e&&h!==null;return n.setOverrideActive(d,y),()=>{n.setOverrideActive(d,!1)}},[e,n,h,r,d]);const m=e?(h??s)==="rendered":i,p=c.useCallback(()=>{e&&f(y=>{const v=(y??s)==="rendered"?"source":"rendered";return v===s?null:v})},[e,s]);return{showRendered:m,toggleLocalMode:p}}const Es=c.createContext(null);function $S({projectId:e,projectPath:t,sessionId:n,sessionTitle:r,provider:s,model:o,thinking:i,effort:l,children:u}){const d=c.useMemo(()=>({projectId:e,projectPath:t,sessionId:n,sessionTitle:r,provider:s,model:o,thinking:i,effort:l}),[e,t,n,r,s,o,i,l]);return a.jsx(Es.Provider,{value:d,children:u})}function DS(){const e=c.useContext(Es);if(!e)throw new Error("useSessionMetadata must be used within SessionMetadataProvider");return e}function Kt(){return c.useContext(Es)}const dh=1e3,Vo="[SessionUITrace]";let it=null;function fh(e){try{return JSON.stringify(e)}catch{return JSON.stringify({unserializable:!0})}}function hh(e,t){if(e==="session-stream-event"){const n=t.eventType,r=t.sdkType;if(n==="message"&&r==="stream_event")return"stream:message:stream_event";if(n==="pending"||n==="markdown-augment")return`stream:${String(n)}`}if(e==="session-stream-dispatch"){const n=t.eventType,r=t.sdkType;if(n==="message"&&r==="stream_event")return"dispatch:message:stream_event";if(n==="pending"||n==="markdown-augment")return`dispatch:${String(n)}`}return null}function Ia(e){eu.record("log",Vo,`${Vo} ${fh(e)}`)}function mh(){const e=it;e&&(it=null,e.timer&&clearTimeout(e.timer),Ia({event:"session-ui-trace-batch",sessionId:e.sessionId,total:e.total,counts:e.counts,windowMs:Date.now()-e.startedAt,firstEventId:e.firstEventId??null,lastEventId:e.lastEventId??null}))}function ph(e,t){it||(it={timer:null,startedAt:Date.now(),total:0,counts:{},sessionId:t.sessionId,firstEventId:t.eventId},it.timer=setTimeout(mh,dh)),it.total+=1,it.counts[e]=(it.counts[e]??0)+1,it.lastEventId=t.eventId}function gh(e,t={}){if(!Zl())return;const n=hh(e,t);if(n){ph(n,t);return}Ia({event:e,...t})}const zo=8;function qo(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function wh(){if(typeof window>"u")return zo;const e=window.__RENDER_PROFILE__;if(e&&typeof e=="object"){const t=e.thresholdMs;if(typeof t=="number"&&Number.isFinite(t))return Math.max(0,t)}return zo}function yh(){return aa()||typeof window<"u"&&window.__RENDER_PROFILE__!==void 0}function $a(e,t,n){if(!yh())return n();const r=qo();try{return n()}finally{const s=qo()-r;if(s>=wh()){const o=typeof t=="function"?t():t,i={name:e,durationMs:Math.round(s*10)/10,...o};gh("render-profile",i),typeof window<"u"&&window.__RENDER_PROFILE__!==void 0&&!aa()&&console.log("[RenderProfile]",i)}}}function ts(e,t){return!e||!t?null:{scrollRoot:e,initialOffset:t.getBoundingClientRect().top-e.getBoundingClientRect().top}}function Da(e,t){if(!e||!t)return;const r=t.getBoundingClientRect().top-e.scrollRoot.getBoundingClientRect().top-e.initialOffset;Math.abs(r)>1&&(e.scrollRoot.scrollTop+=r)}function vh(e,t){const n=c.useRef(null),r=c.useRef(null),s=c.useCallback(()=>{const o=n.current;if(o){let i=o.parentElement;for(;i;){const{overflowY:l}=window.getComputedStyle(i);if(l==="auto"||l==="scroll")break;i=i.parentElement}r.current=ts(i,o)}t()},[t]);return c.useLayoutEffect(()=>{const o=r.current;o&&(r.current=null,Da(o,n.current))},[e]),{btnRef:n,handleClick:s}}const bh=new Set(["A","ABBR","B","BLOCKQUOTE","BR","CAPTION","CITE","CODE","COL","COLGROUP","DD","DEL","DL","DT","EM","FIGCAPTION","FIGURE","H1","H2","H3","H4","H5","H6","HR","I","INS","KBD","LI","MARK","MATH","MENCLOSE","MFENCED","MFRAC","MI","MMULTISCRIPTS","MN","MO","MOVER","MPADDED","MPHANTOM","MROOT","MROW","MS","SEMANTICS","MSPACE","MSQRT","MSTYLE","MSUB","MSUBSUP","MSUP","MTABLE","MTD","MTEXT","MTR","MUNDER","MUNDEROVER","OL","P","PRE","Q","S","SAMP","SMALL","SPAN","STRONG","SUB","SUP","TABLE","TBODY","TD","TFOOT","TH","THEAD","TIME","TR","U","UL","VAR","ANNOTATION"]),xh=new Map([["COL",new Set(["span"])],["COLGROUP",new Set(["span"])],["OL",new Set(["reversed","start","type"])],["TD",new Set(["colspan","rowspan"])],["TH",new Set(["colspan","rowspan","scope"])],["TIME",new Set(["datetime"])]]),Sh="applet, audio, canvas, embed, iframe, object, script, style, svg, template, video",_h=new Set(["COLGROUP","TABLE","TBODY","TFOOT","THEAD","TR"]);function Eh(e,t){return(t.startContainer===e||e.contains(t.startContainer))&&(t.endContainer===e||e.contains(t.endContainer))}function Ch(e){for(const t of e.querySelectorAll(".katex-html"))t.remove()}function kh(e){Ch(e);for(const t of e.querySelectorAll(Sh))t.remove();for(const t of e.querySelectorAll("*")){const n=t.tagName.toUpperCase();if(!bh.has(n)){t.replaceWith(...t.childNodes);continue}const r=xh.get(n);for(const s of t.getAttributeNames())r!=null&&r.has(s.toLowerCase())||t.removeAttribute(s)}}function Lh(e,t){const n=e.cloneContents(),r=e.commonAncestorContainer.nodeType===Node.ELEMENT_NODE?e.commonAncestorContainer:e.commonAncestorContainer.parentElement;if(!r||!_h.has(r.tagName))return n;let s=n,o=r;for(;o&&o!==t;){const l=o.cloneNode(!1);if(l.append(s),s=l,o.tagName==="TABLE")break;o=o.parentElement}const i=t.ownerDocument.createDocumentFragment();return i.append(s),i}function Ba(e){const t=new DOMParser().parseFromString(e,"text/html"),n=t.createRange();return n.selectNodeContents(t.body),wr(t.body,[n])}function wr(e,t){const n=[],r=[];for(const s of t){if(!Eh(e,s))return null;const o=Lh(s,e);kh(o);const i=e.ownerDocument.createElement("div");i.append(o),i.innerHTML&&(n.push(i.innerHTML),r.push(i.textContent??s.toString()))}return n.length===0?null:{html:n.join("<br><br>"),text:r.join(`
16
-
17
- `)}}function Rh(e,t){if(e.defaultPrevented||!e.clipboardData)return!1;const n=t.ownerDocument.getSelection();if(!n||n.isCollapsed||n.rangeCount===0)return!1;const r=[];for(let o=0;o<n.rangeCount;o+=1)r.push(n.getRangeAt(o));const s=wr(t,r);return s?(e.clipboardData.setData("text/html",s.html),e.clipboardData.setData("text/plain",s.text),e.preventDefault(),!0):!1}function Mh(e){const t=e.trim().replace(/^#\s*/,"");return/^acli: 1(?:\s+\+?[a-z][a-z0-9-]*)*$/.test(t)||/^acli-capabilities: (?:[a-z][a-z0-9-]*\/1)(?:\s+[a-z][a-z0-9-]*\/1)*$/.test(t)}function Ah(e){JSON.parse(e);const t=e.match(/"(?:\\.|[^"\\])*"|[{}[\],:]|[^\s{}[\],:]+/g)??[];let n=0,r="";const s=()=>`
18
- ${" ".repeat(n)}`;return t.forEach((o,i)=>{o==="{"||o==="["?(r+=o,n++,t[i+1]!==(o==="{"?"}":"]")&&(r+=s())):o==="}"||o==="]"?(n--,t[i-1]!==(o==="}"?"{":"[")&&(r+=s()),r+=o):o===","?r+=o+s():o===":"?r+=": ":r+=o}),r+(e.endsWith(`
19
- `)?`
20
- `:"")}function jh(e){const t=new mu,n=[...t.append(e),...t.finish()];let r;return n.map(s=>{var i;const o=(i=/^\s*(`{3,}|~{3,})/.exec(s))==null?void 0:i[1];if(o)return r?o[0]===r[0]&&o.length>=r.length&&(r=void 0):r=o,{kind:"text",source:s,text:s};if(!r&&Mh(s))return{kind:"metadata",source:s,text:s};if(!r&&/^[\s]*[[{]/.test(s))try{return{kind:"json",source:s,text:Ah(s)}}catch{}return{kind:"text",source:s,text:s}})}const Fa=c.createContext(null);function Th({children:e,onQuoteTextBlock:t}){return a.jsx(Fa.Provider,{value:t,children:e})}function Cs(){return c.useContext(Fa)}function Ph(e,t){return/\.(?:html?|xhtml)$/i.test(e)||t==="text/html"||t==="application/xhtml+xml"}function Oa(e,t,n=t.renderedMarkdownHtml){const r=pn(e)?n:Ph(e,t.metadata.mimeType)?t.content:void 0;return r?Ba(r):null}function Ha(e,t){const n=Oa(e,t);if(!n)throw new Error("Rendered file contents are unavailable");return n}function Nh(e){const t=Ba(e);if(!t)throw new Error("Rendered contents are unavailable");return t}function Mt(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)}async function Ih(e){if(e.type==="image/png")return e;const t=URL.createObjectURL(e);try{const n=new Image,r=new Promise((i,l)=>{n.onload=()=>i(),n.onerror=()=>l(new Error("Failed to decode image"))});n.src=t,await r;const s=document.createElement("canvas");s.width=n.naturalWidth,s.height=n.naturalHeight;const o=s.getContext("2d");if(!o)throw new Error("Canvas is not available");return o.drawImage(n,0,0),await new Promise((i,l)=>{s.toBlob(u=>{u?i(u):l(new Error("Failed to encode PNG"))},"image/png")})}finally{URL.revokeObjectURL(t)}}async function Ua(e){var n;const t=globalThis.ClipboardItem;if(!((n=navigator.clipboard)!=null&&n.write)||!t)return!1;try{return await navigator.clipboard.write([new t({"image/png":e.then(Ih)})]),!0}catch{return!1}}const an=tt(Ee.sessionRightPane,!1);function cn(e){return e.kind==="vhost"?!0:!e.sessionId||!an.read()?!1:e.kind==="panel"?!0:e.kind==="file"&&!!e.supportsRightPane}let we=null;const ns=new Set;let rs=0;function $h(){for(const e of ns)e()}function Va(e){return!!(e&&e.kind!=="artifact"&&!cn(e)&&!e.minimized)}function ss(e){return!e||!Va(e)?null:e.sessionId}function _n(e){const t=ss(we),n=ss(e);t&&t!==n&&(rs+=1),we=e,$h()}function za(e){if((we==null?void 0:we.id)!==e)return;const t=we.onClose;_n(null),t==null||t()}function rr(e,t){(we==null?void 0:we.id)!==e||we.minimized===t||_n({...we,minimized:t})}function qa(e){rr(e,!0)}function Dh(e){rr(e,!1)}function Bh(e,t){if(e.kind!=="vhost")return{label:e.kind==="file"?"fileViewerClose":"sessionViewerClose",run:t}}function Fh(e,t){const{id:n}=e,r=()=>za(n);return{...e,closeAction:e.closeAction??Bh(e,r),close:r,minimize:()=>rr(n,!0),minimized:t,restore:()=>rr(n,!1)}}function En(e){var r;const t=we,n=(t==null?void 0:t.id)===e.id&&t.minimized;_n(Fh(e,!!n)),t&&t.id!==e.id&&((r=t.onClose)==null||r.call(t))}function sr(e){(we==null?void 0:we.id)===e&&_n(null)}function Oh(e,t){return!e||!t?e===t:e.run===t.run&&e.label===t.label&&!!e.destructive==!!t.destructive&&!!e.busy==!!t.busy}function BS(e,t){(we==null?void 0:we.id)===e&&(Oh(we.closeAction,t)||_n({...we,closeAction:t}))}function Wa(e){return ns.add(e),()=>ns.delete(e)}function Wo(){return we}function ks(){return c.useSyncExternalStore(Wa,Wo,Wo)}function FS(e){return e!==null&&ss(we)===e}function OS(){return c.useSyncExternalStore(Wa,()=>rs,()=>rs)}function Ka(){const e=ks();return(e==null?void 0:e.kind)==="file"?e:null}function Hh(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M13.5 8h-11M6.5 4l-4 4 4 4"})})}const Ga=c.createContext(null);function Uh({children:e,onSendComment:t}){return a.jsx(Ga.Provider,{value:t??null,children:e})}function Vh(){return c.useContext(Ga)}const zh=300*1e3,qh=32,Wh=1024*1024,Kh=100,Ke=new Map,os=new Set,Kn=[];function Ls(e){return(e==null?void 0:e.nowMs)??Date.now()}function Qa(e){return Array.isArray(e)?e.map(t=>Qa(t)):e??null}function Ko(e){if(!e)return{};if(e instanceof URLSearchParams){const n={};for(const r of Array.from(new Set(e.keys())).sort()){const s=e.getAll(r);n[r]=s.length>1?s:s[0]??""}return n}const t={};for(const n of Object.keys(e).sort())t[n]=Qa(e[n]);return t}function is(e){if(e===void 0)return"undefined";if(e===null||typeof e!="object")return JSON.stringify(e)??String(e);if(Array.isArray(e))return`[${e.map(n=>is(n)).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${is(t[n])}`).join(",")}}`}function yr(e){const t=e.projectId??null;return{key:is({sourceKey:e.sourceKey,routeId:e.routeId,projectId:t,routeParams:Ko(e.routeParams),queryParams:Ko(e.queryParams)}),sourceKey:e.sourceKey,routeId:e.routeId,projectId:t}}function Xa(e){var t;try{return((t=JSON.stringify(e))==null?void 0:t.length)??0}catch{return 0}}function Ya(){for(const e of Array.from(os))e()}function Gh(e){return{key:e.key,sourceKey:e.sourceKey,routeId:e.routeId,projectId:e.projectId,createdAt:e.createdAt,updatedAt:e.updatedAt,lastAccessedAt:e.lastAccessedAt,expiresAt:e.expiresAt,approxBytes:e.approxBytes}}function Rs(){typeof window>"u"||(window.__YA_ROUTE_RETENTION__={entries:()=>Ir().entries,events:()=>Ir().events,diagnostics:Ir,clear:em,invalidate:Zh})}function Ht(e,t={}){for(Kn.push(e);Kn.length>Kh;)Kn.shift();Rs(),t.emit&&Ya()}function Cn(e,t,n,r=!0){const s=Ke.get(e);s&&(Ke.delete(e),Ht({type:t==="invalidate"?"invalidate":"evict",key:s.key,sourceKey:s.sourceKey,routeId:s.routeId,projectId:s.projectId,at:n,reason:t,approxBytes:s.approxBytes},{emit:r}))}function Qh(e){for(const t of Array.from(Ke.values()))t.expiresAt<=e&&Cn(t.key,"expired",e,!1)}function Xh(){let e=0;for(const t of Ke.values())e+=t.approxBytes;return e}function Yh(e,t){const n=e.maxEntries??qh,r=e.maxBytes??Wh;for(;Ke.size>n||Xh()>r;){const s=Array.from(Ke.values()).sort((o,i)=>o.lastAccessedAt!==i.lastAccessedAt?o.lastAccessedAt-i.lastAccessedAt:o.updatedAt-i.updatedAt)[0];if(!s)break;Cn(s.key,"lru",t,!1)}}function Ja(e){return os.add(e),Rs(),()=>{os.delete(e)}}function Jh(e,t={}){const n=Ls(t),r=yr(e),s=Ke.get(r.key),o=t.recordDiagnostics??!0;return s?s.expiresAt<=n?t.touch===!1&&!o?{value:null,missReason:"expired"}:(Cn(s.key,"expired",n),o&&Ht({type:"miss",key:r.key,sourceKey:r.sourceKey,routeId:r.routeId,projectId:r.projectId,at:n,reason:"expired"}),{value:null,missReason:"expired"}):(t.touch!==!1&&(s.lastAccessedAt=n),o&&Ht({type:"hit",key:s.key,sourceKey:s.sourceKey,routeId:s.routeId,projectId:s.projectId,at:n,approxBytes:s.approxBytes}),{value:s.value}):(o&&Ht({type:"miss",key:r.key,sourceKey:r.sourceKey,routeId:r.routeId,projectId:r.projectId,at:n,reason:"missing"}),{value:null,missReason:"missing"})}function Ms(e,t){return Jh(e,t).value}function As(e,t,n={}){const r=Ls(n);Qh(r);const s=yr(e),o=Ke.get(s.key),i=n.ttlMs??zh,l={...s,value:t,createdAt:(o==null?void 0:o.createdAt)??r,updatedAt:r,lastAccessedAt:r,expiresAt:r+i,approxBytes:n.approxBytes??Xa(t)};Ke.set(s.key,l),Yh(n,r),Ht({type:"write",key:l.key,sourceKey:l.sourceKey,routeId:l.routeId,projectId:l.projectId,at:r,approxBytes:l.approxBytes},{emit:!0})}function HS(e,t,n={}){const r=Ms(e,{...n,touch:!1,recordDiagnostics:!1}),s=typeof t=="function"?t(r):Object.assign({},r,t);As(e,s,n);const o=yr(e);Ht({type:"patch",key:o.key,sourceKey:o.sourceKey,routeId:o.routeId,projectId:o.projectId,at:Ls(n),approxBytes:n.approxBytes??Xa(s)})}function Zh(e){const t=Date.now();Cn(yr(e).key,"invalidate",t)}function em(){const e=Date.now();for(const t of Array.from(Ke.values()))Cn(t.key,"invalidate",e,!1);Ya()}function Ir(){const e=Array.from(Ke.values(),Gh);return{entries:e,events:[...Kn],totalBytes:e.reduce((t,n)=>t+n.approxBytes,0)}}Rs();const tm=3e4,nm=750,rm=60*1e3;function sm(){return Zi(),!0}function Za(e,t,n,r){return{sourceKey:e,routeId:n?"git-status:data:cached-untracked":r?"git-status:data:no-untracked":"git-status:data",projectId:t}}function om(e,t,n,r){const s=c.useMemo(()=>t?Za(e,t,n,r):null,[e,t,n,r]);return c.useSyncExternalStore(Ja,()=>s?Ms(s,{touch:!1,recordDiagnostics:!1}):null,()=>null)}function im(e,t={}){const n=vn(),r=sm(),s=t.useUntrackedCache===!0,o=t.omitUntracked===!0,i=c.useMemo(()=>ta({endpoint:s?"git-status:cached-untracked":o?"git-status:no-untracked":"git-status",projectId:e??null}),[o,e,s]),l=om(n,e,s,o),u=`${n}\0${i}`,d=c.useRef({identity:u,value:l});d.current.identity!==u?d.current={identity:u,value:l}:l!==null&&(d.current.value=l);const h=l??d.current.value,[f,g]=c.useState(null),[m,p]=c.useState(!1),y=c.useMemo(()=>am(h,f,s),[h,f,s]),[b,v]=c.useState(()=>!!e&&y===null),[_,C]=c.useState(null),[S,L]=c.useState(null),x=c.useRef(!0),E=c.useRef(0),w=c.useRef(0),R=c.useRef(null),j=c.useRef(y),N=c.useRef(f),A=c.useRef(l),k=c.useRef({queryKey:"",present:!1});j.current=y,N.current=f,A.current=l,c.useEffect(()=>(x.current=!0,()=>{x.current=!1}),[]),c.useEffect(()=>{w.current+=1,R.current=null,g(null),p(!1),L(null)},[o,e,n,s]),c.useEffect(()=>{C(null),v(!!e&&j.current===null)},[e,i,n]),c.useEffect(()=>{if(e)return tu({sourceKey:n,key:i})},[e,i,n]);const M=c.useCallback(async({background:H=!1}={})=>{if(!e||!r||!s||(l==null?void 0:l.isGitRepo)!==!0)return;const V=++w.current;(!H||N.current===null)&&L(null),N.current===null&&p(!0);const O=R.current,K=O??ue.listGitUntrackedFiles(e);O||(R.current=K);try{const Y=await K;x.current&&V===w.current&&(g(Y),p(!1),L(null))}catch(Y){x.current&&V===w.current&&!yo(Y)&&(!H||N.current===null)&&L(Y instanceof Error?Y:new Error(String(Y)))}finally{x.current&&V===w.current&&p(!1),R.current===K&&(R.current=null)}},[e,r,l==null?void 0:l.isGitRepo,s]),P=c.useCallback(async({force:H=!1,background:V=!1}={})=>{if(!e||!r)return;const O=++E.current,K=A.current!==null,Y=j.current!==null;!V&&!Y&&v(!0),V||C(null);const te={projectId:e},F=(Q,G)=>{const X=G.meta.projectId;X&&As(Za(G.sourceKey,X,s,o),Q,{ttlMs:rm})},T=Q=>{const G=Q.meta.projectId;if(!G)throw new Error("Project id is required");return ue.getGitStatus(G,{...o?{omitUntracked:!0}:{},...s?{useUntrackedCache:!0}:{}})};try{const Q=await na({sourceKey:n,key:i,force:H||!K,meta:te,fetcher:T,applySnapshot:F});if(!x.current||O!==E.current)return;Q.status!=="obsolete"&&C(null)}catch(Q){if(!x.current||O!==E.current)return;j.current===null&&!yo(Q)&&C(Q instanceof Error?Q:new Error(String(Q)))}finally{x.current&&O===E.current&&v(!1)}},[o,e,i,r,n,s]);c.useEffect(()=>{!e||!r||P({background:j.current!==null})},[P,e,r]),c.useEffect(()=>{const H=k.current,V=l!==null;k.current={queryKey:i,present:V},H.queryKey===i&&H.present&&!V&&e&&r&&document.visibilityState==="visible"&&document.hasFocus()&&P()},[P,e,i,r,l]),c.useEffect(()=>{(l==null?void 0:l.isGitRepo)===!0&&M({background:N.current!==null})},[M,l==null?void 0:l.isGitRepo]);const I=t.poll!==!1;c.useEffect(()=>{if(!e||!r)return;let H=document.visibilityState==="visible"&&document.hasFocus();const V=()=>{const O=document.visibilityState==="visible"&&document.hasFocus();if(O!==H&&(H=O,!!O)){if(A.current===null){P();return}I&&(P({force:!0,background:!0}),M({background:!0}))}};return document.addEventListener("visibilitychange",V),window.addEventListener("focus",V),window.addEventListener("blur",V),()=>{document.removeEventListener("visibilitychange",V),window.removeEventListener("focus",V),window.removeEventListener("blur",V)}},[P,M,I,e,r]),c.useEffect(()=>{if(!e||!r||t.poll===!1)return;let H=!1,V=!1,O=null,K=null;const Y=()=>{P({force:!0,background:!0}),M({background:!0})},te=()=>{O&&(clearInterval(O),O=null)},F=()=>{O||(O=setInterval(Y,tm))},T=()=>{K&&(clearTimeout(K),K=null)},Q=()=>{te(),H&&F()},G=()=>{H&&(T(),K=setTimeout(()=>{K=null,Y(),Q()},nm))},X=()=>{const Z=document.visibilityState==="visible"&&document.hasFocus();V&&Z===H||(V=!0,H=Z,H?F():(te(),T()))},B=vo.onSource(n,"process-state-changed",Z=>{Z.projectId===e&&Z.activity!=="in-turn"&&G()}),q=vo.onSource(n,"reconnect",G);return X(),document.addEventListener("visibilitychange",X),window.addEventListener("focus",X),window.addEventListener("blur",X),()=>{H=!1,te(),T(),B(),q(),document.removeEventListener("visibilitychange",X),window.removeEventListener("focus",X),window.removeEventListener("blur",X)}},[P,M,t.poll,e,r,n]);const $=c.useCallback(async()=>{await Promise.all([P({force:!0,background:j.current!==null}),M({background:N.current!==null})])},[P,M]);return{gitStatus:y,untrackedFiles:f,untrackedLoading:m,untrackedError:S,loading:b,error:_,refetch:$}}function am(e,t,n){if(!n||(e==null?void 0:e.isGitRepo)===!1||!e||!t)return e;const r=[...t.files.map(i=>{var l;return{path:i,status:"?",staged:!1,linesAdded:null,linesDeleted:null,...(l=t.lastEditors)!=null&&l[i]?{lastEditor:t.lastEditors[i]}:{}}}),...t.folders.map(({path:i})=>({path:i,status:"?",staged:!1,linesAdded:null,linesDeleted:null}))],o=[...e.files.filter(i=>i.status!=="?"),...r];return{...e,files:o,isClean:o.length===0}}const cm=5e3,lm=6e4;function Go(e,t){return{sourceKey:e,routeId:"git-status:file-projections",projectId:t}}function um(e,t,n){const r=c.useMemo(()=>t?Go(e,t):null,[t,e]),s=c.useSyncExternalStore(Ja,()=>r?Ms(r,{touch:!1,recordDiagnostics:!1}):null,()=>null),o=(s==null?void 0:s.statusKey)===n?s.value:null,i=c.useRef(n);i.current=n;const l=ea({sourceKey:e,key:{endpoint:"git-status:file-projections",projectId:t??null,statusKey:n},enabled:!!(t&&n),hasData:o!==null,staleTimeMs:cm,meta:{projectId:t,statusKey:n},fetcher:async d=>{const h=d.meta;if(!h.projectId)throw new Error("Project is required for file projections");return ue.getGitFileProjections(h.projectId)},applySnapshot:(d,h)=>{const f=h.meta;!f.projectId||!f.statusKey||f.statusKey!==i.current||As(Go(h.sourceKey,f.projectId),{statusKey:f.statusKey,value:d},{ttlMs:lm})}});return{manifest:o??(n&&!l.error?(s==null?void 0:s.value)??null:null),loading:!!(n&&!o&&!l.error)}}function dm(e){const t=Ue(e).replace(/^\.\/+/,""),n=t.startsWith("/")||t.startsWith("//")||/^[a-zA-Z]:\//.test(t),r=t===".."||t.startsWith("../");return t&&!n&&!r?t:null}function Qo(e,t){return e?t.find(n=>n.path===e||n.origPath===e)??null:null}function fm(e){var t,n;return JSON.stringify([((n=(t=e.recentCommits)==null?void 0:t[0])==null?void 0:n.hash)??null,e.files.map(r=>[r.path,r.origPath??null,r.status,r.staged,r.linesAdded,r.linesDeleted])])}function ec(e,t){var m,p;const n=vn(),r=bn(n),s=Vt(r,jl),o=Vt(r,Tl),i=c.useMemo(()=>dm(t),[t]),l=s&&o&&i?e:void 0,{gitStatus:u,loading:d,error:h}=im(l,{poll:!1,omitUntracked:!1}),f=u!=null&&u.isGitRepo&&i?fm(u):null,g=um(n,l,f);return{cumulativeFile:Qo(i,((m=g.manifest)==null?void 0:m.cumulativeFiles)??[]),loading:!!(e&&i&&(r===null||o&&l&&(d||!u&&!h||u!=null&&u.isGitRepo&&g.loading))),relativePath:i,supported:o,worktreeFile:Qo(i,((p=g.manifest)==null?void 0:p.worktreeFiles)??[])}}const hm=["block","paragraph-hover","paragraph-always"],tc="paragraph-hover";function mm(e){return hm.includes(e)?e:void 0}const fn=ws(Ee.quoteReplyButtonMode,tc,mm);fn.set;function nc(){return{quoteReplyButtonMode:c.useSyncExternalStore(fn.subscribe,fn.read,()=>tc),setQuoteReplyButtonMode:fn.set}}fn.read;const pm="_rowSurface_1pv0o_1",gm="_trigger_1pv0o_5",wm="_overlay_1pv0o_38",ym="_menu_1pv0o_48",vm="_separatorBefore_1pv0o_74",hn={rowSurface:pm,trigger:gm,overlay:wm,menu:ym,separatorBefore:vm},US=hn.rowSurface,bm=500,xm=8;function rc(e,t){const[n,r]=c.useState(null),s=c.useRef(null),o=c.useRef(!1),i=c.useRef(null),l=c.useCallback(()=>r(null),[]),u=c.useCallback((L,x,E,w,R)=>{var j;r({actions:w,x:L,y:x,returnFocus:E,...R!=null&&R.contextKey?{contextKey:R.contextKey}:{}}),(j=R==null?void 0:R.onOpen)==null||j.call(R)},[]),d=c.useCallback((L,x,E)=>{L.preventDefault(),L.stopPropagation();const w=L.currentTarget.getBoundingClientRect();u(w.right,w.bottom+4,L.currentTarget,x,E)},[u]),h=c.useCallback((L,x)=>{r(E=>(E==null?void 0:E.contextKey)===L?{...E,actions:x}:E)},[]),f=c.useCallback((L,x,E)=>{L.preventDefault(),L.stopPropagation(),u(L.clientX,L.clientY,L.currentTarget,x,E)},[u]),g=c.useCallback((L,x,E)=>{if(L.key!=="ContextMenu"&&!(L.shiftKey&&L.key==="F10"))return!1;L.preventDefault(),L.stopPropagation();const w=L.currentTarget.getBoundingClientRect();return u(w.left+Math.min(32,w.width/2),w.top+Math.min(32,w.height),L.currentTarget,x,E),!0},[u]),m=c.useCallback(()=>{s.current&&(clearTimeout(s.current.timer),s.current=null)},[]),p=c.useCallback((L,x,E,w)=>{if(m(),i.current&&(clearTimeout(i.current),i.current=null),o.current=!1,!L.isPrimary||L.button!==0||L.pointerType!=="touch"&&L.pointerType!=="pen")return;const R=L.clientX,j=L.clientY,N=setTimeout(()=>{o.current=!0,s.current=null,u(R,j,x,E,w)},bm);s.current={timer:N,x:R,y:j}},[m,u]),y=c.useCallback((L,x,E)=>{p(L.nativeEvent,L.currentTarget,x,E)},[p]),b=c.useCallback(L=>{const x=s.current;!x||Math.hypot(L.clientX-x.x,L.clientY-x.y)<=xm||m()},[m]),v=c.useCallback(L=>{b(L.nativeEvent)},[b]),_=c.useCallback(()=>o.current?(o.current=!1,!0):!1,[]),C=c.useCallback(()=>{m(),o.current&&(i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{o.current=!1,i.current=null},0))},[m]),S=c.useCallback((L,x,E)=>({onContextMenu:w=>f(w,L,E),onKeyDown:w=>{g(w,L,E)},onPointerDown:w=>y(w,L,E),onPointerMove:v,onPointerUp:m,onPointerCancel:m,onClick:()=>{_()||x()}}),[y,_,m,v,f,g]);return c.useEffect(()=>(window.addEventListener("pointerup",C),window.addEventListener("pointercancel",C),()=>{window.removeEventListener("pointerup",C),window.removeEventListener("pointercancel",C),m(),i.current&&(clearTimeout(i.current),i.current=null)}),[m,C]),{menu:n?a.jsx(Sm,{...n,labels:t,onClose:l,t:e}):null,targetProps:S,openAt:u,openFromButton:d,refreshOpenActions:h,beginLongPressAt:p,moveLongPressAt:b,endLongPress:m,consumeLongPressClick:_}}function VS({actions:e,label:t,onOpen:n,openOptions:r}){return a.jsx("button",{type:"button",className:hn.trigger,"aria-label":t,title:t,onClick:s=>n(s,e,r),children:"⋯"})}function Sm({actions:e,x:t,y:n,returnFocus:r,onClose:s,t:o,labels:i}){const l=c.useRef(null);c.useEffect(()=>Gi(),[]),c.useLayoutEffect(()=>{var h,f;(f=(h=l.current)==null?void 0:h.querySelector('button[role="menuitem"]:not(:disabled)'))==null||f.focus()},[]),c.useEffect(()=>{const h=f=>{var y,b;if(f.key==="Escape"){f.preventDefault(),s(),r==null||r.focus();return}if(f.key!=="ArrowDown"&&f.key!=="ArrowUp"&&f.key!=="Home"&&f.key!=="End")return;const g=Array.from(((y=l.current)==null?void 0:y.querySelectorAll('button[role="menuitem"]:not(:disabled)'))??[]);if(g.length===0)return;f.preventDefault();const m=g.indexOf(document.activeElement),p=f.key==="Home"?0:f.key==="End"?g.length-1:f.key==="ArrowDown"?(m+1+g.length)%g.length:(m-1+g.length)%g.length;(b=g[p])==null||b.focus()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[s,r]);const u=h=>{h.disabled||(h.onSelect(),s(),r==null||r.focus())},d=e.length*34+16;return $e.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:hn.overlay,"aria-label":(i==null?void 0:i.dismiss)??o("sourceDismissActions"),onClick:()=>{s(),r==null||r.focus()},onContextMenu:h=>{h.preventDefault(),s(),r==null||r.focus()}}),a.jsx("div",{ref:l,className:hn.menu,role:"menu","aria-label":(i==null?void 0:i.menu)??o("sourceActionMenu"),style:{left:Math.max(8,Math.min(t,window.innerWidth-232)),top:Math.max(8,Math.min(n,window.innerHeight-d))},children:e.map((h,f)=>a.jsx("button",{type:"button",role:"menuitem",className:h.separatorBefore?hn.separatorBefore:void 0,disabled:h.disabled,onClick:()=>u(h),children:h.label},f))})]}),document.body)}const _m="_cluster_13b9h_1",Em="_button_13b9h_9",Cm="_text_13b9h_37",km="_quote_13b9h_56",Lm="_source_13b9h_75",Rm="_rich_13b9h_94",Mm="_newSession_13b9h_112",Am="_specimen_13b9h_132",jm="_mobile_13b9h_137",Tm="_docked_13b9h_146",Ze={cluster:_m,button:Em,text:Cm,quote:km,source:Lm,rich:Rm,newSession:Mm,specimen:Am,mobile:jm,docked:Tm},Pm=30,Nm=44,nn=6;function Im(){return a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"5",y:"5",width:"9",height:"9",rx:"1.5"}),a.jsx("path",{d:"M11 5V3.5A1.5 1.5 0 0 0 9.5 2H3.5A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5"})]})}const Xo={text:a.jsx(Im,{}),quote:">",source:"</>",rich:"Aa",newSession:"+"},$m={text:Ze.text,quote:Ze.quote,source:Ze.source,rich:Ze.rich,newSession:Ze.newSession};function Dm({kind:e,label:t,onClick:n,onPointerDown:r,onPointerUp:s,specimen:o=!1}){const i=`${Ze.button} ${$m[e]} ${o?Ze.specimen:""}`;return o?a.jsx("span",{className:i,"aria-hidden":"true","data-selection-action-specimen":e,children:Xo[e]}):a.jsx("button",{type:"button",className:i,onMouseDown:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),r==null||r(l)},onPointerUp:s,onClick:n,"aria-label":t,title:t,children:Xo[e]})}function Bm({children:e,docked:t=!1,mobile:n=!1,placement:r,style:s}){return a.jsx("div",{className:[Ze.cluster,t?Ze.docked:"",n?Ze.mobile:""].filter(Boolean).join(" "),style:s,"data-selection-action-cluster":"true","data-selection-action-placement":r,children:e})}const Fm="session-file-comments",sc="data-session-file-comment-mode",oc=100,Om=2e4,Yo=8e3;function Hm({sourceKey:e,sessionId:t,projectId:n,filePath:r}){return[Fm,e,t,n,r].map(encodeURIComponent).join(":")}function Um(e){try{const t=JSON.parse(localStorage.getItem(e)??"null");if(!Array.isArray(t))return[];const n=[];for(const r of t.slice(0,oc)){if(!zm(r))continue;const{id:s,location:o,quote:i,text:l,afterLine:u,afterBlock:d}=r;typeof s!="string"||!s||typeof o!="string"||!o||typeof i!="string"||!i.trim()||typeof l!="string"||!l.trim()||o.length>Yo||i.length>Yo||l.length>Om||u!==void 0&&(!Number.isInteger(u)||Number(u)<1)||d!==void 0&&(!Number.isInteger(d)||Number(d)<0)||n.push({id:s,location:o,quote:i,text:l,...u===void 0?{}:{afterLine:Number(u)},...d===void 0?{}:{afterBlock:Number(d)}})}return n}catch{return[]}}function $r(e,t){const n=t.filter(r=>r.text.trim()).slice(0,oc);if(n.length===0){localStorage.removeItem(e);return}localStorage.setItem(e,JSON.stringify(n))}function ic(e){const t=e.quote.replace(/\r\n?/g,`
21
- `).replace(/^\n+|\n+$/g,"").split(`
22
- `).map(n=>`> ${n}`).join(`
23
- `);return`${e.location}
24
-
25
- ${t}
26
-
27
- ${e.text.trim()}`}function Vm(e){return e.map(ic).join(`
28
-
29
- ---
30
-
31
- `)}function zm(e){return typeof e=="object"&&e!==null}const It="session-transcript-selection-active",qm=50;function Jo(e,t,n){return Math.max(t,Math.min(n,e))}function Zo(e,t,n){const r=e.sourceElement.ownerDocument.createRange();return r.selectNodeContents(e.sourceElement),t==="after"?r.setStart(e.range.endContainer,e.range.endOffset):r.setEnd(e.range.startContainer,e.range.startOffset),!r.toString().trim()||typeof r.getClientRects!="function"?!0:!Array.from(r.getClientRects()).some(s=>s.width>0&&s.height>0&&s.bottom>n.top+1&&s.top<n.bottom-1)}function Wm(e){const t=new Set(e.map(r=>r.sourceElement)),n=[];for(const r of t){const s=r.ownerDocument.createRange();s.selectNodeContents(r),typeof s.getClientRects=="function"&&n.push(...Array.from(s.getClientRects()).filter(o=>o.width>0&&o.height>0))}return n}function Km(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function js(e){var t;return((t=e.matchMedia)==null?void 0:t.call(e,"(pointer: coarse)").matches)===!0}function Gm(e,t){if(js(t))return!0;const n=e.pointerType;return n==="touch"||n==="pen"}function Qm(e,t,n){return t===0&&n===0?!0:e.ranges.some(r=>typeof r.getClientRects!="function"?!0:Array.from(r.getClientRects()).some(s=>t>=s.left-1&&t<=s.right+1&&n>=s.top-1&&n<=s.bottom+1))}function Xm(e,t,n,r,s){const{snippets:o}=n,i=n.root,l=e.ownerDocument.defaultView??window,u=js(l),d=u?Nm:Pm,h=t.getRangeAt(t.rangeCount-1),f=typeof h.getBoundingClientRect=="function"?h.getBoundingClientRect():null,g=typeof h.getClientRects=="function"?Array.from(h.getClientRects()).filter(V=>V.width!==0||V.height!==0):[],m=f&&(f.width!==0||f.height!==0);if(!m&&!s)return null;const p=i.getBoundingClientRect(),y=m?f:{top:(s==null?void 0:s.clientY)??p.top,right:(s==null?void 0:s.clientX)??p.left,bottom:(s==null?void 0:s.clientY)??p.top,left:(s==null?void 0:s.clientX)??p.left,width:0,height:0},b=g[0]??y,v=g.at(-1)??y,_=r*d+(r-1)*nn,C=o[0],S=o.at(-1),L=S?Zo(S,"after",v):!1,x=C?Zo(C,"before",b):!1,E=p.right-v.right,w=b.left-p.left,R=p.bottom-y.bottom,j=y.top-p.top,N=Math.max(0,i.clientHeight-d),A=Math.max(0,i.clientWidth-_),k=y.left-p.left+(y.width-_)/2,M={after:{top:v.top-p.top+(v.height-d)/2,left:v.right-p.left+nn},before:{top:b.top-p.top+(b.height-d)/2,left:b.left-p.left-_-nn},below:{top:y.bottom-p.top+nn,left:k},above:{top:y.top-p.top-d-nn,left:k}},P=Wm(o),I=V=>{if(V==="after"&&!L||V==="before"&&!x)return!1;const O=M[V];if(O.left<0||O.top<0||O.left+_>i.clientWidth||O.top+d>i.clientHeight)return!1;const K={top:p.top+O.top,right:p.left+O.left+_,bottom:p.top+O.top+d,left:p.left+O.left};return K.left<0||K.top<0||K.right>l.innerWidth||K.bottom>l.innerHeight?!1:!P.some(Y=>Km(K,Y))},$=["after","before","below","above"].find(I)??[["after",E-_],["before",w-_],["below",R-d],["above",j-d]].reduce((V,O)=>O[1]>V[1]?O:V)[0],H=M[$];return{side:$,docked:u&&i===e,mobile:u,snapshot:n,top:Jo(H.top,0,N),left:Jo(H.left,0,A)}}function Ym({actionCount:e,getActionCount:t,containerRef:n,inert:r,isInteractiveTarget:s}){const o=c.useRef(!1),[i,l]=c.useState(null),u=c.useCallback(()=>l(null),[]),d=c.useCallback(()=>{const h=n.current,f=h==null?void 0:h.ownerDocument.getSelection();if(!h||!f||f.isCollapsed||f.rangeCount===0)return null;const g=sn(h,f);if(!g)return null;const m=hr(g);return m.length===0?null:{anchors:m.map(tr),snippets:m,ranges:m.map(p=>p.range.cloneRange()),root:g}},[n]);return c.useEffect(()=>{if(r)return;const h=f=>{const g=n.current;if(!g)return;const m=sn(g);m&&nu(f,m)};return document.addEventListener("copy",h),()=>document.removeEventListener("copy",h)},[n,r]),c.useEffect(()=>{if(r)return;const h=n.current,f=(h==null?void 0:h.ownerDocument)??document,g=m=>{const p=n.current;if(m.button!==0||!p||s(m.target))return;const y=f.getSelection(),b=sn(p,y),v=bo(p,m.target);b&&b===v&&(y==null||y.removeAllRanges())};return f.addEventListener("mousedown",g,!0),()=>f.removeEventListener("mousedown",g,!0)},[n,r,s]),c.useEffect(()=>{if(r)return;const h=n.current,f=(h==null?void 0:h.ownerDocument)??document,g=f.defaultView??window;if(!js(g))return;let m=null,p=null;const y=v=>{const _=n.current,C=(_==null?void 0:_.closest(".session-page"))??null,S=(_==null?void 0:_.ownerDocument.body)??null;m&&m!==C&&m.classList.remove(It),p&&p!==S&&p.classList.remove(It),m=C,p=S,C==null||C.classList.toggle(It,v),S==null||S.classList.toggle(It,v&&C!==null)},b=()=>{const v=n.current;y(v?sn(v,v.ownerDocument.getSelection())!==null:!1)};return f.addEventListener("selectionchange",b),f.addEventListener("pointerup",b,!0),f.addEventListener("keyup",b,!0),g.addEventListener("blur",b),()=>{f.removeEventListener("selectionchange",b),f.removeEventListener("pointerup",b,!0),f.removeEventListener("keyup",b,!0),g.removeEventListener("blur",b),m==null||m.classList.remove(It),p==null||p.classList.remove(It)}},[n,r]),c.useEffect(()=>{var E;if(r||e===0){l(null);return}const h=((E=n.current)==null?void 0:E.ownerDocument)??document,f=h.defaultView??window;let g,m=!1;const p=()=>{m=!1,g!==void 0&&(f.clearTimeout(g),g=void 0)},y=w=>{if(o.current&&!w){l(null);return}const R=n.current,j=R==null?void 0:R.ownerDocument.getSelection(),N=d();if(!R||!j||!N){l(null);return}const A=(t==null?void 0:t(N))??e;if(A===0){l(null);return}l(Xm(R,j,N,A,w))},b=()=>{g=f.setTimeout(()=>{g=void 0,m&&(m=!1,y(),b())},qm)},v=()=>{if(g!==void 0){m=!0;return}y(),b()},_=()=>{const w=h.getSelection();if(!w||w.isCollapsed||w.rangeCount===0){p();return}v()},C=w=>{const R=n.current;if(w.target instanceof Element&&w.target.closest('[data-selection-action-cluster="true"]')){o.current=!1,p();return}if(p(),!R||!bo(R,w.target)){o.current=!1;return}o.current=!0,l(null)},S=w=>{const R=o.current;o.current=!1,R&&(p(),f.setTimeout(()=>{p(),y({clientX:w.clientX,clientY:w.clientY})},0))},L=()=>{o.current=!1,p()},x=()=>{if(o.current){p();return}const w=h.getSelection();if(!w||w.isCollapsed||w.rangeCount===0){p(),l(null);return}v()};return h.addEventListener("selectionchange",x),h.addEventListener("pointerdown",C,!0),h.addEventListener("pointercancel",L,!0),h.addEventListener("pointerup",S,!0),f.addEventListener("resize",_),f.addEventListener("scroll",_,!0),()=>{p(),h.removeEventListener("selectionchange",x),h.removeEventListener("pointerdown",C,!0),h.removeEventListener("pointercancel",L,!0),h.removeEventListener("pointerup",S,!0),f.removeEventListener("resize",_),f.removeEventListener("scroll",_,!0)}},[e,d,n,t,r]),{captureSnapshot:d,dismiss:u,state:i}}const $n=tt(Ee.selectionQuoteActionEnabled,!0),Dn=tt(Ee.selectionTextCopyActionEnabled,!1),Bn=tt(Ee.selectionSourceCopyActionEnabled,!1),Fn=tt(Ee.selectionRichCopyActionEnabled,!1),On=tt(Ee.selectionNewSessionActionEnabled,!1);function Jm(){const e=c.useSyncExternalStore($n.subscribe,$n.read,$n.read),t=c.useSyncExternalStore(Dn.subscribe,Dn.read,Dn.read),n=c.useSyncExternalStore(Bn.subscribe,Bn.read,Bn.read),r=c.useSyncExternalStore(Fn.subscribe,Fn.read,Fn.read),s=c.useSyncExternalStore(On.subscribe,On.read,On.read);return{selectionQuoteActionEnabled:e,setSelectionQuoteActionEnabled:$n.set,selectionTextCopyActionEnabled:t,setSelectionTextCopyActionEnabled:Dn.set,selectionSourceCopyActionEnabled:n,setSelectionSourceCopyActionEnabled:Bn.set,selectionRichCopyActionEnabled:r,setSelectionRichCopyActionEnabled:Fn.set,selectionNewSessionActionEnabled:s,setSelectionNewSessionActionEnabled:On.set}}function Dr(e){return e.snippets.some(t=>t.sourceElement.closest(`[${sc}="true"]`)!==null)}function Zm(e){return e.snippets.map((t,n)=>{var s;if(t.sourceStart!==void 0)return t.selectedText;const r=e.ranges[n];return r?((s=wr(e.root,[r]))==null?void 0:s.text)??t.selectedText:t.selectedText}).join(`
32
-
33
- `)}function ep(e){return e.snippets.map(t=>t.markdown).join(`
34
-
35
- `)}function tp(e){return e.anchors.map(t=>t.quotedText).join(`
36
-
37
- `)}function np(e){const t=e.snippets.map(o=>o.sourceLocation);if(t.some(o=>o===void 0))return null;const n=t[0];if(!n||t.some(o=>(o==null?void 0:o.projectId)!==n.projectId||o.filePath!==n.filePath))return null;const r=Math.min(...t.map(o=>(o==null?void 0:o.lineStart)??n.lineStart)),s=Math.max(...t.map(o=>(o==null?void 0:o.lineEnd)??n.lineEnd));return`${n.filePath}:${r}${s>r?`-${s}`:""}`}function rp(e){const t=tp(e),n=np(e);return n?`${n}
38
-
39
- ${t}`:t}function sp({applyQuoteAnchors:e,applyQuoteFromSelection:t,containerRef:n,inert:r,isInteractiveTarget:s,onQuoteSelection:o,onStartNewSessionFromSelection:i}){const l=c.useRef(null),{selectionQuoteActionEnabled:u,selectionTextCopyActionEnabled:d,selectionSourceCopyActionEnabled:h,selectionRichCopyActionEnabled:f,selectionNewSessionActionEnabled:g}=Jm(),{t:m}=xe(),{menu:p,openAt:y}=rc(m,{dismiss:m("sessionDismissSelectionActions"),menu:m("sessionSelectionActionMenu")}),b=c.useMemo(()=>{const k=[];return d&&k.push({kind:"text",label:m("sessionCopySelectionText")}),h&&k.push({kind:"source",label:m("sessionCopySelectionSource")}),f&&k.push({kind:"rich",label:m("sessionCopySelectionRich")}),u&&o&&k.push({kind:"quote",label:m("sessionQuoteSelection")}),g&&i&&k.push({kind:"newSession",label:m("sessionNewSessionFromSelection")}),k},[o,i,g,u,f,h,d,m]),v=c.useCallback(k=>Dr(k)?b.filter(M=>M.kind!=="quote"):b,[b]),_=c.useCallback(k=>v(k).length,[v]),C=Ym({actionCount:b.length,getActionCount:_,containerRef:n,inert:r,isInteractiveTarget:s});c.useEffect(()=>{if(r||!o||!u)return;const k=M=>{if(M.defaultPrevented||M.isComposing||M.ctrlKey||M.metaKey||M.altKey||M.key.length!==1||s(M.target))return;const P=C.captureSnapshot();P&&Dr(P)||t(M.key)&&(C.dismiss(),M.preventDefault(),M.stopPropagation())};return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[t,C.captureSnapshot,C.dismiss,r,s,o,u]);const S=c.useCallback((k,M)=>{if(k==="text"){const I=Zm(M);return I?(fe(I),!0):!1}if(k==="quote"){const I=e(M.anchors);return I&&C.dismiss(),I}if(k==="source"){const I=ep(M);return I?(fe(I),!0):!1}if(k==="newSession")return i?(i(rp(M)),!0):!1;const P=wr(M.root,M.ranges);return P?(Qi(P.html,P.text),!0):!1},[e,C.dismiss,i]),L=c.useCallback(k=>{const M=[{label:m("sessionCopySelectionText"),onSelect:()=>{S("text",k)}},{label:m("sessionCopySelectionSource"),onSelect:()=>{S("source",k)}}];return o&&!Dr(k)&&M.push({label:m("sessionQuoteSelection"),onSelect:()=>{S("quote",k)}}),i&&M.push({label:m("sessionNewSessionFromSelection"),onSelect:()=>{S("newSession",k)}}),M},[S,o,i,m]);c.useEffect(()=>{if(r)return;const k=n.current,M=k==null?void 0:k.ownerDocument;if(!k||!M)return;const P=M.defaultView??window,I=$=>{if($.defaultPrevented||s($.target)||Gm($,P))return;const H=C.captureSnapshot();!H||!Qm(H,$.clientX,$.clientY)||($.preventDefault(),$.stopPropagation(),y($.clientX,$.clientY,M.activeElement instanceof HTMLElement?M.activeElement:null,L(H)))};return M.addEventListener("contextmenu",I),()=>M.removeEventListener("contextmenu",I)},[C.captureSnapshot,n,r,s,y,L]);const x=C.state,E=x!==null&&x.snapshot.root!==n.current,w=x!=null&&x.docked&&typeof document<"u"?document.querySelector("[data-selection-actions-mobile-slot]"):null,R=(x==null?void 0:x.docked)===!0&&w!==null,j=x?a.jsx(Bm,{docked:R,mobile:x.mobile,placement:x.side,style:R?void 0:{top:`${x.top}px`,left:`${x.left}px`},children:v(x.snapshot).map(({kind:k,label:M})=>a.jsx(Dm,{kind:k,label:M,onPointerDown:()=>{l.current=null},onPointerUp:P=>{x.mobile&&(P.preventDefault(),S(k,x.snapshot)&&(l.current=k))},onClick:()=>{if(l.current===k){l.current=null;return}S(k,x.snapshot)}},k))}):null,N=R&&j?$e.createPortal(j,w):null,A=x&&!R?E?x.snapshot.root.isConnected?$e.createPortal(j,x.snapshot.root):null:j:null;return{dismiss:C.dismiss,floatingSelectionActions:A,mobileSelectionActions:N,selectionContextMenu:p}}function op({containerRef:e,composerDraftSignal:t,onQuoteSelection:n,quoteClearSignal:r}){const s=c.useRef(null),o=c.useRef([]),[i,l]=c.useState([]),u=c.useRef(null),d=c.useRef(null),h=c.useRef(t),f=c.useRef(()=>{}),g=c.useCallback(S=>{if(typeof CSS>"u"||!("highlights"in CSS)||typeof Highlight>"u")return;if(S.length===0){CSS.highlights.delete("comment-tint");return}const L=S.filter(x=>fd(x,e.current)).map(hd).filter(x=>x!==null);if(L.length===0){CSS.highlights.delete("comment-tint");return}CSS.highlights.set("comment-tint",new Highlight(...L))},[e]),m=c.useCallback(()=>{var S;(S=d.current)==null||S.call(d),d.current=null},[]),p=c.useCallback(()=>{var S;(S=u.current)==null||S.disconnect(),u.current=null},[]),y=c.useCallback(S=>{var R;p();const L=Array.from(new Set(S.map(j=>j.sourceElement).filter(j=>j.isConnected))),x=L[0],E=(R=x==null?void 0:x.ownerDocument.defaultView)==null?void 0:R.MutationObserver;if(!x||!E)return;const w=new E(()=>{g(o.current)});for(const j of L)w.observe(j,{childList:!0,characterData:!0,subtree:!0});u.current=w},[g,p]),b=c.useCallback(()=>{m();const S=h.current;!S||o.current.length===0||(d.current=S.subscribeDraftChanges(L=>{f.current(L)}))},[m]),v=c.useCallback(S=>{const L=o.current;S!==L&&(o.current=S,l(Array.from(new Set(S.map(x=>x.renderId).filter(x=>x!==void 0)))),g(S),y(S),L.length===0&&S.length>0?b():L.length>0&&S.length===0&&m())},[g,y,b,m]);f.current=S=>{const L=o.current;if(L.length===0)return;const x=s.current;if(x===null&&S.metadata.mayAffectQuoteAnchors===!1)return;s.current=null;const E=md(x??S.text),w=L.filter(R=>pd(E,R));w.length!==L.length&&v(w)},c.useEffect(()=>(h.current=t,b(),m),[t,b,m]),c.useEffect(()=>()=>{m(),p(),g([])},[g,p,m]);const _=c.useCallback((S,L="")=>{var w,R;if(!n||S.length===0)return!1;const x=S.map(j=>{const N=j.sourceLocation;return N?`re: ${N.filePath}:${N.lineStart}
40
- ${j.quotedText}`:j.quotedText}).join(`
41
-
42
- `),E=n(L?`${x}
43
- ${L}`:`${x}
44
- `);return E===null?!1:(s.current=E,v([...o.current,...S]),(R=(w=e.current)==null?void 0:w.ownerDocument.getSelection())==null||R.removeAllRanges(),!0)},[e,n,v]),C=c.useCallback((S="")=>{const L=e.current;if(!L)return!1;const x=sn(L);if(!x)return!1;const E=hr(x).map(tr);return _(E,S)},[_,e]);return c.useEffect(()=>{r>0&&v([])},[r,v]),{anchoredRenderIds:i,applyQuoteAnchors:_,applyQuoteFromSelection:C}}function ac({containerRef:e,inert:t,onQuoteSelection:n,onStartNewSessionFromSelection:r,composerDraftSignal:s,quoteClearSignal:o,isInteractiveTarget:i}){const{quoteReplyButtonMode:l}=nc(),u=op({containerRef:e,composerDraftSignal:s,onQuoteSelection:n,quoteClearSignal:o}),d=sp({...u,containerRef:e,inert:t,isInteractiveTarget:i,onQuoteSelection:n,onStartNewSessionFromSelection:r}),h=c.useCallback(f=>{u.applyQuoteAnchors([f])&&d.dismiss()},[u.applyQuoteAnchors,d.dismiss]);return{anchoredRenderIds:u.anchoredRenderIds,alwaysShowQuoteCircles:l==="paragraph-always",paragraphQuoteCirclesEnabled:l!=="block",handleQuoteTextBlock:h,mobileSelectionActions:d.mobileSelectionActions,floatingSelectionActions:d.floatingSelectionActions,selectionContextMenu:d.selectionContextMenu}}const zS=ac;function cc(e,t,n){c.useEffect(()=>{const r=e.current;if(!(!r||!(t!=null&&t.trim())))return sa(r,t,n)},[n,e,t])}function ei(e,t){const n=c.useRef(null);return cc(n,e,t),n}function ti(e,t){const n=new Map(t.map(r=>[r.id,r.text]));return e.filter(r=>n.get(r.id)!==r.text)}function ip({active:e,storageKey:t,sendComment:n}){const[r,s]=c.useState([]),[o,i]=c.useState(null),[l,u]=c.useState(new Set),[d,h]=c.useState(!1),f=c.useRef(r),g=c.useRef(o),m=c.useRef(l),p=c.useRef(n),y=c.useRef(t);g.current=o,m.current=l,p.current=n,y.current=t,c.useEffect(()=>{var j;const w=t?Um(t):[];f.current=w,g.current=((j=w.at(-1))==null?void 0:j.id)??null,s(w),i(g.current);const R=new Set;m.current=R,u(R),h(!1)},[t]);const b=c.useCallback(()=>{const w=y.current;w&&$r(w,f.current),s(f.current)},[]),v=c.useCallback(w=>{f.current=w,s(w)},[]),_=c.useCallback(w=>{g.current=w,i(w)},[]),C=c.useCallback(w=>{h(!1);const R=f.current.find(k=>k.id===g.current);if((R==null?void 0:R.location)===w.location&&R.quote===w.quote)return;const j=f.current.filter(k=>k.id!==g.current||k.text.trim()),N=j.find(k=>k.location===w.location&&k.quote===w.quote);if(N){v(j),_(N.id);return}const A={...w,id:crypto.randomUUID(),text:""};v([...j,A]),_(A.id)},[v,_]),S=c.useCallback((w,R)=>{h(!1),f.current=f.current.map(j=>j.id===w?{...j,text:R}:j)},[]),L=c.useCallback(w=>{h(!1),v(f.current.filter(R=>R.id!==w)),g.current===w&&_(null)},[v,_]),x=c.useCallback(async w=>{const R=f.current.find(I=>I.id===w),j=p.current;if(!(R!=null&&R.text.trim())||!j||m.current.has(w))return!1;const N=new Set(m.current).add(w);m.current=N,u(N),b();const A=await j(ic(R)),k=new Set(m.current);if(k.delete(w),m.current=k,u(k),!A)return h(!0),!1;const M=ti(f.current,[R]);v(M),g.current===w&&!M.some(I=>I.id===w)&&_(null);const P=y.current;return P&&$r(P,M),h(!1),!0},[b,v,_]),E=c.useCallback(async()=>{const w=p.current,R=f.current.filter(I=>I.text.trim()&&!m.current.has(I.id));if(R.length===0)return b(),!0;if(!w)return b(),!1;const j=new Set(R.map(I=>I.id)),N=new Set([...m.current,...j]);m.current=N,u(N),b();const A=await w(Vm(R)),k=new Set(m.current);for(const I of j)k.delete(I);if(m.current=k,u(k),!A)return h(!0),!1;const M=ti(f.current,R);v(M),g.current&&j.has(g.current)&&!M.some(I=>I.id===g.current)&&_(null);const P=y.current;return P&&$r(P,M),h(!1),!0},[b,v,_]);return c.useEffect(()=>{if(e)return()=>{E()}},[e,E]),{activeDraft:r.find(w=>w.id===o)??null,cancel:L,error:d,flush:E,open:C,persist:b,sendOne:x,sendingIds:l,update:S}}function as(e,t){var i,l;const n=t.replaceAll("\\","/"),r=((i=e.embeddedMedia)==null?void 0:i[t])??((l=e.embeddedMedia)==null?void 0:l[n]);if(!r)return null;const s=atob(r.data),o=new Uint8Array(s.length);for(let u=0;u<s.length;u+=1)o[u]=s.charCodeAt(u);return new Blob([o],{type:r.mimeType})}function wn(e){return["localhost","127.0.0.1","[::1]"].includes(e)?"local":"public"}function lc(e,t,n){const r=t==="local"?e.localOrigin:e.publicOrigin;if(!r)return;const s=new URL(r),o=new URL(n);if(!(s.hostname===o.hostname||!["http:","https:"].includes(s.protocol)||o.protocol==="https:"&&s.protocol!=="https:"))return s.origin}function Ts(e,t,n){if(!t)return!1;let r;try{r=new URL(e,n)}catch{return!1}return!r.username&&!r.password&&/^\/a\/[A-Za-z0-9_-]+\/.+/.test(r.pathname)&&["local","public"].some(s=>r.origin===lc(t,s,n))}async function ap(e,t){const n=await fetch(`${e}/health`,{credentials:"omit",referrerPolicy:"no-referrer",cache:"no-store",redirect:"error",signal:t});if(!n.ok||(await n.json()).artifactViewer!==1)throw new Error("Artifact origin is unavailable")}const cp=["default-src 'none'","script-src 'none'","connect-src 'none'","object-src 'none'","frame-src 'none'","worker-src 'none'","form-action 'none'","base-uri 'none'","img-src data: blob:","media-src data: blob:","style-src 'unsafe-inline'"].join("; ");function lp(e){return`<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${cp}"><meta name="referrer" content="no-referrer"></head><body>${e}</body></html>`}const up="_preview_1sfdn_1",dp="_toolbar_1sfdn_10",fp="_frame_1sfdn_32",hp="_notice_1sfdn_40",_t={preview:up,toolbar:dp,frame:fp,notice:hp};function uc(e){const{t}=xe(),n=ct(),r=bn(n.sourceKey),s=vt(),o=r==null?void 0:r.artifactViewer,i=wn(window.location.hostname),l=o&&s===null&&Vt(r,Pl.artifactViewer.name)?lc(o,i,window.location.href):void 0,[u,d]=c.useState(e.autoStart?1:0),[h,f]=c.useState(null),[g,m]=c.useState(!1),[p,y]=c.useState(!1),[b,v]=c.useState(!1);return c.useEffect(()=>{if(f(null),m(!1),y(!1),v(!1),!u||!l)return;let _=!1,C;const S=w=>{C&&w.disposition==="enforce"&&w.effectiveDirective==="frame-src"&&(w.blockedURI===l||w.blockedURI.startsWith(`${l}/`))&&v(!0)};document.addEventListener("securitypolicyviolation",S);const L=new AbortController,x=setTimeout(()=>L.abort(),2500);y(!0);const E=w=>{n.transport.fetch(`/artifacts/${encodeURIComponent(w)}`,{method:"DELETE"}).catch(()=>{})};return(async()=>{try{if(await ap(l,L.signal),clearTimeout(x),_)return;if(C=await n.transport.fetch("/artifacts",{method:"POST",body:JSON.stringify({path:e.path,projectId:e.projectId,audience:i})}),new URL(C.url).origin!==l)throw E(C.id),new Error("Unexpected artifact origin");if(_){E(C.id);return}f(C)}catch{_||m(!0)}finally{clearTimeout(x),_||y(!1)}})(),()=>{_=!0,L.abort(),clearTimeout(x),document.removeEventListener("securitypolicyviolation",S)}},[u,l,i,e.path,e.projectId,n]),a.jsxs("div",{className:`${_t.preview} ${e.className??""}`,children:[l&&(e.showControls!==!1||g)&&a.jsxs("div",{className:_t.toolbar,children:[a.jsx("button",{type:"button",disabled:p,onClick:()=>d(h?0:_=>_+1),children:t(h?"artifactStop":p?"artifactChecking":g?"artifactRetry":"artifactRun")}),g&&a.jsx("span",{role:"status",children:t("artifactUnavailable")})]}),e.showControls===!1&&p&&a.jsx("div",{className:_t.notice,role:"status",children:t("artifactChecking")}),e.autoStart&&!l&&a.jsx("div",{className:_t.notice,role:"status",children:t("artifactUnavailable")}),h&&b?a.jsxs("div",{className:_t.notice,role:"alert",children:[a.jsx("p",{children:t("artifactFrameBlocked")}),a.jsx("a",{href:h.url,target:"_blank",rel:"noopener noreferrer",children:t("artifactOpenTab")})]}):h?a.jsx("iframe",{className:_t.frame,title:e.title,"aria-label":e.title,sandbox:"allow-scripts allow-same-origin",referrerPolicy:"no-referrer",src:h.url},h.id):a.jsx("iframe",{className:_t.frame,title:e.title,"aria-label":e.title,"data-tooltip":"",sandbox:"",referrerPolicy:"no-referrer",srcDoc:lp(e.html)})]})}const mp="_actions_116fb_1",pp="_destructive_116fb_27",ni={actions:mp,destructive:pp};function dc({url:e,copyUrl:t=e,onClose:n,onMinimize:r,closeRef:s,className:o,minimizeLabel:i,closeLabel:l,moveOut:u=!0,onMoveOut:d=n,destructiveClose:h=!1,closeDisabled:f=!1}){const{t:g}=xe(),[m,p]=c.useState("idle"),y=c.useRef(void 0);c.useEffect(()=>()=>clearTimeout(y.current),[]);const b=new URL(e,window.location.href).href,v=g(m==="copied"?"fileViewerCopied":m==="failed"?"viewerCopyLinkFailed":"viewerLinkHint"),_=C=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:C})});return a.jsxs("div",{className:`${ni.actions} ${o??""}`,children:[a.jsx("a",{href:b,target:"_blank",rel:"noopener noreferrer",role:"button","aria-label":g("fileLinkMenuCopyViewerLink"),title:v,onKeyDown:C=>{C.key===" "&&(C.preventDefault(),C.currentTarget.click())},onClick:C=>{if(C.shiftKey){C.preventDefault(),window.open(b,"_blank","noopener,noreferrer");return}C.ctrlKey||C.metaKey||C.altKey||(C.preventDefault(),fe(new URL(t,window.location.href).href).then(S=>{p(S?"copied":"failed"),clearTimeout(y.current),y.current=setTimeout(()=>p("idle"),3e3)}))},children:_(m==="copied"?"M3 8l3 3 7-7":"M6.5 9.5a2.5 2.5 0 0 0 3.54 0l2.46-2.46a2.5 2.5 0 0 0-3.54-3.54L7.9 4.56M9.5 6.5a2.5 2.5 0 0 0-3.54 0L3.5 8.96a2.5 2.5 0 0 0 3.54 3.54l1.06-1.06")}),u&&a.jsx("a",{href:b,target:"_blank",rel:"noopener noreferrer","aria-label":g("viewerMoveToNewTab"),title:g("viewerMoveToNewTab"),onClick:d,onAuxClick:C=>{C.button===1&&(d==null||d())},children:_("M12 9v4a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h4M9 2h5v5M6 10l8-8")}),r&&a.jsx("button",{type:"button",onClick:r,"aria-label":i??g("modalMinimize"),title:i??g("modalMinimize"),children:_("M3 12h10")}),n&&a.jsx("button",{ref:s,className:h?ni.destructive:void 0,disabled:f,type:"button",onClick:n,"aria-label":l??g("modalClose"),title:l??g("modalClose"),children:_("M4 4l8 8M12 4l-8 8")})]})}function fc(e){return e&&e.replace(/<\/span>\r?\n(?=<span class="line(?:\s|"))/g,"</span>")}function gp(e){const t=[];let n=0;const r=/\r\n|\r|\n/g;for(let s=r.exec(e);s;s=r.exec(e)){const o=s.index;t.push({start:n,end:o,text:e.slice(n,o)}),n=s.index+s[0].length}return t.push({start:n,end:e.length,text:e.slice(n)}),t}function hc(e,t,n){e.setAttribute(ru,String(t)),e.setAttribute(su,String(n))}function wp(e,t){const n=new Map,r=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);let s=0;for(let o=r.nextNode();o;o=r.nextNode()){const i=o,l=i.data;if(t.text.slice(s,s+l.length)!==l)return;const u=t.start+s,d=u+l.length;for(let h=i.parentElement;h&&h!==e;h=h.parentElement){const f=n.get(h);n.set(h,{start:f?Math.min(f.start,u):u,end:f?Math.max(f.end,d):d})}s+=l.length}if(s===t.text.length)for(const[o,i]of n)hc(o,i.start,i.end)}function yp(e,t){if(!e||t===void 0||typeof document>"u")return e;const n=document.createElement("template");n.innerHTML=fc(e)??"";const r=Array.from(n.content.querySelectorAll("code .line")),s=gp(t);for(let o=0;o<r.length;o+=1){const i=r[o],l=s[o];!i||!l||i.textContent!==l.text||(hc(i,l.start,l.end),wp(i,l))}return n.innerHTML}function vp(e,t){if(typeof document>"u")return null;const n=document.createElement("template");if(n.innerHTML=e,!Array.from(n.content.querySelectorAll("code .line[data-line]")).some(o=>Number(o.dataset.line)===t))return null;const s=o=>{const i=n.content.cloneNode(!0);for(const u of i.querySelectorAll("code .line[data-line]")){const d=Number(u.dataset.line);(!Number.isInteger(d)||!o(d))&&u.remove()}const l=document.createElement("div");return l.append(i),l.innerHTML};return{before:s(o=>o<=t),after:s(o=>o>t)}}function bp({value:e,title:t,className:n,disabled:r=!1,icon:s="copy"}){const[o,i]=c.useState(!1),[l,u]=c.useState(!1);return c.useEffect(()=>{if(!o)return;const d=setTimeout(()=>i(!1),1200);return()=>clearTimeout(d)},[o]),a.jsx("button",{type:"button",className:`copy-button ${o?"copied":""} ${n??""}`,title:t,"aria-label":t,disabled:r||l,onClick:async d=>{d.stopPropagation(),u(!0);const h=typeof e=="function"?await Rt(e()):await fe(e);u(!1),h&&i(!0)},children:o?a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsx(xp,{icon:s})})}function xp({icon:e}){const t={width:13,height:13,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};return e==="path"?a.jsxs("svg",{...t,"aria-hidden":"true",children:[a.jsx("path",{d:"M3 7h6l2 2h10v9H3z"}),a.jsx("path",{d:"M8 14h8"}),a.jsx("path",{d:"m13 11 3 3-3 3"})]}):e==="content"?a.jsxs("svg",{...t,"aria-hidden":"true",children:[a.jsx("path",{d:"M6 2h8l4 4v16H6z"}),a.jsx("path",{d:"M14 2v5h5"}),a.jsx("path",{d:"M9 12h6M9 16h6"})]}):a.jsxs("svg",{...t,"aria-hidden":"true",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}const Sp="_root_eaud3_1",_p="_commit_eaud3_14",Ep="_age_eaud3_23",Cp="_dirty_eaud3_27",kp="_uncommitted_eaud3_33",$t={root:Sp,commit:_p,age:Ep,dirty:Cp,uncommitted:kp};function Ps({projectId:e,path:t,rev:n,origPath:r,dirtyLabel:s,uncommittedLabel:o,className:i}){const l=vn(),u=bn(l),d=lt(),h=Vt(u,Nl),f=`${l}\0${e}\0${t}\0${n??""}\0${r??""}`,[g,m]=c.useState({identity:f,value:null}),p=g.identity===f?g.value:null;if(c.useEffect(()=>{if(!h||!e||!t)return;let _=!1;return ue.getGitFileRevision(e,{path:t,rev:n,origPath:r}).then(C=>{_||m({identity:f,value:C})}).catch(()=>{_||m({identity:f,value:null})}),()=>{_=!0}},[f,r,t,e,n,h]),!h||!(p!=null&&p.isGitRepo))return null;if(!p.commit)return a.jsx("span",{className:`${$t.root} ${$t.uncommitted} ${i??""}`,children:o});const y=new URLSearchParams({projectId:e,rev:p.commit.hash,commitFile:n?t:r??t}),b=yt(`${d}/git-status?${y.toString()}`),v=Rp(p.commit);return a.jsxs("span",{className:`${$t.root} ${i??""}`,children:[a.jsx("a",{className:$t.commit,href:b,title:v,children:p.commit.shortHash}),a.jsxs("span",{className:$t.age,children:["(",Lp(p.commit.authorDate),")"]}),p.dirty&&a.jsx("span",{className:$t.dirty,children:s})]})}function Lp(e,t=Date.now()){const n=Math.max(0,Math.floor((t-new Date(e).getTime())/1e3));if(n<60)return"now";const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const s=Math.floor(r/60);if(s<24)return`${s}h ago`;const o=Math.floor(s/24);return o<30?`${o}d ago`:o<365?`${Math.floor(o/30)}mo ago`:`${Math.floor(o/365)}y ago`}function Rp(e){const t=new Date(e.authorDate).toLocaleString(),n=`${e.message}${e.messageTruncated?`
45
- ...`:""}`;return`${e.authorName}
46
- ${t}
47
-
48
- ${n}`}function Mp(e){return e==="auto"||e==="unified"||e==="side-by-side"}function Ap(){try{const e=localStorage.getItem(Ee.diffViewMode);if(Mp(e))return e}catch{}return"auto"}function jp(){const[e,t]=c.useState(Ap),n=c.useCallback(r=>{t(r);try{localStorage.setItem(Ee.diffViewMode,r)}catch{}},[]);return[e,n]}const Tp="[data-source-list-item]:not(:disabled)",Pp="[data-source-file-item]:not(:disabled)",Np=100;function Br(){Il(Np)}function qS(e,{filesOnly:t=!1,onPage:n}={}){var h,f;const r=e.key==="PageDown"?1:e.key==="PageUp"?-1:null;if(r===null&&e.key!=="ArrowDown"&&e.key!=="ArrowUp"&&e.key!=="ArrowLeft"&&e.key!=="ArrowRight"||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;if(r!==null){if(!n)return;e.preventDefault(),Br(),n(r);return}const s=Array.from(e.currentTarget.querySelectorAll(t?Pp:Tp));if(s.length===0)return;const o=document.activeElement,i=s.indexOf(o);if(i<0)return;if(e.key==="ArrowLeft"||e.key==="ArrowRight"){const g=s[i],m=g.getAttribute("aria-expanded");if(e.preventDefault(),Br(),e.key==="ArrowRight"){if(m==="false"){g.click();return}if(m==="true"){const b=s[i+1];if(!b||!((h=g.parentElement)!=null&&h.contains(b)))return;b.focus()}return}if(m==="true"){g.click();return}const p=g.closest("ul");if(!p||p===e.currentTarget)return;const y=(f=p.parentElement)==null?void 0:f.querySelector(":scope > [data-source-list-item]:not(:disabled)");if(!y)return;y.focus();return}const l=e.key==="ArrowDown"?1:-1,u=Math.min(s.length-1,Math.max(0,i+l)),d=s[u];d&&(e.preventDefault(),Br(),d!==o&&d.focus())}function WS(e,t=!0){c.useEffect(()=>{if(!t)return;const n=r=>{if(r.defaultPrevented||r.key!=="/"||r.altKey||r.ctrlKey||r.metaKey||mc(r.target))return;const s=e.current;s&&(r.preventDefault(),s.focus(),s.select())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e])}function mc(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.tagName==="SELECT":!1}const Ip=1e3;function $p(e,t){return e==="unified"||e==="side-by-side"?e:t>=Ip?"side-by-side":"unified"}function Dp(e){const t=[];let n=0;for(const r of e){t.push({type:"header",text:`@@ -${r.oldStart},${r.oldLines} +${r.newStart},${r.newLines} @@`});let s=[],o=[];const i=()=>{const l=Math.max(s.length,o.length);for(let u=0;u<l;u++)t.push({type:"line",left:s[u]??null,right:o[u]??null});s=[],o=[]};for(const l of r.lines){const u=n++,d=l[0];d==="-"?s.push(u):d==="+"?o.push(u):(i(),t.push({type:"line",left:u,right:u}))}i()}return t}function pc(e,t=!1){var s;const n=new Map;if(typeof DOMParser>"u")return n;const r=new DOMParser().parseFromString(e,"text/html");for(const o of r.querySelectorAll("[data-diff-line]")){const i=Number(o.getAttribute("data-diff-line"));Number.isInteger(i)&&(t&&((s=o.querySelector(".diff-prefix"))==null||s.remove()),n.set(i,o.outerHTML))}return n}const Bp=c.createContext(null);function Fp(){return c.useContext(Bp)}const Gn=new Map;function Op(e,t){let n=Gn.get(e);return n||(n=new Set,Gn.set(e,n)),n.add(t),()=>{n==null||n.delete(t),n&&n.size===0&&Gn.delete(e)}}function ri(e){for(const t of Gn.get(e)??[])t()}function Hp(e,t,n=!1){const r=$l(),s=lt(),o=Fp(),[i,l]=c.useState([]),[u,d]=c.useState(!1),[h,f]=c.useState(null),g=c.useRef(null),m=c.useCallback(async()=>{try{const b=await ue.listReviewComments(e);l(b.comments.filter(v=>v.status==="pending"&&v.anchor.path===t))}catch{}},[e,t]);c.useEffect(()=>(m(),Op(e,()=>{m()})),[e,m]);const p=c.useCallback(async(b,v)=>{d(!0),f(null);try{const{comment:_}=await ue.addReviewComment(e,b,v);return l(C=>[...C,_]),ri(e),!0}catch(_){return f(_ instanceof Error?_.message:"Failed to add comment"),!1}finally{d(!1)}},[e]),y=c.useCallback(async(b,v,_,C,S)=>{var L;d(!0),f(null);try{const x=JSON.stringify({anchor:b,text:v,target:_}),E=n&&((L=g.current)==null?void 0:L.key)===x?g.current:null,w=E?E.commentId:(await ue.addReviewComment(e,b,v)).comment.id,R=(E==null?void 0:E.submissionId)??crypto.randomUUID();n&&!E&&(g.current={key:x,commentId:w,submissionId:R});const j=n?{id:R}:void 0,N=j?await ue.submitReview(e,[w],_,_==="new"?S:void 0,j):_==="new"&&S?await ue.submitReview(e,[w],_,S):await ue.submitReview(e,[w],_);return ri(e),N.sessionId?(g.current=null,r(`${s}/projects/${e}/sessions/${N.sessionId}`),"navigated"):(n&&(g.current=null),f(C),m(),"queued")}catch(x){return f(x instanceof Error?x.message:"Failed to submit"),"error"}finally{d(!1)}},[e,r,s,m,n]);return{pending:i,defaultSession:o,busy:u,error:h,setError:f,refreshPending:m,addToReview:p,submitNow:y}}const gc=Yi*Xi,Up=80,Vp=600,zp=10,Ns=150,or="yep-hovercard-appearance-change",qp=ws(Ee.sessionHoverCardShowDelayMs,gc,e=>{const t=Number(e);return Number.isFinite(t)?Math.max(0,t):void 0});function Wp(e,t,n){return Math.min(n,Math.max(t,e))}function Kp(e,t){return Math.round(e/t)*t}function wc(e){return Number.isFinite(e)?Wp(Kp(e,zp),Up,Vp):Ns}function Gp(e,t){const n=localStorage.getItem(e);return n===null?t:Number(n)}function si(){return{showDelayMs:gc,warmShowDelayMs:Yi,maxHeightPx:wc(Gp(Ee.sessionHoverCardMaxHeightPx,Ns))}}function yc(){const{tooltipMode:e,tooltipDelayMs:t}=Dl(),[n,r]=c.useState(si);c.useEffect(()=>{const o=()=>r(si());return window.addEventListener(or,o),()=>window.removeEventListener(or,o)},[]);const s=qp.read();return{...n,showDelayMs:e==="native"?s:t*Xi,warmShowDelayMs:t}}function KS(){const{maxHeightPx:e}=yc(),t=c.useCallback(r=>{localStorage.setItem(Ee.sessionHoverCardMaxHeightPx,String(wc(r))),window.dispatchEvent(new Event(or))},[]),n=c.useCallback(()=>{localStorage.removeItem(Ee.sessionHoverCardMaxHeightPx),window.dispatchEvent(new Event(or))},[]);return{hoverCardMaxHeightPx:e,setHoverCardMaxHeightPx:t,resetHoverCardAppearance:n}}const cs="active-session-hovercard",ls=new EventTarget;let oi=0;function Qp(){return oi+=1,`session-hovercard-${oi}`}function Xp(e){ls.dispatchEvent(new CustomEvent(cs,{detail:e}))}function Yp(e){const t=n=>{e(n.detail)};return ls.addEventListener(cs,t),()=>{ls.removeEventListener(cs,t)}}function Jp({targetRef:e,showDelayMs:t,warmShowDelayMs:n,enabled:r=!0,refreshPreview:s}){const o=s==null?void 0:s.projectId,i=s==null?void 0:s.sessionId,l=s==null?void 0:s.lastAgentText,u=s==null?void 0:s.owner,d=s!==void 0&&s.available!==!1,h=c.useRef(Symbol("session-hovercard-intent")),f=c.useRef(null),g=c.useRef(null),m=c.useRef(!1),p=c.useRef(null);p.current||(p.current=Qp());const y=p.current,[b,v]=c.useState(null),_=c.useRef(null),C=c.useCallback(()=>{Bl(h.current)},[]),S=c.useCallback(()=>{const N=f.current;N&&(f.current=null,Fl(N))},[]),L=c.useCallback(()=>{C(),S(),_.current=null,v(null)},[C,S]),x=c.useCallback(()=>{!d||!o||!i||l||u==="self"||u==="external"||m.current||(m.current=!0,ue.refreshSessionPreview(o,i).finally(()=>{m.current=!1}))},[d,l,u,o,i]),E=c.useCallback(()=>{if(!r||Ol()){L();return}C();const N=Hl()?n:t,A=e.current;A&&Ul(h.current,N,()=>{if(!A.isConnected||!zl(A))return;const k=A.getBoundingClientRect();x(),Xp(y),f.current??(f.current=ql(L));const M={rowLeft:k.left,rowTop:k.top,rowRight:k.right,rowBottom:k.bottom,cursorX:g.current??k.right};_.current=M,v(M)})},[L,C,r,y,x,t,e,n]);c.useEffect(()=>Yp(N=>{N!==y&&L()}),[L,y]),c.useEffect(()=>Vl(L),[L]),c.useEffect(()=>{r||L()},[L,r]),c.useEffect(()=>()=>{C(),S()},[C,S]);const w=c.useCallback(N=>{N.pointerType!=="touch"&&(g.current=N.clientX,E())},[E]),R=c.useCallback(N=>{N.pointerType!=="touch"&&(g.current=N.clientX,_.current||E())},[E]),j=c.useCallback(N=>{const A=N.relatedTarget;A instanceof Element&&A.closest(`[data-session-hovercard-id="${y}"]`)!==null||L()},[L,y]);return{anchor:b,hoverCardId:y,clear:L,onPointerEnter:w,onPointerMove:R,onPointerLeave:j}}const Zp=Date.UTC(2001,0,1);function eg(e){if(!e)return!1;const t=new Date(e).getTime();return Number.isFinite(t)&&t>=Zp}function ii(e){if(!eg(e))return null;const t=Date.now()-new Date(e).getTime();if(t<0)return"0m";const n=Math.floor(t/6e4);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function tg(e,t){const n=ii(e),r=ii(t);return n?`${n} ago${r?` (est. ${r})`:""}`:r?`est. ${r}`:null}const ng=/<command-name>([\s\S]*?)<\/command-name>/,rg=/<command-message>[\s\S]*?<\/command-message>/g,sg=/<command-args>([\s\S]*?)<\/command-args>/,og=/<command-name>[\s\S]*?<\/command-name>/g,ig=/<command-args>[\s\S]*?<\/command-args>/g,ag=/<local-command-caveat>[\s\S]*?<\/local-command-caveat>/g,cg=/^(?:\s*<local-command-caveat>[\s\S]*?<\/local-command-caveat>\s*)+$/,lg=/^\s*<local-command-stdout>([\s\S]*?)<\/local-command-stdout>\s*$/,ug=new RegExp("\x1B\\[[\\d;:? ]*[ -/]*[@-~]","g");function dg(e){var s,o,i,l;const t=(o=(s=e.match(ng))==null?void 0:s[1])==null?void 0:o.trim();if(!t||e.replace(ag,"").replace(og,"").replace(rg,"").replace(ig,"").trim())return null;const r=((l=(i=e.match(sg))==null?void 0:i[1])==null?void 0:l.trim())??"";return{command:t,args:r}}function GS(e){return e.args?`${e.command} ${e.args}`:e.command}function QS(e){return cg.test(e)}function XS(e){var n;const t=e.match(lg);return((n=t==null?void 0:t[1])==null?void 0:n.replace(ug,"").trim())??null}function YS(e){const t=e.replace(/\s+/g," ").trim().toLowerCase();return t==="compacted"||t.startsWith("compacted (")}const fg=19,hg=34,mg=20,pg=38;function gg(e,t){return Math.max(1,Math.floor((e-hg-mg-(t?pg:0))/fg))}const vc="--ya-activity-play",ht=new Map;let at=null;function wg(){return document.visibilityState==="visible"}function Is(e,t){const n=t.intersectsViewport&&wg();if(e.style.setProperty(vc,n?"running":"paused"),t.active!==n){t.active=n;for(const r of t.subscriptions.values())r==null||r(n)}}function yg(e){for(const t of e){const n=t.target,r=ht.get(n);r&&(r.intersectsViewport=t.isIntersecting,Is(n,r))}}function vg(){return typeof window.IntersectionObserver!="function"?null:(at??(at=new window.IntersectionObserver(yg)),at)}function ai(){for(const[e,t]of ht)Is(e,t)}function bg(e,t){const n=Symbol("activity-animation");let r=ht.get(e);if(r)r.subscriptions.set(n,t),t==null||t(r.active??!1);else{const s=vg();r={active:null,intersectsViewport:s===null,subscriptions:new Map([[n,t]])};const o=ht.size===0;ht.set(e,r),o&&document.addEventListener("visibilitychange",ai),s==null||s.observe(e),Is(e,r)}return()=>{const s=ht.get(e);s&&(s.subscriptions.delete(n),!(s.subscriptions.size>0)&&(at==null||at.unobserve(e),ht.delete(e),e.style.removeProperty(vc),ht.size===0&&(at==null||at.disconnect(),at=null,document.removeEventListener("visibilitychange",ai))))}}const xg="_dot_m9hw9_1",Sg="_root_m9hw9_11",_g="_pill_m9hw9_17",Eg="_label_m9hw9_30",Cg="_icon_m9hw9_34",kg="_iconSvg_m9hw9_46",Dt={dot:xg,root:Sg,pill:_g,label:Eg,icon:Cg,iconSvg:kg};function Lg({variant:e="dot",label:t="Thinking",className:n,animationVisibilityManaged:r=!1}){const s=c.useRef(null);c.useEffect(()=>{if(!(r||!s.current))return bg(s.current)},[r]);const o=a.jsx("span",{className:Dt.dot});return e==="icon"?a.jsx("span",{ref:s,className:`${Dt.icon} ${n??""}`,title:t,"aria-label":t,role:"img",children:a.jsxs("svg",{className:Dt.iconSvg,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M12 18V5"}),a.jsx("path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4"}),a.jsx("path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5"}),a.jsx("path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77"}),a.jsx("path",{d:"M18 18a4 4 0 0 0 2-7.464"}),a.jsx("path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517"}),a.jsx("path",{d:"M6 18a4 4 0 0 1-2-7.464"}),a.jsx("path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77"})]})}):e==="pill"?a.jsxs("span",{ref:s,className:`${Dt.pill} ${n??""}`,children:[o,a.jsx("span",{className:Dt.label,children:t})]}):a.jsx("span",{ref:s,className:`${Dt.root} ${n??""}`,children:o})}function Rg({variant:e,label:t}){const n=e==="needs-input"?"Input Needed":"New";return a.jsx("span",{className:`status-badge notification-${e}`,children:t??n})}function Mg({status:e,pendingInputType:t,activity:n}){if(e.owner==="external")return a.jsx("span",{className:"status-badge status-external",children:"External"});if(t){const r=t==="tool-approval"?"Approval Needed":"Question";return a.jsx(Rg,{variant:"needs-input",label:r})}return n==="in-turn"?a.jsx(Lg,{variant:"pill"}):null}const Ag="_root_79ggm_5",jg="_wide_79ggm_15",Tg="_turn_79ggm_38",Pg="_command_79ggm_54",Ng="_meta_79ggm_59",Ig="_project_79ggm_68",$g="_age_79ggm_76",Dg="_reply_79ggm_85",Bg="_replyMarker_79ggm_95",Fg="_replyText_79ggm_100",Ye={root:Ag,wide:jg,turn:Tg,command:Pg,meta:Ng,project:Ig,age:$g,reply:Dg,replyMarker:Bg,replyText:Fg},Hn=4,gt=8,Og=14,ci=8;function Hg({rowLeft:e,rowRight:t,cursorX:n,cardWidth:r,viewportWidth:s}){const o=Math.max(gt,s-r-gt),i=t+ci;if(i+r<=s-gt)return i;const l=e-ci-r;return l>=gt?l:Math.min(Math.max(n+Og,gt),o)}function Ug({hoverCardId:e,anchor:t,prompt:n,lastAgentText:r,provider:s,model:o,projectName:i,ageLabel:l,onMouseLeave:u,status:d,pendingInputType:h,hasUnread:f,activity:g,maxHeightPx:m=Ns}){const p=c.useRef(null),y=ei(n),b=ei(r),[v,_]=c.useState(null),C=[n,r??"",o??"",i??"",l,d].join("\0");c.useLayoutEffect(()=>{const x=p.current;if(!x)return;const{rowTop:E,rowBottom:w}=t,R=x.scrollHeight,j=x.offsetWidth,N=Math.max(0,window.innerHeight-w-Hn-gt),A=Math.max(0,E-Hn-gt),k=Math.min(R,m),M=Math.min(N,m),P=Math.min(A,m);let I,$,H=!1;k<=M?(I=!0,$=M):k<=P?(I=!1,$=P):(I=N>=A,$=Math.min(Math.max(N,A),m),H=!0);const V=Math.min(R,$),O=I?w+Hn:E-Hn-V,K=Hg({...t,cardWidth:j,viewportWidth:window.innerWidth});_({top:Math.max(gt,O),left:K,maxHeight:$,loosened:H})},[t,C,m]);const S=v?gg(v.maxHeight,!!r):void 0,L=n?dg(n):null;return $e.createPortal(a.jsxs("div",{ref:p,"data-session-hovercard-id":e,...Jn,className:`${Ye.root}${v!=null&&v.loosened?` ${Ye.wide}`:""}`,onMouseLeave:u,style:v?{top:v.top,left:v.left,maxHeight:v.maxHeight}:{top:0,left:0,visibility:"hidden"},role:"tooltip",children:[n&&a.jsx("div",{ref:y,className:Ye.turn,style:S?{WebkitLineClamp:S}:void 0,children:L?a.jsxs("span",{className:Ye.command,children:[L.command,L.args?` ${L.args}`:""]}):n}),a.jsxs("div",{className:Ye.meta,children:[a.jsx(lu,{provider:s,model:o}),i&&a.jsx("span",{className:Ye.project,children:i}),l&&a.jsx("span",{className:Ye.age,children:l}),d&&a.jsx(Mg,{status:d,pendingInputType:h,hasUnread:f,activity:g})]}),r&&a.jsxs("div",{ref:b,className:Ye.reply,children:[a.jsx("span",{className:Ye.replyMarker,"aria-hidden":"true",children:"↳"}),a.jsx("span",{className:Ye.replyText,children:r})]})]}),document.body)}function li({sessionId:e,fallback:t,children:n,className:r}){var _,C;const s=Yl(e),{showDelayMs:o,warmShowDelayMs:i,maxHeightPx:l}=yc(),u=c.useRef(null),{anchor:d,hoverCardId:h,clear:f,onPointerEnter:g,onPointerMove:m,onPointerLeave:p}=Jp({targetRef:u,showDelayMs:o,warmShowDelayMs:i,refreshPreview:{projectId:t.projectId,sessionId:e,lastAgentText:s==null?void 0:s.lastAgentText,owner:(_=s==null?void 0:s.ownership)==null?void 0:_.owner,available:!!s}});c.useEffect(()=>{if(!d)return;const S=()=>f();return window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[d,f]);const b=((C=!!(s!=null&&s.customTitle)?s==null?void 0:s.title:(s==null?void 0:s.initialPrompt)??(s==null?void 0:s.fullTitle)??(s==null?void 0:s.title))==null?void 0:C.trim())||t.title,v=(s==null?void 0:s.provider)??t.provider;return a.jsxs("span",{ref:u,className:r,onPointerEnter:g,onPointerMove:m,onPointerLeave:p,children:[n,d&&a.jsx(Ug,{hoverCardId:h,anchor:d,prompt:b,lastAgentText:s==null?void 0:s.lastAgentText,provider:v,model:(s==null?void 0:s.model)??t.model,projectName:s==null?void 0:s.projectName,ageLabel:tg(s==null?void 0:s.updatedAt,s==null?void 0:s.createdAt),status:s==null?void 0:s.ownership,pendingInputType:s==null?void 0:s.pendingInputType,hasUnread:s==null?void 0:s.hasUnread,activity:s==null?void 0:s.activity,maxHeightPx:l,onMouseLeave:f})]})}async function Vg(e){var r;const t=[];let n;for(;;){const s=await ue.getGlobalSessions({project:e,limit:500,after:n});if(t.push(...s.sessions),!s.hasMore)return t;const o=(r=s.sessions[s.sessions.length-1])==null?void 0:r.updatedAt;if(!o||o===n)throw new Error("Existing-session list did not advance");n=o}}function zg(e,t){const n=e.customTitle||e.title||e.id.slice(0,8),r=e.model?`${e.provider}/${e.model}`:e.provider;return t?`${n} · ${r} · ${t}`:`${n} · ${r}`}const qg="_window_1f36g_1",Wg="_anchor_1f36g_12",Kg="_snippet_1f36g_18",Gg="_input_1f36g_30",Qg="_error_1f36g_41",Xg="_actions_1f36g_46",Yg="_submitActions_1f36g_53",Jg="_destination_1f36g_62",Zg="_destinationError_1f36g_76",ew="_defaultSessionTarget_1f36g_82",tw="_submit_1f36g_53",Oe={window:qg,anchor:Wg,snippet:Kg,input:Gg,error:Qg,actions:Xg,submitActions:Yg,destination:Jg,destinationError:Zg,defaultSessionTarget:ew,submit:tw};function nw({projectId:e,anchorLabel:t,snippet:n,busy:r,error:s,onCancel:o,onAddToReview:i,defaultSession:l,onSubmit:u,t:d}){const[h,f]=c.useState(""),[g,m]=c.useState(null),[p,y]=c.useState(!1),[b,v]=c.useState((l==null?void 0:l.id)??"new"),_=c.useRef(!1),C=h.trim().length>0&&!r;c.useEffect(()=>{let x=!1;return Vg(e).then(E=>{var w;x||(m(E),!l&&!_.current&&v(((w=E[0])==null?void 0:w.id)??"new"))}).catch(()=>{x||y(!0)}),()=>{x=!0}},[l,e]);const S=(g==null?void 0:g.find(x=>x.id===b))??null,L=a.jsx("button",{type:"button",className:Oe.submit,onClick:()=>u(h,b),disabled:!C,children:d("sourceReviewSubmitComment")});return a.jsx(bc,{anchorLabel:t,snippet:n,text:h,placeholder:d("sourceReviewCommentPlaceholder"),error:s,onChange:f,actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"review-comment-window-cancel",onClick:o,disabled:r,children:d("cancel")}),a.jsx("button",{type:"button",className:"review-comment-window-add",onClick:()=>i(h),disabled:!C,children:d("sourceReviewAddToReview")}),a.jsxs("div",{className:Oe.submitActions,children:[a.jsxs("label",{className:Oe.destination,children:[a.jsx("span",{children:d("sourceReviewTargetLegend")}),a.jsxs("select",{value:b,onChange:x=>{_.current=!0,v(x.target.value)},children:[a.jsx("option",{value:"new",children:d("sourceReviewTargetNew")}),l&&!(g!=null&&g.some(x=>x.id===l.id))&&a.jsxs("option",{value:l.id,children:[l.title," ·"," ",l.newSession.provider,l.newSession.model?`/${l.newSession.model}`:""," ","· ",d("sourceReviewCurrentSuffix")]}),g==null?void 0:g.map(x=>a.jsx("option",{value:x.id,children:zg(x,x.id===(l==null?void 0:l.id)?d("sourceReviewCurrentSuffix"):void 0)},x.id))]})]}),p&&a.jsx("span",{className:Oe.destinationError,children:d("sourceReviewSessionsUnavailable")}),l&&b===l.id?a.jsx(li,{sessionId:l.id,fallback:{projectId:l.projectId,title:l.title,provider:l.newSession.provider,model:l.newSession.model},className:Oe.defaultSessionTarget,children:L}):S?a.jsx(li,{sessionId:S.id,fallback:{projectId:S.projectId,title:S.customTitle||S.title||S.id.slice(0,8),provider:S.provider,model:S.model},className:Oe.defaultSessionTarget,children:L}):L]})]})})}function bc({anchorLabel:e,snippet:t,text:n,placeholder:r,autoFocus:s=!0,error:o,onChange:i,onBlur:l,onKeyDown:u,actions:d}){return a.jsxs("div",{className:Oe.window,"data-markdown-copy-ignore":"true",children:[a.jsx("div",{className:Oe.anchor,children:e}),a.jsx("pre",{className:Oe.snippet,children:t}),a.jsx("textarea",{className:Oe.input,autoFocus:s,rows:3,value:n,placeholder:r,onBlur:l,onChange:h=>i(h.target.value),onKeyDown:u}),o&&a.jsx("div",{className:Oe.error,children:o}),a.jsx("div",{className:Oe.actions,children:d})]})}const rw="_menuTrigger_qenm5_1",sw={menuTrigger:rw};function ow({container:e,structuredPatch:t,pending:n,revisions:r,consumeLongPressClick:s,onOpenComment:o,onOpenMenu:i,onBeginLongPress:l,onMoveLongPress:u,onEndLongPress:d,t:h}){const[f,g]=c.useState(null),m=c.useCallback(b=>{if(!(b instanceof HTMLElement))return null;const v=b.closest("[data-diff-line]");return!v||!e.contains(v)?null:Fr(e,v,t)},[e,t]),p=c.useCallback(b=>{g(v=>(v==null?void 0:v.flatIndex)===b.flatIndex&&v.contextSide===b.contextSide&&v.top===b.top?v:b)},[]),y=c.useCallback(()=>{if(!f)return null;const b=e.querySelectorAll(`[data-diff-line="${f.flatIndex}"]`),v=Array.from(b).find(_=>xc(_)===f.contextSide)??b[0];return v?Fr(e,v,t):null},[f,e,t]);return c.useLayoutEffect(()=>{const b=w=>{var j;if(s()||!(((j=window.getSelection())==null?void 0:j.isCollapsed)??!0))return;const R=m(w.target);R&&o(R)},v=w=>{const R=m(w.target);R&&(w.preventDefault(),w.stopPropagation(),p(R.target),i(R,{x:w.clientX,y:w.clientY}))},_=w=>{const R=m(w.target);R&&(p(R.target),l(R,w))},C=w=>{u(w);const R=m(w.target);R&&p(R.target)},S=()=>d(),L=()=>{d(),g(null)},x=w=>{const R=m(w.target);R&&p(R.target)},E=w=>{const R=m(w.target);if(!R)return;if(w.key==="ContextMenu"||w.shiftKey&&w.key==="F10"){w.preventDefault(),w.stopPropagation();const k=R.node.getBoundingClientRect();i(R,{x:k.left+Math.min(32,k.width/2),y:k.bottom});return}if(w.key==="Enter"||w.key===" "){w.preventDefault(),o(R);return}if(w.key!=="ArrowDown"&&w.key!=="ArrowUp")return;const j=Array.from(e.querySelectorAll("[data-diff-line]")),N=j.indexOf(R.node),A=j[N+(w.key==="ArrowDown"?1:-1)];A&&(w.preventDefault(),A.focus())};return e.addEventListener("click",b),e.addEventListener("contextmenu",v),e.addEventListener("pointerdown",_),e.addEventListener("pointermove",C),e.addEventListener("pointerup",S),e.addEventListener("pointercancel",S),e.addEventListener("pointerleave",L),e.addEventListener("focusin",x),e.addEventListener("keydown",E),()=>{e.removeEventListener("click",b),e.removeEventListener("contextmenu",v),e.removeEventListener("pointerdown",_),e.removeEventListener("pointermove",C),e.removeEventListener("pointerup",S),e.removeEventListener("pointercancel",S),e.removeEventListener("pointerleave",L),e.removeEventListener("focusin",x),e.removeEventListener("keydown",E)}},[p,s,e,l,d,u,o,i,m]),c.useLayoutEffect(()=>{const b=new Set(n.map(C=>aw(C.anchor))),v=()=>{const C=e.querySelectorAll("[data-diff-line]");for(const S of C){const L=Fr(e,S,t),x=L?r==null?void 0:r[L.location.side]:void 0;S.classList.toggle("has-review-comment",!!L&&b.has(Sc(L.location,x))),S.tabIndex=0,S.setAttribute("aria-label",h("sourceDiffLineActions"))}};v();const _=new MutationObserver(v);return _.observe(e,{childList:!0,subtree:!0}),()=>_.disconnect()},[e,n,r,t,h]),{activeLine:f,resolveActiveLine:y}}function Fr(e,t,n){const r=Number(t.getAttribute("data-diff-line")),s=xc(t),o=yu(n,r,void 0,s);if(!o)return null;const i=t.getBoundingClientRect(),l=e.getBoundingClientRect();return{node:t,target:{flatIndex:r,contextSide:s,top:i.top-l.top+e.scrollTop},location:o}}function xc(e){var t;return((t=e.closest("[data-diff-col]"))==null?void 0:t.getAttribute("data-diff-col"))==="old"?"old":"new"}function iw(e){return(e==null?void 0:e.kind)==="sha"?`sha:${e.sha}`:"uncommitted"}function Sc(e,t){return`${iw(t)}:${e.side}:${e.oldLine}:${e.newLine}`}function aw(e){return Sc(e,e.revision)}function cw({projectId:e,filePath:t,structuredPatch:n,revisions:r,projections:s,container:o,onOpenChange:i,renderSource:l,t:u}){const[d,h]=c.useState(null),{pending:f,defaultSession:g,busy:m,error:p,setError:y,addToReview:b,submitNow:v}=Hp(e,t,s!==void 0);c.useLayoutEffect(()=>(i==null||i(d!==null),()=>{d&&(i==null||i(!1))}),[i,d]);const _=c.useCallback(x=>{y(null),h(x)},[y]),C=c.useCallback(async x=>{d&&await b(d.anchor,x)&&h(null)},[b,d]),S=c.useCallback(async(x,E,w)=>{if(!d)return;await v(d.anchor,x,E,u("sourceReviewSubmitQueued"),w)==="navigated"&&h(null)},[d,v,u]),L=d?a.jsx(nw,{projectId:e,anchorLabel:`${t}:${d.anchor.newLine??d.anchor.oldLine??"?"}`,snippet:d.anchor.snippet,busy:m,error:p,onCancel:()=>h(null),onAddToReview:C,defaultSession:g,onSubmit:(x,E)=>S(x,E,E==="new"?g==null?void 0:g.newSession:void 0),t:u},`${d.anchor.side}:${d.flatIndex}`):null;return a.jsxs(a.Fragment,{children:[l({openComment:d,editor:L}),a.jsx(lw,{filePath:t,structuredPatch:n,revisions:r,projections:s,container:o,pending:f,onOpenComment:_,t:u})]})}function lw({filePath:e,structuredPatch:t,revisions:n,projections:r,container:s,pending:o,onOpenComment:i,t:l}){const{menu:u,openAt:d,openFromButton:h,beginLongPressAt:f,moveLongPressAt:g,endLongPress:m,consumeLongPressClick:p}=rc(l),y=c.useCallback(x=>({path:e,revision:(n==null?void 0:n[x.side])??{kind:"uncommitted",savedAt:new Date().toISOString()},side:x.side,oldLine:x.oldLine,newLine:x.newLine,snippet:x.snippet,snippetAnchorOffset:x.snippetAnchorOffset,...r!=null&&r[x.side]?{projection:r[x.side]}:{}}),[e,r,n]),b=c.useCallback(({location:x,target:E})=>{i({anchor:y(x),flatIndex:E.flatIndex})},[y,i]),v=c.useCallback((x,E,w)=>{const R=E.snippet.split(`
49
- `)[E.snippetAnchorOffset]??"",j=E.newLine??E.oldLine;return[{label:l("sourceCommentOnLine"),onSelect:()=>b({target:x,location:E,node:w})},{label:l("sourceCopyLine"),separatorBefore:!0,onSelect:()=>{fe(R)}},{label:l("sourceCopyPathLine"),onSelect:()=>{fe(j?`${e}:${j}`:e)}}]},[e,b,l]),_=c.useCallback((x,E)=>{d(E.x,E.y,x.node,v(x.target,x.location,x.node))},[v,d]),C=c.useCallback((x,E)=>{f(E,x.node,v(x.target,x.location,x.node))},[f,v]),{activeLine:S,resolveActiveLine:L}=ow({container:s,structuredPatch:t,pending:o,revisions:n,consumeLongPressClick:p,onOpenComment:b,onOpenMenu:_,onBeginLongPress:C,onMoveLongPress:g,onEndLongPress:m,t:l});return a.jsxs(a.Fragment,{children:[S&&a.jsx("button",{type:"button",className:sw.menuTrigger,style:{top:S.top},"aria-label":l("sourceMoreActions"),title:l("sourceMoreActions"),onClick:x=>{const E=L();E&&h(x,v(E.target,E.location,E.node))},children:"⋯"}),u]})}const uw="_root_nfjne_1",dw="_source_nfjne_7",fw="_editor_nfjne_11",Bt={root:uw,source:dw,editor:fw};function mn({before:e,editor:t,after:n}){return t?a.jsxs("div",{className:Bt.root,"data-review-comment-split":"",children:[a.jsx("div",{className:Bt.source,"data-review-comment-before":"",children:e}),a.jsx("div",{className:Bt.editor,children:t}),a.jsx("div",{className:Bt.source,"data-review-comment-after":"",children:n})]}):a.jsx(a.Fragment,{children:e})}function hw({editor:e}){return e?a.jsx("div",{className:Bt.root,"data-review-comment-inline":"",children:a.jsx("div",{className:Bt.editor,children:e})}):null}const mw=c.memo(function({diffHtml:t,structuredPatch:n,splitAfterLine:r,editor:s=null}){const o=c.useMemo(()=>pc(t),[t]),i=c.useMemo(()=>Dp(n),[n]),l=r===void 0?-1:i.findIndex(u=>u.type==="line"&&(u.left===r||u.right===r));return l<0||!s?a.jsx(Or,{rows:i,fragments:o}):a.jsx(mn,{before:a.jsx(Or,{rows:i.slice(0,l+1),fragments:o}),editor:s,after:a.jsx(Or,{rows:i.slice(l+1),fragments:o})})});function Or({rows:e,fragments:t}){return a.jsx("div",{className:"side-by-side-diff",children:e.map((n,r)=>n.type==="header"?a.jsx("div",{className:"sbs-header highlighted-diff",dangerouslySetInnerHTML:{__html:`<pre class="shiki"><code><span class="line line-hunk">${pw(n.text)}</span></code></pre>`}},`h-${r}`):a.jsxs("div",{className:"sbs-row",children:[a.jsx(di,{col:"old",html:ui(t,n.left)}),a.jsx(di,{col:"new",html:ui(t,n.right)})]},`r-${r}`))})}function ui(e,t){return t===null?null:e.get(t)??null}function di({col:e,html:t}){return t===null?a.jsx("div",{className:"sbs-cell sbs-empty"}):a.jsx("div",{className:"sbs-cell highlighted-diff","data-diff-col":e,dangerouslySetInnerHTML:{__html:`<pre class="shiki"><code>${t}</code></pre>`}})}function pw(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const gw="_plain_v5smy_1",ww="_hunkHeader_v5smy_22",fi={plain:gw,hunkHeader:ww},Hr=".line-deleted, .line-inserted, .diff-removed, .diff-added, .fixed-font-diff-removed, .fixed-font-diff-added",hi=c.memo(function({diffHtml:t,structuredPatch:n,splitAfterLine:r,editor:s=null,plain:o=!1,hideRemovedLines:i=!1}){const l=c.useMemo(()=>o?new Map:pc(t,i),[t,i,o]),u=c.useMemo(()=>o?[]:vw(n,i),[i,o,n]);if(o)return a.jsx(yw,{hunks:n,hideRemovedLines:i});const d=r===void 0?-1:u.findIndex(h=>h.type==="line"&&h.flatIndex===r);return d<0||!s?a.jsx(Ur,{rows:u,fragments:l,omitDiffPrefixes:i}):a.jsx(mn,{before:a.jsx(Ur,{rows:u.slice(0,d+1),fragments:l,omitDiffPrefixes:i}),editor:s,after:a.jsx(Ur,{rows:u.slice(d+1),fragments:l,omitDiffPrefixes:i})})});function yw({hunks:e,hideRemovedLines:t}){return a.jsx("div",{className:fi.plain,"data-diff-rendering":"plain",children:a.jsx("pre",{children:a.jsx("code",{children:e.map((n,r)=>a.jsxs(c.Fragment,{children:[!t&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`${fi.hunkHeader} line-hunk`,children:`@@ -${n.oldStart},${n.oldLines} +${n.newStart},${n.newLines} @@`}),`
50
- `]}),n.lines.filter(s=>!t||!s.startsWith("-")).map(s=>t?s.slice(1):s).join(`
51
- `),r+1<e.length?`
52
- `:""]},`${n.oldStart}:${n.newStart}:${r}`))})})})}function vw(e,t){const n=[];let r=0;for(const s of e){t||n.push({type:"header",text:`@@ -${s.oldStart},${s.oldLines} +${s.newStart},${s.newLines} @@`});for(const o of s.lines)(!t||!o.startsWith("-"))&&n.push({type:"line",flatIndex:r,text:o}),r+=1}return n}function Ur({rows:e,fragments:t,omitDiffPrefixes:n}){const r=e.map(s=>s.type==="header"?`<span class="line line-hunk">${Vr(s.text)}</span>`:t.get(s.flatIndex)??`<span class="${bw(s.text)}" data-diff-line="${s.flatIndex}">${n?"":`<span class="diff-prefix">${Vr(s.text[0]??" ")}</span>`}${Vr(s.text.slice(1))}</span>`).join("");return a.jsx("div",{className:"highlighted-diff",dangerouslySetInnerHTML:{__html:`<pre class="shiki"><code>${r}</code></pre>`}})}function bw(e){return e[0]==="-"?"line line-deleted":e[0]==="+"?"line line-inserted":"line line-context"}function Vr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const xw="_plainNotice_ymdjf_1",Sw={plainNotice:xw},_w="_header_1tien_19",Ew="_identity_1tien_29",Cw="_actions_1tien_40",He={header:_w,identity:Ew,actions:Cw},kw=1e6*20;function Lw(e){return e.flatMap(t=>t.lines).join(`
53
- `)}function mi(e){return e.length===0?null:e.map(t=>t.lines.filter(n=>n.startsWith(" ")||n.startsWith("+")).map(n=>n.slice(1)).join(`
54
- `)).join(`
55
- `)}function Un(e){return e.closest(".git-diff-preview-body, .modal-content")??e}const kn={kind:"worktree"},Rw={kind:"working-tree-history"};function ir(e){if(e.kind==="commit")return e.sha;if(e.kind==="comparison"||e.kind==="inclusive-comparison")return e.headSha}function $s(e){const t=Math.max(0,e.scrollHeight-e.clientHeight);return t===0?0:Math.min(1,Math.max(0,e.scrollTop/t))}function Mw(e,t){const n=Math.max(0,e.scrollHeight-e.clientHeight);e.scrollTop=n*Math.min(1,Math.max(0,t))}function us(e,t,n,r){return e==="commit"?{kind:"commit",sha:t}:e==="comparison"||e==="inclusive-comparison"?{kind:e,baseSha:t,headSha:n}:e==="file-projection"?{kind:"file-projection",mode:r}:e==="working-tree-history"?Rw:kn}function _c(e,t,n,r,s){return n.kind==="commit"?ue.getGitCommitDiff(e,{sha:n.sha,path:t.path,status:t.status,...t.origPath?{origPath:t.origPath}:{},fullContext:r,...s?{ignoreWhitespace:!0}:{}}):n.kind==="comparison"||n.kind==="inclusive-comparison"?(n.kind==="inclusive-comparison"?ue.getGitInclusiveComparisonDiff:ue.getGitComparisonDiff)(e,{baseSha:n.baseSha,headSha:n.headSha,path:t.path,status:t.status,...t.origPath?{origPath:t.origPath}:{},fullContext:r,...s?{ignoreWhitespace:!0}:{}}):n.kind==="file-projection"?ue.getGitFileProjectionDiff(e,{path:t.path,mode:n.mode,...t.origPath?{origPath:t.origPath}:{},fullContext:r}):ue.getGitDiff(e,{path:t.path,staged:t.staged,status:t.status,...n.kind==="working-tree-history"?{againstHead:!0,...t.origPath?{origPath:t.origPath}:{}}:{},fullContext:r,...s?{ignoreWhitespace:!0}:{}})}function Aw(e){if(e.kind==="commit"){const t={kind:"sha",sha:e.sha};return{old:t,new:t}}if(e.kind==="comparison"||e.kind==="inclusive-comparison")return{old:{kind:"sha",sha:e.baseSha},new:{kind:"sha",sha:e.headSha}}}const JS=c.forwardRef(function({file:t,fileKey:n,projectId:r,source:s=kn,headerActions:o,retainedScrollRatio:i,retainedDiffView:l,onRetainScrollRatio:u,onRetainDiffView:d,onCommentEditorOpenChange:h,captureReviewProjections:f=!1,ignoreWhitespace:g=!1,onToggleIgnoreWhitespace:m,onProjectionRequestFailure:p,t:y},b){const v=t?t.path.split("/").pop()||t.path:null,_=c.useRef(null),C=c.useRef(null),S=c.useCallback(L=>{C.current=L},[]);return c.useImperativeHandle(b,()=>({jumpToNextHunk:()=>{var L;return((L=C.current)==null?void 0:L.next())??!1},jumpToPreviousHunk:()=>{var L;return((L=C.current)==null?void 0:L.previous())??!1},scrollByPage:L=>{const x=_.current;if(!x)return;const E=Math.max(0,x.scrollHeight-x.clientHeight);x.scrollTop=Math.min(E,Math.max(0,x.scrollTop+L*x.clientHeight))}}),[]),c.useLayoutEffect(()=>{const L=_.current;return()=>{!n||!L||u==null||u(n,$s(L))}},[n,u]),a.jsx("section",{className:"git-diff-preview-pane",children:a.jsx("div",{className:"git-diff-preview-body",ref:_,children:t&&n?a.jsx(Ds,{file:t,fileKey:n,projectId:r,source:s,retainedScrollRatio:i,scrollContainerRef:_,retainedDiffView:l,onRetainDiffView:d,paneHeader:{title:v??t.path,path:t.path,actions:o,revision:a.jsx(Ps,{projectId:r,path:t.path,origPath:ir(s)?void 0:t.origPath,rev:ir(s),dirtyLabel:y("fileRevisionDirty"),uncommittedLabel:y("fileRevisionUncommitted")})},onHunkNavigationChange:S,onCommentEditorOpenChange:h,captureReviewProjections:f,ignoreWhitespace:g,onToggleIgnoreWhitespace:m,onProjectionRequestFailure:p,t:y}):a.jsxs(a.Fragment,{children:[a.jsx(Bs,{title:y("gitStatusDiffPreview"),path:"",actions:o}),a.jsx("div",{className:"git-diff-placeholder",children:y("gitStatusSelectFileForDiff")})]})})})});function ZS({file:e,fileKey:t,projectId:n,source:r=kn,headerActions:s,retainedScrollRatio:o,retainedDiffView:i,onRetainScrollRatio:l,onRetainDiffView:u,onCommentEditorOpenChange:d,captureReviewProjections:h=!1,ignoreWhitespace:f=!1,onToggleIgnoreWhitespace:g,onProjectionRequestFailure:m,t:p,onClose:y}){const b=c.useRef(null);return c.useLayoutEffect(()=>{const v=b.current;return()=>{v&&(l==null||l(t,$s(v)))}},[t,l]),a.jsxs(xn,{title:e.path,onClose:y,closeOnBackGesture:!0,contentRef:b,children:[a.jsxs("div",{className:"git-diff-preview-header-actions",children:[a.jsx(Ps,{projectId:n,path:e.path,origPath:ir(r)?void 0:e.origPath,rev:ir(r),dirtyLabel:p("fileRevisionDirty"),uncommittedLabel:p("fileRevisionUncommitted")}),s]}),a.jsx(Ds,{file:e,fileKey:t,projectId:n,source:r,retainedScrollRatio:o,scrollContainerRef:b,retainedDiffView:i,onRetainDiffView:u,onCommentEditorOpenChange:d,captureReviewProjections:h,ignoreWhitespace:f,onToggleIgnoreWhitespace:g,onProjectionRequestFailure:m,t:p})]})}function Ds({file:e,fileKey:t,projectId:n,source:r=kn,retainedDiffView:s,onRetainDiffView:o,paneHeader:i,onHunkNavigationChange:l,onCommentEditorOpenChange:u,captureReviewProjections:d=!1,ignoreWhitespace:h=!1,onToggleIgnoreWhitespace:f,onProjectionRequestFailure:g,retainedScrollRatio:m,scrollContainerRef:p,t:y}){const b=r.kind,v=r.kind==="commit"?r.sha:r.kind==="comparison"||r.kind==="inclusive-comparison"?r.baseSha:"",_=r.kind==="comparison"||r.kind==="inclusive-comparison"?r.headSha:"",C=r.kind==="file-projection"?r.mode:"worktree",S=JSON.stringify([t,b,v,_,C,h]),[L,x]=c.useState(()=>({requestKey:S,result:null,loading:!0,error:null})),E=L.requestKey===S?L:{result:null,loading:!0,error:null},{result:w,loading:R,error:j}=E,N=c.useRef({fileKey:t,view:s});N.current.fileKey!==t&&(N.current={fileKey:t,view:s});const A=c.useCallback((I,$)=>{N.current.fileKey===I&&(N.current.view={...N.current.view,...$}),o==null||o(I,$)},[o]),k=c.useRef(w),M=c.useRef(m===void 0?null:{fileKey:t,ratio:m});k.current=w,c.useLayoutEffect(()=>{M.current=m===void 0?null:{fileKey:t,ratio:m}},[t,m]),c.useLayoutEffect(()=>{const I=M.current;if(!w||(I==null?void 0:I.fileKey)!==t)return;const $=p==null?void 0:p.current;$&&(Mw($,I.ratio),M.current=null)},[w,t,p]),c.useEffect(()=>{let I=!1;return x($=>$.requestKey===S?{...$,loading:!0,error:null}:{requestKey:S,result:null,loading:!0,error:null}),_c(n,e,us(b,v,_,C),void 0,h).then($=>{if(!I){const H=p==null?void 0:p.current;k.current&&H&&(M.current={fileKey:t,ratio:$s(H)}),x({requestKey:S,result:$,loading:!1,error:null})}}).catch($=>{if(!I){(h||b==="comparison"||b==="inclusive-comparison")&&(g==null||g($));const H=$.message||y("gitStatusLoadDiffFailed");x(V=>V.requestKey===S?{...V,loading:!1,error:H}:{requestKey:S,result:null,loading:!1,error:H})}}),()=>{I=!0}},[n,e,t,S,b,v,_,C,h,g,p,y]);const P=R&&!w;return a.jsxs(a.Fragment,{children:[i&&(P||!w&&j)&&a.jsx(Bs,{title:i.title,path:i.path,actions:i.actions,revision:i.revision}),P&&a.jsx("div",{className:"git-diff-loading",children:y("gitStatusLoadingDiff")}),!w&&j&&a.jsx("div",{className:"git-diff-error",children:j}),w&&a.jsxs(a.Fragment,{children:[j&&a.jsx("div",{className:"git-diff-error",children:j}),a.jsx(jw,{file:e,fileKey:t,projectId:n,source:r,diffResult:w,retainedDiffView:N.current.view,onRetainDiffView:A,paneHeader:i,onHunkNavigationChange:l,onCommentEditorOpenChange:u,captureReviewProjections:d,ignoreWhitespace:h,onToggleIgnoreWhitespace:f,onProjectionRequestFailure:g,t:y},S)]})]})}function jw({file:e,fileKey:t,projectId:n,source:r=kn,diffResult:s,retainedDiffView:o,onRetainDiffView:i,paneHeader:l,onHunkNavigationChange:u,onCommentEditorOpenChange:d,captureReviewProjections:h=!1,ignoreWhitespace:f=!1,onToggleIgnoreWhitespace:g,onProjectionRequestFailure:m,t:p}){const[y,b]=c.useState(()=>((o==null?void 0:o.showFullContext)??!1)||((o==null?void 0:o.hideRemovedLines)??!1)),[v,_]=c.useState(()=>(o==null?void 0:o.hideRemovedLines)??!1),C=c.useMemo(()=>JSON.stringify([s.structuredPatch,s.previewSkipped??null]),[s.previewSkipped,s.structuredPatch]),[S,L]=c.useState({revisionKey:null,result:null,loading:!1,error:null}),x=S.revisionKey===C?S:{result:null,loading:!1,error:null},{result:E,loading:w,error:R}=x,[j,N]=c.useState(()=>(o==null?void 0:o.showMarkdownPreview)??!1),A=c.useRef(null),k=c.useRef(null),[M,P]=c.useState(null),I=c.useCallback(W=>{A.current=W,P(W)},[]),[$,H]=jp(),[V,O]=c.useState(0),K=r.kind,Y=r.kind==="commit"?r.sha:r.kind==="comparison"||r.kind==="inclusive-comparison"?r.baseSha:"",te=r.kind==="comparison"||r.kind==="inclusive-comparison"?r.headSha:"",F=r.kind==="file-projection"?r.mode:"worktree",T=c.useMemo(()=>Aw(us(K,Y,te,F)),[Y,F,te,K]);c.useEffect(()=>{const W=A.current;if(!W||typeof ResizeObserver>"u")return;const z=new ResizeObserver(me=>{var Ce;const ye=(Ce=me[0])==null?void 0:Ce.contentRect.width;typeof ye=="number"&&O(ye)});return z.observe(W),()=>z.disconnect()},[]);const Q=c.useCallback(()=>{H($==="auto"?"unified":$==="unified"?"side-by-side":"auto")},[$,H]),G=pn(e.path),X=c.useMemo(()=>G?fr(Lw(s.structuredPatch),{diffAware:!0,baseFilePath:e.path,projectId:n}):null,[s.structuredPatch,e.path,G,n]),B=c.useMemo(()=>E?mi(E.structuredPatch):null,[E]),q=c.useMemo(()=>!G||B===null||E!=null&&E.markdownHtml?null:fr(B,{baseFilePath:e.path,projectId:n}),[e.path,E==null?void 0:E.markdownHtml,B,G,n]),Z=(E==null?void 0:E.markdownHtml)||(q==null?void 0:q.html),ne=G&&(!!s.markdownHtml||(X==null?void 0:X.changed)===!0||(q==null?void 0:q.changed)===!0),ie=j&&ne,ee=y?Z:X==null?void 0:X.html,he=c.useCallback(W=>{i==null||i(t,W)},[t,i]),ae=c.useCallback(async()=>{if(E)return E;if(w)return null;const W=C;L(z=>z.revisionKey===W?{...z,loading:!0,error:null}:{revisionKey:W,result:null,loading:!0,error:null});try{const z=await _c(n,e,us(K,Y,te,F),!0,f);return L(me=>me.revisionKey===W?{revisionKey:W,result:z,loading:!1,error:null}:me),z}catch(z){(f||K==="comparison"||K==="inclusive-comparison")&&(m==null||m(z));const me=z instanceof Error?z.message:p("gitStatusLoadContextFailed");return L(ye=>ye.revisionKey===W?{revisionKey:W,result:null,loading:!1,error:me}:ye),null}},[E,w,C,n,e,K,Y,te,F,f,m,p]),ve=c.useCallback(async()=>{const W=!y;if(W&&!await ae())return;const z=A.current,me=z?Un(z):null;k.current=ts(me,(z==null?void 0:z.querySelector(Hr))??null),b(W),W||_(!1),he({showFullContext:W,...W?{}:{hideRemovedLines:!1}})},[ae,he,y]),ce=c.useCallback(async()=>{const W=!v;if(W&&!await ae())return;const z=A.current,me=z?Un(z):null;k.current=ts(me,(z==null?void 0:z.querySelector(Hr))??null),W&&b(!0),_(W),he({hideRemovedLines:W,...W?{showFullContext:!0}:{}})},[v,ae,he]),ut=c.useCallback(()=>{const W=!j;N(W),he({showMarkdownPreview:W})},[he,j]),Ve=c.useCallback(async()=>{const W=y?E??await ae():s,z=W?mi(W.structuredPatch):null;if(z===null)throw new Error("Diff content is unavailable");return z},[s,E,ae,y]);c.useEffect(()=>{y&&!E&&!w&&ae()},[w,E,ae,y]),c.useLayoutEffect(()=>{var z;const W=k.current;W&&(k.current=null,Da(W,((z=A.current)==null?void 0:z.querySelector(Hr))??null))},[y,v,E]);const ge=y&&E?E:s,ze=ge.renderMode==="plain"||ge.diffHtml.length>kw,qe=ze?"":ge.diffHtml,jt=c.useMemo(()=>ge.previewSkipped?null:Dw(ge.structuredPatch),[ge.previewSkipped,ge.structuredPatch]),Pe=ge.previewSkipped??jt,[Me,Gt]=c.useState({index:0,count:0}),Tt=c.useRef(Me);c.useEffect(()=>{Tt.current=Me},[Me]);const bt=c.useCallback(()=>ie||Pe||!A.current?[]:Array.from(A.current.querySelectorAll(".line-hunk")),[Pe,ie]),De=c.useCallback(()=>{const W=A.current,z=bt();if(!W||z.length===0){Gt(Se=>Se.count===0?Se:{index:0,count:0});return}const ye=Un(W).getBoundingClientRect().top+52;let Ce=0;for(let Se=0;Se<z.length;Se++){const Pt=z[Se];if(Pt&&Pt.getBoundingClientRect().top<=ye)Ce=Se;else break}Gt(Se=>Se.index===Ce&&Se.count===z.length?Se:{index:Ce,count:z.length})},[bt]),nt=c.useCallback(W=>{const z=bt();if(z.length===0)return!1;const ye=((Tt.current.count===z.length?Tt.current.index:0)+W+z.length)%z.length,Ce=z[ye];return!Ce||typeof Ce.scrollIntoView!="function"?!1:(Ce.scrollIntoView({block:"start",behavior:"smooth"}),Gt({index:ye,count:z.length}),!0)},[bt]),Ne=c.useCallback(()=>nt(1),[nt]),xt=c.useCallback(()=>nt(-1),[nt]);c.useEffect(()=>{const W=A.current;if(!W)return;const z=Un(W);let me=requestAnimationFrame(De),ye=!1;const Ce=()=>{ye||(ye=!0,me=requestAnimationFrame(()=>{ye=!1,De()}))};return z.addEventListener("scroll",Ce,{passive:!0}),()=>{cancelAnimationFrame(me),z.removeEventListener("scroll",Ce)}},[De]),c.useEffect(()=>(u==null||u({next:Ne,previous:xt}),()=>u==null?void 0:u(null)),[Ne,xt,u]),c.useLayoutEffect(()=>{const W=z=>{const me=z.key.toLowerCase();if(me!=="n"&&me!=="p"||z.altKey||z.ctrlKey||z.metaKey||mc(z.target))return;(me==="n"?Ne():xt())&&z.preventDefault()};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[Ne,xt]);const xr=Me.count>0?a.jsxs("span",{className:"diff-hunk-navigation",children:[a.jsx("button",{type:"button",className:"diff-hunk-step",onClick:xt,title:p("sourcePreviousHunkShortcut"),"aria-label":p("sourcePreviousHunkShortcut"),children:"‹"}),a.jsxs("span",{className:"diff-hunk-indicator",children:[Me.index+1,"/",Me.count]}),a.jsx("button",{type:"button",className:"diff-hunk-step",onClick:Ne,title:p("sourceNextHunkShortcut"),"aria-label":p("sourceNextHunkShortcut"),children:"›"})]}):null,de=a.jsxs(a.Fragment,{children:[xr,g&&a.jsx("button",{type:"button",className:`diff-context-toggle diff-toolbar-icon-button ${f?"active":""}`,onClick:g,title:p(f?"gitStatusIgnoreWhitespaceActive":"gitStatusIgnoreWhitespace"),"aria-label":p(f?"gitStatusIgnoreWhitespaceActive":"gitStatusIgnoreWhitespace"),"aria-pressed":f,children:a.jsx("span",{className:"diff-whitespace-glyph","aria-hidden":"true",children:"_+"})}),ne&&a.jsx("button",{type:"button",className:`diff-context-toggle diff-toolbar-icon-button ${ie?"active":""}`,onClick:ut,title:p(ie?"gitStatusDiff":"gitStatusPreview"),"aria-label":p(ie?"gitStatusDiff":"gitStatusPreview"),"aria-pressed":ie,children:a.jsx(Nw,{showDiff:ie})}),a.jsx("button",{type:"button",className:`diff-context-toggle diff-toolbar-icon-button ${y?"active":""}`,onClick:ve,disabled:w,title:p(w?"gitStatusLoading":y?"gitStatusDiffOnly":"gitStatusFullContext"),"aria-label":p(w?"gitStatusLoading":y?"gitStatusDiffOnly":"gitStatusFullContext"),"aria-pressed":y,children:a.jsx(Tw,{expanded:y})}),a.jsx("button",{type:"button",className:`diff-context-toggle diff-toolbar-icon-button ${v?"active":""}`,onClick:ce,disabled:w,title:p(v?"gitStatusShowRemovedLines":"gitStatusHideRemovedLines"),"aria-label":p(v?"gitStatusShowRemovedLines":"gitStatusHideRemovedLines"),"aria-pressed":v,children:a.jsx(Pw,{hidden:v})}),a.jsx(bp,{value:Ve,title:p("fileViewerCopyContent"),className:"diff-context-toggle diff-toolbar-icon-button",disabled:w||!!Pe||ge.structuredPatch.length===0,icon:"content"}),!ie&&!ze&&!v&&a.jsx("button",{type:"button",className:"diff-context-toggle diff-toolbar-icon-button",onClick:Q,title:`${p("diffViewModeTitle")}: ${p(pi($))}`,"aria-label":`${p("diffViewModeTitle")}: ${p(pi($))}`,children:a.jsx(Iw,{mode:$})})]}),Ie=(W,z)=>ge.structuredPatch.length===0?a.jsx("div",{className:"git-diff-empty-projection",children:p(f?"gitStatusWhitespaceChangesHidden":"gitStatusNoContentChanges")}):qe&&!v&&$p($,V)==="side-by-side"?a.jsx(mw,{diffHtml:qe,structuredPatch:ge.structuredPatch,splitAfterLine:W,editor:z}):qe?a.jsx(hi,{diffHtml:qe,structuredPatch:ge.structuredPatch,hideRemovedLines:v,plain:ze,splitAfterLine:W,editor:z}):a.jsx(hi,{diffHtml:"",structuredPatch:ge.structuredPatch,hideRemovedLines:v,plain:ze,splitAfterLine:W,editor:z});return a.jsxs(a.Fragment,{children:[l?a.jsx(Bs,{title:l.title,path:l.path,actions:l.actions,revision:l.revision,children:de}):a.jsxs("div",{className:"diff-context-controls source-diff-context-controls",children:[a.jsx("span",{className:"diff-context-path",children:e.path}),a.jsx("div",{className:"diff-context-buttons",children:de})]}),R&&a.jsx("div",{className:"diff-context-error",children:R}),a.jsxs("div",{className:"diff-modal-content source-diff-pane diff-gutter-aligned",ref:I,children:[ze&&!Pe&&!ie&&a.jsx("div",{className:Sw.plainNotice,children:p("gitStatusDiffPlainMode")}),ie&&ee?a.jsx(_s,{html:ee,sourcePath:e.path}):Pe?a.jsx($w,{file:e,previewSkipped:Pe,t:p}):M?a.jsx(cw,{projectId:n,filePath:e.path,structuredPatch:ge.structuredPatch,revisions:T,projections:h?ge.reviewProjections:void 0,container:M,onOpenChange:d,renderSource:({openComment:W,editor:z})=>Ie(W==null?void 0:W.flatIndex,z),t:p}):Ie(void 0,null)]})]})}function Bs({title:e,path:t,actions:n,revision:r,children:s}){const o=t&&t!==e?t.endsWith(e)?t.slice(0,-e.length).replace(/\/$/,""):t:"";return a.jsxs("div",{className:`git-diff-pane-toolbar ${He.header}`,children:[a.jsxs("div",{className:He.identity,children:[a.jsxs("span",{className:"git-diff-file-identity",title:t||e,children:[o&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"git-diff-toolbar-path",children:o}),a.jsx("span",{className:"git-diff-toolbar-separator","aria-hidden":"true",children:"/"})]}),a.jsx("h3",{className:"git-diff-preview-title",children:e})]}),r]}),a.jsxs("div",{className:He.actions,children:[s&&a.jsx("div",{className:"diff-context-buttons",children:s}),n&&a.jsx("div",{className:"git-diff-preview-header-actions",children:n})]})]})}function Tw({expanded:e}){return a.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M5 12h14"}),e?a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"m8 7 4-4 4 4"}),a.jsx("path",{d:"m8 17 4 4 4-4"})]}):a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"m8 3 4 4 4-4"}),a.jsx("path",{d:"m8 21 4-4 4 4"})]})]})}function Pw({hidden:e}){return a.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M5 7h14M5 12h14M5 17h14"}),e&&a.jsx("path",{d:"M4 4l16 16"})]})}function Nw({showDiff:e}){return e?a.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"m8 9-4 3 4 3M16 9l4 3-4 3M14 5l-4 14"})}):a.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6S2 12 2 12Z"}),a.jsx("circle",{cx:"12",cy:"12",r:"2.5"})]})}function Iw({mode:e}){return a.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:e==="side-by-side"?a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M3 7h7M14 7h7"}),a.jsx("path",{d:"M3 12h7M14 12h7"}),a.jsx("path",{d:"M3 17h7M14 17h7"})]}):a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M4 7h16M4 12h16M4 17h16"}),e==="auto"&&a.jsx("path",{d:"M5 4h4M5 4v3M19 20h-4M19 20v-3"})]})})}function pi(e){switch(e){case"unified":return"diffViewModeUnified";case"side-by-side":return"diffViewModeSideBySide";default:return"diffViewModeAuto"}}function $w({file:e,previewSkipped:t,t:n}){return a.jsxs("div",{className:"git-diff-preview-skipped",children:[a.jsx("div",{className:"git-diff-preview-skipped-title",children:n("gitStatusDiffPreviewSkipped")}),a.jsx("div",{className:"git-diff-preview-skipped-message",children:Bw(t,n)}),a.jsxs("dl",{className:"git-diff-preview-skipped-details",children:[a.jsxs("div",{children:[a.jsx("dt",{children:n("gitStatusDiffPreviewSkippedPath")}),a.jsx("dd",{children:e.path})]}),t.totalBytes!==void 0&&a.jsxs("div",{children:[a.jsx("dt",{children:n("gitStatusDiffPreviewSkippedSize")}),a.jsx("dd",{children:Fw(t.totalBytes)})]}),t.totalChars!==void 0&&a.jsxs("div",{children:[a.jsx("dt",{children:n("gitStatusDiffPreviewSkippedCharacters")}),a.jsx("dd",{children:t.totalChars.toLocaleString()})]}),t.totalLines!==void 0&&a.jsxs("div",{children:[a.jsx("dt",{children:n("gitStatusDiffPreviewSkippedLines")}),a.jsx("dd",{children:t.totalLines.toLocaleString()})]}),t.maxLineChars!==void 0&&a.jsxs("div",{children:[a.jsx("dt",{children:n("gitStatusDiffPreviewSkippedLineLength")}),a.jsx("dd",{children:t.maxLineChars.toLocaleString()})]}),t.htmlChars!==void 0&&a.jsxs("div",{children:[a.jsx("dt",{children:n("gitStatusDiffPreviewSkippedHtmlSize")}),a.jsx("dd",{children:t.htmlChars.toLocaleString()})]})]})]})}function Dw(e){let t=0,n=0;for(const r of e)for(const s of r.lines)for(const o of s){const i=o.codePointAt(0);if(i!==void 0){if(i===0||i===65533)return{reason:"binary"};t+=1,(i<32&&i!==8&&i!==9&&i!==10&&i!==12&&i!==13&&i!==27||i===127)&&(n+=1)}}return n/Math.max(t,1)>.01?{reason:"binary"}:null}function Bw(e,t){switch(e.reason){case"binary":return t("gitStatusDiffPreviewSkippedBinary");case"content-too-large":return t("gitStatusDiffPreviewSkippedContentTooLarge");case"line-too-long":return t("gitStatusDiffPreviewSkippedLineTooLong");case"html-too-large":return t("gitStatusDiffPreviewSkippedHtmlTooLarge")}}function Fw(e){return e<1024?`${e} B`:e<1024*1024?`${gi(e/1024)} KB`:`${gi(e/(1024*1024))} MB`}function gi(e){return e>=10?e.toFixed(0):e.toFixed(1)}const ln=tt(Ee.inlineMediaExpandedByDefault,!1),un=tt(Ee.compactMultiImageGalleries,!0);ln.set;un.set;function Ow(){const e=c.useSyncExternalStore(ln.subscribe,ln.read,ln.read);return{compactMultiImageGalleries:c.useSyncExternalStore(un.subscribe,un.read,un.read),inlineMediaExpandedByDefault:e,setCompactMultiImageGalleries:un.set,setInlineMediaExpandedByDefault:ln.set}}function Ec(e){return e==="/api"?"/":e.startsWith("/api/")?e.slice(4):e}const Hw="image/svg+xml",Uw=8192,Vw=/<svg\b[^>]*>/i,zw=/^\+?\d*\.?\d+(px|pt|pc|cm|mm|in|q|em|ex|rem)?$/i;function Cc(e,t){var r;const n=(r=(e??"").split(";")[0])==null?void 0:r.trim().toLowerCase();return n===Hw||!n&&t.toLowerCase().endsWith(".svg")}function wi(e,t){const n=new RegExp(`\\s${t}\\s*=\\s*"([^"]*)"|\\s${t}\\s*=\\s*'([^']*)'`,"i").exec(e),r=((n==null?void 0:n[1])??(n==null?void 0:n[2])??"").trim();return r.length>0&&zw.test(r)}function qw(e){var n;const t=(n=Vw.exec(e))==null?void 0:n[0];return t?wi(t,"width")&&wi(t,"height"):!1}async function Ww(e,t){if(!Cc(e.type,t))return"raster";try{const n=await e.slice(0,Uw).text();return qw(n)?"vector-sized":"vector-unsized"}catch{return"vector-unsized"}}const Kw="_overlay_x93gz_3",Gw="_menu_x93gz_13",Qw="_activeItem_x93gz_44",Xw="_submenu_x93gz_48",Yw="_branchLabel_x93gz_52",Jw="_backLabel_x93gz_53",Zw="_copyActionLabel_x93gz_69",ey="_separator_x93gz_80",Je={overlay:Kw,menu:Gw,activeItem:Qw,submenu:Xw,branchLabel:Yw,backLabel:Jw,copyActionLabel:Zw,separator:ey};function ar(e,t=!1){return t||pn(e)||/\.(?:html?|xhtml)$/i.test(e)}function ty(e,t){t.provider&&e.set("provider",t.provider),t.model&&e.set("model",t.model),t.thinking&&e.set("thinking",t.thinking),t.permissionMode&&e.set("permissionMode",t.permissionMode),t.executor&&e.set("executor",t.executor)}function ny(e){window.history.pushState(window.history.state,"",e);const t=typeof PopStateEvent=="function"?new PopStateEvent("popstate",{state:window.history.state}):new Event("popstate");window.dispatchEvent(t)}function kc(){const e=lt(),t=vn();return c.useCallback((n,r,s={})=>{const o=r.trim();if(!n||!o)return;const i=new URLSearchParams({projectId:n});if(ty(i,s),s.newTab){const l=uu();i.set("prefillToken",l);const u=window.open(`${e}/new-session?${i.toString()}`,"_blank");if(u){u.opener=null,du(l,t,o,{caret:s.caret});return}i.delete("prefillToken")}fu(t,o,{caret:s.caret}),ny(`${e}/new-session?${i.toString()}`)},[e,t])}function Lc(){const e=kc();return c.useCallback((t,n)=>{e(t,n)},[e])}function Rc(e,t){const n=Lc();return c.useCallback(()=>{n(e,t)},[t,e,n])}function je({children:e,expanded:t=!1,onHover:n,onSelect:r,opensPanel:s=!1}){return a.jsx("button",{type:"button",role:"menuitem","aria-haspopup":s?"menu":void 0,"aria-expanded":s?t:void 0,className:t?Je.activeItem:void 0,onClick:r,onMouseEnter:n,children:e})}function ry({children:e}){return a.jsxs("span",{className:Je.branchLabel,children:[a.jsx("span",{children:e}),a.jsx("span",{"aria-hidden":"true",children:"›"})]})}function sy({children:e}){return a.jsxs("span",{className:Je.backLabel,children:[a.jsx("span",{"aria-hidden":"true",children:"‹"}),a.jsx("span",{children:e})]})}function ft({children:e}){return a.jsxs("span",{className:Je.copyActionLabel,children:[a.jsx(oy,{}),a.jsx("span",{children:e})]})}function oy(){return a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"5",y:"5",width:"9",height:"9",rx:"1.5"}),a.jsx("path",{d:"M11 5V3.5A1.5 1.5 0 0 0 9.5 2H3.5A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5"})]})}function Fs({x:e,y:t,canStartNewSession:n=!0,dismissLabel:r,onClose:s,onCopyAbsolutePath:o,onCopyContents:i,onCopyRenderedContents:l,onCopyFilePath:u,onCopyImage:d,onCopyProjectRelativePath:h,onCopyPublicUrl:f,onCopyViewerLink:g,onDownload:m,onOpen:p,onOpenPreview:y,onOpenSource:b,onStartNewSession:v}){const{t:_}=xe(),[C,S]=c.useState("root"),L=!!(b&&y),x=!!(h||f||o||u||d||g||i||l),E=window.innerWidth>=520&&typeof window.matchMedia=="function"&&window.matchMedia("(hover: hover) and (pointer: fine)").matches,w=1+ +!!m+ +!!(n&&v)+ +!!d+ +!!h+ +!!f+ +!!o+ +!!u+ +!!g+ +!!i+ +!!l;c.useEffect(()=>Gi(),[]),c.useEffect(()=>{const H=V=>{V.key==="Escape"&&(V.preventDefault(),V.stopPropagation(),s())};return window.addEventListener("keydown",H,!0),()=>window.removeEventListener("keydown",H,!0)},[s]);const R=H=>{H(),s()},j=Math.max(8,Math.min(e,window.innerWidth-230)),N=16+w*(E?36:44)+(x?9:0),A=Math.max(8,Math.min(t,window.innerHeight-N)),k=180,M=E?Math.max(8,Math.min(A,window.innerHeight-k)):Math.max(8,Math.min(t,window.innerHeight-k)),P=j+218+230<=window.innerWidth,I=E?P?j+218:Math.max(8,j-218):j,$=C==="root"||E;return $e.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:Je.overlay,"aria-label":r??_("fileLinkDismissMenu"),onClick:s,onContextMenu:H=>{H.preventDefault(),s()}}),$?a.jsxs("div",{className:Je.menu,role:"menu",style:{left:j,top:A},children:[a.jsx(je,{expanded:C==="open",opensPanel:L,onHover:E&&L?()=>S("open"):void 0,onSelect:()=>L?S("open"):R(p),children:L?a.jsx(ry,{children:_("fileLinkMenuOpen")}):_("fileLinkMenuOpen")}),m?a.jsx(je,{onHover:E?()=>S("root"):void 0,onSelect:()=>R(m),children:_("resourceMenuDownload")}):null,n&&v?a.jsx(je,{onHover:E?()=>S("root"):void 0,onSelect:()=>R(v),children:_("fileLinkMenuNewSession")}):null,x?a.jsx("div",{className:Je.separator}):null,d?a.jsx(je,{onHover:E?()=>S("root"):void 0,onSelect:()=>R(d),children:a.jsx(ft,{children:_("fileLinkMenuCopyImage")})}):null,h?a.jsx(je,{onHover:E?()=>S("root"):void 0,onSelect:()=>R(h),children:a.jsx(ft,{children:_("fileLinkMenuCopyProjectRelativePath")})}):null,f?a.jsx(je,{onHover:E?()=>S("root"):void 0,onSelect:()=>R(f),children:a.jsx(ft,{children:_("fileLinkMenuCopyPublicUrl")})}):null,o?a.jsx(je,{onHover:E?()=>S("root"):void 0,onSelect:()=>R(o),children:a.jsx(ft,{children:_("fileLinkMenuCopyAbsolutePath")})}):null,u?a.jsx(je,{onHover:E?()=>S("root"):void 0,onSelect:()=>R(u),children:a.jsx(ft,{children:_("fileLinkMenuCopyFilePath")})}):null,g?a.jsx(je,{onHover:E?()=>S("root"):void 0,onSelect:()=>R(g),children:a.jsx(ft,{children:_("fileLinkMenuCopyViewerLink")})}):null,i?a.jsx(je,{onHover:E?()=>S("root"):void 0,onSelect:()=>R(i),children:a.jsx(ft,{children:_("fileLinkMenuCopyContents")})}):null,l?a.jsx(je,{onHover:E?()=>S("root"):void 0,onSelect:()=>R(l),children:a.jsx(ft,{children:_("fileLinkMenuCopyRenderedContents")})}):null]}):null,C!=="root"?a.jsxs("div",{"aria-label":_("fileLinkMenuOpen"),className:`${Je.menu} ${Je.submenu}`,role:"menu",style:{left:I,top:M},children:[E?null:a.jsxs(a.Fragment,{children:[a.jsx(je,{onSelect:()=>S("root"),children:a.jsx(sy,{children:_("fileLinkMenuBack")})}),a.jsx("div",{className:Je.separator})]}),b?a.jsx(je,{onSelect:()=>R(b),children:_("fileViewerSource")}):null,y?a.jsx(je,{onSelect:()=>R(y),children:_("fileViewerPreview")}):null]}):null]}),document.body)}const Os=Fs;function Mc({basePath:e="",projectId:t,projectRelativePath:n}){if(!t||!n)return null;const r=new URLSearchParams({path:n});return yt(`${e}/projects/${t}/file?${r}`)}function Ac({exposeAbsolutePath:e,filePath:t,projectPath:n}){const r=(t==null?void 0:t.trim())??"";if(!r)return{absolutePath:null,filePath:null,projectRelativePath:null};const s=et(r)?At(r,n):Ue(r).replace(/^\.\/+/,""),o=e?pr(r,n):null;return{absolutePath:o,filePath:s===null&&o===null&&(e||!et(r))?r:null,projectRelativePath:s&&s!=="."?s:null}}function jc({fileName:e,filePath:t,loadBlob:n,onOpen:r,projectPath:s,viewerLink:o}){const{t:i}=xe(),l=vt(),u=Kt(),d=lt(),h=s===void 0?u==null?void 0:u.projectPath:s,[f,g]=c.useState(null),m=Ac({exposeAbsolutePath:l===null,filePath:t,projectPath:h}),p=o??(l===null?Mc({basePath:d,projectId:u==null?void 0:u.projectId,projectRelativePath:m.projectRelativePath}):null),y=v=>{v.preventDefault(),v.stopPropagation(),g({x:v.clientX,y:v.clientY})};return{contextMenuElement:f?a.jsx(Fs,{x:f.x,y:f.y,canStartNewSession:!1,dismissLabel:i("imageResourceDismissMenu"),onClose:()=>g(null),onOpen:r,onDownload:n?()=>{n().then(v=>Mt(v,e)).catch(()=>{})}:void 0,onCopyImage:n?()=>{Ua(n())}:void 0,onCopyProjectRelativePath:m.projectRelativePath?()=>void fe(m.projectRelativePath??""):void 0,onCopyAbsolutePath:m.absolutePath?()=>void fe(m.absolutePath??""):void 0,onCopyFilePath:m.filePath?()=>void fe(m.filePath??""):void 0,onCopyViewerLink:p?()=>void fe(new URL(p,window.location.href).href):void 0}):null,handleContextMenu:y}}const iy="_viewer_1saym_1",ay="_hasNavigation_1saym_9",cy="_toolbarPortaled_1saym_13",ly="_toolbar_1saym_13",uy="_headerToolbar_1saym_31",dy="_control_1saym_37",fy="_download_1saym_38",hy="_zoomLevel_1saym_66",my="_stageShell_1saym_80",py="_stage_1saym_80",gy="_navigation_1saym_99",wy="_navigationButton_1saym_108",yy="_visible_1saym_129",vy="_hidden_1saym_133",by="_navigationIcon_1saym_141",xy="_previous_1saym_152",Sy="_next_1saym_156",_y="_position_1saym_166",Ey="_canvas_1saym_187",Cy="_surface_1saym_198",ky="_zoom_1saym_66",Ly="_image_1saym_213",Ry="_fit_1saym_222",My="_vector_1saym_230",se={viewer:iy,hasNavigation:ay,toolbarPortaled:cy,toolbar:ly,headerToolbar:uy,control:dy,download:fy,zoomLevel:hy,stageShell:my,stage:py,navigation:gy,navigationButton:wy,visible:yy,hidden:vy,navigationIcon:by,previous:xy,next:Sy,position:_y,canvas:Ey,surface:Cy,zoom:ky,image:Ly,fit:Ry,vector:My},yi={fit:se.fit,zoom:se.zoom},Ay={all:se.visible,hidden:se.hidden,position:se.hidden},jy={all:se.visible,hidden:se.hidden,position:se.visible};function st(...e){return e.filter(Boolean).join(" ")}const Vn=32,vi=1800,Ty=2600,ds=.1,Tc=8,bi=1.25;function xi({direction:e}){return a.jsx("svg",{className:se.navigationIcon,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:e==="previous"?"m15 18-6-6 6-6":"m9 6 6 6-6 6"})})}function Si(e){return Math.min(Tc,Math.max(ds,e))}function _i(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function Py({fileName:e,initialNavigationChrome:t="all",keyboardNavigationSequence:n=0,navigation:r,onContextMenu:s,onNavigationInput:o,toolbarHost:i,url:l,vector:u=!1}){const{t:d}=xe(),h=c.useRef(null),f=c.useRef(new Map),g=c.useRef(null),m=c.useRef(!1),p=c.useRef(!1),y=c.useRef(null),b=c.useRef(n),[v,_]=c.useState(null),[C,S]=c.useState("fit"),[L,x]=c.useState(1),E=!!r,[w,R]=c.useState(()=>E?t:"hidden"),j=c.useCallback(()=>{y.current!==null&&(window.clearTimeout(y.current),y.current=null)},[]),N=c.useCallback((B=vi)=>{j(),y.current=window.setTimeout(()=>{y.current=null,p.current||R("hidden")},B)},[j]),A=c.useCallback((B,q=vi)=>{E&&(R(B==="position"&&p.current?"all":B),N(q))},[E,N]);c.useEffect(()=>{if(!E){j(),R("hidden");return}return A(t),j},[j,E,t,A]),c.useEffect(()=>{b.current!==n&&(b.current=n,A("position"))},[n,A]);const k=c.useCallback(()=>{const B=h.current;if(!B||!v)return 1;const q=(B.clientWidth-Vn)/v.width,Z=(B.clientHeight-Vn)/v.height,ne=Math.min(Math.max(ds,q),Math.max(ds,Z));return Math.min(u?Tc:1,ne)},[v,u]),M=c.useCallback(()=>C==="fit"?k():L,[k,L,C]),P=c.useCallback((B,q)=>{const Z=h.current;if(!Z)return;const ne=Z.getBoundingClientRect(),ie=(B.x+q.x)/2-ne.left,ee=(B.y+q.y)/2-ne.top;g.current={contentX:Z.scrollLeft+ie,contentY:Z.scrollTop+ee,distance:_i(B,q),kind:"pinch",scale:M()}},[M]),I=c.useCallback((B,q,Z)=>{const ne=h.current,ie=Si(B);if(!ne){S("zoom"),x(ie);return}const ee=M(),he=ne.getBoundingClientRect(),ae=q===void 0?ne.clientWidth/2:q-he.left,ve=Z===void 0?ne.clientHeight/2:Z-he.top,ce=ne.scrollLeft+ae,ut=ne.scrollTop+ve;S("zoom"),x(ie),requestAnimationFrame(()=>{const Ve=ie/ee;ne.scrollLeft=ce*Ve-ae,ne.scrollTop=ut*Ve-ve})},[M]),$=c.useCallback(()=>{S("fit"),requestAnimationFrame(()=>{const B=h.current;B&&(B.scrollLeft=0,B.scrollTop=0)})},[]),H=c.useCallback(()=>{const B=h.current,q=f.current.values().next().value;g.current=B&&q?{kind:"pan",scrollLeft:B.scrollLeft,scrollTop:B.scrollTop,x:q.x,y:q.y}:null},[]),V=B=>{if(B.pointerType!=="touch")return;B.currentTarget.setPointerCapture(B.pointerId),f.current.set(B.pointerId,{x:B.clientX,y:B.clientY});const q=Array.from(f.current.values());if(q.length>=2){const[Z,ne]=q;if(!Z||!ne)return;P(Z,ne);return}H()},O=B=>{if(B.pointerType!=="touch"||!f.current.has(B.pointerId))return;f.current.set(B.pointerId,{x:B.clientX,y:B.clientY});const q=Array.from(f.current.values());if(q.length>=2){B.preventDefault();const[ae,ve]=q;if(!ae||!ve)return;const ce=g.current;if((ce==null?void 0:ce.kind)!=="pinch"){P(ae,ve);return}const ut=_i(ae,ve);if(ce.distance<=0)return;m.current=!0;const Ve=Si(ce.scale*(ut/ce.distance)),ge=h.current;if(!ge)return;const ze=ge.getBoundingClientRect(),qe=(ae.x+ve.x)/2-ze.left,jt=(ae.y+ve.y)/2-ze.top;S("zoom"),x(Ve),requestAnimationFrame(()=>{const Pe=Ve/ce.scale;ge.scrollLeft=ce.contentX*Pe-qe,ge.scrollTop=ce.contentY*Pe-jt});return}const Z=h.current,ne=g.current,ie=q[0];if(!ie||(ne==null?void 0:ne.kind)!=="pan")return;const ee=ie.x-ne.x,he=ie.y-ne.y;Math.abs(ee)+Math.abs(he)>4&&(m.current=!0),!(!Z||C==="fit")&&(Z.scrollLeft=ne.scrollLeft-ee,Z.scrollTop=ne.scrollTop-he)},K=B=>{B.pointerType==="touch"&&(f.current.delete(B.pointerId),f.current.size===0&&(m.current=!1),H())},Y=B=>{if(B.pointerType!=="touch")return;f.current.delete(B.pointerId);const q=f.current.size===0&&!m.current;f.current.size===0&&(m.current=!1),H(),q&&(o==null||o("controls"),A("all",Ty))},te=B=>{!B.ctrlKey&&!B.metaKey||(B.preventDefault(),I(M()*Math.exp(-B.deltaY*.002),B.clientX,B.clientY))},F=C==="zoom"&&v?{height:Math.max(1,Math.round(v.height*L)),width:Math.max(1,Math.round(v.width*L))}:null,T=F?{height:F.height+Vn,width:F.width+Vn}:void 0,Q=F?{height:F.height,width:F.width}:void 0,G=`${Math.round(M()*100)}%`,X=a.jsxs("div",{className:st(se.toolbar,i!==void 0&&se.headerToolbar),role:"toolbar","aria-label":d("imageViewerControls"),children:[a.jsx("button",{type:"button",className:se.control,"aria-pressed":C==="fit",onClick:$,children:d("imageViewerFit")}),a.jsx("button",{type:"button",className:se.control,"aria-pressed":C==="zoom"&&L===1,onClick:()=>I(1),children:d("imageViewerActualSize")}),a.jsx("button",{type:"button",className:se.control,"aria-label":d("imageViewerZoomOut"),onClick:()=>I(M()/bi),children:"−"}),a.jsx("output",{className:se.zoomLevel,"aria-live":"polite",children:G}),a.jsx("button",{type:"button",className:se.control,"aria-label":d("imageViewerZoomIn"),onClick:()=>I(M()*bi),children:"+"}),a.jsx("a",{className:se.download,href:l,download:e,"aria-label":d("imageViewerDownload",{name:e}),children:d("fileViewerDownload")})]});return a.jsxs("div",{className:st(se.viewer,r&&se.hasNavigation,i!==void 0&&se.toolbarPortaled),children:[i===void 0?X:i?$e.createPortal(X,i):null,a.jsxs("div",{className:se.stageShell,onPointerMoveCapture:B=>{B.pointerType!=="touch"&&(o==null||o("controls"),A("all"))},children:[a.jsx("div",{ref:h,className:st(se.stage,yi[C]),onPointerCancel:K,onPointerDown:V,onPointerMove:O,onPointerUp:Y,onWheel:te,children:a.jsx("div",{className:se.canvas,style:T,children:a.jsx("div",{className:st(se.surface,yi[C]),children:a.jsx("img",{className:st(se.image,u&&se.vector),src:l,alt:e,draggable:!1,onContextMenu:s,style:Q,onLoad:B=>{_({height:B.currentTarget.naturalHeight,width:B.currentTarget.naturalWidth})}})})})}),r?a.jsxs("div",{className:st(se.navigation,Ay[w]),role:"group","aria-label":d("imageViewerGalleryNavigation"),onFocusCapture:()=>{o==null||o("controls"),p.current=!0,j(),R("all")},onBlurCapture:B=>{B.relatedTarget instanceof Node&&B.currentTarget.contains(B.relatedTarget)||(p.current=!1,N())},children:[a.jsx("button",{type:"button",className:st(se.navigationButton,se.previous),"aria-label":d("imageViewerPrevious"),onClick:()=>{o==null||o("controls"),A("all"),r.onPrevious()},children:a.jsx(xi,{direction:"previous"})}),a.jsx("button",{type:"button",className:st(se.navigationButton,se.next),"aria-label":d("imageViewerNext"),onClick:()=>{o==null||o("controls"),A("all"),r.onNext()},children:a.jsx(xi,{direction:"next"})})]}):null]}),r?a.jsx("output",{className:st(se.position,jy[w]),"aria-live":"polite",children:d("imageViewerGalleryPosition",{count:r.count,current:r.current})}):null]})}const Ny="_inlineFrame_1m6sf_12",Iy="_inlineFrameVector_1m6sf_25",$y="_inlineImageButton_1m6sf_30",Dy="_inlineImage_1m6sf_30",By="_inlinePlayer_1m6sf_57",Fy="_inlineLoading_1m6sf_65",Oy="_inlineError_1m6sf_66",Hy="_modalContent_1m6sf_79",Uy="_titleLink_1m6sf_86",Vy="_imageToolbarHost_1m6sf_94",zy="_imageHeader_1m6sf_99",qy="_imageHeaderActions_1m6sf_110",Wy="_imageFrame_1m6sf_144",Ky="_imagePlaceholder_1m6sf_145",Gy="_imageLoadError_1m6sf_157",Qy="_player_1m6sf_174",Xy="_loading_1m6sf_180",Yy="_error_1m6sf_181",Jy="_fileModalContent_1m6sf_192",Zy="_fileModalMeta_1m6sf_203",ev="_fileTextFrame_1m6sf_215",tv="_fileText_1m6sf_215",nv="_fileHtmlFrame_1m6sf_229",rv="_fileBlobFrame_1m6sf_230",sv="_fileLoading_1m6sf_238",ov="_fileError_1m6sf_239",le={inlineFrame:Ny,inlineFrameVector:Iy,inlineImageButton:$y,inlineImage:Dy,inlinePlayer:By,inlineLoading:Fy,inlineError:Oy,modalContent:Hy,titleLink:Uy,imageToolbarHost:Vy,imageHeader:zy,imageHeaderActions:qy,imageFrame:Wy,imagePlaceholder:Ky,imageLoadError:Gy,player:Qy,loading:Xy,error:Yy,fileModalContent:Jy,fileModalMeta:Zy,fileTextFrame:ev,fileText:tv,fileHtmlFrame:nv,fileBlobFrame:rv,fileLoading:sv,fileError:ov},iv="_panePanel_1u6k3_2",av={panePanel:iv};function Pc(){return{sessionRightPaneEnabled:c.useSyncExternalStore(an.subscribe,an.read,an.read),setSessionRightPaneEnabled:an.set}}function cv(e){const[t,n]=c.useState(()=>typeof window<"u"?window.matchMedia(e).matches:!1);return c.useEffect(()=>{const r=window.matchMedia(e);n(r.matches);const s=o=>{n(o.matches)};return r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[e]),t}const zn=tt(Ee.panelSlideAnimations,!0);function lv(){const e=cv("(prefers-reduced-motion: reduce)"),t=c.useSyncExternalStore(zn.subscribe,zn.read,zn.read);return{panelSlideAnimations:t,setPanelSlideAnimations:zn.set,panelSlideDurationMs:t&&!e?200:0}}function Ei(e,t){const[n,r]=c.useState(e);c.useLayoutEffect(()=>{e!==null&&r(e)},[e]);const s=e!==null;return c.useEffect(()=>{if(s)return;if(t===0){r(null);return}const o=setTimeout(()=>r(null),t);return()=>clearTimeout(o)},[s,t]),e??(t>0?n:null)}const uv="_viewer_n7nnf_1",dv="_header_n7nnf_17",fv="_title_n7nnf_23",hv="_frame_n7nnf_30",mv="_notice_n7nnf_38",rn={viewer:uv,header:dv,title:fv,frame:hv,notice:mv};function pv({controller:e,inactive:t}){const{t:n}=xe(),r=t||e.minimized,s=c.useRef(null),[o,i]=c.useState(!1);oa(e.close,!r,"__artifactViewer"),ia(e.close,!r),ys(e.close,!r),c.useEffect(()=>{var u;r||(u=s.current)==null||u.focus()},[r]),c.useEffect(()=>{const u=new URL(e.url).origin,d=h=>{h.disposition==="enforce"&&h.effectiveDirective==="frame-src"&&(h.blockedURI===u||h.blockedURI.startsWith(`${u}/`))&&i(!0)};return document.addEventListener("securitypolicyviolation",d),()=>document.removeEventListener("securitypolicyviolation",d)},[e.url]);const l=document.querySelector(".navigation-route-layer.is-active [data-session-viewer-layer]")??document.querySelector("[data-session-viewer-layer]");return l?$e.createPortal(a.jsxs("section",{className:rn.viewer,role:"dialog","aria-label":e.label,hidden:r,children:[a.jsxs("header",{className:`${He.header} ${rn.header}`,children:[a.jsx("span",{className:He.identity,children:a.jsx("span",{className:rn.title,title:e.label,children:e.label})}),a.jsx(dc,{className:He.actions,url:e.url,onMinimize:e.minimize,onClose:e.close,closeRef:s})]}),o?a.jsx("p",{role:"alert",className:rn.notice,children:n("artifactLinkFrameBlocked")}):a.jsx("iframe",{className:rn.frame,title:e.label,src:e.url,sandbox:"allow-scripts allow-same-origin",referrerPolicy:"no-referrer"})]}),l):null}const Ci=new WeakMap;function gv(e){var o;const t=Ci.get(e);if(t)return t;const n=[],r=((o=e.message)==null?void 0:o.content)??e.content;function s(i){if(typeof i=="string")for(const l of i.matchAll(/https?:\/\/[^\s<>"'`\\]+/gi)){const u=l[0].replace(/[),.;]+$/,"");if(!/\$\{|\$%7b/i.test(u))try{const d=new URL(u);(wn(d.hostname)==="local"||d.pathname.startsWith("/a/"))&&n.push(u)}catch{}}else if(Array.isArray(i))for(const l of i)l.type==="text"&&s(l.text)}if(Array.isArray(r))for(const i of r)i.type==="tool_result"&&s(i.content);return Ci.set(e,n),n}function wv(e,t,n,r){var d,h;if(/\$\{|\$%7b/i.test(e))return;if(Ts(e,t,n)){const f=new URL(e);return{sourceUrl:e,url:f.href,label:f.pathname.split("/").at(-1),artifactToken:f.pathname.split("/")[2]}}if(!((d=t==null?void 0:t.vhosts)!=null&&d.length))return;let s;try{s=new URL(e)}catch{return}if(s.protocol!=="http:"||wn(s.hostname)!=="local"||s.username||s.password)return;const o=t.vhosts.find(f=>f.port===Number(s.port||80));if(!o)return;const i=new URL(n);let l;if((r??wn(i.hostname))==="local"){if(!t.localOrigin)return;l=new URL(t.localOrigin),l.hostname=`${o.name}.localhost`}else{if(!t.vhostPublicRoot)return;l=new URL(`https://${o.name}.${t.vhostPublicRoot}`)}if(l.hostname===i.hostname||i.protocol==="https:"&&l.protocol!=="https:")return;l.pathname=s.pathname,l.search=s.search;const u=(h=t.accessTokens)==null?void 0:h[o.name];if(!(t.accessTokens&&u===void 0))return u&&l.searchParams.set("ya_access",u),l.hash=s.hash,{sourceUrl:e,url:l.href,label:`${o.name}${s.pathname==="/"?"":s.pathname}`}}function ki(e,t,n){var h,f;if(!(t!=null&&t.vhostPublicRoot))return e;let r,s;try{s=new URL(n.clientUrl),r=new URL(e,s)}catch{return e}if(!(n.relayed&&wn(s.hostname)==="public")&&!t.alwaysRewriteVhostLinks&&!n.force||!["http:","https:"].includes(r.protocol)||r.username||r.password||!r.hostname.endsWith(".localhost"))return e;const i=r.hostname.slice(0,-10);if(!i)return e;const l=(h=t.vhosts)==null?void 0:h.some(g=>g.name===i),u=l?(f=t.accessTokens)==null?void 0:f[i]:void 0;if(l&&t.accessTokens&&u===void 0)return e;const d=new URL(`https://${i}.${t.vhostPublicRoot}`);return d.pathname=r.pathname,d.search=r.search,u&&d.searchParams.set("ya_access",u),d.hash=r.hash,d.href}const yv="_links_1awwt_1",vv={links:yv},vr=c.createContext(null),bv=e=>e,xv=()=>{};function Sv(){var e;return((e=c.useContext(vr))==null?void 0:e.rewriteHref)??bv}function _v(){var e;return((e=c.useContext(vr))==null?void 0:e.publicHref)??xv}function Ev(e,t){if(typeof document>"u"||!/href/i.test(e))return e;const n=document.createElement("template");n.innerHTML=e;let r=!1;for(const s of n.content.querySelectorAll("a[href]")){const o=s.getAttribute("href");if(!o)continue;const i=t(o);i!==o&&(s.setAttribute("href",i),r=!0)}return r?n.innerHTML:e}function e_(e){const t=Sv();return c.useMemo(()=>Ev(e,t),[e,t])}function t_({messages:e}){const t=c.useContext(vr);if(!t)return null;const n=new Map;for(const r of e)for(const s of gv(r)){const o=wv(s,t.config,window.location.href);o&&n.set(o.url,o)}return n.size?a.jsx("div",{className:vv.links,children:[...n.values()].map(r=>a.jsxs("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",onClick:s=>{s.stopPropagation(),t.open&&!s.shiftKey&&!s.ctrlKey&&!s.metaKey&&!s.altKey&&t.open(r.url)&&s.preventDefault()},children:[r.label," ↗"]},r.url))}):null}const Hs=c.createContext(null),Nc=c.createContext(null);function Cv(){return c.useContext(Nc)}const Ic=c.createContext(null);function kv(){return c.useContext(Ic)}function br(){return c.useContext(Hs)}function n_({viewerId:e,sessionId:t,title:n,actions:r,contentRef:s,label:o,briefLabel:i,children:l,onClose:u}){const d=c.useId(),h=e??d,f=c.useRef(!0),g=c.useRef(u);return g.current=u,c.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),c.useEffect(()=>{En({id:h,kind:"panel",sessionId:t,title:n,actions:r,contentRef:s,label:o,briefLabel:i,content:l,onClose:()=>{f.current&&g.current()}})},[r,i,l,s,o,t,n,h]),null}function r_({sessionId:e,inactive:t=!1,onSendComment:n,onOpenApp:r,appConfig:s,rightPaneTarget:o,children:i}){const l=ct(),u=bn(l.sourceKey),d=ou(),h=c.useId(),f=c.useMemo(()=>t?null:{config:s,open:r,rewriteHref:m=>ki(m,s,{clientUrl:window.location.href,relayed:d!==void 0}),publicHref:m=>{if(!(s!=null&&s.vhostPublicRoot))return;const p=ki(m,s,{clientUrl:window.location.href,relayed:d!==void 0,force:!0});if(p!==m)return p;try{const y=new URL(m);if(y.hostname.endsWith(`.${s.vhostPublicRoot}`))return y.href}catch{return}}},[t,s,r,d]),g=c.useCallback((m,p)=>t||!Ts(m,u==null?void 0:u.artifactViewer,window.location.href)?!1:(En({id:h,kind:"artifact",sessionId:e,url:m,label:p}),Dh(h),!0),[t,e,u==null?void 0:u.artifactViewer,h]);return a.jsx(Hs.Provider,{value:e,children:a.jsx(Ic.Provider,{value:g,children:a.jsxs(Uh,{onSendComment:n,children:[a.jsx(vr.Provider,{value:f,children:i}),a.jsx(Lv,{sessionId:e,inactive:t,rightPaneTarget:o})]})})})}function s_({children:e}){const t=br(),n=ks();Pc();const r=!!((n==null?void 0:n.sessionId)===t&&Va(n)),s=c.useRef(e);return r||(s.current=e),s.current}function Lv({sessionId:e,inactive:t=!1,rightPaneTarget:n}){const r=ks(),{sessionRightPaneEnabled:s}=Pc(),{panelSlideDurationMs:o}=lv(),i=c.useRef(r),l=c.useRef(0);i.current=r;const u=(r==null?void 0:r.kind)==="panel"&&r.sessionId===e?r:null,d=Ei(u,s&&(!r||u)?o:0),h=(r==null?void 0:r.kind)==="file"&&r.sessionId===e&&r.renderContent?r:null,f=Ei(h,s&&(!r||h)?o:0);if(c.useEffect(()=>(l.current+=1,()=>{const g=l.current+1;l.current=g,queueMicrotask(()=>{const m=i.current;l.current===g&&(m==null?void 0:m.sessionId)===e&&sr(m.id)})}),[e]),f){const g=a.jsx(Hs.Provider,{value:null,children:a.jsx(Nc.Provider,{value:{target:cn(f)?n??null:null,inactive:t||f.minimized||(r==null?void 0:r.id)!==f.id},children:f.renderContent(t,cn(f))})});return cn(f)?n?$e.createPortal(g,n):null:g}return(r==null?void 0:r.kind)==="artifact"&&r.sessionId===e?a.jsx(pv,{controller:r,inactive:t},r.url):d?cn(d)?n?$e.createPortal(a.jsx(Rv,{panel:d,inactive:t}),n):null:a.jsx(xn,{title:d.title,actions:d.actions,contentRef:d.contentRef,onClose:d.close,onMinimize:d.minimize,minimized:d.minimized||t,children:d.content}):null}function Rv({panel:e,inactive:t}){const{t:n}=xe(),r=e.minimized||t;return ys(e.close,!r),a.jsxs("section",{className:av.panePanel,role:"dialog","aria-label":e.label,hidden:r,...Jn,children:[a.jsxs("div",{className:`modal-header ${He.header}`,children:[a.jsx("span",{className:He.identity,children:a.jsx("span",{className:"modal-title",children:e.title})}),a.jsxs("span",{className:`modal-header-actions ${He.actions}`,children:[e.actions,a.jsx("button",{type:"button",className:"modal-close",onClick:e.minimize,"aria-label":n("modalMinimize"),children:"−"}),a.jsx("button",{type:"button",className:"modal-close",onClick:e.close,"aria-label":n("modalClose"),children:"×"})]})]}),a.jsx("div",{className:"modal-content",ref:e.contentRef,children:e.content})]})}function wt(e){return Ot(e)}function zr(e,t,n=!1){if(e.kind==="project-file"&&e.projectId)return{filePath:e.path,lineEnd:e.lineEnd,lineNumber:e.lineNumber,projectId:e.projectId};if(e.kind!=="local-file"||!t)return null;const r=At(e.path,t.projectPath),s=r&&r!=="."?r:n&&et(e.path)?e.path:null;return s?{filePath:s,lineEnd:e.lineEnd,lineNumber:e.lineNumber,projectId:t.projectId}:null}function Mv(e){return`/api/local-image?path=${encodeURIComponent(e)}`}function Qn(e,t,n=e.download){if(e.kind==="project-raw-file"){const s=new URLSearchParams({path:e.path});return n&&s.set("download","true"),`/api/projects/${encodeURIComponent(e.projectId??"")}/files/raw?${s.toString()}`}const r=new URLSearchParams({path:e.path});return e.renderMarkdown&&t&&r.set("render","1"),n&&r.set("download","true"),e.lineNumber!==void 0&&r.set("line",String(e.lineNumber)),e.columnNumber!==void 0&&r.set("column",String(e.columnNumber)),`/api/local-file?${r.toString()}`}function Us(e){return e==="image"||e==="video"}async function fs(e,t=Ji().getCurrentSourceRuntime().transport){return t.fetchBlob(Ec(e))}function Av(e,t){var n;return((n=t==null?void 0:t.buildApiPath)==null?void 0:n.call(t,e))??Mv(e)}async function cr(e,t,n,r=Ji().getCurrentSourceRuntime().transport){const s=Av(e,t);if(!s)throw new Error("Media is outside this view");return t!=null&&t.fetchBlob?t.fetchBlob(e,s,n):fs(s,r)}async function jv(e){const t=new Image;if(t.src=e,typeof t.decode=="function"){await t.decode();return}if(t.complete){if(t.naturalWidth>0)return;throw new Error("Failed to decode image")}await new Promise((n,r)=>{t.onload=()=>n(),t.onerror=()=>r(new Error("Failed to decode image"))})}async function Xn(e,t){return t.fetchBlob(Ec(e))}function lr(e){const t=e.text;return typeof t=="function"?t.call(e):new Promise((n,r)=>{const s=new FileReader;s.onload=()=>n(String(s.result??"")),s.onerror=()=>r(s.error??new Error("Read failed")),s.readAsText(e)})}function Vs(e){var t;return((t=e.split(";")[0])==null?void 0:t.trim().toLowerCase())??""}function Tv(e){return Vs(e)==="text/html"}function Li(e){return Vs(e)==="application/pdf"}function Pv(e){const t=Vs(e);return t.startsWith("text/")||t==="application/json"||t==="application/x-ndjson"||t==="application/xml"||t==="application/yaml"||t==="application/x-yaml"||t==="application/toml"||t==="application/x-toml"}const mt={error:le.inlineError,frame:le.inlineFrame,frameVector:le.inlineFrameVector,image:le.inlineImage,imageButton:le.inlineImageButton,loading:le.inlineLoading,player:le.inlinePlayer};function Ri(e,t,n,r,s){const o=document.createElement("span");if(o.className=s==="vector-unsized"?`${mt.frame} ${mt.frameVector}`:mt.frame,n==="video"){const i=document.createElement("video");i.controls=!0,i.muted=!0,i.className=mt.player,i.src=r,o.append(i)}else{const i=document.createElement("button");i.type="button",i.className=mt.imageButton,i.title=`Open ${wt(t)}`,i.setAttribute("aria-label",`Open ${wt(t)}`),i.dataset.localMediaPreviewTrigger="true";const l=document.createElement("img");l.className=mt.image,l.src=r,l.alt=wt(t),i.append(l),o.append(i)}e.replaceChildren(o)}function Nv(e){const{dismissOnBack:t,filePath:n,imageNavigation:r,mediaSource:s,mediaType:o,onClose:i,parentViewerId:l,path:u}=e,d=br(),h=c.useId(),f=c.useRef(!0),g=c.useRef(i);g.current=i;const m=n===void 0?u:n,p=!!(!l&&d&&o==="image"&&m);c.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);const y=c.useCallback(()=>{f.current&&g.current()},[]),b=c.useRef(r);b.current=r;const v=r==null?void 0:r.count,_=r==null?void 0:r.current,C=c.useMemo(()=>v===void 0||_===void 0?void 0:{count:v,current:_,onNext:()=>{var S;return(S=b.current)==null?void 0:S.onNext()},onPrevious:()=>{var S;return(S=b.current)==null?void 0:S.onPrevious()}},[v,_]);return c.useEffect(()=>{!p||!d||!m||En({id:h,kind:"file",sessionId:d,label:m,briefLabel:wt(m),filePath:m,lineSuffix:"",onClose:y,renderContent:S=>a.jsx(Mi,{path:u,filePath:n,mediaType:o,mediaSource:s,imageNavigation:C,dismissOnBack:t,managedViewerId:h,ownsManagedViewer:!0,inactive:S,onClose:y})})},[y,t,n,C,p,h,s,o,u,m,d]),p?null:a.jsx(Mi,{...e,managedViewerId:l})}function Mi({path:e,filePath:t,mediaType:n,mediaSource:r,imageNavigation:s,dismissOnBack:o=!0,managedViewerId:i,ownsManagedViewer:l=!1,inactive:u=!1,onClose:d}){const{t:h}=xe(),f=ct().transport,g=Ka(),m=!!(u||i&&(g==null?void 0:g.id)===i&&g.minimized),[p,y]=c.useState(null),[b,v]=c.useState(null),[_,C]=c.useState(!0),[S,L]=c.useState(null),[x,E]=c.useState(0),w=c.useRef(b);w.current=b;const R=c.useRef("controls"),j=c.useRef(s);j.current=s;const N=!!s,A=s==null?void 0:s.count,k=s==null?void 0:s.current,M=wt(e),P=t===void 0?e:t,I=h("fileViewerOpenImageNewTab"),$=c.useCallback(()=>{i&&l&&sr(i),d()},[i,d,l]),H=c.useCallback(()=>{i&&qa(i)},[i]);c.useEffect(()=>{let Q=!1,G=null,X=!1;return C(!0),L(null),cr(e,r,"modal",f).then(async B=>{Q||(G=URL.createObjectURL(B),n==="image"&&w.current&&await jv(G),!Q&&(v({blob:B,fileName:M,filePath:P,imageNavigation:A!==void 0&&k!==void 0?{count:A,current:k}:void 0,mediaType:n,path:e,url:G,vector:Cc(B.type,e)}),X=!0,C(!1)))}).catch(B=>{Q||(L(B instanceof Error?B.message:"Failed to load media"),C(!1))}),()=>{Q=!0,G&&!X&&URL.revokeObjectURL(G)}},[r,n,e,M,A,k,P,f]);const V=(b==null?void 0:b.url)??null;c.useEffect(()=>()=>{V&&URL.revokeObjectURL(V)},[V]),c.useEffect(()=>{if(n!=="image"||!N)return;const Q=G=>{var X,B;G.altKey||G.ctrlKey||G.metaKey||(G.key==="ArrowLeft"?(G.preventDefault(),G.stopPropagation(),R.current="keyboard",E(q=>q+1),(X=j.current)==null||X.onPrevious()):G.key==="ArrowRight"&&(G.preventDefault(),G.stopPropagation(),R.current="keyboard",E(q=>q+1),(B=j.current)==null||B.onNext()))};return document.addEventListener("keydown",Q,!0),()=>document.removeEventListener("keydown",Q,!0)},[N,n]);const O=(b==null?void 0:b.mediaType)==="image"?b:null,K=O!=null&&O.imageNavigation&&N?{...O.imageNavigation,onNext:()=>{var Q;return(Q=j.current)==null?void 0:Q.onNext()},onPrevious:()=>{var Q;return(Q=j.current)==null?void 0:Q.onPrevious()}}:void 0,Y=n==="image"||(b==null?void 0:b.mediaType)==="image",te=c.useCallback(()=>{var Q;((Q=w.current)==null?void 0:Q.mediaType)==="image"&&window.open(w.current.url,"_blank","noopener")},[]),F=O==null?void 0:O.blob,T=jc({fileName:(O==null?void 0:O.fileName)??M,filePath:(O==null?void 0:O.filePath)??P,loadBlob:F?()=>Promise.resolve(F):void 0,onOpen:te});return a.jsxs(a.Fragment,{children:[a.jsx(xn,{title:O?a.jsx("a",{className:le.titleLink,href:O.url,target:"_blank",rel:"noopener noreferrer",title:I,onContextMenu:T.handleContextMenu,children:O.fileName}):(b==null?void 0:b.fileName)??M,actions:Y?a.jsx("span",{className:le.imageToolbarHost,ref:y}):void 0,headerClassName:Y?le.imageHeader:void 0,headerActionsClassName:Y?le.imageHeaderActions:void 0,onClose:$,onMinimize:i?H:void 0,minimized:m,closeOnBackGesture:o,closeOnBackspace:o,variant:Y?"image-viewer":void 0,children:O?a.jsxs("div",{className:le.imageFrame,"aria-busy":_,children:[a.jsx(Py,{fileName:O.fileName,initialNavigationChrome:R.current==="keyboard"?"position":"all",keyboardNavigationSequence:x,navigation:K,onContextMenu:T.handleContextMenu,onNavigationInput:Q=>{R.current=Q},toolbarHost:p,url:O.url,vector:O.vector},`${O.path}\0${O.url}`),S?a.jsx("div",{className:le.imageLoadError,role:"alert",children:S}):null]}):a.jsxs("div",{className:`${le.modalContent}${Y?` ${le.imagePlaceholder}`:""}`,children:[_&&a.jsx("div",{className:le.loading,children:"Loading..."}),S&&a.jsx("div",{className:le.error,children:S}),(b==null?void 0:b.mediaType)==="video"?a.jsx("video",{controls:!0,autoPlay:!0,className:le.player,src:b.url}):null]})}),O?T.contextMenuElement:null]})}function Iv({resource:e,initialPresentation:t,dismissOnBack:n,onClose:r}){const s=Kt(),o=ct().transport,i=t??(e.renderMarkdown?"preview":"source"),l=Qn(e,i==="preview"),u=wt(e.path),d=`${e.lineNumber!==void 0?`:${e.lineNumber}`:""}${e.columnNumber!==void 0?`:${e.columnNumber}`:""}`,h=gr(e.path,s==null?void 0:s.projectPath),[f,g]=c.useState({status:"loading"});return c.useEffect(()=>{let m=!1,p=null;return g({status:"loading"}),Xn(l,o).then(async y=>{if(m)return;const b=y.type||"application/octet-stream";if(Tv(b)){const v=await lr(y);m||g(i==="preview"?{status:"html",html:v}:{status:"text",contentType:b,text:v});return}if(Pv(b)){const v=await lr(y);m||g({status:"text",contentType:b,text:v});return}p=URL.createObjectURL(y),m||g({status:"blob",contentType:b,objectUrl:p})}).catch(y=>{m||g({status:"error",error:y instanceof Error?y.message:"Failed to load file"})}),()=>{m=!0,p&&URL.revokeObjectURL(p)}},[l,i,o]),a.jsx(xn,{title:u,onClose:r,closeOnBackGesture:n,closeOnBackspace:n,children:a.jsxs("div",{className:le.fileModalContent,children:[a.jsxs("div",{className:le.fileModalMeta,title:`${e.path}${d}`,children:[h,d]}),f.status==="loading"&&a.jsx("div",{className:le.fileLoading,children:"Loading..."}),f.status==="error"&&a.jsx("div",{className:le.fileError,children:f.error}),f.status==="text"&&a.jsx("div",{className:le.fileTextFrame,children:a.jsx("pre",{className:`${le.fileText} local-file-text`,children:a.jsx("code",{children:f.text})})}),f.status==="html"&&a.jsx(uc,{html:f.html,path:e.path,projectId:e.kind==="project-file"?e.projectId:void 0,className:le.fileHtmlFrame,title:u}),f.status==="blob"&&Li(f.contentType)&&a.jsx("iframe",{className:le.fileBlobFrame,src:f.objectUrl,title:u}),f.status==="blob"&&!Li(f.contentType)&&a.jsxs("div",{className:le.fileError,children:["Preview is not available for ",f.contentType||"this file","."]})]})})}function Ai(e){return{"data-ya-resource":e.getAttribute("data-ya-resource"),"data-ya-path":e.getAttribute("data-ya-path"),"data-ya-project-id":e.getAttribute("data-ya-project-id"),"data-ya-line":e.getAttribute("data-ya-line"),"data-ya-line-end":e.getAttribute("data-ya-line-end"),"data-ya-column":e.getAttribute("data-ya-column"),"data-ya-render-markdown":e.getAttribute("data-ya-render-markdown"),"data-ya-download":e.getAttribute("data-ya-download"),"data-ya-media-type":e.getAttribute("data-ya-media-type")}}function ji(e){if(!(e instanceof Element))return null;const t=e.closest("a[href]");if(t)return t;const n=e.closest(".local-media-inline-preview"),r=n==null?void 0:n.previousElementSibling;return(r==null?void 0:r.querySelector("a[href]"))??null}function Ti(){return typeof window>"u"?void 0:window.location.href}function $v(e){const t=new URL(e);t.searchParams.set("download","true");const n=document.createElement("a");n.href=t.href,n.click()}function Pi(e){return e.kind==="local-file"||e.kind==="project-raw-file"}function Ni(e,t){return t&&(e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)}function Dv(e,t){const n=t.getAttribute("data-media-type");return e.mediaType?e.mediaType:Us(n)?n:"image"}function Bv({contextMenu:e,projectContext:t,transport:n,onClose:r,onOpenResource:s}){var b;const{t:o}=xe(),i=vt(),l=lt(),u=Lc(),d=e.resource.kind==="local-media",h=d?Ac({exposeAbsolutePath:i===null,filePath:e.resource.path,projectPath:t==null?void 0:t.projectPath}):null,f=((b=e.projectFileTarget)==null?void 0:b.filePath)??(h==null?void 0:h.projectRelativePath)??null,g=d?(h==null?void 0:h.absolutePath)??null:i===null?et(e.resource.path)?e.resource.path:f&&(t!=null&&t.projectPath)?pr(f,t.projectPath):null:null,m=e.resource.kind==="project-file"?e.url:i===null?Mc({basePath:l,projectId:t==null?void 0:t.projectId,projectRelativePath:h==null?void 0:h.projectRelativePath}):null,p=ar(e.resource.path,!!e.resource.renderMarkdown),y=v=>{const _=document.createElement("a");_.href="#",s(e.resource,_,v)};return a.jsx(Os,{x:e.x,y:e.y,canStartNewSession:i===null&&!d&&!!(t!=null&&t.projectId),dismissLabel:d?o("imageResourceDismissMenu"):void 0,onClose:r,onOpen:()=>y(),onDownload:d?()=>{cr(e.resource.path,void 0,"modal",n).then(v=>Mt(v,wt(e.resource.path))).catch(()=>{})}:()=>{const{projectFileTarget:v,resource:_}=e,C=v?`/api/projects/${encodeURIComponent(v.projectId)}/files/raw?${new URLSearchParams({path:v.filePath,download:"true"})}`:Qn(_,!1,!0);Xn(C,n).then(S=>Mt(S,wt(e.resource.path))).catch(()=>{})},onCopyImage:d?()=>{Ua(cr(e.resource.path,void 0,"modal",n))}:void 0,onOpenSource:p?()=>y("source"):void 0,onOpenPreview:p?()=>y("preview"):void 0,onStartNewSession:i===null&&!d&&(t!=null&&t.projectId)?()=>{var v;return u(t.projectId,((v=e.projectFileTarget)==null?void 0:v.filePath)??e.resource.path)}:void 0,onCopyProjectRelativePath:f?()=>void fe(f):void 0,onCopyAbsolutePath:g?()=>void fe(g):void 0,onCopyFilePath:d?h!=null&&h.filePath?()=>void fe(h.filePath??""):void 0:!f&&!g&&(i===null||!et(e.resource.path))?()=>void fe(e.resource.path):void 0,onCopyViewerLink:m?()=>void fe(m):void 0,onCopyContents:d?void 0:()=>{const{projectFileTarget:v,resource:_}=e;if(v){Rt(ue.getFile(v.projectId,v.filePath).then(C=>C.content??""));return}Rt(Xn(Qn(_,!1),n).then(lr))},onCopyRenderedContents:d||!p?void 0:()=>{const{projectFileTarget:v,resource:_}=e;if(v){Kr(ue.getFile(v.projectId,v.filePath,!0).then(C=>Ha(v.filePath,C)));return}Kr(Xn(Qn(_,!0),n).then(lr).then(Nh))}})}function Fv(e={}){const t=vt(),n=kv(),r=_v(),s=Kt(),o=ct(),i=o.transport,l=bn(o.sourceKey),u=i.capabilities.sameOriginUrls,d=e.projectContext??s,[h,f]=c.useState(null),[g,m]=c.useState(null),[p,y]=c.useState(null),[b,v]=c.useState(null),[_,C]=c.useState(null),S=(k,M,P)=>{const I=zr(k,d,t===null);return I?(y({...I,...P?{initialPresentation:P}:{}}),m(null),f(null),!0):k.kind==="local-media"?(f({path:k.path,mediaType:Dv(k,M)}),m(null),y(null),!0):Pi(k)?(m({resource:k,...P?{initialPresentation:P}:{}}),f(null),y(null),!0):!1},L=k=>{var V,O;if(!(k.target instanceof Element))return;const M=k.target.closest("button.local-media-inline-toggle");if(M){k.preventDefault(),k.stopPropagation();const K=M.getAttribute("data-media-type"),Y=Us(K)?K:"image",F=!(M.getAttribute("data-expanded")!=="false"),T=((V=M.closest(".local-media-link-group"))==null?void 0:V.nextElementSibling)??null;M.dataset.userToggled="true",M.dataset.expanded=String(F),M.setAttribute("aria-expanded",String(F)),M.setAttribute("aria-label",`${F?"Collapse":"Expand"} ${Y}`),M.title=F?"Collapse inline preview":"Expand inline preview",M.textContent=F?"-":"+",T instanceof HTMLElement&&T.classList.contains("local-media-inline-preview")&&(T.dataset.userToggled="true",T.setAttribute("data-expanded",String(F)));return}const P=ji(k.target);if(!P)return;const I=P.getAttribute("href");if(t===null&&!k.defaultPrevented&&k.button===0&&!k.metaKey&&!k.ctrlKey&&!k.shiftKey&&!k.altKey&&!P.hasAttribute("download")&&(n!=null&&n(P.href,((O=P.textContent)==null?void 0:O.trim())||P.hostname))){k.preventDefault(),k.stopPropagation();return}const $=Eo({attributes:Ai(P),href:I},{currentHref:Ti()});if(!$)return;if(zr($,d,t===null)){if(Ni(k,u))return;k.preventDefault(),k.stopPropagation(),S($,P);return}if($.kind==="local-media"){k.preventDefault(),k.stopPropagation(),S($,P);return}if(Pi($)){if(Ni(k,u))return;k.preventDefault(),k.stopPropagation(),S($,P)}},x=k=>{var $;const M=ji(k.target);if(!M)return;if(t===null&&Ts(M.href,l==null?void 0:l.artifactViewer,window.location.href)){k.preventDefault(),k.stopPropagation(),C({label:(($=M.textContent)==null?void 0:$.trim())||M.hostname,publicUrl:r(M.href),url:M.href,x:k.clientX,y:k.clientY});return}const P=M.getAttribute("href"),I=Eo({attributes:Ai(M),href:P},{currentHref:Ti()});I&&(k.preventDefault(),k.stopPropagation(),v({x:k.clientX,y:k.clientY,resource:I,projectFileTarget:zr(I,d,t===null),url:I.kind==="project-file"?M.href:null}))},E=()=>f(null),w=()=>m(null),R=()=>y(null),j=()=>v(null),N=()=>C(null),A=_?a.jsx(Fs,{x:_.x,y:_.y,canStartNewSession:!1,onClose:N,onOpen:()=>n==null?void 0:n(_.url,_.label),onDownload:()=>$v(_.url),onCopyPublicUrl:_.publicUrl?()=>void fe(_.publicUrl??""):void 0}):b?a.jsx(Bv,{contextMenu:b,projectContext:d,transport:i,onClose:j,onOpenResource:S}):null;return{modal:h,localFileModal:g,projectFileModal:p,handleClick:L,handleContextMenu:x,closeModal:E,closeLocalFileModal:w,closeProjectFileModal:R,contextMenuElement:A}}function Ov(e,t,n,r={}){const{inlineMediaExpandedByDefault:s}=Ow(),o=ct().transport;c.useEffect(()=>{const i=e.current;if(!i)return;const l=new Set,u=new Map,d=new Map;let h=!1;const f=_=>{const C=_.getAttribute("data-media-type");return Us(C)?C:"image"},g=(_,C,S)=>{_.dataset.expanded=String(C),_.setAttribute("aria-expanded",String(C)),_.setAttribute("aria-label",`${C?"Collapse":"Expand"} ${S}`),_.title=C?"Collapse inline preview":"Expand inline preview",_.textContent=C?"-":"+"},m=_=>{var S;const C=((S=_.closest(".local-media-link-group"))==null?void 0:S.nextElementSibling)??null;return C instanceof HTMLElement&&C.classList.contains("local-media-inline-preview")?C:null},p=()=>{const _=i.querySelectorAll("button.local-media-inline-toggle");for(const C of _){if(C.dataset.userToggled==="true")continue;const S=f(C),L=r.suppressAutomaticImages&&S==="image"?!1:s;if(C.dataset.defaultExpanded===String(L))continue;g(C,L,S),C.dataset.defaultExpanded=String(L);const x=m(C);x&&x.dataset.userToggled!=="true"&&(x.setAttribute("data-expanded",String(L)),x.dataset.defaultExpanded=String(L))}},y=(_,C)=>{const S=`${C}\0${_}`,L=u.get(S);if(L)return Promise.resolve(L);const x=d.get(S);if(x)return x;const E=cr(_,n,"inline",o).then(async w=>{const R=URL.createObjectURL(w);l.add(R);const j=await Ww(w,_),N={objectUrl:R,sizing:j};return h?(l.delete(R),URL.revokeObjectURL(R)):u.set(S,N),N}).finally(()=>d.delete(S));return d.set(S,E),E},b=()=>{p();const _=Array.from(i.querySelectorAll(".local-media-inline-preview"));for(const C of _){if(C.getAttribute("data-expanded")==="false"||C.dataset.inlineMounted==="true")continue;const S=C.getAttribute("data-media-path");if(!S)continue;const L=f(C);C.dataset.inlineMounted="true",C.replaceChildren();const x=`${L}\0${S}`,E=u.get(x);if(E){Ri(C,S,L,E.objectUrl,E.sizing);continue}const w=document.createElement("span");w.className=mt.loading,w.textContent="Loading...",C.append(w),y(S,L).then(({objectUrl:R,sizing:j})=>{h||!C.isConnected||Ri(C,S,L,R,j)}).catch(R=>{if(h||!C.isConnected)return;const j=document.createElement("span");j.className=mt.error,j.textContent=R instanceof Error?R.message:"Failed to load media",C.replaceChildren(j)})}};b();const v=new MutationObserver(b);return v.observe(i,{attributeFilter:["data-expanded"],attributes:!0,childList:!0,subtree:!0}),()=>{h=!0,v.disconnect();for(const _ of l)URL.revokeObjectURL(_)}},[s,e,t,n,r.suppressAutomaticImages,o])}const Hv="_root_13ii2_1",Uv="_link_13ii2_7",Vv="_inline_13ii2_17",zv="_inlineLink_13ii2_21",qv="_header_13ii2_31",Wv="_headerLink_13ii2_38",Kv="_active_13ii2_45",Et={root:Hv,link:Uv,inline:Vv,inlineLink:zv,header:qv,headerLink:Wv,active:Kv};function ur({basePath:e="",diffMode:t,filePath:n,lineEnd:r,lineNumber:s,projectId:o,viewMode:i}){const l=new URLSearchParams({path:n});return t?l.set("diff",t):(s!==void 0&&l.set("line",String(s)),r!==void 0&&l.set("lineEnd",String(r)),i==="range"&&l.set("view","range")),`${e}/projects/${o}/file?${l.toString()}`}function Gv({className:e,filePath:t,projectId:n}){const r=ec(n,t);return!r.supported||!r.relativePath||!r.worktreeFile&&!r.cumulativeFile?null:a.jsx($c,{availability:r,className:e,projectId:n,variant:"inline"})}function $c({activeView:e="source",availability:t,className:n,onSelect:r,projectId:s,sourceHref:o,variant:i}){const{t:l}=xe(),u=lt(),d=t.relativePath;if(!t.supported||!d||!t.worktreeFile&&!t.cumulativeFile)return null;const h=m=>yt(ur({basePath:u,diffMode:m,filePath:d,projectId:s})),f=m=>p=>{p.stopPropagation(),!(!r||p.button!==0||p.metaKey||p.ctrlKey||p.shiftKey||p.altKey)&&(p.preventDefault(),r(m))},g=m=>[Et.link,i==="header"?Et.headerLink:Et.inlineLink,e===m?Et.active:null].filter(Boolean).join(" ");return a.jsxs("span",{className:[Et.root,i==="header"?Et.header:Et.inline,n].filter(Boolean).join(" "),"data-file-diff-links":i,role:"group","aria-label":l("fileDiffViews"),children:[i==="header"&&o&&a.jsx("a",{className:g("source"),href:o,"aria-current":e==="source"?"page":void 0,onClick:f("source"),children:l("fileViewerSource")}),t.worktreeFile&&a.jsx("a",{className:g("worktree"),href:h("worktree"),"aria-current":e==="worktree"?"page":void 0,"aria-label":l("fileDiffVsHeadTitle",{path:d}),title:l("fileDiffVsHeadTitle",{path:d}),onClick:f("worktree"),children:l("fileDiffVsHead")}),t.cumulativeFile&&a.jsx("a",{className:g("cumulative"),href:h("cumulative"),"aria-current":e==="cumulative"?"page":void 0,"aria-label":l("fileDiffVsParentTitle",{path:d}),title:l("fileDiffVsParentTitle",{path:d}),onClick:f("cumulative"),children:l("fileDiffVsParent")})]})}const Qv="_list_1omn2_1",Xv="_listCompact_1omn2_11",Yv="_row_1omn2_15",Jv="_rowHighlighted_1omn2_27",Zv="_rowMain_1omn2_32",eb="_rowMeta_1omn2_39",tb="_count_1omn2_46",nb="_warning_1omn2_51",rb="_notice_1omn2_56",sb="_rowActions_1omn2_61",ob="_rowTypeIcon_1omn2_68",ib="_rowTypeIconLive_1omn2_85",ab="_iconButton_1omn2_89",cb="_iconButtonDanger_1omn2_107",lb="_iconButtonFreeze_1omn2_114",ub="_error_1omn2_144",db="_empty_1omn2_148",be={list:Qv,listCompact:Xv,row:Yv,rowHighlighted:Jv,rowMain:Zv,rowMeta:eb,count:tb,warning:nb,notice:rb,rowActions:sb,rowTypeIcon:ob,rowTypeIconLive:ib,iconButton:ab,iconButtonDanger:cb,iconButtonFreeze:lb,error:ub,empty:db};function fb({children:e,compact:t=!1}){return a.jsx("div",{className:`${be.list} ${t?be.listCompact:""}`,role:"list",children:e})}function hb({children:e,copyAction:t,freezeAction:n,highlighted:r=!1,mode:s,modeLabel:o,revokeAction:i,title:l,warning:u}){return a.jsxs("div",{className:`${be.row} ${r?be.rowHighlighted:""}`,role:"listitem",children:[a.jsxs("div",{className:be.rowMain,children:[a.jsx("strong",{children:l}),e,u&&a.jsx("span",{className:be.warning,children:u})]}),a.jsxs("div",{className:be.rowActions,children:[a.jsx("span",{className:`${be.rowTypeIcon} ${s==="live"?be.rowTypeIconLive:""}`,title:o,"aria-label":o,role:"img",children:a.jsx(yb,{kind:s})}),a.jsx("button",{type:"button",className:be.iconButton,disabled:t.disabled,onClick:t.onClick,title:t.label,"aria-label":t.label,children:t.working?"…":a.jsx(vb,{})}),n&&a.jsx("button",{type:"button",className:`${be.iconButton} ${be.iconButtonFreeze}`,disabled:n.disabled,onClick:n.onClick,title:n.label,"aria-label":n.label,children:n.working?"…":a.jsx(wb,{})}),a.jsx("button",{type:"button",className:`${be.iconButton} ${be.iconButtonDanger}`,disabled:i.disabled,onClick:i.onClick,title:i.label,"aria-label":i.label,children:i.working?"…":a.jsx(gb,{})})]})]})}function mb({children:e}){return a.jsx("span",{className:be.rowMeta,children:e})}function Ii({children:e,loading:t=!1}){return a.jsx("div",{className:be.empty,role:t?"status":void 0,children:e})}function pb({children:e}){return a.jsx("div",{className:be.count,children:e})}function $i({children:e,tone:t}){return a.jsx("div",{className:t==="error"?be.error:be.notice,role:t==="error"?"alert":"status",children:e})}function o_(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:a.jsx("path",{d:"M8 3v10M3 8h10"})})}function gb(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round","aria-hidden":"true",children:a.jsx("path",{d:"m4 4 8 8M12 4l-8 8"})})}function wb(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1.5"}),a.jsx("path",{d:"M5.5 7V4.75a2.5 2.5 0 0 1 5 0V7M8 10v1.5"})]})}function i_(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"m3 8.5 3.2 3.2L13 4.8"})})}function yb({kind:e}){const t={all:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("path",{d:"M3 12h18M12 3c3 3.2 3 14.8 0 18M12 3c-3 3.2-3 14.8 0 18"})]}),project:a.jsx("path",{d:"M3 6.5h7l2 2h9v10.5H3zM3 6.5V5h7l2 2"}),session:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"14",rx:"3"}),a.jsx("path",{d:"m8 21 4-3h5M7 9h10M7 13h7"})]}),frozen:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"5",y:"10",width:"14",height:"11",rx:"2"}),a.jsx("path",{d:"M8 10V7a4 4 0 0 1 8 0v3M12 14v3"})]}),live:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),a.jsx("path",{d:"M8.5 8.5a5 5 0 0 0 0 7M15.5 8.5a5 5 0 0 1 0 7M5.5 5.5a9 9 0 0 0 0 13M18.5 5.5a9 9 0 0 1 0 13"})]})};return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t[e]})}function vb(){return a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"5",y:"5",width:"9",height:"9",rx:"1.5"}),a.jsx("path",{d:"M11 5V3.5A1.5 1.5 0 0 0 9.5 2H3.5A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5"})]})}const bb="_modal_1132s_1",xb="_fileIdentity_1132s_10",Sb="_liveBadge_1132s_39",_b="_description_1132s_52",Eb="_warning_1132s_59",Cb="_createButton_1132s_82",kb="_manualCopy_1132s_97",Lb="_inventory_1132s_118",Rb="_inventoryHeading_1132s_123",ot={modal:bb,fileIdentity:xb,liveBadge:Sb,description:_b,warning:Eb,createButton:Cb,manualCopy:kb,inventory:Lb,inventoryHeading:Rb};function Mb({anchorRect:e,filePath:t,projectId:n,title:r,onClose:s}){const{t:o}=xe(),[i,l]=c.useState([]),[u,d]=c.useState(!0),[h,f]=c.useState(null),[g,m]=c.useState(null),[p,y]=c.useState(null),[b,v]=c.useState(null),_=c.useRef(null),C=c.useCallback(async()=>{d(!0),m(null);try{const E=await ue.getPublicFileShares(n,t);l(E.items)}catch(E){m(E instanceof Error?E.message:o("publicFileShareLoadFailed"))}finally{d(!1)}},[t,n,o]);c.useEffect(()=>{C()},[C]),c.useEffect(()=>{var E,w;b&&((E=_.current)==null||E.focus(),(w=_.current)==null||w.select())},[b]);const S=async()=>{f("create"),m(null),y(null),v(null);const E=ue.createPublicFileShare({projectId:n,path:t,...r?{title:r}:{}}),w=Rt(E.then(R=>R.url));try{const R=await E;await w?y(o("publicFileShareCopied")):(v(R.url),y(o("publicFileShareManualCopy"))),await C()}catch(R){m(R instanceof Error?R.message:o("publicFileShareCreateFailed"))}finally{f(null)}},L=async E=>{if(m(null),y(null),v(null),await Rt(Promise.resolve(E.url))){y(o("publicFileShareCopied"));return}v(E.url),y(o("publicFileShareManualCopy"))},x=async E=>{if(window.confirm(o("publicShareManagementRevokeOneConfirm"))){f(`revoke:${E.shareId}`),m(null),y(null);try{await ue.revokePublicFileShare(E.shareId),l(w=>w.filter(R=>R.shareId!==E.shareId)),y(o("publicFileShareRevoked"))}catch(w){m(w instanceof Error?w.message:o("publicFileShareRevokeFailed"))}finally{f(null)}}};return a.jsx(xn,{anchorRect:e,title:o("publicFileShareTitle"),onClose:s,children:a.jsxs("div",{className:ot.modal,children:[a.jsxs("div",{className:ot.fileIdentity,title:t,children:[a.jsx(Ab,{}),a.jsx("span",{children:t}),a.jsx("span",{className:ot.liveBadge,children:o("publicShareLiveBadge")})]}),a.jsx("p",{className:ot.description,children:o("publicFileShareDescription")}),a.jsxs("div",{className:ot.warning,role:"note",children:[a.jsx(jb,{}),a.jsx("span",{children:o("publicFileShareWarning")})]}),a.jsxs("button",{type:"button",className:`settings-button settings-button-primary ${ot.createButton}`,disabled:h!==null,onClick:()=>void S(),children:[a.jsx(Tb,{}),o(h==="create"?"publicFileShareCreating":"publicFileShareCreate")]}),b&&a.jsxs("label",{className:ot.manualCopy,children:[a.jsx("span",{children:o("publicFileShareUrlLabel")}),a.jsx("input",{ref:_,readOnly:!0,value:b})]}),g&&a.jsx($i,{tone:"error",children:g}),p&&a.jsx($i,{tone:"notice",children:p}),a.jsxs("div",{className:ot.inventory,children:[a.jsx("div",{className:ot.inventoryHeading,children:a.jsx("strong",{children:o("publicFileShareExisting")})}),u?a.jsx(Ii,{loading:!0,children:o("publicFileShareLoading")}):i.length===0?a.jsx(Ii,{children:o("publicFileShareEmpty")}):a.jsx(fb,{compact:!0,children:i.map(E=>{const w=h===`revoke:${E.shareId}`;return a.jsx(hb,{title:E.title||t.split("/").at(-1)||t,mode:"live",modeLabel:o("publicShareLiveBadge"),copyAction:{label:o("publicFileShareCopy"),disabled:h!==null,onClick:()=>void L(E)},revokeAction:{label:o("publicFileShareRevoke"),disabled:h!==null,working:w,onClick:()=>void x(E)},children:a.jsx(mb,{children:new Date(E.createdAt).toLocaleString()})},E.shareId)})}),!u&&a.jsx(pb,{children:o("publicFileShareCount",{count:i.length})})]})]})})}function Ab(){return a.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor","aria-hidden":"true",children:a.jsx("path",{d:"M5 2.5h6l4 4v11H5zM11 2.5v4h4"})})}function jb(){return a.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor","aria-hidden":"true",children:a.jsx("path",{d:"M10 2.5 18 17H2zM10 7v4.5M10 14.5v.1"})})}function Tb(){return a.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor","aria-hidden":"true",children:a.jsx("path",{d:"m8 12 4-4M6.5 14.5l-1 1a2.8 2.8 0 0 1-4-4l3-3a2.8 2.8 0 0 1 4 0M13.5 5.5l1-1a2.8 2.8 0 1 1 4 4l-3 3a2.8 2.8 0 0 1-4 0"})})}const Pb="_viewer_5pr5p_1",Nb="_body_5pr5p_6",Ib="_backButton_5pr5p_10",$b="_htmlPreviewFrame_5pr5p_15",Db="_diffBody_5pr5p_23",Bb="_rawToggle_5pr5p_28",Fb="_commentToggle_5pr5p_38",Ob="_commentSend_5pr5p_48",Hb="_provenanceRow_5pr5p_61",Ub="_quoteReplySurface_5pr5p_68",Vb="_info_5pr5p_75",zb="_windowActions_5pr5p_87",qb="_fullscreenButton_5pr5p_88",Wb="_actions_5pr5p_89",Te={viewer:Pb,body:Nb,backButton:Ib,htmlPreviewFrame:$b,diffBody:Db,rawToggle:Bb,commentToggle:Fb,commentSend:Ob,provenanceRow:Hb,quoteReplySurface:Ub,info:Vb,windowActions:zb,fullscreenButton:qb,actions:Wb};function Kb(e){return e instanceof Element&&e.closest("input, textarea, select, [contenteditable]:not([contenteditable='false'])")!==null}function Gb(e){if(!e.isConnected||e.closest('[aria-hidden="true"]'))return!1;const t=e.closest('[role="dialog"]')??e.closest(".file-viewer")??e,n=e.ownerDocument.activeElement;return!n||n===e.ownerDocument.body||t.contains(n)}function Qb(e){var u,d,h;const t=e==null?void 0:e.ownerDocument.getSelection();if(!e||!t)return!1;const n=e.ownerDocument.createRange(),r=((u=e.ownerDocument.defaultView)==null?void 0:u.NodeFilter)??NodeFilter,s=e.ownerDocument.createTreeWalker(e,r.SHOW_TEXT),o=s.nextNode();if(o){let f=o;for(let g=s.nextNode();g;g=s.nextNode())f=g;n.setStart(o,0),n.setEnd(f,((d=f.textContent)==null?void 0:d.length)??0)}else n.selectNodeContents(e);t.removeAllRanges(),t.addRange(n);const i=((h=e.ownerDocument.defaultView)==null?void 0:h.Event)??Event;return e.ownerDocument.dispatchEvent(new i("selectionchange")),!0}function Xb({className:e,contentRef:t}){const{t:n}=xe(),r=c.useCallback(()=>Qb(t.current),[t]);c.useEffect(()=>{var u;const i=((u=t.current)==null?void 0:u.ownerDocument)??document,l=d=>{const h=t.current;!h||d.defaultPrevented||d.isComposing||d.altKey||d.shiftKey||!(d.ctrlKey||d.metaKey)||d.key.toLowerCase()!=="a"||Kb(d.target)||!Gb(h)||(d.preventDefault(),d.stopPropagation(),r())};return i.addEventListener("keydown",l,!0),()=>i.removeEventListener("keydown",l,!0)},[t,r]);const s=n("viewerSelectAll"),o=n("viewerSelectAllTitle");return a.jsx("button",{type:"button",className:e,onMouseDown:i=>i.preventDefault(),onPointerDown:i=>i.preventDefault(),onClick:r,title:o,"aria-label":s,children:a.jsx(Yb,{})})}function Yb(){return a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M6 2H2v4M10 2h4v4M14 10v4h-4M6 14H2v-4"}),a.jsx("rect",{x:"5",y:"5",width:"6",height:"6",rx:"1"})]})}const Di="p, ul, ol, blockquote, pre, h1, h2, h3, h4, h5, h6, table",Jb=200,Zb=120;function ex(e){return Array.from(e.querySelectorAll(Di)).filter(n=>{var s;const r=(s=n.parentElement)==null?void 0:s.closest(Di);return!r||!e.contains(r)})}function tx(e,t){return e.length===t.length&&e.every((n,r)=>{var s,o,i;return n.blockIndex===((s=t[r])==null?void 0:s.blockIndex)&&n.top===((o=t[r])==null?void 0:o.top)&&n.height===((i=t[r])==null?void 0:i.height)})}function Dc(e,t){const n=e[t];if(!n)throw new Error(`Missing paragraph block ${t}`);return n}function nx(e,t,n){const r=n.getBoundingClientRect();return Array.from(t).sort((s,o)=>s-o).map(s=>{const o=Dc(e,s).getBoundingClientRect();return{blockIndex:s,top:o.top-r.top+n.scrollTop,height:o.height}})}function rx({alwaysShowQuoteCircle:e,contentRef:t,layoutKey:n,onQuoteBlock:r,paragraphQuoteCirclesEnabled:s,sourceRef:o,surfaceRef:i}){const{t:l}=xe(),u=c.useRef([]),[d,h]=c.useState([]);c.useEffect(()=>{const m=t.current,p=i.current;if(!s||!m||!p){u.current.length>0&&(u.current=[],h([]));return}let y=[],b=new WeakMap;const v=new Set;let _=0,C=0,S=!1;const L=()=>{_=0;const A=nx(y,v,p);u.current=A.map(k=>Dc(y,k.blockIndex)),h(k=>tx(k,A)?k:A)},x=()=>{_===0&&(_=requestAnimationFrame(L))},E=()=>{window.clearTimeout(C),C=window.setTimeout(x,Zb)},w=typeof IntersectionObserver>"u"?null:new IntersectionObserver(A=>{const k=A.find(M=>M.target===p);if(k&&!k.isIntersecting){if(!S)return;S=!1,v.clear(),w==null||w.disconnect(),w==null||w.observe(p),x();return}if(k!=null&&k.isIntersecting&&!S){S=!0;for(const M of y)w==null||w.observe(M)}for(const M of A){if(!(M.target instanceof HTMLElement))continue;const P=b.get(M.target);P!==void 0&&(M.isIntersecting?v.add(P):v.delete(P))}x()},{rootMargin:`${Jb}px 0px`}),R=()=>{if(w)for(const A of y)w.unobserve(A);if(y=ex(m),b=new WeakMap,y.forEach((A,k)=>{b.set(A,k)}),v.clear(),w&&S)for(const A of y)w.observe(A);else if(!w)for(let A=0;A<y.length;A+=1)v.add(A);x()};R(),w&&w.observe(p);const j=typeof ResizeObserver>"u"?null:new ResizeObserver(E);j==null||j.observe(m);const N=new MutationObserver(R);return N.observe(m,{childList:!0,subtree:!0}),()=>{j==null||j.disconnect(),N.disconnect(),w==null||w.disconnect(),_!==0&&cancelAnimationFrame(_),window.clearTimeout(C)}},[t,n,s,i]);const f=c.useCallback(()=>{const m=o.current,p=t.current;if(!m)return;const y=iu(m);if(!y)return;const b=p&&p!==m?xo(m,p):null;r(tr(b?{...y,range:b.range,selectedText:b.selectedText}:y))},[t,r,o]),g=c.useCallback(m=>{const p=o.current,y=u.current[m];if(!p||!y)return;const b=xo(p,y);b&&r(tr(b))},[r,o]);return a.jsx("div",{className:"text-block-quote-rail",children:s&&d.length>0?d.map((m,p)=>a.jsx("button",{type:"button",className:`text-block-quote text-block-quote-paragraph ${e?"always-visible":""}`,style:{top:`${m.top+m.height}px`},onClick:()=>g(p),title:l("sessionQuoteBlock"),"aria-label":l("sessionQuoteBlock"),children:">"},m.blockIndex)):a.jsx("button",{type:"button",className:`text-block-quote text-block-quote-fallback ${e?"always-visible":""}`,onClick:f,title:l("sessionQuoteBlock"),"aria-label":l("sessionQuoteBlock"),children:">"})})}function Bi(e){return e<1024?`${e} b`:e<1024*1024?`${Math.round(e/1024)} kb`:`${Math.round(e/(1024*1024)*10)/10} mb`}function sx(e){var r;const t=((r=e.split(".").pop())==null?void 0:r.toLowerCase())||"";return{ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",swift:"swift",php:"php",sql:"sql",sh:"bash",bash:"bash",zsh:"bash",json:"json",yaml:"yaml",yml:"yaml",toml:"toml",xml:"xml",html:"html",css:"css",scss:"scss",md:"markdown",markdown:"markdown"}[t]||"plaintext"}function Fi(e){return e.startsWith("image/")}function qr(e,t){return/\.(?:html?|xhtml)$/i.test(e)||t==="text/html"||t==="application/xhtml+xml"}function ox(e){if(!zt(e))return null;try{return Wt(mr(e))}catch{return null}}function ix(e,t){return e===void 0?null:{end:Math.max(e,t??e),start:e}}function Ct(e){return(e==null?void 0:e.contentStartLine)??1}function Bc(e){if(e.contentEndLine!==void 0)return e.contentEndLine;if(e.content!==void 0)return Ct(e)+e.content.split(`
56
- `).length-1}function Oi(e){if(!e.contentTruncated)return null;const t=Bc(e),n=e.contentTotalLines?` of ${e.contentTotalLines}`:"";return`Showing lines ${Ct(e)}-${t}${n}`}function Fc(e,t,n){return t===void 0?e:`${e}:${t}${n&&n>t?`-${n}`:""}`}function ax(e,t,n,r){const s=e.split(`
57
- `),o=r-t;if(o<0||o>=s.length)return null;const i=Math.max(0,o-3),l=Math.min(s.length,o+4);return{location:Fc(n,r),quote:s.slice(i,l).join(`
58
- `),afterLine:r}}function cx(e,t){const n=Array.from(e.querySelectorAll(".markdown-rendered > :not([data-review-comment-inline-host])"));let r;for(let s=0;s<n.length;s+=1)try{t.intersectsNode(n[s])&&(r=s)}catch{}return r}function lx({afterBlock:e,children:t,editor:n,previewRef:r}){const[s,o]=c.useState(null);return c.useLayoutEffect(()=>{if(e===void 0){o(null);return}const i=r.current;if(!i){o(null);return}const l=i.ownerDocument.createElement("div");l.dataset.reviewCommentInlineHost="";const u=()=>{const f=i.querySelectorAll(".markdown-rendered > :not([data-review-comment-inline-host])").item(e);f&&f.nextElementSibling!==l&&f.after(l)};if(u(),!l.isConnected){o(null);return}const d=new MutationObserver(u);return d.observe(i,{childList:!0,subtree:!0}),o(l),()=>{d.disconnect(),l.remove()}},[e,r]),a.jsxs("div",{ref:r,children:[t,s?$e.createPortal(a.jsx(hw,{editor:n}),s,"session-file-comment-editor"):null]})}function ux({busy:e,cancelLabel:t,draft:n,error:r,onCancel:s,onChange:o,onPersist:i,onSend:l,placeholder:u,sendLabel:d}){const[h,f]=c.useState(n.text);return a.jsx(bc,{anchorLabel:n.location,snippet:n.quote,text:h,placeholder:u,autoFocus:!n.preserveSelection,error:r,onBlur:i,onChange:g=>{f(g),o(n.id,g)},onKeyDown:g=>{g.key!=="Enter"||g.shiftKey||g.nativeEvent.isComposing||(g.preventDefault(),g.stopPropagation(),l(n.id))},actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>s(n.id),disabled:e,children:t}),a.jsx("button",{type:"button",className:Te.commentSend,onClick:()=>l(n.id),disabled:!h.trim()||e,children:d})]})})}function dx(e,t,n,r){if(!e)return e;const s=ix(n,r),o=(s==null?void 0:s.start)===(s==null?void 0:s.end);let i=0;return e.replace(/<span class="([^"]*)">/g,(l,u)=>{if(!u.split(/\s+/).includes("line"))return l;i+=1;const d=t+i-1,h=s!==null&&d>=s.start&&d<=s.end;return`<span class="${[u,o&&h?"highlighted-line":"",d===(s==null?void 0:s.start)?"highlighted-line-start":"",d===(s==null?void 0:s.end)?"highlighted-line-end":""].filter(Boolean).join(" ")}" data-line="${d}">`})}const Hi={loadFile:(e,t,n,r,s,o)=>ue.getFile(e,t,n,r,s,o),getRawFileUrl:(e,t,n)=>ue.getFileRawUrl(e,t,n),fetchRawFileBlob:(e,t,n)=>{const{rawUrl:r}=e;if(!r)throw new Error("Raw file URL unavailable");const s=n?`${r}${r.includes("?")?"&":"?"}download=true`:r;return fs(s)},createMediaSource:e=>e?{fetchBlob:async(t,n)=>as(e,t)??fs(n)}:void 0};function fx(e,t){const n=e.getBoundingClientRect();return t.getBoundingClientRect().top-n.top+e.scrollTop}function hx(e,t){if(e.scrollHeight<=e.clientHeight)return 0;const n=fx(e,t),r=e.clientHeight*.1,s=Math.max(0,e.scrollHeight-e.clientHeight);return Math.max(0,Math.min(s,n-r))}const mx=c.memo(function({projectId:t,filePath:n,source:r=Hi,openInNewTabUrl:s,onClose:o,onMinimize:i,parentViewerId:l,standalone:u=!1,lineNumber:d,lineEnd:h,viewMode:f="full",initialPresentation:g,diffMode:m,headerLeading:p}){var po,go;const{t:y}=xe(),b=Cs(),v=Vh(),_=Kt(),{quoteReplyButtonMode:C}=nc(),S=ct(),L=S.transport,x=vt(),E=`${t}\0${n}\0${m??"source"}`,[w,R]=c.useState(!1),[j,N]=c.useState(null),A=c.useRef(null),[k,M]=c.useState(()=>({identity:E,view:m??"source"})),P=k.identity===E?k.view:m??"source",I=c.useCallback(D=>{D==="source"&&(A.current=E,R(!1),N(null)),M({identity:E,view:D})},[E]),$=P!=="source",H=$?void 0:d,V=$?void 0:h,O=$?"full":f,K=ec(x===null?t:void 0,n),Y=P==="worktree"?K.worktreeFile:P==="cumulative"?K.cumulativeFile:null,te=L.capabilities.sameOriginUrls,F=lt(),[T,Q]=c.useState(null),[G,X]=c.useState(!0),[B,q]=c.useState(null),[Z,ne]=c.useState(!1),[ie,ee]=c.useState(!1),[he,ae]=c.useState(null),ve=c.useRef(null),[ce,ut]=c.useState(!1),[Ve,ge]=c.useState(null),[ze,qe]=c.useState(null),[jt,Pe]=c.useState(null),Me=Qf(),Gt=Do(zf,Me.density),Tt=Do(Vf,Me.density),bt=Gf(Gt),De=c.useMemo(()=>ox(t),[t]),nt=c.useMemo(()=>et(n)?At(n,De):Ue(n).replace(/^\.\/+/,""),[n,De]),Ne=nt??n,xt=c.useMemo(()=>({projectId:t,filePath:Ne,contentStartLine:T?Ct(T):1}),[T,t,Ne]),xr=c.useMemo(()=>_&&v?Hm({sourceKey:S.sourceKey,sessionId:_.sessionId,projectId:t,filePath:n}):null,[n,t,v,_,S.sourceKey]),de=ip({active:ce,storageKey:xr,sendComment:v}),Ie=c.useRef(null);cc(Ie,$||T==null?void 0:T.content,xt);const W=kc(),z=c.useCallback(D=>{W(t,D)},[t,W]),me=c.useRef(null),{modal:ye,localFileModal:Ce,projectFileModal:Se,handleClick:Pt,handleContextMenu:Sr,closeModal:Jc,closeLocalFileModal:Zc,closeProjectFileModal:el,contextMenuElement:tl}=Fv({projectContext:{projectId:t,projectPath:De}}),Gs=c.useRef(Pt),Qs=c.useRef(Sr);Gs.current=Pt,Qs.current=Sr;const Xs=c.useCallback(D=>Gs.current(D),[]),Ys=c.useCallback(D=>Qs.current(D),[]),_r=c.useCallback(D=>{var J,_e;if(D.key!==" ")return;const U=(_e=(J=D.target).closest)==null?void 0:_e.call(J,"a[href]");U&&(D.preventDefault(),U.click())},[]),nl=c.useCallback(D=>{D.button>0||D.target instanceof Element&&D.target.closest("button, input, textarea, select, a[href], [contenteditable='true']")||D.currentTarget.focus({preventScroll:!0})},[]),rl=c.useCallback(D=>{if(D.button!==0||D.target instanceof Element&&D.target.closest("button, input, textarea, select, a[href], [contenteditable='true']"))return;const U=D.currentTarget.ownerDocument.getSelection();if(!U||U.isCollapsed||U.rangeCount===0)return;(U.anchorNode!==null&&D.currentTarget.contains(U.anchorNode)||U.focusNode!==null&&D.currentTarget.contains(U.focusNode))&&U.removeAllRanges()},[]),rt=!!(v&&_&&o&&!u&&x===null&&!$&&(T!=null&&T.metadata.isText)&&T.content!==void 0&&!(w&&qr(n,T.metadata.mimeType)));c.useEffect(()=>{!ce||rt||(de.flush(),ut(!1))},[ce,rt,de.flush]);const Js=c.useCallback(()=>{const D=Ie.current;if(!ce||!rt||!D)return;const U=hr(D);if(U.length===0)return;const J=U.map(pe=>pe.sourceLocation).filter(pe=>(pe==null?void 0:pe.filePath)===Ne),_e=J.length===U.length?Math.min(...J.map(pe=>(pe==null?void 0:pe.lineStart)??1)):void 0,Ae=J.length===U.length?Math.max(...J.map(pe=>(pe==null?void 0:pe.lineEnd)??1)):void 0,dt=w?cx(me.current??D,U.at(-1).range):void 0;de.open({location:Fc(Ne,_e,Ae),quote:U.map(pe=>pe.markdown).join(`
59
-
60
- `),preserveSelection:!0,...!w&&Ae!==void 0?{afterLine:Ae}:{},...dt===void 0?{}:{afterBlock:dt}})},[ce,rt,de.open,w,Ne]);c.useEffect(()=>{if(!ce||!rt)return;const D=Ie.current,U=D==null?void 0:D.ownerDocument;if(!D||!U)return;let J=!1,_e=0;const Ae=()=>{window.clearTimeout(_e),_e=window.setTimeout(Js,0)},dt=Re=>{Re.button===0&&Re.target instanceof Node&&D.contains(Re.target)&&!(Re.target instanceof Element&&Re.target.closest("button, input, textarea, select, a[href]"))&&(J=!0)},pe=()=>{J&&(J=!1,Ae())},Nt=()=>{const Re=U.activeElement;Re instanceof Element&&Re.closest('[data-markdown-copy-ignore="true"]')||J||Ae()};return U.addEventListener("pointerdown",dt,!0),U.addEventListener("pointerup",pe,!0),U.addEventListener("pointercancel",pe,!0),U.addEventListener("selectionchange",Nt),Ae(),()=>{window.clearTimeout(_e),U.removeEventListener("pointerdown",dt,!0),U.removeEventListener("pointerup",pe,!0),U.removeEventListener("pointercancel",pe,!0),U.removeEventListener("selectionchange",Nt)}},[ce,rt,Js]);const sl=c.useCallback(D=>{if(!ce||!rt||!(T!=null&&T.content)||D.target instanceof Element&&D.target.closest("button, input, textarea, select, a[href], [contenteditable='true']"))return;const U=D.currentTarget.ownerDocument.getSelection();if(U&&!U.isCollapsed)return;const J=D.target instanceof Element?D.target.closest("[data-line]"):null,_e=Number(J==null?void 0:J.dataset.line);if(!Number.isInteger(_e))return;const Ae=ax(T.content,Ct(T),Ne,_e);Ae&&de.open(Ae)},[ce,rt,T,de.open,Ne]),ol=c.useCallback(()=>{ut(D=>(D&&de.flush(),!D))},[de.flush]),il=c.useCallback(D=>{if(!ce)return;const U=D.relatedTarget;if(!(U instanceof Node)){de.persist();return}(D.currentTarget.closest("dialog")??D.currentTarget).contains(U)||de.flush()},[ce,de.flush,de.persist]),Zs=c.useCallback(()=>{de.flush(),o==null||o()},[o,de.flush]),al=c.useCallback(()=>{de.flush(),i==null||i()},[i,de.flush]),eo=c.useMemo(()=>{var D;return(D=r.createMediaSource)==null?void 0:D.call(r,T)},[T,r]),We=c.useMemo(()=>T!=null&&T.renderedMarkdownHtml?r.transformRenderedMarkdownHtml?r.transformRenderedMarkdownHtml(T.renderedMarkdownHtml,T):T.renderedMarkdownHtml:null,[T,r]),cl=c.useMemo(()=>We?a.jsx(_s,{html:We,sourcePath:n,density:Tt,ariaLabel:y("fileViewerPreview"),onClick:Xs,onContextMenu:Ys,onKeyDown:_r}):null,[n,_r,Xs,Ys,Tt,We,y]),Qt=c.useMemo(()=>T?Oa(n,T,We??void 0):null,[T,n,We]),Ln=c.useMemo(()=>{const D=dx(T==null?void 0:T.highlightedHtml,Ct(T),H,V);return yp(fc(D),T==null?void 0:T.content)},[V,H,T]);Ov(me,!$&&w?We:null,eo);const to=!$&&w?We:$?null:Ln,Er=`${t}\0${n}\0${d??""}\0${h??""}\0${f}`;c.useEffect(()=>{P==="source"||K.loading||(P==="worktree"&&!K.worktreeFile||P==="cumulative"&&!K.cumulativeFile)&&I("source")},[P,K,I]),c.useEffect(()=>{var U;let D=!1;if($){X(!1),q(null),Pe(null);return}if(T&&((U=ve.current)==null?void 0:U.identity)===Er&&ve.current.source===r){X(!1),q(null);return}return X(!0),q(null),Pe(null),r.loadFile(t,n,!0,H,V,O).then(J=>{if(!D){ve.current={identity:Er,source:r},Q(J);const _e=pn(n)&&!!J.renderedMarkdownHtml,Ae=J.content!==void 0&&qr(n,J.metadata.mimeType);R(A.current===E?!1:g?g==="preview"&&(_e||Ae):_e),X(!1)}}).catch(J=>{D||(q(J.message||y("fileViewerLoadFailed")),X(!1))}),()=>{D=!0}},[t,$,V,H,O,n,g,r,Er,y,E,T]),c.useEffect(()=>{if(!T||!Fi(T.metadata.mimeType)){qe(null);return}if(!r.fetchRawFileBlob){qe(null);return}let D=!1,U=null;return qe(null),r.fetchRawFileBlob(T,n,!1).then(J=>{D||(U=URL.createObjectURL(J),qe(U))}).catch(J=>{D||q(J instanceof Error?J.message:String(J))}),()=>{D=!0,U&&URL.revokeObjectURL(U)}},[T,n,r]),c.useEffect(()=>{if(!ie)return;const D=U=>{U.key==="Escape"&&ee(!1)};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[ie]),c.useEffect(()=>{var J;if(H===void 0||!to)return;const D=jt??((J=Ie.current)==null?void 0:J.querySelector(".highlighted-line-start, .markdown-preview-span-start")),U=Ie.current;D&&U&&requestAnimationFrame(()=>{U.scrollTop=hx(U,D)})},[H,to,jt]);const ll=c.useCallback(async()=>{if((T==null?void 0:T.content)!==void 0)try{if(!await fe(T.content))throw new Error("Clipboard write failed");ne(!0),setTimeout(()=>ne(!1),3e3)}catch(D){console.error("Failed to copy:",D)}},[T==null?void 0:T.content]),ul=c.useCallback(()=>{Rt(r.loadFile(t,n,!1).then(D=>D.content??""))},[n,t,r]),dl=c.useCallback(()=>{Qt&&Qi(Qt.html,Qt.text)},[Qt]),fl=c.useMemo(()=>gr(n,De),[n,De]),Cr=c.useMemo(()=>pr(n,De),[n,De]),Xt=c.useMemo(()=>x?Sn(x,{filePath:n,lineEnd:h,lineNumber:d,viewMode:f}):null,[n,h,d,x,f]),kr=c.useMemo(()=>s||Xt||yt(ur({basePath:F,filePath:n,lineEnd:h,lineNumber:d,projectId:t,viewMode:f})),[F,n,h,d,s,t,Xt,f]),Yt=c.useMemo(()=>P==="source"||Xt?kr:yt(ur({basePath:F,diffMode:P,filePath:K.relativePath??n,projectId:t})),[P,F,n,K.relativePath,t,Xt,kr]),Ge=Ot(n),no=sx(n),Rn=T?Fi(T.metadata.mimeType):!1,Jt=T?((po=r.getRawFileUrl)==null?void 0:po.call(r,t,n,!1))??T.rawUrl:null,Mn=Rn?te&&Jt?Jt:ze??(r.fetchRawFileBlob?null:Jt):null,ro=y("fileViewerOpenImageNewTab"),so=Rc(t,n),oo=c.useCallback(()=>{if(!T)return;if(r.fetchRawFileBlob){r.fetchRawFileBlob(T,n,!0).then(U=>Mt(U,Ge)).catch(U=>{q(U instanceof Error?U.message:String(U))});return}const D=new URLSearchParams({path:n,download:"true"});L.fetchBlob(`/projects/${t}/files/raw?${D}`).then(U=>Mt(U,Ge)).catch(U=>{q(U instanceof Error?U.message:"Failed to download file")})},[T,Ge,n,t,r,L]),io=c.useMemo(()=>new URL(Yt,window.location.href).href,[Yt]),ao=c.useCallback(()=>{if(Mn){window.open(Mn,"_blank","noopener");return}window.open(Yt,"_blank","noopener")},[Mn,Yt]),hl=c.useCallback(()=>{if(!T)return Promise.reject(new Error("Image is not loaded"));if(r.fetchRawFileBlob)return r.fetchRawFileBlob(T,n,!1);const D=new URLSearchParams({path:n});return L.fetchBlob(`/projects/${encodeURIComponent(t)}/files/raw?${D}`)},[T,n,t,r,L]),co=jc({fileName:Ge,filePath:n,loadBlob:Rn?hl:void 0,onOpen:ao,projectPath:De,viewerLink:Yt}),ml=c.useCallback(D=>{D.preventDefault(),D.stopPropagation(),ge({x:D.clientX,y:D.clientY})},[]),pl=c.useCallback(()=>ge(null),[]);if(G||!$&&!T&&!B||$&&K.loading&&!Y)return a.jsx("div",{className:"file-viewer",children:a.jsx("div",{className:"file-viewer-loading",children:y("fileViewerLoading",{name:Ge})})});if(!$&&(B||!T))return a.jsx("div",{className:"file-viewer",children:a.jsx("div",{className:"file-viewer-error",children:B||y("fileViewerNotFound")})});const ke=T==null?void 0:T.metadata,Be=T==null?void 0:T.content,lo=Rn,uo=!!(r.fetchRawFileBlob||Jt),An=Be!==void 0&&pn(n)&&!!We,jn=Be!==void 0&&ke!==void 0&&qr(n,ke.mimeType),fo=An||jn,Fe=ce?de.activeDraft:null,gl=Fe?de.sendingIds.has(Fe.id):!1,Qe=Fe?a.jsx(ux,{draft:Fe,placeholder:y("fileViewerCommentPlaceholder"),error:de.error?y("fileViewerCommentSendFailed"):null,busy:gl,cancelLabel:y("cancel"),sendLabel:y("toolbarSend"),onCancel:de.cancel,onChange:de.update,onPersist:de.persist,onSend:D=>void de.sendOne(D)},Fe.id):null,Zt=Qe&&!w?Fe==null?void 0:Fe.afterLine:void 0,ho=Qe&&w&&We&&(Fe==null?void 0:Fe.afterBlock)!==void 0?Fe.afterBlock:void 0,mo=()=>{if($)return Y?a.jsx("div",{className:Te.diffBody,children:a.jsx(Ds,{file:Y,fileKey:`file-viewer:${P}:${Y.path}`,projectId:t,source:{kind:"file-projection",mode:P},captureReviewProjections:!0,t:y})}):a.jsx("div",{className:"file-viewer-loading",children:y("fileViewerLoading",{name:Ge})});if(!T||!ke)return a.jsx("div",{className:"file-viewer-error",children:B||y("fileViewerNotFound")});if(lo){const D=r.fetchRawFileBlob?ze:Jt,U=Mn??D;return a.jsx("div",{className:"file-viewer-image",children:D&&U?a.jsx("a",{className:"file-viewer-image-link",href:U,target:"_blank",rel:"noopener noreferrer",title:ro,"aria-label":ro,onContextMenu:co.handleContextMenu,children:a.jsx("img",{src:D,alt:Ge})}):a.jsx("div",{className:"file-viewer-loading",children:y("fileViewerLoading",{name:Ge})})})}if(Be!==void 0){if(w&&An&&We)return a.jsx(lx,{afterBlock:Qe?ho:void 0,editor:Qe,previewRef:me,children:cl});if(w&&jn)return a.jsx(uc,{html:Be,path:n,projectId:t,className:Te.htmlPreviewFrame,title:Ge,autoStart:j===E,showControls:j!==E},E);if(Ln){const Re=Oi(T),en=Zt!==void 0?vp(Ln,Zt):null,St=Tn=>a.jsx("div",{className:"shiki-container",onClick:Pt,onContextMenu:Sr,onKeyDown:_r,dangerouslySetInnerHTML:{__html:Tn}});return a.jsxs("div",{className:"file-viewer-code file-viewer-code-highlighted","data-language":T.highlightedLanguage??no,style:bt,children:[en&&Qe?a.jsx(mn,{before:St(en.before),editor:Qe,after:St(en.after)}):St(Ln),T.highlightedTruncated&&a.jsx("div",{className:"file-viewer-truncated",children:y("fileViewerHighlightTruncated")}),Re&&a.jsx("div",{className:"file-viewer-truncated",children:Re})]})}const D=Be.length>0?Be.split(`
61
- `):[],U=Ct(T),J=H??0,_e=Math.max(J,V??J),Ae=J===_e,dt=Oi(T),pe=(Re,en)=>{const St=D.slice(Re,en);return St.length>0?a.jsxs("div",{className:"code-highlighter-plain",children:[a.jsx("div",{className:"code-line-numbers",children:St.map((Tn,Lr)=>{const Xe=U+Re+Lr;return a.jsx("div",{children:Xe},`ln-${Xe}`)})}),a.jsx("pre",{className:"code-content",children:a.jsx("code",{children:St.map((Tn,Lr)=>{const Xe=U+Re+Lr,vl=H!==void 0&&Xe>=J&&Xe<=_e,bl=[Ae&&vl?"highlighted-line":"",Xe===J?"highlighted-line-start":"",Xe===_e?"highlighted-line-end":""].filter(Boolean).join(" ");return a.jsx("div",{ref:H!==void 0&&Xe===J?xl=>Pe(xl):void 0,className:bl||void 0,"data-line":Xe,children:Tn||" "},`line-${Xe}`)})})})]}):null},Nt=Zt===void 0?null:Math.min(D.length,Math.max(0,Zt-U+1));return a.jsxs("div",{className:"file-viewer-code","data-language":no,style:bt,children:[Nt!==null&&Qe?a.jsx(mn,{before:pe(0,Nt),editor:Qe,after:pe(Nt,D.length)}):D.length>0?pe(0,D.length):a.jsx("div",{className:"file-viewer-empty-content",children:"No content read"}),dt&&a.jsx("div",{className:"file-viewer-truncated",children:dt})]})}return a.jsxs("div",{className:"file-viewer-binary",children:[a.jsx("p",{children:y("fileViewerBinary")}),a.jsxs("p",{children:[a.jsx("strong",{children:y("fileViewerType")})," ",ke==null?void 0:ke.mimeType]}),a.jsxs("p",{children:[a.jsx("strong",{children:y("fileViewerSize")})," ",ke?Bi(ke.size):""]}),uo&&a.jsx("button",{type:"button",className:"file-viewer-download-btn",onClick:oo,children:y("fileViewerDownloadFile")})]})},wl=a.jsxs("div",{className:`file-viewer-header ${He.header}`,children:[p,o&&a.jsx("button",{type:"button",className:`file-viewer-action ${Te.backButton}`,onClick:Zs,title:y("actionBack"),"aria-label":y("actionBack"),children:a.jsx(Hh,{})}),a.jsxs("div",{className:`file-viewer-info ${He.identity} ${Te.info}`,children:[a.jsx("span",{className:"file-viewer-path",title:n,onContextMenu:ml,children:fl}),a.jsxs("div",{className:Te.provenanceRow,children:[x===null&&K.relativePath&&a.jsx(Ps,{projectId:t,path:K.relativePath,origPath:(go=K.worktreeFile)==null?void 0:go.origPath,dirtyLabel:y("fileRevisionDirty"),uncommittedLabel:y("fileRevisionUncommitted")}),a.jsxs("span",{className:"file-viewer-meta",children:[ke?Bi(ke.size):"",!$&&(ke==null?void 0:ke.isText)&&Be!==void 0&&a.jsxs(a.Fragment,{children:[" • ",T!=null&&T.contentTruncated?`lines ${Ct(T)}-${Bc(T)}${T!=null&&T.contentTotalLines?` of ${T.contentTotalLines}`:""}`:y("fileViewerLines",{count:Be.length>0?Be.split(`
62
- `).length:0})]})]})]})]}),a.jsxs("div",{className:`file-viewer-actions ${He.actions} ${Te.actions}`,children:[x===null&&a.jsx($c,{activeView:P,availability:K,onSelect:I,projectId:t,sourceHref:kr,variant:"header"}),!$&&fo&&a.jsx("button",{type:"button",className:`file-viewer-action ${Te.rawToggle}`,"aria-label":y("fileViewerRawSource"),"aria-pressed":!w,title:y("fileViewerRawSource"),onClick:()=>{N(!w&&jn?E:null),R(D=>!D)},children:a.jsx(gx,{})}),rt&&a.jsx("button",{type:"button",className:`file-viewer-action ${Te.commentToggle}`,"aria-label":y("fileViewerCommentMode"),"aria-pressed":ce,title:y("fileViewerCommentMode"),onClick:ol,children:a.jsx(Sx,{})}),!$&&(ke==null?void 0:ke.isText)&&Be!==void 0&&a.jsx(Xf,{zoom:Me.zoom,canZoomIn:Me.canZoomIn,canZoomOut:Me.canZoomOut,onZoomIn:Me.zoomIn,onZoomOut:Me.zoomOut}),($||!lo&&Be!==void 0&&!(w&&jn))&&a.jsx(Xb,{className:"file-viewer-action",contentRef:Ie}),!$&&Be!==void 0&&a.jsx("button",{type:"button",className:`file-viewer-action ${Z?"copied":""}`,onClick:ll,title:y(Z?"fileViewerCopied":"fileViewerCopyContent"),children:Z?a.jsx(bx,{}):a.jsx(wx,{})}),x===null&&r===Hi&&!$&&a.jsx(yx,{onOpen:ae}),x===null&&a.jsx("button",{type:"button",className:"file-viewer-action file-viewer-new-session",onClick:so,title:y("fileViewerNewSession"),children:a.jsx(xx,{})}),!$&&uo&&a.jsx("button",{type:"button",className:"file-viewer-action",onClick:oo,title:y("fileViewerDownload"),children:a.jsx(_x,{})}),a.jsx("button",{type:"button",className:`file-viewer-action file-viewer-fullscreen-toggle ${Te.fullscreenButton}`,onClick:()=>ee(!ie),title:y(ie?"fileViewerExitFullscreen":"fileViewerFullscreen"),children:ie?a.jsx(Cx,{}):a.jsx(Ex,{})}),a.jsx(dc,{className:Te.windowActions,url:io,moveOut:!u,onMinimize:i?al:void 0,onClose:o?Zs:void 0,minimizeLabel:y("fileViewerMinimize")})]})]}),yl=["file-viewer",Te.viewer,u&&"file-viewer-standalone",ie&&"file-viewer-fullscreen",O==="range"&&"file-viewer-compact"].filter(Boolean).join(" ");return a.jsxs("div",{className:yl,onBlurCapture:il,children:[wl,he&&a.jsx(Mb,{anchorRect:he,filePath:n,projectId:t,title:Ge,onClose:()=>ae(null)}),Ve&&a.jsx(Os,{x:Ve.x,y:Ve.y,canStartNewSession:x===null,onClose:pl,onOpen:ao,onOpenSource:ar(n)?()=>{N(null),R(!1)}:void 0,onOpenPreview:ar(n)&&fo?()=>{N(E),R(!0)}:void 0,onStartNewSession:so,onCopyProjectRelativePath:nt?()=>void fe(nt):void 0,onCopyAbsolutePath:x===null&&Cr?()=>void fe(Cr):void 0,onCopyFilePath:!nt&&!Cr?()=>void fe(n):void 0,onCopyViewerLink:()=>void fe(io),onCopyContents:ul,onCopyRenderedContents:Qt?dl:void 0}),tl,Rn?co.contextMenuElement:null,a.jsxs("div",{className:`file-viewer-body ${Te.body} ${b&&w&&An?Te.quoteReplySurface:""}`,ref:Ie,tabIndex:-1,...ce?{[sc]:"true"}:{},onClick:sl,onMouseDownCapture:rl,onPointerDown:nl,children:[Qe&&Zt===void 0&&ho===void 0?a.jsx(mn,{before:mo(),editor:Qe}):mo(),!ce&&b&&w&&An?a.jsx(rx,{alwaysShowQuoteCircle:C==="paragraph-always",contentRef:me,layoutKey:`${n}\0${We??""}`,onQuoteBlock:b,paragraphQuoteCirclesEnabled:C!=="block",sourceRef:Ie,surfaceRef:Ie}):null,u?a.jsx(px,{containerRef:Ie,onStartNewSessionFromSelection:x===null?z:void 0}):null]}),ye?a.jsx(Nv,{path:ye.path,mediaType:ye.mediaType,mediaSource:eo,dismissOnBack:!0,parentViewerId:ye.mediaType==="image"?l:void 0,onClose:Jc}):null,Ce?a.jsx(Iv,{resource:Ce.resource,initialPresentation:Ce.initialPresentation,dismissOnBack:!0,onClose:Zc}):null,Se?a.jsx(yn,{nestedViewer:!0,projectId:Se.projectId,filePath:Se.filePath,lineNumber:Se.lineNumber,lineEnd:Se.lineEnd,initialPresentation:Se.initialPresentation,onClose:el}):null]})});function px({containerRef:e,onStartNewSessionFromSelection:t}){const{floatingSelectionActions:n,selectionContextMenu:r}=ac({containerRef:e,inert:!1,onStartNewSessionFromSelection:t,quoteClearSignal:0,isInteractiveTarget:s=>s instanceof Element&&s.closest("button, input, textarea, select, a[href], [contenteditable='true']")!==null});return a.jsxs(a.Fragment,{children:[n,r]})}function gx(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M5.5 4 2 8l3.5 4M10.5 4 14 8l-3.5 4M9.5 2.5l-3 11"})})}function wx(){return a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"5",y:"5",width:"9",height:"9",rx:"1.5"}),a.jsx("path",{d:"M11 5V3.5A1.5 1.5 0 0 0 9.5 2H3.5A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5"})]})}function yx({onOpen:e}){const{t}=xe(),{version:n}=ra(),{status:r}=nd();return(r==null?void 0:r.canCreate)!==!0||!Vt(n,Wl)?null:a.jsx("button",{type:"button",className:"file-viewer-action",onClick:s=>e(s.currentTarget.getBoundingClientRect()),title:t("fileViewerSharePublicly"),"aria-label":t("fileViewerSharePublicly"),children:a.jsx(vx,{})})}function vx(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"m8 12 4-4M6.5 14.5l-1 1a2.8 2.8 0 0 1-4-4l3-3a2.8 2.8 0 0 1 4 0M13.5 5.5l1-1a2.8 2.8 0 1 1 4 4l-3 3a2.8 2.8 0 0 1-4 0"})})}function bx(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M3 8.5L6.5 12L13 4"})})}function xx(){return a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M8 5v6M5 8h6"})]})}function Sx(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M3 3.5h10v7H7l-3.5 2.5v-2.5H3z"})})}function _x(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M8 2v9M4 8l4 4 4-4M2 14h12"})})}function Ex(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M2 5V2h3M11 2h3v3M14 11v3h-3M5 14H2v-3"})})}function Cx(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M5 2v3H2M14 5h-3V2M11 14v-3h3M2 11h3v3"})})}const kx=128*1024,Ui=3e4,Lx=64,Oc=128,Rx=4096;function Mx(){var e;return(e=globalThis.crypto)!=null&&e.randomUUID?globalThis.crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function Vi(){const e=new Error("Share request cancelled");return e.name="AbortError",e}function Ax(e){return e instanceof Error?e:new Error("Share transfer failed")}function Hc(e,t){return e.length>t||new TextEncoder().encode(e).byteLength>t}async function jx(e,t){if(typeof e=="string"){if(Hc(e,t))throw new Error("Relay response is too large");return e}if(e instanceof Blob){if(e.size>t)throw new Error("Relay response is too large");return await e.text()}if(e instanceof ArrayBuffer){if(e.byteLength>t)throw new Error("Relay response is too large");return new TextDecoder().decode(e)}throw new Error("Relay returned an invalid response")}function Tx(e){if(e===void 0)return!0;if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=Object.entries(e);return t.length<=Lx&&t.every(([n,r])=>n.length<=Oc&&typeof r=="string"&&r.length<=Rx)}class Px{constructor(t,n,r){oe(this,"ws");oe(this,"ready");oe(this,"readyResolve");oe(this,"readyReject");oe(this,"readySettled",!1);oe(this,"connectTimeout");oe(this,"pending");oe(this,"closedIntentionally",!1);oe(this,"terminalError");oe(this,"signal");oe(this,"abortListener",()=>{this.close(Vi())});var s,o;this.signal=r,this.ready=new Promise((i,l)=>{this.readyResolve=i,this.readyReject=l}),this.ready.catch(()=>{}),this.ws=new WebSocket(t),this.connectTimeout=setTimeout(()=>{this.fail(new Error("Share request timed out")),this.close()},Ui),this.ws.onopen=()=>{this.ws.send(JSON.stringify({type:"client_connect",username:n}))},this.ws.onmessage=i=>{this.handleMessage(i)},this.ws.onerror=()=>{this.close(new Error("Relay connection failed"))},this.ws.onclose=()=>{this.closedIntentionally||this.failTerminal(new Error("Relay connection closed"))},(s=this.signal)==null||s.addEventListener("abort",this.abortListener,{once:!0}),(o=this.signal)!=null&&o.aborted&&this.abortListener()}async request(t,n=Kl){var s;if(await this.ready,(s=this.signal)!=null&&s.aborted)throw Vi();if(this.terminalError)throw this.terminalError;if(this.closedIntentionally||this.ws.readyState>=2)throw new Error("Relay connection closed");if(this.pending)throw new Error("Public share relay requests must be sequential");const r=Mx();return await new Promise((o,i)=>{const l=setTimeout(()=>{this.pending=void 0;const u=new Error("Share request timed out");i(u),this.close(u)},Ui);this.pending={id:r,resolve:o,reject:i,timeout:l,maxResponseBytes:n};try{this.ws.send(JSON.stringify({type:"request",id:r,method:"GET",path:t,headers:{}}))}catch{clearTimeout(l),this.pending=void 0;const u=new Error("Relay connection closed");this.failTerminal(u),i(u)}})}isTerminal(){return this.terminalError!==void 0||this.closedIntentionally||this.ws.readyState>=2}close(t=new Error("Relay connection closed")){var n;this.closedIntentionally||(this.failTerminal(t),this.closedIntentionally=!0,(n=this.signal)==null||n.removeEventListener("abort",this.abortListener),this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.ws.onopen=null,this.ws.onmessage=null,this.ws.onerror=null,this.ws.onclose=null,this.ws.close())}async handleMessage(t){var r;let n;try{const s=((r=this.pending)==null?void 0:r.maxResponseBytes)??kx;let o;if(typeof t.data=="string"){if(Hc(t.data,s))throw new Error("Relay response is too large");o=t.data}else o=await jx(t.data,s);n=JSON.parse(o)}catch(s){const o=Ax(s);this.fail(o),this.close(o);return}if(n&&typeof n=="object"&&n.type==="client_connected"){this.readySettled||(this.readySettled=!0,this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.readyResolve());return}if(n&&typeof n=="object"&&n.type==="response"){const s=n;if(typeof s.id!="string"||s.id.length>Oc||!Number.isInteger(s.status)||s.status<100||s.status>599||!Tx(s.headers)){const i=new Error("Relay returned an invalid response");this.fail(i),this.close(i);return}if(!this.pending||s.id!==this.pending.id)return;const o=this.pending;this.pending=void 0,clearTimeout(o.timeout),o.resolve(s)}}fail(t){if(this.readySettled||(this.readySettled=!0,this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.readyReject(t)),this.pending){const n=this.pending;this.pending=void 0,clearTimeout(n.timeout),n.reject(t)}}failTerminal(t){this.terminalError??(this.terminalError=t),this.fail(this.terminalError)}}async function Uc({path:e,relayUrl:t,relayUsername:n,signal:r,maxResponseBytes:s}){const o=new Px(t,n,r);try{return await o.request(e,s)}finally{o.close()}}class zi extends Error{constructor(t,n,r){super(t),this.status=n,this.retryable=r,this.name="PublicShareRelayError"}}function Nx(e){var t,n;if(e.status>=400){const r=e.body,s=r&&typeof r=="object"&&typeof r.error=="string"?r.error:"Share not found";throw new zi(s,e.status,!!(r&&typeof r=="object"&&r.retryable===!0))}if(e.status!==200)throw new zi("Share returned an unexpected response",e.status,!1);if(typeof e.body=="string"&&(((t=e.headers)==null?void 0:t["content-type"])??((n=e.headers)==null?void 0:n["Content-Type"])??"").includes("json"))try{return JSON.parse(e.body)}catch{throw new Error("Share response is invalid")}return e.body}async function Ix(e){return Nx(await Uc(e))}async function $x(e){var s,o;const t=await Uc(e);if(t.status>=400)throw new Error("Share not found");const n=((s=t.headers)==null?void 0:s["content-type"])||((o=t.headers)==null?void 0:o["Content-Type"])||"application/octet-stream",r=t.body;if(r&&typeof r=="object"&&r._binary===!0&&typeof r.data=="string"){const i=atob(r.data),l=new Uint8Array(i.length);for(let u=0;u<i.length;u+=1)l[u]=i.charCodeAt(u);return new Blob([l],{type:n})}return typeof r=="string"?new Blob([r],{type:n}):new Blob([JSON.stringify(r??null)],{type:n})}function Dx(e,t){const n=document.createElement("template");return n.innerHTML=e,ah(n.content,t),n.innerHTML}function zs(e){const t=async(n,r)=>{const s=Lt(r,e.projectId),o=(s?as(n,s.path):null)??as(n,r);if(o)return o;if(!s)throw new Error("File is outside this public share");const i=new URLSearchParams({path:s.path});return e.viewerId&&i.set("viewerId",e.viewerId),await $x({relayUrl:e.relayUrl,relayUsername:e.relayUsername,path:`/public-api/shares/${encodeURIComponent(e.secret)}/files/raw?${i}`})};return{loadFile:async(n,r,s,o,i,l)=>{const u=new URLSearchParams({path:r});return e.viewerId&&u.set("viewerId",e.viewerId),s&&u.set("highlight","true"),o!==void 0&&u.set("line",String(o)),i!==void 0&&u.set("lineEnd",String(i)),l==="range"&&u.set("view","range"),await Ix({relayUrl:e.relayUrl,relayUsername:e.relayUsername,path:`/public-api/shares/${encodeURIComponent(e.secret)}/files?${u}`})},getRawFileUrl:()=>null,fetchRawFileBlob:t,createMediaSource:n=>({buildApiPath:r=>ih(e,r),fetchBlob:async r=>await t(n??{embeddedMedia:{}},r)}),transformRenderedMarkdownHtml:n=>Dx(n,e)}}const Bx="_linkCluster_1l5oo_1",Fx="_paneViewer_1l5oo_7",Ox="_nestedPaneViewer_1l5oo_15",Hx="_fileViewerModal_1l5oo_21",Ux="_fileViewerModalCompact_1l5oo_35",Vx="_inlineDiffLinks_1l5oo_50",Ft={linkCluster:Bx,paneViewer:Fx,nestedPaneViewer:Ox,fileViewerModal:Hx,fileViewerModalCompact:Ux,inlineDiffLinks:Vx};function zx({filePath:e}){return a.jsx(au,{text:e,label:"Copy path",copiedLabel:"Copied path",className:"file-path-copy",onClick:t=>t.stopPropagation()})}function Vc(e){if(!zt(e))return null;try{const t=mr(e);return Wt(t)}catch{return null}}function qx(e,t){const n=Vc(e),r=At(t,n);if(r!==null)return r;const s=Ue(t);return!(s.startsWith("/")||/^[a-zA-Z]:\//.test(s))&&t.includes("\\")?Ue(t):t}function hs(e,t){return e===void 0?"":t!==void 0&&t>e?`:${e}-${t}`:`:${e}`}const a_=c.memo(function({filePath:t,projectId:n,lineNumber:r,lineEnd:s,columnNumber:o,displayText:i,showLineSuffix:l=!0,showFullPath:u=!1,viewMode:d="full",showCopyButton:h=!0,showVersionControlLinks:f=!0}){const g=vt(),m=br(),p=Cs(),y=lt(),b=ct().transport,v=c.useId(),[_,C]=c.useState(!1),[S,L]=c.useState(),[x,E]=c.useState(null),w=c.useMemo(()=>qx(n,t),[n,t]),R=Rc(n,w),j=c.useMemo(()=>Vc(n),[n]),N=c.useMemo(()=>et(w)?At(w,j):Ue(w).replace(/^\.\/+/,""),[j,w]),A=c.useMemo(()=>pr(et(t)?t:w,j),[t,j,w]),k=ar(w),M=g?Sn(g,{columnNumber:o,filePath:w,lineEnd:s,lineNumber:r,viewMode:d}):null,P=g!==null?M:yt(ur({basePath:y,filePath:w,lineEnd:s,lineNumber:r,projectId:n,viewMode:d})),I=c.useMemo(()=>g?zs(g):void 0,[g]),$=c.useCallback(ee=>{if(m&&g===null){const he=hs(r,s);En({id:v,kind:"file",sessionId:m,label:`${w}${he}`,briefLabel:Ot(w),filePath:w,lineSuffix:he,supportsRightPane:!0,renderContent:(ae,ve)=>a.jsx(yn,{managedViewerId:v,inactive:ae,rightPane:ve,quoteReply:p,projectId:n,filePath:w,lineNumber:r,lineEnd:s,viewMode:d,initialPresentation:ee,source:I,openInNewTabUrl:P},v)});return}L(ee),C(!0)},[P,s,r,v,n,g,I,m,p,d,w]),H=c.useCallback(ee=>{if(ee.stopPropagation(),!(ee.button!==0||ee.metaKey||ee.ctrlKey||ee.shiftKey||ee.altKey)){if(g&&!M){ee.preventDefault();return}ee.preventDefault(),$()}},[$,g,M]),V=c.useCallback(()=>{C(!1)},[]),O=c.useCallback(ee=>{ee.preventDefault(),ee.stopPropagation(),E({x:ee.clientX,y:ee.clientY})},[]),K=c.useCallback(()=>E(null),[]),Y=c.useCallback(ee=>$(ee),[$]),te=c.useCallback(()=>{P&&fe(new URL(P,window.location.href).href)},[P]),F=c.useCallback(()=>{const ee=I?I.loadFile(n,w,!1):ue.getFile(n,w);Rt(ee.then(he=>he.content??""))},[n,I,w]),T=c.useCallback(()=>{const ee=I?I.loadFile(n,w,!0):ue.getFile(n,w,!0);Kr(ee.then(he=>Ha(w,he)))},[n,I,w]),Q=c.useCallback(()=>{const ee=Ot(w);if(I!=null&&I.fetchRawFileBlob){I.loadFile(n,w,!1).then(ae=>{var ve;return(ve=I.fetchRawFileBlob)==null?void 0:ve.call(I,ae,w,!0)}).then(ae=>{ae&&Mt(ae,ee)}).catch(()=>{});return}const he=new URLSearchParams({path:w,download:"true"});b.fetchBlob(`/projects/${n}/files/raw?${he}`).then(ae=>Mt(ae,ee)).catch(()=>{})},[n,I,b,w]),G=u?t:Ot(t),X=i||G,B=hs(r,s),q=B&&o!==void 0&&s===void 0?`:${o}`:"",Z=`${B}${q}`,ne=l?Z:"",ie=Gl(`${t}${Z}`);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:Ft.linkCluster,children:[a.jsxs("a",{href:P??"#",className:"file-path-link",onClick:H,onContextMenu:O,...ie,children:[a.jsx("span",{className:"file-path-link-name",children:X}),ne&&a.jsx("span",{className:"file-path-link-line",children:ne})]}),h&&a.jsx(zx,{filePath:w}),g===null&&f&&a.jsx(Gv,{className:Ft.inlineDiffLinks,projectId:n,filePath:w})]}),x&&a.jsx(Os,{x:x.x,y:x.y,canStartNewSession:g===null,onClose:K,onOpen:()=>Y(),onDownload:Q,onOpenSource:k?()=>Y("source"):void 0,onOpenPreview:k?()=>Y("preview"):void 0,onStartNewSession:R,onCopyProjectRelativePath:N?()=>void fe(N):void 0,onCopyAbsolutePath:g===null&&A?()=>void fe(A):void 0,onCopyFilePath:!N&&!A?()=>void fe(w):void 0,onCopyViewerLink:P?te:void 0,onCopyContents:F,onCopyRenderedContents:k?T:void 0}),_&&a.jsx(yn,{projectId:n,filePath:w,lineNumber:r,lineEnd:s,viewMode:d,initialPresentation:S,source:I,openInNewTabUrl:P,onClose:V})]})});function Wx(e){return a.jsx(yn,{...e})}function yn({projectId:e,filePath:t,lineNumber:n,lineEnd:r,viewMode:s="full",initialPresentation:o,source:i,openInNewTabUrl:l,managedViewerId:u,inactive:d=!1,rightPane:h=!1,nestedViewer:f=!1,quoteReply:g,onClose:m}){const p=vt(),y=c.useMemo(()=>p?zs(p):void 0,[p]),b=i??y,v=Cs(),_=g??v,C=br(),S=Cv(),L=u===void 0&&(f||S!==null),x=h||L&&!!(S!=null&&S.target),E=u===void 0&&!L&&!!C&&p===null,w=Kt(),R=c.useId(),j=u??R,N=Ka(),A=!!(d||L&&(S!=null&&S.inactive)||(N==null?void 0:N.id)===j&&N.minimized),k=c.useRef(m);k.current=m;const M=c.useCallback(()=>{var te;if(u!==void 0){za(j);return}sr(j),(te=k.current)==null||te.call(k)},[j,u]),P=c.useCallback(()=>qa(j),[j]);c.useLayoutEffect(()=>{if(u!==void 0||L||p!==null)return;const te=hs(n,r);En({id:j,kind:"file",sessionId:C??(w==null?void 0:w.sessionId)??"",label:`${t}${te}`,briefLabel:Ot(t),onClose:M,filePath:t,lineSuffix:te,...E?{supportsRightPane:!0,renderContent:(F,T)=>a.jsx(Wx,{managedViewerId:j,inactive:F,rightPane:T,quoteReply:_,projectId:e,filePath:t,lineNumber:n,lineEnd:r,viewMode:s,initialPresentation:o,source:b,openInNewTabUrl:l})}:{}})},[M,t,r,n,u,L,j,p,w==null?void 0:w.sessionId,C,E,e,s,o,b,l,_]),c.useEffect(()=>{if(!(u!==void 0||E||L))return()=>sr(j)},[u,j,E,L]);const I=te=>{te.target===te.currentTarget&&M()},$=!E&&!A&&(!x||L||(N==null?void 0:N.id)===j);if(oa(M,$,"__fileViewerModal"),ia(M,$),ys(M,$),E)return null;const H=a.jsx(mx,{projectId:e,filePath:t,lineNumber:n,lineEnd:r,viewMode:s,initialPresentation:o,source:b,openInNewTabUrl:l,onClose:M,onMinimize:p===null&&!L?P:void 0,parentViewerId:u}),V=_?a.jsx(Th,{onQuoteTextBlock:_,children:H}):H;if(x){const te=a.jsx(No,{projectId:e,children:a.jsx("div",{className:`${Ft.paneViewer} ${L?Ft.nestedPaneViewer:""}`,...Jn,children:V})});return L&&(S!=null&&S.target)?$e.createPortal(te,S.target):te}const O=p===null?document.querySelector(".navigation-route-layer.is-active [data-session-viewer-layer]")??document.querySelector("[data-session-viewer-layer]"):null,K=a.jsx("div",{className:"modal-overlay","aria-hidden":A||void 0,style:A?{display:"none"}:void 0,onClick:I,onMouseDown:te=>te.stopPropagation(),children:a.jsx("dialog",{className:`modal file-viewer-modal ${Ft.fileViewerModal} ${s==="range"?`file-viewer-modal-compact ${Ft.fileViewerModalCompact}`:""}`,...Jn,open:!0,onClick:te=>te.stopPropagation(),children:V})}),Y=p===null?O??document.querySelector(".navigation-route-layer.is-active .session-page")??document.querySelector(".session-page"):null;return $e.createPortal(p?K:a.jsx(No,{projectId:e,children:K}),Y??document.body)}const Kx=new RegExp(String.raw`\x1b(?:\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1b\\)|[@-Z\\-_])`,"g");function Le(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function Ut(e){return Le(e).replaceAll(`
63
- `,"&#10;")}function qs(e){return e.replace(Kx,"")}function qn(e){return e.replace(/^[ab]\//,"")}function Gx(e){const t=e.replace(/\r\n/g,`
64
- `).split(`
65
- `);for(const n of t){const r=/^\+\+\+\s+(?!\/dev\/null)(?:[ab]\/)?(.+?)\s*$/.exec(n);if(r!=null&&r[1])return qn(r[1].trim())}for(const n of t){const r=/^---\s+(?!\/dev\/null)(?:[ab]\/)?(.+?)\s*$/.exec(n);if(r!=null&&r[1])return qn(r[1].trim())}for(const n of t){const r=/^diff --git\s+a\/(.+?)\s+b\/(.+?)\s*$/.exec(n);if(r!=null&&r[2])return qn(r[2].trim());if(r!=null&&r[1])return qn(r[1].trim())}}function qi(e){const t=[];for(const n of e.replace(/\\/g,"/").split("/"))if(!(!n||n===".")){if(n===".."){if(t.length===0)return null;t.pop();continue}t.push(n)}return t.join("/")}function Qx(e,t){const n=e.trim();if(!n||n.startsWith("#")||n.startsWith("//")||/^[a-z][a-z0-9+.-]*:/i.test(n))return null;const r=n.split(/[?#]/,1)[0]??"";if(!r)return null;if(r.startsWith("/"))return qi(r.slice(1));const s=t!=null&&t.includes("/")?t.slice(0,t.lastIndexOf("/")):"";return qi(s?`${s}/${r}`:r)}function Xx(e,t,n={}){const r=Qx(t,n.baseFilePath);if(!r)return null;const s=Le(e||t);if(!n.projectId)return{html:s,changed:!0};const i=(n.publicShare&&Sn(n.publicShare,{filePath:r}))??yt(`${n.basePath??""}/projects/${encodeURIComponent(n.projectId)}/file?path=${encodeURIComponent(r)}`),l=`/${r}`,u=gr(l,n.projectPath);return{html:`<a class="fixed-font-file-link" href="${Ut(i)}" data-fixed-font-file-path="${Ut(r)}" data-tooltip="${Ut(u)}">${s}</a>`,changed:!0}}function Wi(e,t){var i;if(!t.projectId||!((i=t.projectPathLinks)!=null&&i.length))return{html:Le(e),changed:!1};const n=new Map(t.projectPathLinks.map(l=>[l.text,l.filePath])),r=Du(e).filter(l=>n.has(l.text));if(r.length===0)return{html:Le(e),changed:!1};let s="",o=0;for(const l of r){const u=n.get(l.text),d=t.publicShare?Sn(t.publicShare,{filePath:u}):null;if(t.publicShare&&!d){s+=Le(e.slice(o,l.end)),o=l.end;continue}s+=Le(e.slice(o,l.start));const h=d??yt(`${t.basePath??""}/projects/${encodeURIComponent(t.projectId)}/file?path=${encodeURIComponent(u)}`),f=gr(u,t.projectPath);s+=`<a class="fixed-font-file-link" href="${Ut(h)}" data-fixed-font-file-path="${Ut(u)}" data-tooltip="${Ut(f)}">${Le(l.text)}</a>`,o=l.end}return s+=Le(e.slice(o)),{html:s,changed:!0}}function dr(e,t){try{return cu.renderToString(e,{throwOnError:!1,displayMode:t,output:"htmlAndMathml",strict:"ignore",trust:!1})}catch{const n=t?`$$${e}$$`:`$${e}$`;return`<span class="fixed-font-math-error">${Le(n)}</span>`}}function Ws(e,t){let n=0;for(let r=t-1;r>=0&&e[r]==="\\";r-=1)n+=1;return n%2===1}function zc(e,t,n){let r=n;for(;r<e.length;){const s=e.indexOf(t,r);if(s<0||!Ws(e,s))return s;r=s+t.length}return-1}function qc(e,t){const n=e.startsWith("$$",t)?{close:"$$",open:"$$"}:e.startsWith("\\[",t)&&!Ws(e,t)?{close:"\\]",open:"\\["}:null;if(!n)return null;const r=zc(e,n.close,t+n.open.length);if(r<0)return null;const s=e.slice(t+n.open.length,r).trim();return s?{end:r+n.close.length,html:dr(s,!0)}:null}function Wc(e,t){if(e.startsWith("\\(",t)&&!Ws(e,t)){const l=zc(e,"\\)",t+2);if(l<0)return null;const u=e.slice(t+2,l).trim();return!u||u.includes(`
66
- `)?null:{end:l+2,html:dr(u,!1)}}if(e[t]!=="$")return null;const n=e[t+1];if(!n||/\s/.test(n))return null;let r=t+1;for(;r<e.length;){const l=e[r];if(l===`
67
- `)return null;if(l==="$")break;r+=1}if(r>=e.length||e[r]!=="$")return null;const s=e[r-1];if(!s||/\s/.test(s))return null;const o=e[r+1];if(o&&(/\d/.test(o)||o==="$"))return null;const i=e.slice(t+1,r);return!i||!/[\\^{}+]/.test(i)&&!/\d/.test(i)?null:{end:r+1,html:dr(i,!1)}}function Kc(e){return{chars:e.length,lines:e.length===0?0:e.split(`
68
- `).length}}function Gc(e){let t="",n=!1,r=0,s=0;for(;s<e.length;){const o=qc(e,s),i=o?null:Wc(e,s),l=o??i;if(!l){s+=1;continue}t+=Le(e.slice(r,s)),t+=l.html,n=!0,s=l.end,r=s}return t+=Le(e.slice(r)),{html:t,changed:n}}function Yx(e,t={}){return $a("fixed-font-math",()=>({...Kc(e),diffAware:t.diffAware??!1}),()=>t.diffAware?rS(e):Gc(e))}function Jx(e){const t=e.replace(/\r\n/g,`
69
- `).split(`
70
- `);if(t.some(s=>s.startsWith("@@ "))||t.some(s=>s.startsWith("diff --git "))||t.some(s=>s.startsWith("--- "))&&t.some(s=>s.startsWith("+++ ")))return!0;let n=0,r=0;for(const s of t)s.startsWith("+")&&!s.startsWith("+++")&&(n+=1),s.startsWith("-")&&!s.startsWith("---")&&(r+=1);return n>0&&r>0&&n+r>=2}function Qc(e,t){return t&&e.length>0&&(e[0]===" "||e[0]==="+"&&!e.startsWith("+++")||e[0]==="-"&&!e.startsWith("---"))?{prefix:e[0],content:e.slice(1)}:{prefix:"",content:e}}function ms(e){const t=e.trim();return t.startsWith("|")&&t.endsWith("|")&&t.split("|").length>=4}function Yn(e){return e.trim().slice(1,-1).split("|").map(n=>n.trim())}function Wr(e){if(!ms(e))return!1;const t=Yn(e);return t.length>0&&t.every(n=>/^:?-{2,}:?$/.test(n.replace(/\s+/g,"")))}function Zx(e){const t=e.replace(/\s+/g,""),n=t.startsWith(":"),r=t.endsWith(":");return n&&r?"center":r?"right":n?"left":null}function kt(e,t={}){let n="",r=!1,s=0,o=0;const i=l=>{if(l>s){const u=Wi(e.slice(s,l),t);n+=u.html,u.changed&&(r=!0)}};for(;o<e.length;){const l=e[o];if(l==="`"){const g=e.indexOf("`",o+1);if(g>o+1){i(o);const m=Wi(e.slice(o+1,g),t);n+=`<code>${m.html}</code>`,r=!0,o=g+1,s=o;continue}}if(l==="["){const g=e.indexOf("]",o+1);if(g>o+1&&e[g+1]==="("){const m=e.indexOf(")",g+2);if(m>g+2){const p=e.slice(o+1,g),y=e.slice(g+2,m),b=Xx(p,y,t);if(b){i(o),n+=b.html,r=!0,o=m+1,s=o;continue}}}}const u=qc(e,o),d=u?null:Wc(e,o),h=u??d;if(h){i(o),n+=h.html,r=!0,o=h.end,s=o;continue}const f=e.startsWith("**",o)?"**":e.startsWith("__",o)?"__":null;if(f){const g=e.indexOf(f,o+2);if(g>o+2){i(o);const m=kt(e.slice(o+2,g),t);n+=`<strong>${m.html}</strong>`,r=!0,o=g+2,s=o;continue}}o+=1}return i(e.length),{html:n,changed:r}}function ps(e){return e==="+"?"fixed-font-diff-added":e==="-"?"fixed-font-diff-removed":e===" "?"fixed-font-diff-context":""}function gs(e){return`<span class="fixed-font-diff-gutter">${e===""||e===" "?"&nbsp;":Le(e)}</span>`}function eS(e,t,n={}){var m,p;const r=e[t],s=e[t+1];if(!r||!ms(r.content))return null;const o=!!s&&Wr(s.content);let i=o?t+2:t+1;for(;i<e.length&&ms(((m=e[i])==null?void 0:m.content)??"")&&!(i+1<e.length&&Wr(((p=e[i+1])==null?void 0:p.content)??""));)i+=1;if(!o&&i-t<2)return null;const l=o?Yn(s.content).map(Zx):[],u=o?e.slice(t+2,i).filter(y=>!Wr(y.content)):e.slice(t,i),d=e.slice(t,i).some(y=>y.prefix!==""),h=(y,b,v)=>{const _=l[v],C=_?` style="text-align: ${_}"`:"";return`<${y}${C}>${kt(b,n).html}</${y}>`},f=o?(()=>{const y=Yn(r.content).map((v,_)=>h("th",v,_)).join(""),b=d?`<th class="fixed-font-diff-gutter-cell">${gs(r.prefix)}</th>`:"";return`<thead><tr class="${ps(r.prefix)}">${b}${y}</tr></thead>`})():"",g=u.map(y=>{const b=Yn(y.content).map((_,C)=>h("td",_,C)).join(""),v=d?`<td class="fixed-font-diff-gutter-cell">${gs(y.prefix)}</td>`:"";return`<tr class="${ps(y.prefix)}">${v}${b}</tr>`}).join("");return{end:i,html:`<div class="fixed-font-markdown-block"><table class="fixed-font-markdown-table">${f}<tbody>${g}</tbody></table></div>`}}function tS(e,t,n){var h;if(n)return null;const s=(((h=e[t])==null?void 0:h.content.trim())??"").match(/^[\w.-]+\[(\d+)\]\{[^}]*\}:$/);if(!s)return null;const o=t+1+Number(s[1]);if(o>e.length)return null;const i=Iu(e.slice(t,o).map(f=>f.content).join(`
71
- `)),l=(i==null?void 0:i.length)===1?i[0]:void 0;if(!l)return null;const u=`<thead><tr>${l.columns.map(f=>`<th>${Le(f)}</th>`).join("")}</tr></thead>`,d=l.rows.map(f=>`<tr>${f.map(g=>`<td>${Le(g)}</td>`).join("")}</tr>`).join("");return{end:o,html:`<div class="fixed-font-markdown-block"><table class="fixed-font-markdown-table">${u}<tbody>${d}</tbody></table></div>`}}function nS(e,t={}){var l;const n=/^\s{0,3}(#{1,6})\s+(.+?)\s*#*\s*$/.exec(e);if(n!=null&&n[1]&&n[2])return{html:kt(n[2],t).html,changed:!0,className:`fixed-font-markdown-heading fixed-font-markdown-heading-${n[1].length}`};if(/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/.test(e))return{html:'<span class="fixed-font-markdown-rule" aria-hidden="true"></span>',changed:!0,className:"fixed-font-markdown-rule-line"};const r=/^\s{0,3}>\s?(.*)$/.exec(e);if(r)return{html:kt(r[1]??"",t).html,changed:!0,className:"fixed-font-markdown-blockquote"};const s=/^(\s*)([-*+]|\d+[.)])\s+(.+)$/.exec(e);if(s!=null&&s[2]&&s[3]){const u=((l=s[1])==null?void 0:l.length)??0,d=s[2].length+1;return{html:`<span class="fixed-font-markdown-list-marker">${/^\d/.test(s[2])?Le(s[2]):"&bull;"}</span><span class="fixed-font-markdown-list-body">${kt(s[3],t).html}</span>`,changed:!0,className:"fixed-font-markdown-list-line",style:`--fixed-font-list-indent-ch:${u};--fixed-font-list-marker-ch:${d};`}}const o=/^(\s+)(\S[\s\S]*)$/.exec(e);if(o!=null&&o[1]&&o[2]){const u=kt(o[2],t);return{html:`<span class="fixed-font-leading-indent" style="--fixed-font-leading-ch:${o[1].length};"></span>${u.html}`,changed:u.changed}}return kt(e,t)}function Xc(e,t,n){var u,d,h;const r=(u=e[t])==null?void 0:u.content.trim(),s=r==="$$"?"$$":r==="\\["?"\\]":null;if(!s)return null;let o=t+1;for(;o<e.length&&((d=e[o])==null?void 0:d.content.trim())!==s;)o+=1;if(o>=e.length)return null;const i=e.slice(t+1,o).map(f=>f.content).join(`
72
- `).trim();if(!i)return null;const l=dr(i,!0);if(n){const f=e.slice(t,o+1),g=((h=f[0])==null?void 0:h.prefix)??"";return f.some(m=>m.prefix!==g)?null:{end:o+1,html:Ks({prefix:g},{className:"fixed-font-markdown-display-math",html:l})}}return{end:o+1,html:l}}function Ks(e,t){const n=["fixed-font-rendered-line",ps(e.prefix),t.className].filter(Boolean).join(" "),r=t.style?` style="${t.style}"`:"";return`<div class="${n}">${gs(e.prefix)}<div class="fixed-font-rendered-line__content"${r}>${t.html}</div></div>`}function rS(e){const t=qs(e).replace(/\r\n/g,`
73
- `).split(`
74
- `).map(o=>Qc(o,!0));let n="",r=!1,s=0;for(;s<t.length;){const o=Xc(t,s,!0);if(o){n+=o.html,r=!0,s=o.end;continue}const i=t[s];if(!i){s+=1;continue}const l=Gc(i.content);n+=Ks(i,l),l.changed&&(r=!0),s+=1}return{html:n,changed:r}}function sS(e,t={}){const n=qs(e),r=t.baseFilePath??Gx(n),s=t.diffAware??Jx(n);if(!s&&jh(n).some(h=>h.kind!=="text"))return{html:Le(n),changed:!1};const o={...t,baseFilePath:r},i=n.replace(/\r\n/g,`
75
- `).split(`
76
- `).map(h=>Qc(h,s));let l="",u=!1,d=0;for(;d<i.length;){const h=Xc(i,d,s);if(h){l+=h.html,h.end<i.length&&(l+=`
77
- `),u=!0,d=h.end;continue}const f=tS(i,d,s);if(f){l+=f.html,u=!0,d=f.end;continue}const g=eS(i,d,o);if(g){l+=g.html,u=!0,d=g.end;continue}const m=i[d];if(!m){d+=1;continue}const p=nS(m.content,o);p.changed&&(u=!0),s?l+=Ks(m,p):(l+=p.html,d<i.length-1&&(l+=`
78
- `)),d+=1}return{html:l,changed:u}}function fr(e,t={}){return $a("fixed-font-rich-content",()=>({...Kc(e),diffAware:t.diffAware??null,hasProjectId:!!t.projectId,hasBaseFilePath:!!t.baseFilePath}),()=>sS(e,t))}function oS(e,t){return t==="themed"?e:e.replace(/ data-tooltip="([^"]*)"/g,(n,r)=>` title="${r}"`)}function c_({sourceText:e,sourceView:t,renderRenderedView:n,diffAware:r,baseFilePath:s,initialMode:o,precomputedRendered:i,renderMode:l="rich",projectPathLinks:u}){const d=Kt(),h=vt(),f=lt(),g=Ql(),m=Ea(s),[p,y]=c.useState(null),b=c.useRef(null),v=c.useMemo(()=>qs(e),[e]),_=c.useMemo(()=>h?zs(h):void 0,[h]),C=c.useMemo(()=>i??(l==="math"?Yx(e,{diffAware:r}):fr(e,{diffAware:r,projectId:d==null?void 0:d.projectId,projectPath:(d==null?void 0:d.projectPath)??void 0,baseFilePath:s,basePath:f,publicShare:h,projectPathLinks:u})),[i,e,l,r,d==null?void 0:d.projectId,d==null?void 0:d.projectPath,s,f,h,u]),{showRendered:S,toggleLocalMode:L}=uh(C.changed,{initialMode:o,renderWhenDisabled:!1,resetDependencies:[e,l]}),{btnRef:x,handleClick:E}=vh(S,L),w=c.useMemo(()=>{var k;const A=oS(C.html,g);return Ra(A,m.state==="ready"&&((k=m.result)==null?void 0:k.status)==="ready"?m.result.artifact:void 0).html},[m,C.html,g]);c.useEffect(()=>{const A=b.current;if(!(!A||!v.trim()))return sa(A,v)},[v]);const R=c.useCallback(A=>{var M,P;const k=(P=(M=A.target)==null?void 0:M.closest)==null?void 0:P.call(M,"a[data-fixed-font-file-path]");k&&(A.button!==0||A.metaKey||A.ctrlKey||A.shiftKey||A.altKey||(A.preventDefault(),A.stopPropagation(),y({filePath:k.dataset.fixedFontFilePath??"",href:k.getAttribute("href")})))},[]),j=c.useCallback(A=>{const k=b.current,M=k?hr(k).map(I=>I.markdown).join(`
79
-
80
- `):"";Rh(A.nativeEvent,A.currentTarget)&&M&&A.clipboardData.setData("text/plain",M)},[]),N=(d==null?void 0:d.projectId)??(h==null?void 0:h.projectId)??"";return a.jsxs("div",{ref:b,className:"fixed-font-render-toggle","data-render-mode":S&&C.changed?"rendered":"source",children:[S&&C.changed?a.jsx("div",{onClick:R,onCopy:j,children:n(w)}):t,C.changed&&a.jsx("button",{ref:x,type:"button",className:`fixed-font-render-toggle__button ${S?"is-rendered":""}`,onClick:E,"aria-label":S?"Show source":"Show rendered view",title:S?"Show source":"Show rendered view","aria-pressed":S,children:a.jsx(uf,{})}),p&&N!==""&&a.jsx(yn,{projectId:N,filePath:p.filePath,source:_,openInNewTabUrl:p.href,onClose:()=>y(null)})]})}function iS(){return a.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:[a.jsx("path",{d:"M21 11a9 9 0 0 1-9 9 10 10 0 0 1-4-.9L3 21l1.8-5A9 9 0 1 1 21 11Z"}),a.jsx("path",{d:"M9.6 8a2.5 2.5 0 0 1 4.8 1c0 1.7-2.4 1.7-2.4 3.5M12 15h.01"})]})}function aS({question:e,showDismissed:t,state:n}){var f,g;const{t:r}=xe(),[s,o]=c.useState(!1),i=c.useRef(null),l=c.useRef(!1),u=()=>{i.current&&clearTimeout(i.current),i.current=null};c.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const d=((f=n.records[e.id])==null?void 0:f.dismissed)===!0,h=()=>{n.update(e.id,{dismissed:!d}),o(!1)};return a.jsxs("li",{className:re.menuRow,children:[a.jsx("span",{className:re.turnAge,role:"img","aria-label":r("asyncQuestionTurnsAgo",{count:e.age}),children:e.age}),a.jsxs("div",{className:re.previewBox,children:[a.jsxs("button",{type:"button",className:re.preview,title:e.title,"aria-label":e.title,onClick:()=>{if(l.current){l.current=!1;return}n.open(e)},onContextMenu:m=>{m.preventDefault(),u(),o(!0)},onTouchStart:()=>{l.current=!1,u(),i.current=setTimeout(()=>{l.current=!0,o(!0)},450)},onTouchMove:u,onTouchEnd:u,onTouchCancel:u,children:[a.jsx("span",{className:re.previewText,children:e.title}),!((g=n.records[e.id])!=null&&g.seen)&&a.jsx("span",{className:re.unseen,role:"img","aria-label":r("asyncQuestionUnseen")})]}),a.jsx("button",{type:"button",className:re.dismiss,onClick:h,"aria-label":r(d?"asyncQuestionRestore":"asyncQuestionDismiss",{question:e.title}),children:d&&t?"↶":"×"}),s&&a.jsx("div",{className:re.rowMenu,role:"menu",children:a.jsx("button",{type:"button",role:"menuitem",onClick:h,children:r(d?"asyncQuestionRestoreShort":"asyncQuestionDismissShort")})})]})]})}function l_({overflow:e=!1,compact:t="none",inventory:n,groupTitles:r,omitted:s=!1}){const o=xs(),i=n??o,{t:l}=xe(),u=c.useRef(null),d=c.useRef(null),h=c.useRef(null),[f,g]=c.useState(!1),[m,p]=c.useState(!1),[y,b]=c.useState(!1),[v,_]=c.useState({left:8,bottom:0,width:360,maxHeight:400}),C=(i==null?void 0:i.questions.filter(A=>!vs(i.records[A.id])))??[],S=C.filter(A=>{var k;return y||!((k=i==null?void 0:i.records[A.id])!=null&&k.dismissed)}),L=C.filter(A=>{var k;return!((k=i==null?void 0:i.records[A.id])!=null&&k.dismissed)}),x=L.filter(A=>{var k;return er(A.age,((k=i==null?void 0:i.records[A.id])==null?void 0:k.edits)??0,i==null?void 0:i.reminderTurns)==="recent"}),E=L.every(A=>{var k;return er(A.age,((k=i==null?void 0:i.records[A.id])==null?void 0:k.edits)??0,i==null?void 0:i.reminderTurns)==="retired"}),w=x.reduce((A,k)=>!A||k.age<=A.age?k:A,void 0),R=i==null?void 0:i.setMenuOpen,j=()=>{g(!1),R==null||R(!1)};if(c.useLayoutEffect(()=>{if(!f)return;const A=()=>{var $;const k=($=u.current)==null?void 0:$.getBoundingClientRect();if(!k)return;const M=Math.min(520,window.innerWidth-16),P=!!n&&window.innerHeight-k.bottom>Math.min(280,k.top),I=P?window.innerHeight-k.bottom-14:k.top-16;_({left:Math.max(8,Math.min(k.right-M,window.innerWidth-M-8)),...P?{top:k.bottom+6}:{bottom:window.innerHeight-k.top+6},width:M,maxHeight:Math.max(100,Math.min(400,I))})};return A(),window.addEventListener("resize",A),()=>window.removeEventListener("resize",A)},[f,n]),c.useLayoutEffect(()=>{var k,M;if(!f)return;h.current&&(h.current.scrollTop=h.current.scrollHeight);const A=(k=d.current)==null?void 0:k.querySelectorAll(`button.${re.preview}`);(M=A==null?void 0:A[A.length-1])==null||M.focus({preventScroll:!0})},[f]),c.useEffect(()=>{if(!f)return;const A=M=>{var P,I;!(M.target instanceof Node)||(P=d.current)!=null&&P.contains(M.target)||(I=u.current)!=null&&I.contains(M.target)||(g(!1),R==null||R(!1))},k=M=>{var P;M.key==="Escape"&&(M.preventDefault(),g(!1),R==null||R(!1),(P=u.current)==null||P.focus({preventScroll:!0}))};return document.addEventListener("pointerdown",A),document.addEventListener("keydown",k),()=>{document.removeEventListener("pointerdown",A),document.removeEventListener("keydown",k)}},[f,R]),c.useEffect(()=>{(i==null?void 0:i.menuOpen)===!1&&g(!1)},[i==null?void 0:i.menuOpen]),!i||i.reminderTurns===0||i.questions.length===0||!e&&E&&!f&&!m)return null;const N=w?`${l(x.length===1?"asyncQuestionSingle":"asyncQuestionCount",{count:x.length})} · ${l(w.age===1?"asyncQuestionOneTurnAgo":"asyncQuestionTurnsAgo",{count:w.age})}`:l("asyncQuestionsTitle");return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:u,onFocus:()=>p(!0),onBlur:()=>p(!1),type:"button",className:`${re.indicator} ${x.length?re.recent:""} ${e?re.overflowEntry:""}`,"aria-label":N,title:N,"aria-expanded":f,"aria-haspopup":"dialog",role:e?"menuitem":void 0,onClick:()=>{g(!f),R==null||R(!f)},onContextMenu:A=>{A.preventDefault(),A.stopPropagation(),g(!0),R==null||R(!0)},children:[a.jsx(iS,{}),w&&!e?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:x.length}),t!=="late"&&a.jsx("span",{children:l(x.length===1?"asyncQuestionWord":"asyncQuestionsWord")}),t==="none"&&a.jsxs("span",{children:["·"," ",l(w.age===1?"asyncQuestionOneTurnAgo":"asyncQuestionTurnsAgo",{count:w.age})]})]}):t!=="late"&&a.jsx("span",{children:l("asyncQuestionsTitle")})]}),f&&$e.createPortal(a.jsxs("div",{ref:d,className:re.menu,style:v,role:"dialog","aria-label":l("asyncQuestionsTitle"),onKeyDown:A=>{var P,I;if(A.key!=="ArrowDown"&&A.key!=="ArrowUp")return;const k=[...((P=d.current)==null?void 0:P.querySelectorAll(`button.${re.preview}`))??[]],M=k.indexOf(document.activeElement);k.length&&(A.preventDefault(),(I=k[(M+(A.key==="ArrowDown"?1:-1)+k.length)%k.length])==null||I.focus())},children:[a.jsxs("div",{className:re.menuHeading,children:[a.jsx("strong",{children:l("asyncQuestionsTitle")}),a.jsx("button",{type:"button",className:re.dismiss,"aria-label":l("asyncQuestionCloseMenu"),onClick:j,children:"×"})]}),a.jsx("ul",{ref:h,className:re.questionList,children:S.map((A,k)=>{var M,P,I;return a.jsxs(c.Fragment,{children:[(r==null?void 0:r.has(A.id))&&(k===0||((M=r.get(S[k-1].id))==null?void 0:M.id)!==((P=r.get(A.id))==null?void 0:P.id))&&a.jsx("li",{className:re.groupHeading,children:(I=r.get(A.id))==null?void 0:I.title}),a.jsx(aS,{question:A,showDismissed:y,state:{...i,open:$=>{j(),i.open($)}}})]},A.id)})}),S.length===0&&a.jsx("p",{children:l("asyncQuestionsNone")}),s&&a.jsx("p",{className:re.hint,children:l("asyncQuestionsEarlierOmitted")}),a.jsx("button",{type:"button",className:re.secondary,onClick:()=>b(!y),children:l(y?"asyncQuestionHideDismissed":"asyncQuestionShowDismissed")})]}),document.body)]})}function cS({question:e}){const t=xs(),{t:n}=xe(),r=c.useRef(null),[s,o]=c.useState(!1),i=t.records[e.id],l=t.activeId===e.id,u=t.submittingId===e.id,d=vs(i),h=t.update,f=c.useMemo(()=>fr(e.title,{diffAware:!1}).html,[e.title]);c.useEffect(()=>{if(i!=null&&i.seen||!r.current)return;let m=!1;const p=()=>{m&&!document.hidden&&h(e.id,{seen:!0})},y=new IntersectionObserver(([b])=>{m=((b==null?void 0:b.intersectionRatio)??0)>=.6,p()},{threshold:.6});return y.observe(r.current),document.addEventListener("visibilitychange",p),()=>{y.disconnect(),document.removeEventListener("visibilitychange",p)}},[e.id,i==null?void 0:i.seen,h]);const g=async m=>{o(!1);try{await t.submit(e,m)||o(!0)}catch{o(!0)}};return a.jsxs("div",{className:`${re.inlineQuestion} ${l?re.activeQuestion:""}`,"data-async-question-reply":e.id,children:[a.jsx("div",{ref:r,children:a.jsx(_s,{className:re.questionTitle,html:f})}),e.options.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("p",{className:re.hint,children:n("asyncQuestionClickToSend")}),a.jsx("ul",{className:re.options,children:e.options.map((m,p)=>a.jsx("li",{children:a.jsxs("button",{type:"button",disabled:u||d,onClick:()=>void g(m),children:[a.jsx("span",{"aria-hidden":"true",children:"•"}),a.jsx("span",{children:m})]})},`${p}:${m}`))})]}),d?a.jsx("p",{className:re.sent,children:i!=null&&i.quoted?n("asyncQuestionReplyQuoted"):n("asyncQuestionReplySent",{answer:i.answer})}):a.jsxs(a.Fragment,{children:[!l&&a.jsx("button",{type:"button",className:re.secondary,onClick:()=>t.open(e),children:n("asyncQuestionReply")}),l&&a.jsxs("form",{className:re.replyForm,onSubmit:m=>{m.preventDefault(),!(u||!(i!=null&&i.draft.trim()))&&g((i==null?void 0:i.draft)??"")},children:[a.jsx("textarea",{rows:3,value:(i==null?void 0:i.draft)??"","aria-label":n("asyncQuestionReplyTo",{question:e.title}),placeholder:n("asyncQuestionReplyPlaceholder"),readOnly:u,onKeyDown:m=>{var p;m.key!=="Enter"||m.shiftKey||m.nativeEvent.isComposing||m.keyCode===229||(m.preventDefault(),m.repeat||(p=m.currentTarget.form)==null||p.requestSubmit())},onChange:m=>h(e.id,{draft:m.target.value})}),a.jsxs("div",{className:re.replyActions,children:[a.jsx("button",{type:"button",className:`${re.secondary} ${re.iconAction}`,onClick:t.returnToPrevious,"aria-label":n("asyncQuestionBack"),title:n("asyncQuestionBack"),children:a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"m10 5-7 7 7 7M3 12h18"})})}),a.jsx("button",{type:"submit",className:re.send,disabled:u||!(i!=null&&i.draft.trim()),children:n(u?"asyncQuestionSending":"asyncQuestionSend")})]})]}),a.jsx("button",{type:"button",className:`${re.secondary} ${re.iconAction}`,onClick:()=>t.quote(e),"aria-label":n("asyncQuestionQuoteMain"),title:n("asyncQuestionQuoteMain"),children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("path",{d:"m10 8 4 4-4 4"})]})})]}),s&&a.jsx("p",{role:"alert",className:re.error,children:n("asyncQuestionSendFailed")})]})}function u_({renderId:e,fallback:t}){const n=xs(),r=(n==null?void 0:n.questions.filter(s=>s.renderId===e))??[];return r.length?a.jsx(a.Fragment,{children:r.map(s=>a.jsx(cS,{question:s},s.id))}):t}const Yc=1600,d_=`${Yc}px 0px`;function f_(e,t=Yc){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}const lS=180*1e3;function h_(e,t,n,r){return`${e.replace(/\/$/,"")}/projects/${t}/sessions/${n}/agents/${encodeURIComponent(r)}`}function m_(e,t){return e.title||e.agentType||t}function p_(...e){for(const t of e)if(t)return t;return[]}const uS=300*1e3;function g_(e){const t=new Map;let n=Number.NEGATIVE_INFINITY;for(const r of e){const s=Date.parse(r.updatedAt);Number.isFinite(s)&&s>n&&(n=s)}for(const r of e){const s=Date.parse(r.updatedAt);if(!Number.isFinite(s)||n===Number.NEGATIVE_INFINITY){t.set(r.id,"older");continue}const o=n-s;t.set(r.id,o===0?"latest":o<uS?"recent":"older")}return t}function w_(e,t,n=Date.now()){return t!=="in-turn"?0:e.filter(r=>{const s=Date.parse(r.updatedAt);return!Number.isNaN(s)&&n-s<lS}).length}export{br as $,vt as A,Hh as B,bp as C,Ns as D,ih as E,mx as F,No as G,zp as H,$x as I,kS as J,Sv as K,ei as L,_s as M,th as N,cn as O,ks as P,hm as Q,lh as R,Dm as S,Lg as T,xs as U,uf as V,l_ as W,Nv as X,cr as Y,gr as Z,bg as _,Qd as a,n_ as a$,OS as a0,zS as a1,FS as a2,Th as a3,gh as a4,Zh as a5,Op as a6,Br as a7,Hp as a8,nw as a9,gb as aA,o_ as aB,wb as aC,$i as aD,Ii as aE,fb as aF,hb as aG,mb as aH,pb as aI,yc as aJ,tg as aK,Jp as aL,g_ as aM,Mg as aN,Ug as aO,f_ as aP,af as aQ,Ei as aR,He as aS,dc as aT,sr as aU,gv as aV,En as aW,Dh as aX,BS as aY,p_ as aZ,w_ as a_,wu as aa,Ps as ab,mn as ac,WS as ad,qS as ae,US as af,VS as ag,JS as ah,ZS as ai,mc as aj,ri as ak,CS as al,Vg as am,zg as an,im as ao,Bp as ap,Ja as aq,HS as ar,cv as as,Ms as at,AS as au,RS as av,MS as aw,id as ax,yb as ay,i_ as az,Pc as b,YS as b0,IS as b1,kc as b2,$S as b3,r_ as b4,TS as b5,s_ as b6,xS as b7,mu as b8,_S as b9,fr as bA,Mh as bB,DS as bC,Gv as bD,qx as bE,ts as bF,Hr as bG,Da as bH,hi as bI,pn as bJ,e_ as bK,fc as bL,vh as bM,Vf as bN,SS as bO,vS as bP,bS as bQ,d_ as bR,t_ as bS,u_ as bT,ES as ba,QS as bb,dg as bc,GS as bd,XS as be,Sn as bf,jc as bg,Ea as bh,Ra as bi,Ev as bj,Fv as bk,Ov as bl,Nf as bm,uh as bn,rx as bo,xf as bp,Iv as bq,yn as br,NS as bs,a_ as bt,zx as bu,At as bv,$a as bw,jh as bx,c_ as by,Xb as bz,lv as c,KS as d,Ow as e,nc as f,Jm as g,Vp as h,Up as i,gg as j,Du as k,Ot as l,h_ as m,nd as n,rd as o,m_ as p,ud as q,Yx as r,LS as s,PS as t,rc as u,wv as v,jS as w,ii as x,Ec as y,Kt as z};