@p4code/cli 0.9.21 → 0.9.22

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 (194) hide show
  1. package/dist/{TraceDiagnostics-DEAfnZGb.mjs → TraceDiagnostics-DE0N1Yf6.mjs} +2 -2
  2. package/dist/bin.mjs +1 -1
  3. package/dist/{binCli-IfUU-uWs.mjs → binCli-DC5fHnhS.mjs} +5 -5
  4. package/dist/client/.vite/manifest.json +1101 -1101
  5. package/dist/client/assets/{2NI2N5EU-qP3PpVDC.js → 2NI2N5EU-CgpeJ5KT.js} +2 -2
  6. package/dist/client/assets/{4UO7MD6I-Da5jHHfF.js → 4UO7MD6I-BZfVOqtM.js} +2 -2
  7. package/dist/client/assets/{5B3SVYGG-BGHUtemY.js → 5B3SVYGG-B5V3_tzl.js} +2 -2
  8. package/dist/client/assets/{5GK6JWQ2-DwbHk3MV.js → 5GK6JWQ2-DRzSVTZ0.js} +2 -2
  9. package/dist/client/assets/{5N7A7DKN-B-2quXAp.js → 5N7A7DKN-BX-IFKkJ.js} +2 -2
  10. package/dist/client/assets/{5OC2THR4-DSQWJ0ZQ.js → 5OC2THR4-CGiKcStE.js} +2 -2
  11. package/dist/client/assets/{5S6HY5KT-CAwEcA6I.js → 5S6HY5KT-B5Smgpiz.js} +2 -2
  12. package/dist/client/assets/{6IMQ5BUJ-BABYtiev.js → 6IMQ5BUJ-BSWEueVD.js} +2 -2
  13. package/dist/client/assets/{6OLKWJ4F-CwQRt55E.js → 6OLKWJ4F-0nUReGo5.js} +2 -2
  14. package/dist/client/assets/{74OO7NKP-DZoL_aBI.js → 74OO7NKP-BZ5SCLUX.js} +2 -2
  15. package/dist/client/assets/{75O6YZUN-CoqdPLhF.js → 75O6YZUN-NifBwMlS.js} +2 -2
  16. package/dist/client/assets/{77XECAW3-DM5Itfvk.js → 77XECAW3-_XJOQitm.js} +2 -2
  17. package/dist/client/assets/{ABYRPUBD-C2IaQicJ.js → ABYRPUBD-B5mFmY4q.js} +2 -2
  18. package/dist/client/assets/{AuthSurfaceShell-Dfcdz_aG.js → AuthSurfaceShell-DesOxtee.js} +2 -2
  19. package/dist/client/assets/{BB2UYUI2-DQkTEBDf.js → BB2UYUI2-CxFyfwSJ.js} +2 -2
  20. package/dist/client/assets/{BUM34MOA-DuY83HEN.js → BUM34MOA-Kk83QSsb.js} +2 -2
  21. package/dist/client/assets/{CEQABKGZ-CNAynrzB.js → CEQABKGZ-DLcBenqs.js} +2 -2
  22. package/dist/client/assets/{CXAC5362-B_mhvA6r.js → CXAC5362-BcvLk6NG.js} +2 -2
  23. package/dist/client/assets/{ChatGptUsageButton-DT3CRIhB.js → ChatGptUsageButton-C9D5JFWr.js} +2 -2
  24. package/dist/client/assets/{ChatMarkdown-_SLyl8Hk.js → ChatMarkdown-Ck4FJs_Q.js} +5 -5
  25. package/dist/client/assets/{CodexSetupSection.logic-CqdvWoE6.js → CodexSetupSection.logic-DzEO1qoo.js} +2 -2
  26. package/dist/client/assets/{CommandBlock-DnTIHX5l.js → CommandBlock-C15Q987N.js} +2 -2
  27. package/dist/client/assets/{ConnectAgentSurface-D-Z7Gl3G.js → ConnectAgentSurface-6FVydN17.js} +2 -2
  28. package/dist/client/assets/{DRLTVNUE-Bp-Mh_TD.js → DRLTVNUE-CkNId4Pz.js} +2 -2
  29. package/dist/client/assets/{DYY6UVD2-Dwh9ZkXt.js → DYY6UVD2-B4516qT_.js} +2 -2
  30. package/dist/client/assets/{DevicePanel-MMC7u5qJ.js → DevicePanel-B3CR7kGX.js} +2 -2
  31. package/dist/client/assets/{DeviceSetup-BCrBVLkf.js → DeviceSetup-Lxy9dmqi.js} +2 -2
  32. package/dist/client/assets/{DiffCommentAnnotation-D7iLWjnP.js → DiffCommentAnnotation-CSzNea6G.js} +2 -2
  33. package/dist/client/assets/{DiffFileTree-PCGZGqlB.js → DiffFileTree-CDnFut1y.js} +2 -2
  34. package/dist/client/assets/{DiffPanel-OOedo4tu.js → DiffPanel-KfudIZct.js} +2 -2
  35. package/dist/client/assets/{DiffWorkerPoolProvider-CmorWW2H.js → DiffWorkerPoolProvider-zgaFe3TY.js} +2 -2
  36. package/dist/client/assets/{EmbeddedDesign-CeUGLwuZ.js → EmbeddedDesign-BI3VZqZl.js} +4 -4
  37. package/dist/client/assets/{FNOVOB4O-BJscBtWY.js → FNOVOB4O-Uc8FDPv8.js} +2 -2
  38. package/dist/client/assets/{FileDiff-BMtpmo0v.js → FileDiff-B4Yf4fFg.js} +2 -2
  39. package/dist/client/assets/{FilePreviewPanel-DUqI7pF3.js → FilePreviewPanel-u1jxtxzb.js} +2 -2
  40. package/dist/client/assets/{FoldedSettingsSection-BTMENmDo.js → FoldedSettingsSection-DvzfFn5A.js} +2 -2
  41. package/dist/client/assets/{HDGCDEEZ-BA3H_tu4.js → HDGCDEEZ-DVkQN-82.js} +2 -2
  42. package/dist/client/assets/{HSJLKHB7-BojHXJG0.js → HSJLKHB7-txH19TCj.js} +2 -2
  43. package/dist/client/assets/{IntervalSecondsField-Cpc7UePr.js → IntervalSecondsField-xqmFxAii.js} +2 -2
  44. package/dist/client/assets/JZOYTAAL-BqUoPKcz.js +1 -0
  45. package/dist/client/assets/{K3MD6TGW-hwfRTJ3N.js → K3MD6TGW-4d2yDOzZ.js} +2 -2
  46. package/dist/client/assets/{K7RP3OMA-4mJh9KrG.js → K7RP3OMA-B8vKr81f.js} +2 -2
  47. package/dist/client/assets/{LHDIQX7Q-LIdvhN0m.js → LHDIQX7Q-DAyTfuTY.js} +2 -2
  48. package/dist/client/assets/{LUXOKEGN-B1aHy25-.js → LUXOKEGN-C67XJj3F.js} +2 -2
  49. package/dist/client/assets/{LinkMachineSelect-CM7JZDuM.js → LinkMachineSelect-DoqwB0AR.js} +2 -2
  50. package/dist/client/assets/{MathTypeset-CA2nw_Ej.js → MathTypeset-CMO1aCZc.js} +2 -2
  51. package/dist/client/assets/{ModelLiveLayer-CPk6oSLz.js → ModelLiveLayer-DqW0VhFG.js} +3 -3
  52. package/dist/client/assets/{N3JZAHOW-Dz6QAj1L.js → N3JZAHOW-Bp1sdK_N.js} +2 -2
  53. package/dist/client/assets/{NUIALGQ3-W9kPoZrb.js → NUIALGQ3-D427dlgt.js} +2 -2
  54. package/dist/client/assets/{NoProjectsHero-DrTDAhjM.js → NoProjectsHero-BL0Jsc_V.js} +2 -2
  55. package/dist/client/assets/{O65XPQGZ-CPx16bPB.js → O65XPQGZ-BxqHRP3n.js} +2 -2
  56. package/dist/client/assets/{O7XIQ6OM-CAdGDrqF.js → O7XIQ6OM-CKRD1aP5.js} +2 -2
  57. package/dist/client/assets/{OFQON5FD-DOxYOpsO.js → OFQON5FD-CzS9a25C.js} +2 -2
  58. package/dist/client/assets/{P4ConnectAccountPages-D0qqCxCf.js → P4ConnectAccountPages-Ca1o0JuS.js} +2 -2
  59. package/dist/client/assets/{P4ConnectSidebarSignIn-CtO1hqIS.js → P4ConnectSidebarSignIn-29st82gY.js} +2 -2
  60. package/dist/client/assets/{PJQHF43J-CEic-zJ0.js → PJQHF43J-Ww7-2BqY.js} +2 -2
  61. package/dist/client/assets/{PanelLayoutControls-CPevLAhG.js → PanelLayoutControls-CoWjUmx7.js} +4 -4
  62. package/dist/client/assets/{PierreEntryIcon-oOiSTYpG.js → PierreEntryIcon-UO6zY_i-.js} +2 -2
  63. package/dist/client/assets/{PreviewPanel-BSwObBjW.js → PreviewPanel-BHj7Mvmn.js} +2 -2
  64. package/dist/client/assets/{ProjectDefaultsSettings-BkxL8Xjx.js → ProjectDefaultsSettings-DN1mhFNf.js} +2 -2
  65. package/dist/client/assets/{ProjectFavicon-DYcNXMDQ.js → ProjectFavicon-CyXd4lSF.js} +3 -3
  66. package/dist/client/assets/{ProjectIconPickerDialog-CnlPMGQj.js → ProjectIconPickerDialog-B_D_9SAb.js} +2 -2
  67. package/dist/client/assets/{ProviderAuthTerminal-B1NeqFZE.js → ProviderAuthTerminal-B0GzUrya.js} +2 -2
  68. package/dist/client/assets/{ProviderModelPicker-CLwSFV6Q.js → ProviderModelPicker-DQ3N8RWz.js} +2 -2
  69. package/dist/client/assets/{ProviderSettingsForm-D9GJtzdb.js → ProviderSettingsForm-DefAmKv_.js} +2 -2
  70. package/dist/client/assets/{PullRequestCodeTab-CajEWSe5.js → PullRequestCodeTab-BTwbK3zR.js} +2 -2
  71. package/dist/client/assets/{RHNBAITX-D5lTu0BB.js → RHNBAITX-BsGO-vJB.js} +2 -2
  72. package/dist/client/assets/{ReadOnlySourcePreview-LxG8Br9J.js → ReadOnlySourcePreview-COho36OD.js} +2 -2
  73. package/dist/client/assets/{RenderErrorBoundary-CcI-4Zo3.js → RenderErrorBoundary-CYsCxleQ.js} +2 -2
  74. package/dist/client/assets/{SLD4V6NK-CG_xQFi-.js → SLD4V6NK-BZEKTqDY.js} +2 -2
  75. package/dist/client/assets/{ScheduledTasksSettings-CSygG_5X.js → ScheduledTasksSettings-CpfGXMow.js} +2 -2
  76. package/dist/client/assets/{ScopedSwitch-LzARRHas.js → ScopedSwitch-Cq7B0T7B.js} +2 -2
  77. package/dist/client/assets/{SelfImproveSettingsSection-DjuOvf_q.js → SelfImproveSettingsSection-DZUf-jb0.js} +2 -2
  78. package/dist/client/assets/{SettingsPanels-Ci2h30Aw.js → SettingsPanels-Bk_YhHLm.js} +2 -2
  79. package/dist/client/assets/{SettingsPanels.logic-BkjrmwrI.js → SettingsPanels.logic-UhRGlGN1.js} +2 -2
  80. package/dist/client/assets/{SettingsScopeNotice-96p-bg8p.js → SettingsScopeNotice-Cja-hHOp.js} +2 -2
  81. package/dist/client/assets/{SidebarStageBackdrop-B8YG-M-e.js → SidebarStageBackdrop-DL1ZzaTz.js} +2 -2
  82. package/dist/client/assets/{T3PCR2KE-DyNYo7Zy.js → T3PCR2KE-D049x5K8.js} +2 -2
  83. package/dist/client/assets/{TKWO2OVW-5eCjJCfz.js → TKWO2OVW-Du9gxVgn.js} +2 -2
  84. package/dist/client/assets/{TSHNXIZL-CjI9VTqp.js → TSHNXIZL-pUPHV4Qd.js} +2 -2
  85. package/dist/client/assets/{ThemeEditorPanel-BdfXdTV6.js → ThemeEditorPanel-CcFVvJlQ.js} +2 -2
  86. package/dist/client/assets/{ThreadDetailsItemsMenu-Cgj2yuzU.js → ThreadDetailsItemsMenu-C4wfbepv.js} +4 -4
  87. package/dist/client/assets/{ThreadTerminalDrawer-DBG1eHBS.js → ThreadTerminalDrawer-PkBB7D3Z.js} +2 -2
  88. package/dist/client/assets/{UQJE5E4I-CY9HwTsw.js → UQJE5E4I-BN56DsgT.js} +2 -2
  89. package/dist/client/assets/{USNYFO5S-BW0HcjRg.js → USNYFO5S-DVfAs9Gy.js} +2 -2
  90. package/dist/client/assets/{Virtualizer-NI9bqlwX.js → Virtualizer-Cn_zq3uH.js} +2 -2
  91. package/dist/client/assets/{WEVWDWVA-BF8z-yRH.js → WEVWDWVA-Cz36fo-k.js} +2 -2
  92. package/dist/client/assets/{X5RFHQXM-pdor6bX7.js → X5RFHQXM-CUB_vKAl.js} +2 -2
  93. package/dist/client/assets/{X62E3GBT-C6b2WsLT.js → X62E3GBT-C0wKfqHq.js} +2 -2
  94. package/dist/client/assets/{XBNEOJTC-BxqaKoJL.js → XBNEOJTC-CkYPODhO.js} +2 -2
  95. package/dist/client/assets/{YHV2MVVZ-DO-ICZOV.js → YHV2MVVZ-Cf82W2em.js} +2 -2
  96. package/dist/client/assets/{YURCZMG2-BxKVNupW.js → YURCZMG2-C9tzKn90.js} +2 -2
  97. package/dist/client/assets/{YVG2LODB-BwiP1iS0.js → YVG2LODB-DEZWhxa8.js} +2 -2
  98. package/dist/client/assets/{_chat-DDScEBKF.js → _chat-PsMoIPUC.js} +5 -5
  99. package/dist/client/assets/{_chat.design-360SdjDb.js → _chat.design-CWE-keji.js} +2 -2
  100. package/dist/client/assets/{_chat.index-DsRV2lh0.js → _chat.index-YmI2iiCN.js} +2 -2
  101. package/dist/client/assets/{_chat.new-B_AL_NJ2.js → _chat.new-BQY5ktA8.js} +2 -2
  102. package/dist/client/assets/{_chat.pull-requests-DlL4gjh7.js → _chat.pull-requests-C90JBKAN.js} +2 -2
  103. package/dist/client/assets/{assetUrls-gAudvjhV.js → assetUrls-C78a94Xu.js} +2 -2
  104. package/dist/client/assets/{assets-DaZ46ybf.js → assets-5kUNv3CS.js} +2 -2
  105. package/dist/client/assets/{browserHistoryStore-CIeLvEnV.js → browserHistoryStore-DHI-0j5y.js} +2 -2
  106. package/dist/client/assets/{browserLinkTarget-MQvtO-01.js → browserLinkTarget-D8HUAQg-.js} +2 -2
  107. package/dist/client/assets/{connect-DkCGs4oR.js → connect-Dl6MuR2C.js} +2 -2
  108. package/dist/client/assets/connect-agent-B22xdP4o.js +2 -0
  109. package/dist/client/assets/{design-Djc1_eDF.js → design-BoZx445P.js} +2 -2
  110. package/dist/client/assets/{device-P8L_QiVD.js → device-Ku4cbgo-.js} +2 -2
  111. package/dist/client/assets/{diffRendering-Cb9qJUqp.js → diffRendering-yxIsTMie.js} +2 -2
  112. package/dist/client/assets/{dist-BocOAtMa.js → dist-CkH9xVVz.js} +2 -2
  113. package/dist/client/assets/{duoViewer-Domn2baW.js → duoViewer-_3Xk2sTq.js} +2 -2
  114. package/dist/client/assets/{dynamic-CjS-lEY3.js → dynamic-CwQ-caG2.js} +2 -2
  115. package/dist/client/assets/{embeddedScripts-AO2vzovy.js → embeddedScripts-Cn7aGTAj.js} +2 -2
  116. package/dist/client/assets/{entities-s42SFcbu.js → entities-DOpLfnwX.js} +2 -2
  117. package/dist/client/assets/{fileLinks-BY6FjK66.js → fileLinks-CJ9SYNL6.js} +2 -2
  118. package/dist/client/assets/{fileTreeExpansion-B--IBStv.js → fileTreeExpansion-CdWOFpa-.js} +2 -2
  119. package/dist/client/assets/{getDiffFileInput-B7pCnCeh.js → getDiffFileInput-hLtjvhYr.js} +2 -2
  120. package/dist/client/assets/{index-C5VbGbq-.js → index-etcfxnIt.js} +3 -3
  121. package/dist/client/assets/{lazy-Bpm7QNt6.js → lazy--Qcevr63.js} +4 -4
  122. package/dist/client/assets/{linkedPrompt-DqEOywCR.js → linkedPrompt-D4M9Fbja.js} +2 -2
  123. package/dist/client/assets/{main-BYwnnJ9E.js → main-C04YJQbN.js} +7 -7
  124. package/dist/client/assets/{mediaReference-CW0q8-nM.js → mediaReference-D4rhlY-i.js} +2 -2
  125. package/dist/client/assets/{mediaSource-BgP2sq1w.js → mediaSource-B03Ykm6c.js} +2 -2
  126. package/dist/client/assets/{modelScene-OONljnCt.js → modelScene-CX8s0IGN.js} +2 -2
  127. package/dist/client/assets/{onboarding-DLaBhCVN.js → onboarding-BZ01kUjR.js} +2 -2
  128. package/dist/client/assets/{openFileInPreview-Dpge7x7S.js → openFileInPreview-XKgvCQ1z.js} +2 -2
  129. package/dist/client/assets/{p4ProjectFile-Fd0NSHmZ.js → p4ProjectFile-y2CDxOaL.js} +2 -2
  130. package/dist/client/assets/{pair-BUkFlR8l.js → pair-PXvf9qqC.js} +2 -2
  131. package/dist/client/assets/{phoneViewer-BJj_96At.js → phoneViewer-F9Wt5VkW.js} +2 -2
  132. package/dist/client/assets/{pierre-icons-BptmNFMW.js → pierre-icons-BTVgApcG.js} +2 -2
  133. package/dist/client/assets/{preview-BBssbPEj.js → preview-5pSBET3P.js} +2 -2
  134. package/dist/client/assets/{primary-TNEEuOuT.js → primary-BXI66byW.js} +2 -2
  135. package/dist/client/assets/{primaryCloudLinkState-DbUZbjy4.js → primaryCloudLinkState-DswWb__m.js} +2 -2
  136. package/dist/client/assets/{projectFilesQueryState-CVSEDHhW.js → projectFilesQueryState-B6AeAhgL.js} +2 -2
  137. package/dist/client/assets/{projectScriptEditor-D2C0qPZA.js → projectScriptEditor-DvKvgTs-.js} +2 -2
  138. package/dist/client/assets/{providerSkills-5OBbbZq-.js → providerSkills-D-ytsJU9.js} +2 -2
  139. package/dist/client/assets/{pullRequestDetail.logic-D5hhGj8d.js → pullRequestDetail.logic-DQj9l9DL.js} +2 -2
  140. package/dist/client/assets/{pullRequests-R7416J6H.js → pullRequests-DrQJ8zM2.js} +2 -2
  141. package/dist/client/assets/{queries-Bp7Rbzrz.js → queries-BA_altUI.js} +2 -2
  142. package/dist/client/assets/{relay-V_5ApBIP.js → relay-CTdDIWLg.js} +2 -2
  143. package/dist/client/assets/{renderScheduler-T1-hnpvd.js → renderScheduler-eNIG8tB_.js} +2 -2
  144. package/dist/client/assets/{runtime-B92ivG9b.js → runtime-BvdQMwVb.js} +3 -3
  145. package/dist/client/assets/{scheduledTasksSettings.logic-DOegPD4_.js → scheduledTasksSettings.logic-CKzZuci7.js} +2 -2
  146. package/dist/client/assets/{server-GB5fRm03.js → server-DthHkqkT.js} +2 -2
  147. package/dist/client/assets/{session-CFzb2gMH.js → session-CxeYe0sJ.js} +2 -2
  148. package/dist/client/assets/{session-logic-Cx9524Pd.js → session-logic-2ZMapwqV.js} +2 -2
  149. package/dist/client/assets/{settings-DuV3USCX.js → settings-DAe5Z4UG.js} +2 -2
  150. package/dist/client/assets/{settings.appearance-DtON2De5.js → settings.appearance-wfb5oCmC.js} +2 -2
  151. package/dist/client/assets/settings.archived-BF0zdtbV.js +2 -0
  152. package/dist/client/assets/{settings.computer-use-BuiCBgaZ.js → settings.computer-use-DJQcngZ4.js} +2 -2
  153. package/dist/client/assets/{settings.connections-CTuywqD3.js → settings.connections-CoxujVuf.js} +2 -2
  154. package/dist/client/assets/{settings.data-controls-BTvw7hwA.js → settings.data-controls-DUI06j8l.js} +2 -2
  155. package/dist/client/assets/{settings.decisions-DjyXWkGE.js → settings.decisions-BY4z-aRM.js} +2 -2
  156. package/dist/client/assets/{settings.designs-B7y3Iz_g.js → settings.designs-O0d1vzoU.js} +2 -2
  157. package/dist/client/assets/{settings.diagnostics-muot_u8V.js → settings.diagnostics-CwCeo1mG.js} +2 -2
  158. package/dist/client/assets/{settings.general-CejKrS3r.js → settings.general-CAOwfHEb.js} +2 -2
  159. package/dist/client/assets/{settings.integrations-3B64nKur.js → settings.integrations-2RsLmeUi.js} +2 -2
  160. package/dist/client/assets/{settings.keybindings-DhvXS2QI.js → settings.keybindings-CwvrmKin.js} +2 -2
  161. package/dist/client/assets/{settings.open-source-licenses-nDTYUclU.js → settings.open-source-licenses-DCBCu3U3.js} +2 -2
  162. package/dist/client/assets/{settings.plugins-DJQxiL8Y.js → settings.plugins-8R8eV7IR.js} +2 -2
  163. package/dist/client/assets/{settings.projects-Cf31zLX1.js → settings.projects-Cy_93LuA.js} +3 -3
  164. package/dist/client/assets/{settings.providers-BenYwp5l.js → settings.providers-4HI8om0T.js} +3 -3
  165. package/dist/client/assets/{settings.scheduled-tasks-B0BJtx2Y.js → settings.scheduled-tasks-CHnjcJx8.js} +2 -2
  166. package/dist/client/assets/{settings.secrets-CugtPHky.js → settings.secrets-BgQSmFWY.js} +2 -2
  167. package/dist/client/assets/{settings.snap-shot-9uuaPZ8d.js → settings.snap-shot-C0J6pItQ.js} +2 -2
  168. package/dist/client/assets/{settings.source-control-DECPD9xY.js → settings.source-control-B3kcm55_.js} +2 -2
  169. package/dist/client/assets/{settings.storage-uPkJDu8D.js → settings.storage-Cy6oX7X3.js} +2 -2
  170. package/dist/client/assets/{settingsLayout-BoWaVHvV.js → settingsLayout-YTaL8Lym.js} +2 -2
  171. package/dist/client/assets/{sidebarProjectGrouping-MU2UfzY1.js → sidebarProjectGrouping-BaiZoO-A.js} +2 -2
  172. package/dist/client/assets/{sourceControl-BU6NXFEv.js → sourceControl-j8xaTHat.js} +2 -2
  173. package/dist/client/assets/{sourceControlClients-DBozOkI3.js → sourceControlClients-BxzlzQxJ.js} +2 -2
  174. package/dist/client/assets/{terminal-links-B5f_yaZ1.js → terminal-links-BdsGDJ3O.js} +2 -2
  175. package/dist/client/assets/{terminalSessions-Cg0AQjBU.js → terminalSessions-yZRa64tn.js} +2 -2
  176. package/dist/client/assets/{uiStateStore-u_PaGpa6.js → uiStateStore-CX-sbFiq.js} +2 -2
  177. package/dist/client/assets/{usage-BzExgBit.js → usage-CdxC8YNe.js} +2 -2
  178. package/dist/client/assets/{use-atom-command-Bd7vZxeH.js → use-atom-command-Bsfu4mja.js} +2 -2
  179. package/dist/client/assets/{useHandleNewThread-CA9pnWuC.js → useHandleNewThread-Cv_08eER.js} +2 -2
  180. package/dist/client/assets/{useP4ConnectAuthPrompt-czmNhUqV.js → useP4ConnectAuthPrompt-CW-hut92.js} +2 -2
  181. package/dist/client/assets/{usePullRequestActions-BIPl_xE4.js → usePullRequestActions-BHv9tRFF.js} +2 -2
  182. package/dist/client/assets/{useScopedModelAvailability-UuZvj6HE.js → useScopedModelAvailability-J0i-Sj4p.js} +2 -2
  183. package/dist/client/assets/{useSettings-Dp9RSL-0.js → useSettings-BhGGZc98.js} +2 -2
  184. package/dist/client/assets/{vcsRefInvalidation-CoBKCEWS.js → vcsRefInvalidation-71d-99uY.js} +2 -2
  185. package/dist/client/assets/{welcome-CJjj0VVp.js → welcome-Ytf7jmR7.js} +2 -2
  186. package/dist/client/index.html +1 -1
  187. package/dist/{preview-JlPVV2bV.mjs → preview-CmCyL-Tc.mjs} +2 -2
  188. package/dist/{runtimeLayer-B9K2BVKV.mjs → runtimeLayer-BnJcJFjY.mjs} +2 -2
  189. package/dist/{runtimeLayer-ZFdf4c6R.mjs → runtimeLayer-DnNbGwAf.mjs} +1 -1
  190. package/dist/{server-BnHhGuOc.mjs → server-DXfSgbuj.mjs} +4 -4
  191. package/package.json +1 -1
  192. package/dist/client/assets/JZOYTAAL-Bw2-11fa.js +0 -1
  193. package/dist/client/assets/connect-agent-C4n-OyN3.js +0 -2
  194. package/dist/client/assets/settings.archived-CxxKM6i3.js +0 -2
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MathTypeset-CA2nw_Ej.js","assets/react-BUfh6y28.js","assets/jsx-runtime-DJeoFXNw.js","assets/katex-DJhrJSbw.js","assets/MathTypeset-DEcVZfaU.css","assets/lazy-Bpm7QNt6.js","assets/index-C5VbGbq-.js"])))=>i.map(i=>d[i]);
2
- import{a as e,n as t,t as n}from"./react-BUfh6y28.js";import{t as r}from"./index-C5VbGbq-.js";import{n as i,t as a}from"./jsx-runtime-DJeoFXNw.js";import{Ad as o,Ai as s,Al as c,At as l,Bi as u,Cc as d,Co as f,Ea as p,Ei as m,Fi as h,Gu as g,Hd as _,Hr as v,Ir as y,Ji as b,Jo as x,Js as S,Lr as C,Mt as w,Na as T,Ni as E,Nr as D,Os as O,Pf as k,Qd as A,Qu as j,Ri as M,Rl as N,Ru as P,Si as F,Ti as ee,To as te,Ua as ne,Vf as re,Wa as I,Wo as L,Xl as ie,Zn as ae,_d as oe,_i as se,ap as ce,au as le,bd as ue,bi as de,fi as R,fl as fe,fr as z,gi as pe,go as me,gs as he,gu as ge,hi as _e,ja as ve,ki as ye,kl as be,kr as xe,li as Se,mi as Ce,mr as we,mu as Te,n as Ee,no as De,np as Oe,of as ke,oi as Ae,ol as je,pu as Me,qa as Ne,qd as Pe,qs as Fe,qu as Ie,rr as Le,ru as Re,t as B,tf as ze,tp as Be,tr as Ve,ud as He,ui as Ue,un as We,vi as Ge,wa as Ke,wi as qe,ws as Je,xf as Ye,xi as Xe,xo as Ze,xt as Qe,yd as $e,yi as et,zi as tt}from"./utils-DkKLB01I.js";import{Bs as nt,Ea as rt,H as it,Ic as at,Oa as ot,Tp as st,Va as ct,W as lt,Zs as ut,en as dt,lh as ft,pn as pt,qs as mt}from"./src-R7EkrVcv.js";import{Dr as ht,Jn as gt,Sr as _t,Zn as vt,_ as yt,dr as bt,ei as xt,er as St,h as Ct,p as wt,qn as Tt,rr as Et,rt as Dt,ur as Ot}from"./runtime-B92ivG9b.js";import{C as kt,D as At,G as jt,O as Mt,S as Nt,Y as Pt,d as Ft}from"./entities-s42SFcbu.js";import{f as It,h as Lt,i as Rt,n as zt,s as Bt,t as Vt}from"./useRender-BP5vR6yH.js";import{A as Ht,C as Ut,G as Wt,d as Gt,f as Kt,u as qt}from"./TooltipProvider-DiV5KdTq.js";import{t as Jt}from"./link-BHR6GsRr.js";import{t as Yt}from"./useNavigate-DXSBYc-k.js";import{a as Xt,h as Zt}from"./relay-V_5ApBIP.js";import{J as Qt,K as $t,Y as en,at as tn,r as nn,s as rn}from"./useSettings-Dp9RSL-0.js";import{f as an}from"./server-GB5fRm03.js";import{i as on,n as sn,r as cn,s as ln,t as un}from"./session-CFzb2gMH.js";import{n as dn}from"./query-CeIgbVxh.js";import{t as fn}from"./use-atom-command-Bd7vZxeH.js";import{u as pn}from"./rightPanelStore-Bt0unAo8.js";import{a as mn,i as hn,n as gn,o as _n,r as vn,t as yn}from"./fileLinks-BY6FjK66.js";import{t as bn}from"./toastHelpers-DxXYm50b.js";import{A as xn,B as Sn,D as Cn,F as wn,I as Tn,L as En,M as Dn,O as On,P as kn,R as An,a as jn,j as Mn,k as Nn,l as Pn,z as Fn}from"./diffRendering-Cb9qJUqp.js";import{a as In,c as Ln,d as Rn,i as zn,l as Bn,n as Vn,o as Hn,r as Un,s as Wn,t as Gn,u as Kn}from"./mediaReference-CW0q8-nM.js";import{n as qn,r as Jn,t as Yn}from"./mediaSource-BgP2sq1w.js";import{o as Xn}from"./timestampFormat-Dq7sHZpd.js";import{t as Zn}from"./env-BfPir1X4.js";import{a as Qn,n as $n,t as er}from"./tooltip-CCYU8XGM.js";import{i as tr,o as nr}from"./pierre-icons-BptmNFMW.js";import{n as rr,t as ir}from"./scroll-area-D2D-AlvC.js";import{c as ar,s as or,t as sr}from"./dialog-5OaxRXCC.js";import{t as cr}from"./observeResize-BESwMMOy.js";import{s as lr,t as ur,u as dr}from"./assets-DaZ46ybf.js";import{i as fr,n as pr,t as mr}from"./assetUrls-gAudvjhV.js";import{n as hr,x as gr}from"./browserHistoryStore-CIeLvEnV.js";import{a as _r,i as vr,n as yr,r as br,t as xr}from"./openFileInPreview-Dpge7x7S.js";import{p as Sr}from"./Icons-DmQwwfAN.js";import{t as Cr}from"./preview-BBssbPEj.js";import{o as wr,t as Tr}from"./PierreEntryIcon-oOiSTYpG.js";import{$ as Er,F as Dr,G as Or,H as kr,I as Ar,J as jr,K as Mr,O as Nr,Q as Pr,U as Fr,V as Ir,W as Lr,X as Rr,Y as zr,Z as Br,a as Vr,et as Hr,ft as Ur,i as Wr,j as Gr,k as Kr,lt as qr,nt as Jr,ot as Yr,pt as Xr,q as Zr,r as Qr,rt as $r,t as ei,tt as ti,ut as ni,w as ri,z as ii}from"./RenderErrorBoundary-CcI-4Zo3.js";import{i as ai}from"./browserLinkTarget-MQvtO-01.js";import{t as oi}from"./pullRequestIcons-1lUVOGQJ.js";import{r as si}from"./pullRequests-R7416J6H.js";import{a as ci,i as li,n as ui,o as di,t as fi}from"./popover-hyDlWUPU.js";import{t as pi}from"./ProjectFavicon-DYcNXMDQ.js";import{o as mi,r as hi}from"./terminal-links-B5f_yaZ1.js";import{Ao as gi,Bo as _i,Po as vi,Ro as yi,jo as bi,ko as xi,zo as Si}from"./main-BYwnnJ9E.js";function Ci(e,t,n,r){return{left:e,top:t,right:n,bottom:r,x:e,y:t,width:n-e,height:r-t}}function wi(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function Ti(e){let t=[],n,r=1/0,i=1/0,a=-1/0,o=-1/0;for(let s of Array.from(e).sort((e,t)=>e.top-t.top)){if(r=Math.min(r,s.left),i=Math.min(i,s.top),a=Math.max(a,s.right),o=Math.max(o,s.bottom),!n||s.top-n.top>n.height/2)t.push(wi(s));else{let e=t[t.length-1];e.left=Math.min(e.left,s.left),e.right=Math.max(e.right,s.right),e.bottom=Math.max(e.bottom,s.bottom),e.width=e.right-e.left,e.height=e.bottom-e.top}n=s}return{lines:t,fallback:Ci(r,i,a,o)}}function Ei(e,t,n){return e.findIndex(e=>t>e.left-2&&t<e.right+2&&n>e.top-2&&n<e.bottom+2)}function Di(e){return Ci(e.left,e.top,e.right,e.bottom)}function Oi(e,t,n){let{lines:r}=Ti(e.getClientRects());if(r.length<2)return;let i=Ei(r,t,n);return{x:t,y:n,lineIndex:i===-1?void 0:i,element:e}}function ki(e,t,n){let{lines:r,fallback:i}=Ti(e.getClientRects());if(r.length<2)return null;let a=n?.x,o=n?.y,s=t[0];if(n?.lineIndex!=null&&r[n.lineIndex])return Di(r[n.lineIndex]);if(a!=null&&o!=null){let e=Ei(r,a,o);if(e!==-1)return Di(r[e])}if(r.length===2&&r[0].left>r[1].right&&a!=null&&o!=null)return i;if(s===`t`||s===`b`){let e=r[0],t=r[r.length-1],n=s===`t`?e:t;return Ci(n.left,e.top,n.right,t.bottom)}let c=s===`l`,l=r[0].left,u=r[0].right,d=c?1/0:-1/0,f=r[0],p=r[0];for(let e of r){l=Math.min(l,e.left),u=Math.max(u,e.right);let t=c?e.left:e.right;c&&t<d||!c&&t>d?(d=t,f=e,p=e):t===d&&(p=e)}return Ci(l,f.top,u,p.bottom)}function Ai(e){return`contextElement`in e&&e.contextElement?e.contextElement:Ne(e)?e:void 0}function ji(e,t){function n(t){Mi(e,t.currentTarget,t.clientX,t.clientY)}function r(e){t||n(e)}return{onFocus(){e.current=void 0},onMouseEnter:n,onMouseMove:r}}function Mi(e,t,n,r){let i=Oi(t,n,r);return e.current=i,i}function Ni(e){return{name:`inline`,async fn(t){let n=t.elements.reference;if(typeof n?.getClientRects!=`function`)return{};let r=Ai(n),i=e.current,a=i?.element===n||i?.element===r?i:void 0,o=ki(n,t.placement,a);if(!o||typeof t.platform.getElementRects!=`function`)return{};let s=await t.platform.getElementRects({reference:{contextElement:r,getBoundingClientRect(){return o}},floating:t.elements.floating,strategy:t.strategy});return t.rects.reference.x===s.reference.x&&t.rects.reference.y===s.reference.y&&t.rects.reference.width===s.reference.width&&t.rects.reference.height===s.reference.height?{}:{reset:{rects:s}}}}}var V=e(n(),1),H=i(),U=e(a(),1),Pi=e(p());function Fi(e){let t=e.toLowerCase();return t.includes(`mac`)?`Reveal in Finder`:t.includes(`win`)?`Reveal in File Explorer`:`Reveal in Files`}function Ii(e){return e===`darwin`?`Reveal in Finder`:e===`windows`?`Reveal in File Explorer`:`Reveal in Files`}function Li(e){return e===`finder`?`Reveal in Finder`:e===`file-explorer`?`Reveal in File Explorer`:`Reveal in Files`}var Ri={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},zi=class{maxEntries;maxMemoryBytes;cache=new Map;totalSize=0;constructor(e,t){this.maxEntries=e,this.maxMemoryBytes=t}get(e){let t=this.cache.get(e);return t?(this.promote(e,t),t.value):null}set(e,t,n){if(n>this.maxMemoryBytes)return;let r=this.cache.get(e);r&&(this.totalSize-=r.approximateSize,this.cache.delete(e)),this.evictIfNeeded(n),this.cache.set(e,{value:t,approximateSize:n}),this.totalSize+=n}clear(){this.cache.clear(),this.totalSize=0}promote(e,t){this.cache.delete(e),this.cache.set(e,t)}evictIfNeeded(e){for(;(this.cache.size>=this.maxEntries||this.totalSize+e>this.maxMemoryBytes)&&this.cache.size>0;){let e=this.cache.keys().next().value;if(e===void 0)break;let t=this.cache.get(e);t&&(this.totalSize-=t.approximateSize),this.cache.delete(e)}}},Bi=new Map(it.map(e=>[e.id,e.label]));function Vi(e,t){return e===`file-manager`?Ee(t):Bi.get(e)??`Editor`}function Hi(e){return e===null||e===`file-manager`?`Open in editor`:`Open in ${Bi.get(e)??`Editor`}`}var Ui={mode:`local-exec`},Wi={mode:`remote-unavailable`},Gi={state:Ui,isResolved:!1};function Ki(e){try{return new URL(e).hostname}catch{return null}}function qi(e){let{target:t}=e;if(t===null)return Ui;if(t._tag===`PrimaryConnectionTarget`){if(e.isDesktopRenderer)return Ui;let n=Ki(t.httpBaseUrl);if(n!==null&&Dt(n))return Ui}else if(yt(t))return Ui;if(e.sshAlias!==null&&e.sshAlias.length>0)return{mode:`remote-links`,host:{kind:`ssh-alias`,host:e.sshAlias}};let n=e.remoteOpenTargets?.[0];return n===void 0?Wi:{mode:`remote-links`,host:n}}function Ji(e){let t=(0,H.c)(6),{presentation:n}=tn(e),r;bb0:{if(n===null){r=Gi;break bb0}let e;if(t[0]!==n.entry.profile||t[1]!==n.entry.target||t[2]!==n.serverConfig?.remoteOpenTargets){let r=ft(n.entry.profile),i=r!==null&&r._tag===`SshConnectionProfile`?r.target.alias:null;e=qi({target:n.entry.target,sshAlias:i,remoteOpenTargets:n.serverConfig?.remoteOpenTargets,isDesktopRenderer:window.desktopBridge!==void 0}),t[0]=n.entry.profile,t[1]=n.entry.target,t[2]=n.serverConfig?.remoteOpenTargets,t[3]=e}else e=t[3];let i;t[4]===e?i=t[5]:(i={state:e,isResolved:!0},t[4]=e,t[5]=i),r=i}return r}function Yi(e){return Ji(e).state}var Xi=[`vscode`],Zi=null;function Qi(){let e=(0,H.c)(2),[t,n]=(0,V.useState)(ta),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(Zi!==null)return;let e=window.desktopBridge?.probeRemoteEditors;if(e===void 0){Zi=Xi;return}let t=!1;return e().then(e=>{let r=e.filter(ea);Zi=r.length>0?r:Xi,t||n(Zi)},$i),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,V.useEffect)(r,i),t}function $i(){Zi=Xi}function ea(e){return lt.includes(e)}function ta(){return Zi??Xi}async function na(e){let t=window.desktopBridge;if(t!==void 0)try{return await t.openExternal(e)}catch{return!1}return window.location.assign(e),!0}var ra=`p4code:remote-open-hint-seen`;function ia(){let e=(0,H.c)(5),[t,n]=O(ra,!1,ut),r;e[0]===n?r=e[1]:(r=()=>n(!0),e[0]=n,e[1]=r);let i;return e[2]!==t||e[3]!==r?(i=[t,r],e[2]=t,e[3]=r,e[4]=i):i=e[4],i}function aa(e){if(e.autoplay||!e.paused||e.seeking||e.currentTime!==0||e.played.length>0||!Number.isFinite(e.duration)||e.duration<=0)return;let t=e.src.split(`#`,2)[1];if(!(t&&new URLSearchParams(t).has(`t`)))try{e.currentTime=Math.min(.1,e.duration/2)}catch{}}var oa={"open-in-preview":`open-link-in-preview`,"open-external":`open-link-external`,"copy-link":`copy-link`,"link-to-thread":`link-pull-request-to-thread`,"unlink-from-thread":`unlink-pull-request-from-thread`},sa=[{id:`open-in-preview`,label:`Open in integrated browser`},{id:`open-external`,label:`Open in system browser`},{id:`copy-link`,label:`Copy Link`}];function ca(e){let t=e.canOpenInPreview?sa:sa.filter(e=>e.id!==`open-in-preview`);return e.threadLinkAction===void 0?t:[{id:e.threadLinkAction,label:e.threadLinkAction===`link-to-thread`?`Link to thread`:`Unlink from thread`},...t]}function la(e){if(!e)return null;try{let t=new URL(e.startsWith(`//`)?`https:${e}`:e);return t.protocol!==`http:`&&t.protocol!==`https:`?null:t}catch{return null}}function ua(e){return la(e)?.href??null}function da(e){return la(e)?.hostname||null}async function fa({href:e,position:t,canOpenInPreview:n=!0,threadLinkAction:r,showContextMenu:i,openInPreview:a,openExternal:o,copyLink:s,updateThreadLink:c,reportFailure:l}){let u;try{u=await i(ca({canOpenInPreview:n,threadLinkAction:r}),t)}catch(e){l(`show-link-context-menu`,e);return}try{u===`open-in-preview`?await a(e):u===`open-external`?await o(e):u===`copy-link`?await s(e):(u===`link-to-thread`||u===`unlink-from-thread`)&&await c?.(e,u===`link-to-thread`)}catch(e){u&&l(oa[u],e)}}function pa(e){return e.startsWith(`//`)?`${typeof window<`u`&&window.location.protocol===`http:`?`http:`:`https:`}${e}`:e}function ma(e){let t=new TextEncoder;return Uint8Array.from(e.split(/(%[0-9a-f]{2})/i).flatMap(e=>/^%[0-9a-f]{2}$/i.test(e)?[Number.parseInt(e.slice(1),16)]:[...t.encode(e)]))}function ha(e){let t=e.split(`#`,1)[0]??e,n=t.indexOf(`,`),[r=``,...i]=t.slice(5,n).split(`;`),a=t.slice(n+1);try{if(n<0)throw Error(`Missing data URL payload.`);let e=i.some(e=>e.trim().toLowerCase()===`base64`)?Uint8Array.from(atob(decodeURIComponent(a)),e=>e.charCodeAt(0)):ma(a);return new Blob([e],{type:r||`text/plain`})}catch(e){throw Error(`This inline media could not be decoded.`,{cause:e})}}async function ga(e){let t=await fetch(e).catch(()=>null);if(t?.ok)return t.blob();let n=typeof window>`u`?void 0:window.desktopBridge,r=n?.readMedia&&/^https?:/i.test(e)?await n.readMedia(e).catch(()=>null):null;if(r&&r.status>=200&&r.status<300)return new Blob([new Uint8Array(r.data)],{type:r.mimeType});let i=r?.status??t?.status;throw Error(i===void 0?n?.readMedia?`The file could not be fetched. Check the connection and try again.`:`The file could not be fetched. The host may block browser access (CORS), or the connection may be unavailable.`:`The file could not be fetched (HTTP ${i}).`)}async function _a(e){if(/^data:/i.test(e))return ha(e);let t=await ga(e);if(t.type.split(`;`,1)[0]===`text/html`)throw Error(`This link returned a web page instead of media. Open the original URL.`);return t}async function va(e,t){let n=URL.createObjectURL(await _a(e));try{let e=document.createElement(`a`);e.href=n,e.download=t,e.click()}finally{setTimeout(()=>URL.revokeObjectURL(n),3e4)}}async function ya(e){let t=await _a(e);if(t.type.split(`;`,1)[0]===`image/png`)return t;let n=URL.createObjectURL(t),r=new Image;r.src=n;try{try{await r.decode()}catch(e){throw Error(`The browser could not decode this image for copying. Try saving it instead.`,{cause:e})}let{naturalWidth:e,naturalHeight:t}=r;if(e<=0||t<=0||e*t>64e6)throw Error(`This image is too large or has no usable dimensions. Try saving it instead.`);let n=document.createElement(`canvas`);n.width=e,n.height=t;let i=n.getContext(`2d`);if(!i)throw Error(`Image copying is unavailable in this browser.`);return i.drawImage(r,0,0),await new Promise((e,t)=>{n.toBlob(n=>n?e(n):t(Error(`The image could not be converted to PNG.`)),`image/png`)})}finally{URL.revokeObjectURL(n)}}function ba(e){let t=da(e.originalUrl)===null?void 0:e.originalUrl,n=t??e.src;if(!n)return null;let r=pa(n),i=!1;try{let e=new URL(r).protocol;if(e!==`http:`&&e!==`https:`&&e!==`blob:`)return null;i=e===`blob:`}catch{return null}return(0,U.jsxs)(we,{size:`sm`,variant:`secondary`,className:e.className,render:(0,U.jsx)(`a`,{href:r,target:i?void 0:`_blank`,download:i?e.fileName||!0:void 0,rel:`noopener noreferrer`}),children:[i?(0,U.jsx)(Re,{}):(0,U.jsx)(le,{}),t?`Open original`:i?`Download video`:`Open in browser`]})}function xa(e){return e.reference&&Vn(e.reference)||e.name||e.kind}function Sa(e){return e===null||ct(e,`filesystem:read`)}function Ca(e){if(e===null)return!0;let t=L.get(un.sessionStateAtom(e));return t._tag!==`Failure`&&Sa(ft(Je(t)))}function wa(e){let t=(0,H.c)(24),n=e.asset&&(e.asset.resource._tag===`workspace-file`||e.asset.resource._tag===`media-file`)?e.asset.environmentId:null,r;t[0]===n?r=t[1]:(r=n===null?null:un.sessionStateAtom(n),t[0]=n,t[1]=r);let i=dn(r),a;t[2]!==i||t[3]!==n?(a=n===null||i.error===null&&i.data!==null&&Sa(i.data),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o=a,s;t[5]===n?s=t[6]:(s=()=>{if(!Ca(n))throw Error(`This connection cannot read host files.`)},t[5]=n,t[6]=s);let c=s,l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1,refresh:!0},t[7]=l):l=t[7];let u=fr(ur.createUrl,l),d;t[8]!==c||t[9]!==u||t[10]!==e.asset||t[11]!==e.src?(d=async()=>{if(c(),!e.asset){if(!e.src)throw Error(`This media is unavailable. Try reopening the preview.`);return e.src}let{environmentId:t,resource:n}=e.asset,r=cn(t);if(!r)throw Error(`Reconnect to this environment and try again.`);let i=await u({environmentId:t,input:{resource:n}});if(i._tag===`Failure`)throw ht(i);c();let a=dr(r.httpBaseUrl,i.value.relativeUrl);if(!a)throw Error(`The environment returned an invalid media URL.`);return a},t[8]=c,t[9]=u,t[10]=e.asset,t[11]=e.src,t[12]=d):d=t[12];let f=d,p;t[13]!==f||t[14]!==e?(p=async()=>{await va(await f(),xa(e))},t[13]=f,t[14]=e,t[15]=p):p=t[15];let m=p,h;t[16]!==f||t[17]!==c?(h=async()=>{if(c(),!navigator.clipboard?.write||typeof ClipboardItem>`u`)throw Error(`Image copying is unavailable. Use a secure browser connection or save the image.`);await navigator.clipboard.write([new ClipboardItem({"image/png":f().then(ya)})])},t[16]=f,t[17]=c,t[18]=h):h=t[18];let g=h,_;return t[19]!==c||t[20]!==o||t[21]!==g||t[22]!==m?(_={save:m,copyImage:g,canReadMedia:o,assertCanReadMedia:c},t[19]=c,t[20]=o,t[21]=g,t[22]=m,t[23]=_):_=t[23],_}function Ta({source:e,children:t,showTooltip:n=!0}){let{save:r,copyImage:i,canReadMedia:a,assertCanReadMedia:o}=wa(e),[s,c]=(0,V.useState)(!1),l=(0,V.useRef)(!1),u=e.reference,d=u?.kind===`file`?u.path:u?.url??e.name,f=async t=>{let n=Qt();if(!n||l.current)return;l.current=!0,c(!1);let s=`Could not open media menu`,d;try{let c=e.kind===`image`?`image`:`video`,l=!a||e.src===null&&e.asset===void 0,f=typeof navigator<`u`&&!!navigator.clipboard?.write&&typeof ClipboardItem<`u`,p=[];u?.kind===`file`?(p.push({id:`copy-full-path`,label:`Copy full path`}),u.relativePath&&p.push({id:`copy-relative-path`,label:`Copy relative path`})):u?.kind===`url`&&p.push({id:`copy-url`,label:`Copy URL`}),e.onOpenFile&&p.push({id:`open-file`,label:`Open in file viewer`,disabled:!a}),p.push({id:`save`,label:`Save ${c}`,disabled:l}),e.kind===`image`&&p.push({id:`copy-image`,label:`Copy image`,disabled:l||!f});let m=await n.contextMenu.show(p,t);if(!m)return;s=`Could not ${p.find(e=>e.id===m)?.label.toLowerCase()??`complete media action`}`;let h=m===`copy-full-path`&&u?.kind===`file`?u.path:m===`copy-relative-path`&&u?.kind===`file`?u.relativePath:m===`copy-url`&&u?.kind===`url`?u.url:void 0;h===void 0?m===`open-file`?(o(),e.onOpenFile?.()):(m===`save`||m===`copy-image`)&&(d=Xt.add({type:`loading`,title:m===`save`?`Preparing ${c} download…`:`Copying image…`}),await(m===`save`?r():i()),Xt.update(d,{type:`success`,title:m===`save`?`Download started`:`Image copied`})):(await Zt(h,u?.kind===`file`?`file path`:`URL`),Xt.add({type:`success`,title:m===`copy-url`?`URL copied`:`Path copied`}))}catch(e){let t=bn({type:`error`,title:s,description:e instanceof Error?e.message:`The media action failed.`});d?Xt.update(d,t):Xt.add(t)}finally{l.current=!1}};return(0,U.jsxs)(er,{disabled:!n,open:s,onOpenChange:c,children:[(0,U.jsx)(Qn,{render:t,tabIndex:0,onContextMenu:e=>{if(e.defaultPrevented)return;e.preventDefault(),e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();f(e.clientX===0&&e.clientY===0?{x:t.left,y:t.bottom}:{x:e.clientX,y:e.clientY})},onKeyDown:e=>{if(e.defaultPrevented||!(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`))return;e.preventDefault(),e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();f({x:t.left,y:t.bottom})}}),(0,U.jsx)($n,{variant:`code`,children:d})]})}function Ea({src:e,label:t,sourceFailed:n=!1,originalUrl:r,revision:i=null,preload:a=`visible`,autoPlay:o=!1,onOpen:s,className:c,videoClassName:l,stateClassName:u,style:d,copyMarkdown:f,onRetry:p,actionsSource:m}){let h=(0,V.useRef)(null),[g,_]=(0,V.useState)(null),[v,y]=(0,V.useState)(null),[b,x]=(0,V.useState)(!1),[S,C]=(0,V.useState)(0),[w,T]=(0,V.useState)(null),E=g?.src??e,D=g===null?i:g.revision,O=E===null?n:v===E,k=(0,V.useCallback)(()=>{let e=h.current;(e===null||e.paused||e.ended)&&_(e=>e!==null&&e.revision!==i?null:e)},[i]);(0,V.useEffect)(k,[k]),(0,V.useEffect)(()=>{let e=h.current;if(!e||a===`metadata`||w===E)return;if(typeof IntersectionObserver>`u`){T(E);return}let t=!0,n=new IntersectionObserver(e=>{t&&e.some(e=>e.isIntersecting)&&(T(E),n.disconnect())},{rootMargin:`200px`});return n.observe(e),()=>{t=!1,n.disconnect()}},[E,a,w,O,S]),(0,V.useEffect)(()=>{let e=h.current;if(!e)return;let t=()=>{let t=document.fullscreenElement?.contains(e)||`webkitDisplayingFullscreen`in e&&e.webkitDisplayingFullscreen===!0;document.hidden&&!t&&e.pause()};return document.addEventListener(`visibilitychange`,t),document.addEventListener(`fullscreenchange`,t),e.addEventListener(`webkitendfullscreen`,t),()=>{document.removeEventListener(`visibilitychange`,t),document.removeEventListener(`fullscreenchange`,t),e.removeEventListener(`webkitendfullscreen`,t),e.pause()}},[E,O,S]);let A=async()=>{if(!b){x(!0);try{await p?.(),_(null),y(null),C(e=>e+1)}catch{y(E)}finally{x(!1)}}},j=(0,U.jsxs)(`span`,{className:B(`relative inline-block align-middle`,c),style:d,"data-markdown-copy":f,children:[O&&!s?(0,U.jsxs)(`span`,{role:`alert`,className:B(`flex aspect-video max-h-full min-h-28 w-full flex-col items-center justify-center gap-3 rounded-lg border border-border/40 bg-muted/40 p-4 text-center text-sm text-muted-foreground`,u),children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsx)(re,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),`Video unavailable`,t?` · ${t}`:``]}),(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[e!==null||p?(0,U.jsxs)(we,{size:`sm`,variant:`secondary`,disabled:b,onClick:()=>void A(),children:[(0,U.jsx)(ke,{}),b?`Retrying…`:`Retry video`]}):null,(0,U.jsx)(ba,{originalUrl:r,src:e??E,fileName:t})]})]}):E!==null&&!O?(0,U.jsx)(`video`,{ref:h,src:E,"aria-label":t||`Video preview`,"aria-hidden":s?!0:void 0,autoPlay:!s&&o,controls:!s,muted:s?!0:void 0,playsInline:!0,preload:a===`metadata`||w===E?`metadata`:`none`,className:B(`aspect-video max-h-full w-full bg-black object-contain`,s&&`pointer-events-none`,l),style:d,onLoadedMetadata:e=>aa(e.currentTarget),onPlay:()=>_({src:E,revision:D}),onPause:k,onEnded:k,onError:()=>{e!==null&&E!==e?_(null):y(E)}},S):(0,U.jsx)(`span`,{role:`status`,"aria-label":O?`Video preview unavailable`:`Loading video`,className:B(`block aspect-video w-full rounded-lg bg-muted/60`,u),style:d}),s?(0,U.jsx)(`button`,{type:`button`,"aria-label":t?`Play ${t}`:`Play video`,onClick:s,className:`absolute inset-0 flex cursor-pointer items-center justify-center rounded-lg focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring`,children:(0,U.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-black/50 text-white`,children:(0,U.jsx)(Pe,{"aria-hidden":!0,className:`size-4 fill-current`})})}):null]});return m?(0,U.jsx)(Ta,{source:m,children:j}):j}var Da=(0,V.createContext)(!1);function Oa(e){let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>{if(t)return t.addEventListener(`beforematch`,e),()=>t.removeEventListener(`beforematch`,e)},t[0]=e,t[1]=n),n}function ka(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&jr(e.charCodeAt(n+1))&&jr(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Aa(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function ja(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MathTypeset-CMO1aCZc.js","assets/react-BUfh6y28.js","assets/jsx-runtime-DJeoFXNw.js","assets/katex-DJhrJSbw.js","assets/MathTypeset-DEcVZfaU.css","assets/lazy--Qcevr63.js","assets/index-etcfxnIt.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,n as t,t as n}from"./react-BUfh6y28.js";import{t as r}from"./index-etcfxnIt.js";import{n as i,t as a}from"./jsx-runtime-DJeoFXNw.js";import{Ad as o,Ai as s,Al as c,At as l,Bi as u,Cc as d,Co as f,Ea as p,Ei as m,Fi as h,Gu as g,Hd as _,Hr as v,Ir as y,Ji as b,Jo as x,Js as S,Lr as C,Mt as w,Na as T,Ni as E,Nr as D,Os as O,Pf as k,Qd as A,Qu as j,Ri as M,Rl as N,Ru as P,Si as F,Ti as ee,To as te,Ua as ne,Vf as re,Wa as I,Wo as L,Xl as ie,Zn as ae,_d as oe,_i as se,ap as ce,au as le,bd as ue,bi as de,fi as R,fl as fe,fr as z,gi as pe,go as me,gs as he,gu as ge,hi as _e,ja as ve,ki as ye,kl as be,kr as xe,li as Se,mi as Ce,mr as we,mu as Te,n as Ee,no as De,np as Oe,of as ke,oi as Ae,ol as je,pu as Me,qa as Ne,qd as Pe,qs as Fe,qu as Ie,rr as Le,ru as Re,t as B,tf as ze,tp as Be,tr as Ve,ud as He,ui as Ue,un as We,vi as Ge,wa as Ke,wi as qe,ws as Je,xf as Ye,xi as Xe,xo as Ze,xt as Qe,yd as $e,yi as et,zi as tt}from"./utils-DkKLB01I.js";import{Bs as nt,Ea as rt,H as it,Ic as at,Oa as ot,Tp as st,Va as ct,W as lt,Zs as ut,en as dt,lh as ft,pn as pt,qs as mt}from"./src-R7EkrVcv.js";import{Dr as ht,Jn as gt,Sr as _t,Zn as vt,_ as yt,dr as bt,ei as xt,er as St,h as Ct,p as wt,qn as Tt,rr as Et,rt as Dt,ur as Ot}from"./runtime-BvdQMwVb.js";import{C as kt,D as At,G as jt,O as Mt,S as Nt,Y as Pt,d as Ft}from"./entities-DOpLfnwX.js";import{f as It,h as Lt,i as Rt,n as zt,s as Bt,t as Vt}from"./useRender-BP5vR6yH.js";import{A as Ht,C as Ut,G as Wt,d as Gt,f as Kt,u as qt}from"./TooltipProvider-DiV5KdTq.js";import{t as Jt}from"./link-BHR6GsRr.js";import{t as Yt}from"./useNavigate-DXSBYc-k.js";import{a as Xt,h as Zt}from"./relay-CTdDIWLg.js";import{J as Qt,K as $t,Y as en,at as tn,r as nn,s as rn}from"./useSettings-BhGGZc98.js";import{f as an}from"./server-DthHkqkT.js";import{i as on,n as sn,r as cn,s as ln,t as un}from"./session-CxeYe0sJ.js";import{n as dn}from"./query-CeIgbVxh.js";import{t as fn}from"./use-atom-command-Bsfu4mja.js";import{u as pn}from"./rightPanelStore-Bt0unAo8.js";import{a as mn,i as hn,n as gn,o as _n,r as vn,t as yn}from"./fileLinks-CJ9SYNL6.js";import{t as bn}from"./toastHelpers-DxXYm50b.js";import{A as xn,B as Sn,D as Cn,F as wn,I as Tn,L as En,M as Dn,O as On,P as kn,R as An,a as jn,j as Mn,k as Nn,l as Pn,z as Fn}from"./diffRendering-yxIsTMie.js";import{a as In,c as Ln,d as Rn,i as zn,l as Bn,n as Vn,o as Hn,r as Un,s as Wn,t as Gn,u as Kn}from"./mediaReference-D4rhlY-i.js";import{n as qn,r as Jn,t as Yn}from"./mediaSource-B03Ykm6c.js";import{o as Xn}from"./timestampFormat-Dq7sHZpd.js";import{t as Zn}from"./env-BfPir1X4.js";import{a as Qn,n as $n,t as er}from"./tooltip-CCYU8XGM.js";import{i as tr,o as nr}from"./pierre-icons-BTVgApcG.js";import{n as rr,t as ir}from"./scroll-area-D2D-AlvC.js";import{c as ar,s as or,t as sr}from"./dialog-5OaxRXCC.js";import{t as cr}from"./observeResize-BESwMMOy.js";import{s as lr,t as ur,u as dr}from"./assets-5kUNv3CS.js";import{i as fr,n as pr,t as mr}from"./assetUrls-C78a94Xu.js";import{n as hr,x as gr}from"./browserHistoryStore-DHI-0j5y.js";import{a as _r,i as vr,n as yr,r as br,t as xr}from"./openFileInPreview-XKgvCQ1z.js";import{p as Sr}from"./Icons-DmQwwfAN.js";import{t as Cr}from"./preview-5pSBET3P.js";import{o as wr,t as Tr}from"./PierreEntryIcon-UO6zY_i-.js";import{$ as Er,F as Dr,G as Or,H as kr,I as Ar,J as jr,K as Mr,O as Nr,Q as Pr,U as Fr,V as Ir,W as Lr,X as Rr,Y as zr,Z as Br,a as Vr,et as Hr,ft as Ur,i as Wr,j as Gr,k as Kr,lt as qr,nt as Jr,ot as Yr,pt as Xr,q as Zr,r as Qr,rt as $r,t as ei,tt as ti,ut as ni,w as ri,z as ii}from"./RenderErrorBoundary-CYsCxleQ.js";import{i as ai}from"./browserLinkTarget-D8HUAQg-.js";import{t as oi}from"./pullRequestIcons-1lUVOGQJ.js";import{r as si}from"./pullRequests-DrQJ8zM2.js";import{a as ci,i as li,n as ui,o as di,t as fi}from"./popover-hyDlWUPU.js";import{t as pi}from"./ProjectFavicon-CyXd4lSF.js";import{o as mi,r as hi}from"./terminal-links-BdsGDJ3O.js";import{Ao as gi,Bo as _i,Po as vi,Ro as yi,jo as bi,ko as xi,zo as Si}from"./main-C04YJQbN.js";function Ci(e,t,n,r){return{left:e,top:t,right:n,bottom:r,x:e,y:t,width:n-e,height:r-t}}function wi(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function Ti(e){let t=[],n,r=1/0,i=1/0,a=-1/0,o=-1/0;for(let s of Array.from(e).sort((e,t)=>e.top-t.top)){if(r=Math.min(r,s.left),i=Math.min(i,s.top),a=Math.max(a,s.right),o=Math.max(o,s.bottom),!n||s.top-n.top>n.height/2)t.push(wi(s));else{let e=t[t.length-1];e.left=Math.min(e.left,s.left),e.right=Math.max(e.right,s.right),e.bottom=Math.max(e.bottom,s.bottom),e.width=e.right-e.left,e.height=e.bottom-e.top}n=s}return{lines:t,fallback:Ci(r,i,a,o)}}function Ei(e,t,n){return e.findIndex(e=>t>e.left-2&&t<e.right+2&&n>e.top-2&&n<e.bottom+2)}function Di(e){return Ci(e.left,e.top,e.right,e.bottom)}function Oi(e,t,n){let{lines:r}=Ti(e.getClientRects());if(r.length<2)return;let i=Ei(r,t,n);return{x:t,y:n,lineIndex:i===-1?void 0:i,element:e}}function ki(e,t,n){let{lines:r,fallback:i}=Ti(e.getClientRects());if(r.length<2)return null;let a=n?.x,o=n?.y,s=t[0];if(n?.lineIndex!=null&&r[n.lineIndex])return Di(r[n.lineIndex]);if(a!=null&&o!=null){let e=Ei(r,a,o);if(e!==-1)return Di(r[e])}if(r.length===2&&r[0].left>r[1].right&&a!=null&&o!=null)return i;if(s===`t`||s===`b`){let e=r[0],t=r[r.length-1],n=s===`t`?e:t;return Ci(n.left,e.top,n.right,t.bottom)}let c=s===`l`,l=r[0].left,u=r[0].right,d=c?1/0:-1/0,f=r[0],p=r[0];for(let e of r){l=Math.min(l,e.left),u=Math.max(u,e.right);let t=c?e.left:e.right;c&&t<d||!c&&t>d?(d=t,f=e,p=e):t===d&&(p=e)}return Ci(l,f.top,u,p.bottom)}function Ai(e){return`contextElement`in e&&e.contextElement?e.contextElement:Ne(e)?e:void 0}function ji(e,t){function n(t){Mi(e,t.currentTarget,t.clientX,t.clientY)}function r(e){t||n(e)}return{onFocus(){e.current=void 0},onMouseEnter:n,onMouseMove:r}}function Mi(e,t,n,r){let i=Oi(t,n,r);return e.current=i,i}function Ni(e){return{name:`inline`,async fn(t){let n=t.elements.reference;if(typeof n?.getClientRects!=`function`)return{};let r=Ai(n),i=e.current,a=i?.element===n||i?.element===r?i:void 0,o=ki(n,t.placement,a);if(!o||typeof t.platform.getElementRects!=`function`)return{};let s=await t.platform.getElementRects({reference:{contextElement:r,getBoundingClientRect(){return o}},floating:t.elements.floating,strategy:t.strategy});return t.rects.reference.x===s.reference.x&&t.rects.reference.y===s.reference.y&&t.rects.reference.width===s.reference.width&&t.rects.reference.height===s.reference.height?{}:{reset:{rects:s}}}}}var V=e(n(),1),H=i(),U=e(a(),1),Pi=e(p());function Fi(e){let t=e.toLowerCase();return t.includes(`mac`)?`Reveal in Finder`:t.includes(`win`)?`Reveal in File Explorer`:`Reveal in Files`}function Ii(e){return e===`darwin`?`Reveal in Finder`:e===`windows`?`Reveal in File Explorer`:`Reveal in Files`}function Li(e){return e===`finder`?`Reveal in Finder`:e===`file-explorer`?`Reveal in File Explorer`:`Reveal in Files`}var Ri={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},zi=class{maxEntries;maxMemoryBytes;cache=new Map;totalSize=0;constructor(e,t){this.maxEntries=e,this.maxMemoryBytes=t}get(e){let t=this.cache.get(e);return t?(this.promote(e,t),t.value):null}set(e,t,n){if(n>this.maxMemoryBytes)return;let r=this.cache.get(e);r&&(this.totalSize-=r.approximateSize,this.cache.delete(e)),this.evictIfNeeded(n),this.cache.set(e,{value:t,approximateSize:n}),this.totalSize+=n}clear(){this.cache.clear(),this.totalSize=0}promote(e,t){this.cache.delete(e),this.cache.set(e,t)}evictIfNeeded(e){for(;(this.cache.size>=this.maxEntries||this.totalSize+e>this.maxMemoryBytes)&&this.cache.size>0;){let e=this.cache.keys().next().value;if(e===void 0)break;let t=this.cache.get(e);t&&(this.totalSize-=t.approximateSize),this.cache.delete(e)}}},Bi=new Map(it.map(e=>[e.id,e.label]));function Vi(e,t){return e===`file-manager`?Ee(t):Bi.get(e)??`Editor`}function Hi(e){return e===null||e===`file-manager`?`Open in editor`:`Open in ${Bi.get(e)??`Editor`}`}var Ui={mode:`local-exec`},Wi={mode:`remote-unavailable`},Gi={state:Ui,isResolved:!1};function Ki(e){try{return new URL(e).hostname}catch{return null}}function qi(e){let{target:t}=e;if(t===null)return Ui;if(t._tag===`PrimaryConnectionTarget`){if(e.isDesktopRenderer)return Ui;let n=Ki(t.httpBaseUrl);if(n!==null&&Dt(n))return Ui}else if(yt(t))return Ui;if(e.sshAlias!==null&&e.sshAlias.length>0)return{mode:`remote-links`,host:{kind:`ssh-alias`,host:e.sshAlias}};let n=e.remoteOpenTargets?.[0];return n===void 0?Wi:{mode:`remote-links`,host:n}}function Ji(e){let t=(0,H.c)(6),{presentation:n}=tn(e),r;bb0:{if(n===null){r=Gi;break bb0}let e;if(t[0]!==n.entry.profile||t[1]!==n.entry.target||t[2]!==n.serverConfig?.remoteOpenTargets){let r=ft(n.entry.profile),i=r!==null&&r._tag===`SshConnectionProfile`?r.target.alias:null;e=qi({target:n.entry.target,sshAlias:i,remoteOpenTargets:n.serverConfig?.remoteOpenTargets,isDesktopRenderer:window.desktopBridge!==void 0}),t[0]=n.entry.profile,t[1]=n.entry.target,t[2]=n.serverConfig?.remoteOpenTargets,t[3]=e}else e=t[3];let i;t[4]===e?i=t[5]:(i={state:e,isResolved:!0},t[4]=e,t[5]=i),r=i}return r}function Yi(e){return Ji(e).state}var Xi=[`vscode`],Zi=null;function Qi(){let e=(0,H.c)(2),[t,n]=(0,V.useState)(ta),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(Zi!==null)return;let e=window.desktopBridge?.probeRemoteEditors;if(e===void 0){Zi=Xi;return}let t=!1;return e().then(e=>{let r=e.filter(ea);Zi=r.length>0?r:Xi,t||n(Zi)},$i),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,V.useEffect)(r,i),t}function $i(){Zi=Xi}function ea(e){return lt.includes(e)}function ta(){return Zi??Xi}async function na(e){let t=window.desktopBridge;if(t!==void 0)try{return await t.openExternal(e)}catch{return!1}return window.location.assign(e),!0}var ra=`p4code:remote-open-hint-seen`;function ia(){let e=(0,H.c)(5),[t,n]=O(ra,!1,ut),r;e[0]===n?r=e[1]:(r=()=>n(!0),e[0]=n,e[1]=r);let i;return e[2]!==t||e[3]!==r?(i=[t,r],e[2]=t,e[3]=r,e[4]=i):i=e[4],i}function aa(e){if(e.autoplay||!e.paused||e.seeking||e.currentTime!==0||e.played.length>0||!Number.isFinite(e.duration)||e.duration<=0)return;let t=e.src.split(`#`,2)[1];if(!(t&&new URLSearchParams(t).has(`t`)))try{e.currentTime=Math.min(.1,e.duration/2)}catch{}}var oa={"open-in-preview":`open-link-in-preview`,"open-external":`open-link-external`,"copy-link":`copy-link`,"link-to-thread":`link-pull-request-to-thread`,"unlink-from-thread":`unlink-pull-request-from-thread`},sa=[{id:`open-in-preview`,label:`Open in integrated browser`},{id:`open-external`,label:`Open in system browser`},{id:`copy-link`,label:`Copy Link`}];function ca(e){let t=e.canOpenInPreview?sa:sa.filter(e=>e.id!==`open-in-preview`);return e.threadLinkAction===void 0?t:[{id:e.threadLinkAction,label:e.threadLinkAction===`link-to-thread`?`Link to thread`:`Unlink from thread`},...t]}function la(e){if(!e)return null;try{let t=new URL(e.startsWith(`//`)?`https:${e}`:e);return t.protocol!==`http:`&&t.protocol!==`https:`?null:t}catch{return null}}function ua(e){return la(e)?.href??null}function da(e){return la(e)?.hostname||null}async function fa({href:e,position:t,canOpenInPreview:n=!0,threadLinkAction:r,showContextMenu:i,openInPreview:a,openExternal:o,copyLink:s,updateThreadLink:c,reportFailure:l}){let u;try{u=await i(ca({canOpenInPreview:n,threadLinkAction:r}),t)}catch(e){l(`show-link-context-menu`,e);return}try{u===`open-in-preview`?await a(e):u===`open-external`?await o(e):u===`copy-link`?await s(e):(u===`link-to-thread`||u===`unlink-from-thread`)&&await c?.(e,u===`link-to-thread`)}catch(e){u&&l(oa[u],e)}}function pa(e){return e.startsWith(`//`)?`${typeof window<`u`&&window.location.protocol===`http:`?`http:`:`https:`}${e}`:e}function ma(e){let t=new TextEncoder;return Uint8Array.from(e.split(/(%[0-9a-f]{2})/i).flatMap(e=>/^%[0-9a-f]{2}$/i.test(e)?[Number.parseInt(e.slice(1),16)]:[...t.encode(e)]))}function ha(e){let t=e.split(`#`,1)[0]??e,n=t.indexOf(`,`),[r=``,...i]=t.slice(5,n).split(`;`),a=t.slice(n+1);try{if(n<0)throw Error(`Missing data URL payload.`);let e=i.some(e=>e.trim().toLowerCase()===`base64`)?Uint8Array.from(atob(decodeURIComponent(a)),e=>e.charCodeAt(0)):ma(a);return new Blob([e],{type:r||`text/plain`})}catch(e){throw Error(`This inline media could not be decoded.`,{cause:e})}}async function ga(e){let t=await fetch(e).catch(()=>null);if(t?.ok)return t.blob();let n=typeof window>`u`?void 0:window.desktopBridge,r=n?.readMedia&&/^https?:/i.test(e)?await n.readMedia(e).catch(()=>null):null;if(r&&r.status>=200&&r.status<300)return new Blob([new Uint8Array(r.data)],{type:r.mimeType});let i=r?.status??t?.status;throw Error(i===void 0?n?.readMedia?`The file could not be fetched. Check the connection and try again.`:`The file could not be fetched. The host may block browser access (CORS), or the connection may be unavailable.`:`The file could not be fetched (HTTP ${i}).`)}async function _a(e){if(/^data:/i.test(e))return ha(e);let t=await ga(e);if(t.type.split(`;`,1)[0]===`text/html`)throw Error(`This link returned a web page instead of media. Open the original URL.`);return t}async function va(e,t){let n=URL.createObjectURL(await _a(e));try{let e=document.createElement(`a`);e.href=n,e.download=t,e.click()}finally{setTimeout(()=>URL.revokeObjectURL(n),3e4)}}async function ya(e){let t=await _a(e);if(t.type.split(`;`,1)[0]===`image/png`)return t;let n=URL.createObjectURL(t),r=new Image;r.src=n;try{try{await r.decode()}catch(e){throw Error(`The browser could not decode this image for copying. Try saving it instead.`,{cause:e})}let{naturalWidth:e,naturalHeight:t}=r;if(e<=0||t<=0||e*t>64e6)throw Error(`This image is too large or has no usable dimensions. Try saving it instead.`);let n=document.createElement(`canvas`);n.width=e,n.height=t;let i=n.getContext(`2d`);if(!i)throw Error(`Image copying is unavailable in this browser.`);return i.drawImage(r,0,0),await new Promise((e,t)=>{n.toBlob(n=>n?e(n):t(Error(`The image could not be converted to PNG.`)),`image/png`)})}finally{URL.revokeObjectURL(n)}}function ba(e){let t=da(e.originalUrl)===null?void 0:e.originalUrl,n=t??e.src;if(!n)return null;let r=pa(n),i=!1;try{let e=new URL(r).protocol;if(e!==`http:`&&e!==`https:`&&e!==`blob:`)return null;i=e===`blob:`}catch{return null}return(0,U.jsxs)(we,{size:`sm`,variant:`secondary`,className:e.className,render:(0,U.jsx)(`a`,{href:r,target:i?void 0:`_blank`,download:i?e.fileName||!0:void 0,rel:`noopener noreferrer`}),children:[i?(0,U.jsx)(Re,{}):(0,U.jsx)(le,{}),t?`Open original`:i?`Download video`:`Open in browser`]})}function xa(e){return e.reference&&Vn(e.reference)||e.name||e.kind}function Sa(e){return e===null||ct(e,`filesystem:read`)}function Ca(e){if(e===null)return!0;let t=L.get(un.sessionStateAtom(e));return t._tag!==`Failure`&&Sa(ft(Je(t)))}function wa(e){let t=(0,H.c)(24),n=e.asset&&(e.asset.resource._tag===`workspace-file`||e.asset.resource._tag===`media-file`)?e.asset.environmentId:null,r;t[0]===n?r=t[1]:(r=n===null?null:un.sessionStateAtom(n),t[0]=n,t[1]=r);let i=dn(r),a;t[2]!==i||t[3]!==n?(a=n===null||i.error===null&&i.data!==null&&Sa(i.data),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o=a,s;t[5]===n?s=t[6]:(s=()=>{if(!Ca(n))throw Error(`This connection cannot read host files.`)},t[5]=n,t[6]=s);let c=s,l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1,refresh:!0},t[7]=l):l=t[7];let u=fr(ur.createUrl,l),d;t[8]!==c||t[9]!==u||t[10]!==e.asset||t[11]!==e.src?(d=async()=>{if(c(),!e.asset){if(!e.src)throw Error(`This media is unavailable. Try reopening the preview.`);return e.src}let{environmentId:t,resource:n}=e.asset,r=cn(t);if(!r)throw Error(`Reconnect to this environment and try again.`);let i=await u({environmentId:t,input:{resource:n}});if(i._tag===`Failure`)throw ht(i);c();let a=dr(r.httpBaseUrl,i.value.relativeUrl);if(!a)throw Error(`The environment returned an invalid media URL.`);return a},t[8]=c,t[9]=u,t[10]=e.asset,t[11]=e.src,t[12]=d):d=t[12];let f=d,p;t[13]!==f||t[14]!==e?(p=async()=>{await va(await f(),xa(e))},t[13]=f,t[14]=e,t[15]=p):p=t[15];let m=p,h;t[16]!==f||t[17]!==c?(h=async()=>{if(c(),!navigator.clipboard?.write||typeof ClipboardItem>`u`)throw Error(`Image copying is unavailable. Use a secure browser connection or save the image.`);await navigator.clipboard.write([new ClipboardItem({"image/png":f().then(ya)})])},t[16]=f,t[17]=c,t[18]=h):h=t[18];let g=h,_;return t[19]!==c||t[20]!==o||t[21]!==g||t[22]!==m?(_={save:m,copyImage:g,canReadMedia:o,assertCanReadMedia:c},t[19]=c,t[20]=o,t[21]=g,t[22]=m,t[23]=_):_=t[23],_}function Ta({source:e,children:t,showTooltip:n=!0}){let{save:r,copyImage:i,canReadMedia:a,assertCanReadMedia:o}=wa(e),[s,c]=(0,V.useState)(!1),l=(0,V.useRef)(!1),u=e.reference,d=u?.kind===`file`?u.path:u?.url??e.name,f=async t=>{let n=Qt();if(!n||l.current)return;l.current=!0,c(!1);let s=`Could not open media menu`,d;try{let c=e.kind===`image`?`image`:`video`,l=!a||e.src===null&&e.asset===void 0,f=typeof navigator<`u`&&!!navigator.clipboard?.write&&typeof ClipboardItem<`u`,p=[];u?.kind===`file`?(p.push({id:`copy-full-path`,label:`Copy full path`}),u.relativePath&&p.push({id:`copy-relative-path`,label:`Copy relative path`})):u?.kind===`url`&&p.push({id:`copy-url`,label:`Copy URL`}),e.onOpenFile&&p.push({id:`open-file`,label:`Open in file viewer`,disabled:!a}),p.push({id:`save`,label:`Save ${c}`,disabled:l}),e.kind===`image`&&p.push({id:`copy-image`,label:`Copy image`,disabled:l||!f});let m=await n.contextMenu.show(p,t);if(!m)return;s=`Could not ${p.find(e=>e.id===m)?.label.toLowerCase()??`complete media action`}`;let h=m===`copy-full-path`&&u?.kind===`file`?u.path:m===`copy-relative-path`&&u?.kind===`file`?u.relativePath:m===`copy-url`&&u?.kind===`url`?u.url:void 0;h===void 0?m===`open-file`?(o(),e.onOpenFile?.()):(m===`save`||m===`copy-image`)&&(d=Xt.add({type:`loading`,title:m===`save`?`Preparing ${c} download…`:`Copying image…`}),await(m===`save`?r():i()),Xt.update(d,{type:`success`,title:m===`save`?`Download started`:`Image copied`})):(await Zt(h,u?.kind===`file`?`file path`:`URL`),Xt.add({type:`success`,title:m===`copy-url`?`URL copied`:`Path copied`}))}catch(e){let t=bn({type:`error`,title:s,description:e instanceof Error?e.message:`The media action failed.`});d?Xt.update(d,t):Xt.add(t)}finally{l.current=!1}};return(0,U.jsxs)(er,{disabled:!n,open:s,onOpenChange:c,children:[(0,U.jsx)(Qn,{render:t,tabIndex:0,onContextMenu:e=>{if(e.defaultPrevented)return;e.preventDefault(),e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();f(e.clientX===0&&e.clientY===0?{x:t.left,y:t.bottom}:{x:e.clientX,y:e.clientY})},onKeyDown:e=>{if(e.defaultPrevented||!(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`))return;e.preventDefault(),e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();f({x:t.left,y:t.bottom})}}),(0,U.jsx)($n,{variant:`code`,children:d})]})}function Ea({src:e,label:t,sourceFailed:n=!1,originalUrl:r,revision:i=null,preload:a=`visible`,autoPlay:o=!1,onOpen:s,className:c,videoClassName:l,stateClassName:u,style:d,copyMarkdown:f,onRetry:p,actionsSource:m}){let h=(0,V.useRef)(null),[g,_]=(0,V.useState)(null),[v,y]=(0,V.useState)(null),[b,x]=(0,V.useState)(!1),[S,C]=(0,V.useState)(0),[w,T]=(0,V.useState)(null),E=g?.src??e,D=g===null?i:g.revision,O=E===null?n:v===E,k=(0,V.useCallback)(()=>{let e=h.current;(e===null||e.paused||e.ended)&&_(e=>e!==null&&e.revision!==i?null:e)},[i]);(0,V.useEffect)(k,[k]),(0,V.useEffect)(()=>{let e=h.current;if(!e||a===`metadata`||w===E)return;if(typeof IntersectionObserver>`u`){T(E);return}let t=!0,n=new IntersectionObserver(e=>{t&&e.some(e=>e.isIntersecting)&&(T(E),n.disconnect())},{rootMargin:`200px`});return n.observe(e),()=>{t=!1,n.disconnect()}},[E,a,w,O,S]),(0,V.useEffect)(()=>{let e=h.current;if(!e)return;let t=()=>{let t=document.fullscreenElement?.contains(e)||`webkitDisplayingFullscreen`in e&&e.webkitDisplayingFullscreen===!0;document.hidden&&!t&&e.pause()};return document.addEventListener(`visibilitychange`,t),document.addEventListener(`fullscreenchange`,t),e.addEventListener(`webkitendfullscreen`,t),()=>{document.removeEventListener(`visibilitychange`,t),document.removeEventListener(`fullscreenchange`,t),e.removeEventListener(`webkitendfullscreen`,t),e.pause()}},[E,O,S]);let A=async()=>{if(!b){x(!0);try{await p?.(),_(null),y(null),C(e=>e+1)}catch{y(E)}finally{x(!1)}}},j=(0,U.jsxs)(`span`,{className:B(`relative inline-block align-middle`,c),style:d,"data-markdown-copy":f,children:[O&&!s?(0,U.jsxs)(`span`,{role:`alert`,className:B(`flex aspect-video max-h-full min-h-28 w-full flex-col items-center justify-center gap-3 rounded-lg border border-border/40 bg-muted/40 p-4 text-center text-sm text-muted-foreground`,u),children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsx)(re,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),`Video unavailable`,t?` · ${t}`:``]}),(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[e!==null||p?(0,U.jsxs)(we,{size:`sm`,variant:`secondary`,disabled:b,onClick:()=>void A(),children:[(0,U.jsx)(ke,{}),b?`Retrying…`:`Retry video`]}):null,(0,U.jsx)(ba,{originalUrl:r,src:e??E,fileName:t})]})]}):E!==null&&!O?(0,U.jsx)(`video`,{ref:h,src:E,"aria-label":t||`Video preview`,"aria-hidden":s?!0:void 0,autoPlay:!s&&o,controls:!s,muted:s?!0:void 0,playsInline:!0,preload:a===`metadata`||w===E?`metadata`:`none`,className:B(`aspect-video max-h-full w-full bg-black object-contain`,s&&`pointer-events-none`,l),style:d,onLoadedMetadata:e=>aa(e.currentTarget),onPlay:()=>_({src:E,revision:D}),onPause:k,onEnded:k,onError:()=>{e!==null&&E!==e?_(null):y(E)}},S):(0,U.jsx)(`span`,{role:`status`,"aria-label":O?`Video preview unavailable`:`Loading video`,className:B(`block aspect-video w-full rounded-lg bg-muted/60`,u),style:d}),s?(0,U.jsx)(`button`,{type:`button`,"aria-label":t?`Play ${t}`:`Play video`,onClick:s,className:`absolute inset-0 flex cursor-pointer items-center justify-center rounded-lg focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring`,children:(0,U.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-black/50 text-white`,children:(0,U.jsx)(Pe,{"aria-hidden":!0,className:`size-4 fill-current`})})}):null]});return m?(0,U.jsx)(Ta,{source:m,children:j}):j}var Da=(0,V.createContext)(!1);function Oa(e){let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>{if(t)return t.addEventListener(`beforematch`,e),()=>t.removeEventListener(`beforematch`,e)},t[0]=e,t[1]=n),n}function ka(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&jr(e.charCodeAt(n+1))&&jr(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Aa(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function ja(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
3
3
  `}]}function Ma(e,t){let n=t.value?t.value+`
4
4
  `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Na(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Pa(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Fa(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=ka(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function Ia(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function La(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Ra(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function za(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ra(e,t);let i={src:ka(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function Ba(e,t){let n={src:ka(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Va(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Ha(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ra(e,t);let i={href:ka(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Ua(e,t){let n={href:ka(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Wa(e,t,n){let r=e.all(t),i=n?Ga(n):Ka(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
5
5
  `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
@@ -38,12 +38,12 @@ import{a as e,n as t,t as n}from"./react-BUfh6y28.js";import{t as r}from"./index
38
38
  `)}function Og(e){let t=document.createElement(`pre`),n=document.createElement(`code`);return n.textContent=e.trim(),t.appendChild(n),t}function kg(e){let t=document.createElement(`code`);if(t.textContent=e.getAttribute(`data-markdown-copy`)?.trim()??``,e.getAttribute(`data-markdown-math`)!==`display`)return t;let n=document.createElement(`pre`);return n.append(t),n}function Ag(e){for(let t of e.querySelectorAll(`[data-markdown-mermaid]`)){let e=t.getAttribute(`data-markdown-copy`);e!==null&&t.replaceChildren(Og(e))}for(let t of e.querySelectorAll(Cg))t.replaceWith(kg(t));for(let t of e.querySelectorAll(Zh))t.classList.contains(`chat-markdown-file-link`)||t.closest(`.chat-markdown-file-link`)?(t.getAttribute(`aria-hidden`)===`true`||t.localName===`svg`)&&t.remove():t.remove();return`<meta charset="utf-8">${e.innerHTML}`}function jg(e){let t=[],n=[];for(let r=0;r<e.rangeCount;r+=1){let i=e.getRangeAt(r);if(i.collapsed)continue;let a=document.createElement(`div`);a.appendChild(i.cloneContents());let o=i.commonAncestorContainer,s=o.nodeType===Node.ELEMENT_NODE?o:o.parentElement,c=s?.closest(`[data-markdown-mermaid]`)?.getAttribute(`data-markdown-copy`);if(c!=null){let e=c.trim();if(!e)continue;t.push(e),a.replaceChildren(Og(c)),n.push(Ag(a));continue}let l=wg(s);if(l){t.push(l.getAttribute(`data-markdown-copy`)?.trim()??``),n.push(`<meta charset="utf-8">${kg(l).outerHTML}`);continue}if(s?.closest(`pre`)){let e=i.toString();e&&(t.push(e),n.push(Ag(a)));continue}let u=xg(a);u&&(t.push(u),n.push(Ag(a)))}return t.length===0?null:{text:t.join(`
39
39
 
40
40
  `),html:n.join(``)}}function Mg(e,t){let n=[...e.querySelectorAll(`[data-assistant-citation-source]`)].find(e=>e.dataset.assistantCitationSource===t.messageId&&e.dataset.assistantCitationEnvironment===t.environmentId&&e.dataset.assistantCitationThread===t.threadId),r=n?.closest(`[data-assistant-citation-viewport]`);if(!n||!r)return null;let i=qg(n,t);return i?{source:n,range:i,viewport:r}:null}var Ng=`button, input, textarea, select, [role=button], [contenteditable], [hidden], [aria-hidden=true], script, style, template, noscript, svg`,Pg=`address, article, aside, blockquote, dd, div, dl, dt, figcaption, figure, footer, h1, h2, h3, h4, h5, h6, header, hr, li, main, nav, ol, p, pre, section, table, td, th, tr, ul`;function Fg(e){return e.replace(/\s+/g,` `)}function Ig(e,t){let n=e.charCodeAt(t-1),r=e.charCodeAt(t);return n>=55296&&n<=56319&&r>=56320&&r<=57343}function Lg(e,t,n){let r=e.slice(t,n);if(r.trim().length===0)return null;let i=Fg(e),a=Fg(e.slice(0,t)).length;t>0&&/\s/.test(e[t-1])&&/\s/.test(e[t])&&--a;let o=Fg(e.slice(0,n)).length,s=Math.max(0,a-32),c=Math.min(i.length,o+32);return Ig(i,s)&&(s+=1),Ig(i,c)&&--c,{text:r,start:a,end:o,prefix:i.slice(s,a),suffix:i.slice(o,c)}}function Rg(e,t){let n=Fg(e),r=Fg(t.text);if(r.trim().length===0)return null;let i=Fg(t.prefix),a=Fg(t.suffix),o=(e,t)=>n.slice(Math.max(0,e-i.length),e)===i&&n.slice(t,t+a.length)===a,s=Number.isSafeInteger(t.start)&&Number.isSafeInteger(t.end)&&t.start>=0&&t.end-t.start===r.length&&n.slice(t.start,t.end)===r&&o(t.start,t.end)?{start:t.start,end:t.end}:null,c=null,l=0;for(let e=n.indexOf(r);e!==-1;e=n.indexOf(r,e+1)){let t=e+r.length;if(l+=1,c={start:e,end:t},o(e,t)){if(s!==null&&s.start!==e)return null;s={start:e,end:t}}}return s??(l===1?c:null)}var zg=e=>e.nodeType===3;function Bg(e){let t=[],n=[],r=0,i=!1,a=(e,a)=>{i&&r>0&&(t.push(`
41
- `),r+=1),i=!1,n.push({node:e,start:r,end:r+a.length}),t.push(a),r+=a.length},o=e=>{if(e.nodeType===3){let t=e;t.length>0&&a(t,t.data);return}if(e.nodeType!==1)return;let t=e;if(t.matches(Ng))return;let n=t.matches(Pg);if((n||t.tagName===`BR`)&&(i=!0),t.matches(`[data-markdown-math]`))a(t,t.getAttribute(`data-markdown-copy`)?.trim()??``);else for(let e of t.childNodes)o(e);n&&(i=!0)};return o(e),{text:t.join(``),chunks:n}}function Vg(e){return(e.nodeType===1?e:e.parentElement)?.closest(Ng)??null}function Hg(e,t){return!(t.collapsed||!e.contains(t.startContainer)||!e.contains(t.endContainer)||Vg(t.startContainer)!==null||Vg(t.endContainer)!==null)}function Ug(e){let t=wg(e.parentElement)??e.parentElement,n=t?.ownerDocument?.defaultView;return!!t&&!!n&&n.getComputedStyle(t).userSelect===`none`}function Wg(e,t,n){if(!e.intersectsNode(t))return null;if(t.nodeType===3){let n=t;return(t===e.startContainer?e.startOffset:0)<(t===e.endContainer?e.endOffset:n.length)&&!Ug(n)?n:null}for(let r=n?t.lastChild:t.firstChild;r!==null;r=n?r.previousSibling:r.nextSibling){let t=Wg(e,r,n);if(t!==null)return t}return null}function Gg(e,t){if(t===null||t.isCollapsed||t.rangeCount!==1)return null;let n=t.getRangeAt(0).cloneRange(),r=Wg(n,n.commonAncestorContainer,!1),i=Wg(n,n.commonAncestorContainer,!0);if(r===null||i===null)return null;let a=r.parentElement?.closest(`[data-assistant-citation-source]`);if(!a||!e.contains(a))return null;let o=wg(r.parentElement),s=wg(i.parentElement);if(o?n.setStartBefore(o):n.setStart(r,r===n.startContainer?n.startOffset:0),s?n.setEndAfter(s):n.setEnd(i,i===n.endContainer?n.endOffset:i.length),!Hg(a,n))return null;let c=Bg(a),l=null,u=0;for(let e of c.chunks){if(!n.intersectsNode(e.node))continue;let t=n.startContainer===e.node?n.startOffset:0,r=n.endContainer===e.node?n.endOffset:e.end-e.start;t!==r&&(l??=e.start+t,u=e.start+r)}if(l===null)return null;let d=Lg(c.text,l,u);return d===null?null:{source:a,selector:d,range:n}}function Kg(e,t){let n=0;for(let r of e.matchAll(/\s+|\S+/g)){let e=/\s/.test(r[0][0]),i=e?1:r[0].length;if(t<=n+i)return r.index+(e&&t>n?r[0].length:t-n);n+=i}return e.length}function qg(e,t){if(Vg(e)!==null)return null;let n=Bg(e),r=Rg(n.text,t);if(r===null)return null;let i=Kg(n.text,r.start),a=Kg(n.text,r.end),o=n.chunks.find(e=>e.end>i),s=n.chunks.findLast(e=>e.start<a);if(o===void 0||s===void 0)return null;let c=e.ownerDocument.createRange();return zg(o.node)?c.setStart(o.node,Math.max(0,i-o.start)):c.setStartBefore(o.node),zg(s.node)?c.setEnd(s.node,Math.min(s.node.length,a-s.start)):c.setEndAfter(s.node),Hg(e,c)?c:null}var Jg=Lt(`inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] border px-[0.5em] align-middle font-medium text-[0.86em] leading-none [&_svg]:block [&_svg]:size-[1.17em] [&_svg]:shrink-0 [&_svg]:self-center [button&,a&,[data-popup-open]&]:cursor-pointer [button&,a&]:transition-colors [button&,a&]:motion-reduce:transition-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-foreground disabled:cursor-default`,{defaultVariants:{kind:`neutral`},variants:{kind:{neutral:`border-border/70 bg-accent/40 text-foreground`,image:`[--context-chip-accent:oklch(0.62_0.16_16)]`,video:`[--context-chip-accent:oklch(0.62_0.16_48)]`,file:`[--context-chip-accent:oklch(0.62_0.136_237)]`,mention:`[--context-chip-accent:oklch(0.62_0.11_215)]`,terminal:`[--context-chip-accent:oklch(0.62_0.134_163)]`,element:`[--context-chip-accent:oklch(0.62_0.134_70)]`,"preview-annotation":`[--context-chip-accent:oklch(0.62_0.134_70)]`,"review-comment":`[--context-chip-accent:oklch(0.62_0.16_292)]`,"pull-request":`[--context-chip-accent:oklch(0.62_0.16_277)]`,"pr-open":`[--context-chip-accent:oklch(0.62_0.134_163)]`,"pr-draft":`[--context-chip-accent:oklch(0.62_0.02_259)]`,"pr-merged":`[--context-chip-accent:oklch(0.62_0.16_292)]`,"pr-closed":`[--context-chip-accent:oklch(0.62_0.16_16)]`,skill:`[--context-chip-accent:oklch(0.62_0.16_322)]`,thread:`[--context-chip-accent:oklch(0.62_0.12_190)]`,environment:`[--context-chip-accent:oklch(0.62_0.11_145)]`,citation:`[--context-chip-accent:oklch(0.62_0.16_259)]`},state:{unresolved:`border-dashed`,invalid:``}},compoundVariants:[{kind:[`image`,`video`,`file`,`mention`,`terminal`,`element`,`preview-annotation`,`review-comment`,`pull-request`,`pr-open`,`pr-draft`,`pr-merged`,`pr-closed`,`skill`,`thread`,`citation`],className:`[--context-chip-border:color-mix(in_oklab,var(--context-chip-accent)_34%,var(--contrast-border))] [--context-chip-border-hover:color-mix(in_oklab,var(--context-chip-accent)_48%,var(--contrast-border))] [--context-chip-foreground:color-mix(in_oklab,var(--context-chip-accent)_22%,var(--contrast-foreground))] border-(--context-chip-border) bg-(--context-chip-accent)/11 text-(--context-chip-foreground) [button:enabled&,a&]:hover:border-(--context-chip-border-hover) [button:enabled&,a&]:hover:bg-(--context-chip-accent)/17`},{state:`unresolved`,className:`text-foreground`},{state:`invalid`,className:`border-destructive/35 bg-destructive/8 text-destructive`}]});function Yg(e){let t=(0,H.c)(9),n,r,i,a;if(t[0]!==e){let{className:o,kind:s,state:c,render:l,...u}=e;n=l;let d={className:B(Jg({kind:s,state:c}),o),"data-slot":`context-chip`,"data-state":c};a=Vt,r=`span`,i=Rt(d,u),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;return t[5]!==n||t[6]!==r||t[7]!==i?(o={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8],a(o)}function Xg(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=B(`block min-w-0 self-center truncate leading-tight`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,U.jsx)(`span`,{className:i,"data-slot":`context-chip-label`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Zg(e){let t=(0,H.c)(9),n,r,i,a;if(t[0]!==e){let{className:o,render:s,...c}=e;n=s;let l={className:B(`ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-pointer items-center justify-center rounded-sm text-current transition-colors hover:bg-(--context-chip-accent,var(--color-foreground))/17 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring motion-reduce:transition-none [&_svg]:size-[0.85em]`,o),"data-slot":`context-chip-action`,type:n?void 0:`button`};a=Vt,r=`button`,i=Rt(l,c),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;return t[5]!==n||t[6]!==r||t[7]!==i?(o={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8],a(o)}var Qg=`<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>`;function $g(e,t=36){let n=Array.from(e);if(n.length<=t)return e;if(t<=0)return``;if(t===1)return`…`;let r=t-1,i=Math.min(r-1,r>=18?14:Math.ceil(r/2)),a=r-i,o=i===0?``:n.slice(-i).join(``);return`${n.slice(0,a).join(``)}…${o}`}function e_(e){let t=(0,H.c)(34),{metadata:n}=e,r,i,a,o,s;t[0]===n?(r=t[1],i=t[2],a=t[3],o=t[4],s=t[5]):(i=ri(n),s=`max-w-80 space-y-1 overflow-hidden py-0.5 text-left`,o=`flex items-center gap-1.5 text-xs font-medium`,r=i.Icon,a=B(`size-3.5 shrink-0`,i.toneClassName),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s);let c;t[6]!==r||t[7]!==a?(c=(0,U.jsx)(r,{className:a}),t[6]=r,t[7]=a,t[8]=c):c=t[8];let l;t[9]===n.number?l=t[10]:(l=(0,U.jsxs)(`span`,{className:`text-foreground`,children:[`Pull request #`,n.number]}),t[9]=n.number,t[10]=l);let u;t[11]!==i.label||t[12]!==i.toneClassName?(u=(0,U.jsx)(`span`,{className:i.toneClassName,children:i.label}),t[11]=i.label,t[12]=i.toneClassName,t[13]=u):u=t[13];let d;t[14]!==o||t[15]!==c||t[16]!==l||t[17]!==u?(d=(0,U.jsxs)(`div`,{className:o,children:[c,l,u]}),t[14]=o,t[15]=c,t[16]=l,t[17]=u,t[18]=d):d=t[18];let f;t[19]===n.title?f=t[20]:(f=(0,U.jsx)(`div`,{className:`wrap-break-word text-foreground`,children:n.title}),t[19]=n.title,t[20]=f);let p;t[21]===n.headBranch?p=t[22]:(p=(0,U.jsx)(`code`,{className:`truncate`,children:n.headBranch}),t[21]=n.headBranch,t[22]=p);let m;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,U.jsx)(je,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[23]=m):m=t[23];let h;t[24]===n.baseBranch?h=t[25]:(h=(0,U.jsx)(`code`,{className:`truncate`,children:n.baseBranch}),t[24]=n.baseBranch,t[25]=h);let g;t[26]!==h||t[27]!==p?(g=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-secondary-label text-3xs`,children:[p,m,h]}),t[26]=h,t[27]=p,t[28]=g):g=t[28];let _;return t[29]!==g||t[30]!==s||t[31]!==d||t[32]!==f?(_=(0,U.jsxs)(`div`,{className:s,children:[d,f,g]}),t[29]=g,t[30]=s,t[31]=d,t[32]=f,t[33]=_):_=t[33],_}var t_=V.createContext(void 0);function n_(e){let t=V.useContext(t_);if(t===void 0&&!e)throw Error(It(50));return t}var r_={...pe,instantType:E(e=>e.instantType),hasViewport:E(e=>e.hasViewport)},i_=class e extends m{constructor(e,t,n=!1){let r=new se,i={...a_(),...e};i.floatingRootContext=_e(r,t,n),super(i,{popupRef:V.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r,closeDelayRef:{current:300},inlineRectCoordsRef:{current:void 0}},r_)}setOpen=(e,t)=>{let n=t.reason,r=n===me,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;let o=t.event;e&&r&&t.trigger&&`clientX`in o&&`clientY`in o&&this.context.inlineRectCoordsRef.current?.element!==t.trigger&&Mi(this.context.inlineRectCoordsRef,t.trigger,o.clientX,o.clientY),this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let r={open:e};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0),et(r,e,t.trigger),this.update(r)};r?Pi.flushSync(s):s()};static useStore(t,n){return qe(t,(t,r)=>new e(n,t,r)).store}};function a_(){return{...Ce(),instantType:void 0,hasViewport:!1}}function o_(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:i,actionsRef:a,handle:o,triggerId:s,defaultTriggerId:c=null,children:l}=e,u=i_.useStore(o?.store,{open:n,openProp:t,activeTriggerId:c,triggerIdProp:s});xe(()=>{t===void 0&&u.state.open===!1&&n===!0&&u.update({open:!0,activeTriggerId:c})}),u.useControlledProp(`openProp`,t),u.useControlledProp(`triggerIdProp`,s),u.useContextCallback(`onOpenChange`,r),u.useContextCallback(`onOpenChangeComplete`,i);let d=u.useState(`open`),f=u.useState(`activeTriggerId`),p=u.useState(`mounted`),m=u.useState(`payload`);de(u);let{forceUnmount:h}=Xe(d,u,()=>{u.context.inlineRectCoordsRef.current=void 0});ne(()=>{d&&(f??u.set(`payload`,void 0))},[u,f,d]);let g=V.useCallback(()=>{u.setOpen(!1,ve(De))},[u]);V.useImperativeHandle(a,()=>({unmount:h,close:g}),[h,g]);let _=d||p;return(0,U.jsxs)(t_.Provider,{value:u,children:[_&&(0,U.jsx)(s_,{store:u}),typeof l==`function`?l({payload:m}):l]})}function s_({store:e}){let t=e.useState(`floatingRootContext`),n=h(t),r=n.reference??Bt,i=n.trigger??Bt,a=V.useMemo(()=>Rt(Ge,n.floating),[n.floating]);return F(e,{activeTriggerProps:r,inactiveTriggerProps:i,popupProps:a}),null}var c_=ye(function(e){return n_(!0)?(0,U.jsx)(o_,{...e}):(0,U.jsx)(tt,{children:(0,U.jsx)(o_,{...e})})}),l_=V.createContext(void 0);function u_(){let e=V.useContext(l_);if(e===void 0)throw Error(It(48));return e}var d_=V.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return n_().useState(`mounted`)||n?(0,U.jsx)(l_.Provider,{value:n,children:(0,U.jsx)(Gt,{ref:t,...r})}):null}),f_=s(function(e,t){let{render:n,className:r,delay:i,closeDelay:a,id:o,payload:s,handle:c,style:l,...u}=e,d=n_(!0),p=c?.store??d;if(!p)throw Error(It(89));let m=T(o),h=p.useState(`isTriggerActive`,m),g=p.useState(`isOpenedByTrigger`,m),_=p.useState(`floatingRootContext`),v=p.context.inlineRectCoordsRef,y=V.useRef(null),b=i??600,x=a??300,{registerTrigger:S,isMountedByThisTrigger:C}=ee(m,y,p,{payload:s});ne(()=>{C&&(p.context.closeDelayRef.current=x)},[p,C,x]);let w=Se(_,{mouseOnly:!0,move:!1,handleClose:Ae(),delay:()=>({open:b,close:x}),triggerElementRef:y,isActiveTrigger:h,isClosing:()=>p.select(`transitionStatus`)===`ending`}),E=R(_,{delay:b}),D={open:g},O=p.useState(`triggerProps`,C),k=ji(v,g);return zt(`a`,e,{state:D,ref:[t,S,y],props:[w,E.reference,O,k,{id:m},u],stateAttributesMapping:f})}),p_=V.createContext(void 0);function m_(){let e=V.useContext(p_);if(e===void 0)throw Error(It(49));return e}var h_=V.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=b,style:_,...v}=e,x=n_(),S=u_(),w=u(),T=x.useState(`open`),E=x.useState(`mounted`),O=x.useState(`floatingRootContext`),k=x.useState(`instantType`),A=x.useState(`transitionStatus`),j=x.useState(`hasViewport`),N=x.context.inlineRectCoordsRef,P=y({anchor:i,floatingRootContext:O,positionMethod:a,mounted:E,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:S,nodeId:w,collisionAvoidance:g,adaptiveOrigin:j?C:void 0,inline:Ni(N)}),F=P.update;ne(()=>{T&&E&&F()},[T,E,F]);let ee={open:T,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},te=D(e,ee,{styles:P.positionerStyles,transitionStatus:A,props:v,refs:[t,x.useStateSetter(`positionerElement`)],hidden:!E,inert:!T});return(0,U.jsx)(p_.Provider,{value:P,children:(0,U.jsx)(M,{id:w,children:te})})}),g_={...Ze,...te},__=V.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=n_(),{side:s,align:c}=m_(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);Ke({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=I(()=>o.context.closeDelayRef.current);return Ue(p,{closeDelay:m}),zt(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,v(d),a],stateAttributesMapping:g_})}),v_=c_;function y_(e){let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=(0,U.jsx)(f_,{"data-slot":`preview-card-trigger`,...e}),t[0]=e,t[1]=n),n}function b_(e){let t=(0,H.c)(16),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,align:i,side:a,sideOffset:o,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?`start`:i,c=a===void 0?`top`:a,l=o===void 0?6:o,u;t[6]===n?u=t[7]:(u=B(`origin-(--transform-origin) rounded-lg border bg-popover text-popover-foreground shadow-lg outline-none transition-[scale,opacity] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0`,n),t[6]=n,t[7]=u);let d;t[8]!==r||t[9]!==u?(d=(0,U.jsx)(__,{className:u,"data-slot":`preview-card-popup`,...r}),t[8]=r,t[9]=u,t[10]=d):d=t[10];let f;return t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==d?(f=(0,U.jsx)(d_,{children:(0,U.jsx)(h_,{align:s,className:`z-[140] max-w-(--available-width)`,"data-slot":`preview-card-positioner`,side:c,sideOffset:l,children:d})}),t[11]=s,t[12]=c,t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function x_(e){let t=(0,H.c)(36),{link:n,originalUrl:r,target:i,confirmBeforeOpen:a,onOpenPullRequest:o,onOpenFallback:s,fallback:c}=e,[l,u]=(0,V.useState)(!1),d=(0,V.useRef)(null),[f,p]=(0,V.useState)(!1),m;t[0]!==l||t[1]!==i?(m=l?si.detail({environmentId:i.environmentId,input:i.input}):null,t[0]=l,t[1]=i,t[2]=m):m=t[2];let h=dn(m),g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g={reportFailure:!1,reportDefect:!1},t[3]=g):g=t[3];let _=fr(si.preview,g),v;t[4]!==a||t[5]!==n||t[6]!==s||t[7]!==o||t[8]!==r||t[9]!==_||t[10]!==f||t[11]!==i?(v=a===!0?(0,V.cloneElement)(n,{onClick:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),e.stopPropagation(),!f&&(u(!1),p(!0),_(i).then(async e=>{_t(e)||e._tag===`Success`&&o?.(e.value.url)||await s?.(r)}).catch(S_).finally(()=>p(!1))))}}):n,t[4]=a,t[5]=n,t[6]=s,t[7]=o,t[8]=r,t[9]=_,t[10]=f,t[11]=i,t[12]=v):v=t[12];let y=v,b=h.data,x=b!==null||h.error!==null&&c!==void 0,S=l&&h.error!==null&&!x,C;t[13]===b?C=t[14]:(C=b===null?null:ri({state:b.state,isDraft:b.isDraft}),t[13]=b,t[14]=C);let w=C,T=b?.author===null?`ghost`:b?.author.name&&b.author.name!==b.author.login?`${b.author.name} (@${b.author.login})`:b?.author.login??null,E;t[15]===x?E=t[16]:(E=e=>{!e&&!x&&d.current?.close()},t[15]=x,t[16]=E);let D;t[17]===y?D=t[18]:(D=(0,U.jsx)(y_,{render:(0,U.jsx)(Qn,{render:y}),delay:350,closeDelay:120}),t[17]=y,t[18]=D);let O;t[19]===r?O=t[20]:(O=(0,U.jsx)($n,{side:`top`,children:r}),t[19]=r,t[20]=O);let k;t[21]!==S||t[22]!==E||t[23]!==D||t[24]!==O?(k=(0,U.jsxs)(er,{open:S,onOpenChange:E,children:[D,O]}),t[21]=S,t[22]=E,t[23]=D,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==T||t[27]!==b||t[28]!==c||t[29]!==x||t[30]!==w?(A=x?(0,U.jsx)(b_,{align:`center`,className:`w-80 max-w-[calc(100vw-2rem)]`,children:(0,U.jsx)(`div`,{className:`p-3`,children:b===null?c:(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-2xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:b.repository}),(0,U.jsxs)(`span`,{className:`shrink-0`,children:[`#`,b.number]}),(0,U.jsx)(`span`,{"aria-hidden":!0,children:`·`}),w===null?null:(0,U.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(w.Icon,{"aria-hidden":!0,className:`size-3 ${w.toneClassName}`}),w.label]})]}),(0,U.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-snug text-foreground text-pretty`,children:b.title}),(0,U.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(Vr,{actor:b.author,className:`size-4`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:T}),(0,U.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,U.jsxs)(`span`,{className:`shrink-0`,children:[`opened `,Xn(b.createdAt)]})]})]})})}):null,t[26]=T,t[27]=b,t[28]=c,t[29]=x,t[30]=w,t[31]=A):A=t[31];let j;return t[32]!==l||t[33]!==k||t[34]!==A?(j=(0,U.jsxs)(v_,{open:l,onOpenChange:u,actionsRef:d,children:[k,A]}),t[32]=l,t[33]=k,t[34]=A,t[35]=j):j=t[35],j}function S_(e){console.error(`[pull-request-link-preview] failed to open link`,e)}var C_={open:`pr-open`,draft:`pr-draft`,merged:`pr-merged`,closed:`pr-closed`,unknown:`pull-request`};function w_(e){let t=(0,H.c)(20),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({icon:n,label:r,tooltip:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i.state===`unresolved`?`true`:void 0,s=a?0:void 0,c;t[5]===r?c=t[6]:(c=(0,U.jsx)(Xg,{children:r}),t[5]=r,t[6]=c);let l;t[7]!==n||t[8]!==i||t[9]!==o||t[10]!==s||t[11]!==c?(l=(0,U.jsxs)(Yg,{"data-context-unresolved":o,tabIndex:s,...i,children:[n,c]}),t[7]=n,t[8]=i,t[9]=o,t[10]=s,t[11]=c,t[12]=l):l=t[12];let u=l;if(!a)return u;let d;t[13]===u?d=t[14]:(d=(0,U.jsx)(Qn,{render:u}),t[13]=u,t[14]=d);let f;t[15]===a?f=t[16]:(f=(0,U.jsx)($n,{side:`top`,className:`whitespace-pre-wrap`,children:a}),t[15]=a,t[16]=f);let p;return t[17]!==d||t[18]!==f?(p=(0,U.jsxs)(er,{children:[d,f]}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function T_(e){let t=(0,H.c)(19),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,U.jsx)(`button`,{type:`button`}),t[0]=n):n=t[0];let r=`${e.accessibleLabel}. Show details`,i;t[1]!==e.copyMarkdown||t[2]!==e.kind||t[3]!==r?(i=(0,U.jsx)(Yg,{kind:e.kind,render:n,"aria-label":r,"data-markdown-copy":e.copyMarkdown}),t[1]=e.copyMarkdown,t[2]=e.kind,t[3]=r,t[4]=i):i=t[4];let a;t[5]===e.label?a=t[6]:(a=(0,U.jsx)(Xg,{children:e.label}),t[5]=e.label,t[6]=a);let o;t[7]!==e.icon||t[8]!==i||t[9]!==a?(o=(0,U.jsxs)(di,{render:i,children:[e.icon,a]}),t[7]=e.icon,t[8]=i,t[9]=a,t[10]=o):o=t[10];let s;t[11]===e.accessibleLabel?s=t[12]:(s=(0,U.jsx)(ci,{className:`sr-only`,children:e.accessibleLabel}),t[11]=e.accessibleLabel,t[12]=s);let c;t[13]!==e.children||t[14]!==s?(c=(0,U.jsxs)(li,{side:`top`,width:`lg`,padding:`compact`,children:[s,e.children]}),t[13]=e.children,t[14]=s,t[15]=c):c=t[15];let l;return t[16]!==o||t[17]!==c?(l=(0,U.jsxs)(fi,{children:[o,c]}),t[16]=o,t[17]=c,t[18]=l):l=t[18],l}function E_(e){let t=(0,H.c)(28),n=Ur(e.environmentId,e.metadata.url),r=e.metadata.state===`open`&&e.metadata.isDraft?`draft`:e.metadata.state,i=oi[r].Icon,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,U.jsx)(`button`,{type:`button`}),t[0]=a):a=t[0];let o=`Open ${e.kindLabel} ${e.label}: ${e.metadata.title}`,s;t[1]===e?s=t[2]:(s=t=>e.onOpen(t,e.metadata.url),t[1]=e,t[2]=s);let c;t[3]===i?c=t[4]:(c=(0,U.jsx)(i,{}),t[3]=i,t[4]=c);let l;t[5]===e.label?l=t[6]:(l=(0,U.jsx)(Xg,{children:e.label}),t[5]=e.label,t[6]=l);let u;t[7]!==e.copyMarkdown||t[8]!==e.kind||t[9]!==o||t[10]!==s||t[11]!==c||t[12]!==l?(u=(0,U.jsxs)(Yg,{kind:e.kind,render:a,"aria-label":o,"data-markdown-copy":e.copyMarkdown,onClick:s,children:[c,l]}),t[7]=e.copyMarkdown,t[8]=e.kind,t[9]=o,t[10]=s,t[11]=c,t[12]=l,t[13]=u):u=t[13];let d=u;if(n!==null){let r;t[14]===e.metadata?r=t[15]:(r=(0,U.jsx)(e_,{metadata:e.metadata}),t[14]=e.metadata,t[15]=r);let i;return t[16]!==d||t[17]!==n||t[18]!==e.metadata.url||t[19]!==r?(i=(0,U.jsx)(x_,{link:d,originalUrl:e.metadata.url,target:n,confirmBeforeOpen:!1,fallback:r}),t[16]=d,t[17]=n,t[18]=e.metadata.url,t[19]=r,t[20]=i):i=t[20],i}let f;t[21]===d?f=t[22]:(f=(0,U.jsx)(Qn,{render:d}),t[21]=d,t[22]=f);let p;t[23]===e.metadata?p=t[24]:(p=(0,U.jsx)($n,{side:`top`,children:(0,U.jsx)(e_,{metadata:e.metadata})}),t[23]=e.metadata,t[24]=p);let m;return t[25]!==f||t[26]!==p?(m=(0,U.jsxs)(er,{children:[f,p]}),t[25]=f,t[26]=p,t[27]=m):m=t[27],m}function D_(e){try{let t=document.createElement(`canvas`);t.width=t.height=16;let n=t.getContext(`2d`);if(!n)return;n.drawImage(e,0,0,16,16);let{data:r}=n.getImageData(0,0,16,16),i=0,a=0,o=0,s=0;for(let e=0;e<r.length;e+=4){let t=r[e+3];i+=r[e]*t,a+=r[e+1]*t,o+=r[e+2]*t,s+=t}return s===0?void 0:`rgb(${Math.round(i/s)} ${Math.round(a/s)} ${Math.round(o/s)})`}catch{return}}function O_(e){let t=(0,H.c)(32),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({name:n,previewUrl:r,size:a,suffix:s,style:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let[c,l]=(0,V.useState)(),[u,d]=(0,V.useState)(),f=c?.url===r?c?.color:void 0,p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,U.jsx)(`button`,{type:`button`}),t[7]=p):p=t[7];let m=`Image attachment, ${n}, ${a}`,h;t[8]===f?h=t[9]:(h=f?{"--context-chip-accent":f}:{},t[8]=f,t[9]=h);let _;t[10]!==o||t[11]!==h?(_={...o,...h},t[10]=o,t[11]=h,t[12]=_):_=t[12];let v=_,y;t[13]!==u||t[14]!==r?(y=r?(0,U.jsx)(`img`,{crossOrigin:u===r?void 0:`anonymous`,src:r,alt:``,className:`size-[1.17em] shrink-0 rounded-sm object-cover`,onError:()=>d(r),onLoad:e=>l({url:r,color:D_(e.currentTarget)})},r):(0,U.jsx)(g,{}),t[13]=u,t[14]=r,t[15]=y):y=t[15];let b;t[16]===n?b=t[17]:(b=$g(n),t[16]=n,t[17]=b);let x;t[18]===b?x=t[19]:(x=(0,U.jsx)(Xg,{className:`max-w-72`,children:b}),t[18]=b,t[19]=x);let S;t[20]===a?S=t[21]:(S=(0,U.jsx)(`span`,{className:`shrink-0 text-3xs text-current`,children:a}),t[20]=a,t[21]=S);let C;t[22]===s?C=t[23]:(C=s?(0,U.jsx)(`span`,{className:`text-3xs text-current`,children:s}):null,t[22]=s,t[23]=C);let w;return t[24]!==i||t[25]!==C||t[26]!==m||t[27]!==v||t[28]!==y||t[29]!==x||t[30]!==S?(w=(0,U.jsxs)(Yg,{kind:`image`,render:p,"aria-label":m,style:v,...i,children:[y,x,S,C]}),t[24]=i,t[25]=C,t[26]=m,t[27]=v,t[28]=y,t[29]=x,t[30]=S,t[31]=w):w=t[31],w}function k_(e){let t=(0,H.c)(23),n;t[0]===e?n=t[1]:(n=(0,U.jsx)(A_,{...e}),t[0]=e,t[1]=n);let r=n,i=e.unresolved?`unresolved`:e.error?`invalid`:null,a=e.isVideo?`video`:`file`,o;t[2]===i?o=t[3]:(o=i?{state:i}:{},t[2]=i,t[3]=o);let s;t[4]!==e.accessibleLabel||t[5]!==e.suffix?(s=[e.accessibleLabel,e.suffix].filter(Boolean),t[4]=e.accessibleLabel,t[5]=e.suffix,t[6]=s):s=t[6];let c=s.join(`, `),l=e.unresolved?`true`:void 0,u;t[7]!==e.copyMarkdown||t[8]!==a||t[9]!==o||t[10]!==c||t[11]!==l?(u={kind:a,...o,"aria-label":c,"data-markdown-copy":e.copyMarkdown,"data-context-unresolved":l},t[7]=e.copyMarkdown,t[8]=a,t[9]=o,t[10]=c,t[11]=l,t[12]=u):u=t[12];let d=u,f;t[13]!==d||t[14]!==r||t[15]!==e.disabled||t[16]!==e.onOpen?(f=(0,U.jsx)(Qn,{render:e.onOpen?(0,U.jsx)(Yg,{render:(0,U.jsx)(`button`,{type:`button`,disabled:e.disabled}),onClick:e.onOpen,...d,children:r}):(0,U.jsx)(Yg,{tabIndex:0,...d,children:r})}),t[13]=d,t[14]=r,t[15]=e.disabled,t[16]=e.onOpen,t[17]=f):f=t[17];let p;t[18]===e.tooltip?p=t[19]:(p=(0,U.jsx)($n,{side:`top`,className:`whitespace-pre-wrap`,children:e.tooltip}),t[18]=e.tooltip,t[19]=p);let m;return t[20]!==f||t[21]!==p?(m=(0,U.jsxs)(er,{children:[f,p]}),t[20]=f,t[21]=p,t[22]=m):m=t[22],m}function A_(e){let t=(0,H.c)(17),n;t[0]!==e.isVideo||t[1]!==e.name||t[2]!==e.theme?(n=e.isVideo?(0,U.jsx)(ge,{}):(0,U.jsx)(Tr,{pathValue:e.name,kind:`file`,theme:e.theme}),t[0]=e.isVideo,t[1]=e.name,t[2]=e.theme,t[3]=n):n=t[3];let r;t[4]===e.name?r=t[5]:(r=$g(e.name),t[4]=e.name,t[5]=r);let i;t[6]===r?i=t[7]:(i=(0,U.jsx)(Xg,{className:`max-w-72`,children:r}),t[6]=r,t[7]=i);let a;t[8]===e.size?a=t[9]:(a=(0,U.jsx)(`span`,{className:`shrink-0 text-3xs text-current`,children:e.size}),t[8]=e.size,t[9]=a);let o;t[10]===e.suffix?o=t[11]:(o=e.suffix?(0,U.jsx)(`span`,{className:`text-3xs text-current`,children:e.suffix}):null,t[10]=e.suffix,t[11]=o);let s;return t[12]!==n||t[13]!==i||t[14]!==a||t[15]!==o?(s=(0,U.jsxs)(U.Fragment,{children:[n,i,a,o]}),t[12]=n,t[13]=i,t[14]=a,t[15]=o,t[16]=s):s=t[16],s}function j_(e){let t=(0,H.c)(6),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,U.jsx)(N,{}),t[0]=n):n=t[0];let r=`Unavailable context, ${e.label}`,i;return t[1]!==e.copyMarkdown||t[2]!==e.label||t[3]!==e.tooltip||t[4]!==r?(i=(0,U.jsx)(w_,{icon:n,label:e.label,state:`unresolved`,"aria-label":r,"data-markdown-copy":e.copyMarkdown,tooltip:e.tooltip}),t[1]=e.copyMarkdown,t[2]=e.label,t[3]=e.tooltip,t[4]=r,t[5]=i):i=t[5],i}function M_(e){let t=(0,H.c)(38),{citation:n,inputRef:r,onSubmit:i,onSubmitAndSend:a,onCancel:o,onDraftChange:s}=e,[c,l]=(0,V.useState)(n.comment??``),u=c.length>pt,d;t[0]!==c||t[1]!==u||t[2]!==i?(d=()=>{u||i(c)},t[0]=c,t[1]=u,t[2]=i,t[3]=d):d=t[3];let f=d,p;t[4]!==c||t[5]!==u||t[6]!==i||t[7]!==a?(p=()=>{u||(a?a(c):i(c))},t[4]=c,t[5]=u,t[6]=i,t[7]=a,t[8]=p):p=t[8];let m=p,h;t[9]===o?h=t[10]:(h=e=>{e.stopPropagation(),!(e.nativeEvent.isComposing||e.keyCode===229)&&e.key===`Escape`&&(e.preventDefault(),o())},t[9]=o,t[10]=h);let g=u||void 0,_;t[11]===s?_=t[12]:(_=e=>{l(e.currentTarget.value),s?.(e.currentTarget.value)},t[11]=s,t[12]=_);let v;t[13]!==f||t[14]!==m?(v=e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&e.keyCode!==229&&(e.preventDefault(),e.metaKey||e.ctrlKey?m():f())},t[13]=f,t[14]=m,t[15]=v):v=t[15];let y;t[16]!==c||t[17]!==r||t[18]!==g||t[19]!==_||t[20]!==v?(y=(0,U.jsx)(`textarea`,{ref:r,"aria-label":`Comment on selected text`,"aria-description":`Enter to save the citation comment; Command/Ctrl+Enter to save and send; Shift+Enter for a new line.`,"aria-invalid":g,placeholder:`Add an optional comment...`,rows:2,className:`field-sizing-content block max-h-40 min-h-16 w-full resize-none bg-transparent px-1 py-1.5 text-base outline-none placeholder:text-muted-foreground sm:text-sm`,value:c,onChange:_,onKeyDown:v}),t[16]=c,t[17]=r,t[18]=g,t[19]=_,t[20]=v,t[21]=y):y=t[21];let b;t[22]===u?b=t[23]:(b=u?(0,U.jsxs)(`p`,{role:`status`,className:`pt-1 text-xs text-destructive`,children:[`Comments can contain up to `,pt.toLocaleString(),` `,`characters.`]}):null,t[22]=u,t[23]=b);let x;t[24]===o?x=t[25]:(x=(0,U.jsx)(we,{variant:`outline`,size:`xs`,onPointerDown:P_,onClick:o,children:`Cancel`}),t[24]=o,t[25]=x);let S=u?`Shorten comment`:`Save`,C;t[26]!==u||t[27]!==f||t[28]!==S?(C=(0,U.jsx)(we,{size:`xs`,disabled:u,onPointerDown:N_,onClick:f,children:S}),t[26]=u,t[27]=f,t[28]=S,t[29]=C):C=t[29];let w;t[30]!==C||t[31]!==x?(w=(0,U.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-2`,children:[x,C]}),t[30]=C,t[31]=x,t[32]=w):w=t[32];let T;return t[33]!==w||t[34]!==h||t[35]!==y||t[36]!==b?(T=(0,U.jsxs)(`div`,{"data-citation-comment-editor":`true`,onKeyDown:h,children:[y,b,w]}),t[33]=w,t[34]=h,t[35]=y,t[36]=b,t[37]=T):T=t[37],T}function N_(e){return e.preventDefault()}function P_(e){return e.preventDefault()}function F_({reason:e,draft:t,savedComment:n}){return e===`escape-key`||t===null||t.trim()===(n??``).trim()?{kind:`close`}:t.length>8e3?{kind:`keep-open`}:{kind:`commit`,comment:t}}var I_=650,L_=3e3,R_=`--assistant-citation-highlight-opacity`,z_=.45,B_=`p4-assistant-citation-comment`;function V_({anchor:e,citation:t,onUnavailable:n}){let{source:r,range:i,viewport:a}=e,o=typeof CSS<`u`?CSS.highlights:void 0,s=null,c=!1,l=new MutationObserver(e=>{if(c)return;let t=e.some(e=>r.contains(e.target));f(t)}),u=()=>{c||(c=!0,l.disconnect(),s&&(s.delete(i),s.size===0&&o?.get(B_)===s&&o.delete(B_)))},d=()=>{c||(u(),n())},f=e=>{if(!r.isConnected||!a.contains(r))return d(),!1;if(e||i.collapsed||!r.contains(i.startContainer)||!r.contains(i.endContainer)){let e=qg(r,t);if(!e)return d(),!1;i.setStart(e.startContainer,e.startOffset),i.setEnd(e.endContainer,e.endOffset)}return!0};if(!f(!1))return u;if(typeof Highlight<`u`&&o){let e=o.get(B_);s=e??new Highlight,s.add(i),e||o.set(B_,s)}return l.observe(a,{childList:!0,subtree:!0,characterData:!0}),u}function H_({root:e,itemKey:t,request:n,list:r}){let i=n.activationRef.current;if(i.dismissed)return;let a=r.getScrollableNode();if(!(a instanceof HTMLElement))return;let o=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,s=null,c=null,l=null,u=null,d=!1,f=!1,p=null,m=!i.scrolled,h=e=>l!==null&&e?.rangeCount===1&&e.getRangeAt(0)===l.range&&l.range.startContainer===l.snapshot.startContainer&&l.range.startOffset===l.snapshot.startOffset&&l.range.endContainer===l.snapshot.endContainer&&l.range.endOffset===l.snapshot.endOffset,g=()=>{s&&CSS.highlights.get(`p4-assistant-citation`)===s&&CSS.highlights.delete(`p4-assistant-citation`),s=null,c=null;let t=l?e.ownerDocument.getSelection():null;l&&h(t)&&t?.removeRange(l.range),l=null,delete e.dataset.citationHighlighted},_=()=>{f||(i.dismissed=!0,T())},v=()=>{if(u=null,f||i.dismissed||!e.isConnected||!a.contains(e)){g();return}if(i.pulse&&performance.now()-i.pulse.startedAt>=L_){_();return}let v=r.getState(),b=v.indexByKey(t);if(b===void 0||!(v.sizeAtIndex(b)>0))return;let x=qg(e,n.citation),S=(x??e).getBoundingClientRect();if(S.height<=0||a.clientHeight<=0)g();else{if(!i.scrolled){if(d)return;let e=a.getBoundingClientRect(),t=Math.max(0,Math.min(a.scrollHeight-a.clientHeight,v.scroll+S.top-e.top-Math.min(120,a.clientHeight/3)));if(Math.abs(t-v.scroll)>1){d=!0,r.scrollToOffset({offset:t,animated:!o}).then(()=>{d=!1,!f&&!i.dismissed&&y()},()=>{d=!1,!(f||i.dismissed)&&(i.dismissed=!0,g(),n.onComplete(),Xt.add({type:`warning`,title:`Could not open the cited response`,description:`Click the citation to try again.`}))});return}if(S.bottom<=e.top||S.top>=e.bottom)return;i.scrolled=!0,n.onComplete(),x||Xt.add({type:`warning`,title:`The quoted text has changed`,description:`Showing the source response. The saved quote is unchanged.`})}if(!x)_();else{if(typeof Highlight<`u`&&typeof CSS<`u`&&CSS.highlights)s=new Highlight(x),CSS.highlights.set(`p4-assistant-citation`,s),c=x,e.dataset.citationHighlighted=`true`;else{let t=e.ownerDocument.getSelection();if(t&&(m||h(t)))t.removeAllRanges(),t.addRange(x),l={range:t.getRangeAt(0),snapshot:x.cloneRange()},m=!1,c=x,e.dataset.citationHighlighted=`true`;else{_();return}}if(!p){let t=i.pulse??={startedAt:performance.now(),reducedMotion:o},n=e=>e/L_,r=n(2550);p=e.animate(t.reducedMotion?[{offset:0,[R_]:z_},{offset:r,[R_]:z_},{offset:1,[R_]:0}]:[{offset:0,[R_]:0},{offset:n(I_*.5),[R_]:z_},{offset:n(I_),[R_]:0},{offset:n(I_*1.5),[R_]:z_},{offset:r,[R_]:z_},{offset:1,[R_]:0}],{duration:L_,easing:`ease-in-out`}),p.id=`p4-assistant-citation-pulse`,p.currentTime=Math.max(0,performance.now()-t.startedAt),p.finished.then(_,()=>{})}}}},y=()=>{u!==null&&cancelAnimationFrame(u),u=requestAnimationFrame(v)},b=new MutationObserver(t=>{let n=c!==null&&(c.collapsed||!e.contains(c.startContainer)||!e.contains(c.endContainer));n&&(m||=l!==null&&h(e.ownerDocument.getSelection()),g()),(n||t.some(t=>e.contains(t.target)||[...t.addedNodes,...t.removedNodes].some(t=>t.contains(e))))&&y()});b.observe(a,{childList:!0,characterData:!0,subtree:!0});let x=cr([e,a],y),S=r.getState(),C=[S.listenToPosition(t,y),S.listen(`totalSize`,y),S.listen(`headerSize`,y)],w=()=>{d&&(d=!1,r.scrollToOffset({get offset(){return a.scrollTop},animated:!1}))};i.cancelScroll=w,y();let T=()=>{if(!f){f=!0,w(),p?.cancel(),u!==null&&cancelAnimationFrame(u),b.disconnect(),x();for(let e of C)e();i.cancelScroll===w&&delete i.cancelScroll,g()}};return T}function U_(e){let t=(0,H.c)(11),{messageId:n,threadRef:r,itemKey:i,request:a,listRef:o,children:s}=e,c=(0,V.useRef)(null),l,u;t[0]!==i||t[1]!==o||t[2]!==n||t[3]!==a?(l=()=>{let e=c.current,t=o.current;if(e&&t&&a&&a.citation.messageId===n)return H_({root:e,itemKey:i,request:a,list:t})},u=[i,o,n,a],t[0]=i,t[1]=o,t[2]=n,t[3]=a,t[4]=l,t[5]=u):(l=t[4],u=t[5]),(0,V.useEffect)(l,u);let d=r?.environmentId,f=r?.threadId,p;return t[6]!==s||t[7]!==n||t[8]!==d||t[9]!==f?(p=(0,U.jsx)(`div`,{ref:c,"data-assistant-citation-source":n,"data-assistant-citation-environment":d,"data-assistant-citation-thread":f,children:s}),t[6]=s,t[7]=n,t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function W_(e){let t=(0,H.c)(77),{citation:n,composer:r,commentEditor:i}=e,a=r!==void 0&&r,o=Yt(),s=(0,V.useRef)(null),c=(0,V.useRef)(null),l=(0,V.useRef)(null),[u,d]=(0,V.useState)(null),f=i?.open??!1,p=i?.sourceAnchor,m=p===u?void 0:p,h,g;t[0]===f?(h=t[1],g=t[2]):(h=()=>{f||(l.current=null)},g=[f],t[0]=f,t[1]=h,t[2]=g),(0,V.useEffect)(h,g);let v;t[3]!==n.comment||t[4]!==i?(v=e=>{let t=F_({reason:e,draft:l.current,savedComment:n.comment});return t.kind===`commit`?i?.onSave(t.comment)??!0:t.kind!==`keep-open`},t[3]=n.comment,t[4]=i,t[5]=v):v=t[5];let y=v,b;t[6]!==i||t[7]!==y||t[8]!==p?(b=()=>{p&&(y(`none`)?i?.onOpenChange(!1):d(p))},t[6]=i,t[7]=y,t[8]=p,t[9]=b):b=t[9];let x=(0,V.useEffectEvent)(b),S;t[10]!==n||t[11]!==f||t[12]!==x||t[13]!==p||t[14]!==u?(S=()=>{if(!f||p===u)return;let e=p??Mg(document,n);if(e)return V_({anchor:e,citation:n,onUnavailable:x})},t[10]=n,t[11]=f,t[12]=x,t[13]=p,t[14]=u,t[15]=S):S=t[15];let C;t[16]!==n||t[17]!==f||t[18]!==p||t[19]!==u?(C=[n,f,p,u],t[16]=n,t[17]=f,t[18]=p,t[19]=u,t[20]=C):C=t[20],(0,V.useEffect)(S,C);let w;t[21]===m?w=t[22]:(w=m?{contextElement:m.source,getBoundingClientRect:()=>{let e=m.range.getClientRects(),t=e.item(e.length-1)??m.range.getBoundingClientRect(),n=m.source.getBoundingClientRect(),r=Math.min(Math.max(t.left,n.left),n.right),i=Math.max(Math.min(t.right,n.right),r);return new DOMRect(r,t.top,i-r,t.height)}}:void 0,t[21]=m,t[22]=w);let T=w,E;t[23]===n?E=t[24]:(E=Gr(n),t[23]=n,t[24]=E);let D=E,O;t[25]!==n.environmentId||t[26]!==n.threadId?(O={environmentId:n.environmentId,threadId:n.threadId},t[25]=n.environmentId,t[26]=n.threadId,t[27]=O):O=t[27];let k;t[28]===n?k=t[29]:(k=Nr(n),t[28]=n,t[29]=k);let A;t[30]===n?A=t[31]:(A=Ar(n),t[30]=n,t[31]=A);let j;t[32]!==n||t[33]!==o?(j=e=>{e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),o(Kr(n)))},t[32]=n,t[33]=o,t[34]=j):j=t[34];let M;t[35]!==O||t[36]!==k||t[37]!==A||t[38]!==j?(M={to:`/$environmentId/$threadId`,params:O,hash:k,"data-markdown-copy":A,resetScroll:!1,onClick:j},t[35]=O,t[36]=k,t[37]=A,t[38]=j,t[39]=M):M=t[39];let N=M,P=`View cited assistant text: ${D}`,F;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,U.jsx)(ze,{"aria-hidden":`true`}),t[40]=F):F=t[40];let ee;t[41]===D?ee=t[42]:(ee=(0,U.jsx)(Xg,{className:`max-w-[16em]`,children:D}),t[41]=D,t[42]=ee);let te;t[43]!==N||t[44]!==P||t[45]!==ee?(te=(0,U.jsxs)(Jt,{...N,className:`inline-flex h-full min-w-0 items-center gap-[0.33em] rounded-sm text-inherit no-underline focus-visible:outline-2 focus-visible:outline-foreground`,"aria-label":P,children:[F,ee]}),t[43]=N,t[44]=P,t[45]=ee,t[46]=te):te=t[46];let ne=te;if(!a){let e;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(ze,{}),t[47]=e):e=t[47];let r=`Quoted assistant text: ${D}`,i;t[48]===n?i=t[49]:(i=Ar(n),t[48]=n,t[49]=i);let a;t[50]===n?a=t[51]:(a=(0,U.jsx)(K_,{citation:n}),t[50]=n,t[51]=a);let o;t[52]===N?o=t[53]:(o=(0,U.jsx)(we,{variant:`outline`,size:`sm`,render:(0,U.jsx)(Jt,{...N})}),t[52]=N,t[53]=o);let s;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,U.jsx)(fe,{"aria-hidden":`true`}),t[54]=s):s=t[54];let c;t[55]===o?c=t[56]:(c=(0,U.jsxs)(ui,{render:o,children:[s,`Go to source`]}),t[55]=o,t[56]=c);let l;t[57]!==a||t[58]!==c?(l=(0,U.jsxs)(`div`,{className:`flex max-h-[calc(var(--available-height)_-_1rem_-_2px)] flex-col items-start gap-3 p-1 text-sm`,children:[a,c]}),t[57]=a,t[58]=c,t[59]=l):l=t[59];let u;return t[60]!==D||t[61]!==r||t[62]!==i||t[63]!==l?(u=(0,U.jsx)(T_,{kind:`citation`,icon:e,label:D,accessibleLabel:r,copyMarkdown:i,children:l}),t[60]=D,t[61]=r,t[62]=i,t[63]=l,t[64]=u):u=t[64],u}let re;t[65]===n?re=t[66]:(re=Ar(n),t[65]=n,t[66]=re);let I;t[67]!==m||t[68]!==n||t[69]!==i||t[70]!==T||t[71]!==y?(I=i?(0,U.jsxs)(fi,{open:i.open,onOpenChange:(e,t)=>{!e&&!y(t.reason)?t.cancel():i.onOpenChange(e)},children:[(0,U.jsx)(di,{"aria-label":n.comment?`Edit citation comment`:`Add comment to citation`,"data-citation-comment-trigger":`true`,render:(0,U.jsx)(Zg,{}),children:(0,U.jsx)(_,{"aria-hidden":`true`})}),i.open?(0,U.jsx)(li,{...We,side:m?`bottom`:`top`,align:`end`,anchor:T,initialFocus:()=>(s.current?.focus({preventScroll:!0}),!1),finalFocus:i.onRestoreFocus?()=>{let e=document.activeElement;return(e===document.body||e!==null&&c.current?.contains(e))&&i.onRestoreFocus?.(),!1}:void 0,ref:c,"aria-label":`Edit citation comment`,width:`md`,padding:`compact`,onPointerDown:G_,children:(0,U.jsx)(M_,{citation:n,inputRef:s,onDraftChange:e=>{l.current=e,i.onDraftChange?.(e)},onSubmit:e=>i.onSave(e)?(i.onOpenChange(!1),!0):!1,...i.onSaveAndSend?{onSubmitAndSend:e=>i.onSaveAndSend?.(e)?(i.onOpenChange(!1),!0):!1}:{},onCancel:()=>{i.onCancel?i.onCancel():i.onOpenChange(!1)}},Ar(n))}):null]}):null,t[67]=m,t[68]=n,t[69]=i,t[70]=T,t[71]=y,t[72]=I):I=t[72];let L;return t[73]!==ne||t[74]!==re||t[75]!==I?(L=(0,U.jsxs)(Yg,{kind:`citation`,contentEditable:!1,"data-assistant-citation-chip":`true`,"data-markdown-copy":re,children:[ne,I]}),t[73]=ne,t[74]=re,t[75]=I,t[76]=L):L=t[76],L}function G_(e){return e.stopPropagation()}function K_(e){let t=(0,H.c)(14),{citation:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={top:!1,bottom:!1},t[0]=r):r=t[0];let[i,a]=(0,V.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{let t=e.scrollTop>1,n=e.scrollHeight-e.clientHeight-e.scrollTop>1;a(e=>e.top===t&&e.bottom===n?e:{top:t,bottom:n})},t[1]=o):o=t[1];let s=o,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>e?cr(e,()=>s(e)):void 0,t[2]=c):c=t[2];let l=c,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>s(e.currentTarget),t[3]=u):u=t[3];let d;t[4]===i?d=t[5]:(d=B(`max-h-64 min-h-0 space-y-3 self-stretch overflow-y-auto whitespace-pre-wrap wrap-break-word`,rr(i)),t[4]=i,t[5]=d);let f;t[6]===n.text?f=t[7]:(f=(0,U.jsx)(`blockquote`,{className:`border-l-2 border-border pl-3 text-muted-foreground`,children:n.text}),t[6]=n.text,t[7]=f);let p;t[8]===n.comment?p=t[9]:(p=n.comment?(0,U.jsx)(`p`,{children:n.comment}):null,t[8]=n.comment,t[9]=p);let m;return t[10]!==d||t[11]!==f||t[12]!==p?(m=(0,U.jsxs)(`div`,{ref:l,onScroll:u,className:d,children:[f,p]}),t[10]=d,t[11]=f,t[12]=p,t[13]=m):m=t[13],m}function q_(e){let t=(0,H.c)(36),n=e.link.environmentId??e.environmentId,r=dm(e.link.threadId),i;t[0]!==n||t[1]!==e.link.threadId?(i=S(n,e.link.threadId),t[0]=n,t[1]=e.link.threadId,t[2]=i):i=t[2];let a=Mt(i),o=Mt(a===null&&r!==null?S(n,r):null),s=a??o,c=s===null&&e.link.environmentId===null,l=At(c),u;t[3]!==c||t[4]!==e.link||t[5]!==l?(u=c?fm(e.link,l):null,t[3]=c,t[4]=e.link,t[5]=l,t[6]=u):u=t[6];let d=Mt(u),f=s??d,p=f?.environmentId??n,m=f?.id??e.link.threadId,h;t[7]!==p||t[8]!==f?(h=f===null?null:Fe(p,f.projectId),t[7]=p,t[8]=f,t[9]=h):h=t[9];let g=Nt(h),_;t[10]!==e.environmentId||t[11]!==e.link?(_=hm(e.link,e.environmentId),t[10]=e.environmentId,t[11]=e.link,t[12]=_):_=t[12];let v=_,y;t[13]!==e.label||t[14]!==f||t[15]!==m||t[16]!==v?(y=f?.title.trim()||e.label||(f===null?v:m),t[13]=e.label,t[14]=f,t[15]=m,t[16]=v,t[17]=y):y=t[17];let b=y,x;t[18]!==p||t[19]!==m?(x={environmentId:p,threadId:m},t[18]=p,t[19]=m,t[20]=x):x=t[20];let C=f===null?v:g?.title,w;t[21]!==p||t[22]!==e.label||t[23]!==e.link||t[24]!==f||t[25]!==m||t[26]!==b?(w=f===null?mm(e.link,e.label??void 0):mm({environmentId:p,threadId:m},b),t[21]=p,t[22]=e.label,t[23]=e.link,t[24]=f,t[25]=m,t[26]=b,t[27]=w):w=t[27];let T;t[28]===g?T=t[29]:(T=(0,U.jsx)(`span`,{className:`ms-[0.25em] me-[0.2em] inline-flex size-[14px] [vertical-align:-0.125em]`,"aria-hidden":!0,children:g===null?(0,U.jsx)($e,{className:`block size-full shrink-0`}):(0,U.jsx)(pi,{project:g,className:`size-full`})}),t[28]=g,t[29]=T);let E;return t[30]!==x||t[31]!==C||t[32]!==w||t[33]!==T||t[34]!==b?(E=(0,U.jsxs)(Jt,{to:`/$environmentId/$threadId`,params:x,title:C,"data-markdown-copy":w,children:[T,b]}),t[30]=x,t[31]=C,t[32]=w,t[33]=T,t[34]=b,t[35]=E):E=t[35],E}function J_(e){return e.displayName?.trim()||e.name}var Y_=/(^|\s)\p{Sc}(?![0-9][0-9_]*(?:[kKmMbBtT]|[eE][0-9]+)?(?:\s|$))(?=[a-zA-Z0-9:_-]*[a-zA-Z])([a-zA-Z0-9][a-zA-Z0-9:_-]*)(?=\s|$)/gu;function*X_(e,t){let n=new Map;for(let r of e.matchAll(Y_)){let e=r[2]??``;n.has(e)||n.set(e,t.find(t=>t.name===e));let i=n.get(e);i&&(yield{start:r.index+(r[1]?.length??0),end:r.index+r[0].length,skill:i,rawText:`$${e}`})}}function Z_(e){let t=(0,H.c)(6),n,r;if(t[0]!==e.skills||t[1]!==e.text){r=Symbol.for(`react.early_return_sentinel`);bb0:{let i=[],a=0;for(let{start:t,end:n,skill:r,rawText:o}of X_(e.text,e.skills))t>a&&i.push(e.text.slice(a,t)),i.push((0,U.jsx)($_,{skill:r,rawText:o},`${t}:${r.name}`)),a=n;if(a===0){let n;t[4]===e.text?n=t[5]:(n=(0,U.jsx)(U.Fragment,{children:e.text}),t[4]=e.text,t[5]=n),r=n;break bb0}a<e.text.length&&i.push(e.text.slice(a)),n=(0,U.jsx)(U.Fragment,{children:i})}t[0]=e.skills,t[1]=e.text,t[2]=n,t[3]=r}else n=t[2],r=t[3];return r===Symbol.for(`react.early_return_sentinel`)?n:r}function Q_(e,t){return V.Children.map(e,e=>{if(typeof e==`string`)return(0,U.jsx)(Z_,{text:e,skills:t});if(!(0,V.isValidElement)(e))return e;let n=typeof e.type==`string`?e.type:e.props.node?.tagName;return n===`code`||n===`a`||!(`children`in e.props)?e:(0,V.cloneElement)(e,void 0,Q_(e.props.children,t))})}function $_(e){let t=(0,H.c)(8),n=e.rawText,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,U.jsx)(ev,{}),t[0]=r):r=t[0];let i;t[1]===e.skill?i=t[2]:(i=J_(e.skill),t[1]=e.skill,t[2]=i);let a;t[3]===i?a=t[4]:(a=(0,U.jsx)(Xg,{children:i}),t[3]=i,t[4]=a);let o;return t[5]!==e.rawText||t[6]!==a?(o=(0,U.jsxs)(Yg,{kind:`skill`,"data-markdown-copy":n,children:[r,a]}),t[5]=e.rawText,t[6]=a,t[7]=o):o=t[7],o}function ev(){let e=(0,H.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`contents`,dangerouslySetInnerHTML:{__html:Qg}}),e[0]=t):t=e[0],t}var tv=(0,V.lazy)(()=>r(()=>import(`./MathTypeset-CA2nw_Ej.js`),__vite__mapDeps([0,1,2,3,4]))),nv=(0,V.memo)(function(e){let t=(0,H.c)(34),n=(0,V.useRef)(null),r=(0,V.useRef)(null),[i,a]=(0,V.useState)(!1),o,s;t[0]===e.focusable?(o=t[1],s=t[2]):(o=()=>{let t=n.current,i=r.current;if(!t||!i||e.focusable===!1)return;let o=()=>a(t.scrollWidth>t.clientWidth);return o(),cr([t,i],o)},s=[e.focusable],t[0]=e.focusable,t[1]=o,t[2]=s),(0,V.useLayoutEffect)(o,s);let c=e.focusable!==!1&&i,l;t[3]===e.tex?l=t[4]:(l=e.tex.trim(),t[3]=e.tex,t[4]=l);let u=l,d=e.display?`\\[\n${u}\n\\]`:`\\(${u}\\)`,f;t[5]===d?f=t[6]:(f=(0,U.jsx)(`span`,{className:`whitespace-pre-wrap`,children:d}),t[5]=d,t[6]=f);let p=f,m=e.display?`chat-markdown-math-display my-[0.65rem] block in-[.chat-markdown-table-container]:max-w-none in-[.chat-markdown-table-container]:overflow-visible`:`inline-block max-w-full align-middle whitespace-nowrap wrap-normal break-normal in-[.chat-markdown-table-container]:max-w-none in-[.chat-markdown-table-container]:overflow-visible`,h=e.display?`display`:`inline`,g=e.display?`${d}\n\n`:d,_=e.focusable===!1?void 0:`group`,v=e.focusable===!1?void 0:e.display?`Display equation`:`Inline equation`,y=c?0:-1,b=c?e.display?`Scroll display equation`:`Scroll inline equation`:void 0,x=e.display?`inline-block w-max min-w-full`:`inline-block w-max`,S;t[7]===u?S=t[8]:(S=[u],t[7]=u,t[8]=S);let C;t[9]!==p||t[10]!==e.display||t[11]!==u?(C=(0,U.jsx)(tv,{tex:u,display:e.display,fallback:p}),t[9]=p,t[10]=e.display,t[11]=u,t[12]=C):C=t[12];let w;t[13]!==p||t[14]!==C?(w=(0,U.jsx)(V.Suspense,{fallback:p,children:C}),t[13]=p,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==p||t[17]!==S||t[18]!==w?(T=(0,U.jsx)(ei,{resetKeys:S,fallback:p,children:w}),t[16]=p,t[17]=S,t[18]=w,t[19]=T):T=t[19];let E;t[20]!==x||t[21]!==T?(E=(0,U.jsx)(`span`,{ref:r,className:x,children:T}),t[20]=x,t[21]=T,t[22]=E):E=t[22];let D;t[23]!==b||t[24]!==E||t[25]!==y?(D=(0,U.jsx)(`span`,{ref:n,className:`block max-w-full overflow-x-auto overflow-y-hidden in-[.chat-markdown-table-container]:max-w-none in-[.chat-markdown-table-container]:overflow-visible px-0.5 py-0.75 focus-visible:outline-1 focus-visible:outline-solid focus-visible:-outline-offset-1 focus-visible:outline-border [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded [&::-webkit-scrollbar-thumb]:border [&::-webkit-scrollbar-thumb]:border-transparent [&::-webkit-scrollbar-thumb]:bg-clip-content`,tabIndex:y,"aria-label":b,children:E}),t[23]=b,t[24]=E,t[25]=y,t[26]=D):D=t[26];let O;return t[27]!==D||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(O=(0,U.jsx)(`span`,{className:m,"data-markdown-math":h,"data-markdown-copy":g,role:_,"aria-label":v,children:D}),t[27]=D,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=O):O=t[33],O}),rv=/^[.,:;!?…)\]}"'’”]+/;function iv(){let e=t=>{if(t.tagName===`pre`||!t.children)return;let n=[];for(let r of t.children){e(r);let t=n.at(-1),i=r.type===`text`&&(t?.tagName===`a`||t?.tagName===`code`)?rv.exec(r.value??``)?.[0]:void 0;if(!t||!i){n.push(r);continue}n[n.length-1]={type:`element`,tagName:`span`,properties:{className:[`has-[[data-slot=context-chip-label]]:whitespace-nowrap`]},children:[t,{type:`text`,value:i}]};let a=(r.value??``).slice(i.length);a&&n.push({...r,value:a})}t.children=n};return e}async function av(e){let t=Yn(e.source,{threadId:e.threadRef?.threadId,workspaceRoot:e.cwd,resolvedFilePath:e.resolvedFilePath});if(t===null)return null;let{kind:n,name:r,reference:i}=t,a=i?.kind===`file`?i.relativePath:void 0,o,s;if(t.access===`direct`)o=pa(t.uri);else{if(t.access===`unavailable`||!e.threadRef||!e.httpBaseUrl)throw Error(`Reconnect to this environment and open the media again.`);s={environmentId:e.threadRef.environmentId,resource:t.resource};let n=await e.createAssetUrl({environmentId:s.environmentId,input:{resource:s.resource}});if(n._tag===`Failure`)throw ht(n);let r=dr(e.httpBaseUrl,n.value.relativeUrl);if(r===null)throw Error(`The environment returned an invalid media URL.`);o=r+t.srcFragment}return{images:[{src:o,name:r,...n===`video`?{type:`video`,autoPlay:!1}:{},...t.access===`direct`&&da(t.uri)!==null?{originalUrl:t.uri}:{},...t.srcFragment?{srcFragment:t.srcFragment}:{},actionsSource:{kind:n,name:r,src:o,...i?{reference:i}:{},...s?{asset:s}:{},...a&&e.onOpenFile?{onOpenFile:()=>e.onOpenFile?.(a)}:{}}}],index:0}}function ov(e,t){return{environmentId:e,resource:{_tag:`attachment`,attachmentId:t.id,fileName:t.name,mimeType:w(t)??t.mimeType}}}function sv(e,t){if(!l(t))return null;let n=t.previewUrl??null,r=t.downloadable===!1?void 0:ov(e,t);return n===null&&r===void 0?null:{images:[{src:n,name:t.name,type:`video`,actionsSource:{kind:`video`,name:t.name,src:n,...r?{asset:r}:{}}}],index:0}}function cv(e){let t=e.images[e.index],n=t?.actionsSource?.asset;return`${t?.src??(n?JSON.stringify([n.environmentId,n.resource]):`image`)}:${e.index}`}function lv(e,t){let n=URL.createObjectURL(t);return e.src=n,()=>URL.revokeObjectURL(n)}function uv(e,t){let n=e.find(e=>e.id===t);if(n?.type===`file`&&n.file&&l(n))return{images:[{src:URL.createObjectURL(n.file),name:n.name,type:`video`}],index:0};let r=e.flatMap(e=>e.type===`image`&&e.previewUrl?[{id:e.id,src:e.previewUrl,name:e.name,source:e.source}]:[]);if(r.length===0)return null;let i=r.findIndex(e=>e.id===t);return i<0?null:{images:r.map(e=>({src:e.src,name:e.name,...e.source?.kind===`snap-shot`?{source:e.source}:{}})),index:i}}var dv=[];function fv(e){let t=e.fontStyle??0;return{...e.color?{color:e.color}:{},...t&1?{fontStyle:`italic`}:{},...t&2?{fontWeight:700}:{},...t&4?{textDecoration:`underline`}:{}}}function pv(e){let t=(0,H.c)(13),{code:n,language:r,embedded:i,theme:a,wordClassName:o}=e,s=i===void 0?dv:i,c;t[0]===r?c=t[1]:(c=vi(r),t[0]=r,t[1]=c);let l=(0,V.use)(c);for(let e of s)(0,V.use)(vi(e.language));let u;if(t[2]!==n||t[3]!==s||t[4]!==l||t[5]!==r||t[6]!==a){let e=Pn(a),i=(t,n)=>l.codeToTokens(t,{lang:n,theme:e}).tokens;u=vv(n,gv(n,i(n,r),s,i)),t[2]=n,t[3]=s,t[4]=l,t[5]=r,t[6]=a,t[7]=u}else u=t[7];let d=u,f;if(t[8]!==d||t[9]!==o){let e;t[11]===o?e=t[12]:(e=e=>{let{key:t,tokens:n,ending:r}=e;return(0,U.jsxs)(`span`,{children:[o?yv(n).map(e=>typeof e==`string`?e:(0,U.jsx)(`span`,{className:o,children:e.pieces.map(hv)},e.key)):n.map(mv),r]},t)},t[11]=o,t[12]=e),f=d.map(e),t[8]=d,t[9]=o,t[10]=f}else f=t[10];return f}function mv(e){return(0,U.jsx)(`span`,{style:fv(e),children:e.content},`${e.offset}:${e.content}`)}function hv(e){return(0,U.jsx)(`span`,{style:fv(e.token),children:e.text},e.key)}function gv(e,t,n,r){if(n.length===0)return t;let i=Array.from({length:e.length});for(let e of t.flat())i.fill(e,e.offset,e.offset+e.content.length);for(let e of n){let t;try{t=r(e.text,e.language)}catch{continue}for(let n of t.flat()){if(n.content===``)continue;let t=n.offset+n.content.length-1;i.fill(n,e.starts[n.offset],e.ends[t])}}return _v(e,i)}function _v(e,t){let n=[],r=0;for(let i of[...e.matchAll(/\r?\n/gu),void 0]){let a=i?.index??e.length,o=[];for(let n=r;n<a;){let r=t[n],i=n+1;for(;i<a&&t[i]?.color===r?.color&&t[i]?.fontStyle===r?.fontStyle;)i+=1;o.push({content:e.slice(n,i),offset:n,...r?.color?{color:r.color}:{},...r?.fontStyle?{fontStyle:r.fontStyle}:{}}),n=i}n.push(o),i&&(r=i.index+i[0].length)}return n}function vv(e,t){let n=e.match(/\r?\n/gu)??[],r=0;return t.map((e,t)=>{let i=e.map(e=>e.content).join(``),a=`${r}:${i}`,o=n[t]??``;return r+=i.length+o.length,{key:a,tokens:e,ending:o}})}function yv(e){let t=[],n=null;for(let r of e){let e=r.offset;for(let i of r.content.split(/(\s+)/u))i!==``&&(/^\s/u.test(i)?(t.push(i),n=null):(n||(n={key:String(e),pieces:[]},t.push(n)),n.pieces.push({key:String(e),text:i,token:r})),e+=i.length)}return t}var bv=`relative h-28 w-52 max-w-full overflow-hidden rounded-lg border border-border/80`;function xv(e){let t=(0,H.c)(9),{details:n,className:r}=e,{resolvedTheme:i}=$t(),a;t[0]!==n.content||t[1]!==n.format||t[2]!==i?(a=n.format===`json`?(0,U.jsx)(ei,{fallback:n.content,children:(0,U.jsx)(V.Suspense,{fallback:n.content,children:(0,U.jsx)(pv,{code:n.content,language:`json`,theme:i})})}):n.content,t[0]=n.content,t[1]=n.format,t[2]=i,t[3]=a):a=t[3];let o=a,s;t[4]===r?s=t[5]:(s=B(`overflow-auto whitespace-pre-wrap break-words font-mono focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70`,r),t[4]=r,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,U.jsx)(`pre`,{className:s,tabIndex:0,children:o}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Sv(e){if(e.accessibility?.format===`element-tree`)return{content:JSON.stringify(e.accessibility,null,2),format:`json`};let t=e.accessibility?.format===`flat-text`?e.accessibility.text.trim():e.accessibleText?.trim();return t?{content:t,format:`text`}:void 0}function Cv(e){return!!(e.accessibility||e.accessibleText?.trim())}function wv(e){let t=(0,H.c)(28),{source:n,className:r,side:i}=e,a=i===void 0?`top`:i,o;t[0]===n?o=t[1]:(o=Cv(n),t[0]=n,t[1]=o);let s=o,c=s?k:g,l;t[2]===n?l=t[3]:(l=Sv(n),t[2]=n,t[3]=l);let u=l,d=s?`Accessibility data`:`No accessibility data`,f=s?`View accessibility data`:`No accessibility data`,p;t[4]!==r||t[5]!==f?(p=(0,U.jsx)(di,{render:(0,U.jsx)(we,{"aria-label":f,className:r,onClick:Tv,size:`icon-micro`,variant:`overlay`})}),t[4]=r,t[5]=f,t[6]=p):p=t[6];let m;t[7]===c?m=t[8]:(m=(0,U.jsx)(c,{className:`size-3`,"aria-hidden":`true`}),t[7]=c,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,U.jsx)(Qn,{render:p,children:m}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let _;t[12]!==a||t[13]!==d?(_=(0,U.jsx)($n,{side:a,children:d}),t[12]=a,t[13]=d,t[14]=_):_=t[14];let v;t[15]!==h||t[16]!==_?(v=(0,U.jsxs)(er,{children:[h,_]}),t[15]=h,t[16]=_,t[17]=v):v=t[17];let y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,U.jsx)(ci,{children:`Accessibility data`}),t[18]=y):y=t[18];let b;t[19]!==u||t[20]!==s?(b=(0,U.jsxs)(`div`,{className:`max-h-[min(28rem,70vh)] space-y-2 overflow-y-auto`,children:[y,u?(0,U.jsx)(xv,{details:u,className:`max-h-64 rounded-md border border-border/70 bg-muted/45 p-2.5 text-2xs leading-4`}):s?(0,U.jsx)(`div`,{className:`rounded-md border border-border/70 bg-muted/45 p-2.5 text-muted-foreground text-xs leading-4`,children:`Structured accessibility elements were included, but they have no readable names or values.`}):(0,U.jsx)(`div`,{className:`rounded-md border border-border/70 bg-muted/45 p-2.5 text-muted-foreground text-xs leading-4`,children:`The app or capture backend did not provide verified accessibility data.`})]}),t[19]=u,t[20]=s,t[21]=b):b=t[21];let x;t[22]!==a||t[23]!==b?(x=(0,U.jsx)(li,{side:a,align:`center`,width:`md`,children:b}),t[22]=a,t[23]=b,t[24]=x):x=t[24];let S;return t[25]!==x||t[26]!==v?(S=(0,U.jsxs)(fi,{children:[v,x]}),t[25]=x,t[26]=v,t[27]=S):S=t[27],S}function Tv(e){return e.stopPropagation()}function Ev(e){let t=(0,H.c)(21),{source:n,className:r}=e,i;t[0]===r?i=t[1]:(i=B(`pointer-events-none absolute inset-x-0 bottom-0 flex min-w-0 items-center gap-1.5 bg-linear-to-t from-black/85 via-black/55 to-transparent px-2.5 pb-2 pt-6`,r),t[0]=r,t[1]=i);let a;t[2]!==n.appIconDataUrl||t[3]!==n.appName?(a=n.appIconDataUrl?(0,U.jsx)(`img`,{src:n.appIconDataUrl,alt:``,className:`size-7 shrink-0 rounded-md`}):(0,U.jsx)(`div`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md bg-white/20 text-3xs font-medium text-white uppercase`,children:n.appName.slice(0,1)}),t[2]=n.appIconDataUrl,t[3]=n.appName,t[4]=a):a=t[4];let o;t[5]===n.appName?o=t[6]:(o=(0,U.jsx)(`span`,{className:`truncate`,children:n.appName}),t[5]=n.appName,t[6]=o);let s;t[7]===n?s=t[8]:(s=(0,U.jsx)(wv,{source:n,className:`pointer-events-auto`}),t[7]=n,t[8]=s);let c;t[9]!==o||t[10]!==s?(c=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-2xs font-medium leading-3.5 text-white`,children:[o,s]}),t[9]=o,t[10]=s,t[11]=c):c=t[11];let l=n.windowTitle||`Captured window`,u;t[12]===l?u=t[13]:(u=(0,U.jsx)(`div`,{className:`truncate text-3xs leading-3.5 text-white/70`,children:l}),t[12]=l,t[13]=u);let d;t[14]!==c||t[15]!==u?(d=(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[c,u]}),t[14]=c,t[15]=u,t[16]=d):d=t[16];let f;return t[17]!==i||t[18]!==a||t[19]!==d?(f=(0,U.jsxs)(`div`,{className:i,children:[a,d]}),t[17]=i,t[18]=a,t[19]=d,t[20]=f):f=t[20],f}var Dv=8;function Ov(e){let t=(0,H.c)(44),{src:n,name:r,onError:i,ref:a}=e,o=(0,V.useRef)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={width:0,height:0},t[0]=s):s=t[0];let[c,l]=(0,V.useState)(s),[u,d]=(0,V.useState)(kv),[f,p]=(0,V.useState)(1),m=(0,V.useRef)(1),h=(0,V.useRef)(null),g=(0,V.useRef)(null),_=(0,V.useRef)(!1),[v,y]=(0,V.useState)(!1),b=Math.max(1,Math.min(u.height*.86,u.height-160)),x=Math.min(1,(u.width*.92-(u.width>=640?96:0))/(c.width||1),b/(c.height||1)),S=c.width*x*f,C=c.height*x*f,w,T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>({pan(e){let t=o.current;if(!t||m.current<=1||(e===`ArrowLeft`||e===`ArrowRight`)&&t.scrollWidth<=t.offsetWidth)return!1;bb36:switch(e){case`ArrowLeft`:t.scrollLeft-=40;break bb36;case`ArrowRight`:t.scrollLeft+=40;break bb36;case`ArrowUp`:t.scrollTop-=40;break bb36;case`ArrowDown`:t.scrollTop+=40;break bb36;default:return!1}return!0}}),T=[],t[1]=w,t[2]=T):(w=t[1],T=t[2]),(0,V.useImperativeHandle)(a,w,T);let E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=(e,t)=>{let n=o.current,r=m.current,i=Math.min(Dv,Math.max(1,e));if(!n||r===i)return;let a=n.getBoundingClientRect(),s=t?t.x-a.left:n.clientWidth/2,c=t?t.y-a.top:n.clientHeight/2;h.current={x:(n.scrollLeft+s)/r,y:(n.scrollTop+c)/r,clientX:a.left+s,clientY:a.top+c},m.current=i,p(i)},t[3]=E):E=t[3];let D=E,O,k;t[4]===f?(O=t[5],k=t[6]):(O=()=>{let e=o.current,t=h.current;if(!e||!t)return;let n=e.getBoundingClientRect();e.scrollLeft=t.x*f-(t.clientX-n.left),e.scrollTop=t.y*f-(t.clientY-n.top),h.current=null},k=[f],t[4]=f,t[5]=O,t[6]=k),(0,V.useLayoutEffect)(O,k);let A,j;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{let e=()=>{d({width:window.innerWidth,height:window.innerHeight}),D(1)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},j=[D],t[7]=A,t[8]=j):(A=t[7],j=t[8]),(0,V.useEffect)(A,j);let M,N;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>{let e=o.current;if(!e)return;let t=t=>{if(t.deltaY===0)return;t.preventDefault();let n=t.deltaY*(t.deltaMode===1?16:t.deltaMode===2?e.clientHeight:1);D(m.current*Math.exp(-n*(t.ctrlKey?.01:.002)),{x:t.clientX,y:t.clientY})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},M=[D],t[9]=M,t[10]=N):(M=t[9],N=t[10]),(0,V.useEffect)(N,M);let P=`${r}, zoomable image`,F=S||void 0,ee=C||void 0,te=f>1?v?`grabbing`:`grab`:`zoom-in`,ne;t[11]!==b||t[12]!==F||t[13]!==ee||t[14]!==te?(ne={width:F,height:ee,maxHeight:b,cursor:te},t[11]=b,t[12]=F,t[13]=ee,t[14]=te,t[15]=ne):ne=t[15];let re,I,L,ie,ae,oe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(re=e=>{_.current||e.detail>1||D(m.current>1?1:2,{x:e.clientX,y:e.clientY})},I=e=>{e.ctrlKey||e.metaKey||e.altKey||(e.key===`Enter`||e.key===` `?(e.preventDefault(),e.repeat||D(m.current>1?1:2)):e.key===`+`||e.key===`=`?(e.preventDefault(),D(m.current*1.5)):e.key===`-`?(e.preventDefault(),D(m.current/1.5)):e.key===`0`&&(e.preventDefault(),D(1)))},L=e=>{if(g.current||(_.current=!1,e.pointerType!==`mouse`||e.button!==0||m.current<=1))return;let t=e.currentTarget,n=t.getBoundingClientRect();e.clientX-n.left>=t.clientWidth||e.clientY-n.top>=t.clientHeight||(g.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,left:t.scrollLeft,top:t.scrollTop},t.setPointerCapture(e.pointerId),y(!0))},ie=e=>{let t=g.current;t&&t.pointerId===e.pointerId&&(Math.hypot(e.clientX-t.x,e.clientY-t.y)>4&&(_.current=!0),e.currentTarget.scrollLeft=t.left-(e.clientX-t.x),e.currentTarget.scrollTop=t.top-(e.clientY-t.y))},ae=e=>{g.current?.pointerId===e.pointerId&&(e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),g.current=null,y(!1))},oe=e=>{g.current?.pointerId===e.pointerId&&(g.current=null,y(!1))},t[16]=re,t[17]=I,t[18]=L,t[19]=ie,t[20]=ae,t[21]=oe):(re=t[16],I=t[17],L=t[18],ie=t[19],ae=t[20],oe=t[21]);let se;t[22]!==C||t[23]!==b||t[24]!==c.width||t[25]!==S?(se=c.width?{width:S,height:C}:{maxWidth:`var(--media-width)`,maxHeight:b},t[22]=C,t[23]=b,t[24]=c.width,t[25]=S,t[26]=se):se=t[26];let ce;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ce=e=>{l({width:e.currentTarget.naturalWidth,height:e.currentTarget.naturalHeight})},t[27]=ce):ce=t[27];let le;t[28]!==r||t[29]!==i||t[30]!==n||t[31]!==se?(le=(0,U.jsx)(`img`,{src:n,alt:r,draggable:!1,className:`block max-w-none select-none`,style:se,onLoad:ce,onError:i}),t[28]=r,t[29]=i,t[30]=n,t[31]=se,t[32]=le):le=t[32];let ue;t[33]!==P||t[34]!==ne||t[35]!==le?(ue=(0,U.jsx)(`div`,{ref:o,role:`region`,"aria-label":P,"aria-description":`Click to zoom in or return to fit. Scroll to zoom, drag to pan. Use Enter to toggle zoom, plus or minus to zoom, and 0 to fit.`,tabIndex:0,className:`max-w-[var(--media-width)] overflow-auto overscroll-contain rounded-lg bg-background shadow-2xl ring-1 ring-border/70 outline-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring`,style:ne,onClick:re,onKeyDown:I,onPointerDown:L,onPointerMove:ie,onPointerUp:ae,onLostPointerCapture:oe,children:le}),t[33]=P,t[34]=ne,t[35]=le,t[36]=ue):ue=t[36];let de;t[37]===f?de=t[38]:(de=Math.round(f*100),t[37]=f,t[38]=de);let R;t[39]===de?R=t[40]:(R=(0,U.jsxs)(`span`,{className:`sr-only`,"aria-live":`polite`,children:[de,`% zoom`]}),t[39]=de,t[40]=R);let fe;return t[41]!==ue||t[42]!==R?(fe=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[ue,R]}),t[41]=ue,t[42]=R,t[43]=fe):fe=t[43],fe}function kv(){return{width:window.innerWidth,height:window.innerHeight}}var Av=`flex aspect-auto h-48 min-h-0 w-[min(var(--media-width),32rem)] flex-col items-center justify-center gap-3 rounded-lg border border-border/70 bg-black p-6 text-center text-sm text-white shadow-2xl`;function jv(e){let t=(0,H.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,U.jsx)(`div`,{role:`alert`,className:Av,children:n}),t[0]=n,t[1]=r),r}function Mv(e){let t=(0,H.c)(7),{item:n}=e,r=n.actionsSource?.asset,i=pr(r?.environmentId??null,r?.resource??null),a=mr(r?.environmentId??null,r?.resource??null),o=r?i._tag===`Success`?i.url+(n.srcFragment??``):null:n.src,s=i._tag===`Failure`,c=n.autoPlay??!0,l=r?a:void 0,u;return t[0]!==n.name||t[1]!==n.originalUrl||t[2]!==o||t[3]!==s||t[4]!==c||t[5]!==l?(u=(0,U.jsx)(Ea,{src:o,label:n.name,sourceFailed:s,originalUrl:n.originalUrl,preload:`metadata`,autoPlay:c,className:`block max-h-[var(--media-height)] max-w-[var(--media-width)] text-center`,videoClassName:`aspect-auto max-h-[var(--media-height)] w-auto max-w-[var(--media-width)] rounded-lg border border-border/70 shadow-2xl`,stateClassName:Av,onRetry:l}),t[0]=n.name,t[1]=n.originalUrl,t[2]=o,t[3]=s,t[4]=c,t[5]=l,t[6]=u):u=t[6],u}var Nv=(0,V.memo)(function(e){let t=(0,H.c)(74),{preview:n,onClose:r}=e,[i,a]=(0,V.useState)(0),[o,s]=(0,V.useState)(null),[l,u]=(0,V.useState)(null),d=(0,V.useRef)(null),[f]=(0,V.useState)(Pv),p=(0,V.useRef)(null),m=n.images.length,h=m>0?((n.index+i)%m+m)%m:0,g=n.images[h],_;t[0]!==g?.actionsSource||t[1]!==g?.name||t[2]!==g?.src||t[3]!==g?.type?(_=g?.actionsSource??{kind:g?.type===`video`?`video`:`image`,name:g?.name??`Media`,src:g?.src??null},t[0]=g?.actionsSource,t[1]=g?.name,t[2]=g?.src,t[3]=g?.type,t[4]=_):_=t[4];let v=_,y=v.onOpenFile,b;t[5]!==r||t[6]!==y||t[7]!==v?(b=y?{...v,onOpenFile:()=>{y(),r()}}:v,t[5]=r,t[6]=y,t[7]=v,t[8]=b):b=t[8];let x=b,S;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{a(t=>t+e)},t[9]=S):S=t[9];let C=S,w=(0,V.useRef)(null),T,E;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>(w.current=document.activeElement,()=>{let e=w.current;e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}),E=[],t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,V.useEffect)(T,E);let D;t[12]===n.images.length?D=t[13]:(D=e=>{e.defaultPrevented||en()||e.target instanceof HTMLVideoElement||(d.current?.pan(e.key)?(e.preventDefault(),e.stopPropagation()):n.images.length<=1||(e.key===`ArrowLeft`?(e.preventDefault(),e.stopPropagation(),C(-1)):e.key===`ArrowRight`&&(e.preventDefault(),e.stopPropagation(),C(1))))},t[12]=n.images.length,t[13]=D);let O=D,k,A;if(t[14]===r?(k=t[15],A=t[16]):(k=()=>{let e=e=>{e.key!==`Escape`||en()||(e.preventDefault(),e.stopPropagation(),r())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},A=[r],t[14]=r,t[15]=k,t[16]=A),(0,V.useEffect)(k,A),!g)return null;let j=g.type===`video`?`video`:`image`,M;t[17]===g.originalUrl?M=t[18]:(M=g.originalUrl&&da(g.originalUrl)!==null?(0,U.jsx)(ba,{originalUrl:g.originalUrl}):null,t[17]=g.originalUrl,t[18]=M);let N=M,P;t[19]===g.source?P=t[20]:(P=g.source?Sv(g.source):void 0,t[19]=g.source,t[20]=P);let F=P,ee=!!F&&l===g.src,te=ee?`Show screenshot`:F?.format===`json`?`Show accessibility JSON`:`Show extracted text`,ne;t[21]===r?ne=t[22]:(ne=e=>{e||r()},t[21]=r,t[22]=ne);let re;t[23]===f?re=t[24]:(re=()=>f,t[23]=f,t[24]=re);let I;t[25]===r?I=t[26]:(I=e=>{e.target===e.currentTarget&&r()},t[25]=r,t[26]=I);let L;t[27]===j?L=t[28]:(L=(0,U.jsxs)(ar,{className:`sr-only`,children:[`Expanded `,j,` preview`]}),t[27]=j,t[28]=L);let ie=`Close ${j} preview`,ae;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,U.jsx)(ce,{}),t[29]=ae):ae=t[29];let oe;t[30]!==r||t[31]!==ie?(oe=(0,U.jsx)(we,{type:`button`,ref:p,size:`icon-sm`,variant:`media-close`,className:`absolute right-0 top-0 z-20`,onClick:r,"aria-label":ie,children:ae}),t[30]=r,t[31]=ie,t[32]=oe):oe=t[32];let se;t[33]===n.images.length?se=t[34]:(se=n.images.length>1&&(0,U.jsx)(we,{type:`button`,size:`icon`,variant:`media-navigation`,className:`left-0 top-auto bottom-0 translate-y-0 sm:top-1/2 sm:bottom-auto sm:-translate-y-1/2`,"aria-label":`Previous media`,onClick:()=>C(-1),children:(0,U.jsx)(be,{className:`size-5`})}),t[33]=n.images.length,t[34]=se);let le;t[35]!==F||t[36]!==o||t[37]!==h||t[38]!==g||t[39]!==N||t[40]!==ee?(le=g.type===`video`?(0,U.jsx)(Mv,{item:g},h):ee?F?(0,U.jsx)(xv,{details:F,className:`h-[min(var(--media-height),40rem)] w-[min(var(--media-width),42rem)] transition-opacity duration-140 ease-out starting:opacity-0 rounded-lg border border-border/70 bg-background p-4 text-xs leading-5 shadow-2xl motion-reduce:transition-none`}):null:g.src===null||o===g.src?(0,U.jsxs)(jv,{children:[(0,U.jsx)(`p`,{children:N?`This image could not be loaded.`:`Image unavailable. The file may have been moved or deleted.`}),N]}):(0,U.jsx)(Ov,{ref:d,src:g.src,name:g.name,onError:()=>s(g.src)},`${h}:${g.src}`),t[35]=F,t[36]=o,t[37]=h,t[38]=g,t[39]=N,t[40]=ee,t[41]=le):le=t[41];let ue=n.images.length>1?` (${h+1}/${n.images.length})`:``,de;t[42]!==g.name||t[43]!==ue?(de=(0,U.jsxs)(`span`,{className:`truncate`,"aria-live":`polite`,"aria-atomic":`true`,children:[g.name,ue]}),t[42]=g.name,t[43]=ue,t[44]=de):de=t[44];let R;t[45]!==F||t[46]!==te||t[47]!==g.source||t[48]!==g.src||t[49]!==ee?(R=F&&g.source?(0,U.jsx)(we,{"aria-label":te,"aria-pressed":ee,onClick:()=>u(ee?null:g.src),size:`icon-micro`,variant:`overlay`,children:(0,U.jsx)(qt,{className:`size-3`,"aria-hidden":`true`,icon:ee?Ht:Wt})}):g.source?(0,U.jsx)(wv,{source:g.source,side:`top`}):null,t[45]=F,t[46]=te,t[47]=g.source,t[48]=g.src,t[49]=ee,t[50]=R):R=t[50];let fe;t[51]!==de||t[52]!==R?(fe=(0,U.jsxs)(`div`,{className:`mt-2 flex max-w-[var(--media-width)] items-center justify-center gap-1.5 text-xs text-white/80 max-sm:px-10`,children:[de,R]}),t[51]=de,t[52]=R,t[53]=fe):fe=t[53];let z;t[54]!==le||t[55]!==fe?(z=(0,U.jsxs)(`div`,{className:`relative isolate z-10 flex max-h-full max-w-[var(--media-width)] flex-col items-center`,children:[le,fe]}),t[54]=le,t[55]=fe,t[56]=z):z=t[56];let pe;t[57]!==x||t[58]!==z?(pe=(0,U.jsx)(Ta,{source:x,showTooltip:!1,children:z}),t[57]=x,t[58]=z,t[59]=pe):pe=t[59];let me;t[60]===n.images.length?me=t[61]:(me=n.images.length>1&&(0,U.jsx)(we,{type:`button`,size:`icon`,variant:`media-navigation`,className:`right-0 top-auto bottom-0 translate-y-0 sm:top-1/2 sm:bottom-auto sm:-translate-y-1/2`,"aria-label":`Next media`,onClick:()=>C(1),children:(0,U.jsx)(c,{className:`size-5`})}),t[60]=n.images.length,t[61]=me);let he;t[62]!==O||t[63]!==re||t[64]!==I||t[65]!==L||t[66]!==oe||t[67]!==se||t[68]!==pe||t[69]!==me?(he=(0,U.jsxs)(or,{...We,variant:`media`,showCloseButton:!1,bottomStickOnMobile:!1,className:`row-start-1 h-full max-h-[92vh] w-[92vw] max-w-[92vw] items-center justify-center overflow-visible [--media-width:92vw] [--media-height:min(86vh,calc(100vh-160px))] sm:[--media-width:calc(92vw-96px)]`,onKeyDown:O,initialFocus:p,finalFocus:re,onClick:I,children:[L,oe,se,pe,me]}),t[62]=O,t[63]=re,t[64]=I,t[65]=L,t[66]=oe,t[67]=se,t[68]=pe,t[69]=me,t[70]=he):he=t[70];let ge;return t[71]!==ne||t[72]!==he?(ge=(0,U.jsx)(sr,{open:!0,onOpenChange:ne,children:he}),t[71]=ne,t[72]=he,t[73]=ge):ge=t[73],ge});function Pv(){return document.activeElement instanceof HTMLElement?document.activeElement:null}var Fv=new WeakMap;function Iv(e,t){let n=e.closest(`[data-image-gallery]`)??e.closest(`.chat-markdown`),r=[],i=-1;for(let a of n?.querySelectorAll(`img`)??[]){let n=Fv.get(a);if(!n)continue;let o=a.closest(`a`),s=o?.getAttribute(`href`)??``;if(o&&wt(s)!==`image`)continue;let c=da(s)===null?null:pa(s),l=Un(s),u=c?{...n,src:c,originalUrl:s,actionsSource:{kind:`image`,name:n.name,src:c,...l?{reference:l}:{}}}:n;a===e||!Fv.has(e)&&i<0&&u.src===t.src?(i=r.length,r.push(t)):r.push(u)}return i<0?{images:[t],index:0}:{images:r,index:i}}function Lv(e){let t=(0,H.c)(5),n=mi(e.environmentId,e.path,e.cwd),r=n?.kind===`directory`?`directory`:`file`,i=n?.mimeType,a;return t[0]!==e.path||t[1]!==e.theme||t[2]!==r||t[3]!==i?(a=(0,U.jsx)(Tr,{pathValue:e.path,kind:r,mimeType:i,theme:e.theme}),t[0]=e.path,t[1]=e.theme,t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Rv(e){let t=(0,H.c)(5),n=mi(e.environmentId,e.path,e.cwd),r=e.label??e.path,i;t[0]===n?i=t[1]:(i=n?.byteLength===void 0?null:` · ${wr(n.byteLength)}`,t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,U.jsxs)(U.Fragment,{children:[r,i]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function zv(e){let t=(0,H.c)(10),n;t[0]!==e.cwd||t[1]!==e.environmentId||t[2]!==e.path||t[3]!==e.theme?(n=(0,U.jsx)(Lv,{path:e.path,environmentId:e.environmentId,cwd:e.cwd,theme:e.theme}),t[0]=e.cwd,t[1]=e.environmentId,t[2]=e.path,t[3]=e.theme,t[4]=n):n=t[4];let r;t[5]===e.label?r=t[6]:(r=(0,U.jsx)(Xg,{children:e.label}),t[5]=e.label,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,U.jsxs)(U.Fragment,{children:[n,r]}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}function Bv(e){let t=e.children.find(e=>e.type===`element`&&e.tagName===`pre`);if(t?.type!==`element`)throw Error(`Missing highlighted pre element`);let n=t.children.find(e=>e.type===`element`&&e.tagName===`code`);if(n?.type!==`element`)throw Error(`Missing highlighted code element`);return n.children}function Vv(e,t,n){let r={lang:t,theme:n},i={type:`text`,value:`
41
+ `),r+=1),i=!1,n.push({node:e,start:r,end:r+a.length}),t.push(a),r+=a.length},o=e=>{if(e.nodeType===3){let t=e;t.length>0&&a(t,t.data);return}if(e.nodeType!==1)return;let t=e;if(t.matches(Ng))return;let n=t.matches(Pg);if((n||t.tagName===`BR`)&&(i=!0),t.matches(`[data-markdown-math]`))a(t,t.getAttribute(`data-markdown-copy`)?.trim()??``);else for(let e of t.childNodes)o(e);n&&(i=!0)};return o(e),{text:t.join(``),chunks:n}}function Vg(e){return(e.nodeType===1?e:e.parentElement)?.closest(Ng)??null}function Hg(e,t){return!(t.collapsed||!e.contains(t.startContainer)||!e.contains(t.endContainer)||Vg(t.startContainer)!==null||Vg(t.endContainer)!==null)}function Ug(e){let t=wg(e.parentElement)??e.parentElement,n=t?.ownerDocument?.defaultView;return!!t&&!!n&&n.getComputedStyle(t).userSelect===`none`}function Wg(e,t,n){if(!e.intersectsNode(t))return null;if(t.nodeType===3){let n=t;return(t===e.startContainer?e.startOffset:0)<(t===e.endContainer?e.endOffset:n.length)&&!Ug(n)?n:null}for(let r=n?t.lastChild:t.firstChild;r!==null;r=n?r.previousSibling:r.nextSibling){let t=Wg(e,r,n);if(t!==null)return t}return null}function Gg(e,t){if(t===null||t.isCollapsed||t.rangeCount!==1)return null;let n=t.getRangeAt(0).cloneRange(),r=Wg(n,n.commonAncestorContainer,!1),i=Wg(n,n.commonAncestorContainer,!0);if(r===null||i===null)return null;let a=r.parentElement?.closest(`[data-assistant-citation-source]`);if(!a||!e.contains(a))return null;let o=wg(r.parentElement),s=wg(i.parentElement);if(o?n.setStartBefore(o):n.setStart(r,r===n.startContainer?n.startOffset:0),s?n.setEndAfter(s):n.setEnd(i,i===n.endContainer?n.endOffset:i.length),!Hg(a,n))return null;let c=Bg(a),l=null,u=0;for(let e of c.chunks){if(!n.intersectsNode(e.node))continue;let t=n.startContainer===e.node?n.startOffset:0,r=n.endContainer===e.node?n.endOffset:e.end-e.start;t!==r&&(l??=e.start+t,u=e.start+r)}if(l===null)return null;let d=Lg(c.text,l,u);return d===null?null:{source:a,selector:d,range:n}}function Kg(e,t){let n=0;for(let r of e.matchAll(/\s+|\S+/g)){let e=/\s/.test(r[0][0]),i=e?1:r[0].length;if(t<=n+i)return r.index+(e&&t>n?r[0].length:t-n);n+=i}return e.length}function qg(e,t){if(Vg(e)!==null)return null;let n=Bg(e),r=Rg(n.text,t);if(r===null)return null;let i=Kg(n.text,r.start),a=Kg(n.text,r.end),o=n.chunks.find(e=>e.end>i),s=n.chunks.findLast(e=>e.start<a);if(o===void 0||s===void 0)return null;let c=e.ownerDocument.createRange();return zg(o.node)?c.setStart(o.node,Math.max(0,i-o.start)):c.setStartBefore(o.node),zg(s.node)?c.setEnd(s.node,Math.min(s.node.length,a-s.start)):c.setEndAfter(s.node),Hg(e,c)?c:null}var Jg=Lt(`inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] border px-[0.5em] align-middle font-medium text-[0.86em] leading-none [&_svg]:block [&_svg]:size-[1.17em] [&_svg]:shrink-0 [&_svg]:self-center [button&,a&,[data-popup-open]&]:cursor-pointer [button&,a&]:transition-colors [button&,a&]:motion-reduce:transition-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-foreground disabled:cursor-default`,{defaultVariants:{kind:`neutral`},variants:{kind:{neutral:`border-border/70 bg-accent/40 text-foreground`,image:`[--context-chip-accent:oklch(0.62_0.16_16)]`,video:`[--context-chip-accent:oklch(0.62_0.16_48)]`,file:`[--context-chip-accent:oklch(0.62_0.136_237)]`,mention:`[--context-chip-accent:oklch(0.62_0.11_215)]`,terminal:`[--context-chip-accent:oklch(0.62_0.134_163)]`,element:`[--context-chip-accent:oklch(0.62_0.134_70)]`,"preview-annotation":`[--context-chip-accent:oklch(0.62_0.134_70)]`,"review-comment":`[--context-chip-accent:oklch(0.62_0.16_292)]`,"pull-request":`[--context-chip-accent:oklch(0.62_0.16_277)]`,"pr-open":`[--context-chip-accent:oklch(0.62_0.134_163)]`,"pr-draft":`[--context-chip-accent:oklch(0.62_0.02_259)]`,"pr-merged":`[--context-chip-accent:oklch(0.62_0.16_292)]`,"pr-closed":`[--context-chip-accent:oklch(0.62_0.16_16)]`,skill:`[--context-chip-accent:oklch(0.62_0.16_322)]`,thread:`[--context-chip-accent:oklch(0.62_0.12_190)]`,environment:`[--context-chip-accent:oklch(0.62_0.11_145)]`,citation:`[--context-chip-accent:oklch(0.62_0.16_259)]`},state:{unresolved:`border-dashed`,invalid:``}},compoundVariants:[{kind:[`image`,`video`,`file`,`mention`,`terminal`,`element`,`preview-annotation`,`review-comment`,`pull-request`,`pr-open`,`pr-draft`,`pr-merged`,`pr-closed`,`skill`,`thread`,`citation`],className:`[--context-chip-border:color-mix(in_oklab,var(--context-chip-accent)_34%,var(--contrast-border))] [--context-chip-border-hover:color-mix(in_oklab,var(--context-chip-accent)_48%,var(--contrast-border))] [--context-chip-foreground:color-mix(in_oklab,var(--context-chip-accent)_22%,var(--contrast-foreground))] border-(--context-chip-border) bg-(--context-chip-accent)/11 text-(--context-chip-foreground) [button:enabled&,a&]:hover:border-(--context-chip-border-hover) [button:enabled&,a&]:hover:bg-(--context-chip-accent)/17`},{state:`unresolved`,className:`text-foreground`},{state:`invalid`,className:`border-destructive/35 bg-destructive/8 text-destructive`}]});function Yg(e){let t=(0,H.c)(9),n,r,i,a;if(t[0]!==e){let{className:o,kind:s,state:c,render:l,...u}=e;n=l;let d={className:B(Jg({kind:s,state:c}),o),"data-slot":`context-chip`,"data-state":c};a=Vt,r=`span`,i=Rt(d,u),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;return t[5]!==n||t[6]!==r||t[7]!==i?(o={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8],a(o)}function Xg(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=B(`block min-w-0 self-center truncate leading-tight`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,U.jsx)(`span`,{className:i,"data-slot":`context-chip-label`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Zg(e){let t=(0,H.c)(9),n,r,i,a;if(t[0]!==e){let{className:o,render:s,...c}=e;n=s;let l={className:B(`ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-pointer items-center justify-center rounded-sm text-current transition-colors hover:bg-(--context-chip-accent,var(--color-foreground))/17 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring motion-reduce:transition-none [&_svg]:size-[0.85em]`,o),"data-slot":`context-chip-action`,type:n?void 0:`button`};a=Vt,r=`button`,i=Rt(l,c),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;return t[5]!==n||t[6]!==r||t[7]!==i?(o={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8],a(o)}var Qg=`<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>`;function $g(e,t=36){let n=Array.from(e);if(n.length<=t)return e;if(t<=0)return``;if(t===1)return`…`;let r=t-1,i=Math.min(r-1,r>=18?14:Math.ceil(r/2)),a=r-i,o=i===0?``:n.slice(-i).join(``);return`${n.slice(0,a).join(``)}…${o}`}function e_(e){let t=(0,H.c)(34),{metadata:n}=e,r,i,a,o,s;t[0]===n?(r=t[1],i=t[2],a=t[3],o=t[4],s=t[5]):(i=ri(n),s=`max-w-80 space-y-1 overflow-hidden py-0.5 text-left`,o=`flex items-center gap-1.5 text-xs font-medium`,r=i.Icon,a=B(`size-3.5 shrink-0`,i.toneClassName),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s);let c;t[6]!==r||t[7]!==a?(c=(0,U.jsx)(r,{className:a}),t[6]=r,t[7]=a,t[8]=c):c=t[8];let l;t[9]===n.number?l=t[10]:(l=(0,U.jsxs)(`span`,{className:`text-foreground`,children:[`Pull request #`,n.number]}),t[9]=n.number,t[10]=l);let u;t[11]!==i.label||t[12]!==i.toneClassName?(u=(0,U.jsx)(`span`,{className:i.toneClassName,children:i.label}),t[11]=i.label,t[12]=i.toneClassName,t[13]=u):u=t[13];let d;t[14]!==o||t[15]!==c||t[16]!==l||t[17]!==u?(d=(0,U.jsxs)(`div`,{className:o,children:[c,l,u]}),t[14]=o,t[15]=c,t[16]=l,t[17]=u,t[18]=d):d=t[18];let f;t[19]===n.title?f=t[20]:(f=(0,U.jsx)(`div`,{className:`wrap-break-word text-foreground`,children:n.title}),t[19]=n.title,t[20]=f);let p;t[21]===n.headBranch?p=t[22]:(p=(0,U.jsx)(`code`,{className:`truncate`,children:n.headBranch}),t[21]=n.headBranch,t[22]=p);let m;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,U.jsx)(je,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[23]=m):m=t[23];let h;t[24]===n.baseBranch?h=t[25]:(h=(0,U.jsx)(`code`,{className:`truncate`,children:n.baseBranch}),t[24]=n.baseBranch,t[25]=h);let g;t[26]!==h||t[27]!==p?(g=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-secondary-label text-3xs`,children:[p,m,h]}),t[26]=h,t[27]=p,t[28]=g):g=t[28];let _;return t[29]!==g||t[30]!==s||t[31]!==d||t[32]!==f?(_=(0,U.jsxs)(`div`,{className:s,children:[d,f,g]}),t[29]=g,t[30]=s,t[31]=d,t[32]=f,t[33]=_):_=t[33],_}var t_=V.createContext(void 0);function n_(e){let t=V.useContext(t_);if(t===void 0&&!e)throw Error(It(50));return t}var r_={...pe,instantType:E(e=>e.instantType),hasViewport:E(e=>e.hasViewport)},i_=class e extends m{constructor(e,t,n=!1){let r=new se,i={...a_(),...e};i.floatingRootContext=_e(r,t,n),super(i,{popupRef:V.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r,closeDelayRef:{current:300},inlineRectCoordsRef:{current:void 0}},r_)}setOpen=(e,t)=>{let n=t.reason,r=n===me,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;let o=t.event;e&&r&&t.trigger&&`clientX`in o&&`clientY`in o&&this.context.inlineRectCoordsRef.current?.element!==t.trigger&&Mi(this.context.inlineRectCoordsRef,t.trigger,o.clientX,o.clientY),this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let r={open:e};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0),et(r,e,t.trigger),this.update(r)};r?Pi.flushSync(s):s()};static useStore(t,n){return qe(t,(t,r)=>new e(n,t,r)).store}};function a_(){return{...Ce(),instantType:void 0,hasViewport:!1}}function o_(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:i,actionsRef:a,handle:o,triggerId:s,defaultTriggerId:c=null,children:l}=e,u=i_.useStore(o?.store,{open:n,openProp:t,activeTriggerId:c,triggerIdProp:s});xe(()=>{t===void 0&&u.state.open===!1&&n===!0&&u.update({open:!0,activeTriggerId:c})}),u.useControlledProp(`openProp`,t),u.useControlledProp(`triggerIdProp`,s),u.useContextCallback(`onOpenChange`,r),u.useContextCallback(`onOpenChangeComplete`,i);let d=u.useState(`open`),f=u.useState(`activeTriggerId`),p=u.useState(`mounted`),m=u.useState(`payload`);de(u);let{forceUnmount:h}=Xe(d,u,()=>{u.context.inlineRectCoordsRef.current=void 0});ne(()=>{d&&(f??u.set(`payload`,void 0))},[u,f,d]);let g=V.useCallback(()=>{u.setOpen(!1,ve(De))},[u]);V.useImperativeHandle(a,()=>({unmount:h,close:g}),[h,g]);let _=d||p;return(0,U.jsxs)(t_.Provider,{value:u,children:[_&&(0,U.jsx)(s_,{store:u}),typeof l==`function`?l({payload:m}):l]})}function s_({store:e}){let t=e.useState(`floatingRootContext`),n=h(t),r=n.reference??Bt,i=n.trigger??Bt,a=V.useMemo(()=>Rt(Ge,n.floating),[n.floating]);return F(e,{activeTriggerProps:r,inactiveTriggerProps:i,popupProps:a}),null}var c_=ye(function(e){return n_(!0)?(0,U.jsx)(o_,{...e}):(0,U.jsx)(tt,{children:(0,U.jsx)(o_,{...e})})}),l_=V.createContext(void 0);function u_(){let e=V.useContext(l_);if(e===void 0)throw Error(It(48));return e}var d_=V.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return n_().useState(`mounted`)||n?(0,U.jsx)(l_.Provider,{value:n,children:(0,U.jsx)(Gt,{ref:t,...r})}):null}),f_=s(function(e,t){let{render:n,className:r,delay:i,closeDelay:a,id:o,payload:s,handle:c,style:l,...u}=e,d=n_(!0),p=c?.store??d;if(!p)throw Error(It(89));let m=T(o),h=p.useState(`isTriggerActive`,m),g=p.useState(`isOpenedByTrigger`,m),_=p.useState(`floatingRootContext`),v=p.context.inlineRectCoordsRef,y=V.useRef(null),b=i??600,x=a??300,{registerTrigger:S,isMountedByThisTrigger:C}=ee(m,y,p,{payload:s});ne(()=>{C&&(p.context.closeDelayRef.current=x)},[p,C,x]);let w=Se(_,{mouseOnly:!0,move:!1,handleClose:Ae(),delay:()=>({open:b,close:x}),triggerElementRef:y,isActiveTrigger:h,isClosing:()=>p.select(`transitionStatus`)===`ending`}),E=R(_,{delay:b}),D={open:g},O=p.useState(`triggerProps`,C),k=ji(v,g);return zt(`a`,e,{state:D,ref:[t,S,y],props:[w,E.reference,O,k,{id:m},u],stateAttributesMapping:f})}),p_=V.createContext(void 0);function m_(){let e=V.useContext(p_);if(e===void 0)throw Error(It(49));return e}var h_=V.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=b,style:_,...v}=e,x=n_(),S=u_(),w=u(),T=x.useState(`open`),E=x.useState(`mounted`),O=x.useState(`floatingRootContext`),k=x.useState(`instantType`),A=x.useState(`transitionStatus`),j=x.useState(`hasViewport`),N=x.context.inlineRectCoordsRef,P=y({anchor:i,floatingRootContext:O,positionMethod:a,mounted:E,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:S,nodeId:w,collisionAvoidance:g,adaptiveOrigin:j?C:void 0,inline:Ni(N)}),F=P.update;ne(()=>{T&&E&&F()},[T,E,F]);let ee={open:T,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},te=D(e,ee,{styles:P.positionerStyles,transitionStatus:A,props:v,refs:[t,x.useStateSetter(`positionerElement`)],hidden:!E,inert:!T});return(0,U.jsx)(p_.Provider,{value:P,children:(0,U.jsx)(M,{id:w,children:te})})}),g_={...Ze,...te},__=V.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=n_(),{side:s,align:c}=m_(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);Ke({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=I(()=>o.context.closeDelayRef.current);return Ue(p,{closeDelay:m}),zt(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,v(d),a],stateAttributesMapping:g_})}),v_=c_;function y_(e){let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=(0,U.jsx)(f_,{"data-slot":`preview-card-trigger`,...e}),t[0]=e,t[1]=n),n}function b_(e){let t=(0,H.c)(16),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,align:i,side:a,sideOffset:o,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?`start`:i,c=a===void 0?`top`:a,l=o===void 0?6:o,u;t[6]===n?u=t[7]:(u=B(`origin-(--transform-origin) rounded-lg border bg-popover text-popover-foreground shadow-lg outline-none transition-[scale,opacity] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0`,n),t[6]=n,t[7]=u);let d;t[8]!==r||t[9]!==u?(d=(0,U.jsx)(__,{className:u,"data-slot":`preview-card-popup`,...r}),t[8]=r,t[9]=u,t[10]=d):d=t[10];let f;return t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==d?(f=(0,U.jsx)(d_,{children:(0,U.jsx)(h_,{align:s,className:`z-[140] max-w-(--available-width)`,"data-slot":`preview-card-positioner`,side:c,sideOffset:l,children:d})}),t[11]=s,t[12]=c,t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function x_(e){let t=(0,H.c)(36),{link:n,originalUrl:r,target:i,confirmBeforeOpen:a,onOpenPullRequest:o,onOpenFallback:s,fallback:c}=e,[l,u]=(0,V.useState)(!1),d=(0,V.useRef)(null),[f,p]=(0,V.useState)(!1),m;t[0]!==l||t[1]!==i?(m=l?si.detail({environmentId:i.environmentId,input:i.input}):null,t[0]=l,t[1]=i,t[2]=m):m=t[2];let h=dn(m),g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g={reportFailure:!1,reportDefect:!1},t[3]=g):g=t[3];let _=fr(si.preview,g),v;t[4]!==a||t[5]!==n||t[6]!==s||t[7]!==o||t[8]!==r||t[9]!==_||t[10]!==f||t[11]!==i?(v=a===!0?(0,V.cloneElement)(n,{onClick:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),e.stopPropagation(),!f&&(u(!1),p(!0),_(i).then(async e=>{_t(e)||e._tag===`Success`&&o?.(e.value.url)||await s?.(r)}).catch(S_).finally(()=>p(!1))))}}):n,t[4]=a,t[5]=n,t[6]=s,t[7]=o,t[8]=r,t[9]=_,t[10]=f,t[11]=i,t[12]=v):v=t[12];let y=v,b=h.data,x=b!==null||h.error!==null&&c!==void 0,S=l&&h.error!==null&&!x,C;t[13]===b?C=t[14]:(C=b===null?null:ri({state:b.state,isDraft:b.isDraft}),t[13]=b,t[14]=C);let w=C,T=b?.author===null?`ghost`:b?.author.name&&b.author.name!==b.author.login?`${b.author.name} (@${b.author.login})`:b?.author.login??null,E;t[15]===x?E=t[16]:(E=e=>{!e&&!x&&d.current?.close()},t[15]=x,t[16]=E);let D;t[17]===y?D=t[18]:(D=(0,U.jsx)(y_,{render:(0,U.jsx)(Qn,{render:y}),delay:350,closeDelay:120}),t[17]=y,t[18]=D);let O;t[19]===r?O=t[20]:(O=(0,U.jsx)($n,{side:`top`,children:r}),t[19]=r,t[20]=O);let k;t[21]!==S||t[22]!==E||t[23]!==D||t[24]!==O?(k=(0,U.jsxs)(er,{open:S,onOpenChange:E,children:[D,O]}),t[21]=S,t[22]=E,t[23]=D,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==T||t[27]!==b||t[28]!==c||t[29]!==x||t[30]!==w?(A=x?(0,U.jsx)(b_,{align:`center`,className:`w-80 max-w-[calc(100vw-2rem)]`,children:(0,U.jsx)(`div`,{className:`p-3`,children:b===null?c:(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-2xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:b.repository}),(0,U.jsxs)(`span`,{className:`shrink-0`,children:[`#`,b.number]}),(0,U.jsx)(`span`,{"aria-hidden":!0,children:`·`}),w===null?null:(0,U.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(w.Icon,{"aria-hidden":!0,className:`size-3 ${w.toneClassName}`}),w.label]})]}),(0,U.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-snug text-foreground text-pretty`,children:b.title}),(0,U.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(Vr,{actor:b.author,className:`size-4`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:T}),(0,U.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,U.jsxs)(`span`,{className:`shrink-0`,children:[`opened `,Xn(b.createdAt)]})]})]})})}):null,t[26]=T,t[27]=b,t[28]=c,t[29]=x,t[30]=w,t[31]=A):A=t[31];let j;return t[32]!==l||t[33]!==k||t[34]!==A?(j=(0,U.jsxs)(v_,{open:l,onOpenChange:u,actionsRef:d,children:[k,A]}),t[32]=l,t[33]=k,t[34]=A,t[35]=j):j=t[35],j}function S_(e){console.error(`[pull-request-link-preview] failed to open link`,e)}var C_={open:`pr-open`,draft:`pr-draft`,merged:`pr-merged`,closed:`pr-closed`,unknown:`pull-request`};function w_(e){let t=(0,H.c)(20),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({icon:n,label:r,tooltip:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i.state===`unresolved`?`true`:void 0,s=a?0:void 0,c;t[5]===r?c=t[6]:(c=(0,U.jsx)(Xg,{children:r}),t[5]=r,t[6]=c);let l;t[7]!==n||t[8]!==i||t[9]!==o||t[10]!==s||t[11]!==c?(l=(0,U.jsxs)(Yg,{"data-context-unresolved":o,tabIndex:s,...i,children:[n,c]}),t[7]=n,t[8]=i,t[9]=o,t[10]=s,t[11]=c,t[12]=l):l=t[12];let u=l;if(!a)return u;let d;t[13]===u?d=t[14]:(d=(0,U.jsx)(Qn,{render:u}),t[13]=u,t[14]=d);let f;t[15]===a?f=t[16]:(f=(0,U.jsx)($n,{side:`top`,className:`whitespace-pre-wrap`,children:a}),t[15]=a,t[16]=f);let p;return t[17]!==d||t[18]!==f?(p=(0,U.jsxs)(er,{children:[d,f]}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function T_(e){let t=(0,H.c)(19),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,U.jsx)(`button`,{type:`button`}),t[0]=n):n=t[0];let r=`${e.accessibleLabel}. Show details`,i;t[1]!==e.copyMarkdown||t[2]!==e.kind||t[3]!==r?(i=(0,U.jsx)(Yg,{kind:e.kind,render:n,"aria-label":r,"data-markdown-copy":e.copyMarkdown}),t[1]=e.copyMarkdown,t[2]=e.kind,t[3]=r,t[4]=i):i=t[4];let a;t[5]===e.label?a=t[6]:(a=(0,U.jsx)(Xg,{children:e.label}),t[5]=e.label,t[6]=a);let o;t[7]!==e.icon||t[8]!==i||t[9]!==a?(o=(0,U.jsxs)(di,{render:i,children:[e.icon,a]}),t[7]=e.icon,t[8]=i,t[9]=a,t[10]=o):o=t[10];let s;t[11]===e.accessibleLabel?s=t[12]:(s=(0,U.jsx)(ci,{className:`sr-only`,children:e.accessibleLabel}),t[11]=e.accessibleLabel,t[12]=s);let c;t[13]!==e.children||t[14]!==s?(c=(0,U.jsxs)(li,{side:`top`,width:`lg`,padding:`compact`,children:[s,e.children]}),t[13]=e.children,t[14]=s,t[15]=c):c=t[15];let l;return t[16]!==o||t[17]!==c?(l=(0,U.jsxs)(fi,{children:[o,c]}),t[16]=o,t[17]=c,t[18]=l):l=t[18],l}function E_(e){let t=(0,H.c)(28),n=Ur(e.environmentId,e.metadata.url),r=e.metadata.state===`open`&&e.metadata.isDraft?`draft`:e.metadata.state,i=oi[r].Icon,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,U.jsx)(`button`,{type:`button`}),t[0]=a):a=t[0];let o=`Open ${e.kindLabel} ${e.label}: ${e.metadata.title}`,s;t[1]===e?s=t[2]:(s=t=>e.onOpen(t,e.metadata.url),t[1]=e,t[2]=s);let c;t[3]===i?c=t[4]:(c=(0,U.jsx)(i,{}),t[3]=i,t[4]=c);let l;t[5]===e.label?l=t[6]:(l=(0,U.jsx)(Xg,{children:e.label}),t[5]=e.label,t[6]=l);let u;t[7]!==e.copyMarkdown||t[8]!==e.kind||t[9]!==o||t[10]!==s||t[11]!==c||t[12]!==l?(u=(0,U.jsxs)(Yg,{kind:e.kind,render:a,"aria-label":o,"data-markdown-copy":e.copyMarkdown,onClick:s,children:[c,l]}),t[7]=e.copyMarkdown,t[8]=e.kind,t[9]=o,t[10]=s,t[11]=c,t[12]=l,t[13]=u):u=t[13];let d=u;if(n!==null){let r;t[14]===e.metadata?r=t[15]:(r=(0,U.jsx)(e_,{metadata:e.metadata}),t[14]=e.metadata,t[15]=r);let i;return t[16]!==d||t[17]!==n||t[18]!==e.metadata.url||t[19]!==r?(i=(0,U.jsx)(x_,{link:d,originalUrl:e.metadata.url,target:n,confirmBeforeOpen:!1,fallback:r}),t[16]=d,t[17]=n,t[18]=e.metadata.url,t[19]=r,t[20]=i):i=t[20],i}let f;t[21]===d?f=t[22]:(f=(0,U.jsx)(Qn,{render:d}),t[21]=d,t[22]=f);let p;t[23]===e.metadata?p=t[24]:(p=(0,U.jsx)($n,{side:`top`,children:(0,U.jsx)(e_,{metadata:e.metadata})}),t[23]=e.metadata,t[24]=p);let m;return t[25]!==f||t[26]!==p?(m=(0,U.jsxs)(er,{children:[f,p]}),t[25]=f,t[26]=p,t[27]=m):m=t[27],m}function D_(e){try{let t=document.createElement(`canvas`);t.width=t.height=16;let n=t.getContext(`2d`);if(!n)return;n.drawImage(e,0,0,16,16);let{data:r}=n.getImageData(0,0,16,16),i=0,a=0,o=0,s=0;for(let e=0;e<r.length;e+=4){let t=r[e+3];i+=r[e]*t,a+=r[e+1]*t,o+=r[e+2]*t,s+=t}return s===0?void 0:`rgb(${Math.round(i/s)} ${Math.round(a/s)} ${Math.round(o/s)})`}catch{return}}function O_(e){let t=(0,H.c)(32),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({name:n,previewUrl:r,size:a,suffix:s,style:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let[c,l]=(0,V.useState)(),[u,d]=(0,V.useState)(),f=c?.url===r?c?.color:void 0,p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,U.jsx)(`button`,{type:`button`}),t[7]=p):p=t[7];let m=`Image attachment, ${n}, ${a}`,h;t[8]===f?h=t[9]:(h=f?{"--context-chip-accent":f}:{},t[8]=f,t[9]=h);let _;t[10]!==o||t[11]!==h?(_={...o,...h},t[10]=o,t[11]=h,t[12]=_):_=t[12];let v=_,y;t[13]!==u||t[14]!==r?(y=r?(0,U.jsx)(`img`,{crossOrigin:u===r?void 0:`anonymous`,src:r,alt:``,className:`size-[1.17em] shrink-0 rounded-sm object-cover`,onError:()=>d(r),onLoad:e=>l({url:r,color:D_(e.currentTarget)})},r):(0,U.jsx)(g,{}),t[13]=u,t[14]=r,t[15]=y):y=t[15];let b;t[16]===n?b=t[17]:(b=$g(n),t[16]=n,t[17]=b);let x;t[18]===b?x=t[19]:(x=(0,U.jsx)(Xg,{className:`max-w-72`,children:b}),t[18]=b,t[19]=x);let S;t[20]===a?S=t[21]:(S=(0,U.jsx)(`span`,{className:`shrink-0 text-3xs text-current`,children:a}),t[20]=a,t[21]=S);let C;t[22]===s?C=t[23]:(C=s?(0,U.jsx)(`span`,{className:`text-3xs text-current`,children:s}):null,t[22]=s,t[23]=C);let w;return t[24]!==i||t[25]!==C||t[26]!==m||t[27]!==v||t[28]!==y||t[29]!==x||t[30]!==S?(w=(0,U.jsxs)(Yg,{kind:`image`,render:p,"aria-label":m,style:v,...i,children:[y,x,S,C]}),t[24]=i,t[25]=C,t[26]=m,t[27]=v,t[28]=y,t[29]=x,t[30]=S,t[31]=w):w=t[31],w}function k_(e){let t=(0,H.c)(23),n;t[0]===e?n=t[1]:(n=(0,U.jsx)(A_,{...e}),t[0]=e,t[1]=n);let r=n,i=e.unresolved?`unresolved`:e.error?`invalid`:null,a=e.isVideo?`video`:`file`,o;t[2]===i?o=t[3]:(o=i?{state:i}:{},t[2]=i,t[3]=o);let s;t[4]!==e.accessibleLabel||t[5]!==e.suffix?(s=[e.accessibleLabel,e.suffix].filter(Boolean),t[4]=e.accessibleLabel,t[5]=e.suffix,t[6]=s):s=t[6];let c=s.join(`, `),l=e.unresolved?`true`:void 0,u;t[7]!==e.copyMarkdown||t[8]!==a||t[9]!==o||t[10]!==c||t[11]!==l?(u={kind:a,...o,"aria-label":c,"data-markdown-copy":e.copyMarkdown,"data-context-unresolved":l},t[7]=e.copyMarkdown,t[8]=a,t[9]=o,t[10]=c,t[11]=l,t[12]=u):u=t[12];let d=u,f;t[13]!==d||t[14]!==r||t[15]!==e.disabled||t[16]!==e.onOpen?(f=(0,U.jsx)(Qn,{render:e.onOpen?(0,U.jsx)(Yg,{render:(0,U.jsx)(`button`,{type:`button`,disabled:e.disabled}),onClick:e.onOpen,...d,children:r}):(0,U.jsx)(Yg,{tabIndex:0,...d,children:r})}),t[13]=d,t[14]=r,t[15]=e.disabled,t[16]=e.onOpen,t[17]=f):f=t[17];let p;t[18]===e.tooltip?p=t[19]:(p=(0,U.jsx)($n,{side:`top`,className:`whitespace-pre-wrap`,children:e.tooltip}),t[18]=e.tooltip,t[19]=p);let m;return t[20]!==f||t[21]!==p?(m=(0,U.jsxs)(er,{children:[f,p]}),t[20]=f,t[21]=p,t[22]=m):m=t[22],m}function A_(e){let t=(0,H.c)(17),n;t[0]!==e.isVideo||t[1]!==e.name||t[2]!==e.theme?(n=e.isVideo?(0,U.jsx)(ge,{}):(0,U.jsx)(Tr,{pathValue:e.name,kind:`file`,theme:e.theme}),t[0]=e.isVideo,t[1]=e.name,t[2]=e.theme,t[3]=n):n=t[3];let r;t[4]===e.name?r=t[5]:(r=$g(e.name),t[4]=e.name,t[5]=r);let i;t[6]===r?i=t[7]:(i=(0,U.jsx)(Xg,{className:`max-w-72`,children:r}),t[6]=r,t[7]=i);let a;t[8]===e.size?a=t[9]:(a=(0,U.jsx)(`span`,{className:`shrink-0 text-3xs text-current`,children:e.size}),t[8]=e.size,t[9]=a);let o;t[10]===e.suffix?o=t[11]:(o=e.suffix?(0,U.jsx)(`span`,{className:`text-3xs text-current`,children:e.suffix}):null,t[10]=e.suffix,t[11]=o);let s;return t[12]!==n||t[13]!==i||t[14]!==a||t[15]!==o?(s=(0,U.jsxs)(U.Fragment,{children:[n,i,a,o]}),t[12]=n,t[13]=i,t[14]=a,t[15]=o,t[16]=s):s=t[16],s}function j_(e){let t=(0,H.c)(6),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,U.jsx)(N,{}),t[0]=n):n=t[0];let r=`Unavailable context, ${e.label}`,i;return t[1]!==e.copyMarkdown||t[2]!==e.label||t[3]!==e.tooltip||t[4]!==r?(i=(0,U.jsx)(w_,{icon:n,label:e.label,state:`unresolved`,"aria-label":r,"data-markdown-copy":e.copyMarkdown,tooltip:e.tooltip}),t[1]=e.copyMarkdown,t[2]=e.label,t[3]=e.tooltip,t[4]=r,t[5]=i):i=t[5],i}function M_(e){let t=(0,H.c)(38),{citation:n,inputRef:r,onSubmit:i,onSubmitAndSend:a,onCancel:o,onDraftChange:s}=e,[c,l]=(0,V.useState)(n.comment??``),u=c.length>pt,d;t[0]!==c||t[1]!==u||t[2]!==i?(d=()=>{u||i(c)},t[0]=c,t[1]=u,t[2]=i,t[3]=d):d=t[3];let f=d,p;t[4]!==c||t[5]!==u||t[6]!==i||t[7]!==a?(p=()=>{u||(a?a(c):i(c))},t[4]=c,t[5]=u,t[6]=i,t[7]=a,t[8]=p):p=t[8];let m=p,h;t[9]===o?h=t[10]:(h=e=>{e.stopPropagation(),!(e.nativeEvent.isComposing||e.keyCode===229)&&e.key===`Escape`&&(e.preventDefault(),o())},t[9]=o,t[10]=h);let g=u||void 0,_;t[11]===s?_=t[12]:(_=e=>{l(e.currentTarget.value),s?.(e.currentTarget.value)},t[11]=s,t[12]=_);let v;t[13]!==f||t[14]!==m?(v=e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&e.keyCode!==229&&(e.preventDefault(),e.metaKey||e.ctrlKey?m():f())},t[13]=f,t[14]=m,t[15]=v):v=t[15];let y;t[16]!==c||t[17]!==r||t[18]!==g||t[19]!==_||t[20]!==v?(y=(0,U.jsx)(`textarea`,{ref:r,"aria-label":`Comment on selected text`,"aria-description":`Enter to save the citation comment; Command/Ctrl+Enter to save and send; Shift+Enter for a new line.`,"aria-invalid":g,placeholder:`Add an optional comment...`,rows:2,className:`field-sizing-content block max-h-40 min-h-16 w-full resize-none bg-transparent px-1 py-1.5 text-base outline-none placeholder:text-muted-foreground sm:text-sm`,value:c,onChange:_,onKeyDown:v}),t[16]=c,t[17]=r,t[18]=g,t[19]=_,t[20]=v,t[21]=y):y=t[21];let b;t[22]===u?b=t[23]:(b=u?(0,U.jsxs)(`p`,{role:`status`,className:`pt-1 text-xs text-destructive`,children:[`Comments can contain up to `,pt.toLocaleString(),` `,`characters.`]}):null,t[22]=u,t[23]=b);let x;t[24]===o?x=t[25]:(x=(0,U.jsx)(we,{variant:`outline`,size:`xs`,onPointerDown:P_,onClick:o,children:`Cancel`}),t[24]=o,t[25]=x);let S=u?`Shorten comment`:`Save`,C;t[26]!==u||t[27]!==f||t[28]!==S?(C=(0,U.jsx)(we,{size:`xs`,disabled:u,onPointerDown:N_,onClick:f,children:S}),t[26]=u,t[27]=f,t[28]=S,t[29]=C):C=t[29];let w;t[30]!==C||t[31]!==x?(w=(0,U.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-2`,children:[x,C]}),t[30]=C,t[31]=x,t[32]=w):w=t[32];let T;return t[33]!==w||t[34]!==h||t[35]!==y||t[36]!==b?(T=(0,U.jsxs)(`div`,{"data-citation-comment-editor":`true`,onKeyDown:h,children:[y,b,w]}),t[33]=w,t[34]=h,t[35]=y,t[36]=b,t[37]=T):T=t[37],T}function N_(e){return e.preventDefault()}function P_(e){return e.preventDefault()}function F_({reason:e,draft:t,savedComment:n}){return e===`escape-key`||t===null||t.trim()===(n??``).trim()?{kind:`close`}:t.length>8e3?{kind:`keep-open`}:{kind:`commit`,comment:t}}var I_=650,L_=3e3,R_=`--assistant-citation-highlight-opacity`,z_=.45,B_=`p4-assistant-citation-comment`;function V_({anchor:e,citation:t,onUnavailable:n}){let{source:r,range:i,viewport:a}=e,o=typeof CSS<`u`?CSS.highlights:void 0,s=null,c=!1,l=new MutationObserver(e=>{if(c)return;let t=e.some(e=>r.contains(e.target));f(t)}),u=()=>{c||(c=!0,l.disconnect(),s&&(s.delete(i),s.size===0&&o?.get(B_)===s&&o.delete(B_)))},d=()=>{c||(u(),n())},f=e=>{if(!r.isConnected||!a.contains(r))return d(),!1;if(e||i.collapsed||!r.contains(i.startContainer)||!r.contains(i.endContainer)){let e=qg(r,t);if(!e)return d(),!1;i.setStart(e.startContainer,e.startOffset),i.setEnd(e.endContainer,e.endOffset)}return!0};if(!f(!1))return u;if(typeof Highlight<`u`&&o){let e=o.get(B_);s=e??new Highlight,s.add(i),e||o.set(B_,s)}return l.observe(a,{childList:!0,subtree:!0,characterData:!0}),u}function H_({root:e,itemKey:t,request:n,list:r}){let i=n.activationRef.current;if(i.dismissed)return;let a=r.getScrollableNode();if(!(a instanceof HTMLElement))return;let o=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,s=null,c=null,l=null,u=null,d=!1,f=!1,p=null,m=!i.scrolled,h=e=>l!==null&&e?.rangeCount===1&&e.getRangeAt(0)===l.range&&l.range.startContainer===l.snapshot.startContainer&&l.range.startOffset===l.snapshot.startOffset&&l.range.endContainer===l.snapshot.endContainer&&l.range.endOffset===l.snapshot.endOffset,g=()=>{s&&CSS.highlights.get(`p4-assistant-citation`)===s&&CSS.highlights.delete(`p4-assistant-citation`),s=null,c=null;let t=l?e.ownerDocument.getSelection():null;l&&h(t)&&t?.removeRange(l.range),l=null,delete e.dataset.citationHighlighted},_=()=>{f||(i.dismissed=!0,T())},v=()=>{if(u=null,f||i.dismissed||!e.isConnected||!a.contains(e)){g();return}if(i.pulse&&performance.now()-i.pulse.startedAt>=L_){_();return}let v=r.getState(),b=v.indexByKey(t);if(b===void 0||!(v.sizeAtIndex(b)>0))return;let x=qg(e,n.citation),S=(x??e).getBoundingClientRect();if(S.height<=0||a.clientHeight<=0)g();else{if(!i.scrolled){if(d)return;let e=a.getBoundingClientRect(),t=Math.max(0,Math.min(a.scrollHeight-a.clientHeight,v.scroll+S.top-e.top-Math.min(120,a.clientHeight/3)));if(Math.abs(t-v.scroll)>1){d=!0,r.scrollToOffset({offset:t,animated:!o}).then(()=>{d=!1,!f&&!i.dismissed&&y()},()=>{d=!1,!(f||i.dismissed)&&(i.dismissed=!0,g(),n.onComplete(),Xt.add({type:`warning`,title:`Could not open the cited response`,description:`Click the citation to try again.`}))});return}if(S.bottom<=e.top||S.top>=e.bottom)return;i.scrolled=!0,n.onComplete(),x||Xt.add({type:`warning`,title:`The quoted text has changed`,description:`Showing the source response. The saved quote is unchanged.`})}if(!x)_();else{if(typeof Highlight<`u`&&typeof CSS<`u`&&CSS.highlights)s=new Highlight(x),CSS.highlights.set(`p4-assistant-citation`,s),c=x,e.dataset.citationHighlighted=`true`;else{let t=e.ownerDocument.getSelection();if(t&&(m||h(t)))t.removeAllRanges(),t.addRange(x),l={range:t.getRangeAt(0),snapshot:x.cloneRange()},m=!1,c=x,e.dataset.citationHighlighted=`true`;else{_();return}}if(!p){let t=i.pulse??={startedAt:performance.now(),reducedMotion:o},n=e=>e/L_,r=n(2550);p=e.animate(t.reducedMotion?[{offset:0,[R_]:z_},{offset:r,[R_]:z_},{offset:1,[R_]:0}]:[{offset:0,[R_]:0},{offset:n(I_*.5),[R_]:z_},{offset:n(I_),[R_]:0},{offset:n(I_*1.5),[R_]:z_},{offset:r,[R_]:z_},{offset:1,[R_]:0}],{duration:L_,easing:`ease-in-out`}),p.id=`p4-assistant-citation-pulse`,p.currentTime=Math.max(0,performance.now()-t.startedAt),p.finished.then(_,()=>{})}}}},y=()=>{u!==null&&cancelAnimationFrame(u),u=requestAnimationFrame(v)},b=new MutationObserver(t=>{let n=c!==null&&(c.collapsed||!e.contains(c.startContainer)||!e.contains(c.endContainer));n&&(m||=l!==null&&h(e.ownerDocument.getSelection()),g()),(n||t.some(t=>e.contains(t.target)||[...t.addedNodes,...t.removedNodes].some(t=>t.contains(e))))&&y()});b.observe(a,{childList:!0,characterData:!0,subtree:!0});let x=cr([e,a],y),S=r.getState(),C=[S.listenToPosition(t,y),S.listen(`totalSize`,y),S.listen(`headerSize`,y)],w=()=>{d&&(d=!1,r.scrollToOffset({get offset(){return a.scrollTop},animated:!1}))};i.cancelScroll=w,y();let T=()=>{if(!f){f=!0,w(),p?.cancel(),u!==null&&cancelAnimationFrame(u),b.disconnect(),x();for(let e of C)e();i.cancelScroll===w&&delete i.cancelScroll,g()}};return T}function U_(e){let t=(0,H.c)(11),{messageId:n,threadRef:r,itemKey:i,request:a,listRef:o,children:s}=e,c=(0,V.useRef)(null),l,u;t[0]!==i||t[1]!==o||t[2]!==n||t[3]!==a?(l=()=>{let e=c.current,t=o.current;if(e&&t&&a&&a.citation.messageId===n)return H_({root:e,itemKey:i,request:a,list:t})},u=[i,o,n,a],t[0]=i,t[1]=o,t[2]=n,t[3]=a,t[4]=l,t[5]=u):(l=t[4],u=t[5]),(0,V.useEffect)(l,u);let d=r?.environmentId,f=r?.threadId,p;return t[6]!==s||t[7]!==n||t[8]!==d||t[9]!==f?(p=(0,U.jsx)(`div`,{ref:c,"data-assistant-citation-source":n,"data-assistant-citation-environment":d,"data-assistant-citation-thread":f,children:s}),t[6]=s,t[7]=n,t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function W_(e){let t=(0,H.c)(77),{citation:n,composer:r,commentEditor:i}=e,a=r!==void 0&&r,o=Yt(),s=(0,V.useRef)(null),c=(0,V.useRef)(null),l=(0,V.useRef)(null),[u,d]=(0,V.useState)(null),f=i?.open??!1,p=i?.sourceAnchor,m=p===u?void 0:p,h,g;t[0]===f?(h=t[1],g=t[2]):(h=()=>{f||(l.current=null)},g=[f],t[0]=f,t[1]=h,t[2]=g),(0,V.useEffect)(h,g);let v;t[3]!==n.comment||t[4]!==i?(v=e=>{let t=F_({reason:e,draft:l.current,savedComment:n.comment});return t.kind===`commit`?i?.onSave(t.comment)??!0:t.kind!==`keep-open`},t[3]=n.comment,t[4]=i,t[5]=v):v=t[5];let y=v,b;t[6]!==i||t[7]!==y||t[8]!==p?(b=()=>{p&&(y(`none`)?i?.onOpenChange(!1):d(p))},t[6]=i,t[7]=y,t[8]=p,t[9]=b):b=t[9];let x=(0,V.useEffectEvent)(b),S;t[10]!==n||t[11]!==f||t[12]!==x||t[13]!==p||t[14]!==u?(S=()=>{if(!f||p===u)return;let e=p??Mg(document,n);if(e)return V_({anchor:e,citation:n,onUnavailable:x})},t[10]=n,t[11]=f,t[12]=x,t[13]=p,t[14]=u,t[15]=S):S=t[15];let C;t[16]!==n||t[17]!==f||t[18]!==p||t[19]!==u?(C=[n,f,p,u],t[16]=n,t[17]=f,t[18]=p,t[19]=u,t[20]=C):C=t[20],(0,V.useEffect)(S,C);let w;t[21]===m?w=t[22]:(w=m?{contextElement:m.source,getBoundingClientRect:()=>{let e=m.range.getClientRects(),t=e.item(e.length-1)??m.range.getBoundingClientRect(),n=m.source.getBoundingClientRect(),r=Math.min(Math.max(t.left,n.left),n.right),i=Math.max(Math.min(t.right,n.right),r);return new DOMRect(r,t.top,i-r,t.height)}}:void 0,t[21]=m,t[22]=w);let T=w,E;t[23]===n?E=t[24]:(E=Gr(n),t[23]=n,t[24]=E);let D=E,O;t[25]!==n.environmentId||t[26]!==n.threadId?(O={environmentId:n.environmentId,threadId:n.threadId},t[25]=n.environmentId,t[26]=n.threadId,t[27]=O):O=t[27];let k;t[28]===n?k=t[29]:(k=Nr(n),t[28]=n,t[29]=k);let A;t[30]===n?A=t[31]:(A=Ar(n),t[30]=n,t[31]=A);let j;t[32]!==n||t[33]!==o?(j=e=>{e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),o(Kr(n)))},t[32]=n,t[33]=o,t[34]=j):j=t[34];let M;t[35]!==O||t[36]!==k||t[37]!==A||t[38]!==j?(M={to:`/$environmentId/$threadId`,params:O,hash:k,"data-markdown-copy":A,resetScroll:!1,onClick:j},t[35]=O,t[36]=k,t[37]=A,t[38]=j,t[39]=M):M=t[39];let N=M,P=`View cited assistant text: ${D}`,F;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,U.jsx)(ze,{"aria-hidden":`true`}),t[40]=F):F=t[40];let ee;t[41]===D?ee=t[42]:(ee=(0,U.jsx)(Xg,{className:`max-w-[16em]`,children:D}),t[41]=D,t[42]=ee);let te;t[43]!==N||t[44]!==P||t[45]!==ee?(te=(0,U.jsxs)(Jt,{...N,className:`inline-flex h-full min-w-0 items-center gap-[0.33em] rounded-sm text-inherit no-underline focus-visible:outline-2 focus-visible:outline-foreground`,"aria-label":P,children:[F,ee]}),t[43]=N,t[44]=P,t[45]=ee,t[46]=te):te=t[46];let ne=te;if(!a){let e;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(ze,{}),t[47]=e):e=t[47];let r=`Quoted assistant text: ${D}`,i;t[48]===n?i=t[49]:(i=Ar(n),t[48]=n,t[49]=i);let a;t[50]===n?a=t[51]:(a=(0,U.jsx)(K_,{citation:n}),t[50]=n,t[51]=a);let o;t[52]===N?o=t[53]:(o=(0,U.jsx)(we,{variant:`outline`,size:`sm`,render:(0,U.jsx)(Jt,{...N})}),t[52]=N,t[53]=o);let s;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,U.jsx)(fe,{"aria-hidden":`true`}),t[54]=s):s=t[54];let c;t[55]===o?c=t[56]:(c=(0,U.jsxs)(ui,{render:o,children:[s,`Go to source`]}),t[55]=o,t[56]=c);let l;t[57]!==a||t[58]!==c?(l=(0,U.jsxs)(`div`,{className:`flex max-h-[calc(var(--available-height)_-_1rem_-_2px)] flex-col items-start gap-3 p-1 text-sm`,children:[a,c]}),t[57]=a,t[58]=c,t[59]=l):l=t[59];let u;return t[60]!==D||t[61]!==r||t[62]!==i||t[63]!==l?(u=(0,U.jsx)(T_,{kind:`citation`,icon:e,label:D,accessibleLabel:r,copyMarkdown:i,children:l}),t[60]=D,t[61]=r,t[62]=i,t[63]=l,t[64]=u):u=t[64],u}let re;t[65]===n?re=t[66]:(re=Ar(n),t[65]=n,t[66]=re);let I;t[67]!==m||t[68]!==n||t[69]!==i||t[70]!==T||t[71]!==y?(I=i?(0,U.jsxs)(fi,{open:i.open,onOpenChange:(e,t)=>{!e&&!y(t.reason)?t.cancel():i.onOpenChange(e)},children:[(0,U.jsx)(di,{"aria-label":n.comment?`Edit citation comment`:`Add comment to citation`,"data-citation-comment-trigger":`true`,render:(0,U.jsx)(Zg,{}),children:(0,U.jsx)(_,{"aria-hidden":`true`})}),i.open?(0,U.jsx)(li,{...We,side:m?`bottom`:`top`,align:`end`,anchor:T,initialFocus:()=>(s.current?.focus({preventScroll:!0}),!1),finalFocus:i.onRestoreFocus?()=>{let e=document.activeElement;return(e===document.body||e!==null&&c.current?.contains(e))&&i.onRestoreFocus?.(),!1}:void 0,ref:c,"aria-label":`Edit citation comment`,width:`md`,padding:`compact`,onPointerDown:G_,children:(0,U.jsx)(M_,{citation:n,inputRef:s,onDraftChange:e=>{l.current=e,i.onDraftChange?.(e)},onSubmit:e=>i.onSave(e)?(i.onOpenChange(!1),!0):!1,...i.onSaveAndSend?{onSubmitAndSend:e=>i.onSaveAndSend?.(e)?(i.onOpenChange(!1),!0):!1}:{},onCancel:()=>{i.onCancel?i.onCancel():i.onOpenChange(!1)}},Ar(n))}):null]}):null,t[67]=m,t[68]=n,t[69]=i,t[70]=T,t[71]=y,t[72]=I):I=t[72];let L;return t[73]!==ne||t[74]!==re||t[75]!==I?(L=(0,U.jsxs)(Yg,{kind:`citation`,contentEditable:!1,"data-assistant-citation-chip":`true`,"data-markdown-copy":re,children:[ne,I]}),t[73]=ne,t[74]=re,t[75]=I,t[76]=L):L=t[76],L}function G_(e){return e.stopPropagation()}function K_(e){let t=(0,H.c)(14),{citation:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={top:!1,bottom:!1},t[0]=r):r=t[0];let[i,a]=(0,V.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{let t=e.scrollTop>1,n=e.scrollHeight-e.clientHeight-e.scrollTop>1;a(e=>e.top===t&&e.bottom===n?e:{top:t,bottom:n})},t[1]=o):o=t[1];let s=o,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>e?cr(e,()=>s(e)):void 0,t[2]=c):c=t[2];let l=c,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>s(e.currentTarget),t[3]=u):u=t[3];let d;t[4]===i?d=t[5]:(d=B(`max-h-64 min-h-0 space-y-3 self-stretch overflow-y-auto whitespace-pre-wrap wrap-break-word`,rr(i)),t[4]=i,t[5]=d);let f;t[6]===n.text?f=t[7]:(f=(0,U.jsx)(`blockquote`,{className:`border-l-2 border-border pl-3 text-muted-foreground`,children:n.text}),t[6]=n.text,t[7]=f);let p;t[8]===n.comment?p=t[9]:(p=n.comment?(0,U.jsx)(`p`,{children:n.comment}):null,t[8]=n.comment,t[9]=p);let m;return t[10]!==d||t[11]!==f||t[12]!==p?(m=(0,U.jsxs)(`div`,{ref:l,onScroll:u,className:d,children:[f,p]}),t[10]=d,t[11]=f,t[12]=p,t[13]=m):m=t[13],m}function q_(e){let t=(0,H.c)(36),n=e.link.environmentId??e.environmentId,r=dm(e.link.threadId),i;t[0]!==n||t[1]!==e.link.threadId?(i=S(n,e.link.threadId),t[0]=n,t[1]=e.link.threadId,t[2]=i):i=t[2];let a=Mt(i),o=Mt(a===null&&r!==null?S(n,r):null),s=a??o,c=s===null&&e.link.environmentId===null,l=At(c),u;t[3]!==c||t[4]!==e.link||t[5]!==l?(u=c?fm(e.link,l):null,t[3]=c,t[4]=e.link,t[5]=l,t[6]=u):u=t[6];let d=Mt(u),f=s??d,p=f?.environmentId??n,m=f?.id??e.link.threadId,h;t[7]!==p||t[8]!==f?(h=f===null?null:Fe(p,f.projectId),t[7]=p,t[8]=f,t[9]=h):h=t[9];let g=Nt(h),_;t[10]!==e.environmentId||t[11]!==e.link?(_=hm(e.link,e.environmentId),t[10]=e.environmentId,t[11]=e.link,t[12]=_):_=t[12];let v=_,y;t[13]!==e.label||t[14]!==f||t[15]!==m||t[16]!==v?(y=f?.title.trim()||e.label||(f===null?v:m),t[13]=e.label,t[14]=f,t[15]=m,t[16]=v,t[17]=y):y=t[17];let b=y,x;t[18]!==p||t[19]!==m?(x={environmentId:p,threadId:m},t[18]=p,t[19]=m,t[20]=x):x=t[20];let C=f===null?v:g?.title,w;t[21]!==p||t[22]!==e.label||t[23]!==e.link||t[24]!==f||t[25]!==m||t[26]!==b?(w=f===null?mm(e.link,e.label??void 0):mm({environmentId:p,threadId:m},b),t[21]=p,t[22]=e.label,t[23]=e.link,t[24]=f,t[25]=m,t[26]=b,t[27]=w):w=t[27];let T;t[28]===g?T=t[29]:(T=(0,U.jsx)(`span`,{className:`ms-[0.25em] me-[0.2em] inline-flex size-[14px] [vertical-align:-0.125em]`,"aria-hidden":!0,children:g===null?(0,U.jsx)($e,{className:`block size-full shrink-0`}):(0,U.jsx)(pi,{project:g,className:`size-full`})}),t[28]=g,t[29]=T);let E;return t[30]!==x||t[31]!==C||t[32]!==w||t[33]!==T||t[34]!==b?(E=(0,U.jsxs)(Jt,{to:`/$environmentId/$threadId`,params:x,title:C,"data-markdown-copy":w,children:[T,b]}),t[30]=x,t[31]=C,t[32]=w,t[33]=T,t[34]=b,t[35]=E):E=t[35],E}function J_(e){return e.displayName?.trim()||e.name}var Y_=/(^|\s)\p{Sc}(?![0-9][0-9_]*(?:[kKmMbBtT]|[eE][0-9]+)?(?:\s|$))(?=[a-zA-Z0-9:_-]*[a-zA-Z])([a-zA-Z0-9][a-zA-Z0-9:_-]*)(?=\s|$)/gu;function*X_(e,t){let n=new Map;for(let r of e.matchAll(Y_)){let e=r[2]??``;n.has(e)||n.set(e,t.find(t=>t.name===e));let i=n.get(e);i&&(yield{start:r.index+(r[1]?.length??0),end:r.index+r[0].length,skill:i,rawText:`$${e}`})}}function Z_(e){let t=(0,H.c)(6),n,r;if(t[0]!==e.skills||t[1]!==e.text){r=Symbol.for(`react.early_return_sentinel`);bb0:{let i=[],a=0;for(let{start:t,end:n,skill:r,rawText:o}of X_(e.text,e.skills))t>a&&i.push(e.text.slice(a,t)),i.push((0,U.jsx)($_,{skill:r,rawText:o},`${t}:${r.name}`)),a=n;if(a===0){let n;t[4]===e.text?n=t[5]:(n=(0,U.jsx)(U.Fragment,{children:e.text}),t[4]=e.text,t[5]=n),r=n;break bb0}a<e.text.length&&i.push(e.text.slice(a)),n=(0,U.jsx)(U.Fragment,{children:i})}t[0]=e.skills,t[1]=e.text,t[2]=n,t[3]=r}else n=t[2],r=t[3];return r===Symbol.for(`react.early_return_sentinel`)?n:r}function Q_(e,t){return V.Children.map(e,e=>{if(typeof e==`string`)return(0,U.jsx)(Z_,{text:e,skills:t});if(!(0,V.isValidElement)(e))return e;let n=typeof e.type==`string`?e.type:e.props.node?.tagName;return n===`code`||n===`a`||!(`children`in e.props)?e:(0,V.cloneElement)(e,void 0,Q_(e.props.children,t))})}function $_(e){let t=(0,H.c)(8),n=e.rawText,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,U.jsx)(ev,{}),t[0]=r):r=t[0];let i;t[1]===e.skill?i=t[2]:(i=J_(e.skill),t[1]=e.skill,t[2]=i);let a;t[3]===i?a=t[4]:(a=(0,U.jsx)(Xg,{children:i}),t[3]=i,t[4]=a);let o;return t[5]!==e.rawText||t[6]!==a?(o=(0,U.jsxs)(Yg,{kind:`skill`,"data-markdown-copy":n,children:[r,a]}),t[5]=e.rawText,t[6]=a,t[7]=o):o=t[7],o}function ev(){let e=(0,H.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`contents`,dangerouslySetInnerHTML:{__html:Qg}}),e[0]=t):t=e[0],t}var tv=(0,V.lazy)(()=>r(()=>import(`./MathTypeset-CMO1aCZc.js`),__vite__mapDeps([0,1,2,3,4]))),nv=(0,V.memo)(function(e){let t=(0,H.c)(34),n=(0,V.useRef)(null),r=(0,V.useRef)(null),[i,a]=(0,V.useState)(!1),o,s;t[0]===e.focusable?(o=t[1],s=t[2]):(o=()=>{let t=n.current,i=r.current;if(!t||!i||e.focusable===!1)return;let o=()=>a(t.scrollWidth>t.clientWidth);return o(),cr([t,i],o)},s=[e.focusable],t[0]=e.focusable,t[1]=o,t[2]=s),(0,V.useLayoutEffect)(o,s);let c=e.focusable!==!1&&i,l;t[3]===e.tex?l=t[4]:(l=e.tex.trim(),t[3]=e.tex,t[4]=l);let u=l,d=e.display?`\\[\n${u}\n\\]`:`\\(${u}\\)`,f;t[5]===d?f=t[6]:(f=(0,U.jsx)(`span`,{className:`whitespace-pre-wrap`,children:d}),t[5]=d,t[6]=f);let p=f,m=e.display?`chat-markdown-math-display my-[0.65rem] block in-[.chat-markdown-table-container]:max-w-none in-[.chat-markdown-table-container]:overflow-visible`:`inline-block max-w-full align-middle whitespace-nowrap wrap-normal break-normal in-[.chat-markdown-table-container]:max-w-none in-[.chat-markdown-table-container]:overflow-visible`,h=e.display?`display`:`inline`,g=e.display?`${d}\n\n`:d,_=e.focusable===!1?void 0:`group`,v=e.focusable===!1?void 0:e.display?`Display equation`:`Inline equation`,y=c?0:-1,b=c?e.display?`Scroll display equation`:`Scroll inline equation`:void 0,x=e.display?`inline-block w-max min-w-full`:`inline-block w-max`,S;t[7]===u?S=t[8]:(S=[u],t[7]=u,t[8]=S);let C;t[9]!==p||t[10]!==e.display||t[11]!==u?(C=(0,U.jsx)(tv,{tex:u,display:e.display,fallback:p}),t[9]=p,t[10]=e.display,t[11]=u,t[12]=C):C=t[12];let w;t[13]!==p||t[14]!==C?(w=(0,U.jsx)(V.Suspense,{fallback:p,children:C}),t[13]=p,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==p||t[17]!==S||t[18]!==w?(T=(0,U.jsx)(ei,{resetKeys:S,fallback:p,children:w}),t[16]=p,t[17]=S,t[18]=w,t[19]=T):T=t[19];let E;t[20]!==x||t[21]!==T?(E=(0,U.jsx)(`span`,{ref:r,className:x,children:T}),t[20]=x,t[21]=T,t[22]=E):E=t[22];let D;t[23]!==b||t[24]!==E||t[25]!==y?(D=(0,U.jsx)(`span`,{ref:n,className:`block max-w-full overflow-x-auto overflow-y-hidden in-[.chat-markdown-table-container]:max-w-none in-[.chat-markdown-table-container]:overflow-visible px-0.5 py-0.75 focus-visible:outline-1 focus-visible:outline-solid focus-visible:-outline-offset-1 focus-visible:outline-border [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded [&::-webkit-scrollbar-thumb]:border [&::-webkit-scrollbar-thumb]:border-transparent [&::-webkit-scrollbar-thumb]:bg-clip-content`,tabIndex:y,"aria-label":b,children:E}),t[23]=b,t[24]=E,t[25]=y,t[26]=D):D=t[26];let O;return t[27]!==D||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(O=(0,U.jsx)(`span`,{className:m,"data-markdown-math":h,"data-markdown-copy":g,role:_,"aria-label":v,children:D}),t[27]=D,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=O):O=t[33],O}),rv=/^[.,:;!?…)\]}"'’”]+/;function iv(){let e=t=>{if(t.tagName===`pre`||!t.children)return;let n=[];for(let r of t.children){e(r);let t=n.at(-1),i=r.type===`text`&&(t?.tagName===`a`||t?.tagName===`code`)?rv.exec(r.value??``)?.[0]:void 0;if(!t||!i){n.push(r);continue}n[n.length-1]={type:`element`,tagName:`span`,properties:{className:[`has-[[data-slot=context-chip-label]]:whitespace-nowrap`]},children:[t,{type:`text`,value:i}]};let a=(r.value??``).slice(i.length);a&&n.push({...r,value:a})}t.children=n};return e}async function av(e){let t=Yn(e.source,{threadId:e.threadRef?.threadId,workspaceRoot:e.cwd,resolvedFilePath:e.resolvedFilePath});if(t===null)return null;let{kind:n,name:r,reference:i}=t,a=i?.kind===`file`?i.relativePath:void 0,o,s;if(t.access===`direct`)o=pa(t.uri);else{if(t.access===`unavailable`||!e.threadRef||!e.httpBaseUrl)throw Error(`Reconnect to this environment and open the media again.`);s={environmentId:e.threadRef.environmentId,resource:t.resource};let n=await e.createAssetUrl({environmentId:s.environmentId,input:{resource:s.resource}});if(n._tag===`Failure`)throw ht(n);let r=dr(e.httpBaseUrl,n.value.relativeUrl);if(r===null)throw Error(`The environment returned an invalid media URL.`);o=r+t.srcFragment}return{images:[{src:o,name:r,...n===`video`?{type:`video`,autoPlay:!1}:{},...t.access===`direct`&&da(t.uri)!==null?{originalUrl:t.uri}:{},...t.srcFragment?{srcFragment:t.srcFragment}:{},actionsSource:{kind:n,name:r,src:o,...i?{reference:i}:{},...s?{asset:s}:{},...a&&e.onOpenFile?{onOpenFile:()=>e.onOpenFile?.(a)}:{}}}],index:0}}function ov(e,t){return{environmentId:e,resource:{_tag:`attachment`,attachmentId:t.id,fileName:t.name,mimeType:w(t)??t.mimeType}}}function sv(e,t){if(!l(t))return null;let n=t.previewUrl??null,r=t.downloadable===!1?void 0:ov(e,t);return n===null&&r===void 0?null:{images:[{src:n,name:t.name,type:`video`,actionsSource:{kind:`video`,name:t.name,src:n,...r?{asset:r}:{}}}],index:0}}function cv(e){let t=e.images[e.index],n=t?.actionsSource?.asset;return`${t?.src??(n?JSON.stringify([n.environmentId,n.resource]):`image`)}:${e.index}`}function lv(e,t){let n=URL.createObjectURL(t);return e.src=n,()=>URL.revokeObjectURL(n)}function uv(e,t){let n=e.find(e=>e.id===t);if(n?.type===`file`&&n.file&&l(n))return{images:[{src:URL.createObjectURL(n.file),name:n.name,type:`video`}],index:0};let r=e.flatMap(e=>e.type===`image`&&e.previewUrl?[{id:e.id,src:e.previewUrl,name:e.name,source:e.source}]:[]);if(r.length===0)return null;let i=r.findIndex(e=>e.id===t);return i<0?null:{images:r.map(e=>({src:e.src,name:e.name,...e.source?.kind===`snap-shot`?{source:e.source}:{}})),index:i}}var dv=[];function fv(e){let t=e.fontStyle??0;return{...e.color?{color:e.color}:{},...t&1?{fontStyle:`italic`}:{},...t&2?{fontWeight:700}:{},...t&4?{textDecoration:`underline`}:{}}}function pv(e){let t=(0,H.c)(13),{code:n,language:r,embedded:i,theme:a,wordClassName:o}=e,s=i===void 0?dv:i,c;t[0]===r?c=t[1]:(c=vi(r),t[0]=r,t[1]=c);let l=(0,V.use)(c);for(let e of s)(0,V.use)(vi(e.language));let u;if(t[2]!==n||t[3]!==s||t[4]!==l||t[5]!==r||t[6]!==a){let e=Pn(a),i=(t,n)=>l.codeToTokens(t,{lang:n,theme:e}).tokens;u=vv(n,gv(n,i(n,r),s,i)),t[2]=n,t[3]=s,t[4]=l,t[5]=r,t[6]=a,t[7]=u}else u=t[7];let d=u,f;if(t[8]!==d||t[9]!==o){let e;t[11]===o?e=t[12]:(e=e=>{let{key:t,tokens:n,ending:r}=e;return(0,U.jsxs)(`span`,{children:[o?yv(n).map(e=>typeof e==`string`?e:(0,U.jsx)(`span`,{className:o,children:e.pieces.map(hv)},e.key)):n.map(mv),r]},t)},t[11]=o,t[12]=e),f=d.map(e),t[8]=d,t[9]=o,t[10]=f}else f=t[10];return f}function mv(e){return(0,U.jsx)(`span`,{style:fv(e),children:e.content},`${e.offset}:${e.content}`)}function hv(e){return(0,U.jsx)(`span`,{style:fv(e.token),children:e.text},e.key)}function gv(e,t,n,r){if(n.length===0)return t;let i=Array.from({length:e.length});for(let e of t.flat())i.fill(e,e.offset,e.offset+e.content.length);for(let e of n){let t;try{t=r(e.text,e.language)}catch{continue}for(let n of t.flat()){if(n.content===``)continue;let t=n.offset+n.content.length-1;i.fill(n,e.starts[n.offset],e.ends[t])}}return _v(e,i)}function _v(e,t){let n=[],r=0;for(let i of[...e.matchAll(/\r?\n/gu),void 0]){let a=i?.index??e.length,o=[];for(let n=r;n<a;){let r=t[n],i=n+1;for(;i<a&&t[i]?.color===r?.color&&t[i]?.fontStyle===r?.fontStyle;)i+=1;o.push({content:e.slice(n,i),offset:n,...r?.color?{color:r.color}:{},...r?.fontStyle?{fontStyle:r.fontStyle}:{}}),n=i}n.push(o),i&&(r=i.index+i[0].length)}return n}function vv(e,t){let n=e.match(/\r?\n/gu)??[],r=0;return t.map((e,t)=>{let i=e.map(e=>e.content).join(``),a=`${r}:${i}`,o=n[t]??``;return r+=i.length+o.length,{key:a,tokens:e,ending:o}})}function yv(e){let t=[],n=null;for(let r of e){let e=r.offset;for(let i of r.content.split(/(\s+)/u))i!==``&&(/^\s/u.test(i)?(t.push(i),n=null):(n||(n={key:String(e),pieces:[]},t.push(n)),n.pieces.push({key:String(e),text:i,token:r})),e+=i.length)}return t}var bv=`relative h-28 w-52 max-w-full overflow-hidden rounded-lg border border-border/80`;function xv(e){let t=(0,H.c)(9),{details:n,className:r}=e,{resolvedTheme:i}=$t(),a;t[0]!==n.content||t[1]!==n.format||t[2]!==i?(a=n.format===`json`?(0,U.jsx)(ei,{fallback:n.content,children:(0,U.jsx)(V.Suspense,{fallback:n.content,children:(0,U.jsx)(pv,{code:n.content,language:`json`,theme:i})})}):n.content,t[0]=n.content,t[1]=n.format,t[2]=i,t[3]=a):a=t[3];let o=a,s;t[4]===r?s=t[5]:(s=B(`overflow-auto whitespace-pre-wrap break-words font-mono focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70`,r),t[4]=r,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,U.jsx)(`pre`,{className:s,tabIndex:0,children:o}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Sv(e){if(e.accessibility?.format===`element-tree`)return{content:JSON.stringify(e.accessibility,null,2),format:`json`};let t=e.accessibility?.format===`flat-text`?e.accessibility.text.trim():e.accessibleText?.trim();return t?{content:t,format:`text`}:void 0}function Cv(e){return!!(e.accessibility||e.accessibleText?.trim())}function wv(e){let t=(0,H.c)(28),{source:n,className:r,side:i}=e,a=i===void 0?`top`:i,o;t[0]===n?o=t[1]:(o=Cv(n),t[0]=n,t[1]=o);let s=o,c=s?k:g,l;t[2]===n?l=t[3]:(l=Sv(n),t[2]=n,t[3]=l);let u=l,d=s?`Accessibility data`:`No accessibility data`,f=s?`View accessibility data`:`No accessibility data`,p;t[4]!==r||t[5]!==f?(p=(0,U.jsx)(di,{render:(0,U.jsx)(we,{"aria-label":f,className:r,onClick:Tv,size:`icon-micro`,variant:`overlay`})}),t[4]=r,t[5]=f,t[6]=p):p=t[6];let m;t[7]===c?m=t[8]:(m=(0,U.jsx)(c,{className:`size-3`,"aria-hidden":`true`}),t[7]=c,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,U.jsx)(Qn,{render:p,children:m}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let _;t[12]!==a||t[13]!==d?(_=(0,U.jsx)($n,{side:a,children:d}),t[12]=a,t[13]=d,t[14]=_):_=t[14];let v;t[15]!==h||t[16]!==_?(v=(0,U.jsxs)(er,{children:[h,_]}),t[15]=h,t[16]=_,t[17]=v):v=t[17];let y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,U.jsx)(ci,{children:`Accessibility data`}),t[18]=y):y=t[18];let b;t[19]!==u||t[20]!==s?(b=(0,U.jsxs)(`div`,{className:`max-h-[min(28rem,70vh)] space-y-2 overflow-y-auto`,children:[y,u?(0,U.jsx)(xv,{details:u,className:`max-h-64 rounded-md border border-border/70 bg-muted/45 p-2.5 text-2xs leading-4`}):s?(0,U.jsx)(`div`,{className:`rounded-md border border-border/70 bg-muted/45 p-2.5 text-muted-foreground text-xs leading-4`,children:`Structured accessibility elements were included, but they have no readable names or values.`}):(0,U.jsx)(`div`,{className:`rounded-md border border-border/70 bg-muted/45 p-2.5 text-muted-foreground text-xs leading-4`,children:`The app or capture backend did not provide verified accessibility data.`})]}),t[19]=u,t[20]=s,t[21]=b):b=t[21];let x;t[22]!==a||t[23]!==b?(x=(0,U.jsx)(li,{side:a,align:`center`,width:`md`,children:b}),t[22]=a,t[23]=b,t[24]=x):x=t[24];let S;return t[25]!==x||t[26]!==v?(S=(0,U.jsxs)(fi,{children:[v,x]}),t[25]=x,t[26]=v,t[27]=S):S=t[27],S}function Tv(e){return e.stopPropagation()}function Ev(e){let t=(0,H.c)(21),{source:n,className:r}=e,i;t[0]===r?i=t[1]:(i=B(`pointer-events-none absolute inset-x-0 bottom-0 flex min-w-0 items-center gap-1.5 bg-linear-to-t from-black/85 via-black/55 to-transparent px-2.5 pb-2 pt-6`,r),t[0]=r,t[1]=i);let a;t[2]!==n.appIconDataUrl||t[3]!==n.appName?(a=n.appIconDataUrl?(0,U.jsx)(`img`,{src:n.appIconDataUrl,alt:``,className:`size-7 shrink-0 rounded-md`}):(0,U.jsx)(`div`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md bg-white/20 text-3xs font-medium text-white uppercase`,children:n.appName.slice(0,1)}),t[2]=n.appIconDataUrl,t[3]=n.appName,t[4]=a):a=t[4];let o;t[5]===n.appName?o=t[6]:(o=(0,U.jsx)(`span`,{className:`truncate`,children:n.appName}),t[5]=n.appName,t[6]=o);let s;t[7]===n?s=t[8]:(s=(0,U.jsx)(wv,{source:n,className:`pointer-events-auto`}),t[7]=n,t[8]=s);let c;t[9]!==o||t[10]!==s?(c=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-2xs font-medium leading-3.5 text-white`,children:[o,s]}),t[9]=o,t[10]=s,t[11]=c):c=t[11];let l=n.windowTitle||`Captured window`,u;t[12]===l?u=t[13]:(u=(0,U.jsx)(`div`,{className:`truncate text-3xs leading-3.5 text-white/70`,children:l}),t[12]=l,t[13]=u);let d;t[14]!==c||t[15]!==u?(d=(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[c,u]}),t[14]=c,t[15]=u,t[16]=d):d=t[16];let f;return t[17]!==i||t[18]!==a||t[19]!==d?(f=(0,U.jsxs)(`div`,{className:i,children:[a,d]}),t[17]=i,t[18]=a,t[19]=d,t[20]=f):f=t[20],f}var Dv=8;function Ov(e){let t=(0,H.c)(44),{src:n,name:r,onError:i,ref:a}=e,o=(0,V.useRef)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={width:0,height:0},t[0]=s):s=t[0];let[c,l]=(0,V.useState)(s),[u,d]=(0,V.useState)(kv),[f,p]=(0,V.useState)(1),m=(0,V.useRef)(1),h=(0,V.useRef)(null),g=(0,V.useRef)(null),_=(0,V.useRef)(!1),[v,y]=(0,V.useState)(!1),b=Math.max(1,Math.min(u.height*.86,u.height-160)),x=Math.min(1,(u.width*.92-(u.width>=640?96:0))/(c.width||1),b/(c.height||1)),S=c.width*x*f,C=c.height*x*f,w,T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>({pan(e){let t=o.current;if(!t||m.current<=1||(e===`ArrowLeft`||e===`ArrowRight`)&&t.scrollWidth<=t.offsetWidth)return!1;bb36:switch(e){case`ArrowLeft`:t.scrollLeft-=40;break bb36;case`ArrowRight`:t.scrollLeft+=40;break bb36;case`ArrowUp`:t.scrollTop-=40;break bb36;case`ArrowDown`:t.scrollTop+=40;break bb36;default:return!1}return!0}}),T=[],t[1]=w,t[2]=T):(w=t[1],T=t[2]),(0,V.useImperativeHandle)(a,w,T);let E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=(e,t)=>{let n=o.current,r=m.current,i=Math.min(Dv,Math.max(1,e));if(!n||r===i)return;let a=n.getBoundingClientRect(),s=t?t.x-a.left:n.clientWidth/2,c=t?t.y-a.top:n.clientHeight/2;h.current={x:(n.scrollLeft+s)/r,y:(n.scrollTop+c)/r,clientX:a.left+s,clientY:a.top+c},m.current=i,p(i)},t[3]=E):E=t[3];let D=E,O,k;t[4]===f?(O=t[5],k=t[6]):(O=()=>{let e=o.current,t=h.current;if(!e||!t)return;let n=e.getBoundingClientRect();e.scrollLeft=t.x*f-(t.clientX-n.left),e.scrollTop=t.y*f-(t.clientY-n.top),h.current=null},k=[f],t[4]=f,t[5]=O,t[6]=k),(0,V.useLayoutEffect)(O,k);let A,j;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{let e=()=>{d({width:window.innerWidth,height:window.innerHeight}),D(1)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},j=[D],t[7]=A,t[8]=j):(A=t[7],j=t[8]),(0,V.useEffect)(A,j);let M,N;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>{let e=o.current;if(!e)return;let t=t=>{if(t.deltaY===0)return;t.preventDefault();let n=t.deltaY*(t.deltaMode===1?16:t.deltaMode===2?e.clientHeight:1);D(m.current*Math.exp(-n*(t.ctrlKey?.01:.002)),{x:t.clientX,y:t.clientY})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},M=[D],t[9]=M,t[10]=N):(M=t[9],N=t[10]),(0,V.useEffect)(N,M);let P=`${r}, zoomable image`,F=S||void 0,ee=C||void 0,te=f>1?v?`grabbing`:`grab`:`zoom-in`,ne;t[11]!==b||t[12]!==F||t[13]!==ee||t[14]!==te?(ne={width:F,height:ee,maxHeight:b,cursor:te},t[11]=b,t[12]=F,t[13]=ee,t[14]=te,t[15]=ne):ne=t[15];let re,I,L,ie,ae,oe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(re=e=>{_.current||e.detail>1||D(m.current>1?1:2,{x:e.clientX,y:e.clientY})},I=e=>{e.ctrlKey||e.metaKey||e.altKey||(e.key===`Enter`||e.key===` `?(e.preventDefault(),e.repeat||D(m.current>1?1:2)):e.key===`+`||e.key===`=`?(e.preventDefault(),D(m.current*1.5)):e.key===`-`?(e.preventDefault(),D(m.current/1.5)):e.key===`0`&&(e.preventDefault(),D(1)))},L=e=>{if(g.current||(_.current=!1,e.pointerType!==`mouse`||e.button!==0||m.current<=1))return;let t=e.currentTarget,n=t.getBoundingClientRect();e.clientX-n.left>=t.clientWidth||e.clientY-n.top>=t.clientHeight||(g.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,left:t.scrollLeft,top:t.scrollTop},t.setPointerCapture(e.pointerId),y(!0))},ie=e=>{let t=g.current;t&&t.pointerId===e.pointerId&&(Math.hypot(e.clientX-t.x,e.clientY-t.y)>4&&(_.current=!0),e.currentTarget.scrollLeft=t.left-(e.clientX-t.x),e.currentTarget.scrollTop=t.top-(e.clientY-t.y))},ae=e=>{g.current?.pointerId===e.pointerId&&(e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),g.current=null,y(!1))},oe=e=>{g.current?.pointerId===e.pointerId&&(g.current=null,y(!1))},t[16]=re,t[17]=I,t[18]=L,t[19]=ie,t[20]=ae,t[21]=oe):(re=t[16],I=t[17],L=t[18],ie=t[19],ae=t[20],oe=t[21]);let se;t[22]!==C||t[23]!==b||t[24]!==c.width||t[25]!==S?(se=c.width?{width:S,height:C}:{maxWidth:`var(--media-width)`,maxHeight:b},t[22]=C,t[23]=b,t[24]=c.width,t[25]=S,t[26]=se):se=t[26];let ce;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ce=e=>{l({width:e.currentTarget.naturalWidth,height:e.currentTarget.naturalHeight})},t[27]=ce):ce=t[27];let le;t[28]!==r||t[29]!==i||t[30]!==n||t[31]!==se?(le=(0,U.jsx)(`img`,{src:n,alt:r,draggable:!1,className:`block max-w-none select-none`,style:se,onLoad:ce,onError:i}),t[28]=r,t[29]=i,t[30]=n,t[31]=se,t[32]=le):le=t[32];let ue;t[33]!==P||t[34]!==ne||t[35]!==le?(ue=(0,U.jsx)(`div`,{ref:o,role:`region`,"aria-label":P,"aria-description":`Click to zoom in or return to fit. Scroll to zoom, drag to pan. Use Enter to toggle zoom, plus or minus to zoom, and 0 to fit.`,tabIndex:0,className:`max-w-[var(--media-width)] overflow-auto overscroll-contain rounded-lg bg-background shadow-2xl ring-1 ring-border/70 outline-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring`,style:ne,onClick:re,onKeyDown:I,onPointerDown:L,onPointerMove:ie,onPointerUp:ae,onLostPointerCapture:oe,children:le}),t[33]=P,t[34]=ne,t[35]=le,t[36]=ue):ue=t[36];let de;t[37]===f?de=t[38]:(de=Math.round(f*100),t[37]=f,t[38]=de);let R;t[39]===de?R=t[40]:(R=(0,U.jsxs)(`span`,{className:`sr-only`,"aria-live":`polite`,children:[de,`% zoom`]}),t[39]=de,t[40]=R);let fe;return t[41]!==ue||t[42]!==R?(fe=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[ue,R]}),t[41]=ue,t[42]=R,t[43]=fe):fe=t[43],fe}function kv(){return{width:window.innerWidth,height:window.innerHeight}}var Av=`flex aspect-auto h-48 min-h-0 w-[min(var(--media-width),32rem)] flex-col items-center justify-center gap-3 rounded-lg border border-border/70 bg-black p-6 text-center text-sm text-white shadow-2xl`;function jv(e){let t=(0,H.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,U.jsx)(`div`,{role:`alert`,className:Av,children:n}),t[0]=n,t[1]=r),r}function Mv(e){let t=(0,H.c)(7),{item:n}=e,r=n.actionsSource?.asset,i=pr(r?.environmentId??null,r?.resource??null),a=mr(r?.environmentId??null,r?.resource??null),o=r?i._tag===`Success`?i.url+(n.srcFragment??``):null:n.src,s=i._tag===`Failure`,c=n.autoPlay??!0,l=r?a:void 0,u;return t[0]!==n.name||t[1]!==n.originalUrl||t[2]!==o||t[3]!==s||t[4]!==c||t[5]!==l?(u=(0,U.jsx)(Ea,{src:o,label:n.name,sourceFailed:s,originalUrl:n.originalUrl,preload:`metadata`,autoPlay:c,className:`block max-h-[var(--media-height)] max-w-[var(--media-width)] text-center`,videoClassName:`aspect-auto max-h-[var(--media-height)] w-auto max-w-[var(--media-width)] rounded-lg border border-border/70 shadow-2xl`,stateClassName:Av,onRetry:l}),t[0]=n.name,t[1]=n.originalUrl,t[2]=o,t[3]=s,t[4]=c,t[5]=l,t[6]=u):u=t[6],u}var Nv=(0,V.memo)(function(e){let t=(0,H.c)(74),{preview:n,onClose:r}=e,[i,a]=(0,V.useState)(0),[o,s]=(0,V.useState)(null),[l,u]=(0,V.useState)(null),d=(0,V.useRef)(null),[f]=(0,V.useState)(Pv),p=(0,V.useRef)(null),m=n.images.length,h=m>0?((n.index+i)%m+m)%m:0,g=n.images[h],_;t[0]!==g?.actionsSource||t[1]!==g?.name||t[2]!==g?.src||t[3]!==g?.type?(_=g?.actionsSource??{kind:g?.type===`video`?`video`:`image`,name:g?.name??`Media`,src:g?.src??null},t[0]=g?.actionsSource,t[1]=g?.name,t[2]=g?.src,t[3]=g?.type,t[4]=_):_=t[4];let v=_,y=v.onOpenFile,b;t[5]!==r||t[6]!==y||t[7]!==v?(b=y?{...v,onOpenFile:()=>{y(),r()}}:v,t[5]=r,t[6]=y,t[7]=v,t[8]=b):b=t[8];let x=b,S;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{a(t=>t+e)},t[9]=S):S=t[9];let C=S,w=(0,V.useRef)(null),T,E;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>(w.current=document.activeElement,()=>{let e=w.current;e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}),E=[],t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,V.useEffect)(T,E);let D;t[12]===n.images.length?D=t[13]:(D=e=>{e.defaultPrevented||en()||e.target instanceof HTMLVideoElement||(d.current?.pan(e.key)?(e.preventDefault(),e.stopPropagation()):n.images.length<=1||(e.key===`ArrowLeft`?(e.preventDefault(),e.stopPropagation(),C(-1)):e.key===`ArrowRight`&&(e.preventDefault(),e.stopPropagation(),C(1))))},t[12]=n.images.length,t[13]=D);let O=D,k,A;if(t[14]===r?(k=t[15],A=t[16]):(k=()=>{let e=e=>{e.key!==`Escape`||en()||(e.preventDefault(),e.stopPropagation(),r())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},A=[r],t[14]=r,t[15]=k,t[16]=A),(0,V.useEffect)(k,A),!g)return null;let j=g.type===`video`?`video`:`image`,M;t[17]===g.originalUrl?M=t[18]:(M=g.originalUrl&&da(g.originalUrl)!==null?(0,U.jsx)(ba,{originalUrl:g.originalUrl}):null,t[17]=g.originalUrl,t[18]=M);let N=M,P;t[19]===g.source?P=t[20]:(P=g.source?Sv(g.source):void 0,t[19]=g.source,t[20]=P);let F=P,ee=!!F&&l===g.src,te=ee?`Show screenshot`:F?.format===`json`?`Show accessibility JSON`:`Show extracted text`,ne;t[21]===r?ne=t[22]:(ne=e=>{e||r()},t[21]=r,t[22]=ne);let re;t[23]===f?re=t[24]:(re=()=>f,t[23]=f,t[24]=re);let I;t[25]===r?I=t[26]:(I=e=>{e.target===e.currentTarget&&r()},t[25]=r,t[26]=I);let L;t[27]===j?L=t[28]:(L=(0,U.jsxs)(ar,{className:`sr-only`,children:[`Expanded `,j,` preview`]}),t[27]=j,t[28]=L);let ie=`Close ${j} preview`,ae;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,U.jsx)(ce,{}),t[29]=ae):ae=t[29];let oe;t[30]!==r||t[31]!==ie?(oe=(0,U.jsx)(we,{type:`button`,ref:p,size:`icon-sm`,variant:`media-close`,className:`absolute right-0 top-0 z-20`,onClick:r,"aria-label":ie,children:ae}),t[30]=r,t[31]=ie,t[32]=oe):oe=t[32];let se;t[33]===n.images.length?se=t[34]:(se=n.images.length>1&&(0,U.jsx)(we,{type:`button`,size:`icon`,variant:`media-navigation`,className:`left-0 top-auto bottom-0 translate-y-0 sm:top-1/2 sm:bottom-auto sm:-translate-y-1/2`,"aria-label":`Previous media`,onClick:()=>C(-1),children:(0,U.jsx)(be,{className:`size-5`})}),t[33]=n.images.length,t[34]=se);let le;t[35]!==F||t[36]!==o||t[37]!==h||t[38]!==g||t[39]!==N||t[40]!==ee?(le=g.type===`video`?(0,U.jsx)(Mv,{item:g},h):ee?F?(0,U.jsx)(xv,{details:F,className:`h-[min(var(--media-height),40rem)] w-[min(var(--media-width),42rem)] transition-opacity duration-140 ease-out starting:opacity-0 rounded-lg border border-border/70 bg-background p-4 text-xs leading-5 shadow-2xl motion-reduce:transition-none`}):null:g.src===null||o===g.src?(0,U.jsxs)(jv,{children:[(0,U.jsx)(`p`,{children:N?`This image could not be loaded.`:`Image unavailable. The file may have been moved or deleted.`}),N]}):(0,U.jsx)(Ov,{ref:d,src:g.src,name:g.name,onError:()=>s(g.src)},`${h}:${g.src}`),t[35]=F,t[36]=o,t[37]=h,t[38]=g,t[39]=N,t[40]=ee,t[41]=le):le=t[41];let ue=n.images.length>1?` (${h+1}/${n.images.length})`:``,de;t[42]!==g.name||t[43]!==ue?(de=(0,U.jsxs)(`span`,{className:`truncate`,"aria-live":`polite`,"aria-atomic":`true`,children:[g.name,ue]}),t[42]=g.name,t[43]=ue,t[44]=de):de=t[44];let R;t[45]!==F||t[46]!==te||t[47]!==g.source||t[48]!==g.src||t[49]!==ee?(R=F&&g.source?(0,U.jsx)(we,{"aria-label":te,"aria-pressed":ee,onClick:()=>u(ee?null:g.src),size:`icon-micro`,variant:`overlay`,children:(0,U.jsx)(qt,{className:`size-3`,"aria-hidden":`true`,icon:ee?Ht:Wt})}):g.source?(0,U.jsx)(wv,{source:g.source,side:`top`}):null,t[45]=F,t[46]=te,t[47]=g.source,t[48]=g.src,t[49]=ee,t[50]=R):R=t[50];let fe;t[51]!==de||t[52]!==R?(fe=(0,U.jsxs)(`div`,{className:`mt-2 flex max-w-[var(--media-width)] items-center justify-center gap-1.5 text-xs text-white/80 max-sm:px-10`,children:[de,R]}),t[51]=de,t[52]=R,t[53]=fe):fe=t[53];let z;t[54]!==le||t[55]!==fe?(z=(0,U.jsxs)(`div`,{className:`relative isolate z-10 flex max-h-full max-w-[var(--media-width)] flex-col items-center`,children:[le,fe]}),t[54]=le,t[55]=fe,t[56]=z):z=t[56];let pe;t[57]!==x||t[58]!==z?(pe=(0,U.jsx)(Ta,{source:x,showTooltip:!1,children:z}),t[57]=x,t[58]=z,t[59]=pe):pe=t[59];let me;t[60]===n.images.length?me=t[61]:(me=n.images.length>1&&(0,U.jsx)(we,{type:`button`,size:`icon`,variant:`media-navigation`,className:`right-0 top-auto bottom-0 translate-y-0 sm:top-1/2 sm:bottom-auto sm:-translate-y-1/2`,"aria-label":`Next media`,onClick:()=>C(1),children:(0,U.jsx)(c,{className:`size-5`})}),t[60]=n.images.length,t[61]=me);let he;t[62]!==O||t[63]!==re||t[64]!==I||t[65]!==L||t[66]!==oe||t[67]!==se||t[68]!==pe||t[69]!==me?(he=(0,U.jsxs)(or,{...We,variant:`media`,showCloseButton:!1,bottomStickOnMobile:!1,className:`row-start-1 h-full max-h-[92vh] w-[92vw] max-w-[92vw] items-center justify-center overflow-visible [--media-width:92vw] [--media-height:min(86vh,calc(100vh-160px))] sm:[--media-width:calc(92vw-96px)]`,onKeyDown:O,initialFocus:p,finalFocus:re,onClick:I,children:[L,oe,se,pe,me]}),t[62]=O,t[63]=re,t[64]=I,t[65]=L,t[66]=oe,t[67]=se,t[68]=pe,t[69]=me,t[70]=he):he=t[70];let ge;return t[71]!==ne||t[72]!==he?(ge=(0,U.jsx)(sr,{open:!0,onOpenChange:ne,children:he}),t[71]=ne,t[72]=he,t[73]=ge):ge=t[73],ge});function Pv(){return document.activeElement instanceof HTMLElement?document.activeElement:null}var Fv=new WeakMap;function Iv(e,t){let n=e.closest(`[data-image-gallery]`)??e.closest(`.chat-markdown`),r=[],i=-1;for(let a of n?.querySelectorAll(`img`)??[]){let n=Fv.get(a);if(!n)continue;let o=a.closest(`a`),s=o?.getAttribute(`href`)??``;if(o&&wt(s)!==`image`)continue;let c=da(s)===null?null:pa(s),l=Un(s),u=c?{...n,src:c,originalUrl:s,actionsSource:{kind:`image`,name:n.name,src:c,...l?{reference:l}:{}}}:n;a===e||!Fv.has(e)&&i<0&&u.src===t.src?(i=r.length,r.push(t)):r.push(u)}return i<0?{images:[t],index:0}:{images:r,index:i}}function Lv(e){let t=(0,H.c)(5),n=mi(e.environmentId,e.path,e.cwd),r=n?.kind===`directory`?`directory`:`file`,i=n?.mimeType,a;return t[0]!==e.path||t[1]!==e.theme||t[2]!==r||t[3]!==i?(a=(0,U.jsx)(Tr,{pathValue:e.path,kind:r,mimeType:i,theme:e.theme}),t[0]=e.path,t[1]=e.theme,t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Rv(e){let t=(0,H.c)(5),n=mi(e.environmentId,e.path,e.cwd),r=e.label??e.path,i;t[0]===n?i=t[1]:(i=n?.byteLength===void 0?null:` · ${wr(n.byteLength)}`,t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,U.jsxs)(U.Fragment,{children:[r,i]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function zv(e){let t=(0,H.c)(10),n;t[0]!==e.cwd||t[1]!==e.environmentId||t[2]!==e.path||t[3]!==e.theme?(n=(0,U.jsx)(Lv,{path:e.path,environmentId:e.environmentId,cwd:e.cwd,theme:e.theme}),t[0]=e.cwd,t[1]=e.environmentId,t[2]=e.path,t[3]=e.theme,t[4]=n):n=t[4];let r;t[5]===e.label?r=t[6]:(r=(0,U.jsx)(Xg,{children:e.label}),t[5]=e.label,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,U.jsxs)(U.Fragment,{children:[n,r]}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}function Bv(e){let t=e.children.find(e=>e.type===`element`&&e.tagName===`pre`);if(t?.type!==`element`)throw Error(`Missing highlighted pre element`);let n=t.children.find(e=>e.type===`element`&&e.tagName===`code`);if(n?.type!==`element`)throw Error(`Missing highlighted code element`);return n.children}function Vv(e,t,n){let r={lang:t,theme:n},i={type:`text`,value:`
42
42
  `},a;return n=>{if(!t||[`text`,`plaintext`,`plain`,`txt`,`ansi`].includes(t)||n.includes(`\r`))return e.codeToHast(n,r);a&&!n.startsWith(a.prefix)&&(a=void 0);let o=n.lastIndexOf(`
43
43
  `)+1;if(o>(a?.prefix.length??0)){let t=e.codeToHast(n.slice(a?.prefix.length??0,o-1),{...r,...a?{grammarState:a.state}:{}}),s=e.getLastGrammarState(t);if(!s)return a=void 0,e.codeToHast(n,r);a={prefix:n.slice(0,o),state:s,children:[...a?[...a.children,i]:[],...Bv(t)]}}let s=a;return s?e.codeToHast(n.slice(s.prefix.length),{...r,grammarState:s.state,transformers:[{code:e=>({...e,children:[...s.children,i,...e.children]})}]}):e.codeToHast(n,r)}}var Hv={Fragment:U.Fragment,jsx:U.jsx,jsxs:U.jsxs};function Uv(e){let t=_h({...e,children:[]},Hv);if(!(0,V.isValidElement)(t))throw Error(`Expected a highlighted code element`);return t}var Wv=(0,V.memo)(function({node:e}){return e.type===`element`?(0,V.cloneElement)(Uv(e),{dangerouslySetInnerHTML:{__html:Cn({type:`root`,children:e.children})}}):_h(e,Hv)});function Gv({root:e}){let t=e.children[0];if(t?.type!==`element`||t.tagName!==`pre`)return _h(e,Hv);let n=t.children[0];return n?.type!==`element`||n.tagName!==`code`?_h(e,Hv):(0,V.cloneElement)(Uv(t),void 0,(0,V.cloneElement)(Uv(n),void 0,n.children.map((e,t)=>(0,U.jsx)(Wv,{node:e},t))))}function Kv(e,t){this.v=e,this.k=t}function qv(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Jv(e){if(Array.isArray(e))return e}function Yv(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Xv(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
44
44
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zv(e,t){return Jv(e)||Yv(e,t)||Qv(e,t)||Xv()}function Qv(e,t){if(e){if(typeof e==`string`)return qv(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qv(e,t):void 0}}function $v(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof Kv;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}$v.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},$v.prototype.next=function(e){return this._invoke(`next`,e)},$v.prototype.throw=function(e){return this._invoke(`throw`,e)},$v.prototype.return=function(e){return this._invoke(`return`,e)};var ey=Object.entries,ty=Object.setPrototypeOf,ny=Object.isFrozen,ry=Object.getPrototypeOf,iy=Object.getOwnPropertyDescriptor,ay=Object.freeze,oy=Object.seal,sy=Object.create,cy=typeof Reflect<`u`&&Reflect,ly=cy.apply,uy=cy.construct;ay||=function(e){return e},oy||=function(e){return e},ly||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},uy||=function(e){return new e(...[...arguments].slice(1))};var dy=jy(Array.prototype.forEach);Array.prototype.indexOf;var fy=jy(Array.prototype.lastIndexOf),py=jy(Array.prototype.pop),my=jy(Array.prototype.push);Array.prototype.slice;var hy=jy(Array.prototype.splice),gy=Array.isArray,_y=jy(String.prototype.toLowerCase),vy=jy(String.prototype.toString),yy=jy(String.prototype.match),by=jy(String.prototype.replace),xy=jy(String.prototype.indexOf),Sy=jy(String.prototype.trim),Cy=jy(Number.prototype.toString),wy=jy(Boolean.prototype.toString),Ty=typeof BigInt>`u`?null:jy(BigInt.prototype.toString),Ey=typeof Symbol>`u`?null:jy(Symbol.prototype.toString),Dy=jy(Object.prototype.hasOwnProperty),Oy=jy(Object.prototype.toString),ky=jy(RegExp.prototype.test),Ay=My(TypeError);function jy(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return ly(e,t,n)}}function My(e){return function(){return uy(e,[...arguments])}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_y;if(ty&&ty(e,null),!gy(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(ny(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Ny(e){for(let t=0;t<e.length;t++)Dy(e,t)||(e[t]=null);return e}function Py(e){let t=sy(null);for(let r of ey(e)){var n=Zv(r,2);let i=n[0],a=n[1];Dy(e,i)&&(t[i]=gy(a)?Ny(a):a&&typeof a==`object`&&a.constructor===Object?Py(a):a)}return t}function Fy(e){switch(typeof e){case`string`:return e;case`number`:return Cy(e);case`boolean`:return wy(e);case`bigint`:return Ty?Ty(e):`0`;case`symbol`:return Ey?Ey(e):`Symbol()`;case`undefined`:return Oy(e);case`function`:case`object`:{if(e===null)return Oy(e);let t=e,n=Iy(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Oy(e)}return Oy(e)}default:return Oy(e)}}function Iy(e,t){for(;e!==null;){let n=iy(e,t);if(n){if(n.get)return jy(n.get);if(typeof n.value==`function`)return jy(n.value)}e=ry(e)}function n(){return null}return n}function Ly(e){try{return ky(e,``),!0}catch{return!1}}var Ry=ay(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),zy=ay(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),By=ay([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Vy=ay([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Hy=ay(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Uy=ay([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Wy=ay([`#text`]),Gy=ay(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Ky=ay(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),qy=ay(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Jy=ay([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Yy=oy(/{{[\w\W]*|^[\w\W]*}}/g),Xy=oy(/<%[\w\W]*|^[\w\W]*%>/g),Zy=oy(/\${[\w\W]*/g),Qy=oy(/^data-[\-\w.\u00B7-\uFFFF]+$/),$y=oy(/^aria-[\-\w]+$/),eb=oy(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tb=oy(/^(?:\w+script|data):/i),nb=oy(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),rb=oy(/^html$/i),ib=oy(/^[a-z][.\w]*(-[.\w]+)+$/i),ab=oy(/<[/\w!]/g),ob=oy(/<[/\w]/g),sb=oy(/<\/no(script|embed|frames)/i),cb=oy(/\/>/i),lb={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ub=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],db=ay($({},ub)),fb=function(){let e={};return dy(ub,t=>{e[t]=oy(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),ay(e)}(),pb=function(){return typeof window>`u`?null:window},mb=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},hb=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},gb=function(e,t,n,r){return Dy(e,t)&&gy(e[t])?$(r.base?Py(r.base):{},e[t],r.transform):n},_b=function(e,t,n){let r=Dy(e,t)?e[t]:void 0;return r&&typeof r==`object`?Py(r):n()};function vb(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:pb(),t=e=>vb(e);if(t.version=`3.4.16`,t.removed=[],!e||!e.document||e.document.nodeType!==lb.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Iy(d,`cloneNode`),p=Iy(d,`remove`),m=Iy(d,`removeAttributeNode`),h=Iy(d,`nextSibling`),g=Iy(d,`childNodes`),_=Iy(d,`parentNode`),v=Iy(d,`shadowRoot`),y=Iy(d,`attributes`),b=o&&o.prototype?Iy(o.prototype,`nodeType`):null,x=o&&o.prototype?Iy(o.prototype,`nodeName`):null,S=o&&o.prototype?Iy(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let T,E=``,D,O=!1,k=0,A=function(){if(k>0)throw Ay(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},j=function(e){A(),k++;try{return T.createHTML(e)}finally{k--}},M=function(e){A(),k++;try{return T.createScriptURL(e)}finally{k--}},N=function(){return O||=(D=mb(u,i),!0),D},P=n,F=P.implementation,ee=P.createNodeIterator,te=P.createDocumentFragment,ne=P.getElementsByTagName,re=r.importNode,I=hb();t.isSupported=typeof ey==`function`&&typeof _==`function`&&F&&F.createHTMLDocument!==void 0;let L=Yy,ie=Xy,ae=Zy,oe=Qy,se=$y,ce=tb,le=nb,ue=ib,de=eb,R=null,fe=$({},[...Ry,...zy,...By,...Hy,...Wy]),z=null,pe=$({},[...Gy,...Ky,...qy,...Jy]),me=Object.seal(sy(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),he=null,ge=null,_e=Object.seal(sy(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ve=!0,ye=!0,be=!1,xe=!0,Se=!1,Ce=!0,we=!1,Te=!1,Ee=null,De=null,Oe=!1,ke=!1,Ae=!1,je=!1,Me=!0,Ne=!1,Pe=`user-content-`,Fe=!0,Ie=!1,Le={},Re=null,B=$({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),ze=null,Be=$({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ve=null,He=$({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ue=`http://www.w3.org/1998/Math/MathML`,We=`http://www.w3.org/2000/svg`,Ge=`http://www.w3.org/1999/xhtml`,Ke=Ge,qe=!1,Je=null,Ye=$({},[Ue,We,Ge],vy),Xe=ay([`mi`,`mo`,`mn`,`ms`,`mtext`]),Ze=$({},Xe),Qe=ay([`annotation-xml`]),$e=$({},Qe),et=$({},[`title`,`style`,`font`,`a`,`script`]),tt=null,nt=[`application/xhtml+xml`,`text/html`],rt=null,it=null,at=n.createElement(`form`),ot=function(e){return e instanceof RegExp||e instanceof Function},st=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(it&&it===e)return;e&&typeof e==`object`||(e={}),e=Py(e),tt=nt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,rt=tt===`application/xhtml+xml`?vy:_y,R=gb(e,`ALLOWED_TAGS`,fe,{transform:rt}),z=gb(e,`ALLOWED_ATTR`,pe,{transform:rt}),Je=gb(e,`ALLOWED_NAMESPACES`,Ye,{transform:vy}),Ve=gb(e,`ADD_URI_SAFE_ATTR`,He,{transform:rt,base:He}),ze=gb(e,`ADD_DATA_URI_TAGS`,Be,{transform:rt,base:Be}),Re=gb(e,`FORBID_CONTENTS`,B,{transform:rt}),he=gb(e,`FORBID_TAGS`,Py({}),{transform:rt}),ge=gb(e,`FORBID_ATTR`,Py({}),{transform:rt}),Le=Dy(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Py(e.USE_PROFILES):e.USE_PROFILES:!1,ve=e.ALLOW_ARIA_ATTR!==!1,ye=e.ALLOW_DATA_ATTR!==!1,be=e.ALLOW_UNKNOWN_PROTOCOLS||!1,xe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Se=e.SAFE_FOR_TEMPLATES||!1,Ce=e.SAFE_FOR_XML!==!1,we=e.WHOLE_DOCUMENT||!1,ke=e.RETURN_DOM||!1,Ae=e.RETURN_DOM_FRAGMENT||!1,je=e.RETURN_TRUSTED_TYPE||!1,Oe=e.FORCE_BODY||!1,Me=e.SANITIZE_DOM!==!1,Ne=e.SANITIZE_NAMED_PROPS||!1,Fe=e.KEEP_CONTENT!==!1,Ie=e.IN_PLACE||!1,de=Ly(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:eb,Ke=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ge,Ze=_b(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>$({},Xe)),$e=_b(e,`HTML_INTEGRATION_POINTS`,()=>$({},Qe));let t=_b(e,`CUSTOM_ELEMENT_HANDLING`,()=>sy(null));if(me=sy(null),Dy(t,`tagNameCheck`)&&ot(t.tagNameCheck)&&(me.tagNameCheck=t.tagNameCheck),Dy(t,`attributeNameCheck`)&&ot(t.attributeNameCheck)&&(me.attributeNameCheck=t.attributeNameCheck),Dy(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(me.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),oy(me),Se&&(ye=!1),Ae&&(ke=!0),Le&&(R=$({},Wy),z=sy(null),Le.html===!0&&($(R,Ry),$(z,Gy)),Le.svg===!0&&($(R,zy),$(z,Ky),$(z,Jy)),Le.svgFilters===!0&&($(R,By),$(z,Ky),$(z,Jy)),Le.mathMl===!0&&($(R,Hy),$(z,qy),$(z,Jy))),_e.tagCheck=null,_e.attributeCheck=null,Dy(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?_e.tagCheck=e.ADD_TAGS:gy(e.ADD_TAGS)&&(R===fe&&(R=Py(R)),$(R,e.ADD_TAGS,rt))),Dy(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?_e.attributeCheck=e.ADD_ATTR:gy(e.ADD_ATTR)&&(z===pe&&(z=Py(z)),$(z,e.ADD_ATTR,rt))),Dy(e,`ADD_FORBID_CONTENTS`)&&gy(e.ADD_FORBID_CONTENTS)&&(Re===B&&(Re=Py(Re)),$(Re,e.ADD_FORBID_CONTENTS,rt)),Fe&&(R[`#text`]=!0),we&&$(R,[`html`,`head`,`body`]),R.table&&($(R,[`tbody`]),delete he.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Ay(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Ay(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=T;T=e.TRUSTED_TYPES_POLICY;try{E=j(``)}catch(e){throw T=t,e}}else e.TRUSTED_TYPES_POLICY===null?(T=void 0,E=``):(T===void 0&&(T=N()),T&&typeof E==`string`&&(E=j(``)));ay&&ay(e),it=e},ct=$({},[...zy,...By,...Vy]),lt=$({},[...Hy,...Uy]),ut=function(e,t,n){return t.namespaceURI===Ge?e===`svg`:t.namespaceURI===Ue?e===`svg`&&(n===`annotation-xml`||Ze[n]):!!ct[e]},dt=function(e,t,n){return t.namespaceURI===Ge?e===`math`:t.namespaceURI===We?e===`math`&&$e[n]:!!lt[e]},ft=function(e,t,n){return t.namespaceURI===We&&!$e[n]||t.namespaceURI===Ue&&!Ze[n]?!1:!lt[e]&&(et[e]||!ct[e])},pt=function(e){let t=_(e);t&&t.tagName||(t={namespaceURI:Ke,tagName:`template`});let n=_y(e.tagName),r=_y(t.tagName);return Je[e.namespaceURI]?e.namespaceURI===We?ut(n,t,r):e.namespaceURI===Ue?dt(n,t,r):e.namespaceURI===Ge?ft(n,t,r):!!(tt===`application/xhtml+xml`&&Je[e.namespaceURI]):!1},mt=function(e){my(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw Ay(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},ht=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},gt=function(e){yt(e);let t=g(e);if(t){let e=[];dy(t,t=>{my(e,t)}),dy(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&ht(e,r,i)}},_t=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}my(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(ke||Ae)try{mt(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},vt=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||z[rt(i)]||ht(e,r,i)}},yt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===lb.element&&vt(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},bt=function(e,t){return Ce?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},xt=function(e){if(!Ce)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===lb.processingInstruction||n===lb.comment&&ky(ob,e.data)){try{p(e)}catch{}continue}if(n===lb.element){let t=e,n=rt(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&bt(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},St=function(e){let t=null,r=null;if(Oe)e=`<remove></remove>`+e;else{let t=yy(e,/^[\r\n\t ]+/);r=t&&t[0]}tt===`application/xhtml+xml`&&Ke===Ge&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=T?j(e):e;if(Ke===Ge)try{t=new l().parseFromString(i,tt)}catch{}if(!t||!t.documentElement){t=F.createDocument(Ke,`template`,null);try{t.documentElement.innerHTML=qe?E:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ke===Ge?ne.call(t,we?`html`:`body`)[0]:we?t.documentElement:a},Ct=function(e){let t=S?S(e):e.ownerDocument;return ee.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},wt=function(e){return e=by(e,L,` `),e=by(e,ie,` `),e=by(e,ae,` `),e},Tt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ee.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=wt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&dy(i,e=>{Dt(e.content)&&Tt(e.content)})},Et=function(e){let t=x?x(e):null;return typeof t!=`string`||rt(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Dt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===lb.documentFragment}catch{return!1}},Ot=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function kt(e,n,r){e.length!==0&&dy(e,e=>{e.call(t,n,r,it)})}let At=function(e,t){return!!(Ce&&e.hasChildNodes()&&!Ot(e.firstElementChild)&&ky(ab,e.textContent)&&ky(ab,e.innerHTML)||Ce&&e.namespaceURI===Ge&&db[t]&&(Ot(e.firstElementChild)||typeof e.textContent==`string`&&ky(fb[t],e.textContent))||e.nodeType===lb.processingInstruction||Ce&&e.nodeType===lb.comment&&ky(ob,e.data))},jt=function(e,t){return e instanceof RegExp?ky(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Mt=function(e,t,n){if(!he[t]&&Rt(t)&&jt(me.tagNameCheck,t))return!1;if(Fe&&!Re[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return mt(e),!0},Nt=function(e,t,n,r){return e.length===0?t:t===n||t===r?Py(t):t},Pt=function(e,t){return e===t||_(e)!==null?!1:(Ie&&yt(e),!0)},Ft=function(e,n){if(kt(I.beforeSanitizeElements,e,null),Pt(e,n))return!0;if(Et(e))return mt(e),!0;let r=rt(w(e));if(R=Nt(I.uponSanitizeElement,R,fe,Ee),kt(I.uponSanitizeElement,e,{tagName:r,allowedTags:R}),Pt(e,n))return!0;if(At(e,r))return mt(e),!0;if(he[r]||!(_e.tagCheck instanceof Function&&_e.tagCheck(r))&&!R[r]){let t=Mt(e,r,n);return t===!1&&(kt(I.afterSanitizeElements,e,null),Pt(e,n))?!0:t}if(C(e)===lb.element&&!pt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&ky(sb,e.innerHTML))return mt(e),!0;if(Se&&e.nodeType===lb.text){let n=wt(e.textContent);e.textContent!==n&&(my(t.removed,{element:e.cloneNode()}),e.textContent=n)}return kt(I.afterSanitizeElements,e,null),Pt(e,n)},It=function(e,t,r){if(ge[t]||bt(t,e)||Me&&(t===`id`||t===`name`)&&(r in n||r in at))return!1;let i=z[t]||_e.attributeCheck instanceof Function&&_e.attributeCheck(t,e);return ye&&ky(oe,t)||ve&&ky(se,t)?!0:i?Ve[t]||ky(de,by(r,le,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&xy(r,`data:`)===0&&ze[e]||be&&!ky(ce,by(r,le,``))?!0:!r:Rt(e)&&jt(me.tagNameCheck,e)&&jt(me.attributeNameCheck,t,e)||t===`is`&&me.allowCustomizedBuiltInElements&&jt(me.tagNameCheck,r)},Lt=$({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Rt=function(e){return!Lt[_y(e)]&&ky(ue,e)},zt=function(e,t,n,r){if(T&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return j(r);case`TrustedScriptURL`:return M(r)}return r},Bt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Et(e)||(mt(e),!1)}catch{return _t(t,e),!1}},Vt=function(e,n){if(kt(I.beforeSanitizeAttributes,e,null),Pt(e,n))return;let r=e.attributes;if(!r||Et(e))return;z=Nt(I.uponSanitizeAttribute,z,pe,De);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0},a=r.length,o=rt(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=rt(s),d=l,f=s===`value`?d:Sy(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,kt(I.uponSanitizeAttribute,e,i),f=i.attrValue,Ne&&(u===`id`||u===`name`)&&xy(f,Pe)!==0&&(_t(s,e,n),f=Pe+f,p=!0),Ce&&ky(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)||u===`attributename`&&yy(f,`href`)?_t(s,e,n):i.forceKeepAttr||(i.keepAttr?!xe&&ky(cb,f)?_t(s,e,n):(Se&&(f=wt(f)),It(o,u,f)?(f=zt(o,u,c,f),f!==d&&Bt(e,s,c,f)&&p&&py(t.removed)):_t(s,e,n)):_t(s,e,n))}kt(I.afterSanitizeAttributes,e,null),Pt(e,n)},Ht=function(e){let t=null,n=Ct(e);for(kt(I.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(kt(I.uponSanitizeShadowNode,t,null),Ft(t,e),Vt(t,e),Dt(t.content)&&Ht(t.content),C(t)===lb.element){let e=v(t);Dt(e)&&(Ut(e),Ht(e))}kt(I.afterSanitizeShadowDOM,e,null)},Ut=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Ht(e.shadow);continue}let n=e.node,r=C(n)===lb.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&rt(e)===`template`){let e=n.content;Dt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Dt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(qe=!e,qe&&(e=`<!-->`),typeof e!=`string`&&!Ot(e)&&(e=Fy(e),typeof e!=`string`))throw Ay(`dirty is not a string, aborting`);if(!t.isSupported)return e;Te?(R=Ee,z=De):st(n),(I.uponSanitizeElement.length>0||I.uponSanitizeAttribute.length>0)&&(R=Py(R)),I.uponSanitizeAttribute.length>0&&(z=Py(z)),t.removed=[];let c=Ie&&typeof e!=`string`&&Ot(e);if(c){xt(e);let t=w(e);if(typeof t==`string`){let n=rt(t);if(!R[n]||he[n])throw gt(e),Ay(`root node is forbidden and cannot be sanitized in-place`)}if(Et(e))throw gt(e),Ay(`root node is clobbered and cannot be sanitized in-place`);try{Ut(e)}catch(t){throw gt(e),t}}else if(Ot(e))i=St(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===lb.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Ut(i);else{if(!ke&&!Se&&!we&&e.indexOf(`<`)===-1)return T&&je?j(e):e;if(i=St(e),!i)return ke?null:je?E:``}i&&Oe&&mt(i.firstChild);let l=c?e:i;try{let e=Ct(l);for(;o=e.nextNode();)Ft(o,l),Vt(o,l),Dt(o.content)&&Ht(o.content)}catch(n){throw c&&(gt(e),dy(t.removed,e=>{e.element&&yt(e.element)})),n}if(c){let n=!1;if(dy(t.removed,t=>{t.element&&(t.element===e&&(n=!0),yt(t.element))}),n)throw Ay(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return Se&&Tt(e),e}if(ke){if(Se&&Tt(i),Ae)for(s=te.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(z.shadowroot||z.shadowrootmode)&&(s=re.call(r,s,!0)),s}let u=we?i.outerHTML:i.innerHTML;return we&&R[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&ky(rb,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
45
- `+u),Se&&(u=wt(u)),T&&je?j(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};st(e),Te=!0,Ee=R,De=z},t.clearConfig=function(){it=null,Te=!1,Ee=null,De=null,T=D,E=``},t.isValidAttribute=function(e,t,n){it||st({});let r=rt(e),i=rt(t);return It(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Dy(I,e)&&my(I[e],t)},t.removeHook=function(e,t){if(Dy(I,e)){if(t!==void 0){let n=fy(I[e],t);return n===-1?void 0:hy(I[e],n,1)[0]}return py(I[e])}},t.removeHooks=function(e){Dy(I,e)&&(I[e]=[])},t.removeAllHooks=function(){I=hb()},t}var yb=vb(),bb=null,xb=new Map;function Sb(){return bb??=r(()=>import(`./lazy-Bpm7QNt6.js`).then(e=>e.t).then(e=>({status:`loaded`,pele:e}),()=>({status:`failed`})),__vite__mapDeps([5,1,6])),bb}function Cb(e,t){let n=xb.get(t);return n||(n=e.load(t).then(()=>({status:`loaded`,pele:e}),()=>({status:`failed`})),xb.set(t,n)),n}function wb(e,t){try{return e.detectType(t)}catch{return null}}var Tb=null;function Eb(){return Tb??=r(async()=>{let{default:e}=await import(`./katex-DJhrJSbw.js`);return{default:e}},[]).then(({default:e})=>{let t=new Map,n=null;return(r,i)=>{let a=`${i}:${r}`;if(t.has(a))return t.get(a);let o=null;try{n||(n=document.createElement(`div`),n.style.cssText=`position:absolute;left:-9999px;visibility:hidden;display:inline-block;white-space:nowrap`,document.body.append(n)),n.style.fontSize=`${i}px`,n.innerHTML=e.renderToString(r,{displayMode:!0,output:`mathml`,throwOnError:!0,trust:!1,strict:`ignore`,maxSize:20,maxExpand:1e3});let t=n.querySelector(`math`);if(t?.querySelector(`annotation`)?.remove(),t){let{width:e,height:n}=t.getBoundingClientRect();o={html:t.outerHTML,width:e,height:n}}}catch{}return t.set(a,o),o}},()=>null),Tb}var Db=new Set([`math`,`menclose`,`mfrac`,`mi`,`mlabeledtr`,`mn`,`mo`,`mover`,`mpadded`,`mphantom`,`mroot`,`mrow`,`mspace`,`msqrt`,`mstyle`,`msub`,`msubsup`,`msup`,`mtable`,`mtd`,`mtext`,`mtr`,`munder`,`munderover`]),Ob=new Set(`accent.accentunder.columnalign.columnlines.columnspacing.depth.displaystyle.fence.largeop.linebreak.linethickness.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.notation.rowlines.rowspacing.rspace.scriptlevel.separator.stretchy.voffset`.split(`.`)),kb=null;function Ab(e){return kb??=yb(window),kb.sanitize(e,{FORBID_ATTR:[`href`,`xlink:href`,`src`,`srcset`],FORBID_TAGS:[`a`,`image`,`foreignObject`,`style`],USE_PROFILES:{svg:!0,svgFilters:!0},RETURN_DOM_FRAGMENT:!0})}function jb(e){return kb??=yb(window),kb.sanitize(e,{ADD_TAGS:[`foreignObject`,...Db],ADD_ATTR:(e,t)=>Db.has(t)&&Ob.has(e),HTML_INTEGRATION_POINTS:{foreignobject:!0},FORBID_ATTR:[`href`,`xlink:href`,`src`,`srcset`],FORBID_TAGS:[`a`,`img`,`image`,`script`,`style`],USE_PROFILES:{svg:!0,svgFilters:!0,html:!0},RETURN_DOM_FRAGMENT:!0})}var Mb=[`--pele-bg`,`--pele-fg`,`--pele-muted`,`--pele-line`,`--pele-surface`,`--pele-surface-alt`,`--pele-border`,`--pele-accent`,`--pele-critical`,...Array.from({length:8},(e,t)=>`--pele-series-${t+1}`)],Nb=null;function Pb(e){let t=e.cloneNode(!0),n=getComputedStyle(e);for(let e of Mb){let r=n.getPropertyValue(e).trim();r&&t.style.setProperty(e,r)}return t.style.maxWidth=`none`,t.style.backgroundColor=getComputedStyle(document.body).backgroundColor,Nb&&URL.revokeObjectURL(Nb),Nb=URL.createObjectURL(new Blob([new XMLSerializer().serializeToString(t)],{type:`image/svg+xml`})),Nb}function Fb(e){let t=(0,H.c)(32),{source:n,onExpand:r}=e,[,i]=(0,V.useState)(0),[a,o]=(0,V.useState)(null),s=(0,V.useRef)(null),c=n.trim(),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=Sb(),t[0]=l):l=t[0];let u=(0,V.use)(l),d=u.status===`loaded`?wb(u.pele,c):null,f=u.status===`loaded`&&d?(0,V.use)(Cb(u.pele,d)):u,p=c.includes(`$$`)?(0,V.use)(Eb()):null,m;t[1]!==f.pele||t[2]!==f.status||t[3]!==p||t[4]!==c?(m=()=>{let e=s.current;if(f.status!==`loaded`||!e)return;let t=f.pele.mount(e,c,{links:!1,images:!1,zoom:!1,autoDirection:!1,...p?{math:p,sanitize:jb}:{sanitize:Ab},onRender:()=>o(null),onError:e=>o(e instanceof Error?e.message:`The diagram could not be rendered.`)});return()=>t.destroy()},t[1]=f.pele,t[2]=f.status,t[3]=p,t[4]=c,t[5]=m):m=t[5];let h;if(t[6]!==f||t[7]!==p||t[8]!==c?(h=[f,p,c],t[6]=f,t[7]=p,t[8]=c,t[9]=h):h=t[9],(0,V.useLayoutEffect)(m,h),f.status===`failed`){let e;t[10]!==u.status||t[11]!==i||t[12]!==d?(e=()=>{u.status===`failed`&&(bb=null),d&&xb.delete(d),i(Ib)},t[10]=u.status,t[11]=i,t[12]=d,t[13]=e):e=t[13];let r;return t[14]!==n||t[15]!==e?(r=(0,U.jsx)(Lb,{message:`The diagram renderer failed to load.`,source:n,onRetry:e}),t[14]=n,t[15]=e,t[16]=r):r=t[16],r}let g;t[17]===n?g=t[18]:(g=ag(n,`mermaid`),t[17]=n,t[18]=g);let _;t[19]!==a||t[20]!==n?(_=a?(0,U.jsx)(Lb,{message:a,source:n}):null,t[19]=a,t[20]=n,t[21]=_):_=t[21];let v=a!==null,y;t[22]===r?y=t[23]:(y=()=>{let e=s.current?.querySelector(`svg`);e&&r(Pb(e))},t[22]=r,t[23]=y);let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,U.jsx)(`span`,{ref:s,className:`flex w-full justify-center`}),t[24]=b):b=t[24];let x;t[25]!==v||t[26]!==y?(x=(0,U.jsx)(`button`,{type:`button`,"aria-label":`Expand diagram`,hidden:v,className:`block w-full cursor-zoom-in rounded-md focus-visible:outline-2 focus-visible:outline-ring`,onClick:y,children:b}),t[25]=v,t[26]=y,t[27]=x):x=t[27];let S;return t[28]!==g||t[29]!==_||t[30]!==x?(S=(0,U.jsxs)(`div`,{className:`chat-markdown-mermaid overflow-x-auto`,"data-markdown-mermaid":``,"data-markdown-copy":g,children:[_,x]}),t[28]=g,t[29]=_,t[30]=x,t[31]=S):S=t[31],S}function Ib(e){return e+1}function Lb(e){let t=(0,H.c)(12),{message:n,source:r,onRetry:i}=e,a;t[0]===n?a=t[1]:(a=(0,U.jsxs)(`p`,{className:`m-0 text-xs text-destructive`,children:[`Unable to render diagram: `,n]}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i?(0,U.jsx)(we,{type:`button`,variant:`ghost`,size:`xs`,onClick:i,children:`Retry`}):null,t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=(0,U.jsx)(`pre`,{"data-thread-find-ignore":!0,className:`mt-2 mb-0 overflow-auto font-mono text-xs whitespace-pre-wrap`,children:r}),t[7]=r,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,U.jsxs)(`div`,{children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Rb(e){return e.replaceAll(`\\`,`/`)}function zb(e){return e.replace(/[\\/]+$/,``)}function Bb(e){return e.replace(/^\.\/+/,``).replace(/^\/+/,``)}function Vb(e,t){let n=_n(e),r=Ot(Rb(n.path)),i=r;if(t){let e=Ot(Rb(zb(t))),n=vt(e),a=Et(Ot(t)),o=a?r.toLowerCase():r,s=a?e.toLowerCase():e,c=`${s}/`,l=`${a?n.toLowerCase():n}/`;if(o===s)i=n;else if(o.startsWith(c))i=`${n}/${r.slice(e.length+1)}`;else if(!r.startsWith(`/`)){let e=Bb(r);i=o.startsWith(l)?r:`${n}/${e}`}}return vn({...n,path:i})}function Hb(e,t){return hi(e,t)}function Ub(e){return/\.pdf$/i.test(e.split(/[?#]/,1)[0]??``)}function Wb(e){if(!e)return null;let t=hn(Kn(e));return t?`${t.path}${t.hash}`:null}function Gb(e,t,n=t){let r=Hn(e);return r===null?null:qb(r,t,Kb(r,t,n)?t:n)}function Kb(e,t,n){return!t||!n||!Ln(e)||/^(?:~|\.{1,2})\//.test(e)||!_n(e).path.includes(`/`)?!1:bt(n,t)!==null}function qb(e,t,n=t){let r=Rn(e,t,n);return r?Jb(r,t):null}function Jb(e,t){let{path:n,line:r,column:i}=_n(e);return{filePath:n,targetPath:e,displayPath:Vb(e,t),workspaceRelativePath:bt(n,t),basename:vt(n),...r===void 0?{}:{line:r},...i===void 0?{}:{column:i}}}var Yb=0;function Xb(){Yb+=1;let e=Yb;return()=>e===Yb}function Zb(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t>=0?e.slice(t+1):e}function Qb(e){let t=e.trim();return t!==`.`&&t!==`..`&&t.length>0&&!t.includes(`/`)&&!t.includes(`\\`)}function $b(e,t){let n=e.trim();if(!n)return null;let r=t.filter(e=>e.kind===`file`),i=r.find(e=>Zb(e.path)===n);if(i)return i.path;let a=n.toLowerCase(),o=r.filter(e=>Zb(e.path).toLowerCase()===a);return o.length===1?o[0]?.path??null:null}var ex=5e5,tx=new Map,nx=0,rx=0,ix=200,ax=e=>e.length+ix;function ox(e,t){if(!(ax(e)>ex/4)){tx.set(e,t),nx+=ax(e);for(let e of tx.keys()){if(nx<=ex)break;tx.delete(e),nx-=ax(e)}}}function sx({remarkPlugins:e,rehypePlugins:t,components:n,urlTransform:r}){let i=ti().use(Or).use(e).use(Lo,{allowDangerousHtml:!0}).use(t).freeze(),a=`${rx++}\u0000`,o=e=>{`children`in e&&e.children.forEach((t,n)=>{if(t.type===`raw`)e.children[n]={type:`text`,value:t.value};else{if(t.type===`element`)for(let[e,n]of Object.entries(zh))Object.hasOwn(t.properties,e)&&(n===null||n.includes(t.tagName))&&(t.properties[e]=r(String(t.properties[e]||``),e,t));o(t)}})};return(e,t)=>{let r=a+e,s=tx.get(r);if(s!==void 0)return tx.delete(r),tx.set(r,s),s;let c=new Jr(e),l=i.runSync(i.parse(c),c);o(l);let u=_h(l,{Fragment:U.Fragment,components:n,ignoreInvalidStyle:!0,jsx:U.jsx,jsxs:U.jsxs,passKeys:!0,passNode:!0});return t&&ox(r,u),u}}var cx=/^ {0,3}(?:\[[^\]\n]+\]:|<[A-Za-z!?/]|:::|\$\$)|\[\^/m,lx=/^ {0,3}(`{3,}|~{3,})/,ux=/^(?:[ \t]|(?:[-*+]|\d{1,9}[.)])(?:[ \t]|$))/;function dx(e){if(e.includes(`\r`)||cx.test(e))return null;let t=[],n=0,r=0,i=null,a=0,o=!1;for(let s of e.split(`
45
+ `+u),Se&&(u=wt(u)),T&&je?j(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};st(e),Te=!0,Ee=R,De=z},t.clearConfig=function(){it=null,Te=!1,Ee=null,De=null,T=D,E=``},t.isValidAttribute=function(e,t,n){it||st({});let r=rt(e),i=rt(t);return It(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Dy(I,e)&&my(I[e],t)},t.removeHook=function(e,t){if(Dy(I,e)){if(t!==void 0){let n=fy(I[e],t);return n===-1?void 0:hy(I[e],n,1)[0]}return py(I[e])}},t.removeHooks=function(e){Dy(I,e)&&(I[e]=[])},t.removeAllHooks=function(){I=hb()},t}var yb=vb(),bb=null,xb=new Map;function Sb(){return bb??=r(()=>import(`./lazy--Qcevr63.js`).then(e=>e.t).then(e=>({status:`loaded`,pele:e}),()=>({status:`failed`})),__vite__mapDeps([5,1,6])),bb}function Cb(e,t){let n=xb.get(t);return n||(n=e.load(t).then(()=>({status:`loaded`,pele:e}),()=>({status:`failed`})),xb.set(t,n)),n}function wb(e,t){try{return e.detectType(t)}catch{return null}}var Tb=null;function Eb(){return Tb??=r(async()=>{let{default:e}=await import(`./katex-DJhrJSbw.js`);return{default:e}},[]).then(({default:e})=>{let t=new Map,n=null;return(r,i)=>{let a=`${i}:${r}`;if(t.has(a))return t.get(a);let o=null;try{n||(n=document.createElement(`div`),n.style.cssText=`position:absolute;left:-9999px;visibility:hidden;display:inline-block;white-space:nowrap`,document.body.append(n)),n.style.fontSize=`${i}px`,n.innerHTML=e.renderToString(r,{displayMode:!0,output:`mathml`,throwOnError:!0,trust:!1,strict:`ignore`,maxSize:20,maxExpand:1e3});let t=n.querySelector(`math`);if(t?.querySelector(`annotation`)?.remove(),t){let{width:e,height:n}=t.getBoundingClientRect();o={html:t.outerHTML,width:e,height:n}}}catch{}return t.set(a,o),o}},()=>null),Tb}var Db=new Set([`math`,`menclose`,`mfrac`,`mi`,`mlabeledtr`,`mn`,`mo`,`mover`,`mpadded`,`mphantom`,`mroot`,`mrow`,`mspace`,`msqrt`,`mstyle`,`msub`,`msubsup`,`msup`,`mtable`,`mtd`,`mtext`,`mtr`,`munder`,`munderover`]),Ob=new Set(`accent.accentunder.columnalign.columnlines.columnspacing.depth.displaystyle.fence.largeop.linebreak.linethickness.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.notation.rowlines.rowspacing.rspace.scriptlevel.separator.stretchy.voffset`.split(`.`)),kb=null;function Ab(e){return kb??=yb(window),kb.sanitize(e,{FORBID_ATTR:[`href`,`xlink:href`,`src`,`srcset`],FORBID_TAGS:[`a`,`image`,`foreignObject`,`style`],USE_PROFILES:{svg:!0,svgFilters:!0},RETURN_DOM_FRAGMENT:!0})}function jb(e){return kb??=yb(window),kb.sanitize(e,{ADD_TAGS:[`foreignObject`,...Db],ADD_ATTR:(e,t)=>Db.has(t)&&Ob.has(e),HTML_INTEGRATION_POINTS:{foreignobject:!0},FORBID_ATTR:[`href`,`xlink:href`,`src`,`srcset`],FORBID_TAGS:[`a`,`img`,`image`,`script`,`style`],USE_PROFILES:{svg:!0,svgFilters:!0,html:!0},RETURN_DOM_FRAGMENT:!0})}var Mb=[`--pele-bg`,`--pele-fg`,`--pele-muted`,`--pele-line`,`--pele-surface`,`--pele-surface-alt`,`--pele-border`,`--pele-accent`,`--pele-critical`,...Array.from({length:8},(e,t)=>`--pele-series-${t+1}`)],Nb=null;function Pb(e){let t=e.cloneNode(!0),n=getComputedStyle(e);for(let e of Mb){let r=n.getPropertyValue(e).trim();r&&t.style.setProperty(e,r)}return t.style.maxWidth=`none`,t.style.backgroundColor=getComputedStyle(document.body).backgroundColor,Nb&&URL.revokeObjectURL(Nb),Nb=URL.createObjectURL(new Blob([new XMLSerializer().serializeToString(t)],{type:`image/svg+xml`})),Nb}function Fb(e){let t=(0,H.c)(32),{source:n,onExpand:r}=e,[,i]=(0,V.useState)(0),[a,o]=(0,V.useState)(null),s=(0,V.useRef)(null),c=n.trim(),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=Sb(),t[0]=l):l=t[0];let u=(0,V.use)(l),d=u.status===`loaded`?wb(u.pele,c):null,f=u.status===`loaded`&&d?(0,V.use)(Cb(u.pele,d)):u,p=c.includes(`$$`)?(0,V.use)(Eb()):null,m;t[1]!==f.pele||t[2]!==f.status||t[3]!==p||t[4]!==c?(m=()=>{let e=s.current;if(f.status!==`loaded`||!e)return;let t=f.pele.mount(e,c,{links:!1,images:!1,zoom:!1,autoDirection:!1,...p?{math:p,sanitize:jb}:{sanitize:Ab},onRender:()=>o(null),onError:e=>o(e instanceof Error?e.message:`The diagram could not be rendered.`)});return()=>t.destroy()},t[1]=f.pele,t[2]=f.status,t[3]=p,t[4]=c,t[5]=m):m=t[5];let h;if(t[6]!==f||t[7]!==p||t[8]!==c?(h=[f,p,c],t[6]=f,t[7]=p,t[8]=c,t[9]=h):h=t[9],(0,V.useLayoutEffect)(m,h),f.status===`failed`){let e;t[10]!==u.status||t[11]!==i||t[12]!==d?(e=()=>{u.status===`failed`&&(bb=null),d&&xb.delete(d),i(Ib)},t[10]=u.status,t[11]=i,t[12]=d,t[13]=e):e=t[13];let r;return t[14]!==n||t[15]!==e?(r=(0,U.jsx)(Lb,{message:`The diagram renderer failed to load.`,source:n,onRetry:e}),t[14]=n,t[15]=e,t[16]=r):r=t[16],r}let g;t[17]===n?g=t[18]:(g=ag(n,`mermaid`),t[17]=n,t[18]=g);let _;t[19]!==a||t[20]!==n?(_=a?(0,U.jsx)(Lb,{message:a,source:n}):null,t[19]=a,t[20]=n,t[21]=_):_=t[21];let v=a!==null,y;t[22]===r?y=t[23]:(y=()=>{let e=s.current?.querySelector(`svg`);e&&r(Pb(e))},t[22]=r,t[23]=y);let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,U.jsx)(`span`,{ref:s,className:`flex w-full justify-center`}),t[24]=b):b=t[24];let x;t[25]!==v||t[26]!==y?(x=(0,U.jsx)(`button`,{type:`button`,"aria-label":`Expand diagram`,hidden:v,className:`block w-full cursor-zoom-in rounded-md focus-visible:outline-2 focus-visible:outline-ring`,onClick:y,children:b}),t[25]=v,t[26]=y,t[27]=x):x=t[27];let S;return t[28]!==g||t[29]!==_||t[30]!==x?(S=(0,U.jsxs)(`div`,{className:`chat-markdown-mermaid overflow-x-auto`,"data-markdown-mermaid":``,"data-markdown-copy":g,children:[_,x]}),t[28]=g,t[29]=_,t[30]=x,t[31]=S):S=t[31],S}function Ib(e){return e+1}function Lb(e){let t=(0,H.c)(12),{message:n,source:r,onRetry:i}=e,a;t[0]===n?a=t[1]:(a=(0,U.jsxs)(`p`,{className:`m-0 text-xs text-destructive`,children:[`Unable to render diagram: `,n]}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i?(0,U.jsx)(we,{type:`button`,variant:`ghost`,size:`xs`,onClick:i,children:`Retry`}):null,t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=(0,U.jsx)(`pre`,{"data-thread-find-ignore":!0,className:`mt-2 mb-0 overflow-auto font-mono text-xs whitespace-pre-wrap`,children:r}),t[7]=r,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,U.jsxs)(`div`,{children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Rb(e){return e.replaceAll(`\\`,`/`)}function zb(e){return e.replace(/[\\/]+$/,``)}function Bb(e){return e.replace(/^\.\/+/,``).replace(/^\/+/,``)}function Vb(e,t){let n=_n(e),r=Ot(Rb(n.path)),i=r;if(t){let e=Ot(Rb(zb(t))),n=vt(e),a=Et(Ot(t)),o=a?r.toLowerCase():r,s=a?e.toLowerCase():e,c=`${s}/`,l=`${a?n.toLowerCase():n}/`;if(o===s)i=n;else if(o.startsWith(c))i=`${n}/${r.slice(e.length+1)}`;else if(!r.startsWith(`/`)){let e=Bb(r);i=o.startsWith(l)?r:`${n}/${e}`}}return vn({...n,path:i})}function Hb(e,t){return hi(e,t)}function Ub(e){return/\.pdf$/i.test(e.split(/[?#]/,1)[0]??``)}function Wb(e){if(!e)return null;let t=hn(Kn(e));return t?`${t.path}${t.hash}`:null}function Gb(e,t,n=t){let r=Hn(e);return r===null?null:qb(r,t,Kb(r,t,n)?t:n)}function Kb(e,t,n){return!t||!n||!Ln(e)||/^(?:~|\.{1,2})\//.test(e)||!_n(e).path.includes(`/`)?!1:bt(n,t)!==null}function qb(e,t,n=t){let r=Rn(e,t,n);return r?Jb(r,t):null}function Jb(e,t){let{path:n,line:r,column:i}=_n(e);return{filePath:n,targetPath:e,displayPath:Vb(e,t),workspaceRelativePath:bt(n,t),basename:vt(n),...r===void 0?{}:{line:r},...i===void 0?{}:{column:i}}}var Yb=0;function Xb(){Yb+=1;let e=Yb;return()=>e===Yb}function Zb(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t>=0?e.slice(t+1):e}function Qb(e){let t=e.trim();return t!==`.`&&t!==`..`&&t.length>0&&!t.includes(`/`)&&!t.includes(`\\`)}function $b(e,t){let n=e.trim();if(!n)return null;let r=t.filter(e=>e.kind===`file`),i=r.find(e=>Zb(e.path)===n);if(i)return i.path;let a=n.toLowerCase(),o=r.filter(e=>Zb(e.path).toLowerCase()===a);return o.length===1?o[0]?.path??null:null}var ex=5e5,tx=new Map,nx=0,rx=0,ix=200,ax=e=>e.length+ix;function ox(e,t){if(!(ax(e)>ex/4)){tx.set(e,t),nx+=ax(e);for(let e of tx.keys()){if(nx<=ex)break;tx.delete(e),nx-=ax(e)}}}function sx({remarkPlugins:e,rehypePlugins:t,components:n,urlTransform:r}){let i=ti().use(Or).use(e).use(Lo,{allowDangerousHtml:!0}).use(t).freeze(),a=`${rx++}\u0000`,o=e=>{`children`in e&&e.children.forEach((t,n)=>{if(t.type===`raw`)e.children[n]={type:`text`,value:t.value};else{if(t.type===`element`)for(let[e,n]of Object.entries(zh))Object.hasOwn(t.properties,e)&&(n===null||n.includes(t.tagName))&&(t.properties[e]=r(String(t.properties[e]||``),e,t));o(t)}})};return(e,t)=>{let r=a+e,s=tx.get(r);if(s!==void 0)return tx.delete(r),tx.set(r,s),s;let c=new Jr(e),l=i.runSync(i.parse(c),c);o(l);let u=_h(l,{Fragment:U.Fragment,components:n,ignoreInvalidStyle:!0,jsx:U.jsx,jsxs:U.jsxs,passKeys:!0,passNode:!0});return t&&ox(r,u),u}}var cx=/^ {0,3}(?:\[[^\]\n]+\]:|<[A-Za-z!?/]|:::|\$\$)|\[\^/m,lx=/^ {0,3}(`{3,}|~{3,})/,ux=/^(?:[ \t]|(?:[-*+]|\d{1,9}[.)])(?:[ \t]|$))/;function dx(e){if(e.includes(`\r`)||cx.test(e))return null;let t=[],n=0,r=0,i=null,a=0,o=!1;for(let s of e.split(`
46
46
  `)){let c=lx.exec(s)?.[1];if(i!==null){if(/\S/.test(s.slice(0,a)))break;c&&c[0]===i[0]&&c.length>=i.length&&s.trim()===c&&(i=null)}else s.trim()===``?o=!0:(o&&r>n&&!ux.test(s)&&(t.push(e.slice(n,r)),n=r),o=!1,i=c??null,c&&(a=s.indexOf(c)));r+=s.length+1}return t.push(e.slice(n)),t}function fx(e,t,n){return e!==null&&n&&t===`local-exec`}function px(e){return e.canOpenInEditor||e.canOpenInBrowser||e.canOpenInPanel||e.canOpenMedia===!0}function mx(e){return e.canOpenInBrowser&&(Ub(e.iconPath)||!e.canOpenInEditor&&!e.canOpenInPanel)}var hx=[],gx=[],_x={document:Te,presentation:A,spreadsheet:Me,site:P,"google-docs":Te,"google-slides":A,"google-sheets":Me,image:g,email:He,slack:oe};function vx(e){let t=(0,H.c)(26),n=_x[e.template.artifactKind],r;t[0]===e.template.artifactKind?r=t[1]:(r=ii(e.template.artifactKind),t[0]=e.template.artifactKind,t[1]=r);let i=r,a=`${e.template.displayName} template`,o=`${e.template.displayName} (${i})\n\n`,s;t[2]===n?s=t[3]:(s=(0,U.jsx)(n,{"aria-hidden":!0,className:`size-5`}),t[2]=n,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,U.jsx)(`span`,{className:`absolute -right-1 -bottom-1 flex size-4 items-center justify-center rounded-full border border-background bg-primary text-primary-foreground shadow-xs`,children:(0,U.jsx)(Ye,{"aria-hidden":!0,className:`size-2.5`})}),t[4]=c):c=t[4];let l;t[5]===s?l=t[6]:(l=(0,U.jsxs)(`span`,{className:`relative flex size-9 shrink-0 items-center justify-center rounded-lg border border-border/70 bg-background text-muted-foreground shadow-xs`,children:[s,c]}),t[5]=s,t[6]=l);let u;t[7]===e.template.displayName?u=t[8]:(u=(0,U.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.template.displayName}),t[7]=e.template.displayName,t[8]=u);let d;t[9]===i?d=t[10]:(d=(0,U.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:i}),t[9]=i,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]!==l||t[15]!==f?(p=(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[l,f]}),t[14]=l,t[15]=f,t[16]=p):p=t[16];let m;t[17]===e?m=t[18]:(m=e.onUse?(0,U.jsx)(we,{"data-thread-find-ignore":!0,type:`button`,size:`sm`,variant:`outline`,className:`shrink-0`,onClick:()=>e.onUse?.(e.template),children:`Use template`}):null,t[17]=e,t[18]=m);let h;return t[19]!==e.template.artifactKind||t[20]!==e.template.skillName||t[21]!==a||t[22]!==m||t[23]!==o||t[24]!==p?(h=(0,U.jsxs)(`div`,{role:`group`,"aria-label":a,"data-chat-markdown-artifact-template":!0,className:`my-[0.65rem] flex w-full min-w-0 items-center gap-3 rounded-xl border border-border/70 bg-card/60 px-3 py-2.5 text-foreground shadow-xs`,"data-artifact-kind":e.template.artifactKind,"data-markdown-copy":o,"data-skill-name":e.template.skillName,children:[p,m]}),t[19]=e.template.artifactKind,t[20]=e.template.skillName,t[21]=a,t[22]=m,t[23]=o,t[24]=p,t[25]=h):h=t[25],h}var yx=/(?:^|\s)language-([^\s]+)/,bx=/^[A-Za-z]:[\\/]/,xx=500,Sx=52428800;function Cx(e,t){console.error(`[chat-markdown] action failed`,e,t)}var wx=new zi(xx,Sx);function Tx(e,t){let n=e.indexOf(`
47
47
  `,t),r=e.slice(t,n===-1?e.length:n),i=r.match(/^(?:\s*(?:[-+*]|\d+[.)])\s+)(\[[ xX]\])/);return i?.[1]?t+r.indexOf(i[1]):null}function Ex(e,t){let n=Number.parseInt(String(t??1),10),r=Number.isNaN(n)?1:n,i=r+Math.max(e-1,0),a=Math.max(String(r).length,String(i).length);if(!(a<=1))return{"--list-gutter":`${a+2}ch`}}var Dx={note:{label:`Note`,Icon:Ie,borderClassName:`border-blue-500/70`,titleClassName:`text-blue-600 dark:text-blue-400`},tip:{label:`Tip`,Icon:j,borderClassName:`border-emerald-500/70`,titleClassName:`text-emerald-600 dark:text-emerald-400`},important:{label:`Important`,Icon:ue,borderClassName:`border-purple-500/70`,titleClassName:`text-purple-600 dark:text-purple-400`},warning:{label:`Warning`,Icon:re,borderClassName:`border-amber-500/70`,titleClassName:`text-amber-600 dark:text-amber-500`},caution:{label:`Caution`,Icon:o,borderClassName:`border-red-500/70`,titleClassName:`text-red-600 dark:text-red-400`}};function Ox(e){let t=e?.match(yx)?.[1]??`text`;return t===`gitignore`?`ini`:t}var kx=/(?:^|\s)(?:title|file(?:name)?)=(?:"([^"]+)"|'([^']+)'|(\S+))/i,Ax=/^[\w@][\w@./-]*\.[A-Za-z0-9]+$/;function jx(e){if(!e)return null;let t=kx.exec(e);return(t?.[1]??t?.[2]??t?.[3])||(e.split(/\s+/).find(e=>Ax.test(e))??null)}function Mx(e){let t=(e?.children)?.find(e=>e?.type===`element`&&e.tagName===`code`),n=t?.properties?.dataCodeMeta??t?.data?.meta;return typeof n==`string`&&n.trim().length>0?n.trim():void 0}function Nx(e,t){let n=e?.position?.start.offset,r=e?.position?.end.offset;if(n===void 0||r===void 0)return!1;let i=t.slice(n,r),a=/^(?:`{3,}|~{3,})/.exec(i)?.[0],o=/(?:^|\n)[ \t>]*(`{3,}|~{3,})[ \t\r]*$/.exec(i)?.[1];return a!==void 0&&o!==void 0&&a[0]===o[0]&&o.length>=a.length}function Px(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(e=>Px(e)).join(``):(0,V.isValidElement)(e)?Px(e.props.children):``}function Fx(e){let t=V.Children.toArray(e);if(t.length!==1)return null;let n=t[0];return!(0,V.isValidElement)(n)||n.type!==`code`&&n.props.node?.tagName!==`code`?null:{className:n.props.className,code:Px(n.props.children)}}function Ix(e,t,n){return`${jn(e).toString(36)}:${e.length}:${t}:${n}`}function Lx(e,t){return Math.max(e.length*2,t.length*3)}function Rx(){return nn().wordWrap}function zx(e){let t=(0,H.c)(23),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=(0,V.useRef)(null),[a,o]=(0,V.useState)(!1),s=(0,V.useRef)(null),c=a?`Copied`:`Copy table`,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>{let t=i.current?.querySelector(`table`);if(!t||typeof navigator>`u`||navigator.clipboard==null)return;let n=e===`markdown`?Sg(t):Dg(t);navigator.clipboard.writeText(n).then(()=>{s.current!=null&&clearTimeout(s.current),o(!0),s.current=setTimeout(()=>{o(!1),s.current=null},1200)}).catch(t=>{Cx({operation:`copy-table`,format:e},t)})},t[3]=l):l=t[3];let u=l,d,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{s.current!=null&&(clearTimeout(s.current),s.current=null)},f=[],t[4]=d,t[5]=f):(d=t[4],f=t[5]),(0,V.useEffect)(d,f);let p;t[6]!==n||t[7]!==r?(p=(0,U.jsx)(ir,{radius:`none`,chainVerticalScroll:!0,scrollFade:!0,className:`w-full max-w-full`,children:(0,U.jsx)(`table`,{...r,children:n})}),t[6]=n,t[7]=r,t[8]=p):p=t[8];let m;t[9]===c?m=t[10]:(m=(0,U.jsx)(we,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":c}),t[9]=c,t[10]=m);let h=a?Kt:Ut,g;t[11]===h?g=t[12]:(g=(0,U.jsx)(qt,{className:`size-3`,icon:h}),t[11]=h,t[12]=g);let _;t[13]!==m||t[14]!==g?(_=(0,U.jsx)(z,{render:m,children:g}),t[13]=m,t[14]=g,t[15]=_):_=t[15];let v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,U.jsx)(Ve,{onClick:()=>u(`markdown`),children:`Copy as Markdown`}),t[16]=v):v=t[16];let y;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,U.jsxs)(Le,{align:`end`,children:[v,(0,U.jsx)(Ve,{onClick:()=>u(`csv`),children:`Copy as CSV`})]}),t[17]=y):y=t[17];let b;t[18]===_?b=t[19]:(b=(0,U.jsx)(`div`,{className:`mt-0.5 flex items-center justify-end select-none`,children:(0,U.jsxs)(ae,{children:[_,y]})}),t[18]=_,t[19]=b);let x;return t[20]!==b||t[21]!==p?(x=(0,U.jsxs)(`div`,{ref:i,className:`chat-markdown-table-container`,children:[p,b]}),t[20]=b,t[21]=p,t[22]=x):x=t[22],x}function Bx(e){let t=(0,H.c)(20),{children:n,open:r}=e,[i,a]=(0,V.useState)(r!==void 0&&r),o=(0,V.use)(Da),s=i,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>a(!0),t[0]=l):l=t[0];let u=Oa(l),d,f;if(t[1]!==n){let e=V.Children.toArray(n),r=e.findIndex(Vx),i=r>=0?e[r]:null;d=(0,V.isValidElement)(i)&&i.props.children?i.props.children:`Details`;let a;t[4]===r?a=t[5]:(a=(e,t)=>t!==r,t[4]=r,t[5]=a),f=e.filter(a),t[1]=n,t[2]=d,t[3]=f}else d=t[2],f=t[3];let p=f,m=s?`true`:`false`,h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,U.jsx)(c,{className:`size-4 shrink-0 text-muted-foreground transition-transform`,"aria-hidden":!0}),t[6]=h):h=t[6];let g;t[7]===d?g=t[8]:(g=(0,U.jsxs)(bi,{className:`flex w-full items-center gap-2 py-2 text-left text-sm font-medium text-foreground data-panel-open:[&_svg]:rotate-90`,"data-markdown-details-summary":``,children:[h,(0,U.jsx)(`span`,{children:d})]}),t[7]=d,t[8]=g);let _;t[9]===p?_=t[10]:(_=(0,U.jsx)(`div`,{className:`pb-3 ps-6 text-foreground/[calc(80%+var(--appearance-contrast-boost)/5)]`,"data-markdown-details-content":``,children:p}),t[9]=p,t[10]=_);let v;t[11]!==u||t[12]!==o||t[13]!==_?(v=(0,U.jsx)(gi,{ref:u,hiddenUntilFound:o,children:_}),t[11]=u,t[12]=o,t[13]=_,t[14]=v):v=t[14];let y;return t[15]!==s||t[16]!==m||t[17]!==g||t[18]!==v?(y=(0,U.jsx)(`div`,{className:`my-2 border-y border-border/60`,children:(0,U.jsxs)(xi,{open:s,onOpenChange:a,"data-markdown-details":``,"data-markdown-details-open":m,children:[g,v]})}),t[15]=s,t[16]=m,t[17]=g,t[18]=v,t[19]=y):y=t[19],y}function Vx(e){return(0,V.isValidElement)(e)&&e.type===`summary`}var Hx={"data-thread-find-ignore":``};function Ux(e){let t=(0,H.c)(18),{as:n,language:r,fenceTitle:i,theme:a,wrapped:o,title:s,actions:c,headerProps:l,children:u}=e,d=n===void 0?`div`:n,f=o===void 0||o?`true`:`false`,p=l?.className,m;t[0]===p?m=t[1]:(m=B(`chat-markdown-codeblock-header flex items-center justify-between gap-2 pt-1.5 pr-1.5 pb-0 pl-3 select-none`,p),t[0]=p,t[1]=m);let h;t[2]!==i||t[3]!==r||t[4]!==a||t[5]!==s?(h=s??(0,U.jsx)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 font-mono text-2xs`,children:(0,U.jsx)(Wx,{fenceTitle:i,language:r,theme:a})}),t[2]=i,t[3]=r,t[4]=a,t[5]=s,t[6]=h):h=t[6];let g;t[7]!==c||t[8]!==l||t[9]!==m||t[10]!==h?(g=(0,U.jsxs)(`div`,{...l,className:m,children:[h,c]}),t[7]=c,t[8]=l,t[9]=m,t[10]=h,t[11]=g):g=t[11];let _;return t[12]!==d||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,U.jsxs)(d,{className:`chat-markdown-codeblock my-[0.65rem] overflow-hidden rounded-lg border border-border/70 bg-secondary leading-snug dark:border-transparent dark:bg-input/32`,"data-language":r,"data-wrap":f,children:[g,u]}),t[12]=d,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17],_}function Wx(e){let t=(0,H.c)(26),{fenceTitle:n,language:r,theme:i}=e;if(n){let e;t[0]!==n||t[1]!==i?(e=(0,U.jsx)(Tr,{pathValue:n,kind:`file`,theme:i,className:`size-3.5`}),t[0]=n,t[1]=i,t[2]=e):e=t[2];let r;t[3]===n?r=t[4]:(r=(0,U.jsx)(`span`,{className:`truncate`,children:n}),t[3]=n,t[4]=r);let a;return t[5]!==e||t[6]!==r?(a=(0,U.jsxs)(U.Fragment,{children:[e,r]}),t[5]=e,t[6]=r,t[7]=a):a=t[7],a}let a,o;if(t[8]===r?(a=t[9],o=t[10]):(a=nr(r),o=tr(a),t[8]=r,t[9]=a,t[10]=o),!o){let e;return t[11]===r?e=t[12]:(e=(0,U.jsx)(`span`,{className:`truncate`,children:r}),t[11]=r,t[12]=e),e}let s=`Language: ${r}`,c;t[13]===s?c=t[14]:(c=(0,U.jsx)(`span`,{className:`inline-flex shrink-0 rounded-sm`,"aria-label":s}),t[13]=s,t[14]=c);let l;t[15]!==a||t[16]!==i?(l=(0,U.jsx)(Tr,{pathValue:a,kind:`file`,theme:i,className:`size-3.5`}),t[15]=a,t[16]=i,t[17]=l):l=t[17];let u;t[18]!==c||t[19]!==l?(u=(0,U.jsx)(Qn,{render:c,children:l}),t[18]=c,t[19]=l,t[20]=u):u=t[20];let d;t[21]===r?d=t[22]:(d=(0,U.jsx)($n,{side:`top`,children:r}),t[21]=r,t[22]=d);let f;return t[23]!==u||t[24]!==d?(f=(0,U.jsxs)(er,{children:[u,d]}),t[23]=u,t[24]=d,t[25]=f):f=t[25],f}function Gx(e){let t=(0,H.c)(45),{code:n,language:r,fenceTitle:i,theme:a,onRunShellCommand:o,isStreaming:s,viewToggle:c,canWrap:l,diagram:u,children:d}=e,f=l===void 0||l,p=u!==void 0&&u,[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(Rx),v=(0,V.useRef)(null),y=g?`Disable line wrap`:`Wrap lines`,b=m?`Copied`:`Copy code`,x,S;t[0]!==n||t[1]!==s||t[2]!==r||t[3]!==o?(x=n.trim(),S=o!==void 0&&!s&&/^(?:sh|bash|zsh|fish|shell|powershell|pwsh)$/.test(r)&&n.endsWith(`
48
48
  `)&&x.length>0&&!x.endsWith(`\\`)&&!/[\p{Cc}\p{Cf}]/u.test(n.slice(0,-1)),t[0]=n,t[1]=s,t[2]=r,t[3]=o,t[4]=x,t[5]=S):(x=t[4],S=t[5]);let C=S,w;t[6]!==n||t[7]!==i||t[8]!==r?(w=()=>{typeof navigator<`u`&&navigator.clipboard!=null&&navigator.clipboard.writeText(n).then(()=>{v.current!=null&&clearTimeout(v.current),h(!0),v.current=setTimeout(()=>{h(!1),v.current=null},1200)}).catch(e=>{Cx({operation:`copy-code-block`,language:r,...i?{fenceTitle:i}:{}},e)})},t[6]=n,t[7]=i,t[8]=r,t[9]=w):w=t[9];let T=w,E,D;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>()=>{v.current!=null&&(clearTimeout(v.current),v.current=null)},D=[],t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,V.useEffect)(E,D);let O=m?Kt:Ut,k;t[12]===O?k=t[13]:(k=(0,U.jsx)(qt,{className:`size-3`,icon:O}),t[12]=O,t[13]=k);let A;t[14]!==b||t[15]!==T||t[16]!==k?(A=(0,U.jsx)(we,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,onClick:T,"aria-label":b,children:k}),t[14]=b,t[15]=T,t[16]=k,t[17]=A):A=t[17];let j=A;if(p){let e;t[18]!==j||t[19]!==c?(e=(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5 pt-1.5 pr-1.5 select-none`,children:[c,j]}),t[18]=j,t[19]=c,t[20]=e):e=t[20];let n;return t[21]!==d||t[22]!==r||t[23]!==e?(n=(0,U.jsxs)(`div`,{className:`my-[0.65rem] border border-transparent`,"data-language":r,children:[e,d]}),t[21]=d,t[22]=r,t[23]=e,t[24]=n):n=t[24],n}let M;t[25]!==f||t[26]!==y||t[27]!==g?(M=f?(0,U.jsx)(we,{type:`button`,variant:g?`secondary`:`ghost-muted`,size:`icon-xs`,"aria-pressed":g,onClick:()=>_(Kx),"aria-label":y,children:(0,U.jsx)(Oe,{className:`size-3`})}):null,t[25]=f,t[26]=y,t[27]=g,t[28]=M):M=t[28];let N;t[29]!==C||t[30]!==x||t[31]!==o?(N=C?(0,U.jsx)(we,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,onClick:()=>o(x),"aria-label":`Run in terminal`,children:(0,U.jsx)(Pe,{className:`size-3`})}):null,t[29]=C,t[30]=x,t[31]=o,t[32]=N):N=t[32];let P;t[33]!==j||t[34]!==M||t[35]!==N||t[36]!==c?(P=(0,U.jsxs)(`span`,{className:`flex items-center gap-0.5`,role:`toolbar`,"aria-label":`Code block actions`,children:[M,N,c,j]}),t[33]=j,t[34]=M,t[35]=N,t[36]=c,t[37]=P):P=t[37];let F;return t[38]!==d||t[39]!==i||t[40]!==r||t[41]!==P||t[42]!==a||t[43]!==g?(F=(0,U.jsx)(Ux,{language:r,fenceTitle:i,theme:a,wrapped:g,headerProps:Hx,actions:P,children:d}),t[38]=d,t[39]=i,t[40]=r,t[41]=P,t[42]=a,t[43]=g,t[44]=F):F=t[44],F}function Kx(e){return!e}function qx(e){let t=(0,H.c)(26),{code:n,fenceTitle:r,theme:i,isStreaming:a,onExpand:o,children:s}=e,[c,l]=(0,V.useState)(!1),u=(0,V.use)(Da),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>l(!0),t[0]=d):d=t[0];let f=Oa(d),p;t[1]!==n||t[2]!==a||t[3]!==c?(p=!c&&!a&&n.trim().length>0,t[1]=n,t[2]=a,t[3]=c,t[4]=p):p=t[4];let m=p,h=c?`Show diagram`:`Show code`,g=!m,_;t[5]!==a||t[6]!==c||t[7]!==h?(_=a?null:(0,U.jsx)(we,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,onClick:()=>l(Jx),"aria-label":h,children:c?(0,U.jsx)(Be,{className:`size-3`}):(0,U.jsx)(ie,{className:`size-3`})}),t[5]=a,t[6]=c,t[7]=h,t[8]=_):_=t[8];let v;t[9]!==s||t[10]!==n||t[11]!==o||t[12]!==u||t[13]!==m||t[14]!==f||t[15]!==i?(v=m?(0,U.jsxs)(ei,{resetKeys:[n,i],fallback:s,children:[(0,U.jsx)(V.Suspense,{fallback:(0,U.jsx)(`div`,{className:`flex min-h-36 items-center justify-center text-xs text-muted-foreground`,children:`Rendering diagram`}),children:(0,U.jsx)(Fb,{source:n,onExpand:o})}),u?(0,U.jsx)(`pre`,{ref:f,hidden:!0,"aria-hidden":!0,children:n}):null]}):s,t[9]=s,t[10]=n,t[11]=o,t[12]=u,t[13]=m,t[14]=f,t[15]=i,t[16]=v):v=t[16];let y;return t[17]!==n||t[18]!==r||t[19]!==a||t[20]!==m||t[21]!==g||t[22]!==_||t[23]!==v||t[24]!==i?(y=(0,U.jsx)(Gx,{code:n,language:`mermaid`,fenceTitle:r,theme:i,isStreaming:a,canWrap:g,diagram:m,viewToggle:_,children:v}),t[17]=n,t[18]=r,t[19]=a,t[20]=m,t[21]=g,t[22]=_,t[23]=v,t[24]=i,t[25]=y):y=t[25],y}function Jx(e){return!e}function Yx(e){let t=(0,H.c)(17),{className:n,code:r,themeName:i,isStreaming:a}=e,[o,s]=(0,V.useState)(a);a&&!o&&s(!0);let c,l,u;t[0]!==n||t[1]!==r||t[2]!==o||t[3]!==a||t[4]!==i?(l=Ox(n),c=Ix(r,l,i),u=!a&&!o?wx.get(c):null,t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=i,t[5]=c,t[6]=l,t[7]=u):(c=t[5],l=t[6],u=t[7]);let d=u;if(d!=null){let e;return t[8]===d?e=t[9]:(e=(0,U.jsx)(`div`,{className:`chat-markdown-shiki`,dangerouslySetInnerHTML:{__html:d}}),t[8]=d,t[9]=e),e}let f=a||o,p;return t[10]!==c||t[11]!==r||t[12]!==a||t[13]!==l||t[14]!==f||t[15]!==i?(p=(0,U.jsx)(Xx,{code:r,language:l,themeName:i,cacheKey:c,isStreaming:a,preserveLines:f}),t[10]=c,t[11]=r,t[12]=a,t[13]=l,t[14]=f,t[15]=i,t[16]=p):p=t[16],p}function Xx({code:e,language:t,themeName:n,cacheKey:r,isStreaming:i,preserveLines:a}){let o=(0,V.use)(vi(t)),s=(0,V.useMemo)(()=>a?Vv(o,t,n):null,[o,a,t,n]),c=(0,V.useMemo)(()=>{try{return s?s(e):a?o.codeToHast(e,{lang:t,theme:n}):o.codeToHtml(e,{lang:t,theme:n})}catch(r){return console.warn(`Code highlighting failed for language "${t}", falling back to plain text.`,r instanceof Error?r.message:r),a?o.codeToHast(e,{lang:`text`,theme:n}):o.codeToHtml(e,{lang:`text`,theme:n})}},[e,o,s,t,a,n]);return(0,V.useEffect)(()=>{if(!i){let t=typeof c==`string`?c:Cn(c);wx.set(r,t,Lx(t,e))}},[r,e,c,i]),typeof c==`string`?(0,U.jsx)(`div`,{className:`chat-markdown-shiki`,dangerouslySetInnerHTML:{__html:c}}):(0,U.jsx)(`div`,{className:`chat-markdown-shiki`,children:(0,U.jsx)(Gv,{root:c})})}var Zx=`chat-markdown-file-link`;function Qx(e){let t=Kn(e),n=Wb(t)??t;return bx.test(n)?n.replaceAll(`\\`,`/`):n}var $x=`block size-full shrink-0 select-none`,eS=new Set;function tS(e){let t=e.toLowerCase();return t===`github.com`||t.endsWith(`.github.com`)?Sr:null}var nS=(0,V.memo)(function(e){let t=(0,H.c)(10),{host:n}=e,[r,i]=(0,V.useState)(null),a;t[0]===n?a=t[1]:(a=tS(n),t[0]=n,t[1]=a);let o=a,s;t[2]!==o||t[3]!==n?(s=o?null:Gm(`https://${n}`),t[2]=o,t[3]=n,t[4]=s):s=t[4];let c=s,l;return t[5]!==o||t[6]!==r||t[7]!==c||t[8]!==n?(l=(0,U.jsx)(`span`,{className:`ms-[0.25em] me-[0.2em] inline-flex size-[14px] [vertical-align:-0.125em]`,"aria-hidden":!0,children:o?(0,U.jsx)(o,{className:$x}):c===null||r===n||eS.has(n)?(0,U.jsx)(P,{className:$x}):(0,U.jsx)(`img`,{src:c,alt:``,loading:`lazy`,draggable:!1,className:B($x,`rounded-sm`),onError:()=>{eS.add(n),i(n)}})}),t[5]=o,t[6]=r,t[7]=c,t[8]=n,t[9]=l):l=t[9],l}),rS=`max-w-[min(100%,30rem)]`,iS=B(`max-h-[30rem]`,rS),aS=`inline-block!`,oS=`rounded-lg border border-border/40`,sS=B(`h-auto w-auto object-contain`,iS);function cS(e,t,n){return`![${e.replaceAll(`\\`,`\\\\`).replaceAll(`[`,`\\[`).replaceAll(`]`,`\\]`)}](${t}${n===void 0?``:` "${n.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"`})`}function lS(e,t,n=30){let r=Number(e),i=Number(t),a=Number.isFinite(r)&&r>0,o=Number.isFinite(i)&&i>0;if(a&&o)return{width:r,height:`auto`,aspectRatio:`${r} / ${i}`,maxWidth:`min(100%, 30rem, ${n*r/i}rem)`};if(a)return{maxWidth:`min(100%, 30rem, ${r}px)`};if(o)return{maxHeight:`min(30rem, ${i}px)`}}var uS=B(aS,oS),dS=V.createContext(!1);function fS(e,t){if(!e)return{};let n=t.trim()||`image`,r=t=>{if(t.currentTarget.closest(`a`))return;t.preventDefault(),t.stopPropagation();let n=Fv.get(t.currentTarget);n&&e(Iv(t.currentTarget,n))};return{role:`button`,tabIndex:0,"aria-label":`Preview ${n}`,onClick:r,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&r(e)}}}function pS(e){let t=(0,H.c)(7),n=e.kind===`video`?`Video unavailable`:`Image unavailable`,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,U.jsx)(re,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),t[0]=r):r=t[0];let i;t[1]!==n||t[2]!==e.alt||t[3]!==e.detail?(i=[n,e.alt,e.detail].filter(Boolean),t[1]=n,t[2]=e.alt,t[3]=e.detail,t[4]=i):i=t[4];let a=i.join(` · `),o;return t[5]===a?o=t[6]:(o=(0,U.jsxs)(`span`,{"data-thread-find-ignore":!0,className:`inline-flex items-center gap-1.5`,children:[r,a]}),t[5]=a,t[6]=o),o}function mS(e){let t=(0,H.c)(11),n=e.copyMarkdown,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=B(aS,`rounded-md border border-border/40 bg-muted/40 px-2 py-1 text-xs text-muted-foreground`),t[0]=r):r=t[0];let i;t[1]!==e.alt||t[2]!==e.detail||t[3]!==e.kind?(i=(0,U.jsx)(pS,{alt:e.alt,kind:e.kind,detail:e.detail}),t[1]=e.alt,t[2]=e.detail,t[3]=e.kind,t[4]=i):i=t[4];let a;t[5]!==e.copyMarkdown||t[6]!==i?(a=(0,U.jsx)(`span`,{"data-markdown-copy":n,className:r,children:i}),t[5]=e.copyMarkdown,t[6]=i,t[7]=a):a=t[7];let o=a,s;return t[8]!==o||t[9]!==e.actionsSource?(s=e.actionsSource?(0,U.jsx)(Ta,{source:e.actionsSource,children:o}):o,t[8]=o,t[9]=e.actionsSource,t[10]=s):s=t[10],s}var hS=B(`aspect-video w-full overflow-hidden bg-muted/60`,rS,oS);function gS(e){let t=(0,H.c)(52),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),o=e.src??n,s=e.sourceFailed===!0||o!==null&&i===o,c=o!==null&&!s&&(!e.standalone||n!==null),l;t[0]!==e.actionsSource||t[1]!==e.alt||t[2]!==e.originalUrl||t[3]!==o?(l=t=>{t&&(t.complete&&t.naturalWidth>0&&r(t.currentSrc||t.src),Fv.set(t,{src:o,name:e.alt.trim()||`image`,actionsSource:e.actionsSource,...e.originalUrl?{originalUrl:e.originalUrl}:{}}))},t[0]=e.actionsSource,t[1]=e.alt,t[2]=e.originalUrl,t[3]=o,t[4]=l):l=t[4];let u=l,d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>({onLoad:()=>{r(e),a(null)},onError:()=>{a(e),r(null)}}),t[5]=d):d=t[5];let f=d;if(c){let n=e.actionsSource,r=e.imageProps,i=e.alt,a=e.copyMarkdown,s=e.onImageExpand&&`cursor-zoom-in`,c;t[6]!==e.className||t[7]!==s?(c=B(sS,e.className,s),t[6]=e.className,t[7]=s,t[8]=c):c=t[8];let l=e.style,d;t[9]!==e.alt||t[10]!==e.onImageExpand?(d=fS(e.onImageExpand,e.alt),t[9]=e.alt,t[10]=e.onImageExpand,t[11]=d):d=t[11];let p;t[12]===o?p=t[13]:(p=f(o),t[12]=o,t[13]=p);let m;t[14]!==u||t[15]!==e.alt||t[16]!==e.copyMarkdown||t[17]!==e.imageProps||t[18]!==e.style||t[19]!==o||t[20]!==p||t[21]!==c||t[22]!==d?(m=(0,U.jsx)(`img`,{...r,ref:u,src:o,alt:i,"data-markdown-copy":a,decoding:`async`,draggable:!1,className:c,style:l,...d,...p}),t[14]=u,t[15]=e.alt,t[16]=e.copyMarkdown,t[17]=e.imageProps,t[18]=e.style,t[19]=o,t[20]=p,t[21]=c,t[22]=d,t[23]=m):m=t[23];let h;return t[24]!==e.actionsSource||t[25]!==m?(h=(0,U.jsx)(Ta,{source:n,children:m}),t[24]=e.actionsSource,t[25]=m,t[26]=h):h=t[26],h}if(!e.standalone){let n;return t[27]!==s||t[28]!==e.actionsSource||t[29]!==e.alt||t[30]!==e.copyMarkdown||t[31]!==e.imageProps?.id||t[32]!==e.unavailableDetail?(n=s?(0,U.jsx)(mS,{alt:e.alt,copyMarkdown:e.copyMarkdown,actionsSource:e.actionsSource,detail:e.unavailableDetail}):(0,U.jsx)(`span`,{id:e.imageProps?.id,"data-markdown-copy":e.copyMarkdown,role:`status`,"aria-label":`Loading image`,className:aS}),t[27]=s,t[28]=e.actionsSource,t[29]=e.alt,t[30]=e.copyMarkdown,t[31]=e.imageProps?.id,t[32]=e.unavailableDetail,t[33]=n):n=t[33],n}let p=e.actionsSource,m=e.imageProps?.id,h=e.copyMarkdown,g;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(g=B(aS,hS,`relative`),t[34]=g):g=t[34];let _;t[35]===s?_=t[36]:(_=s?{role:`alert`}:{role:`status`,"aria-label":`Loading image`},t[35]=s,t[36]=_);let v;t[37]!==s||t[38]!==u||t[39]!==e.alt||t[40]!==e.unavailableDetail||t[41]!==o?(v=s?(0,U.jsx)(`span`,{className:`flex size-full items-center justify-center p-2 text-center text-xs text-muted-foreground`,children:(0,U.jsx)(pS,{alt:e.alt,detail:e.unavailableDetail})}):o===null?null:(0,U.jsx)(`img`,{ref:u,src:o,alt:e.alt,decoding:`async`,draggable:!1,className:`invisible absolute inset-0 size-full`,...f(o)}),t[37]=s,t[38]=u,t[39]=e.alt,t[40]=e.unavailableDetail,t[41]=o,t[42]=v):v=t[42];let y;t[43]!==e.copyMarkdown||t[44]!==e.style||t[45]!==m||t[46]!==_||t[47]!==v?(y=(0,U.jsx)(`span`,{id:m,"data-markdown-copy":h,className:g,style:e.style,..._,children:v}),t[43]=e.copyMarkdown,t[44]=e.style,t[45]=m,t[46]=_,t[47]=v,t[48]=y):y=t[48];let b;return t[49]!==e.actionsSource||t[50]!==y?(b=(0,U.jsx)(Ta,{source:p,children:y}),t[49]=e.actionsSource,t[50]=y,t[51]=b):b=t[51],b}function _S(e){let t=(0,H.c)(12),n=e.mediaIdentity??e.copyMarkdown??e.src,r=e.src,i=e.sourceFailed,a=e.alt,o=e.originalUrl,s=e.style,c=e.copyMarkdown,l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=B(aS,rS,`w-full`),u=B(iS,oS),t[0]=l,t[1]=u):(l=t[0],u=t[1]);let d;return t[2]!==e.actionsSource||t[3]!==e.alt||t[4]!==e.copyMarkdown||t[5]!==e.onRetry||t[6]!==e.originalUrl||t[7]!==e.sourceFailed||t[8]!==e.src||t[9]!==e.style||t[10]!==n?(d=(0,U.jsx)(Ea,{src:r,sourceFailed:i,label:a,originalUrl:o,style:s,copyMarkdown:c,className:l,videoClassName:u,onRetry:e.onRetry,actionsSource:e.actionsSource},n),t[2]=e.actionsSource,t[3]=e.alt,t[4]=e.copyMarkdown,t[5]=e.onRetry,t[6]=e.originalUrl,t[7]=e.sourceFailed,t[8]=e.src,t[9]=e.style,t[10]=n,t[11]=d):d=t[11],d}var vS=(0,V.memo)(function(e){let t=(0,H.c)(65),n=pr(e.environmentId,e.resource),r=mr(e.environmentId,e.resource),i=e.resource,a;t[0]!==e.workspaceRoot||t[1]!==i._tag||t[2]!==i.path?(a=i._tag===`media-file`?i.path:i._tag===`workspace-file`&&e.workspaceRoot?`${e.workspaceRoot.replace(/[\\/]+$/,``)}/${i.path}`:void 0,t[0]=e.workspaceRoot,t[1]=i._tag,t[2]=i.path,t[3]=a):a=t[3];let o=a,s;t[4]!==o||t[5]!==e.originalUrl||t[6]!==e.workspaceRoot?(s=o?Gn(o,e.workspaceRoot):e.originalUrl?Un(e.originalUrl):void 0,t[4]=o,t[5]=e.originalUrl,t[6]=e.workspaceRoot,t[7]=s):s=t[7];let c=s,l=c?.kind===`file`?c.relativePath:void 0,u=n._tag===`Failure`?e.fallbackSrc:void 0,d=n._tag===`Success`?n.url+(e.srcFragment??``):u===void 0?null:u+(e.srcFragment??``),f=n._tag===`Success`?n.imageDimensions:void 0,p=e.maxHeightRem??30,m;t[8]!==f||t[9]!==p||t[10]!==e.style?(m=e.style??(f?lS(f.width,f.height,p):p===30?void 0:{maxHeight:`${p}rem`}),t[8]=f,t[9]=p,t[10]=e.style,t[11]=m):m=t[11];let h=m,g=e.kind??`image`,_=e.alt||(e.kind??`image`),v;t[12]!==u||t[13]!==e.environmentId||t[14]!==i?(v=u===void 0?{asset:{environmentId:e.environmentId,resource:i}}:{},t[12]=u,t[13]=e.environmentId,t[14]=i,t[15]=v):v=t[15];let y;t[16]===c?y=t[17]:(y=c?{reference:c}:{},t[16]=c,t[17]=y);let b;t[18]!==e.environmentId||t[19]!==l||t[20]!==i._tag||t[21]!==i.threadId?(b=l&&(i._tag===`media-file`||i._tag===`workspace-file`)?{onOpenFile:()=>pn.getState().openFile({environmentId:e.environmentId,threadId:i.threadId},l)}:{},t[18]=e.environmentId,t[19]=l,t[20]=i._tag,t[21]=i.threadId,t[22]=b):b=t[22];let x;t[23]!==d||t[24]!==g||t[25]!==_||t[26]!==v||t[27]!==y||t[28]!==b?(x={kind:g,name:_,src:d,...v,...y,...b},t[23]=d,t[24]=g,t[25]=_,t[26]=v,t[27]=y,t[28]=b,t[29]=x):x=t[29];let S=x;if(e.kind===`video`){let i=n._tag===`Failure`&&u===void 0,a=e.alt,o=e.copyMarkdown,s=e.originalUrl,c=e.style,l;t[30]!==e.environmentId||t[31]!==e.resource||t[32]!==e.srcFragment?(l=JSON.stringify([e.environmentId,e.resource,e.srcFragment]),t[30]=e.environmentId,t[31]=e.resource,t[32]=e.srcFragment,t[33]=l):l=t[33];let f;return t[34]!==S||t[35]!==e.alt||t[36]!==e.copyMarkdown||t[37]!==e.originalUrl||t[38]!==e.style||t[39]!==r||t[40]!==d||t[41]!==l||t[42]!==i?(f=(0,U.jsx)(_S,{src:d,sourceFailed:i,alt:a,copyMarkdown:o,originalUrl:s,style:c,mediaIdentity:l,onRetry:r,actionsSource:S}),t[34]=S,t[35]=e.alt,t[36]=e.copyMarkdown,t[37]=e.originalUrl,t[38]=e.style,t[39]=r,t[40]=d,t[41]=l,t[42]=i,t[43]=f):f=t[43],f}let C;t[44]!==e.environmentId||t[45]!==e.resource||t[46]!==e.srcFragment?(C=JSON.stringify([e.environmentId,e.resource,e.srcFragment]),t[44]=e.environmentId,t[45]=e.resource,t[46]=e.srcFragment,t[47]=C):C=t[47];let w=n._tag===`Failure`&&u===void 0,T=n._tag===`Failure`&&n.reason===`missing-file-access`&&u===void 0?lr:void 0,E=e.alt,D=e.copyMarkdown,O=e.standalone??!0,k=e.framed===!1?void 0:uS,A;t[48]!==e.className||t[49]!==k?(A=B(k,e.className),t[48]=e.className,t[49]=k,t[50]=A):A=t[50];let j;return t[51]!==S||t[52]!==e.alt||t[53]!==e.copyMarkdown||t[54]!==e.imageProps||t[55]!==e.onImageExpand||t[56]!==e.originalUrl||t[57]!==d||t[58]!==h||t[59]!==w||t[60]!==T||t[61]!==O||t[62]!==A||t[63]!==C?(j=(0,U.jsx)(gS,{src:d,sourceFailed:w,unavailableDetail:T,alt:E,copyMarkdown:D,standalone:O,className:A,style:h,imageProps:e.imageProps,actionsSource:S,originalUrl:e.originalUrl,onImageExpand:e.onImageExpand},C),t[51]=S,t[52]=e.alt,t[53]=e.copyMarkdown,t[54]=e.imageProps,t[55]=e.onImageExpand,t[56]=e.originalUrl,t[57]=d,t[58]=h,t[59]=w,t[60]=T,t[61]=O,t[62]=A,t[63]=C,t[64]=j):j=t[64],j});function yS(e){let t=/^(?:https?:\/\/)/i.exec(e)?.[0];return t?t.length:Math.min(e.length,1)}function bS(e){return Array.from(e.matchAll(/\s+|\S+/g),({0:e,index:t})=>e.length<=16?e:(0,U.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},t))}function xS(e){if(!e||typeof e!=`object`||!(`children`in e)||!Array.isArray(e.children))return null;let t=e.children.map(e=>e&&typeof e==`object`&&`type`in e&&e.type===`text`&&`value`in e&&typeof e.value==`string`?e.value:null);return t.every(e=>e!==null)?t.join(``):null}function SS(e){return!e||typeof e!=`object`?``:`type`in e&&e.type===`text`&&`value`in e&&typeof e.value==`string`?e.value:!(`children`in e)||!Array.isArray(e.children)?``:e.children.map(SS).join(``)}function CS(e){return!e||typeof e!=`object`?!1:`type`in e&&e.type===`text`&&`value`in e&&typeof e.value==`string`&&e.value.trim().length>0||`children`in e&&Array.isArray(e.children)&&e.children.some(CS)}var wS=`user-content-`;function TS(e){let t=e.slice(1);try{return decodeURIComponent(t)}catch{return t}}function ES(e){let t=e;for(;t.startsWith(wS);)t=t.slice(13);return t}function DS(e,t){let n=TS(t),r=ES(n),i=e=>e.id===n||ES(e.id)===r,a=e.closest(`.chat-markdown`);if(a){let e=Array.from(a.querySelectorAll(`[id]`)).find(i);if(e)return e}return document.getElementById(n)??Array.from(document.querySelectorAll(`[id]`)).find(i)??null}function OS(e,t){e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),DS(e.currentTarget,t)?.scrollIntoView({block:`start`}))}function kS(e){return e.trim().toLowerCase().replace(/[^\p{L}\p{M}\p{N}\p{Pc} -]/gu,``).replace(/ /g,`-`)}function AS(){return e=>{let t=new Set,n=e=>{let r=e.properties?.id;typeof r==`string`&&t.add(r),e.children?.forEach(n)};n(e);let r=new Map,i=e=>{if(e.type===`element`&&e.tagName&&/^h[1-6]$/.test(e.tagName)){let n=kS(SS(e));if(e.properties?.id===void 0&&n){let i=r.get(n)??0,a=`${wS}${n}`;for(;t.has(a);)i+=1,a=`${wS}${n}-${i}`;r.set(n,i),t.add(a),e.properties={...e.properties,id:a}}}else e.children?.forEach(i)};i(e)}}var jS=[...Nm,AS,iv],MS=[AS,iv];function NS(e){return Dr(e)||d(e)||um(e)||Bn(e)?e:Wb(e)??Jh(e)}function PS(e){let t=(0,H.c)(13),{host:n,plainText:r,children:i}=e;if(r){let e;if(t[0]!==n||t[1]!==r){let i=yS(r),a;t[3]===n?a=t[4]:(a=(0,U.jsx)(nS,{host:n}),t[3]=n,t[4]=a),e=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`whitespace-nowrap`,children:[a,r.slice(0,i)]}),bS(r.slice(i))]}),t[0]=n,t[1]=r,t[2]=e}else e=t[2];return e}let a,o;if(t[5]!==i||t[6]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=V.Children.toArray(i),r=e[0];if(typeof r==`string`&&r.length>0){let i=yS(r),a;t[9]===n?a=t[10]:(a=(0,U.jsx)(nS,{host:n}),t[9]=n,t[10]=a),o=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`whitespace-nowrap`,children:[a,r.slice(0,i)]}),bS(r.slice(i)),e.slice(1)]});break bb0}let s;t[11]===n?s=t[12]:(s=(0,U.jsx)(nS,{host:n}),t[11]=n,t[12]=s),a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[s,r]}),e.slice(1)]})}t[5]=i,t[6]=n,t[7]=a,t[8]=o}else a=t[7],o=t[8];return o===Symbol.for(`react.early_return_sentinel`)?a:o}var FS=(0,V.memo)(function({environmentId:e,href:t,targetPath:n,iconPath:r,displayPath:i,panelPath:a,line:o,label:s,copyMarkdown:c,theme:l,threadRef:u,onOpen:d,onOpenInPanel:f,openInEditorMenuLabel:p,onOpenInBrowser:m,onOpenMedia:h,onReveal:g,revealLabel:_}){let v=(0,V.useCallback)(()=>{d&&(async()=>{try{let e=await d(n);if(e._tag===`Success`||_t(e))return;Cx({operation:`open-file-in-editor`,target:n},e.cause);let t=ht(e);Xt.add(bn({type:`error`,title:`Unable to open file`,description:t instanceof Error?t.message:`An error occurred.`}))}catch(e){Cx({operation:`open-file-in-editor`,target:n},e),Xt.add(bn({type:`error`,title:`Unable to open file`,description:e instanceof Error?e.message:`An error occurred.`}))}})()},[d,n]),y=(0,V.useCallback)(()=>{u&&a?f(a,o):h?h():v()},[v,o,f,h,a,u]),b=(0,V.useCallback)(()=>{m&&(async()=>{try{let e=await m();if(e._tag===`Success`||_t(e))return;Cx({operation:`open-file-in-browser`,target:n},e.cause);let t=ht(e);Xt.add(bn({type:`error`,title:`Unable to open file in browser`,description:t instanceof Error?t.message:`An error occurred.`}))}catch(e){Cx({operation:`open-file-in-browser`,target:n},e),Xt.add(bn({type:`error`,title:`Unable to open file in browser`,description:e instanceof Error?e.message:`An error occurred.`}))}})()},[m,n]),x=(0,V.useCallback)(()=>{g&&(async()=>{try{let e=await g();if(e._tag===`Success`||_t(e))return;Cx({operation:`reveal-file-in-file-manager`,target:n},e.cause);let t=ht(e);Xt.add(bn({type:`error`,title:`Unable to reveal file`,description:t instanceof Error?t.message:`An error occurred.`}))}catch(e){Cx({operation:`reveal-file-in-file-manager`,target:n},e),Xt.add(bn({type:`error`,title:`Unable to reveal file`,description:e instanceof Error?e.message:`An error occurred.`}))}})()},[g,n]),S=(0,V.useCallback)((e,t)=>{typeof window>`u`||!navigator.clipboard?.writeText?Xt.add(bn({type:`error`,title:`Failed to copy ${t.toLowerCase()}`,description:`Clipboard API unavailable.`})):navigator.clipboard.writeText(e).then(()=>{Xt.add({type:`success`,title:`${t} copied`,description:e})},e=>{Cx({operation:`copy-file-path`,target:n,copyTarget:t},e),Xt.add(bn({type:`error`,title:`Failed to copy ${t.toLowerCase()}`,description:e instanceof Error?e.message:`An error occurred.`}))})},[n]),C=(0,V.useCallback)(async e=>{let t=Qt();if(t)try{let r=await t.contextMenu.show([...h?[{id:`preview-media`,label:`Preview media`}]:[],...d?[{id:`open`,label:p}]:[],...m?[{id:`open-in-browser`,label:`Open in integrated browser`}]:[],...g&&_?[{id:`reveal`,label:_}]:[],{id:`copy-relative`,label:`Copy relative path`},{id:`copy-full`,label:`Copy full path`}],e);if(r===`preview-media`){h?.();return}if(r===`open`){v();return}if(r===`open-in-browser`){b();return}if(r===`reveal`){x();return}if(r===`copy-relative`){S(i,`Relative path`);return}r===`copy-full`&&S(n,`Full path`)}catch(e){Cx({operation:`show-file-context-menu`,target:n},e)}},[i,S,b,v,x,m,h,d,g,p,_,n]),w=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let t=e.clientX===0&&e.clientY===0?(()=>{let t=e.currentTarget.getBoundingClientRect();return{x:t.left,y:t.bottom}})():{x:e.clientX,y:e.clientY};C(t)},[C]),T=d!==void 0,E=m!==void 0,D=u!==void 0&&!!a,O=px({canOpenInEditor:T,canOpenInBrowser:E,canOpenInPanel:D,canOpenMedia:h!==void 0}),k=mx({iconPath:r,canOpenInEditor:T,canOpenInBrowser:E,canOpenInPanel:D});return(0,U.jsxs)(er,{children:[(0,U.jsx)(Qn,{render:O?(0,U.jsx)(Yg,{kind:`mention`,render:(0,U.jsx)(`a`,{href:t}),className:Zx,"data-markdown-copy":c,onClick:e=>{e.preventDefault(),e.stopPropagation(),d&&Hb(e)?v():k?b():y()},onContextMenu:w,children:(0,U.jsx)(zv,{path:r,environmentId:e,label:s,theme:l})}):(0,U.jsx)(Yg,{kind:`mention`,render:(0,U.jsx)(`button`,{type:`button`}),"aria-label":`File options for ${s}`,"aria-haspopup":`menu`,className:B(Zx,`select-text`),"data-markdown-copy":c,onClick:w,onContextMenu:w,children:(0,U.jsx)(zv,{path:r,environmentId:e,label:s,theme:l})})}),(0,U.jsx)($n,{side:`top`,variant:`code`,children:(0,U.jsx)(`div`,{className:`overflow-x-auto whitespace-nowrap scrollbar-thumb-border/78 scrollbar-track-transparent [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border/78 [&::-webkit-scrollbar-track]:bg-transparent`,children:(0,U.jsx)(Rv,{path:r,label:n,environmentId:e})})})]})},IS);function IS(e,t){return e.href===t.href&&e.targetPath===t.targetPath&&e.iconPath===t.iconPath&&e.environmentId===t.environmentId&&e.displayPath===t.displayPath&&e.panelPath===t.panelPath&&e.line===t.line&&e.label===t.label&&e.copyMarkdown===t.copyMarkdown&&e.theme===t.theme&&e.threadRef===t.threadRef&&e.onOpen===t.onOpen&&e.onOpenInPanel===t.onOpenInPanel&&e.openInEditorMenuLabel===t.openInEditorMenuLabel&&e.onOpenInBrowser===t.onOpenInBrowser&&e.onOpenMedia===t.onOpenMedia&&e.onReveal===t.onReveal&&e.revealLabel===t.revealLabel}function LS(e,t,n){let r=In(nm(e)).filter(e=>!d(e)).map(Qx).filter(e=>qb(e,t,n??t)),i=zn(e).filter(e=>Gb(e,t,n??t));return JSON.stringify([[...new Set(r)],[...new Set(i)]])}function RS(e,t,n){let[r,i]=JSON.parse(e),a=new Map;for(let e of r){let r=qb(e,t,n??t);r&&a.set(e,r)}let o=new Map;for(let e of i){let r=Gb(e,t,n??t);r&&o.set(e,r)}return{markdownFileLinkMetaByHref:a,inlineCodeFileLinkMetaByText:o,fileLinkParentSuffixByPath:yn([...[...a.values()].map(e=>e.filePath),...[...o.values()].map(e=>e.filePath)])}}function zS(e){let t=(0,H.c)(126),{text:n,inline:r,cwd:i,threadRef:a,pullRequestPanelRef:o,environmentId:s,onTaskListChange:c,isStreaming:l,skills:u,onUseArtifactTemplate:d,onRunShellCommand:f,imageBaseDir:p,onImageExpand:m,renderContextReference:h,headingLevelOffset:g,githubMedia:_}=e,v=r!==void 0&&r,y=l!==void 0&&l,b=u===void 0?hx:u,S=g===void 0?0:g,C=_!==void 0&&_,{resolvedTheme:w}=$t(),[T,E]=(0,V.useState)(null),D=(0,V.useRef)(null),O=m??E,k=(0,V.useRef)(0),A;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>(E(null),()=>{k.current+=1}),t[0]=A):A=t[0];let j=a?.environmentId,M=a?.threadId,N;t[1]!==i||t[2]!==s||t[3]!==p||t[4]!==j||t[5]!==M?(N=[j,M,s,i,p],t[1]=i,t[2]=s,t[3]=p,t[4]=j,t[5]=M,t[6]=N):N=t[6],(0,V.useEffect)(A,N);let P;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(P={reportFailure:!1,refresh:!0},t[7]=P):P=t[7];let F=fr(ur.createUrl,P),ee;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(ee={reportFailure:!1},t[8]=ee):ee=t[8];let te=fr(jt.searchEntries,ee),ne;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(ne={reportFailure:!1},t[9]=ne):ne=t[9];let re=fn(Cr.open,ne),I=Yr(a?.environmentId),L=a?.environmentId??s??null,ie=on(L,rt),ae=on(L,ot),oe=Ji(L),se;t[10]!==ie||t[11]!==L||t[12]!==oe?(se=ie&&fx(L,oe.state.mode,oe.isResolved),t[10]=ie,t[11]=L,t[12]=oe,t[13]=se):se=t[13];let ce=se,le=ln(L),ue;t[14]!==F||t[15]!==i||t[16]!==O||t[17]!==le||t[18]!==a?(ue=(e,t,n)=>{let r=k.current+=1;av({source:e,resolvedFilePath:t,cwd:i,threadRef:a,httpBaseUrl:le._tag===`Some`?le.value.httpBaseUrl:void 0,createAssetUrl:F,onOpenFile:a?e=>pn.getState().openFile(a,e):void 0}).then(e=>{if(e&&k.current===r){let t=e.images[e.index];O(t&&t.type!==`video`&&D.current?Iv(n??D.current,t):e)}},e=>{k.current===r&&Xt.add(bn({type:`error`,title:`Media unavailable`,description:e instanceof Error?e.message:`The file could not be loaded. It may have been moved or deleted.`}))})},t[14]=F,t[15]=i,t[16]=O,t[17]=le,t[18]=a,t[19]=ue):ue=t[19];let de=ue,R;t[20]===L?R=t[21]:(R=an.configValueAtom(L),t[20]=L,t[21]=R);let fe=x(R),z=kt(),pe;t[22]===fe?.availableEditors?pe=t[23]:(pe=fe?.availableEditors??[],t[22]=fe?.availableEditors,t[23]=pe);let me=pe,[ge]=_i(me),_e;t[24]===ge?_e=t[25]:(_e=Hi(ge),t[24]=ge,t[25]=_e);let ve=_e,ye=Si(L,me),be;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(be={reportFailure:!1},t[26]=be):be=t[26];let xe=fn(Pt.openInEditor,be),Se;t[27]!==L||t[28]!==fe?(Se=L!==null&&fe?.shellRevealInFileManager===!0&&fe.availableEditors.includes(`file-manager`)?fe.shellRevealInFileManagerKind===void 0?Ii(fe.environment.platform.os):Li(fe.shellRevealInFileManagerKind):void 0,t[27]=L,t[28]=fe,t[29]=Se):Se=t[29];let Ce=Se,we;t[30]!==L||t[31]!==xe?(we=e=>L===null?Promise.resolve(he(st(new yi({targetPath:e})))):sn(L,`orchestration:operate`)?xe({environmentId:L,input:{cwd:e,editor:`file-manager`,reveal:!0}}):Promise.resolve(he(st(Error(`This connection cannot reveal files on this environment.`)))),t[30]=L,t[31]=xe,t[32]=we):we=t[32];let Te=we,Ee;t[33]===w?Ee=t[34]:(Ee=Pn(w),t[33]=w,t[34]=Ee);let De=Ee,Oe;t[35]!==i||t[36]!==p||t[37]!==n?(Oe=LS(n,i,p),t[35]=i,t[36]=p,t[37]=n,t[38]=Oe):Oe=t[38];let ke=Oe,Ae;t[39]!==i||t[40]!==ke||t[41]!==p?(Ae=RS(ke,i,p),t[39]=i,t[40]=ke,t[41]=p,t[42]=Ae):Ae=t[42];let{markdownFileLinkMetaByHref:je,inlineCodeFileLinkMetaByText:Me,fileLinkParentSuffixByPath:Ne}=Ae,Pe=HS,Fe=ni(a,o),Ie=Xr(a),Le=rn(VS),Re=rn(BS),B;t[43]!==I||t[44]!==a?(B=e=>{if(a===void 0||Ft(a)===null||!I.canLink(e))return null;let t=Tt(e);return t===null?null:{...t,url:e}},t[43]=I,t[44]=a,t[45]=B):B=t[45];let ze=B,Be;t[46]!==I||t[47]!==a?(Be=e=>{if(a===void 0||!I.isLinked(Ft(a),e))return null;let t=Tt(e);return t===null?null:{...t,url:e}},t[46]=I,t[47]=a,t[48]=Be):Be=t[48];let Ve=Be,He;t[49]!==Ve||t[50]!==I||t[51]!==a?(He=async(e,t)=>{a===void 0||!t&&Ve(e)===null||sn(a.environmentId,`orchestration:operate`)&&await I.changeLink(a,e,t)},t[49]=Ve,t[50]=I,t[51]=a,t[52]=He):He=t[52];let Ue=He,We;t[53]!==ae||t[54]!==re||t[55]!==a?(We=e=>!a||!ae?Promise.resolve(he(st(new xr({message:`Preview access is unavailable for this client.`})))):_r({threadRef:a,url:e,openPreview:re}).then(t=>{if(t._tag===`Success`)hr(a,e);else if(!_t(t)){let e=ht(t);e instanceof yr&&Xt.add(bn({type:`error`,title:`Unable to open link in browser`,description:e.message}))}return t}),t[53]=ae,t[54]=re,t[55]=a,t[56]=We):We=t[56];let Ge=We,Ke;t[57]!==ae||t[58]!==F||t[59]!==i||t[60]!==re||t[61]!==le||t[62]!==a?(Ke=e=>!a||!ae||le._tag===`None`?Promise.resolve(he(st(new xr({message:`Environment is not connected.`})))):vr({threadRef:a,filePath:e,workspaceRoot:i,httpBaseUrl:le.value.httpBaseUrl,createAssetUrl:F,openPreview:re}),t[57]=ae,t[58]=F,t[59]=i,t[60]=re,t[61]=le,t[62]=a,t[63]=Ke):Ke=t[63];let qe=Ke,Je;t[64]!==i||t[65]!==L||t[66]!==te?(Je=async e=>{if(!i||L===null||!sn(L,`filesystem:read`)||!Qb(e))return null;let t=await te({environmentId:L,input:{cwd:i,query:e,limit:25,kind:`file`}});return t._tag===`Success`?$b(e,t.value.entries):null},t[64]=i,t[65]=L,t[66]=te,t[67]=Je):Je=t[67];let Ye=Je,Xe;t[68]!==i||t[69]!==Ye||t[70]!==a?(Xe=(e,t)=>{if(!a)return;let n=Xb(),r=e=>pn.getState().openFile(a,e,t);!i||!Qb(e)?r(e):(async()=>{let t=await Ye(e);n()&&r(t??e)})()},t[68]=i,t[69]=Ye,t[70]=a,t[71]=Xe):Xe=t[71];let Ze=Xe,Qe;t[72]!==i||t[73]!==Ye||t[74]!==Te?(Qe=async e=>{let t=e.workspaceRelativePath,n=t?await Ye(t):null,r=n&&i?mn(n,i):e.filePath;return Te(r)},t[72]=i,t[73]=Ye,t[74]=Te,t[75]=Qe):Qe=t[75];let $e=Qe,et;t[76]!==ae||t[77]!==ce||t[78]!==L||t[79]!==Ne||t[80]!==Ze||t[81]!==ye||t[82]!==qe||t[83]!==de||t[84]!==ve||t[85]!==w||t[86]!==Ce||t[87]!==$e||t[88]!==a?(et=(e,t,n)=>{let r=n??e.filePath,i=Ct(e.basename.slice(e.basename.lastIndexOf(`.`)))!==null,o=e.workspaceRelativePath??(!i&&St(e.filePath)?e.filePath:null);return(0,U.jsx)(FS,{environmentId:L,href:e.targetPath,targetPath:e.targetPath,iconPath:e.filePath,displayPath:e.displayPath,panelPath:o,line:e.line,label:gn({path:e.filePath,...e.line===void 0?{}:{line:e.line},...e.column===void 0?{}:{column:e.column}},Ne),copyMarkdown:t,theme:w,threadRef:a,...ce?{onOpen:ye}:{},onOpenInPanel:Ze,onOpenMedia:a&&i?()=>de(r,e.filePath):void 0,openInEditorMenuLabel:ve,onReveal:ce&&Ce!==void 0?()=>$e(e):void 0,revealLabel:Ce,onOpenInBrowser:a&&ae&&gr(a.environmentId)&&br(e.filePath)?()=>qe(e.filePath):void 0})},t[76]=ae,t[77]=ce,t[78]=L,t[79]=Ne,t[80]=Ze,t[81]=ye,t[82]=qe,t[83]=de,t[84]=ve,t[85]=w,t[86]=Ce,t[87]=$e,t[88]=a,t[89]=et):et=t[89];let tt=et,nt;t[90]!==ie||t[91]!==ae||t[92]!==i||t[93]!==De||t[94]!==L||t[95]!==O||t[96]!==tt||t[97]!==C||t[98]!==S||t[99]!==p||t[100]!==v||t[101]!==Me||t[102]!==y||t[103]!==Le||t[104]!==Ve||t[105]!==je||t[106]!==Re||t[107]!==f||t[108]!==c||t[109]!==d||t[110]!==Fe||t[111]!==Ie||t[112]!==Ge||t[113]!==de||t[114]!==z||t[115]!==h||t[116]!==ze||t[117]!==w||t[118]!==fe||t[119]!==b||t[120]!==a||t[121]!==Ue?(nt={canOperateHost:ie,canOperatePreview:ae,cwd:i,diffThemeName:De,environmentId:L,expandMedia:O,fileLinkChip:tt,githubMedia:C,renderContextReference:h,headingLevelOffset:S,imageBaseDir:p,inlineCodeFileLinkMetaByText:Me,inline:v,mathEnabled:Re,isStreaming:y,linkTargetPreference:Le,markdownFileLinkMetaByHref:je,onTaskListChange:c,onUseArtifactTemplate:d,onRunShellCommand:f,openChangeRequestLink:Fe,openDeferredMarkdownLink:Ie,openExternalLinkInPreview:Ge,openMarkdownMedia:de,projects:z,linkedThreadPullRequestFor:Ve,resolveThreadPullRequest:ze,resolvedTheme:w,serverConfig:fe,skills:b,threadRef:a,updateThreadPullRequestLink:Ue},t[90]=ie,t[91]=ae,t[92]=i,t[93]=De,t[94]=L,t[95]=O,t[96]=tt,t[97]=C,t[98]=S,t[99]=p,t[100]=v,t[101]=Me,t[102]=y,t[103]=Le,t[104]=Ve,t[105]=je,t[106]=Re,t[107]=f,t[108]=c,t[109]=d,t[110]=Fe,t[111]=Ie,t[112]=Ge,t[113]=de,t[114]=z,t[115]=h,t[116]=ze,t[117]=w,t[118]=fe,t[119]=b,t[120]=a,t[121]=Ue,t[122]=nt):nt=t[122];let it=nt,at;return t[123]!==it||t[124]!==T?(at={componentState:it,handleCopy:Pe,markdownRef:D,localMediaPreview:T,setLocalMediaPreview:E},t[123]=it,t[124]=T,t[125]=at):at=t[125],at}function BS(e){return e.mathRenderingEnabled}function VS(e){return e.browserLinkTarget}function HS(e){let t=window.getSelection();if(!t||t.isCollapsed||!e.clipboardData)return;let n=jg(t);if(!n)return;e.preventDefault(),e.clipboardData.setData(`text/plain`,n.text);let r=e.clipboardData.getData(dt);e.clipboardData.setData(`text/html`,r?Qe(n.text,r,n.html):n.html)}var US=V.createContext(null),WS=V.createContext(``);function GS(e){let t=`h${e}`;return function({node:n,...r}){let{headingLevelOffset:i}=(0,V.use)(US);return(0,U.jsx)(t,{...r,"aria-level":i>0?Math.min(e+i,6):void 0})}}function KS(e){window.getSelection()?.selectAllChildren(e.currentTarget)}var qS={h1:GS(1),h2:GS(2),h3:GS(3),h4:GS(4),h5:GS(5),h6:GS(6),div:function({node:e,children:t,...n}){let{onUseArtifactTemplate:r}=(0,V.use)(US),i=im(e?.properties);return i?(0,U.jsx)(vx,{template:i,onUse:r}):(0,U.jsx)(`div`,{...n,children:t})},p:function({node:e,children:t,...n}){let{skills:r}=(0,V.use)(US);return(0,U.jsx)(`p`,{...n,children:Q_(t,r)})},blockquote:function({node:e,children:t,...n}){let r=Dx[String(n[`data-alert`]??``)];return r?(0,U.jsxs)(`div`,{role:`note`,className:B(`my-1 border-l-2 pl-3`,r.borderClassName),children:[(0,U.jsxs)(`p`,{"data-thread-find-ignore":`true`,className:B(`flex items-center gap-1.5 font-medium`,r.titleClassName),children:[(0,U.jsx)(r.Icon,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),r.label]}),t]}):(0,U.jsx)(`blockquote`,{...n,children:t})},ol:function({node:e,start:t,style:n,...r}){let i=Ex(e?.children?.filter(e=>e.type===`element`&&e.tagName===`li`).length??0,t);return(0,U.jsx)(`ol`,{...r,start:t,style:i?{...n,...i}:n})},li:function({node:e,children:t,...n}){let{skills:r}=(0,V.use)(US),i=(0,V.use)(WS),a=e?.position?.start.offset,o=typeof a==`number`?Tx(i,a):null;return(0,U.jsx)(`li`,{...n,"data-task-marker-offset":o??void 0,children:Q_(t,r)})},input:function({node:e,type:t,checked:n,disabled:r,...i}){let{onTaskListChange:a}=(0,V.use)(US);return t!==`checkbox`||!a?(0,U.jsx)(`input`,{...i,type:t,checked:n,disabled:r,readOnly:t===`checkbox`}):(0,U.jsx)(`input`,{...i,type:`checkbox`,name:`markdown-task`,"aria-label":`Toggle task`,checked:n,onChange:e=>{let t=Number(e.currentTarget.closest(`li`)?.dataset.taskMarkerOffset);Number.isSafeInteger(t)&&a({markerOffset:t,checked:e.currentTarget.checked})}})},a:function({node:e,href:t,children:n,title:r,...i}){let{canOperateHost:a,canOperatePreview:o,cwd:s,environmentId:c,imageBaseDir:l,markdownFileLinkMetaByHref:u,threadRef:f,openMarkdownMedia:p,openChangeRequestLink:m,openDeferredMarkdownLink:h,linkTargetPreference:g,openExternalLinkInPreview:_,projects:v,linkedThreadPullRequestFor:y,resolveThreadPullRequest:b,serverConfig:x,updateThreadPullRequestLink:S,fileLinkChip:C,renderContextReference:w}=(0,V.use)(US),T=(0,V.use)(WS),E=t?Dr(t):null;if(E)return(0,U.jsx)(W_,{citation:E});let D=t?um(t):null;if(D){let t=SS(e),n=t&&um(t)===null?t:null;return c?(0,U.jsx)(q_,{environmentId:c,link:D,label:n}):(0,U.jsx)(`span`,{children:n??`Thread`})}let O=t?d(t):null;if(O){let t=SS(e)||O.contextId;return w?w({...O,label:t}):(0,U.jsx)(`span`,{children:t})}let k=t?Qx(t):``,A=k?u.get(k)??qb(k,s,l??s):null;if(!A){let r=da(t),s=CS(e),l=String(i[`data-pull-request-autolink`]??``),u=l===`commit`?/\/commit\/([0-9a-f]{40})$/iu.exec(t??``)?.[1]:l===`reference`?xS(e):void 0,d=u!==void 0,C=l===`reference`,w=C&&t?gt(t):t,T=w?qr({environmentId:c,projects:v,pullRequestsEnabled:x?.environment.capabilities.pullRequests===!0,url:w}):null,E=t?.startsWith(`#`)??!1,D=i.onClick,O=o&&!!(f&&gr(f.environmentId)),k=(0,U.jsx)(dS,{value:!0,children:n}),A=(0,U.jsx)(`a`,{...i,className:B(i.className,l===`commit`&&`font-mono`),"data-markdown-copy":u,"data-markdown-image-link":!s||void 0,href:t,target:E?void 0:`_blank`,rel:E?void 0:`noopener noreferrer`,onClick:e=>{D?.(e),E&&t?OS(e,t):t&&r!==null&&wt(t)!==null&&!e.defaultPrevented&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey?(e.preventDefault(),e.stopPropagation(),p(t,void 0,e.target instanceof HTMLImageElement?e.target:e.currentTarget.querySelector(`img`))):t&&!m(e,t,void 0,c??void 0)&&(e.defaultPrevented||(ai({url:t,event:e,preference:g,canOpenInApp:O})===`app`?(e.preventDefault(),e.stopPropagation(),_(t).then(e=>{e._tag===`Success`||_t(e)||(Cx({operation:`open-link-in-preview`,target:t},e.cause),!(ht(e)instanceof yr)&&Qt()?.shell.openExternal(t))})):Zn&&e.altKey&&(e.preventDefault(),e.stopPropagation(),Qt()?.shell.openExternal(t).catch(e=>Cx({operation:`open-link-external`,target:t},e)))))},onContextMenu:e=>{if(!t||!r)return;e.preventDefault(),e.stopPropagation();let n=Qt();if(!n)return;let i=a?y(t)===null?b(t)===null?void 0:`link-to-thread`:`unlink-from-thread`:void 0;fa({href:t,canOpenInPreview:O,threadLinkAction:i,position:{x:e.clientX,y:e.clientY},showContextMenu:(e,t)=>n.contextMenu.show(e,t),openInPreview:async e=>{let t=await _(e);t._tag===`Failure`&&!_t(t)&&Cx({operation:`open-link-in-preview`,target:e},t.cause)},openExternal:e=>n.shell.openExternal(e),copyLink:e=>Zt(e,`link`),updateThreadLink:S,reportFailure:(e,n)=>{Cx({operation:e,target:t},n),(e===`link-pull-request-to-thread`||e===`unlink-pull-request-from-thread`)&&Xt.add(bn({type:`error`,title:e===`link-pull-request-to-thread`?`Unable to link pull request`:`Unable to unlink pull request`,description:n instanceof Error?n.message:`The request failed.`}))}})},children:r&&s&&!d?(0,U.jsx)(PS,{host:r,plainText:xS(e),children:k}):k});return!r||!t?A:T===null?(0,U.jsxs)(er,{children:[(0,U.jsx)(Qn,{render:A}),(0,U.jsx)($n,{side:`top`,children:t})]}):(0,U.jsx)(x_,{link:A,originalUrl:t,target:T,confirmBeforeOpen:C,onOpenPullRequest:e=>m({metaKey:!1,ctrlKey:!1,preventDefault:()=>void 0,stopPropagation:()=>void 0},e,void 0,c??void 0),onOpenFallback:h})}let j=Px(n),M=e?.position?.start.offset,N=e?.position?.end.offset,P=M!==void 0&&N!==void 0?T.slice(M,N):``,F=P.startsWith(`[`)&&P.includes(`](`)?P:`[${(j||A.basename).replace(/[\\[\]]/g,`\\$&`)}](${k})`,ee=C(A,F,k);return Wn(j,k)?ee:(0,U.jsxs)(`span`,{"data-markdown-copy":F,children:[(0,U.jsxs)(`span`,{className:`whitespace-normal`,children:[n,` `]}),ee]})},code:function({node:e,children:t,className:n,...r}){let{cwd:i,imageBaseDir:a,inlineCodeFileLinkMetaByText:o,fileLinkChip:s,mathEnabled:c,inline:l}=(0,V.use)(US),u=c?Qr(n):null;if(u)return(0,U.jsx)(nv,{tex:Px(t),display:u===`display`,focusable:!l});if(e?.properties?.dataInlineCode!=null){let e=Px(t),c=o.get(e.trim())??Gb(e,i,a??i);return c?s(c,`\`${e}\``,Hn(e)??e.trim()):(0,U.jsx)(`code`,{...r,className:n,onDoubleClick:KS,children:t})}return(0,U.jsx)(`code`,{...r,className:n,children:t})},img:function({node:e,title:t,src:n,alt:r,...i}){let{expandMedia:a,cwd:o,environmentId:s,githubMedia:c,imageBaseDir:l,threadRef:u,renderContextReference:f,resolvedTheme:p}=(0,V.use)(US),m=(0,V.use)(dS)?void 0:a,h=typeof n==`string`?d(n):null;if(h){let e=r||h.contextId;return f?f({...h,label:e}):(0,U.jsx)(`span`,{children:e})}let g=e?.properties?.[p===`dark`?`dataDarkSrc`:`dataLightSrc`],_=typeof g==`string`?void 0:e?.properties?.dataLocalSrc,v=e?.properties?.dataMarkdownTitle,y=e?.properties?.dataStandalone===!0,b=typeof g==`string`?g:typeof _==`string`?_:n,x=typeof v==`string`?v:t,S=typeof b==`string`?Kn(b):``,C=typeof _==`string`?S.replaceAll(`\\`,`/`):S,w=r??``,T=cS(w,S,x),{className:E,style:D,width:O,height:k,...A}=i,j=lS(O,k),M=qn(C,l??o),N=wt(C)??`image`,P=M._tag===`Direct`?M.uri:null,F=P===null?null:Qm(pa(P));if(c&&o!==void 0&&s!==null&&P!==null&&F!==null)return(0,U.jsx)(vS,{environmentId:s,resource:{_tag:`github-media`,cwd:o,url:F},alt:w,kind:N,copyMarkdown:T,standalone:y,className:E,style:j,imageProps:A,srcFragment:Jn(C),originalUrl:pa(P),framed:!1,fallbackSrc:F,onImageExpand:m});if(M._tag===`Direct`){let e=pa(M.uri),t=da(M.uri)===null?void 0:M.uri,n=Un(M.uri),r={kind:N,name:w||N,src:e,...n?{reference:n}:{}};return N===`video`?(0,U.jsx)(_S,{src:e,alt:w,copyMarkdown:T,originalUrl:t,style:j,actionsSource:r}):(0,U.jsx)(gS,{src:e,alt:w,copyMarkdown:T,standalone:y,className:E,style:j,imageProps:A,actionsSource:r,originalUrl:t,onImageExpand:m},e)}return M._tag===`WorkspaceFile`&&u?(0,U.jsx)(vS,{environmentId:u.environmentId,resource:{_tag:`media-file`,threadId:u.threadId,path:M.path},alt:w,kind:N,copyMarkdown:T,srcFragment:Jn(C),standalone:y,style:j,workspaceRoot:o,onImageExpand:m}):(0,U.jsx)(mS,{alt:w,copyMarkdown:T,kind:N})},table:function({node:e,...t}){return(0,U.jsx)(zx,{...t})},details:function({node:e,children:t,open:n}){return(0,U.jsx)(Bx,{open:n,children:t})},pre:function({node:e,children:t,...n}){let{resolvedTheme:r,diffThemeName:i,expandMedia:a,isStreaming:o,onRunShellCommand:s,inline:c,mathEnabled:l}=(0,V.use)(US),u=(0,V.use)(WS),d=Fx(t);if(!d)return(0,U.jsx)(`pre`,{...n,children:t});let f=Ox(d.className);if(l&&f===`math`&&(!o||Qr(d.className)===`display`||Nx(e,u)))return(0,U.jsx)(nv,{tex:d.code,display:!0,focusable:!c});let p=jx(Mx(e)),m=(0,U.jsx)(ei,{resetKeys:[d.code,f,i,o],fallback:(0,U.jsx)(`pre`,{...n,children:t}),children:(0,U.jsx)(V.Suspense,{fallback:(0,U.jsx)(`pre`,{...n,className:`invisible`,"aria-hidden":!0,children:t}),children:(0,U.jsx)(Yx,{className:d.className,code:d.code,themeName:i,isStreaming:o})})});return f===`mermaid`?(0,U.jsx)(qx,{code:d.code,fenceTitle:p,theme:r,isStreaming:o,onExpand:e=>a({images:[{src:e,name:`Mermaid diagram`}],index:0}),children:m}):(0,U.jsx)(Gx,{code:d.code,language:f,fenceTitle:p,theme:r,onRunShellCommand:s&&!o&&Nx(e,u)?s:void 0,isStreaming:o,children:m})}},JS=[Wr,{singleDollarTextMath:!0}],YS={plain:Em,breaks:Dm,math:[JS,...Em],mathBreaks:[JS,...Dm]},XS=new WeakMap;function ZS(e,t){if(t.length===0)return e;let n=XS.get(t);n||XS.set(t,n=new WeakMap);let r=n.get(e);return r||n.set(e,r=[...e,...t]),r}var QS=new WeakMap;function $S(e,t){let n=QS.get(e);n||QS.set(e,n=new WeakMap);let r=n.get(t);return r||(r=sx({remarkPlugins:e,rehypePlugins:t,components:qS,urlTransform:NS}),n.set(t,r)),r}var eC=(0,V.memo)(function(e){let t=(0,H.c)(12),{text:n,remarkPlugins:r,rehypePlugins:i,shared:a,cache:o}=e,s,c,l;if(t[0]!==o||t[1]!==i||t[2]!==r||t[3]!==a||t[4]!==n){let e=a?$S(r,i):sx({remarkPlugins:r,rehypePlugins:i,components:qS,urlTransform:NS});s=WS,c=n,l=e(n,a&&o),t[0]=o,t[1]=i,t[2]=r,t[3]=a,t[4]=n,t[5]=s,t[6]=c,t[7]=l}else s=t[5],c=t[6],l=t[7];let u;return t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,U.jsx)(s,{value:c,children:l}),t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u});function tC(e){let t=(0,H.c)(55),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({text:c,className:n,inline:i,lineBreaks:a,parseRawHtml:o,extraRemarkPlugins:s,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i!==void 0&&i,u=a!==void 0&&a,d=o===void 0||o,f=s===void 0?gx:s,p;t[8]!==l||t[9]!==r||t[10]!==c?(p={text:c,inline:l,...r},t[8]=l,t[9]=r,t[10]=c,t[11]=p):p=t[11];let{componentState:m,handleCopy:h,markdownRef:g,localMediaPreview:_,setLocalMediaPreview:v}=zS(p),y,b,x,S,C,w,T,E;if(t[12]!==n||t[13]!==m||t[14]!==f||t[15]!==h||t[16]!==l||t[17]!==u||t[18]!==g||t[19]!==d||t[20]!==r.isStreaming||t[21]!==r.onTaskListChange||t[22]!==c){let e=r.isStreaming===!0&&!l&&f.length===0&&!r.onTaskListChange?dx(c):null,i=r.isStreaming===!0&&e===null&&f.length===0&&/(?:^|\n) {0,3}(?:`{3}|~{3})/.test(c),a=l?`span`:`div`,o;t[31]===g?o=t[32]:(o=e=>{g.current=e},t[31]=g,t[32]=o);let s=o,p=YS[m.mathEnabled?u?`mathBreaks`:`math`:u?`breaks`:`plain`],_=i,v;t[33]!==f||t[34]!==i||t[35]!==p?(v=i?[...p,...f,nh()]:ZS(p,f),t[33]=f,t[34]=i,t[35]=p,t[36]=v):v=t[36];let D=v,O=e??[c];b=a,T=s;let k=!l&&`text-sm leading-relaxed text-foreground/[calc(80%+var(--appearance-contrast-boost)/5)]`;t[37]!==n||t[38]!==k?(E=B(`chat-markdown w-full min-w-0 [overflow-wrap:anywhere] [word-break:break-word]`,k,n),t[37]=n,t[38]=k,t[39]=E):E=t[39],x=m.isStreaming?``:void 0,S=h,y=US,C=m,w=O.map((e,t)=>(0,U.jsx)(eC,{text:e,remarkPlugins:D,rehypePlugins:d?jS:MS,shared:!_,cache:!r.isStreaming||t<O.length-1},t)),t[12]=n,t[13]=m,t[14]=f,t[15]=h,t[16]=l,t[17]=u,t[18]=g,t[19]=d,t[20]=r.isStreaming,t[21]=r.onTaskListChange,t[22]=c,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=w,t[29]=T,t[30]=E}else y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],w=t[28],T=t[29],E=t[30];let D;t[40]!==y||t[41]!==C||t[42]!==w?(D=(0,U.jsx)(y,{value:C,children:w}),t[40]=y,t[41]=C,t[42]=w,t[43]=D):D=t[43];let O;t[44]!==_||t[45]!==v?(O=_?(0,U.jsx)(Nv,{preview:_,onClose:()=>v(null)}):null,t[44]=_,t[45]=v,t[46]=O):O=t[46];let k;return t[47]!==b||t[48]!==x||t[49]!==S||t[50]!==D||t[51]!==O||t[52]!==T||t[53]!==E?(k=(0,U.jsxs)(b,{ref:T,className:E,"data-streaming":x,onCopy:S,children:[D,O]}),t[47]=b,t[48]=x,t[49]=S,t[50]=D,t[51]=O,t[52]=T,t[53]=E,t[54]=k):k=t[54],k}var nC=(0,V.memo)(tC);export{Yi as $,Xg as A,zm as B,w_ as C,E_ as D,C_ as E,Gm as F,Oa as G,rm as H,Wm as I,ua as J,Ea as K,Nm as L,jg as M,Wh as N,j_ as O,Qm as P,ia as Q,Em as R,T_ as S,O_ as T,Lo as U,mm as V,Da as W,na as X,aa as Y,Qi as Z,ev as _,zv as a,U_ as b,Nv as c,pv as d,Vi as et,lv as f,cv as g,uv as h,Vb as i,Ii as it,Gg as j,Yg as k,bv as l,sv as m,nC as n,Fi as nt,Lv as o,ov as p,Ta as q,Ux as r,Li as rt,Rv as s,vS as t,zi as tt,Ev as u,J_ as v,k_ as w,F_ as x,W_ as y,Dm as z};
49
- //# sourceMappingURL=ChatMarkdown-_SLyl8Hk.js.map
49
+ //# sourceMappingURL=ChatMarkdown-Ck4FJs_Q.js.map