@openchamber/web 2.6.0 → 2.6.1-canary.20261102.3

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 (107) hide show
  1. package/dist/assets/{AboutDialog-DBDN-gwQ.js → AboutDialog-BTYnMXM0.js} +1 -1
  2. package/dist/assets/{AboutLogo-BP87552a.js → AboutLogo-BwyB9sbV.js} +1 -1
  3. package/dist/assets/{ArchiveView-GN7gU2qK.js → ArchiveView-BsWIv-C4.js} +1 -1
  4. package/dist/assets/{ChangeRequestDiffUnavailable-B28oeUds.js → ChangeRequestDiffUnavailable-ED92kmXz.js} +1 -1
  5. package/dist/assets/{ChangedPathLabel-DV4XTf6K.js → ChangedPathLabel-7Zbbq-FE.js} +1 -1
  6. package/dist/assets/{CommandPalette-Dvsy8IHV.js → CommandPalette-CLlDfj5e.js} +1 -1
  7. package/dist/assets/{DiffView-BXm5iGeW.js → DiffView-CQOHl1hv.js} +1 -1
  8. package/dist/assets/{FilesView-CAXuJLle.js → FilesView-D00Dnc8i.js} +1 -1
  9. package/dist/assets/{GitView-D29soKpK.js → GitView-Z4zWCBn1.js} +1 -1
  10. package/dist/assets/{GuestSurfacePane-Dw0Um8RG.js → GuestSurfacePane-OM2GGOiX.js} +1 -1
  11. package/dist/assets/{HelpDialog-DuO4UnZT.js → HelpDialog-DNqqtAW-.js} +1 -1
  12. package/dist/assets/{IntegrationsCatalogView-BrLbP8hQ.js → IntegrationsCatalogView-C4-oLIEz.js} +1 -1
  13. package/dist/assets/{JsonTreeView-ZZKmvRSL.js → JsonTreeView-Bw8E9Koo.js} +1 -1
  14. package/dist/assets/{MarkdownDiffPreview-DuH8ODuS.js → MarkdownDiffPreview-CaG-F6-b.js} +1 -1
  15. package/dist/assets/{MarkdownRendererImpl-DNGYmQPH.js → MarkdownRendererImpl-Cd3zotqp.js} +3 -3
  16. package/dist/assets/{MemoryDebugPanel-C7shSvtT.js → MemoryDebugPanel-DzMnnl_P.js} +1 -1
  17. package/dist/assets/{NoteEditor-Ba3KW2rV.js → NoteEditor-DWNlP4dC.js} +1 -1
  18. package/dist/assets/{OnboardingScreen-CIyOLCq2.js → OnboardingScreen-DZVhaQUC.js} +1 -1
  19. package/dist/assets/{OpenCodeStatusDialog-ByN8gJ51.js → OpenCodeStatusDialog-BgseXyBy.js} +1 -1
  20. package/dist/assets/{OverviewView-B6SMyBTp.js → OverviewView-CohMMobq.js} +1 -1
  21. package/dist/assets/{PatchDiff-C8jKkgEf.js → PatchDiff-DGB_PTLK.js} +1 -1
  22. package/dist/assets/{PlanView-NMKJpsCH.js → PlanView-pwTIoUJK.js} +1 -1
  23. package/dist/assets/{ProjectActionsDialog-Ctr7-_lb.js → ProjectActionsDialog-C3rXp1WV.js} +1 -1
  24. package/dist/assets/{ReplyUiBlock-C-C95eJ_.js → ReplyUiBlock-B1NgzCEP.js} +1 -1
  25. package/dist/assets/{RunOverview-DNSvGB7-.js → RunOverview-BqmEhK3a.js} +1 -1
  26. package/dist/assets/{ScheduledTasksDialog-BNXOjpPY.js → ScheduledTasksDialog-CXyiyIDe.js} +1 -1
  27. package/dist/assets/{SettingsView-ug8Oinyr.js → SettingsView-D7mytSZv.js} +1 -1
  28. package/dist/assets/{SettingsWindow-CKUU5T8p.js → SettingsWindow-CnjurTti.js} +1 -1
  29. package/dist/assets/{SidebarSectionsManager-DWJwQwVi.js → SidebarSectionsManager-D1hsBI-4.js} +1 -1
  30. package/dist/assets/{SourceBoardView-BQittQF3.js → SourceBoardView-BoMdMgmW.js} +1 -1
  31. package/dist/assets/{SpaceAccessDialog-CeZrOBod.js → SpaceAccessDialog-q5blJXG5.js} +1 -1
  32. package/dist/assets/{SpaceApplyDialog-DurN0_0Z.js → SpaceApplyDialog-Csq1Z7zY.js} +1 -1
  33. package/dist/assets/{SpaceRow-BkgNrW0R.js → SpaceRow-BvJCw88e.js} +1 -1
  34. package/dist/assets/{SpaceSetupOutput-BDkJcYrl.js → SpaceSetupOutput-Bzeasxqg.js} +1 -1
  35. package/dist/assets/{SpacesView-D6UCwVZp.js → SpacesView-DNI1yLAG.js} +1 -1
  36. package/dist/assets/{SubmoduleDiffSummary-BK5RTTC4.js → SubmoduleDiffSummary-B3CnCMwZ.js} +1 -1
  37. package/dist/assets/{ToolOutputDialog-CAenoFSA.js → ToolOutputDialog-inRAtLLn.js} +1 -1
  38. package/dist/assets/{ToolPartDiffPreview-CdjYwDyA.js → ToolPartDiffPreview-CJneViW_.js} +1 -1
  39. package/dist/assets/{UiBlock-t2ea_iLd.js → UiBlock-ChJiwt5R.js} +1 -1
  40. package/dist/assets/{UsageStatsView-D2AXngeb.js → UsageStatsView-CWV-BYPI.js} +1 -1
  41. package/dist/assets/{Virtualizer-V759EvEY.js → Virtualizer-BOHERqLh.js} +1 -1
  42. package/dist/assets/{WalkthroughView-CiQk4Tg_.js → WalkthroughView-BnT4-pMh.js} +1 -1
  43. package/dist/assets/{WorktreesView-Bmnk7eXM.js → WorktreesView-D_VUAXdo.js} +1 -1
  44. package/dist/assets/{appThemeRegistry-D4EuLaGF.js → appThemeRegistry-BBiQjAje.js} +1 -1
  45. package/dist/assets/{ar-9I6l4EAU.js → ar-BXROvDU9.js} +1 -1
  46. package/dist/assets/{codeHighlight-DD239VMc.js → codeHighlight-CJBps6zM.js} +1 -1
  47. package/dist/assets/{computeVirtualFileMetrics-BhVDZ-oP.js → computeVirtualFileMetrics-CXGHe7T5.js} +2 -2
  48. package/dist/assets/{contextFileOpenGuard-D9Z0ay-I.js → contextFileOpenGuard-Cp662aS-.js} +1 -1
  49. package/dist/assets/{date-time-DlgUVVwY.js → date-time-C4F_nWqa.js} +1 -1
  50. package/dist/assets/{de-CPlTX8kA.js → de-nCDq_bQg.js} +1 -1
  51. package/dist/assets/{es-BMaNboo9.js → es-CvZecQ0j.js} +1 -1
  52. package/dist/assets/{fileContentPoller-paKtimZt.js → fileContentPoller-D0GhYhQ3.js} +1 -1
  53. package/dist/assets/{flexokiTheme-Bv37aHkq.js → flexokiTheme-Df4MxCkn.js} +1 -1
  54. package/dist/assets/{fr-onOdSl19.js → fr-DzrngSh8.js} +1 -1
  55. package/dist/assets/{he-CgCCGzpX.js → he-uZ2JD0ys.js} +1 -1
  56. package/dist/assets/{highlights-ByNnuo4t.js → highlights-gD3Zrhb_.js} +1 -1
  57. package/dist/assets/{index-BKnb59RH.js → index-BNAoU1SB.js} +1 -1
  58. package/dist/assets/{initializeSharedPreferences-CFrNmgg0.js → initializeSharedPreferences-Cb-QZ9nO.js} +1 -1
  59. package/dist/assets/{install-EEjacdUD.js → install-BjzS6Z-p.js} +1 -1
  60. package/dist/assets/{isDiffPlainText-DUd8YJX0.js → isDiffPlainText-SBv5bM8c.js} +1 -1
  61. package/dist/assets/{isFilePlainText-BqR4iT-Y.js → isFilePlainText-QNmxHtqN.js} +1 -1
  62. package/dist/assets/{ja-CYYy1_I8.js → ja-CADF0HeI.js} +1 -1
  63. package/dist/assets/{katex.min-BBVkbKQY.js → katex.min-BCtkGOiC.js} +4 -4
  64. package/dist/assets/{ko-CupS3Elm.js → ko-BLGJMTce.js} +1 -1
  65. package/dist/assets/{main-B3MbWk_e.js → main-BAWvOAbS.js} +2 -2
  66. package/dist/assets/{main-Kwo8IqqZ.js → main-my1cVcab.js} +4 -4
  67. package/dist/assets/{miniChat-DelNi_yP.js → miniChat-C80tea9b.js} +2 -2
  68. package/dist/assets/{mobile-BIso4MdY.js → mobile-Bw86MtWV.js} +2 -2
  69. package/dist/assets/{nl-Di3GhSHB.js → nl-ClP-S61w.js} +1 -1
  70. package/dist/assets/{pageTitle-BL2yQcTV.js → pageTitle-Cph9nb1O.js} +1 -1
  71. package/dist/assets/{parseDiffFromFile-31PZ3lnE.js → parseDiffFromFile-Yp9eHLcj.js} +1 -1
  72. package/dist/assets/{pierreDiffTint-igvBfgMB.js → pierreDiffTint-CFyG2F44.js} +1 -1
  73. package/dist/assets/{pl-DEy-fwio.js → pl-LChBHlUo.js} +1 -1
  74. package/dist/assets/{pt-BR-Cqzgn2Hs.js → pt-BR-CV84EAxr.js} +1 -1
  75. package/dist/assets/{relocateRestoredSession-CGvQdGRX.js → relocateRestoredSession-gkROUapx.js} +2 -2
  76. package/dist/assets/{renderElectronMiniChatApp-hBJHkIHQ.js → renderElectronMiniChatApp-CJN6HCUs.js} +2 -2
  77. package/dist/assets/{renderMarkdownForExport-DWj11Yob.js → renderMarkdownForExport-BPMLtJlQ.js} +1 -1
  78. package/dist/assets/{renderMobileApp-Bzps4LvM.js → renderMobileApp-Cuc-A8vm.js} +3 -3
  79. package/dist/assets/{resolveLanguages-DHAaVkki.js → resolveLanguages-UhQ_Qm0O.js} +1 -1
  80. package/dist/assets/{runtimeEndpointReset-BPYbd6uu.js → runtimeEndpointReset-CMO7G_Ff.js} +5 -5
  81. package/dist/assets/{scheduledTasksApi-D6FhT0TU.js → scheduledTasksApi-Mn2aZ7Rl.js} +1 -1
  82. package/dist/assets/{shiki-y7boL955.js → shiki-B7QfMAec.js} +1 -1
  83. package/dist/assets/{space-apply-9idN6j4k.js → space-apply-CNISDYMA.js} +1 -1
  84. package/dist/assets/{space-close-CjDS5mSo.js → space-close-C4pr8Kt0.js} +1 -1
  85. package/dist/assets/{spaceNetwork-DeZE7V6c.js → spaceNetwork-DUg5u0h8.js} +1 -1
  86. package/dist/assets/{stream-tokenizer-UaU7yP0V.js → stream-tokenizer-CSMIYyXj.js} +1 -1
  87. package/dist/assets/{textMateThemeFromAppTheme-fsNcE7v2.js → textMateThemeFromAppTheme-CbTfkuJp.js} +1 -1
  88. package/dist/assets/{tr-DL0uHNVd.js → tr-BXliZ8MC.js} +1 -1
  89. package/dist/assets/{uk-qdUsCGYW.js → uk-CxABjNd2.js} +1 -1
  90. package/dist/assets/{useAppFontEffects-DpDiWkkc.js → useAppFontEffects-C_TEX3sk.js} +16 -16
  91. package/dist/assets/{useBranchPullRequestRequest-Cbky4ZeH.js → useBranchPullRequestRequest-CLTracub.js} +1 -1
  92. package/dist/assets/{useCallableModelProviders-Y8rZzgJF.js → useCallableModelProviders-CcETbnHf.js} +1 -1
  93. package/dist/assets/{useDiffFindSurface-B7KQR8iQ.js → useDiffFindSurface-BY6KBx38.js} +1 -1
  94. package/dist/assets/{useGitCleanLine-D6E5eJm2.js → useGitCleanLine-KstI02a0.js} +1 -1
  95. package/dist/assets/{useInlineCommentController-CF8aQO6-.js → useInlineCommentController-ByiCLJwx.js} +1 -1
  96. package/dist/assets/{useMarkdownLocalAssets-BXBlTj-y.js → useMarkdownLocalAssets-DG5IJM9Y.js} +1 -1
  97. package/dist/assets/{useRootScrollLock-3qp1KaTm.js → useRootScrollLock-ClFa_ezf.js} +2 -2
  98. package/dist/assets/{useWalkthroughReview-BNHJ06yD.js → useWalkthroughReview-BjhHwuOR.js} +1 -1
  99. package/dist/assets/{useWholeFileComment-CisbVgb0.js → useWholeFileComment-Dbr3Y7Ga.js} +1 -1
  100. package/dist/assets/{useWorktreeArchiveActions-03WxbHUV.js → useWorktreeArchiveActions-jkcvj4mj.js} +1 -1
  101. package/dist/assets/{vendor-codemirror-language-data-C6MZftZF.js → vendor-codemirror-language-data-Cy549AYN.js} +2 -2
  102. package/dist/assets/{zh-CN-B3B6hhd4.js → zh-CN-Cj8b8iKH.js} +1 -1
  103. package/dist/assets/{zh-TW-CBU98qnu.js → zh-TW-CyjD8MXO.js} +1 -1
  104. package/dist/index.html +2 -2
  105. package/dist/mini-chat.html +2 -2
  106. package/dist/mobile.html +2 -2
  107. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownDiffPreview-DuH8ODuS.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/useAppFontEffects-DpDiWkkc.js","assets/katex.min-BBVkbKQY.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod-Csf1sqWl.js","assets/vendor-opencode-client-CqFY51gT.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/vendor-streamdown-BbSYZ3NF.js","assets/vendor-markdown-BTUqNk6W.js","assets/vendor-mdast-util-from-markdown-CZHjOE75.js","assets/vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js","assets/vendor-micromark-util-decode-string-fHsnqYdj.js","assets/vendor-decode-named-character-reference-C3-224fz.js","assets/vendor-micromark-util-normalize-identifier-C9ANKk3v.js","assets/vendor-micromark-AWM-NZXP.js","assets/vendor-micromark-util-combine-extensions-d8XJZrgA.js","assets/vendor-micromark-util-chunked-DrRIdSP-.js","assets/vendor-micromark-factory-space-PzSHLgmq.js","assets/vendor-micromark-util-character-CW3Cu1MS.js","assets/vendor-micromark-core-commonmark-kzTLNXAm.js","assets/vendor-micromark-util-classify-character-tcLuZZwM.js","assets/vendor-micromark-util-resolve-all-PQCKh0dx.js","assets/vendor-micromark-util-subtokenize-BF1Jf29a.js","assets/vendor-micromark-factory-destination-Sj0xfi0V.js","assets/vendor-micromark-factory-label-amyP0HdC.js","assets/vendor-micromark-factory-title-khnLkZK6.js","assets/vendor-micromark-factory-whitespace-eIB00uTl.js","assets/vendor-micromark-util-html-tag-name-DbKNfynz.js","assets/vendor-unist-util-stringify-position-Ch_qCilz.js","assets/vendor-mdast-util-to-string-C_aolqmU.js","assets/vendor-unist-util-visit-DhPeCsfG.js","assets/vendor-unist-util-visit-parents-DlviEg7Z.js","assets/vendor-unist-util-is-BPZGFiMU.js","assets/vendor-hast-util-raw-DvvLJg15.js","assets/vendor-ungap-structured-clone--gfxRhYI.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-parse5-DwmzEj2o.js","assets/vendor-entities-wUUgTZDW.js","assets/vendor-web-namespaces-bsVAaBS1.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-unist-util-position-60F3QETU.js","assets/vendor-hast-util-from-parse5-Ba3T6RJI.js","assets/vendor-devlop-0Dp3JUBc.js","assets/vendor-property-information-Boo8Xpef.js","assets/vendor-hastscript-BrPNioaz.js","assets/vendor-comma-separated-tokens-CRUGqg4f.js","assets/vendor-space-separated-tokens-D7QSIrTI.js","assets/vendor-hast-util-parse-selector-TXfch5wI.js","assets/vendor-vfile-location-LfEFwJ2h.js","assets/vendor-hast-util-to-parse5-BoysVIPW.js","assets/vendor-hast-util-sanitize-2aGO5ay8.js","assets/vendor-micromark-extension-gfm-CsfPlnlB.js","assets/vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js","assets/vendor-micromark-extension-gfm-footnote-OFl1FCH2.js","assets/vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js","assets/vendor-micromark-extension-gfm-table-dgw4LfUw.js","assets/vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js","assets/vendor-mdast-util-gfm-CroMDYLM.js","assets/vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-mdast-util-find-and-replace-DB9iC-bx.js","assets/vendor-escape-string-regexp-BaJN9MlJ.js","assets/vendor-mdast-util-gfm-footnote-C-csI7OF.js","assets/vendor-mdast-util-gfm-strikethrough-BcskTdio.js","assets/vendor-mdast-util-gfm-table-DhPwQIyj.js","assets/vendor-markdown-table-DvhhVmnL.js","assets/vendor-mdast-util-to-markdown-Cl3qaiyc.js","assets/vendor-longest-streak-CtXnX3Xp.js","assets/vendor-mdast-util-phrasing-4oVbNLC3.js","assets/vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js","assets/vendor-mdast-util-to-hast-CWnLaQSO.js","assets/vendor-micromark-util-sanitize-uri-BbwQ7CLk.js","assets/vendor-trim-lines-D8znQY54.js","assets/vendor-micromark-extension-cjk-friendly-BzZDGrF5.js","assets/vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js","assets/vendor-get-east-asian-width-CPhS2cOv.js","assets/vendor-micromark-util-symbol-JJPacVTp.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js","assets/vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js","assets/vendor-hast-util-from-html-isomorphic-B0Kn01s9.js","assets/vendor-hast-util-from-dom-DeNf9aYW.js","assets/vendor-katex-DBqql0K7.js","assets/vendor-hast-util-to-text-0GXLnBvt.js","assets/vendor-hast-util-is-element-CuOmiqQi.js","assets/vendor-unist-util-find-after-CMaZmLxc.js","assets/vendor-micromark-extension-math-BRFoDziv.js","assets/vendor-mdast-util-math-wB-IJCL0.js","assets/vendor-remend-r8cP_t-e.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-marked-DN3zOnEe.js","assets/vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js","assets/vendor-style-to-js-CI2G4dgu.js","assets/vendor-style-to-object-BAv4SQXc.js","assets/vendor-inline-style-parser-BlqBsVO4.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-estree-util-is-identifier-name-BgBfM8ME.js","assets/vendor-vfile-message-DqhD22jI.js","assets/vendor-unified-1CQKw2_w.js","assets/vendor-bail-FqpXQuLt.js","assets/vendor-extend-B94qxKr5.js","assets/vendor-is-plain-obj-C1gvLhAf.js","assets/vendor-trough-B_b8ryxu.js","assets/vendor-vfile-BCWrK60u.js","assets/vendor-html-url-attributes-D46m5wfe.js","assets/vendor-capacitor-core-B4EWRrHz.js","assets/katex-arxpHWv8.css","assets/vendor-base-ui-zhBy6TEG.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-floating-ui-react-dom-Cy8dRGoy.js","assets/vendor-use-sync-external-store-CfLJGVyr.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-dnd-kit-core-Br1Cs7RV.js","assets/vendor-dnd-kit-utilities-DZ9KbT5S.js","assets/vendor-dnd-kit-accessibility-CYclfhtC.js","assets/vendor-dnd-kit-sortable-DpfLEOLv.js","assets/vendor-tanstack-react-virtual-C_IilPt1.js","assets/vendor-tanstack-virtual-core-DsQgKrou.js","assets/vendor-framer-motion-C_wK4GIM.js","assets/vendor-motion-dom-HXPOMxb7.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-codemirror-commands-CjjsURR-.js","assets/vendor-codemirror-state-Cd8udR5z.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-Ciie9ey-.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-codemirror-language-8HZTPOnt.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CZEcqU6G.js","assets/vendor-codemirror-streamparser-CmlTsbN2.js","assets/vendor-codemirror-lang-javascript-DmqaSK_j.js","assets/vendor-lezer-javascript-CWSwshuO.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BGedy2gC.js","assets/vendor-codemirror-lang-json-DVAYKmoO.js","assets/vendor-lezer-json-Cn1mncjr.js","assets/vendor-codemirror-lang-css-BLpgXfL2.js","assets/vendor-lezer-css-B2Hx_Nps.js","assets/vendor-codemirror-lang-html-S3jxr3Mo.js","assets/vendor-lezer-html-Cr8K5DGw.js","assets/vendor-codemirror-lang-markdown-D1jveRI5.js","assets/vendor-lezer-markdown-TQKzBB8i.js","assets/vendor-codemirror-language-data-C6MZftZF.js","assets/vendor-codemirror-lang-python-B-5UC9Ui.js","assets/vendor-lezer-python-BUoImtUb.js","assets/vendor-sonner-Dw26OnzC.js","assets/vendor-cmdk-BtSpU-Io.js","assets/vendor-radix-ui-react-dialog-OIW6VLWw.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D4RvEbuR.js","assets/vendor-radix-ui-react-context-BbFoxCHu.js","assets/vendor-radix-ui-react-id-aGag8i_5.js","assets/vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js","assets/vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js","assets/vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js","assets/vendor-radix-ui-react-primitive-CrN9dRDb.js","assets/vendor-radix-ui-react-slot-BjbalUfz.js","assets/vendor-radix-ui-react-use-callback-ref-CcC_buIU.js","assets/vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js","assets/vendor-radix-ui-react-focus-scope-D1noLHmd.js","assets/vendor-radix-ui-react-portal-BlUEzfrF.js","assets/vendor-radix-ui-react-presence-BGqFfiW4.js","assets/vendor-radix-ui-react-focus-guards-CSS2IbZC.js","assets/vendor-react-remove-scroll-Der_cv-1.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-Clwl9llp.js","assets/vendor-react-style-singleton-D_xJlTqU.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-BdLl6ZIw.js","assets/vendor-use-callback-ref-CXJF1lEr.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-legendapp-list-DAdshx9l.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/ToolPartDiffPreview-CdjYwDyA.js","assets/PatchDiff-C8jKkgEf.js","assets/parseDiffFromFile-31PZ3lnE.js","assets/computeVirtualFileMetrics-BhVDZ-oP.js","assets/themeResolver-4dbEkEN5.js","assets/vendor-pierre-theming-D_TRfu0q.js","assets/hastToHtml-BHV14OWE.js","assets/vendor-hast-util-to-html-Jw3IXh58.js","assets/vendor-stringify-entities-CsH1VEn9.js","assets/vendor-character-entities-legacy-BpoLgcEt.js","assets/vendor-character-entities-html4-D7taRCQ7.js","assets/vendor-diff-C3JhlQdm.js","assets/useNextRenderData-CVFf78p9.js","assets/isDiffPlainText-DUd8YJX0.js","assets/getFiletypeFromFileName-BgI9McTw.js","assets/pierreDiffTint-igvBfgMB.js","assets/appThemeRegistry-D4EuLaGF.js","assets/textMateThemeFromAppTheme-fsNcE7v2.js","assets/diffsHighlighter-BsxkaI3Q.js"])))=>i.map(i=>d[i]);
2
- import{R as k,f as W,j as p,a as Bn}from"./vendor-react--VO_rL_p.js";import{hb as nn,hc as Kn,hd as mt,he as Vn,hf as Hn,hg as qn,hh as Xn,hi as Zn,hj as Gn,fY as rn,hk as Yn,hl as Jn,hm as Qn,hn as er,ho as tr,hp as Mt,hq as nr,u as Ne,hr as sn,Q as Qe,B as Ce,z as rr,I as he,hs as on,bg as sr,ht as an,hu as ir,hv as ln,A as or,hw as ar,hx as lr,hy as cr,hz as dr,hA as ur,hB as fr,hC as hr,hD as mr,hE as pr,hF as gr,hG as wr,hH as Ct,hI as yr,hJ as Et,hK as xr,e6 as br,hL as jt,hM as kr,hN as vr,hO as Sr,al as Mr,hP as Cr,hQ as Er,hR as jr,b0 as st,a2 as Rt,a3 as Nt,a4 as Pt,a5 as _t,n as Rr,cI as De,hS as Nr,U as Pr,hT as At,hU as _r,hV as Ar,hW as Ie,hX as Ir,hY as Lr,hZ as Tr,h_ as $r,h$ as Fr,aJ as cn,aj as Or,ak as Dr,cu as zr,i0 as Wr,i1 as Ur,i2 as Br,i3 as Kr,ag as Vr}from"./useAppFontEffects-DpDiWkkc.js";import{o as It,X as et,j as Hr,w as Be,D as qr,I as Xr,k as Zr,W as Gr,L as dn,U as Yr}from"./vendor-streamdown-BbSYZ3NF.js";import{aG as fe,aX as Ee,l as je,aV as ct,j as pt,aI as un,bR as Jr,bS as Qr,aM as es,bT as ts,u as ce,bg as ns,bU as rs}from"./katex.min-BBVkbKQY.js";import{B as tt}from"./vendor-streamdown-cjk-CeadmtR2.js";import{g as ss}from"./vendor-streamdown-math-SFa9Faw2.js";import{s as fn,o as is,d as os}from"./vendor-zod-Csf1sqWl.js";import{a as as}from"./vendor-markdown-BTUqNk6W.js";import{i as ls,r as cs,o as ds,M as hn,b as us,B as Lt,a as Tt,c as fs}from"./useMarkdownLocalAssets-BXBlTj-y.js";import{_ as mn}from"./vendor-vite-runtime-DD1OZmLC.js";import{r as hs,a as ms}from"./vendor-beautiful-mermaid-Tpx-v0Sg.js";import{b as pn}from"./vendor-shiki-BBVtYVEV.js";import{a as ps}from"./textMateThemeFromAppTheme-fsNcE7v2.js";import{p as gs,i as ws,a as dt,b as ys,s as gn}from"./vendor-yaml-CE-D_49-.js";const wn=["note","tip","important","warning","caution"],yn=n=>wn.find(e=>e===n)??null,xs=/^\[!(note|tip|important|warning|caution)\][\t ]*(?:\r?\n|$)/i;function bs(n){const e=n.children[0];if(e?.type!=="paragraph")return;const t=e.children[0];if(t?.type!=="text")return;const r=xs.exec(t.value),s=yn(r?.[1].toLowerCase());if(!r||!s)return;t.value=t.value.slice(r[0].length),t.value||e.children.shift(),e.children[0]?.type==="break"&&e.children.shift(),e.children.length===0&&n.children.shift(),n.data={...n.data,hProperties:{...n.data?.hProperties,dataOcAlert:s}}}function ks(){return n=>{const e=t=>{if(t.type==="blockquote"&&bs(t),"children"in t)for(const r of t.children)e(r)};e(n)}}function vs(n){return n.type==="root"}const Ss=/^ {0,3}<details(?:\s+(open(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?))?\s*>\s*<summary\s*>([\s\S]*?)<\/summary\s*>/i;function He(n,e,t){const r=e.slice(0,t).split(/\r\n|\r|\n/),s=r.length-1,i=r[r.length-1].length;function a(o){if(o.position)for(const l of[o.position.start,o.position.end])l&&(l.line===1&&(l.column+=i),l.line+=s,l.offset!==void 0&&(l.offset+=t));if("children"in o)for(const l of o.children)a(l)}a(n)}const Ms=/^(\s*<h([1-6])(?:\s+[^\s"'<>/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'<>=]+))?)*\s*>)([\s\S]*?)<\/h\2\s*>\s*$/i,Cs=[1,2,3,4,5,6];function Es(n,e){const t=/(^ {0,3}(`{3,}|~{3,})[^\n]*(?:\n|$))|(`+)|(<\/?details\b[^>]*>)/gim;t.lastIndex=e;let r=1,s;for(;s=t.exec(n);)if(s[2]){const i=s[2],a=new RegExp(`^ {0,3}${i[0]}{${i.length},}[\\t ]*(?:\\r?\\n|$)`,"gm");if(a.lastIndex=t.lastIndex,!a.exec(n))break;t.lastIndex=a.lastIndex}else if(s[3]){const i=/`+/g;i.lastIndex=t.lastIndex;let a;for(;a=i.exec(n);)if(a[0].length===s[3].length){t.lastIndex=i.lastIndex;break}}else if(s[4]){const i=n.lastIndexOf(`
3
- `,s.index-1)+1,a=n.slice(i,s.index);if(/^(?: {4}|\t| {0,3}>)/.test(a)||/(?:^|[^\\])(?:\\\\)*\\$/.test(a))continue;if(r+=/^<\//.test(s[4])?-1:1,r===0)return{bodyEnd:s.index,end:t.lastIndex}}return{bodyEnd:n.length,end:n.length}}function js(){const n=t=>{const r=this.parse(t);if(!vs(r))throw new Error("Disclosure parsing requires a Markdown root");return t.startsWith("\uFEFF")&&He(r,t,1),r},e=(t,r)=>{if(!("children"in t))return;const s=t.children;if(t.type==="blockquote"){const i=t.position?.start?.offset,a=t.position?.end?.offset;if(i===void 0||a===void 0)return;const o=[];let l="",c=i;for(const h of r.slice(i,a).split(new RegExp("(?<=\\n)"))){const u=/^ {0,3}> ?/.exec(h)?.[0].length??0;for(let m=u;m<h.length;m++)o.push(c+m),l+=h[m];c+=h.length}o.push(a);const d=n(l);e(d,l);const f=h=>{if(h.position)for(const u of[h.position.start,h.position.end]){if(!u||u.offset===void 0)continue;u.offset=o[u.offset]??a;const m=r.slice(0,u.offset).split(/\r\n|\r|\n/);u.line=m.length,u.column=m[m.length-1].length+1}if("children"in h)for(const u of h.children)f(u)};f(d),s.splice(0,s.length,...d.children);return}for(let i=0;i<s.length;i++){const a=s[i];if(a.type!=="html"){e(a,r);continue}const o=a.position?.start?.offset;if(o===void 0)continue;const l=Ss.exec(r.slice(o));if(!l)continue;const c=o+l[0].length,{bodyEnd:d,end:f}=Es(r,c),h=r.slice(c,d),u=n(h);e(u,h),He(u,r,c);const m=/<summary\s*>/i.exec(l[0]),g=o+(m?.index??0)+(m?.[0].length??0),w=l[2]??"",y=Ms.exec(w),x=y?y[3]:w,S=n(x);He(S,r,g+(y?.[1].length??0));const v=S.children[0],C=v?.type==="paragraph"?v.children:[{type:"text",value:x}],M=Cs.find(I=>String(I)===y?.[2]),b={type:"ocDisclosureSummary",data:{hName:"summary"},children:M?[{type:"heading",depth:M,children:C}]:C},E={type:"ocDisclosure",data:{hName:"details",hProperties:l[1]?{open:!0}:{}},children:[b,...u.children]};let _=1,P=a.position?.end?.offset??f;for(;i+_<s.length;){const I=s[i+_];if((I.position?.start?.offset??r.length)>=f)break;P=I.position?.end?.offset??f,_++}const N=n(r.slice(f,P));He(N,r,f);const R=N.children;s.splice(i,_,E,...R)}};return(t,r)=>e(t,r.toString())}const Rs=function(n,e,t){const r=this.previous===null||this.previous<-2;let s=!1,i=!1;function a(u){return n.enter("ocMath"),n.enter("ocMathMarker"),n.consume(u),o}function o(u){return u!==40&&u!==91||(s=u===91,s&&!r)?t(u):(n.consume(u),n.exit("ocMathMarker"),n.enter("ocMathValue"),l)}function l(u){return u===null?t(u):u===92?n.check(d,f,c)(u):c(u)}function c(u){return i=!0,u!==null&&u<=-3?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),l):(n.consume(u),l)}const d={tokenize(u,m,g){return w;function w(S){return u.consume(S),y}function y(S){return!i||S!==(s?93:41)?g(S):(u.consume(S),s?x:m)}function x(S){return S===32||S===9?(u.consume(S),x):S===null||S<0?m(S):g(S)}}};function f(u){return n.exit("ocMathValue"),n.enter("ocMathMarker"),n.consume(u),h}function h(u){return n.consume(u),n.exit("ocMathMarker"),n.exit("ocMath"),e}return a},Ns=function(n,e,t){const r=this.previous,s=this.parser.constructs.text[60];let i="";return a;function a(d){return r!==null&&r>=48&&r<=57?t(d):(n.enter("ocMath"),n.consume(d),o)}function o(d){return d===null||d<0||d===34?t(d):d===60&&s?n.check(s,t,l)(d):d===40&&i.endsWith("]")||!i&&/\s/.test(String.fromCharCode(d))?t(d):d===36?!i||/^\s|\s$/.test(i)||/^[\d.,\s]+$/.test(i)||/^\d[\d.,]*(?:[;:]|\s+(?:and|to)\b)/.test(i)?t(d):(n.consume(d),c):l(d)}function l(d){return d===null?t(d):(i+=String.fromCharCode(d),n.consume(d),o)}function c(d){return d!==null&&d>=48&&d<=57?t(d):(n.exit("ocMath"),e(d))}},Ps={enter:{ocMath(n){const e=this.sliceSerialize(n).startsWith("\\[");this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math",e?"math-display":"math-inline"]},hChildren:[]}},n)}},exit:{ocMath(n){const e=this.sliceSerialize(n),t=e.startsWith("$")?1:2,r=e.slice(t,-t),s=this.stack[this.stack.length-1];s.type==="inlineMath"&&(s.value=r,s.data&&(s.data.hChildren=[{type:"text",value:r}])),this.exit(n)}}};function _s(n,e){const t=n.position?.start?.offset,r=n.position?.end?.offset;if(t===void 0||r===void 0)return!0;const s=e.slice(t,r);return!s.startsWith("$")||s.startsWith("$$")?!0:!/^[\d.,\s]+$/.test(n.value)&&!/^\s|\s$/.test(n.value)&&!/\d/.test(e.slice(r,r+1))}function As(){const n=this.data();return(n.micromarkExtensions??=[]).push({text:{92:{name:"ocMath",tokenize:Rs},36:{name:"ocDollarMath",tokenize:Ns}}}),(n.fromMarkdownExtensions??=[]).push(Ps),(e,t)=>{const r=t.toString();function s(i){if(!("children"in i))return;const a=i.children;if(i.type==="link"){const o=a.map(l=>l.type==="inlineMath"||l.type==="math"?r.slice(l.position?.start?.offset,l.position?.end?.offset):l.type==="text"?l.value:"").join("");if(o===i.url){i.children=[{type:"text",value:o}];return}}for(let o=0;o<a.length;o++){const l=a[o];if(l.type==="inlineMath"||l.type==="math"){const c=l.position?.start?.offset,d=l.position?.end?.offset;_s(l,r)?l.type==="inlineMath"&&r.slice(c,d).startsWith("$$")&&(l.data??={},l.data.hProperties={className:["language-math","math-display"]}):a.splice(o,1,{type:"text",value:r.slice(c,d)})}else s(l)}}s(e)}}const Is=new Set(["align","alt","checked","colSpan","controls","disabled","height","href","media","open","playsInline","preload","rel","rowSpan","src","srcSet","start","target","title","type","width"]),We=fn();function nt(n){try{const e=new URL(n);return e.protocol==="file:"&&(!e.hostname||e.hostname==="localhost")}catch{return!1}}function ut(n){return/\s/.test(n)||/^[\s\\]*[/\\]{2}/.test(n)||n.includes("\\")?!1:/^https?:\/\//i.test(n)||!/^[a-z][a-z\d+.-]*:/i.test(n)}function Ls(n,e){return n!==n.trim()||/\s/.test(n)?!1:ut(n)||nt(n)||nn(n)||/^(?:mailto|tel|sms|callto|cid|xmpp|irc|ircs|news|nntp|feed|webcal):/i.test(n)||!e&&Kn(n)}function Ts({isVSCode:n}){return(e,t)=>{const r=t.toString();function s(i){const a=[];for(const o of i.children){if(o.type==="doctype")continue;if(o.type!=="element"){a.push(o);continue}if(["script","style","iframe","object","embed","svg","math","form"].includes(o.tagName))continue;const l=o.position?.start?.offset,c=l!==void 0&&r[l]==="<";if(!(o.tagName==="input"&&o.properties.type!=="checkbox")){for(const d of Object.keys(o.properties)){const h=c&&d==="className"&&o.tagName==="code"&&Array.isArray(o.properties.className)&&o.properties.className.every(u=>/^language-[\w#+.-]+$/.test(String(u)))||!c&&(d==="className"&&["code","li","ul","ol","section","h2","a"].includes(o.tagName)||d==="metastring"&&o.tagName==="code"||["id","ariaDescribedBy","ariaLabel","dataFootnoteRef","dataFootnoteBackref","dataFootnotes"].includes(d)||d==="dataOcAlert"&&o.tagName==="blockquote"||d==="dataOcReference"&&o.tagName==="a");!Is.has(d)&&!h&&delete o.properties[d]}if(o.properties.href!==void 0){const d=We.safeParse(o.properties.href);d.success&&Ls(d.data,n)?o.properties.dataOcLinkSource=d.data:delete o.properties.href}if(o.tagName==="a"&&(o.properties.href="#oc-link"),o.properties.src!==void 0){const d=We.safeParse(o.properties.src);if(d.success){const f=d.data,h=o.tagName==="img"&&/^data:image\/(?:png|jpeg|gif|webp);base64,(?:[a-z\d+/]{4})*(?:[a-z\d+/]{2}==|[a-z\d+/]{3}=)?$/i.test(f);f===f.trim()&&(ut(f)||nt(f)||h)?(o.properties.dataOcMediaSource=f,nt(f)&&delete o.properties.src):delete o.properties.src}else delete o.properties.src}if(o.tagName==="img"&&(o.properties.src="/__oc_markdown_media__"),o.properties.srcSet!==void 0){const d=We.safeParse(o.properties.srcSet);d.success&&d.data.split(",").every(h=>{const[u,m,...g]=h.trim().split(/\s+/);return!!u&&ut(u)&&g.length===0&&(!m||/^(?:\d+w|\d+(?:\.\d+)?x)$/.test(m))})||delete o.properties.srcSet}for(const d of["width","height"])o.properties[d]!==void 0&&!/^\d+(?:\.\d+)?%?$/.test(String(o.properties[d]))&&delete o.properties[d];o.tagName==="video"&&(o.properties.controls=!0,o.properties.playsInline=!0,o.properties.preload="none"),s(o),a.push(o)}}i.children=a}s(e)}}function $s(){return n=>{function e(t){for(const r of t.children)if(r.type==="element"){if(r.tagName==="a"){const s=We.safeParse(r.properties.dataOcLinkSource);s.success?r.properties.href=s.data:delete r.properties.href,delete r.properties.dataOcLinkSource}if(r.tagName==="img"){const s=We.safeParse(r.properties.dataOcMediaSource);s.success&&!nt(s.data)&&!/^data:/i.test(s.data)?r.properties.src=s.data:delete r.properties.src}e(r)}}e(n)}}const xn={singleTilde:!1},Fs=et.gfm,Os=[[Fs[0],xn],...Object.values(et).filter(n=>n!==et.gfm)],Ds=tt.remarkPluginsAfter.at(-1),zs={...tt,remarkPluginsAfter:[...tt.remarkPluginsAfter.slice(0,-1),[Ds,xn]]};function Ws(n=!1){return n?tt:zs}const $t=ss({singleDollarTextMath:!1}),Us={...$t,remarkPlugin:function(){return this.use([$t.remarkPlugin]),As.call(this)}},Bs={tagNames:["a","abbr","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","mark","ol","p","picture","pre","q","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var","video"],strip:["script","style","iframe","object","embed","svg","math","form"],attributes:{"*":["align","alt","checked","colSpan","height","media","open","rowSpan","start","title","width"],a:["href","id","ariaDescribedBy","ariaLabel","dataFootnoteRef","dataFootnoteBackref","dataOcLinkSource","dataOcReference"],code:[["className",/^language-[\w#+.:-]+$/,"math-inline","math-display"],"metastring"],img:["src","srcSet","alt","dataOcMediaSource"],source:["src","srcSet","type","media","dataOcMediaSource"],video:["src","controls","playsInline","preload","dataOcMediaSource"],input:["type","checked","disabled"],li:[["className","task-list-item"]],ul:[["className","contains-task-list"]],ol:[["className","contains-task-list"]],section:["dataFootnotes",["className","footnotes"]],h2:["id",["className","sr-only"]],blockquote:[["dataOcAlert",...wn]]},protocols:{src:["http","https"]},clobberPrefix:"",required:{input:{type:"checkbox",disabled:!0}}};function Ks(){return n=>{function e(t){if(!("children"in t)||t.type==="link"||t.type==="linkReference")return;const r=t.children;for(let s=0;s<r.length;s++){const i=r[s];if(i.type!=="text"){e(i);continue}const a=Array.from(i.value.matchAll(/\bopenchamber:\/\/session\/[A-Za-z0-9_-]{1,128}(?:\?message=[A-Za-z0-9_-]{1,128})?/g));if(a.length===0)continue;const o=[];let l=0;for(const c of a)c.index>l&&o.push({type:"text",value:i.value.slice(l,c.index)}),o.push({type:"link",url:c[0],children:[{type:"text",value:c[0]}]}),l=c.index+c[0].length;l<i.value.length&&o.push({type:"text",value:i.value.slice(l)}),r.splice(s,1,...o),s+=o.length-1}}e(n)}}function Vs(){return(n,e)=>{const t=String(e.value).replace(/^\uFEFF/,"");n.children=n.children.filter(r=>{const s=r.position?.start.offset,i=r.position?.end.offset;return s===void 0||i===void 0||!mt(t.slice(s,i))})}}function qe(n,e,t){return{remarkPlugins:[...t?Object.values(et):Os,js,ks,Vs,Ks],rehypePlugins:[...n?[It.raw]:[],[Ts,{isVSCode:e}],[as,Bs],It.harden,$s]}}const Hs=[!1,!0].flatMap(n=>[qe(!1,!1,n),qe(!1,!0,n),qe(!0,!1,n),qe(!0,!0,n)]);function qs(n,e,t=!1){return Hs[(t?4:0)+(n?2:0)+(e?1:0)]}const Xs=new Set(["inlineCode","code","html","math","inlineMath"]);function Zs(n){return e=>{const t=r=>{if(!Xs.has(r.type)){if(r.type==="text"){r.value=Vn(r.value,n);return}if("children"in r)for(const s of r.children)t(s)}};t(e)}}const Gs=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Ys=n=>{const{issuePrefix:e,changeRequestPrefix:t}=n.descriptor.terminology,r=[...new Set([e,t])].sort((s,i)=>i.length-s.length).map(Gs).join("|");return new RegExp([String.raw`(?<![\w/#!@&.-])(?<project>[\w.-]+(?:/[\w.-]+)+)?(?<prefix>${r})(?<number>\d+)(?![\w-])`,String.raw`(?<![\w@./+-])@(?<user>[A-Za-z0-9](?:[A-Za-z0-9_.-]*[A-Za-z0-9_])?)(?![\w@/-])`,String.raw`(?<![\w/@#.-])(?<sha>[0-9a-f]{7,40})(?![\w/-])`].join("|"),"g")},Js=(n,e,t)=>{const{issuePrefix:r,changeRequestPrefix:s}=n.descriptor.terminology;if(e.number&&e.prefix){const i=e.prefix===r?"issue":e.prefix===s?"pull":null,a=Number(e.number);if(!i||!Number.isSafeInteger(a)||a<1||e.project&&!n.descriptor.repository.nestedNamespaces&&e.project.split("/").length>2)return null;const o=Hn(n,i,a,e.project?qn(e.project):n);return o?{url:o,children:[{type:"text",value:t}]}:null}if(e.user){const i=Xn(n,e.user);return i?{url:i,children:[{type:"text",value:t}]}:null}if(e.sha&&/\d/.test(e.sha)&&/[a-f]/.test(e.sha)){const i=Zn(n,e.sha);return i?{url:i,children:[{type:"inlineCode",value:e.sha.slice(0,7)}]}:null}return null},Qs=n=>{let e=0;for(const t of n.matchAll(/<(\/?)(a|code)\b[^>]*?(\/?)>/gi))t[3]||(e+=t[1]?-1:1);return e},ei=new Set(["link","linkReference","inlineCode","code","html","definition","math","inlineMath"]);function ti(n){const e=Ys(n),t=r=>{const s=[];let i=0;for(const a of r.matchAll(e)){const o=a.groups?Js(n,a.groups,a[0]):null;if(!o)continue;a.index>i&&s.push({type:"text",value:r.slice(i,a.index)});const l={type:"link",url:o.url,children:o.children,data:{hProperties:{dataOcReference:""}}};s.push(l),i=a.index+a[0].length}return s.length===0?null:(i<r.length&&s.push({type:"text",value:r.slice(i)}),s)};return r=>{const s=i=>{if(ei.has(i.type)||!("children"in i))return;const a=i.children;let o=0;for(let l=0;l<a.length;l++){const c=a[l];if(c.type==="html"){o=Math.max(0,o+Qs(c.value));continue}if(o>0)continue;if(c.type!=="text"){s(c);continue}const d=t(c.value);d&&(a.splice(l,1,...d),l+=d.length-1)}};s(r)}}const Xe=new Map;class ni{constructor(e){this.options=e}controller=new AbortController;disposed=!1;sources=new Map;batch;refreshing;documentUrls=new Map;runtimeKey=fe();resolver=Ee();connect(){!this.disposed&&this.controller.signal.aborted&&(this.controller=new AbortController)}register(e){return this.sources.set(e,(this.sources.get(e)??0)+1),()=>{const t=(this.sources.get(e)??1)-1;t?this.sources.set(e,t):this.sources.delete(e)}}check(e){if(e.aborted||this.disposed||this.runtimeKey!==fe()||this.resolver!==Ee())throw new DOMException("Media owner changed","AbortError")}async resolve(e,t=!1,r=!1){const s=this.controller.signal;this.check(s);const{mode:i,directory:a,sessionId:o,messageId:l,documentAssets:c}=this.options;if(i==="assistant"&&(await Promise.resolve(),this.check(s),![...this.sources.keys()].slice(0,12).includes(e)))throw new Error("Message media limit");if(/^(?:https?:)?\/\//i.test(e)){if(i!=="document"&&!t)throw new Error("Remote chat image");return e}if(/^data:/i.test(e))return Gn(e,s);if(i==="document"){if(!c)return e;if(!ls(e))throw new Error("Document source is unavailable");const u=cs(c.filePath,e),m=c.workspaceRoot,g={path:u,directory:m||void 0,allowOutsideWorkspace:m&&rn(u,m)?void 0:"true"};if(t){if(je())throw new Error("Video bridge is unavailable");return await ct(),this.check(s),Ee().authenticatedAsset("/api/fs/raw",g)}const w=this.documentUrls.get(u);if(w)return w;const y=(async()=>{const x=await pt("/api/fs/raw",{query:g,signal:AbortSignal.any([s,AbortSignal.timeout(3e4)])});if(!x.ok)throw new Error(`Image read failed (${x.status})`);const S=await x.blob();if(S.size>25*1024*1024)throw new Error("Image too large for preview");return this.check(s),URL.createObjectURL(S)})();return this.documentUrls.set(u,y),y}if(i==="local")return e;if(je()){if(t)throw new Error("Video bridge is unavailable");const u=await Yn(e,a,s);return this.check(s),u}if(!o||!l)throw new Error("Missing media owner");await Promise.resolve(),this.check(s);const f=[...this.sources.keys()].slice(0,12);if(!f.includes(e))throw new Error("Message media limit");if(!this.batch||r){if(r&&this.refreshing)this.batch=this.refreshing;else if(this.batch=Jn({sources:f.filter(Mt),directory:a,sessionId:o,messageId:l,signal:s}),r){const u=this.batch;this.refreshing=u,u.finally(()=>{this.refreshing===u&&(this.refreshing=void 0)}).catch(()=>{})}}const h=(await this.batch).get(e);if(this.check(s),h?.status!=="ready")throw new Error("Image is unavailable");if(!t&&Qn()){const u=await er(h,a,s);return this.check(s),u}return await ct(),this.check(s),tr(h,a)}async load(e){const t=this.controller.signal,{mode:r,directory:s,sessionId:i,messageId:a}=this.options;if(r==="assistant"&&!je()&&Mt(e)){if(!i||!a)throw new Error("Missing media owner");return nr({source:e,directory:s,sessionId:i,messageId:a,signal:t})}const o=await this.resolve(e);if(!/^(?:data|blob):/i.test(o))throw new Error("Image cannot be saved");return(await fetch(o,{signal:t})).blob()}addGallery(e){const t=`${this.runtimeKey}\0${this.options.sessionId??""}\0${this.options.messageId??""}`;let r=Xe.get(t);return r||(r=new Set,Xe.set(t,r)),r.add(e),()=>{r.delete(e),r.size||Xe.delete(t)}}async openGallery(e,t){const r=this.controller.signal;this.check(r);const s=`${this.runtimeKey}\0${this.options.sessionId??""}\0${this.options.messageId??""}`,i=[...Xe.get(s)??[]].filter(d=>d.element.isConnected).sort((d,f)=>d.element.compareDocumentPosition(f.element)&4?-1:1),a=await Promise.allSettled(i.map(d=>d.resolve()));this.check(r);const o=i.flatMap((d,f)=>{const h=a[f];return h?.status==="fulfilled"?[{url:h.value,filename:d.filename,element:d.element,load:d.load}]:[]}),l=o.findIndex(d=>d.element===e),c=o[l];c&&t({open:!0,title:c.filename,content:"",metadata:{tool:"markdown-image-preview",filename:c.filename},image:{url:c.url,filename:c.filename,load:c.load,gallery:o.map(({url:d,filename:f,load:h})=>({url:d,filename:f,load:h})),index:l}})}disconnect(){this.controller.abort();for(const e of this.documentUrls.values())e.then(t=>URL.revokeObjectURL(t),()=>{});this.documentUrls.clear(),this.batch=void 0,this.refreshing=void 0}dispose(){this.disposed=!0,this.disconnect()}}const bn=k.createContext(null),Fe=k.createContext(!1),me=()=>k.useContext(bn);function ri(n){const e=W.c(23),{content:t,mode:r,sessionId:s,messageId:i,directory:a,settled:o,documentAssets:l,onShowPopup:c,children:d}=n,[f,h]=k.useReducer(si,0);let u,m;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>un(()=>h()),m=[],e[0]=u,e[1]=m):(u=e[0],m=e[1]),k.useEffect(u,m);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=fe(),e[2]=g):g=e[2];const w=g;let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=Ee(),e[3]=y):y=e[3];const x=y,S=l?.filePath,v=l?.workspaceRoot;let C;e[4]!==a||e[5]!==S||e[6]!==i||e[7]!==r||e[8]!==s||e[9]!==v?(C=new ni({mode:r,directory:a,sessionId:s,messageId:i,documentAssets:S?{filePath:S,workspaceRoot:v??null}:void 0}),e[4]=a,e[5]=S,e[6]=i,e[7]=r,e[8]=s,e[9]=v,e[10]=C):C=e[10];const M=C;let b,E;e[11]!==M?(b=()=>{if(w!==fe()||x!==Ee()){M.dispose(),h();return}M.connect();const R=Jr(()=>M.dispose());return()=>{R(),M.disconnect()}},E=[M,x,w],e[11]=M,e[12]=b,e[13]=E):(b=e[12],E=e[13]),k.useLayoutEffect(b,E);let _;e[14]!==l||e[15]!==r||e[16]!==c||e[17]!==M||e[18]!==o?(_={owner:M,mode:r,settled:o,documentAssets:l,onShowPopup:c},e[14]=l,e[15]=r,e[16]=c,e[17]=M,e[18]=o,e[19]=_):_=e[19];const P=_;let N;return e[20]!==d||e[21]!==P?(N=p.jsx(bn.Provider,{value:P,children:d}),e[20]=d,e[21]=P,e[22]=N):N=e[22],N}function si(n){return n+1}const gt=k.createContext(null);function de(){const n=k.useContext(gt);if(!n)throw new Error("Markdown components require MarkdownContent");return n}const ii=/\.(?:mp4|m4v|mov|webm)$/i,oi=/^https:\/\/github\.com\/user-attachments\/assets\/[\w-]+$/i,kn=n=>/[?&]oc_(?:url|client)_token=/i.test(n),ye=n=>kn(n)?"":n,Oe=(n,e="")=>{if(/^data:/i.test(n))return e.trim()||`image.${/^data:image\/([^;,]+)/i.exec(n)?.[1]?.replace("jpeg","jpg")??"png"}`;const t=n.split(/[?#]/,1)[0]?.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??e;try{return decodeURIComponent(t)}catch{return t}},ai=n=>{const t=(n.split(/[?#]/,1)[0]?.replace(/\\/g,"/")??"").split("/").filter(Boolean).at(-1)??"";try{return decodeURIComponent(t)}catch{return t}},Ft=n=>ii.test(n.trim()),vn=(n,e="")=>Ft(e)||Ft(ai(n)),Sn=n=>/^https?:\/\//i.test(n)&&(oi.test(n)||vn(n)),wt=n=>/^(?:https?:)?\/\//i.test(n),Mn=n=>n==="streamdown:incomplete-image",Cn=(n,e)=>n["data-oc-media-source"]??e??"",En=k.createContext(null),li=n=>{const e=n.ownerDocument.defaultView;for(let t=n.parentElement;t&&e;t=t.parentElement)if(t.scrollHeight>t.clientHeight&&/auto|scroll/.test(e.getComputedStyle(t).overflowY))return t;return null};function yt(n,e){const t=W.c(7),r=e===void 0?!1:e,s=k.useRef(null);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=u=>{s.current=u},t[0]=i):i=t[0];const a=i,[o,l]=k.useState(!1);let c,d;t[1]!==n||t[2]!==r?(c=()=>{if(!n||!s.current)return;const u=s.current.ownerDocument.defaultView?.IntersectionObserver;if(!u){l(!0);return}const m=new u(g=>{g.some(ci)&&(l(!0),m.disconnect())},r?{root:li(s.current),rootMargin:"100% 0px"}:{rootMargin:"200px"});return m.observe(s.current),()=>m.disconnect()},d=[n,r],t[1]=n,t[2]=r,t[3]=c,t[4]=d):(c=t[3],d=t[4]),k.useEffect(c,d);const f=!n||o;let h;return t[5]!==f?(h={ref:s,setRef:a,near:f},t[5]=f,t[6]=h):h=t[6],h}function ci(n){return n.isIntersecting}function di(n){const e=W.c(4);let t;e[0]!==n?(t=i=>{if(!n)return fi;const a=window.matchMedia(n);return a.addEventListener("change",i),()=>a.removeEventListener("change",i)},e[0]=n,e[1]=t):t=e[1];const r=t;let s;return e[2]!==n?(s=()=>!n||window.matchMedia(n).matches,e[2]=n,e[3]=s):s=e[3],k.useSyncExternalStore(r,s,ui)}function ui(){return!0}function fi(){}const xt=k.createContext(null);function Ke(n){const e=W.c(23),{source:t,name:r,title:s,linked:i,state:a}=n,{t:o}=Ne(),l=k.useContext(gt),c=me(),d=sn(l?.directory??c?.owner?.options.directory??"");let f;e[0]!==a||e[1]!==o||e[2]!==s?(f=a==="failed"?o("common.image.loadFailed"):s,e[0]=a,e[1]=o,e[2]=s,e[3]=f):f=e[3];let h;e[4]!==t?(h=ye(t),e[4]=t,e[5]=h):h=e[5];let u;e[6]!==a?(u=a==="loading"?p.jsx(rr,{className:"size-3.5","aria-hidden":!0}):p.jsx(he,{name:a==="failed"?"error-warning":"file-image",className:"size-3.5 shrink-0"}),e[6]=a,e[7]=u):u=e[7];let m;e[8]!==r||e[9]!==a||e[10]!==f||e[11]!==h||e[12]!==u?(m=p.jsxs("span",{title:f,"data-oc-media-source":h,"data-oc-media-label":"true","data-oc-media-state":a,className:"inline-flex items-center gap-1 align-text-bottom text-muted-foreground",children:[u,r]}),e[8]=r,e[9]=a,e[10]=f,e[11]=h,e[12]=u,e[13]=m):m=e[13];const g=m;if(!wt(t)||i||kn(t))return g;let w;e[14]!==d||e[15]!==l?.disableLinkSafety||e[16]!==l?.purpose||e[17]!==t?(w=x=>{l?.purpose||l?.disableLinkSafety||x.metaKey||x.ctrlKey||x.shiftKey||x.altKey||(x.preventDefault(),x.stopPropagation(),d(t))},e[14]=d,e[15]=l?.disableLinkSafety,e[16]=l?.purpose,e[17]=t,e[18]=w):w=e[18];let y;return e[19]!==g||e[20]!==t||e[21]!==w?(y=p.jsx("a",{href:t,className:"external-link",target:"_blank",rel:"noopener noreferrer",onClick:w,children:g}),e[19]=g,e[20]=t,e[21]=w,e[22]=y):y=e[22],y}function jn(n,e,t){const r=W.c(22),s=t===void 0?!1:t,i=me(),a=i?.owner,[o,l]=k.useState(null),[c,d]=k.useState(null);let f;r[0]!==i?.mode?(f=()=>{i?.mode==="document"&&l(hi)},r[0]=i?.mode,r[1]=f):f=r[1];const h=i?.mode;let u;r[2]!==h?(u=[h],r[2]=h,r[3]=u):u=r[3],k.useLayoutEffect(f,u);let m,g;r[4]!==e||r[5]!==a||r[6]!==n||r[7]!==s?(m=()=>{if(!a||!n||!e)return;const C=a.controller.signal;let M=!1;return a.resolve(n,s).then(b=>{!M&&!C.aborted&&(d(null),l({owner:a,signal:C,source:n,url:b}))},()=>{!M&&!C.aborted&&d({owner:a,signal:C,source:n,url:""})}),()=>{M=!0}},g=[a,n,e,s],r[4]=e,r[5]=a,r[6]=n,r[7]=s,r[8]=m,r[9]=g):(m=r[8],g=r[9]),k.useEffect(m,g);const w=c?.owner===a&&c?.source===n,y=o&&o.owner===a&&o.source===n&&(i?.mode!=="document"||!o.signal.aborted)&&!w?o.url:void 0;let x;r[10]!==a||r[11]!==n?(x=()=>{a&&d({owner:a,signal:a.controller.signal,source:n,url:""})},r[10]=a,r[11]=n,r[12]=x):x=r[12];let S;r[13]!==a||r[14]!==n||r[15]!==s?(S=async()=>{if(!a)throw new Error("Missing media owner");const C=a.controller.signal,M=await a.resolve(n,s,!0);C.aborted||(d(null),l({owner:a,signal:C,source:n,url:M}))},r[13]=a,r[14]=n,r[15]=s,r[16]=S):S=r[16];let v;return r[17]!==w||r[18]!==y||r[19]!==x||r[20]!==S?(v={url:y,failed:w,fail:x,retry:S},r[17]=w,r[18]=y,r[19]=x,r[20]=S,r[21]=v):v=r[21],v}function hi(n){return n?.signal.aborted?null:n}const mi=(n,e)=>{const t=e===void 0?"":String(e).trim(),r=n===void 0?"":String(n).trim();return/^\d+$/.test(t)?/^\d+$/.test(r)&&Number(t)>0?{aspectRatio:`${r}/${t}`}:{height:`${t}px`}:{}};function pi(n){const e=W.c(9),t=Cn(n,n.src),r=me(),s=k.useContext(Fe);if(Mn(t))return null;if(!s&&vn(t,n.alt??""))return p.jsx(bt,{src:t,title:n.title||n.alt,node:n.node});if(!t){let a;return e[0]!==r?.mode||e[1]!==n.alt||e[2]!==n.height||e[3]!==n.title||e[4]!==n.width?(a=r?.mode==="document"?p.jsx("img",{alt:n.alt,title:n.title,width:n.width,height:n.height}):null,e[0]=r?.mode,e[1]=n.alt,e[2]=n.height,e[3]=n.title,e[4]=n.width,e[5]=a):a=e[5],a}if(r?.mode!=="document"&&(wt(t)||s))return p.jsx(Ke,{source:t,name:Oe(t,n.alt),title:n.title,linked:s});let i;return e[6]!==n||e[7]!==t?(i=p.jsx(gi,{...n,source:t}),e[6]=n,e[7]=t,e[8]=i):i=e[8],i}function gi(n){const e=W.c(91);let t,r,s,i,a,o,l,c,d,f,h;if(e[0]!==n){const{source:Y,node:oe,src:xe,srcSet:Pe,alt:q,title:ue,className:pe,style:_e,width:be,height:ge,onLoad:we,onError:Ae,...Un}=n;o=Y,l=Pe,d=q,f=ue,t=pe,c=_e,h=be,r=ge,i=we,s=Ae,a=Un,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=o,e[7]=l,e[8]=c,e[9]=d,e[10]=f,e[11]=h}else t=e[1],r=e[2],s=e[3],i=e[4],a=e[5],o=e[6],l=e[7],c=e[8],d=e[9],f=e[10],h=e[11];const u=d===void 0?"":d,m=me(),g=k.useContext(Fe),w=k.useContext(En),y=w?.report,x=k.useId();let S;e[12]!==u||e[13]!==o?(S=Oe(o,u),e[12]=u,e[13]=o,e[14]=S):S=e[14];const v=S,C=m?.mode==="assistant",M=m?.mode==="document",b=k.useContext(xt),{ref:E,setRef:_,near:P}=yt(C||M&&b===null,M),N=b??P,R=m?.owner,I=C&&!!m?.onShowPopup&&!g;let O,B;e[15]!==R||e[16]!==o?(O=()=>R?.register(o),B=[R,o],e[15]=R,e[16]=o,e[17]=O,e[18]=B):(O=e[17],B=e[18]),k.useEffect(O,B);const Z=!!(m&&N&&(!C||m.settled)),{url:L,failed:F,fail:J}=jn(o,Z),z=Rn(l,Z),[$,Q]=k.useState(null),j=!!(L&&$?.url===L),D=$&&$.url===L?$.size:void 0;let G,H;e[19]!==j||e[20]!==x||e[21]!==y||e[22]!==D?(G=()=>(y?.(x,j&&D?D:null),()=>y?.(x,null)),H=[y,x,j,D],e[19]=j,e[20]=x,e[21]=y,e[22]=D,e[23]=G,e[24]=H):(G=e[23],H=e[24]),k.useEffect(G,H);let ee,U;e[25]!==j||e[26]!==I||e[27]!==v||e[28]!==R||e[29]!==E||e[30]!==o?(ee=()=>{const Y=E.current;if(!(!R||!j||!Y||!I))return R.addGallery({source:o,filename:v,element:Y,resolve:()=>R.resolve(o,!1,!0),load:()=>R.load(o)})},U=[R,j,o,v,E,I],e[25]=j,e[26]=I,e[27]=v,e[28]=R,e[29]=E,e[30]=o,e[31]=ee,e[32]=U):(ee=e[31],U=e[32]),k.useEffect(ee,U);let X;e[33]!==u||e[34]!==t||e[35]!==M||e[36]!==j||e[37]!==J||e[38]!==r||e[39]!==v||e[40]!==s||e[41]!==i||e[42]!==a||e[43]!==z||e[44]!==w?.ready||e[45]!==_||e[46]!==o||e[47]!==l||e[48]!==c||e[49]!==f||e[50]!==L||e[51]!==h?(X=L||M?p.jsx("img",{...a,ref:M?_:void 0,src:L,srcSet:z,alt:u||v,title:f,width:h,height:r,className:Qe(M?t:"block h-auto max-h-[30rem] w-auto max-w-full object-contain",M?!L&&"invisible":!j&&"hidden"),style:M?{...c,...mi(h,r)}:{...c,width:w?.ready?"100%":c?.width},"data-oc-media-source":ye(o),"data-oc-media-srcset":l,decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:Y=>{const oe=Y.currentTarget;L&&oe.naturalWidth&&oe.naturalHeight&&Q({url:L,size:{width:oe.naturalWidth,height:oe.naturalHeight}}),i?.(Y)},onError:Y=>{J(),s?.(Y)}}):null,e[33]=u,e[34]=t,e[35]=M,e[36]=j,e[37]=J,e[38]=r,e[39]=v,e[40]=s,e[41]=i,e[42]=a,e[43]=z,e[44]=w?.ready,e[45]=_,e[46]=o,e[47]=l,e[48]=c,e[49]=f,e[50]=L,e[51]=h,e[52]=X):X=e[52];const A=X,T=D?D.width/D.height:1;let K;e[53]!==T||e[54]!==w?.ready||e[55]!==D?(K=w?.ready&&D?{flex:`${T} 1 0px`,minWidth:`${8*T}rem`,maxWidth:`min(${D.width}px, ${30*T}rem)`,margin:0}:void 0,e[53]=T,e[54]=w?.ready,e[55]=D,e[56]=K):K=e[56];const te=K;if(M){let Y;return e[57]!==F||e[58]!==A||e[59]!==g||e[60]!==v||e[61]!==o||e[62]!==f?(Y=F?p.jsx(Ke,{source:o,name:v,title:f,linked:g,state:"failed"}):A,e[57]=F,e[58]=A,e[59]=g,e[60]=v,e[61]=o,e[62]=f,e[63]=Y):Y=e[63],Y}const V=j?"inline-block max-w-[min(100%,30rem)] align-top my-1 me-1":void 0;let re;e[64]!==o?(re=ye(o),e[64]=o,e[65]=re):re=e[65];let se;e[66]!==Z||e[67]!==j||e[68]!==F||e[69]!==g||e[70]!==v||e[71]!==o||e[72]!==f?(se=!j&&p.jsx(Ke,{source:o,name:v,title:f,linked:g,state:F?"failed":Z?"loading":void 0}),e[66]=Z,e[67]=j,e[68]=F,e[69]=g,e[70]=v,e[71]=o,e[72]=f,e[73]=se):se=e[73];const ae=L&&!I&&A;let le;e[74]!==m||e[75]!==j||e[76]!==I||e[77]!==A||e[78]!==v||e[79]!==R||e[80]!==E||e[81]!==L?(le=L&&I&&p.jsx(Ce,{variant:"ghost",className:Qe("block h-auto max-w-full overflow-hidden rounded-lg bg-muted/10 p-0 cursor-zoom-in",!j&&"hidden"),"aria-label":v,"data-oc-media-gallery":"true",onClick:()=>{const Y=E.current;Y&&m?.onShowPopup&&R?.openGallery(Y,m.onShowPopup).catch(wi)},children:A}),e[74]=m,e[75]=j,e[76]=I,e[77]=A,e[78]=v,e[79]=R,e[80]=E,e[81]=L,e[82]=le):le=e[82];let ie;return e[83]!==te||e[84]!==_||e[85]!==V||e[86]!==re||e[87]!==se||e[88]!==ae||e[89]!==le?(ie=p.jsxs("span",{ref:_,className:V,style:te,"data-oc-media-source":re,children:[se,ae,le]}),e[83]=te,e[84]=_,e[85]=V,e[86]=re,e[87]=se,e[88]=ae,e[89]=le,e[90]=ie):ie=e[90],ie}function wi(){}function Rn(n,e){const t=W.c(12),r=me(),s=r?.owner,[i,a]=k.useState(null);let o,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(bi)},l=[],t[0]=o,t[1]=l):(o=t[0],l=t[1]),k.useLayoutEffect(o,l);let c;t[2]!==e||t[3]!==r?.mode||t[4]!==s||t[5]!==n?(c=()=>{if(!n||!s||!e||r?.mode!=="document")return;const h=s.controller.signal;let u=!1;const m=n.split(",").flatMap(xi);return Promise.all(m.map(async g=>{const{source:w,descriptor:y}=g,x=await s.resolve(w);return y?`${x} ${y}`:x})).then(g=>{!u&&!h.aborted&&a({owner:s,signal:h,source:n,value:g.join(", ")})},yi),()=>{u=!0}},t[2]=e,t[3]=r?.mode,t[4]=s,t[5]=n,t[6]=c):c=t[6];const d=r?.mode;let f;return t[7]!==e||t[8]!==s||t[9]!==n||t[10]!==d?(f=[s,d,n,e],t[7]=e,t[8]=s,t[9]=n,t[10]=d,t[11]=f):f=t[11],k.useEffect(c,f),i&&i.owner===s&&!i.signal.aborted&&i.source===n?i.value:void 0}function yi(){}function xi(n){const[e,...t]=n.trim().split(/\s+/);return e?[{source:e,descriptor:t.join(" ")}]:[]}function bi(n){return n?.signal.aborted?null:n}function ki(n){const e=W.c(10);let t,r;if(e[0]!==n){const{node:d,children:f,...h}=n;t=f,r=h,e[0]=n,e[1]=t,e[2]=r}else t=e[1],r=e[2];const s=me()?.mode==="document",{setRef:i,near:a}=yt(s,!0),o=s?a:null;let l;e[3]!==t||e[4]!==o?(l=p.jsx(xt.Provider,{value:o,children:t}),e[3]=t,e[4]=o,e[5]=l):l=e[5];let c;return e[6]!==r||e[7]!==i||e[8]!==l?(c=p.jsx("picture",{...r,ref:i,children:l}),e[6]=r,e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function vi(n){const e=W.c(13);let t,r,s;if(e[0]!==n){const{node:u,srcSet:m,media:g,...w}=n;s=m,t=g,r=w,e[0]=n,e[1]=t,e[2]=r,e[3]=s}else t=e[1],r=e[2],s=e[3];const i=me(),a=k.useContext(xt),o=i?.documentAssets?.colorScheme;let l;e[4]!==t||e[5]!==o?(l=o?t?.replace(/\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)/gi,(u,m)=>m.toLowerCase()===o?"(min-width: 0px)":"(max-width: -1px)"):t,e[4]=t,e[5]=o,e[6]=l):l=e[6];const c=l,d=di(i?.mode==="document"?c:void 0),f=Rn(s,i?.mode==="document"&&a!==!1&&d);if(i?.mode!=="document")return null;let h;return e[7]!==t||e[8]!==r||e[9]!==f||e[10]!==s||e[11]!==c?(h=p.jsx("source",{...r,srcSet:f,media:c,"data-oc-media-srcset":s,"data-oc-media-query":t}),e[7]=t,e[8]=r,e[9]=f,e[10]=s,e[11]=c,e[12]=h):h=e[12],h}function bt(n){const e=Cn(n,n.src),t=me(),r=t?.owner,s=k.useContext(Fe),i=wt(e),{setRef:a,near:o}=yt(t?.mode==="assistant"&&!i);k.useEffect(()=>i?void 0:r?.register(e),[r,e,i]);const{url:l,fail:c,retry:d}=jn(e,!!(t&&!i&&!s&&(t.mode!=="assistant"||t.settled&&o)),!0),[f,h]=k.useState(null),u=f?.owner===r&&f?.source===e?f:null,m=k.useMemo(()=>({lastRetry:0,resume:null}),[r,e]),g=k.useRef(m);g.current=m;const w=k.useRef(null),y=n.title||Oe(e),x=i?u?.failed?void 0:u?.url??e:l,S=!!(x&&(i||t?.mode!=="assistant"||u?.ready===x));return!e||Mn(e)?null:s?p.jsx(Ke,{source:e,name:y,linked:!0}):p.jsxs("span",{ref:a,className:"inline-block max-w-full align-top","data-oc-media-source":ye(e),children:[!S&&p.jsx(Ke,{source:e,name:y,linked:!1}),x&&p.jsx("video",{ref:w,src:x,title:y,controls:!0,playsInline:!0,hidden:!S,preload:i&&t?.mode!=="document"?"none":"metadata",className:n.className,"data-oc-media-source":ye(e),onLoadedMetadata:v=>{h({owner:r,source:e,url:u?.url,ready:x});const C=m.resume;C&&(v.currentTarget.currentTime=C.time,C.playing&&v.currentTarget.play().catch(()=>{}),m.resume=null),n.onLoadedMetadata?.(v)},onError:v=>{if(i){const M=Ee(),b=new URL(e,window.location.href),E=new URL(M.api("/api/fs/raw"),window.location.href);if(!(b.origin===E.origin&&b.pathname===E.pathname&&b.searchParams.has("oc_url_token"))||Date.now()-m.lastRetry<1e4){h({owner:r,source:e,failed:!0});return}m.lastRetry=Date.now(),m.resume={time:v.currentTarget.currentTime,playing:!v.currentTarget.paused};const P=r?.controller.signal;b.searchParams.delete("oc_url_token"),ct().then(()=>{P?.aborted||g.current!==m||M!==Ee()||h({owner:r,source:e,url:M.authenticatedAsset("/api/fs/raw",b.searchParams)})},()=>{!P?.aborted&&g.current===m&&h({owner:r,source:e,failed:!0})});return}if(Date.now()-m.lastRetry<1e4){c();return}m.lastRetry=Date.now(),m.resume={time:v.currentTarget.currentTime,playing:!v.currentTarget.paused};const C=r?.controller.signal;d().then(()=>{!C?.aborted&&g.current===m&&w.current?.load()},()=>{!C?.aborted&&g.current===m&&c()})}})]})}function Si(n){const e=W.c(32);let t,r,s;e[0]!==n?({node:r,children:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=new Map,e[4]=i):i=e[4];const[a,o]=k.useState(i);let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=(N,R)=>{o(I=>{if(I.get(N)===R||!R&&!I.has(N))return I;const O=new Map(I);return R?O.set(N,R):O.delete(N),O})},e[5]=l):l=e[5];const c=l,d=r?.children.filter(ji),f=d?.length===1?d[0]:void 0,h=f?.type==="element"&&f.tagName==="a"?f.properties.href:void 0,u=f?.type==="element"&&f.children.length===1&&f.children[0]?.type==="text"?f.children[0].value:"",m=d?.length??0,g=m>1&&d?.every(Ei),w=me()?.mode,y=!!(w==="assistant"&&g&&a.size===m);let x;e[6]!==y?(x={report:c,ready:y},e[6]=y,e[7]=x):x=e[7];const S=x;if(w==="document"&&u&&u===h&&Sn(u)){let N;e[8]!==u?(N=p.jsx(bt,{src:u}),e[8]=u,e[9]=N):N=e[9];let R;return e[10]!==s||e[11]!==N?(R=p.jsx("p",{...s,"data-streamdown":"paragraph",children:N}),e[10]=s,e[11]=N,e[12]=R):R=e[12],R}let v,C;e[13]!==a?(v=[...a.values()],C=v.reduce(Ci,0),e[13]=a,e[14]=v,e[15]=C):(v=e[14],C=e[15]);const M=C;let b;if(e[16]!==m||e[17]!==v||e[18]!==s.style||e[19]!==M||e[20]!==y){if(b={...s.style},y){b.display="flex",b.flexWrap="wrap",b.alignItems="flex-start",b.gap="0.5rem";let N;e[22]!==v?(N=v.map(Mi),e[22]=v,e[23]=N):N=e[23],b.maxWidth=`calc(min(30rem, ${Math.min(...N)}px) * ${M} + ${(m-1)*.5}rem)`}e[16]=m,e[17]=v,e[18]=s.style,e[19]=M,e[20]=y,e[21]=b}else b=e[21];const E=y?"true":void 0;let _;e[24]!==t||e[25]!==b||e[26]!==s||e[27]!==E?(_=p.jsx("p",{...s,"data-streamdown":"paragraph","data-oc-media-row":E,style:b,children:t}),e[24]=t,e[25]=b,e[26]=s,e[27]=E,e[28]=_):_=e[28];let P;return e[29]!==_||e[30]!==S?(P=p.jsx(En.Provider,{value:S,children:_}),e[29]=_,e[30]=S,e[31]=P):P=e[31],P}function Mi(n){return n.height}function Ci(n,e){return n+e.width/e.height}function Ei(n){return n.type==="element"&&n.tagName==="img"}function ji(n){return n.type!=="text"||n.value.trim()}const Ri=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),Ot=Array.from(Ri).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),Ni=n=>on(n),Nn=n=>{let e;try{e=new URL(n.trim())}catch{return null}if(e.protocol!=="file:"||e.hostname&&e.hostname!=="localhost")return null;try{const t=decodeURIComponent(e.pathname);return/^\/[A-Za-z]:\//.test(t)?t.slice(1):t.startsWith("/")?t:null}catch{return null}},rt=n=>{let e=(n||"").trim();return e?((e.startsWith("`")&&e.endsWith("`")||e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1).trim()),e=e.replace(/[.,;!?]+$/g,""),e.endsWith(")")&&!e.includes("(")&&(e=e.slice(0,-1)),e.endsWith("]")&&!e.includes("[")&&(e=e.slice(0,-1)),e):""},Ze=n=>{let e=rt(n);if(!e)return"";const t=e.indexOf(";");t>=0&&(e=e.slice(0,t)),e=e.replace(/#.*$/,"");const r=e.match(/^(.*\.[A-Za-z0-9_-]{1,16}):.*$/);r&&(e=r[1]??e);const s=Ot.length>0?e.match(new RegExp(`^(.*(?:/|^)(${Ot})):.*$`,"i")):null;return s&&(e=s[1]??e),rt(e)},Pi=n=>{const e=rt(n);if(!e)return null;const t=e.indexOf(";"),r=t>=0?rt(e.slice(0,t)):e;if(!r)return null;const s=r.match(/^(.*?):(\d+)-(\d+)$/);if(s){const l=Ze(s[1]??""),c=Number.parseInt(s[2]??"",10),d=Number.parseInt(s[3]??"",10);return!l||!Number.isFinite(c)||!Number.isFinite(d)||d<c?null:{path:l,line:c,endLine:d}}const i=r.match(/^(.*)#L(\d+)(?:C(\d+))?$/i);if(i){const l=Ze(i[1]??""),c=Number.parseInt(i[2]??"",10),d=i[3]?Number.parseInt(i[3],10):void 0;return!l||!Number.isFinite(c)?null:{path:l,line:c,column:Number.isFinite(d??Number.NaN)?d:void 0}}const a=r.match(/^(.*?):(\d+)(?::(\d+))?$/);if(a){const l=Ze(a[1]??""),c=Number.parseInt(a[2]??"",10),d=a[3]?Number.parseInt(a[3],10):void 0;return!l||!Number.isFinite(c)?null:{path:l,line:c,column:Number.isFinite(d??Number.NaN)?d:void 0}}const o=Ze(r);return o?{path:o}:null},_i=/(?:[A-Za-z]:[\\/])?[\w.\-/@+]*[\w\-/@+]\.[A-Za-z0-9]{1,8}(?::\d+(?:-\d+)?(?::\d+)?)?/g,Ai=4,Ii=1e3,Li=200,ke=new Map;let Ge=0;const Dt=[],Ti=()=>je()?Li:Ii,Pn=(n,e)=>`${n}\0${e}`,$i=(n,e)=>{const t=on(n,{preserveWhitespace:!0});if(!t)return Promise.resolve(!1);const r=Pn(e,t),s=ke.get(r);if(s)return ke.delete(r),ke.set(r,s),s;const i=new Promise(o=>{const l=()=>{Ge+=1,pt(`/api/fs/stat?path=${encodeURIComponent(t)}&optional=true`,{method:"GET",cache:"no-store",headers:e?{"x-opencode-directory":e}:void 0}).then(async c=>{if(!c.ok){o(!1);return}const d=await c.json().catch(()=>null);o(d?.exists!==!1)}).catch(()=>o(!1)).finally(()=>{Ge=Math.max(0,Ge-1),Dt.shift()?.()})};if(Ge<Ai){l();return}Dt.push(l)}),a=Ti();for(;ke.size>=a;){const o=ke.keys().next().value;if(typeof o!="string")break;ke.delete(o)}return ke.set(r,i),i},Fi=is({paths:os(fn())}),ze=new Map,Oi=200,Di=(n,e)=>{if(!n||!e||je())return Promise.resolve(null);const t=Pn(e,n),r=ze.get(t);if(r)return r;const s=pt(`/api/fs/find-by-name?name=${encodeURIComponent(n)}`,{method:"GET",cache:"no-store",headers:{"x-opencode-directory":e}}).then(async i=>{if(!i.ok)return null;const a=Fi.safeParse(await i.json().catch(()=>null)),o=a.success?a.data.paths:[];return o.length===1?o[0]:null}).catch(()=>null);for(;ze.size>=Oi;){const i=ze.keys().next();if(i.done)break;ze.delete(i.value)}return ze.set(t,s),s};function Ue(n,e){if("key"in n&&n.key!=="Enter"&&n.key!==" "||(n.preventDefault(),n.stopPropagation(),!("key"in n)&&ar(n.currentTarget.closest("[data-markdown-content]"))))return;const t=/Mac|iPhone|iPad/.test(navigator.platform);e(t?n.metaKey:n.ctrlKey)}const zt=new ln({maxEntries:64,maxBytes:1024*1024});function kt(){const n=W.c(5),{directory:e}=de(),t=k.useContext(an),r=t?.editor,s=t?.runtime.isVSCode,i=ir();let a;return n[0]!==e||n[1]!==r||n[2]!==s||n[3]!==i?(a=async(o,l,c,d)=>{const f=c===void 0?!1:c,u=Ve(o,e,"click",d===void 0?"path":d);if(!u)return;const m=l??u.resolvedPath;if(f&&es()&&await ts(m))return;if(s&&r){r.openFile(m,u.line,u.column);return}const g=ce.getState();u.line?g.openContextFileAtLine(e,m,u.line,u.column??1):g.openContextFile(e,m),i?.openFiles()},n[0]=e,n[1]=r,n[2]=s,n[3]=i,n[4]=a):a=n[4],a}function zi(){const n=W.c(5),e=k.useContext(an),{t}=Ne(),r=e?.files,s=e?.runtime.platform;let i;e:{let a;n[0]!==r?(a=r?.revealPath?.bind(r),n[0]=r,n[1]=a):a=n[1];const o=a;if(!o||!s||s==="vscode"||Qr(s)){i=null;break e}let l;n[2]!==o||n[3]!==t?(l=c=>{o(c).catch(()=>{or.error(t("sidebarFilesTree.toast.revealFailed"))})},n[2]=o,n[3]=t,n[4]=l):l=n[4],i=l}return i}const Wi=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),Ui=(n,e,t)=>{if(!n||!t&&(n.startsWith("--")||n.includes("://")||/[<>]/.test(n)||/\s{2,}/.test(n))||!t&&e==="probe"&&n.includes("@")&&!n.includes("/"))return!1;const s=Ni(n).split("/").filter(Boolean).pop()??"";if(!s||s==="."||s==="..")return!1;const i=s.toLowerCase();return Wi.has(i)||i.startsWith(".")&&i.length>1?!0:s.endsWith(".")?!1:e==="click"?/\.[A-Za-z0-9_-]{1,16}$/.test(s):/\.[A-Za-z][A-Za-z0-9_-]{0,15}$/.test(s)};function Ve(n,e,t="probe",r="path"){const s=/^\s*file:/i.test(n),i=Pi(s?Nn(n)??n:n),a=r==="href"&&!s;if(i&&a){if(i.path.startsWith("//")||/^[A-Za-z][A-Za-z\d+.-]*:/.test(i.path)&&!/^[A-Za-z]:[\\/]/.test(i.path))return null;try{i.path=decodeURIComponent(i.path)}catch{}}if(!i||!e||!Ui(i.path,t,a))return null;const o=sr(e,i.path,{preserveWhitespace:a});return o?{...i,resolvedPath:o}:null}async function _n(n,e,t="path"){const r=Ve(n,e,"probe",t);return r?!rn(r.resolvedPath,e)||await $i(r.resolvedPath,e)?r.resolvedPath:/[\\/]/.test(r.path)?null:Di(r.path,e):null}async function Bi(n,e,t,r=s=>_n(s,e)){if(n.length>2e5)return[];let s=zt.get(n);if(!s){s=Array.from(n.matchAll(_i),l=>({raw:l[0],start:l.index}));const o=n.length*2+s.reduce((l,c)=>l+c.raw.length*2+32,0);o<=1024*1024&&zt.set(n,s,o)}const i=s.filter(o=>Ve(o.raw,e)).slice(0,t);return(await Promise.all(i.map(async o=>{const l=await r(o.raw);return l?{start:o.start,end:o.start+o.raw.length,raw:o.raw,path:l}:null}))).filter(o=>o!==null)}function An(n,e){const t=W.c(8),r=e===void 0?"path":e,{directory:s,fileReferences:i,confirmFile:a}=de();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=fe(),t[0]=o):o=t[0];const l=o,[c,d]=k.useState(null);let f,h;return t[1]!==a||t[2]!==s||t[3]!==i||t[4]!==r||t[5]!==n?(f=()=>{if(!i)return;let u=!0;return a(n,r).then(m=>{u&&l===fe()&&d(m?{raw:n,inputKind:r,directory:s,runtimeKey:l,path:m}:null)}),()=>{u=!1}},h=[n,r,s,i,l,a],t[1]=a,t[2]=s,t[3]=i,t[4]=r,t[5]=n,t[6]=f,t[7]=h):(f=t[6],h=t[7]),k.useEffect(f,h),i&&c?.raw===n&&c.inputKind===r&&c.directory===s&&c.runtimeKey===l?c.path:null}function Ki(n){const e=W.c(20);let t,r,s;e[0]!==n?({children:r,node:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let i;e[4]!==t?.children?(i=t?.children.map(Vi).join("")??"",e[4]=t?.children,e[5]=i):i=e[5];const a=i,o=An(a),l=kt();let c;e[6]!==l||e[7]!==o||e[8]!==a?(c=S=>{o&&Ue(S,v=>{l(a,o,v)})},e[6]=l,e[7]=o,e[8]=a,e[9]=c):c=e[9];const d=c,f=o?"true":void 0,h=o?a:void 0,u=o??void 0,m=o?"button":void 0,g=o?0:void 0,w=o?d:void 0,y=o?d:void 0;let x;return e[10]!==r||e[11]!==s||e[12]!==f||e[13]!==h||e[14]!==u||e[15]!==m||e[16]!==g||e[17]!==w||e[18]!==y?(x=p.jsx("code",{...s,dir:"ltr","data-streamdown":"inline-code","data-openchamber-file-link":f,"data-openchamber-file-ref":h,"data-openchamber-file-path":u,role:m,tabIndex:g,onClick:w,onKeyDown:y,children:r}),e[10]=r,e[11]=s,e[12]=f,e[13]=h,e[14]=u,e[15]=m,e[16]=g,e[17]=w,e[18]=y,e[19]=x):x=e[19],x}function Vi(n){return n.type==="text"?n.value:""}function Hi(n){const e=W.c(10),{purpose:t}=de();if(t){let s,i;if(e[0]!==n){const{node:l,children:c,...d}=n;s=c,i=d,e[0]=n,e[1]=s,e[2]=i}else s=e[1],i=e[2];let a;e[3]!==s?(a=p.jsx(Fe.Provider,{value:!0,children:s}),e[3]=s,e[4]=a):a=e[4];let o;return e[5]!==i||e[6]!==a?(o=p.jsx("a",{...i,children:a}),e[5]=i,e[6]=a,e[7]=o):o=e[7],o}let r;return e[8]!==n?(r=p.jsx(Zi,{...n}),e[8]=n,e[9]=r):r=e[9],r}function qi(n){const e=W.c(3),{src:t}=n,[r,s]=k.useState(!1);if(r)return null;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>s(!0),e[0]=i):i=e[0];let a;return e[1]!==t?(a=p.jsx("span",{"data-message-image-export-exclude":"true",className:"me-1 inline-flex size-[18px] items-center justify-center rounded border border-[var(--border)] bg-[var(--interactive-hover)] align-middle",children:p.jsx("img",{src:t,alt:"","aria-hidden":"true",loading:"lazy",decoding:"async",className:"size-3.5 rounded-sm",onError:i})}),e[1]=t,e[2]=a):a=e[2],a}const Xi=n=>{if(!n)return"";let e="";const t=r=>{r.type==="text"?e+=r.value:r.type==="element"&&r.children.forEach(t)};return n.children.forEach(t),e.trim()};function Zi(n){const e=W.c(17);let t,r,s,i;if(e[0]!==n?({href:t,children:s,node:r,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i):(t=e[1],r=e[2],s=e[3],i=e[4]),!t){let o;if(e[5]!==i){const{target:d,rel:f,...h}=i;o=h,e[5]=i,e[6]=o}else o=e[6];let l;e[7]!==s?(l=p.jsx(Fe.Provider,{value:!0,children:s}),e[7]=s,e[8]=l):l=e[8];let c;return e[9]!==o||e[10]!==l?(c=p.jsx("a",{...o,children:l}),e[9]=o,e[10]=l,e[11]=c):c=e[11],c}let a;return e[12]!==t||e[13]!==r||e[14]!==s||e[15]!==i?(a=p.jsx(Gi,{href:t,node:r,...i,children:s}),e[12]=t,e[13]=r,e[14]=s,e[15]=i,e[16]=a):a=e[16],a}function Gi(n){const e=W.c(102);let t,r,s,i;e[0]!==n?({href:t,children:s,node:r,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i):(t=e[1],r=e[2],s=e[3],i=e[4]);let a;e[5]!==s?(a=p.jsx(Fe.Provider,{value:!0,children:s}),e[5]=s,e[6]=a):a=e[6];const o=a,l=de(),{directory:c}=l,{t:d}=Ne(),f=sn(c),h=kt(),u=me(),m=ce(Ji);let g;e[7]!==r?(g=Xi(r),e[7]=r,e[8]=g):g=e[8];const w=g;let y;e[9]!==t?(y=lr(t),e[9]=t,e[10]=y):y=e[10];const x=y,S=cr(t);let v;e[11]!==t?(v=dr(t),e[11]=t,e[12]=v):v=e[12];const C=v,M=je()?null:ur(t,fr()),b=k.useContext(hr),E=M?b.get(mr(M)):void 0;let _;e[13]!==t?(_=nn(t),e[13]=t,e[14]=_):_=e[14];const P=_;let N;e[15]!==c||e[16]!==t||e[17]!==l.fileNavigation?(N=l.fileNavigation&&Ve(t,c,"click","href"),e[15]=c,e[16]=t,e[17]=l.fileNavigation,e[18]=N):N=e[18];const R=N,I=zi();let O;e[19]!==R||e[20]!==t||e[21]!==l.fileNavigation||e[22]!==I?(O=l.fileNavigation&&!R&&I?Nn(t):null,e[19]=R,e[20]=t,e[21]=l.fileNavigation,e[22]=I,e[23]=O):O=e[23];const B=O,Z=!!(R||B||P||M||x||S||C),L=Z?t:w,F=An(L,Z?"href":"path"),J=!!(F&&!Z);let z;e[24]!==t?(z=pr(t),e[24]=t,e[25]=z):z=e[25];const $=z,Q=r?.properties.dataOcReference!==void 0;let j;e[26]!==$||e[27]!==t||e[28]!==F||e[29]!==Q?(j=$&&!F&&!Q?gr(t):null,e[26]=$,e[27]=t,e[28]=F,e[29]=Q,e[30]=j):j=e[30];const D=j;let G;e[31]!==c||e[32]!==t||e[33]!==m||e[34]!==l.loopbackPreview?(G=l.loopbackPreview&&wr(t)&&c&&!(ns()&&m),e[31]=c,e[32]=t,e[33]=m,e[34]=l.loopbackPreview,e[35]=G):G=e[35];const H=G;let ee;e[36]!==P||e[37]!==$||e[38]!==R||e[39]!==B||e[40]!==t||e[41]!==u||e[42]!==f||e[43]!==h||e[44]!==F||e[45]!==l.disableLinkSafety||e[46]!==I||e[47]!==M||e[48]!==x||e[49]!==w||e[50]!==J?(ee=q=>{if(!(u?.documentAssets&&ds(q,u.documentAssets))){if(J&&F){Ue(q,ue=>{h(w,F,ue)});return}if(M&&(!$||!(q.metaKey||q.ctrlKey||q.shiftKey||q.altKey))){q.preventDefault(),br(M.sessionId,M.messageId);return}if(P){q.preventDefault(),q.stopPropagation(),jt(t);return}if(!x){if(R){Ue(q,ue=>{h(t,F??void 0,ue,"href")});return}if(B&&I){Ue(q,()=>I(B));return}if(t.startsWith("#")&&!u?.documentAssets){q.preventDefault();const ue=decodeURIComponent(t.slice(1)),pe=q.currentTarget.closest("[data-markdown-content]");(pe?Array.from(pe.querySelectorAll("[id]")).find(be=>be.id===ue):null)?.scrollIntoView({block:"nearest"});return}$&&!l.disableLinkSafety&&!(q.metaKey||q.ctrlKey||q.shiftKey||q.altKey)&&(q.preventDefault(),q.stopPropagation(),f(t))}}},e[36]=P,e[37]=$,e[38]=R,e[39]=B,e[40]=t,e[41]=u,e[42]=f,e[43]=h,e[44]=F,e[45]=l.disableLinkSafety,e[46]=I,e[47]=M,e[48]=x,e[49]=w,e[50]=J,e[51]=ee):ee=e[51];const U=ee;if(C){const q=C.openable?Ct:yr,ue=C.openable?C.filename:void 0,pe=C.openable?"button":void 0,_e=C.openable?0:void 0,be=`#${C.iconId}`;let ge;e[52]!==be?(ge=p.jsx("svg",{className:"size-[1.1em] shrink-0","aria-hidden":"true",children:p.jsx("use",{href:be})}),e[52]=be,e[53]=ge):ge=e[53];let we;e[54]!==C.filename?(we=p.jsx("span",{className:Et,children:C.filename}),e[54]=C.filename,e[55]=we):we=e[55];let Ae;return e[56]!==C.filename||e[57]!==C.iconId||e[58]!==q||e[59]!==ue||e[60]!==pe||e[61]!==_e||e[62]!==ge||e[63]!==we?(Ae=p.jsxs("span",{className:q,"data-attachment-citation":C.iconId,"data-attachment-open":ue,role:pe,tabIndex:_e,title:C.filename,children:[ge,we]}),e[56]=C.filename,e[57]=C.iconId,e[58]=q,e[59]=ue,e[60]=pe,e[61]=_e,e[62]=ge,e[63]=we,e[64]=Ae):Ae=e[64],Ae}if(M&&E){let q;return e[65]!==E||e[66]!==M?(q=p.jsx(kr,{chip:E,target:M}),e[65]=E,e[66]=M,e[67]=q):q=e[67],q}if(S)return p.jsx("a",{"data-openchamber-agent-mention":"true",className:"text-primary hover:underline",href:xr(S),target:"_blank",rel:"noopener noreferrer",children:o});let X;e[68]!==D?(X=D&&p.jsx(qi,{src:D}),e[68]=D,e[69]=X):X=e[69];const A=w===t?"ltr":i.dir,T=x?Ct:i.className,K=x??void 0,te=x?`$${x}`:i.title,V=F?"true":void 0,re=F?L:void 0,se=F??void 0;let ae;e[70]!==P||e[71]!==t?(ae=q=>{P&&(q.preventDefault(),q.button===1&&jt(t))},e[70]=P,e[71]=t,e[72]=ae):ae=e[72];const le=P?Yi:void 0;let ie;e[73]!==x?(ie=x&&p.jsx(he,{name:"book-open",className:"size-[1.1em] shrink-0"}),e[73]=x,e[74]=ie):ie=e[74];let Y;e[75]!==o||e[76]!==x?(Y=x?p.jsx("span",{className:Et,children:x}):o,e[75]=o,e[76]=x,e[77]=Y):Y=e[77];let oe;e[78]!==U||e[79]!==t||e[80]!==i||e[81]!==A||e[82]!==T||e[83]!==K||e[84]!==te||e[85]!==V||e[86]!==re||e[87]!==se||e[88]!==ae||e[89]!==le||e[90]!==ie||e[91]!==Y?(oe=p.jsxs("a",{...i,href:t,target:"_blank",rel:"noopener noreferrer",dir:A,className:T,"data-skill-name":K,title:te,"data-openchamber-file-link":V,"data-openchamber-file-ref":re,"data-openchamber-file-path":se,onClick:U,onAuxClick:ae,onDragStart:le,children:[ie,Y]}),e[78]=U,e[79]=t,e[80]=i,e[81]=A,e[82]=T,e[83]=K,e[84]=te,e[85]=V,e[86]=re,e[87]=se,e[88]=ae,e[89]=le,e[90]=ie,e[91]=Y,e[92]=oe):oe=e[92];let xe;e[93]!==c||e[94]!==t||e[95]!==H||e[96]!==d?(xe=H&&p.jsx(Ce,{variant:"ghost",size:"xs",className:"ms-1 align-middle","data-export-ignore":!0,title:d("terminalView.preview.openTitle"),"aria-label":d("terminalView.preview.open"),onClick:()=>ce.getState().openContextPreview(c,t),children:p.jsx(he,{name:"global",className:"size-3.5"})}),e[93]=c,e[94]=t,e[95]=H,e[96]=d,e[97]=xe):xe=e[97];let Pe;return e[98]!==X||e[99]!==oe||e[100]!==xe?(Pe=p.jsxs(p.Fragment,{children:[X,oe,xe]}),e[98]=X,e[99]=oe,e[100]=xe,e[101]=Pe):Pe=e[101],Pe}function Yi(n){return n.preventDefault()}function Ji(n){return n.openLinksInBrowserPanel}const Qi=()=>mn(()=>import("./MarkdownDiffPreview-DuH8ODuS.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199])).then(n=>n.default),eo=()=>{};function to(n){const e=W.c(7),{source:t,incomplete:r}=n;let s;e[0]!==r||e[1]!==t?(s=!r&&!vr(t),e[0]=r,e[1]=t,e[2]=s):s=e[2];const i=s,a=Sr(i,Qi,eo);let o;return e[3]!==a||e[4]!==i||e[5]!==t?(o=p.jsx("div",{"data-streamdown":"code-block-body","data-language":"diff",children:i&&a?p.jsx(a,{source:t}):p.jsx(Mr,{diff:t})}),e[3]=a,e[4]=i,e[5]=t,e[6]=o):o=e[6],o}const no=k.memo(function(e){const t=W.c(5),{tokens:r}=e,s=r.length===0||r.length===1&&r[0].content==="";let i;t[0]!==s||t[1]!==r?(i=s?`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownDiffPreview-CaG-F6-b.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/useAppFontEffects-C_TEX3sk.js","assets/katex.min-BCtkGOiC.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod-Csf1sqWl.js","assets/vendor-opencode-client-CqFY51gT.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/vendor-streamdown-BbSYZ3NF.js","assets/vendor-markdown-BTUqNk6W.js","assets/vendor-mdast-util-from-markdown-CZHjOE75.js","assets/vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js","assets/vendor-micromark-util-decode-string-fHsnqYdj.js","assets/vendor-decode-named-character-reference-C3-224fz.js","assets/vendor-micromark-util-normalize-identifier-C9ANKk3v.js","assets/vendor-micromark-AWM-NZXP.js","assets/vendor-micromark-util-combine-extensions-d8XJZrgA.js","assets/vendor-micromark-util-chunked-DrRIdSP-.js","assets/vendor-micromark-factory-space-PzSHLgmq.js","assets/vendor-micromark-util-character-CW3Cu1MS.js","assets/vendor-micromark-core-commonmark-kzTLNXAm.js","assets/vendor-micromark-util-classify-character-tcLuZZwM.js","assets/vendor-micromark-util-resolve-all-PQCKh0dx.js","assets/vendor-micromark-util-subtokenize-BF1Jf29a.js","assets/vendor-micromark-factory-destination-Sj0xfi0V.js","assets/vendor-micromark-factory-label-amyP0HdC.js","assets/vendor-micromark-factory-title-khnLkZK6.js","assets/vendor-micromark-factory-whitespace-eIB00uTl.js","assets/vendor-micromark-util-html-tag-name-DbKNfynz.js","assets/vendor-unist-util-stringify-position-Ch_qCilz.js","assets/vendor-mdast-util-to-string-C_aolqmU.js","assets/vendor-unist-util-visit-DhPeCsfG.js","assets/vendor-unist-util-visit-parents-DlviEg7Z.js","assets/vendor-unist-util-is-BPZGFiMU.js","assets/vendor-hast-util-raw-DvvLJg15.js","assets/vendor-ungap-structured-clone--gfxRhYI.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-parse5-DwmzEj2o.js","assets/vendor-entities-wUUgTZDW.js","assets/vendor-web-namespaces-bsVAaBS1.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-unist-util-position-60F3QETU.js","assets/vendor-hast-util-from-parse5-Ba3T6RJI.js","assets/vendor-devlop-0Dp3JUBc.js","assets/vendor-property-information-Boo8Xpef.js","assets/vendor-hastscript-BrPNioaz.js","assets/vendor-comma-separated-tokens-CRUGqg4f.js","assets/vendor-space-separated-tokens-D7QSIrTI.js","assets/vendor-hast-util-parse-selector-TXfch5wI.js","assets/vendor-vfile-location-LfEFwJ2h.js","assets/vendor-hast-util-to-parse5-BoysVIPW.js","assets/vendor-hast-util-sanitize-2aGO5ay8.js","assets/vendor-micromark-extension-gfm-CsfPlnlB.js","assets/vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js","assets/vendor-micromark-extension-gfm-footnote-OFl1FCH2.js","assets/vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js","assets/vendor-micromark-extension-gfm-table-dgw4LfUw.js","assets/vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js","assets/vendor-mdast-util-gfm-CroMDYLM.js","assets/vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-mdast-util-find-and-replace-DB9iC-bx.js","assets/vendor-escape-string-regexp-BaJN9MlJ.js","assets/vendor-mdast-util-gfm-footnote-C-csI7OF.js","assets/vendor-mdast-util-gfm-strikethrough-BcskTdio.js","assets/vendor-mdast-util-gfm-table-DhPwQIyj.js","assets/vendor-markdown-table-DvhhVmnL.js","assets/vendor-mdast-util-to-markdown-Cl3qaiyc.js","assets/vendor-longest-streak-CtXnX3Xp.js","assets/vendor-mdast-util-phrasing-4oVbNLC3.js","assets/vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js","assets/vendor-mdast-util-to-hast-CWnLaQSO.js","assets/vendor-micromark-util-sanitize-uri-BbwQ7CLk.js","assets/vendor-trim-lines-D8znQY54.js","assets/vendor-micromark-extension-cjk-friendly-BzZDGrF5.js","assets/vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js","assets/vendor-get-east-asian-width-CPhS2cOv.js","assets/vendor-micromark-util-symbol-JJPacVTp.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js","assets/vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js","assets/vendor-hast-util-from-html-isomorphic-B0Kn01s9.js","assets/vendor-hast-util-from-dom-DeNf9aYW.js","assets/vendor-katex-DBqql0K7.js","assets/vendor-hast-util-to-text-0GXLnBvt.js","assets/vendor-hast-util-is-element-CuOmiqQi.js","assets/vendor-unist-util-find-after-CMaZmLxc.js","assets/vendor-micromark-extension-math-BRFoDziv.js","assets/vendor-mdast-util-math-wB-IJCL0.js","assets/vendor-remend-r8cP_t-e.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-marked-DN3zOnEe.js","assets/vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js","assets/vendor-style-to-js-CI2G4dgu.js","assets/vendor-style-to-object-BAv4SQXc.js","assets/vendor-inline-style-parser-BlqBsVO4.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-estree-util-is-identifier-name-BgBfM8ME.js","assets/vendor-vfile-message-DqhD22jI.js","assets/vendor-unified-1CQKw2_w.js","assets/vendor-bail-FqpXQuLt.js","assets/vendor-extend-B94qxKr5.js","assets/vendor-is-plain-obj-C1gvLhAf.js","assets/vendor-trough-B_b8ryxu.js","assets/vendor-vfile-BCWrK60u.js","assets/vendor-html-url-attributes-D46m5wfe.js","assets/vendor-capacitor-core-B4EWRrHz.js","assets/katex-arxpHWv8.css","assets/vendor-base-ui-zhBy6TEG.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-floating-ui-react-dom-Cy8dRGoy.js","assets/vendor-use-sync-external-store-CfLJGVyr.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-dnd-kit-core-Br1Cs7RV.js","assets/vendor-dnd-kit-utilities-DZ9KbT5S.js","assets/vendor-dnd-kit-accessibility-CYclfhtC.js","assets/vendor-dnd-kit-sortable-DpfLEOLv.js","assets/vendor-tanstack-react-virtual-C_IilPt1.js","assets/vendor-tanstack-virtual-core-DsQgKrou.js","assets/vendor-framer-motion-C_wK4GIM.js","assets/vendor-motion-dom-HXPOMxb7.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-codemirror-commands-CjjsURR-.js","assets/vendor-codemirror-state-Cd8udR5z.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-Ciie9ey-.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-codemirror-language-8HZTPOnt.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CZEcqU6G.js","assets/vendor-codemirror-streamparser-CmlTsbN2.js","assets/vendor-codemirror-lang-javascript-DmqaSK_j.js","assets/vendor-lezer-javascript-CWSwshuO.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BGedy2gC.js","assets/vendor-codemirror-lang-json-DVAYKmoO.js","assets/vendor-lezer-json-Cn1mncjr.js","assets/vendor-codemirror-lang-css-BLpgXfL2.js","assets/vendor-lezer-css-B2Hx_Nps.js","assets/vendor-codemirror-lang-html-S3jxr3Mo.js","assets/vendor-lezer-html-Cr8K5DGw.js","assets/vendor-codemirror-lang-markdown-D1jveRI5.js","assets/vendor-lezer-markdown-TQKzBB8i.js","assets/vendor-codemirror-language-data-Cy549AYN.js","assets/vendor-codemirror-lang-python-B-5UC9Ui.js","assets/vendor-lezer-python-BUoImtUb.js","assets/vendor-sonner-Dw26OnzC.js","assets/vendor-cmdk-BtSpU-Io.js","assets/vendor-radix-ui-react-dialog-OIW6VLWw.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D4RvEbuR.js","assets/vendor-radix-ui-react-context-BbFoxCHu.js","assets/vendor-radix-ui-react-id-aGag8i_5.js","assets/vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js","assets/vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js","assets/vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js","assets/vendor-radix-ui-react-primitive-CrN9dRDb.js","assets/vendor-radix-ui-react-slot-BjbalUfz.js","assets/vendor-radix-ui-react-use-callback-ref-CcC_buIU.js","assets/vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js","assets/vendor-radix-ui-react-focus-scope-D1noLHmd.js","assets/vendor-radix-ui-react-portal-BlUEzfrF.js","assets/vendor-radix-ui-react-presence-BGqFfiW4.js","assets/vendor-radix-ui-react-focus-guards-CSS2IbZC.js","assets/vendor-react-remove-scroll-Der_cv-1.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-Clwl9llp.js","assets/vendor-react-style-singleton-D_xJlTqU.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-BdLl6ZIw.js","assets/vendor-use-callback-ref-CXJF1lEr.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-legendapp-list-DAdshx9l.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/ToolPartDiffPreview-CJneViW_.js","assets/PatchDiff-DGB_PTLK.js","assets/parseDiffFromFile-Yp9eHLcj.js","assets/computeVirtualFileMetrics-CXGHe7T5.js","assets/themeResolver-4dbEkEN5.js","assets/vendor-pierre-theming-D_TRfu0q.js","assets/hastToHtml-BHV14OWE.js","assets/vendor-hast-util-to-html-Jw3IXh58.js","assets/vendor-stringify-entities-CsH1VEn9.js","assets/vendor-character-entities-legacy-BpoLgcEt.js","assets/vendor-character-entities-html4-D7taRCQ7.js","assets/vendor-diff-C3JhlQdm.js","assets/useNextRenderData-CVFf78p9.js","assets/isDiffPlainText-SBv5bM8c.js","assets/getFiletypeFromFileName-BgI9McTw.js","assets/pierreDiffTint-CFyG2F44.js","assets/appThemeRegistry-BBiQjAje.js","assets/textMateThemeFromAppTheme-CbTfkuJp.js","assets/diffsHighlighter-BsxkaI3Q.js"])))=>i.map(i=>d[i]);
2
+ import{R as k,f as W,j as p,a as Bn}from"./vendor-react--VO_rL_p.js";import{hb as nn,hc as Kn,hd as mt,he as Vn,hf as Hn,hg as qn,hh as Xn,hi as Zn,hj as Gn,fY as rn,hk as Yn,hl as Jn,hm as Qn,hn as er,ho as tr,hp as Mt,hq as nr,u as Ne,hr as sn,Q as Qe,B as Ce,z as rr,I as he,hs as on,bg as sr,ht as an,hu as ir,hv as ln,A as or,hw as ar,hx as lr,hy as cr,hz as dr,hA as ur,hB as fr,hC as hr,hD as mr,hE as pr,hF as gr,hG as wr,hH as Ct,hI as yr,hJ as Et,hK as xr,e6 as br,hL as jt,hM as kr,hN as vr,hO as Sr,al as Mr,hP as Cr,hQ as Er,hR as jr,b0 as st,a2 as Rt,a3 as Nt,a4 as Pt,a5 as _t,n as Rr,cI as De,hS as Nr,U as Pr,hT as At,hU as _r,hV as Ar,hW as Ie,hX as Ir,hY as Lr,hZ as Tr,h_ as $r,h$ as Fr,aJ as cn,aj as Or,ak as Dr,cu as zr,i0 as Wr,i1 as Ur,i2 as Br,i3 as Kr,ag as Vr}from"./useAppFontEffects-C_TEX3sk.js";import{o as It,X as et,j as Hr,w as Be,D as qr,I as Xr,k as Zr,W as Gr,L as dn,U as Yr}from"./vendor-streamdown-BbSYZ3NF.js";import{aG as fe,aX as Ee,l as je,aV as ct,j as pt,aI as un,bR as Jr,bS as Qr,aM as es,bT as ts,u as ce,bg as ns,bU as rs}from"./katex.min-BCtkGOiC.js";import{B as tt}from"./vendor-streamdown-cjk-CeadmtR2.js";import{g as ss}from"./vendor-streamdown-math-SFa9Faw2.js";import{s as fn,o as is,d as os}from"./vendor-zod-Csf1sqWl.js";import{a as as}from"./vendor-markdown-BTUqNk6W.js";import{i as ls,r as cs,o as ds,M as hn,b as us,B as Lt,a as Tt,c as fs}from"./useMarkdownLocalAssets-DG5IJM9Y.js";import{_ as mn}from"./vendor-vite-runtime-DD1OZmLC.js";import{r as hs,a as ms}from"./vendor-beautiful-mermaid-Tpx-v0Sg.js";import{b as pn}from"./vendor-shiki-BBVtYVEV.js";import{a as ps}from"./textMateThemeFromAppTheme-CbTfkuJp.js";import{p as gs,i as ws,a as dt,b as ys,s as gn}from"./vendor-yaml-CE-D_49-.js";const wn=["note","tip","important","warning","caution"],yn=n=>wn.find(e=>e===n)??null,xs=/^\[!(note|tip|important|warning|caution)\][\t ]*(?:\r?\n|$)/i;function bs(n){const e=n.children[0];if(e?.type!=="paragraph")return;const t=e.children[0];if(t?.type!=="text")return;const r=xs.exec(t.value),s=yn(r?.[1].toLowerCase());if(!r||!s)return;t.value=t.value.slice(r[0].length),t.value||e.children.shift(),e.children[0]?.type==="break"&&e.children.shift(),e.children.length===0&&n.children.shift(),n.data={...n.data,hProperties:{...n.data?.hProperties,dataOcAlert:s}}}function ks(){return n=>{const e=t=>{if(t.type==="blockquote"&&bs(t),"children"in t)for(const r of t.children)e(r)};e(n)}}function vs(n){return n.type==="root"}const Ss=/^ {0,3}<details(?:\s+(open(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?))?\s*>\s*<summary\s*>([\s\S]*?)<\/summary\s*>/i;function He(n,e,t){const r=e.slice(0,t).split(/\r\n|\r|\n/),s=r.length-1,i=r[r.length-1].length;function a(o){if(o.position)for(const l of[o.position.start,o.position.end])l&&(l.line===1&&(l.column+=i),l.line+=s,l.offset!==void 0&&(l.offset+=t));if("children"in o)for(const l of o.children)a(l)}a(n)}const Ms=/^(\s*<h([1-6])(?:\s+[^\s"'<>/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'<>=]+))?)*\s*>)([\s\S]*?)<\/h\2\s*>\s*$/i,Cs=[1,2,3,4,5,6];function Es(n,e){const t=/(^ {0,3}(`{3,}|~{3,})[^\n]*(?:\n|$))|(`+)|(<\/?details\b[^>]*>)/gim;t.lastIndex=e;let r=1,s;for(;s=t.exec(n);)if(s[2]){const i=s[2],a=new RegExp(`^ {0,3}${i[0]}{${i.length},}[\\t ]*(?:\\r?\\n|$)`,"gm");if(a.lastIndex=t.lastIndex,!a.exec(n))break;t.lastIndex=a.lastIndex}else if(s[3]){const i=/`+/g;i.lastIndex=t.lastIndex;let a;for(;a=i.exec(n);)if(a[0].length===s[3].length){t.lastIndex=i.lastIndex;break}}else if(s[4]){const i=n.lastIndexOf(`
3
+ `,s.index-1)+1,a=n.slice(i,s.index);if(/^(?: {4}|\t| {0,3}>)/.test(a)||/(?:^|[^\\])(?:\\\\)*\\$/.test(a))continue;if(r+=/^<\//.test(s[4])?-1:1,r===0)return{bodyEnd:s.index,end:t.lastIndex}}return{bodyEnd:n.length,end:n.length}}function js(){const n=t=>{const r=this.parse(t);if(!vs(r))throw new Error("Disclosure parsing requires a Markdown root");return t.startsWith("\uFEFF")&&He(r,t,1),r},e=(t,r)=>{if(!("children"in t))return;const s=t.children;if(t.type==="blockquote"){const i=t.position?.start?.offset,a=t.position?.end?.offset;if(i===void 0||a===void 0)return;const o=[];let l="",c=i;for(const h of r.slice(i,a).split(new RegExp("(?<=\\n)"))){const u=/^ {0,3}> ?/.exec(h)?.[0].length??0;for(let m=u;m<h.length;m++)o.push(c+m),l+=h[m];c+=h.length}o.push(a);const d=n(l);e(d,l);const f=h=>{if(h.position)for(const u of[h.position.start,h.position.end]){if(!u||u.offset===void 0)continue;u.offset=o[u.offset]??a;const m=r.slice(0,u.offset).split(/\r\n|\r|\n/);u.line=m.length,u.column=m[m.length-1].length+1}if("children"in h)for(const u of h.children)f(u)};f(d),s.splice(0,s.length,...d.children);return}for(let i=0;i<s.length;i++){const a=s[i];if(a.type!=="html"){e(a,r);continue}const o=a.position?.start?.offset;if(o===void 0)continue;const l=Ss.exec(r.slice(o));if(!l)continue;const c=o+l[0].length,{bodyEnd:d,end:f}=Es(r,c),h=r.slice(c,d),u=n(h);e(u,h),He(u,r,c);const m=/<summary\s*>/i.exec(l[0]),g=o+(m?.index??0)+(m?.[0].length??0),w=l[2]??"",y=Ms.exec(w),x=y?y[3]:w,S=n(x);He(S,r,g+(y?.[1].length??0));const v=S.children[0],C=v?.type==="paragraph"?v.children:[{type:"text",value:x}],M=Cs.find(I=>String(I)===y?.[2]),b={type:"ocDisclosureSummary",data:{hName:"summary"},children:M?[{type:"heading",depth:M,children:C}]:C},E={type:"ocDisclosure",data:{hName:"details",hProperties:l[1]?{open:!0}:{}},children:[b,...u.children]};let _=1,P=a.position?.end?.offset??f;for(;i+_<s.length;){const I=s[i+_];if((I.position?.start?.offset??r.length)>=f)break;P=I.position?.end?.offset??f,_++}const N=n(r.slice(f,P));He(N,r,f);const R=N.children;s.splice(i,_,E,...R)}};return(t,r)=>e(t,r.toString())}const Rs=function(n,e,t){const r=this.previous===null||this.previous<-2;let s=!1,i=!1;function a(u){return n.enter("ocMath"),n.enter("ocMathMarker"),n.consume(u),o}function o(u){return u!==40&&u!==91||(s=u===91,s&&!r)?t(u):(n.consume(u),n.exit("ocMathMarker"),n.enter("ocMathValue"),l)}function l(u){return u===null?t(u):u===92?n.check(d,f,c)(u):c(u)}function c(u){return i=!0,u!==null&&u<=-3?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),l):(n.consume(u),l)}const d={tokenize(u,m,g){return w;function w(S){return u.consume(S),y}function y(S){return!i||S!==(s?93:41)?g(S):(u.consume(S),s?x:m)}function x(S){return S===32||S===9?(u.consume(S),x):S===null||S<0?m(S):g(S)}}};function f(u){return n.exit("ocMathValue"),n.enter("ocMathMarker"),n.consume(u),h}function h(u){return n.consume(u),n.exit("ocMathMarker"),n.exit("ocMath"),e}return a},Ns=function(n,e,t){const r=this.previous,s=this.parser.constructs.text[60];let i="";return a;function a(d){return r!==null&&r>=48&&r<=57?t(d):(n.enter("ocMath"),n.consume(d),o)}function o(d){return d===null||d<0||d===34?t(d):d===60&&s?n.check(s,t,l)(d):d===40&&i.endsWith("]")||!i&&/\s/.test(String.fromCharCode(d))?t(d):d===36?!i||/^\s|\s$/.test(i)||/^[\d.,\s]+$/.test(i)||/^\d[\d.,]*(?:[;:]|\s+(?:and|to)\b)/.test(i)?t(d):(n.consume(d),c):l(d)}function l(d){return d===null?t(d):(i+=String.fromCharCode(d),n.consume(d),o)}function c(d){return d!==null&&d>=48&&d<=57?t(d):(n.exit("ocMath"),e(d))}},Ps={enter:{ocMath(n){const e=this.sliceSerialize(n).startsWith("\\[");this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math",e?"math-display":"math-inline"]},hChildren:[]}},n)}},exit:{ocMath(n){const e=this.sliceSerialize(n),t=e.startsWith("$")?1:2,r=e.slice(t,-t),s=this.stack[this.stack.length-1];s.type==="inlineMath"&&(s.value=r,s.data&&(s.data.hChildren=[{type:"text",value:r}])),this.exit(n)}}};function _s(n,e){const t=n.position?.start?.offset,r=n.position?.end?.offset;if(t===void 0||r===void 0)return!0;const s=e.slice(t,r);return!s.startsWith("$")||s.startsWith("$$")?!0:!/^[\d.,\s]+$/.test(n.value)&&!/^\s|\s$/.test(n.value)&&!/\d/.test(e.slice(r,r+1))}function As(){const n=this.data();return(n.micromarkExtensions??=[]).push({text:{92:{name:"ocMath",tokenize:Rs},36:{name:"ocDollarMath",tokenize:Ns}}}),(n.fromMarkdownExtensions??=[]).push(Ps),(e,t)=>{const r=t.toString();function s(i){if(!("children"in i))return;const a=i.children;if(i.type==="link"){const o=a.map(l=>l.type==="inlineMath"||l.type==="math"?r.slice(l.position?.start?.offset,l.position?.end?.offset):l.type==="text"?l.value:"").join("");if(o===i.url){i.children=[{type:"text",value:o}];return}}for(let o=0;o<a.length;o++){const l=a[o];if(l.type==="inlineMath"||l.type==="math"){const c=l.position?.start?.offset,d=l.position?.end?.offset;_s(l,r)?l.type==="inlineMath"&&r.slice(c,d).startsWith("$$")&&(l.data??={},l.data.hProperties={className:["language-math","math-display"]}):a.splice(o,1,{type:"text",value:r.slice(c,d)})}else s(l)}}s(e)}}const Is=new Set(["align","alt","checked","colSpan","controls","disabled","height","href","media","open","playsInline","preload","rel","rowSpan","src","srcSet","start","target","title","type","width"]),We=fn();function nt(n){try{const e=new URL(n);return e.protocol==="file:"&&(!e.hostname||e.hostname==="localhost")}catch{return!1}}function ut(n){return/\s/.test(n)||/^[\s\\]*[/\\]{2}/.test(n)||n.includes("\\")?!1:/^https?:\/\//i.test(n)||!/^[a-z][a-z\d+.-]*:/i.test(n)}function Ls(n,e){return n!==n.trim()||/\s/.test(n)?!1:ut(n)||nt(n)||nn(n)||/^(?:mailto|tel|sms|callto|cid|xmpp|irc|ircs|news|nntp|feed|webcal):/i.test(n)||!e&&Kn(n)}function Ts({isVSCode:n}){return(e,t)=>{const r=t.toString();function s(i){const a=[];for(const o of i.children){if(o.type==="doctype")continue;if(o.type!=="element"){a.push(o);continue}if(["script","style","iframe","object","embed","svg","math","form"].includes(o.tagName))continue;const l=o.position?.start?.offset,c=l!==void 0&&r[l]==="<";if(!(o.tagName==="input"&&o.properties.type!=="checkbox")){for(const d of Object.keys(o.properties)){const h=c&&d==="className"&&o.tagName==="code"&&Array.isArray(o.properties.className)&&o.properties.className.every(u=>/^language-[\w#+.-]+$/.test(String(u)))||!c&&(d==="className"&&["code","li","ul","ol","section","h2","a"].includes(o.tagName)||d==="metastring"&&o.tagName==="code"||["id","ariaDescribedBy","ariaLabel","dataFootnoteRef","dataFootnoteBackref","dataFootnotes"].includes(d)||d==="dataOcAlert"&&o.tagName==="blockquote"||d==="dataOcReference"&&o.tagName==="a");!Is.has(d)&&!h&&delete o.properties[d]}if(o.properties.href!==void 0){const d=We.safeParse(o.properties.href);d.success&&Ls(d.data,n)?o.properties.dataOcLinkSource=d.data:delete o.properties.href}if(o.tagName==="a"&&(o.properties.href="#oc-link"),o.properties.src!==void 0){const d=We.safeParse(o.properties.src);if(d.success){const f=d.data,h=o.tagName==="img"&&/^data:image\/(?:png|jpeg|gif|webp);base64,(?:[a-z\d+/]{4})*(?:[a-z\d+/]{2}==|[a-z\d+/]{3}=)?$/i.test(f);f===f.trim()&&(ut(f)||nt(f)||h)?(o.properties.dataOcMediaSource=f,nt(f)&&delete o.properties.src):delete o.properties.src}else delete o.properties.src}if(o.tagName==="img"&&(o.properties.src="/__oc_markdown_media__"),o.properties.srcSet!==void 0){const d=We.safeParse(o.properties.srcSet);d.success&&d.data.split(",").every(h=>{const[u,m,...g]=h.trim().split(/\s+/);return!!u&&ut(u)&&g.length===0&&(!m||/^(?:\d+w|\d+(?:\.\d+)?x)$/.test(m))})||delete o.properties.srcSet}for(const d of["width","height"])o.properties[d]!==void 0&&!/^\d+(?:\.\d+)?%?$/.test(String(o.properties[d]))&&delete o.properties[d];o.tagName==="video"&&(o.properties.controls=!0,o.properties.playsInline=!0,o.properties.preload="none"),s(o),a.push(o)}}i.children=a}s(e)}}function $s(){return n=>{function e(t){for(const r of t.children)if(r.type==="element"){if(r.tagName==="a"){const s=We.safeParse(r.properties.dataOcLinkSource);s.success?r.properties.href=s.data:delete r.properties.href,delete r.properties.dataOcLinkSource}if(r.tagName==="img"){const s=We.safeParse(r.properties.dataOcMediaSource);s.success&&!nt(s.data)&&!/^data:/i.test(s.data)?r.properties.src=s.data:delete r.properties.src}e(r)}}e(n)}}const xn={singleTilde:!1},Fs=et.gfm,Os=[[Fs[0],xn],...Object.values(et).filter(n=>n!==et.gfm)],Ds=tt.remarkPluginsAfter.at(-1),zs={...tt,remarkPluginsAfter:[...tt.remarkPluginsAfter.slice(0,-1),[Ds,xn]]};function Ws(n=!1){return n?tt:zs}const $t=ss({singleDollarTextMath:!1}),Us={...$t,remarkPlugin:function(){return this.use([$t.remarkPlugin]),As.call(this)}},Bs={tagNames:["a","abbr","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","mark","ol","p","picture","pre","q","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var","video"],strip:["script","style","iframe","object","embed","svg","math","form"],attributes:{"*":["align","alt","checked","colSpan","height","media","open","rowSpan","start","title","width"],a:["href","id","ariaDescribedBy","ariaLabel","dataFootnoteRef","dataFootnoteBackref","dataOcLinkSource","dataOcReference"],code:[["className",/^language-[\w#+.:-]+$/,"math-inline","math-display"],"metastring"],img:["src","srcSet","alt","dataOcMediaSource"],source:["src","srcSet","type","media","dataOcMediaSource"],video:["src","controls","playsInline","preload","dataOcMediaSource"],input:["type","checked","disabled"],li:[["className","task-list-item"]],ul:[["className","contains-task-list"]],ol:[["className","contains-task-list"]],section:["dataFootnotes",["className","footnotes"]],h2:["id",["className","sr-only"]],blockquote:[["dataOcAlert",...wn]]},protocols:{src:["http","https"]},clobberPrefix:"",required:{input:{type:"checkbox",disabled:!0}}};function Ks(){return n=>{function e(t){if(!("children"in t)||t.type==="link"||t.type==="linkReference")return;const r=t.children;for(let s=0;s<r.length;s++){const i=r[s];if(i.type!=="text"){e(i);continue}const a=Array.from(i.value.matchAll(/\bopenchamber:\/\/session\/[A-Za-z0-9_-]{1,128}(?:\?message=[A-Za-z0-9_-]{1,128})?/g));if(a.length===0)continue;const o=[];let l=0;for(const c of a)c.index>l&&o.push({type:"text",value:i.value.slice(l,c.index)}),o.push({type:"link",url:c[0],children:[{type:"text",value:c[0]}]}),l=c.index+c[0].length;l<i.value.length&&o.push({type:"text",value:i.value.slice(l)}),r.splice(s,1,...o),s+=o.length-1}}e(n)}}function Vs(){return(n,e)=>{const t=String(e.value).replace(/^\uFEFF/,"");n.children=n.children.filter(r=>{const s=r.position?.start.offset,i=r.position?.end.offset;return s===void 0||i===void 0||!mt(t.slice(s,i))})}}function qe(n,e,t){return{remarkPlugins:[...t?Object.values(et):Os,js,ks,Vs,Ks],rehypePlugins:[...n?[It.raw]:[],[Ts,{isVSCode:e}],[as,Bs],It.harden,$s]}}const Hs=[!1,!0].flatMap(n=>[qe(!1,!1,n),qe(!1,!0,n),qe(!0,!1,n),qe(!0,!0,n)]);function qs(n,e,t=!1){return Hs[(t?4:0)+(n?2:0)+(e?1:0)]}const Xs=new Set(["inlineCode","code","html","math","inlineMath"]);function Zs(n){return e=>{const t=r=>{if(!Xs.has(r.type)){if(r.type==="text"){r.value=Vn(r.value,n);return}if("children"in r)for(const s of r.children)t(s)}};t(e)}}const Gs=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Ys=n=>{const{issuePrefix:e,changeRequestPrefix:t}=n.descriptor.terminology,r=[...new Set([e,t])].sort((s,i)=>i.length-s.length).map(Gs).join("|");return new RegExp([String.raw`(?<![\w/#!@&.-])(?<project>[\w.-]+(?:/[\w.-]+)+)?(?<prefix>${r})(?<number>\d+)(?![\w-])`,String.raw`(?<![\w@./+-])@(?<user>[A-Za-z0-9](?:[A-Za-z0-9_.-]*[A-Za-z0-9_])?)(?![\w@/-])`,String.raw`(?<![\w/@#.-])(?<sha>[0-9a-f]{7,40})(?![\w/-])`].join("|"),"g")},Js=(n,e,t)=>{const{issuePrefix:r,changeRequestPrefix:s}=n.descriptor.terminology;if(e.number&&e.prefix){const i=e.prefix===r?"issue":e.prefix===s?"pull":null,a=Number(e.number);if(!i||!Number.isSafeInteger(a)||a<1||e.project&&!n.descriptor.repository.nestedNamespaces&&e.project.split("/").length>2)return null;const o=Hn(n,i,a,e.project?qn(e.project):n);return o?{url:o,children:[{type:"text",value:t}]}:null}if(e.user){const i=Xn(n,e.user);return i?{url:i,children:[{type:"text",value:t}]}:null}if(e.sha&&/\d/.test(e.sha)&&/[a-f]/.test(e.sha)){const i=Zn(n,e.sha);return i?{url:i,children:[{type:"inlineCode",value:e.sha.slice(0,7)}]}:null}return null},Qs=n=>{let e=0;for(const t of n.matchAll(/<(\/?)(a|code)\b[^>]*?(\/?)>/gi))t[3]||(e+=t[1]?-1:1);return e},ei=new Set(["link","linkReference","inlineCode","code","html","definition","math","inlineMath"]);function ti(n){const e=Ys(n),t=r=>{const s=[];let i=0;for(const a of r.matchAll(e)){const o=a.groups?Js(n,a.groups,a[0]):null;if(!o)continue;a.index>i&&s.push({type:"text",value:r.slice(i,a.index)});const l={type:"link",url:o.url,children:o.children,data:{hProperties:{dataOcReference:""}}};s.push(l),i=a.index+a[0].length}return s.length===0?null:(i<r.length&&s.push({type:"text",value:r.slice(i)}),s)};return r=>{const s=i=>{if(ei.has(i.type)||!("children"in i))return;const a=i.children;let o=0;for(let l=0;l<a.length;l++){const c=a[l];if(c.type==="html"){o=Math.max(0,o+Qs(c.value));continue}if(o>0)continue;if(c.type!=="text"){s(c);continue}const d=t(c.value);d&&(a.splice(l,1,...d),l+=d.length-1)}};s(r)}}const Xe=new Map;class ni{constructor(e){this.options=e}controller=new AbortController;disposed=!1;sources=new Map;batch;refreshing;documentUrls=new Map;runtimeKey=fe();resolver=Ee();connect(){!this.disposed&&this.controller.signal.aborted&&(this.controller=new AbortController)}register(e){return this.sources.set(e,(this.sources.get(e)??0)+1),()=>{const t=(this.sources.get(e)??1)-1;t?this.sources.set(e,t):this.sources.delete(e)}}check(e){if(e.aborted||this.disposed||this.runtimeKey!==fe()||this.resolver!==Ee())throw new DOMException("Media owner changed","AbortError")}async resolve(e,t=!1,r=!1){const s=this.controller.signal;this.check(s);const{mode:i,directory:a,sessionId:o,messageId:l,documentAssets:c}=this.options;if(i==="assistant"&&(await Promise.resolve(),this.check(s),![...this.sources.keys()].slice(0,12).includes(e)))throw new Error("Message media limit");if(/^(?:https?:)?\/\//i.test(e)){if(i!=="document"&&!t)throw new Error("Remote chat image");return e}if(/^data:/i.test(e))return Gn(e,s);if(i==="document"){if(!c)return e;if(!ls(e))throw new Error("Document source is unavailable");const u=cs(c.filePath,e),m=c.workspaceRoot,g={path:u,directory:m||void 0,allowOutsideWorkspace:m&&rn(u,m)?void 0:"true"};if(t){if(je())throw new Error("Video bridge is unavailable");return await ct(),this.check(s),Ee().authenticatedAsset("/api/fs/raw",g)}const w=this.documentUrls.get(u);if(w)return w;const y=(async()=>{const x=await pt("/api/fs/raw",{query:g,signal:AbortSignal.any([s,AbortSignal.timeout(3e4)])});if(!x.ok)throw new Error(`Image read failed (${x.status})`);const S=await x.blob();if(S.size>25*1024*1024)throw new Error("Image too large for preview");return this.check(s),URL.createObjectURL(S)})();return this.documentUrls.set(u,y),y}if(i==="local")return e;if(je()){if(t)throw new Error("Video bridge is unavailable");const u=await Yn(e,a,s);return this.check(s),u}if(!o||!l)throw new Error("Missing media owner");await Promise.resolve(),this.check(s);const f=[...this.sources.keys()].slice(0,12);if(!f.includes(e))throw new Error("Message media limit");if(!this.batch||r){if(r&&this.refreshing)this.batch=this.refreshing;else if(this.batch=Jn({sources:f.filter(Mt),directory:a,sessionId:o,messageId:l,signal:s}),r){const u=this.batch;this.refreshing=u,u.finally(()=>{this.refreshing===u&&(this.refreshing=void 0)}).catch(()=>{})}}const h=(await this.batch).get(e);if(this.check(s),h?.status!=="ready")throw new Error("Image is unavailable");if(!t&&Qn()){const u=await er(h,a,s);return this.check(s),u}return await ct(),this.check(s),tr(h,a)}async load(e){const t=this.controller.signal,{mode:r,directory:s,sessionId:i,messageId:a}=this.options;if(r==="assistant"&&!je()&&Mt(e)){if(!i||!a)throw new Error("Missing media owner");return nr({source:e,directory:s,sessionId:i,messageId:a,signal:t})}const o=await this.resolve(e);if(!/^(?:data|blob):/i.test(o))throw new Error("Image cannot be saved");return(await fetch(o,{signal:t})).blob()}addGallery(e){const t=`${this.runtimeKey}\0${this.options.sessionId??""}\0${this.options.messageId??""}`;let r=Xe.get(t);return r||(r=new Set,Xe.set(t,r)),r.add(e),()=>{r.delete(e),r.size||Xe.delete(t)}}async openGallery(e,t){const r=this.controller.signal;this.check(r);const s=`${this.runtimeKey}\0${this.options.sessionId??""}\0${this.options.messageId??""}`,i=[...Xe.get(s)??[]].filter(d=>d.element.isConnected).sort((d,f)=>d.element.compareDocumentPosition(f.element)&4?-1:1),a=await Promise.allSettled(i.map(d=>d.resolve()));this.check(r);const o=i.flatMap((d,f)=>{const h=a[f];return h?.status==="fulfilled"?[{url:h.value,filename:d.filename,element:d.element,load:d.load}]:[]}),l=o.findIndex(d=>d.element===e),c=o[l];c&&t({open:!0,title:c.filename,content:"",metadata:{tool:"markdown-image-preview",filename:c.filename},image:{url:c.url,filename:c.filename,load:c.load,gallery:o.map(({url:d,filename:f,load:h})=>({url:d,filename:f,load:h})),index:l}})}disconnect(){this.controller.abort();for(const e of this.documentUrls.values())e.then(t=>URL.revokeObjectURL(t),()=>{});this.documentUrls.clear(),this.batch=void 0,this.refreshing=void 0}dispose(){this.disposed=!0,this.disconnect()}}const bn=k.createContext(null),Fe=k.createContext(!1),me=()=>k.useContext(bn);function ri(n){const e=W.c(23),{content:t,mode:r,sessionId:s,messageId:i,directory:a,settled:o,documentAssets:l,onShowPopup:c,children:d}=n,[f,h]=k.useReducer(si,0);let u,m;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>un(()=>h()),m=[],e[0]=u,e[1]=m):(u=e[0],m=e[1]),k.useEffect(u,m);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=fe(),e[2]=g):g=e[2];const w=g;let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=Ee(),e[3]=y):y=e[3];const x=y,S=l?.filePath,v=l?.workspaceRoot;let C;e[4]!==a||e[5]!==S||e[6]!==i||e[7]!==r||e[8]!==s||e[9]!==v?(C=new ni({mode:r,directory:a,sessionId:s,messageId:i,documentAssets:S?{filePath:S,workspaceRoot:v??null}:void 0}),e[4]=a,e[5]=S,e[6]=i,e[7]=r,e[8]=s,e[9]=v,e[10]=C):C=e[10];const M=C;let b,E;e[11]!==M?(b=()=>{if(w!==fe()||x!==Ee()){M.dispose(),h();return}M.connect();const R=Jr(()=>M.dispose());return()=>{R(),M.disconnect()}},E=[M,x,w],e[11]=M,e[12]=b,e[13]=E):(b=e[12],E=e[13]),k.useLayoutEffect(b,E);let _;e[14]!==l||e[15]!==r||e[16]!==c||e[17]!==M||e[18]!==o?(_={owner:M,mode:r,settled:o,documentAssets:l,onShowPopup:c},e[14]=l,e[15]=r,e[16]=c,e[17]=M,e[18]=o,e[19]=_):_=e[19];const P=_;let N;return e[20]!==d||e[21]!==P?(N=p.jsx(bn.Provider,{value:P,children:d}),e[20]=d,e[21]=P,e[22]=N):N=e[22],N}function si(n){return n+1}const gt=k.createContext(null);function de(){const n=k.useContext(gt);if(!n)throw new Error("Markdown components require MarkdownContent");return n}const ii=/\.(?:mp4|m4v|mov|webm)$/i,oi=/^https:\/\/github\.com\/user-attachments\/assets\/[\w-]+$/i,kn=n=>/[?&]oc_(?:url|client)_token=/i.test(n),ye=n=>kn(n)?"":n,Oe=(n,e="")=>{if(/^data:/i.test(n))return e.trim()||`image.${/^data:image\/([^;,]+)/i.exec(n)?.[1]?.replace("jpeg","jpg")??"png"}`;const t=n.split(/[?#]/,1)[0]?.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??e;try{return decodeURIComponent(t)}catch{return t}},ai=n=>{const t=(n.split(/[?#]/,1)[0]?.replace(/\\/g,"/")??"").split("/").filter(Boolean).at(-1)??"";try{return decodeURIComponent(t)}catch{return t}},Ft=n=>ii.test(n.trim()),vn=(n,e="")=>Ft(e)||Ft(ai(n)),Sn=n=>/^https?:\/\//i.test(n)&&(oi.test(n)||vn(n)),wt=n=>/^(?:https?:)?\/\//i.test(n),Mn=n=>n==="streamdown:incomplete-image",Cn=(n,e)=>n["data-oc-media-source"]??e??"",En=k.createContext(null),li=n=>{const e=n.ownerDocument.defaultView;for(let t=n.parentElement;t&&e;t=t.parentElement)if(t.scrollHeight>t.clientHeight&&/auto|scroll/.test(e.getComputedStyle(t).overflowY))return t;return null};function yt(n,e){const t=W.c(7),r=e===void 0?!1:e,s=k.useRef(null);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=u=>{s.current=u},t[0]=i):i=t[0];const a=i,[o,l]=k.useState(!1);let c,d;t[1]!==n||t[2]!==r?(c=()=>{if(!n||!s.current)return;const u=s.current.ownerDocument.defaultView?.IntersectionObserver;if(!u){l(!0);return}const m=new u(g=>{g.some(ci)&&(l(!0),m.disconnect())},r?{root:li(s.current),rootMargin:"100% 0px"}:{rootMargin:"200px"});return m.observe(s.current),()=>m.disconnect()},d=[n,r],t[1]=n,t[2]=r,t[3]=c,t[4]=d):(c=t[3],d=t[4]),k.useEffect(c,d);const f=!n||o;let h;return t[5]!==f?(h={ref:s,setRef:a,near:f},t[5]=f,t[6]=h):h=t[6],h}function ci(n){return n.isIntersecting}function di(n){const e=W.c(4);let t;e[0]!==n?(t=i=>{if(!n)return fi;const a=window.matchMedia(n);return a.addEventListener("change",i),()=>a.removeEventListener("change",i)},e[0]=n,e[1]=t):t=e[1];const r=t;let s;return e[2]!==n?(s=()=>!n||window.matchMedia(n).matches,e[2]=n,e[3]=s):s=e[3],k.useSyncExternalStore(r,s,ui)}function ui(){return!0}function fi(){}const xt=k.createContext(null);function Ke(n){const e=W.c(23),{source:t,name:r,title:s,linked:i,state:a}=n,{t:o}=Ne(),l=k.useContext(gt),c=me(),d=sn(l?.directory??c?.owner?.options.directory??"");let f;e[0]!==a||e[1]!==o||e[2]!==s?(f=a==="failed"?o("common.image.loadFailed"):s,e[0]=a,e[1]=o,e[2]=s,e[3]=f):f=e[3];let h;e[4]!==t?(h=ye(t),e[4]=t,e[5]=h):h=e[5];let u;e[6]!==a?(u=a==="loading"?p.jsx(rr,{className:"size-3.5","aria-hidden":!0}):p.jsx(he,{name:a==="failed"?"error-warning":"file-image",className:"size-3.5 shrink-0"}),e[6]=a,e[7]=u):u=e[7];let m;e[8]!==r||e[9]!==a||e[10]!==f||e[11]!==h||e[12]!==u?(m=p.jsxs("span",{title:f,"data-oc-media-source":h,"data-oc-media-label":"true","data-oc-media-state":a,className:"inline-flex items-center gap-1 align-text-bottom text-muted-foreground",children:[u,r]}),e[8]=r,e[9]=a,e[10]=f,e[11]=h,e[12]=u,e[13]=m):m=e[13];const g=m;if(!wt(t)||i||kn(t))return g;let w;e[14]!==d||e[15]!==l?.disableLinkSafety||e[16]!==l?.purpose||e[17]!==t?(w=x=>{l?.purpose||l?.disableLinkSafety||x.metaKey||x.ctrlKey||x.shiftKey||x.altKey||(x.preventDefault(),x.stopPropagation(),d(t))},e[14]=d,e[15]=l?.disableLinkSafety,e[16]=l?.purpose,e[17]=t,e[18]=w):w=e[18];let y;return e[19]!==g||e[20]!==t||e[21]!==w?(y=p.jsx("a",{href:t,className:"external-link",target:"_blank",rel:"noopener noreferrer",onClick:w,children:g}),e[19]=g,e[20]=t,e[21]=w,e[22]=y):y=e[22],y}function jn(n,e,t){const r=W.c(22),s=t===void 0?!1:t,i=me(),a=i?.owner,[o,l]=k.useState(null),[c,d]=k.useState(null);let f;r[0]!==i?.mode?(f=()=>{i?.mode==="document"&&l(hi)},r[0]=i?.mode,r[1]=f):f=r[1];const h=i?.mode;let u;r[2]!==h?(u=[h],r[2]=h,r[3]=u):u=r[3],k.useLayoutEffect(f,u);let m,g;r[4]!==e||r[5]!==a||r[6]!==n||r[7]!==s?(m=()=>{if(!a||!n||!e)return;const C=a.controller.signal;let M=!1;return a.resolve(n,s).then(b=>{!M&&!C.aborted&&(d(null),l({owner:a,signal:C,source:n,url:b}))},()=>{!M&&!C.aborted&&d({owner:a,signal:C,source:n,url:""})}),()=>{M=!0}},g=[a,n,e,s],r[4]=e,r[5]=a,r[6]=n,r[7]=s,r[8]=m,r[9]=g):(m=r[8],g=r[9]),k.useEffect(m,g);const w=c?.owner===a&&c?.source===n,y=o&&o.owner===a&&o.source===n&&(i?.mode!=="document"||!o.signal.aborted)&&!w?o.url:void 0;let x;r[10]!==a||r[11]!==n?(x=()=>{a&&d({owner:a,signal:a.controller.signal,source:n,url:""})},r[10]=a,r[11]=n,r[12]=x):x=r[12];let S;r[13]!==a||r[14]!==n||r[15]!==s?(S=async()=>{if(!a)throw new Error("Missing media owner");const C=a.controller.signal,M=await a.resolve(n,s,!0);C.aborted||(d(null),l({owner:a,signal:C,source:n,url:M}))},r[13]=a,r[14]=n,r[15]=s,r[16]=S):S=r[16];let v;return r[17]!==w||r[18]!==y||r[19]!==x||r[20]!==S?(v={url:y,failed:w,fail:x,retry:S},r[17]=w,r[18]=y,r[19]=x,r[20]=S,r[21]=v):v=r[21],v}function hi(n){return n?.signal.aborted?null:n}const mi=(n,e)=>{const t=e===void 0?"":String(e).trim(),r=n===void 0?"":String(n).trim();return/^\d+$/.test(t)?/^\d+$/.test(r)&&Number(t)>0?{aspectRatio:`${r}/${t}`}:{height:`${t}px`}:{}};function pi(n){const e=W.c(9),t=Cn(n,n.src),r=me(),s=k.useContext(Fe);if(Mn(t))return null;if(!s&&vn(t,n.alt??""))return p.jsx(bt,{src:t,title:n.title||n.alt,node:n.node});if(!t){let a;return e[0]!==r?.mode||e[1]!==n.alt||e[2]!==n.height||e[3]!==n.title||e[4]!==n.width?(a=r?.mode==="document"?p.jsx("img",{alt:n.alt,title:n.title,width:n.width,height:n.height}):null,e[0]=r?.mode,e[1]=n.alt,e[2]=n.height,e[3]=n.title,e[4]=n.width,e[5]=a):a=e[5],a}if(r?.mode!=="document"&&(wt(t)||s))return p.jsx(Ke,{source:t,name:Oe(t,n.alt),title:n.title,linked:s});let i;return e[6]!==n||e[7]!==t?(i=p.jsx(gi,{...n,source:t}),e[6]=n,e[7]=t,e[8]=i):i=e[8],i}function gi(n){const e=W.c(91);let t,r,s,i,a,o,l,c,d,f,h;if(e[0]!==n){const{source:Y,node:oe,src:xe,srcSet:Pe,alt:q,title:ue,className:pe,style:_e,width:be,height:ge,onLoad:we,onError:Ae,...Un}=n;o=Y,l=Pe,d=q,f=ue,t=pe,c=_e,h=be,r=ge,i=we,s=Ae,a=Un,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=o,e[7]=l,e[8]=c,e[9]=d,e[10]=f,e[11]=h}else t=e[1],r=e[2],s=e[3],i=e[4],a=e[5],o=e[6],l=e[7],c=e[8],d=e[9],f=e[10],h=e[11];const u=d===void 0?"":d,m=me(),g=k.useContext(Fe),w=k.useContext(En),y=w?.report,x=k.useId();let S;e[12]!==u||e[13]!==o?(S=Oe(o,u),e[12]=u,e[13]=o,e[14]=S):S=e[14];const v=S,C=m?.mode==="assistant",M=m?.mode==="document",b=k.useContext(xt),{ref:E,setRef:_,near:P}=yt(C||M&&b===null,M),N=b??P,R=m?.owner,I=C&&!!m?.onShowPopup&&!g;let O,B;e[15]!==R||e[16]!==o?(O=()=>R?.register(o),B=[R,o],e[15]=R,e[16]=o,e[17]=O,e[18]=B):(O=e[17],B=e[18]),k.useEffect(O,B);const Z=!!(m&&N&&(!C||m.settled)),{url:L,failed:F,fail:J}=jn(o,Z),z=Rn(l,Z),[$,Q]=k.useState(null),j=!!(L&&$?.url===L),D=$&&$.url===L?$.size:void 0;let G,H;e[19]!==j||e[20]!==x||e[21]!==y||e[22]!==D?(G=()=>(y?.(x,j&&D?D:null),()=>y?.(x,null)),H=[y,x,j,D],e[19]=j,e[20]=x,e[21]=y,e[22]=D,e[23]=G,e[24]=H):(G=e[23],H=e[24]),k.useEffect(G,H);let ee,U;e[25]!==j||e[26]!==I||e[27]!==v||e[28]!==R||e[29]!==E||e[30]!==o?(ee=()=>{const Y=E.current;if(!(!R||!j||!Y||!I))return R.addGallery({source:o,filename:v,element:Y,resolve:()=>R.resolve(o,!1,!0),load:()=>R.load(o)})},U=[R,j,o,v,E,I],e[25]=j,e[26]=I,e[27]=v,e[28]=R,e[29]=E,e[30]=o,e[31]=ee,e[32]=U):(ee=e[31],U=e[32]),k.useEffect(ee,U);let X;e[33]!==u||e[34]!==t||e[35]!==M||e[36]!==j||e[37]!==J||e[38]!==r||e[39]!==v||e[40]!==s||e[41]!==i||e[42]!==a||e[43]!==z||e[44]!==w?.ready||e[45]!==_||e[46]!==o||e[47]!==l||e[48]!==c||e[49]!==f||e[50]!==L||e[51]!==h?(X=L||M?p.jsx("img",{...a,ref:M?_:void 0,src:L,srcSet:z,alt:u||v,title:f,width:h,height:r,className:Qe(M?t:"block h-auto max-h-[30rem] w-auto max-w-full object-contain",M?!L&&"invisible":!j&&"hidden"),style:M?{...c,...mi(h,r)}:{...c,width:w?.ready?"100%":c?.width},"data-oc-media-source":ye(o),"data-oc-media-srcset":l,decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:Y=>{const oe=Y.currentTarget;L&&oe.naturalWidth&&oe.naturalHeight&&Q({url:L,size:{width:oe.naturalWidth,height:oe.naturalHeight}}),i?.(Y)},onError:Y=>{J(),s?.(Y)}}):null,e[33]=u,e[34]=t,e[35]=M,e[36]=j,e[37]=J,e[38]=r,e[39]=v,e[40]=s,e[41]=i,e[42]=a,e[43]=z,e[44]=w?.ready,e[45]=_,e[46]=o,e[47]=l,e[48]=c,e[49]=f,e[50]=L,e[51]=h,e[52]=X):X=e[52];const A=X,T=D?D.width/D.height:1;let K;e[53]!==T||e[54]!==w?.ready||e[55]!==D?(K=w?.ready&&D?{flex:`${T} 1 0px`,minWidth:`${8*T}rem`,maxWidth:`min(${D.width}px, ${30*T}rem)`,margin:0}:void 0,e[53]=T,e[54]=w?.ready,e[55]=D,e[56]=K):K=e[56];const te=K;if(M){let Y;return e[57]!==F||e[58]!==A||e[59]!==g||e[60]!==v||e[61]!==o||e[62]!==f?(Y=F?p.jsx(Ke,{source:o,name:v,title:f,linked:g,state:"failed"}):A,e[57]=F,e[58]=A,e[59]=g,e[60]=v,e[61]=o,e[62]=f,e[63]=Y):Y=e[63],Y}const V=j?"inline-block max-w-[min(100%,30rem)] align-top my-1 me-1":void 0;let re;e[64]!==o?(re=ye(o),e[64]=o,e[65]=re):re=e[65];let se;e[66]!==Z||e[67]!==j||e[68]!==F||e[69]!==g||e[70]!==v||e[71]!==o||e[72]!==f?(se=!j&&p.jsx(Ke,{source:o,name:v,title:f,linked:g,state:F?"failed":Z?"loading":void 0}),e[66]=Z,e[67]=j,e[68]=F,e[69]=g,e[70]=v,e[71]=o,e[72]=f,e[73]=se):se=e[73];const ae=L&&!I&&A;let le;e[74]!==m||e[75]!==j||e[76]!==I||e[77]!==A||e[78]!==v||e[79]!==R||e[80]!==E||e[81]!==L?(le=L&&I&&p.jsx(Ce,{variant:"ghost",className:Qe("block h-auto max-w-full overflow-hidden rounded-lg bg-muted/10 p-0 cursor-zoom-in",!j&&"hidden"),"aria-label":v,"data-oc-media-gallery":"true",onClick:()=>{const Y=E.current;Y&&m?.onShowPopup&&R?.openGallery(Y,m.onShowPopup).catch(wi)},children:A}),e[74]=m,e[75]=j,e[76]=I,e[77]=A,e[78]=v,e[79]=R,e[80]=E,e[81]=L,e[82]=le):le=e[82];let ie;return e[83]!==te||e[84]!==_||e[85]!==V||e[86]!==re||e[87]!==se||e[88]!==ae||e[89]!==le?(ie=p.jsxs("span",{ref:_,className:V,style:te,"data-oc-media-source":re,children:[se,ae,le]}),e[83]=te,e[84]=_,e[85]=V,e[86]=re,e[87]=se,e[88]=ae,e[89]=le,e[90]=ie):ie=e[90],ie}function wi(){}function Rn(n,e){const t=W.c(12),r=me(),s=r?.owner,[i,a]=k.useState(null);let o,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(bi)},l=[],t[0]=o,t[1]=l):(o=t[0],l=t[1]),k.useLayoutEffect(o,l);let c;t[2]!==e||t[3]!==r?.mode||t[4]!==s||t[5]!==n?(c=()=>{if(!n||!s||!e||r?.mode!=="document")return;const h=s.controller.signal;let u=!1;const m=n.split(",").flatMap(xi);return Promise.all(m.map(async g=>{const{source:w,descriptor:y}=g,x=await s.resolve(w);return y?`${x} ${y}`:x})).then(g=>{!u&&!h.aborted&&a({owner:s,signal:h,source:n,value:g.join(", ")})},yi),()=>{u=!0}},t[2]=e,t[3]=r?.mode,t[4]=s,t[5]=n,t[6]=c):c=t[6];const d=r?.mode;let f;return t[7]!==e||t[8]!==s||t[9]!==n||t[10]!==d?(f=[s,d,n,e],t[7]=e,t[8]=s,t[9]=n,t[10]=d,t[11]=f):f=t[11],k.useEffect(c,f),i&&i.owner===s&&!i.signal.aborted&&i.source===n?i.value:void 0}function yi(){}function xi(n){const[e,...t]=n.trim().split(/\s+/);return e?[{source:e,descriptor:t.join(" ")}]:[]}function bi(n){return n?.signal.aborted?null:n}function ki(n){const e=W.c(10);let t,r;if(e[0]!==n){const{node:d,children:f,...h}=n;t=f,r=h,e[0]=n,e[1]=t,e[2]=r}else t=e[1],r=e[2];const s=me()?.mode==="document",{setRef:i,near:a}=yt(s,!0),o=s?a:null;let l;e[3]!==t||e[4]!==o?(l=p.jsx(xt.Provider,{value:o,children:t}),e[3]=t,e[4]=o,e[5]=l):l=e[5];let c;return e[6]!==r||e[7]!==i||e[8]!==l?(c=p.jsx("picture",{...r,ref:i,children:l}),e[6]=r,e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function vi(n){const e=W.c(13);let t,r,s;if(e[0]!==n){const{node:u,srcSet:m,media:g,...w}=n;s=m,t=g,r=w,e[0]=n,e[1]=t,e[2]=r,e[3]=s}else t=e[1],r=e[2],s=e[3];const i=me(),a=k.useContext(xt),o=i?.documentAssets?.colorScheme;let l;e[4]!==t||e[5]!==o?(l=o?t?.replace(/\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)/gi,(u,m)=>m.toLowerCase()===o?"(min-width: 0px)":"(max-width: -1px)"):t,e[4]=t,e[5]=o,e[6]=l):l=e[6];const c=l,d=di(i?.mode==="document"?c:void 0),f=Rn(s,i?.mode==="document"&&a!==!1&&d);if(i?.mode!=="document")return null;let h;return e[7]!==t||e[8]!==r||e[9]!==f||e[10]!==s||e[11]!==c?(h=p.jsx("source",{...r,srcSet:f,media:c,"data-oc-media-srcset":s,"data-oc-media-query":t}),e[7]=t,e[8]=r,e[9]=f,e[10]=s,e[11]=c,e[12]=h):h=e[12],h}function bt(n){const e=Cn(n,n.src),t=me(),r=t?.owner,s=k.useContext(Fe),i=wt(e),{setRef:a,near:o}=yt(t?.mode==="assistant"&&!i);k.useEffect(()=>i?void 0:r?.register(e),[r,e,i]);const{url:l,fail:c,retry:d}=jn(e,!!(t&&!i&&!s&&(t.mode!=="assistant"||t.settled&&o)),!0),[f,h]=k.useState(null),u=f?.owner===r&&f?.source===e?f:null,m=k.useMemo(()=>({lastRetry:0,resume:null}),[r,e]),g=k.useRef(m);g.current=m;const w=k.useRef(null),y=n.title||Oe(e),x=i?u?.failed?void 0:u?.url??e:l,S=!!(x&&(i||t?.mode!=="assistant"||u?.ready===x));return!e||Mn(e)?null:s?p.jsx(Ke,{source:e,name:y,linked:!0}):p.jsxs("span",{ref:a,className:"inline-block max-w-full align-top","data-oc-media-source":ye(e),children:[!S&&p.jsx(Ke,{source:e,name:y,linked:!1}),x&&p.jsx("video",{ref:w,src:x,title:y,controls:!0,playsInline:!0,hidden:!S,preload:i&&t?.mode!=="document"?"none":"metadata",className:n.className,"data-oc-media-source":ye(e),onLoadedMetadata:v=>{h({owner:r,source:e,url:u?.url,ready:x});const C=m.resume;C&&(v.currentTarget.currentTime=C.time,C.playing&&v.currentTarget.play().catch(()=>{}),m.resume=null),n.onLoadedMetadata?.(v)},onError:v=>{if(i){const M=Ee(),b=new URL(e,window.location.href),E=new URL(M.api("/api/fs/raw"),window.location.href);if(!(b.origin===E.origin&&b.pathname===E.pathname&&b.searchParams.has("oc_url_token"))||Date.now()-m.lastRetry<1e4){h({owner:r,source:e,failed:!0});return}m.lastRetry=Date.now(),m.resume={time:v.currentTarget.currentTime,playing:!v.currentTarget.paused};const P=r?.controller.signal;b.searchParams.delete("oc_url_token"),ct().then(()=>{P?.aborted||g.current!==m||M!==Ee()||h({owner:r,source:e,url:M.authenticatedAsset("/api/fs/raw",b.searchParams)})},()=>{!P?.aborted&&g.current===m&&h({owner:r,source:e,failed:!0})});return}if(Date.now()-m.lastRetry<1e4){c();return}m.lastRetry=Date.now(),m.resume={time:v.currentTarget.currentTime,playing:!v.currentTarget.paused};const C=r?.controller.signal;d().then(()=>{!C?.aborted&&g.current===m&&w.current?.load()},()=>{!C?.aborted&&g.current===m&&c()})}})]})}function Si(n){const e=W.c(32);let t,r,s;e[0]!==n?({node:r,children:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=new Map,e[4]=i):i=e[4];const[a,o]=k.useState(i);let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=(N,R)=>{o(I=>{if(I.get(N)===R||!R&&!I.has(N))return I;const O=new Map(I);return R?O.set(N,R):O.delete(N),O})},e[5]=l):l=e[5];const c=l,d=r?.children.filter(ji),f=d?.length===1?d[0]:void 0,h=f?.type==="element"&&f.tagName==="a"?f.properties.href:void 0,u=f?.type==="element"&&f.children.length===1&&f.children[0]?.type==="text"?f.children[0].value:"",m=d?.length??0,g=m>1&&d?.every(Ei),w=me()?.mode,y=!!(w==="assistant"&&g&&a.size===m);let x;e[6]!==y?(x={report:c,ready:y},e[6]=y,e[7]=x):x=e[7];const S=x;if(w==="document"&&u&&u===h&&Sn(u)){let N;e[8]!==u?(N=p.jsx(bt,{src:u}),e[8]=u,e[9]=N):N=e[9];let R;return e[10]!==s||e[11]!==N?(R=p.jsx("p",{...s,"data-streamdown":"paragraph",children:N}),e[10]=s,e[11]=N,e[12]=R):R=e[12],R}let v,C;e[13]!==a?(v=[...a.values()],C=v.reduce(Ci,0),e[13]=a,e[14]=v,e[15]=C):(v=e[14],C=e[15]);const M=C;let b;if(e[16]!==m||e[17]!==v||e[18]!==s.style||e[19]!==M||e[20]!==y){if(b={...s.style},y){b.display="flex",b.flexWrap="wrap",b.alignItems="flex-start",b.gap="0.5rem";let N;e[22]!==v?(N=v.map(Mi),e[22]=v,e[23]=N):N=e[23],b.maxWidth=`calc(min(30rem, ${Math.min(...N)}px) * ${M} + ${(m-1)*.5}rem)`}e[16]=m,e[17]=v,e[18]=s.style,e[19]=M,e[20]=y,e[21]=b}else b=e[21];const E=y?"true":void 0;let _;e[24]!==t||e[25]!==b||e[26]!==s||e[27]!==E?(_=p.jsx("p",{...s,"data-streamdown":"paragraph","data-oc-media-row":E,style:b,children:t}),e[24]=t,e[25]=b,e[26]=s,e[27]=E,e[28]=_):_=e[28];let P;return e[29]!==_||e[30]!==S?(P=p.jsx(En.Provider,{value:S,children:_}),e[29]=_,e[30]=S,e[31]=P):P=e[31],P}function Mi(n){return n.height}function Ci(n,e){return n+e.width/e.height}function Ei(n){return n.type==="element"&&n.tagName==="img"}function ji(n){return n.type!=="text"||n.value.trim()}const Ri=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),Ot=Array.from(Ri).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),Ni=n=>on(n),Nn=n=>{let e;try{e=new URL(n.trim())}catch{return null}if(e.protocol!=="file:"||e.hostname&&e.hostname!=="localhost")return null;try{const t=decodeURIComponent(e.pathname);return/^\/[A-Za-z]:\//.test(t)?t.slice(1):t.startsWith("/")?t:null}catch{return null}},rt=n=>{let e=(n||"").trim();return e?((e.startsWith("`")&&e.endsWith("`")||e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1).trim()),e=e.replace(/[.,;!?]+$/g,""),e.endsWith(")")&&!e.includes("(")&&(e=e.slice(0,-1)),e.endsWith("]")&&!e.includes("[")&&(e=e.slice(0,-1)),e):""},Ze=n=>{let e=rt(n);if(!e)return"";const t=e.indexOf(";");t>=0&&(e=e.slice(0,t)),e=e.replace(/#.*$/,"");const r=e.match(/^(.*\.[A-Za-z0-9_-]{1,16}):.*$/);r&&(e=r[1]??e);const s=Ot.length>0?e.match(new RegExp(`^(.*(?:/|^)(${Ot})):.*$`,"i")):null;return s&&(e=s[1]??e),rt(e)},Pi=n=>{const e=rt(n);if(!e)return null;const t=e.indexOf(";"),r=t>=0?rt(e.slice(0,t)):e;if(!r)return null;const s=r.match(/^(.*?):(\d+)-(\d+)$/);if(s){const l=Ze(s[1]??""),c=Number.parseInt(s[2]??"",10),d=Number.parseInt(s[3]??"",10);return!l||!Number.isFinite(c)||!Number.isFinite(d)||d<c?null:{path:l,line:c,endLine:d}}const i=r.match(/^(.*)#L(\d+)(?:C(\d+))?$/i);if(i){const l=Ze(i[1]??""),c=Number.parseInt(i[2]??"",10),d=i[3]?Number.parseInt(i[3],10):void 0;return!l||!Number.isFinite(c)?null:{path:l,line:c,column:Number.isFinite(d??Number.NaN)?d:void 0}}const a=r.match(/^(.*?):(\d+)(?::(\d+))?$/);if(a){const l=Ze(a[1]??""),c=Number.parseInt(a[2]??"",10),d=a[3]?Number.parseInt(a[3],10):void 0;return!l||!Number.isFinite(c)?null:{path:l,line:c,column:Number.isFinite(d??Number.NaN)?d:void 0}}const o=Ze(r);return o?{path:o}:null},_i=/(?:[A-Za-z]:[\\/])?[\w.\-/@+]*[\w\-/@+]\.[A-Za-z0-9]{1,8}(?::\d+(?:-\d+)?(?::\d+)?)?/g,Ai=4,Ii=1e3,Li=200,ke=new Map;let Ge=0;const Dt=[],Ti=()=>je()?Li:Ii,Pn=(n,e)=>`${n}\0${e}`,$i=(n,e)=>{const t=on(n,{preserveWhitespace:!0});if(!t)return Promise.resolve(!1);const r=Pn(e,t),s=ke.get(r);if(s)return ke.delete(r),ke.set(r,s),s;const i=new Promise(o=>{const l=()=>{Ge+=1,pt(`/api/fs/stat?path=${encodeURIComponent(t)}&optional=true`,{method:"GET",cache:"no-store",headers:e?{"x-opencode-directory":e}:void 0}).then(async c=>{if(!c.ok){o(!1);return}const d=await c.json().catch(()=>null);o(d?.exists!==!1)}).catch(()=>o(!1)).finally(()=>{Ge=Math.max(0,Ge-1),Dt.shift()?.()})};if(Ge<Ai){l();return}Dt.push(l)}),a=Ti();for(;ke.size>=a;){const o=ke.keys().next().value;if(typeof o!="string")break;ke.delete(o)}return ke.set(r,i),i},Fi=is({paths:os(fn())}),ze=new Map,Oi=200,Di=(n,e)=>{if(!n||!e||je())return Promise.resolve(null);const t=Pn(e,n),r=ze.get(t);if(r)return r;const s=pt(`/api/fs/find-by-name?name=${encodeURIComponent(n)}`,{method:"GET",cache:"no-store",headers:{"x-opencode-directory":e}}).then(async i=>{if(!i.ok)return null;const a=Fi.safeParse(await i.json().catch(()=>null)),o=a.success?a.data.paths:[];return o.length===1?o[0]:null}).catch(()=>null);for(;ze.size>=Oi;){const i=ze.keys().next();if(i.done)break;ze.delete(i.value)}return ze.set(t,s),s};function Ue(n,e){if("key"in n&&n.key!=="Enter"&&n.key!==" "||(n.preventDefault(),n.stopPropagation(),!("key"in n)&&ar(n.currentTarget.closest("[data-markdown-content]"))))return;const t=/Mac|iPhone|iPad/.test(navigator.platform);e(t?n.metaKey:n.ctrlKey)}const zt=new ln({maxEntries:64,maxBytes:1024*1024});function kt(){const n=W.c(5),{directory:e}=de(),t=k.useContext(an),r=t?.editor,s=t?.runtime.isVSCode,i=ir();let a;return n[0]!==e||n[1]!==r||n[2]!==s||n[3]!==i?(a=async(o,l,c,d)=>{const f=c===void 0?!1:c,u=Ve(o,e,"click",d===void 0?"path":d);if(!u)return;const m=l??u.resolvedPath;if(f&&es()&&await ts(m))return;if(s&&r){r.openFile(m,u.line,u.column);return}const g=ce.getState();u.line?g.openContextFileAtLine(e,m,u.line,u.column??1):g.openContextFile(e,m),i?.openFiles()},n[0]=e,n[1]=r,n[2]=s,n[3]=i,n[4]=a):a=n[4],a}function zi(){const n=W.c(5),e=k.useContext(an),{t}=Ne(),r=e?.files,s=e?.runtime.platform;let i;e:{let a;n[0]!==r?(a=r?.revealPath?.bind(r),n[0]=r,n[1]=a):a=n[1];const o=a;if(!o||!s||s==="vscode"||Qr(s)){i=null;break e}let l;n[2]!==o||n[3]!==t?(l=c=>{o(c).catch(()=>{or.error(t("sidebarFilesTree.toast.revealFailed"))})},n[2]=o,n[3]=t,n[4]=l):l=n[4],i=l}return i}const Wi=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),Ui=(n,e,t)=>{if(!n||!t&&(n.startsWith("--")||n.includes("://")||/[<>]/.test(n)||/\s{2,}/.test(n))||!t&&e==="probe"&&n.includes("@")&&!n.includes("/"))return!1;const s=Ni(n).split("/").filter(Boolean).pop()??"";if(!s||s==="."||s==="..")return!1;const i=s.toLowerCase();return Wi.has(i)||i.startsWith(".")&&i.length>1?!0:s.endsWith(".")?!1:e==="click"?/\.[A-Za-z0-9_-]{1,16}$/.test(s):/\.[A-Za-z][A-Za-z0-9_-]{0,15}$/.test(s)};function Ve(n,e,t="probe",r="path"){const s=/^\s*file:/i.test(n),i=Pi(s?Nn(n)??n:n),a=r==="href"&&!s;if(i&&a){if(i.path.startsWith("//")||/^[A-Za-z][A-Za-z\d+.-]*:/.test(i.path)&&!/^[A-Za-z]:[\\/]/.test(i.path))return null;try{i.path=decodeURIComponent(i.path)}catch{}}if(!i||!e||!Ui(i.path,t,a))return null;const o=sr(e,i.path,{preserveWhitespace:a});return o?{...i,resolvedPath:o}:null}async function _n(n,e,t="path"){const r=Ve(n,e,"probe",t);return r?!rn(r.resolvedPath,e)||await $i(r.resolvedPath,e)?r.resolvedPath:/[\\/]/.test(r.path)?null:Di(r.path,e):null}async function Bi(n,e,t,r=s=>_n(s,e)){if(n.length>2e5)return[];let s=zt.get(n);if(!s){s=Array.from(n.matchAll(_i),l=>({raw:l[0],start:l.index}));const o=n.length*2+s.reduce((l,c)=>l+c.raw.length*2+32,0);o<=1024*1024&&zt.set(n,s,o)}const i=s.filter(o=>Ve(o.raw,e)).slice(0,t);return(await Promise.all(i.map(async o=>{const l=await r(o.raw);return l?{start:o.start,end:o.start+o.raw.length,raw:o.raw,path:l}:null}))).filter(o=>o!==null)}function An(n,e){const t=W.c(8),r=e===void 0?"path":e,{directory:s,fileReferences:i,confirmFile:a}=de();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=fe(),t[0]=o):o=t[0];const l=o,[c,d]=k.useState(null);let f,h;return t[1]!==a||t[2]!==s||t[3]!==i||t[4]!==r||t[5]!==n?(f=()=>{if(!i)return;let u=!0;return a(n,r).then(m=>{u&&l===fe()&&d(m?{raw:n,inputKind:r,directory:s,runtimeKey:l,path:m}:null)}),()=>{u=!1}},h=[n,r,s,i,l,a],t[1]=a,t[2]=s,t[3]=i,t[4]=r,t[5]=n,t[6]=f,t[7]=h):(f=t[6],h=t[7]),k.useEffect(f,h),i&&c?.raw===n&&c.inputKind===r&&c.directory===s&&c.runtimeKey===l?c.path:null}function Ki(n){const e=W.c(20);let t,r,s;e[0]!==n?({children:r,node:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let i;e[4]!==t?.children?(i=t?.children.map(Vi).join("")??"",e[4]=t?.children,e[5]=i):i=e[5];const a=i,o=An(a),l=kt();let c;e[6]!==l||e[7]!==o||e[8]!==a?(c=S=>{o&&Ue(S,v=>{l(a,o,v)})},e[6]=l,e[7]=o,e[8]=a,e[9]=c):c=e[9];const d=c,f=o?"true":void 0,h=o?a:void 0,u=o??void 0,m=o?"button":void 0,g=o?0:void 0,w=o?d:void 0,y=o?d:void 0;let x;return e[10]!==r||e[11]!==s||e[12]!==f||e[13]!==h||e[14]!==u||e[15]!==m||e[16]!==g||e[17]!==w||e[18]!==y?(x=p.jsx("code",{...s,dir:"ltr","data-streamdown":"inline-code","data-openchamber-file-link":f,"data-openchamber-file-ref":h,"data-openchamber-file-path":u,role:m,tabIndex:g,onClick:w,onKeyDown:y,children:r}),e[10]=r,e[11]=s,e[12]=f,e[13]=h,e[14]=u,e[15]=m,e[16]=g,e[17]=w,e[18]=y,e[19]=x):x=e[19],x}function Vi(n){return n.type==="text"?n.value:""}function Hi(n){const e=W.c(10),{purpose:t}=de();if(t){let s,i;if(e[0]!==n){const{node:l,children:c,...d}=n;s=c,i=d,e[0]=n,e[1]=s,e[2]=i}else s=e[1],i=e[2];let a;e[3]!==s?(a=p.jsx(Fe.Provider,{value:!0,children:s}),e[3]=s,e[4]=a):a=e[4];let o;return e[5]!==i||e[6]!==a?(o=p.jsx("a",{...i,children:a}),e[5]=i,e[6]=a,e[7]=o):o=e[7],o}let r;return e[8]!==n?(r=p.jsx(Zi,{...n}),e[8]=n,e[9]=r):r=e[9],r}function qi(n){const e=W.c(3),{src:t}=n,[r,s]=k.useState(!1);if(r)return null;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>s(!0),e[0]=i):i=e[0];let a;return e[1]!==t?(a=p.jsx("span",{"data-message-image-export-exclude":"true",className:"me-1 inline-flex size-[18px] items-center justify-center rounded border border-[var(--border)] bg-[var(--interactive-hover)] align-middle",children:p.jsx("img",{src:t,alt:"","aria-hidden":"true",loading:"lazy",decoding:"async",className:"size-3.5 rounded-sm",onError:i})}),e[1]=t,e[2]=a):a=e[2],a}const Xi=n=>{if(!n)return"";let e="";const t=r=>{r.type==="text"?e+=r.value:r.type==="element"&&r.children.forEach(t)};return n.children.forEach(t),e.trim()};function Zi(n){const e=W.c(17);let t,r,s,i;if(e[0]!==n?({href:t,children:s,node:r,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i):(t=e[1],r=e[2],s=e[3],i=e[4]),!t){let o;if(e[5]!==i){const{target:d,rel:f,...h}=i;o=h,e[5]=i,e[6]=o}else o=e[6];let l;e[7]!==s?(l=p.jsx(Fe.Provider,{value:!0,children:s}),e[7]=s,e[8]=l):l=e[8];let c;return e[9]!==o||e[10]!==l?(c=p.jsx("a",{...o,children:l}),e[9]=o,e[10]=l,e[11]=c):c=e[11],c}let a;return e[12]!==t||e[13]!==r||e[14]!==s||e[15]!==i?(a=p.jsx(Gi,{href:t,node:r,...i,children:s}),e[12]=t,e[13]=r,e[14]=s,e[15]=i,e[16]=a):a=e[16],a}function Gi(n){const e=W.c(102);let t,r,s,i;e[0]!==n?({href:t,children:s,node:r,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i):(t=e[1],r=e[2],s=e[3],i=e[4]);let a;e[5]!==s?(a=p.jsx(Fe.Provider,{value:!0,children:s}),e[5]=s,e[6]=a):a=e[6];const o=a,l=de(),{directory:c}=l,{t:d}=Ne(),f=sn(c),h=kt(),u=me(),m=ce(Ji);let g;e[7]!==r?(g=Xi(r),e[7]=r,e[8]=g):g=e[8];const w=g;let y;e[9]!==t?(y=lr(t),e[9]=t,e[10]=y):y=e[10];const x=y,S=cr(t);let v;e[11]!==t?(v=dr(t),e[11]=t,e[12]=v):v=e[12];const C=v,M=je()?null:ur(t,fr()),b=k.useContext(hr),E=M?b.get(mr(M)):void 0;let _;e[13]!==t?(_=nn(t),e[13]=t,e[14]=_):_=e[14];const P=_;let N;e[15]!==c||e[16]!==t||e[17]!==l.fileNavigation?(N=l.fileNavigation&&Ve(t,c,"click","href"),e[15]=c,e[16]=t,e[17]=l.fileNavigation,e[18]=N):N=e[18];const R=N,I=zi();let O;e[19]!==R||e[20]!==t||e[21]!==l.fileNavigation||e[22]!==I?(O=l.fileNavigation&&!R&&I?Nn(t):null,e[19]=R,e[20]=t,e[21]=l.fileNavigation,e[22]=I,e[23]=O):O=e[23];const B=O,Z=!!(R||B||P||M||x||S||C),L=Z?t:w,F=An(L,Z?"href":"path"),J=!!(F&&!Z);let z;e[24]!==t?(z=pr(t),e[24]=t,e[25]=z):z=e[25];const $=z,Q=r?.properties.dataOcReference!==void 0;let j;e[26]!==$||e[27]!==t||e[28]!==F||e[29]!==Q?(j=$&&!F&&!Q?gr(t):null,e[26]=$,e[27]=t,e[28]=F,e[29]=Q,e[30]=j):j=e[30];const D=j;let G;e[31]!==c||e[32]!==t||e[33]!==m||e[34]!==l.loopbackPreview?(G=l.loopbackPreview&&wr(t)&&c&&!(ns()&&m),e[31]=c,e[32]=t,e[33]=m,e[34]=l.loopbackPreview,e[35]=G):G=e[35];const H=G;let ee;e[36]!==P||e[37]!==$||e[38]!==R||e[39]!==B||e[40]!==t||e[41]!==u||e[42]!==f||e[43]!==h||e[44]!==F||e[45]!==l.disableLinkSafety||e[46]!==I||e[47]!==M||e[48]!==x||e[49]!==w||e[50]!==J?(ee=q=>{if(!(u?.documentAssets&&ds(q,u.documentAssets))){if(J&&F){Ue(q,ue=>{h(w,F,ue)});return}if(M&&(!$||!(q.metaKey||q.ctrlKey||q.shiftKey||q.altKey))){q.preventDefault(),br(M.sessionId,M.messageId);return}if(P){q.preventDefault(),q.stopPropagation(),jt(t);return}if(!x){if(R){Ue(q,ue=>{h(t,F??void 0,ue,"href")});return}if(B&&I){Ue(q,()=>I(B));return}if(t.startsWith("#")&&!u?.documentAssets){q.preventDefault();const ue=decodeURIComponent(t.slice(1)),pe=q.currentTarget.closest("[data-markdown-content]");(pe?Array.from(pe.querySelectorAll("[id]")).find(be=>be.id===ue):null)?.scrollIntoView({block:"nearest"});return}$&&!l.disableLinkSafety&&!(q.metaKey||q.ctrlKey||q.shiftKey||q.altKey)&&(q.preventDefault(),q.stopPropagation(),f(t))}}},e[36]=P,e[37]=$,e[38]=R,e[39]=B,e[40]=t,e[41]=u,e[42]=f,e[43]=h,e[44]=F,e[45]=l.disableLinkSafety,e[46]=I,e[47]=M,e[48]=x,e[49]=w,e[50]=J,e[51]=ee):ee=e[51];const U=ee;if(C){const q=C.openable?Ct:yr,ue=C.openable?C.filename:void 0,pe=C.openable?"button":void 0,_e=C.openable?0:void 0,be=`#${C.iconId}`;let ge;e[52]!==be?(ge=p.jsx("svg",{className:"size-[1.1em] shrink-0","aria-hidden":"true",children:p.jsx("use",{href:be})}),e[52]=be,e[53]=ge):ge=e[53];let we;e[54]!==C.filename?(we=p.jsx("span",{className:Et,children:C.filename}),e[54]=C.filename,e[55]=we):we=e[55];let Ae;return e[56]!==C.filename||e[57]!==C.iconId||e[58]!==q||e[59]!==ue||e[60]!==pe||e[61]!==_e||e[62]!==ge||e[63]!==we?(Ae=p.jsxs("span",{className:q,"data-attachment-citation":C.iconId,"data-attachment-open":ue,role:pe,tabIndex:_e,title:C.filename,children:[ge,we]}),e[56]=C.filename,e[57]=C.iconId,e[58]=q,e[59]=ue,e[60]=pe,e[61]=_e,e[62]=ge,e[63]=we,e[64]=Ae):Ae=e[64],Ae}if(M&&E){let q;return e[65]!==E||e[66]!==M?(q=p.jsx(kr,{chip:E,target:M}),e[65]=E,e[66]=M,e[67]=q):q=e[67],q}if(S)return p.jsx("a",{"data-openchamber-agent-mention":"true",className:"text-primary hover:underline",href:xr(S),target:"_blank",rel:"noopener noreferrer",children:o});let X;e[68]!==D?(X=D&&p.jsx(qi,{src:D}),e[68]=D,e[69]=X):X=e[69];const A=w===t?"ltr":i.dir,T=x?Ct:i.className,K=x??void 0,te=x?`$${x}`:i.title,V=F?"true":void 0,re=F?L:void 0,se=F??void 0;let ae;e[70]!==P||e[71]!==t?(ae=q=>{P&&(q.preventDefault(),q.button===1&&jt(t))},e[70]=P,e[71]=t,e[72]=ae):ae=e[72];const le=P?Yi:void 0;let ie;e[73]!==x?(ie=x&&p.jsx(he,{name:"book-open",className:"size-[1.1em] shrink-0"}),e[73]=x,e[74]=ie):ie=e[74];let Y;e[75]!==o||e[76]!==x?(Y=x?p.jsx("span",{className:Et,children:x}):o,e[75]=o,e[76]=x,e[77]=Y):Y=e[77];let oe;e[78]!==U||e[79]!==t||e[80]!==i||e[81]!==A||e[82]!==T||e[83]!==K||e[84]!==te||e[85]!==V||e[86]!==re||e[87]!==se||e[88]!==ae||e[89]!==le||e[90]!==ie||e[91]!==Y?(oe=p.jsxs("a",{...i,href:t,target:"_blank",rel:"noopener noreferrer",dir:A,className:T,"data-skill-name":K,title:te,"data-openchamber-file-link":V,"data-openchamber-file-ref":re,"data-openchamber-file-path":se,onClick:U,onAuxClick:ae,onDragStart:le,children:[ie,Y]}),e[78]=U,e[79]=t,e[80]=i,e[81]=A,e[82]=T,e[83]=K,e[84]=te,e[85]=V,e[86]=re,e[87]=se,e[88]=ae,e[89]=le,e[90]=ie,e[91]=Y,e[92]=oe):oe=e[92];let xe;e[93]!==c||e[94]!==t||e[95]!==H||e[96]!==d?(xe=H&&p.jsx(Ce,{variant:"ghost",size:"xs",className:"ms-1 align-middle","data-export-ignore":!0,title:d("terminalView.preview.openTitle"),"aria-label":d("terminalView.preview.open"),onClick:()=>ce.getState().openContextPreview(c,t),children:p.jsx(he,{name:"global",className:"size-3.5"})}),e[93]=c,e[94]=t,e[95]=H,e[96]=d,e[97]=xe):xe=e[97];let Pe;return e[98]!==X||e[99]!==oe||e[100]!==xe?(Pe=p.jsxs(p.Fragment,{children:[X,oe,xe]}),e[98]=X,e[99]=oe,e[100]=xe,e[101]=Pe):Pe=e[101],Pe}function Yi(n){return n.preventDefault()}function Ji(n){return n.openLinksInBrowserPanel}const Qi=()=>mn(()=>import("./MarkdownDiffPreview-CaG-F6-b.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199])).then(n=>n.default),eo=()=>{};function to(n){const e=W.c(7),{source:t,incomplete:r}=n;let s;e[0]!==r||e[1]!==t?(s=!r&&!vr(t),e[0]=r,e[1]=t,e[2]=s):s=e[2];const i=s,a=Sr(i,Qi,eo);let o;return e[3]!==a||e[4]!==i||e[5]!==t?(o=p.jsx("div",{"data-streamdown":"code-block-body","data-language":"diff",children:i&&a?p.jsx(a,{source:t}):p.jsx(Mr,{diff:t})}),e[3]=a,e[4]=i,e[5]=t,e[6]=o):o=e[6],o}const no=k.memo(function(e){const t=W.c(5),{tokens:r}=e,s=r.length===0||r.length===1&&r[0].content==="";let i;t[0]!==s||t[1]!==r?(i=s?`
4
4
  `:r.map(ao),t[0]=s,t[1]=r,t[2]=i):i=t[2];let a;return t[3]!==i?(a=p.jsx("span",{className:"block before:content-[counter(line)] before:[counter-increment:line]",children:i}),t[3]=i,t[4]=a):a=t[4],a}),ro=k.memo(function({source:e,language:t,incomplete:r,plugin:s}){const i=k.useMemo(()=>({code:e,language:t,isIncomplete:r,themes:s.getThemes()}),[e,t,r,s]),a=k.useMemo(()=>s.cached(i),[s,i]),[o,l]=k.useState(null),c=k.useRef(null),d=k.useMemo(()=>{const h=c.current;return h?.plugin===s&&h.input.language===i.language&&i.code.startsWith(h.input.code)?h.lineage:Symbol()},[i,s]),f=k.useMemo(()=>{const h=o?.lineage===d?o:null;if(h?.input===i)return h;if(a)return{input:i,result:a};const u=c.current,m=u?.lineage===d?u.display:null;return h&&(!m||h.input.code.length>=m.input.code.length)?h:m||{input:i,result:{tokens:i.code.split(`
5
5
  `).map(g=>[{content:g}])}}},[i,a,d,o]);return k.useLayoutEffect(()=>(c.current={input:i,plugin:s,lineage:d,display:f,exact:a!==null},()=>{c.current=null}),[i,s,d,f,a]),k.useEffect(()=>{const h=m=>{const g=c.current;g?.lineage!==d||!g.input.code.startsWith(i.code)||g.exact&&g.input!==i||i.code.length<g.display.input.code.length||l(w=>w?.input===g.input&&i!==g.input||w?.lineage===d&&(w.input.code.length>i.code.length||w.input===i&&w.result===m)?w:{input:i,result:m,lineage:d})},u=s.highlight(i,h);u&&h(u)},[s,i,d]),p.jsx("div",{"data-streamdown":"code-block-body","data-language":t,children:p.jsx("pre",{children:p.jsx("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:f.result.tokens.map((h,u)=>p.jsx(no,{tokens:h},u))})})})});function so(n){const e=W.c(66);let t,r,s,i;e[0]!==n?({children:t,className:r,node:s,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i):(t=e[1],r=e[2],s=e[3],i=e[4]);const a=de(),{t:o}=Ne(),l=ce(oo),c=Hr(),d=kt(),[f,h]=k.useState(!1),u=k.useRef(null);let m,g;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=()=>()=>{u.current&&clearTimeout(u.current)},g=[],e[5]=m,e[6]=g):(m=e[5],g=e[6]),k.useEffect(m,g);const w=k.useContext(Cr);let y,x,S;e[7]!==r||e[8]!==w?(y=/language-([^\s]+)/.exec(r??"")?.[1]??"",x=w!==null&&jr(y),S=y.toLowerCase()==="diff"||x,e[7]=r,e[8]=w,e[9]=y,e[10]=x,e[11]=S):(y=e[9],x=e[10],S=e[11]);const v=S;let C,M;if(e[12]!==s?.children){C=s?.children.map(io).join("")??"";let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j=/\n$/,e[15]=j):j=e[15],M=C.replace(j,""),e[12]=s?.children,e[13]=C,e[14]=M}else C=e[13],M=e[14];const b=M,{purpose:E,onExportCode:_}=a;let P,N;if(e[16]!==C||e[17]!==y||e[18]!==_||e[19]!==E?(P=()=>{E&&y!=="mermaid"&&_?.(C,y)},N=[E,_,C,y],e[16]=C,e[17]=y,e[18]=_,e[19]=E,e[20]=P,e[21]=N):(P=e[20],N=e[21]),k.useLayoutEffect(P,N),y==="mermaid"||y==="openui-lang"&&a.uiBlocks){let j;return e[22]!==t||e[23]!==r||e[24]!==s||e[25]!==i?(j=p.jsx(Be.code,{...i,node:s,className:r,children:t}),e[22]=t,e[23]=r,e[24]=s,e[25]=i,e[26]=j):j=e[26],j}let R;e[27]!==d||e[28]!==a.fileNavigation?(R=j=>{if(!a.fileNavigation||!(j.target instanceof Element))return;const D=j.target.closest('[data-openchamber-file-link="true"]'),G=D?.getAttribute("data-openchamber-file-ref");G&&Ue(j,H=>{d(G,D?.getAttribute("data-openchamber-file-path")??void 0,H)})},e[27]=d,e[28]=a.fileNavigation,e[29]=R):R=e[29];const I=R;let O;e[30]!==b?(O=async()=>{(await st(b)).ok&&(h(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>h(!1),2e3))},e[30]=b,e[31]=O):O=e[31];const B=O,Z=l?"true":"false";let L;e[32]!==y||e[33]!==v||e[34]!==x||e[35]!==o?(L=x?o("chat.markdown.suggestion.title"):v?o("markdownRenderer.code.proposal"):y.toLowerCase()||"text",e[32]=y,e[33]=v,e[34]=x,e[35]=o,e[36]=L):L=e[36];let F;e[37]!==L?(F=p.jsx(qr,{language:L}),e[37]=L,e[38]=F):F=e[38];let J;e[39]!==f||e[40]!==B||e[41]!==v||e[42]!==E||e[43]!==o||e[44]!==l?(J=!E&&p.jsx("div",{className:"pointer-events-none absolute top-0 end-0 flex items-center",children:p.jsxs("div",{"data-streamdown":"code-block-actions",className:"pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur",children:[!v&&p.jsx(Ce,{variant:"ghost",size:"xs","data-export-ignore":!0,title:o(l?"markdownRenderer.code.actions.disableWrapTitle":"markdownRenderer.code.actions.enableWrapTitle"),"aria-pressed":l,onClick:()=>ce.getState().setCodeBlockLineWrap(!l),children:p.jsx(he,{name:"text-wrap",className:"size-3.5"})}),p.jsx(Ce,{variant:"ghost",size:"xs","data-export-ignore":!0,title:o(f?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.code.actions.copyTitle"),onClick:B,children:p.jsx(he,{name:f?"check":"file-copy",className:"size-3.5"})})]})}),e[39]=f,e[40]=B,e[41]=v,e[42]=E,e[43]=o,e[44]=l,e[45]=J):J=e[45];let z;e[46]!==b||e[47]!==c||e[48]!==y||e[49]!==a.code||e[50]!==v||e[51]!==E||e[52]!==x||e[53]!==w?(z=v&&!E?p.jsx(to,{source:x?Er(b,w.excerpt):b,incomplete:c}):p.jsx(ro,{source:b,language:y,incomplete:c,plugin:a.code}),e[46]=b,e[47]=c,e[48]=y,e[49]=a.code,e[50]=v,e[51]=E,e[52]=x,e[53]=w,e[54]=z):z=e[54];let $;e[55]!==c||e[56]!==y||e[57]!==F||e[58]!==J||e[59]!==z?($=p.jsxs(Xr,{language:y,isIncomplete:c,dir:"ltr",children:[F,J,z]}),e[55]=c,e[56]=y,e[57]=F,e[58]=J,e[59]=z,e[60]=$):$=e[60];let Q;return e[61]!==b||e[62]!==I||e[63]!==$||e[64]!==Z?(Q=p.jsx("div",{"data-code-wrap":Z,"data-oc-code-source":b,onClick:I,onKeyDown:I,children:$}),e[61]=b,e[62]=I,e[63]=$,e[64]=Z,e[65]=Q):Q=e[65],Q}function io(n){return n.type==="text"?n.value:""}function oo(n){return n.codeBlockLineWrap}function ao(n,e){const t={...n.htmlStyle,color:n.color,backgroundColor:n.bgColor};return p.jsx("span",{style:t,...n.htmlAttrs,children:n.content},e)}const lo=["csv","tsv","md"],co=["csv","md"],Wt=n=>n==="md"?"Markdown":n.toUpperCase(),Ut=n=>n.replace(/\\/g,"\\\\").replace(/\|/g,"\\|"),In=k.createContext(new Map);function Bt(n){const e=W.c(12);let t,r,s;e[0]!==n?({node:t,style:s,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);const i=k.useContext(In),a=t?i.get(t):void 0,o=t?.tagName==="th"?Be.th:Be.td,l=a?"normal":"nowrap";let c;e[4]!==s||e[5]!==l?(c={...s,"--oc-table-code-wrap":l},e[4]=s,e[5]=l,e[6]=c):c=e[6];const d=c;let f;return e[7]!==o||e[8]!==d||e[9]!==t||e[10]!==r?(f=p.jsx(o,{...r,node:t,style:d}),e[7]=o,e[8]=d,e[9]=t,e[10]=r,e[11]=f):f=e[11],f}const Ye=120,uo=280;function fo(n,e,t){const r=n.map(a=>Math.min(Math.max(Ye,e||320),a));if(!t||e<=0)return r;let s=r.map((a,o)=>o),i=e;for(;s.length;){const a=i/s.length,o=s.filter(l=>r[l]<=a);if(!o.length){const l=a<Ye?uo:Math.floor(a);for(const c of s)r[c]=Math.max(Math.min(Ye,n[c]),Math.min(n[c],l));break}for(const l of o)i-=r[l];s=s.filter(l=>r[l]>a)}return r}function ho(n,e){const t=e.ownerDocument.createElement("div");t.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden";const r=n.map(a=>{const o=a.ownerDocument.createElement(a.localName);for(const{name:l,value:c}of Array.from(a.attributes))o.setAttribute(l,c);return o.append(...Array.from(a.childNodes,l=>l.cloneNode(!0))),o.style.cssText="display:block;width:max-content",t.append(o),o});e.append(t);const s=r.map(a=>a.getBoundingClientRect().width);for(const a of r)a.style.width="min-content";const i=r.map((a,o)=>Math.ceil(Math.max(Math.min(s[o],Ye),a.getBoundingClientRect().width))+1);return t.remove(),i}function Ln(n,e){if(n.nodeType===Node.TEXT_NODE){const t=n.textContent??"";return e?Ut(t):t}if(n instanceof HTMLAnchorElement){const t=n.getAttribute("href");if(t){const r=t.replace(/ /g,"%20");if(!e)return r;const s=Ut(n.textContent??"").replace(/\[/g,"\\[").replace(/\]/g,"\\]"),i=r.replace(/\|/g,"%7C"),a=/[()]/.test(i)?`<${i.replace(/</g,"%3C").replace(/>/g,"%3E")}>`:i;return`[${s}](${a})`}}return Array.from(n.childNodes).map(t=>Ln(t,e)).join("")}function Kt(n,e){const t=Array.from(n.rows).map(s=>Array.from(s.cells).map(i=>Ln(i,e==="md").trim())),r={headers:t[0]??[],rows:t.slice(1)};return e==="csv"?Zr(r):e==="tsv"?Gr(r):[r.headers,r.headers.map(()=>"---"),...r.rows].map(s=>`| ${s.join(" | ")} |`).join(`
6
6
  `)}function mo(n){const e=W.c(56);let t,r,s,i;e[0]!==n?({node:s,className:r,children:t,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i):(t=e[1],r=e[2],s=e[3],i=e[4]);const{purpose:a,settled:o}=de(),l=ce(bo),c=k.useRef(null),d=k.useRef(null),[f,h]=k.useState(null),u=f?.node===s?f:null;let m,g;e[5]!==u||e[6]!==s||e[7]!==o?(m=()=>{const H=c.current,ee=d.current?.parentElement;if(!H||!ee||!o)return;const U=H.ownerDocument.defaultView;if(!U)return;const X=()=>{const T=U.getComputedStyle(ee),K=Math.max(0,ee.clientWidth-(parseFloat(T.paddingInlineStart)||0)-(parseFloat(T.paddingInlineEnd)||0)-2),te=U.getComputedStyle(H).font;if(u&&u.font!==te){h(null);return}if(u){u.available!==K&&h({...u,available:K});return}if(K<=0)return;const V=[],re=Array.from(H.rows),se=re.filter(xo);for(const ie of se.length?se:re)Array.from(ie.cells).forEach((Y,oe)=>{V[oe]=Math.max(V[oe]??0,Math.ceil(Y.getBoundingClientRect().width))});const ae=re.find(yo),le=ae?Array.from(ae.cells):[];se.length&&le.length&&H.parentElement&&ho(le,H.parentElement).forEach((ie,Y)=>{V[Y]=Math.max(V[Y]??0,ie)}),h({node:s,natural:V,available:K,font:te})};X();const A=new ResizeObserver(X);return A.observe(ee),()=>A.disconnect()},g=[s,u,o],e[5]=u,e[6]=s,e[7]=o,e[8]=m,e[9]=g):(m=e[8],g=e[9]),k.useLayoutEffect(m,g);let w;e[10]!==u||e[11]!==l?(w=u?fo(u.natural,u.available,l):null,e[10]=u,e[11]=l,e[12]=w):w=e[12];const y=w;let x;e[13]!==y?(x=y?.map(wo),e[13]=y,e[14]=x):x=e[14];const S=x;let v;e[15]!==u||e[16]!==y?(v=y&&u?y.map((H,ee)=>u.natural[ee]>H?"1":"0").join(""):"",e[15]=u,e[16]=y,e[17]=v):v=e[17];const C=v;let M;if(e[18]!==C||e[19]!==s?.children){M=new Map;for(const H of s?.children??[])if(H.type==="element")for(const ee of H.children){if(ee.type!=="element"||ee.tagName!=="tr")continue;ee.children.filter(go).forEach((X,A)=>M.set(X,C[A]==="1"))}e[18]=C,e[19]=s?.children,e[20]=M}else M=e[20];const b=M,[E,_]=k.useState(!1),P=k.useRef(null),{t:N}=Ne();let R,I;e[21]===Symbol.for("react.memo_cache_sentinel")?(R=()=>()=>{P.current&&clearTimeout(P.current)},I=[],e[21]=R,e[22]=I):(R=e[21],I=e[22]),k.useEffect(R,I);let O,B,Z,L,F;if(e[23]!==E||e[24]!==a||e[25]!==N||e[26]!==l){const H=async U=>{!c.current||!(await st(Kt(c.current,U))).ok||(_(!0),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>_(!1),2e3))},ee=U=>{const X=c.current;if(!X)return;const A=URL.createObjectURL(new Blob([Kt(X,U)],{type:U==="csv"?"text/csv;charset=utf-8":"text/markdown;charset=utf-8"})),T=document.createElement("a");T.href=A,T.download=`table.${U}`,T.click(),URL.revokeObjectURL(A)};L=d,F="table-wrapper",O=l?"true":"false",B="group flex flex-col",Z=!a&&p.jsxs("div",{"data-streamdown":"table-controls","data-export-ignore":!0,className:"flex items-center justify-end gap-1",children:[p.jsx(Ce,{variant:"ghost",size:"xs",title:N(l?"markdownRenderer.table.actions.disableWrapTitle":"markdownRenderer.table.actions.enableWrapTitle"),"aria-pressed":l,onClick:()=>ce.getState().setTableCellWrap(!l),children:p.jsx(he,{name:"text-wrap",className:"size-3.5"})}),p.jsxs(Rt,{children:[p.jsx(Nt,{asChild:!0,children:p.jsx(Ce,{variant:"ghost",size:"xs",title:N(E?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.table.actions.copyTitle"),children:p.jsx(he,{name:E?"check":"file-copy",className:"size-3.5"})})}),p.jsx(Pt,{align:"end",children:lo.map(U=>p.jsx(_t,{onSelect:()=>{H(U)},children:Wt(U)},U))})]}),p.jsxs(Rt,{children:[p.jsx(Nt,{asChild:!0,children:p.jsx(Ce,{variant:"ghost",size:"xs",title:N("markdownRenderer.table.actions.downloadTitle"),children:p.jsx(he,{name:"download",className:"size-3.5"})})}),p.jsx(Pt,{align:"end",children:co.map(U=>p.jsx(_t,{onSelect:()=>ee(U),children:Wt(U)},U))})]})]}),e[23]=E,e[24]=a,e[25]=N,e[26]=l,e[27]=O,e[28]=B,e[29]=Z,e[30]=L,e[31]=F}else O=e[27],B=e[28],Z=e[29],L=e[30],F=e[31];const J=y?"fixed":o?"natural":"pending";let z;e[32]!==i.style||e[33]!==y?(z=y?{...i.style,width:y.reduce(po,0),tableLayout:"fixed"}:i.style,e[32]=i.style,e[33]=y,e[34]=z):z=e[34];let $;e[35]!==r?($=Qe("border-collapse",r),e[35]=r,e[36]=$):$=e[36];let Q;e[37]!==S?(Q=S&&p.jsx("colgroup",{children:S}),e[37]=S,e[38]=Q):Q=e[38];let j;e[39]!==b||e[40]!==t?(j=p.jsx(In.Provider,{value:b,children:t}),e[39]=b,e[40]=t,e[41]=j):j=e[41];let D;e[42]!==i||e[43]!==J||e[44]!==z||e[45]!==$||e[46]!==Q||e[47]!==j?(D=p.jsx(Rr,{outerClassName:"overlay-scrollbar-wrapper--no-gutter min-w-0",fillContainer:!1,children:p.jsxs("table",{...i,ref:c,"data-streamdown":"table","data-oc-table-layout":J,style:z,className:$,children:[Q,j]})}),e[42]=i,e[43]=J,e[44]=z,e[45]=$,e[46]=Q,e[47]=j,e[48]=D):D=e[48];let G;return e[49]!==O||e[50]!==B||e[51]!==Z||e[52]!==D||e[53]!==L||e[54]!==F?(G=p.jsxs("div",{ref:L,"data-streamdown":F,"data-table-wrap":O,className:B,children:[Z,D]}),e[49]=O,e[50]=B,e[51]=Z,e[52]=D,e[53]=L,e[54]=F,e[55]=G):G=e[55],G}function po(n,e){return n+e}function go(n){return n.type==="element"}function wo(n,e){return p.jsx("col",{style:{width:n}},e)}function yo(n){return n.parentElement?.tagName==="THEAD"}function xo(n){return n.parentElement?.tagName==="TBODY"}function bo(n){return n.tableCellWrap}const ne=n=>Number.isFinite(n)&&n>0,Vt=n=>{if(n==null)return null;const e=String(n).trim().match(/^([+-]?(?:(?:\d+\.?\d*)|(?:\.\d+))(?:[eE][+-]?\d+)?)(?:px)?$/);if(!e)return null;const t=Number(e[1]);return ne(t)?t:null},it=(n,e,t)=>Math.min(t,Math.max(e,n)),ko=6,Ht=1.25,vo=1.0015,So=.5,Mo=12,qt=3,Co=400,Eo='[data-streamdown="mermaid-block"]',Xt=n=>[n.x,n.y,n.width,n.height].map(e=>{const t=Number(e.toFixed(ko));return Object.is(t,-0)?"0":String(t)}).join(" "),jo=n=>{const e=n.viewBox?.trim().split(/[\s,]+/).map(s=>Number.parseFloat(s));if(e?.length===4){const[s,i,a,o]=e;if(Number.isFinite(s)&&Number.isFinite(i)&&ne(a)&&ne(o))return{x:s,y:i,width:a,height:o}}const t=Vt(n.width),r=Vt(n.height);return t===null||r===null?null:{x:0,y:0,width:t,height:r}},Tn=(n,e)=>{if(!ne(e.width)||!ne(e.height))return n;const t=n.width/n.height,r=e.width/e.height;if(t>r){const i=n.width/r;return{x:n.x,y:n.y-(i-n.height)/2,width:n.width,height:i}}const s=n.height*r;return{x:n.x-(s-n.width)/2,y:n.y,width:s,height:n.height}},Ro=({currentBox:n,viewport:e,delta:t})=>!ne(e.width)||!ne(e.height)||!ne(n.width)||!ne(n.height)?n:{x:n.x-t.x/e.width*n.width,y:n.y-t.y/e.height*n.height,width:n.width,height:n.height},No=(n,e)=>{const t=e.x-n.x,r=e.y-n.y;return t*t+r*r>qt*qt},ot=n=>{const[e,t]=n;return!e||!t?null:{distance:Math.hypot(t.x-e.x,t.y-e.y),center:{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}},Po=({currentBox:n,contentBox:e,viewport:t,pointer:r,zoomFactor:s,minScale:i,maxScale:a})=>{if(!ne(t.width)||!ne(t.height)||!ne(s)||!ne(n.width)||!ne(n.height)||!ne(e.width)||!ne(e.height)||!ne(i)||!ne(a))return n;const o=Math.min(i,a),l=Math.max(i,a),c=Tn(e,t),d=c.width/n.width,f=it(d*s,o,l),h=c.width/f,u=h/(n.width/n.height),m=it(r.x/t.width,0,1),g=it(r.y/t.height,0,1),w=n.x+m*n.width,y=n.y+g*n.height;return{x:w-m*h,y:y-g*u,width:h,height:u}},vt=new WeakMap,Re=new Set;let Se=null,Te=null;const $e=new Set;let Me=null;const _o=n=>{$e.add(n),Me===null&&(Me=window.requestAnimationFrame(()=>{Me=window.requestAnimationFrame(()=>{Me=null;const e=Array.from($e);$e.clear(),$n(e);for(const t of e)On(t)})}))},Zt=n=>{$e.delete(n),$e.size===0&&Me!==null&&(window.cancelAnimationFrame(Me),Me=null)},Ao=n=>n.querySelector('[data-streamdown="mermaid-viewport"]')??n.querySelector('[data-streamdown="mermaid"]'),Le=n=>{const e=n.getBoundingClientRect();return{width:e.width,height:e.height}},Gt=(n,e)=>{const t=e.getBoundingClientRect();return{x:n.clientX-t.left,y:n.clientY-t.top}},Io=n=>n instanceof Element&&!!n.closest('button, a, [role="button"]'),$n=n=>{const e=n.map(t=>Le(t.viewport));n.forEach((t,r)=>{const s=e[r];s&&t.fitToViewport(s)})},Fn=()=>{Te!==null||Re.size===0||(Te=window.requestAnimationFrame(()=>{Te=null,$n(Array.from(Re))}))},Lo=()=>{if(Se)return Se;const n=globalThis.ResizeObserver;return n?(Se=new n(e=>{for(const t of e)t.target instanceof HTMLElement&&vt.get(t.target)?.fitToViewport({width:t.contentRect.width,height:t.contentRect.height})}),Se):null},On=n=>{if(Re.has(n))return;const e=Re.size===0;Re.add(n),vt.set(n.viewport,n),Lo()?.observe(n.viewport),e&&window.addEventListener("resize",Fn)},To=n=>{Re.delete(n)&&(Se?.unobserve(n.viewport),vt.delete(n.viewport),!(Re.size>0)&&(Se?.disconnect(),Se=null,window.removeEventListener("resize",Fn),Te!==null&&(window.cancelAnimationFrame(Te),Te=null)))},$o=n=>{const e=Ao(n),t=n.querySelector('[data-streamdown="mermaid"] svg');if(!e||!t)return null;const r=jo({viewBox:t.getAttribute("data-oc-mermaid-original-viewbox")??t.getAttribute("viewBox"),width:t.getAttribute("width"),height:t.getAttribute("height")});if(!r)return t.setAttribute("data-oc-mermaid-fitted",""),null;t.setAttribute("data-oc-mermaid-original-viewbox",Xt(r));let s=r,i=null,a=null,o=null,l=null;const c=new Map;let d=null;const f=b=>{s=b,t.setAttribute("viewBox",Xt(b)),t.removeAttribute("width"),t.removeAttribute("height")},h=b=>{!ne(b.width)||!ne(b.height)||(f(Tn(r,b)),t.setAttribute("data-oc-mermaid-fitted",""))},u=()=>{Zt(M),h(Le(e)),On(M)},m=()=>{$e.has(M)&&u()},g=(b,E)=>{m(),f(Po({currentBox:s,contentBox:r,viewport:Le(e),pointer:b,zoomFactor:E,minScale:So,maxScale:Mo}))},w=()=>{const b=Le(e);g({x:b.width/2,y:b.height/2},Ht)},y=()=>{const b=Le(e);g({x:b.width/2,y:b.height/2},1/Ht)},x=b=>{!b.ctrlKey&&!b.metaKey||(b.preventDefault(),b.stopPropagation(),g(Gt(b,e),Math.pow(vo,-b.deltaY)))},S=b=>{if(!(b.button!==0||Io(b.target))){if(m(),b.isPrimary&&(c.clear(),d=null),c.set(b.pointerId,{x:b.clientX,y:b.clientY}),c.size>1){i=null,d=ot(Array.from(c.values()))?.distance??null,e.setPointerCapture?.(b.pointerId),n.setAttribute("data-mermaid-suppress-click","true"),b.preventDefault();return}i=b.pointerId,a={x:b.clientX,y:b.clientY},o=a,l!==null&&(window.clearTimeout(l),l=null),n.removeAttribute("data-mermaid-suppress-click"),e.setPointerCapture?.(b.pointerId),n.setAttribute("data-mermaid-panning","true"),b.preventDefault()}},v=b=>{const E={x:b.clientX,y:b.clientY};if(d!==null&&c.has(b.pointerId)){c.set(b.pointerId,E);const _=ot(Array.from(c.values()));if(_){const P=Gt({clientX:_.center.x,clientY:_.center.y},e);g(P,_.distance/d),d=_.distance}b.preventDefault();return}i!==b.pointerId||!o||(f(Ro({currentBox:s,viewport:Le(e),delta:{x:E.x-o.x,y:E.y-o.y}})),o=E,a&&No(a,E)&&n.setAttribute("data-mermaid-suppress-click","true"),b.preventDefault())},C=b=>{if(c.delete(b.pointerId)){if(e.releasePointerCapture?.(b.pointerId),c.size>0){i=null,d=c.size>1?ot(Array.from(c.values()))?.distance??null:null;return}d=null,i=null,a=null,o=null,n.removeAttribute("data-mermaid-panning"),n.hasAttribute("data-mermaid-suppress-click")&&(l=window.setTimeout(()=>{n.removeAttribute("data-mermaid-suppress-click"),l=null},Co))}};e.addEventListener("wheel",x,{passive:!1}),e.addEventListener("pointerdown",S),e.addEventListener("pointermove",v),e.addEventListener("pointerup",C),e.addEventListener("pointercancel",C);const M={viewport:e,zoomIn:w,zoomOut:y,fit:u,fitToViewport:h,cleanup:()=>{Zt(M),To(M),e.removeEventListener("wheel",x),e.removeEventListener("pointerdown",S),e.removeEventListener("pointermove",v),e.removeEventListener("pointerup",C),e.removeEventListener("pointercancel",C),l!==null&&window.clearTimeout(l),c.clear(),n.removeAttribute("data-mermaid-panning"),n.removeAttribute("data-mermaid-suppress-click")}};return _o(M),M},ve=new Map,Fo={bg:"var(--surface-elevated)",fg:"var(--surface-foreground)",line:"var(--surface-muted-foreground)",accent:"var(--primary-base)",muted:"var(--surface-muted-foreground)",surface:"var(--surface-muted)",border:"var(--interactive-border)"};function Oo(n,e){const t=`${e}:${n}`,r=ve.get(t);if(r)return ve.delete(t),ve.set(t,r),r;let s;try{s=e==="ascii"?{ascii:hs(n)}:{svg:ms(n,{...Fo,transparent:!0,font:"system-ui, sans-serif"})}}catch{s={}}if(ve.set(t,s),ve.size>100){const i=ve.keys().next().value;i!==void 0&&ve.delete(i)}return s}const Do=k.memo(function(e){const t=W.c(5),{svg:r,viewer:s}=e,i=s?"":void 0;let a;t[0]!==r?(a={__html:r},t[0]=r,t[1]=a):a=t[1];let o;return t[2]!==i||t[3]!==a?(o=p.jsx("div",{"data-streamdown":"mermaid","data-oc-mermaid-viewer":i,dangerouslySetInnerHTML:a}),t[2]=i,t[3]=a,t[4]=o):o=t[4],o});function zo(n){const e=W.c(70),{code:t,isIncomplete:r}=n,{theme:s,purpose:i,mermaidControls:a,onShowPopup:o}=de(),l=ce(Wo),{t:c}=Ne(),d=k.useRef(null),f=k.useRef(null),[h,u]=k.useState(!1),m=k.useRef(null);let g;e[0]!==t?(g=t.trimEnd(),e[0]=t,e[1]=g):g=e[1];const w=g;let y;e[2]!==r||e[3]!==l||e[4]!==w?(y=r?null:Oo(w,l),e[2]=r,e[3]=l,e[4]=w,e[5]=y):y=e[5];const x=y,S=x?.svg,v=x?.ascii||w;let C,M;e[6]!==i||e[7]!==S?(C=()=>{if(!d.current||!S||i)return;const T=$o(d.current);return f.current=T,()=>{T?.cleanup(),f.current=null}},M=[S,i],e[6]=i,e[7]=S,e[8]=C,e[9]=M):(C=e[8],M=e[9]),k.useEffect(C,M);let b,E;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=()=>()=>{m.current&&clearTimeout(m.current)},E=[],e[10]=b,e[11]=E):(b=e[10],E=e[11]),k.useEffect(b,E);let _;e[12]!==S||e[13]!==s.colors.interactive.border||e[14]!==s.colors.primary.base||e[15]!==s.colors.surface.elevated||e[16]!==s.colors.surface.foreground||e[17]!==s.colors.surface.muted||e[18]!==s.colors.surface.mutedForeground?(_=()=>{const T={"var(--surface-elevated)":s.colors.surface.elevated,"var(--surface-foreground)":s.colors.surface.foreground,"var(--surface-muted-foreground)":s.colors.surface.mutedForeground,"var(--primary-base)":s.colors.primary.base,"var(--surface-muted)":s.colors.surface.muted,"var(--interactive-border)":s.colors.interactive.border};let K=S??"";for(const[te,V]of Object.entries(T))K=K.replaceAll(te,V);return K},e[12]=S,e[13]=s.colors.interactive.border,e[14]=s.colors.primary.base,e[15]=s.colors.surface.elevated,e[16]=s.colors.surface.foreground,e[17]=s.colors.surface.muted,e[18]=s.colors.surface.mutedForeground,e[19]=_):_=e[19];const P=_;let N;e[20]!==o||e[21]!==i||e[22]!==w||e[23]!==c?(N=T=>{if(i||!o||!w||!(T.target instanceof Element)||T.target.closest('button, a, [role="button"]'))return;const K=d.current;if(!K)return;if(K.hasAttribute("data-mermaid-suppress-click")){K.removeAttribute("data-mermaid-suppress-click");return}const te=Array.from(K.closest("[data-markdown-content]")?.querySelectorAll(Eo)??[]),V=`${c("layout.mainTab.diagram")} ${te.indexOf(K)+1}`;o({open:!0,title:V,content:"",metadata:{tool:"mermaid-preview",filename:V},mermaid:{source:w,url:`data:text/plain;charset=utf-8,${encodeURIComponent(w)}`,filename:V}})},e[20]=o,e[21]=i,e[22]=w,e[23]=c,e[24]=N):N=e[24];const R=N;let I;e[25]!==w||e[26]!==S||e[27]!==v?(I=async()=>{(await st(S?w:v)).ok&&(u(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>u(!1),2e3))},e[25]=w,e[26]=S,e[27]=v,e[28]=I):I=e[28];const O=I;let B;e[29]!==P||e[30]!==S?(B=()=>{if(!S)return;const T=URL.createObjectURL(new Blob([P()],{type:"image/svg+xml;charset=utf-8"})),K=document.createElement("a");K.href=T,K.download="diagram.svg",K.click(),URL.revokeObjectURL(T)},e[29]=P,e[30]=S,e[31]=B):B=e[31];const Z=B,L=a.showPanZoomControls&&!!S,F=a.download&&!!S,J=!i&&(L||a.copy||F);let z;e[32]!==L||e[33]!==c?(z=L&&p.jsxs(p.Fragment,{children:[p.jsx(De,{label:c("markdownRenderer.mermaid.actions.zoomInTitle"),icon:"zoom-in",onClick:()=>f.current?.zoomIn()}),p.jsx(De,{label:c("markdownRenderer.mermaid.actions.zoomOutTitle"),icon:"zoom-out",onClick:()=>f.current?.zoomOut()}),p.jsx(De,{label:c("markdownRenderer.mermaid.actions.resetViewTitle"),icon:"focus-3",onClick:()=>f.current?.fit()})]}),e[32]=L,e[33]=c,e[34]=z):z=e[34];let $;e[35]!==a.copy||e[36]!==h||e[37]!==O||e[38]!==c?($=a.copy&&p.jsx(De,{label:c(h?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.mermaid.actions.copyTitle"),icon:"file-copy",done:h,onClick:()=>{O()}}),e[35]=a.copy,e[36]=h,e[37]=O,e[38]=c,e[39]=$):$=e[39];let Q;e[40]!==F||e[41]!==Z||e[42]!==c?(Q=F&&p.jsx(De,{label:c("markdownRenderer.mermaid.actions.downloadSvgTitle"),icon:"download",onClick:Z}),e[40]=F,e[41]=Z,e[42]=c,e[43]=Q):Q=e[43];let j;e[44]!==z||e[45]!==$||e[46]!==Q?(j=p.jsxs(p.Fragment,{children:[z,$,Q]}),e[44]=z,e[45]=$,e[46]=Q,e[47]=j):j=e[47];const D=j;let G;e[48]!==D||e[49]!==a.toolbarSlot||e[50]!==J?(G=J&&a.toolbarSlot?Bn.createPortal(D,a.toolbarSlot):null,e[48]=D,e[49]=a.toolbarSlot,e[50]=J,e[51]=G):G=e[51];let H;e[52]!==D||e[53]!==a.toolbarSlot||e[54]!==J?(H=J&&!a.toolbarSlot&&p.jsx("div",{"data-streamdown":"mermaid-toolbar","data-export-ignore":!0,className:"flex h-6 items-center justify-end gap-0.5 opacity-0 transition-opacity duration-150 focus-within:opacity-100 group-hover/mermaid:opacity-100 pointer-coarse:opacity-100",children:D}),e[52]=D,e[53]=a.toolbarSlot,e[54]=J,e[55]=H):H=e[55];const ee=S?"svg":"ascii";let U;e[56]!==P||e[57]!==i||e[58]!==S||e[59]!==v?(U=p.jsx("div",{"data-streamdown":"mermaid-scroll",children:S?p.jsx("div",{"data-streamdown":"mermaid-viewport",children:p.jsx(Do,{svg:i?P():S,viewer:!i})}):p.jsx("pre",{"data-streamdown":"mermaid-ascii",children:v})}),e[56]=P,e[57]=i,e[58]=S,e[59]=v,e[60]=U):U=e[60];let X;e[61]!==R||e[62]!==w||e[63]!==ee||e[64]!==U?(X=p.jsx("div",{ref:d,dir:"ltr","data-streamdown":"mermaid-block","data-oc-mermaid-source":w,"data-mermaid-render":ee,onClick:R,children:U}),e[61]=R,e[62]=w,e[63]=ee,e[64]=U,e[65]=X):X=e[65];let A;return e[66]!==G||e[67]!==H||e[68]!==X?(A=p.jsxs("div",{"data-streamdown":"mermaid-frame",className:"group/mermaid",children:[G,H,X]}),e[66]=G,e[67]=H,e[68]=X,e[69]=A):A=e[69],A}function Wo(n){return n.mermaidRenderingMode}function Uo(n){const e=W.c(8),{code:t,isIncomplete:r}=n,{uiBlockReply:s,directory:i}=de(),a=Nr();if(!a){let d;return e[0]!==t?(d=p.jsx("pre",{dir:"ltr",children:p.jsx("code",{children:t})}),e[0]=t,e[1]=d):d=e[1],d}const o=!r,l=i??"";let c;return e[2]!==a||e[3]!==t||e[4]!==o||e[5]!==l||e[6]!==s?(c=p.jsx(a,{code:t,complete:o,reply:s,directory:l}),e[2]=a,e[3]=t,e[4]=o,e[5]=l,e[6]=s,e[7]=c):c=e[7],c}const Bo={note:"information",tip:"lightbulb",important:"feedback",warning:"alert",caution:"error-warning"},Ko={note:"chat.markdown.alert.note",tip:"chat.markdown.alert.tip",important:"chat.markdown.alert.important",warning:"chat.markdown.alert.warning",caution:"chat.markdown.alert.caution"},Vo=n=>{const e=W.c(31);let t,r,s;e[0]!==n?({node:r,children:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);const{t:i}=Ne();let a,o,l,c,d;if(e[4]!==t||e[5]!==r?.properties.dataOcAlert||e[6]!==s){d=Symbol.for("react.early_return_sentinel");e:{if(a=yn(r?.properties.dataOcAlert),!a){let x;e[12]!==t||e[13]!==s?(x=p.jsx("blockquote",{...s,dir:"auto",children:t}),e[12]=t,e[13]=s,e[14]=x):x=e[14],d=x;break e}l=s,c="auto",o=a.toUpperCase()}e[4]=t,e[5]=r?.properties.dataOcAlert,e[6]=s,e[7]=a,e[8]=o,e[9]=l,e[10]=c,e[11]=d}else a=e[7],o=e[8],l=e[9],c=e[10],d=e[11];if(d!==Symbol.for("react.early_return_sentinel"))return d;const f=Bo[a];let h;e[15]!==f?(h=p.jsx(he,{name:f,className:"size-4 shrink-0"}),e[15]=f,e[16]=h):h=e[16];const u=Ko[a];let m;e[17]!==i||e[18]!==u?(m=i(u),e[17]=i,e[18]=u,e[19]=m):m=e[19];let g;e[20]!==m?(g=p.jsx("span",{children:m}),e[20]=m,e[21]=g):g=e[21];let w;e[22]!==o||e[23]!==h||e[24]!==g?(w=p.jsxs("p",{"data-oc-alert-title":o,children:[h,g]}),e[22]=o,e[23]=h,e[24]=g,e[25]=w):w=e[25];let y;return e[26]!==t||e[27]!==w||e[28]!==l||e[29]!==c?(y=p.jsxs("blockquote",{...l,dir:c,children:[w,t]}),e[26]=t,e[27]=w,e[28]=l,e[29]=c,e[30]=y):y=e[30],y},Ho="openchamber-md",Je={background:"transparent",foreground:"var(--md-syntax-foreground)",comment:"var(--md-syntax-comment)",keyword:"var(--md-syntax-keyword)",string:"var(--md-syntax-string)",number:"var(--md-syntax-number)",function:"var(--md-syntax-function)",variable:"var(--md-syntax-variable)",type:"var(--md-syntax-type)",operator:"var(--md-syntax-operator)"},qo=Object.fromEntries(Object.keys(Pr({base:Je})).map(n=>[n,`var(--md-token-${n})`])),Yt={name:Ho,colors:{"editor.background":"transparent","editor.foreground":Je.foreground},tokenColors:[...ps({base:Je,tokens:qo}),{scope:["markup.bold","punctuation.definition.bold"],settings:{fontStyle:"bold"}},{scope:["markup.italic","punctuation.definition.italic"],settings:{fontStyle:"italic"}},{scope:["markup.heading","markup.heading entity.name"],settings:{foreground:Je.keyword,fontStyle:"bold"}},{scope:["markup.inserted","punctuation.definition.inserted"],settings:{foreground:"var(--md-syntax-inserted)"}},{scope:["markup.deleted","punctuation.definition.deleted","invalid","invalid.illegal"],settings:{foreground:"var(--md-syntax-deleted)"}}]};function Xo(n){n=n.map(a=>{const o=[];for(const l of a){const c=o.at(-1);c&&/^\s+$/.test(c.content)&&c.offset+c.content.length===l.offset&&c.bgColor===l.bgColor&&(c.fontStyle??0)===(l.fontStyle??0)&&!((l.fontStyle??0)&12)?o[o.length-1]={...l,offset:c.offset,content:c.content+l.content}:o.push(l)}return o});const e=new Uint32Array(n.length+1),t=new Uint32Array(n.reduce((a,o)=>a+o.length,0)*3),r=[],s=new Map;let i=0;return n.forEach((a,o)=>{e[o]=i;for(const l of a){const c=Math.max(0,l.fontStyle??0),d=JSON.stringify([l.color,l.bgColor,c]);let f=s.get(d);f===void 0&&(f=r.length,s.set(d,f),r.push({color:l.color,bgColor:l.bgColor,fontStyle:c})),t[i++]=l.offset,t[i++]=l.content.length,t[i++]=f}}),e[n.length]=i,{lines:e,spans:t,styles:r}}function at(n,e){const{lines:t,spans:r}=e,s=e.styles.map(({color:a,bgColor:o,fontStyle:l})=>{const c={};return l&1&&(c.fontStyle="italic"),l&2&&(c.fontWeight="bold"),l&12&&(c.textDecoration=[l&4?"underline":"",l&8?"line-through":""].filter(Boolean).join(" ")),{color:a,bgColor:o,htmlStyle:c}}),i=[];for(let a=0;a<t.length-1;a++){const o=[];for(let l=t[a];l<t[a+1];l+=3){const c=r[l];o.push({...s[r[l+2]],offset:c,content:n.slice(c,c+r[l+1])})}i.push(o)}return{tokens:i}}const Jt=(n,e)=>`highlight:${e}:${Fr(n)}`;function Qt(n,e){if(e.startsWith(n.code))return n.result.tokens.length-1;const t=Math.min(n.code.length,e.length);let r=0,s=0;for(;r<t&&n.code.charCodeAt(r)===e.charCodeAt(r);)e[r]===`