@moonshot-ai/kimi-code 0.31.1 → 0.32.0

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 (69) hide show
  1. package/dist/main.mjs +14072 -4202
  2. package/dist-web/assets/{CodeBlockNode-DxKllCdY.js → CodeBlockNode-CWRAiwpN.js} +2 -2
  3. package/dist-web/assets/DesignSystemView-BLkRtARQ.css +1 -0
  4. package/dist-web/assets/DesignSystemView-CSgrXT8-.js +13 -0
  5. package/dist-web/assets/{Tooltip-CLzA0dLY.js → Tooltip-C_9C69n1.js} +1 -1
  6. package/dist-web/assets/{arc-L6XgwaeB.js → arc-CaIZENoz.js} +1 -1
  7. package/dist-web/assets/{architectureDiagram-3BPJPVTR-DEkKXknP.js → architectureDiagram-3BPJPVTR-Dt-lfduX.js} +1 -1
  8. package/dist-web/assets/{blockDiagram-GPEHLZMM-CDbS9yI1.js → blockDiagram-GPEHLZMM-BaAQL6lt.js} +1 -1
  9. package/dist-web/assets/{c4Diagram-AAUBKEIU-DtO_U08K.js → c4Diagram-AAUBKEIU-2vAWC6pd.js} +1 -1
  10. package/dist-web/assets/channel-Mifv9lsN.js +1 -0
  11. package/dist-web/assets/{chunk-2J33WTMH-Bmvll7Mb.js → chunk-2J33WTMH-Bnq66mZS.js} +1 -1
  12. package/dist-web/assets/{chunk-4BX2VUAB-DTAOb1Kz.js → chunk-4BX2VUAB-Cy6uIY_i.js} +1 -1
  13. package/dist-web/assets/{chunk-55IACEB6-B-8C29Gy.js → chunk-55IACEB6-ee0SSPyA.js} +1 -1
  14. package/dist-web/assets/{chunk-727SXJPM-B_col3ZF.js → chunk-727SXJPM-avqimpaN.js} +1 -1
  15. package/dist-web/assets/{chunk-AQP2D5EJ-TC4DTyYP.js → chunk-AQP2D5EJ-8ZS5m44x.js} +1 -1
  16. package/dist-web/assets/{chunk-FMBD7UC4-B7DtFL7B.js → chunk-FMBD7UC4-3BEn4jzp.js} +1 -1
  17. package/dist-web/assets/{chunk-ND2GUHAM-C3emWcK-.js → chunk-ND2GUHAM-XiHpA5bu.js} +1 -1
  18. package/dist-web/assets/{chunk-QZHKN3VN-GMC4JHFn.js → chunk-QZHKN3VN-BIuWoUAy.js} +1 -1
  19. package/dist-web/assets/classDiagram-4FO5ZUOK-CcoZYTpn.js +1 -0
  20. package/dist-web/assets/classDiagram-v2-Q7XG4LA2-CcoZYTpn.js +1 -0
  21. package/dist-web/assets/{cose-bilkent-S5V4N54A-CcDRV2Eg.js → cose-bilkent-S5V4N54A-DFifExT3.js} +1 -1
  22. package/dist-web/assets/{dagre-BM42HDAG-CAPDvTOf.js → dagre-BM42HDAG-CH8TYIoN.js} +1 -1
  23. package/dist-web/assets/{diagram-2AECGRRQ-BnpT8dB4.js → diagram-2AECGRRQ-BNWQjl8Q.js} +1 -1
  24. package/dist-web/assets/{diagram-5GNKFQAL-Cx0MS5ma.js → diagram-5GNKFQAL-CoKDKOTB.js} +1 -1
  25. package/dist-web/assets/{diagram-KO2AKTUF-E1kGutBk.js → diagram-KO2AKTUF-COFrQzDL.js} +1 -1
  26. package/dist-web/assets/{diagram-LMA3HP47-BHRVZsCe.js → diagram-LMA3HP47-D56uag-b.js} +1 -1
  27. package/dist-web/assets/{diagram-OG6HWLK6-zaiP7eEP.js → diagram-OG6HWLK6-NQsHdLkK.js} +1 -1
  28. package/dist-web/assets/{erDiagram-TEJ5UH35-CxeNDv-0.js → erDiagram-TEJ5UH35-Bm0b6CWK.js} +1 -1
  29. package/dist-web/assets/{flowDiagram-I6XJVG4X-DyteJsUl.js → flowDiagram-I6XJVG4X-CGYSp8Bq.js} +1 -1
  30. package/dist-web/assets/{ganttDiagram-6RSMTGT7-DZqlcIzV.js → ganttDiagram-6RSMTGT7-CEc6NV2N.js} +1 -1
  31. package/dist-web/assets/{gitGraphDiagram-PVQCEYII-Dw9S_fYV.js → gitGraphDiagram-PVQCEYII-BAhY9nr0.js} +1 -1
  32. package/dist-web/assets/{index-DQ9K54ko.css → index-DICKDW-m.css} +1 -1
  33. package/dist-web/assets/{index-B2ou3JmJ.js → index-Dalfnnlg.js} +2 -2
  34. package/dist-web/assets/{index-B9zmed_C.js → index-_s1Mk1Gy.js} +1 -1
  35. package/dist-web/assets/{index-X66FNAUX.js → index-wHkNQuci.js} +8 -8
  36. package/dist-web/assets/{index10-pQAlOV_D.js → index10-CrWPuYNH.js} +1 -1
  37. package/dist-web/assets/{index11-Jj0EtwVs.js → index11-LAXRObvM.js} +1 -1
  38. package/dist-web/assets/{index5-DYtlr_77.js → index5-C24lR9df.js} +1 -1
  39. package/dist-web/assets/{index6-C3SLqmgw.js → index6-DwtbCuXq.js} +1 -1
  40. package/dist-web/assets/{index7-CNIa1-2e.js → index7-lxjTUsdv.js} +1 -1
  41. package/dist-web/assets/{index8-B7--CG9b.js → index8-Cq4M-goM.js} +1 -1
  42. package/dist-web/assets/{infoDiagram-5YYISTIA-DwStzHtD.js → infoDiagram-5YYISTIA-DsFtOarh.js} +1 -1
  43. package/dist-web/assets/{ishikawaDiagram-YF4QCWOH-D5eudraB.js → ishikawaDiagram-YF4QCWOH-yWOTF1Hs.js} +1 -1
  44. package/dist-web/assets/{journeyDiagram-JHISSGLW-KmL5ZWxl.js → journeyDiagram-JHISSGLW-DfKlUFoY.js} +1 -1
  45. package/dist-web/assets/{kanban-definition-UN3LZRKU-Cw5DexaK.js → kanban-definition-UN3LZRKU-ChaaCq64.js} +1 -1
  46. package/dist-web/assets/{linear-C63Cr2o_.js → linear-Cv76CvTu.js} +1 -1
  47. package/dist-web/assets/{mermaid.core-BwcskAQn.js → mermaid.core-CHHamN_E.js} +4 -4
  48. package/dist-web/assets/{mindmap-definition-RKZ34NQL-DQzkgNi9.js → mindmap-definition-RKZ34NQL-BItYoCgz.js} +1 -1
  49. package/dist-web/assets/{pieDiagram-4H26LBE5-9iFPJO1g.js → pieDiagram-4H26LBE5-u0ZLLum4.js} +1 -1
  50. package/dist-web/assets/{quadrantDiagram-W4KKPZXB-CWHMWTB1.js → quadrantDiagram-W4KKPZXB-tlOD4LcT.js} +1 -1
  51. package/dist-web/assets/{requirementDiagram-4Y6WPE33-Dauq61O7.js → requirementDiagram-4Y6WPE33-B-59Zyfn.js} +1 -1
  52. package/dist-web/assets/{sankeyDiagram-5OEKKPKP-CgWplOyO.js → sankeyDiagram-5OEKKPKP-CQKNtGzZ.js} +1 -1
  53. package/dist-web/assets/{sequenceDiagram-3UESZ5HK-COId1xtx.js → sequenceDiagram-3UESZ5HK-C1fARjfY.js} +1 -1
  54. package/dist-web/assets/{stateDiagram-AJRCARHV-DoZHdBHI.js → stateDiagram-AJRCARHV-DY7qlwac.js} +1 -1
  55. package/dist-web/assets/stateDiagram-v2-BHNVJYJU-C5z1ljIG.js +1 -0
  56. package/dist-web/assets/{timeline-definition-PNZ67QCA-BXT88uZe.js → timeline-definition-PNZ67QCA-CQrFrztG.js} +1 -1
  57. package/dist-web/assets/{vennDiagram-CIIHVFJN-DqnH58Gz.js → vennDiagram-CIIHVFJN-BmxSL_2Q.js} +1 -1
  58. package/dist-web/assets/{vue.runtime.esm-bundler-CV6FAM7w.js → vue.runtime.esm-bundler-CCLV9JFt.js} +1 -1
  59. package/dist-web/assets/{wardley-L42UT6IY-BoufZjwT.js → wardley-L42UT6IY-BYs-sYrU.js} +1 -1
  60. package/dist-web/assets/{wardleyDiagram-YWT4CUSO-BMuhpvfE.js → wardleyDiagram-YWT4CUSO-BMwUFKJB.js} +1 -1
  61. package/dist-web/assets/{xychartDiagram-2RQKCTM6-BqWwNtNF.js → xychartDiagram-2RQKCTM6-mvEzsri8.js} +1 -1
  62. package/dist-web/index.html +2 -2
  63. package/package.json +7 -6
  64. package/dist-web/assets/DesignSystemView-CuTwm3PV.css +0 -1
  65. package/dist-web/assets/DesignSystemView-Y1YvR64p.js +0 -13
  66. package/dist-web/assets/channel-BsxnfQ-Y.js +0 -1
  67. package/dist-web/assets/classDiagram-4FO5ZUOK-DaUEhzAU.js +0 -1
  68. package/dist-web/assets/classDiagram-v2-Q7XG4LA2-DaUEhzAU.js +0 -1
  69. package/dist-web/assets/stateDiagram-v2-BHNVJYJU-CjAW3D5i.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DesignSystemView-Y1YvR64p.js","assets/DesignSystemView-CuTwm3PV.css","assets/mhchem-DtR62fUK.js","assets/katex-DnlPpQZa.js","assets/CodeBlockNode-DxKllCdY.js","assets/safeRaf-DGuzXxDK.js","assets/index5-DYtlr_77.js","assets/index11-Jj0EtwVs.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DesignSystemView-CSgrXT8-.js","assets/DesignSystemView-BLkRtARQ.css","assets/mhchem-DtR62fUK.js","assets/katex-DnlPpQZa.js","assets/CodeBlockNode-CWRAiwpN.js","assets/safeRaf-DGuzXxDK.js","assets/index5-C24lR9df.js","assets/index11-LAXRObvM.js"])))=>i.map(i=>d[i]);
2
2
  (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))o(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&o(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();/**
3
3
  * @vue/shared v3.5.35
4
4
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
@@ -64,7 +64,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DesignSystemVie
64
64
  <path d="M16.0404 12C16.0404 9.76874 14.2313 7.9596 12.0001 7.9596C9.76883 7.9596 7.95972 9.76874 7.95972 12C7.95972 14.2313 9.76883 16.0404 12.0001 16.0404C14.2313 16.0404 16.0404 14.2313 16.0404 12ZM14.2222 12C14.2222 13.2271 13.2271 14.2222 12 14.2222C10.7729 14.2222 9.77783 13.2271 9.77783 12C9.77783 10.7729 10.7729 9.77778 12 9.77778C13.2271 9.77778 14.2222 10.7729 14.2222 12Z" fill="currentColor"/>
65
65
  <path d="M9.91145 21.8009C9.29001 21.6797 8.76914 21.2612 8.50632 20.6922L8.07372 19.7556C7.88838 19.3544 7.43553 19.1048 6.95371 19.1549L5.89572 19.2647C5.2733 19.3293 4.64823 19.114 4.22298 18.6611C3.74343 18.1504 3.32454 17.6037 2.97033 17.0181C2.61571 16.4318 2.32839 15.8106 2.10407 15.1566C1.89769 14.5549 2.02148 13.8954 2.4089 13.3902L3.0376 12.5704C3.30043 12.2277 3.30042 11.7722 3.03758 11.4295L2.40413 10.6035C2.01474 10.0958 1.891 9.43198 2.10208 8.82826C2.55037 7.54612 3.27017 6.35997 4.22 5.34259C4.64518 4.8872 5.27275 4.67067 5.89701 4.73544L6.95383 4.84514C7.43561 4.89515 7.88844 4.6456 8.07377 4.24441L8.50266 3.31593C8.76494 2.74818 9.28448 2.33019 9.90423 2.20761C11.2916 1.9332 12.7148 1.93127 14.0885 2.19913C14.7099 2.32029 15.2308 2.73881 15.4937 3.3078L15.9263 4.24441C16.1116 4.6456 16.5644 4.89514 17.0462 4.84514L18.1043 4.73532C18.7267 4.67072 19.3518 4.88603 19.777 5.33886C20.2566 5.84953 20.6755 6.3963 21.0297 6.98193C21.3843 7.56823 21.6716 8.18942 21.8959 8.84339C22.1023 9.44509 21.9785 10.1046 21.5911 10.6098L20.9624 11.4295C20.6996 11.7722 20.6996 12.2278 20.9624 12.5705L21.5959 13.3964C21.9853 13.9042 22.109 14.568 21.8979 15.1717C21.4497 16.4538 20.7299 17.6399 19.7801 18.6573C19.3549 19.1128 18.7273 19.3294 18.103 19.2646L17.0462 19.1549C16.5645 19.1049 16.1116 19.3544 15.9263 19.7556L15.4974 20.6841C15.2351 21.2518 14.7156 21.6698 14.0958 21.7924C12.7083 22.0668 11.2852 22.0687 9.91145 21.8009ZM13.7432 20.0088C13.7844 20.0006 13.8259 19.9673 13.847 19.9216L14.2758 18.9931C14.7915 17.8768 15.9886 17.2171 17.2341 17.3464L18.2909 17.4561C18.3649 17.4638 18.4272 17.4423 18.4512 17.4166C19.2296 16.5828 19.8171 15.6146 20.1817 14.5716C20.1845 14.5636 20.1796 14.5373 20.1532 14.5029L19.5198 13.677C18.7564 12.6815 18.7564 11.3185 19.5198 10.323L20.1485 9.5033C20.1746 9.46927 20.1795 9.4429 20.1762 9.43327C19.9932 8.89965 19.7603 8.39623 19.4741 7.92293C19.1873 7.4489 18.846 7.00333 18.4517 6.58351C18.4272 6.55739 18.3656 6.53616 18.2921 6.54378L17.234 6.65361C15.9886 6.78287 14.7915 6.12317 14.2758 5.00689L13.8432 4.07027C13.822 4.02448 13.7811 3.9916 13.7406 3.98371C12.5983 3.76097 11.4132 3.76258 10.2571 3.99124C10.2158 3.99941 10.1744 4.03271 10.1533 4.07842L9.72441 5.00689C9.20875 6.12317 8.01164 6.7829 6.76619 6.6536L5.70942 6.54391C5.63535 6.53623 5.573 6.55774 5.54905 6.5834C4.77067 7.41713 4.18312 8.38534 3.81845 9.42835C3.81564 9.43637 3.82054 9.46265 3.84693 9.49706L4.48038 10.323C5.24381 11.3185 5.24383 12.6815 4.48041 13.6769L3.85171 14.4967C3.82561 14.5307 3.82066 14.5571 3.82396 14.5667C4.00701 15.1004 4.23986 15.6038 4.52613 16.0771C4.81284 16.5511 5.15421 16.9967 5.54845 17.4165C5.57298 17.4426 5.63461 17.4638 5.70811 17.4562L6.76608 17.3464C8.01157 17.2171 9.20871 17.8768 9.72438 18.9932L10.157 19.9297C10.1781 19.9755 10.2191 20.0084 10.2595 20.0163C11.4018 20.239 12.587 20.2374 13.7432 20.0088Z" fill="currentColor"/>
66
66
  </svg>
67
- `,MD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm5-2v16"/><path d="m15 10l-2 2l2 2"/></g></svg>',ED='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm5-2v16"/><path d="m14 10l2 2l-2 2"/></g></svg>',TD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3L18 10a3 3 0 0 0-6-6l-6.5 6.5a4.5 4.5 0 0 0 9 9L21 13"/></svg>',ND='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"/></svg>',ID='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m12.866 3l9.526 16.5a1 1 0 0 1-.866 1.5H2.474a1 1 0 0 1-.866-1.5L11.134 3a1 1 0 0 1 1.732 0m-8.66 16h15.588L12 5.5zM11 16h2v2h-2zm0-7h2v5h-2z"/></svg>',LD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M3 10H2V4.003C2 3.449 2.455 3 2.992 3h18.016A.99.99 0 0 1 22 4.003V10h-1v10.002a.996.996 0 0 1-.993.998H3.993A.996.996 0 0 1 3 20.002zm16 0H5v9h14zM4 5v3h16V5zm5 7h6v2H9z"/></svg>',$D='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m13 16.172l5.364-5.364l1.414 1.414L12 20l-7.778-7.778l1.414-1.414L11 16.172V4h2z"/></svg>',FD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m12 13.171l4.95-4.95l1.414 1.415L12 16L5.636 9.636L7.05 8.222z"/></svg>',OD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m5.828 7l2.536 2.535L6.95 10.95L2 6l4.95-4.95l1.414 1.415L5.828 5H13a8 8 0 1 1 0 16H4v-2h9a6 6 0 0 0 0-12z"/></svg>',BD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m16.172 11l-5.364-5.364l1.414-1.414L20 12l-7.778 7.778l-1.414-1.414L16.172 13H4v-2z"/></svg>',RD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m13.172 12l-4.95-4.95l1.414-1.413L16 12l-6.364 6.364l-1.414-1.415z"/></svg>',O_='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M13 7.828V20h-2V7.828l-5.364 5.364l-1.414-1.414L12 4l7.778 7.778l-1.414 1.414z"/></svg>',DD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m12 10.828l-4.95 4.95l-1.414-1.414L12 8l6.364 6.364l-1.414 1.414z"/></svg>',PD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M4 18v-3.7a1.5 1.5 0 0 0-1.5-1.5H2v-1.6h.5A1.5 1.5 0 0 0 4 9.7V6a3 3 0 0 1 3-3h1v2H7a1 1 0 0 0-1 1v4.1A2 2 0 0 1 4.626 12A2 2 0 0 1 6 13.9V18a1 1 0 0 0 1 1h1v2H7a3 3 0 0 1-3-3m16-3.7V18a3 3 0 0 1-3 3h-1v-2h1a1 1 0 0 0 1-1v-4.1a2 2 0 0 1 1.374-1.9A2 2 0 0 1 18 10.1V6a1 1 0 0 0-1-1h-1V3h1a3 3 0 0 1 3 3v3.7a1.5 1.5 0 0 0 1.5 1.5h.5v1.6h-.5a1.5 1.5 0 0 0-1.5 1.5"/></svg>',HD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M9 3V1H7v2H3a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h18a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1h-4V1h-2v2zm-5 7h16v9H4zm0-5h3v1h2V5h6v1h2V5h3v3H4zm5.879 5.964L12 13.086l2.121-2.122l1.415 1.415l-2.122 2.121l2.121 2.121l-1.414 1.414L12 15.915l-2.121 2.12l-1.415-1.414l2.122-2.12l-2.122-2.122z"/></svg>',WD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M7 3V1h2v2h6V1h2v2h4a1 1 0 0 1 1 1v5h-2V5h-3v2h-2V5H9v2H7V5H4v14h6v2H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm10 9a4 4 0 1 0 0 8a4 4 0 0 0 0-8m-6 4a6 6 0 1 1 12 0a6 6 0 0 1-12 0m5-3v3.414l2.293 2.293l1.414-1.414L18 15.586V13z"/></svg>',zD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M9 1v2h6V1h2v2h4a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h4V1zm11 10H4v8h16zM8 14v2H6v-2zm10 0v2h-8v-2zM7 5H4v4h16V5h-3v2h-2V5H9v2H7z"/></svg>',UD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m10 15.17l9.192-9.191l1.414 1.414L10 17.999l-6.364-6.364l1.414-1.414z"/></svg>',qD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m12 10.587l4.95-4.95l1.414 1.414l-4.95 4.95l4.95 4.95l-1.415 1.414l-4.95-4.95l-4.949 4.95l-1.414-1.415l4.95-4.95l-4.95-4.95L7.05 5.638z"/></svg>',jD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m23 12l-7.071 7.071l-1.414-1.414L20.172 12l-5.657-5.657l1.414-1.414zM3.828 12l5.657 5.657l-1.414 1.414L1 12l7.071-7.071l1.414 1.414z"/></svg>',VD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M15 4h-2v7h7V9h-3.586l4.293-4.293l-1.414-1.414L15 7.586zM4 15h3.586l-4.293 4.293l1.414 1.414L9 16.414V20h2v-7H4z"/></svg>',KD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M3 19h18v2H3zm10-5.828L19.071 7.1l1.414 1.414L12 17L3.515 8.515L4.929 7.1L11 13.173V2h2z"/></svg>',GD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M8.5 7a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m0 6.5a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m1.5 5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0M15.5 7a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m1.5 5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0m-1.5 8a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3"/></svg>',YD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M6.17 18a3.001 3.001 0 0 1 5.66 0H22v2H11.83a3.001 3.001 0 0 1-5.66 0H2v-2zm6-7a3.001 3.001 0 0 1 5.66 0H22v2h-4.17a3.001 3.001 0 0 1-5.66 0H2v-2zm-6-7a3.001 3.001 0 0 1 5.66 0H22v2H11.83a3.001 3.001 0 0 1-5.66 0H2V4zM9 6a1 1 0 1 0 0-2a1 1 0 0 0 0 2m6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2m-6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2"/></svg>',ZD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M17.586 5H14V3h7v7h-2V6.414l-4.293 4.293l-1.414-1.414zM3 14h2v3.586l4.293-4.293l1.414 1.414L6.414 19H10v2H3z"/></svg>',XD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm11-3v8h-2V6.413l-7.793 7.794l-1.414-1.414L17.585 5H13V3z"/></svg>',QD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M15 4H5v16h14V8h-4zM3 2.992C3 2.444 3.447 2 3.999 2H16l5 5v13.993A1 1 0 0 1 20.007 22H3.993A1 1 0 0 1 3 21.008zM11 11V8h2v3h3v2h-3v3h-2v-3H8v-2z"/></svg>',JD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M7 6V3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1h-3v3c0 .552-.45 1-1.007 1H4.007A1 1 0 0 1 3 21l.003-14c0-.552.45-1 1.006-1zM5.002 8L5 20h10V8zM9 6h8v10h2V4H9z"/></svg>',eP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m21 6.757l-2 2V4h-9v5H5v11h14v-2.757l2-2v5.765a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 20.993V8l6.003-6h10.995C20.55 2 21 2.455 21 2.992zm.778 2.05l1.414 1.415L15.414 18l-1.416-.002l.002-1.412z"/></svg>',B_='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M9 2.003V2h10.998C20.55 2 21 2.455 21 2.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 20.993V8zM5.83 8H9V4.83zM11 4v5a1 1 0 0 1-1 1H5v10h14V4z"/></svg>',tP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M21 8v12.993A1 1 0 0 1 20.007 22H3.993A.993.993 0 0 1 3 21.008V2.992C3 2.455 3.449 2 4.002 2h10.995zm-2 1h-5V4H5v16h14zM8 7h3v2H8zm0 4h8v2H8zm0 4h8v2H8z"/></svg>',nP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M13 9h8L11 24v-9H4l9-15zm-2 2V7.22L7.532 13H13v4.394L17.263 11z"/></svg>',oP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M12.414 5H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414zM4 5v14h16V7h-8.414l-2-2zm7 7V9h2v3h3v2h-3v3h-2v-3H8v-2z"/></svg>',sP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M12.414 5H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414z"/></svg>',iP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M6 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2M3 6a3 3 0 1 1 4 2.83V9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-.17a3.001 3.001 0 1 1 2 0V9a4 4 0 0 1-4 4h-2v2.17a3.001 3.001 0 1 1-2 0V13H9a4 4 0 0 1-4-4v-.17A3 3 0 0 1 3 6m15-1a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-6 12a1 1 0 1 0 0 2a1 1 0 0 0 0-2"/></svg>',rP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M15 5h2a2 2 0 0 1 2 2v8.17a3.001 3.001 0 1 1-2 0V7h-2v3l-4.5-4L15 2zM5 8.83a3.001 3.001 0 1 1 2 0v6.34a3.001 3.001 0 1 1-2 0zM6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 12a1 1 0 1 0 0-2a1 1 0 0 0 0 2m12 0a1 1 0 1 0 0-2a1 1 0 0 0 0 2"/></svg>',lP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.01 8.01 0 0 0 5.648 6.667M10.03 13c.151 2.439.848 4.73 1.97 6.752A15.9 15.9 0 0 0 13.97 13zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.01 8.01 0 0 0 19.938 13M4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333A8.01 8.01 0 0 0 4.062 11m5.969 0h3.938A15.9 15.9 0 0 0 12 4.248A15.9 15.9 0 0 0 10.03 11m4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.01 8.01 0 0 0-5.648-6.667"/></svg>',R_='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M2.992 21A.993.993 0 0 1 2 20.007V3.993A1 1 0 0 1 2.992 3h18.016c.548 0 .992.445.992.993v16.014a1 1 0 0 1-.992.993zM20 15V5H4v14L14 9zm0 2.828l-6-6L6.828 19H20zM8 11a2 2 0 1 1 0-4a2 2 0 0 1 0 4"/></svg>',aP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16M11 7h2v2h-2zm0 4h2v6h-2z"/></svg>',cP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m13.06 8.111l1.415 1.414a7 7 0 0 1 0 9.9l-.354.353a7 7 0 1 1-9.9-9.9l1.415 1.415a5 5 0 1 0 7.071 7.071l.354-.354a5 5 0 0 0 0-7.07l-1.415-1.415zm6.718 6.01l-1.414-1.414a5 5 0 0 0-7.071-7.07l-.354.353a5 5 0 0 0 0 7.07l1.415 1.415l-1.415 1.414l-1.414-1.414a7 7 0 0 1 0-9.9l.354-.353a7 7 0 1 1 9.9 9.9"/></svg>',uP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M8 4h13v2H8zm-5-.5h3v3H3zm0 7h3v3H3zm0 7h3v3H3zM8 11h13v2H8zm0 7h13v2H8z"/></svg>',dP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M8 4h13v2H8zM4.5 6.5a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m0 7a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m0 6.9a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3M8 11h13v2H8zm0 7h13v2H8z"/></svg>',fP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M4 15h2v5h12V4H6v5H4V3a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm6-4V8l5 4l-5 4v-3H2v-2z"/></svg>',hP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m17 4.238l-7.928 7.1L4 7.216V19h16zM4.511 5l7.55 6.662L19.502 5z"/></svg>',pP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M6.455 19L2 22.5V4a1 1 0 0 1 1-1h18a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1zm-.692-2H20V5H4v13.385zM8 10h8v2H8z"/></svg>',mP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M6 5h2v14H6zm10 0h2v14h-2z"/></svg>',gP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m15.728 9.576l-1.414-1.414L5 17.476v1.414h1.414zm1.414-1.414l1.414-1.414l-1.414-1.414l-1.414 1.414zm-9.9 12.728H3v-4.243L16.435 3.212a1 1 0 0 1 1.414 0l2.829 2.829a1 1 0 0 1 0 1.414z"/></svg>',vP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M19.376 12.416L8.777 19.482A.5.5 0 0 1 8 19.066V4.934a.5.5 0 0 1 .777-.416l10.599 7.066a.5.5 0 0 1 0 .832"/></svg>',yP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m-1-5h2v2h-2zm2-1.645V14h-2v-1.5a1 1 0 0 1 1-1a1.5 1.5 0 1 0-1.471-1.794l-1.962-.393A3.501 3.501 0 1 1 13 13.355"/></svg>',kP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M20 4v12h3l-4 5l-4-5h3V4zm-8 14v2H3v-2zm2-7v2H3v-2zm0-7v2H3V4z"/></svg>',bP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M14 4.438A2.437 2.437 0 0 0 16.438 2h1.125A2.437 2.437 0 0 0 20 4.438v1.125A2.437 2.437 0 0 0 17.563 8h-1.125A2.437 2.437 0 0 0 14 5.563zM1 11a6 6 0 0 0 6-6h2a6 6 0 0 0 6 6v2a6 6 0 0 0-6 6H7a6 6 0 0 0-6-6zm3.876 1A8.04 8.04 0 0 1 8 15.124A8.04 8.04 0 0 1 11.124 12A8.04 8.04 0 0 1 8 8.876A8.04 8.04 0 0 1 4.876 12m12.374 2A3.25 3.25 0 0 1 14 17.25v1.5A3.25 3.25 0 0 1 17.25 22h1.5A3.25 3.25 0 0 1 22 18.75v-1.5A3.25 3.25 0 0 1 18.75 14z"/></svg>',xP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928z"/></svg>',wP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928zm0-2.292l4.247 2.377l-.948-4.773l3.573-3.305l-4.833-.573l-2.038-4.419l-2.039 4.42l-4.833.572l3.573 3.305l-.948 4.773z"/></svg>',_P='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M6 5h12a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1"/></svg>',SP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M5 11v2h14v-2z"/></svg>',CP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M12 2a1 1 0 1 1 0 2a8 8 0 1 0 8 8a1 1 0 1 1 2 0c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m0 4a1 1 0 1 1 0 2a4 4 0 1 0 4 4a1 1 0 1 1 2 0a6 6 0 1 1-6-6m5.656-3.9a1.001 1.001 0 0 1 1.415 1.415l-.708.706h.001a1 1 0 1 0 1.414 1.415l.707-.707A1 1 0 0 1 21.9 6.343l-2.12 2.122a1 1 0 0 1-.708.292h-2.414l-3.95 3.95a1 1 0 0 1-1.414-1.414l3.95-3.95V4.93a1 1 0 0 1 .292-.707z"/></svg>',AP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m1 2v14h16V5zm8 10h6v2h-6zm-3.333-3L5.838 9.172l1.415-1.415L11.495 12l-4.242 4.243l-1.415-1.415z"/></svg>',MP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m1-8h4v2h-6V7h2z"/></svg>',EP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M5.33 3.272a3.5 3.5 0 0 1 4.254 4.962l10.709 10.71l-1.414 1.414l-10.71-10.71a3.502 3.502 0 0 1-4.962-4.255L5.444 7.63a1.5 1.5 0 0 0 2.121-2.121zm10.367 1.883l3.182-1.768l1.414 1.415l-1.768 3.182l-1.768.353l-2.12 2.121l-1.415-1.414l2.121-2.121zm-6.718 8.132l1.415 1.414l-5.304 5.303a1 1 0 0 1-1.492-1.327l.078-.087z"/></svg>',TP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M4 22a8 8 0 1 1 16 0h-2a6 6 0 0 0-12 0zm8-9c-3.315 0-6-2.685-6-6s2.685-6 6-6s6 2.685 6 6s-2.685 6-6 6m0-2c2.21 0 4-1.79 4-4s-1.79-4-4-4s-4 1.79-4 4s1.79 4 4 4"/></svg>',y6={sm:14,md:16,lg:20};function bt(e,t){return{component:e,svg:t}}const k6={plus:bt(vO,ND),"chat-new":bt(zF,xD),"calendar-close":bt(YO,HD),"calendar-schedule":bt(QO,WD),"calendar-todo":bt(tB,zD),close:bt(lB,qD),check:bt(sB,UD),archive:bt(_O,LD),search:bt(nO,CD),copy:bt(FB,JD),link:bt(pR,cP),"external-link":bt(EB,XD),download:bt(gB,KD),undo:bt(LO,OD),send:bt(L_,O_),image:bt(F_,R_),settings:bt(iO,AD),sliders:bt(wB,YD),"log-in":bt(_R,fP),"chevron-down":bt(TO,FD),"chevron-right":bt(DO,RD),"chevron-up":bt(UO,DD),"arrow-up":bt(L_,O_),"arrow-down":bt(AO,$D),"arrow-right":bt(OO,BD),minus:bt(iD,SP),"panel-collapse":bt(aO,MD),"panel-expand":bt(dO,ED),expand:bt(CB,ZD),collapse:bt(hB,VD),list:bt(bR,dP),sort:bt(qR,kP),grip:bt(kB,GD),folder:bt(ZF,_D),"folder-closed":bt(jF,wD),"folder-plus":bt(GB,oP),"folder-solid":bt(XB,sP),file:bt($_,B_),"file-text":bt(zB,tP),"file-edit":bt(RB,eP),"file-plus":bt(IB,QD),"file-off":bt($_,B_),attachment:bt(pO,TD),"image-off":bt(F_,R_),code:bt(uB,jD),terminal:bt(dD,AP),pencil:bt(OR,gP),tool:bt(vD,EP),glob:bt(VO,PD),globe:bt(rR,lP),"check-list":bt(vR,uP),bolt:bt(jB,nP),"git-fork":bt(eR,iP),"git-pull-request":bt(oR,rP),message:bt(TR,pP),mail:bt(AR,hP),user:bt(bD,TP),info:bt(dR,aP),"help-circle":bt(WR,yP),"alert-triangle":bt(bO,ID),clock:bt(pD,MP),sparkles:bt(KR,bP),target:bt(aD,CP),pause:bt(LR,mP),play:bt(DR,vP),stop:bt(nD,_P),star:bt(ZR,xP),"star-outline":bt(JR,wP),"dots-horizontal":bt(JF,SD)};function NP(e){return k6[e]}function IP(e,t){return e.replace(/\s(?:width|height)="[^"]*"/g,"").replace(/^<svg\b/,`<svg class="kw-icon" width="${t}" height="${t}" aria-hidden="true"`)}function Dc(e,t="md"){const n=k6[e];return n?IP(n.svg,y6[t]):""}const Q4e=[["Actions",["plus","attachment","chat-new","close","check","search","copy","link","external-link","download","undo","send","image","settings","sliders","log-in"]],["Navigation & layout",["chevron-down","chevron-right","chevron-up","arrow-up","arrow-down","arrow-right","minus","panel-collapse","panel-expand","expand","collapse","list","sort","grip"]],["Files & tools",["folder","folder-closed","folder-plus","folder-solid","file","file-text","file-edit","file-plus","file-off","image-off","code","terminal","pencil","tool","glob","globe","check-list","bolt","git-fork","git-pull-request","archive","target","calendar-schedule","calendar-todo","calendar-close"]],["Communication",["message","mail","user"]],["Status & media",["info","help-circle","alert-triangle","clock","sparkles","pause","play","stop","star","star-outline","dots-horizontal"]]],Ge=Je({__name:"Icon",props:{name:{},size:{default:"md"},label:{}},setup(e){const t=e,n=D(()=>NP(t.name)),o=D(()=>y6[t.size]);return(s,i)=>n.value?(x(),Se(Ho(n.value.component),{key:0,class:"kw-icon",width:o.value,height:o.value,"aria-label":e.label,"aria-hidden":e.label?void 0:!0},null,8,["width","height","aria-label","aria-hidden"])):ue("",!0)}}),LP={key:0,class:"ui-dialog__head"},$P={class:"ui-dialog__titles"},FP={key:0,class:"ui-dialog__title"},OP={key:1,class:"ui-dialog__desc"},BP={class:"ui-dialog__body"},RP={key:1,class:"ui-dialog__foot"},DP='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',PP=Je({__name:"Dialog",props:{open:{type:Boolean},title:{},description:{},closeOnOverlay:{type:Boolean,default:!0},closeOnEsc:{type:Boolean,default:!0},size:{default:"md"},height:{default:"auto"},padded:{type:Boolean,default:!0},initialFocus:{}},emits:["update:open","close"],setup(e,{emit:t}){const n=e,o=t,s=oe(null);let i=null;function r(){o("update:open",!1),o("close")}function l(){return s.value?Array.from(s.value.querySelectorAll(DP)):[]}function a(){const{initialFocus:d}=n;return d?typeof d=="function"?d()??null:typeof d=="string"?s.value?.querySelector(d)??null:s.value?.contains(d)?d:null:null}function c(d){if(!n.open)return;if(d.key==="Escape"&&n.closeOnEsc){d.preventDefault(),r();return}if(d.key!=="Tab")return;const f=l(),h=f[0],p=f[f.length-1];if(!h||!p){d.preventDefault(),s.value?.focus();return}const m=document.activeElement;d.shiftKey&&m===h?(d.preventDefault(),p.focus()):!d.shiftKey&&m===p&&(d.preventDefault(),h.focus())}function u(d){n.closeOnOverlay&&d.target===d.currentTarget&&r()}return et(()=>n.open,async d=>{if(d){Rc.value+=1,i=document.activeElement,await yt();const f=a(),h=l();(f??h[0]??s.value)?.focus()}else Rc.value=Math.max(0,Rc.value-1),i instanceof HTMLElement&&(i.focus(),i=null)},{immediate:!0}),typeof window<"u"&&window.addEventListener("keydown",c),ho(()=>{typeof window<"u"&&window.removeEventListener("keydown",c),n.open&&(Rc.value=Math.max(0,Rc.value-1))}),(d,f)=>(x(),Se(_1,{to:"body"},[e.open?(x(),E("div",{key:0,class:"ui-dialog__overlay",onMousedown:u},[w("div",{ref_key:"panel",ref:s,class:Ue(["ui-dialog",[`ui-dialog--${e.size}`,{"ui-dialog--flush":!e.padded,"ui-dialog--fixed-height":e.height==="fixed"}]]),role:"dialog","aria-modal":"true",tabindex:"-1"},[e.title||d.$slots.head?(x(),E("div",LP,[jn(d.$slots,"head",{},()=>[w("div",$P,[e.title?(x(),E("div",FP,R(e.title),1)):ue("",!0),e.description?(x(),E("div",OP,R(e.description),1)):ue("",!0)])],!0),ae(Xn,{class:"ui-dialog__close",size:"sm",label:"Close",onClick:r},{default:Ie(()=>[ae(Ge,{name:"close",size:"md"})]),_:1})])):ue("",!0),w("div",BP,[jn(d.$slots,"default",{},void 0,!0)]),d.$slots.foot?(x(),E("div",RP,[jn(d.$slots,"foot",{},void 0,!0)])):ue("",!0)],2)],32)):ue("",!0)]))}}),Qr=dt(PP,[["__scopeId","data-v-3dce23a4"]]),HP={class:"sd-head"},WP=["placeholder","aria-label"],zP=["aria-selected","onClick","onMousemove"],UP={class:"sd-meta"},qP=["innerHTML"],jP={class:"sd-time"},VP=["innerHTML"],KP=["innerHTML"],GP={key:1,class:"sd-empty"},YP={class:"sd-hint"},ZP=200,XP=Je({__name:"SearchSessionsDialog",props:{sessions:{},activeId:{}},emits:["select","close"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=oe(!0),r=oe(""),l=oe(null),a=oe(null),c=D(()=>{const k=r.value.trim().toLowerCase(),g=[];for(const v of o.sessions){const b=v.title??"",A=v.lastPrompt??"",I=v.workspaceName??"",N=k.length>0&&b.toLowerCase().includes(k),M=k.length>0&&A.toLowerCase().includes(k),$=k.length>0&&I.toLowerCase().includes(k);if(!(k.length>0&&!N&&!M&&!$)&&(g.push({session:v,inTitle:N,inWorkspace:$,snippetText:A?RF(A,r.value):""}),g.length>=ZP))break}return g}),u=oe(0);et(r,()=>{u.value=0});function d(k){const g=c.value.length;return g===0?0:Math.max(0,Math.min(g-1,k))}async function f(){await yt(),a.value?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest"})}function h(k){u.value=d(u.value+k),f()}function p(k){s("select",k),s("close")}function m(){const k=c.value[u.value];k&&p(k.session.id)}function y(k){k.key==="ArrowDown"?(k.preventDefault(),h(1)):k.key==="ArrowUp"?(k.preventDefault(),h(-1)):k.key==="Enter"&&(k.preventDefault(),m())}return An(()=>{l.value?.focus()}),(k,g)=>(x(),Se(Qr,{open:i.value,"onUpdate:open":g[1]||(g[1]=v=>i.value=v),size:"lg",height:"fixed",padded:!1,onClose:g[2]||(g[2]=v=>s("close"))},{head:Ie(()=>[w("div",HP,[ae(Ge,{class:"sd-search-icon",name:"search",size:"md"}),qn(w("input",{ref_key:"inputRef",ref:l,"onUpdate:modelValue":g[0]||(g[0]=v=>r.value=v),class:"sd-input",type:"text",placeholder:C(n)("sidebar.searchPlaceholder"),"aria-label":C(n)("sidebar.searchPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:y},null,40,WP),[[Cs,r.value]])])]),foot:Ie(()=>[w("span",YP,R(C(n)("sidebar.searchHint")),1)]),default:Ie(()=>[w("div",{ref_key:"listRef",ref:a,class:"sd-list",role:"listbox"},[c.value.length>0?(x(!0),E(We,{key:0},rt(c.value,(v,b)=>(x(),E("button",{key:v.session.id,class:Ue(["sd-row",{on:b===u.value,active:v.session.id===e.activeId}]),role:"option","aria-selected":b===u.value,onClick:A=>p(v.session.id),onMousemove:A=>u.value=b},[w("span",UP,[ae(Ge,{class:"sd-folder",name:"folder-closed",size:"sm"}),w("span",{class:"sd-ws",innerHTML:C(_g)(v.session.workspaceName??v.session.workspaceId??"",v.inWorkspace?r.value:"")},null,8,qP),w("span",jP,R(v.session.time),1)]),w("span",{class:"sd-title",innerHTML:C(_g)(v.session.title,v.inTitle?r.value:"")},null,8,VP),v.snippetText?(x(),E("span",{key:0,class:"sd-snippet",innerHTML:C(_g)(v.snippetText,r.value)},null,8,KP)):ue("",!0)],42,zP))),128)):(x(),E("div",GP,R(C(n)("sidebar.searchNoResults")),1))],512)]),_:1},8,["open"]))}}),QP=dt(XP,[["__scopeId","data-v-a678f802"]]),JP=["aria-label"],eH=Je({__name:"Spinner",props:{size:{default:"md"},label:{default:"Loading"}},setup(e){return(t,n)=>(x(),E("span",{class:Ue(["ui-spinner",`ui-spinner--${e.size}`]),role:"status","aria-label":e.label},[...n[0]||(n[0]=[w("svg",{class:"ui-spinner__svg",viewBox:"0 0 24 24","aria-hidden":"true"},[w("circle",{class:"ui-spinner__track",cx:"12",cy:"12",r:"9"}),w("circle",{class:"ui-spinner__arc",cx:"12",cy:"12",r:"9"})],-1)])],10,JP))}}),Us=dt(eH,[["__scopeId","data-v-e5c5b17d"]]),tH={key:0,class:"ui-badge__dot","aria-hidden":"true"},nH=Je({__name:"Badge",props:{variant:{default:"neutral"},size:{default:"md"},dot:{type:Boolean}},setup(e){return(t,n)=>(x(),E("span",{class:Ue(["ui-badge",[`ui-badge--${e.variant}`,`ui-badge--${e.size}`]])},[e.dot?(x(),E("span",tH)):ue("",!0),jn(t.$slots,"default",{},void 0,!0)],2))}}),qi=dt(nH,[["__scopeId","data-v-5bc5cd6d"]]),oH=Je({__name:"Menu",setup(e,{expose:t}){const n=oe();return t({el:n}),(o,s)=>(x(),E("div",{ref_key:"el",ref:n,class:"ui-menu",role:"menu"},[jn(o.$slots,"default",{},void 0,!0)],512))}}),Ml=dt(oH,[["__scopeId","data-v-60e6cd8d"]]),sH={key:0,class:"ui-menu-sep",role:"separator"},iH=["disabled"],rH=Je({__name:"MenuItem",props:{active:{type:Boolean},danger:{type:Boolean},disabled:{type:Boolean},separator:{type:Boolean},size:{default:"md"}},emits:["click"],setup(e){return(t,n)=>e.separator?(x(),E("div",sH)):(x(),E("button",{key:1,class:Ue(["ui-menu-item",[`ui-menu-item--${e.size}`,{"is-active":e.active,"is-danger":e.danger}]]),type:"button",role:"menuitem",disabled:e.disabled,onClick:n[0]||(n[0]=o=>t.$emit("click",o))},[jn(t.$slots,"default",{},void 0,!0)],10,iH))}}),Tn=dt(rH,[["__scopeId","data-v-f940771a"]]),al=6,cl=8,lH=150,aH=Je({__name:"Tooltip",props:{text:{},placement:{default:"top"},maxWidth:{default:280},maxLines:{default:6}},setup(e){const t=e,n=oe(),o=oe(),s=oe(!1),i=oe(!1),r=oe({maxWidth:`${t.maxWidth}px`});let l,a=null,c;function u(){const m=o.value;if(!a||!m)return;const y=a.getBoundingClientRect(),k=m.offsetWidth,g=m.offsetHeight,v=window.innerWidth,b=window.innerHeight;let A=t.placement;A==="top"&&y.top-al-g<cl?A="bottom":A==="bottom"&&y.bottom+al+g>b-cl?A="top":A==="left"&&y.left-al-k<cl?A="right":A==="right"&&y.right+al+k>v-cl&&(A="left");let I=0,N=0;A==="top"?(I=y.top-al-g,N=y.left+y.width/2-k/2):A==="bottom"?(I=y.bottom+al,N=y.left+y.width/2-k/2):A==="left"?(I=y.top+y.height/2-g/2,N=y.left-al-k):(I=y.top+y.height/2-g/2,N=y.right+al),N=Math.min(Math.max(N,cl),v-cl-k),I=Math.min(Math.max(I,cl),b-cl-g),r.value={maxWidth:`${t.maxWidth}px`,top:`${Math.round(I)}px`,left:`${Math.round(N)}px`}}function d(){t.text&&(window.clearTimeout(l),l=window.setTimeout(()=>{s.value=!0,i.value=!1,yt(()=>{u(),i.value=!0})},lH))}function f(){window.clearTimeout(l),s.value=!1,i.value=!1}function h(){s.value&&f()}function p(m){m!==a&&(a&&(a.removeEventListener("mouseenter",d),a.removeEventListener("mouseleave",f),a.removeEventListener("focusin",d),a.removeEventListener("focusout",f)),a=m,a&&(a.addEventListener("mouseenter",d),a.addEventListener("mouseleave",f),a.addEventListener("focusin",d),a.addEventListener("focusout",f)))}return An(()=>{const m=n.value??null;p(m?.firstElementChild??m),m&&(c=new MutationObserver(()=>{const y=m.firstElementChild??null;y!==a&&(f(),p(y??m))}),c.observe(m,{childList:!0})),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h)}),ho(()=>{window.clearTimeout(l),c?.disconnect(),p(null),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}),(m,y)=>(x(),E(We,null,[w("span",{ref_key:"trigger",ref:n,class:"ui-tip"},[jn(m.$slots,"default",{},void 0,!0)],512),(x(),Se(_1,{to:"body"},[qn(w("div",{ref_key:"bubble",ref:o,class:Ue(["ui-tip__bubble",{positioned:i.value}]),style:on([r.value,{"--tip-lines":e.maxLines}]),role:"tooltip"},R(e.text),7),[[xi,s.value]])]))],64))}}),an=dt(aH,[["__scopeId","data-v-4c261eb6"]]),cH={class:"row"},uH={class:"lead","aria-hidden":"true"},dH={key:1,class:"unread-dot"},fH={class:"left"},hH=["onKeydown"],pH={class:"act"},mH={class:"ts"},gH={class:"menu-time"},vH=Je({__name:"SessionRow",props:{session:{},active:{type:Boolean},approvalCount:{default:0},questionCount:{default:0},unread:{type:Boolean,default:!1}},emits:["select","rename","archive","fork","export"],setup(e,{expose:t,emit:n}){const{t:o}=$t(),s=e,i=n;function r(S){const B=new Date(S);if(Number.isNaN(B.getTime()))return S;const W=z=>String(z).padStart(2,"0");return`${B.getFullYear()}-${W(B.getMonth()+1)}-${W(B.getDate())} ${W(B.getHours())}:${W(B.getMinutes())}`}const l=D(()=>s.session.updatedAt?r(s.session.updatedAt):s.session.time),a=oe(!1),c=oe(null),u=oe(null),d=oe({});function f(S){const B=S.target;u.value?.el?.contains(B)||c.value?.el?.contains(B)||m()}function h(){const S=c.value?.el;if(!S)return;const B=u.value?.el,W=S.getBoundingClientRect(),z=4,L=8,O=B?.offsetHeight??0,U=B?.offsetWidth??0;let Z=W.bottom+z;Z+O>window.innerHeight-L&&(Z=Math.max(L,W.top-O-z));let ie=W.right-U;ie<L&&(ie=L),d.value={top:`${Math.round(Z)}px`,left:`${Math.round(ie)}px`}}async function p(S){if(S.stopPropagation(),a.value){m();return}a.value=!0,setTimeout(()=>document.addEventListener("mousedown",f),0),window.addEventListener("resize",m),await yt(),h()}function m(){a.value=!1,document.removeEventListener("mousedown",f),window.removeEventListener("resize",m)}On(()=>{document.removeEventListener("mousedown",f),window.removeEventListener("resize",m)});const y=oe(!1),k=oe(""),g=oe(null);async function v(){m(),y.value=!0,k.value=s.session.title,await yt();try{g.value?.focus(),g.value?.select()}catch{}}function b(){const S=k.value.trim();S&&i("rename",s.session.id,S),y.value=!1}function A(){y.value=!1}const I=oe(!1),N=oe(!1);async function M(){const S=await Jo(s.session.id);I.value=S,N.value=!S,setTimeout(()=>{I.value=!1,N.value=!1,m()},1500)}function $(){m(),i("fork",s.session.id)}function T(){m(),i("export",s.session.id)}function F(){m(),i("archive",s.session.id)}return t({closeMenu:m}),(S,B)=>(x(),E("div",{class:Ue(["se",{on:e.active}]),onClick:B[4]||(B[4]=W=>i("select",e.session.id))},[w("div",cH,[w("span",uH,[e.session.busy?(x(),Se(Us,{key:0,size:"sm"})):e.unread?(x(),E("span",dH)):ue("",!0)]),w("div",fH,[y.value?qn((x(),E("input",{key:0,ref_key:"renameInputRef",ref:g,"onUpdate:modelValue":B[0]||(B[0]=W=>k.value=W),class:"rename-input",onClick:B[1]||(B[1]=St(()=>{},["stop"])),onKeydown:[ur(St(b,["stop"]),["enter"]),ur(St(A,["stop"]),["esc"])],onBlur:b},null,40,hH)),[[Cs,k.value]]):(x(),E("span",{key:1,class:"t",onDblclick:St(v,["stop"])},R(e.session.title),33))]),ae(an,{text:C(o)("workspace.awaitingAnswerTitle")},{default:Ie(()=>[!y.value&&(e.questionCount>0||e.session.pendingInteraction==="question")?(x(),Se(qi,{key:0,variant:"info",size:"sm"},{default:Ie(()=>[ot(R(C(o)("workspace.awaitingAnswer")),1)]),_:1})):ue("",!0)]),_:1},8,["text"]),ae(an,{text:C(o)("workspace.awaitingPermissionTitle")},{default:Ie(()=>[!y.value&&(e.approvalCount>0||e.session.pendingInteraction==="approval")?(x(),Se(qi,{key:0,variant:"warning",size:"sm"},{default:Ie(()=>[ot(R(C(o)("workspace.awaitingPermission")),1)]),_:1})):ue("",!0)]),_:1},8,["text"]),ae(an,{text:C(o)("workspace.abortedTitle")},{default:Ie(()=>[!y.value&&!e.session.busy&&e.session.pendingInteraction!=="question"&&e.session.pendingInteraction!=="approval"&&e.questionCount===0&&e.approvalCount===0&&(e.session.lastTurnReason==="cancelled"||e.session.lastTurnReason==="failed")?(x(),Se(qi,{key:0,variant:"danger",size:"sm"},{default:Ie(()=>[ot(R(C(o)("workspace.aborted")),1)]),_:1})):ue("",!0)]),_:1},8,["text"]),w("span",pH,[w("span",mH,R(e.session.time),1),y.value?ue("",!0):(x(),Se(Xn,{key:0,ref_key:"kebabRef",ref:c,class:Ue(["kebab",{open:a.value}]),size:"sm",label:C(o)("sidebar.options"),onClick:B[2]||(B[2]=St(W=>p(W),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"dots-horizontal"})]),_:1},8,["class","label"]))])]),(x(),Se(_1,{to:"body"},[a.value?(x(),Se(Ml,{key:0,ref_key:"menuRef",ref:u,class:"menu",style:on(d.value),onClick:B[3]||(B[3]=St(()=>{},["stop"]))},{default:Ie(()=>[ae(Tn,{danger:N.value,onClick:M},{default:Ie(()=>[ae(Ge,{name:I.value?"check":"copy",size:"sm"},null,8,["name"]),ot(" "+R(N.value?C(o)("sidebar.copyFailed"):I.value?C(o)("sidebar.copied"):C(o)("sidebar.copySessionId")),1)]),_:1},8,["danger"]),ae(Tn,{separator:""}),ae(Tn,{onClick:v},{default:Ie(()=>[ae(Ge,{name:"pencil",size:"sm"}),ot(" "+R(C(o)("sidebar.rename")),1)]),_:1}),ae(Tn,{onClick:$},{default:Ie(()=>[ae(Ge,{name:"git-fork",size:"sm"}),ot(" "+R(C(o)("sidebar.fork")),1)]),_:1}),ae(Tn,{onClick:T},{default:Ie(()=>[ae(Ge,{name:"download",size:"sm"}),ot(" "+R(C(o)("sidebar.export")),1)]),_:1}),ae(Tn,{danger:"",onClick:F},{default:Ie(()=>[ae(Ge,{name:"archive",size:"sm"}),ot(" "+R(C(o)("sidebar.archive")),1)]),_:1}),ae(Tn,{separator:""}),w("div",gH,R(l.value),1)]),_:1},8,["style"])):ue("",!0)]))],2))}}),yH=dt(vH,[["__scopeId","data-v-c1a3c877"]]),kH={class:"gh-top"},bH={class:"gh-name"},xH=["inert"],wH=["disabled"],_H={class:"show-more-label"},SH={class:"show-more-label"},CH={key:2,class:"group-empty"},AH=Je({__name:"WorkspaceGroup",props:{group:{},activeWorkspaceId:{},activeId:{},renamingId:{},renameValue:{},renameInputRef:{},pendingBySession:{},unreadBySession:{},wsMenuOpenId:{},dragging:{type:Boolean},isCollapsed:{type:Function},isExpanded:{type:Function}},emits:["groupClick","groupContextmenu","toggleWsMenu","createInWorkspace","selectSession","renameSession","archiveSession","forkSession","exportSession","loadMore","toggleExpand","confirmRename","cancelRename","updateRenameValue","wsDragstart","wsDragend"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=D({get:()=>o.renameValue,set:f=>s("updateRenameValue",f)}),r=D(()=>{if(o.isExpanded(o.group.workspace.id))return o.group.sessions;const f=o.group.sessions.slice(0,o.group.initialCount);if(o.activeId&&!f.some(h=>h.id===o.activeId)){const h=o.group.sessions.find(p=>p.id===o.activeId);if(h)return[...f,h]}return f}),l=D(()=>o.group.sessions.length>o.group.initialCount);function a(){return Math.max(0,o.group.workspace.sessionCount-o.group.sessions.length)}function c(){return o.group.sessions.length-o.group.initialCount}function u(f){o.renameInputRef.value=f instanceof HTMLInputElement?f:null}function d(f){f.dataTransfer&&(f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("text/plain",o.group.workspace.id),s("wsDragstart",o.group.workspace.id))}return(f,h)=>(x(),E("div",{class:Ue(["group",{dragging:e.dragging}])},[w("div",{class:Ue(["gh",{on:e.group.workspace.id===e.activeWorkspaceId,collapsed:e.isCollapsed(e.group.workspace.id)}]),draggable:"true",onClick:h[7]||(h[7]=St(p=>s("groupClick",e.group.workspace.id,p),["stop"])),onContextmenu:h[8]||(h[8]=p=>s("groupContextmenu",e.group.workspace,p)),onDragstart:d,onDragend:h[9]||(h[9]=p=>s("wsDragend"))},[w("div",kH,[e.isCollapsed(e.group.workspace.id)?(x(),Se(Ge,{key:0,class:"gh-folder",name:"folder-closed"})):(x(),Se(Ge,{key:1,class:"gh-folder",name:"folder"})),e.renamingId!==e.group.workspace.id?(x(),Se(an,{key:2,text:e.group.workspace.root},{default:Ie(()=>[w("span",bH,R(e.group.workspace.name),1)]),_:1},8,["text"])):qn((x(),E("input",{key:3,ref:u,"onUpdate:modelValue":h[0]||(h[0]=p=>i.value=p),class:"gh-rename",type:"text",onKeydown:[h[1]||(h[1]=ur(p=>s("confirmRename"),["enter"])),h[2]||(h[2]=ur(p=>s("cancelRename"),["esc"]))],onBlur:h[3]||(h[3]=p=>s("cancelRename")),onClick:h[4]||(h[4]=St(()=>{},["stop"]))},null,544)),[[Cs,i.value]]),e.renamingId!==e.group.workspace.id?(x(),E("div",{key:4,class:Ue(["gh-actions",{open:e.wsMenuOpenId===e.group.workspace.id}])},[ae(Xn,{class:Ue(["gh-more",{open:e.wsMenuOpenId===e.group.workspace.id}]),size:"sm",label:C(n)("sidebar.options"),"aria-haspopup":"menu","aria-expanded":e.wsMenuOpenId===e.group.workspace.id,onClick:h[5]||(h[5]=St(p=>s("toggleWsMenu",e.group.workspace,p),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"dots-horizontal"})]),_:1},8,["class","label","aria-expanded"]),ae(Xn,{class:"gh-add",size:"sm",label:C(n)("workspace.newInGroup"),onClick:h[6]||(h[6]=St(p=>s("createInWorkspace",e.group.workspace.id),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"chat-new"})]),_:1},8,["label"])],2)):ue("",!0)])],34),w("div",{class:Ue(["group-sessions",{collapsed:e.isCollapsed(e.group.workspace.id)}]),inert:e.isCollapsed(e.group.workspace.id)},[(x(!0),E(We,null,rt(r.value,p=>(x(),Se(yH,{key:p.id,session:p,active:p.id===e.activeId,"approval-count":e.pendingBySession[p.id]?.approvals??0,"question-count":e.pendingBySession[p.id]?.questions??0,unread:e.unreadBySession[p.id]??!1,onSelect:h[10]||(h[10]=m=>s("selectSession",m)),onRename:h[11]||(h[11]=(m,y)=>s("renameSession",m,y)),onArchive:h[12]||(h[12]=m=>s("archiveSession",m)),onFork:h[13]||(h[13]=m=>s("forkSession",m)),onExport:h[14]||(h[14]=m=>s("exportSession",m))},null,8,["session","active","approval-count","question-count","unread"]))),128)),e.group.hasMore||e.group.loadingMore?(x(),E("button",{key:0,class:"show-more",disabled:e.group.loadingMore,onClick:h[15]||(h[15]=St(p=>s("loadMore",e.group.workspace.id),["stop"]))},[h[17]||(h[17]=w("span",{class:"show-more-lead","aria-hidden":"true"},null,-1)),w("span",_H,R(e.group.loadingMore?C(n)("sidebar.loadingMore"):C(n)("sidebar.showMore",{count:a()})),1)],8,wH)):ue("",!0),l.value?(x(),E("button",{key:1,class:"show-more",onClick:h[16]||(h[16]=St(p=>s("toggleExpand",e.group.workspace.id),["stop"]))},[h[18]||(h[18]=w("span",{class:"show-more-lead","aria-hidden":"true"},null,-1)),w("span",SH,R(e.isExpanded(e.group.workspace.id)?C(n)("sidebar.showLess"):C(n)("sidebar.showAll",{count:c()})),1)])):ue("",!0),e.group.sessions.length===0?(x(),E("div",CH,R(C(n)("sidebar.noSessions")),1)):ue("",!0)],10,xH)],2))}}),MH=dt(AH,[["__scopeId","data-v-cdac739a"]]),EH="kimi_desktop",TH="platform",D_="kimi-desktop",P_="kimi-desktop-platform";function NH(){let e=!1,t=null;try{const n=new URLSearchParams(window.location.search);n.has(EH)?(sessionStorage.setItem(D_,"1"),e=!0):e=e||sessionStorage.getItem(D_)==="1";const o=n.get(TH);o?(sessionStorage.setItem(P_,o),t=o):t=sessionStorage.getItem(P_)}catch{}return{isDesktop:e,platform:t}}const by=NH(),IH=by.isDesktop,iu=by.isDesktop&&by.platform==="darwin",LH={class:"ui-kbd"},$H=Je({__name:"Kbd",props:{keys:{}},setup(e){return(t,n)=>(x(),E("span",LH,[(x(!0),E(We,null,rt(e.keys,o=>(x(),E("kbd",{key:o,class:"ui-kbd__key"},R(o),1))),128))]))}}),Er=dt($H,[["__scopeId","data-v-32292ed8"]]),FH=["disabled","aria-pressed"],OH=Je({__name:"Pill",props:{clickable:{type:Boolean,default:!0},active:{type:Boolean},disabled:{type:Boolean},ariaPressed:{type:Boolean}},emits:["click"],setup(e){return(t,n)=>e.clickable?(x(),E("button",{key:0,class:Ue(["ui-pill",{"is-active":e.active}]),type:"button",disabled:e.disabled,"aria-pressed":e.ariaPressed,onClick:n[0]||(n[0]=o=>t.$emit("click",o))},[jn(t.$slots,"default",{},void 0,!0)],10,FH)):(x(),E("span",{key:1,class:Ue(["ui-pill",{"is-active":e.active}])},[jn(t.$slots,"default",{},void 0,!0)],2))}}),Cp=dt(OH,[["__scopeId","data-v-317ace1a"]]),BH={class:"ch"},RH={class:"ch-brand"},DH={class:"ch-backend-ep"},PH={class:"btn-wrap"},HH={class:"search-input"},WH={key:0,class:"empty"},zH={class:"side-section-label"},UH={class:"side-section-title"},qH={class:"side-section-actions"},jH=["onDragover","onDrop"],VH={class:"side-footer"},KH={class:"section-menu-check"},GH={class:"section-menu-check"},YH={class:"section-menu-check"},ZH={class:"backend-menu-name"},XH={class:"backend-menu-url"},QH=1e3,JH=Je({__name:"Sidebar",props:{activeWorkspace:{default:null},activeWorkspaceId:{default:null},sessions:{},groups:{},activeId:{},workspaceSortMode:{},backend:{default:"v1"},attentionBySession:{default:()=>({})},pendingBySession:{default:()=>({})},unreadBySession:{default:()=>({})},colWidth:{default:220},collapsed:{type:Boolean,default:!1},dragging:{type:Boolean,default:!1}},emits:["select","create","createInWorkspace","selectWorkspace","addWorkspace","rename","archive","fork","export","renameWorkspace","deleteWorkspace","reorderWorkspaces","setWorkspaceSortMode","loadMoreSessions","loadAllSessions","openSettings","collapse"],setup(e,{emit:t}){const{t:n}=$t(),o=!1,s=oe(null),i=D(()=>""),r=["default","multi"];function l(nt){const Be=s.value?.presets[nt]??"";return Be?EF(Be):""}function a(nt){const Be=s.value;return Be!==null&&Be.current===Be.presets[nt]}const c=e,u=t,d=oe(!1),f=m()?["⌘","K"]:["Ctrl","K"];function h(){u("loadAllSessions"),d.value=!0}function p(nt){(nt.metaKey||nt.ctrlKey)&&nt.key.toLowerCase()==="k"&&(nt.preventDefault(),h())}An(()=>window.addEventListener("keydown",p)),ho(()=>window.removeEventListener("keydown",p));function m(){if(typeof navigator>"u")return!1;if(/Mac|iPod|iPhone|iPad/.test(navigator.platform))return!0;const nt=navigator.userAgentData;return nt?.platform==="macOS"||nt?.platform==="iOS"}const y=oe(!1);function k(nt){y.value=nt.target.scrollTop>0}const g=oe(new Set(pF()));function v(nt){return g.value.has(nt)}function b(nt){const Be=new Set(g.value);Be.has(nt)?Be.delete(nt):Be.add(nt),g.value=Be,wg(Be)}function A(){const nt=new Set(c.groups.map(Be=>Be.workspace.id));g.value=nt,wg(nt)}function I(){const nt=new Set;g.value=nt,wg(nt)}const N=D(()=>c.groups.length>0&&c.groups.every(nt=>g.value.has(nt.workspace.id))),M=oe(new Set);function $(nt){return M.value.has(nt)}function T(nt){const Be=new Set(M.value);Be.has(nt)?Be.delete(nt):Be.add(nt),M.value=Be}function F(nt){if(!M.value.has(nt)){const Be=new Set(M.value);Be.add(nt),M.value=Be}u("loadMoreSessions",nt)}const S=oe(null),B=oe(null);function W(nt){S.value=nt}function z(){S.value=null,B.value=null}function L(nt){const Be=nt.currentTarget.getBoundingClientRect();return nt.clientY<Be.top+Be.height/2?"before":"after"}function O(nt,Be){S.value===null||S.value===Be||(nt.preventDefault(),nt.dataTransfer&&(nt.dataTransfer.dropEffect="move"),B.value={id:Be,position:L(nt)})}function U(nt){const Be=S.value,Bt=B.value?.id===nt?B.value.position:"before";if(B.value=null,S.value=null,!Be||Be===nt)return;const Yt=$F(c.groups.map(vn=>vn.workspace.id),Be,nt,Bt);u("reorderWorkspaces",Yt)}function Z(nt,Be){Be.target.closest(".gh-more, .gh-add")||b(nt)}function ie(nt){u("select",nt)}const q=oe(null),ee=oe(""),fe=oe(null);function ne(){return fe}function j(nt,Be){q.value=nt,ee.value=Be,yt().then(()=>fe.value?.focus())}function K(){const nt=q.value,Be=ee.value.trim();nt&&Be&&u("renameWorkspace",nt,Be),q.value=null}function ve(){q.value=null}function he(nt){ee.value=nt}const Ae=oe(!1),re=oe(null),Y=oe({}),Q=oe(null);function P(nt){Q.value?.el&&!Q.value.el.contains(nt.target)&&me()}function G(nt,Be){Be.preventDefault(),Be.stopPropagation(),re.value=nt,Y.value={top:`${Be.clientY}px`,left:`${Be.clientX}px`},Ae.value=!0,document.addEventListener("mousedown",P,!0)}function me(){Ae.value=!1,document.removeEventListener("mousedown",P,!0),re.value=null}function ye(){re.value&&Jo(re.value.root),me()}function de(){re.value&&j(re.value.id,re.value.name),me()}function V(){const nt=re.value;nt&&(me(),u("deleteWorkspace",nt.id))}const se=oe(null),pe=oe(null),ke=oe({}),Ne=oe(null);function qe(nt){const Be=nt.target;Be.closest(".gh-more")||Be.closest(".ws-menu")||xe()}async function be(nt,Be){if(se.value===nt.id){xe();return}const Bt=Be.currentTarget;pe.value=nt,se.value=nt.id,document.addEventListener("mousedown",qe),window.addEventListener("resize",xe),await yt();const Yt=Ne.value?.el,vn=Bt.getBoundingClientRect(),xn=4,nn=8,Vn=Yt?.offsetHeight??0,Kn=Yt?.offsetWidth??0;let Jn=vn.bottom+xn;Jn+Vn>window.innerHeight-nn&&(Jn=Math.max(nn,vn.top-Vn-xn));let Oo=vn.right-Kn;Oo<nn&&(Oo=nn),ke.value={top:`${Math.round(Jn)}px`,left:`${Math.round(Oo)}px`}}function xe(){se.value=null,pe.value=null,document.removeEventListener("mousedown",qe),window.removeEventListener("resize",xe)}function Ze(nt){Jo(nt.root),xe()}function tt(nt){j(nt.id,nt.name),xe()}function lt(nt){xe(),u("deleteWorkspace",nt.id)}const ut=oe(!1),mt=oe({}),Tt=oe(null);function wt(nt){const Be=nt.target;Be.closest(".side-section-kebab")||Be.closest(".section-menu")||en()}async function Ft(nt){if(ut.value){en();return}const Be=nt.currentTarget;ut.value=!0,document.addEventListener("mousedown",wt),window.addEventListener("resize",en),await yt();const Bt=Tt.value?.el,Yt=Be.getBoundingClientRect(),vn=4,xn=8,nn=Bt?.offsetHeight??0,Vn=Bt?.offsetWidth??0;let Kn=Yt.bottom+vn;Kn+nn>window.innerHeight-xn&&(Kn=Math.max(xn,Yt.top-nn-vn));let Jn=Yt.right-Vn;Jn<xn&&(Jn=xn),mt.value={top:`${Math.round(Kn)}px`,left:`${Math.round(Jn)}px`}}function en(){ut.value=!1,document.removeEventListener("mousedown",wt),window.removeEventListener("resize",en)}function Hn(nt){u("setWorkspaceSortMode",nt),en()}const Pt=oe(!1),bn=oe({}),pn=oe(null);function Kt(nt){const Be=nt.target;Be.closest(".ch-backend")||Be.closest(".backend-menu")||Gt()}async function Nn(nt){if(s.value===null)return;if(Pt.value){Gt();return}const Be=nt.currentTarget;Pt.value=!0,document.addEventListener("mousedown",Kt),window.addEventListener("resize",Gt),await yt();const Bt=pn.value?.el,Yt=Be.getBoundingClientRect(),vn=4,xn=8,nn=Bt?.offsetHeight??0;let Vn=Yt.bottom+vn;Vn+nn>window.innerHeight-xn&&(Vn=Math.max(xn,Yt.top-nn-vn)),bn.value={top:`${Math.round(Vn)}px`,left:`${Math.round(Math.max(xn,Yt.left))}px`}}function Gt(){Pt.value=!1,document.removeEventListener("mousedown",Kt),window.removeEventListener("resize",Gt)}async function Wt(nt){if(a(nt)){Gt();return}if(await MF(nt)===null){console.warn("[kimi-web] dev backend switch failed:",nt),Gt();return}window.location.reload()}ho(()=>{document.removeEventListener("mousedown",P,!0),document.removeEventListener("mousedown",qe),document.removeEventListener("mousedown",wt),document.removeEventListener("mousedown",Kt),window.removeEventListener("resize",xe),window.removeEventListener("resize",en),window.removeEventListener("resize",Gt)});const mn=oe(null);let so;function gn(){const nt=mn.value;nt&&(nt.classList.remove("blink-now"),nt.getBoundingClientRect(),nt.classList.add("blink-now"),clearTimeout(so),so=setTimeout(()=>nt.classList.remove("blink-now"),300))}const to=Hi(()=>vs(()=>import("./DesignSystemView-Y1YvR64p.js"),__vite__mapDeps([0,1]))),vt=oe(!1);let Wn,Bn=!1;function Qn(nt){Bn=!1,clearTimeout(Wn),nt.currentTarget.setPointerCapture?.(nt.pointerId),Wn=setTimeout(()=>{Bn=!0,vt.value=!0},QH)}function sn(nt){clearTimeout(Wn);const Be=nt.currentTarget;Be.hasPointerCapture?.(nt.pointerId)&&Be.releasePointerCapture(nt.pointerId)}function es(){if(Bn){Bn=!1;return}gn()}return ho(()=>{clearTimeout(Wn)}),(nt,Be)=>(x(),E("aside",{class:Ue(["side",{"macos-desktop":C(iu),collapsed:e.collapsed,"no-anim":e.dragging}]),style:on({width:e.collapsed?"0px":e.colWidth+"px"})},[w("div",{class:"col",style:on({width:e.colWidth+"px"})},[w("div",BH,[w("div",RH,[C(iu)?ue("",!0):(x(),E(We,{key:0},[(x(),E("svg",{ref_key:"logoRef",ref:mn,class:Ue(["ch-logo",{"is-dev":C(o)}]),viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Kimi Code",onClick:es,onPointerdown:Qn,onPointerup:sn,onPointercancel:sn},[...Be[22]||(Be[22]=[qk('<defs data-v-1b04ce05><mask id="kimiEyes" maskUnits="userSpaceOnUse" data-v-1b04ce05><rect x="0" y="0" width="32" height="22" fill="#fff" data-v-1b04ce05></rect><g class="ch-eyes" fill="#000" data-v-1b04ce05><rect class="ch-eye" x="11.8" y="7" width="2.8" height="8" rx="1.4" data-v-1b04ce05></rect><rect class="ch-eye" x="17.4" y="7" width="2.8" height="8" rx="1.4" data-v-1b04ce05></rect></g></mask></defs><rect x="1" y="1" width="30" height="20" rx="6" fill="var(--logo)" mask="url(#kimiEyes)" data-v-1b04ce05></rect>',2)])],34)),Be[23]||(Be[23]=w("span",{class:"ch-name"},"Kimi Code",-1)),C(o)?(x(),Se(Cp,{key:0,class:"ch-backend",clickable:s.value!==null,title:C(n)("sidebar.backendTitle",{backend:e.backend,endpoint:i.value}),onClick:Nn},{default:Ie(()=>[w("span",{class:Ue(["ch-backend-kind",`is-${e.backend}`])},R(e.backend),3),w("span",DH," · "+R(i.value),1),s.value!==null?(x(),Se(Ge,{key:0,name:"chevron-down",size:"sm"})):ue("",!0)]),_:1},8,["clickable","title"])):ue("",!0)],64))]),C(iu)?ue("",!0):(x(),Se(Xn,{key:0,class:"ch-collapse",size:"sm",label:C(n)("sidebar.collapseSidebar"),onClick:Be[0]||(Be[0]=St(Bt=>u("collapse"),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"panel-collapse"})]),_:1},8,["label"]))]),w("div",PH,[w("button",{class:"btn-new-chat",type:"button",onClick:Be[1]||(Be[1]=St(Bt=>u("create"),["stop"]))},[ae(Ge,{name:"chat-new"}),w("span",null,R(C(n)("sidebar.newChat")),1)]),ue("",!0)]),w("div",{class:Ue(["search-wrap",{"search-wrap--scrolled":y.value}])},[w("button",{class:"search",type:"button",onClick:h},[ae(Ge,{class:"search-icon",name:"search"}),w("span",HH,R(C(n)("sidebar.search")),1),ae(Er,{keys:C(f)},null,8,["keys"])])],2),w("div",{class:"sessions",onScroll:k},[e.groups.length===0?(x(),E("div",WH,R(C(n)("workspace.noWorkspace")),1)):(x(),E(We,{key:1},[w("div",zH,[w("span",UH,R(C(n)("sidebar.workspaces")),1),w("div",qH,[ae(Xn,{class:"side-section-toggle",size:"sm",label:N.value?C(n)("sidebar.expandAll"):C(n)("sidebar.collapseAll"),onClick:Be[3]||(Be[3]=St(Bt=>N.value?I():A(),["stop"]))},{default:Ie(()=>[N.value?(x(),Se(Ge,{key:0,name:"expand"})):(x(),Se(Ge,{key:1,name:"collapse"}))]),_:1},8,["label"]),ae(Xn,{class:"side-section-toggle side-section-kebab",size:"sm",label:C(n)("sidebar.options"),"aria-haspopup":"menu","aria-expanded":ut.value,onClick:Be[4]||(Be[4]=St(Bt=>Ft(Bt),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"dots-horizontal"})]),_:1},8,["label","aria-expanded"])])]),(x(!0),E(We,null,rt(e.groups,Bt=>(x(),E("div",{key:Bt.workspace.id,class:Ue(["ws-drop-target",{"drop-before":B.value?.id===Bt.workspace.id&&B.value.position==="before","drop-after":B.value?.id===Bt.workspace.id&&B.value.position==="after"}]),onDragover:Yt=>O(Yt,Bt.workspace.id),onDrop:Yt=>U(Bt.workspace.id)},[ae(MH,{group:Bt,"active-workspace-id":e.activeWorkspaceId,"active-id":e.activeId,"renaming-id":q.value,"rename-value":ee.value,"rename-input-ref":ne(),"pending-by-session":e.pendingBySession,"unread-by-session":e.unreadBySession,"ws-menu-open-id":se.value,dragging:S.value===Bt.workspace.id,"is-collapsed":v,"is-expanded":$,onGroupClick:Z,onGroupContextmenu:G,onToggleWsMenu:be,onCreateInWorkspace:Be[5]||(Be[5]=Yt=>u("createInWorkspace",Yt)),onSelectSession:ie,onRenameSession:Be[6]||(Be[6]=(Yt,vn)=>u("rename",Yt,vn)),onArchiveSession:Be[7]||(Be[7]=Yt=>u("archive",Yt)),onForkSession:Be[8]||(Be[8]=Yt=>u("fork",Yt)),onExportSession:Be[9]||(Be[9]=Yt=>u("export",Yt)),onLoadMore:F,onToggleExpand:T,onConfirmRename:K,onCancelRename:ve,onUpdateRenameValue:he,onWsDragstart:W,onWsDragend:z},null,8,["group","active-workspace-id","active-id","renaming-id","rename-value","rename-input-ref","pending-by-session","unread-by-session","ws-menu-open-id","dragging"])],42,jH))),128))],64))],32),w("div",VH,[w("button",{class:"btn-settings",type:"button",onClick:Be[10]||(Be[10]=St(Bt=>u("openSettings"),["stop"]))},[ae(Ge,{name:"settings"}),w("span",null,R(C(n)("settings.title")),1)])])],4),Ae.value?(x(),Se(Ml,{key:0,ref_key:"ghMenuRef",ref:Q,class:"gh-menu",style:on(Y.value),onClick:Be[11]||(Be[11]=St(()=>{},["stop"]))},{default:Ie(()=>[ae(Tn,{onClick:ye},{default:Ie(()=>[ot(R(C(n)("sidebar.copyPath")),1)]),_:1}),ae(Tn,{onClick:de},{default:Ie(()=>[ot(R(C(n)("sidebar.rename")),1)]),_:1}),ae(Tn,{danger:"",onClick:V},{default:Ie(()=>[ot(R(C(n)("sidebar.removeWorkspace")),1)]),_:1})]),_:1},8,["style"])):ue("",!0),se.value!==null&&pe.value?(x(),Se(Ml,{key:1,ref_key:"wsMenuRef",ref:Ne,class:"ws-menu",style:on(ke.value),onClick:Be[15]||(Be[15]=St(()=>{},["stop"]))},{default:Ie(()=>[ae(Tn,{onClick:Be[12]||(Be[12]=Bt=>Ze(pe.value))},{default:Ie(()=>[ot(R(C(n)("sidebar.copyPath")),1)]),_:1}),ae(Tn,{separator:""}),ae(Tn,{onClick:Be[13]||(Be[13]=Bt=>tt(pe.value))},{default:Ie(()=>[ot(R(C(n)("sidebar.rename")),1)]),_:1}),ae(Tn,{separator:""}),ae(Tn,{danger:"",onClick:Be[14]||(Be[14]=Bt=>lt(pe.value))},{default:Ie(()=>[ot(R(C(n)("sidebar.removeWorkspace")),1)]),_:1})]),_:1},8,["style"])):ue("",!0),ut.value?(x(),Se(Ml,{key:2,ref_key:"sectionMenuRef",ref:Tt,class:"section-menu",style:on(mt.value),onClick:Be[18]||(Be[18]=St(()=>{},["stop"]))},{default:Ie(()=>[ae(Tn,{onClick:Be[16]||(Be[16]=Bt=>Hn("manual"))},{default:Ie(()=>[w("span",KH,[e.workspaceSortMode==="manual"?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):ue("",!0)]),ot(" "+R(C(n)("sidebar.sortManual")),1)]),_:1}),ae(Tn,{onClick:Be[17]||(Be[17]=Bt=>Hn("recent"))},{default:Ie(()=>[w("span",GH,[e.workspaceSortMode==="recent"?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):ue("",!0)]),ot(" "+R(C(n)("sidebar.sortRecent")),1)]),_:1})]),_:1},8,["style"])):ue("",!0),Pt.value?(x(),Se(Ml,{key:3,ref_key:"backendMenuRef",ref:pn,class:"backend-menu",style:on(bn.value),onClick:Be[19]||(Be[19]=St(()=>{},["stop"]))},{default:Ie(()=>[(x(),E(We,null,rt(r,Bt=>ae(Tn,{key:Bt,onClick:Yt=>Wt(Bt)},{default:Ie(()=>[w("span",YH,[a(Bt)?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):ue("",!0)]),w("span",ZH,R(Bt),1),w("span",XH,R(l(Bt)),1)]),_:2},1032,["onClick"])),64))]),_:1},8,["style"])):ue("",!0),d.value?(x(),Se(QP,{key:4,sessions:e.sessions,"active-id":e.activeId,onSelect:ie,onClose:Be[20]||(Be[20]=Bt=>d.value=!1)},null,8,["sessions","active-id"])):ue("",!0),(x(),Se(_1,{to:"body"},[vt.value?(x(),Se(C(to),{key:0,onClose:Be[21]||(Be[21]=Bt=>vt.value=!1)})):ue("",!0)]))],6))}}),eW=dt(JH,[["__scopeId","data-v-1b04ce05"]]);function tW(e){try{const t=yo(e);if(t===null)return null;const n=Number(t);return Number.isFinite(n)?n:null}catch{return null}}function nW(e,t){try{Eo(e,String(t))}catch{}}function oW(e){const{storageKey:t,defaultWidth:n,min:o,max:s,reverse:i=!1}=e;function r(k){return Number.isFinite(k)?Math.min(NA(s),Math.max(o,Math.round(k))):n}const l=oe(r(tW(t)??n)),a=oe(!1);function c(k){const g=r(k);l.value=g,nW(t,g)}let u=0,d=0,f=null,h=-1;function p(k){if(!a.value)return;const g=k.clientX-u;c(d+(i?-g:g))}function m(){if(a.value){if(a.value=!1,typeof document<"u"&&(document.body.style.userSelect="",document.body.style.cursor=""),f){try{f.releasePointerCapture(h)}catch{}f.removeEventListener("pointermove",p),f.removeEventListener("pointerup",m),f.removeEventListener("pointercancel",m)}f=null,h=-1}}function y(k){k.preventDefault(),a.value=!0,u=k.clientX,d=r(l.value),f=k.currentTarget,h=k.pointerId,typeof document<"u"&&(document.body.style.userSelect="none",document.body.style.cursor="col-resize");try{f.setPointerCapture(h)}catch{}f.addEventListener("pointermove",p),f.addEventListener("pointerup",m),f.addEventListener("pointercancel",m)}return ho(m),{width:l,dragging:a,clamp:r,setWidth:c,onPointerDown:y}}const sW=["aria-label"],iW=Je({__name:"ResizeHandle",props:{storageKey:{},defaultWidth:{},min:{},max:{},reverse:{type:Boolean},ariaLabel:{}},emits:["update:width","update:dragging"],setup(e,{emit:t}){const n=e,o=t,{t:s}=$t(),{width:i,dragging:r,onPointerDown:l}=oW({storageKey:n.storageKey,defaultWidth:n.defaultWidth,min:n.min,max:()=>n.max,reverse:n.reverse});return o("update:width",i.value),et(i,a=>o("update:width",a)),et(r,a=>o("update:dragging",a)),(a,c)=>(x(),E("div",{class:Ue(["rh",{dragging:C(r)}]),role:"separator","aria-orientation":"vertical","aria-label":e.ariaLabel??C(s)("layout.resizeHandleAria"),onPointerdown:c[0]||(c[0]=(...u)=>C(l)&&C(l)(...u))},[...c[1]||(c[1]=[w("span",{class:"rh-bar","aria-hidden":"true"},null,-1)])],42,sW))}}),H_=dt(iW,[["__scopeId","data-v-48fd0a6d"]]),rW={preview:"Preview",confirm:"Confirm",cancel:"Cancel"},lW={authBannerMessage:"Not signed in · Sign in to Kimi Code to start a conversation",authBannerLogin:"Sign in",authPageTitle:"Sign in to Kimi Code",authPageMessage:"Connect your Kimi Code account before starting or continuing conversations.",authPageLogin:"Sign in",connecting:"Connecting…",connectRetrying:"Cannot reach the server — retrying…",internalBuildBanner:"Internal testing only"},aW={workspaceMeta:"workspace · {branch}",sessionsHeader:"sessions",workspaces:"Workspaces",sortWorkspaces:"Sort workspaces",sortManual:"Manual",sortRecent:"Last edited",collapseAll:"Collapse all workspaces",expandAll:"Expand all workspaces",newSession:"New Session",newChat:"New Chat",newWorkspace:"New Workspace",emptyState:"No sessions yet · click New Session to start",archiveConfirm:"Archive this session? You can restore it later from Settings.",options:"Options",rename:"Rename",copyPath:"Copy path",copySessionId:"Copy session ID",copied:"Copied ✓",copyFailed:"Copy failed",archive:"Archive",fork:"Fork session",export:"Export session",delete:"Delete",removeWorkspace:"Remove workspace",brand:"Kimi Code",signedIn:"Signed in",signOut:"Sign out",notSignedIn:"Not signed in",signIn:"Sign in",language:"Language",daemon:"Daemon",backendTitle:"Backend {backend} · {endpoint} — click to switch",noSessions:"No conversations yet",showMore:"Load {count} more conversations",showLess:"Show less",showAll:"Show {count} more conversations",loadingMore:"Loading…",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",searchPlaceholder:"Search sessions",search:"Search",searchHint:"↑↓ navigate · ↵ open · Esc close",searchNoResults:"No matching sessions"},cW={switcherTitle:"Switch workspace",switchTooltip:"Switch workspace",eyebrow:"Workspace",branchLabel:"branch: {branch}",noBranch:"no branch",sessionCount:"{count} session | {count} sessions",allWorkspaces:"All workspaces",currentWorkspace:"Current workspace only",addWorkspace:"Add workspace…",noWorkspace:"No workspace",deleteHasSessions:"This workspace still has sessions — archive them before deleting it",removeWorkspaceConfirm:'Remove workspace "{name}"?',swarmEnableConfirm:"Enable swarm mode? The agent will run multiple sub-agents in parallel.",goalStartConfirm:'Start goal: "{objective}"? The agent will run autonomously toward it.',scopeCurrent:"this workspace",scopeAll:"all workspaces",newInGroup:"New session in this workspace",addTitle:"Add workspace",recentLabel:"Recent folders",cancel:"Cancel",addFailed:"Couldn't open this folder. Check the path and try again.",openThisFolder:"Open this folder",up:"Up",browsing:"Browsing…",filterPlaceholder:"Filter subfolders…",searchPlaceholder:"Fuzzy-search subfolders, or paste an absolute path…",searching:"Searching…",noFilterMatch:"No subfolders match “{q}”",noSubfolders:"No subfolders here",browseHint:'Click a folder to enter it, then "Open this folder" to add it as a workspace.',checkingPath:"Checking path…",pathPickHint:"Path not found — did you mean:",noPathMatch:"Path not found — no matching folders under {parent}",badParent:"Parent directory does not exist: {parent}",pathFollowHint:'Folder located — press Enter or "Open this folder" to add it.',degradedPlaceholder:"Type an absolute path, press Enter to add…",degradedHint:"File browsing is unavailable — type an absolute path and press Enter to add.",attentionTitle:"{count} item needs your attention | {count} items need your attention",awaitingAnswer:"Answer",awaitingAnswerTitle:"A question is waiting for your answer",awaitingPermission:"Approve",awaitingPermissionTitle:"An action is waiting for your approval",aborted:"Stopped",abortedTitle:"This session was interrupted before finishing"},uW={jumpToLatestAria:"Jump to latest message",toc:"Conversation outline",newMessages:"Latest messages",loading:"Loading…",starting:"Starting conversation…",emptyWorkspaceHint:"Send in {name}",switchWorkspace:"Switch workspace",addWorkspace:"New workspace",moreWorkspaces:"More workspaces ({count})",compacting:"Compacting context…",compactedPlain:"Context compacted",compactedAuto:"Context auto-compacted",compactedTokens:" ({before} → {after} tokens)",viewSummary:"View summary",summaryTitle:"Compaction summary",manuallyAborted:"Manually stopped",activatedSkill:"Activated skill: {name}",undo:"Undo",undoTooltip:"Undoing the conversation will not roll back code changes",undoConfirm:"Undo last message?",yesterday:"Yesterday",loadOlder:"Load earlier messages",loadingOlder:"Loading earlier messages…",cron:{fired:"Scheduled reminder fired",missed:"Missed scheduled reminders",job:"job {id}",oneShot:"one-shot",coalesced:"{n} fires coalesced",missedCount:"{n} missed",finalDelivery:"final delivery",everyMinute:"Every minute",everyNMinutes:"Every {n} minutes",everyHour:"Every hour",everyNHours:"Every {n} hours",dailyAt:"Daily at {time}",weekdaysAt:"Weekdays at {time}",expand:"Show more",collapse:"Show less"}},dW={connectionConnected:"Connected",connectionConnecting:"Connecting…",connectionDisconnected:"Disconnected",ctxTooltip:"Used {used} / {max} tokens ({pct}%)",modelLabel:"Model",permissionManual:"Manual",permissionAuto:"Auto",permissionYolo:"YOLO",permissionManualDesc:"Ask for approval on every tool action",permissionAutoDesc:"Fully autonomous — agent decides everything without asking",permissionYoloDesc:"Auto-approve tool actions, but agent may still ask questions",planLabel:"Plan",planDesc:"Have the agent make a plan before changing files",planOn:"on",planOff:"off",planTooltip:"Toggle plan mode (research before editing)",modesLabel:"Mode",goalLabel:"Goal",goalDesc:"Track one objective until it is complete",swarmLabel:"Swarm",swarmDesc:"Run parallel agents for broader exploration",modeOff:"Off",goalPlaceholder:"What should the agent achieve?",goalStart:"Start",goalPause:"Pause",goalResume:"Resume",goalCancel:"Cancel",goalCancelConfirm:"Cancel this goal? It cannot be resumed afterwards.",goalCancelConfirmYes:"Yes",goalCancelConfirmNo:"No",goalStatusActive:"Active",goalStatusPaused:"Paused",goalStatusBlocked:"Blocked",goalStatusComplete:"Complete",modeNotSupported:"Not supported",thinkingLabel:"thinking",thinkingTooltip:"Toggle thinking mode",thinkingOn:"On",thinkingOff:"Off",cacheNote:"Note: Switching models or thinking effort invalidates the existing prompt cache. Start a new chat to avoid extra token costs.",starredModels:"Starred",moreModels:"More models…",statusPanelTitle:"Session status",statusPanelClose:"Close",statusModel:"Model",statusThinking:"Thinking",statusPermission:"Permission",statusPlanMode:"Plan mode",statusSwarmMode:"Swarm mode",swarmOn:"on",swarmOff:"off",statusContext:"Context",statusCost:"Cost",statusContextValue:"{used} / {max} ({pct}%)",statusNone:"—",activityRunning:"Running…",activityAwaitingApproval:"Awaiting approval",activityAwaitingQuestion:"Awaiting answer",interrupt:"Interrupt",runningShort:"in progress"},fW={placeholder:"Type a message…",send:"Send ↵",queueLabel:"Queue",placeholderRunning:"Press Enter to queue · Ctrl+S to inject into the running turn",starting:"Sending…",queueAutoDrain:"sends automatically when the current turn ends",queueNext:"Up next",queueDragTitle:"Drag to reorder",editQueued:"Edit (load back into the input)",queuedAttachments:"attachment ×{n}",queuedHasImage:"Contains {n} image(s) — remove only, not editable",attachmentImage:"Image",attachmentVideo:"Video",attachmentFile:"File",attachmentOpenUnsupported:"Can’t open {name} — this file type isn’t supported",dropToAttach:"Drop files to attach",remove:"Remove",removeNamed:"Remove {name}",uploading:"Uploading",uploadFailed:"Upload failed",attachFile:"Attach file",previewAttachment:"Preview {name}",interrupt:"Interrupt",interruptTitle:"Interrupt current operation",expandTitle:"Expand input for multi-line editing",collapseTitle:"Collapse input",emptyConversationTitle:"Kimi Code",emptyConversation:"No messages yet — type below to start the conversation",quickStartPlaceholder:"Type a message to start a new conversation…",thinkingSuffix:" · thinking",thinkingSuffixEffort:" · {level}"},hW={title:"Sign in to Kimi Code",close:"Close (Esc)",starting:"Starting authorization flow…",lead:"Click the button below to authorize in a new browser tab.",authorizeInBrowser:"Authorize in browser",orDivider:"or",fallbackPrefix:"On another device? Open ",fallbackSuffix:" and enter the device code:",copy:"Copy",copied:"Copied",waitingAuth:"Waiting for authorization",waitingAutoClose:"Waiting for authorization, signs in automatically…",success:"Authorized",successHint:"Loading, will close automatically…",expiredTitle:"Authorization code expired",expiredHint:"Please restart the authorization flow",retry:"Retry",closeBtn:"Close",errorTitle:"The current daemon does not support login yet",errorHint:"Please upgrade kimi-code and try again",pollErrorTitle:"Lost connection to the daemon",pollErrorHint:"Authorization polling failed repeatedly. Check the kimi-code process and try again."},pW={dialogLabel:"Manage providers",title:"Provider management",close:"Close (Esc)",loading:"Loading providers…",unavailable:"The daemon does not support provider management yet",empty:"No providers yet",status:{connected:"Connected",error:"Error",unconfigured:"Not configured"},keySet:"key set",keyNotSet:"key not set",modelCount:"{count} models",confirmDelete:"Confirm delete?",refresh:"Refresh",delete:"Delete",refreshTitle:"Refresh {type}",deleteTitle:"Delete {type}",loginKimi:"Sign in to Kimi",loginAnthropic:"Sign in to Anthropic",enterApiKey:"Enter API Key",fieldType:"Type",fieldApiKey:"API Key",fieldBaseUrl:"Base URL",fieldDefaultModel:"Default model",baseUrlPlaceholder:"https://… (optional)",optional:"Optional",apiKeyRequired:"API Key cannot be empty",add:"Add",escClose:"Esc to close"},mW={dialogLabel:"Switch model",title:"Switch model",close:"Close (Esc)",allTab:"All",providerTabs:"Model providers",searchPlaceholder:"Search models or providers…",loading:"Loading models…",unavailable:"The daemon does not support model listing yet",contextSuffix:"{size} ctx",emptyNoModels:"The daemon offers no selectable models",emptyNoMatch:"No matching models",starTitle:"Add to favorites",unstarTitle:"Remove from favorites",footerHint:"↑↓ Navigate · Enter Select · Esc Close"},gW={justNow:"just now"},vW={title:{shell:"Run command?",diff:"Apply changes?",file:"Write file?",fileop:"File operation?",url:"Fetch URL?",search:"Search?",invocation:"Invoke?",todo:"Update todo?",plan_review:"Ready to build with this plan?",generic:"Approve action?"},subagentBadge:"sub agent · {name}",required:"APPROVAL REQUIRED",danger:"Danger: {detail}",searchQueryLabel:"query",searchScope:"scope: {scope}",feedbackPlaceholder:"Explain why you are rejecting… (Enter to submit, Esc to cancel)",feedbackHint:"Enter to submit · Esc to cancel",approve:"Approve",approveSession:"Approve for session",reject:"Reject",feedback:"+Feedback",approvePlan:"Approve plan",revise:"Revise",rejectAndExit:"Reject and Exit"},yW={title:"Question",step:"Q{current}/{total}",back:"‹ Back",nextQuestion:"Next question ›",otherDefault:"Other…",submit:"Submit",dismiss:"Dismiss",minimize:"Minimize",expand:"Expand"},kW={tag:"tasks",summary:"{run} running · {done} done",stop:"stop",defaultDescription:"Background task",dockTasks:"Background tasks",dockBash:"Bash",dockSubagent:"Sub Agent",dockTodos:"Todos",running:"running",closePanel:"Close panel",timingRunning:"Running · {time}",timingDone:"Done · {sec}s",emptyTasks:"No background tasks running",emptyBash:"No bash tasks running",emptySubagent:"No sub agent tasks running",emptyTodo:"No todos yet",openTab:"Open the tasks tab",openDetail:"Open",collapse:"Collapse",expand:"Expand"},bW={panelTitle:"Thinking",close:"Close"},xW={title:"Changes",branch:"branch",aheadTitle:"ahead of remote",behindTitle:"behind remote",changeCount:"{count} changes",empty:"No git changes / not provided by daemon",clean:"Working tree clean, no changes",back:"Back",loading:"Loading diff…",noDiff:"No line changes for this file",list:"List",tree:"Tree",close:"Close"},wW={},_W={empty:"Select a file on the left to preview",loading:"Loading…",lineCount:"{count} lines",copy:"Copy",copied:"Copied",copyPath:"Copy path",openInEditor:"Open",reveal:"Reveal",download:"Download",close:"Close",search:"Search",prevMatch:"Previous match",nextMatch:"Next match",htmlMode:"HTML preview mode",markdownMode:"Markdown preview mode",preview:"Preview",source:"Source",imageFit:"Image sizing",fit:"Fit",actual:"Actual",pdfNoPreview:"This PDF cannot be embedded here. Download it to view.",imageNoPreview:"Image file · {mime} · {size} · preview unavailable",videoNoPreview:"Video file · {mime} · {size} · preview unavailable",binaryNoPreview:"Binary file · {mime} · {size} bytes · preview unavailable",unknownType:"unknown type",copyCode:"Copy code",enlargeImage:"Enlarge image",errors:{emptyPath:"File path is empty",unsupportedPath:"URLs and remote paths cannot be previewed",outsideWorkspace:"Only files inside the current workspace can be previewed",isDirectory:"Select a file instead of a directory",loadFailed:"Unable to read this file"}},SW={searching:"Searching…",noMatch:"No matches"},CW={dismiss:"Close",errorLabel:"Error",noteLabel:"Note",agentError:{title:"Model request failed",connection:"Cannot connect to the model service",auth:"Model authentication failed",rateLimit:"Model rate limit reached",overloaded:"Model overloaded",filtered:"Response filtered by the provider",api:"Model API error",contextOverflow:"Context size exceeded"},details:{cause:"Cause",code:"Error code",connection:"Connection",contentType:"Content type",details:"Server details",duration:"Duration",endpoint:"Endpoint",errorName:"Error type",message:"Message",operation:"Operation",phase:"Failure phase",request:"Request",requestId:"Request ID",responsePreview:"Response preview",sessionId:"Session ID",stack:"Stack",status:"HTTP status",timeout:"Timeout",timestamp:"Time"},daemonApiTitle:"Kimi daemon returned an error",daemonNetworkMessage:"Web did not receive a response from the local service. Check that Kimi daemon is still running, or refresh the page.",daemonNetworkTitle:"Cannot connect to Kimi daemon",diagnostics:"Diagnostics",hideDetails:"Hide details",operationFailedMessage:"The last operation did not finish. Try again later.",operationFailedTitle:"Operation failed",sessionSnapshotMessage:"Web could not load the current conversation. Check that Kimi daemon is still running, or refresh the page.",sessionSnapshotTitle:"Cannot load current conversation",showDetails:"Show details",copyDetails:"Copy diagnostics",copied:"Copied",wsTitle:"Realtime connection error",goal:{alreadyExists:"This session already has an active goal. Cancel it before starting a new one.",notFound:"No goal to act on — it may have already finished or been cancelled.",statusInvalid:"The current goal state does not allow this action.",notResumable:"This goal cannot be resumed (it may be cancelled or completed).",objectiveTooLong:"The objective is too long. Please shorten it and try again."}},AW={new:{desc:"Create a new session"},clear:{desc:"Clear and start a new session"},login:{desc:"Sign in to Kimi in the browser"},plan:{desc:"Toggle plan mode on/off"},swarm:{desc:"Toggle swarm mode; /swarm <task> runs a task in swarm"},goal:{desc:"Create/control a goal: /goal <objective>, /goal pause|resume|cancel"},btw:{desc:"Side chat: /btw <question> asks a forked side session"},yolo:{desc:"Auto-approve tool actions; the agent may still ask questions"},auto:{desc:"Fully autonomous — the agent never asks questions"},thinking:{desc:"Set the thinking level"},compact:{desc:"Compact the conversation history"},fork:{desc:"Fork this session into a new one"},export:{desc:"Download this session and troubleshooting logs as a ZIP",noSession:"Open a session before exporting it."},status:{desc:"View session status"},undo:{desc:"Undo the last message"}},MW={label:{read:"Read",bash:"Run",edit:"Edit",write:"Write",grep:"Search",glob:"Find",ls:"List",web_fetch:"Fetch",search:"Search",todo:"Todo",task:"Task",swarm:"Swarm",ask_user:"Question",goal_create:"Start Goal",goal_get:"Read Goal",goal_budget:"Set Goal Budget",goal_update:"Update Goal"},swarm:{progress:"{done} / {total}",runningSub:"{count} in progress",doneSub:"{completed} completed · {failed} failed",phaseQueued:"Queued",phaseWorking:"Working",phaseSuspended:"Suspended",phaseCompleted:"Completed",phaseFailed:"Failed",waiting:"Waiting for subagents…"},chip:{lines:"{count} lines",results:"{count} results",edited:"edited",created:"created",todos:"{count} items"},goal:{objectiveWithCriterion:"{objective} · {criterion}",status:"Status: {status}",budget:"{value} {unit}",turns:"{value} turns",tokens:"{value} tokens",milliseconds:"{value} ms",seconds:"{value} sec",minutes:"{value} min",hours:"{value} hr"},group:{title:"{count} tool call | {count} tool calls",running:"running",error:"failed",done:"done"},ask:{dismissed:"Dismissed",answer:"{count} answer",answers:"{count} answers",answered:"Answered",more:"(+{count} more)"}},EW={resizeHandleAria:"Resize sidebar width",resizePreviewAria:"Resize preview panel width",detailPanelAria:"Detail panel"},TW={openSwitcher:"Switch session / workspace",openSettings:"Session settings",settingsTitle:"Session settings",groupSession:"Current session",groupApp:"App preferences",sheetLabel:"Sheet",closeSheet:"Close",tapToCycle:"tap to cycle",running:"running",idle:"idle",sessionCount:"{n} sessions",newSession:"New session",permManualSub:"confirm every tool",permAutoSub:"fully autonomous, never asks",permYoloSub:"auto-approve tools, may still ask",planModeSub:"Plan mode",swarmModeSub:"Swarm mode",archivedSessions:"Archived sessions",archivedSessionsSub:"Browse and restore archived sessions",archivedBack:"Back"},NW={colorSchemeLabel:"Light/Dark",light:"Moon Bright",dark:"Moon Dark",system:"System",accentLabel:"Accent",accentBlue:"Blue",accentBlack:"Black"},IW={preview:"预览",confirm:"确认",cancel:"取消"},LW={authBannerMessage:"未登录 · 需要登录 Kimi Code 才能开始对话",authBannerLogin:"登录",authPageTitle:"登录 Kimi Code",authPageMessage:"先连接 Kimi Code 账号,然后再开始或继续对话。",authPageLogin:"登录",connecting:"连接中…",connectRetrying:"无法连接服务器,正在重试…",internalBuildBanner:"仅供内部测试"},$W={workspaceMeta:"workspace · {branch}",sessionsHeader:"sessions",workspaces:"工作区",sortWorkspaces:"工作区排序",sortManual:"手动排序",sortRecent:"按最后编辑时间",collapseAll:"折叠全部工作区",expandAll:"展开全部工作区",newSession:"新建会话",newChat:"新建对话",newWorkspace:"新建工作区",emptyState:"还没有会话 · 点击 新建会话 开始",archiveConfirm:"确认归档会话?归档后可以从「设置」中恢复",options:"选项",rename:"重命名",copyPath:"复制路径",copySessionId:"复制 Session ID",copied:"已复制 ✓",copyFailed:"复制失败",archive:"归档",fork:"分叉会话",export:"导出会话",delete:"删除",removeWorkspace:"移除工作区",brand:"Kimi Code",signedIn:"已登录",signOut:"退出登录",notSignedIn:"未登录",signIn:"登录",language:"语言",daemon:"后台",backendTitle:"后端 {backend} · {endpoint} — 点击切换",noSessions:"暂无对话",showMore:"加载更多 {count} 个对话",showLess:"收起",showAll:"展开剩余 {count} 个对话",loadingMore:"加载中…",collapseSidebar:"收起侧边栏",expandSidebar:"展开侧边栏",searchPlaceholder:"搜索会话",search:"搜索",searchHint:"↑↓ 选择 · ↵ 打开 · Esc 关闭",searchNoResults:"没有匹配的会话"},FW={switcherTitle:"切换工作区",switchTooltip:"切换工作区",eyebrow:"工作区",branchLabel:"分支: {branch}",noBranch:"无分支",sessionCount:"{count} 个会话",allWorkspaces:"全部工作区",currentWorkspace:"仅当前工作区",addWorkspace:"添加工作区…",noWorkspace:"暂无工作区",deleteHasSessions:"工作区内还有会话,请先归档这些会话再删除",removeWorkspaceConfirm:"移除工作区「{name}」?",swarmEnableConfirm:"启用 swarm 模式?Agent 将并行运行多个子 agent。",goalStartConfirm:"启动 goal:「{objective}」?Agent 将自主执行。",scopeCurrent:"当前工作区",scopeAll:"全部工作区",newInGroup:"在此工作区新建会话",addTitle:"添加工作区",recentLabel:"最近的文件夹",cancel:"取消",addFailed:"无法打开此文件夹,请检查路径后重试。",openThisFolder:"打开此文件夹",up:"上一级",browsing:"加载中…",filterPlaceholder:"过滤子文件夹…",searchPlaceholder:"模糊搜索子文件夹,或粘贴绝对路径…",searching:"搜索中…",noFilterMatch:"没有匹配「{q}」的子文件夹",noSubfolders:"此处没有子文件夹",browseHint:'点击文件夹进入,再点"打开此文件夹"将其添加为工作区。',checkingPath:"检查路径…",pathPickHint:"此路径不存在,你是不是想找:",noPathMatch:"此路径不存在,「{parent}」下没有匹配的文件夹",badParent:"上级目录不存在:{parent}",pathFollowHint:'已定位到目标文件夹,按回车或点击"打开此文件夹"完成添加。',degradedPlaceholder:"输入绝对路径,回车添加…",degradedHint:"守护进程无法浏览文件系统,请直接输入绝对路径后回车添加。",attentionTitle:"{count} 项待处理",awaitingAnswer:"待回答",awaitingAnswerTitle:"有提问等待你回答",awaitingPermission:"待授权",awaitingPermissionTitle:"有操作等待你授权",aborted:"已中断",abortedTitle:"此会话在完成前被中断"},OW={jumpToLatestAria:"跳到最新消息",toc:"对话目录",newMessages:"最新消息",loading:"加载中…",starting:"正在创建对话…",emptyWorkspaceHint:"在 {name} 中发送",switchWorkspace:"切换工作区",addWorkspace:"添加工作区",moreWorkspaces:"更多工作区 ({count})",compacting:"正在压缩上下文…",compactedPlain:"上下文已压缩",compactedAuto:"已自动压缩上下文",compactedTokens:"({before} → {after} tokens)",viewSummary:"查看摘要",summaryTitle:"压缩摘要",manuallyAborted:"您已手动终止",activatedSkill:"已激活技能: {name}",undo:"撤销",undoTooltip:"撤销对话不会回滚代码",undoConfirm:"撤销上一条消息?",yesterday:"昨天",loadOlder:"加载更早的消息",loadingOlder:"正在加载更早的消息…",cron:{fired:"定时任务已触发",missed:"错过的定时提醒",job:"任务 {id}",oneShot:"单次",coalesced:"已合并 {n} 次触发",missedCount:"错过 {n} 次",finalDelivery:"最后一次投递",everyMinute:"每分钟",everyNMinutes:"每 {n} 分钟",everyHour:"每小时",everyNHours:"每 {n} 小时",dailyAt:"每天 {time}",weekdaysAt:"工作日 {time}",expand:"展开",collapse:"收起"}},BW={connectionConnected:"已连接",connectionConnecting:"连接中…",connectionDisconnected:"未连接",ctxTooltip:"使用 {used} / {max} tokens ({pct}%)",modelLabel:"模型",permissionManual:"逐条确认",permissionAuto:"完全自主",permissionYolo:"自动通过",permissionManualDesc:"每个工具操作都需要你手动确认",permissionAutoDesc:"完全自主运行,智能体自己做决定,不再询问",permissionYoloDesc:"自动批准工具操作,但遇到关键问题仍会询问",planLabel:"计划",planDesc:"先让智能体梳理计划,再修改文件",planOn:"开",planOff:"关",planTooltip:"切换计划模式(先调研再修改)",modesLabel:"模式",goalLabel:"目标",goalDesc:"持续跟踪一个目标,直到任务完成",swarmLabel:"Swarm",swarmDesc:"并行运行多个智能体,适合大范围探索",modeOff:"未启用",goalPlaceholder:"让智能体完成什么目标?",goalStart:"开始",goalPause:"暂停",goalResume:"继续",goalCancel:"取消",goalCancelConfirm:"是否需要取消当前目标?取消后将无法恢复。",goalCancelConfirmYes:"是",goalCancelConfirmNo:"否",goalStatusActive:"进行中",goalStatusPaused:"已暂停",goalStatusBlocked:"已阻塞",goalStatusComplete:"已完成",modeNotSupported:"暂不支持",thinkingLabel:"思考",thinkingTooltip:"切换思考模式",thinkingOn:"开",thinkingOff:"关",cacheNote:"提示:切换模型或思考程度会使已有的提示词缓存失效。建议新建对话,避免额外的 token 消耗。",starredModels:"收藏",moreModels:"更多模型…",statusPanelTitle:"会话状态",statusPanelClose:"关闭",statusModel:"模型",statusThinking:"思考强度",statusPermission:"权限",statusPlanMode:"计划模式",statusSwarmMode:"Swarm 模式",swarmOn:"开",swarmOff:"关",statusContext:"上下文",statusCost:"花费",statusContextValue:"{used} / {max} ({pct}%)",statusNone:"—",activityRunning:"运行中…",activityAwaitingApproval:"等待批准",activityAwaitingQuestion:"等待回答",interrupt:"中断",runningShort:"进行中"},RW={placeholder:"输入消息…",send:"发送 ↵",queueLabel:"队列",placeholderRunning:"输入会加入队列 · Ctrl+S 立即插入运行中的回合",starting:"正在发送…",queueAutoDrain:"当前回合结束后自动逐条发送",queueNext:"下一条",queueDragTitle:"拖拽排序",editQueued:"编辑(载入到输入框)",queuedAttachments:"附件 ×{n}",queuedHasImage:"包含 {n} 张图片 — 只能移除,不能编辑",attachmentImage:"图片",attachmentVideo:"视频",attachmentFile:"文件",attachmentOpenUnsupported:"无法打开 {name}:暂不支持此文件类型",dropToAttach:"松开鼠标添加附件",remove:"移除",removeNamed:"移除 {name}",uploading:"上传中",uploadFailed:"上传失败",attachFile:"添加附件",previewAttachment:"预览 {name}",interrupt:"中断",interruptTitle:"中断当前操作",expandTitle:"展开输入框进行多行编辑",collapseTitle:"收起输入框",emptyConversationTitle:"Kimi Code",emptyConversation:"还没有消息 —— 在下方输入开始对话",quickStartPlaceholder:"输入消息开始新对话…",thinkingSuffix:" · 思考",thinkingSuffixEffort:" · {level}"},DW={title:"登录 Kimi Code",close:"关闭 (Esc)",starting:"正在启动授权流程…",lead:"点击下方按钮,在新标签页中完成授权。",authorizeInBrowser:"在浏览器中授权",orDivider:"或者",fallbackPrefix:"换个设备?在浏览器打开 ",fallbackSuffix:" 输入设备码:",copy:"复制",copied:"已复制",waitingAuth:"等待授权",waitingAutoClose:"等待授权,完成后自动登录…",success:"已授权",successHint:"正在加载,稍后自动关闭…",expiredTitle:"授权码已过期",expiredHint:"请重新开始授权流程",retry:"重试",closeBtn:"关闭",errorTitle:"当前 daemon 暂不支持登录",errorHint:"请升级 kimi-code 后重试",pollErrorTitle:"与 daemon 的连接已断开",pollErrorHint:"授权轮询连续失败,请检查 kimi-code 进程后重试"},PW={dialogLabel:"管理提供商",title:"提供商管理",close:"关闭 (Esc)",loading:"加载提供商中…",unavailable:"daemon 暂不支持提供商管理",empty:"暂无提供商",status:{connected:"已连接",error:"错误",unconfigured:"未配置"},keySet:"key 已设置",keyNotSet:"未设置 key",modelCount:"{count} 个模型",confirmDelete:"确认删除?",refresh:"刷新",delete:"删除",refreshTitle:"刷新 {type}",deleteTitle:"删除 {type}",loginKimi:"登录 Kimi",loginAnthropic:"登录 Anthropic",enterApiKey:"填写 API Key",fieldType:"类型",fieldApiKey:"API Key",fieldBaseUrl:"Base URL",fieldDefaultModel:"默认模型",baseUrlPlaceholder:"https://… (可选)",optional:"可选",apiKeyRequired:"API Key 不能为空",add:"添加",escClose:"Esc 关闭"},HW={dialogLabel:"切换模型",title:"切换模型",close:"关闭 (Esc)",allTab:"全部",providerTabs:"模型提供商",searchPlaceholder:"搜索模型或提供商…",loading:"加载模型中…",unavailable:"daemon 暂不支持模型列表",contextSuffix:"{size} ctx",emptyNoModels:"daemon 未提供可选模型",emptyNoMatch:"无匹配模型",starTitle:"添加到收藏",unstarTitle:"取消收藏",footerHint:"↑↓ 导航 · Enter 选择 · Esc 关闭"},WW={justNow:"刚刚"},zW={title:{shell:"运行命令?",diff:"应用修改?",file:"写入文件?",fileop:"文件操作?",url:"抓取 URL?",search:"搜索?",invocation:"调用?",todo:"更新 todo?",plan_review:"按这份 plan 开始实现?",generic:"批准操作?"},subagentBadge:"子 agent · {name}",required:"APPROVAL REQUIRED",danger:"危险: {detail}",searchQueryLabel:"查询",searchScope:"范围:{scope}",feedbackPlaceholder:"说明拒绝原因… (Enter 提交, Esc 取消)",feedbackHint:"Enter 提交 · Esc 取消",approve:"批准",approveSession:"本会话内批准",reject:"拒绝",feedback:"+反馈",approvePlan:"批准 plan",revise:"修改",rejectAndExit:"拒绝并退出"},UW={title:"提问",step:"Q{current}/{total}",back:"‹ 返回",nextQuestion:"下一题 ›",otherDefault:"其他…",submit:"提交",dismiss:"放弃",minimize:"最小化",expand:"展开"},qW={tag:"任务",summary:"{run} 运行中 · {done} 完成",stop:"stop",defaultDescription:"后台任务",dockTasks:"后台任务",dockBash:"后台 Bash",dockSubagent:"子 Agent",dockTodos:"待办",running:"运行中",closePanel:"关闭面板",timingRunning:"运行中 · {time}",timingDone:"完成 · {sec}s",emptyTasks:"暂无后台任务",emptyBash:"暂无后台 Bash 任务",emptySubagent:"暂无子 Agent 任务",emptyTodo:"暂无待办事项",openTab:"查看全部后台任务",openDetail:"查看",collapse:"折叠",expand:"展开"},jW={panelTitle:"思考过程",close:"关闭"},VW={title:"改动",branch:"分支",aheadTitle:"领先远程",behindTitle:"落后远程",changeCount:"{count} 改动",empty:"无 git 改动 / daemon 未提供",clean:"工作区干净,无改动",back:"返回",loading:"正在加载 diff…",noDiff:"该文件没有行级改动",list:"列表",tree:"树形",close:"关闭"},KW={},GW={empty:"选择左侧文件预览",loading:"加载中…",lineCount:"{count} 行",copy:"复制",copied:"已复制",copyPath:"复制路径",openInEditor:"打开",reveal:"显示",download:"下载",close:"关闭",search:"搜索",prevMatch:"上一个匹配",nextMatch:"下一个匹配",htmlMode:"HTML 预览模式",markdownMode:"Markdown 预览模式",preview:"预览",source:"源码",imageFit:"图片缩放",fit:"适应",actual:"原始",pdfNoPreview:"无法内嵌预览此 PDF,可以下载后查看",imageNoPreview:"图片文件 · {mime} · {size} · 暂不预览",videoNoPreview:"视频文件 · {mime} · {size} · 暂不预览",binaryNoPreview:"二进制文件 · {mime} · {size} 字节 · 暂不预览",unknownType:"未知类型",copyCode:"复制代码",enlargeImage:"放大图片",errors:{emptyPath:"文件路径为空",unsupportedPath:"不支持预览 URL 或远程路径",outsideWorkspace:"只能预览当前 workspace 内的文件",isDirectory:"请选择具体文件,而不是目录",loadFailed:"无法读取这个文件"}},YW={searching:"搜索中…",noMatch:"无匹配"},ZW={dismiss:"关闭",errorLabel:"错误",noteLabel:"提示",agentError:{title:"模型请求失败",connection:"无法连接模型服务",auth:"模型认证失败",rateLimit:"模型请求被限流",overloaded:"模型服务过载",filtered:"响应被提供方过滤",api:"模型接口返回错误",contextOverflow:"上下文超出模型限制"},details:{cause:"底层原因",code:"错误码",connection:"连接状态",contentType:"响应类型",details:"服务端详情",duration:"耗时",endpoint:"请求地址",errorName:"错误类型",message:"错误信息",operation:"操作",phase:"失败阶段",request:"请求",requestId:"Request ID",responsePreview:"响应预览",sessionId:"Session ID",stack:"堆栈",status:"HTTP 状态",timeout:"超时设置",timestamp:"时间"},daemonApiTitle:"Kimi daemon 返回错误",daemonNetworkMessage:"Web 没有拿到本地服务的响应。请确认 Kimi daemon 仍在运行,或刷新页面重试。",daemonNetworkTitle:"无法连接到 Kimi daemon",diagnostics:"诊断信息",hideDetails:"收起详情",operationFailedMessage:"刚才的操作没有完成,请稍后重试。",operationFailedTitle:"操作失败",sessionSnapshotMessage:"Web 没能加载当前会话内容。请确认 Kimi daemon 仍在运行,或刷新页面重试。",sessionSnapshotTitle:"无法加载当前会话内容",showDetails:"查看详情",copyDetails:"复制诊断信息",copied:"已复制",wsTitle:"实时连接出错",goal:{alreadyExists:"当前会话已有一个进行中的目标,请先取消它再创建新目标。",notFound:"没有找到可操作的目标,可能它已经结束或被取消。",statusInvalid:"当前目标状态不支持这个操作。",notResumable:"这个目标无法恢复(可能已取消或已完成)。",objectiveTooLong:"目标描述太长了,请精简后重试。"}},XW={new:{desc:"创建新会话"},clear:{desc:"清空并新建会话"},login:{desc:"在浏览器中登录 Kimi"},plan:{desc:"切换计划模式 开/关"},swarm:{desc:"切换 swarm 模式;/swarm <任务> 直接在 swarm 下执行"},goal:{desc:"创建/控制目标:/goal <目标>、/goal pause|resume|cancel"},btw:{desc:"侧边聊天:/btw <问题> 向 fork 的侧边会话提问"},yolo:{desc:"自动批准工具操作,Agent 仍可能提问"},auto:{desc:"完全自主,Agent 不再提问"},thinking:{desc:"设置思考强度"},compact:{desc:"压缩会话历史"},fork:{desc:"把当前会话 fork 出一个新会话"},export:{desc:"将当前会话和排障日志下载为 ZIP 压缩包",noSession:"请先打开一个会话再导出。"},status:{desc:"查看会话状态"},undo:{desc:"撤销上一条消息"}},QW={label:{read:"读取",bash:"运行",edit:"编辑",write:"写入",grep:"搜索",glob:"查找",ls:"列目录",web_fetch:"抓取",search:"搜索",todo:"待办",task:"任务",swarm:"Swarm",ask_user:"提问",goal_create:"启动目标",goal_get:"读取目标",goal_budget:"设置目标预算",goal_update:"更新目标"},swarm:{progress:"{done} / {total}",runningSub:"{count} 个进行中",doneSub:"完成 {completed} · 失败 {failed}",phaseQueued:"排队",phaseWorking:"运行中",phaseSuspended:"暂停",phaseCompleted:"完成",phaseFailed:"失败",waiting:"等待子任务加入…"},chip:{lines:"{count} 行",results:"{count} 结果",edited:"已编辑",created:"已创建",todos:"{count} 项"},goal:{objectiveWithCriterion:"{objective} · {criterion}",status:"状态:{status}",budget:"{value} {unit}",turns:"{value} 轮",tokens:"{value} token",milliseconds:"{value} 毫秒",seconds:"{value} 秒",minutes:"{value} 分钟",hours:"{value} 小时"},group:{title:"{count} 个工具调用",running:"运行中",error:"有失败",done:"已完成"},ask:{dismissed:"已忽略",answer:"{count} 个回答",answers:"{count} 个回答",answered:"已回答",more:"(还有 {count} 个)"}},JW={resizeHandleAria:"调整侧栏宽度",resizePreviewAria:"调整预览面板宽度",detailPanelAria:"详情面板"},ez={openSwitcher:"切换会话 / 工作区",openSettings:"会话设置",settingsTitle:"会话设置",groupSession:"当前会话",groupApp:"应用偏好",sheetLabel:"面板",closeSheet:"关闭",tapToCycle:"点击切换",running:"运行中",idle:"空闲",sessionCount:"{n} 个会话",newSession:"新建会话",permManualSub:"每个工具都确认",permAutoSub:"完全自主,不再提问",permYoloSub:"自动批准工具,仍可能提问",planModeSub:"计划模式",swarmModeSub:"Swarm 模式",archivedSessions:"已归档会话",archivedSessionsSub:"查看并恢复已归档会话",archivedBack:"返回"},tz={colorSchemeLabel:"明暗",light:"月之亮面",dark:"月之暗面",system:"跟随系统",accentLabel:"主题色",accentBlue:"蓝色",accentBlack:"黑色"},nz={title:"Welcome to Kimi Web",subtitle:"Pick a few preferences — you can change them anytime in Settings.",languageLabel:"Language",start:"Get started",skip:"Skip",reopen:"Preferences / onboarding"},oz={title:"欢迎来使用 Kimi Web",subtitle:"来选择一些你的偏好 —— 之后也可以在设置里随时修改。",languageLabel:"语言",start:"开始使用",skip:"跳过",reopen:"偏好 / 引导"},sz={title:"Settings",close:"Close (Esc)",tabs:{general:"General",agent:"Agent",account:"Account",advanced:"Advanced",archived:"Archived"},appearance:"Appearance",notifications:"Notifications",notifyOnComplete:"Notify when a turn completes",notifyOnQuestion:"Notify when a question needs an answer",notifyOnApproval:"Notify when a tool needs approval",soundOnComplete:"Play a sound when a turn completes, needs an answer, or needs approval",notifyDenied:"Blocked in browser settings",notifyTitle:"Kimi Code · Turn finished",notifyQuestionTitle:"Kimi Code · Needs answer",notifyApprovalTitle:"Kimi Code · Approval required",notifyFallback:"View result",notifyQuestionFallback:"A question is waiting for your answer",notifyApprovalFallback:"A tool needs your approval",account:"Account",uiFontSize:"Font size",agentDefaults:"Agent defaults",providers:"Providers",providersHint:"Add, remove, or refresh providers",manageProviders:"Manage",saving:"Saving",defaultModel:"Default model",defaultModelHint:"New sessions prefer this model",noDefaultModel:"No default model",defaultPermission:"Default permission",defaultPermissionHint:"Only affects newly-created sessions",defaultThinking:"Thinking by default",defaultThinkingHint:"Whether new sessions start with thinking enabled",defaultPlanMode:"Plan mode by default",defaultPlanModeHint:"Whether new sessions start in plan mode",mergeSkills:"Merge all available skills",mergeSkillsHint:"Show project, plugin, and user skills together",telemetry:"Improve product with usage data",telemetryHint:"When on, we collect anonymous interaction data (such as clicks, interruptions, and feature usage) to improve the product experience. You can turn it off at any time.",telemetryRestartHint:"Takes effect after restarting the service.",credentialReady:"Credential configured",credentialMissing:"Missing credential",configUnavailable:"The server did not return config yet. These settings are unavailable.",advanced:"Advanced",build:"Build",serverVersion:"Server version",backend:"Backend",exportLog:"Troubleshooting log",logHint:"Enable with ?debug=1 to capture",exportLogBtn:"Export log",conversationToc:"Show conversation outline",conversationTocHint:"Show a clickable outline in the right margin to jump between messages",archivedTitle:"Archived sessions",archivedDesc:"Browse archived sessions, see their workspace path, name, and archive time, and restore them to the session list.",archivedSearch:"Search archived sessions",archivedAllWorkspaces:"All workspaces",archivedSortLabel:"Sort by",archivedSortArchived:"Archive time",archivedSortCreated:"Created time",archivedSortName:"Name",archivedRestore:"Restore",archivedEmpty:"No archived sessions yet",archivedNoMatch:"No matching archived sessions",archivedSessionsCount:"{count} sessions",archivedAt:"Archived {time}",archivedLoadMore:"Load more",archivedLoading:"Loading…",archivedLoadingAll:"Loading all archived sessions…"},iz={title:"设置",close:"关闭 (Esc)",tabs:{general:"通用",agent:"Agent",account:"账户",advanced:"高级",archived:"已归档"},appearance:"外观",notifications:"通知",notifyOnComplete:"会话完成时通知",notifyOnQuestion:"待回答时通知",notifyOnApproval:"待审批时通知",soundOnComplete:"会话完成、待回答或待审批时播放提示音",notifyDenied:"已在浏览器设置中被阻止",notifyTitle:"Kimi Code · 回合完成",notifyQuestionTitle:"Kimi Code · 待回答",notifyApprovalTitle:"Kimi Code · 等待审批",notifyFallback:"点击查看结果",notifyQuestionFallback:"有提问等待你回答",notifyApprovalFallback:"有工具等待你审批",account:"账户",uiFontSize:"字体大小",agentDefaults:"Agent 默认值",providers:"提供商",providersHint:"添加、删除或刷新提供商",manageProviders:"管理",saving:"保存中",defaultModel:"默认模型",defaultModelHint:"新会话会优先使用这个模型",noDefaultModel:"未设置默认模型",defaultPermission:"默认权限",defaultPermissionHint:"只影响之后新建的会话",defaultThinking:"默认开启思考",defaultThinkingHint:"新会话默认是否开启 thinking",defaultPlanMode:"默认计划模式",defaultPlanModeHint:"新会话默认进入 plan mode",mergeSkills:"合并所有可用 Skills",mergeSkillsHint:"让项目、插件和用户 Skills 一起出现在可用列表中",telemetry:"使用数据改进产品",telemetryHint:"开启后,我们会收集您的匿名交互数据(如点击、打断、功能使用等),用于改进产品体验。您可以随时关闭。",telemetryRestartHint:"更改后需重启服务生效。",credentialReady:"凭据已配置",credentialMissing:"缺少凭据",configUnavailable:"当前服务端没有返回 config,设置项暂不可用。",advanced:"高级",build:"构建",serverVersion:"服务端版本",backend:"后端",exportLog:"故障排查日志",logHint:"加 ?debug=1 开启采集",exportLogBtn:"导出日志",conversationToc:"显示对话目录",conversationTocHint:"在右侧显示可点击跳转的对话目录",archivedTitle:"已归档会话",archivedDesc:"查看已归档会话,确认其所属工作区路径、会话名称和归档时间,并可恢复到会话列表。",archivedSearch:"搜索已归档会话",archivedAllWorkspaces:"所有工作区",archivedSortLabel:"排序方式",archivedSortArchived:"归档时间",archivedSortCreated:"创建时间",archivedSortName:"按字母顺序",archivedRestore:"恢复",archivedEmpty:"还没有归档的会话",archivedNoMatch:"没有匹配的已归档会话",archivedSessionsCount:"{count} 个会话",archivedAt:"归档于 {time}",archivedLoadMore:"加载更多",archivedLoading:"加载中…",archivedLoadingAll:"正在加载全部归档会话…"},rz={openInEditor:"Open in editor",openInEditorShort:"Open",chooseOpenApp:"Choose application",copyAll:"Copy all as Markdown",copyFinalSummary:"Copy final summary",copied:"Copied",copyPath:"Copy path",changed:"{n} changed",gitTooltip:"Open Files > Changed",detached:"detached",openPr:"Open pull request",prStatusOpen:"open",prStatusClosed:"closed",prStatusMerged:"merged",prStatusDraft:"draft",prStatusUnknown:"unknown",options:"Options",copySessionId:"Copy Session ID",renameSession:"Rename",forkSession:"Fork session",archiveSession:"Archive",exportSession:"Export session"},lz={openInEditor:"在编辑器中打开",openInEditorShort:"打开",chooseOpenApp:"选择应用",copyAll:"复制全部对话为 Markdown",copyFinalSummary:"仅复制最终总结",copied:"已复制",copyPath:"复制路径",changed:"{n} 处改动",gitTooltip:"打开「文件 > 改动」",detached:"游离",openPr:"打开 Pull Request",prStatusOpen:"已打开",prStatusClosed:"已关闭",prStatusMerged:"已合并",prStatusDraft:"草稿",prStatusUnknown:"未知",options:"选项",copySessionId:"复制 Session ID",renameSession:"重命名",forkSession:"分叉会话",archiveSession:"归档",exportSession:"导出会话"},az={title:"Side chat",subtitle:"forked from this session",empty:"Ask a quick question on the side — it shares this session’s context.",placeholder:"Ask the side chat…",send:"Send"},cz={title:"侧边聊天",subtitle:"从当前会话 fork",empty:"在侧边随手问一句 —— 它共享当前会话的上下文。",placeholder:"问问侧边聊天…",send:"发送"},uz={en:{common:rW,app:lW,sidebar:aW,workspace:cW,conversation:uW,status:dW,composer:fW,login:hW,providers:pW,model:mW,sessions:gW,approval:vW,question:yW,tasks:kW,thinking:bW,diff:xW,fileTree:wW,filePreview:_W,mention:SW,warnings:CW,commands:AW,tools:MW,layout:EW,mobile:TW,theme:NW,onboarding:nz,settings:sz,header:rz,sideChat:az},zh:{common:IW,app:LW,sidebar:$W,workspace:FW,conversation:OW,status:BW,composer:RW,login:DW,providers:PW,model:HW,sessions:WW,approval:zW,question:UW,tasks:qW,thinking:jW,diff:VW,fileTree:KW,filePreview:GW,mention:YW,warnings:ZW,commands:XW,tools:QW,layout:JW,mobile:ez,theme:tz,onboarding:oz,settings:iz,header:lz,sideChat:cz}},b6=[{code:"en",label:"English"},{code:"zh",label:"中文"}];function dz(){const e=yo(Dt.locale);return e==="en"||e==="zh"?e:globalThis.navigator?.language?.toLowerCase().startsWith("zh")?"zh":"en"}const Rn=nF({legacy:!1,locale:dz(),fallbackLocale:"en",messages:uz});function x6(e){Rn.global.locale.value=e,Eo(Dt.locale,e)}const is=Rn.global.t,fz={read:"tools.label.read",bash:"tools.label.bash",edit:"tools.label.edit",multi_edit:"tools.label.edit",write:"tools.label.write",grep:"tools.label.grep",glob:"tools.label.glob",ls:"tools.label.ls",web_fetch:"tools.label.web_fetch",search:"tools.label.search",todo:"tools.label.todo",task:"tools.label.task",agentswarm:"tools.label.swarm",askuserquestion:"tools.label.ask_user",creategoal:"tools.label.goal_create",getgoal:"tools.label.goal_get",setgoalbudget:"tools.label.goal_budget",updategoal:"tools.label.goal_update"},hz={multiedit:"multi_edit",multiedits:"multi_edit",shell:"bash",run:"bash",exec:"bash",ripgrep:"grep",rg:"grep",find:"glob",fetch:"web_fetch",webfetch:"web_fetch",url_fetch:"web_fetch",urlfetch:"web_fetch",list:"ls",listdir:"ls",list_dir:"ls",todowrite:"todo",todo_write:"todo",todoread:"todo",todolist:"todo",todo_list:"todo",agent:"task",subagent:"task",websearch:"search",web_search:"search",create_goal:"creategoal",get_goal:"getgoal",set_goal_budget:"setgoalbudget",update_goal:"updategoal"};function Ja(e){const t=(e??"").trim().toLowerCase().replace(/[\s-]+/g,"_");return hz[t]??t}function ec(e){const t=fz[Ja(e)];return t?is(t):e}const pz={read:"file-text",bash:"terminal",edit:"pencil",multi_edit:"pencil",write:"file-plus",grep:"search",search:"search",glob:"glob",ls:"folder",web_fetch:"globe",todo:"check-list",task:"sparkles",agentswarm:"git-pull-request",askuserquestion:"help-circle",creategoal:"target",getgoal:"target",setgoalbudget:"target",updategoal:"target",croncreate:"calendar-schedule",cronlist:"calendar-todo",crondelete:"calendar-close"};function I1(e){const t=Ja(e);let n=pz[t];return!n&&(e??"").trim().toLowerCase().includes("skill")&&(n="bolt"),n||(n="tool"),Dc(n,"sm")}const w6=80;function mz(e,t=w6){const n=e.trim();return n.length>t?n.slice(0,t-1)+"…":n}function gz(e,t){const n=e.trim();return!!(n===""||n==="{}"||n==="[]"||n==="null"||t&&Object.keys(t).length===0)}function vz(e){const t=e.trim();if(!t.startsWith("{"))return null;try{const n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function rn(e){return typeof e=="string"&&e.length>0?e:void 0}function yl(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function yz(e){try{const t=new URL(e),n=t.pathname.split("/").filter(Boolean)[0];return n?`${t.host}/${n}`:t.host}catch{return e.replace(/^https?:\/\//,"")}}function Sg(e){return rn(e.path)??rn(e.file_path)??rn(e.filePath)??rn(e.filename)}const kz={active:"status.goalStatusActive",blocked:"status.goalStatusBlocked",complete:"status.goalStatusComplete"};function bz(e){const t=rn(e);if(!t)return;const n=kz[t];return n?is(n):t}function xz(e){const t=yl(e.value),n=rn(e.unit);if(!(t===void 0||!n))switch(n){case"turns":return is("tools.goal.turns",{value:t});case"tokens":return is("tools.goal.tokens",{value:t});case"milliseconds":return is("tools.goal.milliseconds",{value:t});case"seconds":return is("tools.goal.seconds",{value:t});case"minutes":return is("tools.goal.minutes",{value:t});case"hours":return is("tools.goal.hours",{value:t});default:return is("tools.goal.budget",{value:t,unit:n})}}const wz=64;function pf(e,t,n=!1){const o=(s,i=w6)=>n?s.trim():mz(s,i);try{const s=vz(t);if(!n&&gz(t,s))return"";const i=()=>o(t.replace(/^·\s*/,""));if(!s)return i();switch(Ja(e)){case"read":{const r=Sg(s);if(!r)return i();const l=yl(s.offset)??yl(s.line_start)??yl(s.start_line),a=yl(s.limit)??yl(s.length),c=yl(s.line_end)??yl(s.end_line)??(l!==void 0&&a!==void 0?l+a:void 0);return o(l!==void 0&&c!==void 0?`${r}:${l}-${c}`:l!==void 0?`${r}:${l}`:r)}case"write":{const r=Sg(s);return r?o(`${r} ${is("tools.chip.created")}`):i()}case"edit":case"multi_edit":{const r=Sg(s);return r?o(r):i()}case"bash":{const r=rn(s.command)??rn(s.cmd)??rn(s.script);return r?o(r,wz):i()}case"grep":case"search":{const r=rn(s.pattern)??rn(s.query)??rn(s.regex),l=rn(s.path)??rn(s.glob)??rn(s.include);return r&&l?o(`${r} in ${l}`):r?o(r):i()}case"glob":{const r=rn(s.pattern)??rn(s.glob)??rn(s.query),l=rn(s.path)??rn(s.cwd);return r&&l?o(`${r} in ${l}`):r?o(r):rn(s.path)?o(rn(s.path)):i()}case"ls":{const r=rn(s.path)??rn(s.dir)??rn(s.directory)??rn(s.cwd);return r?o(r):i()}case"web_fetch":{const r=rn(s.url)??rn(s.uri);return r?o(yz(r)):i()}case"todo":case"task":{const r=rn(s.description)??rn(s.title)??rn(s.prompt)??rn(s.name)??rn(s.subagent_type);if(r)return o(r);const l=Array.isArray(s.todos)?s.todos:Array.isArray(s.items)?s.items:void 0;return l?o(is("tools.chip.todos",{count:l.length})):i()}case"creategoal":{if(n)return i();const r=rn(s.objective),l=rn(s.completionCriterion);return r&&l?o(is("tools.goal.objectiveWithCriterion",{objective:r,criterion:l})):r?o(r):i()}case"getgoal":return n?i():"";case"setgoalbudget":{if(n)return i();const r=xz(s);return r?o(r):i()}case"updategoal":{if(n)return i();const r=bz(s.status);return r?o(is("tools.goal.status",{status:r})):i()}default:return i()}}catch{return t}}function _z(e){try{switch(Ja(e.name)){case"bash":return e.timing?e.timing:"";case"read":{if(e.output&&e.output.length>0){const t=e.output.length;return is("tools.chip.lines",{count:t})}return""}case"edit":case"multi_edit":case"write":{if(e.output){for(const n of e.output){const o=n.match(/\+(\d+).*[-−](\d+)/);if(o)return`+${o[1]} −${o[2]}`}const t=e.output.find(n=>/\d+/.test(n));if(t){const n=t.match(/\+(\d+)/),o=t.match(/[-−](\d+)/);if(n||o)return`${n?`+${n[1]}`:""} ${o?`−${o[1]}`:""}`.trim()}if(e.status!=="error")return is("tools.chip.edited")}return""}case"grep":case"search":return e.output&&e.output.length>0?is("tools.chip.results",{count:e.output.length}):"";default:return""}}catch{return""}}const Sz=Je({__name:"StatusDot",props:{status:{}},setup(e){const t=e;function n(s){switch(s){case"ok":case"done":case"completed":case"success":return"ok";case"error":case"failed":case"danger":return"error";case"running":case"working":case"in_progress":case"active":return"running";case"suspended":return"suspended";default:return"idle"}}const o=D(()=>n(t.status));return(s,i)=>(x(),E("span",{class:Ue(["kw-dot",`kw-dot--${o.value}`]),"aria-hidden":"true"},null,2))}}),mf=dt(Sz,[["__scopeId","data-v-e36198e5"]]),Cz=["innerHTML"],Az={class:"bh-text"},Mz={class:"a"},Ez={key:0,class:"p"},Tz={class:"rt"},Nz=["aria-label"],Iz={key:0,class:"tm"},Lz=["inert"],$z={class:"bb-pad"},Fz=Je({__name:"ToolRow",props:{status:{},icon:{default:""},name:{},arg:{default:""},time:{default:""},open:{type:Boolean,default:!1},expandable:{type:Boolean,default:!1},stacked:{type:Boolean,default:!1},stackPosition:{default:"single"}},emits:["toggle"],setup(e,{emit:t}){const n=t,o=Jt("pinScroll",()=>{}),s=oe(null);function i(){n("toggle");const r=s.value;r&&yt(()=>o(r))}return(r,l)=>(x(),E("div",{class:Ue(["box",{open:e.open,stacked:e.stacked,err:e.status==="error","stack-first":e.stackPosition==="first","stack-middle":e.stackPosition==="middle","stack-last":e.stackPosition==="last"}])},[w("div",{class:"bh",ref_key:"bhEl",ref:s,onClick:i},[e.icon?(x(),E("span",{key:0,class:"gl",innerHTML:e.icon,"aria-hidden":"true"},null,8,Cz)):ue("",!0),w("span",Az,[w("span",Mz,R(e.name),1),ae(an,{text:e.arg},{default:Ie(()=>[e.arg?(x(),E("span",Ez,R(e.arg),1)):ue("",!0)]),_:1},8,["text"])]),w("span",Tz,[w("span",{class:Ue(["status",e.status]),role:"status","aria-label":e.status},[e.status==="ok"?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):e.status==="error"?(x(),Se(Ge,{key:1,name:"close",size:"sm"})):e.status==="suspended"?(x(),Se(mf,{key:2,status:"suspended"})):(x(),Se(mf,{key:3,status:"running"}))],10,Nz),jn(r.$slots,"trailing"),e.time?(x(),E("span",Iz,R(e.time),1)):ue("",!0)]),e.expandable?(x(),Se(Ge,{key:1,class:"car",name:e.open?"chevron-down":"chevron-right",size:"sm"},null,8,["name"])):ue("",!0)],512),w("div",{class:Ue(["bb",{open:e.open}]),inert:!e.open},[w("div",$z,[jn(r.$slots,"default")])],10,Lz)],2))}}),L1=dt(Fz,[["__scopeId","data-v-fef8aad2"]]),Oz={key:0,class:"at-type"},Bz={key:1,class:"at-task"},Rz={key:2,class:"bb-code"},Dz=Je({__name:"AgentTool",props:{tool:{},mobile:{type:Boolean,default:!1},stackPosition:{default:"single"},toolDiffPanel:{type:Boolean,default:!1}},emits:["openMedia","openFile","openToolDiff","openAgent"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t;function i(k){if(!k)return{};try{const g=JSON.parse(k);return{description:typeof g.description=="string"?g.description:void 0,subagentType:typeof g.subagent_type=="string"?g.subagent_type:void 0,prompt:typeof g.prompt=="string"?g.prompt:void 0}}catch{return{}}}const r=D(()=>i(o.tool.arg)),l=D(()=>!!o.tool.output&&o.tool.output.length>0),a=D(()=>!!r.value.prompt||!!r.value.subagentType||l.value),c=oe(o.tool.defaultExpanded===!0&&a.value),u=D(()=>o.tool.status),d=D(()=>ec(o.tool.name)),f=D(()=>I1(o.tool.name)),h=D(()=>r.value.description||r.value.subagentType||""),p=Jt("resolveAgentTaskId"),m=D(()=>p?p(o.tool.id)!==void 0:!0);function y(){a.value&&(c.value=!c.value)}return et(()=>[o.tool.defaultExpanded,o.tool.output?.length,o.tool.status],()=>{o.tool.defaultExpanded===!0&&a.value&&(c.value=!0)}),(k,g)=>(x(),Se(L1,{status:u.value,icon:f.value,name:d.value,arg:c.value?"":h.value,time:e.tool.timing,open:c.value,expandable:a.value,stacked:e.stackPosition!=="single","stack-position":e.stackPosition,onToggle:y},{trailing:Ie(()=>[m.value?(x(),E("button",{key:0,type:"button",class:"at-open",onClick:g[0]||(g[0]=St(v=>s("openAgent",e.tool.id),["stop"]))},R(C(n)("tasks.openDetail")),1)):ue("",!0)]),default:Ie(()=>[r.value.subagentType?(x(),E("div",Oz,R(r.value.subagentType),1)):ue("",!0),r.value.prompt?(x(),E("div",Bz,R(r.value.prompt),1)):ue("",!0),l.value?(x(),E("div",Rz,[(x(!0),E(We,null,rt(e.tool.output??[],(v,b)=>(x(),E("div",{key:b},R(v),1))),128))])):ue("",!0)]),_:1},8,["status","icon","name","arg","time","open","expandable","stacked","stack-position"]))}}),Pz=dt(Dz,[["__scopeId","data-v-14ef8750"]]);function Hz(e){if(!e)return[];try{const n=JSON.parse(e).questions;if(!Array.isArray(n))return[];const o=[];for(const s of n){if(!s||typeof s!="object")continue;const i=s,r=Array.isArray(i.options)?i.options.map(l=>{const a=l&&typeof l=="object"?l:{};return{label:typeof a.label=="string"?a.label:"",description:typeof a.description=="string"?a.description:""}}):[];o.push({question:typeof i.question=="string"?i.question:"",header:typeof i.header=="string"?i.header:"",options:r,multiSelect:i.multi_select===!0})}return o}catch{return[]}}const Uh={recognized:!1,answers:{},note:""};function Wz(e){const t=e?.[0];if(!t)return Uh;let n;try{n=JSON.parse(t)}catch{return Uh}if(!n||typeof n!="object"||Array.isArray(n))return Uh;const o=n.answers;if(!o||typeof o!="object"||Array.isArray(o))return Uh;const s={};for(const[i,r]of Object.entries(o))typeof r=="string"?s[i]=r:r===!0&&(s[i]=!0);return{recognized:!0,answers:s,note:typeof n.note=="string"?n.note:""}}function zz(e,t,n){return e[t]??e[`q_${n}`]}const Uz=/^opt_\d+_(\d+)$/;function qz(e,t=[]){if(e===void 0)return{selected:new Set,otherText:"",indeterminate:!1};if(e===!0)return{selected:new Set,otherText:"",indeterminate:!0};const n=new Map;t.forEach((r,l)=>{r.label.length>0&&!n.has(r.label)&&n.set(r.label,l)});const o=n.get(e);if(o!==void 0)return{selected:new Set([o]),otherText:"",indeterminate:!1};const s=new Set,i=[];for(const r of e.split(",")){const l=r.trim(),a=n.get(l);if(a!==void 0){s.add(a);continue}const c=Uz.exec(l);c?s.add(Number(c[1])):l.length>0&&i.push(l)}return{selected:s,otherText:i.join(", "),indeterminate:!1}}const jz={key:0,class:"chip"},Vz={key:0,class:"au-dismissed"},Kz={key:1,class:"au-list"},Gz={class:"au-q"},Yz={key:0,class:"au-hdr"},Zz={class:"au-qtext"},Xz={class:"au-opts"},Qz={class:"au-glyph"},Jz={class:"au-label"},eU={key:0,class:"au-desc"},tU={key:0,class:"au-opt sel"},nU={class:"au-glyph"},oU={class:"au-label"},sU={key:1,class:"au-opt sel"},iU={class:"au-label"},rU={key:2,class:"au-raw"},lU=80,aU=Je({__name:"AskUserTool",props:{tool:{},mobile:{type:Boolean,default:!1},stackPosition:{default:"single"},toolDiffPanel:{type:Boolean,default:!1}},emits:["openMedia","openFile","openToolDiff"],setup(e){const t=e,{t:n}=$t();function o(N,M=lU){const $=N.trim();return $.length>M?$.slice(0,M-1)+"…":$}const s=D(()=>Hz(t.tool.arg)),i=D(()=>Wz(t.tool.output)),r=D(()=>i.value.recognized),l=D(()=>r.value&&Object.keys(i.value.answers).length===0&&i.value.note.length>0),a=D(()=>s.value.map((N,M)=>qz(zz(i.value.answers,N.question,M),N.options))),c=D(()=>Object.keys(i.value.answers).length);function u(N,M){return a.value[N]?.selected.has(M)??!1}function d(N){return a.value[N]?.otherText??""}function f(N){return a.value[N]?.indeterminate??!1}function h(N,M){return N?M?"■":"□":M?"●":"○"}const p=D(()=>{if(!r.value)return o(t.tool.output?.[0]??"");if(l.value)return n("tools.ask.dismissed");const N=s.value[0]?.question??"",M=o(N);return s.value.length<=1?M:`${M} ${n("tools.ask.more",{count:s.value.length-1})}`}),m=D(()=>r.value?l.value?n("tools.ask.dismissed"):c.value===0?"":c.value===1?n("tools.ask.answer",{count:1}):n("tools.ask.answers",{count:c.value}):""),y=D(()=>!!t.tool.output&&t.tool.output.length>0),k=D(()=>r.value&&(s.value.length>0||l.value)||y.value),g=oe(t.tool.defaultExpanded===!0&&k.value),v=D(()=>t.tool.status),b=D(()=>ec(t.tool.name)),A=D(()=>I1(t.tool.name));function I(){k.value&&(g.value=!g.value)}return et(()=>[t.tool.defaultExpanded,t.tool.output?.length,t.tool.status],()=>{t.tool.defaultExpanded===!0&&k.value&&(g.value=!0)}),(N,M)=>(x(),Se(L1,{status:v.value,icon:A.value,name:b.value,arg:g.value?"":p.value,time:e.tool.timing,open:g.value,expandable:k.value,stacked:e.stackPosition!=="single","stack-position":e.stackPosition,onToggle:I},{trailing:Ie(()=>[m.value?(x(),E("span",jz,R(m.value),1)):ue("",!0)]),default:Ie(()=>[l.value?(x(),E("div",Vz,R(i.value.note),1)):r.value?(x(),E("div",Kz,[(x(!0),E(We,null,rt(s.value,($,T)=>(x(),E("div",{key:T,class:"au-block"},[w("div",Gz,[$.header?(x(),E("span",Yz,R($.header),1)):ue("",!0),w("span",Zz,R($.question),1)]),w("div",Xz,[(x(!0),E(We,null,rt($.options,(F,S)=>(x(),E("div",{key:S,class:Ue(["au-opt",{sel:u(T,S)}])},[w("span",Qz,R(h($.multiSelect,u(T,S))),1),w("span",Jz,R(F.label),1),F.description?(x(),E("span",eU,R(F.description),1)):ue("",!0)],2))),128)),d(T)?(x(),E("div",tU,[w("span",nU,R(h($.multiSelect,!0)),1),w("span",oU,R(d(T)),1)])):ue("",!0),f(T)?(x(),E("div",sU,[M[0]||(M[0]=w("span",{class:"au-glyph"},"●",-1)),w("span",iU,R(C(n)("tools.ask.answered")),1)])):ue("",!0)])]))),128))])):(x(),E("div",rU,[(x(!0),E(We,null,rt(e.tool.output??[],($,T)=>(x(),E("div",{key:T},R($),1))),128))]))]),_:1},8,["status","icon","name","arg","time","open","expandable","stacked","stack-position"]))}}),cU=dt(aU,[["__scopeId","data-v-a9a0f259"]]),uU=1e6,W_=5e3;function z_(e){if(e==="")return[];const t=e.split(`
67
+ `,MD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm5-2v16"/><path d="m15 10l-2 2l2 2"/></g></svg>',ED='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm5-2v16"/><path d="m14 10l2 2l-2 2"/></g></svg>',TD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3L18 10a3 3 0 0 0-6-6l-6.5 6.5a4.5 4.5 0 0 0 9 9L21 13"/></svg>',ND='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"/></svg>',ID='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m12.866 3l9.526 16.5a1 1 0 0 1-.866 1.5H2.474a1 1 0 0 1-.866-1.5L11.134 3a1 1 0 0 1 1.732 0m-8.66 16h15.588L12 5.5zM11 16h2v2h-2zm0-7h2v5h-2z"/></svg>',LD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M3 10H2V4.003C2 3.449 2.455 3 2.992 3h18.016A.99.99 0 0 1 22 4.003V10h-1v10.002a.996.996 0 0 1-.993.998H3.993A.996.996 0 0 1 3 20.002zm16 0H5v9h14zM4 5v3h16V5zm5 7h6v2H9z"/></svg>',$D='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m13 16.172l5.364-5.364l1.414 1.414L12 20l-7.778-7.778l1.414-1.414L11 16.172V4h2z"/></svg>',FD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m12 13.171l4.95-4.95l1.414 1.415L12 16L5.636 9.636L7.05 8.222z"/></svg>',OD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m5.828 7l2.536 2.535L6.95 10.95L2 6l4.95-4.95l1.414 1.415L5.828 5H13a8 8 0 1 1 0 16H4v-2h9a6 6 0 0 0 0-12z"/></svg>',BD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m16.172 11l-5.364-5.364l1.414-1.414L20 12l-7.778 7.778l-1.414-1.414L16.172 13H4v-2z"/></svg>',RD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m13.172 12l-4.95-4.95l1.414-1.413L16 12l-6.364 6.364l-1.414-1.415z"/></svg>',O_='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M13 7.828V20h-2V7.828l-5.364 5.364l-1.414-1.414L12 4l7.778 7.778l-1.414 1.414z"/></svg>',DD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m12 10.828l-4.95 4.95l-1.414-1.414L12 8l6.364 6.364l-1.414 1.414z"/></svg>',PD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M4 18v-3.7a1.5 1.5 0 0 0-1.5-1.5H2v-1.6h.5A1.5 1.5 0 0 0 4 9.7V6a3 3 0 0 1 3-3h1v2H7a1 1 0 0 0-1 1v4.1A2 2 0 0 1 4.626 12A2 2 0 0 1 6 13.9V18a1 1 0 0 0 1 1h1v2H7a3 3 0 0 1-3-3m16-3.7V18a3 3 0 0 1-3 3h-1v-2h1a1 1 0 0 0 1-1v-4.1a2 2 0 0 1 1.374-1.9A2 2 0 0 1 18 10.1V6a1 1 0 0 0-1-1h-1V3h1a3 3 0 0 1 3 3v3.7a1.5 1.5 0 0 0 1.5 1.5h.5v1.6h-.5a1.5 1.5 0 0 0-1.5 1.5"/></svg>',HD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M9 3V1H7v2H3a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h18a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1h-4V1h-2v2zm-5 7h16v9H4zm0-5h3v1h2V5h6v1h2V5h3v3H4zm5.879 5.964L12 13.086l2.121-2.122l1.415 1.415l-2.122 2.121l2.121 2.121l-1.414 1.414L12 15.915l-2.121 2.12l-1.415-1.414l2.122-2.12l-2.122-2.122z"/></svg>',WD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M7 3V1h2v2h6V1h2v2h4a1 1 0 0 1 1 1v5h-2V5h-3v2h-2V5H9v2H7V5H4v14h6v2H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm10 9a4 4 0 1 0 0 8a4 4 0 0 0 0-8m-6 4a6 6 0 1 1 12 0a6 6 0 0 1-12 0m5-3v3.414l2.293 2.293l1.414-1.414L18 15.586V13z"/></svg>',zD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M9 1v2h6V1h2v2h4a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h4V1zm11 10H4v8h16zM8 14v2H6v-2zm10 0v2h-8v-2zM7 5H4v4h16V5h-3v2h-2V5H9v2H7z"/></svg>',UD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m10 15.17l9.192-9.191l1.414 1.414L10 17.999l-6.364-6.364l1.414-1.414z"/></svg>',qD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m12 10.587l4.95-4.95l1.414 1.414l-4.95 4.95l4.95 4.95l-1.415 1.414l-4.95-4.95l-4.949 4.95l-1.414-1.415l4.95-4.95l-4.95-4.95L7.05 5.638z"/></svg>',jD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m23 12l-7.071 7.071l-1.414-1.414L20.172 12l-5.657-5.657l1.414-1.414zM3.828 12l5.657 5.657l-1.414 1.414L1 12l7.071-7.071l1.414 1.414z"/></svg>',VD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M15 4h-2v7h7V9h-3.586l4.293-4.293l-1.414-1.414L15 7.586zM4 15h3.586l-4.293 4.293l1.414 1.414L9 16.414V20h2v-7H4z"/></svg>',KD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M3 19h18v2H3zm10-5.828L19.071 7.1l1.414 1.414L12 17L3.515 8.515L4.929 7.1L11 13.173V2h2z"/></svg>',GD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M8.5 7a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m0 6.5a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m1.5 5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0M15.5 7a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m1.5 5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0m-1.5 8a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3"/></svg>',YD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M6.17 18a3.001 3.001 0 0 1 5.66 0H22v2H11.83a3.001 3.001 0 0 1-5.66 0H2v-2zm6-7a3.001 3.001 0 0 1 5.66 0H22v2h-4.17a3.001 3.001 0 0 1-5.66 0H2v-2zm-6-7a3.001 3.001 0 0 1 5.66 0H22v2H11.83a3.001 3.001 0 0 1-5.66 0H2V4zM9 6a1 1 0 1 0 0-2a1 1 0 0 0 0 2m6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2m-6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2"/></svg>',ZD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M17.586 5H14V3h7v7h-2V6.414l-4.293 4.293l-1.414-1.414zM3 14h2v3.586l4.293-4.293l1.414 1.414L6.414 19H10v2H3z"/></svg>',XD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm11-3v8h-2V6.413l-7.793 7.794l-1.414-1.414L17.585 5H13V3z"/></svg>',QD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M15 4H5v16h14V8h-4zM3 2.992C3 2.444 3.447 2 3.999 2H16l5 5v13.993A1 1 0 0 1 20.007 22H3.993A1 1 0 0 1 3 21.008zM11 11V8h2v3h3v2h-3v3h-2v-3H8v-2z"/></svg>',JD='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M7 6V3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1h-3v3c0 .552-.45 1-1.007 1H4.007A1 1 0 0 1 3 21l.003-14c0-.552.45-1 1.006-1zM5.002 8L5 20h10V8zM9 6h8v10h2V4H9z"/></svg>',eP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m21 6.757l-2 2V4h-9v5H5v11h14v-2.757l2-2v5.765a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 20.993V8l6.003-6h10.995C20.55 2 21 2.455 21 2.992zm.778 2.05l1.414 1.415L15.414 18l-1.416-.002l.002-1.412z"/></svg>',B_='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M9 2.003V2h10.998C20.55 2 21 2.455 21 2.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 20.993V8zM5.83 8H9V4.83zM11 4v5a1 1 0 0 1-1 1H5v10h14V4z"/></svg>',tP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M21 8v12.993A1 1 0 0 1 20.007 22H3.993A.993.993 0 0 1 3 21.008V2.992C3 2.455 3.449 2 4.002 2h10.995zm-2 1h-5V4H5v16h14zM8 7h3v2H8zm0 4h8v2H8zm0 4h8v2H8z"/></svg>',nP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M13 9h8L11 24v-9H4l9-15zm-2 2V7.22L7.532 13H13v4.394L17.263 11z"/></svg>',oP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M12.414 5H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414zM4 5v14h16V7h-8.414l-2-2zm7 7V9h2v3h3v2h-3v3h-2v-3H8v-2z"/></svg>',sP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M12.414 5H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414z"/></svg>',iP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M6 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2M3 6a3 3 0 1 1 4 2.83V9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-.17a3.001 3.001 0 1 1 2 0V9a4 4 0 0 1-4 4h-2v2.17a3.001 3.001 0 1 1-2 0V13H9a4 4 0 0 1-4-4v-.17A3 3 0 0 1 3 6m15-1a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-6 12a1 1 0 1 0 0 2a1 1 0 0 0 0-2"/></svg>',rP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M15 5h2a2 2 0 0 1 2 2v8.17a3.001 3.001 0 1 1-2 0V7h-2v3l-4.5-4L15 2zM5 8.83a3.001 3.001 0 1 1 2 0v6.34a3.001 3.001 0 1 1-2 0zM6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 12a1 1 0 1 0 0-2a1 1 0 0 0 0 2m12 0a1 1 0 1 0 0-2a1 1 0 0 0 0 2"/></svg>',lP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.01 8.01 0 0 0 5.648 6.667M10.03 13c.151 2.439.848 4.73 1.97 6.752A15.9 15.9 0 0 0 13.97 13zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.01 8.01 0 0 0 19.938 13M4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333A8.01 8.01 0 0 0 4.062 11m5.969 0h3.938A15.9 15.9 0 0 0 12 4.248A15.9 15.9 0 0 0 10.03 11m4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.01 8.01 0 0 0-5.648-6.667"/></svg>',R_='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M2.992 21A.993.993 0 0 1 2 20.007V3.993A1 1 0 0 1 2.992 3h18.016c.548 0 .992.445.992.993v16.014a1 1 0 0 1-.992.993zM20 15V5H4v14L14 9zm0 2.828l-6-6L6.828 19H20zM8 11a2 2 0 1 1 0-4a2 2 0 0 1 0 4"/></svg>',aP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16M11 7h2v2h-2zm0 4h2v6h-2z"/></svg>',cP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m13.06 8.111l1.415 1.414a7 7 0 0 1 0 9.9l-.354.353a7 7 0 1 1-9.9-9.9l1.415 1.415a5 5 0 1 0 7.071 7.071l.354-.354a5 5 0 0 0 0-7.07l-1.415-1.415zm6.718 6.01l-1.414-1.414a5 5 0 0 0-7.071-7.07l-.354.353a5 5 0 0 0 0 7.07l1.415 1.415l-1.415 1.414l-1.414-1.414a7 7 0 0 1 0-9.9l.354-.353a7 7 0 1 1 9.9 9.9"/></svg>',uP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M8 4h13v2H8zm-5-.5h3v3H3zm0 7h3v3H3zm0 7h3v3H3zM8 11h13v2H8zm0 7h13v2H8z"/></svg>',dP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M8 4h13v2H8zM4.5 6.5a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m0 7a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m0 6.9a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3M8 11h13v2H8zm0 7h13v2H8z"/></svg>',fP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M4 15h2v5h12V4H6v5H4V3a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm6-4V8l5 4l-5 4v-3H2v-2z"/></svg>',hP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m17 4.238l-7.928 7.1L4 7.216V19h16zM4.511 5l7.55 6.662L19.502 5z"/></svg>',pP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M6.455 19L2 22.5V4a1 1 0 0 1 1-1h18a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1zm-.692-2H20V5H4v13.385zM8 10h8v2H8z"/></svg>',mP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M6 5h2v14H6zm10 0h2v14h-2z"/></svg>',gP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m15.728 9.576l-1.414-1.414L5 17.476v1.414h1.414zm1.414-1.414l1.414-1.414l-1.414-1.414l-1.414 1.414zm-9.9 12.728H3v-4.243L16.435 3.212a1 1 0 0 1 1.414 0l2.829 2.829a1 1 0 0 1 0 1.414z"/></svg>',vP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M19.376 12.416L8.777 19.482A.5.5 0 0 1 8 19.066V4.934a.5.5 0 0 1 .777-.416l10.599 7.066a.5.5 0 0 1 0 .832"/></svg>',yP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m-1-5h2v2h-2zm2-1.645V14h-2v-1.5a1 1 0 0 1 1-1a1.5 1.5 0 1 0-1.471-1.794l-1.962-.393A3.501 3.501 0 1 1 13 13.355"/></svg>',kP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M20 4v12h3l-4 5l-4-5h3V4zm-8 14v2H3v-2zm2-7v2H3v-2zm0-7v2H3V4z"/></svg>',bP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M14 4.438A2.437 2.437 0 0 0 16.438 2h1.125A2.437 2.437 0 0 0 20 4.438v1.125A2.437 2.437 0 0 0 17.563 8h-1.125A2.437 2.437 0 0 0 14 5.563zM1 11a6 6 0 0 0 6-6h2a6 6 0 0 0 6 6v2a6 6 0 0 0-6 6H7a6 6 0 0 0-6-6zm3.876 1A8.04 8.04 0 0 1 8 15.124A8.04 8.04 0 0 1 11.124 12A8.04 8.04 0 0 1 8 8.876A8.04 8.04 0 0 1 4.876 12m12.374 2A3.25 3.25 0 0 1 14 17.25v1.5A3.25 3.25 0 0 1 17.25 22h1.5A3.25 3.25 0 0 1 22 18.75v-1.5A3.25 3.25 0 0 1 18.75 14z"/></svg>',xP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928z"/></svg>',wP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928zm0-2.292l4.247 2.377l-.948-4.773l3.573-3.305l-4.833-.573l-2.038-4.419l-2.039 4.42l-4.833.572l3.573 3.305l-.948 4.773z"/></svg>',_P='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M6 5h12a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1"/></svg>',SP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M5 11v2h14v-2z"/></svg>',CP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M12 2a1 1 0 1 1 0 2a8 8 0 1 0 8 8a1 1 0 1 1 2 0c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m0 4a1 1 0 1 1 0 2a4 4 0 1 0 4 4a1 1 0 1 1 2 0a6 6 0 1 1-6-6m5.656-3.9a1.001 1.001 0 0 1 1.415 1.415l-.708.706h.001a1 1 0 1 0 1.414 1.415l.707-.707A1 1 0 0 1 21.9 6.343l-2.12 2.122a1 1 0 0 1-.708.292h-2.414l-3.95 3.95a1 1 0 0 1-1.414-1.414l3.95-3.95V4.93a1 1 0 0 1 .292-.707z"/></svg>',AP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m1 2v14h16V5zm8 10h6v2h-6zm-3.333-3L5.838 9.172l1.415-1.415L11.495 12l-4.242 4.243l-1.415-1.415z"/></svg>',MP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m1-8h4v2h-6V7h2z"/></svg>',EP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M5.33 3.272a3.5 3.5 0 0 1 4.254 4.962l10.709 10.71l-1.414 1.414l-10.71-10.71a3.502 3.502 0 0 1-4.962-4.255L5.444 7.63a1.5 1.5 0 0 0 2.121-2.121zm10.367 1.883l3.182-1.768l1.414 1.415l-1.768 3.182l-1.768.353l-2.12 2.121l-1.415-1.414l2.121-2.121zm-6.718 8.132l1.415 1.414l-5.304 5.303a1 1 0 0 1-1.492-1.327l.078-.087z"/></svg>',TP='<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M4 22a8 8 0 1 1 16 0h-2a6 6 0 0 0-12 0zm8-9c-3.315 0-6-2.685-6-6s2.685-6 6-6s6 2.685 6 6s-2.685 6-6 6m0-2c2.21 0 4-1.79 4-4s-1.79-4-4-4s-4 1.79-4 4s1.79 4 4 4"/></svg>',y6={sm:14,md:16,lg:20};function bt(e,t){return{component:e,svg:t}}const k6={plus:bt(vO,ND),"chat-new":bt(zF,xD),"calendar-close":bt(YO,HD),"calendar-schedule":bt(QO,WD),"calendar-todo":bt(tB,zD),close:bt(lB,qD),check:bt(sB,UD),archive:bt(_O,LD),search:bt(nO,CD),copy:bt(FB,JD),link:bt(pR,cP),"external-link":bt(EB,XD),download:bt(gB,KD),undo:bt(LO,OD),send:bt(L_,O_),image:bt(F_,R_),settings:bt(iO,AD),sliders:bt(wB,YD),"log-in":bt(_R,fP),"chevron-down":bt(TO,FD),"chevron-right":bt(DO,RD),"chevron-up":bt(UO,DD),"arrow-up":bt(L_,O_),"arrow-down":bt(AO,$D),"arrow-right":bt(OO,BD),minus:bt(iD,SP),"panel-collapse":bt(aO,MD),"panel-expand":bt(dO,ED),expand:bt(CB,ZD),collapse:bt(hB,VD),list:bt(bR,dP),sort:bt(qR,kP),grip:bt(kB,GD),folder:bt(ZF,_D),"folder-closed":bt(jF,wD),"folder-plus":bt(GB,oP),"folder-solid":bt(XB,sP),file:bt($_,B_),"file-text":bt(zB,tP),"file-edit":bt(RB,eP),"file-plus":bt(IB,QD),"file-off":bt($_,B_),attachment:bt(pO,TD),"image-off":bt(F_,R_),code:bt(uB,jD),terminal:bt(dD,AP),pencil:bt(OR,gP),tool:bt(vD,EP),glob:bt(VO,PD),globe:bt(rR,lP),"check-list":bt(vR,uP),bolt:bt(jB,nP),"git-fork":bt(eR,iP),"git-pull-request":bt(oR,rP),message:bt(TR,pP),mail:bt(AR,hP),user:bt(bD,TP),info:bt(dR,aP),"help-circle":bt(WR,yP),"alert-triangle":bt(bO,ID),clock:bt(pD,MP),sparkles:bt(KR,bP),target:bt(aD,CP),pause:bt(LR,mP),play:bt(DR,vP),stop:bt(nD,_P),star:bt(ZR,xP),"star-outline":bt(JR,wP),"dots-horizontal":bt(JF,SD)};function NP(e){return k6[e]}function IP(e,t){return e.replace(/\s(?:width|height)="[^"]*"/g,"").replace(/^<svg\b/,`<svg class="kw-icon" width="${t}" height="${t}" aria-hidden="true"`)}function Dc(e,t="md"){const n=k6[e];return n?IP(n.svg,y6[t]):""}const Q4e=[["Actions",["plus","attachment","chat-new","close","check","search","copy","link","external-link","download","undo","send","image","settings","sliders","log-in"]],["Navigation & layout",["chevron-down","chevron-right","chevron-up","arrow-up","arrow-down","arrow-right","minus","panel-collapse","panel-expand","expand","collapse","list","sort","grip"]],["Files & tools",["folder","folder-closed","folder-plus","folder-solid","file","file-text","file-edit","file-plus","file-off","image-off","code","terminal","pencil","tool","glob","globe","check-list","bolt","git-fork","git-pull-request","archive","target","calendar-schedule","calendar-todo","calendar-close"]],["Communication",["message","mail","user"]],["Status & media",["info","help-circle","alert-triangle","clock","sparkles","pause","play","stop","star","star-outline","dots-horizontal"]]],Ge=Je({__name:"Icon",props:{name:{},size:{default:"md"},label:{}},setup(e){const t=e,n=D(()=>NP(t.name)),o=D(()=>y6[t.size]);return(s,i)=>n.value?(x(),Se(Ho(n.value.component),{key:0,class:"kw-icon",width:o.value,height:o.value,"aria-label":e.label,"aria-hidden":e.label?void 0:!0},null,8,["width","height","aria-label","aria-hidden"])):ue("",!0)}}),LP={key:0,class:"ui-dialog__head"},$P={class:"ui-dialog__titles"},FP={key:0,class:"ui-dialog__title"},OP={key:1,class:"ui-dialog__desc"},BP={class:"ui-dialog__body"},RP={key:1,class:"ui-dialog__foot"},DP='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',PP=Je({__name:"Dialog",props:{open:{type:Boolean},title:{},description:{},closeOnOverlay:{type:Boolean,default:!0},closeOnEsc:{type:Boolean,default:!0},size:{default:"md"},height:{default:"auto"},padded:{type:Boolean,default:!0},initialFocus:{}},emits:["update:open","close"],setup(e,{emit:t}){const n=e,o=t,s=oe(null);let i=null;function r(){o("update:open",!1),o("close")}function l(){return s.value?Array.from(s.value.querySelectorAll(DP)):[]}function a(){const{initialFocus:d}=n;return d?typeof d=="function"?d()??null:typeof d=="string"?s.value?.querySelector(d)??null:s.value?.contains(d)?d:null:null}function c(d){if(!n.open)return;if(d.key==="Escape"&&n.closeOnEsc){d.preventDefault(),r();return}if(d.key!=="Tab")return;const f=l(),h=f[0],p=f[f.length-1];if(!h||!p){d.preventDefault(),s.value?.focus();return}const m=document.activeElement;d.shiftKey&&m===h?(d.preventDefault(),p.focus()):!d.shiftKey&&m===p&&(d.preventDefault(),h.focus())}function u(d){n.closeOnOverlay&&d.target===d.currentTarget&&r()}return et(()=>n.open,async d=>{if(d){Rc.value+=1,i=document.activeElement,await yt();const f=a(),h=l();(f??h[0]??s.value)?.focus()}else Rc.value=Math.max(0,Rc.value-1),i instanceof HTMLElement&&(i.focus(),i=null)},{immediate:!0}),typeof window<"u"&&window.addEventListener("keydown",c),ho(()=>{typeof window<"u"&&window.removeEventListener("keydown",c),n.open&&(Rc.value=Math.max(0,Rc.value-1))}),(d,f)=>(x(),Se(_1,{to:"body"},[e.open?(x(),E("div",{key:0,class:"ui-dialog__overlay",onMousedown:u},[w("div",{ref_key:"panel",ref:s,class:Ue(["ui-dialog",[`ui-dialog--${e.size}`,{"ui-dialog--flush":!e.padded,"ui-dialog--fixed-height":e.height==="fixed"}]]),role:"dialog","aria-modal":"true",tabindex:"-1"},[e.title||d.$slots.head?(x(),E("div",LP,[jn(d.$slots,"head",{},()=>[w("div",$P,[e.title?(x(),E("div",FP,R(e.title),1)):ue("",!0),e.description?(x(),E("div",OP,R(e.description),1)):ue("",!0)])],!0),ae(Xn,{class:"ui-dialog__close",size:"sm",label:"Close",onClick:r},{default:Ie(()=>[ae(Ge,{name:"close",size:"md"})]),_:1})])):ue("",!0),w("div",BP,[jn(d.$slots,"default",{},void 0,!0)]),d.$slots.foot?(x(),E("div",RP,[jn(d.$slots,"foot",{},void 0,!0)])):ue("",!0)],2)],32)):ue("",!0)]))}}),Qr=dt(PP,[["__scopeId","data-v-3dce23a4"]]),HP={class:"sd-head"},WP=["placeholder","aria-label"],zP=["aria-selected","onClick","onMousemove"],UP={class:"sd-meta"},qP=["innerHTML"],jP={class:"sd-time"},VP=["innerHTML"],KP=["innerHTML"],GP={key:1,class:"sd-empty"},YP={class:"sd-hint"},ZP=200,XP=Je({__name:"SearchSessionsDialog",props:{sessions:{},activeId:{}},emits:["select","close"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=oe(!0),r=oe(""),l=oe(null),a=oe(null),c=D(()=>{const k=r.value.trim().toLowerCase(),g=[];for(const v of o.sessions){const b=v.title??"",A=v.lastPrompt??"",I=v.workspaceName??"",N=k.length>0&&b.toLowerCase().includes(k),M=k.length>0&&A.toLowerCase().includes(k),$=k.length>0&&I.toLowerCase().includes(k);if(!(k.length>0&&!N&&!M&&!$)&&(g.push({session:v,inTitle:N,inWorkspace:$,snippetText:A?RF(A,r.value):""}),g.length>=ZP))break}return g}),u=oe(0);et(r,()=>{u.value=0});function d(k){const g=c.value.length;return g===0?0:Math.max(0,Math.min(g-1,k))}async function f(){await yt(),a.value?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest"})}function h(k){u.value=d(u.value+k),f()}function p(k){s("select",k),s("close")}function m(){const k=c.value[u.value];k&&p(k.session.id)}function y(k){k.key==="ArrowDown"?(k.preventDefault(),h(1)):k.key==="ArrowUp"?(k.preventDefault(),h(-1)):k.key==="Enter"&&(k.preventDefault(),m())}return An(()=>{l.value?.focus()}),(k,g)=>(x(),Se(Qr,{open:i.value,"onUpdate:open":g[1]||(g[1]=v=>i.value=v),size:"lg",height:"fixed",padded:!1,onClose:g[2]||(g[2]=v=>s("close"))},{head:Ie(()=>[w("div",HP,[ae(Ge,{class:"sd-search-icon",name:"search",size:"md"}),qn(w("input",{ref_key:"inputRef",ref:l,"onUpdate:modelValue":g[0]||(g[0]=v=>r.value=v),class:"sd-input",type:"text",placeholder:C(n)("sidebar.searchPlaceholder"),"aria-label":C(n)("sidebar.searchPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:y},null,40,WP),[[Cs,r.value]])])]),foot:Ie(()=>[w("span",YP,R(C(n)("sidebar.searchHint")),1)]),default:Ie(()=>[w("div",{ref_key:"listRef",ref:a,class:"sd-list",role:"listbox"},[c.value.length>0?(x(!0),E(We,{key:0},rt(c.value,(v,b)=>(x(),E("button",{key:v.session.id,class:Ue(["sd-row",{on:b===u.value,active:v.session.id===e.activeId}]),role:"option","aria-selected":b===u.value,onClick:A=>p(v.session.id),onMousemove:A=>u.value=b},[w("span",UP,[ae(Ge,{class:"sd-folder",name:"folder-closed",size:"sm"}),w("span",{class:"sd-ws",innerHTML:C(_g)(v.session.workspaceName??v.session.workspaceId??"",v.inWorkspace?r.value:"")},null,8,qP),w("span",jP,R(v.session.time),1)]),w("span",{class:"sd-title",innerHTML:C(_g)(v.session.title,v.inTitle?r.value:"")},null,8,VP),v.snippetText?(x(),E("span",{key:0,class:"sd-snippet",innerHTML:C(_g)(v.snippetText,r.value)},null,8,KP)):ue("",!0)],42,zP))),128)):(x(),E("div",GP,R(C(n)("sidebar.searchNoResults")),1))],512)]),_:1},8,["open"]))}}),QP=dt(XP,[["__scopeId","data-v-a678f802"]]),JP=["aria-label"],eH=Je({__name:"Spinner",props:{size:{default:"md"},label:{default:"Loading"}},setup(e){return(t,n)=>(x(),E("span",{class:Ue(["ui-spinner",`ui-spinner--${e.size}`]),role:"status","aria-label":e.label},[...n[0]||(n[0]=[w("svg",{class:"ui-spinner__svg",viewBox:"0 0 24 24","aria-hidden":"true"},[w("circle",{class:"ui-spinner__track",cx:"12",cy:"12",r:"9"}),w("circle",{class:"ui-spinner__arc",cx:"12",cy:"12",r:"9"})],-1)])],10,JP))}}),Us=dt(eH,[["__scopeId","data-v-e5c5b17d"]]),tH={key:0,class:"ui-badge__dot","aria-hidden":"true"},nH=Je({__name:"Badge",props:{variant:{default:"neutral"},size:{default:"md"},dot:{type:Boolean}},setup(e){return(t,n)=>(x(),E("span",{class:Ue(["ui-badge",[`ui-badge--${e.variant}`,`ui-badge--${e.size}`]])},[e.dot?(x(),E("span",tH)):ue("",!0),jn(t.$slots,"default",{},void 0,!0)],2))}}),qi=dt(nH,[["__scopeId","data-v-5bc5cd6d"]]),oH=Je({__name:"Menu",setup(e,{expose:t}){const n=oe();return t({el:n}),(o,s)=>(x(),E("div",{ref_key:"el",ref:n,class:"ui-menu",role:"menu"},[jn(o.$slots,"default",{},void 0,!0)],512))}}),Ml=dt(oH,[["__scopeId","data-v-60e6cd8d"]]),sH={key:0,class:"ui-menu-sep",role:"separator"},iH=["disabled"],rH=Je({__name:"MenuItem",props:{active:{type:Boolean},danger:{type:Boolean},disabled:{type:Boolean},separator:{type:Boolean},size:{default:"md"}},emits:["click"],setup(e){return(t,n)=>e.separator?(x(),E("div",sH)):(x(),E("button",{key:1,class:Ue(["ui-menu-item",[`ui-menu-item--${e.size}`,{"is-active":e.active,"is-danger":e.danger}]]),type:"button",role:"menuitem",disabled:e.disabled,onClick:n[0]||(n[0]=o=>t.$emit("click",o))},[jn(t.$slots,"default",{},void 0,!0)],10,iH))}}),Tn=dt(rH,[["__scopeId","data-v-f940771a"]]),al=6,cl=8,lH=150,aH=Je({__name:"Tooltip",props:{text:{},placement:{default:"top"},maxWidth:{default:280},maxLines:{default:6}},setup(e){const t=e,n=oe(),o=oe(),s=oe(!1),i=oe(!1),r=oe({maxWidth:`${t.maxWidth}px`});let l,a=null,c;function u(){const m=o.value;if(!a||!m)return;const y=a.getBoundingClientRect(),k=m.offsetWidth,g=m.offsetHeight,v=window.innerWidth,b=window.innerHeight;let A=t.placement;A==="top"&&y.top-al-g<cl?A="bottom":A==="bottom"&&y.bottom+al+g>b-cl?A="top":A==="left"&&y.left-al-k<cl?A="right":A==="right"&&y.right+al+k>v-cl&&(A="left");let I=0,N=0;A==="top"?(I=y.top-al-g,N=y.left+y.width/2-k/2):A==="bottom"?(I=y.bottom+al,N=y.left+y.width/2-k/2):A==="left"?(I=y.top+y.height/2-g/2,N=y.left-al-k):(I=y.top+y.height/2-g/2,N=y.right+al),N=Math.min(Math.max(N,cl),v-cl-k),I=Math.min(Math.max(I,cl),b-cl-g),r.value={maxWidth:`${t.maxWidth}px`,top:`${Math.round(I)}px`,left:`${Math.round(N)}px`}}function d(){t.text&&(window.clearTimeout(l),l=window.setTimeout(()=>{s.value=!0,i.value=!1,yt(()=>{u(),i.value=!0})},lH))}function f(){window.clearTimeout(l),s.value=!1,i.value=!1}function h(){s.value&&f()}function p(m){m!==a&&(a&&(a.removeEventListener("mouseenter",d),a.removeEventListener("mouseleave",f),a.removeEventListener("focusin",d),a.removeEventListener("focusout",f)),a=m,a&&(a.addEventListener("mouseenter",d),a.addEventListener("mouseleave",f),a.addEventListener("focusin",d),a.addEventListener("focusout",f)))}return An(()=>{const m=n.value??null;p(m?.firstElementChild??m),m&&(c=new MutationObserver(()=>{const y=m.firstElementChild??null;y!==a&&(f(),p(y??m))}),c.observe(m,{childList:!0})),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h)}),ho(()=>{window.clearTimeout(l),c?.disconnect(),p(null),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}),(m,y)=>(x(),E(We,null,[w("span",{ref_key:"trigger",ref:n,class:"ui-tip"},[jn(m.$slots,"default",{},void 0,!0)],512),(x(),Se(_1,{to:"body"},[qn(w("div",{ref_key:"bubble",ref:o,class:Ue(["ui-tip__bubble",{positioned:i.value}]),style:on([r.value,{"--tip-lines":e.maxLines}]),role:"tooltip"},R(e.text),7),[[xi,s.value]])]))],64))}}),an=dt(aH,[["__scopeId","data-v-4c261eb6"]]),cH={class:"row"},uH={class:"lead","aria-hidden":"true"},dH={key:1,class:"unread-dot"},fH={class:"left"},hH=["onKeydown"],pH={class:"act"},mH={class:"ts"},gH={class:"menu-time"},vH=Je({__name:"SessionRow",props:{session:{},active:{type:Boolean},approvalCount:{default:0},questionCount:{default:0},unread:{type:Boolean,default:!1}},emits:["select","rename","archive","fork","export"],setup(e,{expose:t,emit:n}){const{t:o}=$t(),s=e,i=n;function r(S){const B=new Date(S);if(Number.isNaN(B.getTime()))return S;const W=z=>String(z).padStart(2,"0");return`${B.getFullYear()}-${W(B.getMonth()+1)}-${W(B.getDate())} ${W(B.getHours())}:${W(B.getMinutes())}`}const l=D(()=>s.session.updatedAt?r(s.session.updatedAt):s.session.time),a=oe(!1),c=oe(null),u=oe(null),d=oe({});function f(S){const B=S.target;u.value?.el?.contains(B)||c.value?.el?.contains(B)||m()}function h(){const S=c.value?.el;if(!S)return;const B=u.value?.el,W=S.getBoundingClientRect(),z=4,L=8,O=B?.offsetHeight??0,U=B?.offsetWidth??0;let Z=W.bottom+z;Z+O>window.innerHeight-L&&(Z=Math.max(L,W.top-O-z));let ie=W.right-U;ie<L&&(ie=L),d.value={top:`${Math.round(Z)}px`,left:`${Math.round(ie)}px`}}async function p(S){if(S.stopPropagation(),a.value){m();return}a.value=!0,setTimeout(()=>document.addEventListener("mousedown",f),0),window.addEventListener("resize",m),await yt(),h()}function m(){a.value=!1,document.removeEventListener("mousedown",f),window.removeEventListener("resize",m)}On(()=>{document.removeEventListener("mousedown",f),window.removeEventListener("resize",m)});const y=oe(!1),k=oe(""),g=oe(null);async function v(){m(),y.value=!0,k.value=s.session.title,await yt();try{g.value?.focus(),g.value?.select()}catch{}}function b(){const S=k.value.trim();S&&i("rename",s.session.id,S),y.value=!1}function A(){y.value=!1}const I=oe(!1),N=oe(!1);async function M(){const S=await Jo(s.session.id);I.value=S,N.value=!S,setTimeout(()=>{I.value=!1,N.value=!1,m()},1500)}function $(){m(),i("fork",s.session.id)}function T(){m(),i("export",s.session.id)}function F(){m(),i("archive",s.session.id)}return t({closeMenu:m}),(S,B)=>(x(),E("div",{class:Ue(["se",{on:e.active}]),onClick:B[4]||(B[4]=W=>i("select",e.session.id))},[w("div",cH,[w("span",uH,[e.session.busy?(x(),Se(Us,{key:0,size:"sm"})):e.unread?(x(),E("span",dH)):ue("",!0)]),w("div",fH,[y.value?qn((x(),E("input",{key:0,ref_key:"renameInputRef",ref:g,"onUpdate:modelValue":B[0]||(B[0]=W=>k.value=W),class:"rename-input",onClick:B[1]||(B[1]=St(()=>{},["stop"])),onKeydown:[ur(St(b,["stop"]),["enter"]),ur(St(A,["stop"]),["esc"])],onBlur:b},null,40,hH)),[[Cs,k.value]]):(x(),E("span",{key:1,class:"t",onDblclick:St(v,["stop"])},R(e.session.title),33))]),ae(an,{text:C(o)("workspace.awaitingAnswerTitle")},{default:Ie(()=>[!y.value&&(e.questionCount>0||e.session.pendingInteraction==="question")?(x(),Se(qi,{key:0,variant:"info",size:"sm"},{default:Ie(()=>[ot(R(C(o)("workspace.awaitingAnswer")),1)]),_:1})):ue("",!0)]),_:1},8,["text"]),ae(an,{text:C(o)("workspace.awaitingPermissionTitle")},{default:Ie(()=>[!y.value&&(e.approvalCount>0||e.session.pendingInteraction==="approval")?(x(),Se(qi,{key:0,variant:"warning",size:"sm"},{default:Ie(()=>[ot(R(C(o)("workspace.awaitingPermission")),1)]),_:1})):ue("",!0)]),_:1},8,["text"]),ae(an,{text:C(o)("workspace.abortedTitle")},{default:Ie(()=>[!y.value&&!e.session.busy&&e.session.pendingInteraction!=="question"&&e.session.pendingInteraction!=="approval"&&e.questionCount===0&&e.approvalCount===0&&(e.session.lastTurnReason==="cancelled"||e.session.lastTurnReason==="failed")?(x(),Se(qi,{key:0,variant:"danger",size:"sm"},{default:Ie(()=>[ot(R(C(o)("workspace.aborted")),1)]),_:1})):ue("",!0)]),_:1},8,["text"]),w("span",pH,[w("span",mH,R(e.session.time),1),y.value?ue("",!0):(x(),Se(Xn,{key:0,ref_key:"kebabRef",ref:c,class:Ue(["kebab",{open:a.value}]),size:"sm",label:C(o)("sidebar.options"),onClick:B[2]||(B[2]=St(W=>p(W),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"dots-horizontal"})]),_:1},8,["class","label"]))])]),(x(),Se(_1,{to:"body"},[a.value?(x(),Se(Ml,{key:0,ref_key:"menuRef",ref:u,class:"menu",style:on(d.value),onClick:B[3]||(B[3]=St(()=>{},["stop"]))},{default:Ie(()=>[ae(Tn,{danger:N.value,onClick:M},{default:Ie(()=>[ae(Ge,{name:I.value?"check":"copy",size:"sm"},null,8,["name"]),ot(" "+R(N.value?C(o)("sidebar.copyFailed"):I.value?C(o)("sidebar.copied"):C(o)("sidebar.copySessionId")),1)]),_:1},8,["danger"]),ae(Tn,{separator:""}),ae(Tn,{onClick:v},{default:Ie(()=>[ae(Ge,{name:"pencil",size:"sm"}),ot(" "+R(C(o)("sidebar.rename")),1)]),_:1}),ae(Tn,{onClick:$},{default:Ie(()=>[ae(Ge,{name:"git-fork",size:"sm"}),ot(" "+R(C(o)("sidebar.fork")),1)]),_:1}),ae(Tn,{onClick:T},{default:Ie(()=>[ae(Ge,{name:"download",size:"sm"}),ot(" "+R(C(o)("sidebar.export")),1)]),_:1}),ae(Tn,{danger:"",onClick:F},{default:Ie(()=>[ae(Ge,{name:"archive",size:"sm"}),ot(" "+R(C(o)("sidebar.archive")),1)]),_:1}),ae(Tn,{separator:""}),w("div",gH,R(l.value),1)]),_:1},8,["style"])):ue("",!0)]))],2))}}),yH=dt(vH,[["__scopeId","data-v-c1a3c877"]]),kH={class:"gh-top"},bH={class:"gh-name"},xH=["inert"],wH=["disabled"],_H={class:"show-more-label"},SH={class:"show-more-label"},CH={key:2,class:"group-empty"},AH=Je({__name:"WorkspaceGroup",props:{group:{},activeWorkspaceId:{},activeId:{},renamingId:{},renameValue:{},renameInputRef:{},pendingBySession:{},unreadBySession:{},wsMenuOpenId:{},dragging:{type:Boolean},isCollapsed:{type:Function},isExpanded:{type:Function}},emits:["groupClick","groupContextmenu","toggleWsMenu","createInWorkspace","selectSession","renameSession","archiveSession","forkSession","exportSession","loadMore","toggleExpand","confirmRename","cancelRename","updateRenameValue","wsDragstart","wsDragend"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=D({get:()=>o.renameValue,set:f=>s("updateRenameValue",f)}),r=D(()=>{if(o.isExpanded(o.group.workspace.id))return o.group.sessions;const f=o.group.sessions.slice(0,o.group.initialCount);if(o.activeId&&!f.some(h=>h.id===o.activeId)){const h=o.group.sessions.find(p=>p.id===o.activeId);if(h)return[...f,h]}return f}),l=D(()=>o.group.sessions.length>o.group.initialCount);function a(){return Math.max(0,o.group.workspace.sessionCount-o.group.sessions.length)}function c(){return o.group.sessions.length-o.group.initialCount}function u(f){o.renameInputRef.value=f instanceof HTMLInputElement?f:null}function d(f){f.dataTransfer&&(f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("text/plain",o.group.workspace.id),s("wsDragstart",o.group.workspace.id))}return(f,h)=>(x(),E("div",{class:Ue(["group",{dragging:e.dragging}])},[w("div",{class:Ue(["gh",{on:e.group.workspace.id===e.activeWorkspaceId,collapsed:e.isCollapsed(e.group.workspace.id)}]),draggable:"true",onClick:h[7]||(h[7]=St(p=>s("groupClick",e.group.workspace.id,p),["stop"])),onContextmenu:h[8]||(h[8]=p=>s("groupContextmenu",e.group.workspace,p)),onDragstart:d,onDragend:h[9]||(h[9]=p=>s("wsDragend"))},[w("div",kH,[e.isCollapsed(e.group.workspace.id)?(x(),Se(Ge,{key:0,class:"gh-folder",name:"folder-closed"})):(x(),Se(Ge,{key:1,class:"gh-folder",name:"folder"})),e.renamingId!==e.group.workspace.id?(x(),Se(an,{key:2,text:e.group.workspace.root},{default:Ie(()=>[w("span",bH,R(e.group.workspace.name),1)]),_:1},8,["text"])):qn((x(),E("input",{key:3,ref:u,"onUpdate:modelValue":h[0]||(h[0]=p=>i.value=p),class:"gh-rename",type:"text",onKeydown:[h[1]||(h[1]=ur(p=>s("confirmRename"),["enter"])),h[2]||(h[2]=ur(p=>s("cancelRename"),["esc"]))],onBlur:h[3]||(h[3]=p=>s("cancelRename")),onClick:h[4]||(h[4]=St(()=>{},["stop"]))},null,544)),[[Cs,i.value]]),e.renamingId!==e.group.workspace.id?(x(),E("div",{key:4,class:Ue(["gh-actions",{open:e.wsMenuOpenId===e.group.workspace.id}])},[ae(Xn,{class:Ue(["gh-more",{open:e.wsMenuOpenId===e.group.workspace.id}]),size:"sm",label:C(n)("sidebar.options"),"aria-haspopup":"menu","aria-expanded":e.wsMenuOpenId===e.group.workspace.id,onClick:h[5]||(h[5]=St(p=>s("toggleWsMenu",e.group.workspace,p),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"dots-horizontal"})]),_:1},8,["class","label","aria-expanded"]),ae(Xn,{class:"gh-add",size:"sm",label:C(n)("workspace.newInGroup"),onClick:h[6]||(h[6]=St(p=>s("createInWorkspace",e.group.workspace.id),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"chat-new"})]),_:1},8,["label"])],2)):ue("",!0)])],34),w("div",{class:Ue(["group-sessions",{collapsed:e.isCollapsed(e.group.workspace.id)}]),inert:e.isCollapsed(e.group.workspace.id)},[(x(!0),E(We,null,rt(r.value,p=>(x(),Se(yH,{key:p.id,session:p,active:p.id===e.activeId,"approval-count":e.pendingBySession[p.id]?.approvals??0,"question-count":e.pendingBySession[p.id]?.questions??0,unread:e.unreadBySession[p.id]??!1,onSelect:h[10]||(h[10]=m=>s("selectSession",m)),onRename:h[11]||(h[11]=(m,y)=>s("renameSession",m,y)),onArchive:h[12]||(h[12]=m=>s("archiveSession",m)),onFork:h[13]||(h[13]=m=>s("forkSession",m)),onExport:h[14]||(h[14]=m=>s("exportSession",m))},null,8,["session","active","approval-count","question-count","unread"]))),128)),e.group.hasMore||e.group.loadingMore?(x(),E("button",{key:0,class:"show-more",disabled:e.group.loadingMore,onClick:h[15]||(h[15]=St(p=>s("loadMore",e.group.workspace.id),["stop"]))},[h[17]||(h[17]=w("span",{class:"show-more-lead","aria-hidden":"true"},null,-1)),w("span",_H,R(e.group.loadingMore?C(n)("sidebar.loadingMore"):C(n)("sidebar.showMore",{count:a()})),1)],8,wH)):ue("",!0),l.value?(x(),E("button",{key:1,class:"show-more",onClick:h[16]||(h[16]=St(p=>s("toggleExpand",e.group.workspace.id),["stop"]))},[h[18]||(h[18]=w("span",{class:"show-more-lead","aria-hidden":"true"},null,-1)),w("span",SH,R(e.isExpanded(e.group.workspace.id)?C(n)("sidebar.showLess"):C(n)("sidebar.showAll",{count:c()})),1)])):ue("",!0),e.group.sessions.length===0?(x(),E("div",CH,R(C(n)("sidebar.noSessions")),1)):ue("",!0)],10,xH)],2))}}),MH=dt(AH,[["__scopeId","data-v-cdac739a"]]),EH="kimi_desktop",TH="platform",D_="kimi-desktop",P_="kimi-desktop-platform";function NH(){let e=!1,t=null;try{const n=new URLSearchParams(window.location.search);n.has(EH)?(sessionStorage.setItem(D_,"1"),e=!0):e=e||sessionStorage.getItem(D_)==="1";const o=n.get(TH);o?(sessionStorage.setItem(P_,o),t=o):t=sessionStorage.getItem(P_)}catch{}return{isDesktop:e,platform:t}}const by=NH(),IH=by.isDesktop,iu=by.isDesktop&&by.platform==="darwin",LH={class:"ui-kbd"},$H=Je({__name:"Kbd",props:{keys:{}},setup(e){return(t,n)=>(x(),E("span",LH,[(x(!0),E(We,null,rt(e.keys,o=>(x(),E("kbd",{key:o,class:"ui-kbd__key"},R(o),1))),128))]))}}),Er=dt($H,[["__scopeId","data-v-32292ed8"]]),FH=["disabled","aria-pressed"],OH=Je({__name:"Pill",props:{clickable:{type:Boolean,default:!0},active:{type:Boolean},disabled:{type:Boolean},ariaPressed:{type:Boolean}},emits:["click"],setup(e){return(t,n)=>e.clickable?(x(),E("button",{key:0,class:Ue(["ui-pill",{"is-active":e.active}]),type:"button",disabled:e.disabled,"aria-pressed":e.ariaPressed,onClick:n[0]||(n[0]=o=>t.$emit("click",o))},[jn(t.$slots,"default",{},void 0,!0)],10,FH)):(x(),E("span",{key:1,class:Ue(["ui-pill",{"is-active":e.active}])},[jn(t.$slots,"default",{},void 0,!0)],2))}}),Cp=dt(OH,[["__scopeId","data-v-317ace1a"]]),BH={class:"ch"},RH={class:"ch-brand"},DH={class:"ch-backend-ep"},PH={class:"btn-wrap"},HH={class:"search-input"},WH={key:0,class:"empty"},zH={class:"side-section-label"},UH={class:"side-section-title"},qH={class:"side-section-actions"},jH=["onDragover","onDrop"],VH={class:"side-footer"},KH={class:"section-menu-check"},GH={class:"section-menu-check"},YH={class:"section-menu-check"},ZH={class:"backend-menu-name"},XH={class:"backend-menu-url"},QH=1e3,JH=Je({__name:"Sidebar",props:{activeWorkspace:{default:null},activeWorkspaceId:{default:null},sessions:{},groups:{},activeId:{},workspaceSortMode:{},backend:{default:"v1"},attentionBySession:{default:()=>({})},pendingBySession:{default:()=>({})},unreadBySession:{default:()=>({})},colWidth:{default:220},collapsed:{type:Boolean,default:!1},dragging:{type:Boolean,default:!1}},emits:["select","create","createInWorkspace","selectWorkspace","addWorkspace","rename","archive","fork","export","renameWorkspace","deleteWorkspace","reorderWorkspaces","setWorkspaceSortMode","loadMoreSessions","loadAllSessions","openSettings","collapse"],setup(e,{emit:t}){const{t:n}=$t(),o=!1,s=oe(null),i=D(()=>""),r=["default","multi"];function l(nt){const Be=s.value?.presets[nt]??"";return Be?EF(Be):""}function a(nt){const Be=s.value;return Be!==null&&Be.current===Be.presets[nt]}const c=e,u=t,d=oe(!1),f=m()?["⌘","K"]:["Ctrl","K"];function h(){u("loadAllSessions"),d.value=!0}function p(nt){(nt.metaKey||nt.ctrlKey)&&nt.key.toLowerCase()==="k"&&(nt.preventDefault(),h())}An(()=>window.addEventListener("keydown",p)),ho(()=>window.removeEventListener("keydown",p));function m(){if(typeof navigator>"u")return!1;if(/Mac|iPod|iPhone|iPad/.test(navigator.platform))return!0;const nt=navigator.userAgentData;return nt?.platform==="macOS"||nt?.platform==="iOS"}const y=oe(!1);function k(nt){y.value=nt.target.scrollTop>0}const g=oe(new Set(pF()));function v(nt){return g.value.has(nt)}function b(nt){const Be=new Set(g.value);Be.has(nt)?Be.delete(nt):Be.add(nt),g.value=Be,wg(Be)}function A(){const nt=new Set(c.groups.map(Be=>Be.workspace.id));g.value=nt,wg(nt)}function I(){const nt=new Set;g.value=nt,wg(nt)}const N=D(()=>c.groups.length>0&&c.groups.every(nt=>g.value.has(nt.workspace.id))),M=oe(new Set);function $(nt){return M.value.has(nt)}function T(nt){const Be=new Set(M.value);Be.has(nt)?Be.delete(nt):Be.add(nt),M.value=Be}function F(nt){if(!M.value.has(nt)){const Be=new Set(M.value);Be.add(nt),M.value=Be}u("loadMoreSessions",nt)}const S=oe(null),B=oe(null);function W(nt){S.value=nt}function z(){S.value=null,B.value=null}function L(nt){const Be=nt.currentTarget.getBoundingClientRect();return nt.clientY<Be.top+Be.height/2?"before":"after"}function O(nt,Be){S.value===null||S.value===Be||(nt.preventDefault(),nt.dataTransfer&&(nt.dataTransfer.dropEffect="move"),B.value={id:Be,position:L(nt)})}function U(nt){const Be=S.value,Bt=B.value?.id===nt?B.value.position:"before";if(B.value=null,S.value=null,!Be||Be===nt)return;const Yt=$F(c.groups.map(vn=>vn.workspace.id),Be,nt,Bt);u("reorderWorkspaces",Yt)}function Z(nt,Be){Be.target.closest(".gh-more, .gh-add")||b(nt)}function ie(nt){u("select",nt)}const q=oe(null),ee=oe(""),fe=oe(null);function ne(){return fe}function j(nt,Be){q.value=nt,ee.value=Be,yt().then(()=>fe.value?.focus())}function K(){const nt=q.value,Be=ee.value.trim();nt&&Be&&u("renameWorkspace",nt,Be),q.value=null}function ve(){q.value=null}function he(nt){ee.value=nt}const Ae=oe(!1),re=oe(null),Y=oe({}),Q=oe(null);function P(nt){Q.value?.el&&!Q.value.el.contains(nt.target)&&me()}function G(nt,Be){Be.preventDefault(),Be.stopPropagation(),re.value=nt,Y.value={top:`${Be.clientY}px`,left:`${Be.clientX}px`},Ae.value=!0,document.addEventListener("mousedown",P,!0)}function me(){Ae.value=!1,document.removeEventListener("mousedown",P,!0),re.value=null}function ye(){re.value&&Jo(re.value.root),me()}function de(){re.value&&j(re.value.id,re.value.name),me()}function V(){const nt=re.value;nt&&(me(),u("deleteWorkspace",nt.id))}const se=oe(null),pe=oe(null),ke=oe({}),Ne=oe(null);function qe(nt){const Be=nt.target;Be.closest(".gh-more")||Be.closest(".ws-menu")||xe()}async function be(nt,Be){if(se.value===nt.id){xe();return}const Bt=Be.currentTarget;pe.value=nt,se.value=nt.id,document.addEventListener("mousedown",qe),window.addEventListener("resize",xe),await yt();const Yt=Ne.value?.el,vn=Bt.getBoundingClientRect(),xn=4,nn=8,Vn=Yt?.offsetHeight??0,Kn=Yt?.offsetWidth??0;let Jn=vn.bottom+xn;Jn+Vn>window.innerHeight-nn&&(Jn=Math.max(nn,vn.top-Vn-xn));let Oo=vn.right-Kn;Oo<nn&&(Oo=nn),ke.value={top:`${Math.round(Jn)}px`,left:`${Math.round(Oo)}px`}}function xe(){se.value=null,pe.value=null,document.removeEventListener("mousedown",qe),window.removeEventListener("resize",xe)}function Ze(nt){Jo(nt.root),xe()}function tt(nt){j(nt.id,nt.name),xe()}function lt(nt){xe(),u("deleteWorkspace",nt.id)}const ut=oe(!1),mt=oe({}),Tt=oe(null);function wt(nt){const Be=nt.target;Be.closest(".side-section-kebab")||Be.closest(".section-menu")||en()}async function Ft(nt){if(ut.value){en();return}const Be=nt.currentTarget;ut.value=!0,document.addEventListener("mousedown",wt),window.addEventListener("resize",en),await yt();const Bt=Tt.value?.el,Yt=Be.getBoundingClientRect(),vn=4,xn=8,nn=Bt?.offsetHeight??0,Vn=Bt?.offsetWidth??0;let Kn=Yt.bottom+vn;Kn+nn>window.innerHeight-xn&&(Kn=Math.max(xn,Yt.top-nn-vn));let Jn=Yt.right-Vn;Jn<xn&&(Jn=xn),mt.value={top:`${Math.round(Kn)}px`,left:`${Math.round(Jn)}px`}}function en(){ut.value=!1,document.removeEventListener("mousedown",wt),window.removeEventListener("resize",en)}function Hn(nt){u("setWorkspaceSortMode",nt),en()}const Pt=oe(!1),bn=oe({}),pn=oe(null);function Kt(nt){const Be=nt.target;Be.closest(".ch-backend")||Be.closest(".backend-menu")||Gt()}async function Nn(nt){if(s.value===null)return;if(Pt.value){Gt();return}const Be=nt.currentTarget;Pt.value=!0,document.addEventListener("mousedown",Kt),window.addEventListener("resize",Gt),await yt();const Bt=pn.value?.el,Yt=Be.getBoundingClientRect(),vn=4,xn=8,nn=Bt?.offsetHeight??0;let Vn=Yt.bottom+vn;Vn+nn>window.innerHeight-xn&&(Vn=Math.max(xn,Yt.top-nn-vn)),bn.value={top:`${Math.round(Vn)}px`,left:`${Math.round(Math.max(xn,Yt.left))}px`}}function Gt(){Pt.value=!1,document.removeEventListener("mousedown",Kt),window.removeEventListener("resize",Gt)}async function Wt(nt){if(a(nt)){Gt();return}if(await MF(nt)===null){console.warn("[kimi-web] dev backend switch failed:",nt),Gt();return}window.location.reload()}ho(()=>{document.removeEventListener("mousedown",P,!0),document.removeEventListener("mousedown",qe),document.removeEventListener("mousedown",wt),document.removeEventListener("mousedown",Kt),window.removeEventListener("resize",xe),window.removeEventListener("resize",en),window.removeEventListener("resize",Gt)});const mn=oe(null);let so;function gn(){const nt=mn.value;nt&&(nt.classList.remove("blink-now"),nt.getBoundingClientRect(),nt.classList.add("blink-now"),clearTimeout(so),so=setTimeout(()=>nt.classList.remove("blink-now"),300))}const to=Hi(()=>vs(()=>import("./DesignSystemView-CSgrXT8-.js"),__vite__mapDeps([0,1]))),vt=oe(!1);let Wn,Bn=!1;function Qn(nt){Bn=!1,clearTimeout(Wn),nt.currentTarget.setPointerCapture?.(nt.pointerId),Wn=setTimeout(()=>{Bn=!0,vt.value=!0},QH)}function sn(nt){clearTimeout(Wn);const Be=nt.currentTarget;Be.hasPointerCapture?.(nt.pointerId)&&Be.releasePointerCapture(nt.pointerId)}function es(){if(Bn){Bn=!1;return}gn()}return ho(()=>{clearTimeout(Wn)}),(nt,Be)=>(x(),E("aside",{class:Ue(["side",{"macos-desktop":C(iu),collapsed:e.collapsed,"no-anim":e.dragging}]),style:on({width:e.collapsed?"0px":e.colWidth+"px"})},[w("div",{class:"col",style:on({width:e.colWidth+"px"})},[w("div",BH,[w("div",RH,[C(iu)?ue("",!0):(x(),E(We,{key:0},[(x(),E("svg",{ref_key:"logoRef",ref:mn,class:Ue(["ch-logo",{"is-dev":C(o)}]),viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Kimi Code",onClick:es,onPointerdown:Qn,onPointerup:sn,onPointercancel:sn},[...Be[22]||(Be[22]=[qk('<defs data-v-1b04ce05><mask id="kimiEyes" maskUnits="userSpaceOnUse" data-v-1b04ce05><rect x="0" y="0" width="32" height="22" fill="#fff" data-v-1b04ce05></rect><g class="ch-eyes" fill="#000" data-v-1b04ce05><rect class="ch-eye" x="11.8" y="7" width="2.8" height="8" rx="1.4" data-v-1b04ce05></rect><rect class="ch-eye" x="17.4" y="7" width="2.8" height="8" rx="1.4" data-v-1b04ce05></rect></g></mask></defs><rect x="1" y="1" width="30" height="20" rx="6" fill="var(--logo)" mask="url(#kimiEyes)" data-v-1b04ce05></rect>',2)])],34)),Be[23]||(Be[23]=w("span",{class:"ch-name"},"Kimi Code",-1)),C(o)?(x(),Se(Cp,{key:0,class:"ch-backend",clickable:s.value!==null,title:C(n)("sidebar.backendTitle",{backend:e.backend,endpoint:i.value}),onClick:Nn},{default:Ie(()=>[w("span",{class:Ue(["ch-backend-kind",`is-${e.backend}`])},R(e.backend),3),w("span",DH," · "+R(i.value),1),s.value!==null?(x(),Se(Ge,{key:0,name:"chevron-down",size:"sm"})):ue("",!0)]),_:1},8,["clickable","title"])):ue("",!0)],64))]),C(iu)?ue("",!0):(x(),Se(Xn,{key:0,class:"ch-collapse",size:"sm",label:C(n)("sidebar.collapseSidebar"),onClick:Be[0]||(Be[0]=St(Bt=>u("collapse"),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"panel-collapse"})]),_:1},8,["label"]))]),w("div",PH,[w("button",{class:"btn-new-chat",type:"button",onClick:Be[1]||(Be[1]=St(Bt=>u("create"),["stop"]))},[ae(Ge,{name:"chat-new"}),w("span",null,R(C(n)("sidebar.newChat")),1)]),ue("",!0)]),w("div",{class:Ue(["search-wrap",{"search-wrap--scrolled":y.value}])},[w("button",{class:"search",type:"button",onClick:h},[ae(Ge,{class:"search-icon",name:"search"}),w("span",HH,R(C(n)("sidebar.search")),1),ae(Er,{keys:C(f)},null,8,["keys"])])],2),w("div",{class:"sessions",onScroll:k},[e.groups.length===0?(x(),E("div",WH,R(C(n)("workspace.noWorkspace")),1)):(x(),E(We,{key:1},[w("div",zH,[w("span",UH,R(C(n)("sidebar.workspaces")),1),w("div",qH,[ae(Xn,{class:"side-section-toggle",size:"sm",label:N.value?C(n)("sidebar.expandAll"):C(n)("sidebar.collapseAll"),onClick:Be[3]||(Be[3]=St(Bt=>N.value?I():A(),["stop"]))},{default:Ie(()=>[N.value?(x(),Se(Ge,{key:0,name:"expand"})):(x(),Se(Ge,{key:1,name:"collapse"}))]),_:1},8,["label"]),ae(Xn,{class:"side-section-toggle side-section-kebab",size:"sm",label:C(n)("sidebar.options"),"aria-haspopup":"menu","aria-expanded":ut.value,onClick:Be[4]||(Be[4]=St(Bt=>Ft(Bt),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"dots-horizontal"})]),_:1},8,["label","aria-expanded"])])]),(x(!0),E(We,null,rt(e.groups,Bt=>(x(),E("div",{key:Bt.workspace.id,class:Ue(["ws-drop-target",{"drop-before":B.value?.id===Bt.workspace.id&&B.value.position==="before","drop-after":B.value?.id===Bt.workspace.id&&B.value.position==="after"}]),onDragover:Yt=>O(Yt,Bt.workspace.id),onDrop:Yt=>U(Bt.workspace.id)},[ae(MH,{group:Bt,"active-workspace-id":e.activeWorkspaceId,"active-id":e.activeId,"renaming-id":q.value,"rename-value":ee.value,"rename-input-ref":ne(),"pending-by-session":e.pendingBySession,"unread-by-session":e.unreadBySession,"ws-menu-open-id":se.value,dragging:S.value===Bt.workspace.id,"is-collapsed":v,"is-expanded":$,onGroupClick:Z,onGroupContextmenu:G,onToggleWsMenu:be,onCreateInWorkspace:Be[5]||(Be[5]=Yt=>u("createInWorkspace",Yt)),onSelectSession:ie,onRenameSession:Be[6]||(Be[6]=(Yt,vn)=>u("rename",Yt,vn)),onArchiveSession:Be[7]||(Be[7]=Yt=>u("archive",Yt)),onForkSession:Be[8]||(Be[8]=Yt=>u("fork",Yt)),onExportSession:Be[9]||(Be[9]=Yt=>u("export",Yt)),onLoadMore:F,onToggleExpand:T,onConfirmRename:K,onCancelRename:ve,onUpdateRenameValue:he,onWsDragstart:W,onWsDragend:z},null,8,["group","active-workspace-id","active-id","renaming-id","rename-value","rename-input-ref","pending-by-session","unread-by-session","ws-menu-open-id","dragging"])],42,jH))),128))],64))],32),w("div",VH,[w("button",{class:"btn-settings",type:"button",onClick:Be[10]||(Be[10]=St(Bt=>u("openSettings"),["stop"]))},[ae(Ge,{name:"settings"}),w("span",null,R(C(n)("settings.title")),1)])])],4),Ae.value?(x(),Se(Ml,{key:0,ref_key:"ghMenuRef",ref:Q,class:"gh-menu",style:on(Y.value),onClick:Be[11]||(Be[11]=St(()=>{},["stop"]))},{default:Ie(()=>[ae(Tn,{onClick:ye},{default:Ie(()=>[ot(R(C(n)("sidebar.copyPath")),1)]),_:1}),ae(Tn,{onClick:de},{default:Ie(()=>[ot(R(C(n)("sidebar.rename")),1)]),_:1}),ae(Tn,{danger:"",onClick:V},{default:Ie(()=>[ot(R(C(n)("sidebar.removeWorkspace")),1)]),_:1})]),_:1},8,["style"])):ue("",!0),se.value!==null&&pe.value?(x(),Se(Ml,{key:1,ref_key:"wsMenuRef",ref:Ne,class:"ws-menu",style:on(ke.value),onClick:Be[15]||(Be[15]=St(()=>{},["stop"]))},{default:Ie(()=>[ae(Tn,{onClick:Be[12]||(Be[12]=Bt=>Ze(pe.value))},{default:Ie(()=>[ot(R(C(n)("sidebar.copyPath")),1)]),_:1}),ae(Tn,{separator:""}),ae(Tn,{onClick:Be[13]||(Be[13]=Bt=>tt(pe.value))},{default:Ie(()=>[ot(R(C(n)("sidebar.rename")),1)]),_:1}),ae(Tn,{separator:""}),ae(Tn,{danger:"",onClick:Be[14]||(Be[14]=Bt=>lt(pe.value))},{default:Ie(()=>[ot(R(C(n)("sidebar.removeWorkspace")),1)]),_:1})]),_:1},8,["style"])):ue("",!0),ut.value?(x(),Se(Ml,{key:2,ref_key:"sectionMenuRef",ref:Tt,class:"section-menu",style:on(mt.value),onClick:Be[18]||(Be[18]=St(()=>{},["stop"]))},{default:Ie(()=>[ae(Tn,{onClick:Be[16]||(Be[16]=Bt=>Hn("manual"))},{default:Ie(()=>[w("span",KH,[e.workspaceSortMode==="manual"?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):ue("",!0)]),ot(" "+R(C(n)("sidebar.sortManual")),1)]),_:1}),ae(Tn,{onClick:Be[17]||(Be[17]=Bt=>Hn("recent"))},{default:Ie(()=>[w("span",GH,[e.workspaceSortMode==="recent"?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):ue("",!0)]),ot(" "+R(C(n)("sidebar.sortRecent")),1)]),_:1})]),_:1},8,["style"])):ue("",!0),Pt.value?(x(),Se(Ml,{key:3,ref_key:"backendMenuRef",ref:pn,class:"backend-menu",style:on(bn.value),onClick:Be[19]||(Be[19]=St(()=>{},["stop"]))},{default:Ie(()=>[(x(),E(We,null,rt(r,Bt=>ae(Tn,{key:Bt,onClick:Yt=>Wt(Bt)},{default:Ie(()=>[w("span",YH,[a(Bt)?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):ue("",!0)]),w("span",ZH,R(Bt),1),w("span",XH,R(l(Bt)),1)]),_:2},1032,["onClick"])),64))]),_:1},8,["style"])):ue("",!0),d.value?(x(),Se(QP,{key:4,sessions:e.sessions,"active-id":e.activeId,onSelect:ie,onClose:Be[20]||(Be[20]=Bt=>d.value=!1)},null,8,["sessions","active-id"])):ue("",!0),(x(),Se(_1,{to:"body"},[vt.value?(x(),Se(C(to),{key:0,onClose:Be[21]||(Be[21]=Bt=>vt.value=!1)})):ue("",!0)]))],6))}}),eW=dt(JH,[["__scopeId","data-v-1b04ce05"]]);function tW(e){try{const t=yo(e);if(t===null)return null;const n=Number(t);return Number.isFinite(n)?n:null}catch{return null}}function nW(e,t){try{Eo(e,String(t))}catch{}}function oW(e){const{storageKey:t,defaultWidth:n,min:o,max:s,reverse:i=!1}=e;function r(k){return Number.isFinite(k)?Math.min(NA(s),Math.max(o,Math.round(k))):n}const l=oe(r(tW(t)??n)),a=oe(!1);function c(k){const g=r(k);l.value=g,nW(t,g)}let u=0,d=0,f=null,h=-1;function p(k){if(!a.value)return;const g=k.clientX-u;c(d+(i?-g:g))}function m(){if(a.value){if(a.value=!1,typeof document<"u"&&(document.body.style.userSelect="",document.body.style.cursor=""),f){try{f.releasePointerCapture(h)}catch{}f.removeEventListener("pointermove",p),f.removeEventListener("pointerup",m),f.removeEventListener("pointercancel",m)}f=null,h=-1}}function y(k){k.preventDefault(),a.value=!0,u=k.clientX,d=r(l.value),f=k.currentTarget,h=k.pointerId,typeof document<"u"&&(document.body.style.userSelect="none",document.body.style.cursor="col-resize");try{f.setPointerCapture(h)}catch{}f.addEventListener("pointermove",p),f.addEventListener("pointerup",m),f.addEventListener("pointercancel",m)}return ho(m),{width:l,dragging:a,clamp:r,setWidth:c,onPointerDown:y}}const sW=["aria-label"],iW=Je({__name:"ResizeHandle",props:{storageKey:{},defaultWidth:{},min:{},max:{},reverse:{type:Boolean},ariaLabel:{}},emits:["update:width","update:dragging"],setup(e,{emit:t}){const n=e,o=t,{t:s}=$t(),{width:i,dragging:r,onPointerDown:l}=oW({storageKey:n.storageKey,defaultWidth:n.defaultWidth,min:n.min,max:()=>n.max,reverse:n.reverse});return o("update:width",i.value),et(i,a=>o("update:width",a)),et(r,a=>o("update:dragging",a)),(a,c)=>(x(),E("div",{class:Ue(["rh",{dragging:C(r)}]),role:"separator","aria-orientation":"vertical","aria-label":e.ariaLabel??C(s)("layout.resizeHandleAria"),onPointerdown:c[0]||(c[0]=(...u)=>C(l)&&C(l)(...u))},[...c[1]||(c[1]=[w("span",{class:"rh-bar","aria-hidden":"true"},null,-1)])],42,sW))}}),H_=dt(iW,[["__scopeId","data-v-48fd0a6d"]]),rW={preview:"Preview",confirm:"Confirm",cancel:"Cancel"},lW={authBannerMessage:"Not signed in · Sign in to Kimi Code to start a conversation",authBannerLogin:"Sign in",authPageTitle:"Sign in to Kimi Code",authPageMessage:"Connect your Kimi Code account before starting or continuing conversations.",authPageLogin:"Sign in",connecting:"Connecting…",connectRetrying:"Cannot reach the server — retrying…",internalBuildBanner:"Internal testing only"},aW={workspaceMeta:"workspace · {branch}",sessionsHeader:"sessions",workspaces:"Workspaces",sortWorkspaces:"Sort workspaces",sortManual:"Manual",sortRecent:"Last edited",collapseAll:"Collapse all workspaces",expandAll:"Expand all workspaces",newSession:"New Session",newChat:"New Chat",newWorkspace:"New Workspace",emptyState:"No sessions yet · click New Session to start",archiveConfirm:"Archive this session? You can restore it later from Settings.",options:"Options",rename:"Rename",copyPath:"Copy path",copySessionId:"Copy session ID",copied:"Copied ✓",copyFailed:"Copy failed",archive:"Archive",fork:"Fork session",export:"Export session",delete:"Delete",removeWorkspace:"Remove workspace",brand:"Kimi Code",signedIn:"Signed in",signOut:"Sign out",notSignedIn:"Not signed in",signIn:"Sign in",language:"Language",daemon:"Daemon",backendTitle:"Backend {backend} · {endpoint} — click to switch",noSessions:"No conversations yet",showMore:"Load {count} more conversations",showLess:"Show less",showAll:"Show {count} more conversations",loadingMore:"Loading…",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",searchPlaceholder:"Search sessions",search:"Search",searchHint:"↑↓ navigate · ↵ open · Esc close",searchNoResults:"No matching sessions"},cW={switcherTitle:"Switch workspace",switchTooltip:"Switch workspace",eyebrow:"Workspace",branchLabel:"branch: {branch}",noBranch:"no branch",sessionCount:"{count} session | {count} sessions",allWorkspaces:"All workspaces",currentWorkspace:"Current workspace only",addWorkspace:"Add workspace…",noWorkspace:"No workspace",deleteHasSessions:"This workspace still has sessions — archive them before deleting it",removeWorkspaceConfirm:'Remove workspace "{name}"?',swarmEnableConfirm:"Enable swarm mode? The agent will run multiple sub-agents in parallel.",goalStartConfirm:'Start goal: "{objective}"? The agent will run autonomously toward it.',scopeCurrent:"this workspace",scopeAll:"all workspaces",newInGroup:"New session in this workspace",addTitle:"Add workspace",recentLabel:"Recent folders",cancel:"Cancel",addFailed:"Couldn't open this folder. Check the path and try again.",openThisFolder:"Open this folder",up:"Up",browsing:"Browsing…",filterPlaceholder:"Filter subfolders…",searchPlaceholder:"Fuzzy-search subfolders, or paste an absolute path…",searching:"Searching…",noFilterMatch:"No subfolders match “{q}”",noSubfolders:"No subfolders here",browseHint:'Click a folder to enter it, then "Open this folder" to add it as a workspace.',checkingPath:"Checking path…",pathPickHint:"Path not found — did you mean:",noPathMatch:"Path not found — no matching folders under {parent}",badParent:"Parent directory does not exist: {parent}",pathFollowHint:'Folder located — press Enter or "Open this folder" to add it.',degradedPlaceholder:"Type an absolute path, press Enter to add…",degradedHint:"File browsing is unavailable — type an absolute path and press Enter to add.",attentionTitle:"{count} item needs your attention | {count} items need your attention",awaitingAnswer:"Answer",awaitingAnswerTitle:"A question is waiting for your answer",awaitingPermission:"Approve",awaitingPermissionTitle:"An action is waiting for your approval",aborted:"Stopped",abortedTitle:"This session was interrupted before finishing"},uW={jumpToLatestAria:"Jump to latest message",toc:"Conversation outline",newMessages:"Latest messages",loading:"Loading…",starting:"Starting conversation…",emptyWorkspaceHint:"Send in {name}",switchWorkspace:"Switch workspace",addWorkspace:"New workspace",moreWorkspaces:"More workspaces ({count})",compacting:"Compacting context…",compactedPlain:"Context compacted",compactedAuto:"Context auto-compacted",compactedTokens:" ({before} → {after} tokens)",viewSummary:"View summary",summaryTitle:"Compaction summary",manuallyAborted:"Manually stopped",activatedSkill:"Activated skill: {name}",undo:"Undo",undoTooltip:"Undoing the conversation will not roll back code changes",undoConfirm:"Undo last message?",yesterday:"Yesterday",loadOlder:"Load earlier messages",loadingOlder:"Loading earlier messages…",cron:{fired:"Scheduled reminder fired",missed:"Missed scheduled reminders",job:"job {id}",oneShot:"one-shot",coalesced:"{n} fires coalesced",missedCount:"{n} missed",finalDelivery:"final delivery",everyMinute:"Every minute",everyNMinutes:"Every {n} minutes",everyHour:"Every hour",everyNHours:"Every {n} hours",dailyAt:"Daily at {time}",weekdaysAt:"Weekdays at {time}",expand:"Show more",collapse:"Show less"}},dW={connectionConnected:"Connected",connectionConnecting:"Connecting…",connectionDisconnected:"Disconnected",ctxTooltip:"Used {used} / {max} tokens ({pct}%)",modelLabel:"Model",permissionManual:"Manual",permissionAuto:"Auto",permissionYolo:"YOLO",permissionManualDesc:"Ask for approval on every tool action",permissionAutoDesc:"Fully autonomous — agent decides everything without asking",permissionYoloDesc:"Auto-approve tool actions, but agent may still ask questions",planLabel:"Plan",planDesc:"Have the agent make a plan before changing files",planOn:"on",planOff:"off",planTooltip:"Toggle plan mode (research before editing)",modesLabel:"Mode",goalLabel:"Goal",goalDesc:"Track one objective until it is complete",swarmLabel:"Swarm",swarmDesc:"Run parallel agents for broader exploration",modeOff:"Off",goalPlaceholder:"What should the agent achieve?",goalStart:"Start",goalPause:"Pause",goalResume:"Resume",goalCancel:"Cancel",goalCancelConfirm:"Cancel this goal? It cannot be resumed afterwards.",goalCancelConfirmYes:"Yes",goalCancelConfirmNo:"No",goalStatusActive:"Active",goalStatusPaused:"Paused",goalStatusBlocked:"Blocked",goalStatusComplete:"Complete",modeNotSupported:"Not supported",thinkingLabel:"thinking",thinkingTooltip:"Toggle thinking mode",thinkingOn:"On",thinkingOff:"Off",cacheNote:"Note: Switching models or thinking effort invalidates the existing prompt cache. Start a new chat to avoid extra token costs.",starredModels:"Starred",moreModels:"More models…",statusPanelTitle:"Session status",statusPanelClose:"Close",statusModel:"Model",statusThinking:"Thinking",statusPermission:"Permission",statusPlanMode:"Plan mode",statusSwarmMode:"Swarm mode",swarmOn:"on",swarmOff:"off",statusContext:"Context",statusCost:"Cost",statusContextValue:"{used} / {max} ({pct}%)",statusNone:"—",activityRunning:"Running…",activityAwaitingApproval:"Awaiting approval",activityAwaitingQuestion:"Awaiting answer",interrupt:"Interrupt",runningShort:"in progress"},fW={placeholder:"Type a message…",send:"Send ↵",queueLabel:"Queue",placeholderRunning:"Press Enter to queue · Ctrl+S to inject into the running turn",starting:"Sending…",queueAutoDrain:"sends automatically when the current turn ends",queueNext:"Up next",queueDragTitle:"Drag to reorder",editQueued:"Edit (load back into the input)",queuedAttachments:"attachment ×{n}",queuedHasImage:"Contains {n} image(s) — remove only, not editable",attachmentImage:"Image",attachmentVideo:"Video",attachmentFile:"File",attachmentOpenUnsupported:"Can’t open {name} — this file type isn’t supported",dropToAttach:"Drop files to attach",remove:"Remove",removeNamed:"Remove {name}",uploading:"Uploading",uploadFailed:"Upload failed",attachFile:"Attach file",previewAttachment:"Preview {name}",interrupt:"Interrupt",interruptTitle:"Interrupt current operation",expandTitle:"Expand input for multi-line editing",collapseTitle:"Collapse input",emptyConversationTitle:"Kimi Code",emptyConversation:"No messages yet — type below to start the conversation",quickStartPlaceholder:"Type a message to start a new conversation…",thinkingSuffix:" · thinking",thinkingSuffixEffort:" · {level}"},hW={title:"Sign in to Kimi Code",close:"Close (Esc)",starting:"Starting authorization flow…",lead:"Click the button below to authorize in a new browser tab.",authorizeInBrowser:"Authorize in browser",orDivider:"or",fallbackPrefix:"On another device? Open ",fallbackSuffix:" and enter the device code:",copy:"Copy",copied:"Copied",waitingAuth:"Waiting for authorization",waitingAutoClose:"Waiting for authorization, signs in automatically…",success:"Authorized",successHint:"Loading, will close automatically…",expiredTitle:"Authorization code expired",expiredHint:"Please restart the authorization flow",retry:"Retry",closeBtn:"Close",errorTitle:"The current daemon does not support login yet",errorHint:"Please upgrade kimi-code and try again",pollErrorTitle:"Lost connection to the daemon",pollErrorHint:"Authorization polling failed repeatedly. Check the kimi-code process and try again."},pW={dialogLabel:"Manage providers",title:"Provider management",close:"Close (Esc)",loading:"Loading providers…",unavailable:"The daemon does not support provider management yet",empty:"No providers yet",status:{connected:"Connected",error:"Error",unconfigured:"Not configured"},keySet:"key set",keyNotSet:"key not set",modelCount:"{count} models",confirmDelete:"Confirm delete?",refresh:"Refresh",delete:"Delete",refreshTitle:"Refresh {type}",deleteTitle:"Delete {type}",loginKimi:"Sign in to Kimi",loginAnthropic:"Sign in to Anthropic",enterApiKey:"Enter API Key",fieldType:"Type",fieldApiKey:"API Key",fieldBaseUrl:"Base URL",fieldDefaultModel:"Default model",baseUrlPlaceholder:"https://… (optional)",optional:"Optional",apiKeyRequired:"API Key cannot be empty",add:"Add",escClose:"Esc to close"},mW={dialogLabel:"Switch model",title:"Switch model",close:"Close (Esc)",allTab:"All",providerTabs:"Model providers",searchPlaceholder:"Search models or providers…",loading:"Loading models…",unavailable:"The daemon does not support model listing yet",contextSuffix:"{size} ctx",emptyNoModels:"The daemon offers no selectable models",emptyNoMatch:"No matching models",starTitle:"Add to favorites",unstarTitle:"Remove from favorites",footerHint:"↑↓ Navigate · Enter Select · Esc Close"},gW={justNow:"just now"},vW={title:{shell:"Run command?",diff:"Apply changes?",file:"Write file?",fileop:"File operation?",url:"Fetch URL?",search:"Search?",invocation:"Invoke?",todo:"Update todo?",plan_review:"Ready to build with this plan?",generic:"Approve action?"},subagentBadge:"sub agent · {name}",required:"APPROVAL REQUIRED",danger:"Danger: {detail}",searchQueryLabel:"query",searchScope:"scope: {scope}",feedbackPlaceholder:"Explain why you are rejecting… (Enter to submit, Esc to cancel)",feedbackHint:"Enter to submit · Esc to cancel",approve:"Approve",approveSession:"Approve for session",reject:"Reject",feedback:"+Feedback",approvePlan:"Approve plan",revise:"Revise",rejectAndExit:"Reject and Exit"},yW={title:"Question",step:"Q{current}/{total}",back:"‹ Back",nextQuestion:"Next question ›",otherDefault:"Other…",submit:"Submit",dismiss:"Dismiss",minimize:"Minimize",expand:"Expand"},kW={tag:"tasks",summary:"{run} running · {done} done",stop:"stop",defaultDescription:"Background task",dockTasks:"Background tasks",dockBash:"Bash",dockSubagent:"Sub Agent",dockTodos:"Todos",running:"running",closePanel:"Close panel",timingRunning:"Running · {time}",timingDone:"Done · {sec}s",emptyTasks:"No background tasks running",emptyBash:"No bash tasks running",emptySubagent:"No sub agent tasks running",emptyTodo:"No todos yet",openTab:"Open the tasks tab",openDetail:"Open",collapse:"Collapse",expand:"Expand"},bW={panelTitle:"Thinking",close:"Close"},xW={title:"Changes",branch:"branch",aheadTitle:"ahead of remote",behindTitle:"behind remote",changeCount:"{count} changes",empty:"No git changes / not provided by daemon",clean:"Working tree clean, no changes",back:"Back",loading:"Loading diff…",noDiff:"No line changes for this file",list:"List",tree:"Tree",close:"Close"},wW={},_W={empty:"Select a file on the left to preview",loading:"Loading…",lineCount:"{count} lines",copy:"Copy",copied:"Copied",copyPath:"Copy path",openInEditor:"Open",reveal:"Reveal",download:"Download",close:"Close",search:"Search",prevMatch:"Previous match",nextMatch:"Next match",htmlMode:"HTML preview mode",markdownMode:"Markdown preview mode",preview:"Preview",source:"Source",imageFit:"Image sizing",fit:"Fit",actual:"Actual",pdfNoPreview:"This PDF cannot be embedded here. Download it to view.",imageNoPreview:"Image file · {mime} · {size} · preview unavailable",videoNoPreview:"Video file · {mime} · {size} · preview unavailable",binaryNoPreview:"Binary file · {mime} · {size} bytes · preview unavailable",unknownType:"unknown type",copyCode:"Copy code",enlargeImage:"Enlarge image",errors:{emptyPath:"File path is empty",unsupportedPath:"URLs and remote paths cannot be previewed",outsideWorkspace:"Only files inside the current workspace can be previewed",isDirectory:"Select a file instead of a directory",loadFailed:"Unable to read this file"}},SW={searching:"Searching…",noMatch:"No matches"},CW={dismiss:"Close",errorLabel:"Error",noteLabel:"Note",agentError:{title:"Model request failed",connection:"Cannot connect to the model service",auth:"Model authentication failed",rateLimit:"Model rate limit reached",overloaded:"Model overloaded",filtered:"Response filtered by the provider",api:"Model API error",contextOverflow:"Context size exceeded"},details:{cause:"Cause",code:"Error code",connection:"Connection",contentType:"Content type",details:"Server details",duration:"Duration",endpoint:"Endpoint",errorName:"Error type",message:"Message",operation:"Operation",phase:"Failure phase",request:"Request",requestId:"Request ID",responsePreview:"Response preview",sessionId:"Session ID",stack:"Stack",status:"HTTP status",timeout:"Timeout",timestamp:"Time"},daemonApiTitle:"Kimi daemon returned an error",daemonNetworkMessage:"Web did not receive a response from the local service. Check that Kimi daemon is still running, or refresh the page.",daemonNetworkTitle:"Cannot connect to Kimi daemon",diagnostics:"Diagnostics",hideDetails:"Hide details",operationFailedMessage:"The last operation did not finish. Try again later.",operationFailedTitle:"Operation failed",sessionSnapshotMessage:"Web could not load the current conversation. Check that Kimi daemon is still running, or refresh the page.",sessionSnapshotTitle:"Cannot load current conversation",showDetails:"Show details",copyDetails:"Copy diagnostics",copied:"Copied",wsTitle:"Realtime connection error",goal:{alreadyExists:"This session already has an active goal. Cancel it before starting a new one.",notFound:"No goal to act on — it may have already finished or been cancelled.",statusInvalid:"The current goal state does not allow this action.",notResumable:"This goal cannot be resumed (it may be cancelled or completed).",objectiveTooLong:"The objective is too long. Please shorten it and try again."}},AW={new:{desc:"Create a new session"},clear:{desc:"Clear and start a new session"},login:{desc:"Sign in to Kimi in the browser"},plan:{desc:"Toggle plan mode on/off"},swarm:{desc:"Toggle swarm mode; /swarm <task> runs a task in swarm"},goal:{desc:"Create/control a goal: /goal <objective>, /goal pause|resume|cancel"},btw:{desc:"Side chat: /btw <question> asks a forked side session"},yolo:{desc:"Auto-approve tool actions; the agent may still ask questions"},auto:{desc:"Fully autonomous — the agent never asks questions"},thinking:{desc:"Set the thinking level"},compact:{desc:"Compact the conversation history"},fork:{desc:"Fork this session into a new one"},export:{desc:"Download this session and troubleshooting logs as a ZIP",noSession:"Open a session before exporting it."},status:{desc:"View session status"},undo:{desc:"Undo the last message"}},MW={label:{read:"Read",bash:"Run",edit:"Edit",write:"Write",grep:"Search",glob:"Find",ls:"List",web_fetch:"Fetch",search:"Search",todo:"Todo",task:"Task",swarm:"Swarm",ask_user:"Question",goal_create:"Start Goal",goal_get:"Read Goal",goal_budget:"Set Goal Budget",goal_update:"Update Goal"},swarm:{progress:"{done} / {total}",runningSub:"{count} in progress",doneSub:"{completed} completed · {failed} failed",phaseQueued:"Queued",phaseWorking:"Working",phaseSuspended:"Suspended",phaseCompleted:"Completed",phaseFailed:"Failed",waiting:"Waiting for subagents…"},chip:{lines:"{count} lines",results:"{count} results",edited:"edited",created:"created",todos:"{count} items"},goal:{objectiveWithCriterion:"{objective} · {criterion}",status:"Status: {status}",budget:"{value} {unit}",turns:"{value} turns",tokens:"{value} tokens",milliseconds:"{value} ms",seconds:"{value} sec",minutes:"{value} min",hours:"{value} hr"},group:{title:"{count} tool call | {count} tool calls",running:"running",error:"failed",done:"done"},ask:{dismissed:"Dismissed",answer:"{count} answer",answers:"{count} answers",answered:"Answered",more:"(+{count} more)"}},EW={resizeHandleAria:"Resize sidebar width",resizePreviewAria:"Resize preview panel width",detailPanelAria:"Detail panel"},TW={openSwitcher:"Switch session / workspace",openSettings:"Session settings",settingsTitle:"Session settings",groupSession:"Current session",groupApp:"App preferences",sheetLabel:"Sheet",closeSheet:"Close",tapToCycle:"tap to cycle",running:"running",idle:"idle",sessionCount:"{n} sessions",newSession:"New session",permManualSub:"confirm every tool",permAutoSub:"fully autonomous, never asks",permYoloSub:"auto-approve tools, may still ask",planModeSub:"Plan mode",swarmModeSub:"Swarm mode",archivedSessions:"Archived sessions",archivedSessionsSub:"Browse and restore archived sessions",archivedBack:"Back"},NW={colorSchemeLabel:"Light/Dark",light:"Moon Bright",dark:"Moon Dark",system:"System",accentLabel:"Accent",accentBlue:"Blue",accentBlack:"Black"},IW={preview:"预览",confirm:"确认",cancel:"取消"},LW={authBannerMessage:"未登录 · 需要登录 Kimi Code 才能开始对话",authBannerLogin:"登录",authPageTitle:"登录 Kimi Code",authPageMessage:"先连接 Kimi Code 账号,然后再开始或继续对话。",authPageLogin:"登录",connecting:"连接中…",connectRetrying:"无法连接服务器,正在重试…",internalBuildBanner:"仅供内部测试"},$W={workspaceMeta:"workspace · {branch}",sessionsHeader:"sessions",workspaces:"工作区",sortWorkspaces:"工作区排序",sortManual:"手动排序",sortRecent:"按最后编辑时间",collapseAll:"折叠全部工作区",expandAll:"展开全部工作区",newSession:"新建会话",newChat:"新建对话",newWorkspace:"新建工作区",emptyState:"还没有会话 · 点击 新建会话 开始",archiveConfirm:"确认归档会话?归档后可以从「设置」中恢复",options:"选项",rename:"重命名",copyPath:"复制路径",copySessionId:"复制 Session ID",copied:"已复制 ✓",copyFailed:"复制失败",archive:"归档",fork:"分叉会话",export:"导出会话",delete:"删除",removeWorkspace:"移除工作区",brand:"Kimi Code",signedIn:"已登录",signOut:"退出登录",notSignedIn:"未登录",signIn:"登录",language:"语言",daemon:"后台",backendTitle:"后端 {backend} · {endpoint} — 点击切换",noSessions:"暂无对话",showMore:"加载更多 {count} 个对话",showLess:"收起",showAll:"展开剩余 {count} 个对话",loadingMore:"加载中…",collapseSidebar:"收起侧边栏",expandSidebar:"展开侧边栏",searchPlaceholder:"搜索会话",search:"搜索",searchHint:"↑↓ 选择 · ↵ 打开 · Esc 关闭",searchNoResults:"没有匹配的会话"},FW={switcherTitle:"切换工作区",switchTooltip:"切换工作区",eyebrow:"工作区",branchLabel:"分支: {branch}",noBranch:"无分支",sessionCount:"{count} 个会话",allWorkspaces:"全部工作区",currentWorkspace:"仅当前工作区",addWorkspace:"添加工作区…",noWorkspace:"暂无工作区",deleteHasSessions:"工作区内还有会话,请先归档这些会话再删除",removeWorkspaceConfirm:"移除工作区「{name}」?",swarmEnableConfirm:"启用 swarm 模式?Agent 将并行运行多个子 agent。",goalStartConfirm:"启动 goal:「{objective}」?Agent 将自主执行。",scopeCurrent:"当前工作区",scopeAll:"全部工作区",newInGroup:"在此工作区新建会话",addTitle:"添加工作区",recentLabel:"最近的文件夹",cancel:"取消",addFailed:"无法打开此文件夹,请检查路径后重试。",openThisFolder:"打开此文件夹",up:"上一级",browsing:"加载中…",filterPlaceholder:"过滤子文件夹…",searchPlaceholder:"模糊搜索子文件夹,或粘贴绝对路径…",searching:"搜索中…",noFilterMatch:"没有匹配「{q}」的子文件夹",noSubfolders:"此处没有子文件夹",browseHint:'点击文件夹进入,再点"打开此文件夹"将其添加为工作区。',checkingPath:"检查路径…",pathPickHint:"此路径不存在,你是不是想找:",noPathMatch:"此路径不存在,「{parent}」下没有匹配的文件夹",badParent:"上级目录不存在:{parent}",pathFollowHint:'已定位到目标文件夹,按回车或点击"打开此文件夹"完成添加。',degradedPlaceholder:"输入绝对路径,回车添加…",degradedHint:"守护进程无法浏览文件系统,请直接输入绝对路径后回车添加。",attentionTitle:"{count} 项待处理",awaitingAnswer:"待回答",awaitingAnswerTitle:"有提问等待你回答",awaitingPermission:"待授权",awaitingPermissionTitle:"有操作等待你授权",aborted:"已中断",abortedTitle:"此会话在完成前被中断"},OW={jumpToLatestAria:"跳到最新消息",toc:"对话目录",newMessages:"最新消息",loading:"加载中…",starting:"正在创建对话…",emptyWorkspaceHint:"在 {name} 中发送",switchWorkspace:"切换工作区",addWorkspace:"添加工作区",moreWorkspaces:"更多工作区 ({count})",compacting:"正在压缩上下文…",compactedPlain:"上下文已压缩",compactedAuto:"已自动压缩上下文",compactedTokens:"({before} → {after} tokens)",viewSummary:"查看摘要",summaryTitle:"压缩摘要",manuallyAborted:"您已手动终止",activatedSkill:"已激活技能: {name}",undo:"撤销",undoTooltip:"撤销对话不会回滚代码",undoConfirm:"撤销上一条消息?",yesterday:"昨天",loadOlder:"加载更早的消息",loadingOlder:"正在加载更早的消息…",cron:{fired:"定时任务已触发",missed:"错过的定时提醒",job:"任务 {id}",oneShot:"单次",coalesced:"已合并 {n} 次触发",missedCount:"错过 {n} 次",finalDelivery:"最后一次投递",everyMinute:"每分钟",everyNMinutes:"每 {n} 分钟",everyHour:"每小时",everyNHours:"每 {n} 小时",dailyAt:"每天 {time}",weekdaysAt:"工作日 {time}",expand:"展开",collapse:"收起"}},BW={connectionConnected:"已连接",connectionConnecting:"连接中…",connectionDisconnected:"未连接",ctxTooltip:"使用 {used} / {max} tokens ({pct}%)",modelLabel:"模型",permissionManual:"逐条确认",permissionAuto:"完全自主",permissionYolo:"自动通过",permissionManualDesc:"每个工具操作都需要你手动确认",permissionAutoDesc:"完全自主运行,智能体自己做决定,不再询问",permissionYoloDesc:"自动批准工具操作,但遇到关键问题仍会询问",planLabel:"计划",planDesc:"先让智能体梳理计划,再修改文件",planOn:"开",planOff:"关",planTooltip:"切换计划模式(先调研再修改)",modesLabel:"模式",goalLabel:"目标",goalDesc:"持续跟踪一个目标,直到任务完成",swarmLabel:"Swarm",swarmDesc:"并行运行多个智能体,适合大范围探索",modeOff:"未启用",goalPlaceholder:"让智能体完成什么目标?",goalStart:"开始",goalPause:"暂停",goalResume:"继续",goalCancel:"取消",goalCancelConfirm:"是否需要取消当前目标?取消后将无法恢复。",goalCancelConfirmYes:"是",goalCancelConfirmNo:"否",goalStatusActive:"进行中",goalStatusPaused:"已暂停",goalStatusBlocked:"已阻塞",goalStatusComplete:"已完成",modeNotSupported:"暂不支持",thinkingLabel:"思考",thinkingTooltip:"切换思考模式",thinkingOn:"开",thinkingOff:"关",cacheNote:"提示:切换模型或思考程度会使已有的提示词缓存失效。建议新建对话,避免额外的 token 消耗。",starredModels:"收藏",moreModels:"更多模型…",statusPanelTitle:"会话状态",statusPanelClose:"关闭",statusModel:"模型",statusThinking:"思考强度",statusPermission:"权限",statusPlanMode:"计划模式",statusSwarmMode:"Swarm 模式",swarmOn:"开",swarmOff:"关",statusContext:"上下文",statusCost:"花费",statusContextValue:"{used} / {max} ({pct}%)",statusNone:"—",activityRunning:"运行中…",activityAwaitingApproval:"等待批准",activityAwaitingQuestion:"等待回答",interrupt:"中断",runningShort:"进行中"},RW={placeholder:"输入消息…",send:"发送 ↵",queueLabel:"队列",placeholderRunning:"输入会加入队列 · Ctrl+S 立即插入运行中的回合",starting:"正在发送…",queueAutoDrain:"当前回合结束后自动逐条发送",queueNext:"下一条",queueDragTitle:"拖拽排序",editQueued:"编辑(载入到输入框)",queuedAttachments:"附件 ×{n}",queuedHasImage:"包含 {n} 张图片 — 只能移除,不能编辑",attachmentImage:"图片",attachmentVideo:"视频",attachmentFile:"文件",attachmentOpenUnsupported:"无法打开 {name}:暂不支持此文件类型",dropToAttach:"松开鼠标添加附件",remove:"移除",removeNamed:"移除 {name}",uploading:"上传中",uploadFailed:"上传失败",attachFile:"添加附件",previewAttachment:"预览 {name}",interrupt:"中断",interruptTitle:"中断当前操作",expandTitle:"展开输入框进行多行编辑",collapseTitle:"收起输入框",emptyConversationTitle:"Kimi Code",emptyConversation:"还没有消息 —— 在下方输入开始对话",quickStartPlaceholder:"输入消息开始新对话…",thinkingSuffix:" · 思考",thinkingSuffixEffort:" · {level}"},DW={title:"登录 Kimi Code",close:"关闭 (Esc)",starting:"正在启动授权流程…",lead:"点击下方按钮,在新标签页中完成授权。",authorizeInBrowser:"在浏览器中授权",orDivider:"或者",fallbackPrefix:"换个设备?在浏览器打开 ",fallbackSuffix:" 输入设备码:",copy:"复制",copied:"已复制",waitingAuth:"等待授权",waitingAutoClose:"等待授权,完成后自动登录…",success:"已授权",successHint:"正在加载,稍后自动关闭…",expiredTitle:"授权码已过期",expiredHint:"请重新开始授权流程",retry:"重试",closeBtn:"关闭",errorTitle:"当前 daemon 暂不支持登录",errorHint:"请升级 kimi-code 后重试",pollErrorTitle:"与 daemon 的连接已断开",pollErrorHint:"授权轮询连续失败,请检查 kimi-code 进程后重试"},PW={dialogLabel:"管理提供商",title:"提供商管理",close:"关闭 (Esc)",loading:"加载提供商中…",unavailable:"daemon 暂不支持提供商管理",empty:"暂无提供商",status:{connected:"已连接",error:"错误",unconfigured:"未配置"},keySet:"key 已设置",keyNotSet:"未设置 key",modelCount:"{count} 个模型",confirmDelete:"确认删除?",refresh:"刷新",delete:"删除",refreshTitle:"刷新 {type}",deleteTitle:"删除 {type}",loginKimi:"登录 Kimi",loginAnthropic:"登录 Anthropic",enterApiKey:"填写 API Key",fieldType:"类型",fieldApiKey:"API Key",fieldBaseUrl:"Base URL",fieldDefaultModel:"默认模型",baseUrlPlaceholder:"https://… (可选)",optional:"可选",apiKeyRequired:"API Key 不能为空",add:"添加",escClose:"Esc 关闭"},HW={dialogLabel:"切换模型",title:"切换模型",close:"关闭 (Esc)",allTab:"全部",providerTabs:"模型提供商",searchPlaceholder:"搜索模型或提供商…",loading:"加载模型中…",unavailable:"daemon 暂不支持模型列表",contextSuffix:"{size} ctx",emptyNoModels:"daemon 未提供可选模型",emptyNoMatch:"无匹配模型",starTitle:"添加到收藏",unstarTitle:"取消收藏",footerHint:"↑↓ 导航 · Enter 选择 · Esc 关闭"},WW={justNow:"刚刚"},zW={title:{shell:"运行命令?",diff:"应用修改?",file:"写入文件?",fileop:"文件操作?",url:"抓取 URL?",search:"搜索?",invocation:"调用?",todo:"更新 todo?",plan_review:"按这份 plan 开始实现?",generic:"批准操作?"},subagentBadge:"子 agent · {name}",required:"APPROVAL REQUIRED",danger:"危险: {detail}",searchQueryLabel:"查询",searchScope:"范围:{scope}",feedbackPlaceholder:"说明拒绝原因… (Enter 提交, Esc 取消)",feedbackHint:"Enter 提交 · Esc 取消",approve:"批准",approveSession:"本会话内批准",reject:"拒绝",feedback:"+反馈",approvePlan:"批准 plan",revise:"修改",rejectAndExit:"拒绝并退出"},UW={title:"提问",step:"Q{current}/{total}",back:"‹ 返回",nextQuestion:"下一题 ›",otherDefault:"其他…",submit:"提交",dismiss:"放弃",minimize:"最小化",expand:"展开"},qW={tag:"任务",summary:"{run} 运行中 · {done} 完成",stop:"stop",defaultDescription:"后台任务",dockTasks:"后台任务",dockBash:"后台 Bash",dockSubagent:"子 Agent",dockTodos:"待办",running:"运行中",closePanel:"关闭面板",timingRunning:"运行中 · {time}",timingDone:"完成 · {sec}s",emptyTasks:"暂无后台任务",emptyBash:"暂无后台 Bash 任务",emptySubagent:"暂无子 Agent 任务",emptyTodo:"暂无待办事项",openTab:"查看全部后台任务",openDetail:"查看",collapse:"折叠",expand:"展开"},jW={panelTitle:"思考过程",close:"关闭"},VW={title:"改动",branch:"分支",aheadTitle:"领先远程",behindTitle:"落后远程",changeCount:"{count} 改动",empty:"无 git 改动 / daemon 未提供",clean:"工作区干净,无改动",back:"返回",loading:"正在加载 diff…",noDiff:"该文件没有行级改动",list:"列表",tree:"树形",close:"关闭"},KW={},GW={empty:"选择左侧文件预览",loading:"加载中…",lineCount:"{count} 行",copy:"复制",copied:"已复制",copyPath:"复制路径",openInEditor:"打开",reveal:"显示",download:"下载",close:"关闭",search:"搜索",prevMatch:"上一个匹配",nextMatch:"下一个匹配",htmlMode:"HTML 预览模式",markdownMode:"Markdown 预览模式",preview:"预览",source:"源码",imageFit:"图片缩放",fit:"适应",actual:"原始",pdfNoPreview:"无法内嵌预览此 PDF,可以下载后查看",imageNoPreview:"图片文件 · {mime} · {size} · 暂不预览",videoNoPreview:"视频文件 · {mime} · {size} · 暂不预览",binaryNoPreview:"二进制文件 · {mime} · {size} 字节 · 暂不预览",unknownType:"未知类型",copyCode:"复制代码",enlargeImage:"放大图片",errors:{emptyPath:"文件路径为空",unsupportedPath:"不支持预览 URL 或远程路径",outsideWorkspace:"只能预览当前 workspace 内的文件",isDirectory:"请选择具体文件,而不是目录",loadFailed:"无法读取这个文件"}},YW={searching:"搜索中…",noMatch:"无匹配"},ZW={dismiss:"关闭",errorLabel:"错误",noteLabel:"提示",agentError:{title:"模型请求失败",connection:"无法连接模型服务",auth:"模型认证失败",rateLimit:"模型请求被限流",overloaded:"模型服务过载",filtered:"响应被提供方过滤",api:"模型接口返回错误",contextOverflow:"上下文超出模型限制"},details:{cause:"底层原因",code:"错误码",connection:"连接状态",contentType:"响应类型",details:"服务端详情",duration:"耗时",endpoint:"请求地址",errorName:"错误类型",message:"错误信息",operation:"操作",phase:"失败阶段",request:"请求",requestId:"Request ID",responsePreview:"响应预览",sessionId:"Session ID",stack:"堆栈",status:"HTTP 状态",timeout:"超时设置",timestamp:"时间"},daemonApiTitle:"Kimi daemon 返回错误",daemonNetworkMessage:"Web 没有拿到本地服务的响应。请确认 Kimi daemon 仍在运行,或刷新页面重试。",daemonNetworkTitle:"无法连接到 Kimi daemon",diagnostics:"诊断信息",hideDetails:"收起详情",operationFailedMessage:"刚才的操作没有完成,请稍后重试。",operationFailedTitle:"操作失败",sessionSnapshotMessage:"Web 没能加载当前会话内容。请确认 Kimi daemon 仍在运行,或刷新页面重试。",sessionSnapshotTitle:"无法加载当前会话内容",showDetails:"查看详情",copyDetails:"复制诊断信息",copied:"已复制",wsTitle:"实时连接出错",goal:{alreadyExists:"当前会话已有一个进行中的目标,请先取消它再创建新目标。",notFound:"没有找到可操作的目标,可能它已经结束或被取消。",statusInvalid:"当前目标状态不支持这个操作。",notResumable:"这个目标无法恢复(可能已取消或已完成)。",objectiveTooLong:"目标描述太长了,请精简后重试。"}},XW={new:{desc:"创建新会话"},clear:{desc:"清空并新建会话"},login:{desc:"在浏览器中登录 Kimi"},plan:{desc:"切换计划模式 开/关"},swarm:{desc:"切换 swarm 模式;/swarm <任务> 直接在 swarm 下执行"},goal:{desc:"创建/控制目标:/goal <目标>、/goal pause|resume|cancel"},btw:{desc:"侧边聊天:/btw <问题> 向 fork 的侧边会话提问"},yolo:{desc:"自动批准工具操作,Agent 仍可能提问"},auto:{desc:"完全自主,Agent 不再提问"},thinking:{desc:"设置思考强度"},compact:{desc:"压缩会话历史"},fork:{desc:"把当前会话 fork 出一个新会话"},export:{desc:"将当前会话和排障日志下载为 ZIP 压缩包",noSession:"请先打开一个会话再导出。"},status:{desc:"查看会话状态"},undo:{desc:"撤销上一条消息"}},QW={label:{read:"读取",bash:"运行",edit:"编辑",write:"写入",grep:"搜索",glob:"查找",ls:"列目录",web_fetch:"抓取",search:"搜索",todo:"待办",task:"任务",swarm:"Swarm",ask_user:"提问",goal_create:"启动目标",goal_get:"读取目标",goal_budget:"设置目标预算",goal_update:"更新目标"},swarm:{progress:"{done} / {total}",runningSub:"{count} 个进行中",doneSub:"完成 {completed} · 失败 {failed}",phaseQueued:"排队",phaseWorking:"运行中",phaseSuspended:"暂停",phaseCompleted:"完成",phaseFailed:"失败",waiting:"等待子任务加入…"},chip:{lines:"{count} 行",results:"{count} 结果",edited:"已编辑",created:"已创建",todos:"{count} 项"},goal:{objectiveWithCriterion:"{objective} · {criterion}",status:"状态:{status}",budget:"{value} {unit}",turns:"{value} 轮",tokens:"{value} token",milliseconds:"{value} 毫秒",seconds:"{value} 秒",minutes:"{value} 分钟",hours:"{value} 小时"},group:{title:"{count} 个工具调用",running:"运行中",error:"有失败",done:"已完成"},ask:{dismissed:"已忽略",answer:"{count} 个回答",answers:"{count} 个回答",answered:"已回答",more:"(还有 {count} 个)"}},JW={resizeHandleAria:"调整侧栏宽度",resizePreviewAria:"调整预览面板宽度",detailPanelAria:"详情面板"},ez={openSwitcher:"切换会话 / 工作区",openSettings:"会话设置",settingsTitle:"会话设置",groupSession:"当前会话",groupApp:"应用偏好",sheetLabel:"面板",closeSheet:"关闭",tapToCycle:"点击切换",running:"运行中",idle:"空闲",sessionCount:"{n} 个会话",newSession:"新建会话",permManualSub:"每个工具都确认",permAutoSub:"完全自主,不再提问",permYoloSub:"自动批准工具,仍可能提问",planModeSub:"计划模式",swarmModeSub:"Swarm 模式",archivedSessions:"已归档会话",archivedSessionsSub:"查看并恢复已归档会话",archivedBack:"返回"},tz={colorSchemeLabel:"明暗",light:"月之亮面",dark:"月之暗面",system:"跟随系统",accentLabel:"主题色",accentBlue:"蓝色",accentBlack:"黑色"},nz={title:"Welcome to Kimi Web",subtitle:"Pick a few preferences — you can change them anytime in Settings.",languageLabel:"Language",start:"Get started",skip:"Skip",reopen:"Preferences / onboarding"},oz={title:"欢迎来使用 Kimi Web",subtitle:"来选择一些你的偏好 —— 之后也可以在设置里随时修改。",languageLabel:"语言",start:"开始使用",skip:"跳过",reopen:"偏好 / 引导"},sz={title:"Settings",close:"Close (Esc)",tabs:{general:"General",agent:"Agent",account:"Account",advanced:"Advanced",archived:"Archived"},appearance:"Appearance",notifications:"Notifications",notifyOnComplete:"Notify when a turn completes",notifyOnQuestion:"Notify when a question needs an answer",notifyOnApproval:"Notify when a tool needs approval",soundOnComplete:"Play a sound when a turn completes, needs an answer, or needs approval",notifyDenied:"Blocked in browser settings",notifyTitle:"Kimi Code · Turn finished",notifyQuestionTitle:"Kimi Code · Needs answer",notifyApprovalTitle:"Kimi Code · Approval required",notifyFallback:"View result",notifyQuestionFallback:"A question is waiting for your answer",notifyApprovalFallback:"A tool needs your approval",account:"Account",uiFontSize:"Font size",agentDefaults:"Agent defaults",providers:"Providers",providersHint:"Add, remove, or refresh providers",manageProviders:"Manage",saving:"Saving",defaultModel:"Default model",defaultModelHint:"New sessions prefer this model",noDefaultModel:"No default model",defaultPermission:"Default permission",defaultPermissionHint:"Only affects newly-created sessions",defaultThinking:"Thinking by default",defaultThinkingHint:"Whether new sessions start with thinking enabled",defaultPlanMode:"Plan mode by default",defaultPlanModeHint:"Whether new sessions start in plan mode",mergeSkills:"Merge all available skills",mergeSkillsHint:"Show project, plugin, and user skills together",telemetry:"Improve product with usage data",telemetryHint:"When on, we collect anonymous interaction data (such as clicks, interruptions, and feature usage) to improve the product experience. You can turn it off at any time.",telemetryRestartHint:"Takes effect after restarting the service.",credentialReady:"Credential configured",credentialMissing:"Missing credential",configUnavailable:"The server did not return config yet. These settings are unavailable.",advanced:"Advanced",build:"Build",serverVersion:"Server version",backend:"Backend",exportLog:"Troubleshooting log",logHint:"Enable with ?debug=1 to capture",exportLogBtn:"Export log",conversationToc:"Show conversation outline",conversationTocHint:"Show a clickable outline in the right margin to jump between messages",archivedTitle:"Archived sessions",archivedDesc:"Browse archived sessions, see their workspace path, name, and archive time, and restore them to the session list.",archivedSearch:"Search archived sessions",archivedAllWorkspaces:"All workspaces",archivedSortLabel:"Sort by",archivedSortArchived:"Archive time",archivedSortCreated:"Created time",archivedSortName:"Name",archivedRestore:"Restore",archivedEmpty:"No archived sessions yet",archivedNoMatch:"No matching archived sessions",archivedSessionsCount:"{count} sessions",archivedAt:"Archived {time}",archivedLoadMore:"Load more",archivedLoading:"Loading…",archivedLoadingAll:"Loading all archived sessions…"},iz={title:"设置",close:"关闭 (Esc)",tabs:{general:"通用",agent:"Agent",account:"账户",advanced:"高级",archived:"已归档"},appearance:"外观",notifications:"通知",notifyOnComplete:"会话完成时通知",notifyOnQuestion:"待回答时通知",notifyOnApproval:"待审批时通知",soundOnComplete:"会话完成、待回答或待审批时播放提示音",notifyDenied:"已在浏览器设置中被阻止",notifyTitle:"Kimi Code · 回合完成",notifyQuestionTitle:"Kimi Code · 待回答",notifyApprovalTitle:"Kimi Code · 等待审批",notifyFallback:"点击查看结果",notifyQuestionFallback:"有提问等待你回答",notifyApprovalFallback:"有工具等待你审批",account:"账户",uiFontSize:"字体大小",agentDefaults:"Agent 默认值",providers:"提供商",providersHint:"添加、删除或刷新提供商",manageProviders:"管理",saving:"保存中",defaultModel:"默认模型",defaultModelHint:"新会话会优先使用这个模型",noDefaultModel:"未设置默认模型",defaultPermission:"默认权限",defaultPermissionHint:"只影响之后新建的会话",defaultThinking:"默认开启思考",defaultThinkingHint:"新会话默认是否开启 thinking",defaultPlanMode:"默认计划模式",defaultPlanModeHint:"新会话默认进入 plan mode",mergeSkills:"合并所有可用 Skills",mergeSkillsHint:"让项目、插件和用户 Skills 一起出现在可用列表中",telemetry:"使用数据改进产品",telemetryHint:"开启后,我们会收集您的匿名交互数据(如点击、打断、功能使用等),用于改进产品体验。您可以随时关闭。",telemetryRestartHint:"更改后需重启服务生效。",credentialReady:"凭据已配置",credentialMissing:"缺少凭据",configUnavailable:"当前服务端没有返回 config,设置项暂不可用。",advanced:"高级",build:"构建",serverVersion:"服务端版本",backend:"后端",exportLog:"故障排查日志",logHint:"加 ?debug=1 开启采集",exportLogBtn:"导出日志",conversationToc:"显示对话目录",conversationTocHint:"在右侧显示可点击跳转的对话目录",archivedTitle:"已归档会话",archivedDesc:"查看已归档会话,确认其所属工作区路径、会话名称和归档时间,并可恢复到会话列表。",archivedSearch:"搜索已归档会话",archivedAllWorkspaces:"所有工作区",archivedSortLabel:"排序方式",archivedSortArchived:"归档时间",archivedSortCreated:"创建时间",archivedSortName:"按字母顺序",archivedRestore:"恢复",archivedEmpty:"还没有归档的会话",archivedNoMatch:"没有匹配的已归档会话",archivedSessionsCount:"{count} 个会话",archivedAt:"归档于 {time}",archivedLoadMore:"加载更多",archivedLoading:"加载中…",archivedLoadingAll:"正在加载全部归档会话…"},rz={openInEditor:"Open in editor",openInEditorShort:"Open",chooseOpenApp:"Choose application",copyAll:"Copy all as Markdown",copyFinalSummary:"Copy final summary",copied:"Copied",copyPath:"Copy path",changed:"{n} changed",gitTooltip:"Open Files > Changed",detached:"detached",openPr:"Open pull request",prStatusOpen:"open",prStatusClosed:"closed",prStatusMerged:"merged",prStatusDraft:"draft",prStatusUnknown:"unknown",options:"Options",copySessionId:"Copy Session ID",renameSession:"Rename",forkSession:"Fork session",archiveSession:"Archive",exportSession:"Export session"},lz={openInEditor:"在编辑器中打开",openInEditorShort:"打开",chooseOpenApp:"选择应用",copyAll:"复制全部对话为 Markdown",copyFinalSummary:"仅复制最终总结",copied:"已复制",copyPath:"复制路径",changed:"{n} 处改动",gitTooltip:"打开「文件 > 改动」",detached:"游离",openPr:"打开 Pull Request",prStatusOpen:"已打开",prStatusClosed:"已关闭",prStatusMerged:"已合并",prStatusDraft:"草稿",prStatusUnknown:"未知",options:"选项",copySessionId:"复制 Session ID",renameSession:"重命名",forkSession:"分叉会话",archiveSession:"归档",exportSession:"导出会话"},az={title:"Side chat",subtitle:"forked from this session",empty:"Ask a quick question on the side — it shares this session’s context.",placeholder:"Ask the side chat…",send:"Send"},cz={title:"侧边聊天",subtitle:"从当前会话 fork",empty:"在侧边随手问一句 —— 它共享当前会话的上下文。",placeholder:"问问侧边聊天…",send:"发送"},uz={en:{common:rW,app:lW,sidebar:aW,workspace:cW,conversation:uW,status:dW,composer:fW,login:hW,providers:pW,model:mW,sessions:gW,approval:vW,question:yW,tasks:kW,thinking:bW,diff:xW,fileTree:wW,filePreview:_W,mention:SW,warnings:CW,commands:AW,tools:MW,layout:EW,mobile:TW,theme:NW,onboarding:nz,settings:sz,header:rz,sideChat:az},zh:{common:IW,app:LW,sidebar:$W,workspace:FW,conversation:OW,status:BW,composer:RW,login:DW,providers:PW,model:HW,sessions:WW,approval:zW,question:UW,tasks:qW,thinking:jW,diff:VW,fileTree:KW,filePreview:GW,mention:YW,warnings:ZW,commands:XW,tools:QW,layout:JW,mobile:ez,theme:tz,onboarding:oz,settings:iz,header:lz,sideChat:cz}},b6=[{code:"en",label:"English"},{code:"zh",label:"中文"}];function dz(){const e=yo(Dt.locale);return e==="en"||e==="zh"?e:globalThis.navigator?.language?.toLowerCase().startsWith("zh")?"zh":"en"}const Rn=nF({legacy:!1,locale:dz(),fallbackLocale:"en",messages:uz});function x6(e){Rn.global.locale.value=e,Eo(Dt.locale,e)}const is=Rn.global.t,fz={read:"tools.label.read",bash:"tools.label.bash",edit:"tools.label.edit",multi_edit:"tools.label.edit",write:"tools.label.write",grep:"tools.label.grep",glob:"tools.label.glob",ls:"tools.label.ls",web_fetch:"tools.label.web_fetch",search:"tools.label.search",todo:"tools.label.todo",task:"tools.label.task",agentswarm:"tools.label.swarm",askuserquestion:"tools.label.ask_user",creategoal:"tools.label.goal_create",getgoal:"tools.label.goal_get",setgoalbudget:"tools.label.goal_budget",updategoal:"tools.label.goal_update"},hz={multiedit:"multi_edit",multiedits:"multi_edit",shell:"bash",run:"bash",exec:"bash",ripgrep:"grep",rg:"grep",find:"glob",fetch:"web_fetch",webfetch:"web_fetch",url_fetch:"web_fetch",urlfetch:"web_fetch",list:"ls",listdir:"ls",list_dir:"ls",todowrite:"todo",todo_write:"todo",todoread:"todo",todolist:"todo",todo_list:"todo",agent:"task",subagent:"task",websearch:"search",web_search:"search",create_goal:"creategoal",get_goal:"getgoal",set_goal_budget:"setgoalbudget",update_goal:"updategoal"};function Ja(e){const t=(e??"").trim().toLowerCase().replace(/[\s-]+/g,"_");return hz[t]??t}function ec(e){const t=fz[Ja(e)];return t?is(t):e}const pz={read:"file-text",bash:"terminal",edit:"pencil",multi_edit:"pencil",write:"file-plus",grep:"search",search:"search",glob:"glob",ls:"folder",web_fetch:"globe",todo:"check-list",task:"sparkles",agentswarm:"git-pull-request",askuserquestion:"help-circle",creategoal:"target",getgoal:"target",setgoalbudget:"target",updategoal:"target",croncreate:"calendar-schedule",cronlist:"calendar-todo",crondelete:"calendar-close"};function I1(e){const t=Ja(e);let n=pz[t];return!n&&(e??"").trim().toLowerCase().includes("skill")&&(n="bolt"),n||(n="tool"),Dc(n,"sm")}const w6=80;function mz(e,t=w6){const n=e.trim();return n.length>t?n.slice(0,t-1)+"…":n}function gz(e,t){const n=e.trim();return!!(n===""||n==="{}"||n==="[]"||n==="null"||t&&Object.keys(t).length===0)}function vz(e){const t=e.trim();if(!t.startsWith("{"))return null;try{const n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function rn(e){return typeof e=="string"&&e.length>0?e:void 0}function yl(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function yz(e){try{const t=new URL(e),n=t.pathname.split("/").filter(Boolean)[0];return n?`${t.host}/${n}`:t.host}catch{return e.replace(/^https?:\/\//,"")}}function Sg(e){return rn(e.path)??rn(e.file_path)??rn(e.filePath)??rn(e.filename)}const kz={active:"status.goalStatusActive",blocked:"status.goalStatusBlocked",complete:"status.goalStatusComplete"};function bz(e){const t=rn(e);if(!t)return;const n=kz[t];return n?is(n):t}function xz(e){const t=yl(e.value),n=rn(e.unit);if(!(t===void 0||!n))switch(n){case"turns":return is("tools.goal.turns",{value:t});case"tokens":return is("tools.goal.tokens",{value:t});case"milliseconds":return is("tools.goal.milliseconds",{value:t});case"seconds":return is("tools.goal.seconds",{value:t});case"minutes":return is("tools.goal.minutes",{value:t});case"hours":return is("tools.goal.hours",{value:t});default:return is("tools.goal.budget",{value:t,unit:n})}}const wz=64;function pf(e,t,n=!1){const o=(s,i=w6)=>n?s.trim():mz(s,i);try{const s=vz(t);if(!n&&gz(t,s))return"";const i=()=>o(t.replace(/^·\s*/,""));if(!s)return i();switch(Ja(e)){case"read":{const r=Sg(s);if(!r)return i();const l=yl(s.offset)??yl(s.line_start)??yl(s.start_line),a=yl(s.limit)??yl(s.length),c=yl(s.line_end)??yl(s.end_line)??(l!==void 0&&a!==void 0?l+a:void 0);return o(l!==void 0&&c!==void 0?`${r}:${l}-${c}`:l!==void 0?`${r}:${l}`:r)}case"write":{const r=Sg(s);return r?o(`${r} ${is("tools.chip.created")}`):i()}case"edit":case"multi_edit":{const r=Sg(s);return r?o(r):i()}case"bash":{const r=rn(s.command)??rn(s.cmd)??rn(s.script);return r?o(r,wz):i()}case"grep":case"search":{const r=rn(s.pattern)??rn(s.query)??rn(s.regex),l=rn(s.path)??rn(s.glob)??rn(s.include);return r&&l?o(`${r} in ${l}`):r?o(r):i()}case"glob":{const r=rn(s.pattern)??rn(s.glob)??rn(s.query),l=rn(s.path)??rn(s.cwd);return r&&l?o(`${r} in ${l}`):r?o(r):rn(s.path)?o(rn(s.path)):i()}case"ls":{const r=rn(s.path)??rn(s.dir)??rn(s.directory)??rn(s.cwd);return r?o(r):i()}case"web_fetch":{const r=rn(s.url)??rn(s.uri);return r?o(yz(r)):i()}case"todo":case"task":{const r=rn(s.description)??rn(s.title)??rn(s.prompt)??rn(s.name)??rn(s.subagent_type);if(r)return o(r);const l=Array.isArray(s.todos)?s.todos:Array.isArray(s.items)?s.items:void 0;return l?o(is("tools.chip.todos",{count:l.length})):i()}case"creategoal":{if(n)return i();const r=rn(s.objective),l=rn(s.completionCriterion);return r&&l?o(is("tools.goal.objectiveWithCriterion",{objective:r,criterion:l})):r?o(r):i()}case"getgoal":return n?i():"";case"setgoalbudget":{if(n)return i();const r=xz(s);return r?o(r):i()}case"updategoal":{if(n)return i();const r=bz(s.status);return r?o(is("tools.goal.status",{status:r})):i()}default:return i()}}catch{return t}}function _z(e){try{switch(Ja(e.name)){case"bash":return e.timing?e.timing:"";case"read":{if(e.output&&e.output.length>0){const t=e.output.length;return is("tools.chip.lines",{count:t})}return""}case"edit":case"multi_edit":case"write":{if(e.output){for(const n of e.output){const o=n.match(/\+(\d+).*[-−](\d+)/);if(o)return`+${o[1]} −${o[2]}`}const t=e.output.find(n=>/\d+/.test(n));if(t){const n=t.match(/\+(\d+)/),o=t.match(/[-−](\d+)/);if(n||o)return`${n?`+${n[1]}`:""} ${o?`−${o[1]}`:""}`.trim()}if(e.status!=="error")return is("tools.chip.edited")}return""}case"grep":case"search":return e.output&&e.output.length>0?is("tools.chip.results",{count:e.output.length}):"";default:return""}}catch{return""}}const Sz=Je({__name:"StatusDot",props:{status:{}},setup(e){const t=e;function n(s){switch(s){case"ok":case"done":case"completed":case"success":return"ok";case"error":case"failed":case"danger":return"error";case"running":case"working":case"in_progress":case"active":return"running";case"suspended":return"suspended";default:return"idle"}}const o=D(()=>n(t.status));return(s,i)=>(x(),E("span",{class:Ue(["kw-dot",`kw-dot--${o.value}`]),"aria-hidden":"true"},null,2))}}),mf=dt(Sz,[["__scopeId","data-v-e36198e5"]]),Cz=["innerHTML"],Az={class:"bh-text"},Mz={class:"a"},Ez={key:0,class:"p"},Tz={class:"rt"},Nz=["aria-label"],Iz={key:0,class:"tm"},Lz=["inert"],$z={class:"bb-pad"},Fz=Je({__name:"ToolRow",props:{status:{},icon:{default:""},name:{},arg:{default:""},time:{default:""},open:{type:Boolean,default:!1},expandable:{type:Boolean,default:!1},stacked:{type:Boolean,default:!1},stackPosition:{default:"single"}},emits:["toggle"],setup(e,{emit:t}){const n=t,o=Jt("pinScroll",()=>{}),s=oe(null);function i(){n("toggle");const r=s.value;r&&yt(()=>o(r))}return(r,l)=>(x(),E("div",{class:Ue(["box",{open:e.open,stacked:e.stacked,err:e.status==="error","stack-first":e.stackPosition==="first","stack-middle":e.stackPosition==="middle","stack-last":e.stackPosition==="last"}])},[w("div",{class:"bh",ref_key:"bhEl",ref:s,onClick:i},[e.icon?(x(),E("span",{key:0,class:"gl",innerHTML:e.icon,"aria-hidden":"true"},null,8,Cz)):ue("",!0),w("span",Az,[w("span",Mz,R(e.name),1),ae(an,{text:e.arg},{default:Ie(()=>[e.arg?(x(),E("span",Ez,R(e.arg),1)):ue("",!0)]),_:1},8,["text"])]),w("span",Tz,[w("span",{class:Ue(["status",e.status]),role:"status","aria-label":e.status},[e.status==="ok"?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):e.status==="error"?(x(),Se(Ge,{key:1,name:"close",size:"sm"})):e.status==="suspended"?(x(),Se(mf,{key:2,status:"suspended"})):(x(),Se(mf,{key:3,status:"running"}))],10,Nz),jn(r.$slots,"trailing"),e.time?(x(),E("span",Iz,R(e.time),1)):ue("",!0)]),e.expandable?(x(),Se(Ge,{key:1,class:"car",name:e.open?"chevron-down":"chevron-right",size:"sm"},null,8,["name"])):ue("",!0)],512),w("div",{class:Ue(["bb",{open:e.open}]),inert:!e.open},[w("div",$z,[jn(r.$slots,"default")])],10,Lz)],2))}}),L1=dt(Fz,[["__scopeId","data-v-fef8aad2"]]),Oz={key:0,class:"at-type"},Bz={key:1,class:"at-task"},Rz={key:2,class:"bb-code"},Dz=Je({__name:"AgentTool",props:{tool:{},mobile:{type:Boolean,default:!1},stackPosition:{default:"single"},toolDiffPanel:{type:Boolean,default:!1}},emits:["openMedia","openFile","openToolDiff","openAgent"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t;function i(k){if(!k)return{};try{const g=JSON.parse(k);return{description:typeof g.description=="string"?g.description:void 0,subagentType:typeof g.subagent_type=="string"?g.subagent_type:void 0,prompt:typeof g.prompt=="string"?g.prompt:void 0}}catch{return{}}}const r=D(()=>i(o.tool.arg)),l=D(()=>!!o.tool.output&&o.tool.output.length>0),a=D(()=>!!r.value.prompt||!!r.value.subagentType||l.value),c=oe(o.tool.defaultExpanded===!0&&a.value),u=D(()=>o.tool.status),d=D(()=>ec(o.tool.name)),f=D(()=>I1(o.tool.name)),h=D(()=>r.value.description||r.value.subagentType||""),p=Jt("resolveAgentTaskId"),m=D(()=>p?p(o.tool.id)!==void 0:!0);function y(){a.value&&(c.value=!c.value)}return et(()=>[o.tool.defaultExpanded,o.tool.output?.length,o.tool.status],()=>{o.tool.defaultExpanded===!0&&a.value&&(c.value=!0)}),(k,g)=>(x(),Se(L1,{status:u.value,icon:f.value,name:d.value,arg:c.value?"":h.value,time:e.tool.timing,open:c.value,expandable:a.value,stacked:e.stackPosition!=="single","stack-position":e.stackPosition,onToggle:y},{trailing:Ie(()=>[m.value?(x(),E("button",{key:0,type:"button",class:"at-open",onClick:g[0]||(g[0]=St(v=>s("openAgent",e.tool.id),["stop"]))},R(C(n)("tasks.openDetail")),1)):ue("",!0)]),default:Ie(()=>[r.value.subagentType?(x(),E("div",Oz,R(r.value.subagentType),1)):ue("",!0),r.value.prompt?(x(),E("div",Bz,R(r.value.prompt),1)):ue("",!0),l.value?(x(),E("div",Rz,[(x(!0),E(We,null,rt(e.tool.output??[],(v,b)=>(x(),E("div",{key:b},R(v),1))),128))])):ue("",!0)]),_:1},8,["status","icon","name","arg","time","open","expandable","stacked","stack-position"]))}}),Pz=dt(Dz,[["__scopeId","data-v-14ef8750"]]);function Hz(e){if(!e)return[];try{const n=JSON.parse(e).questions;if(!Array.isArray(n))return[];const o=[];for(const s of n){if(!s||typeof s!="object")continue;const i=s,r=Array.isArray(i.options)?i.options.map(l=>{const a=l&&typeof l=="object"?l:{};return{label:typeof a.label=="string"?a.label:"",description:typeof a.description=="string"?a.description:""}}):[];o.push({question:typeof i.question=="string"?i.question:"",header:typeof i.header=="string"?i.header:"",options:r,multiSelect:i.multi_select===!0})}return o}catch{return[]}}const Uh={recognized:!1,answers:{},note:""};function Wz(e){const t=e?.[0];if(!t)return Uh;let n;try{n=JSON.parse(t)}catch{return Uh}if(!n||typeof n!="object"||Array.isArray(n))return Uh;const o=n.answers;if(!o||typeof o!="object"||Array.isArray(o))return Uh;const s={};for(const[i,r]of Object.entries(o))typeof r=="string"?s[i]=r:r===!0&&(s[i]=!0);return{recognized:!0,answers:s,note:typeof n.note=="string"?n.note:""}}function zz(e,t,n){return e[t]??e[`q_${n}`]}const Uz=/^opt_\d+_(\d+)$/;function qz(e,t=[]){if(e===void 0)return{selected:new Set,otherText:"",indeterminate:!1};if(e===!0)return{selected:new Set,otherText:"",indeterminate:!0};const n=new Map;t.forEach((r,l)=>{r.label.length>0&&!n.has(r.label)&&n.set(r.label,l)});const o=n.get(e);if(o!==void 0)return{selected:new Set([o]),otherText:"",indeterminate:!1};const s=new Set,i=[];for(const r of e.split(",")){const l=r.trim(),a=n.get(l);if(a!==void 0){s.add(a);continue}const c=Uz.exec(l);c?s.add(Number(c[1])):l.length>0&&i.push(l)}return{selected:s,otherText:i.join(", "),indeterminate:!1}}const jz={key:0,class:"chip"},Vz={key:0,class:"au-dismissed"},Kz={key:1,class:"au-list"},Gz={class:"au-q"},Yz={key:0,class:"au-hdr"},Zz={class:"au-qtext"},Xz={class:"au-opts"},Qz={class:"au-glyph"},Jz={class:"au-label"},eU={key:0,class:"au-desc"},tU={key:0,class:"au-opt sel"},nU={class:"au-glyph"},oU={class:"au-label"},sU={key:1,class:"au-opt sel"},iU={class:"au-label"},rU={key:2,class:"au-raw"},lU=80,aU=Je({__name:"AskUserTool",props:{tool:{},mobile:{type:Boolean,default:!1},stackPosition:{default:"single"},toolDiffPanel:{type:Boolean,default:!1}},emits:["openMedia","openFile","openToolDiff"],setup(e){const t=e,{t:n}=$t();function o(N,M=lU){const $=N.trim();return $.length>M?$.slice(0,M-1)+"…":$}const s=D(()=>Hz(t.tool.arg)),i=D(()=>Wz(t.tool.output)),r=D(()=>i.value.recognized),l=D(()=>r.value&&Object.keys(i.value.answers).length===0&&i.value.note.length>0),a=D(()=>s.value.map((N,M)=>qz(zz(i.value.answers,N.question,M),N.options))),c=D(()=>Object.keys(i.value.answers).length);function u(N,M){return a.value[N]?.selected.has(M)??!1}function d(N){return a.value[N]?.otherText??""}function f(N){return a.value[N]?.indeterminate??!1}function h(N,M){return N?M?"■":"□":M?"●":"○"}const p=D(()=>{if(!r.value)return o(t.tool.output?.[0]??"");if(l.value)return n("tools.ask.dismissed");const N=s.value[0]?.question??"",M=o(N);return s.value.length<=1?M:`${M} ${n("tools.ask.more",{count:s.value.length-1})}`}),m=D(()=>r.value?l.value?n("tools.ask.dismissed"):c.value===0?"":c.value===1?n("tools.ask.answer",{count:1}):n("tools.ask.answers",{count:c.value}):""),y=D(()=>!!t.tool.output&&t.tool.output.length>0),k=D(()=>r.value&&(s.value.length>0||l.value)||y.value),g=oe(t.tool.defaultExpanded===!0&&k.value),v=D(()=>t.tool.status),b=D(()=>ec(t.tool.name)),A=D(()=>I1(t.tool.name));function I(){k.value&&(g.value=!g.value)}return et(()=>[t.tool.defaultExpanded,t.tool.output?.length,t.tool.status],()=>{t.tool.defaultExpanded===!0&&k.value&&(g.value=!0)}),(N,M)=>(x(),Se(L1,{status:v.value,icon:A.value,name:b.value,arg:g.value?"":p.value,time:e.tool.timing,open:g.value,expandable:k.value,stacked:e.stackPosition!=="single","stack-position":e.stackPosition,onToggle:I},{trailing:Ie(()=>[m.value?(x(),E("span",jz,R(m.value),1)):ue("",!0)]),default:Ie(()=>[l.value?(x(),E("div",Vz,R(i.value.note),1)):r.value?(x(),E("div",Kz,[(x(!0),E(We,null,rt(s.value,($,T)=>(x(),E("div",{key:T,class:"au-block"},[w("div",Gz,[$.header?(x(),E("span",Yz,R($.header),1)):ue("",!0),w("span",Zz,R($.question),1)]),w("div",Xz,[(x(!0),E(We,null,rt($.options,(F,S)=>(x(),E("div",{key:S,class:Ue(["au-opt",{sel:u(T,S)}])},[w("span",Qz,R(h($.multiSelect,u(T,S))),1),w("span",Jz,R(F.label),1),F.description?(x(),E("span",eU,R(F.description),1)):ue("",!0)],2))),128)),d(T)?(x(),E("div",tU,[w("span",nU,R(h($.multiSelect,!0)),1),w("span",oU,R(d(T)),1)])):ue("",!0),f(T)?(x(),E("div",sU,[M[0]||(M[0]=w("span",{class:"au-glyph"},"●",-1)),w("span",iU,R(C(n)("tools.ask.answered")),1)])):ue("",!0)])]))),128))])):(x(),E("div",rU,[(x(!0),E(We,null,rt(e.tool.output??[],($,T)=>(x(),E("div",{key:T},R($),1))),128))]))]),_:1},8,["status","icon","name","arg","time","open","expandable","stacked","stack-position"]))}}),cU=dt(aU,[["__scopeId","data-v-a9a0f259"]]),uU=1e6,W_=5e3;function z_(e){if(e==="")return[];const t=e.split(`
68
68
  `);return t.at(-1)===""&&t.pop(),t}function dU(e,t){const n=z_(e),o=z_(t),s=n.length,i=o.length;if(s===0&&i===0)return[];if(s>W_||i>W_||(s+1)*(i+1)>uU)return null;const r=Array.from({length:s+1},()=>Array.from({length:i+1},()=>0));for(let h=1;h<=s;h++)for(let p=1;p<=i;p++)r[h][p]=n[h-1]===o[p-1]?r[h-1][p-1]+1:Math.max(r[h-1][p],r[h][p-1]);const l=[];let a=s,c=i;for(;a>0||c>0;)a>0&&c>0&&n[a-1]===o[c-1]?(l.push({type:"context",text:n[a-1]}),a--,c--):c>0&&(a===0||r[a][c-1]>=r[a-1][c])?(l.push({type:"add",text:o[c-1]}),c--):(l.push({type:"del",text:n[a-1]}),a--);l.reverse();const u=[];let d=1,f=1;for(const h of l)h.type==="context"?(u.push({type:"context",text:h.text,oldNo:d,newNo:f}),d++,f++):h.type==="add"?(u.push({type:"add",text:h.text,newNo:f}),f++):(u.push({type:"del",text:h.text,oldNo:d}),d++);return u}function fU(e){let t=0,n=0;for(const o of e)o.type==="add"?t++:o.type==="del"&&n++;return{added:t,removed:n}}function _6(e){const t=e.trim();if(!t.startsWith("{"))return null;try{const n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function S6(e){const t=Ja(e.name);if(t!=="edit"&&t!=="write")return null;const n=_6(e.arg);if(!n)return null;if(t==="edit"){if(n.replace_all===!0)return null;const o=typeof n.old_string=="string"?n.old_string:void 0,s=typeof n.new_string=="string"?n.new_string:void 0;return o===void 0||s===void 0?null:dU(o,s)}return null}function hU(e){const t=_6(e);return t&&typeof t.path=="string"?t.path:void 0}function pU(e,t){for(const n of e){const o=n.tools?.find(s=>s.id===t);if(o)return o}}const mU={key:0,class:"bb-empty"},U_=50,gU=Je({__name:"ToolOutputBlock",props:{lines:{},emptyText:{}},setup(e){const t=e,n=D(()=>t.lines??[]),o=D(()=>n.value.length>U_),s={"--tool-output-visible-lines":String(U_)};return(i,r)=>(x(),E("div",{class:Ue(["bb-code tool-output-block",{scroll:o.value}]),style:s},[n.value.length===0&&e.emptyText?(x(),E("div",mU,R(e.emptyText),1)):ue("",!0),(x(!0),E(We,null,rt(n.value,(l,a)=>(x(),E("div",{key:a},R(l),1))),128))],2))}}),C6=dt(gU,[["__scopeId","data-v-262bbea0"]]),vU={key:0,class:"chip"},yU={key:0,class:"bb-summary"},kU=Je({__name:"EditTool",props:{tool:{},mobile:{type:Boolean,default:!1},stackPosition:{default:"single"},toolDiffPanel:{type:Boolean,default:!1}},emits:["openMedia","openFile","openToolDiff"],setup(e,{emit:t}){const n=e,o=t,s=D(()=>n.tool.status),i=D(()=>ec(n.tool.name)),r=D(()=>I1(n.tool.name)),l=D(()=>pf(n.tool.name,n.tool.arg)),a=D(()=>pf(n.tool.name,n.tool.arg,!0)),c=D(()=>S6(n.tool)),u=D(()=>{const m=c.value;if(m&&n.tool.status!=="error"){const{added:y,removed:k}=fU(m);if(y||k)return`+${y} −${k}`}return""}),d=D(()=>!!n.tool.output&&n.tool.output.length>0),f=oe(!1),h=D(()=>d.value&&!n.toolDiffPanel);function p(){if(n.toolDiffPanel){o("openToolDiff",n.tool.id);return}d.value&&(f.value=!f.value)}return(m,y)=>(x(),Se(L1,{status:s.value,icon:r.value,name:i.value,arg:f.value?"":l.value,time:e.tool.timing,open:f.value,expandable:h.value||e.toolDiffPanel,stacked:e.stackPosition!=="single","stack-position":e.stackPosition,onToggle:p},{trailing:Ie(()=>[u.value?(x(),E("span",vU,R(u.value),1)):ue("",!0)]),default:Ie(()=>[a.value?(x(),E("div",yU,R(a.value),1)):ue("",!0),ae(C6,{lines:e.tool.output,"empty-text":"Waiting for output…"},null,8,["lines"])]),_:1},8,["status","icon","name","arg","time","open","expandable","stacked","stack-position"]))}}),bU=dt(kU,[["__scopeId","data-v-74e1da99"]]),xU={key:0,class:"chip"},wU={key:0,class:"bb-summary"},_U=Je({__name:"GenericTool",props:{tool:{},mobile:{type:Boolean,default:!1},stackPosition:{default:"single"},toolDiffPanel:{type:Boolean,default:!1}},emits:["openMedia","openFile","openToolDiff"],setup(e){const t=e,n=D(()=>t.tool.status==="running"&&/^bash$/i.test(t.tool.name)),o=D(()=>!!t.tool.output&&t.tool.output.length>0),s=D(()=>o.value||n.value),i=oe(t.tool.defaultExpanded===!0&&s.value),r=D(()=>t.tool.status),l=D(()=>ec(t.tool.name)),a=D(()=>I1(t.tool.name)),c=D(()=>pf(t.tool.name,t.tool.arg)),u=D(()=>pf(t.tool.name,t.tool.arg,!0)),d=D(()=>_z({name:t.tool.name,arg:t.tool.arg,output:t.tool.output,timing:t.tool.timing,status:t.tool.status}));function f(){s.value&&(i.value=!i.value)}return et(()=>[t.tool.defaultExpanded,t.tool.output?.length,t.tool.status,t.tool.name],()=>{t.tool.defaultExpanded===!0&&s.value&&(i.value=!0)}),(h,p)=>(x(),Se(L1,{status:r.value,icon:a.value,name:l.value,arg:i.value?"":c.value,time:e.tool.name!=="bash"?e.tool.timing:"",open:i.value,expandable:s.value,stacked:e.stackPosition!=="single","stack-position":e.stackPosition,onToggle:f},{trailing:Ie(()=>[d.value?(x(),E("span",xU,R(d.value),1)):ue("",!0)]),default:Ie(()=>[u.value?(x(),E("div",wU,R(u.value),1)):ue("",!0),ae(C6,{lines:e.tool.output,"empty-text":"Waiting for output…"},null,8,["lines"])]),_:1},8,["status","icon","name","arg","time","open","expandable","stacked","stack-position"]))}}),SU=dt(_U,[["__scopeId","data-v-aa4edcb0"]]),CU={class:"media-title"},AU=["src","alt"],MU=["src"],EU=["src"],TU=Je({__name:"MediaTool",props:{tool:{},mobile:{type:Boolean,default:!1}},emits:["openMedia"],setup(e,{emit:t}){const n=e,o=t,s=D(()=>n.tool.status==="ok"?n.tool.media:void 0);function i(c){return c.split(/[\\/]+/).pop()||c}function r(c){return c<1024?`${c} B`:c<1024*1024?`${(c/1024).toFixed(1)} KB`:`${(c/1024/1024).toFixed(1)} MB`}const l=D(()=>{const c=s.value;if(!c)return"";const u=[c.path?i(c.path):n.tool.name];return c.mimeType&&u.push(c.mimeType),c.bytes!==void 0&&u.push(r(c.bytes)),c.dimensions&&u.push(c.dimensions),u.join(" · ")});function a(){const c=s.value;c?.kind==="image"&&o("openMedia",c)}return(c,u)=>s.value?(x(),E("div",{key:0,class:Ue(["media-tool",{mob:e.mobile}])},[ae(an,{text:s.value.path||l.value},{default:Ie(()=>[w("div",CU,R(l.value),1)]),_:1},8,["text"]),s.value.kind==="image"?(x(),Se(an,{key:0,text:s.value.path||l.value},{default:Ie(()=>[w("button",{type:"button",class:"media-image-button",onClick:a},[w("img",{class:"media-image",src:s.value.url,alt:s.value.path?i(s.value.path):l.value,loading:"lazy"},null,8,AU)])]),_:1},8,["text"])):s.value.kind==="video"?(x(),E("video",{key:1,class:"media-video",src:s.value.url,controls:"",preload:"metadata"},null,8,MU)):(x(),E("audio",{key:2,class:"media-audio",src:s.value.url,controls:""},null,8,EU))],2)):ue("",!0)}}),NU=dt(TU,[["__scopeId","data-v-c05c114a"]]),IU=/<summary>([\s\S]*?)<\/summary>/,LU=/<resume_hint>([\s\S]*?)<\/resume_hint>/,Cg=/<subagent\b([^>]*)>|<\/subagent>/g,$U="</subagent>",q_=/(completed|failed|aborted):\s*(\d+)/g,j_=/([a-z_]+)="([^"]*)"/g;function FU(e){return e.replaceAll("&quot;",'"').replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function OU(e){const t={};j_.lastIndex=0;let n;for(;(n=j_.exec(e))!==null;)t[n[1]]=FU(n[2]);return t}function BU(e){const t={completed:0,failed:0,aborted:0};q_.lastIndex=0;let n;for(;(n=q_.exec(e))!==null;){const o=n[1];t[o]=Number(n[2])}return t}function RU(e,t){const n=OU(e);return{outcome:n.outcome??"completed",item:n.item,agentId:n.agent_id,mode:n.mode,state:n.state,body:t.trim()}}function DU(e){const t=[],n=[];Cg.lastIndex=0;let o;for(;(o=Cg.exec(e))!==null;)if(o[0]===$U){if(n.length===0)continue;const s=n.pop();s&&n.length===0&&t.push(RU(s.attrs,e.slice(s.bodyStart,o.index)))}else n.length===0?n.push({attrs:o[1]??"",bodyStart:Cg.lastIndex}):n.push(null);return t}function PU(e){if(e==null)return null;const t=Array.isArray(e)?e.join(`
69
69
  `):e;if(!t.includes("<agent_swarm_result>"))return null;const n=IU.exec(t)?.[1]?.trim()??"",{completed:o,failed:s,aborted:i}=BU(n),r=LU.exec(t)?.[1]?.trim(),l=DU(t),a=o+s+i;return{summary:n,completed:o,failed:s,aborted:i,total:a>0?a:l.length,subagents:l,resumeHint:r}}function V_(e){return e?e.split(`
70
70
  `).map(t=>t.trimEnd()).filter(Boolean).at(-1)??"":""}function HU(e){return e.suspendedReason||V_(e.text)||V_(e.outputLines?.join(`
@@ -282,11 +282,11 @@ ${v}`);u+=N}else u+=I;u+=k,d=h?f+1:e.length}return u}function vee(e,t){if(!e||!t
282
282
  <button class="copy-button" data-code="${v}">${N}</button>
283
283
  </div>
284
284
  <div class="code-editor"></div>
285
- </div>`};const c=/^\[(\d+)\]/,u=/^\[([^\]\n]+)\]/,d=p=>{if(!p.startsWith("["))return!1;const m=u.exec(p);if(!m)return p!=="["&&!/^\[\d+$/.test(p);const y=String(m[1]??"");return p.slice(m[0].length).startsWith("(")?!1:!/^\d+$/.test(y)},f=(p,m)=>{const y=p;if(y.src[y.pos]!=="[")return!1;const k=c.exec(y.src.slice(y.pos));if(!k)return!1;const g=y.src.slice(Math.max(0,y.pos-120),y.pos);if(/"[^"\n]{1,80}"\s*:\s*$/.test(g))return!1;const v=y.src.slice(y.pos+k[0].length);if(v.startsWith("](")||v.startsWith("(")||d(v))return!1;if(!m){const b=k[1],A=y.push("reference","span",0);A.content=b,A.markup=k[0],A.raw=k[0]}return y.pos+=k[0].length,!0};n.inline.ruler.before("escape","reference",f),n.renderer.rules.reference=(p,m)=>{const k=String(p[m].content??"");return`<span class="reference-link" data-reference-id="${k}" role="button" tabindex="0" title="Click to view reference">${k}</span>`};const h=n.use.bind(n);return n.use=((...p)=>(o.__markstreamHasCustomParserExtensions=!0,h(...p))),n}function Vee({nextContent:e,previousContent:t,typewriterEnabled:n}){return n?e===t?{settledContent:e,streamedDelta:"",appended:!1}:t&&e.startsWith(t)&&e.length>t.length?{settledContent:t,streamedDelta:e.slice(t.length),appended:!0}:{settledContent:e,streamedDelta:"",appended:!1}:{settledContent:e,streamedDelta:"",appended:!1}}function nE({nextContent:e,persistedContent:t,currentState:n,typewriterEnabled:o,streamRenderVersionChanged:s=!1}){const i=`${n.settledContent}${n.streamedDelta}`;return o?n.streamedDelta&&i===e?s?{settledContent:i,streamedDelta:"",appended:!1}:{settledContent:n.settledContent,streamedDelta:n.streamedDelta,appended:!1}:Vee({nextContent:e,previousContent:t??i,typewriterEnabled:o}):{settledContent:e,streamedDelta:"",appended:!1}}const Kee={plain:"plaintext",text:"plaintext",txt:"plaintext",js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",mts:"typescript",cts:"typescript",golang:"go",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",kts:"kotlin",md:"markdown",yml:"yaml",sh:"shellscript",bash:"shellscript",zsh:"shellscript",shell:"shellscript",shellscript:"shellscript",ps:"powershell",ps1:"powershell",pwsh:"powershell","c++":"cpp","c#":"csharp",cs:"csharp",objc:"objective-c",objectivec:"objective-c","objective-c":"objective-c",objectivecpp:"objective-cpp","objective-c++":"objective-cpp","objective-cpp":"objective-cpp"};function Gee(e){const t=String(e??"").trim();if(!t)return"";const[n=""]=t.split(/\s+/);return n.split(":")[0]?.trim().toLowerCase()??""}function oE(e){const t=Gee(e);return Kee[t]??t}function Yee(e){if(!Array.isArray(e))return;const t=e.filter(o=>typeof o=="string").map(o=>oE(o)).filter(Boolean),n=Array.from(new Set(t)).sort();return n.length>0?n:void 0}function Zee(e){if(!Array.isArray(e))return;const t=[],n=new Set;for(const o of e){if(typeof o!="string")continue;const s=o.trim();!s||n.has(s)||(n.add(s),t.push(s))}return t.length>0?t:void 0}function Xee(e){return Zee(e)?.join("\0")??""}function Qee(e,t){return`${Xee(e)}\0\0${Yee(t)?.join("\0")??""}`}function Ac(e,t,n=1){const o=Number(e);return Number.isFinite(o)?Math.max(n,o):t}function XC(e,t){const n=Number(e);return Number.isFinite(n)?Math.max(0,n):t}var Jee=class{constructor(e={},t){this.source="",this.visible="",this.done=!1,this.paused=!1,this.listeners=new Set,this.rafId=0,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.hasStarted=!1,this.destroyed=!1,this.getSnapshot=()=>({source:this.source,visible:this.visible,done:this.done,paused:this.paused,pendingChars:this.pendingChars,caughtUp:this.caughtUp,final:this.final}),this.subscribe=d=>this.destroyed?()=>{}:(this.listeners.add(d),()=>{this.listeners.delete(d)}),this.enqueue=d=>{if(this.destroyed||!d)return;this.done&&(this.done=!1);const f=this.source.length>0,h=this.pendingChars<=0;if(this.source+=d,h){const p=QC();this.startedAt=f&&this.hasStarted?p-this.normalizedStartDelayMs:p,this.lastTick=p,this.charBudget=0}this.hasStarted=!0,this.emit(),this.ensureLoop()},this.finish=(d={})=>{if(!this.destroyed){if(this.done=!0,d.flush??this.flushOnFinish){this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit();return}this.emit(),this.ensureLoop()}},this.flush=()=>{this.destroyed||(this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit())},this.reset=(d="")=>{this.destroyed||(this.cancelLoop(),this.source=d,this.visible=d,this.done=!1,this.paused=!1,this.hasStarted=!1,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit())},this.pause=()=>{this.destroyed||this.paused||(this.paused=!0,this.cancelLoop(),this.emit())},this.resume=()=>{if(this.destroyed||!this.paused)return;this.paused=!1;const d=QC();this.lastTick=d,this.startedAt||=d,this.emit(),this.ensureLoop()},this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.cancelLoop(),this.listeners.clear())},this.dispose=()=>{this.destroy()},this.tick=d=>{if(this.rafId=0,this.destroyed||this.paused)return;if(this.pendingChars<=0){this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond;return}if(d-this.startedAt<this.normalizedStartDelayMs){this.rafId=requestAnimationFrame(this.tick);return}const f=1e3/Math.max(1,this.maxCommitFps),h=Math.min(100,Math.max(0,d-this.lastTick));if(h<f){this.rafId=requestAnimationFrame(this.tick);return}this.lastTick=d;const p=this.pendingChars,m=p>this.normalizedCatchUpThreshold?this.normalizedCatchUpLatencyMs:this.normalizedTargetLatencyMs,y=ote(p/Math.max(.001,m/1e3),this.minCharsPerSecond,this.maxCharsPerSecond);if(this.currentCps+=(y-this.currentCps)*.2,this.charBudget+=this.currentCps*(h/1e3),this.charBudget<1){this.ensureLoop();return}const k=Math.min(Math.floor(this.charBudget),this.maxCharsPerCommit),g=nte(this.source.slice(this.visible.length),k,this.segmenter);g.text&&(this.visible+=g.text,this.charBudget=Math.max(0,this.charBudget-g.graphemeCount),this.emit()),this.ensureLoop()};const{minCharsPerSecond:n=40,maxCharsPerSecond:o=1e3,targetLatencyMs:s=900,catchUpLatencyMs:i=350,catchUpThreshold:r=600,maxCommitFps:l=30,startDelayMs:a=80,maxCharsPerCommit:c=80,flushOnFinish:u=!1}=e;this.minCharsPerSecond=Ac(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,Ac(o,1e3,1)),this.normalizedTargetLatencyMs=Ac(s,900,1),this.normalizedCatchUpLatencyMs=Ac(i,350,1),this.normalizedCatchUpThreshold=XC(r,600),this.normalizedStartDelayMs=XC(a,80),this.maxCommitFps=Math.trunc(Ac(l,30,1)),this.maxCharsPerCommit=Math.trunc(Ac(c,80,1)),this.flushOnFinish=u,this.segmenter=tte(),t&&this.listeners.add(t),this.currentCps=this.minCharsPerSecond}get pendingChars(){return Math.max(0,this.source.length-this.visible.length)}get caughtUp(){return this.pendingChars===0}get final(){return this.done&&this.caughtUp}ensureLoop(){if(!(this.destroyed||this.rafId||this.paused||this.pendingChars<=0)){if(typeof requestAnimationFrame!="function"){this.flush();return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),this.rafId=0)}emit(){if(!this.destroyed)for(const e of this.listeners)e()}};function ete(e={},t){const n=new Jee(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function tte(){if(typeof Intl>"u")return null;const e=Intl.Segmenter;return e?new e(void 0,{granularity:"grapheme"}):null}function nte(e,t,n){if(!e||t<=0)return{text:"",graphemeCount:0};if(!n){const i=Array.from(e).slice(0,t);return{text:i.join(""),graphemeCount:i.length}}let o="",s=0;for(const i of n.segment(e)){if(s>=t)break;o+=i.segment,s++}return{text:o,graphemeCount:s}}function QC(){return typeof performance<"u"?performance.now():Date.now()}function ote(e,t,n){return Math.min(n,Math.max(t,e))}var ste=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(c){s(c)}},r=a=>{try{l(n.throw(a))}catch(c){s(c)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const Hy=Symbol.for("markstream-vue:node-lifecycle");function e3e(){}const R2=new Map;let sE="material";const Kc=new Map,JC=new Map;let Wy=null;function ite(e){R2.set(e.id,e)}function rte(e){const t=R2.get(sE);if(!t)return;const n=t.core[e];if(n)return n;const o=Kc.get(t.id);if(o){const s=o[e];if(s)return s}t.loadExtended&&!Kc.has(t.id)&&ate(t)}function lte(){var e,t;return(t=(e=R2.get(sE))==null?void 0:e.fallback)!=null?t:""}function ate(e){return ste(this,null,function*(){var t,n,o;if(Kc.has(e.id))return(t=Kc.get(e.id))!=null?t:null;let s=JC.get(e.id);return s||(s=((o=(n=e.loadExtended)==null?void 0:n.call(e))!=null?o:Promise.resolve(null)).then(i=>(Kc.set(e.id,i),Wy?.(),i)).catch(()=>(Kc.set(e.id,null),null)),JC.set(e.id,s)),s})}const e4='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M30 14v-2h-2V8h-2v4h-2V8h-2v4h-2v2h2v2h-2v2h2v4h2v-4h2v4h2v-4h2v-2h-2v-2Zm-4 2h-2v-2h2Zm-12.437 6A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',t4='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',cte={id:"material",core:{"":t4,plain:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',text:t4,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ffca28" d="M2 2v12h12V2zm6 6h1v4a1.003 1.003 0 0 1-1 1H7a1.003 1.003 0 0 1-1-1v-1h1v1h1zm3 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',typescript:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 16 16"><path fill="#0288d1" d="M2 2v12h12V2zm4 6h3v1H8v4H7V9H6zm5 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00bcd4" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#00bcd4" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#00bcd4" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#00bcd4" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#0288d1" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#0288d1" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#0288d1" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#e65100" d="m4 4 2 22 10 2 10-2 2-22Zm19.72 7H11.28l.29 3h11.86l-.802 9.335L15.99 25l-6.635-1.646L8.93 19h3.02l.19 2 3.86.77 3.84-.77.29-4H8.84L8 8h16Z"/></svg>',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#7e57c2" d="M20 18h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 20 22h2v2h2v-2c0-.388-.562-.851-1.254-1.034C20.356 20.34 20 18.84 20 18m-3.254 2.966C14.356 20.34 14 18.84 14 18h-2v-2h-2v8h2v-2h4v2h2v-2c0-.388-.562-.851-1.254-1.034"/><path fill="#7e57c2" d="M24 4H4v20a4 4 0 0 0 4 4h16.16A3.84 3.84 0 0 0 28 24.16V8a4 4 0 0 0-4-4m2 14h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 26 22v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2Z"/></svg>',scss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ec407a" d="M27.837 5.673a4.33 4.33 0 0 0-2.293-2.701c-2.362-1.261-6.11-1.298-9.548-.092a26.3 26.3 0 0 0-8.76 4.966c-2.752 2.542-3.438 4.925-3.189 6.194.523 2.668 3.274 4.539 5.485 6.042.418.284.822.559 1.175.816-1.429.76-4.261 2.444-5.088 4.248a3.88 3.88 0 0 0-.118 3.332A2.37 2.37 0 0 0 6.869 29.8a5.6 5.6 0 0 0 1.49.2 6.35 6.35 0 0 0 5.19-2.856 6.74 6.74 0 0 0 .864-5.382 7.3 7.3 0 0 1 2.044-.03 3.92 3.92 0 0 1 2.816 1.311 1.82 1.82 0 0 1 .423 1.262 1.55 1.55 0 0 1-.772 1.05c-.234.14-.586.355-.504.803.036.194.198.633.894.512a2.93 2.93 0 0 0 2.145-2.651 4 4 0 0 0-1.197-2.904 5.94 5.94 0 0 0-4.396-1.626 10.6 10.6 0 0 0-2.672.304 20 20 0 0 0-2.203-1.846c-1.712-1.3-3.33-2.529-3.235-4.26.125-2.263 2.468-4.532 6.964-6.744 4.016-1.976 7.254-2.037 8.944-1.438a2 2 0 0 1 1.204.883 2.77 2.77 0 0 1-.36 2.47 9.71 9.71 0 0 1-7.425 4.304 3.86 3.86 0 0 1-3.238-.757c-.278-.302-.593-.645-1.074-.383q-.565.31-.225 1.189a3.9 3.9 0 0 0 2.407 1.92 11.7 11.7 0 0 0 7.128-.671c3.527-1.35 6.681-5.202 5.756-8.787M11.895 24.475a4 4 0 0 1-.192.468 4.5 4.5 0 0 1-.753 1.081 2.83 2.83 0 0 1-2.533 1.107c-.056-.032-.078-.146-.085-.193a3.28 3.28 0 0 1 1.076-2.284 11.3 11.3 0 0 1 2.644-1.933 3.85 3.85 0 0 1-.157 1.754"/></svg>',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="#f9a825" d="M560-160v-80h120q17 0 28.5-11.5T720-280v-80q0-38 22-69t58-44v-14q-36-13-58-44t-22-69v-80q0-17-11.5-28.5T680-720H560v-80h120q50 0 85 35t35 85v80q0 17 11.5 28.5T840-560h40v160h-40q-17 0-28.5 11.5T800-360v80q0 50-35 85t-85 35zm-280 0q-50 0-85-35t-35-85v-80q0-17-11.5-28.5T120-400H80v-160h40q17 0 28.5-11.5T160-600v-80q0-50 35-85t85-35h120v80H280q-17 0-28.5 11.5T240-680v80q0 38-22 69t-58 44v14q36 13 58 44t22 69v80q0 17 11.5 28.5T280-240h120v80z"/></svg>',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#0288d1" d="M9.86 2A2.86 2.86 0 0 0 7 4.86v1.68h4.29c.39 0 .71.57.71.96H4.86A2.86 2.86 0 0 0 2 10.36v3.781a2.86 2.86 0 0 0 2.86 2.86h1.18v-2.68a2.85 2.85 0 0 1 2.85-2.86h5.25c1.58 0 2.86-1.271 2.86-2.851V4.86A2.86 2.86 0 0 0 14.14 2zm-.72 1.61c.4 0 .72.12.72.71s-.32.891-.72.891c-.39 0-.71-.3-.71-.89s.32-.711.71-.711"/><path fill="#fdd835" d="M17.959 7v2.68a2.85 2.85 0 0 1-2.85 2.859H9.86A2.85 2.85 0 0 0 7 15.389v3.75a2.86 2.86 0 0 0 2.86 2.86h4.28A2.86 2.86 0 0 0 17 19.14v-1.68h-4.291c-.39 0-.709-.57-.709-.96h7.14A2.86 2.86 0 0 0 22 13.64V9.86A2.86 2.86 0 0 0 19.14 7zM8.32 11.513l-.004.004.038-.004zm6.54 7.276c.39 0 .71.3.71.89a.71.71 0 0 1-.71.71c-.4 0-.72-.12-.72-.71s.32-.89.72-.89"/></svg>',ruby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#f44336" d="M18.041 3.177c2.24.382 2.879 1.919 2.843 3.527V6.67l-1.013 13.266-13.132.897h.008c-1.093-.044-3.518-.151-3.634-3.545l1.217-2.222 2.462 5.74 2.097-6.77-.045.009.018-.018 6.85 2.186L13.945 9.3l6.53-.409-5.144-4.212 2.71-1.51v.009M3.113 17.252v.017zM6.916 6.874c2.63-2.622 6.033-4.168 7.34-2.844 1.297 1.306-.072 4.523-2.702 7.135-2.666 2.613-6.015 4.248-7.322 2.933-1.306-1.324.036-4.612 2.675-7.224z"/></svg>',go:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00acc1" d="M2 12h4v2H2zm-2 4h6v2H0zm4 4h2v2H4zm16.954-5H14v3h3.239a4.42 4.42 0 0 1-3.531 2 2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 15.292 13a2.73 2.73 0 0 1 1.749.584l2.962-1.185A5.6 5.6 0 0 0 15.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 6.4 6.4 0 0 0 .003-1.5"/><path fill="#00acc1" d="M26.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 5.614 5.614 0 0 0-5.659-6.5m2.681 6.137A4.515 4.515 0 0 1 24.708 20a2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 26.292 13a2.65 2.65 0 0 1 2.053.858 2.86 2.86 0 0 1 .628 2.28Z"/></svg>',java:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#f44336" d="M4 26h24v2H4zM28 4H7a1 1 0 0 0-1 1v13a4 4 0 0 0 4 4h10a4 4 0 0 0 4-4v-4h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2m0 8h-4V6h4Z"/></svg>',kotlin:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><defs><linearGradient id="a" x1="1.725" x2="22.185" y1="22.67" y2="1.982" gradientTransform="translate(1.306 1.129)scale(.89324)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7c4dff"/><stop offset=".5" stop-color="#d500f9"/><stop offset="1" stop-color="#ef5350"/></linearGradient></defs><path fill="url(#a)" d="M2.975 2.976v18.048h18.05v-.03l-4.478-4.511-4.48-4.515 4.48-4.515 4.443-4.477z"/></svg>',c:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M19.563 22A5.57 5.57 0 0 1 14 16.437v-2.873A5.57 5.57 0 0 1 19.563 8H24V2h-4.437A11.563 11.563 0 0 0 8 13.563v2.873A11.564 11.564 0 0 0 19.563 28H24v-6Z"/></svg>',cpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M28 14v-4h-2v4h-6v-4h-2v4h-4v2h4v4h2v-4h6v4h2v-4h4v-2z"/><path fill="#0288d1" d="M13.563 22A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',cs:e4,csharp:e4,php:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#1e88e5" d="M12 18.08c-6.63 0-12-2.72-12-6.08s5.37-6.08 12-6.08S24 8.64 24 12s-5.37 6.08-12 6.08m-5.19-7.95c.54 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.58 1.09q-.42.33-1.29.33h-.87l.53-2.76zm-3.5 5.55h1.44l.34-1.75h1.23c.54 0 .98-.06 1.33-.17.35-.12.67-.31.96-.58.24-.22.43-.46.58-.73.15-.26.26-.56.31-.88.16-.78.05-1.39-.33-1.82-.39-.44-.99-.65-1.82-.65H4.59zm7.25-8.33-1.28 6.58h1.42l.74-3.77h1.14c.36 0 .6.06.71.18s.13.34.07.66l-.57 2.93h1.45l.59-3.07c.13-.62.03-1.07-.27-1.36-.3-.27-.85-.4-1.65-.4h-1.27L12 7.35zM18 10.13c.55 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.57 1.09-.29.22-.72.33-1.3.33h-.85l.5-2.76zm-3.5 5.55h1.44l.34-1.75h1.22c.55 0 1-.06 1.35-.17.35-.12.65-.31.95-.58.24-.22.44-.46.58-.73.15-.26.26-.56.32-.88.15-.78.04-1.39-.34-1.82-.36-.44-.99-.65-1.82-.65h-2.75z"/></svg>',shell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',powershell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#03a9f4" d="M29.07 6H7.677A1.535 1.535 0 0 0 6.24 7.113l-4.2 17.774A.852.852 0 0 0 2.93 26h21.393a1.535 1.535 0 0 0 1.436-1.113L29.96 7.112A.852.852 0 0 0 29.07 6M8.626 23.797a1.4 1.4 0 0 1-1.814-.31l-.007-.009a1.075 1.075 0 0 1 .315-1.599l9.6-6.061-6.102-5.852-.01-.01a1.068 1.068 0 0 1 .084-1.625l.037-.03a1.38 1.38 0 0 1 1.8.07l7.233 6.957a1.1 1.1 0 0 1 .236.739 1.08 1.08 0 0 1-.412.79c-.074.04-.146.119-10.951 6.935ZM24 22.94A1.135 1.135 0 0 1 22.803 24h-5.634a1.061 1.061 0 1 1 .001-2.112h5.633A1.134 1.134 0 0 1 24 22.938Z"/></svg>',sql:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ffca28" d="M16 24c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-8c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-12C10.477 4 6 4.895 6 6v4c0 1.1 4.475 2 10 2s10-.9 10-2V6c0-1.105-4.477-2-10-2"/></svg>',yaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#ff5252" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12c0 1.1-.9 2-2 2H6c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2m12 16v-2H9v2zm-4-4v-2H6v2z"/></svg>',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>',xml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#8bc34a" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m.12 13.5 3.74 3.74 1.42-1.41-2.33-2.33 2.33-2.33-1.42-1.41zm11.16 0-3.74-3.74-1.42 1.41 2.33 2.33-2.33 2.33 1.42 1.41z"/></svg>',rust:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ff7043" d="m30 12-4-2V6h-4l-2-4-4 2-4-2-2 4H6v4l-4 2 2 4-2 4 4 2v4h4l2 4 4-2 4 2 2-4h4v-4l4-2-2-4ZM6 16a9.9 9.9 0 0 1 .842-4H10v8H6.842A9.9 9.9 0 0 1 6 16m10 10a9.98 9.98 0 0 1-7.978-4H16v-2h-2v-2h4c.819.819.297 2.308 1.179 3.37a1.89 1.89 0 0 0 1.46.63h3.34A9.98 9.98 0 0 1 16 26m-2-12v-2h4a1 1 0 0 1 0 2Zm11.158 6H24a2.006 2.006 0 0 1-2-2 2 2 0 0 0-2-2 3 3 0 0 0 3-3q0-.08-.004-.161A3.115 3.115 0 0 0 19.83 10H8.022a9.986 9.986 0 0 1 17.136 10"/></svg>',vue:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#41b883" d="M1.791 3.851 12 21.471 22.209 3.936V3.85H18.24l-6.18 10.616L5.906 3.851z"/><path fill="#35495e" d="m5.907 3.851 6.152 10.617L18.24 3.851h-3.723L12.084 8.03 9.66 3.85z"/></svg>',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>'},fallback:'<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',loadExtended:()=>vs(()=>import("./extended-p72mFE2C.js"),[]).then(e=>e.materialExtendedMap)},ute=gr(0);Wy=()=>{ute.value++},ite(cte);const dte={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",plaintext:"plain",text:"plain",txt:"plain","c++":"cpp","c#":"csharp",cs:"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function K1(e){var t;const n=(function(o){if(!o)return"";const s=o.trim();if(!s)return"";const[i]=s.split(/\s+/),[r]=i.split(":");return r.toLowerCase()})(e);return(t=dte[n])!=null?t:n}function t3e(e){const t=K1(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";case"objectivec":return"objective-c";case"objectivecpp":return"objective-cpp";default:return t}}function n3e(e){return rte(K1(e))||lte()}const n4={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",csharp:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"};var G1=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(c){s(c)}},r=a=>{try{l(n.throw(a))}catch(c){s(c)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});let gs=null,Na=!1,Ia=null,Y1=P2;function Vf(e){var t;const n=(t=e?.default)!=null?t:e;return n&&typeof n.renderToString=="function"?n:null}function D2(){try{const e=globalThis;return Vf(e?.katex)}catch{return null}}function P2(){return G1(null,null,function*(){const e=D2();if(e)return e;const t=yield vs(()=>import("./katex-DnlPpQZa.js"),[]);try{yield vs(()=>import("./mhchem-DtR62fUK.js"),__vite__mapDeps([2,3]))}catch{}return Vf(t)})}function iE(e){const t=Promise.resolve(e).then(n=>{var o;return Ia===t&&n?(gs=(o=Vf(n))!=null?o:n,gs):null}).catch(()=>null).finally(()=>{Ia===t&&(Ia=null)});return Ia=t,Na=!0,t}function fte(e){Y1=e,gs=null,Na=!1,Ia=null}function hte(e){fte(P2)}function rE(){return typeof Y1=="function"}function o3e(){var e;const t=Y1;if(!t||t===P2)return null;if(gs)return gs;const n=D2();if(n)return gs=n,gs;if(Na)return null;try{const o=t();return o?typeof o?.then=="function"?(iE(o),null):(gs=(e=Vf(o))!=null?e:o,gs):null}catch{return null}}function lE(){return G1(this,null,function*(){var e;const t=D2();if(t)return gs=t,gs;if(gs)return gs;if(Ia)return Ia;if(Na)return null;const n=Y1;if(!n)return Na=!0,null;try{const o=n();if(typeof o?.then=="function")return iE(o);if(o)return gs=(e=Vf(o))!=null?e:o,Na=!0,gs}catch{}return Na=!0,null})}function aE(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}let Tl=null,wl=null;const Yo=new Map,Ur=new Map;let Af=5;const Pa=new Set;function Vd(){if(Yo.size<Af&&Pa.size){let e=Af-Yo.size;for(const t of Array.from(Pa)){if(e<=0)break;Pa.delete(t),e--;try{t()}catch{}}}}function cE(){for(const e of Array.from(Pa)){Pa.delete(e);try{e()}catch{}}}function pte(e){Tl=e,wl=null,Tl.onmessage=t=>{const{id:n,html:o,error:s}=t.data,i=Yo.get(n);if(i)if(Yo.delete(n),clearTimeout(i.timeoutId),i.cleanup(),Vd(),s)i.aborted||i.reject(new Error(s));else{const{content:r,displayMode:l}=t.data;if(r){const a=`${l?"d":"i"}:${r}`;if(Ur.set(a,o),Ur.size>200){const c=Ur.keys().next().value;Ur.delete(c)}}i.aborted||i.resolve(o)}},Tl.onerror=t=>{console.error("[katexWorkerClient] Worker error:",t);for(const[n,o]of Yo.entries())clearTimeout(o.timeoutId),o.cleanup(),o.aborted||o.reject(new Error(`Worker error: ${t.message}`));Yo.clear(),cE()}}function mte(){var e;for(const t of Yo.values())clearTimeout(t.timeoutId),t.cleanup(),t.aborted||t.reject(new Error("Worker cleared"));Yo.clear(),cE(),Tl&&((e=Tl.terminate)==null||e.call(Tl)),Tl=null,wl=null}function gte(e,t=!0,n=2e3,o){return G1(this,null,function*(){performance.now();const s=aE(e);if(!rE()){const a=new Error("KaTeX rendering disabled");return a.name="KaTeXDisabled",a.code="KATEX_DISABLED",Promise.reject(a)}if(wl)return Promise.reject(wl);const i=`${t?"d":"i"}:${s}`,r=Ur.get(i);if(r)return Vd(),Promise.resolve(r);const l=Tl||(wl=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),wl.name="WorkerInitError",wl.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject(wl);if(Yo.size>=Af){const a=new Error("Worker busy");return a.name="WorkerBusy",a.code="WORKER_BUSY",a.busy=!0,a.inFlight=Yo.size,a.max=Af,Promise.reject(a)}return new Promise((a,c)=>{if(o?.aborted){const m=new Error("Aborted");return m.name="AbortError",void c(m)}const u=Math.random().toString(36).slice(2);let d=null;const f=globalThis.setTimeout(()=>{const m=Yo.get(u);if(!m)return;Yo.delete(u),m.cleanup();const y=new Error("Worker render timed out");y.name="WorkerTimeout",y.code="WORKER_TIMEOUT",m.aborted||m.reject(y),Vd()},n);d=()=>{const m=Yo.get(u);if(!m||m.aborted)return;m.aborted=!0,m.cleanup();const y=new Error("Aborted");y.name="AbortError",c(y)},o&&o.addEventListener("abort",d,{once:!0});const h=a,p=c;Yo.set(u,{resolve:m=>{h(m)},reject:m=>{p(m)},timeoutId:f,aborted:!1,cleanup:()=>{o&&d&&o.removeEventListener("abort",d),d=null}});try{l.postMessage({id:u,content:s,displayMode:t})}catch(m){const y=Yo.get(u);Yo.delete(u),clearTimeout(f),y?.cleanup(),y?.reject(m),Vd()}})})}function s3e(e,t=!0,n){const o=`${t?"d":"i"}:${aE(e)}`;if(Ur.set(o,n),Ur.size>200){const s=Ur.keys().next().value;Ur.delete(s)}}const vte="WORKER_BUSY";function yte(e=2e3,t){return Yo.size<Af?Promise.resolve():new Promise((n,o)=>{let s,i=!1,r=null,l=()=>{};const a=()=>{s&&globalThis.clearTimeout(s),Pa.delete(l),t&&r&&t.removeEventListener("abort",r),r=null};l=()=>{i||(i=!0,a(),n())},Pa.add(l),s=globalThis.setTimeout(()=>{if(i)return;i=!0,a();const c=new Error("Wait for worker slot timed out");c.name="WorkerBusyTimeout",c.code="WORKER_BUSY_TIMEOUT",o(c)},e),queueMicrotask(()=>Vd()),t&&(r=()=>{if(i)return;i=!0,a();const c=new Error("Aborted");c.name="AbortError",o(c)},t.aborted?r():t.addEventListener("abort",r,{once:!0}))})}const ud={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function i3e(e){return G1(this,arguments,function*(t,n=!0,o={}){var s,i,r,l;if(!rE()){const m=new Error("KaTeX rendering disabled");throw m.name="KaTeXDisabled",m.code="KATEX_DISABLED",m}const a=(s=o.timeout)!=null?s:ud.timeout,c=(i=o.waitTimeout)!=null?i:ud.waitTimeout,u=(r=o.backoffMs)!=null?r:ud.backoffMs,d=(l=o.maxRetries)!=null?l:ud.maxRetries,f=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):ud.maxRetries,h=o.signal;let p=0;for(;;){if(h?.aborted){const m=new Error("Aborted");throw m.name="AbortError",m}try{return yield gte(t,n,a,h)}catch(m){if(m?.code!==vte||p>=f)throw m;if(p++,yield yte(c,h).catch(()=>{}),h?.aborted){const y=new Error("Aborted");throw y.name="AbortError",y}u>0&&(yield new Promise(y=>globalThis.setTimeout(y,u*p)))}}})}function Gc(e){const t=typeof e=="number"?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function kte(e){var t;for(const n of e.split(/\r?\n/)){const o=n.trim();if(!o||o.startsWith("%%"))continue;const s=o.match(/^([A-Z][\w-]*)\b/i);return((t=s?.[1])==null?void 0:t.toLowerCase())||""}return""}function Fm(e){const t=e.split(/\r?\n/).map(s=>s.trim()).filter(s=>s&&!s.startsWith("%%")),n=Math.max(1,t.length),o=kte(e);return o==="gantt"?220+28*n:o==="sequencediagram"?180+26*n:o==="classdiagram"||o==="statediagram"||o==="erdiagram"?180+24*n:o==="flowchart"||o==="graph"?170+28*n:200+22*n}function Om(e){const t=e.split(/\r?\n/).filter(n=>/^\s*-\s+/.test(n)).length;return t>=3?500:t>0?280+60*t:360}function uE(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function Bm(e,t=360,n=500){return uE(e,t,n)}function Rm(e,t=360,n=500){return uE(e,t,n)}var bte=Object.defineProperty,xte=Object.defineProperties,wte=Object.getOwnPropertyDescriptors,o4=Object.getOwnPropertySymbols,_te=Object.prototype.hasOwnProperty,Ste=Object.prototype.propertyIsEnumerable,s4=(e,t,n)=>t in e?bte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dE=(e,t)=>{for(var n in t||(t={}))_te.call(t,n)&&s4(e,n,t[n]);if(o4)for(var n of o4(t))Ste.call(t,n)&&s4(e,n,t[n]);return e},i4=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(c){s(c)}},r=a=>{try{l(n.throw(a))}catch(c){s(c)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const Dm=()=>vs(()=>import("./mermaid.core-BwcskAQn.js").then(e=>e.bn),[]);let Tr=null,Yc=Dm,Cd=null,zy=!1,Uy=!1,Ad=0;function Cte(e){Yc=e,Ad++,Tr=null,Cd=null,zy=!1,Uy=!1}function Ate(e){Cte(Dm)}function r4(){return typeof Yc=="function"}function l4(e){if(!e)return e;const t=e&&e.default?e.default:e;if(t&&(typeof t.render=="function"||typeof t.parse=="function"||typeof t.initialize=="function"))return t;if(t&&t.mermaidAPI&&(typeof t.mermaidAPI.render=="function"||typeof t.mermaidAPI.parse=="function")){const s=t.mermaidAPI;return n=dE({},t),o={render:s.render.bind(s),parse:s.parse?s.parse.bind(s):void 0,initialize:i=>typeof t.initialize=="function"?t.initialize(i):s.initialize?s.initialize(i):void 0},xte(n,wte(o))}var n,o;return e.mermaid&&typeof e.mermaid.render=="function"?e.mermaid:t}function a4(e){if(e)try{const t=e?.initialize;e.initialize=n=>{const o=dE({suppressErrorRendering:!0},n||{});return typeof t=="function"?t.call(e,o):e?.mermaidAPI&&typeof e.mermaidAPI.initialize=="function"?e.mermaidAPI.initialize(o):void 0}}catch{}}function r3e(){return i4(this,null,function*(){if(Tr)return Tr;const e=(function(){try{const o=globalThis;return l4(o?.mermaid)}catch{return null}})();if(e)return Tr=e,a4(Tr),Tr;const t=Yc,n=Ad;return t?t===Dm&&zy?null:Cd||(Cd=i4(null,null,function*(){let o;try{o=yield t()}catch(s){if(t===Dm)return n===Ad&&t===Yc&&(zy=!0,(function(i){Uy||(Uy=!0,console.warn('[markstream-vue] Optional dependency "mermaid" is not installed. Mermaid blocks will render as source.',i))})(s)),null;throw s}finally{n===Ad&&t===Yc&&(Cd=null)}return n!==Ad||t!==Yc?null:o?(Tr=l4(o),a4(Tr),Tr):null}),Cd):null})}let $s=null,_l=null;const Di=new Map,ka=new Map;function Op(e){for(const t of Di.values())t.reject(e);Di.clear(),ka.clear()}let c4=5,u4=!1;const Mte="WORKER_BUSY",d4="MERMAID_DISABLED";function Ete(e){if($s&&$s!==e){const n=new Error("Worker replaced");n.code="WORKER_REPLACED",Op(n)}$s=e,_l=null;const t=e;$s.onmessage=n=>{if($s!==t)return;const{id:o,ok:s,result:i,error:r}=n.data,l=Di.get(o);l&&(s===!1||r?l.reject(new Error(r||"Unknown error")):l.resolve(i))},$s.onerror=n=>{var o,s;if($s===t)if(Di.size!==0){try{u4?console.error("[mermaidWorkerClient] Worker error:",n?.message||n):(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker error:",n?.message||n)}catch{}Op(new Error(`Worker error: ${n.message}`))}else(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker error (no pending):",n?.message||n)},$s.onmessageerror=n=>{var o,s;if($s===t)if(Di.size!==0){try{u4?console.error("[mermaidWorkerClient] Worker messageerror:",n):(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker messageerror:",n)}catch{}Op(new Error("Worker messageerror"))}else(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",n)}}function Tte(){var e;if($s)try{Op(new Error("Worker cleared")),(e=$s.terminate)==null||e.call($s)}catch{}$s=null,_l=null}function fE(e,t,n,o){if(!r4()){const r=new Error("Mermaid rendering disabled");return r.name="MermaidDisabled",r.code=d4,Promise.reject(r)}const s=`${e}\0${t.theme}\0${n}\0${t.code}`;let i=ka.get(s);return i||(i=(function(r,l,a=1400){if(!r4()){const u=new Error("Mermaid rendering disabled");return u.name="MermaidDisabled",u.code=d4,Promise.reject(u)}if(_l)return Promise.reject(_l);const c=$s||(_l=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),_l.name="WorkerInitError",_l.code="WORKER_INIT_ERROR",null);if(!c)return Promise.reject(_l);if(Di.size>=c4){const u=new Error("Worker busy");return u.name="WorkerBusy",u.code=Mte,u.inFlight=Di.size,u.max=c4,Promise.reject(u)}return new Promise((u,d)=>{const f=Math.random().toString(36).slice(2);let h,p=!1;const m=()=>{p||(p=!0,h!=null&&globalThis.clearTimeout(h),Di.delete(f))},y={resolve:k=>{m(),u(k)},reject:k=>{m(),d(k)}};Di.set(f,y);try{c.postMessage({id:f,action:r,payload:l})}catch(k){return Di.delete(f),void d(k)}h=globalThis.setTimeout(()=>{const k=new Error("Worker call timed out");k.name="WorkerTimeout",k.code="WORKER_TIMEOUT";const g=Di.get(f);g&&g.reject(k)},a)})})(e,t,n),ka.set(s,i),i.then(()=>{ka.get(s)===i&&ka.delete(s)},()=>{ka.get(s)===i&&ka.delete(s)})),(function(r,l){if(!l)return r;if(l.aborted){const a=new Error("Aborted");return a.name="AbortError",Promise.reject(a)}return new Promise((a,c)=>{let u=()=>{};const d=()=>l.removeEventListener("abort",u);u=()=>{d();const f=new Error("Aborted");f.name="AbortError",c(f)},l.addEventListener("abort",u,{once:!0}),r.then(f=>{d(),a(f)},f=>{d(),c(f)})})})(i,o)}function l3e(e,t,n=1400,o){return fE("canParse",{code:e,theme:t},n,o)}function a3e(e,t,n=1400,o){return fE("findPrefix",{code:e,theme:t},n,o)}var Nte=Object.defineProperty,Ite=Object.defineProperties,Lte=Object.getOwnPropertyDescriptors,f4=Object.getOwnPropertySymbols,$te=Object.prototype.hasOwnProperty,Fte=Object.prototype.propertyIsEnumerable,h4=(e,t,n)=>t in e?Nte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,it=(e,t)=>{for(var n in t||(t={}))$te.call(t,n)&&h4(e,n,t[n]);if(f4)for(var n of f4(t))Fte.call(t,n)&&h4(e,n,t[n]);return e},Ot=(e,t)=>Ite(e,Lte(t)),Zn=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(c){s(c)}},r=a=>{try{l(n.throw(a))}catch(c){s(c)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const Ote="__global__",ov="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",qy=(()=>{const e=globalThis;if(e[ov])return e[ov];const t={scopedCustomComponents:{},revision:gr(0)};return e[ov]=t,t})(),p4=qy.revision,Bte=Symbol("markstreamCustomComponents"),Rte=new Set(["text","paragraph","heading","code_block","list","list_item","blockquote","table","table_row","table_cell","definition_list","definition_item","footnote","footnote_reference","footnote_anchor","admonition","hardbreak","link","image","thematic_break","math_inline","math_block","strong","emphasis","strikethrough","highlight","insert","subscript","superscript","emoji","checkbox","checkbox_input","inline_code","html_inline","html_block","reference","mermaid","infographic","d2","vmr_container"]);function Kf(e){return Rte.has(String(e).trim().toLowerCase())}function Dte(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function sv(e={}){const t={};for(const[n,o]of Object.entries(e))if(o!=null){t[n]=o;for(const s of new Set([Ti(n),Ti(Dte(n))]))!s||Kf(s)||Object.prototype.hasOwnProperty.call(t,s)||(t[s]=o)}return t}function To(e){const t=Jt(Bte,null);return D(()=>{var n;return p4.value,(function(o,s={}){return p4.value,it(it(it({},sv(qy.scopedCustomComponents[Ote]||{})),sv(s)),sv((function(i){return i&&qy.scopedCustomComponents[i]||{}})(o)))})(e?.(),(n=t?.value)!=null?n:{})})}const Pte=["aria-label"],Hte={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-unchecked"},Wte={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-checked"},Mn=(e,t)=>{const n=e.__vccOpts||e;for(const[o,s]of t)n[o]=s;return n},ti=Mn(Je({__name:"CheckboxNode",props:{node:{}},setup:e=>(t,n)=>(x(),E("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(x(),E("svg",Wte,[...n[1]||(n[1]=[w("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),w("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(x(),E("svg",Hte,[...n[0]||(n[0]=[w("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,Pte))}),[["__scopeId","data-v-be21ab83"]]);ti.install=e=>{e.component(ti.__name,ti)};const zte={class:"emoji-node"},Ds=Mn(Je({__name:"EmojiNode",props:{node:{}},setup:e=>(t,n)=>(x(),E("span",zte,R(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);Ds.install=e=>{e.component(Ds.__name,Ds)};const Ute=["id"],qte=["title"],ni=Mn(Je({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const t=`#fnref--${e.node.id}`;function n(){if(typeof document>"u")return;const o=document.querySelector(t);o?o.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${t} not found`)}return(o,s)=>(x(),E("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:n},[w("span",{href:t,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+R(e.node.id)+"]",9,qte)],8,Ute))}}),[["__scopeId","data-v-c1463a29"]]);ni.install=e=>{e.component(ni.__name,ni)};const hE=(()=>{try{return!1}catch{}return!1})();function iv(e){hE&&console.warn(e)}function m4(e,t="safe",n){return B2(e,t,n)}function pE(e){return See(e)}function rv(e){return e===!0?"":e===!1?"false":e==null?null:String(e)}function H2(e,t="safe"){const n=String(e.tag||e.type||"").trim(),o=Fp((s=e.attrs)?Array.isArray(s)?s.every(Array.isArray)?s.map(([r,l])=>[String(r),rv(l)]):s.filter(r=>r&&typeof r=="object"&&!Array.isArray(r)&&"name"in r).map(r=>[String(r.name),rv(r.value)]):Object.entries(s).map(([r,l])=>[r,rv(l)]):null,t,n);var s;if(!o)return;const i=pE(jd(o));return Object.keys(i).length>0?i:void 0}function g4(e,t,n=!1){const o=Object.entries(t??{}),s=o.length>0?o.map(([i,r])=>r===""?` ${i}`:` ${i}="${r}"`).join(""):"";return n?`<${e}${s} />`:`<${e}${s}>`}function dd(e,t){Array.isArray(t)?e.push(...t):t!=null&&e.push(t)}function lv(e,t,n,o,s,i,r=!1){const l=(function(d,f){return X8(d,f)})(e,o);if(zf.has(e.toLowerCase())||!l&&K8(e,i))return null;if(!l&&O2(e,i))return r?[g4(e,t,!0)]:[g4(e,t),...n,`</${e}>`];const a=B2(t,i,e),c=a.key,u=c!=null&&c!==""?c:s;if(l){const d=o[e]||o[e.toLowerCase()],f=pE(a);return Lt(d,Ot(it({},f),{key:u}),n.length>0?n:void 0)}return Lt(e,Ot(it({},a),{innerHTML:void 0,key:u}),n.length>0?n:void 0)}function mE(e,t){return Mee(e,t)}function Pm(e,t,n="safe"){if(!e)return[];try{return(function(i,r,l="safe"){let a=0;const c=[],u=[];for(const d of i)if(d.type==="text")(c.length>0?c[c.length-1].children:u).push(d.content);else if(d.type==="self_closing"){const f=lv(d.tagName,d.attrs||{},[],r,"ms-html-"+a++,l,!0);dd(c.length>0?c[c.length-1].children:u,f)}else if(d.type==="tag_open")c.push({tagName:d.tagName,children:[],attrs:d.attrs,autoKey:"ms-html-"+a++});else if(d.type==="tag_close"){const f=d.tagName.toLowerCase();let h=-1;for(let p=c.length-1;p>=0;p--)if(c[p].tagName.toLowerCase()===f){h=p;break}if(h!==-1)for(;c.length>h;){const p=c.pop(),m=lv(p.tagName,p.attrs||{},p.children,r,p.autoKey,l);c.length>0?dd(c[c.length-1].children,m):dd(u,m),p.tagName.toLowerCase()!==f&&c.length>h&&iv(`Auto-closing unclosed tag: <${p.tagName}>`)}else iv(`Ignoring closing tag with no matching opening tag: </${d.tagName}>`)}for(;c.length>0;){const d=c.pop(),f=lv(d.tagName,d.attrs||{},d.children,r,d.autoKey,l);c.length>0?dd(c[c.length-1].children,f):dd(u,f),iv(`Auto-closing unclosed tag: <${d.tagName}>`)}return u})(Q8(e),t,n)}catch(s){return o=s,hE&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const jte=["innerHTML"],oi=Mn(Je({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=Jt("markstreamHtmlPolicy",void 0),o=D(()=>{var l,a;return(a=(l=t.htmlPolicy)!=null?l:n?.value)!=null?a:"safe"}),s=To(()=>t.customId),i=Je({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=D(()=>{const l=t.node.content;if(!l)return{mode:"html",content:""};if(o.value==="escape")return{mode:"html",content:uu(l,o.value)};if(t.node.loading&&!t.node.autoClosed)return{mode:"text",content:l};if(t.node.loading&&t.node.autoClosed){const c=Pm(l,s.value,o.value);if(c!==null)return{mode:"dynamic",nodes:c}}if(!mE(l,s.value))return{mode:"html",content:uu(l,o.value)};const a=Pm(l,s.value,o.value);return a===null?{mode:"html",content:uu(l,o.value)}:{mode:"dynamic",nodes:a}});return(l,a)=>r.value.mode==="dynamic"?(x(),E("span",{key:0,class:Ue(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},[ae(C(i),{nodes:r.value.nodes},null,8,["nodes"])],2)):r.value.mode==="text"?(x(),E("span",{key:1,class:Ue(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},R(r.value.content),3)):(x(),E("span",{key:2,class:Ue(["html-inline-node",{"html-inline-node--loading":t.node.loading}]),innerHTML:r.value.content},null,10,jte))}}),[["__scopeId","data-v-d17f12b0"]]);oi.install=e=>{e.component(oi.__name,oi)};const Vte={class:"inline-code"},Kte={key:0},as=Mn(Je({__name:"InlineCodeNode",props:{node:{}},setup(e){const t=e,n=Bf(),o=Jt("markstreamFade",void 0),s=Jt("markstreamTextStreamState",void 0),i=Jt("markstreamStreamVersion",void 0),r=D(()=>{const g=n.fade;return g===""||g===!0||g==="true"||g!==!1&&g!=="false"&&void 0}),l=D(()=>typeof r.value=="boolean"?r.value:typeof o?.value!="boolean"||o.value),a=D(()=>{var g;return String((g=t.node.code)!=null?g:"")}),c=D(()=>!l.value),u=D(()=>{var g;const v=(g=n["index-key"])!=null?g:n.indexKey;return v==null||v===""?"":String(v)}),d=oe(t.node.code),f=oe(""),h=oe(0);let p;function m(){p?.(),p=void 0}function y(){m(),f.value&&(d.value=d.value+f.value,f.value="")}et([()=>t.node.code,u,l],([g])=>{const v=String(g??""),b=u.value,A=nE({nextContent:v,persistedContent:b?s?.get(b):void 0,currentState:{settledContent:d.value,streamedDelta:f.value},typewriterEnabled:l.value});d.value=A.settledContent,f.value=A.streamedDelta,A.appended?(h.value+=1,(function(){if(!f.value||p||!i)return;const I=i.value;p=et(()=>i.value,N=>{N!==I&&y()},{flush:"sync"})})()):f.value||m(),b&&s?.set(b,v)},{immediate:!0}),Lf(m);const k=D(()=>h.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(g,v)=>(x(),E("code",Vte,[c.value?(x(),E(We,{key:0},[ot(R(a.value),1)],64)):(x(),E(We,{key:1},[d.value?(x(),E("span",Kte,R(d.value),1)):ue("",!0),f.value?(x(),E("span",{key:1,class:Ue(["inline-code-stream-delta",[k.value]]),onAnimationend:y},R(f.value),35)):ue("",!0)],64))]))}}),[["__scopeId","data-v-4e331c97"]]);as.install=e=>{e.component(as.__name,as)};const jy=oe(!1),v4=oe(""),y4=oe("top"),Kd=oe(null),Gd=oe(null),Vy=oe(null),Ky=oe(null),k4=oe(null);let Bp=null,Rp=null,Gy=0;function gE(){Bp&&(clearTimeout(Bp),Bp=null),Rp&&(clearTimeout(Rp),Rp=null)}let np=!1,op=null,b4=!1;function Gte(e,t,n="top",o=!1,s,i){if(!e)return;const r=++Gy;gE();const l=()=>Zn(null,null,function*(){var a,c;if(yield(function(){return Zn(this,null,function*(){if(!np&&!b4&&typeof document<"u"){op!=null||(op=Zn(null,null,function*(){const[{createApp:u,h:d},{default:f}]=yield Promise.all([vs(()=>import("./vue.runtime.esm-bundler-CV6FAM7w.js"),[]),vs(()=>import("./Tooltip-CLzA0dLY.js"),[])]),h=document.createElement("div");h.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(h),u({setup:()=>()=>{var p;return d(f,{visible:jy.value,"anchor-el":Kd.value,content:v4.value,placement:y4.value,id:Gd.value,originX:Vy.value,originY:Ky.value,isDark:(p=k4.value)!=null?p:void 0})}}).mount(h),np=!0}));try{yield op}catch(u){np=!1,op=null,b4=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",u)}}})})(),np&&r===Gy){Gd.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,Kd.value=e,v4.value=t,y4.value=n,Vy.value=(a=s?.x)!=null?a:null,Ky.value=(c=s?.y)!=null?c:null,k4.value=typeof i=="boolean"?i:null,jy.value=!0;try{e.setAttribute("aria-describedby",Gd.value)}catch{}}});o?l():Bp=setTimeout(l,80)}function Yte(e=!1){Gy+=1,gE();const t=()=>{if(Kd.value&&Gd.value)try{Kd.value.removeAttribute("aria-describedby")}catch{}jy.value=!1,Kd.value=null,Gd.value=null,Vy.value=null,Ky.value=null};e?t():Rp=setTimeout(t,120)}const Zte={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."},Xte=Symbol("markstreamI18nFallback");function vE(e,t){var n;return(n=t?.[e])!=null?n:Zte[e]}const Yy=(e,t)=>{var n;return(n=vE(e,t))!=null?n:(function(o){return(o.split(".").pop()||o).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,s=>s.toUpperCase()).trim()})(e)};function x4(e,t){return{t(n){const o=vE(n,t);if(e.te&&o!=null&&!e.te(n))return Yy(n,t);const s=e.t(n);return s===n&&o!=null?Yy(n,t):s}}}function Qte(){const e=(function(){var n,o,s;try{const i=Mo(),r=Xte,l=i?.provides,a=(n=i?.appContext)==null?void 0:n.provides;return(s=(o=l?.[r])!=null?o:a?.[r])!=null?s:null}catch{}return null})(),t=(function(){var n,o;try{const s=Mo(),i=s?.proxy,r=i?.$t;if(typeof r=="function"){const c=i?.$te;return{t:r.bind(i),te:typeof c=="function"?c.bind(i):void 0}}const l=(o=(n=s?.appContext)==null?void 0:n.config)==null?void 0:o.globalProperties,a=l?.$t;if(typeof a=="function"){const c=l?.$te;return{t:a.bind(l),te:typeof c=="function"?c.bind(l):void 0}}}catch{}return null})();if(t)return x4(t,e);try{const n=globalThis.$vueI18nUse||null;if(n&&typeof n=="function")try{const o=n();if(o&&typeof o.t=="function")return x4({t:o.t.bind(o),te:typeof o.te=="function"?o.te.bind(o):void 0},e)}catch{}}catch{}return{t:n=>Yy(n,e)}}const yE=Symbol("ViewportPriority"),kE=Symbol("ViewportPriorityOptions"),bE=Symbol("OffscreenHeavyNodeDeferral"),Jte=D(()=>!1),ja="400px";function W2(){return Jt(kE,void 0)}function z2(){return Jt(bE,Jte)}function ene(e,t){var n,o;const s=typeof window<"u"&&typeof document<"u",i=typeof t=="boolean"?oe(t):t,r=s?(n=window.requestIdleCallback)!=null?n:N=>window.setTimeout(()=>N({didTimeout:!0,timeRemaining:()=>0}),16):null,l=s?(o=window.cancelIdleCallback)!=null?o:N=>window.clearTimeout(N):null,a=new WeakMap;let c=1;const u=new Map,d=new Map,f=new Set;let h=null,p=null;function m(N){if(!N)return"viewport";let M=a.get(N);return M||(M=c++,a.set(N,M)),String(M)}function y(){if(h!=null){try{l?.(h)}catch{}h=null}}function k(N){if(N){const M=u.get(N);if(M&&!M.targets.size){try{M.io.disconnect()}catch{}u.delete(N)}}d.size||f.size||y()}function g(N){const M=d.get(N);if(!M)return;const $=u.get(M.bucketKey);if(!M.visible.value){M.visible.value=!0;try{M.resolve()}catch{}}try{$?.io.unobserve(N)}catch{}$?.targets.delete(N),d.delete(N),f.delete(N),k(M.bucketKey)}function v(){window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&r&&h==null&&f.size&&(h=r(()=>{h=null;const N=f.values().next().value;N&&(f.delete(N),g(N),f.size&&v())},{timeout:1200}))}function b(N,M){if(!s||typeof IntersectionObserver>"u")return null;const $=(function(z,L){var O,U,Z;return{root:(O=e?.(z??null))!=null?O:null,rootMargin:(U=L?.rootMargin)!=null?U:ja,threshold:(Z=L?.threshold)!=null?Z:0}})(N,M),T=[m((F=$).root),F.rootMargin,F.threshold].join("\0");var F;const S=u.get(T);if(S)return{key:T,bucket:S};let B;try{B=new IntersectionObserver(z=>{for(const L of z)(L.isIntersecting||L.intersectionRatio>0)&&g(L.target)},{root:$.root,rootMargin:$.rootMargin,threshold:$.threshold})}catch{return null}const W={io:B,targets:new Map};return u.set(T,W),{key:T,bucket:W}}function A(){if(s&&i.value)for(const[N,M]of Array.from(d.entries())){const $=b(N,M.opts);if(!$){g(N);continue}if($.key===M.bucketKey)continue;const T=M.bucketKey,F=u.get(T);try{F?.io.unobserve(N)}catch{}F?.targets.delete(N),M.bucketKey=$.key,$.bucket.targets.set(N,M),$.bucket.io.observe(N),k(T)}}et(i,N=>{if(!N){for(const M of Array.from(d.keys()))g(M);y()}},{flush:"sync"});const I=(N,M)=>{const $=oe(!1);let T,F=!1;const S=new Promise(L=>{T=()=>{F||(F=!0,L())}}),B=()=>{const L=d.get(N);if(!L)return f.delete(N),void k();const O=u.get(L.bucketKey);try{O?.io.unobserve(N)}catch{}O?.targets.delete(N),d.delete(N),f.delete(N),k(L.bucketKey)};if(!s||!i.value)return $.value=!0,T(),{isVisible:$,whenVisible:S,destroy:B};const W=b(N,M);if(!W)return $.value=!0,T(),{isVisible:$,whenVisible:S,destroy:B};const z={resolve:T,visible:$,bucketKey:W.key,opts:M};return d.set(N,z),W.bucket.targets.set(N,z),W.bucket.io.observe(N),s&&p==null&&(p=window.requestAnimationFrame(()=>{p=null,A()})),M?.allowIdle!==!1&&(f.add(N),v()),{isVisible:$,whenVisible:S,destroy:B}};return I.refresh=A,Ln(yE,I),I}function U2(){var e,t;const n=Jt(yE,void 0);if(n)return n;const o=new WeakMap,s=new Map,i=new Set;let r=null;const l=typeof window<"u"?(e=window.requestIdleCallback)!=null?e:h=>window.setTimeout(()=>h({didTimeout:!0,timeRemaining:()=>0}),16):null,a=typeof window<"u"?(t=window.cancelIdleCallback)!=null?t:h=>window.clearTimeout(h):null,c=()=>{if(r!=null){try{a?.(r)}catch{}r=null}},u=h=>{if(!h)return;const p=s.get(h);if(p&&!p.targets.size){try{p.io.disconnect()}catch{}s.delete(h)}},d=h=>{const p=o.get(h);if(!p)return;const m=s.get(p.bucketKey);if(!p.visible.value){p.visible.value=!0;try{p.resolve()}catch{}}try{m?.io.unobserve(h)}catch{}o.delete(h),m?.targets.delete(h),i.delete(h),u(p.bucketKey),i.size||c()},f=()=>{window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&l&&r==null&&i.size&&(r=l(()=>{r=null;const h=i.values().next().value;h&&(i.delete(h),d(h),i.size&&f())},{timeout:1200}))};return(h,p)=>{const m=oe(!1);let y,k=!1;const g=new Promise(A=>{y=()=>{k||(k=!0,A())}}),v=()=>{const A=o.get(h);if(!A)return i.delete(h),void(i.size||c());const I=s.get(A.bucketKey);try{I?.io.unobserve(h)}catch{}o.delete(h),I?.targets.delete(h),i.delete(h),u(A.bucketKey),i.size||c()},b=(A=>{var I,N;if(typeof window>"u"||typeof IntersectionObserver>"u")return null;const M=(B=>{var W,z;return[(W=B?.rootMargin)!=null?W:ja,(z=B?.threshold)!=null?z:0].join("\0")})(A),$=s.get(M);if($)return{key:M,bucket:$};const T=(I=A?.rootMargin)!=null?I:ja;let F;try{F=new IntersectionObserver(B=>{for(const W of B)(W.isIntersecting||W.intersectionRatio>0)&&d(W.target)},{root:null,rootMargin:T,threshold:(N=A?.threshold)!=null?N:0})}catch{return null}const S={io:F,targets:new Set};return s.set(M,S),{key:M,bucket:S}})(p);return b?(o.set(h,{resolve:y,visible:m,bucketKey:b.key}),b.bucket.targets.add(h),b.bucket.io.observe(h),p?.allowIdle!==!1&&(i.add(h),f()),{isVisible:m,whenVisible:g,destroy:v}):(m.value=!0,y(),{isVisible:m,whenVisible:g,destroy:v})}}function tne(e,t){var n,o;const s=(o=(n=e.indexKey)!=null?n:t["index-key"])!=null?o:t.indexKey;return s==null||s===""?"":String(s)}const nne=["data-markstream-viewport-pending"],one=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],sne={key:1,class:"image-placeholder"},ine={key:1,class:"image-node__raw-text"},rne={key:2,class:"image-shimmer-overlay"},lne={key:1,class:"image-node__raw-text"},ane={key:3,class:"image-error"},Fl=Mn(Je({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:t}){var n,o,s;const i=e,r=t,l=oe(!1),a=oe(!1),c=oe(""),u=oe("primary"),d=oe(null),f=Bf(),h=Jt(Hy,null),p=U2(),m=W2(),y=z2(),k=D(()=>jS(i.node.src)),g=D(()=>jS(i.fallbackSrc)),v=(s=(o=(n=Mo())==null?void 0:n.vnode.el)==null?void 0:o.querySelector)==null?void 0:s.call(o,"img"),b=typeof window<"u"&&v?.getAttribute("src")===(k.value||g.value),A=oe(typeof window>"u"||b||!y.value),I=gr(null);let N="",M=null;const $=D(()=>c.value),T=D(()=>!i.lazy),F=D(()=>typeof window<"u"&&y.value&&!b),S=D(()=>!F.value||A.value),B=D(()=>S.value?$.value:""),W=D(()=>{var he,Ae;return(Ae=(he=m?.value.heavyBlockMargin)!=null?he:m?.value.rootMargin)!=null?Ae:ja}),z=D(()=>!i.node.loading&&u.value!=="failed"&&c.value.length>0),L=D(()=>u.value==="failed"),O=D(()=>(!T.value||F.value&&!A.value)&&!l.value&&!a.value&&u.value!=="failed"&&c.value.length>0),U=D(()=>tne(i,f));function Z(he=U.value){he&&d.value&&h?.reportHeight(he,d.value.offsetHeight)}function ie(he=U.value){he&&yt(()=>{Z(he)})}function q(){M&&(clearTimeout(M),M=null)}function ee(){const he=U.value;he&&N!==he&&(N&&h?.markSettled(N),q(),N=he,h?.markPending(he),typeof window<"u"&&(M=window.setTimeout(()=>{N===he&&(ie(he),fe())},8e3)))}function fe(){return Zn(this,null,function*(){const he=N;he&&(q(),N="",yield yt(),Z(he),h?.markSettled(he))})}function ne(){if(u.value==="primary"&&g.value&&g.value!==c.value)return u.value="fallback",c.value=g.value,l.value=!1,a.value=!1,void ie();u.value="failed",a.value=!0,r("error",c.value),ie()}function j(){l.value=!0,a.value=!1,r("load",$.value),ie()}function K(he){he.preventDefault(),l.value&&!a.value&&r("click",[he,$.value])}const{t:ve}=Qte();return et([k,g,()=>i.node.loading],()=>(l.value=!1,a.value=!1,i.node.loading||k.value?(c.value=k.value,void(u.value="primary")):g.value?(c.value=g.value,void(u.value="fallback")):(c.value="",u.value="failed",void(a.value=!0))),{immediate:!0}),typeof window<"u"&&et([d,F],([he,Ae],re,Y)=>{var Q;if((Q=I.value)==null||Q.destroy(),I.value=null,!Ae||A.value)return void(A.value=!0);if(!he)return void(A.value=!1);let P=!0;const G=p(he,{rootMargin:W.value,allowIdle:!1});I.value=G,A.value=G.isVisible.value,G.whenVisible.then(()=>{P&&I.value===G&&(A.value=!0)}),Y(()=>{P=!1,G.destroy(),I.value===G&&(I.value=null)})},{immediate:!0}),et([z,l,a,$,()=>i.lazy,S],([he,Ae,re,Y,Q,P])=>he&&Y&&!re&&P?Ae?(fe(),void ie()):Q?(ee(),void ie()):void(Ae||re||ee()):(fe(),void ie()),{flush:"post",immediate:!0}),ho(()=>{var he;(he=I.value)==null||he.destroy(),I.value=null,(function(){const Ae=N;Ae&&(q(),N="",h?.markSettled(Ae))})()}),(he,Ae)=>{var re,Y,Q,P,G;return x(),E("span",{ref_key:"rootRef",ref:d,class:"image-node-container","data-markstream-viewport-pending":F.value&&!A.value?"true":void 0},[z.value?(x(),E("img",{key:0,src:B.value||void 0,alt:String((Y=(re=i.node.alt)!=null?re:i.node.title)!=null?Y:""),title:String((P=(Q=i.node.title)!=null?Q:i.node.alt)!=null?P:""),class:Ue(["image-node__img",{"is-loading":!T.value&&!l.value,"is-loaded":T.value||l.value,"has-natural-size":l.value,"cursor-pointer":l.value}]),loading:i.lazy?"lazy":void 0,fetchpriority:T.value?"high":void 0,decoding:T.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":(G=i.node.alt)!=null?G:C(ve)("image.preview"),onError:ne,onLoad:j,onClick:K},null,42,one)):ue("",!0),e.node.loading&&!a.value?(x(),E("span",sne,[i.usePlaceholder?jn(he.$slots,"placeholder",{key:0,node:i.node,displaySrc:$.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[Ae[0]||(Ae[0]=w("span",{class:"image-shimmer"},null,-1))],!0):(x(),E("span",ine,R(e.node.raw),1))])):ue("",!0),O.value&&!e.node.loading?(x(),E("span",rne,[i.usePlaceholder?jn(he.$slots,"placeholder",{key:0,node:i.node,displaySrc:$.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[Ae[1]||(Ae[1]=w("span",{class:"image-shimmer"},null,-1))],!0):(x(),E("span",lne,R(e.node.raw),1))])):ue("",!0),L.value?(x(),E("span",ane,[jn(he.$slots,"error",{node:i.node,displaySrc:$.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[Ae[2]||(Ae[2]=w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[w("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),w("span",null,R(C(ve)("image.loadError")),1)],!0)])):ue("",!0)],8,nne)}}}),[["__scopeId","data-v-046e82ac"]]);Fl.install=e=>{e.component(Fl.__name,Fl)};const cne={key:2},vr=Je({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const t=e,n=To(()=>t.customId),o=Jt("markstreamHtmlPolicy",void 0),s=Jt("markstreamNestedRendererProps",void 0),i=D(()=>{var p;return(p=o?.value)!=null?p:"safe"}),r=D(()=>{var p,m;const y=(p=s?.value)!=null?p:{};return Ot(it({},y),{customId:(m=t.customId)!=null?m:y.customId,htmlPolicy:i.value})}),l=Hi({loader:()=>Promise.resolve().then(()=>eb),suspensible:!1}),a=D(()=>t.components[String(t.node.type)]),c=D(()=>!!(a.value&&n.value[t.node.type]&&!Kf(String(t.node.type)))),u=D(()=>c.value?H2(t.node,i.value):void 0),d=D(()=>Array.isArray(t.node.children)&&t.node.children.length>0),f=D(()=>{var p;return String((p=t.node.content)!=null?p:"")}),h=D(()=>{var p,m;return String((m=(p=t.node.content)!=null?p:t.node.raw)!=null?m:"")});return(p,m)=>a.value&&c.value?(x(),Se(Ho(a.value),Sn({key:0},u.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":r.value.isDark}),{default:Ie(()=>[d.value?(x(),Se(C(l),Sn({key:0},r.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):f.value?(x(),Se(C(l),Sn({key:1},r.value,{content:f.value,final:!e.node.loading,"index-key":`${e.indexKey||"child"}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ue("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark"])):a.value?(x(),Se(Ho(a.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,["node","custom-id","index-key"])):e.fallbackToText?(x(),E("span",cne,R(h.value),1)):ue("",!0)}}),w4=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function une(e){var t;if(typeof e=="boolean")return e;if(e&&typeof e=="object"){const n=e;return Ot(it(it({},w4),n),{enabled:(t=n.enabled)==null||t})}return it({},w4)}function q2(e,t){if(e.renderSideBySide===!1)return!0;if(e.useInlineViewWhenSpaceIsLimited!==!0)return!1;const n=e.renderSideBySideInlineBreakpoint,o=typeof n=="number"&&Number.isFinite(n)?n:900;return t>0&&t<=o}function xE(e){var t,n;const o=(n=(t=String(e??"").split(/\r?\n/,1)[0])==null?void 0:t.trim())!=null?n:"";if(o.length<3)return"";const s=o[0];if(s!=="`"&&s!=="~"||o[1]!==s||o[2]!==s)return"";let i=3;for(;o[i]===s;)i+=1;return o.slice(i).trim()}function _4(e){var t;return((t=String(e??"").trim().split(/\s+/,1)[0])!=null?t:"")==="diff"}function dne(e){var t;return e.diff===!0||_4(e.language)||_4(xE(String((t=e.raw)!=null?t:"")))}function fne(e,t,n){const o=(function(s){const i=xE(s);if(!i)return"";const r=i.split(/\s+/).filter(Boolean);if(!r.length)return"";const l=r[0]==="diff"?r.slice(1):r;for(const a of l){const c=a.includes(":")?a.slice(a.indexOf(":")+1):a;if(c&&/[./\\-]/.test(c))return c}return""})(e);return{title:o||t,caption:o?n?`Diff / ${t}`:t:""}}const hne=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],pne={key:0,translate:"no",class:"markstream-pre__diff-code"},mne={class:"markstream-pre__diff-pane-content"},gne={class:"markstream-pre__diff-number","aria-hidden":"true"},vne={class:"markstream-pre__diff-content"},yne={class:"markstream-pre__diff-content-inner"},kne={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},bne=["textContent"],xne=["textContent"],Fs=Je({__name:"PreCodeNode",props:{node:{},loading:{type:Boolean},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},diffHideUnchangedRegions:{type:[Boolean,Object]},reservedHeightPx:{}},setup(e){const t=e;function n(j,K){const ve=String(j??"");return K?ve:ve.replace(/\r\n$|\n$|\r$/,"")}const o=D(()=>{var j,K,ve;const he=String((K=(j=t.node)==null?void 0:j.language)!=null?K:"");return String((ve=String(he).split(/\s+/g)[0])!=null?ve:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),s=D(()=>`language-${o.value}`),i=D(()=>{var j;return t.loading===!0||((j=t.node)==null?void 0:j.loading)===!0}),r=D(()=>{var j;return n((j=t.node)==null?void 0:j.code,i.value)});let l="",a=1;const c=D(()=>(function(j){let K=0,ve=1;j.startsWith(l)&&(K=l.length,ve=a,K>0&&j[K-1]==="\r"&&j[K]===`
285
+ </div>`};const c=/^\[(\d+)\]/,u=/^\[([^\]\n]+)\]/,d=p=>{if(!p.startsWith("["))return!1;const m=u.exec(p);if(!m)return p!=="["&&!/^\[\d+$/.test(p);const y=String(m[1]??"");return p.slice(m[0].length).startsWith("(")?!1:!/^\d+$/.test(y)},f=(p,m)=>{const y=p;if(y.src[y.pos]!=="[")return!1;const k=c.exec(y.src.slice(y.pos));if(!k)return!1;const g=y.src.slice(Math.max(0,y.pos-120),y.pos);if(/"[^"\n]{1,80}"\s*:\s*$/.test(g))return!1;const v=y.src.slice(y.pos+k[0].length);if(v.startsWith("](")||v.startsWith("(")||d(v))return!1;if(!m){const b=k[1],A=y.push("reference","span",0);A.content=b,A.markup=k[0],A.raw=k[0]}return y.pos+=k[0].length,!0};n.inline.ruler.before("escape","reference",f),n.renderer.rules.reference=(p,m)=>{const k=String(p[m].content??"");return`<span class="reference-link" data-reference-id="${k}" role="button" tabindex="0" title="Click to view reference">${k}</span>`};const h=n.use.bind(n);return n.use=((...p)=>(o.__markstreamHasCustomParserExtensions=!0,h(...p))),n}function Vee({nextContent:e,previousContent:t,typewriterEnabled:n}){return n?e===t?{settledContent:e,streamedDelta:"",appended:!1}:t&&e.startsWith(t)&&e.length>t.length?{settledContent:t,streamedDelta:e.slice(t.length),appended:!0}:{settledContent:e,streamedDelta:"",appended:!1}:{settledContent:e,streamedDelta:"",appended:!1}}function nE({nextContent:e,persistedContent:t,currentState:n,typewriterEnabled:o,streamRenderVersionChanged:s=!1}){const i=`${n.settledContent}${n.streamedDelta}`;return o?n.streamedDelta&&i===e?s?{settledContent:i,streamedDelta:"",appended:!1}:{settledContent:n.settledContent,streamedDelta:n.streamedDelta,appended:!1}:Vee({nextContent:e,previousContent:t??i,typewriterEnabled:o}):{settledContent:e,streamedDelta:"",appended:!1}}const Kee={plain:"plaintext",text:"plaintext",txt:"plaintext",js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",mts:"typescript",cts:"typescript",golang:"go",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",kts:"kotlin",md:"markdown",yml:"yaml",sh:"shellscript",bash:"shellscript",zsh:"shellscript",shell:"shellscript",shellscript:"shellscript",ps:"powershell",ps1:"powershell",pwsh:"powershell","c++":"cpp","c#":"csharp",cs:"csharp",objc:"objective-c",objectivec:"objective-c","objective-c":"objective-c",objectivecpp:"objective-cpp","objective-c++":"objective-cpp","objective-cpp":"objective-cpp"};function Gee(e){const t=String(e??"").trim();if(!t)return"";const[n=""]=t.split(/\s+/);return n.split(":")[0]?.trim().toLowerCase()??""}function oE(e){const t=Gee(e);return Kee[t]??t}function Yee(e){if(!Array.isArray(e))return;const t=e.filter(o=>typeof o=="string").map(o=>oE(o)).filter(Boolean),n=Array.from(new Set(t)).sort();return n.length>0?n:void 0}function Zee(e){if(!Array.isArray(e))return;const t=[],n=new Set;for(const o of e){if(typeof o!="string")continue;const s=o.trim();!s||n.has(s)||(n.add(s),t.push(s))}return t.length>0?t:void 0}function Xee(e){return Zee(e)?.join("\0")??""}function Qee(e,t){return`${Xee(e)}\0\0${Yee(t)?.join("\0")??""}`}function Ac(e,t,n=1){const o=Number(e);return Number.isFinite(o)?Math.max(n,o):t}function XC(e,t){const n=Number(e);return Number.isFinite(n)?Math.max(0,n):t}var Jee=class{constructor(e={},t){this.source="",this.visible="",this.done=!1,this.paused=!1,this.listeners=new Set,this.rafId=0,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.hasStarted=!1,this.destroyed=!1,this.getSnapshot=()=>({source:this.source,visible:this.visible,done:this.done,paused:this.paused,pendingChars:this.pendingChars,caughtUp:this.caughtUp,final:this.final}),this.subscribe=d=>this.destroyed?()=>{}:(this.listeners.add(d),()=>{this.listeners.delete(d)}),this.enqueue=d=>{if(this.destroyed||!d)return;this.done&&(this.done=!1);const f=this.source.length>0,h=this.pendingChars<=0;if(this.source+=d,h){const p=QC();this.startedAt=f&&this.hasStarted?p-this.normalizedStartDelayMs:p,this.lastTick=p,this.charBudget=0}this.hasStarted=!0,this.emit(),this.ensureLoop()},this.finish=(d={})=>{if(!this.destroyed){if(this.done=!0,d.flush??this.flushOnFinish){this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit();return}this.emit(),this.ensureLoop()}},this.flush=()=>{this.destroyed||(this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit())},this.reset=(d="")=>{this.destroyed||(this.cancelLoop(),this.source=d,this.visible=d,this.done=!1,this.paused=!1,this.hasStarted=!1,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit())},this.pause=()=>{this.destroyed||this.paused||(this.paused=!0,this.cancelLoop(),this.emit())},this.resume=()=>{if(this.destroyed||!this.paused)return;this.paused=!1;const d=QC();this.lastTick=d,this.startedAt||=d,this.emit(),this.ensureLoop()},this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.cancelLoop(),this.listeners.clear())},this.dispose=()=>{this.destroy()},this.tick=d=>{if(this.rafId=0,this.destroyed||this.paused)return;if(this.pendingChars<=0){this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond;return}if(d-this.startedAt<this.normalizedStartDelayMs){this.rafId=requestAnimationFrame(this.tick);return}const f=1e3/Math.max(1,this.maxCommitFps),h=Math.min(100,Math.max(0,d-this.lastTick));if(h<f){this.rafId=requestAnimationFrame(this.tick);return}this.lastTick=d;const p=this.pendingChars,m=p>this.normalizedCatchUpThreshold?this.normalizedCatchUpLatencyMs:this.normalizedTargetLatencyMs,y=ote(p/Math.max(.001,m/1e3),this.minCharsPerSecond,this.maxCharsPerSecond);if(this.currentCps+=(y-this.currentCps)*.2,this.charBudget+=this.currentCps*(h/1e3),this.charBudget<1){this.ensureLoop();return}const k=Math.min(Math.floor(this.charBudget),this.maxCharsPerCommit),g=nte(this.source.slice(this.visible.length),k,this.segmenter);g.text&&(this.visible+=g.text,this.charBudget=Math.max(0,this.charBudget-g.graphemeCount),this.emit()),this.ensureLoop()};const{minCharsPerSecond:n=40,maxCharsPerSecond:o=1e3,targetLatencyMs:s=900,catchUpLatencyMs:i=350,catchUpThreshold:r=600,maxCommitFps:l=30,startDelayMs:a=80,maxCharsPerCommit:c=80,flushOnFinish:u=!1}=e;this.minCharsPerSecond=Ac(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,Ac(o,1e3,1)),this.normalizedTargetLatencyMs=Ac(s,900,1),this.normalizedCatchUpLatencyMs=Ac(i,350,1),this.normalizedCatchUpThreshold=XC(r,600),this.normalizedStartDelayMs=XC(a,80),this.maxCommitFps=Math.trunc(Ac(l,30,1)),this.maxCharsPerCommit=Math.trunc(Ac(c,80,1)),this.flushOnFinish=u,this.segmenter=tte(),t&&this.listeners.add(t),this.currentCps=this.minCharsPerSecond}get pendingChars(){return Math.max(0,this.source.length-this.visible.length)}get caughtUp(){return this.pendingChars===0}get final(){return this.done&&this.caughtUp}ensureLoop(){if(!(this.destroyed||this.rafId||this.paused||this.pendingChars<=0)){if(typeof requestAnimationFrame!="function"){this.flush();return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),this.rafId=0)}emit(){if(!this.destroyed)for(const e of this.listeners)e()}};function ete(e={},t){const n=new Jee(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function tte(){if(typeof Intl>"u")return null;const e=Intl.Segmenter;return e?new e(void 0,{granularity:"grapheme"}):null}function nte(e,t,n){if(!e||t<=0)return{text:"",graphemeCount:0};if(!n){const i=Array.from(e).slice(0,t);return{text:i.join(""),graphemeCount:i.length}}let o="",s=0;for(const i of n.segment(e)){if(s>=t)break;o+=i.segment,s++}return{text:o,graphemeCount:s}}function QC(){return typeof performance<"u"?performance.now():Date.now()}function ote(e,t,n){return Math.min(n,Math.max(t,e))}var ste=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(c){s(c)}},r=a=>{try{l(n.throw(a))}catch(c){s(c)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const Hy=Symbol.for("markstream-vue:node-lifecycle");function e3e(){}const R2=new Map;let sE="material";const Kc=new Map,JC=new Map;let Wy=null;function ite(e){R2.set(e.id,e)}function rte(e){const t=R2.get(sE);if(!t)return;const n=t.core[e];if(n)return n;const o=Kc.get(t.id);if(o){const s=o[e];if(s)return s}t.loadExtended&&!Kc.has(t.id)&&ate(t)}function lte(){var e,t;return(t=(e=R2.get(sE))==null?void 0:e.fallback)!=null?t:""}function ate(e){return ste(this,null,function*(){var t,n,o;if(Kc.has(e.id))return(t=Kc.get(e.id))!=null?t:null;let s=JC.get(e.id);return s||(s=((o=(n=e.loadExtended)==null?void 0:n.call(e))!=null?o:Promise.resolve(null)).then(i=>(Kc.set(e.id,i),Wy?.(),i)).catch(()=>(Kc.set(e.id,null),null)),JC.set(e.id,s)),s})}const e4='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M30 14v-2h-2V8h-2v4h-2V8h-2v4h-2v2h2v2h-2v2h2v4h2v-4h2v4h2v-4h2v-2h-2v-2Zm-4 2h-2v-2h2Zm-12.437 6A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',t4='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',cte={id:"material",core:{"":t4,plain:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',text:t4,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ffca28" d="M2 2v12h12V2zm6 6h1v4a1.003 1.003 0 0 1-1 1H7a1.003 1.003 0 0 1-1-1v-1h1v1h1zm3 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',typescript:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 16 16"><path fill="#0288d1" d="M2 2v12h12V2zm4 6h3v1H8v4H7V9H6zm5 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00bcd4" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#00bcd4" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#00bcd4" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#00bcd4" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#0288d1" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#0288d1" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#0288d1" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#e65100" d="m4 4 2 22 10 2 10-2 2-22Zm19.72 7H11.28l.29 3h11.86l-.802 9.335L15.99 25l-6.635-1.646L8.93 19h3.02l.19 2 3.86.77 3.84-.77.29-4H8.84L8 8h16Z"/></svg>',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#7e57c2" d="M20 18h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 20 22h2v2h2v-2c0-.388-.562-.851-1.254-1.034C20.356 20.34 20 18.84 20 18m-3.254 2.966C14.356 20.34 14 18.84 14 18h-2v-2h-2v8h2v-2h4v2h2v-2c0-.388-.562-.851-1.254-1.034"/><path fill="#7e57c2" d="M24 4H4v20a4 4 0 0 0 4 4h16.16A3.84 3.84 0 0 0 28 24.16V8a4 4 0 0 0-4-4m2 14h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 26 22v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2Z"/></svg>',scss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ec407a" d="M27.837 5.673a4.33 4.33 0 0 0-2.293-2.701c-2.362-1.261-6.11-1.298-9.548-.092a26.3 26.3 0 0 0-8.76 4.966c-2.752 2.542-3.438 4.925-3.189 6.194.523 2.668 3.274 4.539 5.485 6.042.418.284.822.559 1.175.816-1.429.76-4.261 2.444-5.088 4.248a3.88 3.88 0 0 0-.118 3.332A2.37 2.37 0 0 0 6.869 29.8a5.6 5.6 0 0 0 1.49.2 6.35 6.35 0 0 0 5.19-2.856 6.74 6.74 0 0 0 .864-5.382 7.3 7.3 0 0 1 2.044-.03 3.92 3.92 0 0 1 2.816 1.311 1.82 1.82 0 0 1 .423 1.262 1.55 1.55 0 0 1-.772 1.05c-.234.14-.586.355-.504.803.036.194.198.633.894.512a2.93 2.93 0 0 0 2.145-2.651 4 4 0 0 0-1.197-2.904 5.94 5.94 0 0 0-4.396-1.626 10.6 10.6 0 0 0-2.672.304 20 20 0 0 0-2.203-1.846c-1.712-1.3-3.33-2.529-3.235-4.26.125-2.263 2.468-4.532 6.964-6.744 4.016-1.976 7.254-2.037 8.944-1.438a2 2 0 0 1 1.204.883 2.77 2.77 0 0 1-.36 2.47 9.71 9.71 0 0 1-7.425 4.304 3.86 3.86 0 0 1-3.238-.757c-.278-.302-.593-.645-1.074-.383q-.565.31-.225 1.189a3.9 3.9 0 0 0 2.407 1.92 11.7 11.7 0 0 0 7.128-.671c3.527-1.35 6.681-5.202 5.756-8.787M11.895 24.475a4 4 0 0 1-.192.468 4.5 4.5 0 0 1-.753 1.081 2.83 2.83 0 0 1-2.533 1.107c-.056-.032-.078-.146-.085-.193a3.28 3.28 0 0 1 1.076-2.284 11.3 11.3 0 0 1 2.644-1.933 3.85 3.85 0 0 1-.157 1.754"/></svg>',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="#f9a825" d="M560-160v-80h120q17 0 28.5-11.5T720-280v-80q0-38 22-69t58-44v-14q-36-13-58-44t-22-69v-80q0-17-11.5-28.5T680-720H560v-80h120q50 0 85 35t35 85v80q0 17 11.5 28.5T840-560h40v160h-40q-17 0-28.5 11.5T800-360v80q0 50-35 85t-85 35zm-280 0q-50 0-85-35t-35-85v-80q0-17-11.5-28.5T120-400H80v-160h40q17 0 28.5-11.5T160-600v-80q0-50 35-85t85-35h120v80H280q-17 0-28.5 11.5T240-680v80q0 38-22 69t-58 44v14q36 13 58 44t22 69v80q0 17 11.5 28.5T280-240h120v80z"/></svg>',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#0288d1" d="M9.86 2A2.86 2.86 0 0 0 7 4.86v1.68h4.29c.39 0 .71.57.71.96H4.86A2.86 2.86 0 0 0 2 10.36v3.781a2.86 2.86 0 0 0 2.86 2.86h1.18v-2.68a2.85 2.85 0 0 1 2.85-2.86h5.25c1.58 0 2.86-1.271 2.86-2.851V4.86A2.86 2.86 0 0 0 14.14 2zm-.72 1.61c.4 0 .72.12.72.71s-.32.891-.72.891c-.39 0-.71-.3-.71-.89s.32-.711.71-.711"/><path fill="#fdd835" d="M17.959 7v2.68a2.85 2.85 0 0 1-2.85 2.859H9.86A2.85 2.85 0 0 0 7 15.389v3.75a2.86 2.86 0 0 0 2.86 2.86h4.28A2.86 2.86 0 0 0 17 19.14v-1.68h-4.291c-.39 0-.709-.57-.709-.96h7.14A2.86 2.86 0 0 0 22 13.64V9.86A2.86 2.86 0 0 0 19.14 7zM8.32 11.513l-.004.004.038-.004zm6.54 7.276c.39 0 .71.3.71.89a.71.71 0 0 1-.71.71c-.4 0-.72-.12-.72-.71s.32-.89.72-.89"/></svg>',ruby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#f44336" d="M18.041 3.177c2.24.382 2.879 1.919 2.843 3.527V6.67l-1.013 13.266-13.132.897h.008c-1.093-.044-3.518-.151-3.634-3.545l1.217-2.222 2.462 5.74 2.097-6.77-.045.009.018-.018 6.85 2.186L13.945 9.3l6.53-.409-5.144-4.212 2.71-1.51v.009M3.113 17.252v.017zM6.916 6.874c2.63-2.622 6.033-4.168 7.34-2.844 1.297 1.306-.072 4.523-2.702 7.135-2.666 2.613-6.015 4.248-7.322 2.933-1.306-1.324.036-4.612 2.675-7.224z"/></svg>',go:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00acc1" d="M2 12h4v2H2zm-2 4h6v2H0zm4 4h2v2H4zm16.954-5H14v3h3.239a4.42 4.42 0 0 1-3.531 2 2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 15.292 13a2.73 2.73 0 0 1 1.749.584l2.962-1.185A5.6 5.6 0 0 0 15.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 6.4 6.4 0 0 0 .003-1.5"/><path fill="#00acc1" d="M26.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 5.614 5.614 0 0 0-5.659-6.5m2.681 6.137A4.515 4.515 0 0 1 24.708 20a2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 26.292 13a2.65 2.65 0 0 1 2.053.858 2.86 2.86 0 0 1 .628 2.28Z"/></svg>',java:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#f44336" d="M4 26h24v2H4zM28 4H7a1 1 0 0 0-1 1v13a4 4 0 0 0 4 4h10a4 4 0 0 0 4-4v-4h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2m0 8h-4V6h4Z"/></svg>',kotlin:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><defs><linearGradient id="a" x1="1.725" x2="22.185" y1="22.67" y2="1.982" gradientTransform="translate(1.306 1.129)scale(.89324)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7c4dff"/><stop offset=".5" stop-color="#d500f9"/><stop offset="1" stop-color="#ef5350"/></linearGradient></defs><path fill="url(#a)" d="M2.975 2.976v18.048h18.05v-.03l-4.478-4.511-4.48-4.515 4.48-4.515 4.443-4.477z"/></svg>',c:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M19.563 22A5.57 5.57 0 0 1 14 16.437v-2.873A5.57 5.57 0 0 1 19.563 8H24V2h-4.437A11.563 11.563 0 0 0 8 13.563v2.873A11.564 11.564 0 0 0 19.563 28H24v-6Z"/></svg>',cpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M28 14v-4h-2v4h-6v-4h-2v4h-4v2h4v4h2v-4h6v4h2v-4h4v-2z"/><path fill="#0288d1" d="M13.563 22A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',cs:e4,csharp:e4,php:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#1e88e5" d="M12 18.08c-6.63 0-12-2.72-12-6.08s5.37-6.08 12-6.08S24 8.64 24 12s-5.37 6.08-12 6.08m-5.19-7.95c.54 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.58 1.09q-.42.33-1.29.33h-.87l.53-2.76zm-3.5 5.55h1.44l.34-1.75h1.23c.54 0 .98-.06 1.33-.17.35-.12.67-.31.96-.58.24-.22.43-.46.58-.73.15-.26.26-.56.31-.88.16-.78.05-1.39-.33-1.82-.39-.44-.99-.65-1.82-.65H4.59zm7.25-8.33-1.28 6.58h1.42l.74-3.77h1.14c.36 0 .6.06.71.18s.13.34.07.66l-.57 2.93h1.45l.59-3.07c.13-.62.03-1.07-.27-1.36-.3-.27-.85-.4-1.65-.4h-1.27L12 7.35zM18 10.13c.55 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.57 1.09-.29.22-.72.33-1.3.33h-.85l.5-2.76zm-3.5 5.55h1.44l.34-1.75h1.22c.55 0 1-.06 1.35-.17.35-.12.65-.31.95-.58.24-.22.44-.46.58-.73.15-.26.26-.56.32-.88.15-.78.04-1.39-.34-1.82-.36-.44-.99-.65-1.82-.65h-2.75z"/></svg>',shell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',powershell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#03a9f4" d="M29.07 6H7.677A1.535 1.535 0 0 0 6.24 7.113l-4.2 17.774A.852.852 0 0 0 2.93 26h21.393a1.535 1.535 0 0 0 1.436-1.113L29.96 7.112A.852.852 0 0 0 29.07 6M8.626 23.797a1.4 1.4 0 0 1-1.814-.31l-.007-.009a1.075 1.075 0 0 1 .315-1.599l9.6-6.061-6.102-5.852-.01-.01a1.068 1.068 0 0 1 .084-1.625l.037-.03a1.38 1.38 0 0 1 1.8.07l7.233 6.957a1.1 1.1 0 0 1 .236.739 1.08 1.08 0 0 1-.412.79c-.074.04-.146.119-10.951 6.935ZM24 22.94A1.135 1.135 0 0 1 22.803 24h-5.634a1.061 1.061 0 1 1 .001-2.112h5.633A1.134 1.134 0 0 1 24 22.938Z"/></svg>',sql:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ffca28" d="M16 24c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-8c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-12C10.477 4 6 4.895 6 6v4c0 1.1 4.475 2 10 2s10-.9 10-2V6c0-1.105-4.477-2-10-2"/></svg>',yaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#ff5252" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12c0 1.1-.9 2-2 2H6c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2m12 16v-2H9v2zm-4-4v-2H6v2z"/></svg>',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>',xml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#8bc34a" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m.12 13.5 3.74 3.74 1.42-1.41-2.33-2.33 2.33-2.33-1.42-1.41zm11.16 0-3.74-3.74-1.42 1.41 2.33 2.33-2.33 2.33 1.42 1.41z"/></svg>',rust:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ff7043" d="m30 12-4-2V6h-4l-2-4-4 2-4-2-2 4H6v4l-4 2 2 4-2 4 4 2v4h4l2 4 4-2 4 2 2-4h4v-4l4-2-2-4ZM6 16a9.9 9.9 0 0 1 .842-4H10v8H6.842A9.9 9.9 0 0 1 6 16m10 10a9.98 9.98 0 0 1-7.978-4H16v-2h-2v-2h4c.819.819.297 2.308 1.179 3.37a1.89 1.89 0 0 0 1.46.63h3.34A9.98 9.98 0 0 1 16 26m-2-12v-2h4a1 1 0 0 1 0 2Zm11.158 6H24a2.006 2.006 0 0 1-2-2 2 2 0 0 0-2-2 3 3 0 0 0 3-3q0-.08-.004-.161A3.115 3.115 0 0 0 19.83 10H8.022a9.986 9.986 0 0 1 17.136 10"/></svg>',vue:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#41b883" d="M1.791 3.851 12 21.471 22.209 3.936V3.85H18.24l-6.18 10.616L5.906 3.851z"/><path fill="#35495e" d="m5.907 3.851 6.152 10.617L18.24 3.851h-3.723L12.084 8.03 9.66 3.85z"/></svg>',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>'},fallback:'<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',loadExtended:()=>vs(()=>import("./extended-p72mFE2C.js"),[]).then(e=>e.materialExtendedMap)},ute=gr(0);Wy=()=>{ute.value++},ite(cte);const dte={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",plaintext:"plain",text:"plain",txt:"plain","c++":"cpp","c#":"csharp",cs:"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function K1(e){var t;const n=(function(o){if(!o)return"";const s=o.trim();if(!s)return"";const[i]=s.split(/\s+/),[r]=i.split(":");return r.toLowerCase()})(e);return(t=dte[n])!=null?t:n}function t3e(e){const t=K1(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";case"objectivec":return"objective-c";case"objectivecpp":return"objective-cpp";default:return t}}function n3e(e){return rte(K1(e))||lte()}const n4={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",csharp:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"};var G1=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(c){s(c)}},r=a=>{try{l(n.throw(a))}catch(c){s(c)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});let gs=null,Na=!1,Ia=null,Y1=P2;function Vf(e){var t;const n=(t=e?.default)!=null?t:e;return n&&typeof n.renderToString=="function"?n:null}function D2(){try{const e=globalThis;return Vf(e?.katex)}catch{return null}}function P2(){return G1(null,null,function*(){const e=D2();if(e)return e;const t=yield vs(()=>import("./katex-DnlPpQZa.js"),[]);try{yield vs(()=>import("./mhchem-DtR62fUK.js"),__vite__mapDeps([2,3]))}catch{}return Vf(t)})}function iE(e){const t=Promise.resolve(e).then(n=>{var o;return Ia===t&&n?(gs=(o=Vf(n))!=null?o:n,gs):null}).catch(()=>null).finally(()=>{Ia===t&&(Ia=null)});return Ia=t,Na=!0,t}function fte(e){Y1=e,gs=null,Na=!1,Ia=null}function hte(e){fte(P2)}function rE(){return typeof Y1=="function"}function o3e(){var e;const t=Y1;if(!t||t===P2)return null;if(gs)return gs;const n=D2();if(n)return gs=n,gs;if(Na)return null;try{const o=t();return o?typeof o?.then=="function"?(iE(o),null):(gs=(e=Vf(o))!=null?e:o,gs):null}catch{return null}}function lE(){return G1(this,null,function*(){var e;const t=D2();if(t)return gs=t,gs;if(gs)return gs;if(Ia)return Ia;if(Na)return null;const n=Y1;if(!n)return Na=!0,null;try{const o=n();if(typeof o?.then=="function")return iE(o);if(o)return gs=(e=Vf(o))!=null?e:o,Na=!0,gs}catch{}return Na=!0,null})}function aE(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}let Tl=null,wl=null;const Yo=new Map,Ur=new Map;let Af=5;const Pa=new Set;function Vd(){if(Yo.size<Af&&Pa.size){let e=Af-Yo.size;for(const t of Array.from(Pa)){if(e<=0)break;Pa.delete(t),e--;try{t()}catch{}}}}function cE(){for(const e of Array.from(Pa)){Pa.delete(e);try{e()}catch{}}}function pte(e){Tl=e,wl=null,Tl.onmessage=t=>{const{id:n,html:o,error:s}=t.data,i=Yo.get(n);if(i)if(Yo.delete(n),clearTimeout(i.timeoutId),i.cleanup(),Vd(),s)i.aborted||i.reject(new Error(s));else{const{content:r,displayMode:l}=t.data;if(r){const a=`${l?"d":"i"}:${r}`;if(Ur.set(a,o),Ur.size>200){const c=Ur.keys().next().value;Ur.delete(c)}}i.aborted||i.resolve(o)}},Tl.onerror=t=>{console.error("[katexWorkerClient] Worker error:",t);for(const[n,o]of Yo.entries())clearTimeout(o.timeoutId),o.cleanup(),o.aborted||o.reject(new Error(`Worker error: ${t.message}`));Yo.clear(),cE()}}function mte(){var e;for(const t of Yo.values())clearTimeout(t.timeoutId),t.cleanup(),t.aborted||t.reject(new Error("Worker cleared"));Yo.clear(),cE(),Tl&&((e=Tl.terminate)==null||e.call(Tl)),Tl=null,wl=null}function gte(e,t=!0,n=2e3,o){return G1(this,null,function*(){performance.now();const s=aE(e);if(!rE()){const a=new Error("KaTeX rendering disabled");return a.name="KaTeXDisabled",a.code="KATEX_DISABLED",Promise.reject(a)}if(wl)return Promise.reject(wl);const i=`${t?"d":"i"}:${s}`,r=Ur.get(i);if(r)return Vd(),Promise.resolve(r);const l=Tl||(wl=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),wl.name="WorkerInitError",wl.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject(wl);if(Yo.size>=Af){const a=new Error("Worker busy");return a.name="WorkerBusy",a.code="WORKER_BUSY",a.busy=!0,a.inFlight=Yo.size,a.max=Af,Promise.reject(a)}return new Promise((a,c)=>{if(o?.aborted){const m=new Error("Aborted");return m.name="AbortError",void c(m)}const u=Math.random().toString(36).slice(2);let d=null;const f=globalThis.setTimeout(()=>{const m=Yo.get(u);if(!m)return;Yo.delete(u),m.cleanup();const y=new Error("Worker render timed out");y.name="WorkerTimeout",y.code="WORKER_TIMEOUT",m.aborted||m.reject(y),Vd()},n);d=()=>{const m=Yo.get(u);if(!m||m.aborted)return;m.aborted=!0,m.cleanup();const y=new Error("Aborted");y.name="AbortError",c(y)},o&&o.addEventListener("abort",d,{once:!0});const h=a,p=c;Yo.set(u,{resolve:m=>{h(m)},reject:m=>{p(m)},timeoutId:f,aborted:!1,cleanup:()=>{o&&d&&o.removeEventListener("abort",d),d=null}});try{l.postMessage({id:u,content:s,displayMode:t})}catch(m){const y=Yo.get(u);Yo.delete(u),clearTimeout(f),y?.cleanup(),y?.reject(m),Vd()}})})}function s3e(e,t=!0,n){const o=`${t?"d":"i"}:${aE(e)}`;if(Ur.set(o,n),Ur.size>200){const s=Ur.keys().next().value;Ur.delete(s)}}const vte="WORKER_BUSY";function yte(e=2e3,t){return Yo.size<Af?Promise.resolve():new Promise((n,o)=>{let s,i=!1,r=null,l=()=>{};const a=()=>{s&&globalThis.clearTimeout(s),Pa.delete(l),t&&r&&t.removeEventListener("abort",r),r=null};l=()=>{i||(i=!0,a(),n())},Pa.add(l),s=globalThis.setTimeout(()=>{if(i)return;i=!0,a();const c=new Error("Wait for worker slot timed out");c.name="WorkerBusyTimeout",c.code="WORKER_BUSY_TIMEOUT",o(c)},e),queueMicrotask(()=>Vd()),t&&(r=()=>{if(i)return;i=!0,a();const c=new Error("Aborted");c.name="AbortError",o(c)},t.aborted?r():t.addEventListener("abort",r,{once:!0}))})}const ud={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function i3e(e){return G1(this,arguments,function*(t,n=!0,o={}){var s,i,r,l;if(!rE()){const m=new Error("KaTeX rendering disabled");throw m.name="KaTeXDisabled",m.code="KATEX_DISABLED",m}const a=(s=o.timeout)!=null?s:ud.timeout,c=(i=o.waitTimeout)!=null?i:ud.waitTimeout,u=(r=o.backoffMs)!=null?r:ud.backoffMs,d=(l=o.maxRetries)!=null?l:ud.maxRetries,f=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):ud.maxRetries,h=o.signal;let p=0;for(;;){if(h?.aborted){const m=new Error("Aborted");throw m.name="AbortError",m}try{return yield gte(t,n,a,h)}catch(m){if(m?.code!==vte||p>=f)throw m;if(p++,yield yte(c,h).catch(()=>{}),h?.aborted){const y=new Error("Aborted");throw y.name="AbortError",y}u>0&&(yield new Promise(y=>globalThis.setTimeout(y,u*p)))}}})}function Gc(e){const t=typeof e=="number"?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function kte(e){var t;for(const n of e.split(/\r?\n/)){const o=n.trim();if(!o||o.startsWith("%%"))continue;const s=o.match(/^([A-Z][\w-]*)\b/i);return((t=s?.[1])==null?void 0:t.toLowerCase())||""}return""}function Fm(e){const t=e.split(/\r?\n/).map(s=>s.trim()).filter(s=>s&&!s.startsWith("%%")),n=Math.max(1,t.length),o=kte(e);return o==="gantt"?220+28*n:o==="sequencediagram"?180+26*n:o==="classdiagram"||o==="statediagram"||o==="erdiagram"?180+24*n:o==="flowchart"||o==="graph"?170+28*n:200+22*n}function Om(e){const t=e.split(/\r?\n/).filter(n=>/^\s*-\s+/.test(n)).length;return t>=3?500:t>0?280+60*t:360}function uE(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function Bm(e,t=360,n=500){return uE(e,t,n)}function Rm(e,t=360,n=500){return uE(e,t,n)}var bte=Object.defineProperty,xte=Object.defineProperties,wte=Object.getOwnPropertyDescriptors,o4=Object.getOwnPropertySymbols,_te=Object.prototype.hasOwnProperty,Ste=Object.prototype.propertyIsEnumerable,s4=(e,t,n)=>t in e?bte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dE=(e,t)=>{for(var n in t||(t={}))_te.call(t,n)&&s4(e,n,t[n]);if(o4)for(var n of o4(t))Ste.call(t,n)&&s4(e,n,t[n]);return e},i4=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(c){s(c)}},r=a=>{try{l(n.throw(a))}catch(c){s(c)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const Dm=()=>vs(()=>import("./mermaid.core-CHHamN_E.js").then(e=>e.bn),[]);let Tr=null,Yc=Dm,Cd=null,zy=!1,Uy=!1,Ad=0;function Cte(e){Yc=e,Ad++,Tr=null,Cd=null,zy=!1,Uy=!1}function Ate(e){Cte(Dm)}function r4(){return typeof Yc=="function"}function l4(e){if(!e)return e;const t=e&&e.default?e.default:e;if(t&&(typeof t.render=="function"||typeof t.parse=="function"||typeof t.initialize=="function"))return t;if(t&&t.mermaidAPI&&(typeof t.mermaidAPI.render=="function"||typeof t.mermaidAPI.parse=="function")){const s=t.mermaidAPI;return n=dE({},t),o={render:s.render.bind(s),parse:s.parse?s.parse.bind(s):void 0,initialize:i=>typeof t.initialize=="function"?t.initialize(i):s.initialize?s.initialize(i):void 0},xte(n,wte(o))}var n,o;return e.mermaid&&typeof e.mermaid.render=="function"?e.mermaid:t}function a4(e){if(e)try{const t=e?.initialize;e.initialize=n=>{const o=dE({suppressErrorRendering:!0},n||{});return typeof t=="function"?t.call(e,o):e?.mermaidAPI&&typeof e.mermaidAPI.initialize=="function"?e.mermaidAPI.initialize(o):void 0}}catch{}}function r3e(){return i4(this,null,function*(){if(Tr)return Tr;const e=(function(){try{const o=globalThis;return l4(o?.mermaid)}catch{return null}})();if(e)return Tr=e,a4(Tr),Tr;const t=Yc,n=Ad;return t?t===Dm&&zy?null:Cd||(Cd=i4(null,null,function*(){let o;try{o=yield t()}catch(s){if(t===Dm)return n===Ad&&t===Yc&&(zy=!0,(function(i){Uy||(Uy=!0,console.warn('[markstream-vue] Optional dependency "mermaid" is not installed. Mermaid blocks will render as source.',i))})(s)),null;throw s}finally{n===Ad&&t===Yc&&(Cd=null)}return n!==Ad||t!==Yc?null:o?(Tr=l4(o),a4(Tr),Tr):null}),Cd):null})}let $s=null,_l=null;const Di=new Map,ka=new Map;function Op(e){for(const t of Di.values())t.reject(e);Di.clear(),ka.clear()}let c4=5,u4=!1;const Mte="WORKER_BUSY",d4="MERMAID_DISABLED";function Ete(e){if($s&&$s!==e){const n=new Error("Worker replaced");n.code="WORKER_REPLACED",Op(n)}$s=e,_l=null;const t=e;$s.onmessage=n=>{if($s!==t)return;const{id:o,ok:s,result:i,error:r}=n.data,l=Di.get(o);l&&(s===!1||r?l.reject(new Error(r||"Unknown error")):l.resolve(i))},$s.onerror=n=>{var o,s;if($s===t)if(Di.size!==0){try{u4?console.error("[mermaidWorkerClient] Worker error:",n?.message||n):(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker error:",n?.message||n)}catch{}Op(new Error(`Worker error: ${n.message}`))}else(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker error (no pending):",n?.message||n)},$s.onmessageerror=n=>{var o,s;if($s===t)if(Di.size!==0){try{u4?console.error("[mermaidWorkerClient] Worker messageerror:",n):(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker messageerror:",n)}catch{}Op(new Error("Worker messageerror"))}else(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",n)}}function Tte(){var e;if($s)try{Op(new Error("Worker cleared")),(e=$s.terminate)==null||e.call($s)}catch{}$s=null,_l=null}function fE(e,t,n,o){if(!r4()){const r=new Error("Mermaid rendering disabled");return r.name="MermaidDisabled",r.code=d4,Promise.reject(r)}const s=`${e}\0${t.theme}\0${n}\0${t.code}`;let i=ka.get(s);return i||(i=(function(r,l,a=1400){if(!r4()){const u=new Error("Mermaid rendering disabled");return u.name="MermaidDisabled",u.code=d4,Promise.reject(u)}if(_l)return Promise.reject(_l);const c=$s||(_l=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),_l.name="WorkerInitError",_l.code="WORKER_INIT_ERROR",null);if(!c)return Promise.reject(_l);if(Di.size>=c4){const u=new Error("Worker busy");return u.name="WorkerBusy",u.code=Mte,u.inFlight=Di.size,u.max=c4,Promise.reject(u)}return new Promise((u,d)=>{const f=Math.random().toString(36).slice(2);let h,p=!1;const m=()=>{p||(p=!0,h!=null&&globalThis.clearTimeout(h),Di.delete(f))},y={resolve:k=>{m(),u(k)},reject:k=>{m(),d(k)}};Di.set(f,y);try{c.postMessage({id:f,action:r,payload:l})}catch(k){return Di.delete(f),void d(k)}h=globalThis.setTimeout(()=>{const k=new Error("Worker call timed out");k.name="WorkerTimeout",k.code="WORKER_TIMEOUT";const g=Di.get(f);g&&g.reject(k)},a)})})(e,t,n),ka.set(s,i),i.then(()=>{ka.get(s)===i&&ka.delete(s)},()=>{ka.get(s)===i&&ka.delete(s)})),(function(r,l){if(!l)return r;if(l.aborted){const a=new Error("Aborted");return a.name="AbortError",Promise.reject(a)}return new Promise((a,c)=>{let u=()=>{};const d=()=>l.removeEventListener("abort",u);u=()=>{d();const f=new Error("Aborted");f.name="AbortError",c(f)},l.addEventListener("abort",u,{once:!0}),r.then(f=>{d(),a(f)},f=>{d(),c(f)})})})(i,o)}function l3e(e,t,n=1400,o){return fE("canParse",{code:e,theme:t},n,o)}function a3e(e,t,n=1400,o){return fE("findPrefix",{code:e,theme:t},n,o)}var Nte=Object.defineProperty,Ite=Object.defineProperties,Lte=Object.getOwnPropertyDescriptors,f4=Object.getOwnPropertySymbols,$te=Object.prototype.hasOwnProperty,Fte=Object.prototype.propertyIsEnumerable,h4=(e,t,n)=>t in e?Nte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,it=(e,t)=>{for(var n in t||(t={}))$te.call(t,n)&&h4(e,n,t[n]);if(f4)for(var n of f4(t))Fte.call(t,n)&&h4(e,n,t[n]);return e},Ot=(e,t)=>Ite(e,Lte(t)),Zn=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(c){s(c)}},r=a=>{try{l(n.throw(a))}catch(c){s(c)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const Ote="__global__",ov="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",qy=(()=>{const e=globalThis;if(e[ov])return e[ov];const t={scopedCustomComponents:{},revision:gr(0)};return e[ov]=t,t})(),p4=qy.revision,Bte=Symbol("markstreamCustomComponents"),Rte=new Set(["text","paragraph","heading","code_block","list","list_item","blockquote","table","table_row","table_cell","definition_list","definition_item","footnote","footnote_reference","footnote_anchor","admonition","hardbreak","link","image","thematic_break","math_inline","math_block","strong","emphasis","strikethrough","highlight","insert","subscript","superscript","emoji","checkbox","checkbox_input","inline_code","html_inline","html_block","reference","mermaid","infographic","d2","vmr_container"]);function Kf(e){return Rte.has(String(e).trim().toLowerCase())}function Dte(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function sv(e={}){const t={};for(const[n,o]of Object.entries(e))if(o!=null){t[n]=o;for(const s of new Set([Ti(n),Ti(Dte(n))]))!s||Kf(s)||Object.prototype.hasOwnProperty.call(t,s)||(t[s]=o)}return t}function To(e){const t=Jt(Bte,null);return D(()=>{var n;return p4.value,(function(o,s={}){return p4.value,it(it(it({},sv(qy.scopedCustomComponents[Ote]||{})),sv(s)),sv((function(i){return i&&qy.scopedCustomComponents[i]||{}})(o)))})(e?.(),(n=t?.value)!=null?n:{})})}const Pte=["aria-label"],Hte={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-unchecked"},Wte={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-checked"},Mn=(e,t)=>{const n=e.__vccOpts||e;for(const[o,s]of t)n[o]=s;return n},ti=Mn(Je({__name:"CheckboxNode",props:{node:{}},setup:e=>(t,n)=>(x(),E("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(x(),E("svg",Wte,[...n[1]||(n[1]=[w("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),w("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(x(),E("svg",Hte,[...n[0]||(n[0]=[w("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,Pte))}),[["__scopeId","data-v-be21ab83"]]);ti.install=e=>{e.component(ti.__name,ti)};const zte={class:"emoji-node"},Ds=Mn(Je({__name:"EmojiNode",props:{node:{}},setup:e=>(t,n)=>(x(),E("span",zte,R(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);Ds.install=e=>{e.component(Ds.__name,Ds)};const Ute=["id"],qte=["title"],ni=Mn(Je({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const t=`#fnref--${e.node.id}`;function n(){if(typeof document>"u")return;const o=document.querySelector(t);o?o.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${t} not found`)}return(o,s)=>(x(),E("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:n},[w("span",{href:t,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+R(e.node.id)+"]",9,qte)],8,Ute))}}),[["__scopeId","data-v-c1463a29"]]);ni.install=e=>{e.component(ni.__name,ni)};const hE=(()=>{try{return!1}catch{}return!1})();function iv(e){hE&&console.warn(e)}function m4(e,t="safe",n){return B2(e,t,n)}function pE(e){return See(e)}function rv(e){return e===!0?"":e===!1?"false":e==null?null:String(e)}function H2(e,t="safe"){const n=String(e.tag||e.type||"").trim(),o=Fp((s=e.attrs)?Array.isArray(s)?s.every(Array.isArray)?s.map(([r,l])=>[String(r),rv(l)]):s.filter(r=>r&&typeof r=="object"&&!Array.isArray(r)&&"name"in r).map(r=>[String(r.name),rv(r.value)]):Object.entries(s).map(([r,l])=>[r,rv(l)]):null,t,n);var s;if(!o)return;const i=pE(jd(o));return Object.keys(i).length>0?i:void 0}function g4(e,t,n=!1){const o=Object.entries(t??{}),s=o.length>0?o.map(([i,r])=>r===""?` ${i}`:` ${i}="${r}"`).join(""):"";return n?`<${e}${s} />`:`<${e}${s}>`}function dd(e,t){Array.isArray(t)?e.push(...t):t!=null&&e.push(t)}function lv(e,t,n,o,s,i,r=!1){const l=(function(d,f){return X8(d,f)})(e,o);if(zf.has(e.toLowerCase())||!l&&K8(e,i))return null;if(!l&&O2(e,i))return r?[g4(e,t,!0)]:[g4(e,t),...n,`</${e}>`];const a=B2(t,i,e),c=a.key,u=c!=null&&c!==""?c:s;if(l){const d=o[e]||o[e.toLowerCase()],f=pE(a);return Lt(d,Ot(it({},f),{key:u}),n.length>0?n:void 0)}return Lt(e,Ot(it({},a),{innerHTML:void 0,key:u}),n.length>0?n:void 0)}function mE(e,t){return Mee(e,t)}function Pm(e,t,n="safe"){if(!e)return[];try{return(function(i,r,l="safe"){let a=0;const c=[],u=[];for(const d of i)if(d.type==="text")(c.length>0?c[c.length-1].children:u).push(d.content);else if(d.type==="self_closing"){const f=lv(d.tagName,d.attrs||{},[],r,"ms-html-"+a++,l,!0);dd(c.length>0?c[c.length-1].children:u,f)}else if(d.type==="tag_open")c.push({tagName:d.tagName,children:[],attrs:d.attrs,autoKey:"ms-html-"+a++});else if(d.type==="tag_close"){const f=d.tagName.toLowerCase();let h=-1;for(let p=c.length-1;p>=0;p--)if(c[p].tagName.toLowerCase()===f){h=p;break}if(h!==-1)for(;c.length>h;){const p=c.pop(),m=lv(p.tagName,p.attrs||{},p.children,r,p.autoKey,l);c.length>0?dd(c[c.length-1].children,m):dd(u,m),p.tagName.toLowerCase()!==f&&c.length>h&&iv(`Auto-closing unclosed tag: <${p.tagName}>`)}else iv(`Ignoring closing tag with no matching opening tag: </${d.tagName}>`)}for(;c.length>0;){const d=c.pop(),f=lv(d.tagName,d.attrs||{},d.children,r,d.autoKey,l);c.length>0?dd(c[c.length-1].children,f):dd(u,f),iv(`Auto-closing unclosed tag: <${d.tagName}>`)}return u})(Q8(e),t,n)}catch(s){return o=s,hE&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const jte=["innerHTML"],oi=Mn(Je({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=Jt("markstreamHtmlPolicy",void 0),o=D(()=>{var l,a;return(a=(l=t.htmlPolicy)!=null?l:n?.value)!=null?a:"safe"}),s=To(()=>t.customId),i=Je({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=D(()=>{const l=t.node.content;if(!l)return{mode:"html",content:""};if(o.value==="escape")return{mode:"html",content:uu(l,o.value)};if(t.node.loading&&!t.node.autoClosed)return{mode:"text",content:l};if(t.node.loading&&t.node.autoClosed){const c=Pm(l,s.value,o.value);if(c!==null)return{mode:"dynamic",nodes:c}}if(!mE(l,s.value))return{mode:"html",content:uu(l,o.value)};const a=Pm(l,s.value,o.value);return a===null?{mode:"html",content:uu(l,o.value)}:{mode:"dynamic",nodes:a}});return(l,a)=>r.value.mode==="dynamic"?(x(),E("span",{key:0,class:Ue(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},[ae(C(i),{nodes:r.value.nodes},null,8,["nodes"])],2)):r.value.mode==="text"?(x(),E("span",{key:1,class:Ue(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},R(r.value.content),3)):(x(),E("span",{key:2,class:Ue(["html-inline-node",{"html-inline-node--loading":t.node.loading}]),innerHTML:r.value.content},null,10,jte))}}),[["__scopeId","data-v-d17f12b0"]]);oi.install=e=>{e.component(oi.__name,oi)};const Vte={class:"inline-code"},Kte={key:0},as=Mn(Je({__name:"InlineCodeNode",props:{node:{}},setup(e){const t=e,n=Bf(),o=Jt("markstreamFade",void 0),s=Jt("markstreamTextStreamState",void 0),i=Jt("markstreamStreamVersion",void 0),r=D(()=>{const g=n.fade;return g===""||g===!0||g==="true"||g!==!1&&g!=="false"&&void 0}),l=D(()=>typeof r.value=="boolean"?r.value:typeof o?.value!="boolean"||o.value),a=D(()=>{var g;return String((g=t.node.code)!=null?g:"")}),c=D(()=>!l.value),u=D(()=>{var g;const v=(g=n["index-key"])!=null?g:n.indexKey;return v==null||v===""?"":String(v)}),d=oe(t.node.code),f=oe(""),h=oe(0);let p;function m(){p?.(),p=void 0}function y(){m(),f.value&&(d.value=d.value+f.value,f.value="")}et([()=>t.node.code,u,l],([g])=>{const v=String(g??""),b=u.value,A=nE({nextContent:v,persistedContent:b?s?.get(b):void 0,currentState:{settledContent:d.value,streamedDelta:f.value},typewriterEnabled:l.value});d.value=A.settledContent,f.value=A.streamedDelta,A.appended?(h.value+=1,(function(){if(!f.value||p||!i)return;const I=i.value;p=et(()=>i.value,N=>{N!==I&&y()},{flush:"sync"})})()):f.value||m(),b&&s?.set(b,v)},{immediate:!0}),Lf(m);const k=D(()=>h.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(g,v)=>(x(),E("code",Vte,[c.value?(x(),E(We,{key:0},[ot(R(a.value),1)],64)):(x(),E(We,{key:1},[d.value?(x(),E("span",Kte,R(d.value),1)):ue("",!0),f.value?(x(),E("span",{key:1,class:Ue(["inline-code-stream-delta",[k.value]]),onAnimationend:y},R(f.value),35)):ue("",!0)],64))]))}}),[["__scopeId","data-v-4e331c97"]]);as.install=e=>{e.component(as.__name,as)};const jy=oe(!1),v4=oe(""),y4=oe("top"),Kd=oe(null),Gd=oe(null),Vy=oe(null),Ky=oe(null),k4=oe(null);let Bp=null,Rp=null,Gy=0;function gE(){Bp&&(clearTimeout(Bp),Bp=null),Rp&&(clearTimeout(Rp),Rp=null)}let np=!1,op=null,b4=!1;function Gte(e,t,n="top",o=!1,s,i){if(!e)return;const r=++Gy;gE();const l=()=>Zn(null,null,function*(){var a,c;if(yield(function(){return Zn(this,null,function*(){if(!np&&!b4&&typeof document<"u"){op!=null||(op=Zn(null,null,function*(){const[{createApp:u,h:d},{default:f}]=yield Promise.all([vs(()=>import("./vue.runtime.esm-bundler-CCLV9JFt.js"),[]),vs(()=>import("./Tooltip-C_9C69n1.js"),[])]),h=document.createElement("div");h.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(h),u({setup:()=>()=>{var p;return d(f,{visible:jy.value,"anchor-el":Kd.value,content:v4.value,placement:y4.value,id:Gd.value,originX:Vy.value,originY:Ky.value,isDark:(p=k4.value)!=null?p:void 0})}}).mount(h),np=!0}));try{yield op}catch(u){np=!1,op=null,b4=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",u)}}})})(),np&&r===Gy){Gd.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,Kd.value=e,v4.value=t,y4.value=n,Vy.value=(a=s?.x)!=null?a:null,Ky.value=(c=s?.y)!=null?c:null,k4.value=typeof i=="boolean"?i:null,jy.value=!0;try{e.setAttribute("aria-describedby",Gd.value)}catch{}}});o?l():Bp=setTimeout(l,80)}function Yte(e=!1){Gy+=1,gE();const t=()=>{if(Kd.value&&Gd.value)try{Kd.value.removeAttribute("aria-describedby")}catch{}jy.value=!1,Kd.value=null,Gd.value=null,Vy.value=null,Ky.value=null};e?t():Rp=setTimeout(t,120)}const Zte={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."},Xte=Symbol("markstreamI18nFallback");function vE(e,t){var n;return(n=t?.[e])!=null?n:Zte[e]}const Yy=(e,t)=>{var n;return(n=vE(e,t))!=null?n:(function(o){return(o.split(".").pop()||o).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,s=>s.toUpperCase()).trim()})(e)};function x4(e,t){return{t(n){const o=vE(n,t);if(e.te&&o!=null&&!e.te(n))return Yy(n,t);const s=e.t(n);return s===n&&o!=null?Yy(n,t):s}}}function Qte(){const e=(function(){var n,o,s;try{const i=Mo(),r=Xte,l=i?.provides,a=(n=i?.appContext)==null?void 0:n.provides;return(s=(o=l?.[r])!=null?o:a?.[r])!=null?s:null}catch{}return null})(),t=(function(){var n,o;try{const s=Mo(),i=s?.proxy,r=i?.$t;if(typeof r=="function"){const c=i?.$te;return{t:r.bind(i),te:typeof c=="function"?c.bind(i):void 0}}const l=(o=(n=s?.appContext)==null?void 0:n.config)==null?void 0:o.globalProperties,a=l?.$t;if(typeof a=="function"){const c=l?.$te;return{t:a.bind(l),te:typeof c=="function"?c.bind(l):void 0}}}catch{}return null})();if(t)return x4(t,e);try{const n=globalThis.$vueI18nUse||null;if(n&&typeof n=="function")try{const o=n();if(o&&typeof o.t=="function")return x4({t:o.t.bind(o),te:typeof o.te=="function"?o.te.bind(o):void 0},e)}catch{}}catch{}return{t:n=>Yy(n,e)}}const yE=Symbol("ViewportPriority"),kE=Symbol("ViewportPriorityOptions"),bE=Symbol("OffscreenHeavyNodeDeferral"),Jte=D(()=>!1),ja="400px";function W2(){return Jt(kE,void 0)}function z2(){return Jt(bE,Jte)}function ene(e,t){var n,o;const s=typeof window<"u"&&typeof document<"u",i=typeof t=="boolean"?oe(t):t,r=s?(n=window.requestIdleCallback)!=null?n:N=>window.setTimeout(()=>N({didTimeout:!0,timeRemaining:()=>0}),16):null,l=s?(o=window.cancelIdleCallback)!=null?o:N=>window.clearTimeout(N):null,a=new WeakMap;let c=1;const u=new Map,d=new Map,f=new Set;let h=null,p=null;function m(N){if(!N)return"viewport";let M=a.get(N);return M||(M=c++,a.set(N,M)),String(M)}function y(){if(h!=null){try{l?.(h)}catch{}h=null}}function k(N){if(N){const M=u.get(N);if(M&&!M.targets.size){try{M.io.disconnect()}catch{}u.delete(N)}}d.size||f.size||y()}function g(N){const M=d.get(N);if(!M)return;const $=u.get(M.bucketKey);if(!M.visible.value){M.visible.value=!0;try{M.resolve()}catch{}}try{$?.io.unobserve(N)}catch{}$?.targets.delete(N),d.delete(N),f.delete(N),k(M.bucketKey)}function v(){window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&r&&h==null&&f.size&&(h=r(()=>{h=null;const N=f.values().next().value;N&&(f.delete(N),g(N),f.size&&v())},{timeout:1200}))}function b(N,M){if(!s||typeof IntersectionObserver>"u")return null;const $=(function(z,L){var O,U,Z;return{root:(O=e?.(z??null))!=null?O:null,rootMargin:(U=L?.rootMargin)!=null?U:ja,threshold:(Z=L?.threshold)!=null?Z:0}})(N,M),T=[m((F=$).root),F.rootMargin,F.threshold].join("\0");var F;const S=u.get(T);if(S)return{key:T,bucket:S};let B;try{B=new IntersectionObserver(z=>{for(const L of z)(L.isIntersecting||L.intersectionRatio>0)&&g(L.target)},{root:$.root,rootMargin:$.rootMargin,threshold:$.threshold})}catch{return null}const W={io:B,targets:new Map};return u.set(T,W),{key:T,bucket:W}}function A(){if(s&&i.value)for(const[N,M]of Array.from(d.entries())){const $=b(N,M.opts);if(!$){g(N);continue}if($.key===M.bucketKey)continue;const T=M.bucketKey,F=u.get(T);try{F?.io.unobserve(N)}catch{}F?.targets.delete(N),M.bucketKey=$.key,$.bucket.targets.set(N,M),$.bucket.io.observe(N),k(T)}}et(i,N=>{if(!N){for(const M of Array.from(d.keys()))g(M);y()}},{flush:"sync"});const I=(N,M)=>{const $=oe(!1);let T,F=!1;const S=new Promise(L=>{T=()=>{F||(F=!0,L())}}),B=()=>{const L=d.get(N);if(!L)return f.delete(N),void k();const O=u.get(L.bucketKey);try{O?.io.unobserve(N)}catch{}O?.targets.delete(N),d.delete(N),f.delete(N),k(L.bucketKey)};if(!s||!i.value)return $.value=!0,T(),{isVisible:$,whenVisible:S,destroy:B};const W=b(N,M);if(!W)return $.value=!0,T(),{isVisible:$,whenVisible:S,destroy:B};const z={resolve:T,visible:$,bucketKey:W.key,opts:M};return d.set(N,z),W.bucket.targets.set(N,z),W.bucket.io.observe(N),s&&p==null&&(p=window.requestAnimationFrame(()=>{p=null,A()})),M?.allowIdle!==!1&&(f.add(N),v()),{isVisible:$,whenVisible:S,destroy:B}};return I.refresh=A,Ln(yE,I),I}function U2(){var e,t;const n=Jt(yE,void 0);if(n)return n;const o=new WeakMap,s=new Map,i=new Set;let r=null;const l=typeof window<"u"?(e=window.requestIdleCallback)!=null?e:h=>window.setTimeout(()=>h({didTimeout:!0,timeRemaining:()=>0}),16):null,a=typeof window<"u"?(t=window.cancelIdleCallback)!=null?t:h=>window.clearTimeout(h):null,c=()=>{if(r!=null){try{a?.(r)}catch{}r=null}},u=h=>{if(!h)return;const p=s.get(h);if(p&&!p.targets.size){try{p.io.disconnect()}catch{}s.delete(h)}},d=h=>{const p=o.get(h);if(!p)return;const m=s.get(p.bucketKey);if(!p.visible.value){p.visible.value=!0;try{p.resolve()}catch{}}try{m?.io.unobserve(h)}catch{}o.delete(h),m?.targets.delete(h),i.delete(h),u(p.bucketKey),i.size||c()},f=()=>{window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&l&&r==null&&i.size&&(r=l(()=>{r=null;const h=i.values().next().value;h&&(i.delete(h),d(h),i.size&&f())},{timeout:1200}))};return(h,p)=>{const m=oe(!1);let y,k=!1;const g=new Promise(A=>{y=()=>{k||(k=!0,A())}}),v=()=>{const A=o.get(h);if(!A)return i.delete(h),void(i.size||c());const I=s.get(A.bucketKey);try{I?.io.unobserve(h)}catch{}o.delete(h),I?.targets.delete(h),i.delete(h),u(A.bucketKey),i.size||c()},b=(A=>{var I,N;if(typeof window>"u"||typeof IntersectionObserver>"u")return null;const M=(B=>{var W,z;return[(W=B?.rootMargin)!=null?W:ja,(z=B?.threshold)!=null?z:0].join("\0")})(A),$=s.get(M);if($)return{key:M,bucket:$};const T=(I=A?.rootMargin)!=null?I:ja;let F;try{F=new IntersectionObserver(B=>{for(const W of B)(W.isIntersecting||W.intersectionRatio>0)&&d(W.target)},{root:null,rootMargin:T,threshold:(N=A?.threshold)!=null?N:0})}catch{return null}const S={io:F,targets:new Set};return s.set(M,S),{key:M,bucket:S}})(p);return b?(o.set(h,{resolve:y,visible:m,bucketKey:b.key}),b.bucket.targets.add(h),b.bucket.io.observe(h),p?.allowIdle!==!1&&(i.add(h),f()),{isVisible:m,whenVisible:g,destroy:v}):(m.value=!0,y(),{isVisible:m,whenVisible:g,destroy:v})}}function tne(e,t){var n,o;const s=(o=(n=e.indexKey)!=null?n:t["index-key"])!=null?o:t.indexKey;return s==null||s===""?"":String(s)}const nne=["data-markstream-viewport-pending"],one=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],sne={key:1,class:"image-placeholder"},ine={key:1,class:"image-node__raw-text"},rne={key:2,class:"image-shimmer-overlay"},lne={key:1,class:"image-node__raw-text"},ane={key:3,class:"image-error"},Fl=Mn(Je({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:t}){var n,o,s;const i=e,r=t,l=oe(!1),a=oe(!1),c=oe(""),u=oe("primary"),d=oe(null),f=Bf(),h=Jt(Hy,null),p=U2(),m=W2(),y=z2(),k=D(()=>jS(i.node.src)),g=D(()=>jS(i.fallbackSrc)),v=(s=(o=(n=Mo())==null?void 0:n.vnode.el)==null?void 0:o.querySelector)==null?void 0:s.call(o,"img"),b=typeof window<"u"&&v?.getAttribute("src")===(k.value||g.value),A=oe(typeof window>"u"||b||!y.value),I=gr(null);let N="",M=null;const $=D(()=>c.value),T=D(()=>!i.lazy),F=D(()=>typeof window<"u"&&y.value&&!b),S=D(()=>!F.value||A.value),B=D(()=>S.value?$.value:""),W=D(()=>{var he,Ae;return(Ae=(he=m?.value.heavyBlockMargin)!=null?he:m?.value.rootMargin)!=null?Ae:ja}),z=D(()=>!i.node.loading&&u.value!=="failed"&&c.value.length>0),L=D(()=>u.value==="failed"),O=D(()=>(!T.value||F.value&&!A.value)&&!l.value&&!a.value&&u.value!=="failed"&&c.value.length>0),U=D(()=>tne(i,f));function Z(he=U.value){he&&d.value&&h?.reportHeight(he,d.value.offsetHeight)}function ie(he=U.value){he&&yt(()=>{Z(he)})}function q(){M&&(clearTimeout(M),M=null)}function ee(){const he=U.value;he&&N!==he&&(N&&h?.markSettled(N),q(),N=he,h?.markPending(he),typeof window<"u"&&(M=window.setTimeout(()=>{N===he&&(ie(he),fe())},8e3)))}function fe(){return Zn(this,null,function*(){const he=N;he&&(q(),N="",yield yt(),Z(he),h?.markSettled(he))})}function ne(){if(u.value==="primary"&&g.value&&g.value!==c.value)return u.value="fallback",c.value=g.value,l.value=!1,a.value=!1,void ie();u.value="failed",a.value=!0,r("error",c.value),ie()}function j(){l.value=!0,a.value=!1,r("load",$.value),ie()}function K(he){he.preventDefault(),l.value&&!a.value&&r("click",[he,$.value])}const{t:ve}=Qte();return et([k,g,()=>i.node.loading],()=>(l.value=!1,a.value=!1,i.node.loading||k.value?(c.value=k.value,void(u.value="primary")):g.value?(c.value=g.value,void(u.value="fallback")):(c.value="",u.value="failed",void(a.value=!0))),{immediate:!0}),typeof window<"u"&&et([d,F],([he,Ae],re,Y)=>{var Q;if((Q=I.value)==null||Q.destroy(),I.value=null,!Ae||A.value)return void(A.value=!0);if(!he)return void(A.value=!1);let P=!0;const G=p(he,{rootMargin:W.value,allowIdle:!1});I.value=G,A.value=G.isVisible.value,G.whenVisible.then(()=>{P&&I.value===G&&(A.value=!0)}),Y(()=>{P=!1,G.destroy(),I.value===G&&(I.value=null)})},{immediate:!0}),et([z,l,a,$,()=>i.lazy,S],([he,Ae,re,Y,Q,P])=>he&&Y&&!re&&P?Ae?(fe(),void ie()):Q?(ee(),void ie()):void(Ae||re||ee()):(fe(),void ie()),{flush:"post",immediate:!0}),ho(()=>{var he;(he=I.value)==null||he.destroy(),I.value=null,(function(){const Ae=N;Ae&&(q(),N="",h?.markSettled(Ae))})()}),(he,Ae)=>{var re,Y,Q,P,G;return x(),E("span",{ref_key:"rootRef",ref:d,class:"image-node-container","data-markstream-viewport-pending":F.value&&!A.value?"true":void 0},[z.value?(x(),E("img",{key:0,src:B.value||void 0,alt:String((Y=(re=i.node.alt)!=null?re:i.node.title)!=null?Y:""),title:String((P=(Q=i.node.title)!=null?Q:i.node.alt)!=null?P:""),class:Ue(["image-node__img",{"is-loading":!T.value&&!l.value,"is-loaded":T.value||l.value,"has-natural-size":l.value,"cursor-pointer":l.value}]),loading:i.lazy?"lazy":void 0,fetchpriority:T.value?"high":void 0,decoding:T.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":(G=i.node.alt)!=null?G:C(ve)("image.preview"),onError:ne,onLoad:j,onClick:K},null,42,one)):ue("",!0),e.node.loading&&!a.value?(x(),E("span",sne,[i.usePlaceholder?jn(he.$slots,"placeholder",{key:0,node:i.node,displaySrc:$.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[Ae[0]||(Ae[0]=w("span",{class:"image-shimmer"},null,-1))],!0):(x(),E("span",ine,R(e.node.raw),1))])):ue("",!0),O.value&&!e.node.loading?(x(),E("span",rne,[i.usePlaceholder?jn(he.$slots,"placeholder",{key:0,node:i.node,displaySrc:$.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[Ae[1]||(Ae[1]=w("span",{class:"image-shimmer"},null,-1))],!0):(x(),E("span",lne,R(e.node.raw),1))])):ue("",!0),L.value?(x(),E("span",ane,[jn(he.$slots,"error",{node:i.node,displaySrc:$.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[Ae[2]||(Ae[2]=w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[w("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),w("span",null,R(C(ve)("image.loadError")),1)],!0)])):ue("",!0)],8,nne)}}}),[["__scopeId","data-v-046e82ac"]]);Fl.install=e=>{e.component(Fl.__name,Fl)};const cne={key:2},vr=Je({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const t=e,n=To(()=>t.customId),o=Jt("markstreamHtmlPolicy",void 0),s=Jt("markstreamNestedRendererProps",void 0),i=D(()=>{var p;return(p=o?.value)!=null?p:"safe"}),r=D(()=>{var p,m;const y=(p=s?.value)!=null?p:{};return Ot(it({},y),{customId:(m=t.customId)!=null?m:y.customId,htmlPolicy:i.value})}),l=Hi({loader:()=>Promise.resolve().then(()=>eb),suspensible:!1}),a=D(()=>t.components[String(t.node.type)]),c=D(()=>!!(a.value&&n.value[t.node.type]&&!Kf(String(t.node.type)))),u=D(()=>c.value?H2(t.node,i.value):void 0),d=D(()=>Array.isArray(t.node.children)&&t.node.children.length>0),f=D(()=>{var p;return String((p=t.node.content)!=null?p:"")}),h=D(()=>{var p,m;return String((m=(p=t.node.content)!=null?p:t.node.raw)!=null?m:"")});return(p,m)=>a.value&&c.value?(x(),Se(Ho(a.value),Sn({key:0},u.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":r.value.isDark}),{default:Ie(()=>[d.value?(x(),Se(C(l),Sn({key:0},r.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):f.value?(x(),Se(C(l),Sn({key:1},r.value,{content:f.value,final:!e.node.loading,"index-key":`${e.indexKey||"child"}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ue("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark"])):a.value?(x(),Se(Ho(a.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,["node","custom-id","index-key"])):e.fallbackToText?(x(),E("span",cne,R(h.value),1)):ue("",!0)}}),w4=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function une(e){var t;if(typeof e=="boolean")return e;if(e&&typeof e=="object"){const n=e;return Ot(it(it({},w4),n),{enabled:(t=n.enabled)==null||t})}return it({},w4)}function q2(e,t){if(e.renderSideBySide===!1)return!0;if(e.useInlineViewWhenSpaceIsLimited!==!0)return!1;const n=e.renderSideBySideInlineBreakpoint,o=typeof n=="number"&&Number.isFinite(n)?n:900;return t>0&&t<=o}function xE(e){var t,n;const o=(n=(t=String(e??"").split(/\r?\n/,1)[0])==null?void 0:t.trim())!=null?n:"";if(o.length<3)return"";const s=o[0];if(s!=="`"&&s!=="~"||o[1]!==s||o[2]!==s)return"";let i=3;for(;o[i]===s;)i+=1;return o.slice(i).trim()}function _4(e){var t;return((t=String(e??"").trim().split(/\s+/,1)[0])!=null?t:"")==="diff"}function dne(e){var t;return e.diff===!0||_4(e.language)||_4(xE(String((t=e.raw)!=null?t:"")))}function fne(e,t,n){const o=(function(s){const i=xE(s);if(!i)return"";const r=i.split(/\s+/).filter(Boolean);if(!r.length)return"";const l=r[0]==="diff"?r.slice(1):r;for(const a of l){const c=a.includes(":")?a.slice(a.indexOf(":")+1):a;if(c&&/[./\\-]/.test(c))return c}return""})(e);return{title:o||t,caption:o?n?`Diff / ${t}`:t:""}}const hne=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],pne={key:0,translate:"no",class:"markstream-pre__diff-code"},mne={class:"markstream-pre__diff-pane-content"},gne={class:"markstream-pre__diff-number","aria-hidden":"true"},vne={class:"markstream-pre__diff-content"},yne={class:"markstream-pre__diff-content-inner"},kne={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},bne=["textContent"],xne=["textContent"],Fs=Je({__name:"PreCodeNode",props:{node:{},loading:{type:Boolean},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},diffHideUnchangedRegions:{type:[Boolean,Object]},reservedHeightPx:{}},setup(e){const t=e;function n(j,K){const ve=String(j??"");return K?ve:ve.replace(/\r\n$|\n$|\r$/,"")}const o=D(()=>{var j,K,ve;const he=String((K=(j=t.node)==null?void 0:j.language)!=null?K:"");return String((ve=String(he).split(/\s+/g)[0])!=null?ve:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),s=D(()=>`language-${o.value}`),i=D(()=>{var j;return t.loading===!0||((j=t.node)==null?void 0:j.loading)===!0}),r=D(()=>{var j;return n((j=t.node)==null?void 0:j.code,i.value)});let l="",a=1;const c=D(()=>(function(j){let K=0,ve=1;j.startsWith(l)&&(K=l.length,ve=a,K>0&&j[K-1]==="\r"&&j[K]===`
286
286
  `&&K++);for(let he=K;he<j.length;he++)j[he]===`
287
287
  `?ve++:j[he]==="\r"&&(ve++,j[he+1]===`
288
288
  `&&he++);return l=j,a=ve,ve})(r.value)),u=D(()=>r.value.split(/\r\n|\n|\r/));let d=0,f="";const h=D(()=>{const j=c.value;j<d&&(d=0,f="");for(let K=d+1;K<=j;K++)f+=`${f?`
289
- `:""}${K}`;return d=j,f}),p=D(()=>{var j;return t.showLineNumbers===!0&&((j=t.node)==null?void 0:j.diff)===!0}),m=D(()=>p.value&&t.diffInline===!0),y=D(()=>{const j=Number(t.reservedHeightPx);if(!Number.isFinite(j)||j<=0)return;const K=`${Math.ceil(j)}px`;return i.value?{maxHeight:K,overflow:"auto"}:{height:K,minHeight:K,maxHeight:K,overflow:"auto"}}),k=["diff ","index ","--- ","+++ ","@@ "];function g(j){return String(j??"").trim().length===0}function v(j,K="context",ve={}){const he=g(j);return{code:j,kind:he&&K!=="hunk"&&K!=="spacer"&&!ve.preserveBlankKind?"context":K,empty:he}}function b(j){const K=n(j,i.value);return K?K.split(/\r\n|\n|\r/):[]}function A(j,K){return!g(j[K])||K<j.length-1}function I(j){return j.startsWith("-")&&!j.startsWith("---")}function N(j){return j.startsWith("+")&&!j.startsWith("+++")}function M(j){return j.some(K=>k.some(ve=>K.startsWith(ve)))}function $(j,K){return K||!j.startsWith(" ")||j.startsWith(" ")?j:` ${j}`}function T(j,K){const ve=j.length,he=K.length,Ae=[];let re=0;for(;re<ve&&re<he&&j[re]===K[re];)Ae.push({originalIndex:re,modifiedIndex:re}),re++;const Y=[];let Q=ve-1,P=he-1;for(;Q>=re&&P>=re&&j[Q]===K[P];)Y.unshift({originalIndex:Q,modifiedIndex:P}),Q--,P--;const G=Q-re+1,me=P-re+1;if(G<=0||me<=0||i.value||(G+1)*(me+1)>15e5)return Ae.concat(Y);const ye=me+1,de=new Uint32Array((G+1)*(me+1));for(let ke=G-1;ke>=0;ke--)for(let Ne=me-1;Ne>=0;Ne--){const qe=ke*ye+Ne;if(j[re+ke]===K[re+Ne])de[qe]=de[(ke+1)*ye+Ne+1]+1;else{const be=de[(ke+1)*ye+Ne],xe=de[ke*ye+Ne+1];de[qe]=be>=xe?be:xe}}const V=[];let se=0,pe=0;for(;se<G&&pe<me;)j[re+se]===K[re+pe]?(V.push({originalIndex:re+se,modifiedIndex:re+pe}),se++,pe++):de[(se+1)*ye+pe]>=de[se*ye+pe+1]?se++:pe++;return Ae.concat(V,Y)}function F(j){var K;const ve=(function(){var P,G;const me=t.diffHideUnchangedRegions;if(me==null||me===!1)return null;const ye=me===!0?{}:me;return ye.enabled===!1?null:{contextLineCount:Math.max(0,Math.floor((P=ye.contextLineCount)!=null?P:2)),minimumLineCount:Math.max(1,Math.floor((G=ye.minimumLineCount)!=null?G:4))}})();if(!ve||j.length<1||j.length>2||j.length===2&&j[0].lines.length!==j[1].lines.length)return j;const he=j[0].lines,Ae=(K=j[1])==null?void 0:K.lines,re=P=>he[P].kind==="context"&&(Ae===void 0||Ae[P].kind==="context"&&he[P].code===Ae[P].code),Y=[];let Q=0;for(;Q<he.length;){const P=Q;for(;Q<he.length&&re(Q);)Q++;const G=Q;if(G-P>=ve.minimumLineCount){const me=P+(P===0?0:ve.contextLineCount),ye=G-(G===he.length?0:ve.contextLineCount);ye-me>=ve.minimumLineCount&&Y.push({start:me,end:ye})}Q===P&&Q++}return Y.length?j.map((P,G)=>{const me=[];let ye=0;for(const de of Y)me.push(...P.lines.slice(ye,de.start)),me.push({code:G===0?"Unmodified lines":"",kind:"collapsed",empty:!1,key:`${P.key}-collapsed-${de.start}-${de.end}`,number:""}),ye=de.end;return me.push(...P.lines.slice(ye)),Ot(it({},P),{lines:me})}):j}const S=D(()=>{var j,K,ve,he;if(!p.value)return[];const Ae=(function(G){const me=G.some(de=>I(de)),ye=G.some(de=>N(de));return me&&ye||(function(){var de,V,se,pe;if(o.value==="diff")return!0;const ke=(pe=(se=String((V=(de=t.node)==null?void 0:de.raw)!=null?V:"").split(/\r?\n/,1)[0])==null?void 0:se.trim())!=null?pe:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(ke)})()&&(me||ye)})(u.value),re=(function(){var G,me;return((G=t.node)==null?void 0:G.originalCode)!=null||((me=t.node)==null?void 0:me.updatedCode)!=null})();if(m.value){const G=re?(function(me,ye){const de=b(me),V=b(ye),se=T(de,V);if(se.length>0){const xe=[];let Ze=0,tt=0;for(const lt of se){for(;Ze<lt.originalIndex;)xe.push(Ot(it({},v(de[Ze],"removed",{preserveBlankKind:A(de,Ze)})),{key:`inline-removed-source-${Ze}`,number:Ze+1})),Ze++;for(;tt<lt.modifiedIndex;)xe.push(Ot(it({},v(V[tt],"added",{preserveBlankKind:A(V,tt)})),{key:`inline-added-source-${tt}`,number:tt+1})),tt++;xe.push(Ot(it({},v(V[lt.modifiedIndex])),{key:`inline-context-source-${lt.originalIndex}-${lt.modifiedIndex}`,number:lt.modifiedIndex+1})),Ze=lt.originalIndex+1,tt=lt.modifiedIndex+1}for(;Ze<de.length;)xe.push(Ot(it({},v(de[Ze],"removed",{preserveBlankKind:A(de,Ze)})),{key:`inline-removed-source-${Ze}`,number:Ze+1})),Ze++;for(;tt<V.length;)xe.push(Ot(it({},v(V[tt],"added",{preserveBlankKind:A(V,tt)})),{key:`inline-added-source-${tt}`,number:tt+1})),tt++;return xe}const pe=[];let ke=0,Ne=de.length-1,qe=V.length-1;for(;ke<=Ne&&ke<=qe&&de[ke]===V[ke];)pe.push(Ot(it({},v(V[ke])),{key:`inline-prefix-${ke}`,number:ke+1})),ke++;const be=[];for(;Ne>=ke&&qe>=ke&&de[Ne]===V[qe];)be.unshift(Ot(it({},v(V[qe])),{key:`inline-suffix-${qe}`,number:qe+1})),Ne--,qe--;for(let xe=ke;xe<=Ne;xe++)pe.push(Ot(it({},v(de[xe],"removed",{preserveBlankKind:A(de,xe)})),{key:`inline-removed-source-${xe}`,number:xe+1}));for(let xe=ke;xe<=qe;xe++)pe.push(Ot(it({},v(V[xe],"added",{preserveBlankKind:A(V,xe)})),{key:`inline-added-source-${xe}`,number:xe+1}));return pe.concat(be)})((j=t.node)==null?void 0:j.originalCode,(K=t.node)==null?void 0:K.updatedCode):(function(me){const ye=[];let de=1,V=1;const se=M(me);for(const[pe,ke]of me.entries())if(ke.startsWith("@@")){const Ne=ke.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);Ne&&(de=Number(Ne[1]),V=Number(Ne[2])),ye.push(Ot(it({},v(ke,"hunk")),{key:`inline-hunk-${pe}`,number:""}))}else if(I(ke))ye.push(Ot(it({},v($(ke.slice(1),se),"removed",{preserveBlankKind:!0})),{key:`inline-removed-${pe}`,number:de++}));else if(N(ke))ye.push(Ot(it({},v($(ke.slice(1),se),"added",{preserveBlankKind:!0})),{key:`inline-added-${pe}`,number:V++}));else{const Ne=se&&ke.startsWith(" ")?ke.slice(1):ke;ye.push(Ot(it({},v(Ne)),{key:`inline-context-${pe}`,number:V})),de++,V++}return ye})(u.value);return F([{key:"inline",className:"markstream-pre__diff-pane--inline",lines:G}])}if(!Ae&&re)return(function(G,me){const ye=b(G),de=b(me),V=T(ye,de),se=[],pe=[];let ke=0,Ne=0,qe=0;const be=(xe,Ze)=>{const tt=Math.max(xe-ke,Ze-Ne);for(let lt=0;lt<tt;lt++){const ut=ke+lt,mt=Ne+lt;se.push(ut<xe?Ot(it({},v(ye[ut],"removed",{preserveBlankKind:A(ye,ut)})),{key:`original-changed-${qe}-${ut}`,number:ut+1}):Ot(it({},v("","spacer")),{key:`original-spacer-${qe}-${lt}`,number:""})),pe.push(mt<Ze?Ot(it({},v(de[mt],"added",{preserveBlankKind:A(de,mt)})),{key:`modified-changed-${qe}-${mt}`,number:mt+1}):Ot(it({},v("","spacer")),{key:`modified-spacer-${qe}-${lt}`,number:""}))}ke=xe,Ne=Ze,qe++};for(const xe of V)be(xe.originalIndex,xe.modifiedIndex),se.push(Ot(it({},v(ye[xe.originalIndex])),{key:`original-context-${xe.originalIndex}-${xe.modifiedIndex}`,number:xe.originalIndex+1})),pe.push(Ot(it({},v(de[xe.modifiedIndex])),{key:`modified-context-${xe.originalIndex}-${xe.modifiedIndex}`,number:xe.modifiedIndex+1})),ke=xe.originalIndex+1,Ne=xe.modifiedIndex+1;return be(ye.length,de.length),F([{key:"original",className:"markstream-pre__diff-pane--original",lines:se},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:pe}])})((ve=t.node)==null?void 0:ve.originalCode,(he=t.node)==null?void 0:he.updatedCode);const Y=[],Q=[],P=M(u.value);for(const G of u.value)if(G.startsWith("@@"))Y.push(v(G,"hunk")),Q.push(v(G,"hunk"));else if(G.startsWith("-")&&!G.startsWith("---"))Y.push(v($(G.slice(1),P),"removed",{preserveBlankKind:!0}));else if(G.startsWith("+")&&!G.startsWith("+++"))Q.push(v($(G.slice(1),P),"added",{preserveBlankKind:!0}));else{const me=P&&G.startsWith(" ")?G.slice(1):G;Y.push(v(me)),Q.push(v(me))}return F([{key:"original",className:"markstream-pre__diff-pane--original",lines:Y.map((G,me)=>Ot(it({},G),{key:`original-${me}`,number:me+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:Q.map((G,me)=>Ot(it({},G),{key:`modified-${me}`,number:me+1}))}])}),B=D(()=>S.value.some(j=>j.lines.some(K=>K.kind==="collapsed"))),W=D(()=>{const j=o.value;return j?`Code block: ${j}`:"Code block"}),z=oe(null),L=oe([]);let O=null,U=!1,Z=null;function ie(j){const K=Number.parseFloat(String(j??""));return Number.isFinite(K)&&K>0?K:0}function q(j,K){var ve;if(!j)return K;if(j.classList.contains("markstream-pre__diff-line--collapsed"))return 32;const he=j.querySelector(".markstream-pre__diff-content"),Ae=he?.getBoundingClientRect(),re=(ve=Ae?.height)!=null?ve:0;return Math.max(K,Math.ceil(re))}function ee(){U||typeof window>"u"||(O!=null&&window.cancelAnimationFrame(O),O=window.requestAnimationFrame(()=>{O=null,U||(function(){var j,K;O=null;const ve=z.value;if(!ve||!p.value||m.value||!ve.classList.contains("is-wrap"))return void(L.value.length&&(L.value=[]));const he=(function(me){const ye=window.getComputedStyle(me),de=ie(ye.getPropertyValue("--markstream-pre-diff-line-height"));if(de>0)return de;const V=ie(ye.lineHeight);return V>0?V:18})(ve),Ae=Array.from(ve.querySelectorAll(".markstream-pre__diff-pane--original .markstream-pre__diff-line")),re=Array.from(ve.querySelectorAll(".markstream-pre__diff-pane--modified .markstream-pre__diff-line")),Y=Math.max(Ae.length,re.length),Q=[];for(let me=0;me<Y;me++){const ye=q((j=Ae[me])!=null?j:null,he),de=q((K=re[me])!=null?K:null,he),V=Math.max(he,ye,de);Q.push({rowHeight:V,originalHeight:ye,modifiedHeight:de})}var P,G;P=L.value,G=Q,P.length===G.length&&P.every((me,ye)=>{const de=G[ye];return de&&Math.abs(me.rowHeight-de.rowHeight)<=.5&&Math.abs(me.originalHeight-de.originalHeight)<=.5&&Math.abs(me.modifiedHeight-de.modifiedHeight)<=.5})||(L.value=Q)})()}))}function fe(j){Z?.disconnect(),Z=null,j&&p.value&&!m.value&&typeof ResizeObserver<"u"&&(Z=new ResizeObserver(()=>{ee()}),Z.observe(j))}function ne(j,K){const ve=L.value[j];if(!ve)return;const he=K==="original"?ve.originalHeight:ve.modifiedHeight;return{"--markstream-pre-diff-synced-row-height":`${Math.ceil(ve.rowHeight)}px`,"--markstream-pre-diff-content-height":`${Math.ceil(he)}px`}}return et(z,j=>{fe(j),yt(()=>ee())},{flush:"post"}),et([p,m,S],()=>{fe(z.value),yt(()=>ee())},{flush:"post",immediate:!0}),ho(()=>{U=!0,O!=null&&(window.cancelAnimationFrame(O),O=null),Z?.disconnect(),Z=null}),(j,K)=>(x(),E("pre",{ref_key:"preRef",ref:z,style:on(y.value),class:Ue([s.value,{"markstream-pre--line-numbers":t.showLineNumbers,"markstream-pre--diff-preview":p.value,"markstream-pre--diff-inline":m.value,"markstream-pre--diff-collapsed":B.value}]),"aria-busy":i.value,"aria-label":W.value,"data-language":o.value,"data-markstream-line-numbers":t.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[p.value?(x(),E("code",pne,[(x(!0),E(We,null,rt(S.value,ve=>(x(),E("span",{key:ve.key,class:Ue(["markstream-pre__diff-pane",ve.className])},[w("span",mne,[(x(!0),E(We,null,rt(ve.lines,(he,Ae)=>(x(),E("span",{key:he.key,class:Ue(["markstream-pre__diff-line",[`markstream-pre__diff-line--${he.kind}`,{"markstream-pre__diff-line--empty":he.empty}]]),style:on(ne(Ae,ve.key))},[K[0]||(K[0]=w("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),w("span",gne,R(he.number),1),w("span",vne,[w("span",yne,R(he.code),1)])],6))),128))])],2))),128))])):(x(),E(We,{key:1},[t.showLineNumbers?(x(),E("span",kne,[w("span",{class:"markstream-pre__line-numbers-text",textContent:R(h.value)},null,8,bne)])):ue("",!0),w("code",{translate:"no",class:"markstream-pre__code",textContent:R(r.value)},null,8,xne)],64))],14,hne))}});Fs.install=e=>{e.component(Fs.__name,Fs)};const wne={key:0},mo=Mn(Je({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const t=e,n=Bf(),o=Jt("markstreamFade",void 0),s=Jt("markstreamTextStreamState",void 0),i=Jt("markstreamStreamVersion",void 0),r=D(()=>{const y=n.fade;return y===""||y===!0||y==="true"||y!==!1&&y!=="false"&&void 0}),l=D(()=>typeof r.value=="boolean"?r.value:typeof o?.value!="boolean"||o.value),a=D(()=>{var y;const k=(y=n["index-key"])!=null?y:n.indexKey;return k==null||k===""?"":String(k)}),c=oe(t.node.content),u=oe(""),d=oe(0);let f;function h(){f?.(),f=void 0}function p(){h(),u.value&&(c.value=c.value+u.value,u.value="")}et([()=>t.node.content,a,l],([y])=>{const k=String(y??""),g=a.value,v=nE({nextContent:k,persistedContent:g?s?.get(g):void 0,currentState:{settledContent:c.value,streamedDelta:u.value},typewriterEnabled:l.value});c.value=v.settledContent,u.value=v.streamedDelta,v.appended?(d.value+=1,(function(){if(!u.value||f||!i)return;const b=i.value;f=et(()=>i.value,A=>{A!==b&&p()},{flush:"sync"})})()):u.value||h(),g&&s?.set(g,k)},{immediate:!0}),Lf(h);const m=D(()=>d.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(y,k)=>(x(),E("span",{class:Ue([[e.node.center?"text-node-center":""],"text-node"])},[c.value?(x(),E("span",wne,R(c.value),1)):ue("",!0),u.value?(x(),E("span",{key:1,class:Ue(["text-node-stream-delta",[m.value]]),onAnimationend:p},R(u.value),35)):ue("",!0)],2))}}),[["__scopeId","data-v-a7e90764"]]);function Md(e,t,n){return Je({name:e,inheritAttrs:!1,setup(o,{attrs:s,slots:i}){var r,l;const a=U2(),c=W2(),u=z2(),d=typeof window<"u"&&((l=(r=Mo())==null?void 0:r.vnode.el)==null?void 0:l.nodeType)===1,f=oe(typeof window>"u"||d||!u.value),h=gr(null);let p=null;function m(y){const k=y&&"$el"in y?y.$el:y;h.value=k instanceof HTMLElement?k:null}return typeof window<"u"&&et([h,u],([y,k],g,v)=>{if(p?.destroy(),p=null,!k||f.value)return void(f.value=!0);if(!y)return;let b=!0;const A=a(y,{rootMargin:c?.value.heavyBlockMargin,allowIdle:!1});p=A,f.value=A.isVisible.value,A.whenVisible.then(()=>{b&&p===A&&(f.value=!0)}),v(()=>{b=!1,A.destroy(),p===A&&(p=null)})},{immediate:!0}),ho(()=>{p?.destroy(),p=null}),()=>Lt(f.value?t:n,Ot(it({},s),{ref:m}),i)}})}mo.install=e=>{e.component(mo.__name,mo)};const Hm=Je({name:"CodeBlockNodeLoading",inheritAttrs:!1,props:["node","isDark","loading","stream","theme","darkTheme","lightTheme","isShowPreview","monacoOptions","enableFontSizeControl","minWidth","maxWidth","themes","showHeader","showCopyButton","showExpandButton","showPreviewButton","showCollapseButton","showFontSizeButtons","showTooltips","htmlPreviewAllowScripts","htmlPreviewSandbox","customId","estimatedHeightPx","estimatedContentHeightPx","estimatedDiffInline"],emits:["previewCode","copy"],setup(e,{attrs:t}){const n=e;return()=>{var o,s,i,r,l,a,c;const u=K1(String((s=(o=n.node)==null?void 0:o.language)!=null?s:"")),d=n4[u]||(u?u.charAt(0).toUpperCase()+u.slice(1):n4[""]),f=dne(n.node),h=fne(String((r=(i=n.node)==null?void 0:i.raw)!=null?r:""),d,f),p=n.monacoOptions,m=f&&((l=n.estimatedDiffInline)!=null?l:q2(p??{},typeof window>"u"?0:window.innerWidth)),y=p?.diffAppearance,k=y==="dark"||y!=="light"&&n.isDark===!0,g=typeof p?.fontSize=="number"&&Number.isFinite(p.fontSize)&&p.fontSize>0?p.fontSize:12,v=typeof p?.lineHeight=="number"&&Number.isFinite(p.lineHeight)&&p.lineHeight>0?p.lineHeight:g===12?18:Math.max(12,Math.round(1.5*g)),b=typeof p?.tabSize=="number"&&Number.isFinite(p.tabSize)&&p.tabSize>0?p.tabSize:4,A=f?0:8,I=typeof((a=p?.padding)==null?void 0:a.top)=="number"&&Number.isFinite(p.padding.top)&&p.padding.top>=0?p.padding.top:A,N=typeof((c=p?.padding)==null?void 0:c.bottom)=="number"&&Number.isFinite(p.padding.bottom)&&p.padding.bottom>=0?p.padding.bottom:A,M=typeof p?.fontFamily=="string"?p.fontFamily.trim():"",$=it(it({fontSize:`${g}px`,lineHeight:`${v}px`,tabSize:b,paddingTop:`${I}px`,paddingBottom:`${N}px`,"--markstream-pre-line-number-top":`${I}px`},f?{"--markstream-pre-diff-line-height":`${v}px`}:{}),M?{"--markstream-code-font-family":M}:{}),T=()=>Lt("button",{class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0","aria-hidden":"true",disabled:!0,tabindex:-1,type:"button"},[Lt("svg",{class:"action-icon"})]),F=n.isShowPreview!==!1&&(u==="html"||u==="svg"),S=n.showFontSizeButtons!==!1&&n.enableFontSizeControl!==!1||n.showExpandButton!==!1||F&&n.showPreviewButton!==!1,B=z=>{if(z!=null)return typeof z=="number"?`${z}px`:String(z)},W=it(it(it({"--markstream-code-layout-character-width":"1ch"},B(n.minWidth)?{minWidth:B(n.minWidth)}:{}),B(n.maxWidth)?{maxWidth:B(n.maxWidth)}:{}),f?{}:{color:"var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))",backgroundColor:"var(--vscode-editor-background, var(--markstream-code-fallback-bg, var(--code-bg)))",borderColor:"var(--markstream-code-border-color, var(--code-border))"});return Lt("div",Ot(it({},t),{class:["code-block-container","rounded-lg","border",{dark:n.isDark===!0,"is-rendering":n.loading!==!1,"is-dark":k,"is-diff":f,"is-plain-text":u===""||u==="plaintext"||u==="text"},t.class],style:[W,t.style],"data-markstream-code-block":"1","data-markstream-enhanced":"false","data-markstream-code-block-state":n.loading?"streaming":"settled","data-markstream-code-loading":"1"}),[n.showHeader===!1?null:Lt("div",{class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},[Lt("div",{class:"code-header-main"},[Lt("span",{class:"icon-slot h-4 w-4 flex-shrink-0"}),Lt("div",{class:"code-header-copy"},[Lt("div",{class:"code-header-title"},h.title),h.caption?Lt("div",{class:"code-header-caption"},h.caption):null])]),Lt("div",{class:"flex items-center gap-0.5",style:{visibility:"hidden"}},[f?Lt("div",{class:"code-diff-stats","aria-hidden":"true"},[Lt("span",{class:"code-diff-stat removed"},"-0"),Lt("span",{class:"code-diff-stat added"},"+0")]):null,n.showCopyButton===!1?null:T(),n.showCollapseButton===!1?null:T(),S?Lt("div",{class:"relative"},[T()]):null])]),Lt("div",{class:"code-block-shell-content",style:n.stream!==!1||n.loading===!1?void 0:{display:"none"}},[Lt(Fs,{node:n.node,loading:n.loading,showLineNumbers:!0,reservedHeightPx:f?void 0:n.estimatedContentHeightPx,diffInline:m,diffHideUnchangedRegions:f?une(p?.diffHideUnchangedRegions):void 0,class:"code-pre-fallback",style:$,"data-markstream-code-loading":"1"})]),Lt("div",{class:"code-loading-placeholder",style:n.stream===!1&&n.loading!==!1?void 0:{display:"none"}},[Lt("div",{class:"loading-skeleton"},[Lt("div",{class:"skeleton-line"}),Lt("div",{class:"skeleton-line"}),Lt("div",{class:"skeleton-line short"})])]),Lt("span",{class:"sr-only","aria-live":"polite",role:"status"})])}}}),av=Md("ViewportDeferredCodeBlockNode",Hi({loader:()=>Zn(null,null,function*(){try{return(yield vs(()=>import("./CodeBlockNode-DxKllCdY.js"),__vite__mapDeps([4,5]))).default}catch(e){return console.warn('[markstream-vue] Optional peer dependency stream-diffs is missing. Falling back to preformatted code rendering. To enable enhanced code block features, please install "stream-diffs".',e),Fs}}),loadingComponent:Hm,delay:0,suspensible:!1}),Hm),Gi=Hi(()=>Zn(null,null,function*(){var e;if(((e=(function(){const t=Reflect.get(globalThis,"process");return t?.env})())==null?void 0:e.NODE_ENV)==="test"&&typeof window<"u")return t=>{var n,o,s,i;return Lt(mo,Ot(it({},t),{node:{type:"text",content:(o=t.node.raw)!=null?o:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(s=t.node.content)!=null?s:""}$`}}))};try{return yield lE(),(yield vs(()=>import("./index7-CNIa1-2e.js"),[])).default}catch(t){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',t)}return t=>{var n,o,s,i;return Lt(mo,Ot(it({},t),{node:{type:"text",content:(o=t.node.raw)!=null?o:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(s=t.node.content)!=null?s:""}$`}}))}})),wE=Hi(()=>Zn(null,null,function*(){try{return yield lE(),(yield vs(()=>import("./index6-C3SLqmgw.js"),[])).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var t,n,o,s;return Lt(mo,Ot(it({},e),{node:{type:"text",content:(n=e.node.raw)!=null?n:`$$${(t=e.node.content)!=null?t:""}$$`,raw:(s=e.node.raw)!=null?s:`$$${(o=e.node.content)!=null?o:""}$$`}}))}})),bs=Mn(Je({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(t,n)=>(x(),E("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0",onClick:n[0]||(n[0]=o=>t.$emit("click",o,e.node.id,e.messageId,e.threadId)),onMouseenter:n[1]||(n[1]=o=>t.$emit("mouseEnter",o,e.node.id,e.messageId,e.threadId)),onMouseleave:n[2]||(n[2]=o=>t.$emit("mouseLeave",o,e.node.id,e.messageId,e.threadId))},R(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);bs.install=e=>{e.component(bs.__name,bs)};const _ne={class:"superscript-node"},Ps=Mn(Je({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=D(()=>it({text:mo,inline_code:as,link:_s,html_inline:oi,strong:xs,emphasis:Ss,footnote_reference:ni,strikethrough:ws,highlight:si,insert:Ws,subscript:Hs,emoji:Ds,math_inline:Gi,reference:bs},n.value));return(s,i)=>(x(),E("sup",_ne,[(x(!0),E(We,null,rt(e.node.children,(r,l)=>(x(),Se(C(vr),{key:`${e.indexKey||"superscript"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"superscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-24160b22"]]);Ps.install=e=>{e.component(Ps.__name,Ps)};const Sne={class:"subscript-node"},Hs=Mn(Je({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=D(()=>it({text:mo,inline_code:as,link:_s,html_inline:oi,strong:xs,emphasis:Ss,footnote_reference:ni,strikethrough:ws,highlight:si,insert:Ws,superscript:Ps,emoji:Ds,math_inline:Gi,reference:bs},n.value));return(s,i)=>(x(),E("sub",Sne,[(x(!0),E(We,null,rt(e.node.children,(r,l)=>(x(),Se(C(vr),{key:`${e.indexKey||"subscript"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"subscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-197fa13b"]]);Hs.install=e=>{e.component(Hs.__name,Hs)};const Cne={class:"strong-node"},xs=Mn(Je({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=D(()=>it({text:mo,inline_code:as,link:_s,html_inline:oi,emphasis:Ss,strikethrough:ws,highlight:si,insert:Ws,subscript:Hs,superscript:Ps,emoji:Ds,footnote_reference:ni,math_inline:Gi,reference:bs},n.value));return(s,i)=>(x(),E("strong",Cne,[(x(!0),E(We,null,rt(e.node.children,(r,l)=>(x(),Se(C(vr),{key:`${e.indexKey||"strong"}-${l}`,components:o.value,node:r,"index-key":`${e.indexKey||"strong"}-${l}`,"custom-id":t.customId},null,8,["components","node","index-key","custom-id"]))),128))]))}}),[["__scopeId","data-v-a8647104"]]);xs.install=e=>{e.component(xs.__name,xs)};const Ane={class:"strikethrough-node"},ws=Mn(Je({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=D(()=>it({text:mo,inline_code:as,link:_s,html_inline:oi,strong:xs,emphasis:Ss,highlight:si,insert:Ws,subscript:Hs,superscript:Ps,emoji:Ds,footnote_reference:ni,math_inline:Gi,reference:bs},n.value));return(s,i)=>(x(),E("del",Ane,[(x(!0),E(We,null,rt(e.node.children,(r,l)=>(x(),Se(C(vr),{key:`${e.indexKey||"strikethrough"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-b7a531fa"]]);ws.install=e=>{e.component(ws.__name,ws)};const Mne=["href","title","aria-label","aria-hidden","target","rel"],Ene=["aria-hidden"],Tne={class:"link-text-wrapper relative inline-flex"},Nne={class:"leading-[normal] link-text"},_s=Mn(Je({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const t=e,n=Jt("markstreamShowTooltips",void 0),o=D(()=>{const k=n?.value;return typeof k=="boolean"?k:t.showTooltip}),s=D(()=>{var k,g,v,b,A;const I=t.underlineBottom!==void 0?typeof t.underlineBottom=="number"?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px",N=(k=t.animationOpacity)!=null?k:.35,M=Math.max(.12,Math.min(.5*N,N)),$={"--underline-height":`${(g=t.underlineHeight)!=null?g:2}px`,"--underline-bottom":I,"--underline-opacity":String(N),"--underline-rest-opacity":String(M),"--underline-duration":`${(v=t.animationDuration)!=null?v:1.6}s`,"--underline-timing":(b=t.animationTiming)!=null?b:"ease-in-out","--underline-iteration":typeof t.animationIteration=="number"?String(t.animationIteration):(A=t.animationIteration)!=null?A:"infinite"};return t.color&&($["--link-color"]=t.color),$}),i=To(()=>t.customId),r=D(()=>it({text:mo,strong:xs,strikethrough:ws,emphasis:Ss,image:Fl,html_inline:oi,inline_code:as},i.value)),l=Bf(),a=D(()=>{var k,g;const v=(k=t.node)==null?void 0:k.attrs;if(!v||typeof v!="object")return{};const b={};if(Array.isArray(v))for(const A of v)Array.isArray(A)&&A[0]&&(b[String(A[0])]=String((g=A[1])!=null?g:""));else for(const[A,I]of Object.entries(v))A&&I!=null&&I!==!1&&(b[A]=I===!0?"":String(I));return m4(b,"safe","a")}),c=D(()=>it(it({},l),a.value)),u=D(()=>{var k,g;return m4({href:String((g=(k=t.node)==null?void 0:k.href)!=null?g:"")},"safe","a").href}),d=D(()=>{if(!u.value)return;const k=c.value.target;return(typeof k=="string"?k.trim():String(k??"").trim())||(CY(u.value)?"_blank":void 0)}),f=D(()=>{var k;return String((k=d.value)!=null?k:"").trim().toLowerCase()==="_blank"}),h=D(()=>{if(!u.value)return;const k=c.value.rel,g=new Set((typeof k=="string"?k:String(k??"")).split(/\s+/).filter(Boolean)),v=new Set(Array.from(g).filter(b=>b.toLowerCase()!=="opener"));return f.value&&(v.add("noopener"),v.add("noreferrer")),v.size>0?Array.from(v).join(" "):void 0}),p=D(()=>{const k=it({},c.value);return delete k.title,delete k.href,delete k.target,delete k.rel,k});function m(){o.value&&Yte()}const y=D(()=>{var k,g;const v=(k=t.node)==null?void 0:k.title;return typeof v=="string"&&v.trim().length>0?v:String((g=u.value)!=null?g:"")});return(k,g)=>{var v,b;return e.node.loading?(x(),E("span",Sn({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},C(l),{style:s.value}),[w("span",Tne,[w("span",Nne,[ae(C(mo),{class:"leading-[normal] link-text",node:{type:"text",content:String((v=e.node.text)!=null?v:""),raw:String((b=e.node.text)!=null?b:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),g[1]||(g[1]=w("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,Ene)):(x(),E("a",Sn({key:0,class:"link-node",href:u.value,title:o.value?"":y.value,"aria-label":`Link: ${y.value}`,"aria-hidden":e.node.loading?"true":"false",target:d.value,rel:h.value},p.value,{style:s.value,onMouseenter:g[0]||(g[0]=A=>(function(I){var N,M,$,T;if(!o.value)return;const F=I,S=F?.clientX!=null&&F?.clientY!=null?{x:F.clientX,y:F.clientY}:void 0,B=((N=t.node)==null?void 0:N.title)||((M=u.value)!=null&&M.includes("xn--")&&((T=($=t.node)==null?void 0:$.text)!=null&&T.includes("://"))?t.node.text:u.value)||"";Gte(I.currentTarget,B,"top",!1,S)})(A)),onMouseleave:m}),[(x(!0),E(We,null,rt(e.node.children,(A,I)=>(x(),Se(C(vr),{key:`${e.indexKey||"emphasis"}-${I}`,components:r.value,node:A,"custom-id":t.customId,"index-key":`${e.indexKey||"link-text"}-${I}`},null,8,["components","node","custom-id","index-key"]))),128))],16,Mne))}}}),[["__scopeId","data-v-367e6ca4"]]);_s.install=e=>{e.component(_s.__name,_s)};const Ine={class:"insert-node"},Ws=Mn(Je({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=D(()=>it({text:mo,inline_code:as,link:_s,html_inline:oi,strong:xs,emphasis:Ss,strikethrough:ws,highlight:si,subscript:Hs,superscript:Ps,emoji:Ds,footnote_reference:ni,math_inline:Gi,reference:bs},n.value));return(s,i)=>(x(),E("ins",Ine,[(x(!0),E(We,null,rt(e.node.children,(r,l)=>(x(),Se(C(vr),{key:`${e.indexKey||"insert"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-1e2c29d4"]]);Ws.install=e=>{e.component(Ws.__name,Ws)};const Lne={class:"highlight-node"},si=Mn(Je({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=D(()=>it({text:mo,inline_code:as,link:_s,html_inline:oi,strong:xs,emphasis:Ss,strikethrough:ws,insert:Ws,subscript:Hs,superscript:Ps,emoji:Ds,footnote_reference:ni,math_inline:Gi,reference:bs},n.value));return(s,i)=>(x(),E("mark",Lne,[(x(!0),E(We,null,rt(e.node.children,(r,l)=>(x(),Se(C(vr),{key:`${e.indexKey||"highlight"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-7a62982a"]]);si.install=e=>{e.component(si.__name,si)};const $ne={class:"emphasis-node"},Ss=Mn(Je({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=D(()=>it({text:mo,inline_code:as,link:_s,html_inline:oi,strong:xs,strikethrough:ws,highlight:si,insert:Ws,subscript:Hs,superscript:Ps,emoji:Ds,footnote_reference:ni,math_inline:Gi,reference:bs},n.value));return(s,i)=>(x(),E("em",$ne,[(x(!0),E(We,null,rt(e.node.children,(r,l)=>(x(),Se(C(vr),{key:`${e.indexKey||"emphasis"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-2a5aafbf"]]);Ss.install=e=>{e.component(Ss.__name,Ss)};const Fne={class:"hard-break"},Ol=Mn(Je({__name:"HardBreakNode",props:{node:{}},setup:e=>(t,n)=>(x(),E("br",Fne))}),[["__scopeId","data-v-50c58f70"]]);Ol.install=e=>{e.component(Ol.__name,Ol)};const Mf=Je({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const t=e,n=gt({checkbox:ti,checkbox_input:ti,emoji:Ds,emphasis:Ss,hardbreak:Ol,highlight:si,inline_code:as,insert:Ws,link:_s,reference:bs,strikethrough:ws,strong:xs,subscript:Hs,superscript:Ps,text:mo}),o=To(()=>t.customId),s=D(()=>{const i=o.value;return Object.keys(i).length>0?it(it({},n),i):n});return(i,r)=>(x(!0),E(We,null,rt(e.nodes,(l,a)=>(x(),Se(C(vr),{key:a,components:s.value,node:l,"custom-id":t.customId,"index-key":`${e.indexKey||"inline"}-${a}`},null,8,["components","node","custom-id","index-key"]))),128))}});function Zy(e){if(!e||typeof e!="object")return!1;const t=`|${e.type}|`;if(!"|checkbox|checkbox_input|emoji|emphasis|hardbreak|highlight|inline_code|insert|link|reference|strikethrough|strong|subscript|superscript|text|".includes(t))return!1;if(!"|emphasis|highlight|insert|link|strikethrough|strong|subscript|superscript|".includes(t))return!0;const n=e.children;return Array.isArray(n)&&n.every(Zy)}function Wm(e,t=!0,n=!1){if(!e||!n&&e.length===0)return null;if(e.every(Zy))return e;if(!t||e.length!==1)return null;const o=e[0];if(o?.type!=="paragraph"||!Array.isArray(o.children))return null;const s=o.children;return(n||s.length>0)&&s.every(Zy)?s:null}function Va(e){var t,n;if(!e?.length)return null;let o="";for(const s of e){if(s?.type!=="text"||s.center===!0)return null;o+=String((n=(t=s.content)!=null?t:s.raw)!=null?n:"")}return o}const One=["cite"],Bne={key:0,dir:"auto",class:"paragraph-node"},Rne=["custom-id"],Dp=Mn(Je({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=To(()=>t.customId),o=D(()=>!!n.value.paragraph),s=D(()=>!!n.value.text),i=D(()=>Wm(t.node.children,!o.value)),r=D(()=>t.fade!==!1||s.value?null:Va(i.value));return Ln("markstreamShowTooltips",D(()=>t.showTooltips)),Ln("markstreamFade",D(()=>t.fade)),(l,a)=>(x(),E("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[i.value?(x(),E("p",Bne,[r.value!==null?(x(),E("span",{key:0,class:"text-node","custom-id":t.customId},R(r.value),9,Rne)):(x(),Se(C(Mf),{key:1,nodes:i.value,"custom-id":t.customId,"index-key":`blockquote-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(x(),Se(C(zs),{key:1,"show-tooltips":t.showTooltips,"index-key":`blockquote-${t.indexKey}`,nodes:t.node.children||[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:a[0]||(a[0]=c=>l.$emit("copy",c))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade"]))],8,One))}}),[["__scopeId","data-v-abfecebc"]]);Dp.install=e=>{e.component(Dp.__name,Dp)};const Dne={class:"definition-list"},Pne={class:"definition-term"},Hne={class:"definition-desc"},Pp=Mn(Je({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,o)=>(x(),E("dl",Dne,[(x(!0),E(We,null,rt(t.node.items,(s,i)=>(x(),E(We,{key:i},[w("dt",Pne,[ae(C(zs),{"index-key":`definition-term-${t.indexKey}-${i}`,nodes:s.term,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[0]||(o[0]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])]),w("dd",Hne,[ae(C(zs),{"index-key":`definition-desc-${t.indexKey}-${i}`,nodes:s.definition,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[1]||(o[1]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],64))),128))]))}}),[["__scopeId","data-v-4e103b30"]]);Pp.install=e=>{e.component(Pp.__name,Pp)};const Wne=["href","title"],Yd=Mn(Je({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const t=e;function n(o){var s;if(o.preventDefault(),typeof document>"u")return;const i=`fnref-${String((s=t.node.id)!=null?s:"")}`,r=document.getElementById(i);r&&r.scrollIntoView({behavior:"smooth",block:"center"})}return(o,s)=>(x(),E("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:n}," ↩︎ ",8,Wne))}}),[["__scopeId","data-v-e1eb37b6"]]);Yd.install=e=>{e.component(Yd.__name,Yd)};const zne=["id"],Une={class:"flex-1"},Hp=Je({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,o)=>(x(),E("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[w("div",Une,[ae(C(zs),{"index-key":`footnote-${t.indexKey}`,nodes:t.node.children,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[0]||(o[0]=s=>n.$emit("copy",s))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],8,zne))}});Hp.install=e=>{e.component(Hp.__name,Hp)};const qne=["custom-id"],Xy=Mn(Je({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=Jt("markstreamFade",void 0),s=D(()=>o?.value!==!1||n.value.text?null:Va(t.node.children)),i=D(()=>it({text:mo,inline_code:as,link:_s,image:Fl,strong:xs,emphasis:Ss,strikethrough:ws,highlight:si,insert:Ws,subscript:Hs,superscript:Ps,emoji:Ds,checkbox:ti,checkbox_input:ti,footnote_reference:ni,hardbreak:Ol,math_inline:Gi,reference:bs},n.value));return(r,l)=>(x(),Se(Ho(`h${e.node.level}`),Sn({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:Ie(()=>[s.value!==null?(x(),E("span",{key:0,class:"text-node","custom-id":t.customId},R(s.value),9,qne)):(x(!0),E(We,{key:1},rt(e.node.children,(a,c)=>(x(),Se(C(vr),{key:c,components:i.value,"custom-id":t.customId,node:a,"index-key":`${e.indexKey||"heading"}-${c}`},null,8,["components","custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-7122dbe1"]]),Z1=Xy;Z1.install=e=>{e.component(Xy.__name,Xy)};const jne={key:0,dir:"auto",class:"paragraph-node"},Vne=["custom-id"],Kne={dir:"auto",class:"paragraph-node"},Gne=["custom-id"],du=Mn(Je({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=D(()=>{var h;return(h=t.node)!=null?h:t.item}),o=To(()=>t.customId),s=D(()=>!!o.value.paragraph),i=D(()=>!!o.value.text),r=D(()=>{var h;return Wm((h=n.value)==null?void 0:h.children,!s.value)}),l=D(()=>{var h;if(s.value)return null;const p=(h=n.value)==null?void 0:h.children;if(!Array.isArray(p)||p.length<2)return null;const m=p[0];if(m?.type!=="paragraph"||!Array.isArray(m.children))return null;const y=p.slice(1);if(!y.every(g=>g?.type==="list"))return null;const k=Wm([m]);return k?{paragraphChildren:k,nestedLists:y}:null});function a(){return t.fade===!1&&!i.value}const c=D(()=>a()?Va(r.value):null),u=D(()=>{var h;return a()?Va((h=l.value)==null?void 0:h.paragraphChildren):null}),d=Object.freeze({}),f=D(()=>{const{value:h}=t;return typeof h=="number"&&Number.isFinite(h)?{value:h}:d});return Ln("markstreamShowTooltips",D(()=>t.showTooltips)),Ln("markstreamFade",D(()=>t.fade)),(h,p)=>{var m,y;return x(),E("li",Sn({class:"list-item",dir:"auto"},f.value),[r.value?(x(),E("p",jne,[c.value!==null?(x(),E("span",{key:0,class:"text-node","custom-id":t.customId},R(c.value),9,Vne)):(x(),Se(C(Mf),{key:1,nodes:r.value,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):l.value?(x(),E(We,{key:1},[w("p",Kne,[u.value!==null?(x(),E("span",{key:0,class:"text-node","custom-id":t.customId},R(u.value),9,Gne)):(x(),Se(C(Mf),{key:1,nodes:l.value.paragraphChildren,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(x(!0),E(We,null,rt(l.value.nestedLists,(k,g)=>(x(),Se(C(zs),{key:g,nodes:[k],"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-nested-${g}`,"show-tooltips":t.showTooltips,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:p[0]||(p[0]=v=>h.$emit("copy",v))},null,8,["nodes","custom-id","index-key","show-tooltips","typewriter","fade","is-dark"]))),128))],64)):(x(),Se(C(zs),{key:2,"show-tooltips":t.showTooltips,"index-key":`list-item-${t.indexKey}`,nodes:(y=(m=n.value)==null?void 0:m.children)!=null?y:[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,onCopy:p[1]||(p[1]=k=>h.$emit("copy",k))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade","is-dark"]))],16)}}}),[["__scopeId","data-v-617214f9"]]);du.install=e=>{e.component(du.__name,du)};const fu=Mn(Je({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=To(()=>e.customId),n=D(()=>t.value.list_item||du);return(o,s)=>(x(),Se(Ho(e.node.ordered?"ol":"ul"),{class:Ue(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:Ie(()=>[(x(!0),E(We,null,rt(e.node.items,(i,r)=>{var l;return x(),Se(Ho(n.value),Sn({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:i,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?((l=e.node.start)!=null?l:1)+r:void 0,onCopy:s[0]||(s[0]=a=>o.$emit("copy",a))}),null,16,["node","custom-id","index-key","typewriter","fade","is-dark","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-99cb95e0"]]);fu.install=e=>{e.component(fu.__name,fu)};const Yne={key:2,class:"html-block-node__raw"},Zne=["innerHTML"],Xne={key:1,class:"html-block-node__placeholder"},Zd=Mn(Je({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=Jt("markstreamHtmlPolicy",void 0),o=Jt("markstreamNestedRendererProps",void 0),s=D(()=>{var S,B;return(B=(S=t.htmlPolicy)!=null?S:n?.value)!=null?B:"safe"}),i=D(()=>{var S,B;const W=(S=o?.value)!=null?S:{};return Ot(it({},W),{customId:(B=t.customId)!=null?B:W.customId,htmlPolicy:s.value})}),r=Hi({loader:()=>Promise.resolve().then(()=>eb),suspensible:!1}),l=D(()=>{const S=Fp(t.node.attrs,s.value);if(!S)return;const B=jd(S);return Object.keys(B).length>0?B:void 0}),a=D(()=>{const S=String(t.node.tag||"").trim(),B=Fp(t.node.attrs,s.value,S);if(!B)return;const W=jd(B);return Object.keys(W).length>0?W:void 0}),c=To(()=>t.customId),u=Je({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),d=oe(null),f=oe(typeof window>"u"),h=oe(t.node.content),p=D(()=>Array.isArray(t.node.children)?t.node.children:[]),m=D(()=>String(t.node.tag||"div")),y=D(()=>{var S;if(m.value.trim().toLowerCase()!=="details"||(S=t.node.attrs)!=null&&S.some(([W])=>String(W).toLowerCase()==="open"))return null;const B=p.value[0];return B?.type==="html_block"&&String(B.tag||"").toLowerCase()==="summary"?B:null}),k=D(()=>{var S;return Va((S=y.value)==null?void 0:S.children)}),g=D(()=>{const S=y.value;if(!S)return;const B=Fp(S.attrs,s.value,"summary");if(!B)return;const W=jd(B);return Object.keys(W).length>0?W:void 0}),v=D(()=>k.value==null?p.value:p.value.slice(1)),b=D(()=>{const S=m.value.trim().toLowerCase();return q5.has(S)||O2(S,s.value)}),A=D(()=>p.value.length>0&&!!t.node.tag&&!b.value),I=D(()=>{var S,B,W;if(A.value)return{mode:"structured"};if(!f.value)return{mode:"html",content:(S=h.value)!=null?S:""};const z=(B=h.value)!=null?B:t.node.content;if(!z)return{mode:"html",content:""};if(s.value==="escape")return{mode:"html",content:uu(z,s.value)};if(t.node.loading){const O=Pm(z,c.value,s.value);return O===null?{mode:"text",content:(W=t.node.raw)!=null?W:z}:{mode:"dynamic",nodes:O}}if(!mE(z,c.value))return{mode:"html",content:uu(z,s.value)};const L=Pm(z,c.value,s.value);return L===null?{mode:"html",content:uu(z,s.value)}:{mode:"dynamic",nodes:L}}),N=U2(),M=W2(),$=z2(),T=gr(null),F=!!t.node.loading;return typeof window<"u"?(et([()=>d.value,()=>M?.value.heavyBlockMargin,()=>M?.value.rootMargin],([S],B,W)=>{var z,L,O,U;if((L=(z=T.value)==null?void 0:z.destroy)==null||L.call(z),T.value=null,!F)return f.value=!0,void(h.value=t.node.content);if(!S)return void(f.value=!1);let Z=!0;const ie=(U=(O=M?.value.heavyBlockMargin)!=null?O:M?.value.rootMargin)!=null?U:ja,q=N(S,{rootMargin:ie,allowIdle:!$.value});T.value=q,f.value=f.value||q.isVisible.value,q.whenVisible.then(()=>{Z&&T.value===q&&(f.value=!0)}),W(()=>{Z=!1,q.destroy(),T.value===q&&(T.value=null)})},{immediate:!0}),et(()=>t.node.content,S=>{F&&!f.value||(h.value=S)})):f.value=!0,ho(()=>{var S,B;(B=(S=T.value)==null?void 0:S.destroy)==null||B.call(S),T.value=null}),(S,B)=>(x(),Se(Ho(A.value?m.value:"div"),Sn({ref_key:"htmlRef",ref:d,class:"html-block-node","data-markstream-viewport-pending":C($)&&!f.value?"true":void 0},A.value?a.value:void 0),{default:Ie(()=>[f.value?(x(),E(We,{key:0},[I.value.mode==="structured"?(x(),E(We,{key:0},[k.value!==null?(x(),E(We,{key:0},[w("summary",C9(bM(g.value)),R(k.value),17),v.value.length?(x(),Se(C(r),Sn({key:0},i.value,{nodes:v.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):ue("",!0)],64)):(x(),Se(C(r),Sn({key:1},i.value,{nodes:p.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"]))],64)):I.value.mode==="dynamic"?(x(),Se(C(u),{key:1,nodes:I.value.nodes},null,8,["nodes"])):I.value.mode==="text"?(x(),E("pre",Yne,R(I.value.content),1)):(x(),E("div",Sn({key:3},l.value,{innerHTML:I.value.content}),null,16,Zne))],64)):(x(),E("div",Xne,[jn(S.$slots,"placeholder",{node:e.node},()=>[B[0]||(B[0]=w("span",{class:"html-block-node__placeholder-bar"},null,-1)),B[1]||(B[1]=w("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),B[2]||(B[2]=w("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16,["data-markstream-viewport-pending"]))}}),[["__scopeId","data-v-e140a874"]]);Zd.install=e=>{e.component(Zd.__name,Zd)};const Qne={dir:"auto",class:"paragraph-node"},Jne=["custom-id"],Ha=Mn(Je({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){const t=e,n=To(()=>t.customId),o=Jt("markstreamHtmlPolicy",void 0),s=Jt("markstreamFade",void 0),i=Jt("markstreamParseOptions",void 0),r=Jt("markstreamCustomMarkdownIt",void 0),l=Jt("markstreamNestedRendererProps",void 0),a=D(()=>{var M;return(M=o?.value)!=null?M:"safe"}),c=D(()=>{var M;return(M=t.parseOptions)!=null?M:i?.value}),u=D(()=>{var M;return(M=t.customMarkdownIt)!=null?M:r?.value}),d=D(()=>{var M,$;return($=t.customHtmlTags)!=null?$:(M=l?.value)==null?void 0:M.customHtmlTags}),f=D(()=>{var M,$;const T=(M=l?.value)!=null?M:{};return Ot(it({},T),{customId:($=t.customId)!=null?$:T.customId,customHtmlTags:d.value,parseOptions:c.value,customMarkdownIt:u.value,htmlPolicy:a.value})}),h=Hi({loader:()=>Promise.resolve().then(()=>eb),suspensible:!1});function p(M){var $;return M.type==="text"&&String(($=M.content)!=null?$:"").trim()===""}const m=D(()=>t.node.children.filter(M=>!p(M))),y=D(()=>m.value.length>0&&m.value.every(M=>M.type==="image"||(function($){var T;const F=(function(S){return S.type==="link"&&Array.isArray(S.children)?S.children.filter(B=>!p(B)):[]})($);return F.length===1&&((T=F[0])==null?void 0:T.type)==="image"})(M))),k=D(()=>new Set(tc(d.value))),g=D(()=>{if(!y.value||m.value.length<=1)return t.node.children;const M=[];for(let $=0;$<t.node.children.length;$++){const T=t.node.children[$];if(!p(T)){M.push(T);continue}const F=M.length>0,S=t.node.children.slice($+1).some(B=>!p(B));F&&S&&M.push(Ot(it({},T),{content:" ",raw:" "}))}return M}),v=D(()=>s?.value===!1&&!n.value.text),b=D(()=>v.value?Va(g.value):null);function A(M,$){return{node:M,"index-key":`${t.indexKey}-${$}`,"custom-id":t.customId,"custom-html-tags":d.value}}const I=D(()=>it({inline_code:as,image:Fl,link:_s,hardbreak:Ol,emphasis:Ss,strong:xs,strikethrough:ws,highlight:si,insert:Ws,subscript:Hs,superscript:Ps,html_inline:oi,html_block:Zd,emoji:Ds,checkbox:ti,math_inline:Gi,checkbox_input:ti,reference:bs,footnote_anchor:Yd,footnote_reference:ni,text:mo},n.value)),N=D(()=>g.value.map((M,$)=>{var T;const F=(function(S){var B,W,z,L;if(S.type==="html_block"||S.type==="html_inline"){const O=String((B=S.tag)!=null?B:"").trim().toLowerCase()||Y5(S.content);if(O&&!k.value.has(O)&&Z5((W=S.content)!=null?W:S.raw,O)){const U=String((L=(z=S.content)!=null?z:S.raw)!=null?L:"");return{child:{type:"text",content:U,raw:U},component:mo,isCustomComponent:!1}}}return{child:S,component:I.value[S.type],isCustomComponent:!!(n.value[S.type]&&!Kf(String(S.type)))}})(M);return Ot(it({},F),{index:$,key:`${t.indexKey||"paragraph"}-${$}`,customAttrs:F.isCustomComponent?H2(F.child,a.value):void 0,hasSlotChildren:Array.isArray(F.child.children)&&F.child.children.length>0,slotContent:String((T=F.child.content)!=null?T:""),originalChild:M})}));return(M,$)=>(x(),E("p",Qne,[b.value!==null?(x(),E("span",{key:0,class:"text-node","custom-id":t.customId},R(b.value),9,Jne)):(x(!0),E(We,{key:1},rt(N.value,T=>{return x(),E(We,{key:T.key},[y.value&&p(T.originalChild)?(x(),E(We,{key:0},[ot(R((F=T.originalChild,String((S=F.content)!=null?S:""))),1)],64)):T.isCustomComponent?(x(),Se(Ho(T.component),Sn({key:1,ref_for:!0},T.customAttrs,{node:T.child,loading:T.child.loading,"index-key":T.key,"custom-id":t.customId,"custom-html-tags":d.value,"is-dark":f.value.isDark}),{default:Ie(()=>[T.hasSlotChildren?(x(),Se(C(h),Sn({key:0,ref_for:!0},f.value,{nodes:T.child.children,"index-key":T.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):T.slotContent?(x(),Se(C(h),Sn({key:1,ref_for:!0},f.value,{content:T.slotContent,final:!T.child.loading,"index-key":`${T.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ue("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(x(),Se(Ho(T.component),Sn({key:2,ref_for:!0},A(T.child,T.index)),null,16))],64);var F,S}),128))]))}}),[["__scopeId","data-v-c59ff506"]]);Ha.install=e=>{e.component(Ha.__name,Ha)};const eoe={class:"table-node-wrapper"},toe=["aria-busy"],noe={key:0},ooe=["custom-id"],soe=["aria-label","onPointerdown"],ioe=["custom-id"],roe={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Xd=Mn(Je({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=D(()=>{var k;return(k=t.node.loading)!=null&&k}),o=D(()=>{var k;return(k=t.node.rows)!=null?k:[]}),s=oe(null),i=oe([]);let r=null;const l=D(()=>t.node.header.cells.length),a=D(()=>i.value.some(k=>Number.isFinite(k)&&k>0)),c=D(()=>a.value?i.value.map(k=>k>0?{width:`${k}px`}:void 0):[]);Ln("markstreamShowTooltips",D(()=>t.showTooltips)),Ln("markstreamFade",D(()=>t.fade));const u=To(()=>t.customId),d=D(()=>!!u.value.text),f=D(()=>!!u.value.paragraph),h=new WeakMap;function p(k){const g=t.fade===!1&&!d.value,v=!f.value,b=h.get(k);if(b?.children===k.children&&b.textFastPath===g&&b.paragraphFastPath===v)return b.info;const A=Wm(k.children,v,!0),I={simpleChildren:A,plainText:A&&g?Va(A):null};return h.set(k,{children:k.children,textFastPath:g,paragraphFastPath:v,info:I}),I}function m(k){if(!r)return;k.preventDefault();const g=r.startWidth+r.nextStartWidth,v=Math.min(48,Math.floor(g/2)),b=Math.max(v,Math.min(g-v,Math.round(r.startWidth+k.clientX-r.startX))),A=[...r.widths];A[r.index]=b,A[r.index+1]=g-b,i.value=A}function y(){r&&(window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y),r=null)}return et(l,()=>{y(),i.value=[]}),ho(y),(k,g)=>(x(),E("div",eoe,[w("table",{ref_key:"tableRef",ref:s,class:Ue(["table-node",{"table-node--loading":n.value}]),"aria-busy":n.value},[a.value?(x(),E("colgroup",noe,[(x(!0),E(We,null,rt(e.node.header.cells,(v,b)=>(x(),E("col",{key:b,style:on(c.value[b])},null,4))),128))])):ue("",!0),w("thead",null,[w("tr",null,[(x(!0),E(We,null,rt(e.node.header.cells,(v,b)=>(x(),E("th",{key:b,dir:"auto",class:Ue([v.align==="right"?"text-right":v.align==="center"?"text-center":"text-left"])},[p(v).plainText!==null?(x(),E("span",{key:0,class:"text-node","custom-id":t.customId},R(p(v).plainText),9,ooe)):p(v).simpleChildren?(x(),Se(C(Mf),{key:1,nodes:p(v).simpleChildren,"custom-id":t.customId,"index-key":`table-th-${t.indexKey}-${b}`},null,8,["nodes","custom-id","index-key"])):(x(),Se(C(zs),{key:2,nodes:v.children,"index-key":`table-th-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:g[0]||(g[0]=A=>k.$emit("copy",A))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"])),b<e.node.header.cells.length-1?(x(),E("button",{key:3,type:"button",class:"table-node__resize-handle","aria-label":`Resize columns ${b+1} and ${b+2}`,onPointerdown:A=>(function(I,N){if(N.button!==0)return;const M=(function(){var F;const S=(F=s.value)==null?void 0:F.querySelectorAll("thead th");return Array.from(S??[],B=>Math.round(B.getBoundingClientRect().width))})(),$=M[I],T=M[I+1];$&&T&&(N.preventDefault(),r={index:I,startX:N.clientX,startWidth:$,nextStartWidth:T,widths:M},i.value=M,window.addEventListener("pointermove",m),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y))})(b,A)},null,40,soe)):ue("",!0)],2))),128))])]),w("tbody",null,[(x(!0),E(We,null,rt(o.value,(v,b)=>(x(),E("tr",{key:b},[(x(!0),E(We,null,rt(v.cells,(A,I)=>(x(),E("td",{key:I,class:Ue([A.align==="right"?"text-right":A.align==="center"?"text-center":"text-left"]),dir:"auto"},[p(A).plainText!==null?(x(),E("span",{key:0,class:"text-node","custom-id":t.customId},R(p(A).plainText),9,ioe)):p(A).simpleChildren?(x(),Se(C(Mf),{key:1,nodes:p(A).simpleChildren,"custom-id":t.customId,"index-key":`table-td-${t.indexKey}-${b}-${I}`},null,8,["nodes","custom-id","index-key"])):(x(),Se(C(zs),{key:2,nodes:A.children,"index-key":`table-td-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:g[1]||(g[1]=N=>k.$emit("copy",N))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"]))],2))),128))]))),128))])],10,toe),ae(Ua,{name:"table-node-fade"},{default:Ie(()=>[n.value?(x(),E("div",roe,[jn(k.$slots,"loading",{isLoading:n.value},()=>[g[2]||(g[2]=w("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),g[3]||(g[3]=w("span",{class:"sr-only"},"Loading",-1))],!0)])):ue("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);Xd.install=e=>{e.component(Xd.__name,Xd)};const loe={class:"hr-node"},Wp=Mn({},[["render",function(e,t){return x(),E("hr",loe)}],["__scopeId","data-v-39b2349c"]]);Wp.install=e=>{e.component(Wp.__name,Wp)};const aoe={class:"unknown-node"},Qy=Je({__name:"FallbackComponent",props:{node:{}},setup:e=>(t,n)=>(x(),E("div",aoe,R(e.node.raw),1))}),zp=Mn(Je({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const t=e,n=D(()=>`vmr-container vmr-container-${t.node.name}`),o=To(()=>t.customId),s=D(()=>it({text:mo,paragraph:Ha,heading:Z1,inline_code:as,link:_s,image:Fl,strong:xs,emphasis:Ss,strikethrough:ws,insert:Ws,subscript:Hs,superscript:Ps,checkbox:ti,checkbox_input:ti,hardbreak:Ol,math_inline:Gi,reference:bs,list:fu,math_block:wE,table:Xd},o.value));return(i,r)=>(x(),E("div",Sn({class:n.value},e.node.attrs),[(x(!0),E(We,null,rt(e.node.children,(l,a)=>{return x(),Se(Ho((c=l.type,s.value[c]||Qy)),{key:`${e.indexKey||"vmr-container"}-${a}`,"custom-id":t.customId,node:l,"index-key":`${e.indexKey||"vmr-container"}-${a}`,typewriter:t.typewriter,fade:t.fade},null,8,["custom-id","node","index-key","typewriter","fade"]);var c}),128))],16))}}),[["__scopeId","data-v-911e41c4"]]);zp.install=e=>{e.component(zp.__name,zp)};const coe=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],S4=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function uoe(e){if(e<=255)return coe[e];let t=0,n=S4.length-1;for(;t<=n;){const o=t+n>>1,s=S4[o];if(e<s[0])n=o-1;else{if(!(e>s[1]))return s[2];t=o+1}}return"L"}const doe=/[ \t\n\r\f]+/g,foe=/[\t\n\r\f]| {2,}|^ | $/;let cv=null;const hoe=new RegExp("\\p{Script=Arabic}","u"),ql=new RegExp("\\p{M}","u"),j2=new RegExp("\\p{Nd}","u");function C4(e){return hoe.test(e)}function A4(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function dr(e){for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(!(n<12288)){if(n>=55296&&n<=56319&&t+1<e.length){const o=e.charCodeAt(t+1);if(o>=56320&&o<=57343){if(A4(o-56320+(n-55296<<10)+65536))return!0;t++;continue}}if(A4(n))return!0}}return!1}const poe=new Set([" "," ","⁠","\uFEFF"]),moe=new Set(["-","‐","–","—"]);function _E(e,t){return!((function(n){const o=Qd(n);return o!==null&&poe.has(o)})(e)||t&&((function(n){const o=Qd(n);return o!==null&&(V2.has(o)||Ka.has(o))})(e)||(function(n){const o=Qd(n);return o!==null&&moe.has(o)})(e)))}const V2=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),X1=new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),K2=new Set(["'","’"]),Ka=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),goe=new Set([":",".","،","؛"]),voe=new Set(["၏"]),yoe=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function koe(e){if(G2(e))return!0;let t=!1;for(const n of e)if(Ka.has(n)||Um(n))t=!0;else if(!t||!ql.test(n))return!1;return t}function boe(e){for(const t of e)if(!V2.has(t)&&!Ka.has(t))return!1;return e.length>0}function xoe(e){if(G2(e))return!0;for(const t of e)if(!(X1.has(t)||K2.has(t)||ql.test(t)||Um(t)))return!1;return e.length>0}function G2(e){let t=!1;for(const n of e)if(n!=="\\"&&!ql.test(n)){if(!(X1.has(n)||Ka.has(n)||K2.has(n)))return!1;t=!0}return t}function zm(e,t){const n=t-1;if(n<=0)return Math.max(n,0);const o=e.charCodeAt(n);if(o<56320||o>57343)return n;const s=n-1;if(s<0)return n;const i=e.charCodeAt(s);return i>=55296&&i<=56319?s:n}function Qd(e){if(e.length===0)return null;const t=zm(e,e.length);return e.slice(t)}const woe=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function Um(e){const t=e.codePointAt(0);return t!==void 0&&(function(n,o){for(let s=0;s<o.length;s+=2)if(n>=o[s]&&n<=o[s+1])return!0;return!1})(t,woe)}function _oe(e){const t=(function(n){for(const o of n)if(!ql.test(o))return o;return null})(e);return t!==null&&j2.test(t)}function Soe(e){const t=Array.from(e);let n=t.length;for(;n>0;){const o=t[n-1];if(ql.test(o))n--;else{if(!X1.has(o)&&!K2.has(o))break;n--}}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function Coe(e,t,n){return n!=="text"||t||e.length!==1||e==="-"||e==="—"?null:e}function M4(e,t,n,o){const s=t[o],i=e[o];if(s==null)return i;const r=n[o];if(i.length===r)return i;const l=s.repeat(r);return e[o]=l,l}function E4(e,t){return e&&t!==null&&goe.has(t)}function Aoe(e){const t=Qd(e);return t!==null&&voe.has(t)}function Moe(e){if(e.length<2||e[0]!==" ")return null;const t=e.slice(1);return new RegExp("^\\p{M}+$","u").test(t)?{space:" ",marks:t}:null}function Jy(e){let t=e.length;for(;t>0;){const n=zm(e,t),o=e.slice(n,t);if(yoe.has(o))return!0;if(!Ka.has(o))return!1;t=n}return!1}function Eoe(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===`
289
+ `:""}${K}`;return d=j,f}),p=D(()=>{var j;return t.showLineNumbers===!0&&((j=t.node)==null?void 0:j.diff)===!0}),m=D(()=>p.value&&t.diffInline===!0),y=D(()=>{const j=Number(t.reservedHeightPx);if(!Number.isFinite(j)||j<=0)return;const K=`${Math.ceil(j)}px`;return i.value?{maxHeight:K,overflow:"auto"}:{height:K,minHeight:K,maxHeight:K,overflow:"auto"}}),k=["diff ","index ","--- ","+++ ","@@ "];function g(j){return String(j??"").trim().length===0}function v(j,K="context",ve={}){const he=g(j);return{code:j,kind:he&&K!=="hunk"&&K!=="spacer"&&!ve.preserveBlankKind?"context":K,empty:he}}function b(j){const K=n(j,i.value);return K?K.split(/\r\n|\n|\r/):[]}function A(j,K){return!g(j[K])||K<j.length-1}function I(j){return j.startsWith("-")&&!j.startsWith("---")}function N(j){return j.startsWith("+")&&!j.startsWith("+++")}function M(j){return j.some(K=>k.some(ve=>K.startsWith(ve)))}function $(j,K){return K||!j.startsWith(" ")||j.startsWith(" ")?j:` ${j}`}function T(j,K){const ve=j.length,he=K.length,Ae=[];let re=0;for(;re<ve&&re<he&&j[re]===K[re];)Ae.push({originalIndex:re,modifiedIndex:re}),re++;const Y=[];let Q=ve-1,P=he-1;for(;Q>=re&&P>=re&&j[Q]===K[P];)Y.unshift({originalIndex:Q,modifiedIndex:P}),Q--,P--;const G=Q-re+1,me=P-re+1;if(G<=0||me<=0||i.value||(G+1)*(me+1)>15e5)return Ae.concat(Y);const ye=me+1,de=new Uint32Array((G+1)*(me+1));for(let ke=G-1;ke>=0;ke--)for(let Ne=me-1;Ne>=0;Ne--){const qe=ke*ye+Ne;if(j[re+ke]===K[re+Ne])de[qe]=de[(ke+1)*ye+Ne+1]+1;else{const be=de[(ke+1)*ye+Ne],xe=de[ke*ye+Ne+1];de[qe]=be>=xe?be:xe}}const V=[];let se=0,pe=0;for(;se<G&&pe<me;)j[re+se]===K[re+pe]?(V.push({originalIndex:re+se,modifiedIndex:re+pe}),se++,pe++):de[(se+1)*ye+pe]>=de[se*ye+pe+1]?se++:pe++;return Ae.concat(V,Y)}function F(j){var K;const ve=(function(){var P,G;const me=t.diffHideUnchangedRegions;if(me==null||me===!1)return null;const ye=me===!0?{}:me;return ye.enabled===!1?null:{contextLineCount:Math.max(0,Math.floor((P=ye.contextLineCount)!=null?P:2)),minimumLineCount:Math.max(1,Math.floor((G=ye.minimumLineCount)!=null?G:4))}})();if(!ve||j.length<1||j.length>2||j.length===2&&j[0].lines.length!==j[1].lines.length)return j;const he=j[0].lines,Ae=(K=j[1])==null?void 0:K.lines,re=P=>he[P].kind==="context"&&(Ae===void 0||Ae[P].kind==="context"&&he[P].code===Ae[P].code),Y=[];let Q=0;for(;Q<he.length;){const P=Q;for(;Q<he.length&&re(Q);)Q++;const G=Q;if(G-P>=ve.minimumLineCount){const me=P+(P===0?0:ve.contextLineCount),ye=G-(G===he.length?0:ve.contextLineCount);ye-me>=ve.minimumLineCount&&Y.push({start:me,end:ye})}Q===P&&Q++}return Y.length?j.map((P,G)=>{const me=[];let ye=0;for(const de of Y)me.push(...P.lines.slice(ye,de.start)),me.push({code:G===0?"Unmodified lines":"",kind:"collapsed",empty:!1,key:`${P.key}-collapsed-${de.start}-${de.end}`,number:""}),ye=de.end;return me.push(...P.lines.slice(ye)),Ot(it({},P),{lines:me})}):j}const S=D(()=>{var j,K,ve,he;if(!p.value)return[];const Ae=(function(G){const me=G.some(de=>I(de)),ye=G.some(de=>N(de));return me&&ye||(function(){var de,V,se,pe;if(o.value==="diff")return!0;const ke=(pe=(se=String((V=(de=t.node)==null?void 0:de.raw)!=null?V:"").split(/\r?\n/,1)[0])==null?void 0:se.trim())!=null?pe:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(ke)})()&&(me||ye)})(u.value),re=(function(){var G,me;return((G=t.node)==null?void 0:G.originalCode)!=null||((me=t.node)==null?void 0:me.updatedCode)!=null})();if(m.value){const G=re?(function(me,ye){const de=b(me),V=b(ye),se=T(de,V);if(se.length>0){const xe=[];let Ze=0,tt=0;for(const lt of se){for(;Ze<lt.originalIndex;)xe.push(Ot(it({},v(de[Ze],"removed",{preserveBlankKind:A(de,Ze)})),{key:`inline-removed-source-${Ze}`,number:Ze+1})),Ze++;for(;tt<lt.modifiedIndex;)xe.push(Ot(it({},v(V[tt],"added",{preserveBlankKind:A(V,tt)})),{key:`inline-added-source-${tt}`,number:tt+1})),tt++;xe.push(Ot(it({},v(V[lt.modifiedIndex])),{key:`inline-context-source-${lt.originalIndex}-${lt.modifiedIndex}`,number:lt.modifiedIndex+1})),Ze=lt.originalIndex+1,tt=lt.modifiedIndex+1}for(;Ze<de.length;)xe.push(Ot(it({},v(de[Ze],"removed",{preserveBlankKind:A(de,Ze)})),{key:`inline-removed-source-${Ze}`,number:Ze+1})),Ze++;for(;tt<V.length;)xe.push(Ot(it({},v(V[tt],"added",{preserveBlankKind:A(V,tt)})),{key:`inline-added-source-${tt}`,number:tt+1})),tt++;return xe}const pe=[];let ke=0,Ne=de.length-1,qe=V.length-1;for(;ke<=Ne&&ke<=qe&&de[ke]===V[ke];)pe.push(Ot(it({},v(V[ke])),{key:`inline-prefix-${ke}`,number:ke+1})),ke++;const be=[];for(;Ne>=ke&&qe>=ke&&de[Ne]===V[qe];)be.unshift(Ot(it({},v(V[qe])),{key:`inline-suffix-${qe}`,number:qe+1})),Ne--,qe--;for(let xe=ke;xe<=Ne;xe++)pe.push(Ot(it({},v(de[xe],"removed",{preserveBlankKind:A(de,xe)})),{key:`inline-removed-source-${xe}`,number:xe+1}));for(let xe=ke;xe<=qe;xe++)pe.push(Ot(it({},v(V[xe],"added",{preserveBlankKind:A(V,xe)})),{key:`inline-added-source-${xe}`,number:xe+1}));return pe.concat(be)})((j=t.node)==null?void 0:j.originalCode,(K=t.node)==null?void 0:K.updatedCode):(function(me){const ye=[];let de=1,V=1;const se=M(me);for(const[pe,ke]of me.entries())if(ke.startsWith("@@")){const Ne=ke.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);Ne&&(de=Number(Ne[1]),V=Number(Ne[2])),ye.push(Ot(it({},v(ke,"hunk")),{key:`inline-hunk-${pe}`,number:""}))}else if(I(ke))ye.push(Ot(it({},v($(ke.slice(1),se),"removed",{preserveBlankKind:!0})),{key:`inline-removed-${pe}`,number:de++}));else if(N(ke))ye.push(Ot(it({},v($(ke.slice(1),se),"added",{preserveBlankKind:!0})),{key:`inline-added-${pe}`,number:V++}));else{const Ne=se&&ke.startsWith(" ")?ke.slice(1):ke;ye.push(Ot(it({},v(Ne)),{key:`inline-context-${pe}`,number:V})),de++,V++}return ye})(u.value);return F([{key:"inline",className:"markstream-pre__diff-pane--inline",lines:G}])}if(!Ae&&re)return(function(G,me){const ye=b(G),de=b(me),V=T(ye,de),se=[],pe=[];let ke=0,Ne=0,qe=0;const be=(xe,Ze)=>{const tt=Math.max(xe-ke,Ze-Ne);for(let lt=0;lt<tt;lt++){const ut=ke+lt,mt=Ne+lt;se.push(ut<xe?Ot(it({},v(ye[ut],"removed",{preserveBlankKind:A(ye,ut)})),{key:`original-changed-${qe}-${ut}`,number:ut+1}):Ot(it({},v("","spacer")),{key:`original-spacer-${qe}-${lt}`,number:""})),pe.push(mt<Ze?Ot(it({},v(de[mt],"added",{preserveBlankKind:A(de,mt)})),{key:`modified-changed-${qe}-${mt}`,number:mt+1}):Ot(it({},v("","spacer")),{key:`modified-spacer-${qe}-${lt}`,number:""}))}ke=xe,Ne=Ze,qe++};for(const xe of V)be(xe.originalIndex,xe.modifiedIndex),se.push(Ot(it({},v(ye[xe.originalIndex])),{key:`original-context-${xe.originalIndex}-${xe.modifiedIndex}`,number:xe.originalIndex+1})),pe.push(Ot(it({},v(de[xe.modifiedIndex])),{key:`modified-context-${xe.originalIndex}-${xe.modifiedIndex}`,number:xe.modifiedIndex+1})),ke=xe.originalIndex+1,Ne=xe.modifiedIndex+1;return be(ye.length,de.length),F([{key:"original",className:"markstream-pre__diff-pane--original",lines:se},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:pe}])})((ve=t.node)==null?void 0:ve.originalCode,(he=t.node)==null?void 0:he.updatedCode);const Y=[],Q=[],P=M(u.value);for(const G of u.value)if(G.startsWith("@@"))Y.push(v(G,"hunk")),Q.push(v(G,"hunk"));else if(G.startsWith("-")&&!G.startsWith("---"))Y.push(v($(G.slice(1),P),"removed",{preserveBlankKind:!0}));else if(G.startsWith("+")&&!G.startsWith("+++"))Q.push(v($(G.slice(1),P),"added",{preserveBlankKind:!0}));else{const me=P&&G.startsWith(" ")?G.slice(1):G;Y.push(v(me)),Q.push(v(me))}return F([{key:"original",className:"markstream-pre__diff-pane--original",lines:Y.map((G,me)=>Ot(it({},G),{key:`original-${me}`,number:me+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:Q.map((G,me)=>Ot(it({},G),{key:`modified-${me}`,number:me+1}))}])}),B=D(()=>S.value.some(j=>j.lines.some(K=>K.kind==="collapsed"))),W=D(()=>{const j=o.value;return j?`Code block: ${j}`:"Code block"}),z=oe(null),L=oe([]);let O=null,U=!1,Z=null;function ie(j){const K=Number.parseFloat(String(j??""));return Number.isFinite(K)&&K>0?K:0}function q(j,K){var ve;if(!j)return K;if(j.classList.contains("markstream-pre__diff-line--collapsed"))return 32;const he=j.querySelector(".markstream-pre__diff-content"),Ae=he?.getBoundingClientRect(),re=(ve=Ae?.height)!=null?ve:0;return Math.max(K,Math.ceil(re))}function ee(){U||typeof window>"u"||(O!=null&&window.cancelAnimationFrame(O),O=window.requestAnimationFrame(()=>{O=null,U||(function(){var j,K;O=null;const ve=z.value;if(!ve||!p.value||m.value||!ve.classList.contains("is-wrap"))return void(L.value.length&&(L.value=[]));const he=(function(me){const ye=window.getComputedStyle(me),de=ie(ye.getPropertyValue("--markstream-pre-diff-line-height"));if(de>0)return de;const V=ie(ye.lineHeight);return V>0?V:18})(ve),Ae=Array.from(ve.querySelectorAll(".markstream-pre__diff-pane--original .markstream-pre__diff-line")),re=Array.from(ve.querySelectorAll(".markstream-pre__diff-pane--modified .markstream-pre__diff-line")),Y=Math.max(Ae.length,re.length),Q=[];for(let me=0;me<Y;me++){const ye=q((j=Ae[me])!=null?j:null,he),de=q((K=re[me])!=null?K:null,he),V=Math.max(he,ye,de);Q.push({rowHeight:V,originalHeight:ye,modifiedHeight:de})}var P,G;P=L.value,G=Q,P.length===G.length&&P.every((me,ye)=>{const de=G[ye];return de&&Math.abs(me.rowHeight-de.rowHeight)<=.5&&Math.abs(me.originalHeight-de.originalHeight)<=.5&&Math.abs(me.modifiedHeight-de.modifiedHeight)<=.5})||(L.value=Q)})()}))}function fe(j){Z?.disconnect(),Z=null,j&&p.value&&!m.value&&typeof ResizeObserver<"u"&&(Z=new ResizeObserver(()=>{ee()}),Z.observe(j))}function ne(j,K){const ve=L.value[j];if(!ve)return;const he=K==="original"?ve.originalHeight:ve.modifiedHeight;return{"--markstream-pre-diff-synced-row-height":`${Math.ceil(ve.rowHeight)}px`,"--markstream-pre-diff-content-height":`${Math.ceil(he)}px`}}return et(z,j=>{fe(j),yt(()=>ee())},{flush:"post"}),et([p,m,S],()=>{fe(z.value),yt(()=>ee())},{flush:"post",immediate:!0}),ho(()=>{U=!0,O!=null&&(window.cancelAnimationFrame(O),O=null),Z?.disconnect(),Z=null}),(j,K)=>(x(),E("pre",{ref_key:"preRef",ref:z,style:on(y.value),class:Ue([s.value,{"markstream-pre--line-numbers":t.showLineNumbers,"markstream-pre--diff-preview":p.value,"markstream-pre--diff-inline":m.value,"markstream-pre--diff-collapsed":B.value}]),"aria-busy":i.value,"aria-label":W.value,"data-language":o.value,"data-markstream-line-numbers":t.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[p.value?(x(),E("code",pne,[(x(!0),E(We,null,rt(S.value,ve=>(x(),E("span",{key:ve.key,class:Ue(["markstream-pre__diff-pane",ve.className])},[w("span",mne,[(x(!0),E(We,null,rt(ve.lines,(he,Ae)=>(x(),E("span",{key:he.key,class:Ue(["markstream-pre__diff-line",[`markstream-pre__diff-line--${he.kind}`,{"markstream-pre__diff-line--empty":he.empty}]]),style:on(ne(Ae,ve.key))},[K[0]||(K[0]=w("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),w("span",gne,R(he.number),1),w("span",vne,[w("span",yne,R(he.code),1)])],6))),128))])],2))),128))])):(x(),E(We,{key:1},[t.showLineNumbers?(x(),E("span",kne,[w("span",{class:"markstream-pre__line-numbers-text",textContent:R(h.value)},null,8,bne)])):ue("",!0),w("code",{translate:"no",class:"markstream-pre__code",textContent:R(r.value)},null,8,xne)],64))],14,hne))}});Fs.install=e=>{e.component(Fs.__name,Fs)};const wne={key:0},mo=Mn(Je({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const t=e,n=Bf(),o=Jt("markstreamFade",void 0),s=Jt("markstreamTextStreamState",void 0),i=Jt("markstreamStreamVersion",void 0),r=D(()=>{const y=n.fade;return y===""||y===!0||y==="true"||y!==!1&&y!=="false"&&void 0}),l=D(()=>typeof r.value=="boolean"?r.value:typeof o?.value!="boolean"||o.value),a=D(()=>{var y;const k=(y=n["index-key"])!=null?y:n.indexKey;return k==null||k===""?"":String(k)}),c=oe(t.node.content),u=oe(""),d=oe(0);let f;function h(){f?.(),f=void 0}function p(){h(),u.value&&(c.value=c.value+u.value,u.value="")}et([()=>t.node.content,a,l],([y])=>{const k=String(y??""),g=a.value,v=nE({nextContent:k,persistedContent:g?s?.get(g):void 0,currentState:{settledContent:c.value,streamedDelta:u.value},typewriterEnabled:l.value});c.value=v.settledContent,u.value=v.streamedDelta,v.appended?(d.value+=1,(function(){if(!u.value||f||!i)return;const b=i.value;f=et(()=>i.value,A=>{A!==b&&p()},{flush:"sync"})})()):u.value||h(),g&&s?.set(g,k)},{immediate:!0}),Lf(h);const m=D(()=>d.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(y,k)=>(x(),E("span",{class:Ue([[e.node.center?"text-node-center":""],"text-node"])},[c.value?(x(),E("span",wne,R(c.value),1)):ue("",!0),u.value?(x(),E("span",{key:1,class:Ue(["text-node-stream-delta",[m.value]]),onAnimationend:p},R(u.value),35)):ue("",!0)],2))}}),[["__scopeId","data-v-a7e90764"]]);function Md(e,t,n){return Je({name:e,inheritAttrs:!1,setup(o,{attrs:s,slots:i}){var r,l;const a=U2(),c=W2(),u=z2(),d=typeof window<"u"&&((l=(r=Mo())==null?void 0:r.vnode.el)==null?void 0:l.nodeType)===1,f=oe(typeof window>"u"||d||!u.value),h=gr(null);let p=null;function m(y){const k=y&&"$el"in y?y.$el:y;h.value=k instanceof HTMLElement?k:null}return typeof window<"u"&&et([h,u],([y,k],g,v)=>{if(p?.destroy(),p=null,!k||f.value)return void(f.value=!0);if(!y)return;let b=!0;const A=a(y,{rootMargin:c?.value.heavyBlockMargin,allowIdle:!1});p=A,f.value=A.isVisible.value,A.whenVisible.then(()=>{b&&p===A&&(f.value=!0)}),v(()=>{b=!1,A.destroy(),p===A&&(p=null)})},{immediate:!0}),ho(()=>{p?.destroy(),p=null}),()=>Lt(f.value?t:n,Ot(it({},s),{ref:m}),i)}})}mo.install=e=>{e.component(mo.__name,mo)};const Hm=Je({name:"CodeBlockNodeLoading",inheritAttrs:!1,props:["node","isDark","loading","stream","theme","darkTheme","lightTheme","isShowPreview","monacoOptions","enableFontSizeControl","minWidth","maxWidth","themes","showHeader","showCopyButton","showExpandButton","showPreviewButton","showCollapseButton","showFontSizeButtons","showTooltips","htmlPreviewAllowScripts","htmlPreviewSandbox","customId","estimatedHeightPx","estimatedContentHeightPx","estimatedDiffInline"],emits:["previewCode","copy"],setup(e,{attrs:t}){const n=e;return()=>{var o,s,i,r,l,a,c;const u=K1(String((s=(o=n.node)==null?void 0:o.language)!=null?s:"")),d=n4[u]||(u?u.charAt(0).toUpperCase()+u.slice(1):n4[""]),f=dne(n.node),h=fne(String((r=(i=n.node)==null?void 0:i.raw)!=null?r:""),d,f),p=n.monacoOptions,m=f&&((l=n.estimatedDiffInline)!=null?l:q2(p??{},typeof window>"u"?0:window.innerWidth)),y=p?.diffAppearance,k=y==="dark"||y!=="light"&&n.isDark===!0,g=typeof p?.fontSize=="number"&&Number.isFinite(p.fontSize)&&p.fontSize>0?p.fontSize:12,v=typeof p?.lineHeight=="number"&&Number.isFinite(p.lineHeight)&&p.lineHeight>0?p.lineHeight:g===12?18:Math.max(12,Math.round(1.5*g)),b=typeof p?.tabSize=="number"&&Number.isFinite(p.tabSize)&&p.tabSize>0?p.tabSize:4,A=f?0:8,I=typeof((a=p?.padding)==null?void 0:a.top)=="number"&&Number.isFinite(p.padding.top)&&p.padding.top>=0?p.padding.top:A,N=typeof((c=p?.padding)==null?void 0:c.bottom)=="number"&&Number.isFinite(p.padding.bottom)&&p.padding.bottom>=0?p.padding.bottom:A,M=typeof p?.fontFamily=="string"?p.fontFamily.trim():"",$=it(it({fontSize:`${g}px`,lineHeight:`${v}px`,tabSize:b,paddingTop:`${I}px`,paddingBottom:`${N}px`,"--markstream-pre-line-number-top":`${I}px`},f?{"--markstream-pre-diff-line-height":`${v}px`}:{}),M?{"--markstream-code-font-family":M}:{}),T=()=>Lt("button",{class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0","aria-hidden":"true",disabled:!0,tabindex:-1,type:"button"},[Lt("svg",{class:"action-icon"})]),F=n.isShowPreview!==!1&&(u==="html"||u==="svg"),S=n.showFontSizeButtons!==!1&&n.enableFontSizeControl!==!1||n.showExpandButton!==!1||F&&n.showPreviewButton!==!1,B=z=>{if(z!=null)return typeof z=="number"?`${z}px`:String(z)},W=it(it(it({"--markstream-code-layout-character-width":"1ch"},B(n.minWidth)?{minWidth:B(n.minWidth)}:{}),B(n.maxWidth)?{maxWidth:B(n.maxWidth)}:{}),f?{}:{color:"var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))",backgroundColor:"var(--vscode-editor-background, var(--markstream-code-fallback-bg, var(--code-bg)))",borderColor:"var(--markstream-code-border-color, var(--code-border))"});return Lt("div",Ot(it({},t),{class:["code-block-container","rounded-lg","border",{dark:n.isDark===!0,"is-rendering":n.loading!==!1,"is-dark":k,"is-diff":f,"is-plain-text":u===""||u==="plaintext"||u==="text"},t.class],style:[W,t.style],"data-markstream-code-block":"1","data-markstream-enhanced":"false","data-markstream-code-block-state":n.loading?"streaming":"settled","data-markstream-code-loading":"1"}),[n.showHeader===!1?null:Lt("div",{class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},[Lt("div",{class:"code-header-main"},[Lt("span",{class:"icon-slot h-4 w-4 flex-shrink-0"}),Lt("div",{class:"code-header-copy"},[Lt("div",{class:"code-header-title"},h.title),h.caption?Lt("div",{class:"code-header-caption"},h.caption):null])]),Lt("div",{class:"flex items-center gap-0.5",style:{visibility:"hidden"}},[f?Lt("div",{class:"code-diff-stats","aria-hidden":"true"},[Lt("span",{class:"code-diff-stat removed"},"-0"),Lt("span",{class:"code-diff-stat added"},"+0")]):null,n.showCopyButton===!1?null:T(),n.showCollapseButton===!1?null:T(),S?Lt("div",{class:"relative"},[T()]):null])]),Lt("div",{class:"code-block-shell-content",style:n.stream!==!1||n.loading===!1?void 0:{display:"none"}},[Lt(Fs,{node:n.node,loading:n.loading,showLineNumbers:!0,reservedHeightPx:f?void 0:n.estimatedContentHeightPx,diffInline:m,diffHideUnchangedRegions:f?une(p?.diffHideUnchangedRegions):void 0,class:"code-pre-fallback",style:$,"data-markstream-code-loading":"1"})]),Lt("div",{class:"code-loading-placeholder",style:n.stream===!1&&n.loading!==!1?void 0:{display:"none"}},[Lt("div",{class:"loading-skeleton"},[Lt("div",{class:"skeleton-line"}),Lt("div",{class:"skeleton-line"}),Lt("div",{class:"skeleton-line short"})])]),Lt("span",{class:"sr-only","aria-live":"polite",role:"status"})])}}}),av=Md("ViewportDeferredCodeBlockNode",Hi({loader:()=>Zn(null,null,function*(){try{return(yield vs(()=>import("./CodeBlockNode-CWRAiwpN.js"),__vite__mapDeps([4,5]))).default}catch(e){return console.warn('[markstream-vue] Optional peer dependency stream-diffs is missing. Falling back to preformatted code rendering. To enable enhanced code block features, please install "stream-diffs".',e),Fs}}),loadingComponent:Hm,delay:0,suspensible:!1}),Hm),Gi=Hi(()=>Zn(null,null,function*(){var e;if(((e=(function(){const t=Reflect.get(globalThis,"process");return t?.env})())==null?void 0:e.NODE_ENV)==="test"&&typeof window<"u")return t=>{var n,o,s,i;return Lt(mo,Ot(it({},t),{node:{type:"text",content:(o=t.node.raw)!=null?o:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(s=t.node.content)!=null?s:""}$`}}))};try{return yield lE(),(yield vs(()=>import("./index7-lxjTUsdv.js"),[])).default}catch(t){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',t)}return t=>{var n,o,s,i;return Lt(mo,Ot(it({},t),{node:{type:"text",content:(o=t.node.raw)!=null?o:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(s=t.node.content)!=null?s:""}$`}}))}})),wE=Hi(()=>Zn(null,null,function*(){try{return yield lE(),(yield vs(()=>import("./index6-DwtbCuXq.js"),[])).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var t,n,o,s;return Lt(mo,Ot(it({},e),{node:{type:"text",content:(n=e.node.raw)!=null?n:`$$${(t=e.node.content)!=null?t:""}$$`,raw:(s=e.node.raw)!=null?s:`$$${(o=e.node.content)!=null?o:""}$$`}}))}})),bs=Mn(Je({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(t,n)=>(x(),E("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0",onClick:n[0]||(n[0]=o=>t.$emit("click",o,e.node.id,e.messageId,e.threadId)),onMouseenter:n[1]||(n[1]=o=>t.$emit("mouseEnter",o,e.node.id,e.messageId,e.threadId)),onMouseleave:n[2]||(n[2]=o=>t.$emit("mouseLeave",o,e.node.id,e.messageId,e.threadId))},R(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);bs.install=e=>{e.component(bs.__name,bs)};const _ne={class:"superscript-node"},Ps=Mn(Je({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=D(()=>it({text:mo,inline_code:as,link:_s,html_inline:oi,strong:xs,emphasis:Ss,footnote_reference:ni,strikethrough:ws,highlight:si,insert:Ws,subscript:Hs,emoji:Ds,math_inline:Gi,reference:bs},n.value));return(s,i)=>(x(),E("sup",_ne,[(x(!0),E(We,null,rt(e.node.children,(r,l)=>(x(),Se(C(vr),{key:`${e.indexKey||"superscript"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"superscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-24160b22"]]);Ps.install=e=>{e.component(Ps.__name,Ps)};const Sne={class:"subscript-node"},Hs=Mn(Je({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=D(()=>it({text:mo,inline_code:as,link:_s,html_inline:oi,strong:xs,emphasis:Ss,footnote_reference:ni,strikethrough:ws,highlight:si,insert:Ws,superscript:Ps,emoji:Ds,math_inline:Gi,reference:bs},n.value));return(s,i)=>(x(),E("sub",Sne,[(x(!0),E(We,null,rt(e.node.children,(r,l)=>(x(),Se(C(vr),{key:`${e.indexKey||"subscript"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"subscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-197fa13b"]]);Hs.install=e=>{e.component(Hs.__name,Hs)};const Cne={class:"strong-node"},xs=Mn(Je({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=D(()=>it({text:mo,inline_code:as,link:_s,html_inline:oi,emphasis:Ss,strikethrough:ws,highlight:si,insert:Ws,subscript:Hs,superscript:Ps,emoji:Ds,footnote_reference:ni,math_inline:Gi,reference:bs},n.value));return(s,i)=>(x(),E("strong",Cne,[(x(!0),E(We,null,rt(e.node.children,(r,l)=>(x(),Se(C(vr),{key:`${e.indexKey||"strong"}-${l}`,components:o.value,node:r,"index-key":`${e.indexKey||"strong"}-${l}`,"custom-id":t.customId},null,8,["components","node","index-key","custom-id"]))),128))]))}}),[["__scopeId","data-v-a8647104"]]);xs.install=e=>{e.component(xs.__name,xs)};const Ane={class:"strikethrough-node"},ws=Mn(Je({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=D(()=>it({text:mo,inline_code:as,link:_s,html_inline:oi,strong:xs,emphasis:Ss,highlight:si,insert:Ws,subscript:Hs,superscript:Ps,emoji:Ds,footnote_reference:ni,math_inline:Gi,reference:bs},n.value));return(s,i)=>(x(),E("del",Ane,[(x(!0),E(We,null,rt(e.node.children,(r,l)=>(x(),Se(C(vr),{key:`${e.indexKey||"strikethrough"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-b7a531fa"]]);ws.install=e=>{e.component(ws.__name,ws)};const Mne=["href","title","aria-label","aria-hidden","target","rel"],Ene=["aria-hidden"],Tne={class:"link-text-wrapper relative inline-flex"},Nne={class:"leading-[normal] link-text"},_s=Mn(Je({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const t=e,n=Jt("markstreamShowTooltips",void 0),o=D(()=>{const k=n?.value;return typeof k=="boolean"?k:t.showTooltip}),s=D(()=>{var k,g,v,b,A;const I=t.underlineBottom!==void 0?typeof t.underlineBottom=="number"?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px",N=(k=t.animationOpacity)!=null?k:.35,M=Math.max(.12,Math.min(.5*N,N)),$={"--underline-height":`${(g=t.underlineHeight)!=null?g:2}px`,"--underline-bottom":I,"--underline-opacity":String(N),"--underline-rest-opacity":String(M),"--underline-duration":`${(v=t.animationDuration)!=null?v:1.6}s`,"--underline-timing":(b=t.animationTiming)!=null?b:"ease-in-out","--underline-iteration":typeof t.animationIteration=="number"?String(t.animationIteration):(A=t.animationIteration)!=null?A:"infinite"};return t.color&&($["--link-color"]=t.color),$}),i=To(()=>t.customId),r=D(()=>it({text:mo,strong:xs,strikethrough:ws,emphasis:Ss,image:Fl,html_inline:oi,inline_code:as},i.value)),l=Bf(),a=D(()=>{var k,g;const v=(k=t.node)==null?void 0:k.attrs;if(!v||typeof v!="object")return{};const b={};if(Array.isArray(v))for(const A of v)Array.isArray(A)&&A[0]&&(b[String(A[0])]=String((g=A[1])!=null?g:""));else for(const[A,I]of Object.entries(v))A&&I!=null&&I!==!1&&(b[A]=I===!0?"":String(I));return m4(b,"safe","a")}),c=D(()=>it(it({},l),a.value)),u=D(()=>{var k,g;return m4({href:String((g=(k=t.node)==null?void 0:k.href)!=null?g:"")},"safe","a").href}),d=D(()=>{if(!u.value)return;const k=c.value.target;return(typeof k=="string"?k.trim():String(k??"").trim())||(CY(u.value)?"_blank":void 0)}),f=D(()=>{var k;return String((k=d.value)!=null?k:"").trim().toLowerCase()==="_blank"}),h=D(()=>{if(!u.value)return;const k=c.value.rel,g=new Set((typeof k=="string"?k:String(k??"")).split(/\s+/).filter(Boolean)),v=new Set(Array.from(g).filter(b=>b.toLowerCase()!=="opener"));return f.value&&(v.add("noopener"),v.add("noreferrer")),v.size>0?Array.from(v).join(" "):void 0}),p=D(()=>{const k=it({},c.value);return delete k.title,delete k.href,delete k.target,delete k.rel,k});function m(){o.value&&Yte()}const y=D(()=>{var k,g;const v=(k=t.node)==null?void 0:k.title;return typeof v=="string"&&v.trim().length>0?v:String((g=u.value)!=null?g:"")});return(k,g)=>{var v,b;return e.node.loading?(x(),E("span",Sn({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},C(l),{style:s.value}),[w("span",Tne,[w("span",Nne,[ae(C(mo),{class:"leading-[normal] link-text",node:{type:"text",content:String((v=e.node.text)!=null?v:""),raw:String((b=e.node.text)!=null?b:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),g[1]||(g[1]=w("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,Ene)):(x(),E("a",Sn({key:0,class:"link-node",href:u.value,title:o.value?"":y.value,"aria-label":`Link: ${y.value}`,"aria-hidden":e.node.loading?"true":"false",target:d.value,rel:h.value},p.value,{style:s.value,onMouseenter:g[0]||(g[0]=A=>(function(I){var N,M,$,T;if(!o.value)return;const F=I,S=F?.clientX!=null&&F?.clientY!=null?{x:F.clientX,y:F.clientY}:void 0,B=((N=t.node)==null?void 0:N.title)||((M=u.value)!=null&&M.includes("xn--")&&((T=($=t.node)==null?void 0:$.text)!=null&&T.includes("://"))?t.node.text:u.value)||"";Gte(I.currentTarget,B,"top",!1,S)})(A)),onMouseleave:m}),[(x(!0),E(We,null,rt(e.node.children,(A,I)=>(x(),Se(C(vr),{key:`${e.indexKey||"emphasis"}-${I}`,components:r.value,node:A,"custom-id":t.customId,"index-key":`${e.indexKey||"link-text"}-${I}`},null,8,["components","node","custom-id","index-key"]))),128))],16,Mne))}}}),[["__scopeId","data-v-367e6ca4"]]);_s.install=e=>{e.component(_s.__name,_s)};const Ine={class:"insert-node"},Ws=Mn(Je({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=D(()=>it({text:mo,inline_code:as,link:_s,html_inline:oi,strong:xs,emphasis:Ss,strikethrough:ws,highlight:si,subscript:Hs,superscript:Ps,emoji:Ds,footnote_reference:ni,math_inline:Gi,reference:bs},n.value));return(s,i)=>(x(),E("ins",Ine,[(x(!0),E(We,null,rt(e.node.children,(r,l)=>(x(),Se(C(vr),{key:`${e.indexKey||"insert"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-1e2c29d4"]]);Ws.install=e=>{e.component(Ws.__name,Ws)};const Lne={class:"highlight-node"},si=Mn(Je({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=D(()=>it({text:mo,inline_code:as,link:_s,html_inline:oi,strong:xs,emphasis:Ss,strikethrough:ws,insert:Ws,subscript:Hs,superscript:Ps,emoji:Ds,footnote_reference:ni,math_inline:Gi,reference:bs},n.value));return(s,i)=>(x(),E("mark",Lne,[(x(!0),E(We,null,rt(e.node.children,(r,l)=>(x(),Se(C(vr),{key:`${e.indexKey||"highlight"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-7a62982a"]]);si.install=e=>{e.component(si.__name,si)};const $ne={class:"emphasis-node"},Ss=Mn(Je({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=D(()=>it({text:mo,inline_code:as,link:_s,html_inline:oi,strong:xs,strikethrough:ws,highlight:si,insert:Ws,subscript:Hs,superscript:Ps,emoji:Ds,footnote_reference:ni,math_inline:Gi,reference:bs},n.value));return(s,i)=>(x(),E("em",$ne,[(x(!0),E(We,null,rt(e.node.children,(r,l)=>(x(),Se(C(vr),{key:`${e.indexKey||"emphasis"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-2a5aafbf"]]);Ss.install=e=>{e.component(Ss.__name,Ss)};const Fne={class:"hard-break"},Ol=Mn(Je({__name:"HardBreakNode",props:{node:{}},setup:e=>(t,n)=>(x(),E("br",Fne))}),[["__scopeId","data-v-50c58f70"]]);Ol.install=e=>{e.component(Ol.__name,Ol)};const Mf=Je({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const t=e,n=gt({checkbox:ti,checkbox_input:ti,emoji:Ds,emphasis:Ss,hardbreak:Ol,highlight:si,inline_code:as,insert:Ws,link:_s,reference:bs,strikethrough:ws,strong:xs,subscript:Hs,superscript:Ps,text:mo}),o=To(()=>t.customId),s=D(()=>{const i=o.value;return Object.keys(i).length>0?it(it({},n),i):n});return(i,r)=>(x(!0),E(We,null,rt(e.nodes,(l,a)=>(x(),Se(C(vr),{key:a,components:s.value,node:l,"custom-id":t.customId,"index-key":`${e.indexKey||"inline"}-${a}`},null,8,["components","node","custom-id","index-key"]))),128))}});function Zy(e){if(!e||typeof e!="object")return!1;const t=`|${e.type}|`;if(!"|checkbox|checkbox_input|emoji|emphasis|hardbreak|highlight|inline_code|insert|link|reference|strikethrough|strong|subscript|superscript|text|".includes(t))return!1;if(!"|emphasis|highlight|insert|link|strikethrough|strong|subscript|superscript|".includes(t))return!0;const n=e.children;return Array.isArray(n)&&n.every(Zy)}function Wm(e,t=!0,n=!1){if(!e||!n&&e.length===0)return null;if(e.every(Zy))return e;if(!t||e.length!==1)return null;const o=e[0];if(o?.type!=="paragraph"||!Array.isArray(o.children))return null;const s=o.children;return(n||s.length>0)&&s.every(Zy)?s:null}function Va(e){var t,n;if(!e?.length)return null;let o="";for(const s of e){if(s?.type!=="text"||s.center===!0)return null;o+=String((n=(t=s.content)!=null?t:s.raw)!=null?n:"")}return o}const One=["cite"],Bne={key:0,dir:"auto",class:"paragraph-node"},Rne=["custom-id"],Dp=Mn(Je({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=To(()=>t.customId),o=D(()=>!!n.value.paragraph),s=D(()=>!!n.value.text),i=D(()=>Wm(t.node.children,!o.value)),r=D(()=>t.fade!==!1||s.value?null:Va(i.value));return Ln("markstreamShowTooltips",D(()=>t.showTooltips)),Ln("markstreamFade",D(()=>t.fade)),(l,a)=>(x(),E("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[i.value?(x(),E("p",Bne,[r.value!==null?(x(),E("span",{key:0,class:"text-node","custom-id":t.customId},R(r.value),9,Rne)):(x(),Se(C(Mf),{key:1,nodes:i.value,"custom-id":t.customId,"index-key":`blockquote-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(x(),Se(C(zs),{key:1,"show-tooltips":t.showTooltips,"index-key":`blockquote-${t.indexKey}`,nodes:t.node.children||[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:a[0]||(a[0]=c=>l.$emit("copy",c))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade"]))],8,One))}}),[["__scopeId","data-v-abfecebc"]]);Dp.install=e=>{e.component(Dp.__name,Dp)};const Dne={class:"definition-list"},Pne={class:"definition-term"},Hne={class:"definition-desc"},Pp=Mn(Je({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,o)=>(x(),E("dl",Dne,[(x(!0),E(We,null,rt(t.node.items,(s,i)=>(x(),E(We,{key:i},[w("dt",Pne,[ae(C(zs),{"index-key":`definition-term-${t.indexKey}-${i}`,nodes:s.term,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[0]||(o[0]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])]),w("dd",Hne,[ae(C(zs),{"index-key":`definition-desc-${t.indexKey}-${i}`,nodes:s.definition,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[1]||(o[1]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],64))),128))]))}}),[["__scopeId","data-v-4e103b30"]]);Pp.install=e=>{e.component(Pp.__name,Pp)};const Wne=["href","title"],Yd=Mn(Je({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const t=e;function n(o){var s;if(o.preventDefault(),typeof document>"u")return;const i=`fnref-${String((s=t.node.id)!=null?s:"")}`,r=document.getElementById(i);r&&r.scrollIntoView({behavior:"smooth",block:"center"})}return(o,s)=>(x(),E("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:n}," ↩︎ ",8,Wne))}}),[["__scopeId","data-v-e1eb37b6"]]);Yd.install=e=>{e.component(Yd.__name,Yd)};const zne=["id"],Une={class:"flex-1"},Hp=Je({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,o)=>(x(),E("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[w("div",Une,[ae(C(zs),{"index-key":`footnote-${t.indexKey}`,nodes:t.node.children,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[0]||(o[0]=s=>n.$emit("copy",s))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],8,zne))}});Hp.install=e=>{e.component(Hp.__name,Hp)};const qne=["custom-id"],Xy=Mn(Je({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=To(()=>t.customId),o=Jt("markstreamFade",void 0),s=D(()=>o?.value!==!1||n.value.text?null:Va(t.node.children)),i=D(()=>it({text:mo,inline_code:as,link:_s,image:Fl,strong:xs,emphasis:Ss,strikethrough:ws,highlight:si,insert:Ws,subscript:Hs,superscript:Ps,emoji:Ds,checkbox:ti,checkbox_input:ti,footnote_reference:ni,hardbreak:Ol,math_inline:Gi,reference:bs},n.value));return(r,l)=>(x(),Se(Ho(`h${e.node.level}`),Sn({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:Ie(()=>[s.value!==null?(x(),E("span",{key:0,class:"text-node","custom-id":t.customId},R(s.value),9,qne)):(x(!0),E(We,{key:1},rt(e.node.children,(a,c)=>(x(),Se(C(vr),{key:c,components:i.value,"custom-id":t.customId,node:a,"index-key":`${e.indexKey||"heading"}-${c}`},null,8,["components","custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-7122dbe1"]]),Z1=Xy;Z1.install=e=>{e.component(Xy.__name,Xy)};const jne={key:0,dir:"auto",class:"paragraph-node"},Vne=["custom-id"],Kne={dir:"auto",class:"paragraph-node"},Gne=["custom-id"],du=Mn(Je({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=D(()=>{var h;return(h=t.node)!=null?h:t.item}),o=To(()=>t.customId),s=D(()=>!!o.value.paragraph),i=D(()=>!!o.value.text),r=D(()=>{var h;return Wm((h=n.value)==null?void 0:h.children,!s.value)}),l=D(()=>{var h;if(s.value)return null;const p=(h=n.value)==null?void 0:h.children;if(!Array.isArray(p)||p.length<2)return null;const m=p[0];if(m?.type!=="paragraph"||!Array.isArray(m.children))return null;const y=p.slice(1);if(!y.every(g=>g?.type==="list"))return null;const k=Wm([m]);return k?{paragraphChildren:k,nestedLists:y}:null});function a(){return t.fade===!1&&!i.value}const c=D(()=>a()?Va(r.value):null),u=D(()=>{var h;return a()?Va((h=l.value)==null?void 0:h.paragraphChildren):null}),d=Object.freeze({}),f=D(()=>{const{value:h}=t;return typeof h=="number"&&Number.isFinite(h)?{value:h}:d});return Ln("markstreamShowTooltips",D(()=>t.showTooltips)),Ln("markstreamFade",D(()=>t.fade)),(h,p)=>{var m,y;return x(),E("li",Sn({class:"list-item",dir:"auto"},f.value),[r.value?(x(),E("p",jne,[c.value!==null?(x(),E("span",{key:0,class:"text-node","custom-id":t.customId},R(c.value),9,Vne)):(x(),Se(C(Mf),{key:1,nodes:r.value,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):l.value?(x(),E(We,{key:1},[w("p",Kne,[u.value!==null?(x(),E("span",{key:0,class:"text-node","custom-id":t.customId},R(u.value),9,Gne)):(x(),Se(C(Mf),{key:1,nodes:l.value.paragraphChildren,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(x(!0),E(We,null,rt(l.value.nestedLists,(k,g)=>(x(),Se(C(zs),{key:g,nodes:[k],"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-nested-${g}`,"show-tooltips":t.showTooltips,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:p[0]||(p[0]=v=>h.$emit("copy",v))},null,8,["nodes","custom-id","index-key","show-tooltips","typewriter","fade","is-dark"]))),128))],64)):(x(),Se(C(zs),{key:2,"show-tooltips":t.showTooltips,"index-key":`list-item-${t.indexKey}`,nodes:(y=(m=n.value)==null?void 0:m.children)!=null?y:[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,onCopy:p[1]||(p[1]=k=>h.$emit("copy",k))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade","is-dark"]))],16)}}}),[["__scopeId","data-v-617214f9"]]);du.install=e=>{e.component(du.__name,du)};const fu=Mn(Je({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=To(()=>e.customId),n=D(()=>t.value.list_item||du);return(o,s)=>(x(),Se(Ho(e.node.ordered?"ol":"ul"),{class:Ue(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:Ie(()=>[(x(!0),E(We,null,rt(e.node.items,(i,r)=>{var l;return x(),Se(Ho(n.value),Sn({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:i,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?((l=e.node.start)!=null?l:1)+r:void 0,onCopy:s[0]||(s[0]=a=>o.$emit("copy",a))}),null,16,["node","custom-id","index-key","typewriter","fade","is-dark","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-99cb95e0"]]);fu.install=e=>{e.component(fu.__name,fu)};const Yne={key:2,class:"html-block-node__raw"},Zne=["innerHTML"],Xne={key:1,class:"html-block-node__placeholder"},Zd=Mn(Je({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=Jt("markstreamHtmlPolicy",void 0),o=Jt("markstreamNestedRendererProps",void 0),s=D(()=>{var S,B;return(B=(S=t.htmlPolicy)!=null?S:n?.value)!=null?B:"safe"}),i=D(()=>{var S,B;const W=(S=o?.value)!=null?S:{};return Ot(it({},W),{customId:(B=t.customId)!=null?B:W.customId,htmlPolicy:s.value})}),r=Hi({loader:()=>Promise.resolve().then(()=>eb),suspensible:!1}),l=D(()=>{const S=Fp(t.node.attrs,s.value);if(!S)return;const B=jd(S);return Object.keys(B).length>0?B:void 0}),a=D(()=>{const S=String(t.node.tag||"").trim(),B=Fp(t.node.attrs,s.value,S);if(!B)return;const W=jd(B);return Object.keys(W).length>0?W:void 0}),c=To(()=>t.customId),u=Je({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),d=oe(null),f=oe(typeof window>"u"),h=oe(t.node.content),p=D(()=>Array.isArray(t.node.children)?t.node.children:[]),m=D(()=>String(t.node.tag||"div")),y=D(()=>{var S;if(m.value.trim().toLowerCase()!=="details"||(S=t.node.attrs)!=null&&S.some(([W])=>String(W).toLowerCase()==="open"))return null;const B=p.value[0];return B?.type==="html_block"&&String(B.tag||"").toLowerCase()==="summary"?B:null}),k=D(()=>{var S;return Va((S=y.value)==null?void 0:S.children)}),g=D(()=>{const S=y.value;if(!S)return;const B=Fp(S.attrs,s.value,"summary");if(!B)return;const W=jd(B);return Object.keys(W).length>0?W:void 0}),v=D(()=>k.value==null?p.value:p.value.slice(1)),b=D(()=>{const S=m.value.trim().toLowerCase();return q5.has(S)||O2(S,s.value)}),A=D(()=>p.value.length>0&&!!t.node.tag&&!b.value),I=D(()=>{var S,B,W;if(A.value)return{mode:"structured"};if(!f.value)return{mode:"html",content:(S=h.value)!=null?S:""};const z=(B=h.value)!=null?B:t.node.content;if(!z)return{mode:"html",content:""};if(s.value==="escape")return{mode:"html",content:uu(z,s.value)};if(t.node.loading){const O=Pm(z,c.value,s.value);return O===null?{mode:"text",content:(W=t.node.raw)!=null?W:z}:{mode:"dynamic",nodes:O}}if(!mE(z,c.value))return{mode:"html",content:uu(z,s.value)};const L=Pm(z,c.value,s.value);return L===null?{mode:"html",content:uu(z,s.value)}:{mode:"dynamic",nodes:L}}),N=U2(),M=W2(),$=z2(),T=gr(null),F=!!t.node.loading;return typeof window<"u"?(et([()=>d.value,()=>M?.value.heavyBlockMargin,()=>M?.value.rootMargin],([S],B,W)=>{var z,L,O,U;if((L=(z=T.value)==null?void 0:z.destroy)==null||L.call(z),T.value=null,!F)return f.value=!0,void(h.value=t.node.content);if(!S)return void(f.value=!1);let Z=!0;const ie=(U=(O=M?.value.heavyBlockMargin)!=null?O:M?.value.rootMargin)!=null?U:ja,q=N(S,{rootMargin:ie,allowIdle:!$.value});T.value=q,f.value=f.value||q.isVisible.value,q.whenVisible.then(()=>{Z&&T.value===q&&(f.value=!0)}),W(()=>{Z=!1,q.destroy(),T.value===q&&(T.value=null)})},{immediate:!0}),et(()=>t.node.content,S=>{F&&!f.value||(h.value=S)})):f.value=!0,ho(()=>{var S,B;(B=(S=T.value)==null?void 0:S.destroy)==null||B.call(S),T.value=null}),(S,B)=>(x(),Se(Ho(A.value?m.value:"div"),Sn({ref_key:"htmlRef",ref:d,class:"html-block-node","data-markstream-viewport-pending":C($)&&!f.value?"true":void 0},A.value?a.value:void 0),{default:Ie(()=>[f.value?(x(),E(We,{key:0},[I.value.mode==="structured"?(x(),E(We,{key:0},[k.value!==null?(x(),E(We,{key:0},[w("summary",C9(bM(g.value)),R(k.value),17),v.value.length?(x(),Se(C(r),Sn({key:0},i.value,{nodes:v.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):ue("",!0)],64)):(x(),Se(C(r),Sn({key:1},i.value,{nodes:p.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"]))],64)):I.value.mode==="dynamic"?(x(),Se(C(u),{key:1,nodes:I.value.nodes},null,8,["nodes"])):I.value.mode==="text"?(x(),E("pre",Yne,R(I.value.content),1)):(x(),E("div",Sn({key:3},l.value,{innerHTML:I.value.content}),null,16,Zne))],64)):(x(),E("div",Xne,[jn(S.$slots,"placeholder",{node:e.node},()=>[B[0]||(B[0]=w("span",{class:"html-block-node__placeholder-bar"},null,-1)),B[1]||(B[1]=w("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),B[2]||(B[2]=w("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16,["data-markstream-viewport-pending"]))}}),[["__scopeId","data-v-e140a874"]]);Zd.install=e=>{e.component(Zd.__name,Zd)};const Qne={dir:"auto",class:"paragraph-node"},Jne=["custom-id"],Ha=Mn(Je({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){const t=e,n=To(()=>t.customId),o=Jt("markstreamHtmlPolicy",void 0),s=Jt("markstreamFade",void 0),i=Jt("markstreamParseOptions",void 0),r=Jt("markstreamCustomMarkdownIt",void 0),l=Jt("markstreamNestedRendererProps",void 0),a=D(()=>{var M;return(M=o?.value)!=null?M:"safe"}),c=D(()=>{var M;return(M=t.parseOptions)!=null?M:i?.value}),u=D(()=>{var M;return(M=t.customMarkdownIt)!=null?M:r?.value}),d=D(()=>{var M,$;return($=t.customHtmlTags)!=null?$:(M=l?.value)==null?void 0:M.customHtmlTags}),f=D(()=>{var M,$;const T=(M=l?.value)!=null?M:{};return Ot(it({},T),{customId:($=t.customId)!=null?$:T.customId,customHtmlTags:d.value,parseOptions:c.value,customMarkdownIt:u.value,htmlPolicy:a.value})}),h=Hi({loader:()=>Promise.resolve().then(()=>eb),suspensible:!1});function p(M){var $;return M.type==="text"&&String(($=M.content)!=null?$:"").trim()===""}const m=D(()=>t.node.children.filter(M=>!p(M))),y=D(()=>m.value.length>0&&m.value.every(M=>M.type==="image"||(function($){var T;const F=(function(S){return S.type==="link"&&Array.isArray(S.children)?S.children.filter(B=>!p(B)):[]})($);return F.length===1&&((T=F[0])==null?void 0:T.type)==="image"})(M))),k=D(()=>new Set(tc(d.value))),g=D(()=>{if(!y.value||m.value.length<=1)return t.node.children;const M=[];for(let $=0;$<t.node.children.length;$++){const T=t.node.children[$];if(!p(T)){M.push(T);continue}const F=M.length>0,S=t.node.children.slice($+1).some(B=>!p(B));F&&S&&M.push(Ot(it({},T),{content:" ",raw:" "}))}return M}),v=D(()=>s?.value===!1&&!n.value.text),b=D(()=>v.value?Va(g.value):null);function A(M,$){return{node:M,"index-key":`${t.indexKey}-${$}`,"custom-id":t.customId,"custom-html-tags":d.value}}const I=D(()=>it({inline_code:as,image:Fl,link:_s,hardbreak:Ol,emphasis:Ss,strong:xs,strikethrough:ws,highlight:si,insert:Ws,subscript:Hs,superscript:Ps,html_inline:oi,html_block:Zd,emoji:Ds,checkbox:ti,math_inline:Gi,checkbox_input:ti,reference:bs,footnote_anchor:Yd,footnote_reference:ni,text:mo},n.value)),N=D(()=>g.value.map((M,$)=>{var T;const F=(function(S){var B,W,z,L;if(S.type==="html_block"||S.type==="html_inline"){const O=String((B=S.tag)!=null?B:"").trim().toLowerCase()||Y5(S.content);if(O&&!k.value.has(O)&&Z5((W=S.content)!=null?W:S.raw,O)){const U=String((L=(z=S.content)!=null?z:S.raw)!=null?L:"");return{child:{type:"text",content:U,raw:U},component:mo,isCustomComponent:!1}}}return{child:S,component:I.value[S.type],isCustomComponent:!!(n.value[S.type]&&!Kf(String(S.type)))}})(M);return Ot(it({},F),{index:$,key:`${t.indexKey||"paragraph"}-${$}`,customAttrs:F.isCustomComponent?H2(F.child,a.value):void 0,hasSlotChildren:Array.isArray(F.child.children)&&F.child.children.length>0,slotContent:String((T=F.child.content)!=null?T:""),originalChild:M})}));return(M,$)=>(x(),E("p",Qne,[b.value!==null?(x(),E("span",{key:0,class:"text-node","custom-id":t.customId},R(b.value),9,Jne)):(x(!0),E(We,{key:1},rt(N.value,T=>{return x(),E(We,{key:T.key},[y.value&&p(T.originalChild)?(x(),E(We,{key:0},[ot(R((F=T.originalChild,String((S=F.content)!=null?S:""))),1)],64)):T.isCustomComponent?(x(),Se(Ho(T.component),Sn({key:1,ref_for:!0},T.customAttrs,{node:T.child,loading:T.child.loading,"index-key":T.key,"custom-id":t.customId,"custom-html-tags":d.value,"is-dark":f.value.isDark}),{default:Ie(()=>[T.hasSlotChildren?(x(),Se(C(h),Sn({key:0,ref_for:!0},f.value,{nodes:T.child.children,"index-key":T.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):T.slotContent?(x(),Se(C(h),Sn({key:1,ref_for:!0},f.value,{content:T.slotContent,final:!T.child.loading,"index-key":`${T.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ue("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(x(),Se(Ho(T.component),Sn({key:2,ref_for:!0},A(T.child,T.index)),null,16))],64);var F,S}),128))]))}}),[["__scopeId","data-v-c59ff506"]]);Ha.install=e=>{e.component(Ha.__name,Ha)};const eoe={class:"table-node-wrapper"},toe=["aria-busy"],noe={key:0},ooe=["custom-id"],soe=["aria-label","onPointerdown"],ioe=["custom-id"],roe={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Xd=Mn(Je({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=D(()=>{var k;return(k=t.node.loading)!=null&&k}),o=D(()=>{var k;return(k=t.node.rows)!=null?k:[]}),s=oe(null),i=oe([]);let r=null;const l=D(()=>t.node.header.cells.length),a=D(()=>i.value.some(k=>Number.isFinite(k)&&k>0)),c=D(()=>a.value?i.value.map(k=>k>0?{width:`${k}px`}:void 0):[]);Ln("markstreamShowTooltips",D(()=>t.showTooltips)),Ln("markstreamFade",D(()=>t.fade));const u=To(()=>t.customId),d=D(()=>!!u.value.text),f=D(()=>!!u.value.paragraph),h=new WeakMap;function p(k){const g=t.fade===!1&&!d.value,v=!f.value,b=h.get(k);if(b?.children===k.children&&b.textFastPath===g&&b.paragraphFastPath===v)return b.info;const A=Wm(k.children,v,!0),I={simpleChildren:A,plainText:A&&g?Va(A):null};return h.set(k,{children:k.children,textFastPath:g,paragraphFastPath:v,info:I}),I}function m(k){if(!r)return;k.preventDefault();const g=r.startWidth+r.nextStartWidth,v=Math.min(48,Math.floor(g/2)),b=Math.max(v,Math.min(g-v,Math.round(r.startWidth+k.clientX-r.startX))),A=[...r.widths];A[r.index]=b,A[r.index+1]=g-b,i.value=A}function y(){r&&(window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y),r=null)}return et(l,()=>{y(),i.value=[]}),ho(y),(k,g)=>(x(),E("div",eoe,[w("table",{ref_key:"tableRef",ref:s,class:Ue(["table-node",{"table-node--loading":n.value}]),"aria-busy":n.value},[a.value?(x(),E("colgroup",noe,[(x(!0),E(We,null,rt(e.node.header.cells,(v,b)=>(x(),E("col",{key:b,style:on(c.value[b])},null,4))),128))])):ue("",!0),w("thead",null,[w("tr",null,[(x(!0),E(We,null,rt(e.node.header.cells,(v,b)=>(x(),E("th",{key:b,dir:"auto",class:Ue([v.align==="right"?"text-right":v.align==="center"?"text-center":"text-left"])},[p(v).plainText!==null?(x(),E("span",{key:0,class:"text-node","custom-id":t.customId},R(p(v).plainText),9,ooe)):p(v).simpleChildren?(x(),Se(C(Mf),{key:1,nodes:p(v).simpleChildren,"custom-id":t.customId,"index-key":`table-th-${t.indexKey}-${b}`},null,8,["nodes","custom-id","index-key"])):(x(),Se(C(zs),{key:2,nodes:v.children,"index-key":`table-th-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:g[0]||(g[0]=A=>k.$emit("copy",A))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"])),b<e.node.header.cells.length-1?(x(),E("button",{key:3,type:"button",class:"table-node__resize-handle","aria-label":`Resize columns ${b+1} and ${b+2}`,onPointerdown:A=>(function(I,N){if(N.button!==0)return;const M=(function(){var F;const S=(F=s.value)==null?void 0:F.querySelectorAll("thead th");return Array.from(S??[],B=>Math.round(B.getBoundingClientRect().width))})(),$=M[I],T=M[I+1];$&&T&&(N.preventDefault(),r={index:I,startX:N.clientX,startWidth:$,nextStartWidth:T,widths:M},i.value=M,window.addEventListener("pointermove",m),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y))})(b,A)},null,40,soe)):ue("",!0)],2))),128))])]),w("tbody",null,[(x(!0),E(We,null,rt(o.value,(v,b)=>(x(),E("tr",{key:b},[(x(!0),E(We,null,rt(v.cells,(A,I)=>(x(),E("td",{key:I,class:Ue([A.align==="right"?"text-right":A.align==="center"?"text-center":"text-left"]),dir:"auto"},[p(A).plainText!==null?(x(),E("span",{key:0,class:"text-node","custom-id":t.customId},R(p(A).plainText),9,ioe)):p(A).simpleChildren?(x(),Se(C(Mf),{key:1,nodes:p(A).simpleChildren,"custom-id":t.customId,"index-key":`table-td-${t.indexKey}-${b}-${I}`},null,8,["nodes","custom-id","index-key"])):(x(),Se(C(zs),{key:2,nodes:A.children,"index-key":`table-td-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:g[1]||(g[1]=N=>k.$emit("copy",N))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"]))],2))),128))]))),128))])],10,toe),ae(Ua,{name:"table-node-fade"},{default:Ie(()=>[n.value?(x(),E("div",roe,[jn(k.$slots,"loading",{isLoading:n.value},()=>[g[2]||(g[2]=w("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),g[3]||(g[3]=w("span",{class:"sr-only"},"Loading",-1))],!0)])):ue("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);Xd.install=e=>{e.component(Xd.__name,Xd)};const loe={class:"hr-node"},Wp=Mn({},[["render",function(e,t){return x(),E("hr",loe)}],["__scopeId","data-v-39b2349c"]]);Wp.install=e=>{e.component(Wp.__name,Wp)};const aoe={class:"unknown-node"},Qy=Je({__name:"FallbackComponent",props:{node:{}},setup:e=>(t,n)=>(x(),E("div",aoe,R(e.node.raw),1))}),zp=Mn(Je({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const t=e,n=D(()=>`vmr-container vmr-container-${t.node.name}`),o=To(()=>t.customId),s=D(()=>it({text:mo,paragraph:Ha,heading:Z1,inline_code:as,link:_s,image:Fl,strong:xs,emphasis:Ss,strikethrough:ws,insert:Ws,subscript:Hs,superscript:Ps,checkbox:ti,checkbox_input:ti,hardbreak:Ol,math_inline:Gi,reference:bs,list:fu,math_block:wE,table:Xd},o.value));return(i,r)=>(x(),E("div",Sn({class:n.value},e.node.attrs),[(x(!0),E(We,null,rt(e.node.children,(l,a)=>{return x(),Se(Ho((c=l.type,s.value[c]||Qy)),{key:`${e.indexKey||"vmr-container"}-${a}`,"custom-id":t.customId,node:l,"index-key":`${e.indexKey||"vmr-container"}-${a}`,typewriter:t.typewriter,fade:t.fade},null,8,["custom-id","node","index-key","typewriter","fade"]);var c}),128))],16))}}),[["__scopeId","data-v-911e41c4"]]);zp.install=e=>{e.component(zp.__name,zp)};const coe=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],S4=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function uoe(e){if(e<=255)return coe[e];let t=0,n=S4.length-1;for(;t<=n;){const o=t+n>>1,s=S4[o];if(e<s[0])n=o-1;else{if(!(e>s[1]))return s[2];t=o+1}}return"L"}const doe=/[ \t\n\r\f]+/g,foe=/[\t\n\r\f]| {2,}|^ | $/;let cv=null;const hoe=new RegExp("\\p{Script=Arabic}","u"),ql=new RegExp("\\p{M}","u"),j2=new RegExp("\\p{Nd}","u");function C4(e){return hoe.test(e)}function A4(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function dr(e){for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(!(n<12288)){if(n>=55296&&n<=56319&&t+1<e.length){const o=e.charCodeAt(t+1);if(o>=56320&&o<=57343){if(A4(o-56320+(n-55296<<10)+65536))return!0;t++;continue}}if(A4(n))return!0}}return!1}const poe=new Set([" "," ","⁠","\uFEFF"]),moe=new Set(["-","‐","–","—"]);function _E(e,t){return!((function(n){const o=Qd(n);return o!==null&&poe.has(o)})(e)||t&&((function(n){const o=Qd(n);return o!==null&&(V2.has(o)||Ka.has(o))})(e)||(function(n){const o=Qd(n);return o!==null&&moe.has(o)})(e)))}const V2=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),X1=new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),K2=new Set(["'","’"]),Ka=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),goe=new Set([":",".","،","؛"]),voe=new Set(["၏"]),yoe=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function koe(e){if(G2(e))return!0;let t=!1;for(const n of e)if(Ka.has(n)||Um(n))t=!0;else if(!t||!ql.test(n))return!1;return t}function boe(e){for(const t of e)if(!V2.has(t)&&!Ka.has(t))return!1;return e.length>0}function xoe(e){if(G2(e))return!0;for(const t of e)if(!(X1.has(t)||K2.has(t)||ql.test(t)||Um(t)))return!1;return e.length>0}function G2(e){let t=!1;for(const n of e)if(n!=="\\"&&!ql.test(n)){if(!(X1.has(n)||Ka.has(n)||K2.has(n)))return!1;t=!0}return t}function zm(e,t){const n=t-1;if(n<=0)return Math.max(n,0);const o=e.charCodeAt(n);if(o<56320||o>57343)return n;const s=n-1;if(s<0)return n;const i=e.charCodeAt(s);return i>=55296&&i<=56319?s:n}function Qd(e){if(e.length===0)return null;const t=zm(e,e.length);return e.slice(t)}const woe=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function Um(e){const t=e.codePointAt(0);return t!==void 0&&(function(n,o){for(let s=0;s<o.length;s+=2)if(n>=o[s]&&n<=o[s+1])return!0;return!1})(t,woe)}function _oe(e){const t=(function(n){for(const o of n)if(!ql.test(o))return o;return null})(e);return t!==null&&j2.test(t)}function Soe(e){const t=Array.from(e);let n=t.length;for(;n>0;){const o=t[n-1];if(ql.test(o))n--;else{if(!X1.has(o)&&!K2.has(o))break;n--}}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function Coe(e,t,n){return n!=="text"||t||e.length!==1||e==="-"||e==="—"?null:e}function M4(e,t,n,o){const s=t[o],i=e[o];if(s==null)return i;const r=n[o];if(i.length===r)return i;const l=s.repeat(r);return e[o]=l,l}function E4(e,t){return e&&t!==null&&goe.has(t)}function Aoe(e){const t=Qd(e);return t!==null&&voe.has(t)}function Moe(e){if(e.length<2||e[0]!==" ")return null;const t=e.slice(1);return new RegExp("^\\p{M}+$","u").test(t)?{space:" ",marks:t}:null}function Jy(e){let t=e.length;for(;t>0;){const n=zm(e,t),o=e.slice(n,t);if(yoe.has(o))return!0;if(!Ka.has(o))return!1;t=n}return!1}function Eoe(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===`
290
290
  `)return"hard-break"}return e===" "?"space":e===" "||e===" "||e==="⁠"||e==="\uFEFF"?"glue":e==="​"?"zero-width-break":e==="­"?"soft-hyphen":"text"}const Toe=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Ri(e){return e.length===1?e[0]:e.join("")}function Noe(e,t){const n=[];for(let o=e.length-1;o>=0;o--)n.push(e[o]);return n.push(t),Ri(n)}function Ioe(e,t,n,o){if(!Toe.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];const s=[];let i=null,r=[],l=n,a=!1,c=0;for(const u of e){const d=Eoe(u,o),f=d==="text"&&t;i===null||d!==i||f!==a?(i!==null&&s.push({text:Ri(r),isWordLike:a,kind:i,start:l}),i=d,r=[u],l=n+c,a=f,c+=u.length):(r.push(u),c+=u.length)}return i!==null&&s.push({text:Ri(r),isWordLike:a,kind:i,start:l}),s}function uv(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}const Loe=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function $oe(e,t){const n=e.texts[t];return!!n.startsWith("www.")||Loe.test(n)&&t+1<e.len&&e.kinds[t+1]==="text"&&e.texts[t+1]==="//"}function Foe(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const Ooe=new Set([":","-","/","×",",",".","+","–","—"]),Boe=/[\p{P}\p{S}\p{Co}]/u,Roe=new RegExp("\\p{Emoji_Presentation}","u"),Doe=new Set(["?","֊","-","‐","‒","–","—","…","‼","‽","⁉"]);function SE(e){const t=e.charCodeAt(0);return t<128?(function(n){return n>=33&&n<=47&&n!==45||n>=58&&n<=64&&n!==63||n>=91&&n<=96||n>=123&&n<=126})(t):!Doe.has(e)&&!Roe.test(e)&&Boe.test(e)}function T4(e){let t=!1;for(const n of e)if(!ql.test(n)){if(!SE(n))return!1;t=!0}return t}function Poe(e,t,n,o){const s=!t&&T4(e),i=!o&&T4(n),r=(function(a){const c=(function(u){for(let d=u.length;d>0;){const f=zm(u,d),h=u.slice(f,d);if(!ql.test(h))return h;d=f}return null})(a);return c!==null&&Um(c)})(e),l=(t||r)&&(function(a){for(let c=a.length;c>0;){const u=zm(a,c),d=a.slice(u,c);if(!ql.test(d))return SE(d)||Um(d);c=u}return!1})(e);return!!(s||i||l)&&!dr(e)&&!dr(n)&&(t||s||r)&&(o||i)}function N4(e){for(const t of e)if(j2.test(t))return!0;return!1}function Up(e){if(e.length===0)return!1;for(const t of e)if(!j2.test(t)&&!Ooe.has(t))return!1;return!0}function Hoe(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const n=[];let o=0;for(let s=0;s<e.len;s++)e.kinds[s]==="hard-break"&&(n.push({startSegmentIndex:o,endSegmentIndex:s,consumedEndSegmentIndex:s+1}),o=s+1);return o<e.len&&n.push({startSegmentIndex:o,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),n}function Woe(e,t,n="normal",o="normal"){const s=(function(a){const c=a??"normal";return c==="pre-wrap"?{mode:c,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:c,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}})(n),i=s.mode==="pre-wrap"?(function(a){return/[\r\f]/.test(a)?a.replace(/\r\n/g,`
291
291
  `).replace(/[\r\f]/g,`
292
292
  `):a})(e):(function(a){if(!foe.test(a))return a;let c=a.replace(doe," ");return c.charCodeAt(0)===32&&(c=c.slice(1)),c.length>0&&c.charCodeAt(c.length-1)===32&&(c=c.slice(0,-1)),c})(e);if(i.length===0)return{normalized:i,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const r=(function(a,c,u){var d,f,h;const p=(cv===null&&(cv=new Intl.Segmenter(void 0,{granularity:"word"})),cv);let m=0;const y=[],k=[],g=[],v=[],b=[],A=[],I=[],N=[],M=[],$=[],T=[],F=[];for(const L of p.segment(a))for(const O of Ioe(L.segment,(d=L.isWordLike)!=null&&d,L.index,u)){let U=function(){A[K]!==null&&(k[K]=[M4(y,A,I,K)],A[K]=null),k[K].push(O.text),g[K]=g[K]||O.isWordLike,N[K]=N[K]||q,M[K]=M[K]||ee,$[K]=ne,T[K]=j,F[K]=E4(M[K],fe)};const Z=O.kind==="text",ie=Coe(O.text,O.isWordLike,O.kind),q=dr(O.text),ee=C4(O.text),fe=Qd(O.text),ne=Jy(O.text),j=Aoe(O.text),K=m-1;c.carryCJKAfterClosingQuote&&Z&&m>0&&v[K]==="text"&&q&&N[K]&&$[K]||Z&&m>0&&v[K]==="text"&&boe(O.text)&&N[K]||Z&&m>0&&v[K]==="text"&&T[K]?U():Z&&m>0&&v[K]==="text"&&O.isWordLike&&ee&&F[K]?(U(),g[K]=!0):ie!==null&&m>0&&v[K]==="text"&&A[K]===ie?I[K]=((f=I[K])!=null?f:1)+1:Z&&!O.isWordLike&&m>0&&v[K]==="text"&&!N[K]&&(koe(O.text)||O.text==="-"&&g[K])?U():(y[m]=O.text,k[m]=[O.text],g[m]=O.isWordLike,v[m]=O.kind,b[m]=O.start,A[m]=ie,I[m]=ie===null?0:1,N[m]=q,M[m]=ee,$[m]=ne,T[m]=j,F[m]=E4(ee,fe),m++)}for(let L=0;L<m;L++)A[L]===null?y[L]=Ri(k[L]):y[L]=M4(y,A,I,L);for(let L=1;L<m;L++)v[L]!=="text"||g[L]||!G2(y[L])||v[L-1]!=="text"||N[L-1]||(y[L-1]+=y[L],g[L-1]=g[L-1]||g[L],y[L]="");const S=Array.from({length:m},()=>null);let B=-1;for(let L=m-1;L>=0;L--){const O=y[L];if(O.length!==0){if(v[L]==="text"&&!g[L]&&B>=0&&v[B]==="text"&&(xoe(O)||O==="-"&&_oe(y[B]))){const U=(h=S[B])!=null?h:[];U.push(O),S[B]=U,b[B]=b[L],y[L]="";continue}B=L}}for(let L=0;L<m;L++){const O=S[L];O!=null&&(y[L]=Noe(O,y[L]))}let W=0;for(let L=0;L<m;L++){const O=y[L];O.length!==0&&(W!==L&&(y[W]=O,g[W]=g[L],v[W]=v[L],b[W]=b[L]),W++)}y.length=W,g.length=W,v.length=W,b.length=W;const z=(function(L){const O=L.texts.slice(),U=L.isWordLike.slice(),Z=L.kinds.slice(),ie=L.starts.slice();for(let q=0;q<O.length-1;q++){if(Z[q]!=="text"||Z[q+1]!=="text"||!dr(O[q])||!dr(O[q+1]))continue;const ee=Soe(O[q]);ee!==null&&(O[q]=ee.head,O[q+1]=ee.tail+O[q+1],ie[q+1]=ie[q]+ee.head.length)}return{len:O.length,texts:O,isWordLike:U,kinds:Z,starts:ie}})((function(L){const O=[],U=[],Z=[],ie=[];let q=0;for(;q<L.len;){const ee=L.texts[q],fe=L.kinds[q],ne=L.isWordLike[q];if(fe==="text"){const j=[ee];let K=q+1,ve=ne;for(;K<L.len&&L.kinds[K]==="text"&&Poe(L.texts[K-1],L.isWordLike[K-1],L.texts[K],L.isWordLike[K]);){const he=L.texts[K];j.push(he),ve=ve||L.isWordLike[K],K++}if(K>q+1){O.push(Ri(j)),U.push(ve),Z.push("text"),ie.push(L.starts[q]),q=K;continue}}O.push(ee),U.push(ne),Z.push(fe),ie.push(L.starts[q]),q++}return{len:O.length,texts:O,isWordLike:U,kinds:Z,starts:ie}})((function(L){const O=[],U=[],Z=[],ie=[];for(let q=0;q<L.len;q++){const ee=L.texts[q];if(L.kinds[q]==="text"&&ee.includes("-")){const fe=ee.split("-");let ne=fe.length>1;for(let j=0;j<fe.length;j++){const K=fe[j];if(!ne)break;K.length!==0&&N4(K)&&Up(K)||(ne=!1)}if(ne){let j=0;for(let K=0;K<fe.length;K++){const ve=fe[K],he=K<fe.length-1?`${ve}-`:ve;O.push(he),U.push(!0),Z.push("text"),ie.push(L.starts[q]+j),j+=he.length}continue}}O.push(ee),U.push(L.isWordLike[q]),Z.push(L.kinds[q]),ie.push(L.starts[q])}return{len:O.length,texts:O,isWordLike:U,kinds:Z,starts:ie}})((function(L){const O=[],U=[],Z=[],ie=[];for(let q=0;q<L.len;q++){const ee=L.texts[q],fe=L.kinds[q];if(fe==="text"&&Up(ee)&&N4(ee)){const ne=[ee];let j=q+1;for(;j<L.len&&L.kinds[j]==="text"&&Up(L.texts[j]);)ne.push(L.texts[j]),j++;O.push(Ri(ne)),U.push(!0),Z.push("text"),ie.push(L.starts[q]),q=j-1;continue}O.push(ee),U.push(L.isWordLike[q]),Z.push(fe),ie.push(L.starts[q])}return{len:O.length,texts:O,isWordLike:U,kinds:Z,starts:ie}})((function(L){const O=[],U=[],Z=[],ie=[];for(let q=0;q<L.len;q++){const ee=L.texts[q];if(O.push(ee),U.push(L.isWordLike[q]),Z.push(L.kinds[q]),ie.push(L.starts[q]),!Foe(ee))continue;const fe=q+1;if(fe>=L.len||uv(L.kinds[fe]))continue;const ne=[],j=L.starts[fe];let K=fe;for(;K<L.len&&!uv(L.kinds[K]);)ne.push(L.texts[K]),K++;ne.length>0&&(O.push(Ri(ne)),U.push(!0),Z.push("text"),ie.push(j),q=K-1)}return{len:O.length,texts:O,isWordLike:U,kinds:Z,starts:ie}})((function(L){const O=L.texts.slice(),U=L.isWordLike.slice(),Z=L.kinds.slice(),ie=L.starts.slice();for(let ee=0;ee<L.len;ee++){if(Z[ee]!=="text"||!$oe(L,ee))continue;const fe=[O[ee]];let ne=ee+1;for(;ne<L.len&&!uv(Z[ne]);){fe.push(O[ne]),U[ee]=!0;const j=O[ne].includes("?");if(Z[ne]="text",O[ne]="",ne++,j)break}O[ee]=Ri(fe)}let q=0;for(let ee=0;ee<O.length;ee++){const fe=O[ee];fe.length!==0&&(q!==ee&&(O[q]=fe,U[q]=U[ee],Z[q]=Z[ee],ie[q]=ie[ee]),q++)}return O.length=q,U.length=q,Z.length=q,ie.length=q,{len:q,texts:O,isWordLike:U,kinds:Z,starts:ie}})((function(L){const O=[],U=[],Z=[],ie=[];let q=0;for(;q<L.len;){const ee=[L.texts[q]];let fe=L.isWordLike[q],ne=L.kinds[q],j=L.starts[q];if(ne==="glue"){const K=[ee[0]],ve=j;for(q++;q<L.len&&L.kinds[q]==="glue";)K.push(L.texts[q]),q++;const he=Ri(K);if(!(q<L.len&&L.kinds[q]==="text")){O.push(he),U.push(!1),Z.push("glue"),ie.push(ve);continue}ee[0]=he,ee.push(L.texts[q]),fe=L.isWordLike[q],ne="text",j=ve,q++}else q++;if(ne==="text")for(;q<L.len&&L.kinds[q]==="glue";){const K=[];for(;q<L.len&&L.kinds[q]==="glue";)K.push(L.texts[q]),q++;const ve=Ri(K);q<L.len&&L.kinds[q]==="text"?(ee.push(ve,L.texts[q]),fe=fe||L.isWordLike[q],q++):ee.push(ve)}O.push(Ri(ee)),U.push(fe),Z.push(ne),ie.push(j)}return{len:O.length,texts:O,isWordLike:U,kinds:Z,starts:ie}})({len:W,texts:y,isWordLike:g,kinds:v,starts:b})))))));for(let L=0;L<z.len-1;L++){const O=Moe(z.texts[L]);O!==null&&(z.kinds[L]!=="space"&&z.kinds[L]!=="preserved-space"||z.kinds[L+1]!=="text"||!C4(z.texts[L+1])||(z.texts[L]=O.space,z.isWordLike[L]=!1,z.kinds[L]=z.kinds[L]==="preserved-space"?"preserved-space":"space",z.texts[L+1]=O.marks+z.texts[L+1],z.starts[L+1]=z.starts[L]+O.space.length))}return z})(i,t,s),l=o==="keep-all"?(function(a,c,u){if(c.len<=1)return c;const d=[],f=[],h=[],p=[];let m=-1,y=!1;function k(v){d.push(c.texts[v]),f.push(c.isWordLike[v]),h.push("text"),p.push(c.starts[v])}function g(v){if(!(m<0)){if(y)m+1===v?k(m):(function(b,A){let I=!1;for(let $=b;$<A;$++)I=I||c.isWordLike[$];const N=c.starts[b],M=A<c.len?c.starts[A]:a.length;d.push(a.slice(N,M)),f.push(I),h.push("text"),p.push(N)})(m,v);else for(let b=m;b<v;b++)k(b);m=-1,y=!1}}for(let v=0;v<c.len;v++){const b=c.texts[v],A=c.kinds[v];A!=="text"?(g(v),d.push(b),f.push(c.isWordLike[v]),h.push(A),p.push(c.starts[v])):(m>=0&&!_E(c.texts[v-1],u)&&g(v),m<0&&(m=v),y=y||dr(b))}return g(c.len),{len:d.length,texts:d,isWordLike:f,kinds:h,starts:p}})(i,r,t.breakKeepAllAfterPunctuation):r;return it({normalized:i,chunks:Hoe(l,s)},l)}let Mc=null;const I4=new Map;let Ec=null;const zoe=new RegExp("\\p{Emoji_Presentation}","u"),Uoe=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let dv=null;const L4=new Map;function ek(){if(Mc!==null)return Mc;if(typeof OffscreenCanvas<"u")return Mc=new OffscreenCanvas(1,1).getContext("2d"),Mc;if(typeof document<"u")return Mc=document.createElement("canvas").getContext("2d"),Mc;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function hl(e,t){let n=t.get(e);return n===void 0&&(n={width:ek().measureText(e).width,containsCJK:dr(e)},t.set(e,n)),n}function qm(){if(Ec!==null)return Ec;if(typeof navigator>"u")return Ec={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Ec;const e=navigator.userAgent,t=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),n=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return Ec={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:n,breakKeepAllAfterPunctuation:!t,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},Ec}function CE(){return dv===null&&(dv=new Intl.Segmenter(void 0,{granularity:"grapheme"})),dv}function qoe(e){return zoe.test(e)||e.includes("️")}function pa(e,t,n){return n===0?t.width:t.width-(function(o,s){return s.emojiCount===void 0&&(s.emojiCount=(function(i){let r=0;const l=CE();for(const a of l.segment(i))qoe(a.segment)&&r++;return r})(o)),s.emojiCount})(e,t)*n}function joe(e){return e==="space"||e==="zero-width-break"||e==="soft-hyphen"}function $4(e){return e==="space"||e==="preserved-space"||e==="tab"||e==="zero-width-break"||e==="soft-hyphen"}function F4(e,t,n=e.widths.length){for(;t<n&&joe(e.kinds[t]);)t++;return t}function Voe(e,t){if(t<=0)return 0;const n=e%t;return Math.abs(n)<=1e-6?t:t-n}function Koe(e,t,n){return e.letterSpacing!==0&&t&&e.spacingGraphemeCounts[n]>0?e.letterSpacing:0}function Y2(e,t){return t===0?0:e+t}function Goe(e,t,n,o,s){return Y2(o,t==="tab"?s+(function(i,r){return i.letterSpacing!==0&&i.spacingGraphemeCounts[r]>0?i.letterSpacing:0})(e,n):e.lineEndFitAdvances[n])}function O4(e,t,n,o){return Y2(o,t==="tab"?0:e.lineEndFitAdvances[n])}function B4(e,t,n,o,s){return Y2(o,t==="tab"?s:e.lineEndPaintAdvances[n])}function Yoe(e,t,n){return e.letterSpacing!==0&&t?n+e.letterSpacing:n}function Zoe(e,t){return e.letterSpacing===0?t:t+e.letterSpacing}function sp(e,t,n){let o=t;for(;o<e.length&&e[o]<n;)o++;return o}function Xoe(e,t){return(function(n,o){if(n.simpleLineWalkFastPath)return(function(S,B){const{widths:W,kinds:z,breakableFitAdvances:L,breakablePreferredBreaks:O}=S;if(W.length===0)return 0;const U=B+qm().lineFitEpsilon;let Z=0,ie=0,q=!1,ee=0,fe=0,ne=-1,j=0;function K(Q=ee,P=fe,G=ie){Z++,ie=0,q=!1,ne=-1,j=0}function ve(Q,P){q=!0,ee=Q+1,fe=0,ie=P}function he(Q,P,G){q=!0,ee=Q,fe=P+1,ie=G}function Ae(Q,P){q?(ie+=P,ee=Q+1,fe=0):ve(Q,P)}function re(Q,P){var G;const me=L[Q],ye=(G=O[Q])!=null?G:null;let de=ye===null?-1:sp(ye,0,P+1),V=-1,se=0,pe=P;for(;pe<me.length;){const ke=me[pe];if(q)if(ie+ke>U){if(ye!==null&&V>P){K(Q,V,se),pe=V,de=sp(ye,de,pe+1),V=-1,se=0;continue}K(),he(Q,pe,ke)}else ie+=ke,ee=Q,fe=pe+1;else he(Q,pe,ke);const Ne=pe+1;ye!==null&&ye[de]===Ne&&(V=Ne,se=ie,de++),pe++}q&&ee===Q&&fe===me.length&&(ee=Q+1,fe=0)}let Y=0;for(;Y<W.length&&(q||(Y=F4(S,Y),!(Y>=W.length)));){const Q=W[Y],P=$4(z[Y]);if(q)if(ie+Q>U){if(P){Ae(Y,Q),K(Y+1,0,ie-Q),Y++;continue}if(ne>=0){if(ee>ne||ee===ne&&fe>0){K();continue}K(ne,0,j);continue}if(Q>U&&L[Y]!==null){K(),re(Y,0),Y++;continue}K()}else Ae(Y,Q),P&&(ne=Y+1,j=ie-Q),Y++;else Q>U&&L[Y]!==null?re(Y,0):ve(Y,Q),P&&(ne=Y+1,j=ie-Q),Y++}return q&&K(),Z})(n,o);const{widths:s,kinds:i,breakableFitAdvances:r,breakablePreferredBreaks:l,discretionaryHyphenWidth:a,chunks:c}=n;if(s.length===0||c.length===0)return 0;const u=qm(),d=o+u.lineFitEpsilon;let f=0,h=0,p=!1,m=0,y=0,k=-1,g=0,v=null;function b(){k=-1,g=0,v=null}function A(S=m,B=y,W){f++,h=0,p=!1,b()}function I(S,B){p=!0,m=S+1,y=0,h=B}function N(S,B,W){p=!0,m=S,y=B+1,h=W}function M(S,B){p?(h+=B,m=S+1,y=0):I(S,B)}function $(S,B,W,z,L,O){if(!B)return;const U=O4(n,S,W,L);B4(n,S,W,L,z),k=W+1,g=h-O+U,v=S}function T(S,B){var W;const z=r[S],L=(W=l[S])!=null?W:null;let O=L===null?-1:sp(L,0,B+1),U=-1,Z=B;for(;Z<z.length;){const ie=z[Z];if(p){const ee=Yoe(n,!0,ie),fe=h+ee;if(Zoe(n,fe)>d){if(L!==null&&U>B){A(S,U),Z=U,O=sp(L,O,Z+1),U=-1;continue}A(),N(S,Z,ie)}else h=fe,m=S,y=Z+1}else N(S,Z,ie);const q=Z+1;L!==null&&L[O]===q&&(U=q,O++),Z++}p&&m===S&&y===z.length&&(m=S+1,y=0)}function F(S){f++,b()}for(let S=0;S<c.length;S++){const B=c[S];if(B.startSegmentIndex===B.endSegmentIndex){F();continue}p=!1,h=0,B.startSegmentIndex,m=B.startSegmentIndex,y=0,b();let W=B.startSegmentIndex;for(;W<B.endSegmentIndex&&(p||(W=F4(n,W,B.endSegmentIndex),!(W>=B.endSegmentIndex)));){const z=i[W],L=$4(z),O=Koe(n,p,W),U=z==="tab"?Voe(h+O,n.tabStopAdvance):s[W],Z=O+U,ie=Goe(n,z,W,O,U);if(z!=="soft-hyphen")if(p){if(h+ie>d){const q=h+O4(n,z,W,O);if(B4(n,z,W,O,U),v==="soft-hyphen"&&u.preferEarlySoftHyphenBreak&&g<=d){A(k,0);continue}if(L&&q<=d){M(W,Z),A(W+1,0),W++;continue}if(k>=0&&g<=d){if(m>k||m===k&&y>0){A();continue}const ee=k;A(ee,0),W=ee;continue}if(ie>d&&r[W]!==null){A(),T(W,0),W++;continue}A();continue}M(W,Z),$(z,L,W,U,O,Z),W++}else ie>d&&r[W]!==null?T(W,0):I(W,U),$(z,L,W,U,O,Z),W++;else p&&(m=W+1,y=0,k=W+1,g=h+a,v=z),W++}p&&(B.consumedEndSegmentIndex,A(B.consumedEndSegmentIndex,0))}return f})(e,t)}let fv=null;function Z2(){return fv===null&&(fv=new Intl.Segmenter(void 0,{granularity:"grapheme"})),fv}function Qoe(e,t){const n=[];let o=[],s=0,i=!1,r=!1,l=!1;function a(){o.length!==0&&(n.push({text:o.length===1?o[0]:o.join(""),start:s}),o=[],i=!1,r=!1,l=!1)}function c(d,f,h){o=[d],s=f,i=h,r=Jy(d),l=X1.has(d)}function u(d,f){o.push(d),i=i||f;const h=Jy(d);r=d.length===1&&Ka.has(d)&&r||h,l=!1}for(const d of Z2().segment(e)){const f=d.segment,h=dr(f);o.length!==0?l||V2.has(f)||Ka.has(f)||t.carryCJKAfterClosingQuote&&h&&r?u(f,h):i||h?(a(),c(f,d.index,h)):u(f,h):c(f,d.index,h)}return a(),n}function Joe(e,t,n){if(t.length<=1)return t;const o=[];let s=-1,i=!1;function r(l){if(!(s<0)){if(i)s+1===l?o.push(t[s]):(function(a,c){const u=t[a].start,d=c<t.length?t[c].start:e.length;o.push({text:e.slice(u,d),start:u})})(s,l);else for(let a=s;a<l;a++)o.push(t[a]);s=-1,i=!1}}for(let l=0;l<t.length;l++){const a=t[l];s>=0&&!_E(t[l-1].text,n)&&r(l),s<0&&(s=l),i=i||dr(a.text)}return r(t.length),o}function R4(e,t){if(t==="zero-width-break"||t==="soft-hyphen"||t==="hard-break")return 0;if(t==="tab")return 1;let n=0;const o=Z2();for(const s of o.segment(e))n++;return n}function ese(e){return e==="-"||e==="֊"||e==="‐"||e==="‒"||e==="–"||e==="—"}function tse(e,t,n,o,s){const i=qm(),{cache:r,emojiCorrection:l}=(function(F,S){ek().font=F;const B=(function(L){let O=I4.get(L);return O||(O=new Map,I4.set(L,O)),O})(F),W=(function(L){const O=L.match(/(\d+(?:\.\d+)?)\s*px/);return O?parseFloat(O[1]):16})(F),z=S?(function(L,O){let U=L4.get(L);if(U!==void 0)return U;const Z=ek();Z.font=L;const ie=Z.measureText("😀").width;if(U=0,ie>O+.5&&typeof document<"u"&&document.body!==null){const q=document.createElement("span");q.style.font=L,q.style.display="inline-block",q.style.visibility="hidden",q.style.position="absolute",q.textContent="😀",document.body.appendChild(q);const ee=q.getBoundingClientRect().width;document.body.removeChild(q),ie-ee>.5&&(U=ie-ee)}return L4.set(L,U),U})(F,W):0;return{cache:B,fontSize:W,emojiCorrection:z}})(t,(a=e.normalized,Uoe.test(a)));var a;const c=pa("-",hl("-",r),l)+(s===0?0:2*s),u=8*pa(" ",hl(" ",r),l),d=s!==0;if(e.len===0)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const f=[],h=[],p=[],m=[];let y=e.chunks.length<=1&&!d;const k=null,g=[],v=[],b=[],A=null,I=Array.from({length:e.len});function N(F,S,B,W,z,L,O,U,Z){z!=="text"&&z!=="space"&&z!=="zero-width-break"&&(y=!1),f.push(S),h.push(B),p.push(W),m.push(z),g.push(O),v.push(U),d&&b.push(Z)}function M(F,S,B,W,z){const L=hl(F,r),O=d?R4(F,S):0,U=(function(ee,fe,ne){return fe>1?ee+(fe-1)*ne:ee})(pa(F,L,l),O,s),Z=S==="space"||S==="preserved-space"||S==="zero-width-break"?0:U,ie=Z===0?0:Z+(O>0?s:0),q=S==="space"||S==="zero-width-break"?0:U;if(z&&W&&F.length>1){let ee="sum-graphemes";s!==0?ee="segment-prefixes":Up(F)?ee="pair-context":i.preferPrefixWidthsForBreakableRuns&&(ee="segment-prefixes");const fe=(function(j,K,ve,he,Ae){if(K.breakableFitAdvances!==void 0&&K.breakableFitMode===Ae)return K.breakableFitAdvances;K.breakableFitMode=Ae;const re=CE(),Y=[];for(const me of re.segment(j))Y.push(me.segment);if(Y.length<=1)return K.breakableFitAdvances=null,K.breakableFitAdvances;if(Ae==="sum-graphemes"){const me=[];for(const ye of Y){const de=hl(ye,ve);me.push(pa(ye,de,he))}return K.breakableFitAdvances=me,K.breakableFitAdvances}if(Ae==="pair-context"||Y.length>96){const me=[];let ye=null,de=0;for(const V of Y){const se=pa(V,hl(V,ve),he);if(ye===null)me.push(se);else{const pe=ye+V,ke=hl(pe,ve);me.push(pa(pe,ke,he)-de)}ye=V,de=se}return K.breakableFitAdvances=me,K.breakableFitAdvances}const Q=[];let P="",G=0;for(const me of Y){P+=me;const ye=pa(P,hl(P,ve),he);Q.push(ye-G),G=ye}return K.breakableFitAdvances=Q,K.breakableFitAdvances})(F,L,r,l,ee),ne=fe===null||o==="keep-all"?null:(function(j){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(j))return null;const K=[];let ve=0;for(const he of Z2().segment(j))ve++,ese(he.segment)&&K.push(ve);return K.length===0?null:K})(F);return void N(F,U,ie,q,S,B,fe,ne,O)}N(F,U,ie,q,S,B,null,null,O)}for(let F=0;F<e.len;F++){I[F]=f.length;const S=e.texts[F],B=e.isWordLike[F],W=e.kinds[F],z=e.starts[F];if(W==="soft-hyphen"){N(S,0,c,c,W,z,null,null,0);continue}if(W==="hard-break"){N(S,0,0,0,W,z,null,null,0);continue}if(W==="tab"){N(S,0,0,0,W,z,null,null,d?R4(S,W):0);continue}const L=hl(S,r);if(W==="text"&&L.containsCJK){const O=Qoe(S,i),U=o==="keep-all"?Joe(S,O,i.breakKeepAllAfterPunctuation):O;for(let Z=0;Z<U.length;Z++){const ie=U[Z];M(ie.text,"text",z+ie.start,B,o==="keep-all"||!dr(ie.text))}continue}M(S,W,z,B,!0)}const $=(function(F,S,B){const W=[];for(let z=0;z<F.length;z++){const L=F[z],O=L.startSegmentIndex<S.length?S[L.startSegmentIndex]:B,U=L.endSegmentIndex<S.length?S[L.endSegmentIndex]:B,Z=L.consumedEndSegmentIndex<S.length?S[L.consumedEndSegmentIndex]:B;W.push({startSegmentIndex:O,endSegmentIndex:U,consumedEndSegmentIndex:Z})}return W})(e.chunks,I,f.length),T=k===null?null:(function(F,S){const B=(function(z){const L=z.length;if(L===0)return null;const O=new Array(L);let U=!1;for(let ne=0;ne<L;){const j=z.charCodeAt(ne);let K=j,ve=1;if(j>=55296&&j<=56319&&ne+1<L){const Ae=z.charCodeAt(ne+1);Ae>=56320&&Ae<=57343&&(K=Ae-56320+(j-55296<<10)+65536,ve=2)}const he=uoe(K);he!=="R"&&he!=="AL"&&he!=="AN"||(U=!0);for(let Ae=0;Ae<ve;Ae++)O[ne+Ae]=he;ne+=ve}if(!U)return null;let Z=0;for(let ne=0;ne<L;ne++){const j=O[ne];if(j==="L"){Z=0;break}if(j==="R"||j==="AL"){Z=1;break}}const ie=new Int8Array(L);for(let ne=0;ne<L;ne++)ie[ne]=Z;const q=1&Z?"R":"L",ee=q;let fe=ee;for(let ne=0;ne<L;ne++)O[ne]==="NSM"?O[ne]=fe:fe=O[ne];fe=ee;for(let ne=0;ne<L;ne++){const j=O[ne];j==="EN"?O[ne]=fe==="AL"?"AN":"EN":j!=="R"&&j!=="L"&&j!=="AL"||(fe=j)}for(let ne=0;ne<L;ne++)O[ne]==="AL"&&(O[ne]="R");for(let ne=1;ne<L-1;ne++)O[ne]==="ES"&&O[ne-1]==="EN"&&O[ne+1]==="EN"&&(O[ne]="EN"),O[ne]!=="CS"||O[ne-1]!=="EN"&&O[ne-1]!=="AN"||O[ne+1]!==O[ne-1]||(O[ne]=O[ne-1]);for(let ne=0;ne<L;ne++){if(O[ne]!=="EN")continue;let j;for(j=ne-1;j>=0&&O[j]==="ET";j--)O[j]="EN";for(j=ne+1;j<L&&O[j]==="ET";j++)O[j]="EN"}for(let ne=0;ne<L;ne++){const j=O[ne];j!=="WS"&&j!=="ES"&&j!=="ET"&&j!=="CS"||(O[ne]="ON")}fe=ee;for(let ne=0;ne<L;ne++){const j=O[ne];j==="EN"?O[ne]=fe==="L"?"L":"EN":j!=="R"&&j!=="L"||(fe=j)}for(let ne=0;ne<L;ne++){if(O[ne]!=="ON")continue;let j=ne+1;for(;j<L&&O[j]==="ON";)j++;const K=(ne>0?O[ne-1]:ee)!=="L"?"R":"L";if(K===((j<L?O[j]:ee)!=="L"?"R":"L"))for(let ve=ne;ve<j;ve++)O[ve]=K;ne=j-1}for(let ne=0;ne<L;ne++)O[ne]==="ON"&&(O[ne]=q);for(let ne=0;ne<L;ne++){const j=O[ne];1&ie[ne]?j!=="L"&&j!=="AN"&&j!=="EN"||ie[ne]++:j==="R"?ie[ne]++:j!=="AN"&&j!=="EN"||(ie[ne]+=2)}return ie})(F);if(B===null)return null;const W=new Int8Array(S.length);for(let z=0;z<S.length;z++)W[z]=B[S[z]];return W})(e.normalized,k);return A!==null?{widths:f,lineEndFitAdvances:h,lineEndPaintAdvances:p,kinds:m,simpleLineWalkFastPath:y,segLevels:T,breakableFitAdvances:g,breakablePreferredBreaks:v,letterSpacing:s,spacingGraphemeCounts:b,discretionaryHyphenWidth:c,tabStopAdvance:u,chunks:$,segments:A}:{widths:f,lineEndFitAdvances:h,lineEndPaintAdvances:p,kinds:m,simpleLineWalkFastPath:y,segLevels:T,breakableFitAdvances:g,breakablePreferredBreaks:v,letterSpacing:s,spacingGraphemeCounts:b,discretionaryHyphenWidth:c,tabStopAdvance:u,chunks:$}}const hv="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",nse=["diff ","index ","--- ","+++ ","@@ "],Io=(()=>{const e=globalThis;if(e[hv])return e[hv];const t={configs:{},controllers:{},revision:gr(0),preparedCache:new Map,blockEstimateCache:new Map};return e[hv]=t,t})();let fd=null;const pv=Io.revision;function D4(e){var t;return e&&(t=Io.configs[e])!=null?t:null}function P4(e,t){const n=Number.parseFloat(String(e??""));return Number.isFinite(n)&&n>0?n:t}function ose(e){return e?.type==="text"||e?.type==="emoji"||e?.type==="hardbreak"}function mv(e){var t,n,o;if(!Array.isArray(e)||e.length===0)return null;let s="";for(const i of e){if(!ose(i))return null;i.type==="text"?s+=String((t=i.content)!=null?t:""):i.type==="emoji"?s+=String((o=(n=i.name)!=null?n:i.raw)!=null?o:""):i.type==="hardbreak"&&(s+=`
@@ -294,7 +294,7 @@ ${v}`);u+=N}else u+=I;u+=k,d=h?f+1:e.length}return u}function vee(e,t){if(!e||!t
294
294
  `,t-1)+1;return e.slice(n,t).trim()}function Z4(e){const t=IE(e);return t.length>=2&&t.every(n=>{const o=n.trim();return o.length>=1&&o.replace(/^:/,"").replace(/:$/,"").split("").every(s=>s==="-")})}function IE(e){return e.includes("|")?e.replace(/^\|/,"").replace(/\|$/,"").split("|"):[]}function LE(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function X2(e){const t=String(e??"");return`${t.length}:${LE(t)}`}function nk(e,t=new WeakMap,n=0){if(e==null||typeof e=="number"||typeof e=="boolean")return String(e);if(typeof e=="string")return`s:${(function(r){return r.length<=8192?X2(r):`${r.length}:${LE(r.slice(0,8192))}:truncated`})(e)}`;if(typeof e=="function")return`fn:${Js(e)}`;if(typeof e!="object")return typeof e;const o=e,s=t.get(o);if(s)return`cycle:${s}`;if(n>=6)return`object:${Js(o)}`;const i=Js(o);if(t.set(o,i),Array.isArray(e)){const r=e.slice(0,200);return`a:${e.length}:${r.map(l=>nk(l,t,n+1)).join(",")}`}if(typeof e=="object"){const r=e,l=Object.keys(r).sort(),a=l.slice(0,80);return`o:${l.length}:${a.sort().map(c=>`${c}:${nk(r[c],t,n+1)}`).join(";")}`}return typeof e}function jm(e){return typeof e=="object"&&e!==null&&typeof e.type=="string"&&typeof e.raw=="string"}function $E(e,t=new WeakMap,n=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(o=>jm(o)?jl(o,t,n+1):$E(o,t,n+1)).join(",")}`:jm(e)?jl(e,t,n):nk(e,t,n)}function pse(e,t,n){return Object.keys(e).sort().filter(o=>o!=="children"&&!NE.includes(o)).map(o=>{const s=e[o];return typeof s=="string"?`${o}=s:${X2(s)}`:typeof s=="number"||typeof s=="boolean"||s==null?`${o}=${String(s)}`:typeof s=="function"?`${o}=fn:${Js(s)}`:fse.has(o)&&(Array.isArray(s)||typeof s=="object")?`${o}=${$E(s,t,n+1)}`:s&&typeof s=="object"?`${o}=object:${Js(s)}`:""}).filter(Boolean).join(";")}function mse(e){return NE.map(t=>{const n=e[t];return typeof n=="string"?`${t}=s:${X2(n)}`:""}).filter(Boolean).join(";")}function jl(e,t=new WeakMap,n=0){const o=V4.get(e);if(o)return o;const s=e,i=t.get(s);if(i)return`node-cycle:${i}`;if(n>=6)return`node:${e.type}:${Js(s)}`;const r=Js(s);t.set(s,r);const l=(function(a,c,u){const d=a,f=Array.isArray(d.children)?d.children:[],h=f.length?f.slice(0,200).map(p=>jl(p,c,u+1)).join("|"):"";return[a.type,mse(d),pse(d,c,u),f.length,h].join(":")})(e,t,n);return V4.set(s,l),l}function FE(e,t){return jl(e)===jl(t)}function Q2(e,t,n){const o=Oi(),s=t==="stabilizeSignatureMs"?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return n()}finally{e[t]+=Oi()-o,e[s]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function X4(e,t,n){return Q2(t,n,()=>jl(e))}function OE(e,t,n){return X4(e,n,"stabilizeSignatureMs")===X4(t,n,"stabilizeSignatureMs")}function ip(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function Q4(e,t,n){return e<0?0:Math.max(t.length,n.length)-e}function J4(e){return e.__markstreamHasCustomParserExtensions===!0||(function(t){var n;return Number((n=t.__markstreamRegisteredPluginCount)!=null?n:0)>0})(e)}function gse(e,t){return e.length===t.length&&e===t}function J2(e,t,n=0){if(n>=4)return null;if(e.type!==t.type)return!1;const o=e,s=t,i=Object.keys(o).filter(u=>u!=="type"&&u!=="children").sort(),r=Object.keys(s).filter(u=>u!=="type"&&u!=="children").sort();if(i.length!==r.length)return!1;for(let u=0;u<i.length;u++){const d=i[u];if(d!==r[u])return!1;const f=o[d],h=s[d];if(typeof f!=typeof h)return!1;if(typeof f!="string"){if(typeof f!="number"&&typeof f!="boolean"&&f!=null)return null;if(!Object.is(f,h))return!1}else if(typeof h!="string"||!gse(f,h))return!1}const l=Object.prototype.hasOwnProperty.call(o,"children");if(l!==Object.prototype.hasOwnProperty.call(s,"children"))return!1;if(!l)return!0;const a=o.children,c=s.children;if(!Array.isArray(a)||!Array.isArray(c))return null;if(a.length!==c.length)return!1;for(let u=0;u<a.length;u++){const d=a[u],f=c[u];if(!jm(d)||!jm(f))return null;const h=J2(d,f,n+1);if(h==null)return null;if(!h)return!1}return!0}function vse(e,t){if(!e||!t)return!1;if(e===t)return!0;if(e.type!==t.type)return!1;const n=J2(e,t);return n??FE(e,t)}function yse(e,t,n){if(!e||!t)return!1;if(e===t)return!0;if(e.type!==t.type)return!1;let o=null;return Q2(n,"stabilizeSignatureMs",()=>{o=J2(e,t)}),o??OE(e,t,n)}function kse(e,t){const n={};for(const o of use){const s=e[o],i=t?.[o];typeof s=="number"&&(n[o]=s-(typeof i=="number"?i:0))}return n}function bse(e,t){var n;const o=ZC(t.instanceMsgId),s=new Map,i=(n=t.smoothStreamingEnabled)!=null?n:D(()=>!1),r=oe(t.renderContent.value);let l=[],a="",c="",u="",d=!1;const f=(function(){let W="",z=0,L=!1,O=!1,U=!1,Z=!1;function ie(){W="",z=0,L=!1,O=!1,U=!1,Z=!1}function q(ee){let fe=!1;for(let ne=0;ne<ee.length;ne++){const j=ee.charCodeAt(ne);if(j===10||j===13){const ve=j===10&&Z;Z=j===13,L=!1,ve||(U||(O=!1,z=0),U=!1);continue}Z=!1;const K=j===9||j===32;if(K||(U=!0,O&&(fe=!0)),z)if(z!==1)K||(j!==58?z=j===91?1:0:(fe=!0,O=!0));else{if(L){L=!1;continue}if(j===92){L=!0;continue}j===93&&(z=2)}else j===91&&(z=1)}return fe}return(ee,fe)=>{if(!ee||!fe.startsWith(ee)||fe.length<=ee.length)return ie(),[!0,0];let ne=0;W!==ee&&(ie(),q(ee),ne=ee.length);const j=fe.slice(ee.length),K=q(j);return W=fe,[K,ne+j.length]}})();let h,p=0,m=0,y=Oi(),k=-1,g=0;function v(W){k=Number.isInteger(W)?W:0,g+=1}function b(){h&&(clearTimeout(h),h=void 0)}function A(){b();const W=t.renderContent.value;r.value!==W&&(r.value=W),y=Oi()}et([t.renderContent,t.effectiveFinal,i],([W,z,L])=>{r.value!==W&&(!L||z||(function(O,U){if(!O&&U||U.length<=80||U.length<O.length||!U.startsWith(O))return!0;const Z=U.slice(O.length);return!!Z&&(!!Z4(Y4(U))||!(!Z.includes(`
295
295
 
296
296
  `)&&!/(?:^|\n)(?:#{1,6}\s|[-+*]\s+|\d+[.)]\s+|>\s*|`{3,}|~{3,})/.test(Z))||Z.endsWith(`
297
- `)&&!(function(ie){const q=Y4(ie);if(Z4(q))return!1;const ee=IE(q);return ee.length>=2&&ee.some(fe=>fe.trim())})(U))})(r.value,W)?A():(function(){if(m+=1,h)return;const O=Math.max(0,(function(U){const Z=U.parseCoalesceMs;return typeof Z=="number"&&Number.isFinite(Z)&&Z>=0?Z:80})(e)-(Oi()-y));O<=0?A():h=setTimeout(A,O)})())},{flush:"sync",immediate:!0}),Lf(b);const I=D(()=>{var W,z,L,O;return IY(e.customHtmlTags,(W=e.parseOptions)==null?void 0:W.customHtmlTags,(O=(L=(z=t.customComponentsMap)==null?void 0:z.value)!=null?L:{},Object.entries(O).map(([U,Z])=>{const ie=Ti(U);return Z==null||!ie||Kf(ie)||U5.has(ie)||zf.has(ie)?"":ie}).filter(Boolean)))}),N=D(()=>{const{key:W,tags:z}=LY(I.value);if(!W)return o;const L=s.get(W);if(L)return L;const O=ZC(t.instanceMsgId,{customHtmlTags:z});return s.set(W,O),O}),M=D(()=>{const W=N.value;if(!e.customMarkdownIt)return W;const z=e.customMarkdownIt(W);return W.__markstreamHasCustomParserExtensions=!0,z.__markstreamHasCustomParserExtensions=!0,z}),$=D(()=>{var W,z;const L=(W=e.parseOptions)!=null?W:{},O=t.effectiveFinal.value,U=I.value,Z=O!=null,ie=U.length>0;return Z||ie||L.streamParse==null?it(it(Ot(it({},L),{streamParse:(z=L.streamParse)==null||z}),Z?{final:O}:{}),ie?{customHtmlTags:U}:{}):L}),T=D(()=>{var W;return new Set(((W=$.value.customHtmlTags)!=null?W:[]).map(z=>String(z).trim().toLowerCase()).filter(Boolean))}),F=D(()=>G4($.value,M.value,e.customMarkdownIt,{includeFinal:!0})),S=D(()=>G4($.value,M.value,e.customMarkdownIt,{includeFinal:!1}));et([F,S],([W,z],[L,O])=>{L&&(W===L&&z===O||(A(),z!==O&&(l=[],u="")))},{flush:"sync"});const B=D(()=>{var W,z,L,O,U,Z,ie,q,ee,fe,ne;if((W=e.nodes)!=null&&W.length)return l=[],u="",v(0),gt(e.nodes.slice());const j=r.value;if(!j)return l=[],u="",v(-1),[];const K=t.debugPerformanceEnabled.value,ve=K?Oi():0,he=M.value,Ae=F.value,re=S.value;a&&Ae!==a&&(function(tt){var lt,ut;(ut=(lt=tt.stream)==null?void 0:lt.reset)==null||ut.call(lt)})(he),c&&re!==c&&(l=[],u="");const Y=Object.keys((L=(z=t.customComponentsMap)==null?void 0:z.value)!=null?L:{}).length>0||typeof $.value.postTransformNodes=="function";Y!==d&&(l=[],u="");const Q=!Y&&l.length>0&&j.startsWith(u)&&re===c,P=K?K4(he):null,G=K?{}:void 0,me=J4(he),ye=!me&&!Y,de=it(it(Ot(it({},$.value),{__reuseStableTopLevelNodes:ye}),me?{__disableStreamParse:!0}:{}),G?{__timing:G}:{}),V=q8(j,he,de),se=K?Oi():0,pe=K?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let ke,Ne=K?ip(V.length):void 0,qe=0,be=0,xe=0;if(Q){const tt=K?Oi():0,[lt,ut]=(function(Tt){var wt,Ft;const[en,Hn]=Tt.scanGlobalReferenceAppend(Tt.previousContent,Tt.content),Pt=Tt.parseOptions;return[Tt.previousDirtyStartIndex>0&&Pt.final!==!0&&!Tt.customMarkdownIt&&!J4(Tt.md)&&!en&&typeof Pt.preTransformTokens!="function"&&typeof Pt.postTransformTokens!="function"&&typeof Pt.postTransformNodes!="function"&&((Ft=(wt=Pt.customHtmlTags)==null?void 0:wt.length)!=null?Ft:0)===0?Tt.previousDirtyStartIndex:0,Hn]})({content:j,previousContent:u,previousDirtyStartIndex:k,parseOptions:$.value,customMarkdownIt:e.customMarkdownIt,md:he,scanGlobalReferenceAppend:f});xe=ut;const mt=lt<=0;if(pe){const Tt=(function(wt,Ft,en,Hn={}){var Pt;if(!Ft.length)return{nodes:wt,metrics:ip(wt.length)};const bn=(Pt=Hn.scanStartIndex)!=null?Pt:0,pn=Hn.reuseDirtyTail!==!1,Kt=(function(Wt,mn,so,gn=0){const to=Math.min(Wt.length,mn.length);for(let vt=Math.min(to,Math.max(0,gn));vt<to;vt++)if(!yse(mn[vt],Wt[vt],so))return vt;return Wt.length===mn.length?-1:to})(wt,Ft,en,bn);if(Kt<0)return{nodes:Ft,metrics:{reusedNodeCount:wt.length,dirtyStartIndex:Kt,stablePrefixNodeCount:wt.length,dirtyTailNodeCount:0}};const Nn=wt.slice();let Gt=Kt;for(let Wt=0;Wt<Kt;Wt++)Nn[Wt]=Ft[Wt];if(pn)for(let Wt=Kt;Wt<wt.length;Wt++){const mn=Ft[Wt],so=wt[Wt];mn&&OE(mn,so,en)&&(Nn[Wt]=mn,Gt+=1)}return{nodes:Nn,metrics:{reusedNodeCount:Gt,dirtyStartIndex:Kt,stablePrefixNodeCount:Kt,dirtyTailNodeCount:Q4(Kt,wt,Ft)}}})(V,l,pe,{reuseDirtyTail:mt,scanStartIndex:lt});ke=Tt.nodes,Ne=Tt.metrics}else{const Tt=(function(wt,Ft,en={}){var Hn;if(!Ft.length)return{nodes:wt,metrics:ip(wt.length)};const Pt=(Hn=en.scanStartIndex)!=null?Hn:0,bn=en.reuseDirtyTail!==!1,pn=(function(Gt,Wt,mn=0){const so=Math.min(Gt.length,Wt.length);for(let gn=Math.min(so,Math.max(0,mn));gn<so;gn++)if(!vse(Wt[gn],Gt[gn]))return gn;return Gt.length===Wt.length?-1:so})(wt,Ft,Pt);if(pn<0)return{nodes:Ft,metrics:{reusedNodeCount:wt.length,dirtyStartIndex:pn,stablePrefixNodeCount:wt.length,dirtyTailNodeCount:0}};const Kt=wt.slice();let Nn=pn;for(let Gt=0;Gt<pn;Gt++)Kt[Gt]=Ft[Gt];if(bn)for(let Gt=pn;Gt<wt.length;Gt++){const Wt=Ft[Gt],mn=wt[Gt];Wt&&FE(Wt,mn)&&(Kt[Gt]=Wt,Nn+=1)}return{nodes:Kt,metrics:{reusedNodeCount:Nn,dirtyStartIndex:pn,stablePrefixNodeCount:pn,dirtyTailNodeCount:Q4(pn,wt,Ft)}}})(V,l,{reuseDirtyTail:mt,scanStartIndex:lt});ke=Tt.nodes,Ne=Tt.metrics}qe=K?Oi()-tt:0,be=mt?Ne?.dirtyStartIndex==null||Ne.dirtyStartIndex<0?ke.length:Ne.dirtyStartIndex:ke.length}else ke=V,Ne=ip(ke.length);t.effectiveFinal.value!==!0&&(pe?(function(tt,lt,ut=0){for(let mt=Math.max(0,ut);mt<tt.length;mt++)Q2(lt,"primeSignatureMs",()=>jl(tt[mt]))})(ke,pe,be):(function(tt,lt=0){for(let ut=Math.max(0,lt);ut<tt.length;ut++)jl(tt[ut])})(ke,be));const Ze=K?Oi()-se:0;if(p+=1,u=j,a=Ae,c=re,d=Y,l=ke,v((O=Ne?.dirtyStartIndex)!=null?O:0),K){const tt=K4(he),lt=typeof tt?.total=="number"&&tt.total>((U=P?.total)!=null?U:0);t.logPerf(lt?"parse(stream)":"parse(sync)",it(it(it({rendererId:t.instanceMsgId,ms:Math.round(Oi()-ve),nodes:ke.length,contentLength:j.length,parseCommitCount:p,parseCoalescedCount:m,nodeReuseMs:Ze,referenceDefinitionScanChars:xe,signatureMs:(Z=pe?.signatureMs)!=null?Z:0,stabilizeSignatureMs:(ie=pe?.stabilizeSignatureMs)!=null?ie:0,primeSignatureMs:(q=pe?.primeSignatureMs)!=null?q:0,signatureCallCount:(ee=pe?.signatureCallCount)!=null?ee:0,stabilizeSignatureCallCount:(fe=pe?.stabilizeSignatureCallCount)!=null?fe:0,primeSignatureCallCount:(ne=pe?.primeSignatureCallCount)!=null?ne:0,stabilizeMs:qe},Ne??{}),G?Object.fromEntries(dse.map(ut=>{var mt;return[ut,(mt=G[ut])!=null?mt:0]})):{}),tt?{streamMode:tt.lastMode,streamDelta:kse(tt,P),streamStats:tt}:{}))}return gt(ke)});return{effectiveCustomHtmlTags:I,effectiveCustomHtmlTagsSet:T,mdBase:N,mdInstance:M,mergedParseOptions:$,getParsedNodesDirtyStartIndex:()=>k,getParsedNodesRevision:()=>g,parsedNodes:B}}function xse(e){const{isClient:t}=e,n=oe(new Set),o=new Map,s=new Map,i=new Map;function r(c){if(!t)return;const u=i.get(c);u!=null&&(window.clearTimeout(u),i.delete(c))}function l(){if(t)for(const c of i.values())window.clearTimeout(c);i.clear()}function a(){n.value=new Set}return{visibleNodeIndices:n,nodeVisibilityHandles:o,nodeVisibilityWatchStops:s,nodeVisibilityFallbackTimers:i,clearVisibilityFallback:r,clearAllVisibilityFallbacks:l,markNodeVisible:function(c,u=!0){var d;u&&r(c),(function(f,h){if((m=(p=e.shouldTrackVisibleNodeIndices)==null?void 0:p.call(e))!=null&&!m)return;var p,m;const y=n.value,k=y.has(f);if(h){if(k)return;const v=new Set(y);return v.add(f),void(n.value=v)}if(!k)return;const g=new Set(y);g.delete(f),n.value=g})(c,u),u&&((d=e.onNodeMarkedVisible)==null||d.call(e,c))},resetNodeVisibleState:a,cleanupNodeVisibility:function(c){var u;if(e.shouldCleanupNodeVisibility&&!e.shouldCleanupNodeVisibility())return;for(const[f,h]of s.entries())f<c||(h(),s.delete(f));for(const[f,h]of o.entries())f<c||(h.destroy(),o.delete(f),r(f),(u=e.onNodeVisibilityCleaned)==null||u.call(e,f));for(const f of Array.from(i.keys()))f<c||r(f);if(!n.value.size)return;const d=new Set;for(const f of n.value)f<c&&d.add(f);n.value=d},destroyNodeVisibilityState:function(){a();for(const c of s.values())c();s.clear();for(const c of o.values())c.destroy();o.clear(),l()}}}function wse(e={}){const t=oe(""),n=oe(""),o=oe(!1),s=ete(e),i=()=>{const u=s.getSnapshot();t.value=u.source,n.value=u.visible,o.value=u.done},r=s.subscribe(i);i();const l=D(()=>Math.max(0,t.value.length-n.value.length)),a=D(()=>l.value===0),c=D(()=>o.value&&a.value);return Tk()&&Lf(()=>{r(),s.destroy()}),{source:t,visible:n,done:o,final:c,caughtUp:a,pendingChars:l,enqueue:u=>s.enqueue(u),finish:u=>s.finish(u),flush:()=>s.flush(),reset:u=>s.reset(u),pause:()=>s.pause(),resume:()=>s.resume()}}const _se={maxCharsPerSecond:3e3,maxCommitFps:20,maxCharsPerCommit:160,catchUpLatencyMs:220,catchUpThreshold:400},e3=/auto|scroll|overlay/i;function Sse(e){if(!e)return!1;const t=(e.overflowY||"").toLowerCase(),n=(e.overflow||"").toLowerCase();return e3.test(t)||e3.test(n)}function Cse(e){const t=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,n=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return t||n}const Ase={class:"m-0 p-0"},Mse=["data-probe"],Ese=Mn(Je(Ot(it({},{name:"HeightEstimationProbes"}),{__name:"HeightEstimationProbes",props:{width:{},flowRoot:{type:Boolean},paragraphNode:{},listItemNode:{},listNode:{},headingNodes:{},setParagraphWrapper:{type:Function},setListItemWrapper:{type:Function},setListWrapper:{type:Function},setHeadingWrapper:{type:Function}},setup(e){const t=e;function n(o){var s,i;return(i=(s=t.headingNodes)==null?void 0:s[o])!=null?i:null}return(o,s)=>(x(),E("div",{class:"height-estimation-probes",style:on({width:`${e.width}px`}),"aria-hidden":"true"},[w("div",{ref:i=>e.setParagraphWrapper(i),class:Ue(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"paragraph"},[ae(C(Ha),{node:e.paragraphNode,"index-key":"probe-paragraph"},null,8,["node"])],2),w("div",{ref:i=>e.setListItemWrapper(i),class:Ue(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list-item"},[w("ul",Ase,[ae(C(du),{node:e.listItemNode,"index-key":"probe-list-item"},null,8,["node"])])],2),w("div",{ref:i=>e.setListWrapper(i),class:Ue(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list"},[ae(C(fu),{node:e.listNode,"index-key":"probe-list"},null,8,["node"])],2),(x(),E(We,null,rt(6,i=>w("div",{key:`probe-heading-${i}`,ref_for:!0,ref:r=>e.setHeadingWrapper(i,r),class:Ue(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${i}`},[ae(C(Z1),{node:n(i),"index-key":`probe-heading-${i}`},null,8,["node","index-key"])],10,Mse)),64))],4))}})),[["__scopeId","data-v-3e0766e2"]]),t3=Je({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=D(()=>{var n,o;return Rm((o=Gc(e.estimatedPreviewHeightPx))!=null?o:Om(String((n=e.node.code)!=null?n:"")))});return()=>{var n;return Lt("div",{class:"infographic-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",background:"var(--diagram-bg)",borderColor:"var(--diagram-border)",color:"hsl(var(--ms-foreground))"},"data-markstream-infographic":"1","data-markstream-mode":"pending"},[e.showHeader?Lt("div",{class:"infographic-block-header flex justify-between items-center border-b",style:{padding:"var(--ms-inset-panel-y) var(--ms-inset-panel-x)",background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)",minHeight:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)"}},[Lt("div",{class:"flex items-center gap-x-2 overflow-hidden"},[Lt("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),Lt("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),Lt("div",{class:"infographic-header-actions flex items-center opacity-0 pointer-events-none",style:{gap:"var(--ms-gap-header-actions)"},"aria-hidden":"true"},Array.from({length:4},()=>Lt("span",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",style:{width:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))",height:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))"}})))]):null,Lt("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[Lt("pre",{class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",zIndex:"1",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String((n=e.node.code)!=null?n:"")),Lt("div",{class:"absolute inset-0"},[Lt("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}}),n3=Je({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=D(()=>{var n,o;return Bm((o=Gc(e.estimatedPreviewHeightPx))!=null?o:Fm(String((n=e.node.code)!=null?n:"")))});return()=>{var n;return Lt("div",{class:"mermaid-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",borderColor:"var(--diagram-border)"},"data-markstream-mermaid":"1","data-markstream-mode":"pending"},[e.showHeader?Lt("div",{class:"mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]",style:{background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)"}},[Lt("div",{class:"flex items-center gap-x-2 overflow-hidden"},[Lt("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),Lt("div",{class:"mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none","aria-hidden":"true"},Array.from({length:4},()=>Lt("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[Lt("span",{class:"action-icon block"})])))]):null,Lt("div",{class:"mermaid-preview-area relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[Lt("pre",{class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String((n=e.node.code)!=null?n:"")),Lt("div",{class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:{fontFamily:"inherit",contentVisibility:"auto",contain:"content",containIntrinsicSize:"var(--ms-size-diagram-min-height) 240px"}})])])}}}),Tse={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:"auto"},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}};function Do(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}const Nse=["data-custom-id"],Ise=["data-node-index","data-node-type"],o3="typewriter-simple-cursor-target",BE=Mn(Je(Ot(it({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},domMode:{},htmlPolicy:{},viewportPriority:{type:Boolean,default:void 0},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},codeRenderer:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},langs:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:[Boolean,String],default:!1},smoothStreaming:{type:[Boolean,String],default:"auto"},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:["copy","copy-code","handleArtifactClick","click","mouseover","mouseout","virtual-state-change","height-change","render-settled","render-final","anchor-change"],setup(e,{expose:t,emit:n}){const o=e,s=n;function i(_){if(!(typeof Event<"u"&&_ instanceof Event))return typeof _=="string"&&s("copy-code",_),void s("copy",_)}const r=Mo(),l=Jt("markstreamNestedRendererProps",void 0);function a(_){const H=r?.vnode.props;return!!H&&(Object.prototype.hasOwnProperty.call(H,_)||Object.prototype.hasOwnProperty.call(H,String(_).replace(/[A-Z]/g,X=>`-${X.toLowerCase()}`)))}function c(_){var H,X;const J=o[_];return a(_)?J:(X=(H=l?.value)==null?void 0:H[_])!=null?X:J}const u=D(()=>{return(_=c("mode"))==="chat"||_==="minimal"||_==="docs"?_:"docs";var _}),d=D(()=>U4(c("typewriter"))),f=D(()=>d.value!=="off"),h=D(()=>c("domMode")==="minimal"?"minimal":"full"),p=D(()=>{return(_={mode:u.value,codeRenderer:c("codeRenderer"),renderCodeBlocksAsPre:c("renderCodeBlocksAsPre")}).renderCodeBlocksAsPre===!0?"pre":_.codeRenderer==="pre"||_.codeRenderer==="shiki"||_.codeRenderer==="monaco"?_.codeRenderer:_.renderCodeBlocksAsPre===!1||_.mode==="docs"?"monaco":"pre";var _}),m=D(()=>Tse[u.value]),y=D(()=>{var _;return(_=c("showTooltips"))!=null?_:m.value.showTooltips}),k=D(()=>{var _;return(_=c("fade"))!=null?_:m.value.fade}),g=D(()=>{var _;return(_=c("batchRendering"))!=null?_:m.value.batchRendering}),v=D(()=>{var _;return(_=c("initialRenderBatchSize"))!=null?_:m.value.initialRenderBatchSize}),b=D(()=>{var _;return(_=c("renderBatchSize"))!=null?_:m.value.renderBatchSize}),A=D(()=>{var _;return(_=c("renderBatchDelay"))!=null?_:m.value.renderBatchDelay}),I=D(()=>{var _;return(_=c("renderBatchBudgetMs"))!=null?_:m.value.renderBatchBudgetMs}),N=D(()=>{var _;return(_=c("renderBatchIdleTimeoutMs"))!=null?_:m.value.renderBatchIdleTimeoutMs}),M=D(()=>{var _;return(_=c("deferNodesUntilVisible"))!=null?_:m.value.deferNodesUntilVisible}),$=D(()=>{var _;return(_=c("maxLiveNodes"))!=null?_:m.value.maxLiveNodes}),T=D(()=>{var _;return(_=c("liveNodeBuffer"))!=null?_:m.value.liveNodeBuffer}),F=D(()=>{var _;return(_=c("nodeVirtual"))!=null?_:m.value.nodeVirtual}),S={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return c("parseOptions")},get customMarkdownIt(){return c("customMarkdownIt")},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return c("customHtmlTags")},get mode(){return c("mode")},get domMode(){return h.value},get htmlPolicy(){return c("htmlPolicy")},get viewportPriority(){return c("viewportPriority")},get viewportPriorityOptions(){return c("viewportPriorityOptions")},get codeBlockStream(){return c("codeBlockStream")},get codeBlockDarkTheme(){return c("codeBlockDarkTheme")},get codeBlockLightTheme(){return c("codeBlockLightTheme")},get codeBlockMonacoOptions(){return c("codeBlockMonacoOptions")},get codeRenderer(){return c("codeRenderer")},get renderCodeBlocksAsPre(){return c("renderCodeBlocksAsPre")},get codeBlockMinWidth(){return c("codeBlockMinWidth")},get codeBlockMaxWidth(){return c("codeBlockMaxWidth")},get codeBlockProps(){return c("codeBlockProps")},get mermaidProps(){return c("mermaidProps")},get d2Props(){return c("d2Props")},get infographicProps(){return c("infographicProps")},get showTooltips(){return y.value},get themes(){return c("themes")},get langs(){return c("langs")},get isDark(){return c("isDark")},get customId(){return c("customId")},get indexKey(){return o.indexKey},get typewriter(){return c("typewriter")},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return c("smoothStreamingOptions")},get parseCoalesceMs(){return c("parseCoalesceMs")},get fade(){return k.value},get batchRendering(){return g.value},get initialRenderBatchSize(){return v.value},get renderBatchSize(){return b.value},get renderBatchDelay(){return A.value},get renderBatchBudgetMs(){return I.value},get renderBatchIdleTimeoutMs(){return N.value},get deferNodesUntilVisible(){return M.value},get maxLiveNodes(){return $.value},get liveNodeBuffer(){return T.value},get nodeVirtual(){return F.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function B(_){s("height-change",_)}function W(_){s("virtual-state-change",_)}function z(_){s("anchor-change",_)}const L=oe(),O=oe(null),U=oe(null),Z=oe(null),ie=zo({1:null,2:null,3:null,4:null,5:null,6:null}),q=oe(!1),ee=new Map,fe=oe(0),ne=oe(0),j=oe({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function K(_,H){return typeof _!="string"?H:_.trim()||H}function ve(_){const H=Number(_);return Number.isFinite(H)&&H>0?Math.max(1,Math.trunc(H)):640}const he=D(()=>{var _;const H=(_=S.viewportPriorityOptions)!=null?_:{},X=K(H.rootMargin,ja);return{rootMargin:X,heavyBlockMargin:K(H.heavyBlockMargin,X),maxTargets:ve(H.maxTargets)}}),Ae=D(()=>{var _;return(_=he.value.rootMargin)!=null?_:ja}),re=D(()=>{var _;return(_=he.value.maxTargets)!=null?_:640});function Y(){var _,H;if(((_=o.virtualScroll)==null?void 0:_.enabled)!==!0)return null;const X=(H=o.virtualScroll)==null?void 0:H.scrollRoot;return Q(typeof X=="function"?X():X)}function Q(_){return _?typeof HTMLElement<"u"&&_ instanceof HTMLElement?_:typeof _=="object"&&"value"in _?Q(_.value):typeof _=="object"&&"$el"in _?Q(_.$el):null:null}Ln(kE,he);const{isClient:P,renderAsFragment:G,debugPerformanceEnabled:me,resolvedShowTooltips:ye,resolvedHtmlPolicy:de,inheritedSmoothStreaming:V,ownsTypewriterCursor:se}=(function(_){const H=typeof window<"u",X=Bf(),J=Jt("markstreamHtmlPolicy",void 0),ce=Jt("markstreamTypewriterCursor",void 0),we=Jt("markstreamSmoothStreaming",void 0),Le=D(()=>_.renderAsFragment===!0),Fe=D(()=>!!(_.debugPerformance&&H&&typeof console<"u")),Ve=D(()=>{var je;if(typeof _.showTooltips=="boolean")return _.showTooltips;const $e=(je=X.showTooltips)!=null?je:X["show-tooltips"];return $e===""||$e===!0||$e==="true"||$e!==!1&&$e!=="false"&&void 0}),Oe=D(()=>{var je,$e;return($e=(je=_.htmlPolicy)!=null?je:J?.value)!=null?$e:"safe"}),Pe=D(()=>ce?.value!==!0);return{isClient:H,renderAsFragment:Le,debugPerformanceEnabled:Fe,resolvedShowTooltips:Ve,resolvedHtmlPolicy:Oe,inheritedSmoothStreaming:we,inheritedTypewriterCursor:ce,ownsTypewriterCursor:Pe}})(S),{resolveViewportRoot:pe,resolveScrollContainer:ke,isReverseFlexScrollRoot:Ne,getNormalizedScrollTop:qe,getOffsetTopWithinRoot:be}=(function(_,H){function X(){var Fe,Ve;return(Ve=(Fe=H.scrollRoot)==null?void 0:Fe.call(H))!=null?Ve:null}function J(Fe){if(typeof window>"u")return null;const Ve=X();if(Ve)return Ve;const Oe=Fe??_.value;if(!Oe)return null;const Pe=Oe.ownerDocument||document,je=Pe.scrollingElement||Pe.documentElement;let $e=Oe;for(;$e&&$e!==Pe.body&&$e!==je;){if(Sse(window.getComputedStyle($e))&&Cse($e))return $e;$e=$e.parentElement}return null}function ce(Fe){if(!H.isClient)return!1;try{const Ve=window.getComputedStyle(Fe);return!!(Ve.display||"").toLowerCase().includes("flex")&&(Ve.flexDirection||"").toLowerCase().endsWith("reverse")}catch{return!1}}function we(Fe,Ve,Oe){var Pe,je;if(Oe)return Le(Ve);const $e=Fe.scrollTop;if(!ce(Fe))return $e;const He=$e<0?-$e:$e;return Math.max(0,((Pe=Fe.scrollHeight)!=null?Pe:0)-((je=Fe.clientHeight)!=null?je:0))-He}function Le(Fe){var Ve,Oe,Pe,je,$e;const He=Number((Ve=Fe.scrollingElement)==null?void 0:Ve.scrollTop),Xe=Number((Pe=(Oe=Fe.documentElement)==null?void 0:Oe.scrollTop)!=null?Pe:0),Ye=Number(($e=(je=Fe.body)==null?void 0:je.scrollTop)!=null?$e:0);return Math.max(0,Number.isFinite(He)?He:0,Number.isFinite(Xe)?Xe:0,Number.isFinite(Ye)?Ye:0)}return{resolveViewportRoot:J,resolveScrollContainer:function(Fe){var Ve,Oe,Pe,je;const $e=X();if($e)return $e;const He=J((Ve=Fe??_.value)!=null?Ve:null);if(He)return He;const Xe=(je=(Pe=Fe?.ownerDocument)!=null?Pe:(Oe=_.value)==null?void 0:Oe.ownerDocument)!=null?je:typeof document<"u"?document:null;return Xe?.scrollingElement||Xe?.documentElement||null},isReverseFlexScrollRoot:ce,getNormalizedScrollTop:we,getOffsetTopWithinRoot:function(Fe,Ve){const Oe=Ve.ownerDocument||Fe.ownerDocument||document;if((function(He,Xe){return He===Xe.documentElement||He===Xe.body||He===Xe.scrollingElement})(Ve,Oe))return Fe.getBoundingClientRect().top+Le(Oe);const Pe=Ve.getBoundingClientRect(),je=Fe.getBoundingClientRect(),$e=we(Ve,Oe,!1);return je.top-Pe.top+$e}}})(L,{isClient:P,scrollRoot:Y});Ln("markstreamShowTooltips",ye),Ln("markstreamHtmlPolicy",de),Ln("markstreamTypewriter",f),Ln("markstreamFade",D(()=>S.fade!==!1)),Ln("markstreamTypewriterCursor",D(()=>!0)),Ln("markstreamTextStreamState",ee),Ln("markstreamStreamVersion",fe),Ln("markstreamParseOptions",D(()=>S.parseOptions)),Ln("markstreamCustomMarkdownIt",D(()=>S.customMarkdownIt));const{smoothStreamingEnabled:xe,renderContent:Ze,requestedFinal:tt,effectiveFinal:lt}=(function(_,H){const X=wse(it(it({},_se),_.smoothStreamingOptions)),J=D(()=>{var $e,He,Xe;return _.smoothStreaming!==!1&&!(($e=_.nodes)!=null&&$e.length)&&(_.smoothStreaming===!0||!((He=H.inheritedSmoothStreaming)!=null&&He.value))&&(_.smoothStreaming===!0||U4(_.typewriter)!=="off"||((Xe=_.maxLiveNodes)!=null?Xe:0)<=0)}),ce=oe(!H.isClient||_.smoothStreaming===!0);An(()=>{ce.value=!0});const we=D(()=>ce.value&&J.value),Le=D(()=>{var $e;return we.value?X.visible.value:($e=_.content)!=null?$e:""}),Fe=D(()=>{var $e,He;const Xe=($e=_.parseOptions)!=null?$e:{};return(He=_.final)!=null?He:Xe.final}),Ve=D(()=>{const $e=Fe.value;return we.value&&$e!=null?!!$e&&X.caughtUp.value:$e});let Oe=0,Pe=!1;function je(){Oe=0,Pe=!1}return et([()=>_.content,()=>_.nodes,we,Fe],([$e,He,Xe,Ye])=>{if(He?.length)return je(),void X.reset("");const ct=$e??"";if(!Xe)return je(),X.reset(ct),void(Ye&&X.finish({flush:!0}));const st=X.source.value;if(ct){if(ct!==st)if(ct.startsWith(st)){const pt=ct.slice(st.length),kt=X.pendingChars.value;pt.length<=8?(Oe++,Pe||Oe>=2&&kt<=8?(Pe=!0,X.reset(ct)):X.enqueue(pt)):(je(),X.enqueue(pt))}else je(),X.reset(ct)}else je(),X.reset("");Ye&&X.finish()},{immediate:!0}),{smoothStream:X,smoothStreamingEligible:J,smoothStreamingEnabled:we,renderContent:Le,requestedFinal:Fe,effectiveFinal:Ve}})(S,{isClient:P,inheritedSmoothStreaming:V}),ut=tt.value===!0;Ln("markstreamSmoothStreaming",xe);const mt=oe(!1),Tt=oe(!1),wt=oe(!1);let Ft="",en=!1,Hn=null;function Pt(){P&&Hn!=null&&(window.clearTimeout(Hn),Hn=null)}function bn(){mt.value=!1,Pt()}function pn(_,H){if(!me.value)return;const X=(function(){if(!me.value)return null;const J=mn(Kt),ce=mn(Nn),we=Math.max(Wt,ce);if(J<=0&&we<=0)return null;const Le={total:J,maxPerFrame:we,byLabel:(Fe=Kt,Object.fromEntries(Array.from(Fe.entries()).sort((Ve,Oe)=>Oe[1]-Ve[1]||Ve[0].localeCompare(Oe[0]))))};var Fe;return Kt.clear(),Nn.clear(),Wt=0,Le})();console.info(`[markstream-vue][perf] ${_}`,X?Ot(it({},H),{layoutReads:X}):H)}et([()=>S.indexKey,()=>S.customId],()=>{var _,H;bn(),Tt.value=!1,wt.value=!((_=o.nodes)!=null&&_.length)&&tt.value!==!0&&!!o.content,Ft=(H=Ze.value)!=null?H:"",en=Ft.length>0},{flush:"sync"}),et([()=>o.content,()=>o.nodes,tt],([_,H,X])=>{!H?.length&&X!==!0&&_&&(wt.value=!0)},{flush:"sync",immediate:!0}),et([Ze,()=>o.nodes,tt],([_,H,X])=>{const J=_??"";return H?.length||X===!0?(bn(),Tt.value=!1,Ft=J,void(en=!0)):(J.length>0&&(wt.value=!0),en?(Ft&&J.length>Ft.length&&J.startsWith(Ft)?(mt.value=!0,Tt.value=!0,P&&(Pt(),Hn=window.setTimeout(()=>{var ce;Hn=null,lt.value===!0||(ce=o.nodes)!=null&&ce.length||(gc(),mt.value=!1,xr())},1200))):(J.length<Ft.length||!J.startsWith(Ft))&&(bn(),Tt.value=!1),void(Ft=J)):(Ft=J,void(en=!0)))},{flush:"sync",immediate:!0});const Kt=new Map,Nn=new Map;let Gt=!1,Wt=0;function mn(_){let H=0;for(const X of _.values())H+=X;return H}function so(){Wt=Math.max(Wt,mn(Nn)),Nn.clear(),Gt=!1}function gn(_){_.maxPerFrame=Math.max(Number(_.maxPerFrame||0),Number(_.currentFrameTotal||0)),_.currentFrameTotal=0,_.frameScheduled=!1}function to(_){var H,X;me.value&&(Kt.set(_,((H=Kt.get(_))!=null?H:0)+1),Nn.set(_,((X=Nn.get(_))!=null?X:0)+1),(function(J){const ce=(function(){if(!P||typeof window>"u")return null;const we=window;if(we.__markstreamLayoutReadPerformance)return we.__markstreamLayoutReadPerformance;const Le={total:0,maxPerFrame:0,byLabel:{}};return we.__markstreamLayoutReadPerformance=Le,Le})();ce&&(ce.total=Number(ce.total||0)+1,ce.byLabel[J]=Number(ce.byLabel[J]||0)+1,ce.currentFrameTotal=Number(ce.currentFrameTotal||0)+1,ce.frameScheduled||(ce.frameScheduled=!0,typeof window.requestAnimationFrame!="function"?typeof queueMicrotask!="function"?setTimeout(()=>gn(ce),0):queueMicrotask(()=>gn(ce)):window.requestAnimationFrame(()=>gn(ce))))})(_),Gt||(Gt=!0,P&&typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(so):typeof queueMicrotask!="function"?setTimeout(so,0):queueMicrotask(so)))}function vt(_,H){return to(_),H()}const Wn=S.customId?`renderer-${S.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,Bn=(function(_){const H=new Map;return{scope:_,cache:H,clear:()=>H.clear()}})(Wn),Qn=Wn;Ln(ME,Bn);const sn=To(()=>S.customId),{effectiveCustomHtmlTagsSet:es,mergedParseOptions:nt,parsedNodes:Be,getParsedNodesDirtyStartIndex:Bt,getParsedNodesRevision:Yt}=bse(S,{instanceMsgId:Wn,renderContent:Ze,effectiveFinal:lt,smoothStreamingEnabled:xe,debugPerformanceEnabled:me,customComponentsMap:sn,logPerf:pn});et(Be,()=>{mt.value||Bn.clear(),fe.value+=1},{immediate:!0});const vn=D(()=>({customId:S.customId,customHtmlTags:nt.value.customHtmlTags,parseOptions:S.parseOptions,customMarkdownIt:S.customMarkdownIt,htmlPolicy:de.value,viewportPriority:S.viewportPriority,viewportPriorityOptions:he.value,mode:u.value,domMode:S.domMode,codeRenderer:p.value,codeBlockStream:S.codeBlockStream,codeBlockDarkTheme:S.codeBlockDarkTheme,codeBlockLightTheme:S.codeBlockLightTheme,codeBlockMonacoOptions:S.codeBlockMonacoOptions,renderCodeBlocksAsPre:S.renderCodeBlocksAsPre,codeBlockMinWidth:S.codeBlockMinWidth,codeBlockMaxWidth:S.codeBlockMaxWidth,codeBlockProps:S.codeBlockProps,mermaidProps:S.mermaidProps,d2Props:S.d2Props,infographicProps:S.infographicProps,showTooltips:ye.value,themes:S.themes,langs:S.langs,isDark:S.isDark,typewriter:f.value,smoothStreamingOptions:S.smoothStreamingOptions,parseCoalesceMs:S.parseCoalesceMs,fade:S.fade}));Ln("markstreamNestedRendererProps",vn);const xn=D(()=>Be.value),nn=D(()=>Be.value.length),Vn=oe(null),Kn=oe(null),Jn=oe(null),Oo=oe(null),ko=o.indexKey!=null&&String(o.indexKey).startsWith("list-item-"),li=!ko&&S.customId?D4(S.customId):null,Uo=D(()=>li?(pv.value,D4(S.customId)):null),As=D(()=>{var _;return!!(!G.value&&S.customId&&!ko&&((_=Uo.value)!=null&&_.enabled))}),cs=D(()=>!!(P&&As.value)),qo=D(()=>{var _;return!!(!G.value&&((_=o.virtualScroll)!=null&&_.enabled))}),Bo=D(()=>qo.value),ai=oe(!1);An(()=>{ai.value=!0});const tn=D(()=>!!(P&&qo.value));Ln("markstreamHostScrollManaged",tn);const qs=D(()=>!!(ai.value&&tn.value)),io=D(()=>cs.value||tn.value),js=D(()=>cs.value||qs.value),ci=D(()=>{var _;return io.value&&((_=Uo.value)==null?void 0:_.textEstimation)!==!1});function Ni(){const _=ne.value||vt("getMeasuredContainerWidth.clientWidth",()=>{var H;return((H=L.value)==null?void 0:H.clientWidth)||0});return Number.isFinite(_)&&_>0?_:0}const ui=D(()=>{const _=Ni();return _>0?Math.max(1,Math.round(_)):640}),Vs=D(()=>{var _,H;return!(lt.value!==!0||qo.value||u.value!=="chat"&&u.value!=="minimal"||a("maxLiveNodes")||a("liveNodeBuffer")||(_=o.nodes)!=null&&_.length||wt.value||!(((H=S.maxLiveNodes)!=null?H:0)<=0))}),ts=D(()=>{var _;return Vs.value?50:Math.max(1,(_=S.maxLiveNodes)!=null?_:320)}),ns=D(()=>{var _;return Vs.value?16:Math.max(0,(_=S.liveNodeBuffer)!=null?_:60)}),zt=D(()=>{var _;return!G.value&&S.nodeVirtual!==!1&&!(((_=S.maxLiveNodes)!=null?_:0)<=0&&!Vs.value)&&(S.nodeVirtual===!0?Be.value.length>0:Be.value.length>ts.value)}),Ms=D(()=>zt.value||cs.value||tn.value),No=D(()=>S.viewportPriority!==!1),di=D(()=>!!No.value&&!q.value);var Ke;Ke=D(()=>No.value),Ln(bE,Ke);const Re=D(()=>{var _;return!(G.value||S.deferNodesUntilVisible===!1||((_=S.maxLiveNodes)!=null?_:0)<=0||zt.value||Be.value.length>900||S.viewportPriority===!1)}),le=ene(_=>{var H;return pe((H=_??L.value)!=null?H:null)},No),{requestFrame:Te,cancelFrame:ge,hasIdleCallback:Ee,isTestEnv:ze}=(function(_){const H=_.isClient&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):null,X=_.isClient&&typeof window.cancelAnimationFrame=="function"?window.cancelAnimationFrame.bind(window):null,J=_.isClient&&typeof window.requestIdleCallback=="function",ce=(function(){var we;if(typeof globalThis>"u"||!("process"in globalThis))return;const Le=(we=Object.getOwnPropertyDescriptor(globalThis,"process"))==null?void 0:we.value;return Le?.env})();return{requestFrame:H,cancelFrame:X,hasIdleCallback:J,isTestEnv:ce?.NODE_ENV==="test"}})({isClient:P}),Ht=D(()=>lt.value===!0&&!qo.value),{resolvedBatchSize:Ut,resolvedInitialBatch:wn,batchingEnabled:go,incrementalRenderingActive:us,renderedCount:te,previousRenderContext:Ce,adaptiveBatchSize:Me,previousBatchConfig:De}=(function(_,H){var X;const J=D(()=>{var je;const $e=Math.trunc((je=_.renderBatchSize)!=null?je:80);return Number.isFinite($e)?Math.max(0,$e):0}),ce=D(()=>{var je;const $e=Math.trunc((je=_.initialRenderBatchSize)!=null?je:J.value);return Number.isFinite($e)?Math.max(0,$e):J.value}),we=D(()=>!H.renderAsFragment.value&&_.batchRendering!==!1&&J.value>0&&H.isClient&&!H.isTestEnv),Le=oe(0),Fe=oe({key:_.indexKey,total:0}),Ve=oe(Math.max(1,J.value||1)),Oe=D(()=>{var je,$e,He;return we.value&&!((je=H.continuousStreaming)!=null&&je.value)&&!(($e=H.forceFullRenderFinalContent)!=null&&$e.value)&&((He=_.maxLiveNodes)!=null?He:0)<=0}),Pe=oe({batchSize:J.value,initial:ce.value,delay:(X=_.renderBatchDelay)!=null?X:16,enabled:Oe.value});return{resolvedBatchSize:J,resolvedInitialBatch:ce,batchingEnabled:we,incrementalRenderingActive:Oe,renderedCount:Le,previousRenderContext:Fe,adaptiveBatchSize:Ve,previousBatchConfig:Pe}})(S,{isClient:P,isTestEnv:ze,renderAsFragment:G,forceFullRenderFinalContent:Ht,continuousStreaming:D(()=>Tt.value&&lt.value!==!0)}),Qe=D(()=>{var _;return!G.value&&S.batchRendering!==!1&&Ut.value>0&&!ze&&((_=S.maxLiveNodes)!=null?_:0)<=0&&!Ht.value}),at=D(()=>Qe.value),It=D(()=>io.value||at.value),Qt=D(()=>{var _;return It.value&&((_=Uo.value)==null?void 0:_.codeBlockEstimation)!==!1}),cn=new Map,Vt=new Map,zn=new WeakMap;let co=null;const Nt=new WeakMap,_t=new Map,Zt=[];let eo=[],ro=[],Ks=-1;const Ii=gr(Zt),Gs=new Set,Jf=oe(0);let eh=0;const Hb=oe(0),cN=D(()=>(Hb.value,Array.from(cn.entries()).sort((_,H)=>_[0]-H[0]))),Iu=oe(null),Ys=oe(null);let el,Ql=null,d0=0,Lu=null;function fi(){el.markFallbackHeightPrefixDirty()}function f0(_){return el.getFallbackNodeHeight(_)}function nc(_,H){return el.estimateHeightRange(_,H)}function h0(_){return el.estimateIndexForOffset(_)}const{activeRestoreAnchor:oc,getRelativeScrollTopWithinContainer:uN,setRelativeScrollTopWithinContainer:dN,resolveAnchorOffset:fN,clearRestoreReconcile:th,scheduleRestoreReconcile:$u,captureRestoreAnchor:Wb,restoreAnchor:zb,getAnchorDrift:hN}=(function(_){const{isClient:H,containerRef:X,parsedNodeCount:J,requestFrame:ce,cancelFrame:we,resolveScrollContainer:Le,getNormalizedScrollTop:Fe,getOffsetTopWithinRoot:Ve,isReverseFlexScrollRoot:Oe,estimateIndexForOffset:Pe,estimateHeightRange:je,getFallbackNodeHeight:$e,clamp:He}=_,Xe=oe(null);let Ye=null,ct=[];function st(){const Et=Le(),qt=X.value;if(!Et||!qt)return null;const Xt=Et.ownerDocument||qt.ownerDocument||document;if(Et===Xt.documentElement||Et===Xt.body||Et===Xt.scrollingElement){const In=qt.getBoundingClientRect();return Math.max(0,-In.top)}return Math.max(0,Fe(Et,Xt,!1)-Ve(qt,Et))}function pt(Et){var qt;const Xt=Le(),In=X.value;if(!Xt||!In)return;const Ko=Math.max(0,Et),Ro=Xt.ownerDocument||In.ownerDocument||document,$i=Ro.defaultView||(typeof window<"u"?window:null);if(Xt===Ro.documentElement||Xt===Ro.body||Xt===Ro.scrollingElement){const Ji=Fe(Xt,Ro,!0)+In.getBoundingClientRect().top;return void((qt=$i?.scrollTo)==null||qt.call($i,0,Math.max(0,Ji+Ko)))}W4(Xt,Ro,Ve(In,Xt)+Ko,{isReverseFlexScrollRoot:Ji=>{var ed;return(ed=Oe?.(Ji))!=null&&ed},getNormalizedScrollTop:Fe})}function kt(Et){const qt=J.value,Xt=He(Et.nodeIndex,0,Math.max(0,qt-1));return je(0,Xt)+Math.max(0,Et.offsetWithinNodePx)}function Mt(){if(Ye!=null&&(we?.(Ye),Ye=null),H)for(const Et of ct)window.clearTimeout(Et);ct=[]}function Ct(Et){const qt=kt(Et),Xt=st();Xt!=null&&Math.abs(Xt-qt)<=.5||pt(qt)}return{activeRestoreAnchor:Xe,getRelativeScrollTopWithinContainer:st,setRelativeScrollTopWithinContainer:pt,resolveAnchorOffset:kt,clearRestoreReconcile:Mt,applyRestoreAnchor:Ct,scheduleRestoreReconcile:function(){Xe.value&&H&&Ye==null&&(Ye=ce?ce(()=>{Ye=null,Xe.value&&Ct(Xe.value)}):null,Ye==null&&Xe.value&&Ct(Xe.value))},captureRestoreAnchor:function(){const Et=st(),qt=J.value;if(Et==null||qt<=0)return null;const Xt=He(Pe(Et+1),0,qt-1),In=je(0,Xt),Ko=$e(Xt);return{nodeIndex:Xt,offsetWithinNodePx:He(Et-In,0,Math.max(0,Ko-1))}},restoreAnchor:function(Et){const qt=J.value;if(Xe.value={nodeIndex:He(Et.nodeIndex,0,Math.max(0,qt-1)),offsetWithinNodePx:Math.max(0,Et.offsetWithinNodePx)},Mt(),Ct(Xe.value),H)for(const Xt of[0,120,280,480])ct.push(window.setTimeout(()=>{Xe.value&&Ct(Xe.value)},Xt))},getAnchorDrift:function(Et){const qt=st();return qt==null?null:qt-kt(Et)}}})({isClient:P,containerRef:L,parsedNodeCount:nn,requestFrame:Te,cancelFrame:ge,resolveScrollContainer:()=>Iu.value||ke(),getNormalizedScrollTop:qe,getOffsetTopWithinRoot:be,isReverseFlexScrollRoot:Ne,estimateIndexForOffset:h0,estimateHeightRange:nc,getFallbackNodeHeight:f0,clamp:Vo}),{nodeHeights:sc,heightStats:hi,heightTreeSize:p0,heightSumTree:pN,heightKnownTree:mN,averageNodeHeight:Ub,resetHeightMeasurements:gN,pruneHeightMeasurements:vN,rebuildHeightTrees:nh,recordNodeHeight:yN,removeNodeHeights:kN,exportHeightCache:bN,importHeightCache:xN,fenwickRangeSum:wN}=(function(_={}){const H=zo({}),X=zo({total:0,count:0}),J=oe(0),ce=oe([]),we=oe([]);function Le(){for(const $e of Object.keys(H))delete H[Number($e)];X.total=0,X.count=0,J.value=0,ce.value=[],we.value=[]}function Fe($e,He,Xe){for(let Ye=He+1;Ye<$e.length;Ye+=Ye&-Ye)$e[Ye]+=Xe}function Ve($e,He){let Xe=0;for(let Ye=He+1;Ye>0;Ye-=Ye&-Ye)Xe+=$e[Ye];return Xe}function Oe($e){J.value=$e;const He=new Array($e+1).fill(0),Xe=new Array($e+1).fill(0);for(const[Ye,ct]of Object.entries(H)){const st=Number(Ye),pt=Number(ct);!Number.isFinite(st)||st<0||st>=$e||!Number.isFinite(pt)||pt<=0||(Fe(He,st,pt),Fe(Xe,st,1))}ce.value=He,we.value=Xe}function Pe($e){if(!Number.isInteger($e)||$e<0)return!1;const He=H[$e];if(!Number.isFinite(He)||He<=0)return!1;if(delete H[$e],X.total=Math.max(0,X.total-He),X.count=Math.max(0,X.count-1),J.value>$e){const Xe=ce.value,Ye=we.value;Xe.length&&Ye.length&&(Fe(Xe,$e,-He),Fe(Ye,$e,-1))}return!0}const je=D(()=>X.count>0?Math.max(12,X.total/X.count):32);return{nodeHeights:H,heightStats:X,heightTreeSize:J,heightSumTree:ce,heightKnownTree:we,averageNodeHeight:je,resetHeightMeasurements:Le,pruneHeightMeasurements:function($e){if($e<=0)return void Le();let He=0,Xe=0;for(const[Ye,ct]of Object.entries(H)){const st=Number(Ye),pt=Number(ct);!Number.isFinite(st)||st<0||st>=$e||!Number.isFinite(pt)||pt<=0?delete H[st]:(He+=pt,Xe++)}X.total=He,X.count=Xe},rebuildHeightTrees:Oe,recordNodeHeight:function($e,He,Xe={}){(function(Ye,ct,st={}){var pt;if(!Number.isFinite(ct)||ct<=0)return!1;const kt=H[Ye];if(kt&&(st.allowShrink===!1&&ct<kt||Math.abs(ct-kt)<=1))return!1;if(H[Ye]=ct,kt?X.total+=ct-kt:(X.total+=ct,X.count++),J.value>Ye){const Mt=ce.value,Ct=we.value;if(Mt.length&&Ct.length)if(kt){const Et=ct-kt;Et!==0&&Fe(Mt,Ye,Et)}else Fe(Mt,Ye,ct),Fe(Ct,Ye,1)}st.notify!==!1&&((pt=_.onHeightRecorded)==null||pt.call(_))})($e,He,Ot(it({},Xe),{notify:!0}))},removeNodeHeight:function($e,He={}){var Xe;const Ye=Pe($e);return Ye&&He.notify!==!1&&((Xe=_.onHeightRecorded)==null||Xe.call(_)),Ye},removeNodeHeights:function($e,He={}){var Xe;let Ye=0;for(const ct of $e)Pe(Number(ct))&&Ye++;return Ye>0&&He.notify!==!1&&((Xe=_.onHeightRecorded)==null||Xe.call(_)),Ye},exportHeightCache:function(){return Object.entries(H).map(([$e,He])=>({index:Number($e),height:Number(He)})).filter($e=>Number.isFinite($e.index)&&$e.index>=0&&Number.isFinite($e.height)&&$e.height>0).sort(($e,He)=>$e.index-He.index)},importHeightCache:function($e,He={}){var Xe;if(!Array.isArray($e))return;const Ye=J.value;let ct=!1;if(He.mode!=="merge"){const st=Object.keys(H);if(st.length>0){for(const pt of st)delete H[Number(pt)];ct=!0}}for(const st of $e){const pt=Number(st.index),kt=Number(st.height);if(!Number.isInteger(pt)||pt<0||Ye>0&&pt>=Ye||!Number.isFinite(kt)||kt<=0)continue;const Mt=H[pt];Mt&&Math.abs(Mt-kt)<=1||(H[pt]=kt,ct=!0)}ct&&((function(){let st=0,pt=0;const kt=J.value;for(const[Mt,Ct]of Object.entries(H)){const Et=Number(Mt),qt=Number(Ct);!Number.isFinite(Et)||Et<0||kt>0&&Et>=kt||!Number.isFinite(qt)||qt<=0?delete H[Et]:(st+=qt,pt++)}X.total=st,X.count=pt})(),Ye>0&&Oe(Ye),(Xe=_.onHeightRecorded)==null||Xe.call(_))},fenwickRangeSum:function($e,He,Xe){if(Xe<=He)return 0;const Ye=Ve($e,Xe-1);return He<=0?Ye:Ye-Ve($e,He-1)}}})({onHeightRecorded:()=>{fi(),tn.value&&Gu(),oc.value&&$u(),Ys.value&&hc(),Gn("node-resize")}});function qb(_){Number.isInteger(_)&&_>=0&&Gs.add(_)}function jb(_){for(const H of _)qb(Number(H))}function ic(_){eh++;let H=!0;try{const X=_();return H=X!==!1,X}finally{eh--,eh===0&&H&&Jf.value++}}function m0(){eo=[],ro=[],Ks=-1,Gs.clear(),Ii.value=Zt}function oh(){m0(),ic(()=>gN()),_t.clear()}function Vb(_){!Number.isInteger(_)||_<0||_>=Be.value.length||_t.set(_,Ru(_))}function Kb(_,H,X={}){const J=sc[_];qb(_),yN(_,H,X);const ce=sc[_];return Object.is(J,ce)?(Gs.delete(_),!1):(ce&&ce>0?Vb(_):J&&_t.delete(_),!0)}function Gb(_,H){const X=vt("getNodeLayoutHeight.slot.offsetHeight",()=>{var J,ce;return(ce=(J=cn.get(_))==null?void 0:J.offsetHeight)!=null?ce:0});return X>0?X:vt("getNodeLayoutHeight.content.offsetHeight",()=>H.offsetHeight)}function Yb(_,H={}){H.mode!=="merge"?m0():jb(_.map(X=>X.index)),ic(()=>xN(_,H)),U0()}const Zi=D(()=>Re.value&&di.value),_N=D(()=>{var _;return!G.value&&S.batchRendering!==!1&&Ut.value>0&&((_=S.maxLiveNodes)!=null?_:0)<=0}),SN=D(()=>!G.value&&ut&&lt.value===!0&&!zt.value&&!qo.value&&!As.value&&!Zi.value&&!_N.value),Zb=D(()=>!!le&&Zi.value),Xb=D(()=>zt.value||tn.value),{focusIndex:yr,liveRange:jo,updateLiveRange:Fu}=(function(_,H){const{parsedNodeCount:X,virtualizationEnabled:J,maxLiveNodesResolved:ce,liveNodeBufferResolved:we,clamp:Le}=H,Fe=we??D(()=>{var Pe;return Math.max(0,(Pe=_.liveNodeBuffer)!=null?Pe:60)}),Ve=oe(0),Oe=zo({start:0,end:0});return{liveNodeBufferResolved:Fe,focusIndex:Ve,liveRange:Oe,updateLiveRange:function(){const Pe=X.value;if(!J.value||Pe===0)return Oe.start=0,void(Oe.end=Pe);const je=Math.min(ce.value,Pe),$e=Fe.value,He=Le(Ve.value-$e,0,Math.max(0,Pe-je));Oe.start=He,Oe.end=Math.min(Pe,He+je)}}})(S,{parsedNodeCount:nn,virtualizationEnabled:zt,maxLiveNodesResolved:ts,liveNodeBufferResolved:ns,clamp:Vo}),Xi=new Map,Jl=new Map,tl=new Map,sh=[],kr=new Map,nl=new Set,Qb=oe(0);let g0=!1;const Jb=D(()=>(Qb.value,nl.size)),Zs=new Map,Qi=new Map,ex=oe(0),v0=D(()=>{ex.value;let _=0;for(const H of Zs.values())_+=Math.max(0,H);return _});let Xs=null;const ih=D(()=>{if(!zt.value)return Be.value.length;const _=ns.value,H=Math.max(jo.end+_,wn.value),X=Math.min(Be.value.length,H);return Math.max(te.value,X)});function rh(){g0||(g0=!0,queueMicrotask(()=>{g0=!1,Qb.value+=1}))}function tx(_,H,X="node-resize"){if(!P||typeof window>"u")return null;const J=window.setTimeout(()=>{nl.delete(J)&&rh();try{H()}finally{Gn(X)}},Math.max(0,_));return nl.add(J),rh(),J}function lh(_){P&&_!=null&&(nl.delete(_)&&rh(),window.clearTimeout(_))}function nx(){if(P&&typeof window<"u")for(const _ of nl)window.clearTimeout(_);nl.size&&(nl.clear(),rh()),sh.length=0,tl.clear()}function CN(_){O.value=_}function AN(_){U.value=_}function MN(_){Z.value=_}const{cancelScheduledFocusSync:y0,scheduleFocusSync:Li}=(function(_){const{isClient:H,containerRef:X,virtualizationEnabled:J,requestFrame:ce,cancelFrame:we,syncFocusToScroll:Le}=_;let Fe=null;function Ve(){var Pe,je,$e;return($e=(je=(Pe=X.value)==null?void 0:Pe.ownerDocument)==null?void 0:je.defaultView)!=null?$e:typeof window<"u"?window:null}function Oe(){if(!Fe)return;const Pe=Ve();Fe.viaTimeout?Pe?Pe.clearTimeout(Fe.id):clearTimeout(Fe.id):we?.(Fe.id),Fe=null}return{cancelScheduledFocusSync:Oe,scheduleFocusSync:function(Pe={}){if(!J.value)return;if(!H)return void Le(!0);if(Pe.immediate)return Oe(),void Le(!0);if(Fe)return;const je=()=>{Fe=null,Le()};if(ce)return void(Fe={id:ce(je),viaTimeout:!1});const $e=Ve();Fe={id:$e?$e.setTimeout(je,16):setTimeout(je,16),viaTimeout:!0}}}})({isClient:P,containerRef:L,virtualizationEnabled:zt,requestFrame:Te,cancelFrame:ge,syncFocusToScroll:function(_=!1){var H;if(!zt.value)return;const X=Iu.value||ke();if(!X)return;const J=X.ownerDocument||((H=L.value)==null?void 0:H.ownerDocument)||document,ce=J?.defaultView||(typeof window<"u"?window:null),we=X===J?.documentElement||X===J?.body,Le=Be.value.length;if(Le<=0)return;if(!we&&Le>0&&Ne(X)){const Ye=vt("syncFocusToScroll.clientHeight",()=>X.clientHeight||0),ct=vt("syncFocusToScroll.scrollTop",()=>X.scrollTop),st=ct<0?-ct:ct;return void uh(Vo((Fe=Math.max(0,st)+.5*Math.max(0,Ye),el.estimateIndexForOffsetFromEnd(Fe)),0,Math.max(0,Le-1)),_)}var Fe;const Ve=(function(Ye,ct,st,pt){const kt=L.value;if(!kt)return null;const Mt=pt?0:vt("syncFocusToScroll.model.root.getBoundingClientRect",()=>Ye.getBoundingClientRect().top),Ct=vt("syncFocusToScroll.model.container.getBoundingClientRect",()=>kt.getBoundingClientRect().top),Et=Math.max(0,Mt-Ct),qt=pt?vt("syncFocusToScroll.model.viewport.clientHeight",()=>{var Xt,In,Ko,Ro;return(Ro=(Ko=(In=st?.innerHeight)!=null?In:(Xt=ct.documentElement)==null?void 0:Xt.clientHeight)!=null?Ko:Ye.clientHeight)!=null?Ro:0}):vt("syncFocusToScroll.model.root.clientHeight",()=>Ye.clientHeight);return Vo(h0(Et+.5*Math.max(0,qt)),0,Math.max(0,Be.value.length-1))})(X,J,ce,we);if(Ve!=null)return void uh(Ve,_);const Oe=we?null:vt("syncFocusToScroll.root.getBoundingClientRect",()=>X.getBoundingClientRect()),Pe=we?0:Oe.top,je=we?vt("syncFocusToScroll.viewport.clientHeight",()=>{var Ye,ct;return(ct=(Ye=ce?.innerHeight)!=null?Ye:X.clientHeight)!=null?ct:0}):Oe.bottom,$e=cN.value;let He=null,Xe=null;for(const[Ye,ct]of $e){if(!ct)continue;const st=vt("syncFocusToScroll.slot.getBoundingClientRect",()=>ct.getBoundingClientRect());st.bottom<=Pe||st.top>=je||(He==null&&(He=Ye),Xe=Ye)}if(He==null||Xe==null){const Ye=L.value;if(!Ye)return;const ct=we?{top:0}:vt("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>X.getBoundingClientRect()),st=vt("syncFocusToScroll.fallback.scrollTop",()=>qe(X,J,we)),pt=we?(()=>{const Mt=vt("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>Ye.getBoundingClientRect()),Ct=(we?0:ct.top)-Mt.top;return Math.max(0,Ct)})():(()=>{const Mt=be(Ye,X);return Math.max(0,st-Mt)})(),kt=we?vt("syncFocusToScroll.fallback.viewport.clientHeight",()=>{var Mt,Ct,Et,qt;return(qt=(Et=(Ct=ce?.innerHeight)!=null?Ct:(Mt=J?.documentElement)==null?void 0:Mt.clientHeight)!=null?Et:X.clientHeight)!=null?qt:0}):vt("syncFocusToScroll.fallback.root.clientHeight",()=>X.clientHeight);return void uh(Vo(h0(pt+.5*Math.max(0,kt)),0,Math.max(0,Be.value.length-1)),!0)}uh(Math.round((He+Xe)/2),_)}}),{visibleNodeIndices:k0,nodeVisibilityHandles:rc,nodeVisibilityWatchStops:ah,nodeVisibilityFallbackTimers:ox,clearVisibilityFallback:ch,markNodeVisible:ol,cleanupNodeVisibility:EN,destroyNodeVisibilityState:b0}=xse({isClient:P,shouldTrackVisibleNodeIndices:()=>Zi.value,shouldCleanupNodeVisibility:()=>zt.value,onNodeMarkedVisible:_=>{zt.value?Li():yr.value=Vo(_,0,Math.max(0,Be.value.length-1))},onNodeVisibilityCleaned:_=>{cn.delete(_)&&Ix()}}),{cleanupScrollListener:sx,setupScrollListener:TN}=(function(_){const{isClient:H,virtualizationEnabled:X,listenerEnabled:J,scrollRootElement:ce,resolveScrollContainer:we,scheduleFocusSync:Le,onScroll:Fe}=_;let Ve=null,Oe=null;function Pe(){Ve&&(Ve(),Ve=null),Oe=null,ce.value=null}function je($e){const He=_.getScrollTop?_.getScrollTop($e):$e.scrollTop;return Math.max(0,Number.isFinite(He)?Math.abs(He):0)}return{cleanupScrollListener:Pe,setupScrollListener:function(){if(!H)return;if(!(($e=J?.value)!=null?$e:X.value))return void Pe();var $e;const He=we();if(!He)return void Pe();if(ce.value===He&&Ve)return;Pe(),Oe=je(He);const Xe=()=>{if(Fe?.(),X.value){const Ye=(function(ct){const st=je(ct),pt=Oe;Oe=st;const kt=Math.max(480,.75*(ct.clientHeight||0));return pt==null?st>kt?{immediate:!0}:void 0:Math.abs(st-pt)>kt?{immediate:!0}:void 0})(He);Ye?Le(Ye):Le()}};He.addEventListener("scroll",Xe,{passive:!0}),ce.value=He,Ve=()=>{He.removeEventListener("scroll",Xe)}}}})({isClient:P,virtualizationEnabled:zt,listenerEnabled:Xb,scrollRootElement:Iu,resolveScrollContainer:ke,scheduleFocusSync:Li,onScroll:function(){const _=Ys.value;if(!_)return;const H=Bu();if(!H||(function(J){if(zu()>=d0)return Lu=null,!1;const ce=Lu;if(ce==null)return!0;const we=Math.abs(J.scrollTop-ce)<=2;return we||(Lu=null),we})(H))return;const X=kx(H);X!=null?(X<-32||Math.abs(Math.max(0,X)-Math.max(0,_.distanceFromBottomPx))>32)&&fc("restore"):fc("restore")},getScrollTop:_=>{var H;const X=_.ownerDocument||((H=L.value)==null?void 0:H.ownerDocument)||document,J=_===X.documentElement||_===X.body||_===X.scrollingElement;return vt("scrollListener.getScrollTop",()=>qe(_,X,J))}});function uh(_,H=!1){const X=Vo(_,0,Math.max(0,Be.value.length-1));!H&&Math.abs(X-yr.value)<=1||(yr.value=X,Fu())}function Vo(_,H,X){return Math.min(Math.max(_,H),X)}function x0(_=Be.value.length){const H=Bt();return!Number.isInteger(H)||H<0?_:Vo(H,0,_)}function w0(_){return _?.firstElementChild}function ix(_,H){var X;return _?(X=_.matches)!=null&&X.call(_,H)?_:_.querySelector(H):null}function NN(_,H){_<1||_>6||(ie[_]=H)}function rx(){if(!io.value)return void(ne.value=0);const _=vt("updateExperimentContainerWidth.clientWidth",()=>{var H,X;return(X=(H=L.value)==null?void 0:H.clientWidth)!=null?X:0});ne.value=_>0?_:0}let Ou=null;function _0(){Ou?.disconnect(),Ou=null}const lx=Md("ViewportDeferredMarkdownCodeBlockNode",Hi({loader:()=>Zn(null,null,function*(){return(yield vs(()=>import("./index5-DYtlr_77.js"),__vite__mapDeps([6,4,5]))).default}),loadingComponent:Hm,delay:0,suspensible:!1}),Hm);function ax(_){return _===lx}const cx=D(()=>p.value==="pre"?Fs:p.value==="shiki"?lx:av);function ux(){var _;return((_=S.codeBlockProps)==null?void 0:_.showHeader)!==!1}function dx(_,H,X){const J=sc[H],ce=typeof J=="number"&&J>0;if(ci.value&&!ce&&!(function(we){return!!sn.value.paragraph&&(we.type==="paragraph"||we.type==="list_item"||we.type==="list")})(_)){const we=AE(_,X,j.value);if(we)return we}if(Qt.value&&_.type==="code_block"){const we=(function(Le){if(Le.type!=="code_block")return null;const Fe=Ux(Le,bh(Le));return ax(Fe)?"markdown":Fe===Fs?"pre":Fe===cx.value||Fe===av?"monaco":null})(_);if(we==="monaco"||we==="markdown"||we==="pre")return(function(Le,Fe){var Ve,Oe,Pe;if(!Le||Le.type!=="code_block")return null;const je=Fe.rendererKind,$e=je!=="pre"&&Fe.showHeader!==!1,He=!!Le.diff;let Xe=0,Ye=500;if(je==="monaco"){const st=(Ve=Fe.monacoOptions)!=null?Ve:{},pt=vv(Le,st,Fe.width),kt=(function(Ct){const Et=typeof Ct?.fontSize=="number"&&Ct.fontSize>0?Ct.fontSize:12;return typeof Ct?.lineHeight=="number"&&Ct.lineHeight>0?Ct.lineHeight:Math.round(1.5*Et)})(st),Mt=(function(Ct,Et){var qt,Xt;const In=typeof((qt=Ct?.padding)==null?void 0:qt.top)=="number"?Ct.padding.top:Et?0:8,Ko=typeof((Xt=Ct?.padding)==null?void 0:Xt.bottom)=="number"?Ct.padding.bottom:Et?0:8;return Math.max(0,In)+Math.max(0,Ko)})(st,He);Ye=typeof st.MAX_HEIGHT=="number"&&st.MAX_HEIGHT>0?st.MAX_HEIGHT:500,Xe=Math.round(pt*kt+Mt)}else if(je==="markdown"){const st=vv(Le);Xe=Math.round(21*st+32)}else{const st=vv(Le);Xe=Math.round(28*st),Ye=Number.POSITIVE_INFINITY}const ct=Math.max(1,Math.min(Xe,Ye));return it({kind:"code-block",height:Math.round(ct+($e?40:0)),contentHeight:ct,rendererKind:je},He&&je==="monaco"?{diffInline:q2((Oe=Fe.monacoOptions)!=null?Oe:{},(Pe=Fe.width)!=null?Pe:0)}:{})})(_,{rendererKind:we,monacoOptions:S.codeBlockMonacoOptions,showHeader:ux(),width:X})}return null}DA(()=>{if(Jf.value,eh>0)return;const _=Be.value,H=Yt();if(!_.length||!It.value)return eo=[],ro=[],Ks=-1,Gs.clear(),void(Ii.value=Zt);const X=ne.value||vt("estimatedNodeHeights.clientWidth",()=>{var Oe;return((Oe=L.value)==null?void 0:Oe.clientWidth)||0});if(!Number.isFinite(X)||X<=0)return eo=[],ro=[],Ks=-1,Gs.clear(),void(Ii.value=Zt);const J=(function(Oe){return[Math.round(Oe),ci.value,Qt.value,j.value,S.codeBlockMonacoOptions,ux(),p.value,sn.value,pv.value]})(X),ce=eo.length<=_.length&&(Le=J,(we=ro).length===Le.length&&we.every((Oe,Pe)=>Object.is(Oe,Le[Pe])));var we,Le;const Fe=ce&&Ks===H?_.length:ce?x0(_.length):0,Ve=ce?Array.from(Gs):[];eo.length=_.length;for(let Oe=Fe;Oe<_.length;Oe++)eo[Oe]=dx(_[Oe],Oe,X);for(const Oe of Ve)Oe>=0&&Oe<_.length&&Oe<Fe&&(eo[Oe]=dx(_[Oe],Oe,X));Gs.clear(),ro=J,Ks=H,Ii.value=eo,X9(Ii)},{flush:"sync"});const lc=D(()=>Ii.value);el=(function(_){let H=!0,X=[0],J="";function ce(Pe){var je;const $e=_.nodeHeights[Pe];if(Number.isFinite($e)&&$e>0)return $e;const He=_.parsedNodes.value[Pe],Xe=He?.type,Ye=!!((je=_.hasCustomParagraphComponent)!=null&&je.call(_)),ct=_.estimatedNodeHeights.value[Pe],st=ct?.height;if(!(function(kt,Mt,Ct){return!!(Ct&&Mt?.kind==="simple-text"&&(kt==="paragraph"||kt==="list_item"||kt==="list"))})(Xe,ct,Ye)&&Number.isFinite(st)&&st>0)return st;const pt=cse(He,_.getContainerWidth()||640);return Xe==="heading"||Xe==="paragraph"&&pt<=28&&(function(kt,Mt){if(Mt)return!1;const Ct=kt.children;return!Array.isArray(Ct)||!Ct.length||Ct.every(EE)})(He,Ye)?pt:Math.max(_.averageNodeHeight.value,pt)}function we(){var Pe;const je=_.parsedNodes.value.length,$e=_.getPrefixCacheKeyParts().join(":");if(!H&&J===$e)return X;const He=new Array(je+1);He[0]=0;for(let Xe=0;Xe<je;Xe++)He[Xe+1]=He[Xe]+(_.heightEstimationActive.value?ce(Xe):(Pe=_.nodeHeights[Xe])!=null?Pe:_.averageNodeHeight.value);return X=He,J=$e,H=!1,He}function Le(Pe){var je,$e;const He=_.parsedNodes.value.length;if(He<=0||Pe<=0)return 0;const Xe=we();if(Pe>=((je=Xe[He])!=null?je:0))return He-1;let Ye=0,ct=He-1,st=He-1;for(;Ye<=ct;){const pt=Ye+ct>>1;(($e=Xe[pt+1])!=null?$e:0)>=Pe?(st=pt,ct=pt-1):Ye=pt+1}return st}function Fe(Pe,je){var $e,He;if(Pe>=je)return 0;if(_.heightEstimationActive.value)return(function(ct,st){var pt,kt;const Mt=_.parsedNodes.value.length,Ct=q4(Math.trunc(ct),0,Mt),Et=q4(Math.trunc(st),Ct,Mt);if(Ct>=Et)return 0;const qt=we();return((pt=qt[Et])!=null?pt:0)-((kt=qt[Ct])!=null?kt:0)})(Pe,je);if(_.heightTreeSize.value!==_.parsedNodes.value.length){let ct=0;for(let st=Pe;st<je;st++)ct+=($e=_.nodeHeights[st])!=null?$e:_.averageNodeHeight.value;return ct}const Xe=_.heightSumTree.value,Ye=_.heightKnownTree.value;if(!Xe.length||!Ye.length){let ct=0;for(let st=Pe;st<je;st++)ct+=(He=_.nodeHeights[st])!=null?He:_.averageNodeHeight.value;return ct}return _.fenwickRangeSum(Xe,Pe,je)+(je-Pe-_.fenwickRangeSum(Ye,Pe,je))*_.averageNodeHeight.value}function Ve(Pe){var je;if(Pe<=0)return 0;const $e=_.parsedNodes.value;if(_.heightEstimationActive.value)return Le(Pe);if(_.heightTreeSize.value===$e.length&&_.heightSumTree.value.length&&_.heightKnownTree.value.length){const Xe=_.averageNodeHeight.value,Ye=_.heightSumTree.value,ct=_.heightKnownTree.value,st=Ct=>Ct<=0?0:_.fenwickRangeSum(Ye,0,Ct)+(Ct-_.fenwickRangeSum(ct,0,Ct))*Xe;let pt=0,kt=$e.length-1,Mt=$e.length-1;for(;pt<=kt;){const Ct=pt+kt>>1;st(Ct+1)>=Pe?(Mt=Ct,kt=Ct-1):pt=Ct+1}return Mt}let He=Pe;for(let Xe=0;Xe<$e.length;Xe++){const Ye=(je=_.nodeHeights[Xe])!=null?je:_.averageNodeHeight.value;if(He<=Ye)return Xe;He-=Ye}return Math.max(0,$e.length-1)}function Oe(){if(!_.heightEstimationActive.value)return 0;let Pe=0;const je=_.estimatedNodeHeights.value;for(let $e=0;$e<je.length;$e++){if(!je[$e])continue;const He=_.nodeHeights[$e];Number.isFinite(He)&&He>0||Pe++}return Pe}return{markFallbackHeightPrefixDirty:function(){H=!0},getFallbackNodeHeight:ce,estimateHeightRange:Fe,estimateIndexForOffset:Ve,estimateIndexForOffsetFromEnd:function(Pe){var je,$e;const He=_.parsedNodes.value;if(!He.length)return 0;if(Pe<=0)return Math.max(0,He.length-1);if(_.heightEstimationActive.value){const Ye=(je=we()[He.length])!=null?je:0;return Le(Math.max(0,Ye-Pe))}if(_.heightTreeSize.value===He.length){const Ye=Fe(0,He.length);return Ve(Math.max(0,Ye-Pe))}let Xe=Pe;for(let Ye=He.length-1;Ye>=0;Ye--){const ct=($e=_.nodeHeights[Ye])!=null?$e:_.averageNodeHeight.value;if(Xe<=ct)return Ye;Xe-=ct}return 0},getEstimatedNodeHeightCount:Oe,buildVirtualHeightSummary:function(Pe){var je;const $e=_.parsedNodes.value.length;return{totalNodes:$e,measuredCount:_.heightStats.count,estimatedCount:Oe(),averageNodeHeight:_.averageNodeHeight.value,topSpacerHeight:Pe.topSpacerHeight,bottomSpacerHeight:Pe.bottomSpacerHeight,estimatedTotalHeight:Fe(0,$e),width:(je=Pe.width)!=null?je:_.getContainerWidth()}}}})({parsedNodes:Be,nodeHeights:sc,heightStats:hi,heightTreeSize:p0,heightSumTree:pN,heightKnownTree:mN,averageNodeHeight:Ub,heightEstimationActive:io,estimatedNodeHeights:lc,getContainerWidth:Ni,hasCustomParagraphComponent:()=>!!sn.value.paragraph,getPrefixCacheKeyParts:()=>{var _;const H=pd(ne.value||vt("getFallbackHeightPrefix.clientWidth",()=>{var J;return((J=L.value)==null?void 0:J.clientWidth)||0})),X=((_=o.virtualScroll)==null?void 0:_.measurementKey)==null?"":String(o.virtualScroll.measurementKey);return[Be.value.length,hi.count,Math.round(hi.total),Math.round(100*Ub.value),X,H,io.value?1:0,pv.value,fe.value,sn.value.paragraph?1:0]},fenwickRangeSum:wN}),et(()=>Be.value.length,_=>{var H;fi(),_<=0?oh():(_<p0.value&&(H=_,m0(),ic(()=>vN(H))),_!==p0.value&&nh(_))},{immediate:!0});const IN=D(()=>{if(!zt.value)return Be.value.map((J,ce)=>({node:J,index:ce}));const _=Be.value.length,H=Vo(jo.start,0,_),X=Vo(jo.end,H,_);return Be.value.slice(H,X).map((J,ce)=>({node:J,index:H+ce}))}),S0=D(()=>zt.value?nc(0,Math.min(jo.start,Be.value.length)):0),C0=D(()=>{if(!zt.value)return 0;const _=Be.value.length;return nc(Math.min(jo.end,_),_)});function fx(){return el.buildVirtualHeightSummary({topSpacerHeight:S0.value,bottomSpacerHeight:C0.value,width:ea()})}function LN(){const _=Be.value,H=fx();return Ot(it({},H),{probe:{paragraphReady:!!j.value.paragraph,listItemReady:!!j.value.listItem,listWrapperOverhead:j.value.listWrapperOverhead,headingReadyLevels:Object.entries(j.value.headings).filter(([,X])=>!!X).map(([X])=>Number(X))},nodes:_.map((X,J)=>{var ce,we,Le,Fe,Ve,Oe,Pe,je,$e;return{index:J,type:X.type,estimateKind:(we=(ce=lc.value[J])==null?void 0:ce.kind)!=null?we:null,rendererKind:(Fe=(Le=lc.value[J])==null?void 0:Le.rendererKind)!=null?Fe:null,estimatedHeight:(Oe=(Ve=lc.value[J])==null?void 0:Ve.height)!=null?Oe:null,estimatedContentHeight:(je=(Pe=lc.value[J])==null?void 0:Pe.contentHeight)!=null?je:null,measuredHeight:($e=sc[J])!=null?$e:null}})})}function A0(){return o.indexKey!=null?String(o.indexKey):qo.value?`virtual-${no()}`:"markdown-renderer"}function hx(_){const H=String(_),X=`${A0()}-`;if(!H.startsWith(X))return null;const J=H.slice(X.length).match(/^(\d+)(?:$|-)/);if(!J)return null;const ce=Number(J[1]);return!Number.isInteger(ce)||ce<0||ce>=Be.value.length?null:ce}function no(){var _,H,X;const J=(_=o.virtualScroll)==null?void 0:_.sessionKey;return String(J!=null&&J!==""?J:(X=(H=o.indexKey)!=null?H:S.customId)!=null?X:Wn)}function bo(){var _;const H=(_=o.virtualScroll)==null?void 0:_.threadKey;return H==null||H===""?void 0:String(H)}const $N=D(()=>{var _,H,X;return(X=bo())!=null?X:String((H=(_=o.indexKey)!=null?_:S.customId)!=null?H:Wn)});function M0(_){var H;return(_??"")===((H=bo())!=null?H:"")}function br(){var _,H,X;return H=(_=o.virtualScroll)==null?void 0:_.measurementKey,X=(function(){const J=p.value;return(function(ce){var we,Le;const Fe=ce.renderer,Ve=Fe==="monaco"?ce.codeBlockMonacoOptions:void 0,Oe=ce.codeBlockProps,Pe=Fe==="shiki";return[ce.isDark?"dark":"light",Fe==="monaco"?"code-rich":Fe==="pre"?"code-pre":"code-shiki",ce.codeBlockStream===!1?"code-static":"code-stream",Do(ce.codeBlockMinWidth),Do(ce.codeBlockMaxWidth),...Pe?[Qee((we=Oe?.themes)!=null?we:ce.themes,(Le=Oe?.langs)!=null?Le:ce.langs)]:[],Do(Ve?.fontSize),Do(Ve?.lineHeight),Do(Ve?.fontFamily),Do(Ve?.tabSize),Do(Ve?.MAX_HEIGHT),Do(Ve?.wordWrap),Do(Ve?.wrappingIndent),Do(Ve?.padding),Do(Oe?.showHeader),Do(Oe?.showCopyButton),Do(Oe?.showExpandButton),Do(Oe?.showPreviewButton),Do(Oe?.showCollapseButton),Do(Oe?.showFontSizeButtons)].join("\0")})({renderer:J,isDark:S.isDark,codeBlockStream:S.codeBlockStream,codeBlockMinWidth:S.codeBlockMinWidth,codeBlockMaxWidth:S.codeBlockMaxWidth,codeBlockMonacoOptions:J==="monaco"?S.codeBlockMonacoOptions:void 0,codeBlockProps:S.codeBlockProps,themes:J==="shiki"?S.themes:void 0,langs:J==="shiki"?S.langs:void 0})})(),[H==null?"":String(H),X].join("\0")}function ea(){return Ni()}const dh=D(()=>pd(ea())),Qs=D(()=>[br(),dh.value].join("\0")),FN=D(()=>{var _;return qo.value?["virtual",(_=bo())!=null?_:"",no(),Qs.value].join("\0"):o.indexKey});function ac(){ex.value+=1}function E0(_){return!(!_||!Number.isInteger(_.index)||_.index<0||_.index>=Be.value.length||_.sessionKey!==no()||_.threadKey!==bo()||_.layoutEpochKey!==Qs.value)}function px(_){const H=String(_),X=Qi.get(H);return X?E0(X)?X.index:null:hx(H)}function mx(_="async-node"){(Zs.size||Qi.size)&&(Zs.clear(),Qi.clear(),ac(),Gn(_))}const cc=Jt(Hy,null),T0={reportHeight(_,H){if(!tn.value)return;const X=px(_);if(X==null)return;const J=Xi.get(X);if(!J)return;const ce=Number(H),we=Gb(X,J);(function(Le,Fe,Ve={}){ic(()=>Kb(Le,Fe,Ve))})(X,Number.isFinite(ce)&&ce>0?Math.max(ce,we||0):we)},markPending(_){if(!tn.value)return;const H=hx(_);H!=null&&(function(X,J){var ce;const we=Qi.get(X);if(we&&E0(we))return Zs.set(X,Math.max(0,(ce=Zs.get(X))!=null?ce:0)+1),ac(),void Gn("async-node");Zs.set(X,1),Qi.set(X,(function(Le){return{index:Le,sessionKey:no(),threadKey:bo(),layoutEpochKey:Qs.value}})(J)),ac(),Gn("async-node")})(String(_),H)},markSettled(_){if(!tn.value)return;const H=String(_),X=px(_);(X!=null||(function(J){return Zs.has(String(J))})(H))&&(function(J){var ce;const we=(ce=Zs.get(J))!=null?ce:0;return!(we<=0||(we<=1?(Zs.delete(J),Qi.delete(J)):Zs.set(J,we-1),ac(),we===1&&Gn("async-node"),0))})(H)&&X!=null&&xr()}};function ON(){let _=0;for(const H of Xi.values())_+=vt("getVisibleDomHeight.offsetHeight",()=>{var X;return(X=H?.offsetHeight)!=null?X:0});return Math.ceil(Math.max(0,_))}Ln(Hy,{reportHeight(_,H){T0.reportHeight(_,H),cc?.reportHeight(_,H)},markPending(_){T0.markPending(_),cc?.markPending(_)},markSettled(_){T0.markSettled(_),cc?.markSettled(_)}});let N0,I0=null,uc=null;function fh(_){return _!==!1&&_!=null&&_!==""}function gx(){return zt.value?(function(){if(!zt.value)return!0;const _=Be.value.length,H=Vo(jo.start,0,_),X=Vo(jo.end,H,_);if(H>=X)return!0;for(let J=H;J<X;J++)if(!cn.has(J)||gh(J)&&!Xi.has(J))return!1;return!0})():te.value>=ih.value}function L0(){return lt.value===!0&&!mt.value&&v0.value===0&&nl.size===0&&kr.size===0&&Xs==null&&gx()}function vx(){var _,H;if(((_=o.virtualScroll)==null?void 0:_.settleMode)!=="manual"||I0===no()&&N0===bo())return!0;const X=(H=o.virtualScroll)==null?void 0:H.settledToken;return!!fh(X)&&uc===Yu(X)}function $0(){return L0()&&vx()}function BN(_,H){return H.totalNodes<=0?_==="final"?"final":"estimate":H.measuredCount>=H.totalNodes?_==="final"?"final":"measured":H.measuredCount>0||H.estimatedCount>0?"mixed":"estimate"}function ta(_="manual",H){const X=fx(),J=(function(ce){return ce||(lt.value!==!0?Be.value.length>0?"streaming":"estimating":!gx()||kr.size>0||Xs!=null?"measuring":$0()?"settled":"settling")})(H);return{sessionKey:no(),threadKey:bo(),phase:J,nodeCount:X.totalNodes,liveRange:{start:jo.start,end:jo.end},renderedCount:te.value,measuredCount:X.measuredCount,estimatedCount:X.estimatedCount,averageNodeHeight:X.averageNodeHeight,topSpacerHeight:X.topSpacerHeight,bottomSpacerHeight:X.bottomSpacerHeight,visibleDomHeight:ON(),totalHeight:yx(),width:X.width,final:lt.value===!0,stable:$0(),confidence:BN(J,X),reason:_}}function Bu(){const _=Iu.value||ke(),H=L.value;if(!_||!H)return null;const X=_.ownerDocument||H.ownerDocument||document,J=_===X.documentElement||_===X.body||_===X.scrollingElement,ce=vt("getScrollBox.scrollTop",()=>qe(_,X,J)),we=vt("getScrollBox.scrollHeight",()=>{var Fe,Ve,Oe,Pe,je;return J?Math.max((Ve=(Fe=X.documentElement)==null?void 0:Fe.scrollHeight)!=null?Ve:0,(Pe=(Oe=X.body)==null?void 0:Oe.scrollHeight)!=null?Pe:0,(je=_.scrollHeight)!=null?je:0):_.scrollHeight}),Le=vt("getScrollBox.clientHeight",()=>{var Fe;return J?((Fe=X.documentElement)==null?void 0:Fe.clientHeight)||_.clientHeight||0:_.clientHeight});return{root:_,doc:X,isViewportRoot:J,scrollTop:ce,scrollHeight:we,clientHeight:Le}}function yx(){const _=Be.value.length,H=Math.max(0,nc(0,_)),X=vt("getRendererLogicalHeight.offsetHeight",()=>{var ce,we;return(we=(ce=L.value)==null?void 0:ce.offsetHeight)!=null?we:0}),J=Math.max(0,X>0?X:vt("getRendererLogicalHeight.scrollHeight",()=>{var ce,we;return(we=(ce=L.value)==null?void 0:ce.scrollHeight)!=null?we:0}));return _<=0?Math.ceil(X):zt.value?H>0?Math.max(1,Math.ceil(H),(function(){let ce=S0.value+C0.value;for(const we of cn.values())we&&(ce+=Math.max(0,vt("getVirtualizedDomLogicalHeight.offsetHeight",()=>we.offsetHeight||0)));return Math.ceil(Math.max(0,ce))})(),(function(ce,we){return ce<=0||we<=0?0:we<=ce+Math.max(512,.05*ce)?Math.ceil(we):0})(H,J)):Math.max(1,Math.ceil(J)):tn.value?H>0||hi.count>0||el.getEstimatedNodeHeightCount()>0?(us.value&&te.value,Math.max(1,Math.ceil(J),Math.ceil(H))):Math.ceil(J):Math.max(1,Math.ceil(J),Math.ceil(H))}function kx(_){const H=L.value;if(!H)return null;const X=vt("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>H.getBoundingClientRect());return(function(ce){return ce.isViewportRoot?ce.clientHeight:vt("getViewportBottomInRoot.getBoundingClientRect",()=>ce.root.getBoundingClientRect().bottom)})(_)-X.bottom}function RN(_={}){const H=_.requireViewport!==!1,X=(function(we=64){const Le=Bu(),Fe=L.value;if(!Le||!Fe)return!1;const Ve=(function(Pe){if(Pe.isViewportRoot)return{top:0,bottom:Pe.clientHeight};const je=vt("getVirtualViewportRect.getBoundingClientRect",()=>Pe.root.getBoundingClientRect());return{top:je.top,bottom:je.bottom}})(Le),Oe=vt("isRendererNearVirtualViewport.getBoundingClientRect",()=>Fe.getBoundingClientRect());return Oe.bottom>=Ve.top-we&&Oe.top<=Ve.bottom+we})();if(H&&!X)return null;const J=(function(){const we=Bu(),Le=L.value;if(!we||!Le||Math.max(0,we.scrollHeight-we.scrollTop-we.clientHeight)>64)return null;const Fe=kx(we);return Fe==null?null:Fe>=-8&&Fe<=160?{type:"bottom",distanceFromBottomPx:Math.max(0,Fe)}:null})();if(J)return{anchor:J,captured:!0};const ce=Wb();if(ce)return{anchor:{type:"node",nodeIndex:ce.nodeIndex,offsetWithinNodePx:ce.offsetWithinNodePx},captured:X};if(_.allowFallback===!0){const we=(function(){const Le=Be.value.length;return Le<=0?null:{type:"node",nodeIndex:Vo(yr.value,0,Math.max(0,Le-1)),offsetWithinNodePx:0}})();return we?{anchor:we,captured:!1}:null}return null}function F0(_){let H=2166136261;for(let X=0;X<_.length;X++)H^=_.charCodeAt(X),H=Math.imul(H,16777619);return(H>>>0).toString(36)}function DN(_,H){let X=_;for(let J=0;J<H.length;J++)X^=H.charCodeAt(J),X=Math.imul(X,16777619);return X^=31,X=Math.imul(X,16777619),X}const PN=new Set(["children","items","header","rows","cells","attrs","data","term","definition"]);function hh(_,H=new WeakSet,X=0){if(_==null||typeof _=="number"||typeof _=="boolean")return String(_);if(typeof _=="string")return`s:${(function(J){const ce=J.length>8192?`${J.slice(0,8192)}...${J.length}`:J;return`${J.length}:${F0(ce)}`})(_)}`;if(typeof _=="function")return"fn";if(typeof _!="object")return typeof _;if(H.has(_))return"cycle";if(X>=6)return"max-depth";H.add(_);try{if(Array.isArray(_)){if(_.length<=160){const Oe=[];for(let Pe=0;Pe<_.length;Pe++)Oe.push(hh(_[Pe],H,X+1));return`a:${_.length}:${Oe.join(",")}`}const we=[],Le=[],Fe=Math.max(0,_.length-32);let Ve=2166136261;for(let Oe=0;Oe<_.length;Oe++){const Pe=hh(_[Oe],H,X+1);Ve=DN(Ve,Pe),Oe<32&&we.push(Pe),Oe>=Fe&&Le.push(Pe)}return[`a:${_.length}`,`h=${we.join(",")}`,`t=${Le.join(",")}`,`all=${(Ve>>>0).toString(36)}`].join(":")}const J=_,ce=Object.keys(J).filter(we=>{const Le=J[we];return we!=="parent"&&we!=="el"&&we!=="component"&&(Le==null||typeof Le=="string"||typeof Le=="number"||typeof Le=="boolean"||PN.has(we))}).sort();return`o:${ce.length}:${ce.map(we=>`${we}=${hh(J[we],H,X+1)}`).join(";")}`}finally{H.delete(_)}}let O0=-1,B0="",na=[2166136261];function Ru(_){const H=Be.value[_];return H?F0(hh(H)):""}function HN(_,H){let X=_;for(let J=0;J<H.length;J++)X^=H.charCodeAt(J),X=Math.imul(X,16777619);return X>>>0}function R0(){var _,H;const X=fe.value;if(O0===X)return B0;const J=Be.value.length;let ce=x0(J);(O0!==X-1||ce>J||na.length<ce+1)&&(ce=0),ce===0?na=[2166136261]:na.length=ce+1;for(let we=ce;we<J;we++){const Le=Ru(we);na[we+1]=HN((_=na[we])!=null?_:2166136261,Le)}return na.length=J+1,B0=(((H=na[J])!=null?H:2166136261)>>>0).toString(36),O0=X,B0}function dc(_,H={}){var X;const J=H.includeHeightCache===!0,ce=(X=H.includeContentHash)!=null?X:J,we=J?(function(Fe){const Ve=(function(){var Ye,ct;const st=Number((ct=(Ye=o.virtualScroll)==null?void 0:Ye.heightCacheLimit)!=null?ct:5e3);return!Number.isFinite(st)||st<=0?Number.POSITIVE_INFINITY:Math.max(1,Math.trunc(st))})();if(!Number.isFinite(Ve)||Fe.length<=Ve)return Fe;const Oe=new Map,Pe=Ye=>{!Ye||Oe.size>=Ve||Oe.set(Ye.index,Ye)},je=Be.value.length,$e=Vo(jo.start-2*ns.value,0,je),He=Vo(jo.end+2*ns.value,$e,je);for(const Ye of Fe)Ye.index>=$e&&Ye.index<He&&Pe(Ye);const Xe=Math.max(1,Math.ceil(Fe.length/Ve));for(let Ye=0;Ye<Fe.length&&Oe.size<Ve;Ye+=Xe)Pe(Fe[Ye]);for(let Ye=Fe.length-1;Ye>=0&&Oe.size<Ve;Ye-=Xe)Pe(Fe[Ye]);return Array.from(Oe.values()).sort((Ye,ct)=>Ye.index-ct.index).slice(0,Ve)})(bN().map(Fe=>{var Ve;const Oe=Be.value[Fe.index];return Oe?Ot(it({},Fe),{nodeType:String((Ve=Oe.type)!=null?Ve:""),signature:Ru(Fe.index)}):null}).filter(Fe=>!!Fe)):[],Le=RN({allowFallback:H.allowAnchorFallback===!0,requireViewport:H.requireViewport});return Le||we.length||H.includeEmptyState===!0?Ot(it({sessionKey:_.sessionKey,threadKey:_.threadKey},Le?{anchor:Le.anchor,anchorCaptured:Le.captured}:{anchorCaptured:!1}),{metrics:_,width:_.width,contentHash:ce?R0():void 0,measurementKey:br()||void 0,heightCache:we.length?we:void 0}):null}function D0(_){var H,X;const J=Bu();if(!J)return;const ce=(function(Fe){const Ve=L.value;if(!Ve)return null;const Oe=be(Ve,Fe.root),Pe=Be.value.length,je=vt("getRendererBottomOffsetWithinRoot.offsetHeight",()=>Ve.offsetHeight||0),$e=Math.max(0,je>0?je:Pe>0?vt("getRendererBottomOffsetWithinRoot.scrollHeight",()=>Ve.scrollHeight||0):0),He=yx();return Oe+Math.max($e,He)})(J);if(ce==null)return;const we=Math.max(0,_.distanceFromBottomPx),Le=Math.max(0,ce-J.clientHeight-we);(function(Fe){d0=zu()+120,Lu=Fe})(Le),J.isViewportRoot?(X=(H=J.doc.defaultView)==null?void 0:H.scrollTo)==null||X.call(H,0,Le):W4(J.root,J.doc,Le,{isReverseFlexScrollRoot:Ne,getNormalizedScrollTop:qe})}const P0=[];function bx(){if(P)for(Ql!=null&&(ge?.(Ql),Ql=null);P0.length;){const _=P0.pop();_!=null&&window.clearTimeout(_)}}function fc(_){const H=!!Ys.value;Ys.value=null,d0=0,Lu=null,bx(),H&&_&&Gn(_)}function hc(){if(!Ys.value||!P||Ql!=null)return;const _=()=>{Ql=null;const H=Ys.value;H&&D0(H)};Ql=Te?Te(_):null,Ql==null&&_()}function xx(_,H={}){const X=Be.value.length;return X<=0?[]:_.filter(J=>!(!Number.isInteger(J.index)||J.index<0||J.index>=X)&&!(!Number.isFinite(J.height)||J.height<=0)&&!(H.requireSignature&&!J.signature)&&!(H.requireCompatibilityMetadata&&!J.nodeType&&!J.signature)&&(function(ce){var we;const Le=Be.value[ce.index];return!(!Le||ce.nodeType&&ce.nodeType!==String((we=Le.type)!=null?we:"")||ce.signature&&ce.signature!==Ru(ce.index))})(J))}function wx(_){const H=pd(ea()),X=pd(_);return H!==-1&&X!==-1&&H===X}function H0(_){var H;const X=Number(_?.width);if(Number.isFinite(X)&&X>0)return X;const J=Number((H=_?.metrics)==null?void 0:H.width);return Number.isFinite(J)&&J>0?J:null}function _x(_){var H;return _.sessionKey===no()&&!!M0(_.threadKey)&&((H=_.measurementKey)!=null?H:"")===br()&&!!wx(H0(_))&&!!(function(X){const J=X.heightCache;return!!J?.length&&(Sx(X)?J.some(ce=>!!(ce.nodeType||ce.signature)):J.some(ce=>!!ce.signature))})(_)}function Sx(_){return!!(_.contentHash&&_.contentHash===R0())}function WN(_){return!Sx(_)}let oa=null,sa=null,ph=null,Du=null,Pu=null;function W0(_){var H;const X=_.map(ce=>{var we,Le;return[ce.index,Math.round(10*ce.height),(we=ce.nodeType)!=null?we:"",(Le=ce.signature)!=null?Le:""].join("")}).join(""),J=pd(ea());return[(H=bo())!=null?H:"",no(),br(),Be.value.length,J,_.length,F0(X)].join(":")}function Cx(_=(H=>(H=o.virtualScroll)==null?void 0:H.heightCache)()){if(!tn.value||!_?.length||Be.value.length<=0||!wx((H=o.virtualScroll)==null?void 0:H.heightCacheWidth))return!1;var H;const X=xx(_,{requireSignature:!0});if(!X.length)return!1;const J=W0(X);return J===oa?(sa="standalone",!0):(Yb(X,{mode:"merge"}),fi(),oa=J,sa="standalone",qu(),Gn("restore"),!0)}function z0(_,H={}){var X,J,ce;if(!tn.value||!_||_.sessionKey!==no()||!M0(_.threadKey)||Be.value.length<=0)return!1;const we=!!((X=_.heightCache)!=null&&X.length)&&!mh(),Le=!_.anchor||_.anchorCaptured===!1&&H.allowUncapturedAnchor!==!0?null:_.anchor,Fe=H.restoreAnchor===!0&&!!Le&&!mh()&&Number(H0(_))>0;let Ve=!1;if((J=_.heightCache)!=null&&J.length&&_x(_)){const Pe=xx(_.heightCache,{requireCompatibilityMetadata:!_.contentHash,requireSignature:WN(_)});Pe.length&&(Yb(Pe,{mode:"merge"}),fi(),oa=W0(Pe),sa="restore",qu(),Ve=!0)}if(we||Fe)return!1;if(!H.restoreAnchor||!Le)return Ve&&Gn("restore"),!0;const Oe=(function(Pe,je){var $e;const He=Pe.anchor,Xe=He?He.type==="bottom"?`bottom:${Math.round(He.distanceFromBottomPx)}`:`node:${He.nodeIndex}:${Math.round(He.offsetWithinNodePx)}`:"none";return[($e=bo())!=null?$e:"",no(),br(),dh.value,je,Xe].join(":")})(_,(ce=H.restoreToken)!=null?ce:"imperative");return ph===Oe?(Ve&&Gn("restore"),!0):(ph=Oe,(function(Pe){const je=()=>{if(Pe.type==="node")return fc(),void zb({nodeIndex:Pe.nodeIndex,offsetWithinNodePx:Pe.offsetWithinNodePx});if(th(),oc.value=null,Ys.value=Pe,bx(),D0(Pe),P)for(const $e of[0,120,280,480])P0.push(window.setTimeout(()=>{const He=Ys.value;He&&D0(He)},$e))};(function($e){if(!zt.value)return!1;const He=Be.value.length;return!(He<=0||(yr.value=$e.type==="node"?Vo($e.nodeIndex,0,He-1):He-1,Fu(),0))})(Pe)?yt(je):je()})(Le),Gn("restore"),!0)}function mh(){const _=ea();return Number.isFinite(_)&&_>0}function Ax(_){var H;return _.sessionKey===no()&&!!M0(_.threadKey)&&(Be.value.length<=0||!(!((H=_.heightCache)!=null&&H.length)||mh())||!(!(_.anchor&&Number(H0(_))>0)||mh()))}function U0(){_t.clear();for(const _ of Object.keys(sc)){const H=Number(_);Number.isInteger(H)&&H>=0&&H<Be.value.length&&Vb(H)}}function Hu(){Xs!=null&&(ge?.(Xs),Xs=null),Q0()}function Mx(){return!P||ze?Promise.resolve():new Promise(_=>{let H=!1,X=null;const J=()=>{H||(H=!0,X!=null&&window.clearTimeout(X),_())};if(Te)return Te(J),void(X=window.setTimeout(J,50));X=window.setTimeout(J,0)})}function q0(_,H=bo(),X=Qs.value){return no()===_&&bo()===H&&Qs.value===X}function j0(){return Zn(this,arguments,function*(_={}){var H,X,J,ce,we;const Le=no(),Fe=bo(),Ve=Qs.value,Oe=(H=_.frames)!=null?H:2,Pe=(X=_.timeoutMs)!=null?X:120,je=(J=_.reason)!=null?J:"manual",$e=_.expectedSettledTokenKey,He=_.flushPendingTimers===!0,Xe=ta(je),Ye=()=>Ot(it({},Xe),{phase:Xe.final?"settling":Xe.phase,stable:!1,confidence:Xe.confidence==="final"?"mixed":Xe.confidence,reason:je}),ct=()=>q0(Le,Fe,Ve)&&($e==null||Uu()===$e);for(let Mt=0;Mt<Oe;Mt++){if(yield yt(),!ct()||(yield Mx(),!ct()))return Ye();xr(),Hu()}if(yield(function(Mt){return!P||Mt<=0?Promise.resolve():new Promise(Ct=>window.setTimeout(Ct,Mt))})(Pe),!ct()||(He&&nx(),xr(),Hu(),!ct()))return Ye();const st=L0();st&&(I0=Le,N0=Fe,((ce=o.virtualScroll)==null?void 0:ce.settleMode)==="manual"&&$e!=null&&fh((we=o.virtualScroll)==null?void 0:we.settledToken)&&Uu()===$e&&(uc=Yu(o.virtualScroll.settledToken)));const pt=ct()&&st&&vx(),kt=ta(je,pt?"final":void 0);return Z0(kt,!0),kt})}let V0="content",ia=null,ra=null,K0=0,Wu=null,pc=null,G0=null,Y0=null;function zu(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Ex(_){var H,X;const J=Wu;if(!J)return!0;const ce=(X=(H=o.virtualScroll)==null?void 0:H.heightDiffThresholdPx)!=null?X:1;return Math.abs(_.totalHeight-J.totalHeight)>ce||_.sessionKey!==J.sessionKey||_.phase!==J.phase||_.stable!==J.stable||_.final!==J.final||_.threadKey!==J.threadKey||_.nodeCount!==J.nodeCount||_.measuredCount!==J.measuredCount||_.width!==J.width}function Uu(_=(H=>(H=o.virtualScroll)==null?void 0:H.settledToken)()){return Do(_)}function Tx(_,H){var X,J;return[_,H.sessionKey,(X=H.threadKey)!=null?X:"",br(),R0(),Do((J=o.virtualScroll)==null?void 0:J.settledToken),Math.round(H.totalHeight),Math.round(H.width)].join("\0")}function qu(){G0=null,Y0=null,pc=null}function zN(_){const H=_.heightCache;return H?.length?W0(H):""}function ju(_){var H,X,J;const ce=_.metrics,we=_.anchor?(Le=_.anchor).type==="bottom"?`bottom:${Math.round(Le.distanceFromBottomPx)}`:`node:${Le.nodeIndex}:${Math.round(Le.offsetWithinNodePx)}`:"none";var Le;return[_.sessionKey,(H=_.threadKey)!=null?H:"",(X=_.measurementKey)!=null?X:br(),(J=_.contentHash)!=null?J:"",zN(_),we,_.anchorCaptured?1:0,ce.liveRange.start,ce.liveRange.end,ce.renderedCount,ce.nodeCount,Math.round(ce.totalHeight),Math.round(ce.width),ce.phase,ce.stable?1:0].join("\0")}function Z0(_,H=!1){if(!tn.value||(function(Le=!1){return!Le&&qo.value&&!qs.value})(H))return;const X=H||Ex(_),J=(function(Le,Fe=!1){return Fe||Le.stable||Le.phase==="final"?{state:dc(Le,{includeHeightCache:!0})}:{state:dc(Le)}})(_,H),ce=J.state,we=!!(ce&&(X||(function(Le,Fe=!1){return!!Fe||ju(Le)!==pc})(ce,H)));if(X&&(B(_),Wu=_,K0=zu()),ce&&we&&(W(ce),ce.anchor&&z(ce.anchor),pc=ju(ce)),_.stable){const Le=Tx("settled",_);if(Le!==G0){G0=Le;const Fe=dc(_,{includeHeightCache:!0});Fe&&(W(Fe),pc=ju(Fe)),(function(Ve){s("render-settled",Ve)})(_)}}if(_.phase==="final"){const Le=Tx("final",_);if(Le!==Y0){Y0=Le;const Fe=dc(_,{includeHeightCache:!0});Fe&&(W(Fe),pc=ju(Fe)),(function(Ve){s("render-final",Ve)})(_)}}}function X0(){ia!=null&&(ge?.(ia),ia=null),ra!=null&&P&&(window.clearTimeout(ra),ra=null)}function Nx(){ia=null,ra=null,(function(_){if(kr.size>0||Xs!=null)return!0;switch(_){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}})(V0)&&(xr(),Hu()),Z0(ta(V0))}function Gn(_){var H,X;if(!tn.value||(V0=_,ia!=null||ra!=null))return;const J=Math.max(0,(X=(H=o.virtualScroll)==null?void 0:H.emitIntervalMs)!=null?X:32),ce=Math.max(0,J-(zu()-K0)),we=()=>{ra=null,ia=Te?Te(Nx):null,ia==null&&Nx()};P&&ce>0?ra=window.setTimeout(we,ce):we()}function Ix(){Hb.value+=1}function gh(_){if(us.value&&_>=te.value){const H=Be.value[_],X=tt.value===!0&&lt.value!==!0&&_>=Be.value.length-2,J=H?.type==="code_block"||H?.type==="image"||H?.type==="mermaid"||H?.type==="infographic";if(!X||J)return!1}return!Zi.value||_<wn.value||k0.value.has(_)}function mc(_){const H=ah.get(_);H&&(H(),ah.delete(_));const X=rc.get(_);X&&(X.destroy(),rc.delete(_)),ch(_)}function vh(_,H){let X=!1;if(H){const we=cn.get(_);cn.set(_,H),we!==H&&(X=!0)}else cn.delete(_)&&(X=!0);if(X&&Ix(),H||ch(_),!Zb.value||!le)return mc(_),void(H&&Zi.value&&ol(_,!0));if(!zt.value&&Zi.value&&!q.value&&rc.size>=re.value&&(q.value||(q.value=!0,b0()),!Zb.value||!le))return mc(_),void(H&&ol(_,!0));if(_<wn.value&&!zt.value||k0.value.has(_))return mc(_),void ol(_,!0);if(!H)return void mc(_);mc(_);const J=le(H,{rootMargin:Ae.value});if(!J)return;rc.set(_,J),ol(_,J.isVisible.value),Zi.value&&(function(we){if(!P||!Zi.value)return;ch(we);const Le=we%17*23,Fe=window.setTimeout(()=>{if(ox.delete(we),!Zi.value||k0.value.has(we))return;const Ve=cn.get(we);if(!Ve)return;const Oe=ke(Ve),Pe=Ve.ownerDocument||document,je=Pe.defaultView||window,$e=!Oe||Oe===Pe.documentElement||Oe===Pe.body,He=!$e&&Oe?vt("nodeVisibilityFallback.root.getBoundingClientRect",()=>Oe.getBoundingClientRect()):null,Xe=$e?0:He.top,Ye=$e?vt("nodeVisibilityFallback.clientHeight",()=>{var st,pt;return(pt=(st=je.innerHeight)!=null?st:Oe?.clientHeight)!=null?pt:0}):He.bottom,ct=vt("nodeVisibilityFallback.node.getBoundingClientRect",()=>Ve.getBoundingClientRect());ct.bottom>=Xe-500&&ct.top<=Ye+500&&ol(we,!0)},1800+Le);ox.set(we,Fe)})(_);let ce=null;ce=et(()=>J.isVisible.value,we=>{if(we){ch(_),ol(_,!0),ce?.(),ah.delete(_),rc.get(_)===J&&rc.delete(_);try{J.destroy()}catch{}}},{immediate:!0}),ah.set(_,ce),zt.value&&Li()}function Q0(){Xs=null,ic(()=>{let _=!1;for(const[H,X]of kr)kr.delete(H),Xi.get(H)===X.el&&Jl.get(H)===X.version&&(_=Kb(H,X.height,{allowShrink:X.allowShrink})||_);return _})}function gc(){Xs!=null&&(ge?.(Xs),Xs=null),kr.clear()}function yh(_,H){(function(X,J,ce){var we;if(!Number.isFinite(ce)||ce<=0||Xi.get(X)!==J)return;const Le=Jl.get(X);if(Le==null)return;const Fe=Be.value[X],Ve=mt.value&&lt.value!==!0&&!((we=o.nodes)!=null&&we.length)&&X>=Be.value.length-2,Oe=!(Fe?.loading===!0||Ve),Pe=kr.get(X),je=Pe?Pe.allowShrink&&Oe:Oe,$e=Pe&&!je?Math.max(Pe.height,ce):ce;kr.set(X,{height:$e,allowShrink:je,version:Le,el:J}),Xs==null&&(Xs=Te?Te(Q0):null,Xs==null&&Q0())})(_,H,Gb(_,H))}function xr(){for(const[_,H]of Xi)H&&yh(_,H)}function Lx(){co?.disconnect(),co=null,Vt.clear()}function J0(){for(;sh.length;)lh(sh.pop())}et(qs,_=>{_&&Gn("content")},{flush:"post"}),t({getVirtualMetrics:ta,captureVirtualState:function(_={}){var H;return dc(ta("manual"),{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:_.allowFallbackAnchor===!0,requireViewport:_.requireViewport===!0,includeEmptyState:(H=_.includeEmptyState)==null||H})},restoreVirtualState:function(_,H={}){const X=H.restoreAnchor===!0,J=H.restoreToken==null?"imperative":String(H.restoreToken);Du=_,Pu={restoreAnchor:X,restoreToken:J,allowUncapturedAnchor:H.allowUncapturedAnchor===!0},!z0(_,{restoreAnchor:X,restoreToken:J,allowUncapturedAnchor:H.allowUncapturedAnchor===!0})&&Ax(_)||(Du=null,Pu=null)},forceMeasure:function(_="manual"){return Zn(this,null,function*(){yield yt(),yield Mx(),xr(),Hu(),yield yt();const H=ta(_);return Z0(H,!0),H})},settle:j0,scrollToNode:function(_,H="start"){fc(),th();const X=Be.value.length;if(X<=0)return;const J=Vo(_,0,X-1),ce=()=>{var we;const Le=fN({nodeIndex:J,offsetWithinNodePx:0}),Fe=f0(J),Ve=Bu(),Oe=(we=Ve?.clientHeight)!=null?we:0,Pe=uN();let je=Le;if(H==="center")je=Le-Oe/2+Fe/2;else if(H==="end")je=Le-Oe+Fe;else if(H==="nearest"&&Pe!=null){if(Le>=Pe&&Le+Fe<=Pe+Oe)return;je=Le<Pe?Le:Le-Oe+Fe}dN(Math.max(0,je)),Li({immediate:!0}),zt.value&&(yr.value=J,Fu())};if(zt.value)return yr.value=J,Fu(),void yt(ce);ce()}}),et(()=>Ms.value,_=>{if(!_){Lx();for(const H of tl.values())for(const X of H)lh(X);tl.clear(),Jl.clear(),J0(),gc()}},{immediate:!0}),et(lt,_=>{_&&(function(){if(P&&lt.value&&Xi.size){J0();for(const H of[80,240,640]){const X=tx(H,()=>{for(const[J,ce]of Xi)ce&&yh(J,ce)},"final");X!=null&&sh.push(X)}}})(),Gn(_?"final":"content")});const UN=z4(()=>Gn("content"),16),qN=z4(()=>Gn("batch"),16);et([()=>Be.value.length,()=>te.value],()=>{Ys.value&&hc(),UN()},{flush:"post",immediate:!0}),et([()=>jo.start,()=>jo.end],()=>{qN()},{flush:"post"});const{cleanupBatchScheduler:jN}=(function(_){const{props:H,isClient:X,isTestEnv:J,parsedNodesIdentity:ce,parsedNodeCount:we,desiredRenderedCount:Le,datasetKey:Fe,batchingEnabled:Ve,incrementalRenderingActive:Oe,resolvedBatchSize:Pe,resolvedInitialBatch:je,renderedCount:$e,adaptiveBatchSize:He,previousRenderContext:Xe,previousBatchConfig:Ye,requestFrame:ct,cancelFrame:st,hasIdleCallback:pt,cleanupNodeVisibility:kt,onDatasetKeyChanged:Mt,onDatasetChanged:Ct}=_;let Et=null,qt="raf",Xt=null,In=0,Ko=!1,Ro=!1;const $i=new Set,Ji=new Set;function ed(){if(X){Et!=null&&(qt==="raf"&&st?st(Et):qt==="idle"&&typeof window.cancelIdleCallback=="function"?window.cancelIdleCallback(Et):qt==="timeout"&&window.clearTimeout(Et),Et=null),In+=1;for(const os of $i)st&&st(os);for(const os of Ji)window.clearTimeout(os);$i.clear(),Ji.clear(),Xt=null,Ko=!1,Ro=!1}}function Mh(){return typeof performance<"u"?performance.now():Date.now()}function Zx(os){(function(wr){var il;if(!Oe.value)return;const _r=Math.max(2,(il=H.renderBatchBudgetMs)!=null?il:6),Sr=Math.max(1,Pe.value||1),Fi=Math.max(1,Math.floor(Sr/4));wr>1.5*_r?He.value=Math.max(Fi,Math.floor(.8*He.value)):wr<.6*_r&&He.value<Sr&&(He.value=Math.min(Sr,Math.ceil(1.2*He.value)))})(os),Ko=!1;const Ts=Ro||$e.value<Le.value;Ro=!1,Ts&&Jx()}function Xx(os,Ts={}){var wr,il;if(!Oe.value)return;const _r=Le.value;if($e.value>=_r)return;const Sr=Math.max(1,os),Fi=()=>{const kc=Mh();Et=null;const td=Xt??Sr;Xt=null;const bc=Mh();$e.value=Math.min(_r,$e.value+td),kt($e.value),(function(rg,Eh){if(!X)return void Zx(Eh);Ko=!0;const ew=++In;yt().then(()=>{var tw;if(ew!==In)return;const f9=Mh(),h9=Math.max(Eh,f9-rg),nw=()=>{ew===In&&Zx(h9)};if(ct){let aa=null,xc=null,sw=!1;const iw=()=>{sw||(sw=!0,aa!==null&&($i.delete(aa),aa=null),xc!==null&&(Ji.delete(xc),window.clearTimeout(xc),xc=null),nw())};return aa=ct(()=>{iw()}),$i.add(aa),xc=window.setTimeout(()=>{aa!==null&&st&&st(aa),iw()},Math.max(32,(tw=H.renderBatchIdleTimeoutMs)!=null?tw:120)),void Ji.add(xc)}const ow=window.setTimeout(()=>{Ji.delete(ow),nw()},0);Ji.add(ow)})})(kc,Mh()-bc)};if(!X||Ts.immediate)return void Fi();const rl=Math.max(0,(wr=H.renderBatchDelay)!=null?wr:16);if(Xt=Xt!=null?Math.max(Xt,Sr):Sr,Et==null){if(!J&&pt&&window.requestIdleCallback){const kc=Math.max(0,(il=H.renderBatchIdleTimeoutMs)!=null?il:120);return qt="idle",void(Et=window.requestIdleCallback(()=>Fi(),{timeout:kc}))}if(ct&&!J)return qt="raf",void(Et=ct(()=>{rl===0?Fi():(qt="timeout",Et=window.setTimeout(()=>Fi(),rl))}));qt="timeout",Et=window.setTimeout(()=>Fi(),rl)}}function Qx(os,Ts={}){Ko?Ro=!0:os==null?Jx():Xx(os,Ts)}function Jx(){Oe.value&&Xx(Ve.value?Math.max(1,Math.round(He.value)):Math.max(1,Pe.value))}return et([ce,we,Fe,Oe,Pe,je,()=>H.renderBatchDelay],()=>{var os;const Ts=we.value,wr=Xe.value,il=Fe.value,_r=!Object.is(il,wr.key),Sr=Ts!==wr.total,Fi=_r||Sr;Xe.value={key:il,total:Ts};const rl=Ye.value,kc=(os=H.renderBatchDelay)!=null?os:16,td=rl.batchSize!==Pe.value||rl.initial!==je.value||rl.delay!==kc||rl.enabled!==Oe.value;Ye.value={batchSize:Pe.value,initial:je.value,delay:kc,enabled:Oe.value},_r&&Mt(Ts),(Fi||td||!Oe.value)&&ed(),(Fi||td)&&(He.value=Math.max(1,Pe.value||1)),Fi&&Ct();const bc=Le.value;if(!Ts)return $e.value=0,void kt(0);if(!Oe.value)return $e.value=bc,void kt($e.value);const rg=_r||wr.total===0;$e.value=rg||td?Math.min(bc,je.value):Math.min($e.value,bc);const Eh=Math.max(1,je.value||Pe.value||Ts);$e.value<bc?Qx(Eh,{immediate:!X}):kt($e.value)},{immediate:!0}),et(Le,(os,Ts)=>{Oe.value&&(typeof Ts=="number"&&os<=Ts||os>$e.value&&Qx())}),{cleanupBatchScheduler:ed}})({props:S,isClient:P,isTestEnv:ze,parsedNodesIdentity:xn,parsedNodeCount:nn,desiredRenderedCount:ih,datasetKey:FN,batchingEnabled:go,incrementalRenderingActive:us,resolvedBatchSize:Ut,resolvedInitialBatch:wn,renderedCount:te,adaptiveBatchSize:Me,previousRenderContext:Ce,previousBatchConfig:De,requestFrame:Te,cancelFrame:ge,hasIdleCallback:Ee,cleanupNodeVisibility:EN,onDatasetKeyChanged:_=>{gc(),oh(),fi(),qu(),_>0&&nh(_)},onDatasetChanged:()=>{zt.value&&Li({immediate:!0})}});et([Xb,zt,()=>L.value,()=>Y()],([_,H])=>{if(!_)return sx(),void y0();TN(),H?Li({immediate:!0}):y0()},{flush:"post",immediate:!0}),et([()=>Be.value.length,()=>zt.value],_=>Zn(null,[_],function*([H,X]){X&&H&&P&&(yield yt(),Li({immediate:!0}))}),{flush:"post"}),et(io,_=>{_&&(function(){var H;if(Vn.value&&Kn.value&&Jn.value&&((H=Oo.value)!=null&&H[1]))return;const X=gt({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),J=gt({type:"list_item",children:[X],raw:"- Probe paragraph text"}),ce=gt({type:"list",ordered:!1,items:[J],raw:"- Probe paragraph text"});Vn.value=X,Kn.value=J,Jn.value=ce;const we={1:null,2:null,3:null,4:null,5:null,6:null};for(let Le=1;Le<=6;Le++)we[Le]=gt({type:"heading",level:Le,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(Le)} Probe heading`});Oo.value=we})()},{immediate:!0}),et([()=>L.value,io],()=>{if(!io.value)return _0(),void(ne.value=0);rx(),_0(),io.value&&L.value&&typeof ResizeObserver<"u"&&(Ou=new ResizeObserver(()=>{rx(),oc.value&&$u(),Ys.value&&hc(),Gn("resize")}),Ou.observe(L.value))},{immediate:!0}),et([io,ui,Qs],()=>Zn(null,null,function*(){if(!io.value)return j.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void fi();yield yt(),(function(){if(!io.value||typeof window>"u")return j.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void fi();const _={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},H=ix(w0(O.value),".paragraph-node");_.paragraph=yv(O.value,H,"pre-wrap");const X=w0(U.value),J=X?.querySelector(".paragraph-node");_.listItem=yv(U.value,J,"pre-wrap");const ce=vt("readSimpleTextProbeProfile.list.offsetHeight",()=>{var Le,Fe;return(Fe=(Le=Z.value)==null?void 0:Le.offsetHeight)!=null?Fe:0}),we=vt("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var Le,Fe;return(Fe=(Le=U.value)==null?void 0:Le.offsetHeight)!=null?Fe:0});_.listWrapperOverhead=Math.max(0,ce-we);for(let Le=1;Le<=6;Le++){const Fe=ix(w0(ie[Le]),`h${Le}`);_.headings[Le]=yv(ie[Le],Fe,"pre-wrap")}j.value=_,fi()})()}),{flush:"post",immediate:!0}),et(()=>Be.value.length,()=>{zt.value&&Li({immediate:!0})}),et([io,ne],()=>{fi(),zt.value&&Li({immediate:!0}),oc.value&&$u(),Ys.value&&hc(),Gn("resize")},{immediate:!1}),et(()=>Zi.value,_=>{if(_)for(const[H,X]of cn)vh(H,X);else if(b0(),zt.value)Li({immediate:!0});else for(const[H,X]of cn)X&&ol(H,!0)},{immediate:!1}),et([Ae,re,()=>Y()],()=>{var _;(_=le.refresh)==null||_.call(le);for(const[H,X]of cn)vh(H,X)},{immediate:!1}),et([()=>S.viewportPriority,()=>Be.value.length,re],([_,H,X])=>{if(_!==!1){if(q.value&&(H<=200||H<=X)){q.value=!1;for(const[J,ce]of cn)vh(J,ce)}}else q.value=!1}),et(()=>te.value,()=>{zt.value&&Li({immediate:!0})}),et([yr,ts,ns,()=>Be.value.length,zt],()=>{Fu()},{immediate:!0});let Vu=null,Ku=!1,vc=null;function Gu(){Vu=null,I0=null,N0=void 0,uc=null,qu()}function eg(){gc(),oh(),fi(),_t.clear();const _=Be.value.length;_>0&&nh(_),U0()}function tg(){X0(),nx(),Wu=null,oa=null,sa=null,ph=null,Du=null,Pu=null,Ku=!1,Gu(),mx("restore"),th(),fc()}function Yu(_){var H;return[(H=bo())!=null?H:"",no(),br(),dh.value,Uu(_),Be.value.length,Math.round(nc(0,Be.value.length)),Math.round(ea()),hi.count,Math.round(hi.total)].join(":")}function $x(){return Zn(this,null,function*(){var _,H,X,J;const ce=(_=o.virtualScroll)==null?void 0:_.settledToken,we=Uu(ce),Le=no(),Fe=bo(),Ve=Qs.value;if(tn.value&&((H=o.virtualScroll)==null?void 0:H.settleMode)==="manual"&&fh(ce))if(L0()){if(Yu(ce)!==uc&&!Ku){Ku=!0;try{const Oe=yield j0({reason:"manual",expectedSettledTokenKey:we}),Pe=Uu()===we;q0(Le,Fe,Ve)&&Oe.sessionKey===Le&&Oe.threadKey===Fe&&Pe&&Oe.stable&&Oe.phase==="final"&&(uc=Yu((X=o.virtualScroll)==null?void 0:X.settledToken))}finally{Ku=!1,yield yt();const Oe=(J=o.virtualScroll)==null?void 0:J.settledToken,Pe=fh(Oe)?Yu(Oe):"";q0(Le,Fe,Ve)&&Pe&&uc!==Pe&&$x()}}}else Gn("manual")})}et(tn,(_,H)=>{if(_!==H){if(!_)return tg(),void X0();tg(),eg(),vc=Qs.value,Gn("content")}},{flush:"post"}),et([tn,Qs],([_,H])=>{_?vc!=null?vc!==H&&(vc=H,(function(X="resize"){gc(),oh(),fi(),_t.clear();const J=Be.value.length;J>0&&nh(J),U0(),oa=null,sa=null,ph=null,Wu=null,Ku=!1,Gu(),Cx(),yt(()=>{xr(),oc.value&&$u(),Ys.value&&hc(),Gn(X)})})("resize")):vc=H:vc=null},{flush:"post",immediate:!0}),et([tn,()=>no(),()=>bo()],([_])=>{_&&(tg(),eg(),mx("content"),Gn("content"))}),et([tn,()=>no(),()=>bo(),Qs,()=>Be.value.length],([_])=>{_&&(function(H="async-node"){let X=!1;for(const[J,ce]of Array.from(Qi.entries()))E0(ce)||(Qi.delete(J),Zs.delete(J),X=!0);X&&(ac(),Gn(H))})("async-node")},{flush:"post"}),et([tn,()=>{var _;return(_=o.virtualScroll)==null?void 0:_.sessionKey},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.measurementKey},()=>o.indexKey,()=>fe.value],([_])=>{_&&(qu(),(function(H="content"){if(!tn.value)return;const X=[],J=Be.value.length,ce=x0(J);for(const we of Array.from(_t.keys())){if(we>=J){X.push(we);continue}if(we<ce)continue;const Le=Ru(we),Fe=_t.get(we);Fe!=null&&Fe!==Le&&X.push(we),_t.set(we,Le)}for(const we of Array.from(_t.keys()))we>=J&&_t.delete(we);X.length&&((function(we,Le={}){const Fe=Array.from(we,Number);jb(Fe);let Ve=0;if(ic(()=>(Ve=kN(Fe,Le),Ve>0)),Ve>0)(function(Oe){for(const Pe of Oe)_t.delete(Pe)})(Fe);else for(const Oe of Fe)Gs.delete(Oe)})(X,{notify:!1}),fi(),Gu(),oc.value&&$u(),Ys.value&&hc(),Gn(H))})("content"))},{flush:"post",immediate:!0}),et([tn,()=>Be.value.length,()=>no(),()=>bo()],([_,H,X,J],[ce,we,Le,Fe])=>{_&&ce&&X===Le&&J===Fe&&H!==we&&Gu()},{flush:"post"}),et([tn,()=>{var _;return(_=o.virtualScroll)==null?void 0:_.heightCache},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.heightCacheWidth},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.restoreState},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.measurementKey},()=>Be.value.length,()=>no(),ne],()=>{Cx()},{flush:"post",immediate:!0}),et([tn,()=>{var _;return(_=o.virtualScroll)==null?void 0:_.restoreState},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.restoreAnchor},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.measurementKey},()=>Be.value.length,()=>no(),ne],_=>Zn(null,[_],function*([H,X]){if(!H||!X)return;yield yt();const J=(function(){var ce;const we=(ce=o.virtualScroll)==null?void 0:ce.restoreAnchor;return we==null||we===!1?null:we===!0?"true":String(we)})();z0(X,{restoreAnchor:J!=null,restoreToken:J??void 0})}),{flush:"post",immediate:!0}),et([tn,ne,()=>{var _;return(_=o.virtualScroll)==null?void 0:_.restoreState},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.measurementKey}],([_])=>{var H;if(!_)return;const X=(H=o.virtualScroll)==null?void 0:H.restoreState;X&&oa&&sa==="restore"&&(_x(X)||(eg(),oa=null,sa=null,Gn("resize")))},{flush:"post"}),et([tn,()=>Be.value.length,()=>no(),ne],_=>Zn(null,[_],function*([H]){var X;const J=Du,ce=Pu;H&&J&&(yield yt(),!z0(J,{restoreAnchor:ce?.restoreAnchor===!0,restoreToken:(X=ce?.restoreToken)!=null?X:"imperative",allowUncapturedAnchor:ce?.allowUncapturedAnchor===!0})&&Ax(J)||(Du=null,Pu=null))}),{flush:"post",immediate:!0}),et([tn,lt,()=>{var _;return(_=o.virtualScroll)==null?void 0:_.settleMode},()=>no(),()=>bo(),Qs,v0,Jb,()=>te.value,ih,()=>hi.count,()=>hi.total],([_,H,X])=>{if(!_||H!==!0||X==="manual"||!$0())return;const J=(function(){var ce;const we=Be.value.length;return[(ce=bo())!=null?ce:"",no(),br(),dh.value,we,Math.round(nc(0,we)),Math.round(ea()),hi.count,Math.round(hi.total)].join(":")})();Vu!==J&&(Vu=J,j0({reason:"final"}).then(ce=>{ce.stable||Vu!==J||(Vu=null)}))},{flush:"post",immediate:!0}),et([tn,lt,()=>{var _;return(_=o.virtualScroll)==null?void 0:_.settleMode},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.settledToken},()=>no(),()=>bo(),Qs,v0,Jb,()=>te.value,ih,()=>Be.value.length,()=>hi.count,()=>hi.total],()=>{$x()},{flush:"post",immediate:!0}),et([()=>Be.value.length,zt,ts,ns,()=>jo.start,()=>jo.end],([_,H,X,J,ce,we])=>{me.value&&pn("virtualization",{nodes:_,virtualization:H,maxLiveNodes:X,buffer:J,focusIndex:yr.value,scroll:H?(()=>{const Le=Iu.value||ke();return Le?{reverse:Ne(Le),scrollTop:Math.round(Le.scrollTop),scrollTopAbs:Math.round(Math.abs(Le.scrollTop)),scrollHeight:Math.round(Le.scrollHeight),clientHeight:Math.round(Le.clientHeight)}:null})():null,liveRange:{start:ce,end:we},rendered:te.value})}),et([()=>S.customId],([_],H,X)=>{if(!_||ko)return;const J=(function(ce,we){return ce?(Io.controllers[ce]=we,()=>{Io.controllers[ce]===we&&delete Io.controllers[ce]}):()=>{}})(_,{captureRestoreAnchor:Wb,restoreAnchor:zb,getAnchorDrift:hN,getReport:LN});X(()=>{J()})},{immediate:!0}),ho(()=>{(function(){if(tn.value)try{xr(),Hu();const _=ta("manual");Ex(_)&&(B(_),Wu=_,K0=zu());const H=dc(_,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});H&&(W(H),H.anchor&&z(H.anchor),pc=ju(H))}catch{}})(),jN(),b0(),Pt(),Lx();for(const _ of tl.values())for(const H of _)lh(H);tl.clear(),Jl.clear(),_t.clear(),J0(),gc(),_0(),th(),fc(),X0(),sx(),y0()});const VN=Md("ViewportDeferredMermaidBlockNode",Hi({loader:()=>Zn(null,null,function*(){try{return(yield vs(()=>import("./index11-Jj0EtwVs.js"),__vite__mapDeps([7,5]))).default}catch(_){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',_),Fs}}),loadingComponent:n3,delay:0}),n3),KN=Md("ViewportDeferredInfographicBlockNode",Hi({loader:()=>Zn(null,null,function*(){try{return(yield vs(()=>import("./index10-pQAlOV_D.js"),[])).default}catch(_){return console.warn('[markstream-vue] Failed to load InfographicBlockNode. Falling back to preformatted code rendering. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.',_),Fs}}),loadingComponent:t3,delay:0}),t3),GN=Md("ViewportDeferredD2BlockNode",Hi(()=>Zn(null,null,function*(){try{return(yield vs(()=>import("./index8-B7--CG9b.js"),[])).default}catch(_){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',_),Fs}})),Fs),Fx={text:mo,paragraph:Ha,heading:Z1,code_block:av,list:fu,list_item:du,blockquote:Dp,table:Xd,definition_list:Pp,footnote:Hp,footnote_reference:ni,footnote_anchor:Yd,admonition:qp,vmr_container:zp,hardbreak:Ol,link:_s,image:Fl,thematic_break:Wp,math_inline:Gi,math_block:wE,strong:xs,emphasis:Ss,strikethrough:ws,highlight:si,insert:Ws,subscript:Hs,superscript:Ps,emoji:Ds,checkbox:ti,checkbox_input:ti,inline_code:as,html_inline:oi,reference:bs,html_block:Zd},YN=D(()=>A0()),Ox=D(()=>H4(S.codeBlockProps)),ZN=D(()=>H4(S.codeBlockProps,{omit:["langs"]})),Bx=D(()=>it(it({stream:S.codeBlockStream,darkTheme:S.codeBlockDarkTheme,lightTheme:S.codeBlockLightTheme,monacoOptions:S.codeBlockMonacoOptions,themes:S.themes,langs:p.value==="shiki"?S.langs:void 0,minWidth:S.codeBlockMinWidth,maxWidth:S.codeBlockMaxWidth},typeof ye.value=="boolean"?{showTooltips:ye.value}:{}),ZN.value)),Rx=D(()=>it(Ot(it({},Bx.value),{langs:S.langs}),Ox.value));function Dx(_){return typeof _=="boolean"?_:void 0}const XN=D(()=>{const _=S.codeBlockProps||{},H={},X=Dx(_.showLineNumbers);X!==void 0&&(H.showLineNumbers=X);const J=Dx(_.diffInline);J!==void 0&&(H.diffInline=J);const ce=(function(we){const Le=Number(we);return Number.isFinite(Le)&&Le>0?Le:void 0})(_.reservedHeightPx);return ce!==void 0&&(H.reservedHeightPx=ce),H}),QN=D(()=>it(it({stream:S.codeBlockStream,darkTheme:S.codeBlockDarkTheme,lightTheme:S.codeBlockLightTheme,themes:S.themes,langs:S.langs,minWidth:S.codeBlockMinWidth,maxWidth:S.codeBlockMaxWidth},typeof ye.value=="boolean"?{showTooltips:ye.value}:{}),Ox.value)),JN=D(()=>it({},S.mermaidProps||{})),Px=D(()=>it({},S.d2Props||{})),e9=D(()=>it({},S.infographicProps||{})),Zu=D(()=>({typewriter:f.value,fade:S.fade,customHtmlTags:nt.value.customHtmlTags})),t9=D(()=>it(it({},Zu.value),typeof ye.value=="boolean"?{showTooltip:ye.value}:{})),n9=D(()=>it(it({},Zu.value),typeof ye.value=="boolean"?{showTooltips:ye.value}:{})),o9=D(()=>it(it({},Zu.value),typeof ye.value=="boolean"?{showTooltips:ye.value}:{})),s9=D(()=>it(it({},Zu.value),typeof ye.value=="boolean"?{showTooltips:ye.value}:{}));function i9(_){return Array.isArray(_.children)&&_.children.length>0}const kh=D(()=>IN.value.map(_=>{var H,X,J,ce,we,Le,Fe,Ve;let Oe=(function(st){var pt,kt,Mt,Ct,Et,qt,Xt;if(st.type!=="code_block")return st;const In=st,Ko=[String((pt=In.language)!=null?pt:""),String((kt=In.loading)!=null?kt:""),String((Mt=In.diff)!=null?Mt:""),String((Ct=In.code)!=null?Ct:""),String((Et=In.originalCode)!=null?Et:""),String((qt=In.updatedCode)!=null?qt:""),String((Xt=In.raw)!=null?Xt:"")].join("\0"),Ro=Nt.get(In);if(Ro&&Ro.signature===Ko)return Ro.node;const $i=it({},In);return Nt.set(In,{signature:Ko,node:$i}),$i})(_.node);const Pe=bh(Oe);let je=Ux(Oe,Pe);if((Oe.type==="html_block"||Oe.type==="html_inline")&&je===Fx[Oe.type]){const st=Oe,pt=String((H=st.tag)!=null?H:"").trim().toLowerCase()||Y5(st.content);if(pt){const kt=sn.value[pt];if(es.value.has(pt)&&kt)je=kt,Oe=Ot(it({},st),{type:pt,tag:pt,content:FY(st.content,pt)});else if(Z5((X=st.content)!=null?X:st.raw,pt)){const Mt=String((ce=(J=st.content)!=null?J:st.raw)!=null?ce:"");Oe.type==="html_inline"?(je=mo,Oe={type:"text",content:Mt,raw:Mt}):(je=Ha,Oe={type:"paragraph",children:[{type:"text",content:Mt,raw:Mt}],raw:Mt})}}}const $e=Oe.type==="code_block"&&p.value==="pre"&&je===Fs&&!ng(sn.value,Pe);let He=it({},(function(st,pt,kt){const Mt=pt??bh(st);if(st.type==="code_block"){const Ct=Mt?ng(sn.value,Mt):void 0;if(kt&&p.value==="pre"&&!Ct&&kt===Fs)return XN.value;if(kt&&Mt&&kt===Ct)return Mt==="mermaid"?Wx(st):Mt==="infographic"?zx(st):Mt==="d2"||Mt==="d2lang"?Px.value:Rx.value;if(kt&&kt===sn.value.code_block)return Rx.value;if(ax(kt))return QN.value}return Mt==="mermaid"?Wx(st):Mt==="infographic"?zx(st):Mt==="d2"||Mt==="d2lang"?Px.value:st.type==="link"?t9.value:st.type==="list"?n9.value:st.type==="blockquote"?o9.value:st.type==="table"?s9.value:st.type==="code_block"?Bx.value:Zu.value})(Oe,Pe,je));const Xe=io.value?lc.value[_.index]:null;Oe.type==="code_block"&&Xe?.kind==="code-block"&&(He=Ot(it({},He),$e?{reservedHeightPx:(we=Xe.height)!=null?we:Xe.contentHeight}:{estimatedHeightPx:Xe.height,estimatedContentHeightPx:Xe.contentHeight,estimatedDiffInline:Xe.diffInline})),$e||Oe.type!=="code_block"||Pe!=="mermaid"||Gc(He.estimatedPreviewHeightPx)!=null||(He=Ot(it({},He),{estimatedPreviewHeightPx:Bm(Fm(String((Le=Oe.code)!=null?Le:"")))})),$e||Oe.type!=="code_block"||Pe!=="infographic"||Gc(He.estimatedPreviewHeightPx)!=null||(He=Ot(it({},He),{estimatedPreviewHeightPx:Rm(Om(String((Fe=Oe.code)!=null?Fe:"")))})),Oe.type==="math_block"&&(He=Ot(it({},He),{cacheScope:Qn}));const Ye=(function(st,pt){const kt=String(st.type);return!Kf(kt)&&sn.value[kt]===pt})(Oe,je),ct=Ye?H2(Oe,de.value):void 0;return Ot(it({},_),{node:Oe,component:je,bindings:He,customBindings:it(it({},ct??{}),He),rendersCustomNode:Ye,hasSlotChildren:i9(Oe),slotContent:String((Ve=Oe.content)!=null?Ve:""),isCodeBlock:Oe.type==="code_block",indexKey:`${YN.value}-${_.index}`,vnodeKey:`${$N.value}\0${_.index}\0${Oe.type}`})}));function bh(_){var H;return _?.type==="code_block"?String((H=_.language)!=null?H:"").trim().toLowerCase():""}function ng(_,H){const X=H.trim().toLowerCase();if(X)for(const J of[X,K1(X),oE(X)]){const ce=J&&_[J];if(ce)return ce}}function Hx(_,H,X,J){var ce,we;const Le=it({},_.value);return Gc(Le.estimatedPreviewHeightPx)==null&&(Le.estimatedPreviewHeightPx=J(X(String((ce=H?.code)!=null?ce:"")),void 0,Le.maxHeight==="none"?null:(we=Gc(Le.maxHeight))!=null?we:void 0)),Le}function Wx(_){return Hx(JN,_,Fm,Bm)}function zx(_){return Hx(e9,_,Om,Rm)}function Ux(_,H){if(!_)return Qy;const X=sn.value,J=X[String(_.type)];if(_.type==="code_block"){const ce=H??bh(_),we=ce?ng(X,ce):void 0;return we||(p.value==="pre"?X.code_block||Fs:ce==="mermaid"?X.mermaid||VN:ce==="infographic"?X.infographic||KN:ce==="d2"||ce==="d2lang"?X.d2||GN:J||X.code_block||cx.value)}return J||Fx[String(_.type)]||Qy}function og(_){s("click",_)}function r9(_){var H;(H=_.target)!=null&&H.closest("[data-node-index]")&&s("mouseover",_)}function l9(_){var H;(H=_.target)!=null&&H.closest("[data-node-index]")&&s("mouseout",_)}function qx(_){s("mouseover",_)}function jx(_){s("mouseout",_)}const la=oe(null),Es=oe(!1),Xu=oe(null),a9=D(()=>!(S.domMode!=="minimal"||G.value||S.fade!==!1||f.value||Es.value||Qe.value||zt.value||Bo.value||As.value||Re.value||Object.keys(sn.value).length!==0));let Qu,yc=null,sg=0,xh=0,wh=0;const Vx=["code_block","admonition","table","math_block","html_block","image","thematic_break"],c9=new Set(Vx),Kx=[".typewriter-cursor",".height-estimation-probes",...Vx.map(_=>`[data-node-type="${_}"]`),"script","style"].join(",");function Gx(_){if(!_||typeof _!="object")return!1;const H=_.type;return typeof H=="string"&&c9.has(H)}function _h(_){var H,X;if(!_||typeof _!="object")return 0;const J=_,ce=(X=(H=J.raw)!=null?H:J.content)!=null?X:J.code;if(typeof ce=="string")return ce.length;const we=J.children;if(Array.isArray(we))return we.reduce((Fe,Ve)=>Fe+_h(Ve),0);const Le=J.items;return Array.isArray(Le)?Le.reduce((Fe,Ve)=>Fe+_h(Ve),0):0}function Sh(){Qu&&(clearTimeout(Qu),Qu=void 0)}function ig(){sg+=1,yc!=null&&(ge?.(yc),yc=null)}function Ju(){ig(),sl(),la.value&&(la.value.style.visibility="hidden")}function u9(_){var H;if(_.nodeType!==Node.TEXT_NODE||!((H=_.textContent)!=null?H:"").trim())return!1;const X=_.parentElement;return!!X&&!X.closest(Kx)}function d9(_){let H=_.lastChild;for(;H;){if(u9(H))return H;if(H.nodeType===Node.ELEMENT_NODE){const X=H;if(!X.matches(Kx)&&X.lastChild){H=X.lastChild;continue}}for(;H&&H!==_&&!H.previousSibling;)H=H.parentNode;if(!H||H===_)break;H=H.previousSibling}return null}function Yx(){const _=kh.value;for(let H=_.length-1;H>=0;H--){const X=_[H];if(!X||Gx(X.node)||!gh(X.index))continue;const J=cn.get(X.index);if(!J)continue;const ce=d9(J);if(ce)return ce}return null}function sl(){Xu.value&&(Xu.value.classList.remove(o3),Xu.value=null)}function Ch(){if(d.value!=="simple"||!P||!Es.value||!L.value)return void sl();const _=Yx(),H=_?(function(X){var J;const ce=(J=X.parentElement)==null?void 0:J.closest(".text-node");return ce instanceof HTMLElement?ce:X.parentElement})(_):null;H!==Xu.value&&(sl(),H&&(H.classList.add(o3),Xu.value=H))}function Ah(){if(d.value!=="precise"||!P||!Es.value||yc!=null)return;const _=sg,H=()=>{yc=null,_===sg&&(function(){var X,J;if(d.value!=="precise"||!(P&&Es.value&&L.value&&la.value))return;const ce=L.value,we=la.value;we.style.visibility="hidden";const Le=Yx();if(!Le)return;let Fe=0,Ve=0,Oe=20,Pe=!1;if(Le?.textContent){const je=Le.textContent.length,$e=document.createRange();$e.setStart(Le,Math.max(0,je-1)),$e.setEnd(Le,je);const He=typeof $e.getClientRects=="function"?$e.getClientRects():void 0,Xe=(J=He?.[He.length-1])!=null?J:(X=Le.parentElement)==null?void 0:X.getBoundingClientRect();if(Xe){const Ye=vt("typewriterCursor.root.getBoundingClientRect",()=>ce.getBoundingClientRect());Fe=Xe.right-Ye.left+ce.scrollLeft,Ve=Xe.top-Ye.top+ce.scrollTop,Oe=Xe.height||Oe,Pe=!0}$e.detach()}Pe&&(we.style.transform=`translate(${Math.max(0,Fe)}px, ${Math.max(0,Ve)}px)`,we.style.height=`${Oe}px`,we.style.visibility="visible")})()};Te?yc=Te(H):H()}return et([Ze,()=>o.content,()=>o.nodes,()=>S.typewriter,lt],()=>Zn(null,null,function*(){var _,H;if(!P||G.value||!se.value)return;if(lt.value)return Es.value=!1,Sh(),void Ju();if((_=o.nodes)!=null&&_.length)return Es.value=!1,Sh(),Ju(),xh=((H=o.content)!=null?H:"").length,void(wh=Ze.value.length);const X=(function(){var Fe,Ve;return(Fe=o.nodes)!=null&&Fe.length?o.nodes.reduce((Oe,Pe)=>Oe+_h(Pe),0):((Ve=o.content)!=null?Ve:"").length})(),J=(function(){var Fe;return(Fe=o.nodes)!=null&&Fe.length?o.nodes.reduce((Ve,Oe)=>Ve+_h(Oe),0):Ze.value.length})(),ce=!Gx(Be.value[Be.value.length-1]),we=X>xh,Le=J>wh;if(!f.value||!ce||!we&&!Le)return f.value&&ce||(Es.value=!1,Ju()),xh=X,void(wh=J);xh=X,wh=J,Es.value=!0,d.value==="precise"&&la.value&&(la.value.style.visibility="hidden"),Sh(),yield yt(),d.value==="simple"?Ch():(sl(),Ah()),Qu=setTimeout(()=>{Qu=void 0,Es.value=!1},3e3)}),{flush:"post",immediate:!0}),et(Es,_=>Zn(null,null,function*(){_?(yield yt(),d.value!=="simple"?(sl(),d.value==="precise"&&Ah()):Ch()):Ju()}),{flush:"post"}),et(d,()=>Zn(null,null,function*(){if(P&&!G.value&&se.value&&Es.value){if(yield yt(),d.value==="simple")return ig(),void Ch();sl(),d.value!=="precise"?Ju():Ah()}}),{flush:"post"}),et([()=>te.value,()=>jo.start,()=>jo.end],()=>Zn(null,null,function*(){P&&!G.value&&se.value&&Es.value&&(yield yt(),d.value!=="simple"?(sl(),d.value==="precise"&&Ah()):Ch())}),{flush:"post"}),ho(()=>{Sh(),ig(),sl(),Bn.clear()}),(_,H)=>{const X=PI("NodeRenderer",!0);return C(G)?(x(!0),E(We,{key:0},rt(kh.value,J=>(x(),E(We,{key:J.vnodeKey},[J.rendersCustomNode?(x(),Se(Ho(J.component),Sn({key:0,ref_for:!0},J.customBindings,{node:J.node,loading:J.node.loading,"index-key":J.indexKey,"custom-id":S.customId,"is-dark":S.isDark,onClick:og,onMouseover:qx,onMouseout:jx,onCopy:H[0]||(H[0]=ce=>i(ce)),onHandleArtifactClick:H[1]||(H[1]=ce=>s("handleArtifactClick",ce))}),{default:Ie(()=>[J.hasSlotChildren?(x(),Se(X,Sn({key:0,ref_for:!0},vn.value,{nodes:J.node.children,"index-key":J.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):J.slotContent?(x(),Se(X,Sn({key:1,ref_for:!0},vn.value,{content:J.slotContent,final:!J.node.loading,"index-key":`${J.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ue("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(x(),Se(Ho(J.component),Sn({key:1,node:J.node,loading:J.node.loading,"index-key":J.indexKey},{ref_for:!0},J.bindings,{"custom-id":S.customId,"is-dark":S.isDark,onClick:og,onMouseover:qx,onMouseout:jx,onCopy:H[2]||(H[2]=ce=>i(ce)),onHandleArtifactClick:H[3]||(H[3]=ce=>s("handleArtifactClick",ce))}),null,16,["node","loading","index-key","custom-id","is-dark"]))],64))),128)):(x(),E("div",{key:1,ref_key:"containerRef",ref:L,class:Ue(["markstream-vue markdown-renderer",[{dark:S.isDark},{virtualized:zt.value},{"virtual-scroll-coordinated":qs.value},{"stable-layout":SN.value},{"typewriter-simple-cursor":Es.value&&d.value==="simple"}]]),"data-custom-id":S.customId,onClick:og,onMouseover:r9,onMouseout:l9},[js.value||zt.value?(x(),E(We,{key:0},[js.value?(x(),Se(Ese,{key:0,width:ui.value,"flow-root":zt.value||qs.value,"paragraph-node":Vn.value,"list-item-node":Kn.value,"list-node":Jn.value,"heading-nodes":Oo.value,"set-paragraph-wrapper":CN,"set-list-item-wrapper":AN,"set-list-wrapper":MN,"set-heading-wrapper":NN},null,8,["width","flow-root","paragraph-node","list-item-node","list-node","heading-nodes"])):ue("",!0),zt.value?(x(),E("div",{key:1,class:"node-spacer",style:on({height:`${S0.value}px`}),"aria-hidden":"true"},null,4)):ue("",!0)],64)):ue("",!0),a9.value?(x(!0),E(We,{key:1},rt(kh.value,J=>(x(),E(We,{key:J.vnodeKey},[gh(J.index)?(x(),Se(Ho(J.component),Sn({key:0,node:J.node,loading:J.node.loading,"index-key":J.indexKey},{ref_for:!0},J.bindings,{"custom-id":S.customId,"is-dark":S.isDark,onMouseover:H[4]||(H[4]=ce=>s("mouseover",ce)),onMouseout:H[5]||(H[5]=ce=>s("mouseout",ce)),onCopy:H[6]||(H[6]=ce=>i(ce)),onHandleArtifactClick:H[7]||(H[7]=ce=>s("handleArtifactClick",ce))}),null,16,["node","loading","index-key","custom-id","is-dark"])):ue("",!0)],64))),128)):(x(!0),E(We,{key:2},rt(kh.value,J=>(x(),E("div",{key:J.vnodeKey,ref_for:!0,ref:ce=>vh(J.index,ce),class:"node-slot","data-node-index":J.index,"data-node-type":J.node.type},[gh(J.index)?(x(),E("div",{key:0,ref_for:!0,ref:ce=>(function(we,Le){var Fe;Le||(function(je){const $e=`${A0()}-${je}`;let He=!1;for(const Xe of Array.from(Zs.keys())){const Ye=Qi.get(Xe);(Ye?.index===je||Xe===$e||Xe.startsWith(`${$e}-`))&&(Zs.delete(Xe),Qi.delete(Xe),He=!0)}He&&(ac(),Gn("async-node"))})(we),kr.delete(we),(function(je){var $e;const He=(($e=Jl.get(je))!=null?$e:0)+1;Jl.set(je,He)})(we);const Ve=tl.get(we);if(Ve){for(const je of Ve)lh(je);tl.delete(we)}if((function(je){const $e=Vt.get(je);$e&&(co?.unobserve($e),zn.delete($e),Vt.delete(je))})(we),!Le||!Ms.value)return Xi.delete(we),void Jl.delete(we);Xi.set(we,Le);const Oe=()=>{yh(we,Le)};queueMicrotask(Oe);const Pe=(co||typeof ResizeObserver>"u"||(co=new ResizeObserver(je=>{if(je.length)for(const $e of je){const He=zn.get($e.target),Xe=Vt.get(He??-1);He!=null&&Xe&&yh(He,Xe)}else xr()})),co);if(Pe&&(Vt.set(we,Le),zn.set(Le,we),Pe.observe(Le)),typeof window<"u"){const je=((Fe=Be.value[we])==null?void 0:Fe.type)==="code_block"?[16,80,240,800]:lt.value?[80]:[];if(je.length){const $e=je.map(He=>tx(He,Oe,"node-resize")).filter(He=>He!=null);$e.length&&tl.set(we,$e)}}})(J.index,ce),class:"node-content"},[J.isCodeBlock?J.rendersCustomNode?(x(),Se(Ho(J.component),Sn({key:1,ref_for:!0},J.customBindings,{node:J.node,loading:J.node.loading,"index-key":J.indexKey,"custom-id":S.customId,"is-dark":S.isDark,onCopy:H[12]||(H[12]=ce=>i(ce)),onHandleArtifactClick:H[13]||(H[13]=ce=>s("handleArtifactClick",ce))}),{default:Ie(()=>[J.hasSlotChildren?(x(),Se(X,Sn({key:0,ref_for:!0},vn.value,{nodes:J.node.children,"index-key":J.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):J.slotContent?(x(),Se(X,Sn({key:1,ref_for:!0},vn.value,{content:J.slotContent,final:!J.node.loading,"index-key":`${J.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ue("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(x(),Se(Ho(J.component),Sn({key:2,node:J.node,loading:J.node.loading,"index-key":J.indexKey},{ref_for:!0},J.bindings,{"custom-id":S.customId,"is-dark":S.isDark,onCopy:H[14]||(H[14]=ce=>i(ce)),onHandleArtifactClick:H[15]||(H[15]=ce=>s("handleArtifactClick",ce))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(x(),Se(Ua,{key:0,name:"fade",css:S.fade!==!1,appear:S.fade!==!1},{default:Ie(()=>[J.rendersCustomNode?(x(),Se(Ho(J.component),Sn({key:0,ref_for:!0},J.customBindings,{node:J.node,loading:J.node.loading,"index-key":J.indexKey,"custom-id":S.customId,"is-dark":S.isDark,onCopy:H[8]||(H[8]=ce=>i(ce)),onHandleArtifactClick:H[9]||(H[9]=ce=>s("handleArtifactClick",ce))}),{default:Ie(()=>[J.hasSlotChildren?(x(),Se(X,Sn({key:0,ref_for:!0},vn.value,{nodes:J.node.children,"index-key":J.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):J.slotContent?(x(),Se(X,Sn({key:1,ref_for:!0},vn.value,{content:J.slotContent,final:!J.node.loading,"index-key":`${J.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ue("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(x(),Se(Ho(J.component),Sn({key:1,node:J.node,loading:J.node.loading,"index-key":J.indexKey},{ref_for:!0},J.bindings,{"custom-id":S.customId,"is-dark":S.isDark,onCopy:H[10]||(H[10]=ce=>i(ce)),onHandleArtifactClick:H[11]||(H[11]=ce=>s("handleArtifactClick",ce))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1032,["css","appear"]))],512)):(x(),E("div",{key:1,class:"node-placeholder",style:on({height:`${f0(J.index)}px`})},null,4))],8,Ise))),128)),Es.value&&d.value==="precise"?(x(),E("span",{key:3,ref_key:"typewriterCursorRef",ref:la,class:"typewriter-cursor","aria-hidden":"true"},null,512)):ue("",!0),zt.value?(x(),E("div",{key:4,class:"node-spacer",style:on({height:`${C0.value}px`}),"aria-hidden":"true"},null,4)):ue("",!0)],42,Nse))}}})),[["__scopeId","data-v-a9489508"]]),zs=BE;zs.install=e=>{const t=new Set(["MarkdownRender","NodeRenderer",zs.__name,zs.name].filter(n=>!!n));for(const n of t)e.component(n,BE)};const eb=Object.freeze(Object.defineProperty({__proto__:null,default:zs},Symbol.toStringTag,{value:"Module"})),Lse={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},$se={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Fse={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Ose={key:3,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Bse={class:"admonition-title"},Rse=["aria-expanded","aria-controls"],Dse=["id"],qp=Mn(Je({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:t}){var n;const o=e,s=t,i=D(()=>{if(o.node.title&&o.node.title.trim().length)return o.node.title;const c=o.node.kind||"note";return c.charAt(0).toUpperCase()+c.slice(1)}),r=oe(!!o.node.collapsible&&!((n=o.node.open)==null||n));function l(){o.node.collapsible&&(r.value=!r.value)}const a=`admonition-${Math.random().toString(36).slice(2,9)}`;return(c,u)=>(x(),E("div",{class:Ue(["admonition",[`admonition-${o.node.kind}`]])},[w("div",{id:a,class:"admonition-legend"},[o.node.kind==="note"||o.node.kind==="info"?(x(),E("svg",Lse,[...u[1]||(u[1]=[w("circle",{cx:"12",cy:"12",r:"10"},null,-1),w("path",{d:"M12 16v-4"},null,-1),w("path",{d:"M12 8h.01"},null,-1)])])):o.node.kind==="tip"?(x(),E("svg",$se,[...u[2]||(u[2]=[w("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"},null,-1),w("path",{d:"M9 18h6"},null,-1),w("path",{d:"M10 22h4"},null,-1)])])):o.node.kind==="warning"||o.node.kind==="caution"?(x(),E("svg",Fse,[...u[3]||(u[3]=[w("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"},null,-1),w("path",{d:"M12 9v4"},null,-1),w("path",{d:"M12 17h.01"},null,-1)])])):o.node.kind==="danger"||o.node.kind==="error"?(x(),E("svg",Ose,[...u[4]||(u[4]=[w("polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"},null,-1),w("path",{d:"M12 8v4"},null,-1),w("path",{d:"M12 16h.01"},null,-1)])])):ue("",!0),w("span",Bse,R(i.value),1),o.node.collapsible?(x(),E("button",{key:4,class:"admonition-toggle","aria-expanded":!r.value,"aria-controls":`${a}-content`,onClick:l},[(x(),E("svg",{style:on({rotate:r.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...u[5]||(u[5]=[w("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,Rse)):ue("",!0)]),qn(w("div",{id:`${a}-content`,class:"admonition-content","aria-labelledby":a},[ae(C(zs),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,fade:o.fade,onCopy:u[0]||(u[0]=d=>s("copy",d))},null,8,["index-key","nodes","custom-id","typewriter","fade"])],8,Dse),[[xi,!r.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);qp.install=e=>{e.component(qp.__name,qp)};const ok=()=>vs(()=>import("./d2_markstream-vue-yoD6TSFD.js"),[]);let rp=null,lp=ok,ap=null,s3=!1,i3=!1;function u3e(){return Zn(this,null,function*(){if(rp)return rp;const e=lp;return e?e===ok&&s3?null:ap||(ap=Zn(null,null,function*(){let t;try{t=yield e()}catch(n){if(e===ok)return e===lp&&(s3=!0,(function(o){i3||(i3=!0,console.warn('[markstream-vue] Optional dependency "@terrastruct/d2" is not installed. D2 blocks will render as source.',o))})(n)),null;throw n}finally{e===lp&&(ap=null)}return e!==lp?null:t?(rp=(function(n){var o;if(!n)return n;if(n.D2&&typeof n.D2=="function")return n.D2;if(n.default&&n.default.D2&&typeof n.default.D2=="function")return n.default.D2;const s=(o=n.default)!=null?o:n;return typeof s=="function"?s:s?.D2&&typeof s.D2=="function"?s.D2:s})(t),rp):null}),ap):null})}let cp=null,RE=null,up=null;function d3e(){return typeof RE=="function"}function f3e(){return Zn(this,null,function*(){if(cp)return cp;const e=RE;return e?up||(up=Zn(null,null,function*(){const t=yield e(),n=(function(o){var s,i,r;if(!o)return null;const l=(s=o.default)!=null?s:o,a=typeof l=="function"&&typeof((i=l.prototype)==null?void 0:i.render)=="function"?l:(r=o.Infographic)!=null?r:l?.Infographic;return typeof a=="function"?a:null})(t);return n?(cp=n,cp):null}).finally(()=>{up=null}),up):null})}const h3e=Symbol("markstreamLanguageIconResolver"),dp=oe(!1);let r3=!1;function kv(){const e=document.documentElement.dataset.colorScheme;return e==="dark"?!0:e==="light"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}function Pse(){return!r3&&typeof window<"u"&&typeof document<"u"&&(r3=!0,dp.value=kv(),new MutationObserver(()=>{dp.value=kv()}).observe(document.documentElement,{attributes:!0,attributeFilter:["data-color-scheme"]}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{dp.value=kv()})),dp}const DE=["cjs","css","csv","gif","htm","html","jpeg","jpg","js","json","jsx","log","md","mjs","pdf","png","scss","svg","ts","tsx","txt","vue","webp","xml","yaml","yml"],Hse=new Set(["AGENTS.md","CHANGELOG.md","Dockerfile","LICENSE","Makefile","README.md","package.json","pnpm-lock.yaml","pnpm-workspace.yaml","tsconfig.json","vite.config.ts"]),sk=[...DE].sort((e,t)=>t.length-e.length).join("|"),bv=new RegExp([String.raw`(?:^|[\s([{"'`+"`"+String.raw`])`,String.raw`(`,String.raw`(?:~|\.{1,2}|/)?(?:[A-Za-z0-9_.@+()[\]-]+/)+[A-Za-z0-9_.@+()[\]-]+(?:\.(?:${sk}))?`,String.raw`|`,String.raw`[A-Za-z0-9_.@+()[\]-]+\.(?:${sk})`,String.raw`)`,String.raw`(?:#L?(\d+)|:(\d+))?`,String.raw`(?=$|[\s)"'\]}>.,;!?,。;!?)])`].join(""),"gi"),PE=/[),.;!?,。;!?)]+$/;function Wse(e){const t=e.toLowerCase();return DE.some(n=>t.endsWith(`.${n}`))}function zse(e){const t=new Map,n=new RegExp(String.raw`\b(?:path|src)=["'](\/[^"']+\.(?:${sk}))["']`,"gi");let o;for(;(o=n.exec(e))!==null;){const s=o[1];if(!s)continue;const i=s.split("/").pop();i&&t.set(i,s)}return t}function Use(e,t={}){const n=e.trim();if(!n||/^[a-z][a-z0-9+.-]*:\/\//i.test(n))return null;const o=n.match(/^(.*?)(?:#L?(\d+)|:(\d+))?$/i);if(!o)return null;let s=(o[1]??"").replace(PE,"");if(!s)return null;const i=s.split("/").pop()??s,r=s.includes("/"),l=Hse.has(i),a=Wse(i);if(r&&!l&&!a)return null;if(!r&&!l){const d=t.aliases?.get(i);if(!d)return null;s=d}const c=o[2]??o[3],u=c?Number(c):void 0;return{path:s,line:u!==void 0&&Number.isFinite(u)&&u>0?u:void 0}}function qse(e,t={}){const n=[];bv.lastIndex=0;let o;for(;(o=bv.exec(e))!==null;){const s=o[0]??"",i=o[1]??"",r=s.indexOf(i);if(r<0)continue;const l=o[2]??o[3];let a=i+(l?s.slice(r+i.length):"");const c=a.replace(PE,""),u=a.length-c.length;a=c;const d=Use(a,t);if(!d)continue;const f=o.index+r,h=f+a.length;n.push({...d,start:f,end:h,text:a}),u>0&&(bv.lastIndex-=u)}return n}const jse=12e4,Vse=6e4,Kse=32,Gse=3e4,l3=/(^|\n)(`{3,}|~{3,})[^\n]*\n([\s\S]*?)(?:\n)?\2(?=\n|$)/g;function Yse(e){let t=0,n=0,o=0;l3.lastIndex=0;let s;for(;(s=l3.exec(e))!==null;){const r=s[3]??"";t+=1,n+=r.length,o=Math.max(o,r.length)}return{codeRenderer:e.length>=jse||n>=Vse||t>=Kse||o>=Gse?"pre":"shiki",codeFenceCount:t,codeChars:n}}function Zse(e){return new Worker("/assets/katexRenderer.worker-CO_gEm4q.js",{type:"module",name:e?.name})}function Xse(e){return new Worker("/assets/mermaidParser.worker-Dx4jPi9z.js",{type:"module",name:e?.name})}const Qse={key:1,class:"diff-wrap"},Jse={class:"diff-bar"},eie=["aria-label","onClick"],tie={class:"diff-pre"},nie={key:0,class:"diff-sign"},oie={class:"diff-text"},sie="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",a3="github-light",c3="github-dark",iie=Je({__name:"Markdown",props:{text:{},openFile:{},streaming:{type:Boolean,default:!1}},setup(e){hte(),Ate(),mte(),Tte(),pte(new Zse),Ete(new Xse);function t(W){return W.inline.ruler.disable("math"),W}const{t:n}=$t(),o=Jt("resolveImage"),s=oe(null),i=e,r=D(()=>!i.streaming),l=D(()=>zse(i.text??"")),a=D(()=>i.streaming?{codeRenderer:"shiki",codeFenceCount:0,codeChars:0}:Yse(i.text??"")),c=Pse(),u=D(()=>!i.streaming),d=zo(new Map),f=new Set,h=/(!\[[^\]]*\]\()\s*([^)\s]+)([^)]*\))/g,p=/(<img\b[^>]*?\bsrc=")([^"]+)(")/gi;function m(W){return!/^(https?:|data:|blob:)/i.test(W)}function y(W){if(!o)return;const z=[];for(const L of[h,p]){L.lastIndex=0;let O;for(;(O=L.exec(W))!==null;)z.push(O[2]??"")}for(const L of z)!L||!m(L)||d.has(L)||f.has(L)||(f.add(L),o(L).then(O=>{d.set(L,O!==L?O:"")}).catch(()=>{d.set(L,"")}).finally(()=>{f.delete(L)}))}function k(W){if(!o)return W;const z=L=>{if(!m(L))return null;const O=d.get(L);return O===void 0?sie:O===""?null:O};return W.replace(h,(L,O,U,Z)=>{const ie=z(U);return ie===null?L:`${O}${ie}${Z}`}).replace(p,(L,O,U,Z)=>{const ie=z(U);return ie===null?L:`${O}${ie}${Z}`})}et(()=>i.text,W=>y(W??""),{immediate:!0});function g(){if(!s.value||!i.openFile||i.streaming)return;const W=document.createTreeWalker(s.value,NodeFilter.SHOW_TEXT),z=[];let L=W.nextNode();for(;L;){const O=L,U=O.parentElement;U&&!U.closest("a, pre, .md-file-link, svg")&&O.data.trim().length>0&&z.push(O),L=W.nextNode()}for(const O of z){const U=qse(O.data,{aliases:l.value});if(U.length===0||!O.parentNode)continue;const Z=document.createDocumentFragment();let ie=0;for(const q of U){q.start>ie&&Z.append(document.createTextNode(O.data.slice(ie,q.start)));const ee=document.createElement("button");ee.type="button",ee.className="md-file-link",ee.textContent=q.text,ee.title=q.line?`${q.path}:${q.line}`:q.path,ee.addEventListener("click",fe=>{fe.preventDefault(),fe.stopPropagation(),i.openFile?.({path:q.path,line:q.line})}),Z.append(ee),ie=q.end}ie<O.data.length&&Z.append(document.createTextNode(O.data.slice(ie))),O.parentNode.replaceChild(Z,O)}}function v(W){return!(!W||/^(https?:|mailto:|tel:|data:|blob:|#)/i.test(W))}function b(W){let z=W.length;for(const L of["#","?"]){const O=W.indexOf(L);O!==-1&&O<z&&(z=O)}return W.slice(0,z)}function A(){if(!s.value||!i.openFile||i.streaming)return;const W=s.value.querySelectorAll("a[href]");for(const z of W){if(z.dataset.mdLinkHandled==="true"||z.closest("svg"))continue;const L=z.getAttribute("href")??"";v(L)&&(z.dataset.mdLinkHandled="true",z.addEventListener("click",O=>{O.preventDefault(),O.stopPropagation(),i.openFile?.({path:b(L)})}))}}function I(){yt().then(()=>{g(),A()})}et(()=>i.text,I),et(()=>i.streaming,I);let N=null;An(()=>{I(),s.value&&(N=new MutationObserver(I),N.observe(s.value,{childList:!0,subtree:!0}))}),On(()=>{N?.disconnect()});const M={showHeader:!0,showCopyButton:!0,showExpandButton:!1,showPreviewButton:!1,showCollapseButton:!1,showFontSizeButtons:!1,loading:!1,monacoOptions:{lineNumbers:!1,fontSize:13,fontFamily:"var(--font-mono)",padding:{top:12,bottom:12}}},$=/(^|\n)(?:```|~~~)diff\b[^\n]*\n([\s\S]*?)(?:\n)?(?:```|~~~)(?=\n|$)/g,T=D(()=>{const W=k(i.text??""),z=[];let L=0;$.lastIndex=0;let O;for(;(O=$.exec(W))!==null;){const Z=O[1]??"",ie=W.slice(L,O.index)+(Z||"");ie.trim()&&z.push({kind:"md",text:ie}),z.push({kind:"diff",code:O[2]??""}),L=$.lastIndex}const U=W.slice(L);return(U.trim()||z.length===0)&&z.push({kind:"md",text:U}),z});function F(W){return W.split(`
297
+ `)&&!(function(ie){const q=Y4(ie);if(Z4(q))return!1;const ee=IE(q);return ee.length>=2&&ee.some(fe=>fe.trim())})(U))})(r.value,W)?A():(function(){if(m+=1,h)return;const O=Math.max(0,(function(U){const Z=U.parseCoalesceMs;return typeof Z=="number"&&Number.isFinite(Z)&&Z>=0?Z:80})(e)-(Oi()-y));O<=0?A():h=setTimeout(A,O)})())},{flush:"sync",immediate:!0}),Lf(b);const I=D(()=>{var W,z,L,O;return IY(e.customHtmlTags,(W=e.parseOptions)==null?void 0:W.customHtmlTags,(O=(L=(z=t.customComponentsMap)==null?void 0:z.value)!=null?L:{},Object.entries(O).map(([U,Z])=>{const ie=Ti(U);return Z==null||!ie||Kf(ie)||U5.has(ie)||zf.has(ie)?"":ie}).filter(Boolean)))}),N=D(()=>{const{key:W,tags:z}=LY(I.value);if(!W)return o;const L=s.get(W);if(L)return L;const O=ZC(t.instanceMsgId,{customHtmlTags:z});return s.set(W,O),O}),M=D(()=>{const W=N.value;if(!e.customMarkdownIt)return W;const z=e.customMarkdownIt(W);return W.__markstreamHasCustomParserExtensions=!0,z.__markstreamHasCustomParserExtensions=!0,z}),$=D(()=>{var W,z;const L=(W=e.parseOptions)!=null?W:{},O=t.effectiveFinal.value,U=I.value,Z=O!=null,ie=U.length>0;return Z||ie||L.streamParse==null?it(it(Ot(it({},L),{streamParse:(z=L.streamParse)==null||z}),Z?{final:O}:{}),ie?{customHtmlTags:U}:{}):L}),T=D(()=>{var W;return new Set(((W=$.value.customHtmlTags)!=null?W:[]).map(z=>String(z).trim().toLowerCase()).filter(Boolean))}),F=D(()=>G4($.value,M.value,e.customMarkdownIt,{includeFinal:!0})),S=D(()=>G4($.value,M.value,e.customMarkdownIt,{includeFinal:!1}));et([F,S],([W,z],[L,O])=>{L&&(W===L&&z===O||(A(),z!==O&&(l=[],u="")))},{flush:"sync"});const B=D(()=>{var W,z,L,O,U,Z,ie,q,ee,fe,ne;if((W=e.nodes)!=null&&W.length)return l=[],u="",v(0),gt(e.nodes.slice());const j=r.value;if(!j)return l=[],u="",v(-1),[];const K=t.debugPerformanceEnabled.value,ve=K?Oi():0,he=M.value,Ae=F.value,re=S.value;a&&Ae!==a&&(function(tt){var lt,ut;(ut=(lt=tt.stream)==null?void 0:lt.reset)==null||ut.call(lt)})(he),c&&re!==c&&(l=[],u="");const Y=Object.keys((L=(z=t.customComponentsMap)==null?void 0:z.value)!=null?L:{}).length>0||typeof $.value.postTransformNodes=="function";Y!==d&&(l=[],u="");const Q=!Y&&l.length>0&&j.startsWith(u)&&re===c,P=K?K4(he):null,G=K?{}:void 0,me=J4(he),ye=!me&&!Y,de=it(it(Ot(it({},$.value),{__reuseStableTopLevelNodes:ye}),me?{__disableStreamParse:!0}:{}),G?{__timing:G}:{}),V=q8(j,he,de),se=K?Oi():0,pe=K?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let ke,Ne=K?ip(V.length):void 0,qe=0,be=0,xe=0;if(Q){const tt=K?Oi():0,[lt,ut]=(function(Tt){var wt,Ft;const[en,Hn]=Tt.scanGlobalReferenceAppend(Tt.previousContent,Tt.content),Pt=Tt.parseOptions;return[Tt.previousDirtyStartIndex>0&&Pt.final!==!0&&!Tt.customMarkdownIt&&!J4(Tt.md)&&!en&&typeof Pt.preTransformTokens!="function"&&typeof Pt.postTransformTokens!="function"&&typeof Pt.postTransformNodes!="function"&&((Ft=(wt=Pt.customHtmlTags)==null?void 0:wt.length)!=null?Ft:0)===0?Tt.previousDirtyStartIndex:0,Hn]})({content:j,previousContent:u,previousDirtyStartIndex:k,parseOptions:$.value,customMarkdownIt:e.customMarkdownIt,md:he,scanGlobalReferenceAppend:f});xe=ut;const mt=lt<=0;if(pe){const Tt=(function(wt,Ft,en,Hn={}){var Pt;if(!Ft.length)return{nodes:wt,metrics:ip(wt.length)};const bn=(Pt=Hn.scanStartIndex)!=null?Pt:0,pn=Hn.reuseDirtyTail!==!1,Kt=(function(Wt,mn,so,gn=0){const to=Math.min(Wt.length,mn.length);for(let vt=Math.min(to,Math.max(0,gn));vt<to;vt++)if(!yse(mn[vt],Wt[vt],so))return vt;return Wt.length===mn.length?-1:to})(wt,Ft,en,bn);if(Kt<0)return{nodes:Ft,metrics:{reusedNodeCount:wt.length,dirtyStartIndex:Kt,stablePrefixNodeCount:wt.length,dirtyTailNodeCount:0}};const Nn=wt.slice();let Gt=Kt;for(let Wt=0;Wt<Kt;Wt++)Nn[Wt]=Ft[Wt];if(pn)for(let Wt=Kt;Wt<wt.length;Wt++){const mn=Ft[Wt],so=wt[Wt];mn&&OE(mn,so,en)&&(Nn[Wt]=mn,Gt+=1)}return{nodes:Nn,metrics:{reusedNodeCount:Gt,dirtyStartIndex:Kt,stablePrefixNodeCount:Kt,dirtyTailNodeCount:Q4(Kt,wt,Ft)}}})(V,l,pe,{reuseDirtyTail:mt,scanStartIndex:lt});ke=Tt.nodes,Ne=Tt.metrics}else{const Tt=(function(wt,Ft,en={}){var Hn;if(!Ft.length)return{nodes:wt,metrics:ip(wt.length)};const Pt=(Hn=en.scanStartIndex)!=null?Hn:0,bn=en.reuseDirtyTail!==!1,pn=(function(Gt,Wt,mn=0){const so=Math.min(Gt.length,Wt.length);for(let gn=Math.min(so,Math.max(0,mn));gn<so;gn++)if(!vse(Wt[gn],Gt[gn]))return gn;return Gt.length===Wt.length?-1:so})(wt,Ft,Pt);if(pn<0)return{nodes:Ft,metrics:{reusedNodeCount:wt.length,dirtyStartIndex:pn,stablePrefixNodeCount:wt.length,dirtyTailNodeCount:0}};const Kt=wt.slice();let Nn=pn;for(let Gt=0;Gt<pn;Gt++)Kt[Gt]=Ft[Gt];if(bn)for(let Gt=pn;Gt<wt.length;Gt++){const Wt=Ft[Gt],mn=wt[Gt];Wt&&FE(Wt,mn)&&(Kt[Gt]=Wt,Nn+=1)}return{nodes:Kt,metrics:{reusedNodeCount:Nn,dirtyStartIndex:pn,stablePrefixNodeCount:pn,dirtyTailNodeCount:Q4(pn,wt,Ft)}}})(V,l,{reuseDirtyTail:mt,scanStartIndex:lt});ke=Tt.nodes,Ne=Tt.metrics}qe=K?Oi()-tt:0,be=mt?Ne?.dirtyStartIndex==null||Ne.dirtyStartIndex<0?ke.length:Ne.dirtyStartIndex:ke.length}else ke=V,Ne=ip(ke.length);t.effectiveFinal.value!==!0&&(pe?(function(tt,lt,ut=0){for(let mt=Math.max(0,ut);mt<tt.length;mt++)Q2(lt,"primeSignatureMs",()=>jl(tt[mt]))})(ke,pe,be):(function(tt,lt=0){for(let ut=Math.max(0,lt);ut<tt.length;ut++)jl(tt[ut])})(ke,be));const Ze=K?Oi()-se:0;if(p+=1,u=j,a=Ae,c=re,d=Y,l=ke,v((O=Ne?.dirtyStartIndex)!=null?O:0),K){const tt=K4(he),lt=typeof tt?.total=="number"&&tt.total>((U=P?.total)!=null?U:0);t.logPerf(lt?"parse(stream)":"parse(sync)",it(it(it({rendererId:t.instanceMsgId,ms:Math.round(Oi()-ve),nodes:ke.length,contentLength:j.length,parseCommitCount:p,parseCoalescedCount:m,nodeReuseMs:Ze,referenceDefinitionScanChars:xe,signatureMs:(Z=pe?.signatureMs)!=null?Z:0,stabilizeSignatureMs:(ie=pe?.stabilizeSignatureMs)!=null?ie:0,primeSignatureMs:(q=pe?.primeSignatureMs)!=null?q:0,signatureCallCount:(ee=pe?.signatureCallCount)!=null?ee:0,stabilizeSignatureCallCount:(fe=pe?.stabilizeSignatureCallCount)!=null?fe:0,primeSignatureCallCount:(ne=pe?.primeSignatureCallCount)!=null?ne:0,stabilizeMs:qe},Ne??{}),G?Object.fromEntries(dse.map(ut=>{var mt;return[ut,(mt=G[ut])!=null?mt:0]})):{}),tt?{streamMode:tt.lastMode,streamDelta:kse(tt,P),streamStats:tt}:{}))}return gt(ke)});return{effectiveCustomHtmlTags:I,effectiveCustomHtmlTagsSet:T,mdBase:N,mdInstance:M,mergedParseOptions:$,getParsedNodesDirtyStartIndex:()=>k,getParsedNodesRevision:()=>g,parsedNodes:B}}function xse(e){const{isClient:t}=e,n=oe(new Set),o=new Map,s=new Map,i=new Map;function r(c){if(!t)return;const u=i.get(c);u!=null&&(window.clearTimeout(u),i.delete(c))}function l(){if(t)for(const c of i.values())window.clearTimeout(c);i.clear()}function a(){n.value=new Set}return{visibleNodeIndices:n,nodeVisibilityHandles:o,nodeVisibilityWatchStops:s,nodeVisibilityFallbackTimers:i,clearVisibilityFallback:r,clearAllVisibilityFallbacks:l,markNodeVisible:function(c,u=!0){var d;u&&r(c),(function(f,h){if((m=(p=e.shouldTrackVisibleNodeIndices)==null?void 0:p.call(e))!=null&&!m)return;var p,m;const y=n.value,k=y.has(f);if(h){if(k)return;const v=new Set(y);return v.add(f),void(n.value=v)}if(!k)return;const g=new Set(y);g.delete(f),n.value=g})(c,u),u&&((d=e.onNodeMarkedVisible)==null||d.call(e,c))},resetNodeVisibleState:a,cleanupNodeVisibility:function(c){var u;if(e.shouldCleanupNodeVisibility&&!e.shouldCleanupNodeVisibility())return;for(const[f,h]of s.entries())f<c||(h(),s.delete(f));for(const[f,h]of o.entries())f<c||(h.destroy(),o.delete(f),r(f),(u=e.onNodeVisibilityCleaned)==null||u.call(e,f));for(const f of Array.from(i.keys()))f<c||r(f);if(!n.value.size)return;const d=new Set;for(const f of n.value)f<c&&d.add(f);n.value=d},destroyNodeVisibilityState:function(){a();for(const c of s.values())c();s.clear();for(const c of o.values())c.destroy();o.clear(),l()}}}function wse(e={}){const t=oe(""),n=oe(""),o=oe(!1),s=ete(e),i=()=>{const u=s.getSnapshot();t.value=u.source,n.value=u.visible,o.value=u.done},r=s.subscribe(i);i();const l=D(()=>Math.max(0,t.value.length-n.value.length)),a=D(()=>l.value===0),c=D(()=>o.value&&a.value);return Tk()&&Lf(()=>{r(),s.destroy()}),{source:t,visible:n,done:o,final:c,caughtUp:a,pendingChars:l,enqueue:u=>s.enqueue(u),finish:u=>s.finish(u),flush:()=>s.flush(),reset:u=>s.reset(u),pause:()=>s.pause(),resume:()=>s.resume()}}const _se={maxCharsPerSecond:3e3,maxCommitFps:20,maxCharsPerCommit:160,catchUpLatencyMs:220,catchUpThreshold:400},e3=/auto|scroll|overlay/i;function Sse(e){if(!e)return!1;const t=(e.overflowY||"").toLowerCase(),n=(e.overflow||"").toLowerCase();return e3.test(t)||e3.test(n)}function Cse(e){const t=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,n=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return t||n}const Ase={class:"m-0 p-0"},Mse=["data-probe"],Ese=Mn(Je(Ot(it({},{name:"HeightEstimationProbes"}),{__name:"HeightEstimationProbes",props:{width:{},flowRoot:{type:Boolean},paragraphNode:{},listItemNode:{},listNode:{},headingNodes:{},setParagraphWrapper:{type:Function},setListItemWrapper:{type:Function},setListWrapper:{type:Function},setHeadingWrapper:{type:Function}},setup(e){const t=e;function n(o){var s,i;return(i=(s=t.headingNodes)==null?void 0:s[o])!=null?i:null}return(o,s)=>(x(),E("div",{class:"height-estimation-probes",style:on({width:`${e.width}px`}),"aria-hidden":"true"},[w("div",{ref:i=>e.setParagraphWrapper(i),class:Ue(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"paragraph"},[ae(C(Ha),{node:e.paragraphNode,"index-key":"probe-paragraph"},null,8,["node"])],2),w("div",{ref:i=>e.setListItemWrapper(i),class:Ue(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list-item"},[w("ul",Ase,[ae(C(du),{node:e.listItemNode,"index-key":"probe-list-item"},null,8,["node"])])],2),w("div",{ref:i=>e.setListWrapper(i),class:Ue(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list"},[ae(C(fu),{node:e.listNode,"index-key":"probe-list"},null,8,["node"])],2),(x(),E(We,null,rt(6,i=>w("div",{key:`probe-heading-${i}`,ref_for:!0,ref:r=>e.setHeadingWrapper(i,r),class:Ue(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${i}`},[ae(C(Z1),{node:n(i),"index-key":`probe-heading-${i}`},null,8,["node","index-key"])],10,Mse)),64))],4))}})),[["__scopeId","data-v-3e0766e2"]]),t3=Je({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=D(()=>{var n,o;return Rm((o=Gc(e.estimatedPreviewHeightPx))!=null?o:Om(String((n=e.node.code)!=null?n:"")))});return()=>{var n;return Lt("div",{class:"infographic-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",background:"var(--diagram-bg)",borderColor:"var(--diagram-border)",color:"hsl(var(--ms-foreground))"},"data-markstream-infographic":"1","data-markstream-mode":"pending"},[e.showHeader?Lt("div",{class:"infographic-block-header flex justify-between items-center border-b",style:{padding:"var(--ms-inset-panel-y) var(--ms-inset-panel-x)",background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)",minHeight:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)"}},[Lt("div",{class:"flex items-center gap-x-2 overflow-hidden"},[Lt("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),Lt("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),Lt("div",{class:"infographic-header-actions flex items-center opacity-0 pointer-events-none",style:{gap:"var(--ms-gap-header-actions)"},"aria-hidden":"true"},Array.from({length:4},()=>Lt("span",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",style:{width:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))",height:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))"}})))]):null,Lt("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[Lt("pre",{class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",zIndex:"1",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String((n=e.node.code)!=null?n:"")),Lt("div",{class:"absolute inset-0"},[Lt("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}}),n3=Je({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=D(()=>{var n,o;return Bm((o=Gc(e.estimatedPreviewHeightPx))!=null?o:Fm(String((n=e.node.code)!=null?n:"")))});return()=>{var n;return Lt("div",{class:"mermaid-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",borderColor:"var(--diagram-border)"},"data-markstream-mermaid":"1","data-markstream-mode":"pending"},[e.showHeader?Lt("div",{class:"mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]",style:{background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)"}},[Lt("div",{class:"flex items-center gap-x-2 overflow-hidden"},[Lt("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),Lt("div",{class:"mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none","aria-hidden":"true"},Array.from({length:4},()=>Lt("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[Lt("span",{class:"action-icon block"})])))]):null,Lt("div",{class:"mermaid-preview-area relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[Lt("pre",{class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String((n=e.node.code)!=null?n:"")),Lt("div",{class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:{fontFamily:"inherit",contentVisibility:"auto",contain:"content",containIntrinsicSize:"var(--ms-size-diagram-min-height) 240px"}})])])}}}),Tse={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:"auto"},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}};function Do(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}const Nse=["data-custom-id"],Ise=["data-node-index","data-node-type"],o3="typewriter-simple-cursor-target",BE=Mn(Je(Ot(it({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},domMode:{},htmlPolicy:{},viewportPriority:{type:Boolean,default:void 0},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},codeRenderer:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},langs:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:[Boolean,String],default:!1},smoothStreaming:{type:[Boolean,String],default:"auto"},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:["copy","copy-code","handleArtifactClick","click","mouseover","mouseout","virtual-state-change","height-change","render-settled","render-final","anchor-change"],setup(e,{expose:t,emit:n}){const o=e,s=n;function i(_){if(!(typeof Event<"u"&&_ instanceof Event))return typeof _=="string"&&s("copy-code",_),void s("copy",_)}const r=Mo(),l=Jt("markstreamNestedRendererProps",void 0);function a(_){const H=r?.vnode.props;return!!H&&(Object.prototype.hasOwnProperty.call(H,_)||Object.prototype.hasOwnProperty.call(H,String(_).replace(/[A-Z]/g,X=>`-${X.toLowerCase()}`)))}function c(_){var H,X;const J=o[_];return a(_)?J:(X=(H=l?.value)==null?void 0:H[_])!=null?X:J}const u=D(()=>{return(_=c("mode"))==="chat"||_==="minimal"||_==="docs"?_:"docs";var _}),d=D(()=>U4(c("typewriter"))),f=D(()=>d.value!=="off"),h=D(()=>c("domMode")==="minimal"?"minimal":"full"),p=D(()=>{return(_={mode:u.value,codeRenderer:c("codeRenderer"),renderCodeBlocksAsPre:c("renderCodeBlocksAsPre")}).renderCodeBlocksAsPre===!0?"pre":_.codeRenderer==="pre"||_.codeRenderer==="shiki"||_.codeRenderer==="monaco"?_.codeRenderer:_.renderCodeBlocksAsPre===!1||_.mode==="docs"?"monaco":"pre";var _}),m=D(()=>Tse[u.value]),y=D(()=>{var _;return(_=c("showTooltips"))!=null?_:m.value.showTooltips}),k=D(()=>{var _;return(_=c("fade"))!=null?_:m.value.fade}),g=D(()=>{var _;return(_=c("batchRendering"))!=null?_:m.value.batchRendering}),v=D(()=>{var _;return(_=c("initialRenderBatchSize"))!=null?_:m.value.initialRenderBatchSize}),b=D(()=>{var _;return(_=c("renderBatchSize"))!=null?_:m.value.renderBatchSize}),A=D(()=>{var _;return(_=c("renderBatchDelay"))!=null?_:m.value.renderBatchDelay}),I=D(()=>{var _;return(_=c("renderBatchBudgetMs"))!=null?_:m.value.renderBatchBudgetMs}),N=D(()=>{var _;return(_=c("renderBatchIdleTimeoutMs"))!=null?_:m.value.renderBatchIdleTimeoutMs}),M=D(()=>{var _;return(_=c("deferNodesUntilVisible"))!=null?_:m.value.deferNodesUntilVisible}),$=D(()=>{var _;return(_=c("maxLiveNodes"))!=null?_:m.value.maxLiveNodes}),T=D(()=>{var _;return(_=c("liveNodeBuffer"))!=null?_:m.value.liveNodeBuffer}),F=D(()=>{var _;return(_=c("nodeVirtual"))!=null?_:m.value.nodeVirtual}),S={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return c("parseOptions")},get customMarkdownIt(){return c("customMarkdownIt")},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return c("customHtmlTags")},get mode(){return c("mode")},get domMode(){return h.value},get htmlPolicy(){return c("htmlPolicy")},get viewportPriority(){return c("viewportPriority")},get viewportPriorityOptions(){return c("viewportPriorityOptions")},get codeBlockStream(){return c("codeBlockStream")},get codeBlockDarkTheme(){return c("codeBlockDarkTheme")},get codeBlockLightTheme(){return c("codeBlockLightTheme")},get codeBlockMonacoOptions(){return c("codeBlockMonacoOptions")},get codeRenderer(){return c("codeRenderer")},get renderCodeBlocksAsPre(){return c("renderCodeBlocksAsPre")},get codeBlockMinWidth(){return c("codeBlockMinWidth")},get codeBlockMaxWidth(){return c("codeBlockMaxWidth")},get codeBlockProps(){return c("codeBlockProps")},get mermaidProps(){return c("mermaidProps")},get d2Props(){return c("d2Props")},get infographicProps(){return c("infographicProps")},get showTooltips(){return y.value},get themes(){return c("themes")},get langs(){return c("langs")},get isDark(){return c("isDark")},get customId(){return c("customId")},get indexKey(){return o.indexKey},get typewriter(){return c("typewriter")},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return c("smoothStreamingOptions")},get parseCoalesceMs(){return c("parseCoalesceMs")},get fade(){return k.value},get batchRendering(){return g.value},get initialRenderBatchSize(){return v.value},get renderBatchSize(){return b.value},get renderBatchDelay(){return A.value},get renderBatchBudgetMs(){return I.value},get renderBatchIdleTimeoutMs(){return N.value},get deferNodesUntilVisible(){return M.value},get maxLiveNodes(){return $.value},get liveNodeBuffer(){return T.value},get nodeVirtual(){return F.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function B(_){s("height-change",_)}function W(_){s("virtual-state-change",_)}function z(_){s("anchor-change",_)}const L=oe(),O=oe(null),U=oe(null),Z=oe(null),ie=zo({1:null,2:null,3:null,4:null,5:null,6:null}),q=oe(!1),ee=new Map,fe=oe(0),ne=oe(0),j=oe({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function K(_,H){return typeof _!="string"?H:_.trim()||H}function ve(_){const H=Number(_);return Number.isFinite(H)&&H>0?Math.max(1,Math.trunc(H)):640}const he=D(()=>{var _;const H=(_=S.viewportPriorityOptions)!=null?_:{},X=K(H.rootMargin,ja);return{rootMargin:X,heavyBlockMargin:K(H.heavyBlockMargin,X),maxTargets:ve(H.maxTargets)}}),Ae=D(()=>{var _;return(_=he.value.rootMargin)!=null?_:ja}),re=D(()=>{var _;return(_=he.value.maxTargets)!=null?_:640});function Y(){var _,H;if(((_=o.virtualScroll)==null?void 0:_.enabled)!==!0)return null;const X=(H=o.virtualScroll)==null?void 0:H.scrollRoot;return Q(typeof X=="function"?X():X)}function Q(_){return _?typeof HTMLElement<"u"&&_ instanceof HTMLElement?_:typeof _=="object"&&"value"in _?Q(_.value):typeof _=="object"&&"$el"in _?Q(_.$el):null:null}Ln(kE,he);const{isClient:P,renderAsFragment:G,debugPerformanceEnabled:me,resolvedShowTooltips:ye,resolvedHtmlPolicy:de,inheritedSmoothStreaming:V,ownsTypewriterCursor:se}=(function(_){const H=typeof window<"u",X=Bf(),J=Jt("markstreamHtmlPolicy",void 0),ce=Jt("markstreamTypewriterCursor",void 0),we=Jt("markstreamSmoothStreaming",void 0),Le=D(()=>_.renderAsFragment===!0),Fe=D(()=>!!(_.debugPerformance&&H&&typeof console<"u")),Ve=D(()=>{var je;if(typeof _.showTooltips=="boolean")return _.showTooltips;const $e=(je=X.showTooltips)!=null?je:X["show-tooltips"];return $e===""||$e===!0||$e==="true"||$e!==!1&&$e!=="false"&&void 0}),Oe=D(()=>{var je,$e;return($e=(je=_.htmlPolicy)!=null?je:J?.value)!=null?$e:"safe"}),Pe=D(()=>ce?.value!==!0);return{isClient:H,renderAsFragment:Le,debugPerformanceEnabled:Fe,resolvedShowTooltips:Ve,resolvedHtmlPolicy:Oe,inheritedSmoothStreaming:we,inheritedTypewriterCursor:ce,ownsTypewriterCursor:Pe}})(S),{resolveViewportRoot:pe,resolveScrollContainer:ke,isReverseFlexScrollRoot:Ne,getNormalizedScrollTop:qe,getOffsetTopWithinRoot:be}=(function(_,H){function X(){var Fe,Ve;return(Ve=(Fe=H.scrollRoot)==null?void 0:Fe.call(H))!=null?Ve:null}function J(Fe){if(typeof window>"u")return null;const Ve=X();if(Ve)return Ve;const Oe=Fe??_.value;if(!Oe)return null;const Pe=Oe.ownerDocument||document,je=Pe.scrollingElement||Pe.documentElement;let $e=Oe;for(;$e&&$e!==Pe.body&&$e!==je;){if(Sse(window.getComputedStyle($e))&&Cse($e))return $e;$e=$e.parentElement}return null}function ce(Fe){if(!H.isClient)return!1;try{const Ve=window.getComputedStyle(Fe);return!!(Ve.display||"").toLowerCase().includes("flex")&&(Ve.flexDirection||"").toLowerCase().endsWith("reverse")}catch{return!1}}function we(Fe,Ve,Oe){var Pe,je;if(Oe)return Le(Ve);const $e=Fe.scrollTop;if(!ce(Fe))return $e;const He=$e<0?-$e:$e;return Math.max(0,((Pe=Fe.scrollHeight)!=null?Pe:0)-((je=Fe.clientHeight)!=null?je:0))-He}function Le(Fe){var Ve,Oe,Pe,je,$e;const He=Number((Ve=Fe.scrollingElement)==null?void 0:Ve.scrollTop),Xe=Number((Pe=(Oe=Fe.documentElement)==null?void 0:Oe.scrollTop)!=null?Pe:0),Ye=Number(($e=(je=Fe.body)==null?void 0:je.scrollTop)!=null?$e:0);return Math.max(0,Number.isFinite(He)?He:0,Number.isFinite(Xe)?Xe:0,Number.isFinite(Ye)?Ye:0)}return{resolveViewportRoot:J,resolveScrollContainer:function(Fe){var Ve,Oe,Pe,je;const $e=X();if($e)return $e;const He=J((Ve=Fe??_.value)!=null?Ve:null);if(He)return He;const Xe=(je=(Pe=Fe?.ownerDocument)!=null?Pe:(Oe=_.value)==null?void 0:Oe.ownerDocument)!=null?je:typeof document<"u"?document:null;return Xe?.scrollingElement||Xe?.documentElement||null},isReverseFlexScrollRoot:ce,getNormalizedScrollTop:we,getOffsetTopWithinRoot:function(Fe,Ve){const Oe=Ve.ownerDocument||Fe.ownerDocument||document;if((function(He,Xe){return He===Xe.documentElement||He===Xe.body||He===Xe.scrollingElement})(Ve,Oe))return Fe.getBoundingClientRect().top+Le(Oe);const Pe=Ve.getBoundingClientRect(),je=Fe.getBoundingClientRect(),$e=we(Ve,Oe,!1);return je.top-Pe.top+$e}}})(L,{isClient:P,scrollRoot:Y});Ln("markstreamShowTooltips",ye),Ln("markstreamHtmlPolicy",de),Ln("markstreamTypewriter",f),Ln("markstreamFade",D(()=>S.fade!==!1)),Ln("markstreamTypewriterCursor",D(()=>!0)),Ln("markstreamTextStreamState",ee),Ln("markstreamStreamVersion",fe),Ln("markstreamParseOptions",D(()=>S.parseOptions)),Ln("markstreamCustomMarkdownIt",D(()=>S.customMarkdownIt));const{smoothStreamingEnabled:xe,renderContent:Ze,requestedFinal:tt,effectiveFinal:lt}=(function(_,H){const X=wse(it(it({},_se),_.smoothStreamingOptions)),J=D(()=>{var $e,He,Xe;return _.smoothStreaming!==!1&&!(($e=_.nodes)!=null&&$e.length)&&(_.smoothStreaming===!0||!((He=H.inheritedSmoothStreaming)!=null&&He.value))&&(_.smoothStreaming===!0||U4(_.typewriter)!=="off"||((Xe=_.maxLiveNodes)!=null?Xe:0)<=0)}),ce=oe(!H.isClient||_.smoothStreaming===!0);An(()=>{ce.value=!0});const we=D(()=>ce.value&&J.value),Le=D(()=>{var $e;return we.value?X.visible.value:($e=_.content)!=null?$e:""}),Fe=D(()=>{var $e,He;const Xe=($e=_.parseOptions)!=null?$e:{};return(He=_.final)!=null?He:Xe.final}),Ve=D(()=>{const $e=Fe.value;return we.value&&$e!=null?!!$e&&X.caughtUp.value:$e});let Oe=0,Pe=!1;function je(){Oe=0,Pe=!1}return et([()=>_.content,()=>_.nodes,we,Fe],([$e,He,Xe,Ye])=>{if(He?.length)return je(),void X.reset("");const ct=$e??"";if(!Xe)return je(),X.reset(ct),void(Ye&&X.finish({flush:!0}));const st=X.source.value;if(ct){if(ct!==st)if(ct.startsWith(st)){const pt=ct.slice(st.length),kt=X.pendingChars.value;pt.length<=8?(Oe++,Pe||Oe>=2&&kt<=8?(Pe=!0,X.reset(ct)):X.enqueue(pt)):(je(),X.enqueue(pt))}else je(),X.reset(ct)}else je(),X.reset("");Ye&&X.finish()},{immediate:!0}),{smoothStream:X,smoothStreamingEligible:J,smoothStreamingEnabled:we,renderContent:Le,requestedFinal:Fe,effectiveFinal:Ve}})(S,{isClient:P,inheritedSmoothStreaming:V}),ut=tt.value===!0;Ln("markstreamSmoothStreaming",xe);const mt=oe(!1),Tt=oe(!1),wt=oe(!1);let Ft="",en=!1,Hn=null;function Pt(){P&&Hn!=null&&(window.clearTimeout(Hn),Hn=null)}function bn(){mt.value=!1,Pt()}function pn(_,H){if(!me.value)return;const X=(function(){if(!me.value)return null;const J=mn(Kt),ce=mn(Nn),we=Math.max(Wt,ce);if(J<=0&&we<=0)return null;const Le={total:J,maxPerFrame:we,byLabel:(Fe=Kt,Object.fromEntries(Array.from(Fe.entries()).sort((Ve,Oe)=>Oe[1]-Ve[1]||Ve[0].localeCompare(Oe[0]))))};var Fe;return Kt.clear(),Nn.clear(),Wt=0,Le})();console.info(`[markstream-vue][perf] ${_}`,X?Ot(it({},H),{layoutReads:X}):H)}et([()=>S.indexKey,()=>S.customId],()=>{var _,H;bn(),Tt.value=!1,wt.value=!((_=o.nodes)!=null&&_.length)&&tt.value!==!0&&!!o.content,Ft=(H=Ze.value)!=null?H:"",en=Ft.length>0},{flush:"sync"}),et([()=>o.content,()=>o.nodes,tt],([_,H,X])=>{!H?.length&&X!==!0&&_&&(wt.value=!0)},{flush:"sync",immediate:!0}),et([Ze,()=>o.nodes,tt],([_,H,X])=>{const J=_??"";return H?.length||X===!0?(bn(),Tt.value=!1,Ft=J,void(en=!0)):(J.length>0&&(wt.value=!0),en?(Ft&&J.length>Ft.length&&J.startsWith(Ft)?(mt.value=!0,Tt.value=!0,P&&(Pt(),Hn=window.setTimeout(()=>{var ce;Hn=null,lt.value===!0||(ce=o.nodes)!=null&&ce.length||(gc(),mt.value=!1,xr())},1200))):(J.length<Ft.length||!J.startsWith(Ft))&&(bn(),Tt.value=!1),void(Ft=J)):(Ft=J,void(en=!0)))},{flush:"sync",immediate:!0});const Kt=new Map,Nn=new Map;let Gt=!1,Wt=0;function mn(_){let H=0;for(const X of _.values())H+=X;return H}function so(){Wt=Math.max(Wt,mn(Nn)),Nn.clear(),Gt=!1}function gn(_){_.maxPerFrame=Math.max(Number(_.maxPerFrame||0),Number(_.currentFrameTotal||0)),_.currentFrameTotal=0,_.frameScheduled=!1}function to(_){var H,X;me.value&&(Kt.set(_,((H=Kt.get(_))!=null?H:0)+1),Nn.set(_,((X=Nn.get(_))!=null?X:0)+1),(function(J){const ce=(function(){if(!P||typeof window>"u")return null;const we=window;if(we.__markstreamLayoutReadPerformance)return we.__markstreamLayoutReadPerformance;const Le={total:0,maxPerFrame:0,byLabel:{}};return we.__markstreamLayoutReadPerformance=Le,Le})();ce&&(ce.total=Number(ce.total||0)+1,ce.byLabel[J]=Number(ce.byLabel[J]||0)+1,ce.currentFrameTotal=Number(ce.currentFrameTotal||0)+1,ce.frameScheduled||(ce.frameScheduled=!0,typeof window.requestAnimationFrame!="function"?typeof queueMicrotask!="function"?setTimeout(()=>gn(ce),0):queueMicrotask(()=>gn(ce)):window.requestAnimationFrame(()=>gn(ce))))})(_),Gt||(Gt=!0,P&&typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(so):typeof queueMicrotask!="function"?setTimeout(so,0):queueMicrotask(so)))}function vt(_,H){return to(_),H()}const Wn=S.customId?`renderer-${S.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,Bn=(function(_){const H=new Map;return{scope:_,cache:H,clear:()=>H.clear()}})(Wn),Qn=Wn;Ln(ME,Bn);const sn=To(()=>S.customId),{effectiveCustomHtmlTagsSet:es,mergedParseOptions:nt,parsedNodes:Be,getParsedNodesDirtyStartIndex:Bt,getParsedNodesRevision:Yt}=bse(S,{instanceMsgId:Wn,renderContent:Ze,effectiveFinal:lt,smoothStreamingEnabled:xe,debugPerformanceEnabled:me,customComponentsMap:sn,logPerf:pn});et(Be,()=>{mt.value||Bn.clear(),fe.value+=1},{immediate:!0});const vn=D(()=>({customId:S.customId,customHtmlTags:nt.value.customHtmlTags,parseOptions:S.parseOptions,customMarkdownIt:S.customMarkdownIt,htmlPolicy:de.value,viewportPriority:S.viewportPriority,viewportPriorityOptions:he.value,mode:u.value,domMode:S.domMode,codeRenderer:p.value,codeBlockStream:S.codeBlockStream,codeBlockDarkTheme:S.codeBlockDarkTheme,codeBlockLightTheme:S.codeBlockLightTheme,codeBlockMonacoOptions:S.codeBlockMonacoOptions,renderCodeBlocksAsPre:S.renderCodeBlocksAsPre,codeBlockMinWidth:S.codeBlockMinWidth,codeBlockMaxWidth:S.codeBlockMaxWidth,codeBlockProps:S.codeBlockProps,mermaidProps:S.mermaidProps,d2Props:S.d2Props,infographicProps:S.infographicProps,showTooltips:ye.value,themes:S.themes,langs:S.langs,isDark:S.isDark,typewriter:f.value,smoothStreamingOptions:S.smoothStreamingOptions,parseCoalesceMs:S.parseCoalesceMs,fade:S.fade}));Ln("markstreamNestedRendererProps",vn);const xn=D(()=>Be.value),nn=D(()=>Be.value.length),Vn=oe(null),Kn=oe(null),Jn=oe(null),Oo=oe(null),ko=o.indexKey!=null&&String(o.indexKey).startsWith("list-item-"),li=!ko&&S.customId?D4(S.customId):null,Uo=D(()=>li?(pv.value,D4(S.customId)):null),As=D(()=>{var _;return!!(!G.value&&S.customId&&!ko&&((_=Uo.value)!=null&&_.enabled))}),cs=D(()=>!!(P&&As.value)),qo=D(()=>{var _;return!!(!G.value&&((_=o.virtualScroll)!=null&&_.enabled))}),Bo=D(()=>qo.value),ai=oe(!1);An(()=>{ai.value=!0});const tn=D(()=>!!(P&&qo.value));Ln("markstreamHostScrollManaged",tn);const qs=D(()=>!!(ai.value&&tn.value)),io=D(()=>cs.value||tn.value),js=D(()=>cs.value||qs.value),ci=D(()=>{var _;return io.value&&((_=Uo.value)==null?void 0:_.textEstimation)!==!1});function Ni(){const _=ne.value||vt("getMeasuredContainerWidth.clientWidth",()=>{var H;return((H=L.value)==null?void 0:H.clientWidth)||0});return Number.isFinite(_)&&_>0?_:0}const ui=D(()=>{const _=Ni();return _>0?Math.max(1,Math.round(_)):640}),Vs=D(()=>{var _,H;return!(lt.value!==!0||qo.value||u.value!=="chat"&&u.value!=="minimal"||a("maxLiveNodes")||a("liveNodeBuffer")||(_=o.nodes)!=null&&_.length||wt.value||!(((H=S.maxLiveNodes)!=null?H:0)<=0))}),ts=D(()=>{var _;return Vs.value?50:Math.max(1,(_=S.maxLiveNodes)!=null?_:320)}),ns=D(()=>{var _;return Vs.value?16:Math.max(0,(_=S.liveNodeBuffer)!=null?_:60)}),zt=D(()=>{var _;return!G.value&&S.nodeVirtual!==!1&&!(((_=S.maxLiveNodes)!=null?_:0)<=0&&!Vs.value)&&(S.nodeVirtual===!0?Be.value.length>0:Be.value.length>ts.value)}),Ms=D(()=>zt.value||cs.value||tn.value),No=D(()=>S.viewportPriority!==!1),di=D(()=>!!No.value&&!q.value);var Ke;Ke=D(()=>No.value),Ln(bE,Ke);const Re=D(()=>{var _;return!(G.value||S.deferNodesUntilVisible===!1||((_=S.maxLiveNodes)!=null?_:0)<=0||zt.value||Be.value.length>900||S.viewportPriority===!1)}),le=ene(_=>{var H;return pe((H=_??L.value)!=null?H:null)},No),{requestFrame:Te,cancelFrame:ge,hasIdleCallback:Ee,isTestEnv:ze}=(function(_){const H=_.isClient&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):null,X=_.isClient&&typeof window.cancelAnimationFrame=="function"?window.cancelAnimationFrame.bind(window):null,J=_.isClient&&typeof window.requestIdleCallback=="function",ce=(function(){var we;if(typeof globalThis>"u"||!("process"in globalThis))return;const Le=(we=Object.getOwnPropertyDescriptor(globalThis,"process"))==null?void 0:we.value;return Le?.env})();return{requestFrame:H,cancelFrame:X,hasIdleCallback:J,isTestEnv:ce?.NODE_ENV==="test"}})({isClient:P}),Ht=D(()=>lt.value===!0&&!qo.value),{resolvedBatchSize:Ut,resolvedInitialBatch:wn,batchingEnabled:go,incrementalRenderingActive:us,renderedCount:te,previousRenderContext:Ce,adaptiveBatchSize:Me,previousBatchConfig:De}=(function(_,H){var X;const J=D(()=>{var je;const $e=Math.trunc((je=_.renderBatchSize)!=null?je:80);return Number.isFinite($e)?Math.max(0,$e):0}),ce=D(()=>{var je;const $e=Math.trunc((je=_.initialRenderBatchSize)!=null?je:J.value);return Number.isFinite($e)?Math.max(0,$e):J.value}),we=D(()=>!H.renderAsFragment.value&&_.batchRendering!==!1&&J.value>0&&H.isClient&&!H.isTestEnv),Le=oe(0),Fe=oe({key:_.indexKey,total:0}),Ve=oe(Math.max(1,J.value||1)),Oe=D(()=>{var je,$e,He;return we.value&&!((je=H.continuousStreaming)!=null&&je.value)&&!(($e=H.forceFullRenderFinalContent)!=null&&$e.value)&&((He=_.maxLiveNodes)!=null?He:0)<=0}),Pe=oe({batchSize:J.value,initial:ce.value,delay:(X=_.renderBatchDelay)!=null?X:16,enabled:Oe.value});return{resolvedBatchSize:J,resolvedInitialBatch:ce,batchingEnabled:we,incrementalRenderingActive:Oe,renderedCount:Le,previousRenderContext:Fe,adaptiveBatchSize:Ve,previousBatchConfig:Pe}})(S,{isClient:P,isTestEnv:ze,renderAsFragment:G,forceFullRenderFinalContent:Ht,continuousStreaming:D(()=>Tt.value&&lt.value!==!0)}),Qe=D(()=>{var _;return!G.value&&S.batchRendering!==!1&&Ut.value>0&&!ze&&((_=S.maxLiveNodes)!=null?_:0)<=0&&!Ht.value}),at=D(()=>Qe.value),It=D(()=>io.value||at.value),Qt=D(()=>{var _;return It.value&&((_=Uo.value)==null?void 0:_.codeBlockEstimation)!==!1}),cn=new Map,Vt=new Map,zn=new WeakMap;let co=null;const Nt=new WeakMap,_t=new Map,Zt=[];let eo=[],ro=[],Ks=-1;const Ii=gr(Zt),Gs=new Set,Jf=oe(0);let eh=0;const Hb=oe(0),cN=D(()=>(Hb.value,Array.from(cn.entries()).sort((_,H)=>_[0]-H[0]))),Iu=oe(null),Ys=oe(null);let el,Ql=null,d0=0,Lu=null;function fi(){el.markFallbackHeightPrefixDirty()}function f0(_){return el.getFallbackNodeHeight(_)}function nc(_,H){return el.estimateHeightRange(_,H)}function h0(_){return el.estimateIndexForOffset(_)}const{activeRestoreAnchor:oc,getRelativeScrollTopWithinContainer:uN,setRelativeScrollTopWithinContainer:dN,resolveAnchorOffset:fN,clearRestoreReconcile:th,scheduleRestoreReconcile:$u,captureRestoreAnchor:Wb,restoreAnchor:zb,getAnchorDrift:hN}=(function(_){const{isClient:H,containerRef:X,parsedNodeCount:J,requestFrame:ce,cancelFrame:we,resolveScrollContainer:Le,getNormalizedScrollTop:Fe,getOffsetTopWithinRoot:Ve,isReverseFlexScrollRoot:Oe,estimateIndexForOffset:Pe,estimateHeightRange:je,getFallbackNodeHeight:$e,clamp:He}=_,Xe=oe(null);let Ye=null,ct=[];function st(){const Et=Le(),qt=X.value;if(!Et||!qt)return null;const Xt=Et.ownerDocument||qt.ownerDocument||document;if(Et===Xt.documentElement||Et===Xt.body||Et===Xt.scrollingElement){const In=qt.getBoundingClientRect();return Math.max(0,-In.top)}return Math.max(0,Fe(Et,Xt,!1)-Ve(qt,Et))}function pt(Et){var qt;const Xt=Le(),In=X.value;if(!Xt||!In)return;const Ko=Math.max(0,Et),Ro=Xt.ownerDocument||In.ownerDocument||document,$i=Ro.defaultView||(typeof window<"u"?window:null);if(Xt===Ro.documentElement||Xt===Ro.body||Xt===Ro.scrollingElement){const Ji=Fe(Xt,Ro,!0)+In.getBoundingClientRect().top;return void((qt=$i?.scrollTo)==null||qt.call($i,0,Math.max(0,Ji+Ko)))}W4(Xt,Ro,Ve(In,Xt)+Ko,{isReverseFlexScrollRoot:Ji=>{var ed;return(ed=Oe?.(Ji))!=null&&ed},getNormalizedScrollTop:Fe})}function kt(Et){const qt=J.value,Xt=He(Et.nodeIndex,0,Math.max(0,qt-1));return je(0,Xt)+Math.max(0,Et.offsetWithinNodePx)}function Mt(){if(Ye!=null&&(we?.(Ye),Ye=null),H)for(const Et of ct)window.clearTimeout(Et);ct=[]}function Ct(Et){const qt=kt(Et),Xt=st();Xt!=null&&Math.abs(Xt-qt)<=.5||pt(qt)}return{activeRestoreAnchor:Xe,getRelativeScrollTopWithinContainer:st,setRelativeScrollTopWithinContainer:pt,resolveAnchorOffset:kt,clearRestoreReconcile:Mt,applyRestoreAnchor:Ct,scheduleRestoreReconcile:function(){Xe.value&&H&&Ye==null&&(Ye=ce?ce(()=>{Ye=null,Xe.value&&Ct(Xe.value)}):null,Ye==null&&Xe.value&&Ct(Xe.value))},captureRestoreAnchor:function(){const Et=st(),qt=J.value;if(Et==null||qt<=0)return null;const Xt=He(Pe(Et+1),0,qt-1),In=je(0,Xt),Ko=$e(Xt);return{nodeIndex:Xt,offsetWithinNodePx:He(Et-In,0,Math.max(0,Ko-1))}},restoreAnchor:function(Et){const qt=J.value;if(Xe.value={nodeIndex:He(Et.nodeIndex,0,Math.max(0,qt-1)),offsetWithinNodePx:Math.max(0,Et.offsetWithinNodePx)},Mt(),Ct(Xe.value),H)for(const Xt of[0,120,280,480])ct.push(window.setTimeout(()=>{Xe.value&&Ct(Xe.value)},Xt))},getAnchorDrift:function(Et){const qt=st();return qt==null?null:qt-kt(Et)}}})({isClient:P,containerRef:L,parsedNodeCount:nn,requestFrame:Te,cancelFrame:ge,resolveScrollContainer:()=>Iu.value||ke(),getNormalizedScrollTop:qe,getOffsetTopWithinRoot:be,isReverseFlexScrollRoot:Ne,estimateIndexForOffset:h0,estimateHeightRange:nc,getFallbackNodeHeight:f0,clamp:Vo}),{nodeHeights:sc,heightStats:hi,heightTreeSize:p0,heightSumTree:pN,heightKnownTree:mN,averageNodeHeight:Ub,resetHeightMeasurements:gN,pruneHeightMeasurements:vN,rebuildHeightTrees:nh,recordNodeHeight:yN,removeNodeHeights:kN,exportHeightCache:bN,importHeightCache:xN,fenwickRangeSum:wN}=(function(_={}){const H=zo({}),X=zo({total:0,count:0}),J=oe(0),ce=oe([]),we=oe([]);function Le(){for(const $e of Object.keys(H))delete H[Number($e)];X.total=0,X.count=0,J.value=0,ce.value=[],we.value=[]}function Fe($e,He,Xe){for(let Ye=He+1;Ye<$e.length;Ye+=Ye&-Ye)$e[Ye]+=Xe}function Ve($e,He){let Xe=0;for(let Ye=He+1;Ye>0;Ye-=Ye&-Ye)Xe+=$e[Ye];return Xe}function Oe($e){J.value=$e;const He=new Array($e+1).fill(0),Xe=new Array($e+1).fill(0);for(const[Ye,ct]of Object.entries(H)){const st=Number(Ye),pt=Number(ct);!Number.isFinite(st)||st<0||st>=$e||!Number.isFinite(pt)||pt<=0||(Fe(He,st,pt),Fe(Xe,st,1))}ce.value=He,we.value=Xe}function Pe($e){if(!Number.isInteger($e)||$e<0)return!1;const He=H[$e];if(!Number.isFinite(He)||He<=0)return!1;if(delete H[$e],X.total=Math.max(0,X.total-He),X.count=Math.max(0,X.count-1),J.value>$e){const Xe=ce.value,Ye=we.value;Xe.length&&Ye.length&&(Fe(Xe,$e,-He),Fe(Ye,$e,-1))}return!0}const je=D(()=>X.count>0?Math.max(12,X.total/X.count):32);return{nodeHeights:H,heightStats:X,heightTreeSize:J,heightSumTree:ce,heightKnownTree:we,averageNodeHeight:je,resetHeightMeasurements:Le,pruneHeightMeasurements:function($e){if($e<=0)return void Le();let He=0,Xe=0;for(const[Ye,ct]of Object.entries(H)){const st=Number(Ye),pt=Number(ct);!Number.isFinite(st)||st<0||st>=$e||!Number.isFinite(pt)||pt<=0?delete H[st]:(He+=pt,Xe++)}X.total=He,X.count=Xe},rebuildHeightTrees:Oe,recordNodeHeight:function($e,He,Xe={}){(function(Ye,ct,st={}){var pt;if(!Number.isFinite(ct)||ct<=0)return!1;const kt=H[Ye];if(kt&&(st.allowShrink===!1&&ct<kt||Math.abs(ct-kt)<=1))return!1;if(H[Ye]=ct,kt?X.total+=ct-kt:(X.total+=ct,X.count++),J.value>Ye){const Mt=ce.value,Ct=we.value;if(Mt.length&&Ct.length)if(kt){const Et=ct-kt;Et!==0&&Fe(Mt,Ye,Et)}else Fe(Mt,Ye,ct),Fe(Ct,Ye,1)}st.notify!==!1&&((pt=_.onHeightRecorded)==null||pt.call(_))})($e,He,Ot(it({},Xe),{notify:!0}))},removeNodeHeight:function($e,He={}){var Xe;const Ye=Pe($e);return Ye&&He.notify!==!1&&((Xe=_.onHeightRecorded)==null||Xe.call(_)),Ye},removeNodeHeights:function($e,He={}){var Xe;let Ye=0;for(const ct of $e)Pe(Number(ct))&&Ye++;return Ye>0&&He.notify!==!1&&((Xe=_.onHeightRecorded)==null||Xe.call(_)),Ye},exportHeightCache:function(){return Object.entries(H).map(([$e,He])=>({index:Number($e),height:Number(He)})).filter($e=>Number.isFinite($e.index)&&$e.index>=0&&Number.isFinite($e.height)&&$e.height>0).sort(($e,He)=>$e.index-He.index)},importHeightCache:function($e,He={}){var Xe;if(!Array.isArray($e))return;const Ye=J.value;let ct=!1;if(He.mode!=="merge"){const st=Object.keys(H);if(st.length>0){for(const pt of st)delete H[Number(pt)];ct=!0}}for(const st of $e){const pt=Number(st.index),kt=Number(st.height);if(!Number.isInteger(pt)||pt<0||Ye>0&&pt>=Ye||!Number.isFinite(kt)||kt<=0)continue;const Mt=H[pt];Mt&&Math.abs(Mt-kt)<=1||(H[pt]=kt,ct=!0)}ct&&((function(){let st=0,pt=0;const kt=J.value;for(const[Mt,Ct]of Object.entries(H)){const Et=Number(Mt),qt=Number(Ct);!Number.isFinite(Et)||Et<0||kt>0&&Et>=kt||!Number.isFinite(qt)||qt<=0?delete H[Et]:(st+=qt,pt++)}X.total=st,X.count=pt})(),Ye>0&&Oe(Ye),(Xe=_.onHeightRecorded)==null||Xe.call(_))},fenwickRangeSum:function($e,He,Xe){if(Xe<=He)return 0;const Ye=Ve($e,Xe-1);return He<=0?Ye:Ye-Ve($e,He-1)}}})({onHeightRecorded:()=>{fi(),tn.value&&Gu(),oc.value&&$u(),Ys.value&&hc(),Gn("node-resize")}});function qb(_){Number.isInteger(_)&&_>=0&&Gs.add(_)}function jb(_){for(const H of _)qb(Number(H))}function ic(_){eh++;let H=!0;try{const X=_();return H=X!==!1,X}finally{eh--,eh===0&&H&&Jf.value++}}function m0(){eo=[],ro=[],Ks=-1,Gs.clear(),Ii.value=Zt}function oh(){m0(),ic(()=>gN()),_t.clear()}function Vb(_){!Number.isInteger(_)||_<0||_>=Be.value.length||_t.set(_,Ru(_))}function Kb(_,H,X={}){const J=sc[_];qb(_),yN(_,H,X);const ce=sc[_];return Object.is(J,ce)?(Gs.delete(_),!1):(ce&&ce>0?Vb(_):J&&_t.delete(_),!0)}function Gb(_,H){const X=vt("getNodeLayoutHeight.slot.offsetHeight",()=>{var J,ce;return(ce=(J=cn.get(_))==null?void 0:J.offsetHeight)!=null?ce:0});return X>0?X:vt("getNodeLayoutHeight.content.offsetHeight",()=>H.offsetHeight)}function Yb(_,H={}){H.mode!=="merge"?m0():jb(_.map(X=>X.index)),ic(()=>xN(_,H)),U0()}const Zi=D(()=>Re.value&&di.value),_N=D(()=>{var _;return!G.value&&S.batchRendering!==!1&&Ut.value>0&&((_=S.maxLiveNodes)!=null?_:0)<=0}),SN=D(()=>!G.value&&ut&&lt.value===!0&&!zt.value&&!qo.value&&!As.value&&!Zi.value&&!_N.value),Zb=D(()=>!!le&&Zi.value),Xb=D(()=>zt.value||tn.value),{focusIndex:yr,liveRange:jo,updateLiveRange:Fu}=(function(_,H){const{parsedNodeCount:X,virtualizationEnabled:J,maxLiveNodesResolved:ce,liveNodeBufferResolved:we,clamp:Le}=H,Fe=we??D(()=>{var Pe;return Math.max(0,(Pe=_.liveNodeBuffer)!=null?Pe:60)}),Ve=oe(0),Oe=zo({start:0,end:0});return{liveNodeBufferResolved:Fe,focusIndex:Ve,liveRange:Oe,updateLiveRange:function(){const Pe=X.value;if(!J.value||Pe===0)return Oe.start=0,void(Oe.end=Pe);const je=Math.min(ce.value,Pe),$e=Fe.value,He=Le(Ve.value-$e,0,Math.max(0,Pe-je));Oe.start=He,Oe.end=Math.min(Pe,He+je)}}})(S,{parsedNodeCount:nn,virtualizationEnabled:zt,maxLiveNodesResolved:ts,liveNodeBufferResolved:ns,clamp:Vo}),Xi=new Map,Jl=new Map,tl=new Map,sh=[],kr=new Map,nl=new Set,Qb=oe(0);let g0=!1;const Jb=D(()=>(Qb.value,nl.size)),Zs=new Map,Qi=new Map,ex=oe(0),v0=D(()=>{ex.value;let _=0;for(const H of Zs.values())_+=Math.max(0,H);return _});let Xs=null;const ih=D(()=>{if(!zt.value)return Be.value.length;const _=ns.value,H=Math.max(jo.end+_,wn.value),X=Math.min(Be.value.length,H);return Math.max(te.value,X)});function rh(){g0||(g0=!0,queueMicrotask(()=>{g0=!1,Qb.value+=1}))}function tx(_,H,X="node-resize"){if(!P||typeof window>"u")return null;const J=window.setTimeout(()=>{nl.delete(J)&&rh();try{H()}finally{Gn(X)}},Math.max(0,_));return nl.add(J),rh(),J}function lh(_){P&&_!=null&&(nl.delete(_)&&rh(),window.clearTimeout(_))}function nx(){if(P&&typeof window<"u")for(const _ of nl)window.clearTimeout(_);nl.size&&(nl.clear(),rh()),sh.length=0,tl.clear()}function CN(_){O.value=_}function AN(_){U.value=_}function MN(_){Z.value=_}const{cancelScheduledFocusSync:y0,scheduleFocusSync:Li}=(function(_){const{isClient:H,containerRef:X,virtualizationEnabled:J,requestFrame:ce,cancelFrame:we,syncFocusToScroll:Le}=_;let Fe=null;function Ve(){var Pe,je,$e;return($e=(je=(Pe=X.value)==null?void 0:Pe.ownerDocument)==null?void 0:je.defaultView)!=null?$e:typeof window<"u"?window:null}function Oe(){if(!Fe)return;const Pe=Ve();Fe.viaTimeout?Pe?Pe.clearTimeout(Fe.id):clearTimeout(Fe.id):we?.(Fe.id),Fe=null}return{cancelScheduledFocusSync:Oe,scheduleFocusSync:function(Pe={}){if(!J.value)return;if(!H)return void Le(!0);if(Pe.immediate)return Oe(),void Le(!0);if(Fe)return;const je=()=>{Fe=null,Le()};if(ce)return void(Fe={id:ce(je),viaTimeout:!1});const $e=Ve();Fe={id:$e?$e.setTimeout(je,16):setTimeout(je,16),viaTimeout:!0}}}})({isClient:P,containerRef:L,virtualizationEnabled:zt,requestFrame:Te,cancelFrame:ge,syncFocusToScroll:function(_=!1){var H;if(!zt.value)return;const X=Iu.value||ke();if(!X)return;const J=X.ownerDocument||((H=L.value)==null?void 0:H.ownerDocument)||document,ce=J?.defaultView||(typeof window<"u"?window:null),we=X===J?.documentElement||X===J?.body,Le=Be.value.length;if(Le<=0)return;if(!we&&Le>0&&Ne(X)){const Ye=vt("syncFocusToScroll.clientHeight",()=>X.clientHeight||0),ct=vt("syncFocusToScroll.scrollTop",()=>X.scrollTop),st=ct<0?-ct:ct;return void uh(Vo((Fe=Math.max(0,st)+.5*Math.max(0,Ye),el.estimateIndexForOffsetFromEnd(Fe)),0,Math.max(0,Le-1)),_)}var Fe;const Ve=(function(Ye,ct,st,pt){const kt=L.value;if(!kt)return null;const Mt=pt?0:vt("syncFocusToScroll.model.root.getBoundingClientRect",()=>Ye.getBoundingClientRect().top),Ct=vt("syncFocusToScroll.model.container.getBoundingClientRect",()=>kt.getBoundingClientRect().top),Et=Math.max(0,Mt-Ct),qt=pt?vt("syncFocusToScroll.model.viewport.clientHeight",()=>{var Xt,In,Ko,Ro;return(Ro=(Ko=(In=st?.innerHeight)!=null?In:(Xt=ct.documentElement)==null?void 0:Xt.clientHeight)!=null?Ko:Ye.clientHeight)!=null?Ro:0}):vt("syncFocusToScroll.model.root.clientHeight",()=>Ye.clientHeight);return Vo(h0(Et+.5*Math.max(0,qt)),0,Math.max(0,Be.value.length-1))})(X,J,ce,we);if(Ve!=null)return void uh(Ve,_);const Oe=we?null:vt("syncFocusToScroll.root.getBoundingClientRect",()=>X.getBoundingClientRect()),Pe=we?0:Oe.top,je=we?vt("syncFocusToScroll.viewport.clientHeight",()=>{var Ye,ct;return(ct=(Ye=ce?.innerHeight)!=null?Ye:X.clientHeight)!=null?ct:0}):Oe.bottom,$e=cN.value;let He=null,Xe=null;for(const[Ye,ct]of $e){if(!ct)continue;const st=vt("syncFocusToScroll.slot.getBoundingClientRect",()=>ct.getBoundingClientRect());st.bottom<=Pe||st.top>=je||(He==null&&(He=Ye),Xe=Ye)}if(He==null||Xe==null){const Ye=L.value;if(!Ye)return;const ct=we?{top:0}:vt("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>X.getBoundingClientRect()),st=vt("syncFocusToScroll.fallback.scrollTop",()=>qe(X,J,we)),pt=we?(()=>{const Mt=vt("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>Ye.getBoundingClientRect()),Ct=(we?0:ct.top)-Mt.top;return Math.max(0,Ct)})():(()=>{const Mt=be(Ye,X);return Math.max(0,st-Mt)})(),kt=we?vt("syncFocusToScroll.fallback.viewport.clientHeight",()=>{var Mt,Ct,Et,qt;return(qt=(Et=(Ct=ce?.innerHeight)!=null?Ct:(Mt=J?.documentElement)==null?void 0:Mt.clientHeight)!=null?Et:X.clientHeight)!=null?qt:0}):vt("syncFocusToScroll.fallback.root.clientHeight",()=>X.clientHeight);return void uh(Vo(h0(pt+.5*Math.max(0,kt)),0,Math.max(0,Be.value.length-1)),!0)}uh(Math.round((He+Xe)/2),_)}}),{visibleNodeIndices:k0,nodeVisibilityHandles:rc,nodeVisibilityWatchStops:ah,nodeVisibilityFallbackTimers:ox,clearVisibilityFallback:ch,markNodeVisible:ol,cleanupNodeVisibility:EN,destroyNodeVisibilityState:b0}=xse({isClient:P,shouldTrackVisibleNodeIndices:()=>Zi.value,shouldCleanupNodeVisibility:()=>zt.value,onNodeMarkedVisible:_=>{zt.value?Li():yr.value=Vo(_,0,Math.max(0,Be.value.length-1))},onNodeVisibilityCleaned:_=>{cn.delete(_)&&Ix()}}),{cleanupScrollListener:sx,setupScrollListener:TN}=(function(_){const{isClient:H,virtualizationEnabled:X,listenerEnabled:J,scrollRootElement:ce,resolveScrollContainer:we,scheduleFocusSync:Le,onScroll:Fe}=_;let Ve=null,Oe=null;function Pe(){Ve&&(Ve(),Ve=null),Oe=null,ce.value=null}function je($e){const He=_.getScrollTop?_.getScrollTop($e):$e.scrollTop;return Math.max(0,Number.isFinite(He)?Math.abs(He):0)}return{cleanupScrollListener:Pe,setupScrollListener:function(){if(!H)return;if(!(($e=J?.value)!=null?$e:X.value))return void Pe();var $e;const He=we();if(!He)return void Pe();if(ce.value===He&&Ve)return;Pe(),Oe=je(He);const Xe=()=>{if(Fe?.(),X.value){const Ye=(function(ct){const st=je(ct),pt=Oe;Oe=st;const kt=Math.max(480,.75*(ct.clientHeight||0));return pt==null?st>kt?{immediate:!0}:void 0:Math.abs(st-pt)>kt?{immediate:!0}:void 0})(He);Ye?Le(Ye):Le()}};He.addEventListener("scroll",Xe,{passive:!0}),ce.value=He,Ve=()=>{He.removeEventListener("scroll",Xe)}}}})({isClient:P,virtualizationEnabled:zt,listenerEnabled:Xb,scrollRootElement:Iu,resolveScrollContainer:ke,scheduleFocusSync:Li,onScroll:function(){const _=Ys.value;if(!_)return;const H=Bu();if(!H||(function(J){if(zu()>=d0)return Lu=null,!1;const ce=Lu;if(ce==null)return!0;const we=Math.abs(J.scrollTop-ce)<=2;return we||(Lu=null),we})(H))return;const X=kx(H);X!=null?(X<-32||Math.abs(Math.max(0,X)-Math.max(0,_.distanceFromBottomPx))>32)&&fc("restore"):fc("restore")},getScrollTop:_=>{var H;const X=_.ownerDocument||((H=L.value)==null?void 0:H.ownerDocument)||document,J=_===X.documentElement||_===X.body||_===X.scrollingElement;return vt("scrollListener.getScrollTop",()=>qe(_,X,J))}});function uh(_,H=!1){const X=Vo(_,0,Math.max(0,Be.value.length-1));!H&&Math.abs(X-yr.value)<=1||(yr.value=X,Fu())}function Vo(_,H,X){return Math.min(Math.max(_,H),X)}function x0(_=Be.value.length){const H=Bt();return!Number.isInteger(H)||H<0?_:Vo(H,0,_)}function w0(_){return _?.firstElementChild}function ix(_,H){var X;return _?(X=_.matches)!=null&&X.call(_,H)?_:_.querySelector(H):null}function NN(_,H){_<1||_>6||(ie[_]=H)}function rx(){if(!io.value)return void(ne.value=0);const _=vt("updateExperimentContainerWidth.clientWidth",()=>{var H,X;return(X=(H=L.value)==null?void 0:H.clientWidth)!=null?X:0});ne.value=_>0?_:0}let Ou=null;function _0(){Ou?.disconnect(),Ou=null}const lx=Md("ViewportDeferredMarkdownCodeBlockNode",Hi({loader:()=>Zn(null,null,function*(){return(yield vs(()=>import("./index5-C24lR9df.js"),__vite__mapDeps([6,4,5]))).default}),loadingComponent:Hm,delay:0,suspensible:!1}),Hm);function ax(_){return _===lx}const cx=D(()=>p.value==="pre"?Fs:p.value==="shiki"?lx:av);function ux(){var _;return((_=S.codeBlockProps)==null?void 0:_.showHeader)!==!1}function dx(_,H,X){const J=sc[H],ce=typeof J=="number"&&J>0;if(ci.value&&!ce&&!(function(we){return!!sn.value.paragraph&&(we.type==="paragraph"||we.type==="list_item"||we.type==="list")})(_)){const we=AE(_,X,j.value);if(we)return we}if(Qt.value&&_.type==="code_block"){const we=(function(Le){if(Le.type!=="code_block")return null;const Fe=Ux(Le,bh(Le));return ax(Fe)?"markdown":Fe===Fs?"pre":Fe===cx.value||Fe===av?"monaco":null})(_);if(we==="monaco"||we==="markdown"||we==="pre")return(function(Le,Fe){var Ve,Oe,Pe;if(!Le||Le.type!=="code_block")return null;const je=Fe.rendererKind,$e=je!=="pre"&&Fe.showHeader!==!1,He=!!Le.diff;let Xe=0,Ye=500;if(je==="monaco"){const st=(Ve=Fe.monacoOptions)!=null?Ve:{},pt=vv(Le,st,Fe.width),kt=(function(Ct){const Et=typeof Ct?.fontSize=="number"&&Ct.fontSize>0?Ct.fontSize:12;return typeof Ct?.lineHeight=="number"&&Ct.lineHeight>0?Ct.lineHeight:Math.round(1.5*Et)})(st),Mt=(function(Ct,Et){var qt,Xt;const In=typeof((qt=Ct?.padding)==null?void 0:qt.top)=="number"?Ct.padding.top:Et?0:8,Ko=typeof((Xt=Ct?.padding)==null?void 0:Xt.bottom)=="number"?Ct.padding.bottom:Et?0:8;return Math.max(0,In)+Math.max(0,Ko)})(st,He);Ye=typeof st.MAX_HEIGHT=="number"&&st.MAX_HEIGHT>0?st.MAX_HEIGHT:500,Xe=Math.round(pt*kt+Mt)}else if(je==="markdown"){const st=vv(Le);Xe=Math.round(21*st+32)}else{const st=vv(Le);Xe=Math.round(28*st),Ye=Number.POSITIVE_INFINITY}const ct=Math.max(1,Math.min(Xe,Ye));return it({kind:"code-block",height:Math.round(ct+($e?40:0)),contentHeight:ct,rendererKind:je},He&&je==="monaco"?{diffInline:q2((Oe=Fe.monacoOptions)!=null?Oe:{},(Pe=Fe.width)!=null?Pe:0)}:{})})(_,{rendererKind:we,monacoOptions:S.codeBlockMonacoOptions,showHeader:ux(),width:X})}return null}DA(()=>{if(Jf.value,eh>0)return;const _=Be.value,H=Yt();if(!_.length||!It.value)return eo=[],ro=[],Ks=-1,Gs.clear(),void(Ii.value=Zt);const X=ne.value||vt("estimatedNodeHeights.clientWidth",()=>{var Oe;return((Oe=L.value)==null?void 0:Oe.clientWidth)||0});if(!Number.isFinite(X)||X<=0)return eo=[],ro=[],Ks=-1,Gs.clear(),void(Ii.value=Zt);const J=(function(Oe){return[Math.round(Oe),ci.value,Qt.value,j.value,S.codeBlockMonacoOptions,ux(),p.value,sn.value,pv.value]})(X),ce=eo.length<=_.length&&(Le=J,(we=ro).length===Le.length&&we.every((Oe,Pe)=>Object.is(Oe,Le[Pe])));var we,Le;const Fe=ce&&Ks===H?_.length:ce?x0(_.length):0,Ve=ce?Array.from(Gs):[];eo.length=_.length;for(let Oe=Fe;Oe<_.length;Oe++)eo[Oe]=dx(_[Oe],Oe,X);for(const Oe of Ve)Oe>=0&&Oe<_.length&&Oe<Fe&&(eo[Oe]=dx(_[Oe],Oe,X));Gs.clear(),ro=J,Ks=H,Ii.value=eo,X9(Ii)},{flush:"sync"});const lc=D(()=>Ii.value);el=(function(_){let H=!0,X=[0],J="";function ce(Pe){var je;const $e=_.nodeHeights[Pe];if(Number.isFinite($e)&&$e>0)return $e;const He=_.parsedNodes.value[Pe],Xe=He?.type,Ye=!!((je=_.hasCustomParagraphComponent)!=null&&je.call(_)),ct=_.estimatedNodeHeights.value[Pe],st=ct?.height;if(!(function(kt,Mt,Ct){return!!(Ct&&Mt?.kind==="simple-text"&&(kt==="paragraph"||kt==="list_item"||kt==="list"))})(Xe,ct,Ye)&&Number.isFinite(st)&&st>0)return st;const pt=cse(He,_.getContainerWidth()||640);return Xe==="heading"||Xe==="paragraph"&&pt<=28&&(function(kt,Mt){if(Mt)return!1;const Ct=kt.children;return!Array.isArray(Ct)||!Ct.length||Ct.every(EE)})(He,Ye)?pt:Math.max(_.averageNodeHeight.value,pt)}function we(){var Pe;const je=_.parsedNodes.value.length,$e=_.getPrefixCacheKeyParts().join(":");if(!H&&J===$e)return X;const He=new Array(je+1);He[0]=0;for(let Xe=0;Xe<je;Xe++)He[Xe+1]=He[Xe]+(_.heightEstimationActive.value?ce(Xe):(Pe=_.nodeHeights[Xe])!=null?Pe:_.averageNodeHeight.value);return X=He,J=$e,H=!1,He}function Le(Pe){var je,$e;const He=_.parsedNodes.value.length;if(He<=0||Pe<=0)return 0;const Xe=we();if(Pe>=((je=Xe[He])!=null?je:0))return He-1;let Ye=0,ct=He-1,st=He-1;for(;Ye<=ct;){const pt=Ye+ct>>1;(($e=Xe[pt+1])!=null?$e:0)>=Pe?(st=pt,ct=pt-1):Ye=pt+1}return st}function Fe(Pe,je){var $e,He;if(Pe>=je)return 0;if(_.heightEstimationActive.value)return(function(ct,st){var pt,kt;const Mt=_.parsedNodes.value.length,Ct=q4(Math.trunc(ct),0,Mt),Et=q4(Math.trunc(st),Ct,Mt);if(Ct>=Et)return 0;const qt=we();return((pt=qt[Et])!=null?pt:0)-((kt=qt[Ct])!=null?kt:0)})(Pe,je);if(_.heightTreeSize.value!==_.parsedNodes.value.length){let ct=0;for(let st=Pe;st<je;st++)ct+=($e=_.nodeHeights[st])!=null?$e:_.averageNodeHeight.value;return ct}const Xe=_.heightSumTree.value,Ye=_.heightKnownTree.value;if(!Xe.length||!Ye.length){let ct=0;for(let st=Pe;st<je;st++)ct+=(He=_.nodeHeights[st])!=null?He:_.averageNodeHeight.value;return ct}return _.fenwickRangeSum(Xe,Pe,je)+(je-Pe-_.fenwickRangeSum(Ye,Pe,je))*_.averageNodeHeight.value}function Ve(Pe){var je;if(Pe<=0)return 0;const $e=_.parsedNodes.value;if(_.heightEstimationActive.value)return Le(Pe);if(_.heightTreeSize.value===$e.length&&_.heightSumTree.value.length&&_.heightKnownTree.value.length){const Xe=_.averageNodeHeight.value,Ye=_.heightSumTree.value,ct=_.heightKnownTree.value,st=Ct=>Ct<=0?0:_.fenwickRangeSum(Ye,0,Ct)+(Ct-_.fenwickRangeSum(ct,0,Ct))*Xe;let pt=0,kt=$e.length-1,Mt=$e.length-1;for(;pt<=kt;){const Ct=pt+kt>>1;st(Ct+1)>=Pe?(Mt=Ct,kt=Ct-1):pt=Ct+1}return Mt}let He=Pe;for(let Xe=0;Xe<$e.length;Xe++){const Ye=(je=_.nodeHeights[Xe])!=null?je:_.averageNodeHeight.value;if(He<=Ye)return Xe;He-=Ye}return Math.max(0,$e.length-1)}function Oe(){if(!_.heightEstimationActive.value)return 0;let Pe=0;const je=_.estimatedNodeHeights.value;for(let $e=0;$e<je.length;$e++){if(!je[$e])continue;const He=_.nodeHeights[$e];Number.isFinite(He)&&He>0||Pe++}return Pe}return{markFallbackHeightPrefixDirty:function(){H=!0},getFallbackNodeHeight:ce,estimateHeightRange:Fe,estimateIndexForOffset:Ve,estimateIndexForOffsetFromEnd:function(Pe){var je,$e;const He=_.parsedNodes.value;if(!He.length)return 0;if(Pe<=0)return Math.max(0,He.length-1);if(_.heightEstimationActive.value){const Ye=(je=we()[He.length])!=null?je:0;return Le(Math.max(0,Ye-Pe))}if(_.heightTreeSize.value===He.length){const Ye=Fe(0,He.length);return Ve(Math.max(0,Ye-Pe))}let Xe=Pe;for(let Ye=He.length-1;Ye>=0;Ye--){const ct=($e=_.nodeHeights[Ye])!=null?$e:_.averageNodeHeight.value;if(Xe<=ct)return Ye;Xe-=ct}return 0},getEstimatedNodeHeightCount:Oe,buildVirtualHeightSummary:function(Pe){var je;const $e=_.parsedNodes.value.length;return{totalNodes:$e,measuredCount:_.heightStats.count,estimatedCount:Oe(),averageNodeHeight:_.averageNodeHeight.value,topSpacerHeight:Pe.topSpacerHeight,bottomSpacerHeight:Pe.bottomSpacerHeight,estimatedTotalHeight:Fe(0,$e),width:(je=Pe.width)!=null?je:_.getContainerWidth()}}}})({parsedNodes:Be,nodeHeights:sc,heightStats:hi,heightTreeSize:p0,heightSumTree:pN,heightKnownTree:mN,averageNodeHeight:Ub,heightEstimationActive:io,estimatedNodeHeights:lc,getContainerWidth:Ni,hasCustomParagraphComponent:()=>!!sn.value.paragraph,getPrefixCacheKeyParts:()=>{var _;const H=pd(ne.value||vt("getFallbackHeightPrefix.clientWidth",()=>{var J;return((J=L.value)==null?void 0:J.clientWidth)||0})),X=((_=o.virtualScroll)==null?void 0:_.measurementKey)==null?"":String(o.virtualScroll.measurementKey);return[Be.value.length,hi.count,Math.round(hi.total),Math.round(100*Ub.value),X,H,io.value?1:0,pv.value,fe.value,sn.value.paragraph?1:0]},fenwickRangeSum:wN}),et(()=>Be.value.length,_=>{var H;fi(),_<=0?oh():(_<p0.value&&(H=_,m0(),ic(()=>vN(H))),_!==p0.value&&nh(_))},{immediate:!0});const IN=D(()=>{if(!zt.value)return Be.value.map((J,ce)=>({node:J,index:ce}));const _=Be.value.length,H=Vo(jo.start,0,_),X=Vo(jo.end,H,_);return Be.value.slice(H,X).map((J,ce)=>({node:J,index:H+ce}))}),S0=D(()=>zt.value?nc(0,Math.min(jo.start,Be.value.length)):0),C0=D(()=>{if(!zt.value)return 0;const _=Be.value.length;return nc(Math.min(jo.end,_),_)});function fx(){return el.buildVirtualHeightSummary({topSpacerHeight:S0.value,bottomSpacerHeight:C0.value,width:ea()})}function LN(){const _=Be.value,H=fx();return Ot(it({},H),{probe:{paragraphReady:!!j.value.paragraph,listItemReady:!!j.value.listItem,listWrapperOverhead:j.value.listWrapperOverhead,headingReadyLevels:Object.entries(j.value.headings).filter(([,X])=>!!X).map(([X])=>Number(X))},nodes:_.map((X,J)=>{var ce,we,Le,Fe,Ve,Oe,Pe,je,$e;return{index:J,type:X.type,estimateKind:(we=(ce=lc.value[J])==null?void 0:ce.kind)!=null?we:null,rendererKind:(Fe=(Le=lc.value[J])==null?void 0:Le.rendererKind)!=null?Fe:null,estimatedHeight:(Oe=(Ve=lc.value[J])==null?void 0:Ve.height)!=null?Oe:null,estimatedContentHeight:(je=(Pe=lc.value[J])==null?void 0:Pe.contentHeight)!=null?je:null,measuredHeight:($e=sc[J])!=null?$e:null}})})}function A0(){return o.indexKey!=null?String(o.indexKey):qo.value?`virtual-${no()}`:"markdown-renderer"}function hx(_){const H=String(_),X=`${A0()}-`;if(!H.startsWith(X))return null;const J=H.slice(X.length).match(/^(\d+)(?:$|-)/);if(!J)return null;const ce=Number(J[1]);return!Number.isInteger(ce)||ce<0||ce>=Be.value.length?null:ce}function no(){var _,H,X;const J=(_=o.virtualScroll)==null?void 0:_.sessionKey;return String(J!=null&&J!==""?J:(X=(H=o.indexKey)!=null?H:S.customId)!=null?X:Wn)}function bo(){var _;const H=(_=o.virtualScroll)==null?void 0:_.threadKey;return H==null||H===""?void 0:String(H)}const $N=D(()=>{var _,H,X;return(X=bo())!=null?X:String((H=(_=o.indexKey)!=null?_:S.customId)!=null?H:Wn)});function M0(_){var H;return(_??"")===((H=bo())!=null?H:"")}function br(){var _,H,X;return H=(_=o.virtualScroll)==null?void 0:_.measurementKey,X=(function(){const J=p.value;return(function(ce){var we,Le;const Fe=ce.renderer,Ve=Fe==="monaco"?ce.codeBlockMonacoOptions:void 0,Oe=ce.codeBlockProps,Pe=Fe==="shiki";return[ce.isDark?"dark":"light",Fe==="monaco"?"code-rich":Fe==="pre"?"code-pre":"code-shiki",ce.codeBlockStream===!1?"code-static":"code-stream",Do(ce.codeBlockMinWidth),Do(ce.codeBlockMaxWidth),...Pe?[Qee((we=Oe?.themes)!=null?we:ce.themes,(Le=Oe?.langs)!=null?Le:ce.langs)]:[],Do(Ve?.fontSize),Do(Ve?.lineHeight),Do(Ve?.fontFamily),Do(Ve?.tabSize),Do(Ve?.MAX_HEIGHT),Do(Ve?.wordWrap),Do(Ve?.wrappingIndent),Do(Ve?.padding),Do(Oe?.showHeader),Do(Oe?.showCopyButton),Do(Oe?.showExpandButton),Do(Oe?.showPreviewButton),Do(Oe?.showCollapseButton),Do(Oe?.showFontSizeButtons)].join("\0")})({renderer:J,isDark:S.isDark,codeBlockStream:S.codeBlockStream,codeBlockMinWidth:S.codeBlockMinWidth,codeBlockMaxWidth:S.codeBlockMaxWidth,codeBlockMonacoOptions:J==="monaco"?S.codeBlockMonacoOptions:void 0,codeBlockProps:S.codeBlockProps,themes:J==="shiki"?S.themes:void 0,langs:J==="shiki"?S.langs:void 0})})(),[H==null?"":String(H),X].join("\0")}function ea(){return Ni()}const dh=D(()=>pd(ea())),Qs=D(()=>[br(),dh.value].join("\0")),FN=D(()=>{var _;return qo.value?["virtual",(_=bo())!=null?_:"",no(),Qs.value].join("\0"):o.indexKey});function ac(){ex.value+=1}function E0(_){return!(!_||!Number.isInteger(_.index)||_.index<0||_.index>=Be.value.length||_.sessionKey!==no()||_.threadKey!==bo()||_.layoutEpochKey!==Qs.value)}function px(_){const H=String(_),X=Qi.get(H);return X?E0(X)?X.index:null:hx(H)}function mx(_="async-node"){(Zs.size||Qi.size)&&(Zs.clear(),Qi.clear(),ac(),Gn(_))}const cc=Jt(Hy,null),T0={reportHeight(_,H){if(!tn.value)return;const X=px(_);if(X==null)return;const J=Xi.get(X);if(!J)return;const ce=Number(H),we=Gb(X,J);(function(Le,Fe,Ve={}){ic(()=>Kb(Le,Fe,Ve))})(X,Number.isFinite(ce)&&ce>0?Math.max(ce,we||0):we)},markPending(_){if(!tn.value)return;const H=hx(_);H!=null&&(function(X,J){var ce;const we=Qi.get(X);if(we&&E0(we))return Zs.set(X,Math.max(0,(ce=Zs.get(X))!=null?ce:0)+1),ac(),void Gn("async-node");Zs.set(X,1),Qi.set(X,(function(Le){return{index:Le,sessionKey:no(),threadKey:bo(),layoutEpochKey:Qs.value}})(J)),ac(),Gn("async-node")})(String(_),H)},markSettled(_){if(!tn.value)return;const H=String(_),X=px(_);(X!=null||(function(J){return Zs.has(String(J))})(H))&&(function(J){var ce;const we=(ce=Zs.get(J))!=null?ce:0;return!(we<=0||(we<=1?(Zs.delete(J),Qi.delete(J)):Zs.set(J,we-1),ac(),we===1&&Gn("async-node"),0))})(H)&&X!=null&&xr()}};function ON(){let _=0;for(const H of Xi.values())_+=vt("getVisibleDomHeight.offsetHeight",()=>{var X;return(X=H?.offsetHeight)!=null?X:0});return Math.ceil(Math.max(0,_))}Ln(Hy,{reportHeight(_,H){T0.reportHeight(_,H),cc?.reportHeight(_,H)},markPending(_){T0.markPending(_),cc?.markPending(_)},markSettled(_){T0.markSettled(_),cc?.markSettled(_)}});let N0,I0=null,uc=null;function fh(_){return _!==!1&&_!=null&&_!==""}function gx(){return zt.value?(function(){if(!zt.value)return!0;const _=Be.value.length,H=Vo(jo.start,0,_),X=Vo(jo.end,H,_);if(H>=X)return!0;for(let J=H;J<X;J++)if(!cn.has(J)||gh(J)&&!Xi.has(J))return!1;return!0})():te.value>=ih.value}function L0(){return lt.value===!0&&!mt.value&&v0.value===0&&nl.size===0&&kr.size===0&&Xs==null&&gx()}function vx(){var _,H;if(((_=o.virtualScroll)==null?void 0:_.settleMode)!=="manual"||I0===no()&&N0===bo())return!0;const X=(H=o.virtualScroll)==null?void 0:H.settledToken;return!!fh(X)&&uc===Yu(X)}function $0(){return L0()&&vx()}function BN(_,H){return H.totalNodes<=0?_==="final"?"final":"estimate":H.measuredCount>=H.totalNodes?_==="final"?"final":"measured":H.measuredCount>0||H.estimatedCount>0?"mixed":"estimate"}function ta(_="manual",H){const X=fx(),J=(function(ce){return ce||(lt.value!==!0?Be.value.length>0?"streaming":"estimating":!gx()||kr.size>0||Xs!=null?"measuring":$0()?"settled":"settling")})(H);return{sessionKey:no(),threadKey:bo(),phase:J,nodeCount:X.totalNodes,liveRange:{start:jo.start,end:jo.end},renderedCount:te.value,measuredCount:X.measuredCount,estimatedCount:X.estimatedCount,averageNodeHeight:X.averageNodeHeight,topSpacerHeight:X.topSpacerHeight,bottomSpacerHeight:X.bottomSpacerHeight,visibleDomHeight:ON(),totalHeight:yx(),width:X.width,final:lt.value===!0,stable:$0(),confidence:BN(J,X),reason:_}}function Bu(){const _=Iu.value||ke(),H=L.value;if(!_||!H)return null;const X=_.ownerDocument||H.ownerDocument||document,J=_===X.documentElement||_===X.body||_===X.scrollingElement,ce=vt("getScrollBox.scrollTop",()=>qe(_,X,J)),we=vt("getScrollBox.scrollHeight",()=>{var Fe,Ve,Oe,Pe,je;return J?Math.max((Ve=(Fe=X.documentElement)==null?void 0:Fe.scrollHeight)!=null?Ve:0,(Pe=(Oe=X.body)==null?void 0:Oe.scrollHeight)!=null?Pe:0,(je=_.scrollHeight)!=null?je:0):_.scrollHeight}),Le=vt("getScrollBox.clientHeight",()=>{var Fe;return J?((Fe=X.documentElement)==null?void 0:Fe.clientHeight)||_.clientHeight||0:_.clientHeight});return{root:_,doc:X,isViewportRoot:J,scrollTop:ce,scrollHeight:we,clientHeight:Le}}function yx(){const _=Be.value.length,H=Math.max(0,nc(0,_)),X=vt("getRendererLogicalHeight.offsetHeight",()=>{var ce,we;return(we=(ce=L.value)==null?void 0:ce.offsetHeight)!=null?we:0}),J=Math.max(0,X>0?X:vt("getRendererLogicalHeight.scrollHeight",()=>{var ce,we;return(we=(ce=L.value)==null?void 0:ce.scrollHeight)!=null?we:0}));return _<=0?Math.ceil(X):zt.value?H>0?Math.max(1,Math.ceil(H),(function(){let ce=S0.value+C0.value;for(const we of cn.values())we&&(ce+=Math.max(0,vt("getVirtualizedDomLogicalHeight.offsetHeight",()=>we.offsetHeight||0)));return Math.ceil(Math.max(0,ce))})(),(function(ce,we){return ce<=0||we<=0?0:we<=ce+Math.max(512,.05*ce)?Math.ceil(we):0})(H,J)):Math.max(1,Math.ceil(J)):tn.value?H>0||hi.count>0||el.getEstimatedNodeHeightCount()>0?(us.value&&te.value,Math.max(1,Math.ceil(J),Math.ceil(H))):Math.ceil(J):Math.max(1,Math.ceil(J),Math.ceil(H))}function kx(_){const H=L.value;if(!H)return null;const X=vt("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>H.getBoundingClientRect());return(function(ce){return ce.isViewportRoot?ce.clientHeight:vt("getViewportBottomInRoot.getBoundingClientRect",()=>ce.root.getBoundingClientRect().bottom)})(_)-X.bottom}function RN(_={}){const H=_.requireViewport!==!1,X=(function(we=64){const Le=Bu(),Fe=L.value;if(!Le||!Fe)return!1;const Ve=(function(Pe){if(Pe.isViewportRoot)return{top:0,bottom:Pe.clientHeight};const je=vt("getVirtualViewportRect.getBoundingClientRect",()=>Pe.root.getBoundingClientRect());return{top:je.top,bottom:je.bottom}})(Le),Oe=vt("isRendererNearVirtualViewport.getBoundingClientRect",()=>Fe.getBoundingClientRect());return Oe.bottom>=Ve.top-we&&Oe.top<=Ve.bottom+we})();if(H&&!X)return null;const J=(function(){const we=Bu(),Le=L.value;if(!we||!Le||Math.max(0,we.scrollHeight-we.scrollTop-we.clientHeight)>64)return null;const Fe=kx(we);return Fe==null?null:Fe>=-8&&Fe<=160?{type:"bottom",distanceFromBottomPx:Math.max(0,Fe)}:null})();if(J)return{anchor:J,captured:!0};const ce=Wb();if(ce)return{anchor:{type:"node",nodeIndex:ce.nodeIndex,offsetWithinNodePx:ce.offsetWithinNodePx},captured:X};if(_.allowFallback===!0){const we=(function(){const Le=Be.value.length;return Le<=0?null:{type:"node",nodeIndex:Vo(yr.value,0,Math.max(0,Le-1)),offsetWithinNodePx:0}})();return we?{anchor:we,captured:!1}:null}return null}function F0(_){let H=2166136261;for(let X=0;X<_.length;X++)H^=_.charCodeAt(X),H=Math.imul(H,16777619);return(H>>>0).toString(36)}function DN(_,H){let X=_;for(let J=0;J<H.length;J++)X^=H.charCodeAt(J),X=Math.imul(X,16777619);return X^=31,X=Math.imul(X,16777619),X}const PN=new Set(["children","items","header","rows","cells","attrs","data","term","definition"]);function hh(_,H=new WeakSet,X=0){if(_==null||typeof _=="number"||typeof _=="boolean")return String(_);if(typeof _=="string")return`s:${(function(J){const ce=J.length>8192?`${J.slice(0,8192)}...${J.length}`:J;return`${J.length}:${F0(ce)}`})(_)}`;if(typeof _=="function")return"fn";if(typeof _!="object")return typeof _;if(H.has(_))return"cycle";if(X>=6)return"max-depth";H.add(_);try{if(Array.isArray(_)){if(_.length<=160){const Oe=[];for(let Pe=0;Pe<_.length;Pe++)Oe.push(hh(_[Pe],H,X+1));return`a:${_.length}:${Oe.join(",")}`}const we=[],Le=[],Fe=Math.max(0,_.length-32);let Ve=2166136261;for(let Oe=0;Oe<_.length;Oe++){const Pe=hh(_[Oe],H,X+1);Ve=DN(Ve,Pe),Oe<32&&we.push(Pe),Oe>=Fe&&Le.push(Pe)}return[`a:${_.length}`,`h=${we.join(",")}`,`t=${Le.join(",")}`,`all=${(Ve>>>0).toString(36)}`].join(":")}const J=_,ce=Object.keys(J).filter(we=>{const Le=J[we];return we!=="parent"&&we!=="el"&&we!=="component"&&(Le==null||typeof Le=="string"||typeof Le=="number"||typeof Le=="boolean"||PN.has(we))}).sort();return`o:${ce.length}:${ce.map(we=>`${we}=${hh(J[we],H,X+1)}`).join(";")}`}finally{H.delete(_)}}let O0=-1,B0="",na=[2166136261];function Ru(_){const H=Be.value[_];return H?F0(hh(H)):""}function HN(_,H){let X=_;for(let J=0;J<H.length;J++)X^=H.charCodeAt(J),X=Math.imul(X,16777619);return X>>>0}function R0(){var _,H;const X=fe.value;if(O0===X)return B0;const J=Be.value.length;let ce=x0(J);(O0!==X-1||ce>J||na.length<ce+1)&&(ce=0),ce===0?na=[2166136261]:na.length=ce+1;for(let we=ce;we<J;we++){const Le=Ru(we);na[we+1]=HN((_=na[we])!=null?_:2166136261,Le)}return na.length=J+1,B0=(((H=na[J])!=null?H:2166136261)>>>0).toString(36),O0=X,B0}function dc(_,H={}){var X;const J=H.includeHeightCache===!0,ce=(X=H.includeContentHash)!=null?X:J,we=J?(function(Fe){const Ve=(function(){var Ye,ct;const st=Number((ct=(Ye=o.virtualScroll)==null?void 0:Ye.heightCacheLimit)!=null?ct:5e3);return!Number.isFinite(st)||st<=0?Number.POSITIVE_INFINITY:Math.max(1,Math.trunc(st))})();if(!Number.isFinite(Ve)||Fe.length<=Ve)return Fe;const Oe=new Map,Pe=Ye=>{!Ye||Oe.size>=Ve||Oe.set(Ye.index,Ye)},je=Be.value.length,$e=Vo(jo.start-2*ns.value,0,je),He=Vo(jo.end+2*ns.value,$e,je);for(const Ye of Fe)Ye.index>=$e&&Ye.index<He&&Pe(Ye);const Xe=Math.max(1,Math.ceil(Fe.length/Ve));for(let Ye=0;Ye<Fe.length&&Oe.size<Ve;Ye+=Xe)Pe(Fe[Ye]);for(let Ye=Fe.length-1;Ye>=0&&Oe.size<Ve;Ye-=Xe)Pe(Fe[Ye]);return Array.from(Oe.values()).sort((Ye,ct)=>Ye.index-ct.index).slice(0,Ve)})(bN().map(Fe=>{var Ve;const Oe=Be.value[Fe.index];return Oe?Ot(it({},Fe),{nodeType:String((Ve=Oe.type)!=null?Ve:""),signature:Ru(Fe.index)}):null}).filter(Fe=>!!Fe)):[],Le=RN({allowFallback:H.allowAnchorFallback===!0,requireViewport:H.requireViewport});return Le||we.length||H.includeEmptyState===!0?Ot(it({sessionKey:_.sessionKey,threadKey:_.threadKey},Le?{anchor:Le.anchor,anchorCaptured:Le.captured}:{anchorCaptured:!1}),{metrics:_,width:_.width,contentHash:ce?R0():void 0,measurementKey:br()||void 0,heightCache:we.length?we:void 0}):null}function D0(_){var H,X;const J=Bu();if(!J)return;const ce=(function(Fe){const Ve=L.value;if(!Ve)return null;const Oe=be(Ve,Fe.root),Pe=Be.value.length,je=vt("getRendererBottomOffsetWithinRoot.offsetHeight",()=>Ve.offsetHeight||0),$e=Math.max(0,je>0?je:Pe>0?vt("getRendererBottomOffsetWithinRoot.scrollHeight",()=>Ve.scrollHeight||0):0),He=yx();return Oe+Math.max($e,He)})(J);if(ce==null)return;const we=Math.max(0,_.distanceFromBottomPx),Le=Math.max(0,ce-J.clientHeight-we);(function(Fe){d0=zu()+120,Lu=Fe})(Le),J.isViewportRoot?(X=(H=J.doc.defaultView)==null?void 0:H.scrollTo)==null||X.call(H,0,Le):W4(J.root,J.doc,Le,{isReverseFlexScrollRoot:Ne,getNormalizedScrollTop:qe})}const P0=[];function bx(){if(P)for(Ql!=null&&(ge?.(Ql),Ql=null);P0.length;){const _=P0.pop();_!=null&&window.clearTimeout(_)}}function fc(_){const H=!!Ys.value;Ys.value=null,d0=0,Lu=null,bx(),H&&_&&Gn(_)}function hc(){if(!Ys.value||!P||Ql!=null)return;const _=()=>{Ql=null;const H=Ys.value;H&&D0(H)};Ql=Te?Te(_):null,Ql==null&&_()}function xx(_,H={}){const X=Be.value.length;return X<=0?[]:_.filter(J=>!(!Number.isInteger(J.index)||J.index<0||J.index>=X)&&!(!Number.isFinite(J.height)||J.height<=0)&&!(H.requireSignature&&!J.signature)&&!(H.requireCompatibilityMetadata&&!J.nodeType&&!J.signature)&&(function(ce){var we;const Le=Be.value[ce.index];return!(!Le||ce.nodeType&&ce.nodeType!==String((we=Le.type)!=null?we:"")||ce.signature&&ce.signature!==Ru(ce.index))})(J))}function wx(_){const H=pd(ea()),X=pd(_);return H!==-1&&X!==-1&&H===X}function H0(_){var H;const X=Number(_?.width);if(Number.isFinite(X)&&X>0)return X;const J=Number((H=_?.metrics)==null?void 0:H.width);return Number.isFinite(J)&&J>0?J:null}function _x(_){var H;return _.sessionKey===no()&&!!M0(_.threadKey)&&((H=_.measurementKey)!=null?H:"")===br()&&!!wx(H0(_))&&!!(function(X){const J=X.heightCache;return!!J?.length&&(Sx(X)?J.some(ce=>!!(ce.nodeType||ce.signature)):J.some(ce=>!!ce.signature))})(_)}function Sx(_){return!!(_.contentHash&&_.contentHash===R0())}function WN(_){return!Sx(_)}let oa=null,sa=null,ph=null,Du=null,Pu=null;function W0(_){var H;const X=_.map(ce=>{var we,Le;return[ce.index,Math.round(10*ce.height),(we=ce.nodeType)!=null?we:"",(Le=ce.signature)!=null?Le:""].join("")}).join(""),J=pd(ea());return[(H=bo())!=null?H:"",no(),br(),Be.value.length,J,_.length,F0(X)].join(":")}function Cx(_=(H=>(H=o.virtualScroll)==null?void 0:H.heightCache)()){if(!tn.value||!_?.length||Be.value.length<=0||!wx((H=o.virtualScroll)==null?void 0:H.heightCacheWidth))return!1;var H;const X=xx(_,{requireSignature:!0});if(!X.length)return!1;const J=W0(X);return J===oa?(sa="standalone",!0):(Yb(X,{mode:"merge"}),fi(),oa=J,sa="standalone",qu(),Gn("restore"),!0)}function z0(_,H={}){var X,J,ce;if(!tn.value||!_||_.sessionKey!==no()||!M0(_.threadKey)||Be.value.length<=0)return!1;const we=!!((X=_.heightCache)!=null&&X.length)&&!mh(),Le=!_.anchor||_.anchorCaptured===!1&&H.allowUncapturedAnchor!==!0?null:_.anchor,Fe=H.restoreAnchor===!0&&!!Le&&!mh()&&Number(H0(_))>0;let Ve=!1;if((J=_.heightCache)!=null&&J.length&&_x(_)){const Pe=xx(_.heightCache,{requireCompatibilityMetadata:!_.contentHash,requireSignature:WN(_)});Pe.length&&(Yb(Pe,{mode:"merge"}),fi(),oa=W0(Pe),sa="restore",qu(),Ve=!0)}if(we||Fe)return!1;if(!H.restoreAnchor||!Le)return Ve&&Gn("restore"),!0;const Oe=(function(Pe,je){var $e;const He=Pe.anchor,Xe=He?He.type==="bottom"?`bottom:${Math.round(He.distanceFromBottomPx)}`:`node:${He.nodeIndex}:${Math.round(He.offsetWithinNodePx)}`:"none";return[($e=bo())!=null?$e:"",no(),br(),dh.value,je,Xe].join(":")})(_,(ce=H.restoreToken)!=null?ce:"imperative");return ph===Oe?(Ve&&Gn("restore"),!0):(ph=Oe,(function(Pe){const je=()=>{if(Pe.type==="node")return fc(),void zb({nodeIndex:Pe.nodeIndex,offsetWithinNodePx:Pe.offsetWithinNodePx});if(th(),oc.value=null,Ys.value=Pe,bx(),D0(Pe),P)for(const $e of[0,120,280,480])P0.push(window.setTimeout(()=>{const He=Ys.value;He&&D0(He)},$e))};(function($e){if(!zt.value)return!1;const He=Be.value.length;return!(He<=0||(yr.value=$e.type==="node"?Vo($e.nodeIndex,0,He-1):He-1,Fu(),0))})(Pe)?yt(je):je()})(Le),Gn("restore"),!0)}function mh(){const _=ea();return Number.isFinite(_)&&_>0}function Ax(_){var H;return _.sessionKey===no()&&!!M0(_.threadKey)&&(Be.value.length<=0||!(!((H=_.heightCache)!=null&&H.length)||mh())||!(!(_.anchor&&Number(H0(_))>0)||mh()))}function U0(){_t.clear();for(const _ of Object.keys(sc)){const H=Number(_);Number.isInteger(H)&&H>=0&&H<Be.value.length&&Vb(H)}}function Hu(){Xs!=null&&(ge?.(Xs),Xs=null),Q0()}function Mx(){return!P||ze?Promise.resolve():new Promise(_=>{let H=!1,X=null;const J=()=>{H||(H=!0,X!=null&&window.clearTimeout(X),_())};if(Te)return Te(J),void(X=window.setTimeout(J,50));X=window.setTimeout(J,0)})}function q0(_,H=bo(),X=Qs.value){return no()===_&&bo()===H&&Qs.value===X}function j0(){return Zn(this,arguments,function*(_={}){var H,X,J,ce,we;const Le=no(),Fe=bo(),Ve=Qs.value,Oe=(H=_.frames)!=null?H:2,Pe=(X=_.timeoutMs)!=null?X:120,je=(J=_.reason)!=null?J:"manual",$e=_.expectedSettledTokenKey,He=_.flushPendingTimers===!0,Xe=ta(je),Ye=()=>Ot(it({},Xe),{phase:Xe.final?"settling":Xe.phase,stable:!1,confidence:Xe.confidence==="final"?"mixed":Xe.confidence,reason:je}),ct=()=>q0(Le,Fe,Ve)&&($e==null||Uu()===$e);for(let Mt=0;Mt<Oe;Mt++){if(yield yt(),!ct()||(yield Mx(),!ct()))return Ye();xr(),Hu()}if(yield(function(Mt){return!P||Mt<=0?Promise.resolve():new Promise(Ct=>window.setTimeout(Ct,Mt))})(Pe),!ct()||(He&&nx(),xr(),Hu(),!ct()))return Ye();const st=L0();st&&(I0=Le,N0=Fe,((ce=o.virtualScroll)==null?void 0:ce.settleMode)==="manual"&&$e!=null&&fh((we=o.virtualScroll)==null?void 0:we.settledToken)&&Uu()===$e&&(uc=Yu(o.virtualScroll.settledToken)));const pt=ct()&&st&&vx(),kt=ta(je,pt?"final":void 0);return Z0(kt,!0),kt})}let V0="content",ia=null,ra=null,K0=0,Wu=null,pc=null,G0=null,Y0=null;function zu(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Ex(_){var H,X;const J=Wu;if(!J)return!0;const ce=(X=(H=o.virtualScroll)==null?void 0:H.heightDiffThresholdPx)!=null?X:1;return Math.abs(_.totalHeight-J.totalHeight)>ce||_.sessionKey!==J.sessionKey||_.phase!==J.phase||_.stable!==J.stable||_.final!==J.final||_.threadKey!==J.threadKey||_.nodeCount!==J.nodeCount||_.measuredCount!==J.measuredCount||_.width!==J.width}function Uu(_=(H=>(H=o.virtualScroll)==null?void 0:H.settledToken)()){return Do(_)}function Tx(_,H){var X,J;return[_,H.sessionKey,(X=H.threadKey)!=null?X:"",br(),R0(),Do((J=o.virtualScroll)==null?void 0:J.settledToken),Math.round(H.totalHeight),Math.round(H.width)].join("\0")}function qu(){G0=null,Y0=null,pc=null}function zN(_){const H=_.heightCache;return H?.length?W0(H):""}function ju(_){var H,X,J;const ce=_.metrics,we=_.anchor?(Le=_.anchor).type==="bottom"?`bottom:${Math.round(Le.distanceFromBottomPx)}`:`node:${Le.nodeIndex}:${Math.round(Le.offsetWithinNodePx)}`:"none";var Le;return[_.sessionKey,(H=_.threadKey)!=null?H:"",(X=_.measurementKey)!=null?X:br(),(J=_.contentHash)!=null?J:"",zN(_),we,_.anchorCaptured?1:0,ce.liveRange.start,ce.liveRange.end,ce.renderedCount,ce.nodeCount,Math.round(ce.totalHeight),Math.round(ce.width),ce.phase,ce.stable?1:0].join("\0")}function Z0(_,H=!1){if(!tn.value||(function(Le=!1){return!Le&&qo.value&&!qs.value})(H))return;const X=H||Ex(_),J=(function(Le,Fe=!1){return Fe||Le.stable||Le.phase==="final"?{state:dc(Le,{includeHeightCache:!0})}:{state:dc(Le)}})(_,H),ce=J.state,we=!!(ce&&(X||(function(Le,Fe=!1){return!!Fe||ju(Le)!==pc})(ce,H)));if(X&&(B(_),Wu=_,K0=zu()),ce&&we&&(W(ce),ce.anchor&&z(ce.anchor),pc=ju(ce)),_.stable){const Le=Tx("settled",_);if(Le!==G0){G0=Le;const Fe=dc(_,{includeHeightCache:!0});Fe&&(W(Fe),pc=ju(Fe)),(function(Ve){s("render-settled",Ve)})(_)}}if(_.phase==="final"){const Le=Tx("final",_);if(Le!==Y0){Y0=Le;const Fe=dc(_,{includeHeightCache:!0});Fe&&(W(Fe),pc=ju(Fe)),(function(Ve){s("render-final",Ve)})(_)}}}function X0(){ia!=null&&(ge?.(ia),ia=null),ra!=null&&P&&(window.clearTimeout(ra),ra=null)}function Nx(){ia=null,ra=null,(function(_){if(kr.size>0||Xs!=null)return!0;switch(_){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}})(V0)&&(xr(),Hu()),Z0(ta(V0))}function Gn(_){var H,X;if(!tn.value||(V0=_,ia!=null||ra!=null))return;const J=Math.max(0,(X=(H=o.virtualScroll)==null?void 0:H.emitIntervalMs)!=null?X:32),ce=Math.max(0,J-(zu()-K0)),we=()=>{ra=null,ia=Te?Te(Nx):null,ia==null&&Nx()};P&&ce>0?ra=window.setTimeout(we,ce):we()}function Ix(){Hb.value+=1}function gh(_){if(us.value&&_>=te.value){const H=Be.value[_],X=tt.value===!0&&lt.value!==!0&&_>=Be.value.length-2,J=H?.type==="code_block"||H?.type==="image"||H?.type==="mermaid"||H?.type==="infographic";if(!X||J)return!1}return!Zi.value||_<wn.value||k0.value.has(_)}function mc(_){const H=ah.get(_);H&&(H(),ah.delete(_));const X=rc.get(_);X&&(X.destroy(),rc.delete(_)),ch(_)}function vh(_,H){let X=!1;if(H){const we=cn.get(_);cn.set(_,H),we!==H&&(X=!0)}else cn.delete(_)&&(X=!0);if(X&&Ix(),H||ch(_),!Zb.value||!le)return mc(_),void(H&&Zi.value&&ol(_,!0));if(!zt.value&&Zi.value&&!q.value&&rc.size>=re.value&&(q.value||(q.value=!0,b0()),!Zb.value||!le))return mc(_),void(H&&ol(_,!0));if(_<wn.value&&!zt.value||k0.value.has(_))return mc(_),void ol(_,!0);if(!H)return void mc(_);mc(_);const J=le(H,{rootMargin:Ae.value});if(!J)return;rc.set(_,J),ol(_,J.isVisible.value),Zi.value&&(function(we){if(!P||!Zi.value)return;ch(we);const Le=we%17*23,Fe=window.setTimeout(()=>{if(ox.delete(we),!Zi.value||k0.value.has(we))return;const Ve=cn.get(we);if(!Ve)return;const Oe=ke(Ve),Pe=Ve.ownerDocument||document,je=Pe.defaultView||window,$e=!Oe||Oe===Pe.documentElement||Oe===Pe.body,He=!$e&&Oe?vt("nodeVisibilityFallback.root.getBoundingClientRect",()=>Oe.getBoundingClientRect()):null,Xe=$e?0:He.top,Ye=$e?vt("nodeVisibilityFallback.clientHeight",()=>{var st,pt;return(pt=(st=je.innerHeight)!=null?st:Oe?.clientHeight)!=null?pt:0}):He.bottom,ct=vt("nodeVisibilityFallback.node.getBoundingClientRect",()=>Ve.getBoundingClientRect());ct.bottom>=Xe-500&&ct.top<=Ye+500&&ol(we,!0)},1800+Le);ox.set(we,Fe)})(_);let ce=null;ce=et(()=>J.isVisible.value,we=>{if(we){ch(_),ol(_,!0),ce?.(),ah.delete(_),rc.get(_)===J&&rc.delete(_);try{J.destroy()}catch{}}},{immediate:!0}),ah.set(_,ce),zt.value&&Li()}function Q0(){Xs=null,ic(()=>{let _=!1;for(const[H,X]of kr)kr.delete(H),Xi.get(H)===X.el&&Jl.get(H)===X.version&&(_=Kb(H,X.height,{allowShrink:X.allowShrink})||_);return _})}function gc(){Xs!=null&&(ge?.(Xs),Xs=null),kr.clear()}function yh(_,H){(function(X,J,ce){var we;if(!Number.isFinite(ce)||ce<=0||Xi.get(X)!==J)return;const Le=Jl.get(X);if(Le==null)return;const Fe=Be.value[X],Ve=mt.value&&lt.value!==!0&&!((we=o.nodes)!=null&&we.length)&&X>=Be.value.length-2,Oe=!(Fe?.loading===!0||Ve),Pe=kr.get(X),je=Pe?Pe.allowShrink&&Oe:Oe,$e=Pe&&!je?Math.max(Pe.height,ce):ce;kr.set(X,{height:$e,allowShrink:je,version:Le,el:J}),Xs==null&&(Xs=Te?Te(Q0):null,Xs==null&&Q0())})(_,H,Gb(_,H))}function xr(){for(const[_,H]of Xi)H&&yh(_,H)}function Lx(){co?.disconnect(),co=null,Vt.clear()}function J0(){for(;sh.length;)lh(sh.pop())}et(qs,_=>{_&&Gn("content")},{flush:"post"}),t({getVirtualMetrics:ta,captureVirtualState:function(_={}){var H;return dc(ta("manual"),{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:_.allowFallbackAnchor===!0,requireViewport:_.requireViewport===!0,includeEmptyState:(H=_.includeEmptyState)==null||H})},restoreVirtualState:function(_,H={}){const X=H.restoreAnchor===!0,J=H.restoreToken==null?"imperative":String(H.restoreToken);Du=_,Pu={restoreAnchor:X,restoreToken:J,allowUncapturedAnchor:H.allowUncapturedAnchor===!0},!z0(_,{restoreAnchor:X,restoreToken:J,allowUncapturedAnchor:H.allowUncapturedAnchor===!0})&&Ax(_)||(Du=null,Pu=null)},forceMeasure:function(_="manual"){return Zn(this,null,function*(){yield yt(),yield Mx(),xr(),Hu(),yield yt();const H=ta(_);return Z0(H,!0),H})},settle:j0,scrollToNode:function(_,H="start"){fc(),th();const X=Be.value.length;if(X<=0)return;const J=Vo(_,0,X-1),ce=()=>{var we;const Le=fN({nodeIndex:J,offsetWithinNodePx:0}),Fe=f0(J),Ve=Bu(),Oe=(we=Ve?.clientHeight)!=null?we:0,Pe=uN();let je=Le;if(H==="center")je=Le-Oe/2+Fe/2;else if(H==="end")je=Le-Oe+Fe;else if(H==="nearest"&&Pe!=null){if(Le>=Pe&&Le+Fe<=Pe+Oe)return;je=Le<Pe?Le:Le-Oe+Fe}dN(Math.max(0,je)),Li({immediate:!0}),zt.value&&(yr.value=J,Fu())};if(zt.value)return yr.value=J,Fu(),void yt(ce);ce()}}),et(()=>Ms.value,_=>{if(!_){Lx();for(const H of tl.values())for(const X of H)lh(X);tl.clear(),Jl.clear(),J0(),gc()}},{immediate:!0}),et(lt,_=>{_&&(function(){if(P&&lt.value&&Xi.size){J0();for(const H of[80,240,640]){const X=tx(H,()=>{for(const[J,ce]of Xi)ce&&yh(J,ce)},"final");X!=null&&sh.push(X)}}})(),Gn(_?"final":"content")});const UN=z4(()=>Gn("content"),16),qN=z4(()=>Gn("batch"),16);et([()=>Be.value.length,()=>te.value],()=>{Ys.value&&hc(),UN()},{flush:"post",immediate:!0}),et([()=>jo.start,()=>jo.end],()=>{qN()},{flush:"post"});const{cleanupBatchScheduler:jN}=(function(_){const{props:H,isClient:X,isTestEnv:J,parsedNodesIdentity:ce,parsedNodeCount:we,desiredRenderedCount:Le,datasetKey:Fe,batchingEnabled:Ve,incrementalRenderingActive:Oe,resolvedBatchSize:Pe,resolvedInitialBatch:je,renderedCount:$e,adaptiveBatchSize:He,previousRenderContext:Xe,previousBatchConfig:Ye,requestFrame:ct,cancelFrame:st,hasIdleCallback:pt,cleanupNodeVisibility:kt,onDatasetKeyChanged:Mt,onDatasetChanged:Ct}=_;let Et=null,qt="raf",Xt=null,In=0,Ko=!1,Ro=!1;const $i=new Set,Ji=new Set;function ed(){if(X){Et!=null&&(qt==="raf"&&st?st(Et):qt==="idle"&&typeof window.cancelIdleCallback=="function"?window.cancelIdleCallback(Et):qt==="timeout"&&window.clearTimeout(Et),Et=null),In+=1;for(const os of $i)st&&st(os);for(const os of Ji)window.clearTimeout(os);$i.clear(),Ji.clear(),Xt=null,Ko=!1,Ro=!1}}function Mh(){return typeof performance<"u"?performance.now():Date.now()}function Zx(os){(function(wr){var il;if(!Oe.value)return;const _r=Math.max(2,(il=H.renderBatchBudgetMs)!=null?il:6),Sr=Math.max(1,Pe.value||1),Fi=Math.max(1,Math.floor(Sr/4));wr>1.5*_r?He.value=Math.max(Fi,Math.floor(.8*He.value)):wr<.6*_r&&He.value<Sr&&(He.value=Math.min(Sr,Math.ceil(1.2*He.value)))})(os),Ko=!1;const Ts=Ro||$e.value<Le.value;Ro=!1,Ts&&Jx()}function Xx(os,Ts={}){var wr,il;if(!Oe.value)return;const _r=Le.value;if($e.value>=_r)return;const Sr=Math.max(1,os),Fi=()=>{const kc=Mh();Et=null;const td=Xt??Sr;Xt=null;const bc=Mh();$e.value=Math.min(_r,$e.value+td),kt($e.value),(function(rg,Eh){if(!X)return void Zx(Eh);Ko=!0;const ew=++In;yt().then(()=>{var tw;if(ew!==In)return;const f9=Mh(),h9=Math.max(Eh,f9-rg),nw=()=>{ew===In&&Zx(h9)};if(ct){let aa=null,xc=null,sw=!1;const iw=()=>{sw||(sw=!0,aa!==null&&($i.delete(aa),aa=null),xc!==null&&(Ji.delete(xc),window.clearTimeout(xc),xc=null),nw())};return aa=ct(()=>{iw()}),$i.add(aa),xc=window.setTimeout(()=>{aa!==null&&st&&st(aa),iw()},Math.max(32,(tw=H.renderBatchIdleTimeoutMs)!=null?tw:120)),void Ji.add(xc)}const ow=window.setTimeout(()=>{Ji.delete(ow),nw()},0);Ji.add(ow)})})(kc,Mh()-bc)};if(!X||Ts.immediate)return void Fi();const rl=Math.max(0,(wr=H.renderBatchDelay)!=null?wr:16);if(Xt=Xt!=null?Math.max(Xt,Sr):Sr,Et==null){if(!J&&pt&&window.requestIdleCallback){const kc=Math.max(0,(il=H.renderBatchIdleTimeoutMs)!=null?il:120);return qt="idle",void(Et=window.requestIdleCallback(()=>Fi(),{timeout:kc}))}if(ct&&!J)return qt="raf",void(Et=ct(()=>{rl===0?Fi():(qt="timeout",Et=window.setTimeout(()=>Fi(),rl))}));qt="timeout",Et=window.setTimeout(()=>Fi(),rl)}}function Qx(os,Ts={}){Ko?Ro=!0:os==null?Jx():Xx(os,Ts)}function Jx(){Oe.value&&Xx(Ve.value?Math.max(1,Math.round(He.value)):Math.max(1,Pe.value))}return et([ce,we,Fe,Oe,Pe,je,()=>H.renderBatchDelay],()=>{var os;const Ts=we.value,wr=Xe.value,il=Fe.value,_r=!Object.is(il,wr.key),Sr=Ts!==wr.total,Fi=_r||Sr;Xe.value={key:il,total:Ts};const rl=Ye.value,kc=(os=H.renderBatchDelay)!=null?os:16,td=rl.batchSize!==Pe.value||rl.initial!==je.value||rl.delay!==kc||rl.enabled!==Oe.value;Ye.value={batchSize:Pe.value,initial:je.value,delay:kc,enabled:Oe.value},_r&&Mt(Ts),(Fi||td||!Oe.value)&&ed(),(Fi||td)&&(He.value=Math.max(1,Pe.value||1)),Fi&&Ct();const bc=Le.value;if(!Ts)return $e.value=0,void kt(0);if(!Oe.value)return $e.value=bc,void kt($e.value);const rg=_r||wr.total===0;$e.value=rg||td?Math.min(bc,je.value):Math.min($e.value,bc);const Eh=Math.max(1,je.value||Pe.value||Ts);$e.value<bc?Qx(Eh,{immediate:!X}):kt($e.value)},{immediate:!0}),et(Le,(os,Ts)=>{Oe.value&&(typeof Ts=="number"&&os<=Ts||os>$e.value&&Qx())}),{cleanupBatchScheduler:ed}})({props:S,isClient:P,isTestEnv:ze,parsedNodesIdentity:xn,parsedNodeCount:nn,desiredRenderedCount:ih,datasetKey:FN,batchingEnabled:go,incrementalRenderingActive:us,resolvedBatchSize:Ut,resolvedInitialBatch:wn,renderedCount:te,adaptiveBatchSize:Me,previousRenderContext:Ce,previousBatchConfig:De,requestFrame:Te,cancelFrame:ge,hasIdleCallback:Ee,cleanupNodeVisibility:EN,onDatasetKeyChanged:_=>{gc(),oh(),fi(),qu(),_>0&&nh(_)},onDatasetChanged:()=>{zt.value&&Li({immediate:!0})}});et([Xb,zt,()=>L.value,()=>Y()],([_,H])=>{if(!_)return sx(),void y0();TN(),H?Li({immediate:!0}):y0()},{flush:"post",immediate:!0}),et([()=>Be.value.length,()=>zt.value],_=>Zn(null,[_],function*([H,X]){X&&H&&P&&(yield yt(),Li({immediate:!0}))}),{flush:"post"}),et(io,_=>{_&&(function(){var H;if(Vn.value&&Kn.value&&Jn.value&&((H=Oo.value)!=null&&H[1]))return;const X=gt({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),J=gt({type:"list_item",children:[X],raw:"- Probe paragraph text"}),ce=gt({type:"list",ordered:!1,items:[J],raw:"- Probe paragraph text"});Vn.value=X,Kn.value=J,Jn.value=ce;const we={1:null,2:null,3:null,4:null,5:null,6:null};for(let Le=1;Le<=6;Le++)we[Le]=gt({type:"heading",level:Le,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(Le)} Probe heading`});Oo.value=we})()},{immediate:!0}),et([()=>L.value,io],()=>{if(!io.value)return _0(),void(ne.value=0);rx(),_0(),io.value&&L.value&&typeof ResizeObserver<"u"&&(Ou=new ResizeObserver(()=>{rx(),oc.value&&$u(),Ys.value&&hc(),Gn("resize")}),Ou.observe(L.value))},{immediate:!0}),et([io,ui,Qs],()=>Zn(null,null,function*(){if(!io.value)return j.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void fi();yield yt(),(function(){if(!io.value||typeof window>"u")return j.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void fi();const _={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},H=ix(w0(O.value),".paragraph-node");_.paragraph=yv(O.value,H,"pre-wrap");const X=w0(U.value),J=X?.querySelector(".paragraph-node");_.listItem=yv(U.value,J,"pre-wrap");const ce=vt("readSimpleTextProbeProfile.list.offsetHeight",()=>{var Le,Fe;return(Fe=(Le=Z.value)==null?void 0:Le.offsetHeight)!=null?Fe:0}),we=vt("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var Le,Fe;return(Fe=(Le=U.value)==null?void 0:Le.offsetHeight)!=null?Fe:0});_.listWrapperOverhead=Math.max(0,ce-we);for(let Le=1;Le<=6;Le++){const Fe=ix(w0(ie[Le]),`h${Le}`);_.headings[Le]=yv(ie[Le],Fe,"pre-wrap")}j.value=_,fi()})()}),{flush:"post",immediate:!0}),et(()=>Be.value.length,()=>{zt.value&&Li({immediate:!0})}),et([io,ne],()=>{fi(),zt.value&&Li({immediate:!0}),oc.value&&$u(),Ys.value&&hc(),Gn("resize")},{immediate:!1}),et(()=>Zi.value,_=>{if(_)for(const[H,X]of cn)vh(H,X);else if(b0(),zt.value)Li({immediate:!0});else for(const[H,X]of cn)X&&ol(H,!0)},{immediate:!1}),et([Ae,re,()=>Y()],()=>{var _;(_=le.refresh)==null||_.call(le);for(const[H,X]of cn)vh(H,X)},{immediate:!1}),et([()=>S.viewportPriority,()=>Be.value.length,re],([_,H,X])=>{if(_!==!1){if(q.value&&(H<=200||H<=X)){q.value=!1;for(const[J,ce]of cn)vh(J,ce)}}else q.value=!1}),et(()=>te.value,()=>{zt.value&&Li({immediate:!0})}),et([yr,ts,ns,()=>Be.value.length,zt],()=>{Fu()},{immediate:!0});let Vu=null,Ku=!1,vc=null;function Gu(){Vu=null,I0=null,N0=void 0,uc=null,qu()}function eg(){gc(),oh(),fi(),_t.clear();const _=Be.value.length;_>0&&nh(_),U0()}function tg(){X0(),nx(),Wu=null,oa=null,sa=null,ph=null,Du=null,Pu=null,Ku=!1,Gu(),mx("restore"),th(),fc()}function Yu(_){var H;return[(H=bo())!=null?H:"",no(),br(),dh.value,Uu(_),Be.value.length,Math.round(nc(0,Be.value.length)),Math.round(ea()),hi.count,Math.round(hi.total)].join(":")}function $x(){return Zn(this,null,function*(){var _,H,X,J;const ce=(_=o.virtualScroll)==null?void 0:_.settledToken,we=Uu(ce),Le=no(),Fe=bo(),Ve=Qs.value;if(tn.value&&((H=o.virtualScroll)==null?void 0:H.settleMode)==="manual"&&fh(ce))if(L0()){if(Yu(ce)!==uc&&!Ku){Ku=!0;try{const Oe=yield j0({reason:"manual",expectedSettledTokenKey:we}),Pe=Uu()===we;q0(Le,Fe,Ve)&&Oe.sessionKey===Le&&Oe.threadKey===Fe&&Pe&&Oe.stable&&Oe.phase==="final"&&(uc=Yu((X=o.virtualScroll)==null?void 0:X.settledToken))}finally{Ku=!1,yield yt();const Oe=(J=o.virtualScroll)==null?void 0:J.settledToken,Pe=fh(Oe)?Yu(Oe):"";q0(Le,Fe,Ve)&&Pe&&uc!==Pe&&$x()}}}else Gn("manual")})}et(tn,(_,H)=>{if(_!==H){if(!_)return tg(),void X0();tg(),eg(),vc=Qs.value,Gn("content")}},{flush:"post"}),et([tn,Qs],([_,H])=>{_?vc!=null?vc!==H&&(vc=H,(function(X="resize"){gc(),oh(),fi(),_t.clear();const J=Be.value.length;J>0&&nh(J),U0(),oa=null,sa=null,ph=null,Wu=null,Ku=!1,Gu(),Cx(),yt(()=>{xr(),oc.value&&$u(),Ys.value&&hc(),Gn(X)})})("resize")):vc=H:vc=null},{flush:"post",immediate:!0}),et([tn,()=>no(),()=>bo()],([_])=>{_&&(tg(),eg(),mx("content"),Gn("content"))}),et([tn,()=>no(),()=>bo(),Qs,()=>Be.value.length],([_])=>{_&&(function(H="async-node"){let X=!1;for(const[J,ce]of Array.from(Qi.entries()))E0(ce)||(Qi.delete(J),Zs.delete(J),X=!0);X&&(ac(),Gn(H))})("async-node")},{flush:"post"}),et([tn,()=>{var _;return(_=o.virtualScroll)==null?void 0:_.sessionKey},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.measurementKey},()=>o.indexKey,()=>fe.value],([_])=>{_&&(qu(),(function(H="content"){if(!tn.value)return;const X=[],J=Be.value.length,ce=x0(J);for(const we of Array.from(_t.keys())){if(we>=J){X.push(we);continue}if(we<ce)continue;const Le=Ru(we),Fe=_t.get(we);Fe!=null&&Fe!==Le&&X.push(we),_t.set(we,Le)}for(const we of Array.from(_t.keys()))we>=J&&_t.delete(we);X.length&&((function(we,Le={}){const Fe=Array.from(we,Number);jb(Fe);let Ve=0;if(ic(()=>(Ve=kN(Fe,Le),Ve>0)),Ve>0)(function(Oe){for(const Pe of Oe)_t.delete(Pe)})(Fe);else for(const Oe of Fe)Gs.delete(Oe)})(X,{notify:!1}),fi(),Gu(),oc.value&&$u(),Ys.value&&hc(),Gn(H))})("content"))},{flush:"post",immediate:!0}),et([tn,()=>Be.value.length,()=>no(),()=>bo()],([_,H,X,J],[ce,we,Le,Fe])=>{_&&ce&&X===Le&&J===Fe&&H!==we&&Gu()},{flush:"post"}),et([tn,()=>{var _;return(_=o.virtualScroll)==null?void 0:_.heightCache},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.heightCacheWidth},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.restoreState},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.measurementKey},()=>Be.value.length,()=>no(),ne],()=>{Cx()},{flush:"post",immediate:!0}),et([tn,()=>{var _;return(_=o.virtualScroll)==null?void 0:_.restoreState},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.restoreAnchor},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.measurementKey},()=>Be.value.length,()=>no(),ne],_=>Zn(null,[_],function*([H,X]){if(!H||!X)return;yield yt();const J=(function(){var ce;const we=(ce=o.virtualScroll)==null?void 0:ce.restoreAnchor;return we==null||we===!1?null:we===!0?"true":String(we)})();z0(X,{restoreAnchor:J!=null,restoreToken:J??void 0})}),{flush:"post",immediate:!0}),et([tn,ne,()=>{var _;return(_=o.virtualScroll)==null?void 0:_.restoreState},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.measurementKey}],([_])=>{var H;if(!_)return;const X=(H=o.virtualScroll)==null?void 0:H.restoreState;X&&oa&&sa==="restore"&&(_x(X)||(eg(),oa=null,sa=null,Gn("resize")))},{flush:"post"}),et([tn,()=>Be.value.length,()=>no(),ne],_=>Zn(null,[_],function*([H]){var X;const J=Du,ce=Pu;H&&J&&(yield yt(),!z0(J,{restoreAnchor:ce?.restoreAnchor===!0,restoreToken:(X=ce?.restoreToken)!=null?X:"imperative",allowUncapturedAnchor:ce?.allowUncapturedAnchor===!0})&&Ax(J)||(Du=null,Pu=null))}),{flush:"post",immediate:!0}),et([tn,lt,()=>{var _;return(_=o.virtualScroll)==null?void 0:_.settleMode},()=>no(),()=>bo(),Qs,v0,Jb,()=>te.value,ih,()=>hi.count,()=>hi.total],([_,H,X])=>{if(!_||H!==!0||X==="manual"||!$0())return;const J=(function(){var ce;const we=Be.value.length;return[(ce=bo())!=null?ce:"",no(),br(),dh.value,we,Math.round(nc(0,we)),Math.round(ea()),hi.count,Math.round(hi.total)].join(":")})();Vu!==J&&(Vu=J,j0({reason:"final"}).then(ce=>{ce.stable||Vu!==J||(Vu=null)}))},{flush:"post",immediate:!0}),et([tn,lt,()=>{var _;return(_=o.virtualScroll)==null?void 0:_.settleMode},()=>{var _;return(_=o.virtualScroll)==null?void 0:_.settledToken},()=>no(),()=>bo(),Qs,v0,Jb,()=>te.value,ih,()=>Be.value.length,()=>hi.count,()=>hi.total],()=>{$x()},{flush:"post",immediate:!0}),et([()=>Be.value.length,zt,ts,ns,()=>jo.start,()=>jo.end],([_,H,X,J,ce,we])=>{me.value&&pn("virtualization",{nodes:_,virtualization:H,maxLiveNodes:X,buffer:J,focusIndex:yr.value,scroll:H?(()=>{const Le=Iu.value||ke();return Le?{reverse:Ne(Le),scrollTop:Math.round(Le.scrollTop),scrollTopAbs:Math.round(Math.abs(Le.scrollTop)),scrollHeight:Math.round(Le.scrollHeight),clientHeight:Math.round(Le.clientHeight)}:null})():null,liveRange:{start:ce,end:we},rendered:te.value})}),et([()=>S.customId],([_],H,X)=>{if(!_||ko)return;const J=(function(ce,we){return ce?(Io.controllers[ce]=we,()=>{Io.controllers[ce]===we&&delete Io.controllers[ce]}):()=>{}})(_,{captureRestoreAnchor:Wb,restoreAnchor:zb,getAnchorDrift:hN,getReport:LN});X(()=>{J()})},{immediate:!0}),ho(()=>{(function(){if(tn.value)try{xr(),Hu();const _=ta("manual");Ex(_)&&(B(_),Wu=_,K0=zu());const H=dc(_,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});H&&(W(H),H.anchor&&z(H.anchor),pc=ju(H))}catch{}})(),jN(),b0(),Pt(),Lx();for(const _ of tl.values())for(const H of _)lh(H);tl.clear(),Jl.clear(),_t.clear(),J0(),gc(),_0(),th(),fc(),X0(),sx(),y0()});const VN=Md("ViewportDeferredMermaidBlockNode",Hi({loader:()=>Zn(null,null,function*(){try{return(yield vs(()=>import("./index11-LAXRObvM.js"),__vite__mapDeps([7,5]))).default}catch(_){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',_),Fs}}),loadingComponent:n3,delay:0}),n3),KN=Md("ViewportDeferredInfographicBlockNode",Hi({loader:()=>Zn(null,null,function*(){try{return(yield vs(()=>import("./index10-CrWPuYNH.js"),[])).default}catch(_){return console.warn('[markstream-vue] Failed to load InfographicBlockNode. Falling back to preformatted code rendering. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.',_),Fs}}),loadingComponent:t3,delay:0}),t3),GN=Md("ViewportDeferredD2BlockNode",Hi(()=>Zn(null,null,function*(){try{return(yield vs(()=>import("./index8-Cq4M-goM.js"),[])).default}catch(_){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',_),Fs}})),Fs),Fx={text:mo,paragraph:Ha,heading:Z1,code_block:av,list:fu,list_item:du,blockquote:Dp,table:Xd,definition_list:Pp,footnote:Hp,footnote_reference:ni,footnote_anchor:Yd,admonition:qp,vmr_container:zp,hardbreak:Ol,link:_s,image:Fl,thematic_break:Wp,math_inline:Gi,math_block:wE,strong:xs,emphasis:Ss,strikethrough:ws,highlight:si,insert:Ws,subscript:Hs,superscript:Ps,emoji:Ds,checkbox:ti,checkbox_input:ti,inline_code:as,html_inline:oi,reference:bs,html_block:Zd},YN=D(()=>A0()),Ox=D(()=>H4(S.codeBlockProps)),ZN=D(()=>H4(S.codeBlockProps,{omit:["langs"]})),Bx=D(()=>it(it({stream:S.codeBlockStream,darkTheme:S.codeBlockDarkTheme,lightTheme:S.codeBlockLightTheme,monacoOptions:S.codeBlockMonacoOptions,themes:S.themes,langs:p.value==="shiki"?S.langs:void 0,minWidth:S.codeBlockMinWidth,maxWidth:S.codeBlockMaxWidth},typeof ye.value=="boolean"?{showTooltips:ye.value}:{}),ZN.value)),Rx=D(()=>it(Ot(it({},Bx.value),{langs:S.langs}),Ox.value));function Dx(_){return typeof _=="boolean"?_:void 0}const XN=D(()=>{const _=S.codeBlockProps||{},H={},X=Dx(_.showLineNumbers);X!==void 0&&(H.showLineNumbers=X);const J=Dx(_.diffInline);J!==void 0&&(H.diffInline=J);const ce=(function(we){const Le=Number(we);return Number.isFinite(Le)&&Le>0?Le:void 0})(_.reservedHeightPx);return ce!==void 0&&(H.reservedHeightPx=ce),H}),QN=D(()=>it(it({stream:S.codeBlockStream,darkTheme:S.codeBlockDarkTheme,lightTheme:S.codeBlockLightTheme,themes:S.themes,langs:S.langs,minWidth:S.codeBlockMinWidth,maxWidth:S.codeBlockMaxWidth},typeof ye.value=="boolean"?{showTooltips:ye.value}:{}),Ox.value)),JN=D(()=>it({},S.mermaidProps||{})),Px=D(()=>it({},S.d2Props||{})),e9=D(()=>it({},S.infographicProps||{})),Zu=D(()=>({typewriter:f.value,fade:S.fade,customHtmlTags:nt.value.customHtmlTags})),t9=D(()=>it(it({},Zu.value),typeof ye.value=="boolean"?{showTooltip:ye.value}:{})),n9=D(()=>it(it({},Zu.value),typeof ye.value=="boolean"?{showTooltips:ye.value}:{})),o9=D(()=>it(it({},Zu.value),typeof ye.value=="boolean"?{showTooltips:ye.value}:{})),s9=D(()=>it(it({},Zu.value),typeof ye.value=="boolean"?{showTooltips:ye.value}:{}));function i9(_){return Array.isArray(_.children)&&_.children.length>0}const kh=D(()=>IN.value.map(_=>{var H,X,J,ce,we,Le,Fe,Ve;let Oe=(function(st){var pt,kt,Mt,Ct,Et,qt,Xt;if(st.type!=="code_block")return st;const In=st,Ko=[String((pt=In.language)!=null?pt:""),String((kt=In.loading)!=null?kt:""),String((Mt=In.diff)!=null?Mt:""),String((Ct=In.code)!=null?Ct:""),String((Et=In.originalCode)!=null?Et:""),String((qt=In.updatedCode)!=null?qt:""),String((Xt=In.raw)!=null?Xt:"")].join("\0"),Ro=Nt.get(In);if(Ro&&Ro.signature===Ko)return Ro.node;const $i=it({},In);return Nt.set(In,{signature:Ko,node:$i}),$i})(_.node);const Pe=bh(Oe);let je=Ux(Oe,Pe);if((Oe.type==="html_block"||Oe.type==="html_inline")&&je===Fx[Oe.type]){const st=Oe,pt=String((H=st.tag)!=null?H:"").trim().toLowerCase()||Y5(st.content);if(pt){const kt=sn.value[pt];if(es.value.has(pt)&&kt)je=kt,Oe=Ot(it({},st),{type:pt,tag:pt,content:FY(st.content,pt)});else if(Z5((X=st.content)!=null?X:st.raw,pt)){const Mt=String((ce=(J=st.content)!=null?J:st.raw)!=null?ce:"");Oe.type==="html_inline"?(je=mo,Oe={type:"text",content:Mt,raw:Mt}):(je=Ha,Oe={type:"paragraph",children:[{type:"text",content:Mt,raw:Mt}],raw:Mt})}}}const $e=Oe.type==="code_block"&&p.value==="pre"&&je===Fs&&!ng(sn.value,Pe);let He=it({},(function(st,pt,kt){const Mt=pt??bh(st);if(st.type==="code_block"){const Ct=Mt?ng(sn.value,Mt):void 0;if(kt&&p.value==="pre"&&!Ct&&kt===Fs)return XN.value;if(kt&&Mt&&kt===Ct)return Mt==="mermaid"?Wx(st):Mt==="infographic"?zx(st):Mt==="d2"||Mt==="d2lang"?Px.value:Rx.value;if(kt&&kt===sn.value.code_block)return Rx.value;if(ax(kt))return QN.value}return Mt==="mermaid"?Wx(st):Mt==="infographic"?zx(st):Mt==="d2"||Mt==="d2lang"?Px.value:st.type==="link"?t9.value:st.type==="list"?n9.value:st.type==="blockquote"?o9.value:st.type==="table"?s9.value:st.type==="code_block"?Bx.value:Zu.value})(Oe,Pe,je));const Xe=io.value?lc.value[_.index]:null;Oe.type==="code_block"&&Xe?.kind==="code-block"&&(He=Ot(it({},He),$e?{reservedHeightPx:(we=Xe.height)!=null?we:Xe.contentHeight}:{estimatedHeightPx:Xe.height,estimatedContentHeightPx:Xe.contentHeight,estimatedDiffInline:Xe.diffInline})),$e||Oe.type!=="code_block"||Pe!=="mermaid"||Gc(He.estimatedPreviewHeightPx)!=null||(He=Ot(it({},He),{estimatedPreviewHeightPx:Bm(Fm(String((Le=Oe.code)!=null?Le:"")))})),$e||Oe.type!=="code_block"||Pe!=="infographic"||Gc(He.estimatedPreviewHeightPx)!=null||(He=Ot(it({},He),{estimatedPreviewHeightPx:Rm(Om(String((Fe=Oe.code)!=null?Fe:"")))})),Oe.type==="math_block"&&(He=Ot(it({},He),{cacheScope:Qn}));const Ye=(function(st,pt){const kt=String(st.type);return!Kf(kt)&&sn.value[kt]===pt})(Oe,je),ct=Ye?H2(Oe,de.value):void 0;return Ot(it({},_),{node:Oe,component:je,bindings:He,customBindings:it(it({},ct??{}),He),rendersCustomNode:Ye,hasSlotChildren:i9(Oe),slotContent:String((Ve=Oe.content)!=null?Ve:""),isCodeBlock:Oe.type==="code_block",indexKey:`${YN.value}-${_.index}`,vnodeKey:`${$N.value}\0${_.index}\0${Oe.type}`})}));function bh(_){var H;return _?.type==="code_block"?String((H=_.language)!=null?H:"").trim().toLowerCase():""}function ng(_,H){const X=H.trim().toLowerCase();if(X)for(const J of[X,K1(X),oE(X)]){const ce=J&&_[J];if(ce)return ce}}function Hx(_,H,X,J){var ce,we;const Le=it({},_.value);return Gc(Le.estimatedPreviewHeightPx)==null&&(Le.estimatedPreviewHeightPx=J(X(String((ce=H?.code)!=null?ce:"")),void 0,Le.maxHeight==="none"?null:(we=Gc(Le.maxHeight))!=null?we:void 0)),Le}function Wx(_){return Hx(JN,_,Fm,Bm)}function zx(_){return Hx(e9,_,Om,Rm)}function Ux(_,H){if(!_)return Qy;const X=sn.value,J=X[String(_.type)];if(_.type==="code_block"){const ce=H??bh(_),we=ce?ng(X,ce):void 0;return we||(p.value==="pre"?X.code_block||Fs:ce==="mermaid"?X.mermaid||VN:ce==="infographic"?X.infographic||KN:ce==="d2"||ce==="d2lang"?X.d2||GN:J||X.code_block||cx.value)}return J||Fx[String(_.type)]||Qy}function og(_){s("click",_)}function r9(_){var H;(H=_.target)!=null&&H.closest("[data-node-index]")&&s("mouseover",_)}function l9(_){var H;(H=_.target)!=null&&H.closest("[data-node-index]")&&s("mouseout",_)}function qx(_){s("mouseover",_)}function jx(_){s("mouseout",_)}const la=oe(null),Es=oe(!1),Xu=oe(null),a9=D(()=>!(S.domMode!=="minimal"||G.value||S.fade!==!1||f.value||Es.value||Qe.value||zt.value||Bo.value||As.value||Re.value||Object.keys(sn.value).length!==0));let Qu,yc=null,sg=0,xh=0,wh=0;const Vx=["code_block","admonition","table","math_block","html_block","image","thematic_break"],c9=new Set(Vx),Kx=[".typewriter-cursor",".height-estimation-probes",...Vx.map(_=>`[data-node-type="${_}"]`),"script","style"].join(",");function Gx(_){if(!_||typeof _!="object")return!1;const H=_.type;return typeof H=="string"&&c9.has(H)}function _h(_){var H,X;if(!_||typeof _!="object")return 0;const J=_,ce=(X=(H=J.raw)!=null?H:J.content)!=null?X:J.code;if(typeof ce=="string")return ce.length;const we=J.children;if(Array.isArray(we))return we.reduce((Fe,Ve)=>Fe+_h(Ve),0);const Le=J.items;return Array.isArray(Le)?Le.reduce((Fe,Ve)=>Fe+_h(Ve),0):0}function Sh(){Qu&&(clearTimeout(Qu),Qu=void 0)}function ig(){sg+=1,yc!=null&&(ge?.(yc),yc=null)}function Ju(){ig(),sl(),la.value&&(la.value.style.visibility="hidden")}function u9(_){var H;if(_.nodeType!==Node.TEXT_NODE||!((H=_.textContent)!=null?H:"").trim())return!1;const X=_.parentElement;return!!X&&!X.closest(Kx)}function d9(_){let H=_.lastChild;for(;H;){if(u9(H))return H;if(H.nodeType===Node.ELEMENT_NODE){const X=H;if(!X.matches(Kx)&&X.lastChild){H=X.lastChild;continue}}for(;H&&H!==_&&!H.previousSibling;)H=H.parentNode;if(!H||H===_)break;H=H.previousSibling}return null}function Yx(){const _=kh.value;for(let H=_.length-1;H>=0;H--){const X=_[H];if(!X||Gx(X.node)||!gh(X.index))continue;const J=cn.get(X.index);if(!J)continue;const ce=d9(J);if(ce)return ce}return null}function sl(){Xu.value&&(Xu.value.classList.remove(o3),Xu.value=null)}function Ch(){if(d.value!=="simple"||!P||!Es.value||!L.value)return void sl();const _=Yx(),H=_?(function(X){var J;const ce=(J=X.parentElement)==null?void 0:J.closest(".text-node");return ce instanceof HTMLElement?ce:X.parentElement})(_):null;H!==Xu.value&&(sl(),H&&(H.classList.add(o3),Xu.value=H))}function Ah(){if(d.value!=="precise"||!P||!Es.value||yc!=null)return;const _=sg,H=()=>{yc=null,_===sg&&(function(){var X,J;if(d.value!=="precise"||!(P&&Es.value&&L.value&&la.value))return;const ce=L.value,we=la.value;we.style.visibility="hidden";const Le=Yx();if(!Le)return;let Fe=0,Ve=0,Oe=20,Pe=!1;if(Le?.textContent){const je=Le.textContent.length,$e=document.createRange();$e.setStart(Le,Math.max(0,je-1)),$e.setEnd(Le,je);const He=typeof $e.getClientRects=="function"?$e.getClientRects():void 0,Xe=(J=He?.[He.length-1])!=null?J:(X=Le.parentElement)==null?void 0:X.getBoundingClientRect();if(Xe){const Ye=vt("typewriterCursor.root.getBoundingClientRect",()=>ce.getBoundingClientRect());Fe=Xe.right-Ye.left+ce.scrollLeft,Ve=Xe.top-Ye.top+ce.scrollTop,Oe=Xe.height||Oe,Pe=!0}$e.detach()}Pe&&(we.style.transform=`translate(${Math.max(0,Fe)}px, ${Math.max(0,Ve)}px)`,we.style.height=`${Oe}px`,we.style.visibility="visible")})()};Te?yc=Te(H):H()}return et([Ze,()=>o.content,()=>o.nodes,()=>S.typewriter,lt],()=>Zn(null,null,function*(){var _,H;if(!P||G.value||!se.value)return;if(lt.value)return Es.value=!1,Sh(),void Ju();if((_=o.nodes)!=null&&_.length)return Es.value=!1,Sh(),Ju(),xh=((H=o.content)!=null?H:"").length,void(wh=Ze.value.length);const X=(function(){var Fe,Ve;return(Fe=o.nodes)!=null&&Fe.length?o.nodes.reduce((Oe,Pe)=>Oe+_h(Pe),0):((Ve=o.content)!=null?Ve:"").length})(),J=(function(){var Fe;return(Fe=o.nodes)!=null&&Fe.length?o.nodes.reduce((Ve,Oe)=>Ve+_h(Oe),0):Ze.value.length})(),ce=!Gx(Be.value[Be.value.length-1]),we=X>xh,Le=J>wh;if(!f.value||!ce||!we&&!Le)return f.value&&ce||(Es.value=!1,Ju()),xh=X,void(wh=J);xh=X,wh=J,Es.value=!0,d.value==="precise"&&la.value&&(la.value.style.visibility="hidden"),Sh(),yield yt(),d.value==="simple"?Ch():(sl(),Ah()),Qu=setTimeout(()=>{Qu=void 0,Es.value=!1},3e3)}),{flush:"post",immediate:!0}),et(Es,_=>Zn(null,null,function*(){_?(yield yt(),d.value!=="simple"?(sl(),d.value==="precise"&&Ah()):Ch()):Ju()}),{flush:"post"}),et(d,()=>Zn(null,null,function*(){if(P&&!G.value&&se.value&&Es.value){if(yield yt(),d.value==="simple")return ig(),void Ch();sl(),d.value!=="precise"?Ju():Ah()}}),{flush:"post"}),et([()=>te.value,()=>jo.start,()=>jo.end],()=>Zn(null,null,function*(){P&&!G.value&&se.value&&Es.value&&(yield yt(),d.value!=="simple"?(sl(),d.value==="precise"&&Ah()):Ch())}),{flush:"post"}),ho(()=>{Sh(),ig(),sl(),Bn.clear()}),(_,H)=>{const X=PI("NodeRenderer",!0);return C(G)?(x(!0),E(We,{key:0},rt(kh.value,J=>(x(),E(We,{key:J.vnodeKey},[J.rendersCustomNode?(x(),Se(Ho(J.component),Sn({key:0,ref_for:!0},J.customBindings,{node:J.node,loading:J.node.loading,"index-key":J.indexKey,"custom-id":S.customId,"is-dark":S.isDark,onClick:og,onMouseover:qx,onMouseout:jx,onCopy:H[0]||(H[0]=ce=>i(ce)),onHandleArtifactClick:H[1]||(H[1]=ce=>s("handleArtifactClick",ce))}),{default:Ie(()=>[J.hasSlotChildren?(x(),Se(X,Sn({key:0,ref_for:!0},vn.value,{nodes:J.node.children,"index-key":J.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):J.slotContent?(x(),Se(X,Sn({key:1,ref_for:!0},vn.value,{content:J.slotContent,final:!J.node.loading,"index-key":`${J.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ue("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(x(),Se(Ho(J.component),Sn({key:1,node:J.node,loading:J.node.loading,"index-key":J.indexKey},{ref_for:!0},J.bindings,{"custom-id":S.customId,"is-dark":S.isDark,onClick:og,onMouseover:qx,onMouseout:jx,onCopy:H[2]||(H[2]=ce=>i(ce)),onHandleArtifactClick:H[3]||(H[3]=ce=>s("handleArtifactClick",ce))}),null,16,["node","loading","index-key","custom-id","is-dark"]))],64))),128)):(x(),E("div",{key:1,ref_key:"containerRef",ref:L,class:Ue(["markstream-vue markdown-renderer",[{dark:S.isDark},{virtualized:zt.value},{"virtual-scroll-coordinated":qs.value},{"stable-layout":SN.value},{"typewriter-simple-cursor":Es.value&&d.value==="simple"}]]),"data-custom-id":S.customId,onClick:og,onMouseover:r9,onMouseout:l9},[js.value||zt.value?(x(),E(We,{key:0},[js.value?(x(),Se(Ese,{key:0,width:ui.value,"flow-root":zt.value||qs.value,"paragraph-node":Vn.value,"list-item-node":Kn.value,"list-node":Jn.value,"heading-nodes":Oo.value,"set-paragraph-wrapper":CN,"set-list-item-wrapper":AN,"set-list-wrapper":MN,"set-heading-wrapper":NN},null,8,["width","flow-root","paragraph-node","list-item-node","list-node","heading-nodes"])):ue("",!0),zt.value?(x(),E("div",{key:1,class:"node-spacer",style:on({height:`${S0.value}px`}),"aria-hidden":"true"},null,4)):ue("",!0)],64)):ue("",!0),a9.value?(x(!0),E(We,{key:1},rt(kh.value,J=>(x(),E(We,{key:J.vnodeKey},[gh(J.index)?(x(),Se(Ho(J.component),Sn({key:0,node:J.node,loading:J.node.loading,"index-key":J.indexKey},{ref_for:!0},J.bindings,{"custom-id":S.customId,"is-dark":S.isDark,onMouseover:H[4]||(H[4]=ce=>s("mouseover",ce)),onMouseout:H[5]||(H[5]=ce=>s("mouseout",ce)),onCopy:H[6]||(H[6]=ce=>i(ce)),onHandleArtifactClick:H[7]||(H[7]=ce=>s("handleArtifactClick",ce))}),null,16,["node","loading","index-key","custom-id","is-dark"])):ue("",!0)],64))),128)):(x(!0),E(We,{key:2},rt(kh.value,J=>(x(),E("div",{key:J.vnodeKey,ref_for:!0,ref:ce=>vh(J.index,ce),class:"node-slot","data-node-index":J.index,"data-node-type":J.node.type},[gh(J.index)?(x(),E("div",{key:0,ref_for:!0,ref:ce=>(function(we,Le){var Fe;Le||(function(je){const $e=`${A0()}-${je}`;let He=!1;for(const Xe of Array.from(Zs.keys())){const Ye=Qi.get(Xe);(Ye?.index===je||Xe===$e||Xe.startsWith(`${$e}-`))&&(Zs.delete(Xe),Qi.delete(Xe),He=!0)}He&&(ac(),Gn("async-node"))})(we),kr.delete(we),(function(je){var $e;const He=(($e=Jl.get(je))!=null?$e:0)+1;Jl.set(je,He)})(we);const Ve=tl.get(we);if(Ve){for(const je of Ve)lh(je);tl.delete(we)}if((function(je){const $e=Vt.get(je);$e&&(co?.unobserve($e),zn.delete($e),Vt.delete(je))})(we),!Le||!Ms.value)return Xi.delete(we),void Jl.delete(we);Xi.set(we,Le);const Oe=()=>{yh(we,Le)};queueMicrotask(Oe);const Pe=(co||typeof ResizeObserver>"u"||(co=new ResizeObserver(je=>{if(je.length)for(const $e of je){const He=zn.get($e.target),Xe=Vt.get(He??-1);He!=null&&Xe&&yh(He,Xe)}else xr()})),co);if(Pe&&(Vt.set(we,Le),zn.set(Le,we),Pe.observe(Le)),typeof window<"u"){const je=((Fe=Be.value[we])==null?void 0:Fe.type)==="code_block"?[16,80,240,800]:lt.value?[80]:[];if(je.length){const $e=je.map(He=>tx(He,Oe,"node-resize")).filter(He=>He!=null);$e.length&&tl.set(we,$e)}}})(J.index,ce),class:"node-content"},[J.isCodeBlock?J.rendersCustomNode?(x(),Se(Ho(J.component),Sn({key:1,ref_for:!0},J.customBindings,{node:J.node,loading:J.node.loading,"index-key":J.indexKey,"custom-id":S.customId,"is-dark":S.isDark,onCopy:H[12]||(H[12]=ce=>i(ce)),onHandleArtifactClick:H[13]||(H[13]=ce=>s("handleArtifactClick",ce))}),{default:Ie(()=>[J.hasSlotChildren?(x(),Se(X,Sn({key:0,ref_for:!0},vn.value,{nodes:J.node.children,"index-key":J.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):J.slotContent?(x(),Se(X,Sn({key:1,ref_for:!0},vn.value,{content:J.slotContent,final:!J.node.loading,"index-key":`${J.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ue("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(x(),Se(Ho(J.component),Sn({key:2,node:J.node,loading:J.node.loading,"index-key":J.indexKey},{ref_for:!0},J.bindings,{"custom-id":S.customId,"is-dark":S.isDark,onCopy:H[14]||(H[14]=ce=>i(ce)),onHandleArtifactClick:H[15]||(H[15]=ce=>s("handleArtifactClick",ce))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(x(),Se(Ua,{key:0,name:"fade",css:S.fade!==!1,appear:S.fade!==!1},{default:Ie(()=>[J.rendersCustomNode?(x(),Se(Ho(J.component),Sn({key:0,ref_for:!0},J.customBindings,{node:J.node,loading:J.node.loading,"index-key":J.indexKey,"custom-id":S.customId,"is-dark":S.isDark,onCopy:H[8]||(H[8]=ce=>i(ce)),onHandleArtifactClick:H[9]||(H[9]=ce=>s("handleArtifactClick",ce))}),{default:Ie(()=>[J.hasSlotChildren?(x(),Se(X,Sn({key:0,ref_for:!0},vn.value,{nodes:J.node.children,"index-key":J.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):J.slotContent?(x(),Se(X,Sn({key:1,ref_for:!0},vn.value,{content:J.slotContent,final:!J.node.loading,"index-key":`${J.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ue("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(x(),Se(Ho(J.component),Sn({key:1,node:J.node,loading:J.node.loading,"index-key":J.indexKey},{ref_for:!0},J.bindings,{"custom-id":S.customId,"is-dark":S.isDark,onCopy:H[10]||(H[10]=ce=>i(ce)),onHandleArtifactClick:H[11]||(H[11]=ce=>s("handleArtifactClick",ce))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1032,["css","appear"]))],512)):(x(),E("div",{key:1,class:"node-placeholder",style:on({height:`${f0(J.index)}px`})},null,4))],8,Ise))),128)),Es.value&&d.value==="precise"?(x(),E("span",{key:3,ref_key:"typewriterCursorRef",ref:la,class:"typewriter-cursor","aria-hidden":"true"},null,512)):ue("",!0),zt.value?(x(),E("div",{key:4,class:"node-spacer",style:on({height:`${C0.value}px`}),"aria-hidden":"true"},null,4)):ue("",!0)],42,Nse))}}})),[["__scopeId","data-v-a9489508"]]),zs=BE;zs.install=e=>{const t=new Set(["MarkdownRender","NodeRenderer",zs.__name,zs.name].filter(n=>!!n));for(const n of t)e.component(n,BE)};const eb=Object.freeze(Object.defineProperty({__proto__:null,default:zs},Symbol.toStringTag,{value:"Module"})),Lse={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},$se={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Fse={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Ose={key:3,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Bse={class:"admonition-title"},Rse=["aria-expanded","aria-controls"],Dse=["id"],qp=Mn(Je({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:t}){var n;const o=e,s=t,i=D(()=>{if(o.node.title&&o.node.title.trim().length)return o.node.title;const c=o.node.kind||"note";return c.charAt(0).toUpperCase()+c.slice(1)}),r=oe(!!o.node.collapsible&&!((n=o.node.open)==null||n));function l(){o.node.collapsible&&(r.value=!r.value)}const a=`admonition-${Math.random().toString(36).slice(2,9)}`;return(c,u)=>(x(),E("div",{class:Ue(["admonition",[`admonition-${o.node.kind}`]])},[w("div",{id:a,class:"admonition-legend"},[o.node.kind==="note"||o.node.kind==="info"?(x(),E("svg",Lse,[...u[1]||(u[1]=[w("circle",{cx:"12",cy:"12",r:"10"},null,-1),w("path",{d:"M12 16v-4"},null,-1),w("path",{d:"M12 8h.01"},null,-1)])])):o.node.kind==="tip"?(x(),E("svg",$se,[...u[2]||(u[2]=[w("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"},null,-1),w("path",{d:"M9 18h6"},null,-1),w("path",{d:"M10 22h4"},null,-1)])])):o.node.kind==="warning"||o.node.kind==="caution"?(x(),E("svg",Fse,[...u[3]||(u[3]=[w("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"},null,-1),w("path",{d:"M12 9v4"},null,-1),w("path",{d:"M12 17h.01"},null,-1)])])):o.node.kind==="danger"||o.node.kind==="error"?(x(),E("svg",Ose,[...u[4]||(u[4]=[w("polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"},null,-1),w("path",{d:"M12 8v4"},null,-1),w("path",{d:"M12 16h.01"},null,-1)])])):ue("",!0),w("span",Bse,R(i.value),1),o.node.collapsible?(x(),E("button",{key:4,class:"admonition-toggle","aria-expanded":!r.value,"aria-controls":`${a}-content`,onClick:l},[(x(),E("svg",{style:on({rotate:r.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...u[5]||(u[5]=[w("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,Rse)):ue("",!0)]),qn(w("div",{id:`${a}-content`,class:"admonition-content","aria-labelledby":a},[ae(C(zs),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,fade:o.fade,onCopy:u[0]||(u[0]=d=>s("copy",d))},null,8,["index-key","nodes","custom-id","typewriter","fade"])],8,Dse),[[xi,!r.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);qp.install=e=>{e.component(qp.__name,qp)};const ok=()=>vs(()=>import("./d2_markstream-vue-yoD6TSFD.js"),[]);let rp=null,lp=ok,ap=null,s3=!1,i3=!1;function u3e(){return Zn(this,null,function*(){if(rp)return rp;const e=lp;return e?e===ok&&s3?null:ap||(ap=Zn(null,null,function*(){let t;try{t=yield e()}catch(n){if(e===ok)return e===lp&&(s3=!0,(function(o){i3||(i3=!0,console.warn('[markstream-vue] Optional dependency "@terrastruct/d2" is not installed. D2 blocks will render as source.',o))})(n)),null;throw n}finally{e===lp&&(ap=null)}return e!==lp?null:t?(rp=(function(n){var o;if(!n)return n;if(n.D2&&typeof n.D2=="function")return n.D2;if(n.default&&n.default.D2&&typeof n.default.D2=="function")return n.default.D2;const s=(o=n.default)!=null?o:n;return typeof s=="function"?s:s?.D2&&typeof s.D2=="function"?s.D2:s})(t),rp):null}),ap):null})}let cp=null,RE=null,up=null;function d3e(){return typeof RE=="function"}function f3e(){return Zn(this,null,function*(){if(cp)return cp;const e=RE;return e?up||(up=Zn(null,null,function*(){const t=yield e(),n=(function(o){var s,i,r;if(!o)return null;const l=(s=o.default)!=null?s:o,a=typeof l=="function"&&typeof((i=l.prototype)==null?void 0:i.render)=="function"?l:(r=o.Infographic)!=null?r:l?.Infographic;return typeof a=="function"?a:null})(t);return n?(cp=n,cp):null}).finally(()=>{up=null}),up):null})}const h3e=Symbol("markstreamLanguageIconResolver"),dp=oe(!1);let r3=!1;function kv(){const e=document.documentElement.dataset.colorScheme;return e==="dark"?!0:e==="light"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}function Pse(){return!r3&&typeof window<"u"&&typeof document<"u"&&(r3=!0,dp.value=kv(),new MutationObserver(()=>{dp.value=kv()}).observe(document.documentElement,{attributes:!0,attributeFilter:["data-color-scheme"]}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{dp.value=kv()})),dp}const DE=["cjs","css","csv","gif","htm","html","jpeg","jpg","js","json","jsx","log","md","mjs","pdf","png","scss","svg","ts","tsx","txt","vue","webp","xml","yaml","yml"],Hse=new Set(["AGENTS.md","CHANGELOG.md","Dockerfile","LICENSE","Makefile","README.md","package.json","pnpm-lock.yaml","pnpm-workspace.yaml","tsconfig.json","vite.config.ts"]),sk=[...DE].sort((e,t)=>t.length-e.length).join("|"),bv=new RegExp([String.raw`(?:^|[\s([{"'`+"`"+String.raw`])`,String.raw`(`,String.raw`(?:~|\.{1,2}|/)?(?:[A-Za-z0-9_.@+()[\]-]+/)+[A-Za-z0-9_.@+()[\]-]+(?:\.(?:${sk}))?`,String.raw`|`,String.raw`[A-Za-z0-9_.@+()[\]-]+\.(?:${sk})`,String.raw`)`,String.raw`(?:#L?(\d+)|:(\d+))?`,String.raw`(?=$|[\s)"'\]}>.,;!?,。;!?)])`].join(""),"gi"),PE=/[),.;!?,。;!?)]+$/;function Wse(e){const t=e.toLowerCase();return DE.some(n=>t.endsWith(`.${n}`))}function zse(e){const t=new Map,n=new RegExp(String.raw`\b(?:path|src)=["'](\/[^"']+\.(?:${sk}))["']`,"gi");let o;for(;(o=n.exec(e))!==null;){const s=o[1];if(!s)continue;const i=s.split("/").pop();i&&t.set(i,s)}return t}function Use(e,t={}){const n=e.trim();if(!n||/^[a-z][a-z0-9+.-]*:\/\//i.test(n))return null;const o=n.match(/^(.*?)(?:#L?(\d+)|:(\d+))?$/i);if(!o)return null;let s=(o[1]??"").replace(PE,"");if(!s)return null;const i=s.split("/").pop()??s,r=s.includes("/"),l=Hse.has(i),a=Wse(i);if(r&&!l&&!a)return null;if(!r&&!l){const d=t.aliases?.get(i);if(!d)return null;s=d}const c=o[2]??o[3],u=c?Number(c):void 0;return{path:s,line:u!==void 0&&Number.isFinite(u)&&u>0?u:void 0}}function qse(e,t={}){const n=[];bv.lastIndex=0;let o;for(;(o=bv.exec(e))!==null;){const s=o[0]??"",i=o[1]??"",r=s.indexOf(i);if(r<0)continue;const l=o[2]??o[3];let a=i+(l?s.slice(r+i.length):"");const c=a.replace(PE,""),u=a.length-c.length;a=c;const d=Use(a,t);if(!d)continue;const f=o.index+r,h=f+a.length;n.push({...d,start:f,end:h,text:a}),u>0&&(bv.lastIndex-=u)}return n}const jse=12e4,Vse=6e4,Kse=32,Gse=3e4,l3=/(^|\n)(`{3,}|~{3,})[^\n]*\n([\s\S]*?)(?:\n)?\2(?=\n|$)/g;function Yse(e){let t=0,n=0,o=0;l3.lastIndex=0;let s;for(;(s=l3.exec(e))!==null;){const r=s[3]??"";t+=1,n+=r.length,o=Math.max(o,r.length)}return{codeRenderer:e.length>=jse||n>=Vse||t>=Kse||o>=Gse?"pre":"shiki",codeFenceCount:t,codeChars:n}}function Zse(e){return new Worker("/assets/katexRenderer.worker-CO_gEm4q.js",{type:"module",name:e?.name})}function Xse(e){return new Worker("/assets/mermaidParser.worker-Dx4jPi9z.js",{type:"module",name:e?.name})}const Qse={key:1,class:"diff-wrap"},Jse={class:"diff-bar"},eie=["aria-label","onClick"],tie={class:"diff-pre"},nie={key:0,class:"diff-sign"},oie={class:"diff-text"},sie="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",a3="github-light",c3="github-dark",iie=Je({__name:"Markdown",props:{text:{},openFile:{},streaming:{type:Boolean,default:!1}},setup(e){hte(),Ate(),mte(),Tte(),pte(new Zse),Ete(new Xse);function t(W){return W.inline.ruler.disable("math"),W}const{t:n}=$t(),o=Jt("resolveImage"),s=oe(null),i=e,r=D(()=>!i.streaming),l=D(()=>zse(i.text??"")),a=D(()=>i.streaming?{codeRenderer:"shiki",codeFenceCount:0,codeChars:0}:Yse(i.text??"")),c=Pse(),u=D(()=>!i.streaming),d=zo(new Map),f=new Set,h=/(!\[[^\]]*\]\()\s*([^)\s]+)([^)]*\))/g,p=/(<img\b[^>]*?\bsrc=")([^"]+)(")/gi;function m(W){return!/^(https?:|data:|blob:)/i.test(W)}function y(W){if(!o)return;const z=[];for(const L of[h,p]){L.lastIndex=0;let O;for(;(O=L.exec(W))!==null;)z.push(O[2]??"")}for(const L of z)!L||!m(L)||d.has(L)||f.has(L)||(f.add(L),o(L).then(O=>{d.set(L,O!==L?O:"")}).catch(()=>{d.set(L,"")}).finally(()=>{f.delete(L)}))}function k(W){if(!o)return W;const z=L=>{if(!m(L))return null;const O=d.get(L);return O===void 0?sie:O===""?null:O};return W.replace(h,(L,O,U,Z)=>{const ie=z(U);return ie===null?L:`${O}${ie}${Z}`}).replace(p,(L,O,U,Z)=>{const ie=z(U);return ie===null?L:`${O}${ie}${Z}`})}et(()=>i.text,W=>y(W??""),{immediate:!0});function g(){if(!s.value||!i.openFile||i.streaming)return;const W=document.createTreeWalker(s.value,NodeFilter.SHOW_TEXT),z=[];let L=W.nextNode();for(;L;){const O=L,U=O.parentElement;U&&!U.closest("a, pre, .md-file-link, svg")&&O.data.trim().length>0&&z.push(O),L=W.nextNode()}for(const O of z){const U=qse(O.data,{aliases:l.value});if(U.length===0||!O.parentNode)continue;const Z=document.createDocumentFragment();let ie=0;for(const q of U){q.start>ie&&Z.append(document.createTextNode(O.data.slice(ie,q.start)));const ee=document.createElement("button");ee.type="button",ee.className="md-file-link",ee.textContent=q.text,ee.title=q.line?`${q.path}:${q.line}`:q.path,ee.addEventListener("click",fe=>{fe.preventDefault(),fe.stopPropagation(),i.openFile?.({path:q.path,line:q.line})}),Z.append(ee),ie=q.end}ie<O.data.length&&Z.append(document.createTextNode(O.data.slice(ie))),O.parentNode.replaceChild(Z,O)}}function v(W){return!(!W||/^(https?:|mailto:|tel:|data:|blob:|#)/i.test(W))}function b(W){let z=W.length;for(const L of["#","?"]){const O=W.indexOf(L);O!==-1&&O<z&&(z=O)}return W.slice(0,z)}function A(){if(!s.value||!i.openFile||i.streaming)return;const W=s.value.querySelectorAll("a[href]");for(const z of W){if(z.dataset.mdLinkHandled==="true"||z.closest("svg"))continue;const L=z.getAttribute("href")??"";v(L)&&(z.dataset.mdLinkHandled="true",z.addEventListener("click",O=>{O.preventDefault(),O.stopPropagation(),i.openFile?.({path:b(L)})}))}}function I(){yt().then(()=>{g(),A()})}et(()=>i.text,I),et(()=>i.streaming,I);let N=null;An(()=>{I(),s.value&&(N=new MutationObserver(I),N.observe(s.value,{childList:!0,subtree:!0}))}),On(()=>{N?.disconnect()});const M={showHeader:!0,showCopyButton:!0,showExpandButton:!1,showPreviewButton:!1,showCollapseButton:!1,showFontSizeButtons:!1,loading:!1,monacoOptions:{lineNumbers:!1,fontSize:13,fontFamily:"var(--font-mono)",padding:{top:12,bottom:12}}},$=/(^|\n)(?:```|~~~)diff\b[^\n]*\n([\s\S]*?)(?:\n)?(?:```|~~~)(?=\n|$)/g,T=D(()=>{const W=k(i.text??""),z=[];let L=0;$.lastIndex=0;let O;for(;(O=$.exec(W))!==null;){const Z=O[1]??"",ie=W.slice(L,O.index)+(Z||"");ie.trim()&&z.push({kind:"md",text:ie}),z.push({kind:"diff",code:O[2]??""}),L=$.lastIndex}const U=W.slice(L);return(U.trim()||z.length===0)&&z.push({kind:"md",text:U}),z});function F(W){return W.split(`
298
298
  `).map(z=>z.startsWith("@@")?{type:"hunk",sign:"",text:z}:/^\+(?!\+\+)/.test(z)?{type:"add",sign:"+",text:z.slice(1)}:/^-(?!--)/.test(z)?{type:"del",sign:"-",text:z.slice(1)}:z.startsWith(" ")?{type:"ctx",sign:"",text:z.slice(1)}:{type:"ctx",sign:"",text:z})}const S=oe(null);function B(W,z){Jo(W).then(L=>{L&&(S.value=z,setTimeout(()=>{S.value=null},1400))})}return(W,z)=>(x(),E("div",{ref_key:"mdRef",ref:s,class:"md"},[(x(!0),E(We,null,rt(T.value,(L,O)=>(x(),E(We,{key:O},[L.kind==="md"?(x(),Se(C(zs),{key:0,content:L.text,"custom-markdown-it":t,mode:"chat","code-renderer":a.value.codeRenderer,"is-dark":C(c),"code-block-light-theme":a3,"code-block-dark-theme":c3,themes:[a3,c3],"code-block-props":M,final:r.value,"smooth-streaming":e.streaming,"batch-rendering":u.value,"defer-nodes-until-visible":!1,onCopy:C(TF)},null,8,["content","code-renderer","is-dark","themes","final","smooth-streaming","batch-rendering","onCopy"])):(x(),E("div",Qse,[w("div",Jse,[z[0]||(z[0]=w("span",{class:"diff-lang"},"diff",-1)),ae(an,{text:C(n)("filePreview.copyCode")},{default:Ie(()=>[w("button",{class:"diff-copy","aria-label":C(n)("filePreview.copyCode"),onClick:U=>B(L.code,O)},[ae(Ge,{name:S.value===O?"check":"copy",size:"sm"},null,8,["name"])],8,eie)]),_:2},1032,["text"])]),w("pre",tie,[w("code",null,[(x(!0),E(We,null,rt(F(L.code),(U,Z)=>(x(),E("span",{key:Z,class:Ue(["diff-line",`diff-${U.type}`])},[U.type!=="hunk"?(x(),E("span",nie,R(U.sign),1)):ue("",!0),w("span",oie,R(U.text),1)],2))),128))])])]))],64))),128))],512))}}),Q1=dt(iie,[["__scopeId","data-v-76651151"]]),rie={class:"tc-anim"},lie={class:"prev-anim"},aie={class:"prev"},cie=Je({__name:"ThinkingBlock",props:{text:{},mobile:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1},foldable:{type:Boolean,default:!0}},emits:["open"],setup(e,{emit:t}){const n=e,o=t,s=D(()=>n.text.split(/\n{2,}/).filter(c=>c.trim().length>0)),i=D(()=>n.foldable&&s.value.length>1),r=D(()=>n.streaming||!i.value),l=D(()=>s.value.at(-1)??""),a=oe(null);return An(()=>{if(!n.streaming)return;const c=a.value;c&&(c.scrollTop=c.scrollHeight)}),et(()=>n.text,()=>{const c=a.value;!c||!(c.scrollHeight-c.scrollTop-c.clientHeight<24)||yt(()=>{a.value&&(a.value.scrollTop=a.value.scrollHeight)})},{immediate:!0}),(c,u)=>(x(),E("div",{class:Ue(["think",{mob:e.mobile}])},[i.value?(x(),E("div",{key:0,class:Ue(["tc-wrap",{"is-collapsed":!r.value}]),onClick:u[0]||(u[0]=d=>o("open"))},[w("div",rie,[w("pre",{ref_key:"bodyEl",ref:a,class:"tc"},R(e.text),513)]),w("div",lie,[w("span",aie,R(l.value),1)])],2)):(x(),E("pre",{key:1,ref_key:"bodyEl",ref:a,class:"tc"},R(e.text),513))],2))}}),uie=dt(cie,[["__scopeId","data-v-fdc551ea"]]),die={class:"activity-notice",role:"status"},fie={"aria-hidden":"true"},hie={class:"an-label"},pie=Je({__name:"ActivityNotice",props:{label:{}},setup(e){return(t,n)=>(x(),E("div",die,[w("span",fie,[ae(Us,{size:"sm"})]),w("span",hie,R(e.label),1)]))}}),mie=dt(pie,[["__scopeId","data-v-0d497074"]]);function gie(e,t="昨天"){try{const n=new Date(e);if(Number.isNaN(n.getTime()))return e;const o=new Date,s=u=>String(u).padStart(2,"0"),i=`${s(n.getHours())}:${s(n.getMinutes())}`,r=n.getFullYear()===o.getFullYear(),l=n.getMonth()===o.getMonth(),a=n.getDate()===o.getDate();if(r&&l&&a)return i;const c=new Date(o);return c.setDate(o.getDate()-1),n.getFullYear()===c.getFullYear()&&n.getMonth()===c.getMonth()&&n.getDate()===c.getDate()?`${t} ${i}`:r?`${s(n.getMonth()+1)}-${s(n.getDate())} ${i}`:`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${i}`}catch{return e}}const vie=Je({__name:"MessageTime",props:{time:{}},setup(e){const t=e,{t:n}=$t(),o=oe(!1),s=D(()=>{const l=new Date(t.time);if(Number.isNaN(l.getTime()))return t.time;const a=c=>String(c).padStart(2,"0");return`${l.getFullYear()}-${a(l.getMonth()+1)}-${a(l.getDate())} ${a(l.getHours())}:${a(l.getMinutes())}`}),i=D(()=>o.value?s.value:gie(t.time,n("conversation.yesterday")));function r(){o.value=!o.value}return(l,a)=>(x(),E("button",{type:"button",class:"msg-time",onClick:St(r,["stop"])},R(i.value),1))}}),HE=dt(vie,[["__scopeId","data-v-9672fbd5"]]);function yie(e){return e.length===1?`0${e}`:e}function kie(e,t){return`${String(Number(e))}:${yie(t)}`}const u3=e=>/^\d+$/.test(e);function bie(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[o,s,i,r,l]=n,a=i==="*"&&r==="*"&&l==="*",c=i==="*"&&r==="*";if(o==="*"&&s==="*"&&a)return t("conversation.cron.everyMinute");const u=/^\*\/(\d+)$/.exec(o);if(u&&s==="*"&&a)return u[1]==="1"?t("conversation.cron.everyMinute"):t("conversation.cron.everyNMinutes",{n:u[1]});if(o==="0"&&s==="*"&&a)return t("conversation.cron.everyHour");const d=/^\*\/(\d+)$/.exec(s);if(o==="0"&&d&&a)return t("conversation.cron.everyNHours",{n:d[1]});if(u3(o)&&u3(s)&&c){const f=kie(s,o);if(l==="1-5")return t("conversation.cron.weekdaysAt",{time:f});if(l==="*")return t("conversation.cron.dailyAt",{time:f})}return e}const xie=["data-turn-id"],wie={class:"cn-bubble"},_ie={class:"cn-title"},Sie={key:0,class:"cn-prompt"},Cie={class:"cn-meta"},Aie={key:0,class:"cn-meta-item"},Mie={key:1,class:"cn-meta-item"},Eie=["aria-label"],Tie=["title"],Nie=Je({__name:"CronNotice",props:{text:{},cron:{},turnId:{},createdAt:{}},setup(e){const t=e,{t:n}=$t(),o=D(()=>t.cron),s=D(()=>o.value?.missedCount!==void 0),i=D(()=>s.value?n("conversation.cron.missed"):n("conversation.cron.fired")),r=D(()=>{const u=o.value?.cron;return u?bie(u,n):""}),l=D(()=>s.value?"error":"ok"),a=D(()=>{const u=o.value;if(!u)return"";const d=[];return u.recurring===!1&&d.push(n("conversation.cron.oneShot")),typeof u.coalescedCount=="number"&&u.coalescedCount>1&&d.push(n("conversation.cron.coalesced",{n:u.coalescedCount})),u.missedCount!==void 0&&d.push(n("conversation.cron.missedCount",{n:u.missedCount})),u.stale===!0&&d.push(n("conversation.cron.finalDelivery")),d.join(" · ")}),c=D(()=>t.text??"");return(u,d)=>(x(),E("div",{class:Ue(["cn cron-notice",{"turn-anchor":!!e.turnId}]),"data-turn-id":e.turnId,role:"status"},[w("div",wie,[w("span",_ie,R(i.value),1),c.value?(x(),E("span",Sie,R(c.value),1)):ue("",!0)]),w("div",Cie,[ae(Ge,{name:"clock",size:"sm",class:"cn-meta-ico","aria-hidden":"true"}),r.value?(x(),E("span",Aie,R(r.value),1)):ue("",!0),a.value?(x(),E("span",Mie,R(a.value),1)):ue("",!0),w("span",{class:Ue(["cn-status",l.value]),"aria-label":l.value},[l.value==="ok"?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):(x(),Se(Ge,{key:1,name:"close",size:"sm"}))],10,Eie),o.value?.jobId?(x(),E("span",{key:2,class:"cn-meta-item cn-id",title:C(n)("conversation.cron.job",{id:o.value.jobId})},R(o.value.jobId),9,Tie)):ue("",!0),e.createdAt?(x(),Se(HE,{key:3,time:e.createdAt},null,8,["time"])):ue("",!0)])],10,xie))}}),Iie=dt(Nie,[["__scopeId","data-v-a62a6587"]]),Lie=["app:load:start","app:load:complete","export:start","export:accepted","export:failed","prompt:start","prompt:accepted","prompt:failed","session:snapshot:start","session:snapshot:accepted","session:snapshot:failed","operation:failed","window:error","window:unhandled-rejection","ws:connection","ws:error","ws:resync","ws:stale-reconnect"],WE=500,Vm=256*1024,d3=200,xv=16384,wv=500,_v=50,Sv=50,$ie=6,Fie=/api[_-]?key|authorization|token|secret|password|cookie|credential/i,Oie=/^[A-Za-z0-9+/=_-]{200,}$/;let Cv=null;function Yi(){if(Cv!==null)return Cv;let e=!1;try{if(typeof location<"u"){const t=new URLSearchParams(location.search).get("debug");(t==="1"||t==="true")&&(e=!0)}}catch{}return e||(e=yo(Dt.debug)==="1"),Cv=e,e}const Bl=[],Zc=[];let Ed=0;const Ca=[];let Td=0,Bie=1;const Km=new TextEncoder,Rie=new Set(Lie),tb=oe(0),Nd=gr(!1);function Die(){return Bl}function Pie(){Bl.length=0,Zc.length=0,Ed=0,Ca.length=0,Td=0,tb.value++}function Jr(e){if(!Nd.value){try{const t={id:Bie++,ts:Date.now(),source:e.source,kind:String(hu(e.kind)),label:String(hu(e.label)),sessionId:e.sessionId===void 0?void 0:String(hu(e.sessionId)),method:e.method,path:e.path,eventType:e.eventType,seq:e.seq,offset:e.offset,status:e.status,code:e.code,requestId:e.requestId,durationMs:e.durationMs,detail:Zl(e.detail)},n=JSON.stringify(t),o=Km.encode(n).byteLength;if(o>Vm)return;for(Bl.push(t),Zc.push(n),Ed+=o+(Zc.length>1?1:0);Bl.length>WE||Ed>Vm;){const s=Zc.shift();Bl.shift(),s!==void 0&&(Ed-=Km.encode(s).byteLength,Zc.length>0&&(Ed-=1))}}catch{return}tb.value++}}function va(e){if(typeof e=="string")return e.length<=d3?e:e.slice(0,d3)}function mi(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Hie(e,t){if(Rie.has(e))try{const n={ts:Date.now(),event:e,sessionId:va(t?.sessionId),status:va(t?.status),operation:va(t?.operation),seq:mi(t?.seq),durationMs:mi(t?.durationMs),messageCount:mi(t?.messageCount),contentCount:mi(t?.contentCount),mediaCount:mi(t?.mediaCount),sessionCount:mi(t?.sessionCount),workspaceCount:mi(t?.workspaceCount),promptId:va(t?.promptId),zipBytes:mi(t?.zipBytes),errorName:va(t?.errorName),errorCode:mi(t?.errorCode),requestId:va(t?.requestId),phase:va(t?.phase),httpStatus:mi(t?.httpStatus),fatal:typeof t?.fatal=="boolean"?t.fatal:void 0,line:mi(t?.line),col:mi(t?.col)},o=JSON.stringify(n),s=Km.encode(o).byteLength;if(s>Vm)return;for(Ca.push(o),Td+=s+(Ca.length>1?1:0);Ca.length>WE||Td>Vm;){const i=Ca.shift();i!==void 0&&(Td-=Km.encode(i).byteLength,Ca.length>0&&(Td-=1))}}catch{return}}function hu(e,t=0){if(e==null)return e;const n=typeof e;if(n==="number"||n==="boolean")return e;if(n==="string"){const i=e;return Oie.test(i)?`[base64-like, ${i.length} chars omitted]`:i.length>wv?`${i.slice(0,wv)}… [+${i.length-wv} chars]`:i}if(n!=="object")return String(e);if(t>=$ie)return"[max depth]";if(Array.isArray(e)){const i=e.slice(0,_v).map(r=>hu(r,t+1));return e.length>_v&&i.push(`[+${e.length-_v} more items]`),i}const o={},s=Object.entries(e);for(const[i,r]of s.slice(0,Sv))o[i]=Fie.test(i)?"[redacted]":hu(r,t+1);return s.length>Sv&&(o._truncatedKeys=s.length-Sv),o}function Zl(e){if(e===void 0)return;const t=hu(e);try{const n=JSON.stringify(t);if(n!==void 0&&n.length>xv)return{_truncated:`detail JSON was ${n.length} chars; first ${xv} kept`,preview:n.slice(0,xv)}}catch{return"[unserializable detail]"}return t}function fp(e){Yi()&&Jr({source:"rest",kind:"rest:request",label:`→ ${e.method} ${e.path}`,method:e.method,path:e.path,requestId:e.requestId,detail:{url:e.url,body:Zl(e.body)}})}function Tc(e){if(!Yi())return;const t=e.code!==0;Jr({source:"rest",kind:t?"rest:error":"rest:response",label:`← ${e.method} ${e.path} ${e.status} code=${e.code}${t?` "${e.msg}"`:""} ${Math.round(e.durationMs)}ms`,method:e.method,path:e.path,requestId:e.requestId,status:e.status,code:e.code,durationMs:e.durationMs,detail:{envelope:{code:e.code,msg:e.msg,request_id:e.envelopeRequestId},data:Zl(e.data)}})}function pl(e){Yi()&&Jr({source:"rest",kind:"rest:error",label:`✕ ${e.method} ${e.path} ${e.phase} error${e.status!==void 0?` (HTTP ${e.status})`:""} ${Math.round(e.durationMs)}ms`,method:e.method,path:e.path,requestId:e.requestId,status:e.status,durationMs:e.durationMs,detail:{phase:e.phase,error:String(e.error)}})}function Nc(e,t){Yi()&&Jr({source:"ws",kind:"ws:lifecycle",eventType:e,label:`ws ${e}`,detail:Zl(t)})}function Wie(e){if(!Yi())return;const t=e??{},n=typeof t.type=="string"?t.type:"(unknown)",o=t.payload,s=typeof o?.session_id=="string"?o.session_id:void 0;Jr({source:"ws",kind:"ws:out",eventType:n,sessionId:s,label:`→ ${n}`,detail:Zl(e)})}function zie(e){if(!Yi())return;const t=e??{},n=typeof t.type=="string"?t.type:"(unknown)",o=typeof t.session_id=="string"?t.session_id:typeof t.payload?.session_id=="string"?t.payload.session_id:void 0,s=typeof t.seq=="number"?t.seq:void 0,i=typeof t.offset=="number"?t.offset:void 0,r=[o,s!==void 0?`seq=${s}`:void 0,i!==void 0?`offset=${i}`:void 0,t.volatile===!0?"volatile":void 0].filter(Boolean);Jr({source:"ws",kind:"ws:in",eventType:n,sessionId:o,seq:s,offset:i,label:`← ${n}${r.length>0?` (${r.join(" ")})`:""}`,detail:Zl(t.payload)})}const Uie={error:"✕",warn:"⚠",info:"ℹ",debug:"·",log:"·"};function qie(e,t,n){Yi()&&Jr({source:"client",kind:`client:${e}`,label:`${Uie[e]} ${t}`,detail:Zl(n)})}function Rr(e,t){Yi()&&Jr({source:"client",kind:"client:event",label:`· ${e}`,detail:Zl(t)})}function _o(e,t){Hie(e,t),Jr({source:"client",kind:"client:key",label:e,sessionId:typeof t?.sessionId=="string"?t.sessionId:void 0,seq:typeof t?.seq=="number"?t.seq:void 0,durationMs:typeof t?.durationMs=="number"?t.durationMs:void 0,detail:t})}let Av=!1,hp=null;function jie(){if(Av)return()=>hp?.();Av=!0;const e=[];try{if(typeof window<"u"){const n=s=>{_o("window:error",{status:"failed",errorName:s.error instanceof Error?s.error.name:"Error",line:s.lineno,col:s.colno})},o=s=>{const i=s.reason;_o("window:unhandled-rejection",{status:"failed",errorName:i instanceof Error?i.name:typeof i})};window.addEventListener("error",n),window.addEventListener("unhandledrejection",o),e.push(()=>{window.removeEventListener("error",n)}),e.push(()=>{window.removeEventListener("unhandledrejection",o)})}}catch{}if(Yi())for(const n of["error","warn","log","info","debug"]){const o=console[n];if(typeof o!="function")continue;const s=(...i)=>{try{qie(n,i.map(Vie).join(" "),i.length>1?i:i[0])}catch{}o.apply(console,i)};console[n]=s,e.push(()=>{console[n]===s&&(console[n]=o)})}const t=()=>{if(hp===t){for(const n of e.toReversed())n();hp=null,Av=!1}};return hp=t,t}function Vie(e){if(typeof e=="string")return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)}catch{return String(e)}}function zE(e=Bl){if(typeof document>"u")return;const t=new Blob([Kie(e)],{type:"application/x-ndjson"}),n=URL.createObjectURL(t);let o;try{o=document.createElement("a"),o.href=n,o.download=`kimi-web-log-${new Date().toISOString().replaceAll(/[:.]/g,"-")}.jsonl`,document.body.append(o),o.click()}finally{o?.remove(),setTimeout(()=>{try{URL.revokeObjectURL(n)}catch{}},0)}}function Kie(e=Bl){return e===Bl?Zc.join(`
299
299
  `):e.map(t=>JSON.stringify(t)).join(`
300
300
  `)}function Gie(){return Ca.join(`
@@ -310,7 +310,7 @@ ${Q}`)}const Ae=he.join(`
310
310
  `)}function O(){for(let he=i.turns.length-1;he>=0;he-=1)if(i.turns[he]?.role==="assistant")return L(he);return""}function U(){const he=O();he.trim()&&Jo(he).then(Ae=>{Ae&&(S.value=!0,d("copyConversationCopied"),B!==null&&clearTimeout(B),B=setTimeout(()=>{B=null,S.value=!1},2e3))}).catch(()=>{})}t({copyConversation:W,copyFinalSummary:U});function Z(he){const Ae=i.turns[he];if(!Ae||Ae.role!=="assistant")return!1;const re=i.turns[he+1];return!re||re.role!=="assistant"}let ie=null;function q(he){const Ae=i.turns[he];if(!Ae)return;const re=L(he);re.trim()&&Jo(re).then(Y=>{Y&&(N.value=Ae.id,ie!==null&&clearTimeout(ie),ie=setTimeout(()=>{ie=null,N.value=null},1400))}).catch(()=>{})}function ee(he){const Ae=he.text;Ae.trim()&&Jo(Ae).then(re=>{re&&(N.value=he.id,ie!==null&&clearTimeout(ie),ie=setTimeout(()=>{ie=null,N.value=null},1400))}).catch(()=>{})}function fe(he){return{kind:he.kind==="video"?"video":"image",url:he.url,path:he.name,fileId:he.fileId}}const ne=oe(null);let j=null;function K(he){if(he.kind==="image"||he.kind==="video"){d("openMedia",fe(he));return}he.fileId!==void 0&&eT(he.fileId,he.name,he.mediaType).then(Ae=>{Ae==="unsupported"&&(ne.value=he.name??he.fileId??"",j!==null&&clearTimeout(j),j=setTimeout(()=>{j=null,ne.value=null},2400))})}function ve(he,Ae){return he.id!==c.value?!1:Ae.sourceIndex===$1(he).length-1}return(he,Ae)=>(x(),E(We,null,[w("div",cle,[e.sessionLoading?(x(),E("div",ule,[ae(Us,{size:"sm"}),w("span",dle,R(C(o)("conversation.loading")),1)])):e.turns.length===0&&(!e.approvals||e.approvals.length===0)?(x(),E("div",fle)):ue("",!0),e.hasMoreMessages||e.loadingMore?(x(),E("div",{key:2,ref_key:"topSentinelRef",ref:r,class:Ue(["top-sentinel",{"top-sentinel-loading":e.loadingMore}])},[e.loadingMore?(x(),E("span",hle,[ae(Us,{size:"sm"}),ot(" "+R(C(o)("conversation.loadingOlder")),1)])):(x(),E("button",{key:0,type:"button",class:"top-sentinel-btn",onClick:Ae[0]||(Ae[0]=re=>d("loadOlderMessages"))},R(C(o)("conversation.loadOlder")),1))],2)):ue("",!0),(x(!0),E(We,null,rt(e.turns,(re,Y)=>(x(),E(We,{key:re.id},[re.role==="user"?(x(),E("div",ple,[w("div",{class:Ue(["u-bub turn-anchor",{undoing:M.value===re.id}]),"data-turn-id":re.id},[re.attachments&&re.attachments.length>0?(x(),E("div",gle,[(x(!0),E(We,null,rt(re.attachments,(Q,P)=>(x(),Se(QE,{key:P,kind:Q.kind,name:Q.name,url:Q.url,"file-id":Q.fileId,"media-type":Q.mediaType,size:Q.size,onActivate:G=>K(Q)},null,8,["kind","name","url","file-id","media-type","size","onActivate"]))),128))])):ue("",!0),re.skillActivation?(x(),E("div",vle,[w("div",yle,[Ae[9]||(Ae[9]=w("span",{class:"skill-act-arrow"},"▶",-1)),w("span",null,R(C(o)("conversation.activatedSkill",{name:re.skillActivation.name})),1)]),re.skillActivation.args?(x(),E("div",kle,R(re.skillActivation.args),1)):ue("",!0)])):re.pluginCommand?(x(),E("div",ble,[w("div",xle,[Ae[10]||(Ae[10]=w("span",{class:"skill-act-arrow"},"▶",-1)),w("span",null,"/"+R(re.pluginCommand.pluginId)+":"+R(re.pluginCommand.commandName),1)]),re.pluginCommand.args?(x(),E("div",wle,R(re.pluginCommand.args),1)):ue("",!0)])):(x(),E("div",_le,R(re.text),1))],10,mle),re.createdAt||A(re)?(x(),E("div",Sle,[A(re)?(x(),E("div",{key:0,class:Ue(["u-edit-wrap",{undoing:M.value===re.id}])},[w("button",{type:"button",class:"u-edit","aria-label":C(o)("conversation.undoTooltip"),onClick:Q=>T(re)},[ae(Ge,{name:"undo",size:"sm"})],8,Cle)],2)):ue("",!0),re.text.trim().length>0?(x(),E("button",{key:1,type:"button",class:"u-copy","aria-label":C(o)("filePreview.copy"),onClick:St(Q=>ee(re),["stop"])},[N.value!==re.id?(x(),Se(Ge,{key:0,name:"copy",size:"sm"})):(x(),Se(Ge,{key:1,name:"check",size:"sm"}))],8,Ale)):ue("",!0),re.createdAt?(x(),Se(HE,{key:2,time:re.createdAt},null,8,["time"])):ue("",!0)])):ue("",!0)])):re.role==="compaction"?(x(),E("div",{key:1,class:"compact-divider turn-anchor","data-turn-id":re.id,role:"separator"},[Ae[11]||(Ae[11]=w("span",{class:"cd-line","aria-hidden":"true"},null,-1)),re.text?(x(),E("button",{key:0,type:"button",class:"cd-label cd-btn",onClick:Q=>d("openCompaction",{turnId:re.id})},[w("span",null,R(I(re)),1),w("span",Tle,R(C(o)("conversation.viewSummary")),1)],8,Ele)):(x(),E("span",Nle,R(I(re)),1)),Ae[12]||(Ae[12]=w("span",{class:"cd-line","aria-hidden":"true"},null,-1))],8,Mle)):re.role==="cron"?(x(),Se(Iie,{key:2,text:re.text,cron:re.cron,"turn-id":re.id,"created-at":re.createdAt},null,8,["text","cron","turn-id","created-at"])):(x(),E("div",{key:3,class:"a-msg turn-anchor","data-turn-id":re.id},[(x(!0),E(We,null,rt(C(bq)(re),(Q,P)=>(x(),E(We,{key:C(_q)(Q,P)},[Q.kind==="thinking"?(x(),Se(uie,{key:0,text:Q.thinking,mobile:"",streaming:ve(re,Q),onOpen:G=>d("openThinking",{turnId:re.id,blockIndex:Q.sourceIndex})},null,8,["text","streaming","onOpen"])):Q.kind==="text"&&Q.text?(x(),E("div",Lle,[ae(Q1,{text:Q.text,streaming:ve(re,Q),"open-file":G=>d("openFile",G)},null,8,["text","streaming","open-file"])])):Q.kind==="tool-stack"?(x(),Se(Nq,{key:2,tools:Q.tools,mobile:"","tool-diff-panel":e.toolDiffPanel,onOpenMedia:Ae[1]||(Ae[1]=G=>d("openMedia",G)),onOpenFile:Ae[2]||(Ae[2]=G=>d("openFile",G)),onOpenToolDiff:Ae[3]||(Ae[3]=G=>d("openToolDiff",G)),onOpenAgent:Ae[4]||(Ae[4]=G=>d("openAgent",G))},null,8,["tools","tool-diff-panel"])):Q.kind==="tool"?(x(),Se(A6,{key:3,tool:Q.tool,mobile:"","tool-diff-panel":e.toolDiffPanel,onOpenMedia:Ae[5]||(Ae[5]=G=>d("openMedia",G)),onOpenFile:Ae[6]||(Ae[6]=G=>d("openFile",G)),onOpenToolDiff:Ae[7]||(Ae[7]=G=>d("openToolDiff",G)),onOpenAgent:Ae[8]||(Ae[8]=G=>d("openAgent",G))},null,8,["tool","tool-diff-panel"])):ue("",!0)],64))),128)),re.id!==c.value&&Z(Y)&&(L(Y).trim().length>0||re.durationMs!==void 0)?(x(),E("div",$le,[ae(an,{text:`${re.durationMs} ms`},{default:Ie(()=>[re.durationMs!==void 0?(x(),E("span",Fle,R(C(vq)(re.durationMs)),1)):ue("",!0)]),_:2},1032,["text"]),L(Y).trim().length>0?(x(),E("button",{key:0,class:"a-cpbtn","aria-label":C(o)("filePreview.copy"),onClick:Q=>q(Y)},[N.value!==re.id?(x(),Se(Ge,{key:0,name:"copy",size:"sm"})):(x(),Se(Ge,{key:1,name:"check",size:"sm"}))],8,Ole)):ue("",!0)])):ue("",!0)],8,Ile))],64))),128)),e.compaction?(x(),Se(mie,{key:3,label:C(o)("conversation.compacting")},null,8,["label"])):ue("",!0),u.value?(x(),E("div",Ble,[ae(JE,{fast:e.fastMoon},null,8,["fast"])])):ue("",!0),e.queued.length>0?(x(),E("div",Rle,[w("div",Dle,[w("span",Ple,[ae(Ge,{name:"mail",size:"sm"}),ot(" "+R(C(o)("composer.queueLabel"))+" · ",1),w("b",null,R(e.queued.length),1)]),w("span",Hle,R(C(o)("composer.queueAutoDrain")),1)]),(x(!0),E(We,null,rt(e.queued,(re,Y)=>(x(),E("div",{key:Y,class:Ue(["u-turn q-turn",{"q-dragging":f.value===Y,"drop-before":h.value?.index===Y&&h.value.position==="before","drop-after":h.value?.index===Y&&h.value.position==="after"}]),onDragover:Q=>k(Y,Q),onDrop:Q=>g(Y,Q)},[w("div",zle,[w("span",{class:"q-grip",title:C(o)("composer.queueDragTitle"),draggable:"true",onDragstart:Q=>y(Y,Q),onDragend:v},[ae(Ge,{name:"grip",size:"sm"})],40,Ule),w("button",{type:"button",class:"q-body",title:C(o)("composer.editQueued"),onClick:Q=>m(Y)},[re.text?(x(),E("span",jle,R(re.text),1)):(x(),E("span",Vle,[ae(Ge,{name:"file",size:"sm"}),ot(" "+R(C(o)("composer.queuedAttachments",{n:re.attachments?.length??0})),1)]))],8,qle),p(re)?(x(),E("div",Kle,[(x(!0),E(We,null,rt(re.attachments,(Q,P)=>(x(),E(We,{key:P},[Q.kind==="file"?(x(),E("span",Gle,[ae(Ge,{name:"file",size:"sm"}),ot(" "+R(Q.name??Q.fileId),1)])):(x(),Se(XE,{key:1,url:Q.url,kind:Q.kind,"file-id":Q.fileId,"media-class":"q-img",controls:!1,muted:""},null,8,["url","kind","file-id"]))],64))),128))])):ue("",!0),Y===0?(x(),E("span",Yle,R(C(o)("composer.queueNext")),1)):(x(),E("span",Zle,"#"+R(Y+1),1)),w("button",{type:"button",class:"q-rm","aria-label":C(o)("composer.remove"),onClick:St(Q=>d("unqueue",Y),["stop"])},[ae(Ge,{name:"close",size:"sm"})],8,Xle)])],42,Wle))),128))])):ue("",!0)]),ne.value!==null?(x(),E("div",Qle,R(C(o)("composer.attachmentOpenUnsupported",{name:ne.value})),1)):ue("",!0)],64))}}),tT=dt(eae,[["__scopeId","data-v-d2cc4eff"]]),tae={class:"ch-id"},nae={key:0,class:"ch-ws"},oae={key:1,class:"ch-sep"},sae=["onKeydown"],iae={class:"ch-ses"},rae={key:0,class:"ch-pill ch-sync-pill"},lae={key:0,class:"ch-ahead"},aae={key:1,class:"ch-behind"},cae={key:1,class:"ch-pill ch-diff-pill"},uae={key:0,class:"ch-add"},dae={key:1,class:"ch-del"},fae=Je({__name:"ChatHeader",props:{sessionId:{},workspaceName:{},workspaceRoot:{},sessionTitle:{},branch:{},ahead:{},behind:{},changesCount:{},gitDiffStats:{},isGitRepo:{type:Boolean},pr:{},copied:{type:Boolean}},emits:["copyAll","copyFinalSummary","openChanges","openPr","renameSession","forkSession","archiveSession","exportSession"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=D(()=>o.ahead??0),r=D(()=>o.behind??0),l=D(()=>o.gitDiffStats?.totalAdditions??0),a=D(()=>o.gitDiffStats?.totalDeletions??0),c=D(()=>l.value>0||a.value>0),u={open:"header.prStatusOpen",closed:"header.prStatusClosed",merged:"header.prStatusMerged",draft:"header.prStatusDraft"};function d(Z){return Z.trim().toLowerCase().replaceAll("_","-")}function f(Z){const ie=d(Z);return u[ie]?`pr-${ie}`:"pr-unknown"}function h(Z){return n(u[d(Z)]??"header.prStatusUnknown")}const p=oe(!1),m=oe(null),y=oe(null),k=oe({});function g(Z){const ie=Z.target;y.value?.el?.contains(ie)||m.value?.el?.contains(ie)||A()}function v(){A()}async function b(Z){if(Z.stopPropagation(),p.value){A();return}p.value=!0,document.addEventListener("mousedown",g),window.addEventListener("resize",v),await yt();const ie=m.value?.el,q=y.value?.el;if(!ie||!q)return;const ee=ie.getBoundingClientRect(),fe=4,ne=8,j=q.offsetWidth,K=q.offsetHeight;let ve=ee.bottom+fe;ve+K>window.innerHeight-ne&&(ve=Math.max(ne,ee.top-K-fe));let he=ee.left;he+j>window.innerWidth-ne&&(he=Math.max(ne,ee.right-j)),k.value={top:`${Math.round(ve)}px`,left:`${Math.round(he)}px`}}function A(){p.value=!1,document.removeEventListener("mousedown",g),window.removeEventListener("resize",v)}On(()=>{document.removeEventListener("mousedown",g),window.removeEventListener("resize",v)});function I(){s("copyAll"),A()}function N(){s("copyFinalSummary"),A()}const M=oe(!1);function $(){o.sessionId&&Jo(o.sessionId).then(Z=>{Z&&(M.value=!0,setTimeout(()=>{M.value=!1},1200))})}const T=oe(!1),F=oe(""),S=oe(null);async function B(){if(A(),!!o.sessionId){T.value=!0,F.value=o.sessionTitle??"",await yt();try{S.value?.focus(),S.value?.select()}catch{}}}function W(){const Z=F.value.trim();Z&&o.sessionId&&Z!==(o.sessionTitle??"").trim()&&s("renameSession",o.sessionId,Z),T.value=!1}function z(){T.value=!1}function L(){o.sessionId&&(A(),s("forkSession",o.sessionId))}function O(){o.sessionId&&(A(),s("exportSession",o.sessionId))}function U(){o.sessionId&&(A(),s("archiveSession",o.sessionId))}return(Z,ie)=>(x(),E("header",{class:Ue(["chat-header",{"macos-desktop":C(iu)}])},[w("div",tae,[e.workspaceName?(x(),E("span",nae,R(e.workspaceName),1)):ue("",!0),e.workspaceName&&e.sessionTitle?(x(),E("span",oae,"/")):ue("",!0),T.value?qn((x(),E("input",{key:2,ref_key:"renameInputRef",ref:S,"onUpdate:modelValue":ie[0]||(ie[0]=q=>F.value=q),class:"ch-rename",type:"text",onKeydown:[ur(St(W,["stop"]),["enter"]),ur(St(z,["stop"]),["esc"])],onBlur:W,onClick:ie[1]||(ie[1]=St(()=>{},["stop"]))},null,40,sae)),[[Cs,F.value]]):e.sessionTitle?(x(),Se(an,{key:3,text:e.sessionTitle},{default:Ie(()=>[w("span",iae,R(e.sessionTitle),1)]),_:1},8,["text"])):ue("",!0)]),ae(Xn,{ref_key:"kebabRef",ref:m,class:Ue(["ch-act-more",{open:p.value}]),label:C(n)("header.options"),"aria-expanded":p.value,"aria-haspopup":"menu",onClick:ie[2]||(ie[2]=St(q=>b(q),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"dots-horizontal",size:"md"})]),_:1},8,["class","label","aria-expanded"]),p.value?(x(),Se(Ml,{key:0,ref_key:"menuRef",ref:y,class:"ch-menu",style:on(k.value),onClick:ie[3]||(ie[3]=St(()=>{},["stop"]))},{default:Ie(()=>[ae(Tn,{onClick:I},{default:Ie(()=>[ae(Ge,{name:e.copied?"check":"copy",size:"sm"},null,8,["name"]),ot(" "+R(e.copied?C(n)("header.copied"):C(n)("header.copyAll")),1)]),_:1}),ae(Tn,{onClick:N},{default:Ie(()=>[ae(Ge,{name:"file-text",size:"sm"}),ot(" "+R(C(n)("header.copyFinalSummary")),1)]),_:1}),e.sessionId?(x(),E(We,{key:0},[ae(Tn,{separator:""}),ae(Tn,{onClick:$},{default:Ie(()=>[ae(Ge,{name:M.value?"check":"copy",size:"sm"},null,8,["name"]),ot(" "+R(M.value?C(n)("header.copied"):C(n)("header.copySessionId")),1)]),_:1}),ae(Tn,{onClick:B},{default:Ie(()=>[ae(Ge,{name:"pencil",size:"sm"}),ot(" "+R(C(n)("header.renameSession")),1)]),_:1}),ae(Tn,{onClick:L},{default:Ie(()=>[ae(Ge,{name:"git-fork",size:"sm"}),ot(" "+R(C(n)("header.forkSession")),1)]),_:1}),ae(Tn,{onClick:O},{default:Ie(()=>[ae(Ge,{name:"download",size:"sm"}),ot(" "+R(C(n)("header.exportSession")),1)]),_:1}),ae(Tn,{danger:"",onClick:U},{default:Ie(()=>[ae(Ge,{name:"archive",size:"sm"}),ot(" "+R(C(n)("header.archiveSession")),1)]),_:1})],64)):ue("",!0)]),_:1},8,["style"])):ue("",!0),ie[6]||(ie[6]=w("div",{class:"ch-spacer"},null,-1)),e.isGitRepo?(x(),E("button",{key:1,type:"button",class:"ch-git",onClick:ie[4]||(ie[4]=q=>s("openChanges"))},[w("span",{class:Ue(["ch-branch",{"ch-detached":!e.branch}])},R(e.branch||C(n)("header.detached")),3),i.value>0||r.value>0?(x(),E("span",rae,[i.value>0?(x(),E("span",lae,"↑"+R(i.value),1)):ue("",!0),r.value>0?(x(),E("span",aae,"↓"+R(r.value),1)):ue("",!0)])):ue("",!0),c.value?(x(),E("span",cae,[l.value>0?(x(),E("span",uae,"+"+R(l.value),1)):ue("",!0),a.value>0?(x(),E("span",dae,"-"+R(a.value),1)):ue("",!0)])):ue("",!0)])):ue("",!0),e.pr?(x(),E("button",{key:2,type:"button",class:Ue(["ch-pill ch-pr",f(e.pr.state)]),onClick:ie[5]||(ie[5]=q=>e.pr&&s("openPr",e.pr.url))},[ae(Ge,{name:"git-pull-request",size:"sm"}),w("span",null,"PR #"+R(e.pr.number)+" · "+R(h(e.pr.state)),1)],2)):ue("",!0)],2))}}),hae=dt(fae,[["__scopeId","data-v-fa4451d4"]]),pae=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],M3=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function mae(e){if(e<=255)return pae[e];let t=0,n=M3.length-1;for(;t<=n;){const o=t+n>>1,s=M3[o];if(e<s[0]){n=o-1;continue}if(e>s[1]){t=o+1;continue}return s[2]}return"L"}function gae(e){const t=e.length;if(t===0)return null;const n=new Array(t);let o=!1;for(let c=0;c<t;){const u=e.charCodeAt(c);let d=u,f=1;if(u>=55296&&u<=56319&&c+1<t){const p=e.charCodeAt(c+1);p>=56320&&p<=57343&&(d=(u-55296<<10)+(p-56320)+65536,f=2)}const h=mae(d);(h==="R"||h==="AL"||h==="AN")&&(o=!0);for(let p=0;p<f;p++)n[c+p]=h;c+=f}if(!o)return null;let s=0;for(let c=0;c<t;c++){const u=n[c];if(u==="L"){s=0;break}if(u==="R"||u==="AL"){s=1;break}}const i=new Int8Array(t);for(let c=0;c<t;c++)i[c]=s;const r=s&1?"R":"L",l=r;let a=l;for(let c=0;c<t;c++)n[c]==="NSM"?n[c]=a:a=n[c];a=l;for(let c=0;c<t;c++){const u=n[c];u==="EN"?n[c]=a==="AL"?"AN":"EN":(u==="R"||u==="L"||u==="AL")&&(a=u)}for(let c=0;c<t;c++)n[c]==="AL"&&(n[c]="R");for(let c=1;c<t-1;c++)n[c]==="ES"&&n[c-1]==="EN"&&n[c+1]==="EN"&&(n[c]="EN"),n[c]==="CS"&&(n[c-1]==="EN"||n[c-1]==="AN")&&n[c+1]===n[c-1]&&(n[c]=n[c-1]);for(let c=0;c<t;c++){if(n[c]!=="EN")continue;let u;for(u=c-1;u>=0&&n[u]==="ET";u--)n[u]="EN";for(u=c+1;u<t&&n[u]==="ET";u++)n[u]="EN"}for(let c=0;c<t;c++){const u=n[c];(u==="WS"||u==="ES"||u==="ET"||u==="CS")&&(n[c]="ON")}a=l;for(let c=0;c<t;c++){const u=n[c];u==="EN"?n[c]=a==="L"?"L":"EN":(u==="R"||u==="L")&&(a=u)}for(let c=0;c<t;c++){if(n[c]!=="ON")continue;let u=c+1;for(;u<t&&n[u]==="ON";)u++;const d=c>0?n[c-1]:l,f=u<t?n[u]:l,h=d!=="L"?"R":"L";if(h===(f!=="L"?"R":"L"))for(let m=c;m<u;m++)n[m]=h;c=u-1}for(let c=0;c<t;c++)n[c]==="ON"&&(n[c]=r);for(let c=0;c<t;c++){const u=n[c];(i[c]&1)===0?u==="R"?i[c]++:(u==="AN"||u==="EN")&&(i[c]+=2):(u==="L"||u==="AN"||u==="EN")&&i[c]++}return i}function vae(e,t){const n=gae(e);if(n===null)return null;const o=new Int8Array(t.length);for(let s=0;s<t.length;s++)o[s]=n[t[s]];return o}const yae=/[ \t\n\r\f]+/g,kae=/[\t\n\r\f]| {2,}|^ | $/;function bae(e){const t=e??"normal";return t==="pre-wrap"?{mode:t,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:t,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function xae(e){if(!kae.test(e))return e;let t=e.replace(yae," ");return t.charCodeAt(0)===32&&(t=t.slice(1)),t.length>0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function wae(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,`
311
311
  `).replace(/[\r\f]/g,`
312
312
  `):e}let Iv=null,_ae;function Sae(){return Iv===null&&(Iv=new Intl.Segmenter(_ae,{granularity:"word"})),Iv}const Cae=/\p{Script=Arabic}/u,Xl=/\p{M}/u,rb=/\p{Nd}/u;function E3(e){return Cae.test(e)}function T3(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function mr(e){for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(!(n<12288)){if(n>=55296&&n<=56319&&t+1<e.length){const o=e.charCodeAt(t+1);if(o>=56320&&o<=57343){const s=(n-55296<<10)+(o-56320)+65536;if(T3(s))return!0;t++;continue}}if(T3(n))return!0}}return!1}function Aae(e){const t=Yf(e);return t!==null&&(lb.has(t)||Ga.has(t))}const Mae=new Set([" "," ","⁠","\uFEFF"]),Eae=new Set(["-","‐","–","—"]);function Tae(e){const t=Yf(e);return t!==null&&Mae.has(t)}function Nae(e){const t=Yf(e);return t!==null&&Eae.has(t)}function nT(e,t){return Tae(e)?!1:t?!(Aae(e)||Nae(e)):!0}const lb=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),J1=new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),ab=new Set(["'","’"]),Ga=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),Iae=new Set([":",".","،","؛"]),Lae=new Set(["၏"]),$ae=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function Fae(e){if(cb(e))return!0;let t=!1;for(const n of e){if(Ga.has(n)||t0(n)){t=!0;continue}if(!(t&&Xl.test(n)))return!1}return t}function Oae(e){for(const t of e)if(!lb.has(t)&&!Ga.has(t))return!1;return e.length>0}function Bae(e){if(cb(e))return!0;for(const t of e)if(!J1.has(t)&&!ab.has(t)&&!Xl.test(t)&&!t0(t))return!1;return e.length>0}function cb(e){let t=!1;for(const n of e)if(!(n==="\\"||Xl.test(n))){if(J1.has(n)||Ga.has(n)||ab.has(n)){t=!0;continue}return!1}return t}function e0(e,t){const n=t-1;if(n<=0)return Math.max(n,0);const o=e.charCodeAt(n);if(o<56320||o>57343)return n;const s=n-1;if(s<0)return n;const i=e.charCodeAt(s);return i>=55296&&i<=56319?s:n}function Yf(e){if(e.length===0)return null;const t=e0(e,e.length);return e.slice(t)}function Rae(e){for(const t of e)if(!Xl.test(t))return t;return null}function Dae(e){for(let t=e.length;t>0;){const n=e0(e,t),o=e.slice(n,t);if(!Xl.test(o))return o;t=n}return null}const Pae=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function Hae(e,t){for(let n=0;n<t.length;n+=2)if(e>=t[n]&&e<=t[n+1])return!0;return!1}function t0(e){const t=e.codePointAt(0);return t!==void 0&&Hae(t,Pae)}function Wae(e){const t=Dae(e);return t!==null&&t0(t)}function zae(e){const t=Rae(e);return t!==null&&rb.test(t)}function Uae(e){const t=Array.from(e);let n=t.length;for(;n>0;){const o=t[n-1];if(Xl.test(o)){n--;continue}if(J1.has(o)||ab.has(o)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function qae(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="—"?e:null}function N3(e,t,n,o){const s=t[o],i=e[o];if(s==null)return i;const r=n[o];if(i.length===r)return i;const l=s.repeat(r);return e[o]=l,l}function I3(e,t){return e&&t!==null&&Iae.has(t)}function jae(e){const t=Yf(e);return t!==null&&Lae.has(t)}function Vae(e){if(e.length<2||e[0]!==" ")return null;const t=e.slice(1);return/^\p{M}+$/u.test(t)?{space:" ",marks:t}:null}function dk(e){let t=e.length;for(;t>0;){const n=e0(e,t),o=e.slice(n,t);if($ae.has(o))return!0;if(!Ga.has(o))return!1;t=n}return!1}function Kae(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===`
313
- `)return"hard-break"}return e===" "?"space":e===" "||e===" "||e==="⁠"||e==="\uFEFF"?"glue":e==="​"?"zero-width-break":e==="­"?"soft-hyphen":"text"}const Gae=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function ji(e){return e.length===1?e[0]:e.join("")}function Yae(e,t){const n=[];for(let o=e.length-1;o>=0;o--)n.push(e[o]);return n.push(t),ji(n)}function Zae(e,t,n,o){if(!Gae.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];const s=[];let i=null,r=[],l=n,a=!1,c=0;for(const u of e){const d=Kae(u,o),f=d==="text"&&t;if(i!==null&&d===i&&f===a){r.push(u),c+=u.length;continue}i!==null&&s.push({text:ji(r),isWordLike:a,kind:i,start:l}),i=d,r=[u],l=n+c,a=f,c+=u.length}return i!==null&&s.push({text:ji(r),isWordLike:a,kind:i,start:l}),s}function fk(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}const Xae=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function Qae(e,t){const n=e.texts[t];return n.startsWith("www.")?!0:Xae.test(n)&&t+1<e.len&&e.kinds[t+1]==="text"&&e.texts[t+1]==="//"}function Jae(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}function ece(e){const t=e.texts.slice(),n=e.isWordLike.slice(),o=e.kinds.slice(),s=e.starts.slice();for(let r=0;r<e.len;r++){if(o[r]!=="text"||!Qae(e,r))continue;const l=[t[r]];let a=r+1;for(;a<e.len&&!fk(o[a]);){l.push(t[a]),n[r]=!0;const c=t[a].includes("?");if(o[a]="text",t[a]="",a++,c)break}t[r]=ji(l)}let i=0;for(let r=0;r<t.length;r++){const l=t[r];l.length!==0&&(i!==r&&(t[i]=l,n[i]=n[r],o[i]=o[r],s[i]=s[r]),i++)}return t.length=i,n.length=i,o.length=i,s.length=i,{len:i,texts:t,isWordLike:n,kinds:o,starts:s}}function tce(e){const t=[],n=[],o=[],s=[];for(let i=0;i<e.len;i++){const r=e.texts[i];if(t.push(r),n.push(e.isWordLike[i]),o.push(e.kinds[i]),s.push(e.starts[i]),!Jae(r))continue;const l=i+1;if(l>=e.len||fk(e.kinds[l]))continue;const a=[],c=e.starts[l];let u=l;for(;u<e.len&&!fk(e.kinds[u]);)a.push(e.texts[u]),u++;a.length>0&&(t.push(ji(a)),n.push(!0),o.push("text"),s.push(c),i=u-1)}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:s}}const nce=new Set([":","-","/","×",",",".","+","–","—"]),oce=/[\p{P}\p{S}\p{Co}]/u,sce=/\p{Emoji_Presentation}/u,ice=new Set(["?","֊","-","‐","‒","–","—","…","‼","‽","⁉"]);function rce(e){return e>=33&&e<=47&&e!==45||e>=58&&e<=64&&e!==63||e>=91&&e<=96||e>=123&&e<=126}function oT(e){const t=e.charCodeAt(0);return t<128?rce(t):!ice.has(e)&&!sce.test(e)&&oce.test(e)}function L3(e){let t=!1;for(const n of e)if(!Xl.test(n)){if(!oT(n))return!1;t=!0}return t}function lce(e){for(let t=e.length;t>0;){const n=e0(e,t),o=e.slice(n,t);if(Xl.test(o)){t=n;continue}return oT(o)||t0(o)}return!1}function ace(e,t,n,o){const s=!t&&L3(e),i=!o&&L3(n),r=Wae(e),l=(t||r)&&lce(e);return!s&&!i&&!l||mr(e)||mr(n)?!1:(t||s||r)&&(o||i)}function sT(e){for(const t of e)if(rb.test(t))return!0;return!1}function Gm(e){if(e.length===0)return!1;for(const t of e)if(!(rb.test(t)||nce.has(t)))return!1;return!0}function cce(e){const t=[],n=[],o=[],s=[];for(let i=0;i<e.len;i++){const r=e.texts[i],l=e.kinds[i];if(l==="text"&&Gm(r)&&sT(r)){const a=[r];let c=i+1;for(;c<e.len&&e.kinds[c]==="text"&&Gm(e.texts[c]);)a.push(e.texts[c]),c++;t.push(ji(a)),n.push(!0),o.push("text"),s.push(e.starts[i]),i=c-1;continue}t.push(r),n.push(e.isWordLike[i]),o.push(l),s.push(e.starts[i])}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:s}}function uce(e){const t=[],n=[],o=[],s=[];let i=0;for(;i<e.len;){const r=e.texts[i],l=e.kinds[i],a=e.isWordLike[i];if(l==="text"){const c=[r];let u=i+1,d=a;for(;u<e.len&&e.kinds[u]==="text"&&ace(e.texts[u-1],e.isWordLike[u-1],e.texts[u],e.isWordLike[u]);){const f=e.texts[u];c.push(f),d=d||e.isWordLike[u],u++}if(u>i+1){t.push(ji(c)),n.push(d),o.push("text"),s.push(e.starts[i]),i=u;continue}}t.push(r),n.push(a),o.push(l),s.push(e.starts[i]),i++}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:s}}function dce(e){const t=[],n=[],o=[],s=[];for(let i=0;i<e.len;i++){const r=e.texts[i];if(e.kinds[i]==="text"&&r.includes("-")){const l=r.split("-");let a=l.length>1;for(let c=0;c<l.length;c++){const u=l[c];if(!a)break;(u.length===0||!sT(u)||!Gm(u))&&(a=!1)}if(a){let c=0;for(let u=0;u<l.length;u++){const d=l[u],f=u<l.length-1?`${d}-`:d;t.push(f),n.push(!0),o.push("text"),s.push(e.starts[i]+c),c+=f.length}continue}}t.push(r),n.push(e.isWordLike[i]),o.push(e.kinds[i]),s.push(e.starts[i])}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:s}}function fce(e){const t=[],n=[],o=[],s=[];let i=0;for(;i<e.len;){const r=[e.texts[i]];let l=e.isWordLike[i],a=e.kinds[i],c=e.starts[i];if(a==="glue"){const u=[r[0]],d=c;for(i++;i<e.len&&e.kinds[i]==="glue";)u.push(e.texts[i]),i++;const f=ji(u);if(i<e.len&&e.kinds[i]==="text")r[0]=f,r.push(e.texts[i]),l=e.isWordLike[i],a="text",c=d,i++;else{t.push(f),n.push(!1),o.push("glue"),s.push(d);continue}}else i++;if(a==="text")for(;i<e.len&&e.kinds[i]==="glue";){const u=[];for(;i<e.len&&e.kinds[i]==="glue";)u.push(e.texts[i]),i++;const d=ji(u);if(i<e.len&&e.kinds[i]==="text"){r.push(d,e.texts[i]),l=l||e.isWordLike[i],i++;continue}r.push(d)}t.push(ji(r)),n.push(l),o.push(a),s.push(c)}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:s}}function hce(e){const t=e.texts.slice(),n=e.isWordLike.slice(),o=e.kinds.slice(),s=e.starts.slice();for(let i=0;i<t.length-1;i++){if(o[i]!=="text"||o[i+1]!=="text"||!mr(t[i])||!mr(t[i+1]))continue;const r=Uae(t[i]);r!==null&&(t[i]=r.head,t[i+1]=r.tail+t[i+1],s[i+1]=s[i]+r.head.length)}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:s}}function pce(e,t,n){const o=Sae();let s=0;const i=[],r=[],l=[],a=[],c=[],u=[],d=[],f=[],h=[],p=[],m=[],y=[];for(const I of o.segment(e))for(const N of Zae(I.segment,I.isWordLike??!1,I.index,n)){let L=function(){u[z]!==null&&(r[z]=[N3(i,u,d,z)],u[z]=null),r[z].push(N.text),l[z]=l[z]||N.isWordLike,f[z]=f[z]||T,h[z]=h[z]||F,p[z]=B,m[z]=W,y[z]=I3(h[z],S)};const M=N.kind==="text",$=qae(N.text,N.isWordLike,N.kind),T=mr(N.text),F=E3(N.text),S=Yf(N.text),B=dk(N.text),W=jae(N.text),z=s-1;t.carryCJKAfterClosingQuote&&M&&s>0&&a[z]==="text"&&T&&f[z]&&p[z]||M&&s>0&&a[z]==="text"&&Oae(N.text)&&f[z]||M&&s>0&&a[z]==="text"&&m[z]?L():M&&s>0&&a[z]==="text"&&N.isWordLike&&F&&y[z]?(L(),l[z]=!0):$!==null&&s>0&&a[z]==="text"&&u[z]===$?d[z]=(d[z]??1)+1:M&&!N.isWordLike&&s>0&&a[z]==="text"&&!f[z]&&(Fae(N.text)||N.text==="-"&&l[z])?L():(i[s]=N.text,r[s]=[N.text],l[s]=N.isWordLike,a[s]=N.kind,c[s]=N.start,u[s]=$,d[s]=$===null?0:1,f[s]=T,h[s]=F,p[s]=B,m[s]=W,y[s]=I3(F,S),s++)}for(let I=0;I<s;I++){if(u[I]!==null){i[I]=N3(i,u,d,I);continue}i[I]=ji(r[I])}for(let I=1;I<s;I++)a[I]==="text"&&!l[I]&&cb(i[I])&&a[I-1]==="text"&&!f[I-1]&&(i[I-1]+=i[I],l[I-1]=l[I-1]||l[I],i[I]="");const k=Array.from({length:s},()=>null);let g=-1;for(let I=s-1;I>=0;I--){const N=i[I];if(N.length!==0){if(a[I]==="text"&&!l[I]&&g>=0&&a[g]==="text"&&(Bae(N)||N==="-"&&zae(i[g]))){const M=k[g]??[];M.push(N),k[g]=M,c[g]=c[I],i[I]="";continue}g=I}}for(let I=0;I<s;I++){const N=k[I];N!=null&&(i[I]=Yae(N,i[I]))}let v=0;for(let I=0;I<s;I++){const N=i[I];N.length!==0&&(v!==I&&(i[v]=N,l[v]=l[I],a[v]=a[I],c[v]=c[I]),v++)}i.length=v,l.length=v,a.length=v,c.length=v;const b=fce({len:v,texts:i,isWordLike:l,kinds:a,starts:c}),A=hce(uce(dce(cce(tce(ece(b))))));for(let I=0;I<A.len-1;I++){const N=Vae(A.texts[I]);N!==null&&(A.kinds[I]!=="space"&&A.kinds[I]!=="preserved-space"||A.kinds[I+1]!=="text"||!E3(A.texts[I+1])||(A.texts[I]=N.space,A.isWordLike[I]=!1,A.kinds[I]=A.kinds[I]==="preserved-space"?"preserved-space":"space",A.texts[I+1]=N.marks+A.texts[I+1],A.starts[I+1]=A.starts[I]+N.space.length))}return A}function mce(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const n=[];let o=0;for(let s=0;s<e.len;s++)e.kinds[s]==="hard-break"&&(n.push({startSegmentIndex:o,endSegmentIndex:s,consumedEndSegmentIndex:s+1}),o=s+1);return o<e.len&&n.push({startSegmentIndex:o,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),n}function gce(e,t,n){if(t.len<=1)return t;const o=[],s=[],i=[],r=[];let l=-1,a=!1;function c(f){o.push(t.texts[f]),s.push(t.isWordLike[f]),i.push("text"),r.push(t.starts[f])}function u(f,h){let p=!1;for(let k=f;k<h;k++)p=p||t.isWordLike[k];const m=t.starts[f],y=h<t.len?t.starts[h]:e.length;o.push(e.slice(m,y)),s.push(p),i.push("text"),r.push(m)}function d(f){if(!(l<0)){if(a)l+1===f?c(l):u(l,f);else for(let h=l;h<f;h++)c(h);l=-1,a=!1}}for(let f=0;f<t.len;f++){const h=t.texts[f],p=t.kinds[f];if(p==="text"){l>=0&&!nT(t.texts[f-1],n)&&d(f),l<0&&(l=f),a=a||mr(h);continue}d(f),o.push(h),s.push(t.isWordLike[f]),i.push(p),r.push(t.starts[f])}return d(t.len),{len:o.length,texts:o,isWordLike:s,kinds:i,starts:r}}function vce(e,t,n="normal",o="normal"){const s=bae(n),i=s.mode==="pre-wrap"?wae(e):xae(e);if(i.length===0)return{normalized:i,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const r=pce(i,t,s),l=o==="keep-all"?gce(i,r,t.breakKeepAllAfterPunctuation):r;return{normalized:i,chunks:mce(l,s),...l}}let Lc=null;const $3=new Map;let $c=null;const yce=96,kce=/\p{Emoji_Presentation}/u,bce=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Lv=null;const F3=new Map;function ub(){if(Lc!==null)return Lc;if(typeof OffscreenCanvas<"u")return Lc=new OffscreenCanvas(1,1).getContext("2d"),Lc;if(typeof document<"u")return Lc=document.createElement("canvas").getContext("2d"),Lc;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function xce(e){let t=$3.get(e);return t||(t=new Map,$3.set(e,t)),t}function Nl(e,t){let n=t.get(e);return n===void 0&&(n={width:ub().measureText(e).width,containsCJK:mr(e)},t.set(e,n)),n}function n0(){if($c!==null)return $c;if(typeof navigator>"u")return $c={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},$c;const e=navigator.userAgent,n=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),o=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return $c={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:o,breakKeepAllAfterPunctuation:!n,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},$c}function wce(e){const t=e.match(/(\d+(?:\.\d+)?)\s*px/);return t?parseFloat(t[1]):16}function iT(){return Lv===null&&(Lv=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Lv}function _ce(e){return kce.test(e)||e.includes("️")}function Sce(e){return bce.test(e)}function Cce(e,t){let n=F3.get(e);if(n!==void 0)return n;const o=ub();o.font=e;const s=o.measureText("😀").width;if(n=0,s>t+.5&&typeof document<"u"&&document.body!==null){const i=document.createElement("span");i.style.font=e,i.style.display="inline-block",i.style.visibility="hidden",i.style.position="absolute",i.textContent="😀",document.body.appendChild(i);const r=i.getBoundingClientRect().width;document.body.removeChild(i),s-r>.5&&(n=s-r)}return F3.set(e,n),n}function Ace(e){let t=0;const n=iT();for(const o of n.segment(e))_ce(o.segment)&&t++;return t}function Mce(e,t){return t.emojiCount===void 0&&(t.emojiCount=Ace(e)),t.emojiCount}function La(e,t,n){return n===0?t.width:t.width-Mce(e,t)*n}function Ece(e,t,n,o,s){if(t.breakableFitAdvances!==void 0&&t.breakableFitMode===s)return t.breakableFitAdvances;t.breakableFitMode=s;const i=iT(),r=[];for(const u of i.segment(e))r.push(u.segment);if(r.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(s==="sum-graphemes"){const u=[];for(const d of r){const f=Nl(d,n);u.push(La(d,f,o))}return t.breakableFitAdvances=u,t.breakableFitAdvances}if(s==="pair-context"||r.length>yce){const u=[];let d=null,f=0;for(const h of r){const p=Nl(h,n),m=La(h,p,o);if(d===null)u.push(m);else{const y=d+h,k=Nl(y,n);u.push(La(y,k,o)-f)}d=h,f=m}return t.breakableFitAdvances=u,t.breakableFitAdvances}const l=[];let a="",c=0;for(const u of r){a+=u;const d=Nl(a,n),f=La(a,d,o);l.push(f-c),c=f}return t.breakableFitAdvances=l,t.breakableFitAdvances}function Tce(e,t){const n=ub();n.font=e;const o=xce(e),s=wce(e),i=t?Cce(e,s):0;return{cache:o,fontSize:s,emojiCorrection:i}}function Nce(e){return e==="space"||e==="zero-width-break"||e==="soft-hyphen"}function rT(e){return e==="space"||e==="preserved-space"||e==="tab"||e==="zero-width-break"||e==="soft-hyphen"}function lT(e,t,n=e.widths.length){for(;t<n;){const o=e.kinds[t];if(!Nce(o))break;t++}return t}function Ice(e,t){if(t<=0)return 0;const n=e%t;return Math.abs(n)<=1e-6?t:t-n}function Lce(e,t,n){return e.letterSpacing!==0&&t&&e.spacingGraphemeCounts[n]>0?e.letterSpacing:0}function db(e,t){return t===0?0:e+t}function $ce(e,t){return e.letterSpacing!==0&&e.spacingGraphemeCounts[t]>0?e.letterSpacing:0}function Fce(e,t,n,o,s){const i=t==="tab"?s+$ce(e,n):e.lineEndFitAdvances[n];return db(o,i)}function O3(e,t,n,o){const s=t==="tab"?0:e.lineEndFitAdvances[n];return db(o,s)}function B3(e,t,n,o,s){const i=t==="tab"?s:e.lineEndPaintAdvances[n];return db(o,i)}function Oce(e,t,n){return e.letterSpacing!==0&&t?n+e.letterSpacing:n}function Bce(e,t){return e.letterSpacing===0?t:t+e.letterSpacing}function Ym(e,t,n){let o=t;for(;o<e.length&&e[o]<n;)o++;return o}function Rce(e,t,n,o,s){if(e.letterSpacing===0)return 0;if(s>0)return e.spacingGraphemeCounts[o]>0?e.letterSpacing:0;for(let i=o-1;i>=t;i--){const r=e.kinds[i];if(!(r==="space"||r==="zero-width-break"||r==="hard-break")){if(r==="soft-hyphen"){if(i===o-1)return 0;continue}return i===t&&n>0||e.spacingGraphemeCounts[i]>0?e.letterSpacing:0}}return 0}function Dce(e,t,n,o,s,i){return t+Rce(e,n,o,s,i)}function Pce(e,t,n){const{widths:o,kinds:s,breakableFitAdvances:i,breakablePreferredBreaks:r}=e;if(o.length===0)return 0;const a=n0().lineFitEpsilon,c=t+a;let u=0,d=0,f=!1,h=0,p=0,m=0,y=0,k=-1,g=0;function v(){k=-1,g=0}function b(T=m,F=y,S=d){u++,n?.(S,h,p,T,F),d=0,f=!1,v()}function A(T,F){f=!0,h=T,p=0,m=T+1,y=0,d=F}function I(T,F,S){f=!0,h=T,p=F,m=T,y=F+1,d=S}function N(T,F){if(!f){A(T,F);return}d+=F,m=T+1,y=0}function M(T,F){const S=i[T],B=r[T]??null;let W=B===null?-1:Ym(B,0,F+1),z=-1,L=0,O=F;for(;O<S.length;){const U=S[O];if(!f)I(T,O,U);else if(d+U>c){if(B!==null&&z>F){b(T,z,L),O=z,W=Ym(B,W,O+1),z=-1,L=0;continue}b(),I(T,O,U)}else d+=U,m=T,y=O+1;const Z=O+1;B!==null&&B[W]===Z&&(z=Z,L=d,W++),O++}f&&m===T&&y===S.length&&(m=T+1,y=0)}let $=0;for(;$<o.length&&!(!f&&($=lT(e,$),$>=o.length));){const T=o[$],F=s[$],S=rT(F);if(!f){T>c&&i[$]!==null?M($,0):A($,T),S&&(k=$+1,g=d-T),$++;continue}if(d+T>c){if(S){N($,T),b($+1,0,d-T),$++;continue}if(k>=0){if(m>k||m===k&&y>0){b();continue}b(k,0,g);continue}if(T>c&&i[$]!==null){b(),M($,0),$++;continue}b();continue}N($,T),S&&(k=$+1,g=d-T),$++}return f&&b(),u}function Hce(e,t,n){if(e.simpleLineWalkFastPath)return Pce(e,t,n);const{widths:o,kinds:s,breakableFitAdvances:i,breakablePreferredBreaks:r,discretionaryHyphenWidth:l,chunks:a}=e;if(o.length===0||a.length===0)return 0;const c=n0(),u=c.lineFitEpsilon,d=t+u;let f=0,h=0,p=!1,m=0,y=0,k=0,g=0,v=-1,b=0,A=0,I=null;function N(){v=-1,b=0,A=0,I=null}function M(){return I==="soft-hyphen"&&v===k&&g===0?A:h}function $(L=k,O=g,U){f++,n!==void 0&&n(Dce(e,U??M(),m,y,L,O),m,y,L,O),h=0,p=!1,N()}function T(L,O){p=!0,m=L,y=0,k=L+1,g=0,h=O}function F(L,O,U){p=!0,m=L,y=O,k=L,g=O+1,h=U}function S(L,O){if(!p){T(L,O);return}h+=O,k=L+1,g=0}function B(L,O,U,Z,ie,q){if(!O)return;const ee=O3(e,L,U,ie),fe=B3(e,L,U,ie,Z);v=U+1,b=h-q+ee,A=h-q+fe,I=L}function W(L,O){const U=i[L],Z=r[L]??null;let ie=Z===null?-1:Ym(Z,0,O+1),q=-1,ee=0,fe=O;for(;fe<U.length;){const ne=U[fe];if(!p)F(L,fe,ne);else{const K=Oce(e,!0,ne),ve=h+K;if(Bce(e,ve)>d){if(Z!==null&&q>O){$(L,q,ee),fe=q,ie=Ym(Z,ie,fe+1),q=-1,ee=0;continue}$(),F(L,fe,ne)}else h=ve,k=L,g=fe+1}const j=fe+1;Z!==null&&Z[ie]===j&&(q=j,ee=h,ie++),fe++}p&&k===L&&g===U.length&&(k=L+1,g=0)}function z(L){f++,n?.(0,L.startSegmentIndex,0,L.consumedEndSegmentIndex,0),N()}for(let L=0;L<a.length;L++){const O=a[L];if(O.startSegmentIndex===O.endSegmentIndex){z(O);continue}p=!1,h=0,m=O.startSegmentIndex,y=0,k=O.startSegmentIndex,g=0,N();let U=O.startSegmentIndex;for(;U<O.endSegmentIndex&&!(!p&&(U=lT(e,U,O.endSegmentIndex),U>=O.endSegmentIndex));){const Z=s[U],ie=rT(Z),q=Lce(e,p,U),ee=Z==="tab"?Ice(h+q,e.tabStopAdvance):o[U],fe=q+ee,ne=Fce(e,Z,U,q,ee);if(Z==="soft-hyphen"){p&&(k=U+1,g=0,v=U+1,b=h+l,A=h+l,I=Z),U++;continue}if(!p){ne>d&&i[U]!==null?W(U,0):T(U,ee),B(Z,ie,U,ee,q,fe),U++;continue}if(h+ne>d){const K=h+O3(e,Z,U,q),ve=h+B3(e,Z,U,q,ee);if(I==="soft-hyphen"&&c.preferEarlySoftHyphenBreak&&b<=d){$(v,0,A);continue}if(ie&&K<=d){S(U,fe),$(U+1,0,ve),U++;continue}if(v>=0&&b<=d){if(k>v||k===v&&g>0){$();continue}const he=v;$(he,0,A),U=he;continue}if(ne>d&&i[U]!==null){$(),W(U,0),U++;continue}$();continue}S(U,fe),B(Z,ie,U,ee,q,fe),U++}if(p){const Z=v===O.consumedEndSegmentIndex?A:h;$(O.consumedEndSegmentIndex,0,Z)}}return f}let $v=null;function fb(){return $v===null&&($v=new Intl.Segmenter(void 0,{granularity:"grapheme"})),$v}function Wce(e){return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}}function zce(e,t){const n=[];let o=[],s=0,i=!1,r=!1,l=!1;function a(){o.length!==0&&(n.push({text:o.length===1?o[0]:o.join(""),start:s}),o=[],i=!1,r=!1,l=!1)}function c(d,f,h){o=[d],s=f,i=h,r=dk(d),l=J1.has(d)}function u(d,f){o.push(d),i=i||f;const h=dk(d);d.length===1&&Ga.has(d)?r=r||h:r=h,l=!1}for(const d of fb().segment(e)){const f=d.segment,h=mr(f);if(o.length===0){c(f,d.index,h);continue}if(l||lb.has(f)||Ga.has(f)||t.carryCJKAfterClosingQuote&&h&&r){u(f,h);continue}if(!i&&!h){u(f,h);continue}a(),c(f,d.index,h)}return a(),n}function Uce(e,t,n){if(t.length<=1)return t;const o=[];let s=-1,i=!1;function r(a,c){const u=t[a].start,d=c<t.length?t[c].start:e.length;o.push({text:e.slice(u,d),start:u})}function l(a){if(!(s<0)){if(i)s+1===a?o.push(t[s]):r(s,a);else for(let c=s;c<a;c++)o.push(t[c]);s=-1,i=!1}}for(let a=0;a<t.length;a++){const c=t[a];s>=0&&!nT(t[a-1].text,n)&&l(a),s<0&&(s=a),i=i||mr(c.text)}return l(t.length),o}function R3(e,t){if(t==="zero-width-break"||t==="soft-hyphen"||t==="hard-break")return 0;if(t==="tab")return 1;let n=0;const o=fb();for(const s of o.segment(e))n++;return n}function qce(e){return e==="-"||e==="֊"||e==="‐"||e==="‒"||e==="–"||e==="—"}function jce(e){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(e))return null;const t=[];let n=0;for(const o of fb().segment(e))n++,qce(o.segment)&&t.push(n);return t.length===0?null:t}function Vce(e,t,n){return t>1?e+(t-1)*n:e}function Kce(e,t,n,o,s){const i=n0(),{cache:r,emojiCorrection:l}=Tce(t,Sce(e.normalized)),a=La("-",Nl("-",r),l)+(s===0?0:s*2),u=La(" ",Nl(" ",r),l)*8,d=s!==0;if(e.len===0)return Wce();const f=[],h=[],p=[],m=[];let y=e.chunks.length<=1&&!d;const k=n?[]:null,g=[],v=[],b=[],A=n?[]:null,I=Array.from({length:e.len});function N(F,S,B,W,z,L,O,U,Z){z!=="text"&&z!=="space"&&z!=="zero-width-break"&&(y=!1),f.push(S),h.push(B),p.push(W),m.push(z),k?.push(L),g.push(O),v.push(U),d&&b.push(Z),A!==null&&A.push(F)}function M(F,S,B,W,z){const L=Nl(F,r),O=d?R3(F,S):0,U=Vce(La(F,L,l),O,s),Z=S==="space"||S==="preserved-space"||S==="zero-width-break"?0:U,ie=Z===0?0:Z+(O>0?s:0),q=S==="space"||S==="zero-width-break"?0:U;if(z&&W&&F.length>1){let ee="sum-graphemes";s!==0?ee="segment-prefixes":Gm(F)?ee="pair-context":i.preferPrefixWidthsForBreakableRuns&&(ee="segment-prefixes");const fe=Ece(F,L,r,l,ee),ne=fe===null||o==="keep-all"?null:jce(F);N(F,U,ie,q,S,B,fe,ne,O);return}N(F,U,ie,q,S,B,null,null,O)}for(let F=0;F<e.len;F++){I[F]=f.length;const S=e.texts[F],B=e.isWordLike[F],W=e.kinds[F],z=e.starts[F];if(W==="soft-hyphen"){N(S,0,a,a,W,z,null,null,0);continue}if(W==="hard-break"){N(S,0,0,0,W,z,null,null,0);continue}if(W==="tab"){N(S,0,0,0,W,z,null,null,d?R3(S,W):0);continue}const L=Nl(S,r);if(W==="text"&&L.containsCJK){const O=zce(S,i),U=o==="keep-all"?Uce(S,O,i.breakKeepAllAfterPunctuation):O;for(let Z=0;Z<U.length;Z++){const ie=U[Z];M(ie.text,"text",z+ie.start,B,o==="keep-all"||!mr(ie.text))}continue}M(S,W,z,B,!0)}const $=Gce(e.chunks,I,f.length),T=k===null?null:vae(e.normalized,k);return A!==null?{widths:f,lineEndFitAdvances:h,lineEndPaintAdvances:p,kinds:m,simpleLineWalkFastPath:y,segLevels:T,breakableFitAdvances:g,breakablePreferredBreaks:v,letterSpacing:s,spacingGraphemeCounts:b,discretionaryHyphenWidth:a,tabStopAdvance:u,chunks:$,segments:A}:{widths:f,lineEndFitAdvances:h,lineEndPaintAdvances:p,kinds:m,simpleLineWalkFastPath:y,segLevels:T,breakableFitAdvances:g,breakablePreferredBreaks:v,letterSpacing:s,spacingGraphemeCounts:b,discretionaryHyphenWidth:a,tabStopAdvance:u,chunks:$}}function Gce(e,t,n){const o=[];for(let s=0;s<e.length;s++){const i=e[s],r=i.startSegmentIndex<t.length?t[i.startSegmentIndex]:n,l=i.endSegmentIndex<t.length?t[i.endSegmentIndex]:n,a=i.consumedEndSegmentIndex<t.length?t[i.consumedEndSegmentIndex]:n;o.push({startSegmentIndex:r,endSegmentIndex:l,consumedEndSegmentIndex:a})}return o}function Yce(e,t,n,o){const s=o?.wordBreak??"normal",i=o?.letterSpacing??0,r=vce(e,n0(),o?.whiteSpace,s);return Kce(r,t,n,s,i)}function Zce(e,t,n){return Yce(e,t,!0,n)}function Xce(e){let t=0;return Hce(e,Number.POSITIVE_INFINITY,n=>{n>t&&(t=n)}),t}const Qce={key:0,class:"slash-menu",role:"listbox"},Jce=["aria-selected","onMouseenter","onMousedown"],eue={class:"slash-name"},tue={class:"slash-desc"},nue=Je({__name:"SlashMenu",props:{items:{},activeIndex:{}},emits:["select","hover"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=oe([]);return et(()=>o.activeIndex,r=>{i.value[r]?.scrollIntoView({block:"nearest"})}),(r,l)=>e.items.length>0?(x(),E("div",Qce,[(x(!0),E(We,null,rt(e.items,(a,c)=>(x(),E("div",{ref_for:!0,ref:u=>{u&&(i.value[c]=u)},key:`${a.name}-${c}`,class:Ue(["slash-item",{active:c===o.activeIndex}]),role:"option","aria-selected":c===o.activeIndex,onMouseenter:u=>s("hover",c),onMousedown:St(u=>s("select",a),["prevent"])},[w("span",eue,R(a.name),1),w("span",tue,R(a.isSkill?a.desc:C(n)(a.desc)),1)],42,Jce))),128))])):ue("",!0)}}),oue=dt(nue,[["__scopeId","data-v-f60b70d9"]]),sue={class:"mention-menu",role:"listbox"},iue={key:0,class:"mention-state dim"},rue={key:1,class:"mention-state dim"},lue=["aria-selected","onMouseenter","onMousedown"],aue=["innerHTML"],cue={class:"mention-name"},uue={class:"mention-path"},due=Je({__name:"MentionMenu",props:{items:{},activeIndex:{},loading:{type:Boolean}},emits:["select","hover"],setup(e,{emit:t}){const n=e,o=t,{t:s}=$t(),i=Dc("folder","sm"),r=Dc("code","sm"),l=Dc("file-text","sm"),a=Dc("image","sm"),c=Dc("file","sm"),u=new Set(["ts","tsx","js","jsx","mjs","cjs","vue","json","py","go","rs","java","kt","c","h","cpp","cc","hpp","cs","rb","php","swift","sh","bash","zsh","css","scss","less","html","htm","xml","sql","yaml","yml","toml","lua","dart","scala","clj","ex","exs"]),d=new Set(["md","markdown","mdx","txt","rst","adoc","pdf","doc","docx"]),f=new Set(["png","jpg","jpeg","gif","svg","webp","bmp","ico","avif"]);function h(p){const m=p.path;if(m.endsWith("/"))return i;const y=p.name||m.split("/").pop()||m,k=y.lastIndexOf("."),g=k>0?y.slice(k+1).toLowerCase():"";return g?u.has(g)?r:d.has(g)?l:f.has(g)?a:c:c}return(p,m)=>(x(),E("div",sue,[n.loading?(x(),E("div",iue,R(C(s)("mention.searching")),1)):n.items.length===0?(x(),E("div",rue,R(C(s)("mention.noMatch")),1)):(x(!0),E(We,{key:2},rt(n.items,(y,k)=>(x(),E("div",{key:y.path,class:Ue(["mention-item",{active:k===n.activeIndex}]),role:"option","aria-selected":k===n.activeIndex,onMouseenter:g=>o("hover",k),onMousedown:St(g=>o("select",y),["prevent"])},[w("span",{class:"mention-icon",innerHTML:h(y),"aria-hidden":"true"},null,8,aue),w("span",cue,R(y.name),1),w("span",uue,R(y.path),1)],42,lue))),128))]))}}),fue=dt(due,[["__scopeId","data-v-f4d6b958"]]),aT=[{name:"/new",desc:"commands.new.desc"},{name:"/clear",desc:"commands.clear.desc"},{name:"/login",desc:"commands.login.desc"},{name:"/plan",desc:"commands.plan.desc"},{name:"/swarm",desc:"commands.swarm.desc",acceptsInput:!0},{name:"/goal",desc:"commands.goal.desc",acceptsInput:!0},{name:"/btw",desc:"commands.btw.desc",acceptsInput:!0},{name:"/auto",desc:"commands.auto.desc"},{name:"/yolo",desc:"commands.yolo.desc"},{name:"/thinking",desc:"commands.thinking.desc"},{name:"/compact",desc:"commands.compact.desc",acceptsInput:!0},{name:"/undo",desc:"commands.undo.desc"},{name:"/fork",desc:"commands.fork.desc"},{name:"/export",desc:"commands.export.desc"},{name:"/status",desc:"commands.status.desc"}];function hue(e){if(!e.startsWith("/"))return null;const t=e.indexOf(" ");return t===-1?{cmd:e,arg:""}:{cmd:e.slice(0,t),arg:e.slice(t+1)}}const Zm="skill:";function pue(e){return e.startsWith(Zm)?e.slice(Zm.length):e}function cT(e=[]){const t=e.map(n=>({name:n.source==="builtin"?`/${n.name}`:`/${Zm}${n.name}`,desc:n.description,isSkill:!0,acceptsInput:!0}));return[...aT,...t]}function mue(e,t=aT){const n=e.toLowerCase().trim().replace(/^\//,"");return n===""?t:t.map((o,s)=>{const i=o.name.toLowerCase().replace(/^\//,"");let r=0;return i===n?r=3:i.startsWith(n)?r=2:i.includes(n)&&(r=1),{item:o,index:s,score:r}}).filter(({score:o})=>o>0).sort((o,s)=>o.score!==s.score?s.score-o.score:o.index-s.index).map(({item:o})=>o)}function o0(e){if(e===void 0)return"toggle";const t=e.capabilities??[];return t.includes("always_thinking")?"always-on":t.includes("thinking")||e.adaptiveThinking===!0?"toggle":"unsupported"}function uT(e){return e?.supportEfforts??[]}function gue(e){return e[Math.floor(e.length/2)]}function Ef(e){if(o0(e)==="unsupported")return"off";const t=uT(e);return t.length>0?e?.defaultEffort??gue(t):"on"}function s0(e){const t=uT(e),n=o0(e);return t.length>0?n==="always-on"?[...t]:["off",...t]:n==="always-on"?["on"]:n==="unsupported"?["off"]:["on","off"]}function hk(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function vue(e){return e!=="off"}function yue(e,t){return s0(e).includes(t)}function hb(e,t){return t==="off"?"off":t==="on"?Ef(e):t}function Xm(e,t){return t??Ef(e)}function kue(e,t){if(e==="off")return{enabled:!1};if(e==="on")return{enabled:!0};const n=t?.at(-1);return n!==void 0&&e===n?{enabled:!0}:{enabled:!0,effort:e}}function bue(e,t,n){return!n||e===void 0?t:Ef(e)}const Qm=100;function xue(e){const t=N1(Dt.inputHistory);if(Array.isArray(t)){const n=t.filter(i=>typeof i=="string"&&i.length>0);if(!e||n.length===0)return{};const o=n.length>Qm?n.slice(-Qm):n,s={[e]:o};return Df(Dt.inputHistory,s),s}return t&&typeof t=="object"?t:{}}function wue(e){const{text:t,textareaRef:n,autosize:o,sessionId:s}=e,i=oe(xue(s())),r=D(()=>i.value[s()??""]??[]);let l=-1,a="";function c(k){const g=s();if(l=-1,!g)return;const v=k.trim();if(!v)return;const b=i.value[g]??[];if(b.at(-1)===v)return;const A=[...b,v],I=A.length>Qm?A.slice(-Qm):A;i.value={...i.value,[g]:I},Df(Dt.inputHistory,i.value)}function u(){const k=n.value;return k?(k.selectionStart??0)===0:!1}function d(k){t.value=k,yt(()=>{const g=n.value;if(!g)return;o();const v=k.length;g.setSelectionRange(v,v)})}function f(){const k=r.value;if(k.length!==0){if(l===-1)a=t.value,l=k.length-1;else if(l>0)l-=1;else return;d(k[l])}}function h(){if(l===-1)return;const k=r.value;l<k.length-1?(l+=1,d(k[l])):(l=-1,d(a))}function p(){l=-1}function m(){return l!==-1}function y(){return r.value.length>0}return et(s,()=>{l=-1}),{push:c,caretAtTextStart:u,recallOlder:f,recallNewer:h,resetBrowsing:p,isBrowsing:m,hasHistory:y}}function _ue(e){const{text:t,textareaRef:n,autosize:o,skills:s,emitCommand:i,historyPush:r,clearDraft:l}=e,a=oe(!1),c=oe([]),u=oe(0);function d(){const h=t.value;h.startsWith("/")&&!h.includes(" ")?(c.value=mue(h,cT(s())),u.value=0,a.value=c.value.length>0):a.value=!1}function f(h){if(a.value=!1,h.acceptsInput){t.value=`${h.name} `,yt(()=>{const p=n.value;if(!p)return;const m=t.value.length;p.setSelectionRange(m,m),p.focus(),o()});return}t.value="",l?.(),r(h.name),i(h.name)}return{open:a,items:c,active:u,update:d,select:f}}function Sue(e){const{text:t,textareaRef:n,autosize:o,searchFiles:s}=e,i=oe(!1),r=oe([]),l=oe(0),a=oe(!1);let c=null;function u(){const h=t.value,p=n.value?.selectionStart??h.length;let m=p-1;for(;m>=0&&!/\s/.test(h[m]);)m--;m++;const y=h.slice(m,p);return y.startsWith("@")?{token:y.slice(1),start:m,end:p}:null}function d(){const h=u(),p=s();if(!h||!p){i.value=!1;return}const m=h.token;c!==null&&clearTimeout(c),c=setTimeout(async()=>{a.value=!0,i.value=!0,l.value=0;try{r.value=await p(m)}catch{r.value=[]}finally{a.value=!1}},200)}function f(h){const p=u();if(!p)return;const m=t.value;t.value=m.slice(0,p.start)+h.path+m.slice(p.end),i.value=!1,yt(()=>{const y=n.value;if(!y)return;const k=p.start+h.path.length;y.setSelectionRange(k,k),y.focus(),o()})}return{open:i,items:r,active:l,loading:a,update:d,select:f}}function Cue(e){const{sessionId:t}=e;function n(c){return yo(M_(c))??""}function o(c,u){const d=M_(c);u?Eo(d,u):qa(d)}const s=oe(n(t())),i=oe(null);function r(){const c=i.value;c&&(c.style.height="auto",c.style.height=`${c.scrollHeight}px`)}et(s,c=>{yt(r),o(t(),c)}),et(t,(c,u)=>{c!==u&&(o(u,s.value),s.value=n(c),yt(r))});function l(c){s.value=c,yt(()=>{const u=i.value;if(!u)return;u.focus();const d=c.length;u.setSelectionRange(d,d),r()})}function a(){o(t(),"")}return{text:s,textareaRef:i,autosize:r,loadForEdit:l,clearDraft:a}}function Aue(e){const{uploadImage:t,sessionId:n}=e,o=oe({}),s=D(()=>o.value[n()??""]??[]),i=oe(null),r=oe(null),l=oe(!1);let a=0;function c(){return`att_${++a}`}function u(O,U){o.value={...o.value,[O]:U}}function d(O){if(O.previewUrl!==void 0)try{URL.revokeObjectURL(O.previewUrl)}catch{}}function f(O){return O.startsWith("image/")?"image":O.startsWith("video/")?"video":"file"}async function h(O){const U=t();if(!U)return;const Z=n()??"";if(O.length!==0)for(const ie of O){const q=f(ie.type),ee=c(),fe=q==="file"?void 0:URL.createObjectURL(ie),ne={localId:ee,name:ie.name,kind:q,previewUrl:fe,mediaType:ie.type||"application/octet-stream",size:ie.size,uploading:!0};u(Z,[...o.value[Z]??[],ne]),U(ie,ie.name).then(j=>{const K=o.value[Z]??[];u(Z,K.map(ve=>ve.localId===ee?{...ve,uploading:!1,fileId:j?.fileId,mediaType:j?.mediaType??ve.mediaType,error:j===null}:ve))}).catch(()=>{const j=o.value[Z]??[];u(Z,j.map(K=>K.localId===ee?{...K,uploading:!1,error:!0}:K))})}}function p(O){const U=n()??"",Z=o.value[U]??[],ie=Z.find(q=>q.localId===O);i.value?.localId===O&&(i.value=null),ie&&d(ie),u(U,Z.filter(q=>q.localId!==O))}function m(O){i.value=O}function y(){i.value=null}function k(){r.value?.click()}function g(O){const U=O.target,Z=Array.from(U.files??[]);h(Z),U.value=""}function v(O){if(!t())return;const U=O.clipboardData;if(!U)return;const Z=[],ie=new Set,q=(ee,fe)=>{const ne=`${ee.size}:${ee.type}:${fe}`;if(ie.has(ne))return;ie.add(ne);const j=ee.type.split("/")[1]??"png",K=fe.includes(".")?fe:`paste-${Date.now()}.${j}`;Z.push(ee instanceof File?ee:new File([ee],K,{type:ee.type}))};for(const ee of Array.from(U.items))if(ee.kind==="file"){const fe=ee.getAsFile();fe&&q(fe,fe.name||`paste-${Date.now()}.${ee.type.split("/")[1]??"png"}`)}for(const ee of Array.from(U.files))q(ee,ee.name);Z.length!==0&&(O.preventDefault(),h(Z))}let b=0;function A(O){!t()||!Array.from(O.dataTransfer?.items??[]).some(Z=>Z.kind==="file")||(O.preventDefault(),O.stopPropagation(),l.value=!0)}function I(){l.value=!1}function N(O){if(b=0,l.value=!1,!t())return;O.preventDefault(),O.stopPropagation();const U=Array.from(O.dataTransfer?.files??[]);h(U)}function M(O){return Array.from(O.dataTransfer?.items??[]).some(U=>U.kind==="file")}function $(O){!t()||!M(O)||(O.preventDefault(),b+=1,l.value=!0)}function T(O){!t()||!M(O)||O.preventDefault()}function F(O){!t()||!M(O)||(b=Math.max(0,b-1),b===0&&(l.value=!1))}function S(O){if(b=0,l.value=!1,!t())return;O.preventDefault();const U=Array.from(O.dataTransfer?.files??[]);h(U)}function B(){const O=n()??"";for(const U of o.value[O]??[])d(U);u(O,[])}function W(O,U,Z){const ie=o.value[O]??[];ie.some(q=>q.localId===U)&&u(O,ie.map(q=>q.localId===U?{...q,...Z}:q))}function z(O){return fetch(O).then(U=>{if(!U.ok)throw new Error(`fetch failed: ${U.status}`);return U.blob()})}function L(O){const U=n()??"";for(const Z of o.value[U]??[])d(Z);u(U,[]);for(const Z of O){const ie=c(),q=/^data:/i.test(Z.url),ee=/^blob:/i.test(Z.url),fe=Z.name??Z.kind;if(Z.fileId){const ne={localId:ie,name:fe,kind:Z.kind,previewUrl:Z.kind==="file"?void 0:Z.url,uploading:!1,fileId:Z.fileId};u(U,[...o.value[U]??[],ne]),Z.kind!=="file"&&!q&&!ee&&ht().getFileBlob(Z.fileId).then(j=>{const K=URL.createObjectURL(j);if(!(o.value[U]??[]).some(he=>he.localId===ie)){URL.revokeObjectURL(K);return}W(U,ie,{previewUrl:K})}).catch(()=>{})}else{if(!Z.url)continue;const ne=t();if(!ne)continue;const j={localId:ie,name:fe,kind:Z.kind,previewUrl:Z.url,uploading:!0};u(U,[...o.value[U]??[],j]),z(Z.url).then(K=>{const ve=fe.includes(".")?fe:`${fe}.${K.type.split("/")[1]??"bin"}`;return ne(K,ve)}).then(K=>{if(K===null){const ve=o.value[U]??[];u(U,ve.filter(he=>he.localId!==ie));return}W(U,ie,{uploading:!1,fileId:K.fileId})}).catch(()=>{const K=o.value[U]??[];u(U,K.filter(ve=>ve.localId!==ie))})}}}return et(n,()=>{i.value=null}),An(()=>{document.addEventListener("paste",v),document.addEventListener("dragenter",$),document.addEventListener("dragover",T),document.addEventListener("dragleave",F),document.addEventListener("drop",S)}),On(()=>{document.removeEventListener("paste",v),document.removeEventListener("dragenter",$),document.removeEventListener("dragover",T),document.removeEventListener("dragleave",F),document.removeEventListener("drop",S);for(const O of Object.values(o.value))for(const U of O)d(U);i.value=null}),{attachments:s,previewAttachment:i,fileInputRef:r,isDragOver:l,removeAttachment:p,openAttachmentPreview:m,closeAttachmentPreview:y,openFilePicker:k,handleFileInputChange:g,handleDragOver:A,handleDragLeave:I,handleDrop:N,clearAfterSubmit:B,loadAttachments:L}}const Mue=["type","disabled"],Eue={class:"ui-button__content"},Tue=Je({__name:"Button",props:{variant:{default:"primary"},size:{default:"md"},disabled:{type:Boolean},loading:{type:Boolean},type:{default:"button"}},setup(e){return(t,n)=>(x(),E("button",{class:Ue(["ui-button",[`ui-button--${e.variant}`,`ui-button--${e.size}`,{"is-loading":e.loading}]]),type:e.type,disabled:e.disabled||e.loading},[e.loading?(x(),Se(Us,{key:0,size:"sm",class:"ui-button__spinner"})):ue("",!0),w("span",Eue,[jn(t.$slots,"default",{},void 0,!0)])],10,Mue))}}),jt=dt(Tue,[["__scopeId","data-v-e58393a8"]]),Nue={class:"ctx-ring",viewBox:"0 0 20 20","aria-hidden":"true"},Iue=["stroke-dasharray","stroke-dashoffset"],Fv=7,Lue=Je({__name:"ContextRing",props:{pct:{}},setup(e){const t=e,n=2*Math.PI*Fv;return(o,s)=>(x(),E("svg",Nue,[w("circle",{class:"ctx-ring-track",cx:"10",cy:"10",r:Fv,fill:"none","stroke-width":"2.5"}),w("circle",{class:"ctx-ring-fill",cx:"10",cy:"10",r:Fv,fill:"none","stroke-width":"2.5","stroke-linecap":"round","stroke-dasharray":`${n}`,"stroke-dashoffset":`${n*(1-t.pct/100)}`},null,8,Iue)]))}}),$ue=dt(Lue,[["__scopeId","data-v-a364f1f1"]]),Fue={key:0,class:"att-strip"},Oue={class:"att-lightbox-card"},Bue=["src"],Rue=["src","alt"],Due={class:"att-lightbox-name"},Pue={class:"composer-card"},Hue={class:"cin-wrap"},Wue={class:"input-row"},zue=["placeholder","disabled"],Uue=["aria-label"],que={class:"toolbar-left"},jue=["onKeydown"],Vue=["onClick"],Kue={class:"pd-check"},Gue={class:"pd-info"},Yue={class:"pd-desc"},Zue={class:"mode-label"},Xue={key:0,class:"mode-tag"},Que={key:1,class:"mode-tag"},Jue={key:2,class:"mode-tag"},ede={class:"mode-row-icon"},tde={class:"mode-row-info"},nde={class:"mode-row-name"},ode={class:"mode-row-desc"},sde={class:"mode-row-icon"},ide={class:"mode-row-info"},rde={class:"mode-row-name"},lde={class:"mode-row-desc"},ade={class:"mode-row-icon"},cde={class:"mode-row-info"},ude={class:"mode-row-name"},dde={class:"mode-row-desc"},fde={key:0,class:"mode-row-actions"},hde={class:"toolbar-right"},pde=["aria-label"],mde=["onKeydown"],gde={key:0,class:"think-suffix"},vde=["aria-label"],yde=["aria-label","disabled"],kde={key:0,class:"md-section"},bde=["onClick"],xde={class:"md-check"},wde={class:"md-name"},_de={class:"md-provider"},Sde={key:1,class:"md-divider"},Cde={key:2,class:"md-section"},Ade=["onClick"],Mde={class:"md-check"},Ede={class:"md-name"},Tde={key:3,class:"md-divider"},Nde={class:"md-name"},Ide={key:0,class:"md-note"},Lde=["aria-label"],$de=["disabled","onClick"],Fde={class:"md-cache-note"},Ode={class:"md-name"},Bde={class:"drop-card"},D3=36,Rde=Je({__name:"Composer",props:{running:{type:Boolean,default:!1},starting:{type:Boolean,default:!1},sessionId:{},queued:{default:()=>[]},searchFiles:{type:Function,default:void 0},uploadImage:{type:Function,default:void 0},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},goalMode:{type:Boolean},goal:{},activationBadges:{},models:{default:()=>[]},starredIds:{default:()=>[]},skills:{default:()=>[]},hideContext:{type:Boolean}},emits:["submit","steer","command","interrupt","setPermission","setThinking","togglePlan","toggleSwarm","toggleGoal","openBtw","createGoal","controlGoal","focusGoal","focusSwarm","compact","pickModel","selectModel"],setup(e,{expose:t,emit:n}){const o=e,s=D(()=>o.starting?r("composer.starting"):o.running?r("composer.placeholderRunning"):o.goalMode?r("status.goalPlaceholder"):r("composer.placeholder")),i=n,{t:r,locale:l}=$t(),{text:a,textareaRef:c,autosize:u,loadForEdit:d,clearDraft:f}=Cue({sessionId:()=>o.sessionId}),h=oe(!1);function p(){h.value=!h.value,yt(()=>{u(),g(),c.value?.focus()})}function m(){h.value&&(h.value=!1,yt(u))}function y(Ke){if(typeof getComputedStyle>"u")return D3;const Re=Number.parseFloat(getComputedStyle(Ke).minHeight);return Number.isFinite(Re)&&Re>0?Re:D3}const k=oe(!1);function g(){const Ke=c.value;k.value=!!Ke&&Ke.scrollHeight>y(Ke)}et(a,()=>{yt(g)}),et(()=>o.sessionId,()=>{h.value=!1});const v=wue({text:a,textareaRef:c,autosize:u,sessionId:()=>o.sessionId}),{open:b,items:A,active:I,update:N,select:M}=_ue({text:a,textareaRef:c,autosize:u,skills:()=>o.skills,emitCommand:Ke=>i("command",Ke),historyPush:Ke=>v.push(Ke),clearDraft:f}),{open:$,items:T,active:F,loading:S,update:B,select:W}=Sue({text:a,textareaRef:c,autosize:u,searchFiles:()=>o.searchFiles});function z(){v.resetBrowsing(),N(),B()}const{attachments:L,previewAttachment:O,fileInputRef:U,isDragOver:Z,removeAttachment:ie,openAttachmentPreview:q,closeAttachmentPreview:ee,openFilePicker:fe,handleFileInputChange:ne,handleDragOver:j,handleDragLeave:K,handleDrop:ve,clearAfterSubmit:he,loadAttachments:Ae}=Aue({uploadImage:()=>o.uploadImage,sessionId:()=>o.sessionId});An(()=>{a.value&&yt(()=>{u(),g()})}),On(()=>{document.removeEventListener("mousedown",nn),V()});function re(){c.value?.focus({preventScroll:!0})}function Y(Ke){Ae(Ke)}t({loadForEdit:d,loadAttachmentsForEdit:Y,focus:re});function Q(Ke){return{fileId:Ke.fileId,kind:Ke.kind,name:Ke.name,mediaType:Ke.mediaType,size:Ke.size}}function P(Ke){if(Ke.kind==="file"){Ke.fileId!==void 0&&eT(Ke.fileId,Ke.name,Ke.mediaType);return}q(Ke)}function G(){const Ke=a.value.trim();if(L.value.some(Te=>Te.uploading))return;const Re=L.value.filter(Te=>!Te.uploading&&!Te.error&&Te.fileId);if(!Ke&&Re.length===0)return;if(v.push(Ke),Ke){const Te=hue(Ke),ge=Te?cT(o.skills).some(Ee=>Ee.name===Te.cmd||Ee.name===`/${Zm}${Te.cmd.slice(1)}`):!1;if(Te&&ge){a.value="",f(),b.value=!1,m(),i("command",Te.arg?`${Te.cmd} ${Te.arg}`:Te.cmd);return}}const le={text:Ke,attachments:Re.map(Te=>Q(Te))};O.value=null,he(),a.value="",f(),b.value=!1,$.value=!1,m(),i("submit",le)}function me(){if(!o.running||L.value.some(Te=>Te.uploading))return;const Ke=a.value.trim(),Re=L.value.filter(Te=>!Te.uploading&&!Te.error&&Te.fileId);if(!Ke&&Re.length===0&&o.queued.length===0)return;const le={text:Ke,attachments:Re.map(Te=>Q(Te))};he(),v.push(Ke),a.value="",f(),b.value=!1,$.value=!1,m(),i("steer",le)}let ye=!1,de=null;function V(){de!==null&&(clearTimeout(de),de=null)}function se(){V(),ye=!0}function pe(){V(),de=setTimeout(()=>{de=null,ye=!1},0)}function ke(Ke){return ye||Ke.isComposing||Ke.keyCode===229}function Ne(Ke){if(!ke(Ke)){if(Ke.key==="Escape"){if(xe.value){Ke.preventDefault(),ut();return}if(Ze.value){Ke.preventDefault(),Tt();return}}if(b.value){if(Ke.key==="ArrowDown"){Ke.preventDefault(),I.value=(I.value+1)%A.value.length;return}if(Ke.key==="ArrowUp"){Ke.preventDefault(),I.value=(I.value-1+A.value.length)%A.value.length;return}if(Ke.key==="Enter"||Ke.key==="Tab"){Ke.preventDefault();const Re=A.value[I.value];Re&&M(Re);return}if(Ke.key==="Escape"){Ke.preventDefault(),b.value=!1;return}}if($.value&&!S.value){if(Ke.key==="ArrowDown"){Ke.preventDefault(),F.value=(F.value+1)%Math.max(1,T.value.length);return}if(Ke.key==="ArrowUp"){Ke.preventDefault(),F.value=(F.value-1+Math.max(1,T.value.length))%Math.max(1,T.value.length);return}if(Ke.key==="Enter"||Ke.key==="Tab"){Ke.preventDefault();const Re=T.value[F.value];Re&&W(Re);return}if(Ke.key==="Escape"){Ke.preventDefault(),$.value=!1;return}}if(Ke.key==="s"&&(Ke.ctrlKey||Ke.metaKey)&&!Ke.shiftKey&&!Ke.altKey){o.running&&(Ke.preventDefault(),me());return}if(!h.value&&!b.value&&!$.value&&!Ke.shiftKey&&!Ke.altKey&&!Ke.metaKey&&!Ke.ctrlKey){const Re=v.isBrowsing();if(Ke.key==="ArrowUp"&&v.hasHistory()&&(Re||v.caretAtTextStart())){Ke.preventDefault(),v.recallOlder();return}if(Ke.key==="ArrowDown"&&Re){Ke.preventDefault(),v.recallNewer();return}}if(Ke.key==="Enter"&&!Ke.shiftKey){if(h.value&&!(Ke.metaKey||Ke.ctrlKey))return;Ke.preventDefault(),G()}}}const qe=D(()=>r("composer.send")),be=D(()=>!!o.uploadImage),xe=oe(!1),Ze=oe(!1),tt=oe(null);function lt(){xe.value=!xe.value,xe.value?(Ze.value=!1,xn(),document.addEventListener("click",wt,!0)):document.removeEventListener("click",wt,!0)}function ut(){xe.value=!1,Ze.value||document.removeEventListener("click",wt,!0)}function mt(){Ze.value=!Ze.value,Ze.value?(xe.value=!1,xn(),document.addEventListener("click",wt,!0)):document.removeEventListener("click",wt,!0)}function Tt(){Ze.value=!1,xe.value||document.removeEventListener("click",wt,!0)}function wt(Ke){tt.value&&!tt.value.contains(Ke.target)&&(ut(),Tt())}On(()=>{document.removeEventListener("click",wt,!0)});const Ft=D(()=>{const Ke=o.status?.ctxMax??0;return Ke<=0?0:Math.min(100,Math.max(0,Math.ceil((o.status?.ctxUsed??0)/Ke*100)))}),en=D(()=>{const Ke=pr(o.status?.ctxUsed??0),Re=pr(o.status?.ctxMax??0);return r("status.ctxTooltip",{used:Ke,max:Re,pct:Ft.value})}),Hn=D(()=>Ft.value>=80),Pt=D(()=>o.models?.find(Ke=>Ke.id===o.status?.modelId)),bn=D(()=>o0(Pt.value)),pn=D(()=>s0(Pt.value)),Kt=D(()=>Xm(Pt.value,o.thinking)),Nn=D(()=>pn.value.includes(Kt.value)?Kt.value:""),Gt=D(()=>vue(Kt.value)),Wt=D(()=>bn.value==="unsupported"||pn.value.length<=1),mn=D(()=>{if(!Gt.value)return"";const Ke=(Pt.value?.supportEfforts?.length??0)>0,Re=Kt.value;return Ke&&Re!=="on"?r("composer.thinkingSuffixEffort",{level:Re}):r("composer.thinkingSuffix")});function so(Ke){Wt.value||i("setThinking",hb(Pt.value,Ke))}function gn(Ke){return Ke==="on"?r("status.thinkingOn"):Ke==="off"?r("status.thinkingOff"):hk(Ke)}const to=D(()=>o.planMode===!0),vt=D(()=>o.swarmMode===!0),Wn=D(()=>o.goal?.status??o.activationBadges?.goal?.status??null),Bn=D(()=>Wn.value!==null&&Wn.value!=="complete"),Qn=D(()=>Bn.value||o.goalMode===!0),sn=D(()=>Wn.value==="active"),es=D(()=>Wn.value==="paused"||Wn.value==="blocked"),nt=oe(!1),Be=oe(null),Bt=oe(null),Yt=oe({}),vn=D(()=>to.value||vt.value||Qn.value);function xn(){nt.value=!1,document.removeEventListener("mousedown",nn)}function nn(Ke){const Re=Ke.target;Be.value?.contains(Re)||Bt.value?.contains(Re)||xn()}function Vn(){if(nt.value){xn();return}ut(),Tt();const Ke=Be.value?.getBoundingClientRect();Ke&&(Yt.value={left:`${Math.round(Ke.left)}px`,bottom:`${Math.round(window.innerHeight-Ke.top+8)}px`}),nt.value=!0,setTimeout(()=>document.addEventListener("mousedown",nn),0)}const Kn=[{mode:"manual",color:"var(--dim)",labelKey:"status.permissionManual",descKey:"status.permissionManualDesc"},{mode:"yolo",color:"var(--color-warning)",labelKey:"status.permissionYolo",descKey:"status.permissionYoloDesc"},{mode:"auto",color:"var(--color-danger)",labelKey:"status.permissionAuto",descKey:"status.permissionAutoDesc"}],Jn=["status.planDesc","status.swarmDesc","status.goalDesc"],Oo=oe(null),ko=oe(""),li=oe("");function Uo(Ke){const Re={};return Ke&&(Re["--composer-menu-desc-width"]=Ke),Re}const As=D(()=>Uo(ko.value)),cs=D(()=>Uo(li.value)),qo=D(()=>({...Yt.value,...cs.value}));let Bo=null;function ai(Ke){const Re=Number.parseFloat(Ke);return Number.isFinite(Re)?Re:0}function tn(Ke){return`${Ke.fontStyle||"normal"} ${Ke.fontWeight||"400"} ${Ke.fontSize} ${Ke.fontFamily}`}function qs(Ke){return Ke.letterSpacing==="normal"?0:ai(Ke.letterSpacing)}function io(Ke,Re){if(!Ke)return 0;const le=Zce(Ke,tn(Re),{letterSpacing:qs(Re)});return Xce(le)}function js(){const Ke=Oo.value?.querySelector(".pd-desc");if(!Ke)return;const Re=getComputedStyle(Ke),le=Math.max(0,...Kn.map(ge=>io(r(ge.descKey),Re))),Te=Math.max(0,...Jn.map(ge=>io(r(ge),Re)));ko.value=le>0?`${Math.ceil(le)}px`:"",li.value=Te>0?`${Math.ceil(Te)}px`:""}function ci(){typeof window>"u"||(Bo!==null&&window.cancelAnimationFrame(Bo),yt(()=>{Bo=window.requestAnimationFrame(()=>{Bo=null,js()})}))}et(l,ci,{immediate:!0}),An(()=>{ci(),document.fonts?.ready.then(ci)}),On(()=>{Bo!==null&&(window.cancelAnimationFrame(Bo),Bo=null)});function Ni(Ke){i("setPermission",Ke),Tt()}const ui=D(()=>Kn.find(Ke=>Ke.mode===o.status?.permission)),Vs=D(()=>ui.value?r(ui.value.labelKey):""),ts=D(()=>Pt.value?.provider??""),ns=D(()=>!ts.value||!o.models?.length?[]:o.models.filter(Ke=>Ke.provider===ts.value)),zt=D(()=>new Set(o.starredIds??[]));function Ms(Ke){return zt.value.has(Ke)}const No=D(()=>o.models?.length?o.models.filter(Ke=>Ms(Ke.id)&&Ke.provider!==ts.value):[]);function di(Ke){i("selectModel",Ke),ut()}return(Ke,Re)=>(x(),E("div",{class:Ue(["composer",{"drag-over":C(Z),expanded:h.value}]),onDragover:Re[18]||(Re[18]=(...le)=>C(j)&&C(j)(...le)),onDragleave:Re[19]||(Re[19]=(...le)=>C(K)&&C(K)(...le)),onDrop:Re[20]||(Re[20]=(...le)=>C(ve)&&C(ve)(...le))},[C(L).length>0?(x(),E("div",Fue,[(x(!0),E(We,null,rt(C(L),le=>(x(),Se(QE,{key:le.localId,kind:le.kind,name:le.name,url:le.previewUrl,"file-id":le.fileId,"media-type":le.mediaType,size:le.size,uploading:le.uploading,error:le.error,removable:"","remove-label":C(r)("composer.removeNamed",{name:le.name}),onActivate:Te=>P(le),onRemove:Te=>C(ie)(le.localId)},null,8,["kind","name","url","file-id","media-type","size","uploading","error","remove-label","onActivate","onRemove"]))),128))])):ue("",!0),C(O)?(x(),E("div",{key:1,class:"att-lightbox",onClick:Re[1]||(Re[1]=St((...le)=>C(ee)&&C(ee)(...le),["self"]))},[w("div",Oue,[ae(an,{text:C(r)("model.close")},{default:Ie(()=>[w("button",{type:"button",class:"att-lightbox-close",onClick:Re[0]||(Re[0]=(...le)=>C(ee)&&C(ee)(...le))},"✕")]),_:1},8,["text"]),C(O).kind==="video"?(x(),E("video",{key:0,class:"att-lightbox-media",src:C(O).previewUrl,controls:"",playsinline:""},null,8,Bue)):(x(),E("img",{key:1,class:"att-lightbox-media",src:C(O).previewUrl,alt:C(O).name},null,8,Rue)),w("div",Due,R(C(O).name),1)])])):ue("",!0),w("div",Pue,[w("div",Hue,[C(b)?(x(),Se(oue,{key:0,items:C(A),"active-index":C(I),onSelect:C(M),onHover:Re[2]||(Re[2]=le=>I.value=le)},null,8,["items","active-index","onSelect"])):ue("",!0),C($)?(x(),Se(fue,{key:1,items:C(T),"active-index":C(F),loading:C(S),onSelect:C(W),onHover:Re[3]||(Re[3]=le=>F.value=le)},null,8,["items","active-index","loading","onSelect"])):ue("",!0),w("div",Wue,[qn(w("textarea",{ref_key:"textareaRef",ref:c,"onUpdate:modelValue":Re[4]||(Re[4]=le=>vo(a)?a.value=le:null),class:"ph",placeholder:s.value,disabled:e.starting,rows:"1",onKeydown:Ne,onCompositionstart:se,onCompositionend:pe,onInput:z},null,40,zue),[[Cs,C(a)]]),h.value||k.value?(x(),E("button",{key:0,class:"expand-btn",type:"button","aria-label":h.value?C(r)("composer.collapseTitle"):C(r)("composer.expandTitle"),onClick:p},[h.value?(x(),Se(Ge,{key:0,name:"collapse",size:"sm"})):(x(),Se(Ge,{key:1,name:"expand",size:"sm"}))],8,Uue)):ue("",!0)])]),be.value?(x(),E("input",{key:0,ref_key:"fileInputRef",ref:U,type:"file",multiple:"",class:"file-input-hidden",onChange:Re[5]||(Re[5]=(...le)=>C(ne)&&C(ne)(...le))},null,544)):ue("",!0),w("div",{ref_key:"toolbarRef",ref:tt,class:"toolbar"},[w("div",{ref_key:"menuMeasureRef",ref:Oo,class:"menu-measure","aria-hidden":"true"},[...Re[21]||(Re[21]=[w("span",{class:"pd-desc"},null,-1)])],512),w("div",que,[be.value?(x(),Se(Xn,{key:0,size:"md",label:C(r)("composer.attachFile"),onClick:C(fe)},{default:Ie(()=>[ae(Ge,{name:"attachment"})]),_:1},8,["label","onClick"])):ue("",!0),e.status?(x(),E("span",{key:1,class:Ue(["perm-pill",["perm-"+e.status.permission,{open:Ze.value}]]),role:"button",tabindex:"0",onClick:St(mt,["stop"]),onKeydown:[ur(mt,["enter"]),ur(St(mt,["prevent"]),["space"])]},R(Vs.value),43,jue)):ue("",!0),Ze.value&&e.status?(x(),E("div",{key:2,class:"perm-dropdown",style:on(As.value),role:"menu",onClick:Re[6]||(Re[6]=St(()=>{},["stop"]))},[(x(),E(We,null,rt(Kn,le=>w("button",{key:le.mode,class:Ue(["pd-row",{"is-current":le.mode===e.status.permission}]),role:"menuitem",onClick:Te=>Ni(le.mode)},[w("span",Kue,[le.mode===e.status.permission?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):ue("",!0)]),w("span",Gue,[w("span",{class:"pd-name",style:on({color:le.color})},R(C(r)(le.labelKey)),5),w("span",Yue,R(C(r)(le.descKey)),1)])],10,Vue)),64))],4)):ue("",!0),e.status?(x(),E("div",{key:3,ref_key:"modesRef",ref:Be,class:"modes"},[w("button",{type:"button",class:Ue(["mode-pill",{on:vn.value,open:nt.value}]),onClick:St(Vn,["stop"])},[w("span",Zue,R(C(r)("status.modesLabel")),1),to.value?(x(),E("span",Xue,R(C(r)("status.planLabel")),1)):ue("",!0),vt.value?(x(),E("span",Que,R(C(r)("status.swarmLabel")),1)):ue("",!0),Qn.value?(x(),E("span",Jue,R(C(r)("status.goalLabel")),1)):ue("",!0)],2),nt.value?(x(),E("div",{key:0,ref_key:"modesMenuRef",ref:Bt,class:"modes-menu",style:on(qo.value),role:"menu"},[w("button",{type:"button",class:Ue(["mode-row",{on:to.value}]),role:"menuitem",onClick:Re[7]||(Re[7]=le=>i("togglePlan"))},[w("span",ede,[ae(Ge,{name:"file-edit",size:"sm"})]),w("span",tde,[w("span",nde,R(C(r)("status.planLabel")),1),w("span",ode,R(C(r)("status.planDesc")),1)]),w("span",{class:Ue(["mode-switch",{on:to.value}])},[...Re[22]||(Re[22]=[w("span",{class:"mode-knob"},null,-1)])],2)],2),w("button",{type:"button",class:Ue(["mode-row",{on:vt.value}]),role:"menuitem",onClick:Re[8]||(Re[8]=le=>i("toggleSwarm"))},[w("span",sde,[ae(Ge,{name:"sparkles",size:"sm"})]),w("span",ide,[w("span",rde,R(C(r)("status.swarmLabel")),1),w("span",lde,R(C(r)("status.swarmDesc")),1)]),w("span",{class:Ue(["mode-switch",{on:vt.value}])},[...Re[23]||(Re[23]=[w("span",{class:"mode-knob"},null,-1)])],2)],2),w("div",{class:Ue(["mode-row mode-row-goal",{on:Bn.value||o.goalMode}])},[w("button",{type:"button",class:"mode-row-main",role:"menuitem",onClick:Re[9]||(Re[9]=le=>Bn.value?i("focusGoal"):i("toggleGoal"))},[w("span",ade,[ae(Ge,{name:"target",size:"sm"})]),w("span",cde,[w("span",ude,R(C(r)("status.goalLabel")),1),w("span",dde,R(C(r)("status.goalDesc")),1)]),Bn.value?ue("",!0):(x(),E("span",{key:0,class:Ue(["mode-switch",{on:o.goalMode}])},[...Re[24]||(Re[24]=[w("span",{class:"mode-knob"},null,-1)])],2))]),Bn.value?(x(),E("div",fde,[sn.value?(x(),Se(jt,{key:0,size:"sm",variant:"secondary",class:"mode-row-action",onClick:Re[10]||(Re[10]=le=>i("controlGoal","pause"))},{default:Ie(()=>[ae(Ge,{name:"pause",size:"sm"}),w("span",null,R(C(r)("status.goalPause")),1)]),_:1})):ue("",!0),es.value?(x(),Se(jt,{key:1,size:"sm",variant:"primary",class:"mode-row-action",onClick:Re[11]||(Re[11]=le=>i("controlGoal","resume"))},{default:Ie(()=>[ae(Ge,{name:"play",size:"sm"}),w("span",null,R(C(r)("status.goalResume")),1)]),_:1})):ue("",!0),ae(jt,{size:"sm",variant:"danger-soft",class:"mode-row-action",onClick:Re[12]||(Re[12]=le=>i("controlGoal","cancel"))},{default:Ie(()=>[ae(Ge,{name:"close",size:"sm"}),w("span",null,R(C(r)("status.goalCancel")),1)]),_:1})])):ue("",!0)],2)],4)):ue("",!0)],512)):ue("",!0)]),w("div",hde,[Hn.value?(x(),E("button",{key:0,class:"compact-chip",onClick:Re[13]||(Re[13]=St(le=>i("compact"),["stop"]))},"/compact")):ue("",!0),ae(an,{text:en.value},{default:Ie(()=>[e.status&&!e.hideContext?(x(),E("span",{key:0,class:"ctx-group",role:"img",tabindex:"0","aria-label":en.value},[ae($ue,{pct:Ft.value},null,8,["pct"])],8,pde)):ue("",!0)]),_:1},8,["text"]),e.status?(x(),E("span",{key:1,class:Ue(["model-pill",{open:xe.value}]),role:"button",tabindex:"0",onClick:St(lt,["stop"]),onKeydown:[ur(lt,["enter"]),ur(St(lt,["prevent"]),["space"])]},[w("b",null,R(e.status.model),1),mn.value?(x(),E("span",gde,R(mn.value),1)):ue("",!0),ae(Ge,{class:"cv",name:"chevron-down",size:"sm"})],42,mde)):ue("",!0),e.running?(x(),Se(an,{key:2,text:C(r)("composer.interruptTitle")},{default:Ie(()=>[w("button",{class:"stop","aria-label":C(r)("composer.interrupt"),onClick:Re[14]||(Re[14]=le=>i("interrupt"))},[ae(Ge,{name:"stop",size:"sm"})],8,vde)]),_:1},8,["text"])):ue("",!0),w("button",{class:Ue(["send",{"is-starting":e.starting}]),"aria-label":qe.value,disabled:e.starting,onClick:Re[15]||(Re[15]=le=>G())},[e.starting?(x(),Se(Us,{key:0,size:"sm"})):(x(),Se(Ge,{key:1,name:"send",size:"sm"}))],10,yde)]),xe.value&&e.status?(x(),E("div",{key:0,class:"model-dropdown",role:"menu",onClick:Re[17]||(Re[17]=St(()=>{},["stop"]))},[No.value.length>0?(x(),E("div",kde,R(C(r)("status.starredModels")),1)):ue("",!0),(x(!0),E(We,null,rt(No.value,le=>(x(),E("button",{key:le.id,class:Ue(["md-row",{"is-current":le.id===e.status.modelId}]),role:"menuitem",onClick:Te=>di(le.id)},[w("span",xde,[le.id===e.status.modelId?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):ue("",!0)]),w("span",wde,R(le.displayName??le.model),1),w("span",_de,R(le.provider),1),ae(Ge,{class:"md-star",name:"star",size:"sm"})],10,bde))),128)),No.value.length>0?(x(),E("div",Sde)):ue("",!0),ns.value.length>0?(x(),E("div",Cde,R(ts.value),1)):ue("",!0),(x(!0),E(We,null,rt(ns.value,le=>(x(),E("button",{key:le.id,class:Ue(["md-row",{"is-current":le.id===e.status.modelId}]),role:"menuitem",onClick:Te=>di(le.id)},[w("span",Mde,[le.id===e.status.modelId?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):ue("",!0)]),w("span",Ede,R(le.displayName??le.model),1),Ms(le.id)?(x(),Se(Ge,{key:0,class:"md-star",name:"star",size:"sm"})):ue("",!0)],10,Ade))),128)),ns.value.length>0?(x(),E("div",Tde)):ue("",!0),w("div",{class:Ue(["md-thinking",{"is-readonly":Wt.value}])},[w("span",Nde,R(C(r)("status.thinkingLabel")),1),bn.value==="unsupported"?(x(),E("span",Ide,R(C(r)("status.modeNotSupported")),1)):(x(),E("div",{key:1,class:"effort-segments",role:"group","aria-label":C(r)("status.thinkingLabel")},[(x(!0),E(We,null,rt(pn.value,le=>(x(),E("button",{key:le,type:"button",class:Ue(["effort-seg",{"is-active":le===Nn.value}]),disabled:Wt.value,onClick:Te=>so(le)},R(gn(le)),11,$de))),128))],8,Lde))],2),Re[25]||(Re[25]=w("div",{class:"md-divider"},null,-1)),w("div",Fde,R(C(r)("status.cacheNote")),1),Re[26]||(Re[26]=w("div",{class:"md-divider"},null,-1)),w("button",{class:"md-row md-row-more",role:"menuitem",onClick:Re[16]||(Re[16]=le=>{ut(),i("pickModel")})},[w("span",Ode,R(C(r)("status.moreModels")),1)])])):ue("",!0)],512)]),w("div",{class:Ue(["drop-overlay",{show:C(Z)}]),"aria-hidden":"true"},[w("div",Bde,[ae(Ge,{name:"file-plus",size:"lg"}),w("span",null,R(C(r)("composer.dropToAttach")),1)])],2)],34))}}),dT=dt(Rde,[["__scopeId","data-v-a89f6a49"]]),Dde={key:0,class:"ui-card__head"},Pde={class:"ui-card__body"},Hde={key:1,class:"ui-card__foot"},Wde=Je({__name:"Card",props:{elevated:{type:Boolean,default:!1}},setup(e){return(t,n)=>(x(),E("div",{class:Ue(["ui-card",{"is-elevated":e.elevated}])},[t.$slots.head?(x(),E("div",Dde,[jn(t.$slots,"head",{},void 0,!0)])):ue("",!0),w("div",Pde,[jn(t.$slots,"default",{},void 0,!0)]),t.$slots.foot?(x(),E("div",Hde,[jn(t.$slots,"foot",{},void 0,!0)])):ue("",!0)],2))}}),pb=dt(Wde,[["__scopeId","data-v-9c9f9a9a"]]),zde={class:"goal-kicker"},Ude={key:0,class:"goal-progress","aria-hidden":"true"},qde={class:"goal-full"},jde={key:0,class:"goal-criterion"},Vde=["inert","aria-hidden"],Kde={class:"goal-meta"},Gde={key:0},Yde={class:"goal-actions"},Zde=Je({__name:"GoalStrip",props:{goal:{},forceExpanded:{}},emits:["controlGoal"],setup(e,{emit:t}){const n=e,o=t,{t:s}=$t(),{confirm:i}=Gf(),r=oe(!1);et(()=>n.forceExpanded,()=>{n.forceExpanded!==void 0&&(r.value=!0)});const l=D(()=>{const d=n.goal.budget.tokenBudget;return!d||d<=0?0:Math.max(0,Math.min(100,Math.round(n.goal.tokensUsed/d*100)))});function a(d){switch(d){case"active":return s("status.goalStatusActive");case"paused":return s("status.goalStatusPaused");case"blocked":return s("status.goalStatusBlocked");case"complete":return s("status.goalStatusComplete")}}function c(d){const f=Math.max(0,Math.round(d/1e3)),h=Math.floor(f/60),p=f%60;return h<=0?`${p}s`:h<60?`${h}m ${p}s`:`${Math.floor(h/60)}h ${h%60}m`}async function u(){await i({title:s("status.goalCancel"),message:s("status.goalCancelConfirm"),confirmLabel:s("status.goalCancelConfirmYes"),cancelLabel:s("status.goalCancelConfirmNo"),variant:"danger"})&&o("controlGoal","cancel")}return(d,f)=>(x(),Se(pb,{class:Ue(["goal-strip",{expanded:r.value}])},{head:Ie(()=>[w("button",{class:"goal-row",type:"button",onClick:f[0]||(f[0]=h=>r.value=!r.value)},[ae(Ge,{class:"goal-icon",name:"target",size:"md"}),w("span",zde,R(C(s)("status.goalLabel")),1),w("span",{class:Ue(["goal-objective",{"expanded-hidden":r.value}])},R(e.goal.objective),3),ae(qi,{variant:e.goal.status==="active"?"success":e.goal.status==="blocked"?"danger":e.goal.status==="paused"?"warning":"neutral",size:"sm",class:"goal-status"},{default:Ie(()=>[ot(R(a(e.goal.status)),1)]),_:1},8,["variant"]),e.goal.budget.tokenBudget!==null?(x(),E("span",Ude,[w("span",{class:"goal-progress-fill",style:on({width:`${l.value}%`})},null,4)])):ue("",!0),ae(Ge,{class:Ue(["goal-chevron",{open:r.value}]),name:"chevron-right",size:"md"},null,8,["class"])])]),default:Ie(()=>[w("div",qde,R(e.goal.objective),1),e.goal.completionCriterion?(x(),E("div",jde,[f[3]||(f[3]=w("span",null,"Done when",-1)),w("p",null,R(e.goal.completionCriterion),1)])):ue("",!0)]),foot:Ie(()=>[w("div",{class:"goal-footer",inert:!r.value,"aria-hidden":!r.value},[w("div",Kde,[w("span",null,R(e.goal.turnsUsed)+" turns",1),w("span",null,R(C(pr)(e.goal.tokensUsed))+" tokens",1),w("span",null,R(c(e.goal.wallClockMs)),1),e.goal.budget.tokenBudget!==null?(x(),E("span",Gde,R(l.value)+"% token budget",1)):ue("",!0)]),w("div",Yde,[e.goal.status==="active"?(x(),Se(jt,{key:0,size:"sm",variant:"secondary",class:"goal-action",onClick:f[1]||(f[1]=St(h=>o("controlGoal","pause"),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"pause",size:"md"}),w("span",null,R(C(s)("status.goalPause")),1)]),_:1})):ue("",!0),e.goal.status==="paused"||e.goal.status==="blocked"?(x(),Se(jt,{key:1,size:"sm",variant:"primary",class:"goal-action",onClick:f[2]||(f[2]=St(h=>o("controlGoal","resume"),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"play",size:"md"}),w("span",null,R(C(s)("status.goalResume")),1)]),_:1})):ue("",!0),ae(jt,{size:"sm",variant:"danger-soft",class:"goal-action",onClick:St(u,["stop"])},{default:Ie(()=>[ae(Ge,{name:"close",size:"md"}),w("span",null,R(C(s)("status.goalCancel")),1)]),_:1})])],8,Vde)]),_:1},8,["class"]))}}),Xde=dt(Zde,[["__scopeId","data-v-44bef30f"]]),Qde={class:"qh"},Jde={class:"qtitle"},efe={key:0,class:"qstep"},tfe={key:1,class:"qmin-peek"},nfe={class:"qbody"},ofe=["aria-label"],sfe=["aria-selected","aria-label","onClick"],ife={class:"qstep-num"},rfe={key:1,class:"qheader-chip"},lfe={class:"qtext"},afe={class:"qopts"},cfe=["onClick"],ufe={class:"qopt-key"},dfe={class:"qopt-glyph"},ffe={key:0,class:"chk"},hfe={key:1,class:"rad"},pfe={class:"qopt-text"},mfe={class:"qopt-label"},gfe={key:0,class:"qopt-desc"},vfe={class:"qopt-glyph"},yfe={key:0,class:"chk"},kfe={key:1,class:"rad"},bfe={class:"qopt-label"},xfe=["placeholder"],wfe={class:"qfoot"},_fe=Je({__name:"QuestionCard",props:{question:{},busyKind:{}},emits:["answer","dismiss"],setup(e,{emit:t}){const n=e,{t:o}=$t(),s=t,i=oe(0),r=oe(!1),l=D(()=>n.question.questions[i.value]),a=D(()=>n.question.questions.length);function c(){i.value>0&&i.value--}function u(){i.value<a.value-1&&i.value++}function d(L){L>=0&&L<a.value&&(i.value=L)}function f(L){const O=p.value[L];return O?O.kind==="multi"?O.optionIds.length>0:O.kind==="multiWithOther"?O.optionIds.length>0||O.otherText.trim().length>0:O.kind==="other"?O.text.trim().length>0:!0:!1}function h(){return f(l.value.id)}const p=oe({});function m(L){return L.recommended===!0?!0:/\b(?:recommended|recommend)\b|推荐/.test(`${L.label} ${L.description??""}`.toLowerCase())}function y(){const L={...p.value};let O=!1;for(const U of n.question.questions){if(L[U.id])continue;const Z=U.options.filter(m);Z.length!==0&&(L[U.id]=U.multiSelect?{kind:"multi",optionIds:Z.map(ie=>ie.id)}:{kind:"single",optionId:Z[0].id},O=!0)}O&&(p.value=L)}et(()=>n.question.questionId,()=>{i.value=0,r.value=!1,p.value={},v.value={}}),et(()=>n.question,()=>{i.value>=n.question.questions.length&&(i.value=0),y()},{immediate:!0,deep:!0});function k(L,O){const U=p.value[L];if(U&&U.kind==="single"&&U.optionId===O){const Z={...p.value};delete Z[L],p.value=Z}else p.value={...p.value,[L]:{kind:"single",optionId:O}}}function g(L,O){const U=p.value[L],Z=U&&(U.kind==="multi"||U.kind==="multiWithOther")?U.kind==="multi"?[...U.optionIds]:[...U.optionIds]:[],ie=Z.indexOf(O);ie>=0?Z.splice(ie,1):Z.push(O);const q=p.value[L],ee=q&&q.kind==="multiWithOther"?q.otherText:"";ee?p.value={...p.value,[L]:{kind:"multiWithOther",optionIds:Z,otherText:ee}}:p.value={...p.value,[L]:{kind:"multi",optionIds:Z}}}const v=oe({}),b=oe(null);function A(L){const O=n.question.questions.find(Z=>Z.id===L),U=v.value[L]??"";if(O.multiSelect){const Z=p.value[L],ie=Z&&(Z.kind==="multi"||Z.kind==="multiWithOther")?Z.kind==="multi"?[...Z.optionIds]:[...Z.optionIds]:[];p.value={...p.value,[L]:{kind:"multiWithOther",optionIds:ie,otherText:U}}}else p.value={...p.value,[L]:{kind:"other",text:U}}}function I(L){A(L),yt(()=>b.value?.focus())}function N(L,O){const U=p.value[L];return U?U.kind==="single"?U.optionId===O:U.kind==="multi"||U.kind==="multiWithOther"?U.optionIds.includes(O):!1:!1}function M(L){const O=p.value[L];return!!(O&&(O.kind==="other"||O.kind==="multiWithOther"))}function $(){return n.question.questions.every(L=>f(L.id))}const T=D(()=>n.busyKind==="answer"),F=D(()=>n.busyKind==="dismiss"),S=D(()=>!!n.busyKind);function B(){if(S.value||!$())return;const L={answers:p.value,method:"click"};s("answer",n.question.questionId,L)}function W(){S.value||s("dismiss",n.question.questionId)}function z(L){const O=(document.activeElement?.tagName??"").toLowerCase(),U=O==="input"||O==="textarea";if(S.value)return;if(L.key==="Enter"){if(L.preventDefault(),r.value)return;i.value<a.value-1&&h()?u():$()&&B();return}if(U)return;if(L.key==="Escape"){L.preventDefault(),W();return}if(r.value)return;const Z=parseInt(L.key,10);if(!isNaN(Z)&&Z>=1&&Z<=9){L.preventDefault();const ie=l.value,q=Z-1,ee=ie.options[q];ee&&(ie.multiSelect?g(ie.id,ee.id):k(ie.id,ee.id))}}return An(()=>document.addEventListener("keydown",z)),On(()=>document.removeEventListener("keydown",z)),(L,O)=>(x(),Se(pb,{class:Ue(["qcard",{minimized:r.value}])},ZA({head:Ie(()=>[w("div",Qde,[O[5]||(O[5]=w("span",{class:"qh-ic"},"?",-1)),w("span",Jde,R(C(o)("question.title")),1),a.value>1&&!r.value?(x(),E("span",efe,R(C(o)("question.step",{current:i.value+1,total:a.value})),1)):ue("",!0),r.value?(x(),E("span",tfe,R(l.value.question),1)):ue("",!0),ae(Xn,{class:"qmin",size:"sm",label:r.value?C(o)("question.expand"):C(o)("question.minimize"),onClick:O[0]||(O[0]=U=>r.value=!r.value)},{default:Ie(()=>[r.value?(x(),Se(Ge,{key:0,name:"chevron-up",size:"md"})):(x(),Se(Ge,{key:1,name:"minus",size:"md"}))]),_:1},8,["label"])])]),_:2},[r.value?void 0:{name:"default",fn:Ie(()=>[w("div",nfe,[a.value>1?(x(),E("div",{key:0,class:"qsteps",role:"tablist","aria-label":C(o)("question.step",{current:i.value+1,total:a.value})},[(x(!0),E(We,null,rt(n.question.questions,(U,Z)=>(x(),E("button",{key:U.id,type:"button",class:Ue(["qstep-dot",{active:Z===i.value,answered:f(U.id)}]),"aria-selected":Z===i.value,"aria-label":C(o)("question.step",{current:Z+1,total:a.value}),onClick:ie=>d(Z)},[w("span",ife,R(Z+1),1)],10,sfe))),128))],8,ofe)):ue("",!0),l.value.header?(x(),E("div",rfe,[ae(qi,{variant:"neutral",size:"sm"},{default:Ie(()=>[ot(R(l.value.header),1)]),_:1})])):ue("",!0),w("div",lfe,R(l.value.question),1),l.value.body?(x(),Se(Q1,{key:2,text:l.value.body,class:"qmdbody"},null,8,["text"])):ue("",!0),w("div",afe,[(x(!0),E(We,null,rt(l.value.options,(U,Z)=>(x(),E("label",{key:U.id,class:Ue(["qopt",{selected:N(l.value.id,U.id)}]),onClick:St(ie=>l.value.multiSelect?g(l.value.id,U.id):k(l.value.id,U.id),["prevent"])},[w("span",ufe,R(Z+1),1),w("span",dfe,[l.value.multiSelect?(x(),E("span",ffe,R(N(l.value.id,U.id)?"■":"□"),1)):(x(),E("span",hfe,R(N(l.value.id,U.id)?"●":"○"),1))]),w("span",pfe,[w("span",mfe,R(U.label),1),U.description?(x(),E("span",gfe,R(U.description),1)):ue("",!0)])],10,cfe))),128)),l.value.allowOther?(x(),E("label",{key:0,class:Ue(["qopt",{selected:M(l.value.id)}]),onClick:O[4]||(O[4]=St(U=>I(l.value.id),["prevent"]))},[O[6]||(O[6]=w("span",{class:"qopt-key"},null,-1)),w("span",vfe,[l.value.multiSelect?(x(),E("span",yfe,R(M(l.value.id)?"■":"□"),1)):(x(),E("span",kfe,R(M(l.value.id)?"●":"○"),1))]),w("span",bfe,R(l.value.otherLabel??C(o)("question.otherDefault")),1),qn(w("input",{ref_key:"otherInputEl",ref:b,"onUpdate:modelValue":O[1]||(O[1]=U=>v.value[l.value.id]=U),class:"other-input",type:"text",placeholder:l.value.otherLabel??C(o)("question.otherDefault"),onInput:O[2]||(O[2]=U=>A(l.value.id)),onFocus:O[3]||(O[3]=U=>A(l.value.id))},null,40,xfe),[[Cs,v.value[l.value.id]]])],2)):ue("",!0)])])]),key:"0"},r.value?void 0:{name:"foot",fn:Ie(()=>[w("div",wfe,[i.value<a.value-1?(x(),Se(jt,{key:0,class:"qfoot-btn qfoot-main",size:"sm",variant:"primary",disabled:!h(),onClick:u},{default:Ie(()=>[ot(R(C(o)("question.nextQuestion")),1)]),_:1},8,["disabled"])):(x(),Se(jt,{key:1,class:"qfoot-btn qfoot-main",size:"sm",variant:"primary",disabled:!$(),loading:T.value,onClick:B},{default:Ie(()=>[ot(R(C(o)("question.submit")),1)]),_:1},8,["disabled","loading"])),a.value>1?(x(),Se(jt,{key:2,class:"qfoot-btn",size:"sm",variant:"secondary",disabled:i.value===0||S.value,onClick:c},{default:Ie(()=>[ot(R(C(o)("question.back")),1)]),_:1},8,["disabled"])):ue("",!0),ae(jt,{class:"qfoot-btn",size:"sm",variant:"ghost",loading:F.value,disabled:S.value,onClick:W},{default:Ie(()=>[ot(R(C(o)("question.dismiss")),1)]),_:1},8,["loading","disabled"])])]),key:"1"}]),1032,["class"]))}}),Sfe=dt(_fe,[["__scopeId","data-v-14c58ac1"]]),Cfe={class:"ah"},Afe={class:"akind"},Mfe={class:"apath"},Efe={class:"ah-path"},Tfe={key:1,class:"diff"},Nfe={class:"dg"},Ife={class:"dc"},Lfe={key:2,class:"body-shell"},$fe={class:"shell-cmd"},Ffe={key:0,class:"shell-cwd"},Ofe={key:1,class:"shell-danger"},Bfe={key:3,class:"body-file"},Rfe={class:"file-bar"},Dfe={class:"file-lang"},Pfe={class:"file-content"},Hfe={class:"file-ln"},Wfe={class:"file-text"},zfe={key:4,class:"body-chip"},Ufe={class:"chip-label"},qfe={class:"chip-value"},jfe={key:0,class:"chip-detail"},Vfe={key:5,class:"body-chip"},Kfe={key:0,class:"chip-label"},Gfe={class:"chip-value"},Yfe={key:6,class:"body-chip"},Zfe={class:"chip-label"},Xfe={class:"chip-value"},Qfe={key:0,class:"chip-detail"},Jfe={key:7,class:"body-chip"},ehe={class:"chip-label"},the={class:"chip-value"},nhe={key:0,class:"chip-detail"},ohe={key:8,class:"body-todo"},she={class:"todo-glyph"},ihe={key:9,class:"body-plan"},rhe={key:10,class:"body-generic"},lhe={class:"gen-text"},ahe={key:11,class:"feedback-wrap"},che=["placeholder"],uhe={class:"feedback-hint"},dhe={key:0,class:"plan-actions"},fhe={key:1,class:"abtn"},hhe=Je({__name:"ApprovalCard",props:{block:{},agentName:{},busy:{type:Boolean}},emits:["decide"],setup(e,{emit:t}){const n=e,o=t,{t:s}=$t(),i=D(()=>{const T=n.block;return T.kind!=="plan_review"?null:{plan:T.plan,path:T.path,options:T.options??[]}}),r=oe(!1),l=["shell","diff","file","fileop","url","search","invocation","todo","plan_review","generic"];function a(){const T=l.includes(n.block.kind)?n.block.kind:"generic";return s(`approval.title.${T}`)}const c=oe(!1),u=oe(""),d=oe(null);function f(){n.busy||(c.value=!0,u.value="",setTimeout(()=>d.value?.focus(),0))}function h(){if(n.busy)return;const T=u.value.trim();i.value?k("feedback",{decision:"rejected",selectedLabel:"Revise",feedback:T||void 0}):k("feedback",{decision:"rejected",feedback:T||void 0}),c.value=!1,u.value=""}function p(){c.value=!1,u.value=""}function m(T){T.key==="Enter"&&!T.shiftKey?(T.preventDefault(),h()):T.key==="Escape"&&(T.preventDefault(),p())}const y=oe(null);et(()=>n.busy,T=>{T||(y.value=null)});function k(T,F){n.busy||(y.value=T,o("decide",F))}function g(){k("approve",{decision:"approved"})}function v(){k("approveSession",{decision:"approved",scope:"session"})}function b(){k("reject",{decision:"rejected"})}function A(){k("approvePlan",{decision:"approved"})}function I(T){k(`option:${T}`,{decision:"approved",selectedLabel:T})}function N(){n.busy||f()}function M(){k("rejectAndExit",{decision:"rejected",selectedLabel:"Reject and Exit"})}function $(T){const F=(document.activeElement?.tagName??"").toLowerCase();if(F==="input"||F==="textarea"||n.busy||r.value)return;const S=i.value;if(S){if(S.options.length===0){T.key==="1"?(T.preventDefault(),A()):T.key==="2"?(T.preventDefault(),N()):T.key==="3"&&(T.preventDefault(),M());return}T.key==="1"&&S.options[0]?(T.preventDefault(),I(S.options[0].label)):T.key==="2"&&S.options[1]?(T.preventDefault(),I(S.options[1].label)):T.key==="3"&&S.options[2]&&(T.preventDefault(),I(S.options[2].label));return}T.key==="1"?(T.preventDefault(),g()):T.key==="2"?(T.preventDefault(),v()):T.key==="3"?(T.preventDefault(),b()):T.key==="4"&&(T.preventDefault(),f())}return An(()=>document.addEventListener("keydown",$)),On(()=>document.removeEventListener("keydown",$)),(T,F)=>(x(),Se(pb,{class:Ue(["appr",{minimized:r.value}])},ZA({head:Ie(()=>[w("div",Cfe,[F[2]||(F[2]=w("span",{class:"ah-ic"},"!",-1)),w("span",Afe,R(a()),1),w("span",Mfe,[e.block.kind==="diff"||e.block.kind==="file"||e.block.kind==="fileop"?(x(),E(We,{key:0},[ot(R(e.block.path),1)],64)):e.block.kind==="shell"?(x(),E(We,{key:1},[ot(R(e.block.command),1)],64)):e.block.kind==="url"?(x(),E(We,{key:2},[ot(R(e.block.url),1)],64)):e.block.kind==="search"?(x(),E(We,{key:3},[ot(R(e.block.query),1)],64)):e.block.kind==="invocation"?(x(),E(We,{key:4},[ot(R(e.block.name),1)],64)):e.block.kind==="generic"?(x(),E(We,{key:5},[ot(R(e.block.summary),1)],64)):ue("",!0)]),e.agentName&&!r.value?(x(),Se(qi,{key:0,variant:"neutral",size:"sm"},{default:Ie(()=>[ot(R(C(s)("approval.subagentBadge",{name:e.agentName})),1)]),_:1})):ue("",!0),r.value?ue("",!0):(x(),Se(qi,{key:1,variant:"warning",size:"sm",class:"aw"},{default:Ie(()=>[ot(R(C(s)("approval.required")),1)]),_:1})),ae(Xn,{class:"amin",size:"sm",label:r.value?C(s)("question.expand"):C(s)("question.minimize"),onClick:F[0]||(F[0]=S=>r.value=!r.value)},{default:Ie(()=>[r.value?(x(),Se(Ge,{key:0,name:"chevron-up",size:"md"})):(x(),Se(Ge,{key:1,name:"minus",size:"md"}))]),_:1},8,["label"])])]),_:2},[r.value?void 0:{name:"default",fn:Ie(()=>[e.block.kind==="plan_review"&&e.block.path?(x(),Se(an,{key:0,text:e.block.path},{default:Ie(()=>[w("div",Efe,R(e.block.path),1)]),_:1},8,["text"])):ue("",!0),e.block.kind==="diff"?(x(),E("div",Tfe,[(x(!0),E(We,null,rt(e.block.diff,(S,B)=>(x(),E("div",{key:B,class:Ue(["dl",S.kind==="add"?"add":S.kind==="rem"?"del":""])},[w("span",Nfe,R(S.gutter),1),w("span",Ife,R(S.text),1)],2))),128))])):e.block.kind==="shell"?(x(),E("div",Lfe,[w("div",$fe,[F[3]||(F[3]=w("span",{class:"shell-dollar"},"$",-1)),ot(" "+R(e.block.command),1)]),e.block.cwd?(x(),E("div",Ffe,"cwd: "+R(e.block.cwd),1)):ue("",!0),e.block.danger?(x(),E("div",Ofe,R(C(s)("approval.danger",{detail:e.block.danger})),1)):ue("",!0)])):e.block.kind==="file"?(x(),E("div",Bfe,[w("div",Rfe,[w("span",Dfe,R(e.block.language??""),1)]),w("div",Pfe,[(x(!0),E(We,null,rt(e.block.content.split(`
313
+ `)return"hard-break"}return e===" "?"space":e===" "||e===" "||e==="⁠"||e==="\uFEFF"?"glue":e==="​"?"zero-width-break":e==="­"?"soft-hyphen":"text"}const Gae=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function ji(e){return e.length===1?e[0]:e.join("")}function Yae(e,t){const n=[];for(let o=e.length-1;o>=0;o--)n.push(e[o]);return n.push(t),ji(n)}function Zae(e,t,n,o){if(!Gae.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];const s=[];let i=null,r=[],l=n,a=!1,c=0;for(const u of e){const d=Kae(u,o),f=d==="text"&&t;if(i!==null&&d===i&&f===a){r.push(u),c+=u.length;continue}i!==null&&s.push({text:ji(r),isWordLike:a,kind:i,start:l}),i=d,r=[u],l=n+c,a=f,c+=u.length}return i!==null&&s.push({text:ji(r),isWordLike:a,kind:i,start:l}),s}function fk(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}const Xae=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function Qae(e,t){const n=e.texts[t];return n.startsWith("www.")?!0:Xae.test(n)&&t+1<e.len&&e.kinds[t+1]==="text"&&e.texts[t+1]==="//"}function Jae(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}function ece(e){const t=e.texts.slice(),n=e.isWordLike.slice(),o=e.kinds.slice(),s=e.starts.slice();for(let r=0;r<e.len;r++){if(o[r]!=="text"||!Qae(e,r))continue;const l=[t[r]];let a=r+1;for(;a<e.len&&!fk(o[a]);){l.push(t[a]),n[r]=!0;const c=t[a].includes("?");if(o[a]="text",t[a]="",a++,c)break}t[r]=ji(l)}let i=0;for(let r=0;r<t.length;r++){const l=t[r];l.length!==0&&(i!==r&&(t[i]=l,n[i]=n[r],o[i]=o[r],s[i]=s[r]),i++)}return t.length=i,n.length=i,o.length=i,s.length=i,{len:i,texts:t,isWordLike:n,kinds:o,starts:s}}function tce(e){const t=[],n=[],o=[],s=[];for(let i=0;i<e.len;i++){const r=e.texts[i];if(t.push(r),n.push(e.isWordLike[i]),o.push(e.kinds[i]),s.push(e.starts[i]),!Jae(r))continue;const l=i+1;if(l>=e.len||fk(e.kinds[l]))continue;const a=[],c=e.starts[l];let u=l;for(;u<e.len&&!fk(e.kinds[u]);)a.push(e.texts[u]),u++;a.length>0&&(t.push(ji(a)),n.push(!0),o.push("text"),s.push(c),i=u-1)}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:s}}const nce=new Set([":","-","/","×",",",".","+","–","—"]),oce=/[\p{P}\p{S}\p{Co}]/u,sce=/\p{Emoji_Presentation}/u,ice=new Set(["?","֊","-","‐","‒","–","—","…","‼","‽","⁉"]);function rce(e){return e>=33&&e<=47&&e!==45||e>=58&&e<=64&&e!==63||e>=91&&e<=96||e>=123&&e<=126}function oT(e){const t=e.charCodeAt(0);return t<128?rce(t):!ice.has(e)&&!sce.test(e)&&oce.test(e)}function L3(e){let t=!1;for(const n of e)if(!Xl.test(n)){if(!oT(n))return!1;t=!0}return t}function lce(e){for(let t=e.length;t>0;){const n=e0(e,t),o=e.slice(n,t);if(Xl.test(o)){t=n;continue}return oT(o)||t0(o)}return!1}function ace(e,t,n,o){const s=!t&&L3(e),i=!o&&L3(n),r=Wae(e),l=(t||r)&&lce(e);return!s&&!i&&!l||mr(e)||mr(n)?!1:(t||s||r)&&(o||i)}function sT(e){for(const t of e)if(rb.test(t))return!0;return!1}function Gm(e){if(e.length===0)return!1;for(const t of e)if(!(rb.test(t)||nce.has(t)))return!1;return!0}function cce(e){const t=[],n=[],o=[],s=[];for(let i=0;i<e.len;i++){const r=e.texts[i],l=e.kinds[i];if(l==="text"&&Gm(r)&&sT(r)){const a=[r];let c=i+1;for(;c<e.len&&e.kinds[c]==="text"&&Gm(e.texts[c]);)a.push(e.texts[c]),c++;t.push(ji(a)),n.push(!0),o.push("text"),s.push(e.starts[i]),i=c-1;continue}t.push(r),n.push(e.isWordLike[i]),o.push(l),s.push(e.starts[i])}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:s}}function uce(e){const t=[],n=[],o=[],s=[];let i=0;for(;i<e.len;){const r=e.texts[i],l=e.kinds[i],a=e.isWordLike[i];if(l==="text"){const c=[r];let u=i+1,d=a;for(;u<e.len&&e.kinds[u]==="text"&&ace(e.texts[u-1],e.isWordLike[u-1],e.texts[u],e.isWordLike[u]);){const f=e.texts[u];c.push(f),d=d||e.isWordLike[u],u++}if(u>i+1){t.push(ji(c)),n.push(d),o.push("text"),s.push(e.starts[i]),i=u;continue}}t.push(r),n.push(a),o.push(l),s.push(e.starts[i]),i++}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:s}}function dce(e){const t=[],n=[],o=[],s=[];for(let i=0;i<e.len;i++){const r=e.texts[i];if(e.kinds[i]==="text"&&r.includes("-")){const l=r.split("-");let a=l.length>1;for(let c=0;c<l.length;c++){const u=l[c];if(!a)break;(u.length===0||!sT(u)||!Gm(u))&&(a=!1)}if(a){let c=0;for(let u=0;u<l.length;u++){const d=l[u],f=u<l.length-1?`${d}-`:d;t.push(f),n.push(!0),o.push("text"),s.push(e.starts[i]+c),c+=f.length}continue}}t.push(r),n.push(e.isWordLike[i]),o.push(e.kinds[i]),s.push(e.starts[i])}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:s}}function fce(e){const t=[],n=[],o=[],s=[];let i=0;for(;i<e.len;){const r=[e.texts[i]];let l=e.isWordLike[i],a=e.kinds[i],c=e.starts[i];if(a==="glue"){const u=[r[0]],d=c;for(i++;i<e.len&&e.kinds[i]==="glue";)u.push(e.texts[i]),i++;const f=ji(u);if(i<e.len&&e.kinds[i]==="text")r[0]=f,r.push(e.texts[i]),l=e.isWordLike[i],a="text",c=d,i++;else{t.push(f),n.push(!1),o.push("glue"),s.push(d);continue}}else i++;if(a==="text")for(;i<e.len&&e.kinds[i]==="glue";){const u=[];for(;i<e.len&&e.kinds[i]==="glue";)u.push(e.texts[i]),i++;const d=ji(u);if(i<e.len&&e.kinds[i]==="text"){r.push(d,e.texts[i]),l=l||e.isWordLike[i],i++;continue}r.push(d)}t.push(ji(r)),n.push(l),o.push(a),s.push(c)}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:s}}function hce(e){const t=e.texts.slice(),n=e.isWordLike.slice(),o=e.kinds.slice(),s=e.starts.slice();for(let i=0;i<t.length-1;i++){if(o[i]!=="text"||o[i+1]!=="text"||!mr(t[i])||!mr(t[i+1]))continue;const r=Uae(t[i]);r!==null&&(t[i]=r.head,t[i+1]=r.tail+t[i+1],s[i+1]=s[i]+r.head.length)}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:s}}function pce(e,t,n){const o=Sae();let s=0;const i=[],r=[],l=[],a=[],c=[],u=[],d=[],f=[],h=[],p=[],m=[],y=[];for(const I of o.segment(e))for(const N of Zae(I.segment,I.isWordLike??!1,I.index,n)){let L=function(){u[z]!==null&&(r[z]=[N3(i,u,d,z)],u[z]=null),r[z].push(N.text),l[z]=l[z]||N.isWordLike,f[z]=f[z]||T,h[z]=h[z]||F,p[z]=B,m[z]=W,y[z]=I3(h[z],S)};const M=N.kind==="text",$=qae(N.text,N.isWordLike,N.kind),T=mr(N.text),F=E3(N.text),S=Yf(N.text),B=dk(N.text),W=jae(N.text),z=s-1;t.carryCJKAfterClosingQuote&&M&&s>0&&a[z]==="text"&&T&&f[z]&&p[z]||M&&s>0&&a[z]==="text"&&Oae(N.text)&&f[z]||M&&s>0&&a[z]==="text"&&m[z]?L():M&&s>0&&a[z]==="text"&&N.isWordLike&&F&&y[z]?(L(),l[z]=!0):$!==null&&s>0&&a[z]==="text"&&u[z]===$?d[z]=(d[z]??1)+1:M&&!N.isWordLike&&s>0&&a[z]==="text"&&!f[z]&&(Fae(N.text)||N.text==="-"&&l[z])?L():(i[s]=N.text,r[s]=[N.text],l[s]=N.isWordLike,a[s]=N.kind,c[s]=N.start,u[s]=$,d[s]=$===null?0:1,f[s]=T,h[s]=F,p[s]=B,m[s]=W,y[s]=I3(F,S),s++)}for(let I=0;I<s;I++){if(u[I]!==null){i[I]=N3(i,u,d,I);continue}i[I]=ji(r[I])}for(let I=1;I<s;I++)a[I]==="text"&&!l[I]&&cb(i[I])&&a[I-1]==="text"&&!f[I-1]&&(i[I-1]+=i[I],l[I-1]=l[I-1]||l[I],i[I]="");const k=Array.from({length:s},()=>null);let g=-1;for(let I=s-1;I>=0;I--){const N=i[I];if(N.length!==0){if(a[I]==="text"&&!l[I]&&g>=0&&a[g]==="text"&&(Bae(N)||N==="-"&&zae(i[g]))){const M=k[g]??[];M.push(N),k[g]=M,c[g]=c[I],i[I]="";continue}g=I}}for(let I=0;I<s;I++){const N=k[I];N!=null&&(i[I]=Yae(N,i[I]))}let v=0;for(let I=0;I<s;I++){const N=i[I];N.length!==0&&(v!==I&&(i[v]=N,l[v]=l[I],a[v]=a[I],c[v]=c[I]),v++)}i.length=v,l.length=v,a.length=v,c.length=v;const b=fce({len:v,texts:i,isWordLike:l,kinds:a,starts:c}),A=hce(uce(dce(cce(tce(ece(b))))));for(let I=0;I<A.len-1;I++){const N=Vae(A.texts[I]);N!==null&&(A.kinds[I]!=="space"&&A.kinds[I]!=="preserved-space"||A.kinds[I+1]!=="text"||!E3(A.texts[I+1])||(A.texts[I]=N.space,A.isWordLike[I]=!1,A.kinds[I]=A.kinds[I]==="preserved-space"?"preserved-space":"space",A.texts[I+1]=N.marks+A.texts[I+1],A.starts[I+1]=A.starts[I]+N.space.length))}return A}function mce(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const n=[];let o=0;for(let s=0;s<e.len;s++)e.kinds[s]==="hard-break"&&(n.push({startSegmentIndex:o,endSegmentIndex:s,consumedEndSegmentIndex:s+1}),o=s+1);return o<e.len&&n.push({startSegmentIndex:o,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),n}function gce(e,t,n){if(t.len<=1)return t;const o=[],s=[],i=[],r=[];let l=-1,a=!1;function c(f){o.push(t.texts[f]),s.push(t.isWordLike[f]),i.push("text"),r.push(t.starts[f])}function u(f,h){let p=!1;for(let k=f;k<h;k++)p=p||t.isWordLike[k];const m=t.starts[f],y=h<t.len?t.starts[h]:e.length;o.push(e.slice(m,y)),s.push(p),i.push("text"),r.push(m)}function d(f){if(!(l<0)){if(a)l+1===f?c(l):u(l,f);else for(let h=l;h<f;h++)c(h);l=-1,a=!1}}for(let f=0;f<t.len;f++){const h=t.texts[f],p=t.kinds[f];if(p==="text"){l>=0&&!nT(t.texts[f-1],n)&&d(f),l<0&&(l=f),a=a||mr(h);continue}d(f),o.push(h),s.push(t.isWordLike[f]),i.push(p),r.push(t.starts[f])}return d(t.len),{len:o.length,texts:o,isWordLike:s,kinds:i,starts:r}}function vce(e,t,n="normal",o="normal"){const s=bae(n),i=s.mode==="pre-wrap"?wae(e):xae(e);if(i.length===0)return{normalized:i,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const r=pce(i,t,s),l=o==="keep-all"?gce(i,r,t.breakKeepAllAfterPunctuation):r;return{normalized:i,chunks:mce(l,s),...l}}let Lc=null;const $3=new Map;let $c=null;const yce=96,kce=/\p{Emoji_Presentation}/u,bce=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Lv=null;const F3=new Map;function ub(){if(Lc!==null)return Lc;if(typeof OffscreenCanvas<"u")return Lc=new OffscreenCanvas(1,1).getContext("2d"),Lc;if(typeof document<"u")return Lc=document.createElement("canvas").getContext("2d"),Lc;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function xce(e){let t=$3.get(e);return t||(t=new Map,$3.set(e,t)),t}function Nl(e,t){let n=t.get(e);return n===void 0&&(n={width:ub().measureText(e).width,containsCJK:mr(e)},t.set(e,n)),n}function n0(){if($c!==null)return $c;if(typeof navigator>"u")return $c={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},$c;const e=navigator.userAgent,n=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),o=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return $c={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:o,breakKeepAllAfterPunctuation:!n,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},$c}function wce(e){const t=e.match(/(\d+(?:\.\d+)?)\s*px/);return t?parseFloat(t[1]):16}function iT(){return Lv===null&&(Lv=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Lv}function _ce(e){return kce.test(e)||e.includes("️")}function Sce(e){return bce.test(e)}function Cce(e,t){let n=F3.get(e);if(n!==void 0)return n;const o=ub();o.font=e;const s=o.measureText("😀").width;if(n=0,s>t+.5&&typeof document<"u"&&document.body!==null){const i=document.createElement("span");i.style.font=e,i.style.display="inline-block",i.style.visibility="hidden",i.style.position="absolute",i.textContent="😀",document.body.appendChild(i);const r=i.getBoundingClientRect().width;document.body.removeChild(i),s-r>.5&&(n=s-r)}return F3.set(e,n),n}function Ace(e){let t=0;const n=iT();for(const o of n.segment(e))_ce(o.segment)&&t++;return t}function Mce(e,t){return t.emojiCount===void 0&&(t.emojiCount=Ace(e)),t.emojiCount}function La(e,t,n){return n===0?t.width:t.width-Mce(e,t)*n}function Ece(e,t,n,o,s){if(t.breakableFitAdvances!==void 0&&t.breakableFitMode===s)return t.breakableFitAdvances;t.breakableFitMode=s;const i=iT(),r=[];for(const u of i.segment(e))r.push(u.segment);if(r.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(s==="sum-graphemes"){const u=[];for(const d of r){const f=Nl(d,n);u.push(La(d,f,o))}return t.breakableFitAdvances=u,t.breakableFitAdvances}if(s==="pair-context"||r.length>yce){const u=[];let d=null,f=0;for(const h of r){const p=Nl(h,n),m=La(h,p,o);if(d===null)u.push(m);else{const y=d+h,k=Nl(y,n);u.push(La(y,k,o)-f)}d=h,f=m}return t.breakableFitAdvances=u,t.breakableFitAdvances}const l=[];let a="",c=0;for(const u of r){a+=u;const d=Nl(a,n),f=La(a,d,o);l.push(f-c),c=f}return t.breakableFitAdvances=l,t.breakableFitAdvances}function Tce(e,t){const n=ub();n.font=e;const o=xce(e),s=wce(e),i=t?Cce(e,s):0;return{cache:o,fontSize:s,emojiCorrection:i}}function Nce(e){return e==="space"||e==="zero-width-break"||e==="soft-hyphen"}function rT(e){return e==="space"||e==="preserved-space"||e==="tab"||e==="zero-width-break"||e==="soft-hyphen"}function lT(e,t,n=e.widths.length){for(;t<n;){const o=e.kinds[t];if(!Nce(o))break;t++}return t}function Ice(e,t){if(t<=0)return 0;const n=e%t;return Math.abs(n)<=1e-6?t:t-n}function Lce(e,t,n){return e.letterSpacing!==0&&t&&e.spacingGraphemeCounts[n]>0?e.letterSpacing:0}function db(e,t){return t===0?0:e+t}function $ce(e,t){return e.letterSpacing!==0&&e.spacingGraphemeCounts[t]>0?e.letterSpacing:0}function Fce(e,t,n,o,s){const i=t==="tab"?s+$ce(e,n):e.lineEndFitAdvances[n];return db(o,i)}function O3(e,t,n,o){const s=t==="tab"?0:e.lineEndFitAdvances[n];return db(o,s)}function B3(e,t,n,o,s){const i=t==="tab"?s:e.lineEndPaintAdvances[n];return db(o,i)}function Oce(e,t,n){return e.letterSpacing!==0&&t?n+e.letterSpacing:n}function Bce(e,t){return e.letterSpacing===0?t:t+e.letterSpacing}function Ym(e,t,n){let o=t;for(;o<e.length&&e[o]<n;)o++;return o}function Rce(e,t,n,o,s){if(e.letterSpacing===0)return 0;if(s>0)return e.spacingGraphemeCounts[o]>0?e.letterSpacing:0;for(let i=o-1;i>=t;i--){const r=e.kinds[i];if(!(r==="space"||r==="zero-width-break"||r==="hard-break")){if(r==="soft-hyphen"){if(i===o-1)return 0;continue}return i===t&&n>0||e.spacingGraphemeCounts[i]>0?e.letterSpacing:0}}return 0}function Dce(e,t,n,o,s,i){return t+Rce(e,n,o,s,i)}function Pce(e,t,n){const{widths:o,kinds:s,breakableFitAdvances:i,breakablePreferredBreaks:r}=e;if(o.length===0)return 0;const a=n0().lineFitEpsilon,c=t+a;let u=0,d=0,f=!1,h=0,p=0,m=0,y=0,k=-1,g=0;function v(){k=-1,g=0}function b(T=m,F=y,S=d){u++,n?.(S,h,p,T,F),d=0,f=!1,v()}function A(T,F){f=!0,h=T,p=0,m=T+1,y=0,d=F}function I(T,F,S){f=!0,h=T,p=F,m=T,y=F+1,d=S}function N(T,F){if(!f){A(T,F);return}d+=F,m=T+1,y=0}function M(T,F){const S=i[T],B=r[T]??null;let W=B===null?-1:Ym(B,0,F+1),z=-1,L=0,O=F;for(;O<S.length;){const U=S[O];if(!f)I(T,O,U);else if(d+U>c){if(B!==null&&z>F){b(T,z,L),O=z,W=Ym(B,W,O+1),z=-1,L=0;continue}b(),I(T,O,U)}else d+=U,m=T,y=O+1;const Z=O+1;B!==null&&B[W]===Z&&(z=Z,L=d,W++),O++}f&&m===T&&y===S.length&&(m=T+1,y=0)}let $=0;for(;$<o.length&&!(!f&&($=lT(e,$),$>=o.length));){const T=o[$],F=s[$],S=rT(F);if(!f){T>c&&i[$]!==null?M($,0):A($,T),S&&(k=$+1,g=d-T),$++;continue}if(d+T>c){if(S){N($,T),b($+1,0,d-T),$++;continue}if(k>=0){if(m>k||m===k&&y>0){b();continue}b(k,0,g);continue}if(T>c&&i[$]!==null){b(),M($,0),$++;continue}b();continue}N($,T),S&&(k=$+1,g=d-T),$++}return f&&b(),u}function Hce(e,t,n){if(e.simpleLineWalkFastPath)return Pce(e,t,n);const{widths:o,kinds:s,breakableFitAdvances:i,breakablePreferredBreaks:r,discretionaryHyphenWidth:l,chunks:a}=e;if(o.length===0||a.length===0)return 0;const c=n0(),u=c.lineFitEpsilon,d=t+u;let f=0,h=0,p=!1,m=0,y=0,k=0,g=0,v=-1,b=0,A=0,I=null;function N(){v=-1,b=0,A=0,I=null}function M(){return I==="soft-hyphen"&&v===k&&g===0?A:h}function $(L=k,O=g,U){f++,n!==void 0&&n(Dce(e,U??M(),m,y,L,O),m,y,L,O),h=0,p=!1,N()}function T(L,O){p=!0,m=L,y=0,k=L+1,g=0,h=O}function F(L,O,U){p=!0,m=L,y=O,k=L,g=O+1,h=U}function S(L,O){if(!p){T(L,O);return}h+=O,k=L+1,g=0}function B(L,O,U,Z,ie,q){if(!O)return;const ee=O3(e,L,U,ie),fe=B3(e,L,U,ie,Z);v=U+1,b=h-q+ee,A=h-q+fe,I=L}function W(L,O){const U=i[L],Z=r[L]??null;let ie=Z===null?-1:Ym(Z,0,O+1),q=-1,ee=0,fe=O;for(;fe<U.length;){const ne=U[fe];if(!p)F(L,fe,ne);else{const K=Oce(e,!0,ne),ve=h+K;if(Bce(e,ve)>d){if(Z!==null&&q>O){$(L,q,ee),fe=q,ie=Ym(Z,ie,fe+1),q=-1,ee=0;continue}$(),F(L,fe,ne)}else h=ve,k=L,g=fe+1}const j=fe+1;Z!==null&&Z[ie]===j&&(q=j,ee=h,ie++),fe++}p&&k===L&&g===U.length&&(k=L+1,g=0)}function z(L){f++,n?.(0,L.startSegmentIndex,0,L.consumedEndSegmentIndex,0),N()}for(let L=0;L<a.length;L++){const O=a[L];if(O.startSegmentIndex===O.endSegmentIndex){z(O);continue}p=!1,h=0,m=O.startSegmentIndex,y=0,k=O.startSegmentIndex,g=0,N();let U=O.startSegmentIndex;for(;U<O.endSegmentIndex&&!(!p&&(U=lT(e,U,O.endSegmentIndex),U>=O.endSegmentIndex));){const Z=s[U],ie=rT(Z),q=Lce(e,p,U),ee=Z==="tab"?Ice(h+q,e.tabStopAdvance):o[U],fe=q+ee,ne=Fce(e,Z,U,q,ee);if(Z==="soft-hyphen"){p&&(k=U+1,g=0,v=U+1,b=h+l,A=h+l,I=Z),U++;continue}if(!p){ne>d&&i[U]!==null?W(U,0):T(U,ee),B(Z,ie,U,ee,q,fe),U++;continue}if(h+ne>d){const K=h+O3(e,Z,U,q),ve=h+B3(e,Z,U,q,ee);if(I==="soft-hyphen"&&c.preferEarlySoftHyphenBreak&&b<=d){$(v,0,A);continue}if(ie&&K<=d){S(U,fe),$(U+1,0,ve),U++;continue}if(v>=0&&b<=d){if(k>v||k===v&&g>0){$();continue}const he=v;$(he,0,A),U=he;continue}if(ne>d&&i[U]!==null){$(),W(U,0),U++;continue}$();continue}S(U,fe),B(Z,ie,U,ee,q,fe),U++}if(p){const Z=v===O.consumedEndSegmentIndex?A:h;$(O.consumedEndSegmentIndex,0,Z)}}return f}let $v=null;function fb(){return $v===null&&($v=new Intl.Segmenter(void 0,{granularity:"grapheme"})),$v}function Wce(e){return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}}function zce(e,t){const n=[];let o=[],s=0,i=!1,r=!1,l=!1;function a(){o.length!==0&&(n.push({text:o.length===1?o[0]:o.join(""),start:s}),o=[],i=!1,r=!1,l=!1)}function c(d,f,h){o=[d],s=f,i=h,r=dk(d),l=J1.has(d)}function u(d,f){o.push(d),i=i||f;const h=dk(d);d.length===1&&Ga.has(d)?r=r||h:r=h,l=!1}for(const d of fb().segment(e)){const f=d.segment,h=mr(f);if(o.length===0){c(f,d.index,h);continue}if(l||lb.has(f)||Ga.has(f)||t.carryCJKAfterClosingQuote&&h&&r){u(f,h);continue}if(!i&&!h){u(f,h);continue}a(),c(f,d.index,h)}return a(),n}function Uce(e,t,n){if(t.length<=1)return t;const o=[];let s=-1,i=!1;function r(a,c){const u=t[a].start,d=c<t.length?t[c].start:e.length;o.push({text:e.slice(u,d),start:u})}function l(a){if(!(s<0)){if(i)s+1===a?o.push(t[s]):r(s,a);else for(let c=s;c<a;c++)o.push(t[c]);s=-1,i=!1}}for(let a=0;a<t.length;a++){const c=t[a];s>=0&&!nT(t[a-1].text,n)&&l(a),s<0&&(s=a),i=i||mr(c.text)}return l(t.length),o}function R3(e,t){if(t==="zero-width-break"||t==="soft-hyphen"||t==="hard-break")return 0;if(t==="tab")return 1;let n=0;const o=fb();for(const s of o.segment(e))n++;return n}function qce(e){return e==="-"||e==="֊"||e==="‐"||e==="‒"||e==="–"||e==="—"}function jce(e){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(e))return null;const t=[];let n=0;for(const o of fb().segment(e))n++,qce(o.segment)&&t.push(n);return t.length===0?null:t}function Vce(e,t,n){return t>1?e+(t-1)*n:e}function Kce(e,t,n,o,s){const i=n0(),{cache:r,emojiCorrection:l}=Tce(t,Sce(e.normalized)),a=La("-",Nl("-",r),l)+(s===0?0:s*2),u=La(" ",Nl(" ",r),l)*8,d=s!==0;if(e.len===0)return Wce();const f=[],h=[],p=[],m=[];let y=e.chunks.length<=1&&!d;const k=n?[]:null,g=[],v=[],b=[],A=n?[]:null,I=Array.from({length:e.len});function N(F,S,B,W,z,L,O,U,Z){z!=="text"&&z!=="space"&&z!=="zero-width-break"&&(y=!1),f.push(S),h.push(B),p.push(W),m.push(z),k?.push(L),g.push(O),v.push(U),d&&b.push(Z),A!==null&&A.push(F)}function M(F,S,B,W,z){const L=Nl(F,r),O=d?R3(F,S):0,U=Vce(La(F,L,l),O,s),Z=S==="space"||S==="preserved-space"||S==="zero-width-break"?0:U,ie=Z===0?0:Z+(O>0?s:0),q=S==="space"||S==="zero-width-break"?0:U;if(z&&W&&F.length>1){let ee="sum-graphemes";s!==0?ee="segment-prefixes":Gm(F)?ee="pair-context":i.preferPrefixWidthsForBreakableRuns&&(ee="segment-prefixes");const fe=Ece(F,L,r,l,ee),ne=fe===null||o==="keep-all"?null:jce(F);N(F,U,ie,q,S,B,fe,ne,O);return}N(F,U,ie,q,S,B,null,null,O)}for(let F=0;F<e.len;F++){I[F]=f.length;const S=e.texts[F],B=e.isWordLike[F],W=e.kinds[F],z=e.starts[F];if(W==="soft-hyphen"){N(S,0,a,a,W,z,null,null,0);continue}if(W==="hard-break"){N(S,0,0,0,W,z,null,null,0);continue}if(W==="tab"){N(S,0,0,0,W,z,null,null,d?R3(S,W):0);continue}const L=Nl(S,r);if(W==="text"&&L.containsCJK){const O=zce(S,i),U=o==="keep-all"?Uce(S,O,i.breakKeepAllAfterPunctuation):O;for(let Z=0;Z<U.length;Z++){const ie=U[Z];M(ie.text,"text",z+ie.start,B,o==="keep-all"||!mr(ie.text))}continue}M(S,W,z,B,!0)}const $=Gce(e.chunks,I,f.length),T=k===null?null:vae(e.normalized,k);return A!==null?{widths:f,lineEndFitAdvances:h,lineEndPaintAdvances:p,kinds:m,simpleLineWalkFastPath:y,segLevels:T,breakableFitAdvances:g,breakablePreferredBreaks:v,letterSpacing:s,spacingGraphemeCounts:b,discretionaryHyphenWidth:a,tabStopAdvance:u,chunks:$,segments:A}:{widths:f,lineEndFitAdvances:h,lineEndPaintAdvances:p,kinds:m,simpleLineWalkFastPath:y,segLevels:T,breakableFitAdvances:g,breakablePreferredBreaks:v,letterSpacing:s,spacingGraphemeCounts:b,discretionaryHyphenWidth:a,tabStopAdvance:u,chunks:$}}function Gce(e,t,n){const o=[];for(let s=0;s<e.length;s++){const i=e[s],r=i.startSegmentIndex<t.length?t[i.startSegmentIndex]:n,l=i.endSegmentIndex<t.length?t[i.endSegmentIndex]:n,a=i.consumedEndSegmentIndex<t.length?t[i.consumedEndSegmentIndex]:n;o.push({startSegmentIndex:r,endSegmentIndex:l,consumedEndSegmentIndex:a})}return o}function Yce(e,t,n,o){const s=o?.wordBreak??"normal",i=o?.letterSpacing??0,r=vce(e,n0(),o?.whiteSpace,s);return Kce(r,t,n,s,i)}function Zce(e,t,n){return Yce(e,t,!0,n)}function Xce(e){let t=0;return Hce(e,Number.POSITIVE_INFINITY,n=>{n>t&&(t=n)}),t}const Qce={key:0,class:"slash-menu",role:"listbox"},Jce=["aria-selected","onMouseenter","onMousedown"],eue={class:"slash-name"},tue={class:"slash-desc"},nue=Je({__name:"SlashMenu",props:{items:{},activeIndex:{}},emits:["select","hover"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=oe([]);return et(()=>o.activeIndex,r=>{i.value[r]?.scrollIntoView({block:"nearest"})}),(r,l)=>e.items.length>0?(x(),E("div",Qce,[(x(!0),E(We,null,rt(e.items,(a,c)=>(x(),E("div",{ref_for:!0,ref:u=>{u&&(i.value[c]=u)},key:`${a.name}-${c}`,class:Ue(["slash-item",{active:c===o.activeIndex}]),role:"option","aria-selected":c===o.activeIndex,onMouseenter:u=>s("hover",c),onMousedown:St(u=>s("select",a),["prevent"])},[w("span",eue,R(a.name),1),w("span",tue,R(a.isSkill?a.desc:C(n)(a.desc)),1)],42,Jce))),128))])):ue("",!0)}}),oue=dt(nue,[["__scopeId","data-v-f60b70d9"]]),sue={class:"mention-menu",role:"listbox"},iue={key:0,class:"mention-state dim"},rue={key:1,class:"mention-state dim"},lue=["aria-selected","onMouseenter","onMousedown"],aue=["innerHTML"],cue={class:"mention-name"},uue={class:"mention-path"},due=Je({__name:"MentionMenu",props:{items:{},activeIndex:{},loading:{type:Boolean}},emits:["select","hover"],setup(e,{emit:t}){const n=e,o=t,{t:s}=$t(),i=Dc("folder","sm"),r=Dc("code","sm"),l=Dc("file-text","sm"),a=Dc("image","sm"),c=Dc("file","sm"),u=new Set(["ts","tsx","js","jsx","mjs","cjs","vue","json","py","go","rs","java","kt","c","h","cpp","cc","hpp","cs","rb","php","swift","sh","bash","zsh","css","scss","less","html","htm","xml","sql","yaml","yml","toml","lua","dart","scala","clj","ex","exs"]),d=new Set(["md","markdown","mdx","txt","rst","adoc","pdf","doc","docx"]),f=new Set(["png","jpg","jpeg","gif","svg","webp","bmp","ico","avif"]);function h(p){const m=p.path;if(m.endsWith("/"))return i;const y=p.name||m.split("/").pop()||m,k=y.lastIndexOf("."),g=k>0?y.slice(k+1).toLowerCase():"";return g?u.has(g)?r:d.has(g)?l:f.has(g)?a:c:c}return(p,m)=>(x(),E("div",sue,[n.loading?(x(),E("div",iue,R(C(s)("mention.searching")),1)):n.items.length===0?(x(),E("div",rue,R(C(s)("mention.noMatch")),1)):(x(!0),E(We,{key:2},rt(n.items,(y,k)=>(x(),E("div",{key:y.path,class:Ue(["mention-item",{active:k===n.activeIndex}]),role:"option","aria-selected":k===n.activeIndex,onMouseenter:g=>o("hover",k),onMousedown:St(g=>o("select",y),["prevent"])},[w("span",{class:"mention-icon",innerHTML:h(y),"aria-hidden":"true"},null,8,aue),w("span",cue,R(y.name),1),w("span",uue,R(y.path),1)],42,lue))),128))]))}}),fue=dt(due,[["__scopeId","data-v-f4d6b958"]]),aT=[{name:"/new",desc:"commands.new.desc"},{name:"/clear",desc:"commands.clear.desc"},{name:"/login",desc:"commands.login.desc"},{name:"/plan",desc:"commands.plan.desc"},{name:"/swarm",desc:"commands.swarm.desc",acceptsInput:!0},{name:"/goal",desc:"commands.goal.desc",acceptsInput:!0},{name:"/btw",desc:"commands.btw.desc",acceptsInput:!0},{name:"/auto",desc:"commands.auto.desc"},{name:"/yolo",desc:"commands.yolo.desc"},{name:"/thinking",desc:"commands.thinking.desc"},{name:"/compact",desc:"commands.compact.desc",acceptsInput:!0},{name:"/undo",desc:"commands.undo.desc"},{name:"/fork",desc:"commands.fork.desc"},{name:"/export",desc:"commands.export.desc"},{name:"/status",desc:"commands.status.desc"}];function hue(e){if(!e.startsWith("/"))return null;const t=e.indexOf(" ");return t===-1?{cmd:e,arg:""}:{cmd:e.slice(0,t),arg:e.slice(t+1)}}const Zm="skill:";function pue(e){return e.startsWith(Zm)?e.slice(Zm.length):e}function cT(e=[]){const t=e.map(n=>({name:n.source==="builtin"?`/${n.name}`:`/${Zm}${n.name}`,desc:n.description,isSkill:!0,acceptsInput:!0}));return[...aT,...t]}function mue(e,t=aT){const n=e.toLowerCase().trim().replace(/^\//,"");return n===""?t:t.map((o,s)=>{const i=o.name.toLowerCase().replace(/^\//,"");let r=0;return i===n?r=3:i.startsWith(n)?r=2:i.includes(n)&&(r=1),{item:o,index:s,score:r}}).filter(({score:o})=>o>0).sort((o,s)=>o.score!==s.score?s.score-o.score:o.index-s.index).map(({item:o})=>o)}function o0(e){if(e===void 0)return"toggle";const t=e.capabilities??[];return t.includes("always_thinking")?"always-on":t.includes("thinking")||e.adaptiveThinking===!0?"toggle":"unsupported"}function uT(e){return e?.supportEfforts??[]}function gue(e){return e[Math.floor(e.length/2)]}function Ef(e){if(o0(e)==="unsupported")return"off";const t=uT(e);return t.length>0?e?.defaultEffort??gue(t):"on"}function s0(e){const t=uT(e),n=o0(e);return t.length>0?n==="always-on"?[...t]:["off",...t]:n==="always-on"?["on"]:n==="unsupported"?["off"]:["on","off"]}function hk(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function vue(e){return e!=="off"}function yue(e,t){return s0(e).includes(t)}function hb(e,t){return t==="off"?"off":t==="on"?Ef(e):t}function Xm(e,t){return t??Ef(e)}function kue(e,t){if(e==="off")return{enabled:!1};if(e==="on")return{enabled:!0};const n=t?.at(-1);return n!==void 0&&e===n?{enabled:!0}:{enabled:!0,effort:e}}function bue(e,t,n){return!n||e===void 0?t:Ef(e)}const Qm=100;function xue(e){const t=N1(Dt.inputHistory);if(Array.isArray(t)){const n=t.filter(i=>typeof i=="string"&&i.length>0);if(!e||n.length===0)return{};const o=n.length>Qm?n.slice(-Qm):n,s={[e]:o};return Df(Dt.inputHistory,s),s}return t&&typeof t=="object"?t:{}}function wue(e){const{text:t,textareaRef:n,autosize:o,sessionId:s}=e,i=oe(xue(s())),r=D(()=>i.value[s()??""]??[]);let l=-1,a="";function c(k){const g=s();if(l=-1,!g)return;const v=k.trim();if(!v)return;const b=i.value[g]??[];if(b.at(-1)===v)return;const A=[...b,v],I=A.length>Qm?A.slice(-Qm):A;i.value={...i.value,[g]:I},Df(Dt.inputHistory,i.value)}function u(){const k=n.value;return k?(k.selectionStart??0)===0:!1}function d(k){t.value=k,yt(()=>{const g=n.value;if(!g)return;o();const v=k.length;g.setSelectionRange(v,v)})}function f(){const k=r.value;if(k.length!==0){if(l===-1)a=t.value,l=k.length-1;else if(l>0)l-=1;else return;d(k[l])}}function h(){if(l===-1)return;const k=r.value;l<k.length-1?(l+=1,d(k[l])):(l=-1,d(a))}function p(){l=-1}function m(){return l!==-1}function y(){return r.value.length>0}return et(s,()=>{l=-1}),{push:c,caretAtTextStart:u,recallOlder:f,recallNewer:h,resetBrowsing:p,isBrowsing:m,hasHistory:y}}function _ue(e){const{text:t,textareaRef:n,autosize:o,skills:s,emitCommand:i,historyPush:r,clearDraft:l}=e,a=oe(!1),c=oe([]),u=oe(0);function d(){const h=t.value;h.startsWith("/")&&!h.includes(" ")?(c.value=mue(h,cT(s())),u.value=0,a.value=c.value.length>0):a.value=!1}function f(h){if(a.value=!1,h.acceptsInput){t.value=`${h.name} `,yt(()=>{const p=n.value;if(!p)return;const m=t.value.length;p.setSelectionRange(m,m),p.focus(),o()});return}t.value="",l?.(),r(h.name),i(h.name)}return{open:a,items:c,active:u,update:d,select:f}}function Sue(e){const{text:t,textareaRef:n,autosize:o,searchFiles:s}=e,i=oe(!1),r=oe([]),l=oe(0),a=oe(!1);let c=null;function u(){const h=t.value,p=n.value?.selectionStart??h.length;let m=p-1;for(;m>=0&&!/\s/.test(h[m]);)m--;m++;const y=h.slice(m,p);return y.startsWith("@")?{token:y.slice(1),start:m,end:p}:null}function d(){const h=u(),p=s();if(!h||!p){i.value=!1;return}const m=h.token;c!==null&&clearTimeout(c),c=setTimeout(async()=>{a.value=!0,i.value=!0,l.value=0;try{r.value=await p(m)}catch{r.value=[]}finally{a.value=!1}},200)}function f(h){const p=u();if(!p)return;const m=t.value;t.value=m.slice(0,p.start)+h.path+m.slice(p.end),i.value=!1,yt(()=>{const y=n.value;if(!y)return;const k=p.start+h.path.length;y.setSelectionRange(k,k),y.focus(),o()})}return{open:i,items:r,active:l,loading:a,update:d,select:f}}function Cue(e){const{sessionId:t}=e;function n(c){return yo(M_(c))??""}function o(c,u){const d=M_(c);u?Eo(d,u):qa(d)}const s=oe(n(t())),i=oe(null);function r(){const c=i.value;c&&(c.style.height="auto",c.style.height=`${c.scrollHeight}px`)}et(s,c=>{yt(r),o(t(),c)}),et(t,(c,u)=>{c!==u&&(o(u,s.value),s.value=n(c),yt(r))});function l(c){s.value=c,yt(()=>{const u=i.value;if(!u)return;u.focus();const d=c.length;u.setSelectionRange(d,d),r()})}function a(){o(t(),"")}return{text:s,textareaRef:i,autosize:r,loadForEdit:l,clearDraft:a}}function Aue(e){const{uploadImage:t,sessionId:n}=e,o=oe({}),s=D(()=>o.value[n()??""]??[]),i=oe(null),r=oe(null),l=oe(!1);let a=0;function c(){return`att_${++a}`}function u(O,U){o.value={...o.value,[O]:U}}function d(O){if(O.previewUrl!==void 0)try{URL.revokeObjectURL(O.previewUrl)}catch{}}function f(O){return O.startsWith("image/")?"image":O.startsWith("video/")?"video":"file"}async function h(O){const U=t();if(!U)return;const Z=n()??"";if(O.length!==0)for(const ie of O){const q=f(ie.type),ee=c(),fe=q==="file"?void 0:URL.createObjectURL(ie),ne={localId:ee,name:ie.name,kind:q,previewUrl:fe,mediaType:ie.type||"application/octet-stream",size:ie.size,uploading:!0};u(Z,[...o.value[Z]??[],ne]),U(ie,ie.name).then(j=>{const K=o.value[Z]??[];u(Z,K.map(ve=>ve.localId===ee?{...ve,uploading:!1,fileId:j?.fileId,mediaType:j?.mediaType??ve.mediaType,error:j===null}:ve))}).catch(()=>{const j=o.value[Z]??[];u(Z,j.map(K=>K.localId===ee?{...K,uploading:!1,error:!0}:K))})}}function p(O){const U=n()??"",Z=o.value[U]??[],ie=Z.find(q=>q.localId===O);i.value?.localId===O&&(i.value=null),ie&&d(ie),u(U,Z.filter(q=>q.localId!==O))}function m(O){i.value=O}function y(){i.value=null}function k(){r.value?.click()}function g(O){const U=O.target,Z=Array.from(U.files??[]);h(Z),U.value=""}function v(O){if(!t())return;const U=O.clipboardData;if(!U)return;const Z=[],ie=new Set,q=(ee,fe)=>{const ne=`${ee.size}:${ee.type}:${fe}`;if(ie.has(ne))return;ie.add(ne);const j=ee.type.split("/")[1]??"png",K=fe.includes(".")?fe:`paste-${Date.now()}.${j}`;Z.push(ee instanceof File?ee:new File([ee],K,{type:ee.type}))};for(const ee of Array.from(U.items))if(ee.kind==="file"){const fe=ee.getAsFile();fe&&q(fe,fe.name||`paste-${Date.now()}.${ee.type.split("/")[1]??"png"}`)}for(const ee of Array.from(U.files))q(ee,ee.name);Z.length!==0&&(O.preventDefault(),h(Z))}let b=0;function A(O){!t()||!Array.from(O.dataTransfer?.items??[]).some(Z=>Z.kind==="file")||(O.preventDefault(),O.stopPropagation(),l.value=!0)}function I(){l.value=!1}function N(O){if(b=0,l.value=!1,!t())return;O.preventDefault(),O.stopPropagation();const U=Array.from(O.dataTransfer?.files??[]);h(U)}function M(O){return Array.from(O.dataTransfer?.items??[]).some(U=>U.kind==="file")}function $(O){!t()||!M(O)||(O.preventDefault(),b+=1,l.value=!0)}function T(O){!t()||!M(O)||O.preventDefault()}function F(O){!t()||!M(O)||(b=Math.max(0,b-1),b===0&&(l.value=!1))}function S(O){if(b=0,l.value=!1,!t())return;O.preventDefault();const U=Array.from(O.dataTransfer?.files??[]);h(U)}function B(){const O=n()??"";for(const U of o.value[O]??[])d(U);u(O,[])}function W(O,U,Z){const ie=o.value[O]??[];ie.some(q=>q.localId===U)&&u(O,ie.map(q=>q.localId===U?{...q,...Z}:q))}function z(O){return fetch(O).then(U=>{if(!U.ok)throw new Error(`fetch failed: ${U.status}`);return U.blob()})}function L(O){const U=n()??"";for(const Z of o.value[U]??[])d(Z);u(U,[]);for(const Z of O){const ie=c(),q=/^data:/i.test(Z.url),ee=/^blob:/i.test(Z.url),fe=Z.name??Z.kind;if(Z.fileId){const ne={localId:ie,name:fe,kind:Z.kind,previewUrl:Z.kind==="file"?void 0:Z.url,uploading:!1,fileId:Z.fileId};u(U,[...o.value[U]??[],ne]),Z.kind!=="file"&&!q&&!ee&&ht().getFileBlob(Z.fileId).then(j=>{const K=URL.createObjectURL(j);if(!(o.value[U]??[]).some(he=>he.localId===ie)){URL.revokeObjectURL(K);return}W(U,ie,{previewUrl:K})}).catch(()=>{})}else{if(!Z.url)continue;const ne=t();if(!ne)continue;const j={localId:ie,name:fe,kind:Z.kind,previewUrl:Z.url,uploading:!0};u(U,[...o.value[U]??[],j]),z(Z.url).then(K=>{const ve=fe.includes(".")?fe:`${fe}.${K.type.split("/")[1]??"bin"}`;return ne(K,ve)}).then(K=>{if(K===null){const ve=o.value[U]??[];u(U,ve.filter(he=>he.localId!==ie));return}W(U,ie,{uploading:!1,fileId:K.fileId})}).catch(()=>{const K=o.value[U]??[];u(U,K.filter(ve=>ve.localId!==ie))})}}}return et(n,()=>{i.value=null}),An(()=>{document.addEventListener("paste",v),document.addEventListener("dragenter",$),document.addEventListener("dragover",T),document.addEventListener("dragleave",F),document.addEventListener("drop",S)}),On(()=>{document.removeEventListener("paste",v),document.removeEventListener("dragenter",$),document.removeEventListener("dragover",T),document.removeEventListener("dragleave",F),document.removeEventListener("drop",S);for(const O of Object.values(o.value))for(const U of O)d(U);i.value=null}),{attachments:s,previewAttachment:i,fileInputRef:r,isDragOver:l,removeAttachment:p,openAttachmentPreview:m,closeAttachmentPreview:y,openFilePicker:k,handleFileInputChange:g,handleDragOver:A,handleDragLeave:I,handleDrop:N,clearAfterSubmit:B,loadAttachments:L}}const Mue=["type","disabled"],Eue={class:"ui-button__content"},Tue=Je({__name:"Button",props:{variant:{default:"primary"},size:{default:"md"},disabled:{type:Boolean},loading:{type:Boolean},type:{default:"button"}},setup(e){return(t,n)=>(x(),E("button",{class:Ue(["ui-button",[`ui-button--${e.variant}`,`ui-button--${e.size}`,{"is-loading":e.loading}]]),type:e.type,disabled:e.disabled||e.loading},[e.loading?(x(),Se(Us,{key:0,size:"sm",class:"ui-button__spinner"})):ue("",!0),w("span",Eue,[jn(t.$slots,"default",{},void 0,!0)])],10,Mue))}}),jt=dt(Tue,[["__scopeId","data-v-556ea0b6"]]),Nue={class:"ctx-ring",viewBox:"0 0 20 20","aria-hidden":"true"},Iue=["stroke-dasharray","stroke-dashoffset"],Fv=7,Lue=Je({__name:"ContextRing",props:{pct:{}},setup(e){const t=e,n=2*Math.PI*Fv;return(o,s)=>(x(),E("svg",Nue,[w("circle",{class:"ctx-ring-track",cx:"10",cy:"10",r:Fv,fill:"none","stroke-width":"2.5"}),w("circle",{class:"ctx-ring-fill",cx:"10",cy:"10",r:Fv,fill:"none","stroke-width":"2.5","stroke-linecap":"round","stroke-dasharray":`${n}`,"stroke-dashoffset":`${n*(1-t.pct/100)}`},null,8,Iue)]))}}),$ue=dt(Lue,[["__scopeId","data-v-a364f1f1"]]),Fue={key:0,class:"att-strip"},Oue={class:"att-lightbox-card"},Bue=["src"],Rue=["src","alt"],Due={class:"att-lightbox-name"},Pue={class:"composer-card"},Hue={class:"cin-wrap"},Wue={class:"input-row"},zue=["placeholder","disabled"],Uue=["aria-label"],que={class:"toolbar-left"},jue=["onKeydown"],Vue=["onClick"],Kue={class:"pd-check"},Gue={class:"pd-info"},Yue={class:"pd-desc"},Zue={class:"mode-label"},Xue={key:0,class:"mode-tag"},Que={key:1,class:"mode-tag"},Jue={key:2,class:"mode-tag"},ede={class:"mode-row-icon"},tde={class:"mode-row-info"},nde={class:"mode-row-name"},ode={class:"mode-row-desc"},sde={class:"mode-row-icon"},ide={class:"mode-row-info"},rde={class:"mode-row-name"},lde={class:"mode-row-desc"},ade={class:"mode-row-icon"},cde={class:"mode-row-info"},ude={class:"mode-row-name"},dde={class:"mode-row-desc"},fde={key:0,class:"mode-row-actions"},hde={class:"toolbar-right"},pde=["aria-label"],mde=["onKeydown"],gde={key:0,class:"think-suffix"},vde=["aria-label"],yde=["aria-label","disabled"],kde={key:0,class:"md-section"},bde=["onClick"],xde={class:"md-check"},wde={class:"md-name"},_de={class:"md-provider"},Sde={key:1,class:"md-divider"},Cde={key:2,class:"md-section"},Ade=["onClick"],Mde={class:"md-check"},Ede={class:"md-name"},Tde={key:3,class:"md-divider"},Nde={class:"md-name"},Ide={key:0,class:"md-note"},Lde=["aria-label"],$de=["disabled","onClick"],Fde={class:"md-cache-note"},Ode={class:"md-name"},Bde={class:"drop-card"},D3=36,Rde=Je({__name:"Composer",props:{running:{type:Boolean,default:!1},starting:{type:Boolean,default:!1},sessionId:{},queued:{default:()=>[]},searchFiles:{type:Function,default:void 0},uploadImage:{type:Function,default:void 0},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},goalMode:{type:Boolean},goal:{},activationBadges:{},models:{default:()=>[]},starredIds:{default:()=>[]},skills:{default:()=>[]},hideContext:{type:Boolean}},emits:["submit","steer","command","interrupt","setPermission","setThinking","togglePlan","toggleSwarm","toggleGoal","openBtw","createGoal","controlGoal","focusGoal","focusSwarm","compact","pickModel","selectModel"],setup(e,{expose:t,emit:n}){const o=e,s=D(()=>o.starting?r("composer.starting"):o.running?r("composer.placeholderRunning"):o.goalMode?r("status.goalPlaceholder"):r("composer.placeholder")),i=n,{t:r,locale:l}=$t(),{text:a,textareaRef:c,autosize:u,loadForEdit:d,clearDraft:f}=Cue({sessionId:()=>o.sessionId}),h=oe(!1);function p(){h.value=!h.value,yt(()=>{u(),g(),c.value?.focus()})}function m(){h.value&&(h.value=!1,yt(u))}function y(Ke){if(typeof getComputedStyle>"u")return D3;const Re=Number.parseFloat(getComputedStyle(Ke).minHeight);return Number.isFinite(Re)&&Re>0?Re:D3}const k=oe(!1);function g(){const Ke=c.value;k.value=!!Ke&&Ke.scrollHeight>y(Ke)}et(a,()=>{yt(g)}),et(()=>o.sessionId,()=>{h.value=!1});const v=wue({text:a,textareaRef:c,autosize:u,sessionId:()=>o.sessionId}),{open:b,items:A,active:I,update:N,select:M}=_ue({text:a,textareaRef:c,autosize:u,skills:()=>o.skills,emitCommand:Ke=>i("command",Ke),historyPush:Ke=>v.push(Ke),clearDraft:f}),{open:$,items:T,active:F,loading:S,update:B,select:W}=Sue({text:a,textareaRef:c,autosize:u,searchFiles:()=>o.searchFiles});function z(){v.resetBrowsing(),N(),B()}const{attachments:L,previewAttachment:O,fileInputRef:U,isDragOver:Z,removeAttachment:ie,openAttachmentPreview:q,closeAttachmentPreview:ee,openFilePicker:fe,handleFileInputChange:ne,handleDragOver:j,handleDragLeave:K,handleDrop:ve,clearAfterSubmit:he,loadAttachments:Ae}=Aue({uploadImage:()=>o.uploadImage,sessionId:()=>o.sessionId});An(()=>{a.value&&yt(()=>{u(),g()})}),On(()=>{document.removeEventListener("mousedown",nn),V()});function re(){c.value?.focus({preventScroll:!0})}function Y(Ke){Ae(Ke)}t({loadForEdit:d,loadAttachmentsForEdit:Y,focus:re});function Q(Ke){return{fileId:Ke.fileId,kind:Ke.kind,name:Ke.name,mediaType:Ke.mediaType,size:Ke.size}}function P(Ke){if(Ke.kind==="file"){Ke.fileId!==void 0&&eT(Ke.fileId,Ke.name,Ke.mediaType);return}q(Ke)}function G(){const Ke=a.value.trim();if(L.value.some(Te=>Te.uploading))return;const Re=L.value.filter(Te=>!Te.uploading&&!Te.error&&Te.fileId);if(!Ke&&Re.length===0)return;if(v.push(Ke),Ke){const Te=hue(Ke),ge=Te?cT(o.skills).some(Ee=>Ee.name===Te.cmd||Ee.name===`/${Zm}${Te.cmd.slice(1)}`):!1;if(Te&&ge){a.value="",f(),b.value=!1,m(),i("command",Te.arg?`${Te.cmd} ${Te.arg}`:Te.cmd);return}}const le={text:Ke,attachments:Re.map(Te=>Q(Te))};O.value=null,he(),a.value="",f(),b.value=!1,$.value=!1,m(),i("submit",le)}function me(){if(!o.running||L.value.some(Te=>Te.uploading))return;const Ke=a.value.trim(),Re=L.value.filter(Te=>!Te.uploading&&!Te.error&&Te.fileId);if(!Ke&&Re.length===0&&o.queued.length===0)return;const le={text:Ke,attachments:Re.map(Te=>Q(Te))};he(),v.push(Ke),a.value="",f(),b.value=!1,$.value=!1,m(),i("steer",le)}let ye=!1,de=null;function V(){de!==null&&(clearTimeout(de),de=null)}function se(){V(),ye=!0}function pe(){V(),de=setTimeout(()=>{de=null,ye=!1},0)}function ke(Ke){return ye||Ke.isComposing||Ke.keyCode===229}function Ne(Ke){if(!ke(Ke)){if(Ke.key==="Escape"){if(xe.value){Ke.preventDefault(),ut();return}if(Ze.value){Ke.preventDefault(),Tt();return}}if(b.value){if(Ke.key==="ArrowDown"){Ke.preventDefault(),I.value=(I.value+1)%A.value.length;return}if(Ke.key==="ArrowUp"){Ke.preventDefault(),I.value=(I.value-1+A.value.length)%A.value.length;return}if(Ke.key==="Enter"||Ke.key==="Tab"){Ke.preventDefault();const Re=A.value[I.value];Re&&M(Re);return}if(Ke.key==="Escape"){Ke.preventDefault(),b.value=!1;return}}if($.value&&!S.value){if(Ke.key==="ArrowDown"){Ke.preventDefault(),F.value=(F.value+1)%Math.max(1,T.value.length);return}if(Ke.key==="ArrowUp"){Ke.preventDefault(),F.value=(F.value-1+Math.max(1,T.value.length))%Math.max(1,T.value.length);return}if(Ke.key==="Enter"||Ke.key==="Tab"){Ke.preventDefault();const Re=T.value[F.value];Re&&W(Re);return}if(Ke.key==="Escape"){Ke.preventDefault(),$.value=!1;return}}if(Ke.key==="s"&&(Ke.ctrlKey||Ke.metaKey)&&!Ke.shiftKey&&!Ke.altKey){o.running&&(Ke.preventDefault(),me());return}if(!h.value&&!b.value&&!$.value&&!Ke.shiftKey&&!Ke.altKey&&!Ke.metaKey&&!Ke.ctrlKey){const Re=v.isBrowsing();if(Ke.key==="ArrowUp"&&v.hasHistory()&&(Re||v.caretAtTextStart())){Ke.preventDefault(),v.recallOlder();return}if(Ke.key==="ArrowDown"&&Re){Ke.preventDefault(),v.recallNewer();return}}if(Ke.key==="Enter"&&!Ke.shiftKey){if(h.value&&!(Ke.metaKey||Ke.ctrlKey))return;Ke.preventDefault(),G()}}}const qe=D(()=>r("composer.send")),be=D(()=>!!o.uploadImage),xe=oe(!1),Ze=oe(!1),tt=oe(null);function lt(){xe.value=!xe.value,xe.value?(Ze.value=!1,xn(),document.addEventListener("click",wt,!0)):document.removeEventListener("click",wt,!0)}function ut(){xe.value=!1,Ze.value||document.removeEventListener("click",wt,!0)}function mt(){Ze.value=!Ze.value,Ze.value?(xe.value=!1,xn(),document.addEventListener("click",wt,!0)):document.removeEventListener("click",wt,!0)}function Tt(){Ze.value=!1,xe.value||document.removeEventListener("click",wt,!0)}function wt(Ke){tt.value&&!tt.value.contains(Ke.target)&&(ut(),Tt())}On(()=>{document.removeEventListener("click",wt,!0)});const Ft=D(()=>{const Ke=o.status?.ctxMax??0;return Ke<=0?0:Math.min(100,Math.max(0,Math.ceil((o.status?.ctxUsed??0)/Ke*100)))}),en=D(()=>{const Ke=pr(o.status?.ctxUsed??0),Re=pr(o.status?.ctxMax??0);return r("status.ctxTooltip",{used:Ke,max:Re,pct:Ft.value})}),Hn=D(()=>Ft.value>=80),Pt=D(()=>o.models?.find(Ke=>Ke.id===o.status?.modelId)),bn=D(()=>o0(Pt.value)),pn=D(()=>s0(Pt.value)),Kt=D(()=>Xm(Pt.value,o.thinking)),Nn=D(()=>pn.value.includes(Kt.value)?Kt.value:""),Gt=D(()=>vue(Kt.value)),Wt=D(()=>bn.value==="unsupported"||pn.value.length<=1),mn=D(()=>{if(!Gt.value)return"";const Ke=(Pt.value?.supportEfforts?.length??0)>0,Re=Kt.value;return Ke&&Re!=="on"?r("composer.thinkingSuffixEffort",{level:Re}):r("composer.thinkingSuffix")});function so(Ke){Wt.value||i("setThinking",hb(Pt.value,Ke))}function gn(Ke){return Ke==="on"?r("status.thinkingOn"):Ke==="off"?r("status.thinkingOff"):hk(Ke)}const to=D(()=>o.planMode===!0),vt=D(()=>o.swarmMode===!0),Wn=D(()=>o.goal?.status??o.activationBadges?.goal?.status??null),Bn=D(()=>Wn.value!==null&&Wn.value!=="complete"),Qn=D(()=>Bn.value||o.goalMode===!0),sn=D(()=>Wn.value==="active"),es=D(()=>Wn.value==="paused"||Wn.value==="blocked"),nt=oe(!1),Be=oe(null),Bt=oe(null),Yt=oe({}),vn=D(()=>to.value||vt.value||Qn.value);function xn(){nt.value=!1,document.removeEventListener("mousedown",nn)}function nn(Ke){const Re=Ke.target;Be.value?.contains(Re)||Bt.value?.contains(Re)||xn()}function Vn(){if(nt.value){xn();return}ut(),Tt();const Ke=Be.value?.getBoundingClientRect();Ke&&(Yt.value={left:`${Math.round(Ke.left)}px`,bottom:`${Math.round(window.innerHeight-Ke.top+8)}px`}),nt.value=!0,setTimeout(()=>document.addEventListener("mousedown",nn),0)}const Kn=[{mode:"manual",color:"var(--dim)",labelKey:"status.permissionManual",descKey:"status.permissionManualDesc"},{mode:"yolo",color:"var(--color-warning)",labelKey:"status.permissionYolo",descKey:"status.permissionYoloDesc"},{mode:"auto",color:"var(--color-danger)",labelKey:"status.permissionAuto",descKey:"status.permissionAutoDesc"}],Jn=["status.planDesc","status.swarmDesc","status.goalDesc"],Oo=oe(null),ko=oe(""),li=oe("");function Uo(Ke){const Re={};return Ke&&(Re["--composer-menu-desc-width"]=Ke),Re}const As=D(()=>Uo(ko.value)),cs=D(()=>Uo(li.value)),qo=D(()=>({...Yt.value,...cs.value}));let Bo=null;function ai(Ke){const Re=Number.parseFloat(Ke);return Number.isFinite(Re)?Re:0}function tn(Ke){return`${Ke.fontStyle||"normal"} ${Ke.fontWeight||"400"} ${Ke.fontSize} ${Ke.fontFamily}`}function qs(Ke){return Ke.letterSpacing==="normal"?0:ai(Ke.letterSpacing)}function io(Ke,Re){if(!Ke)return 0;const le=Zce(Ke,tn(Re),{letterSpacing:qs(Re)});return Xce(le)}function js(){const Ke=Oo.value?.querySelector(".pd-desc");if(!Ke)return;const Re=getComputedStyle(Ke),le=Math.max(0,...Kn.map(ge=>io(r(ge.descKey),Re))),Te=Math.max(0,...Jn.map(ge=>io(r(ge),Re)));ko.value=le>0?`${Math.ceil(le)}px`:"",li.value=Te>0?`${Math.ceil(Te)}px`:""}function ci(){typeof window>"u"||(Bo!==null&&window.cancelAnimationFrame(Bo),yt(()=>{Bo=window.requestAnimationFrame(()=>{Bo=null,js()})}))}et(l,ci,{immediate:!0}),An(()=>{ci(),document.fonts?.ready.then(ci)}),On(()=>{Bo!==null&&(window.cancelAnimationFrame(Bo),Bo=null)});function Ni(Ke){i("setPermission",Ke),Tt()}const ui=D(()=>Kn.find(Ke=>Ke.mode===o.status?.permission)),Vs=D(()=>ui.value?r(ui.value.labelKey):""),ts=D(()=>Pt.value?.provider??""),ns=D(()=>!ts.value||!o.models?.length?[]:o.models.filter(Ke=>Ke.provider===ts.value)),zt=D(()=>new Set(o.starredIds??[]));function Ms(Ke){return zt.value.has(Ke)}const No=D(()=>o.models?.length?o.models.filter(Ke=>Ms(Ke.id)&&Ke.provider!==ts.value):[]);function di(Ke){i("selectModel",Ke),ut()}return(Ke,Re)=>(x(),E("div",{class:Ue(["composer",{"drag-over":C(Z),expanded:h.value}]),onDragover:Re[18]||(Re[18]=(...le)=>C(j)&&C(j)(...le)),onDragleave:Re[19]||(Re[19]=(...le)=>C(K)&&C(K)(...le)),onDrop:Re[20]||(Re[20]=(...le)=>C(ve)&&C(ve)(...le))},[C(L).length>0?(x(),E("div",Fue,[(x(!0),E(We,null,rt(C(L),le=>(x(),Se(QE,{key:le.localId,kind:le.kind,name:le.name,url:le.previewUrl,"file-id":le.fileId,"media-type":le.mediaType,size:le.size,uploading:le.uploading,error:le.error,removable:"","remove-label":C(r)("composer.removeNamed",{name:le.name}),onActivate:Te=>P(le),onRemove:Te=>C(ie)(le.localId)},null,8,["kind","name","url","file-id","media-type","size","uploading","error","remove-label","onActivate","onRemove"]))),128))])):ue("",!0),C(O)?(x(),E("div",{key:1,class:"att-lightbox",onClick:Re[1]||(Re[1]=St((...le)=>C(ee)&&C(ee)(...le),["self"]))},[w("div",Oue,[ae(an,{text:C(r)("model.close")},{default:Ie(()=>[w("button",{type:"button",class:"att-lightbox-close",onClick:Re[0]||(Re[0]=(...le)=>C(ee)&&C(ee)(...le))},"✕")]),_:1},8,["text"]),C(O).kind==="video"?(x(),E("video",{key:0,class:"att-lightbox-media",src:C(O).previewUrl,controls:"",playsinline:""},null,8,Bue)):(x(),E("img",{key:1,class:"att-lightbox-media",src:C(O).previewUrl,alt:C(O).name},null,8,Rue)),w("div",Due,R(C(O).name),1)])])):ue("",!0),w("div",Pue,[w("div",Hue,[C(b)?(x(),Se(oue,{key:0,items:C(A),"active-index":C(I),onSelect:C(M),onHover:Re[2]||(Re[2]=le=>I.value=le)},null,8,["items","active-index","onSelect"])):ue("",!0),C($)?(x(),Se(fue,{key:1,items:C(T),"active-index":C(F),loading:C(S),onSelect:C(W),onHover:Re[3]||(Re[3]=le=>F.value=le)},null,8,["items","active-index","loading","onSelect"])):ue("",!0),w("div",Wue,[qn(w("textarea",{ref_key:"textareaRef",ref:c,"onUpdate:modelValue":Re[4]||(Re[4]=le=>vo(a)?a.value=le:null),class:"ph",placeholder:s.value,disabled:e.starting,rows:"1",onKeydown:Ne,onCompositionstart:se,onCompositionend:pe,onInput:z},null,40,zue),[[Cs,C(a)]]),h.value||k.value?(x(),E("button",{key:0,class:"expand-btn",type:"button","aria-label":h.value?C(r)("composer.collapseTitle"):C(r)("composer.expandTitle"),onClick:p},[h.value?(x(),Se(Ge,{key:0,name:"collapse",size:"sm"})):(x(),Se(Ge,{key:1,name:"expand",size:"sm"}))],8,Uue)):ue("",!0)])]),be.value?(x(),E("input",{key:0,ref_key:"fileInputRef",ref:U,type:"file",multiple:"",class:"file-input-hidden",onChange:Re[5]||(Re[5]=(...le)=>C(ne)&&C(ne)(...le))},null,544)):ue("",!0),w("div",{ref_key:"toolbarRef",ref:tt,class:"toolbar"},[w("div",{ref_key:"menuMeasureRef",ref:Oo,class:"menu-measure","aria-hidden":"true"},[...Re[21]||(Re[21]=[w("span",{class:"pd-desc"},null,-1)])],512),w("div",que,[be.value?(x(),Se(Xn,{key:0,size:"md",label:C(r)("composer.attachFile"),onClick:C(fe)},{default:Ie(()=>[ae(Ge,{name:"attachment"})]),_:1},8,["label","onClick"])):ue("",!0),e.status?(x(),E("span",{key:1,class:Ue(["perm-pill",["perm-"+e.status.permission,{open:Ze.value}]]),role:"button",tabindex:"0",onClick:St(mt,["stop"]),onKeydown:[ur(mt,["enter"]),ur(St(mt,["prevent"]),["space"])]},R(Vs.value),43,jue)):ue("",!0),Ze.value&&e.status?(x(),E("div",{key:2,class:"perm-dropdown",style:on(As.value),role:"menu",onClick:Re[6]||(Re[6]=St(()=>{},["stop"]))},[(x(),E(We,null,rt(Kn,le=>w("button",{key:le.mode,class:Ue(["pd-row",{"is-current":le.mode===e.status.permission}]),role:"menuitem",onClick:Te=>Ni(le.mode)},[w("span",Kue,[le.mode===e.status.permission?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):ue("",!0)]),w("span",Gue,[w("span",{class:"pd-name",style:on({color:le.color})},R(C(r)(le.labelKey)),5),w("span",Yue,R(C(r)(le.descKey)),1)])],10,Vue)),64))],4)):ue("",!0),e.status?(x(),E("div",{key:3,ref_key:"modesRef",ref:Be,class:"modes"},[w("button",{type:"button",class:Ue(["mode-pill",{on:vn.value,open:nt.value}]),onClick:St(Vn,["stop"])},[w("span",Zue,R(C(r)("status.modesLabel")),1),to.value?(x(),E("span",Xue,R(C(r)("status.planLabel")),1)):ue("",!0),vt.value?(x(),E("span",Que,R(C(r)("status.swarmLabel")),1)):ue("",!0),Qn.value?(x(),E("span",Jue,R(C(r)("status.goalLabel")),1)):ue("",!0)],2),nt.value?(x(),E("div",{key:0,ref_key:"modesMenuRef",ref:Bt,class:"modes-menu",style:on(qo.value),role:"menu"},[w("button",{type:"button",class:Ue(["mode-row",{on:to.value}]),role:"menuitem",onClick:Re[7]||(Re[7]=le=>i("togglePlan"))},[w("span",ede,[ae(Ge,{name:"file-edit",size:"sm"})]),w("span",tde,[w("span",nde,R(C(r)("status.planLabel")),1),w("span",ode,R(C(r)("status.planDesc")),1)]),w("span",{class:Ue(["mode-switch",{on:to.value}])},[...Re[22]||(Re[22]=[w("span",{class:"mode-knob"},null,-1)])],2)],2),w("button",{type:"button",class:Ue(["mode-row",{on:vt.value}]),role:"menuitem",onClick:Re[8]||(Re[8]=le=>i("toggleSwarm"))},[w("span",sde,[ae(Ge,{name:"sparkles",size:"sm"})]),w("span",ide,[w("span",rde,R(C(r)("status.swarmLabel")),1),w("span",lde,R(C(r)("status.swarmDesc")),1)]),w("span",{class:Ue(["mode-switch",{on:vt.value}])},[...Re[23]||(Re[23]=[w("span",{class:"mode-knob"},null,-1)])],2)],2),w("div",{class:Ue(["mode-row mode-row-goal",{on:Bn.value||o.goalMode}])},[w("button",{type:"button",class:"mode-row-main",role:"menuitem",onClick:Re[9]||(Re[9]=le=>Bn.value?i("focusGoal"):i("toggleGoal"))},[w("span",ade,[ae(Ge,{name:"target",size:"sm"})]),w("span",cde,[w("span",ude,R(C(r)("status.goalLabel")),1),w("span",dde,R(C(r)("status.goalDesc")),1)]),Bn.value?ue("",!0):(x(),E("span",{key:0,class:Ue(["mode-switch",{on:o.goalMode}])},[...Re[24]||(Re[24]=[w("span",{class:"mode-knob"},null,-1)])],2))]),Bn.value?(x(),E("div",fde,[sn.value?(x(),Se(jt,{key:0,size:"sm",variant:"secondary",class:"mode-row-action",onClick:Re[10]||(Re[10]=le=>i("controlGoal","pause"))},{default:Ie(()=>[ae(Ge,{name:"pause",size:"sm"}),w("span",null,R(C(r)("status.goalPause")),1)]),_:1})):ue("",!0),es.value?(x(),Se(jt,{key:1,size:"sm",variant:"primary",class:"mode-row-action",onClick:Re[11]||(Re[11]=le=>i("controlGoal","resume"))},{default:Ie(()=>[ae(Ge,{name:"play",size:"sm"}),w("span",null,R(C(r)("status.goalResume")),1)]),_:1})):ue("",!0),ae(jt,{size:"sm",variant:"danger-soft",class:"mode-row-action",onClick:Re[12]||(Re[12]=le=>i("controlGoal","cancel"))},{default:Ie(()=>[ae(Ge,{name:"close",size:"sm"}),w("span",null,R(C(r)("status.goalCancel")),1)]),_:1})])):ue("",!0)],2)],4)):ue("",!0)],512)):ue("",!0)]),w("div",hde,[Hn.value?(x(),E("button",{key:0,class:"compact-chip",onClick:Re[13]||(Re[13]=St(le=>i("compact"),["stop"]))},"/compact")):ue("",!0),ae(an,{text:en.value},{default:Ie(()=>[e.status&&!e.hideContext?(x(),E("span",{key:0,class:"ctx-group",role:"img",tabindex:"0","aria-label":en.value},[ae($ue,{pct:Ft.value},null,8,["pct"])],8,pde)):ue("",!0)]),_:1},8,["text"]),e.status?(x(),E("span",{key:1,class:Ue(["model-pill",{open:xe.value}]),role:"button",tabindex:"0",onClick:St(lt,["stop"]),onKeydown:[ur(lt,["enter"]),ur(St(lt,["prevent"]),["space"])]},[w("b",null,R(e.status.model),1),mn.value?(x(),E("span",gde,R(mn.value),1)):ue("",!0),ae(Ge,{class:"cv",name:"chevron-down",size:"sm"})],42,mde)):ue("",!0),e.running?(x(),Se(an,{key:2,text:C(r)("composer.interruptTitle")},{default:Ie(()=>[w("button",{class:"stop","aria-label":C(r)("composer.interrupt"),onClick:Re[14]||(Re[14]=le=>i("interrupt"))},[ae(Ge,{name:"stop",size:"sm"})],8,vde)]),_:1},8,["text"])):ue("",!0),w("button",{class:Ue(["send",{"is-starting":e.starting}]),"aria-label":qe.value,disabled:e.starting,onClick:Re[15]||(Re[15]=le=>G())},[e.starting?(x(),Se(Us,{key:0,size:"sm"})):(x(),Se(Ge,{key:1,name:"send",size:"sm"}))],10,yde)]),xe.value&&e.status?(x(),E("div",{key:0,class:"model-dropdown",role:"menu",onClick:Re[17]||(Re[17]=St(()=>{},["stop"]))},[No.value.length>0?(x(),E("div",kde,R(C(r)("status.starredModels")),1)):ue("",!0),(x(!0),E(We,null,rt(No.value,le=>(x(),E("button",{key:le.id,class:Ue(["md-row",{"is-current":le.id===e.status.modelId}]),role:"menuitem",onClick:Te=>di(le.id)},[w("span",xde,[le.id===e.status.modelId?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):ue("",!0)]),w("span",wde,R(le.displayName??le.model),1),w("span",_de,R(le.provider),1),ae(Ge,{class:"md-star",name:"star",size:"sm"})],10,bde))),128)),No.value.length>0?(x(),E("div",Sde)):ue("",!0),ns.value.length>0?(x(),E("div",Cde,R(ts.value),1)):ue("",!0),(x(!0),E(We,null,rt(ns.value,le=>(x(),E("button",{key:le.id,class:Ue(["md-row",{"is-current":le.id===e.status.modelId}]),role:"menuitem",onClick:Te=>di(le.id)},[w("span",Mde,[le.id===e.status.modelId?(x(),Se(Ge,{key:0,name:"check",size:"sm"})):ue("",!0)]),w("span",Ede,R(le.displayName??le.model),1),Ms(le.id)?(x(),Se(Ge,{key:0,class:"md-star",name:"star",size:"sm"})):ue("",!0)],10,Ade))),128)),ns.value.length>0?(x(),E("div",Tde)):ue("",!0),w("div",{class:Ue(["md-thinking",{"is-readonly":Wt.value}])},[w("span",Nde,R(C(r)("status.thinkingLabel")),1),bn.value==="unsupported"?(x(),E("span",Ide,R(C(r)("status.modeNotSupported")),1)):(x(),E("div",{key:1,class:"effort-segments",role:"group","aria-label":C(r)("status.thinkingLabel")},[(x(!0),E(We,null,rt(pn.value,le=>(x(),E("button",{key:le,type:"button",class:Ue(["effort-seg",{"is-active":le===Nn.value}]),disabled:Wt.value,onClick:Te=>so(le)},R(gn(le)),11,$de))),128))],8,Lde))],2),Re[25]||(Re[25]=w("div",{class:"md-divider"},null,-1)),w("div",Fde,R(C(r)("status.cacheNote")),1),Re[26]||(Re[26]=w("div",{class:"md-divider"},null,-1)),w("button",{class:"md-row md-row-more",role:"menuitem",onClick:Re[16]||(Re[16]=le=>{ut(),i("pickModel")})},[w("span",Ode,R(C(r)("status.moreModels")),1)])])):ue("",!0)],512)]),w("div",{class:Ue(["drop-overlay",{show:C(Z)}]),"aria-hidden":"true"},[w("div",Bde,[ae(Ge,{name:"file-plus",size:"lg"}),w("span",null,R(C(r)("composer.dropToAttach")),1)])],2)],34))}}),dT=dt(Rde,[["__scopeId","data-v-8f6254e0"]]),Dde={key:0,class:"ui-card__head"},Pde={class:"ui-card__body"},Hde={key:1,class:"ui-card__foot"},Wde=Je({__name:"Card",props:{elevated:{type:Boolean,default:!1}},setup(e){return(t,n)=>(x(),E("div",{class:Ue(["ui-card",{"is-elevated":e.elevated}])},[t.$slots.head?(x(),E("div",Dde,[jn(t.$slots,"head",{},void 0,!0)])):ue("",!0),w("div",Pde,[jn(t.$slots,"default",{},void 0,!0)]),t.$slots.foot?(x(),E("div",Hde,[jn(t.$slots,"foot",{},void 0,!0)])):ue("",!0)],2))}}),pb=dt(Wde,[["__scopeId","data-v-9c9f9a9a"]]),zde={class:"goal-kicker"},Ude={key:0,class:"goal-progress","aria-hidden":"true"},qde={class:"goal-full"},jde={key:0,class:"goal-criterion"},Vde=["inert","aria-hidden"],Kde={class:"goal-meta"},Gde={key:0},Yde={class:"goal-actions"},Zde=Je({__name:"GoalStrip",props:{goal:{},forceExpanded:{}},emits:["controlGoal"],setup(e,{emit:t}){const n=e,o=t,{t:s}=$t(),{confirm:i}=Gf(),r=oe(!1);et(()=>n.forceExpanded,()=>{n.forceExpanded!==void 0&&(r.value=!0)});const l=D(()=>{const d=n.goal.budget.tokenBudget;return!d||d<=0?0:Math.max(0,Math.min(100,Math.round(n.goal.tokensUsed/d*100)))});function a(d){switch(d){case"active":return s("status.goalStatusActive");case"paused":return s("status.goalStatusPaused");case"blocked":return s("status.goalStatusBlocked");case"complete":return s("status.goalStatusComplete")}}function c(d){const f=Math.max(0,Math.round(d/1e3)),h=Math.floor(f/60),p=f%60;return h<=0?`${p}s`:h<60?`${h}m ${p}s`:`${Math.floor(h/60)}h ${h%60}m`}async function u(){await i({title:s("status.goalCancel"),message:s("status.goalCancelConfirm"),confirmLabel:s("status.goalCancelConfirmYes"),cancelLabel:s("status.goalCancelConfirmNo"),variant:"danger"})&&o("controlGoal","cancel")}return(d,f)=>(x(),Se(pb,{class:Ue(["goal-strip",{expanded:r.value}])},{head:Ie(()=>[w("button",{class:"goal-row",type:"button",onClick:f[0]||(f[0]=h=>r.value=!r.value)},[ae(Ge,{class:"goal-icon",name:"target",size:"md"}),w("span",zde,R(C(s)("status.goalLabel")),1),w("span",{class:Ue(["goal-objective",{"expanded-hidden":r.value}])},R(e.goal.objective),3),ae(qi,{variant:e.goal.status==="active"?"success":e.goal.status==="blocked"?"danger":e.goal.status==="paused"?"warning":"neutral",size:"sm",class:"goal-status"},{default:Ie(()=>[ot(R(a(e.goal.status)),1)]),_:1},8,["variant"]),e.goal.budget.tokenBudget!==null?(x(),E("span",Ude,[w("span",{class:"goal-progress-fill",style:on({width:`${l.value}%`})},null,4)])):ue("",!0),ae(Ge,{class:Ue(["goal-chevron",{open:r.value}]),name:"chevron-right",size:"md"},null,8,["class"])])]),default:Ie(()=>[w("div",qde,R(e.goal.objective),1),e.goal.completionCriterion?(x(),E("div",jde,[f[3]||(f[3]=w("span",null,"Done when",-1)),w("p",null,R(e.goal.completionCriterion),1)])):ue("",!0)]),foot:Ie(()=>[w("div",{class:"goal-footer",inert:!r.value,"aria-hidden":!r.value},[w("div",Kde,[w("span",null,R(e.goal.turnsUsed)+" turns",1),w("span",null,R(C(pr)(e.goal.tokensUsed))+" tokens",1),w("span",null,R(c(e.goal.wallClockMs)),1),e.goal.budget.tokenBudget!==null?(x(),E("span",Gde,R(l.value)+"% token budget",1)):ue("",!0)]),w("div",Yde,[e.goal.status==="active"?(x(),Se(jt,{key:0,size:"sm",variant:"secondary",class:"goal-action",onClick:f[1]||(f[1]=St(h=>o("controlGoal","pause"),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"pause",size:"md"}),w("span",null,R(C(s)("status.goalPause")),1)]),_:1})):ue("",!0),e.goal.status==="paused"||e.goal.status==="blocked"?(x(),Se(jt,{key:1,size:"sm",variant:"primary",class:"goal-action",onClick:f[2]||(f[2]=St(h=>o("controlGoal","resume"),["stop"]))},{default:Ie(()=>[ae(Ge,{name:"play",size:"md"}),w("span",null,R(C(s)("status.goalResume")),1)]),_:1})):ue("",!0),ae(jt,{size:"sm",variant:"danger-soft",class:"goal-action",onClick:St(u,["stop"])},{default:Ie(()=>[ae(Ge,{name:"close",size:"md"}),w("span",null,R(C(s)("status.goalCancel")),1)]),_:1})])],8,Vde)]),_:1},8,["class"]))}}),Xde=dt(Zde,[["__scopeId","data-v-44bef30f"]]),Qde={class:"qh"},Jde={class:"qtitle"},efe={key:0,class:"qstep"},tfe={key:1,class:"qmin-peek"},nfe={class:"qbody"},ofe=["aria-label"],sfe=["aria-selected","aria-label","onClick"],ife={class:"qstep-num"},rfe={key:1,class:"qheader-chip"},lfe={class:"qtext"},afe={class:"qopts"},cfe=["onClick"],ufe={class:"qopt-key"},dfe={class:"qopt-glyph"},ffe={key:0,class:"chk"},hfe={key:1,class:"rad"},pfe={class:"qopt-text"},mfe={class:"qopt-label"},gfe={key:0,class:"qopt-desc"},vfe={class:"qopt-glyph"},yfe={key:0,class:"chk"},kfe={key:1,class:"rad"},bfe={class:"qopt-label"},xfe=["placeholder"],wfe={class:"qfoot"},_fe=Je({__name:"QuestionCard",props:{question:{},busyKind:{}},emits:["answer","dismiss"],setup(e,{emit:t}){const n=e,{t:o}=$t(),s=t,i=oe(0),r=oe(!1),l=D(()=>n.question.questions[i.value]),a=D(()=>n.question.questions.length);function c(){i.value>0&&i.value--}function u(){i.value<a.value-1&&i.value++}function d(L){L>=0&&L<a.value&&(i.value=L)}function f(L){const O=p.value[L];return O?O.kind==="multi"?O.optionIds.length>0:O.kind==="multiWithOther"?O.optionIds.length>0||O.otherText.trim().length>0:O.kind==="other"?O.text.trim().length>0:!0:!1}function h(){return f(l.value.id)}const p=oe({});function m(L){return L.recommended===!0?!0:/\b(?:recommended|recommend)\b|推荐/.test(`${L.label} ${L.description??""}`.toLowerCase())}function y(){const L={...p.value};let O=!1;for(const U of n.question.questions){if(L[U.id])continue;const Z=U.options.filter(m);Z.length!==0&&(L[U.id]=U.multiSelect?{kind:"multi",optionIds:Z.map(ie=>ie.id)}:{kind:"single",optionId:Z[0].id},O=!0)}O&&(p.value=L)}et(()=>n.question.questionId,()=>{i.value=0,r.value=!1,p.value={},v.value={}}),et(()=>n.question,()=>{i.value>=n.question.questions.length&&(i.value=0),y()},{immediate:!0,deep:!0});function k(L,O){const U=p.value[L];if(U&&U.kind==="single"&&U.optionId===O){const Z={...p.value};delete Z[L],p.value=Z}else p.value={...p.value,[L]:{kind:"single",optionId:O}}}function g(L,O){const U=p.value[L],Z=U&&(U.kind==="multi"||U.kind==="multiWithOther")?U.kind==="multi"?[...U.optionIds]:[...U.optionIds]:[],ie=Z.indexOf(O);ie>=0?Z.splice(ie,1):Z.push(O);const q=p.value[L],ee=q&&q.kind==="multiWithOther"?q.otherText:"";ee?p.value={...p.value,[L]:{kind:"multiWithOther",optionIds:Z,otherText:ee}}:p.value={...p.value,[L]:{kind:"multi",optionIds:Z}}}const v=oe({}),b=oe(null);function A(L){const O=n.question.questions.find(Z=>Z.id===L),U=v.value[L]??"";if(O.multiSelect){const Z=p.value[L],ie=Z&&(Z.kind==="multi"||Z.kind==="multiWithOther")?Z.kind==="multi"?[...Z.optionIds]:[...Z.optionIds]:[];p.value={...p.value,[L]:{kind:"multiWithOther",optionIds:ie,otherText:U}}}else p.value={...p.value,[L]:{kind:"other",text:U}}}function I(L){A(L),yt(()=>b.value?.focus())}function N(L,O){const U=p.value[L];return U?U.kind==="single"?U.optionId===O:U.kind==="multi"||U.kind==="multiWithOther"?U.optionIds.includes(O):!1:!1}function M(L){const O=p.value[L];return!!(O&&(O.kind==="other"||O.kind==="multiWithOther"))}function $(){return n.question.questions.every(L=>f(L.id))}const T=D(()=>n.busyKind==="answer"),F=D(()=>n.busyKind==="dismiss"),S=D(()=>!!n.busyKind);function B(){if(S.value||!$())return;const L={answers:p.value,method:"click"};s("answer",n.question.questionId,L)}function W(){S.value||s("dismiss",n.question.questionId)}function z(L){const O=(document.activeElement?.tagName??"").toLowerCase(),U=O==="input"||O==="textarea";if(S.value)return;if(L.key==="Enter"){if(L.preventDefault(),r.value)return;i.value<a.value-1&&h()?u():$()&&B();return}if(U)return;if(L.key==="Escape"){L.preventDefault(),W();return}if(r.value)return;const Z=parseInt(L.key,10);if(!isNaN(Z)&&Z>=1&&Z<=9){L.preventDefault();const ie=l.value,q=Z-1,ee=ie.options[q];ee&&(ie.multiSelect?g(ie.id,ee.id):k(ie.id,ee.id))}}return An(()=>document.addEventListener("keydown",z)),On(()=>document.removeEventListener("keydown",z)),(L,O)=>(x(),Se(pb,{class:Ue(["qcard",{minimized:r.value}])},ZA({head:Ie(()=>[w("div",Qde,[O[5]||(O[5]=w("span",{class:"qh-ic"},"?",-1)),w("span",Jde,R(C(o)("question.title")),1),a.value>1&&!r.value?(x(),E("span",efe,R(C(o)("question.step",{current:i.value+1,total:a.value})),1)):ue("",!0),r.value?(x(),E("span",tfe,R(l.value.question),1)):ue("",!0),ae(Xn,{class:"qmin",size:"sm",label:r.value?C(o)("question.expand"):C(o)("question.minimize"),onClick:O[0]||(O[0]=U=>r.value=!r.value)},{default:Ie(()=>[r.value?(x(),Se(Ge,{key:0,name:"chevron-up",size:"md"})):(x(),Se(Ge,{key:1,name:"minus",size:"md"}))]),_:1},8,["label"])])]),_:2},[r.value?void 0:{name:"default",fn:Ie(()=>[w("div",nfe,[a.value>1?(x(),E("div",{key:0,class:"qsteps",role:"tablist","aria-label":C(o)("question.step",{current:i.value+1,total:a.value})},[(x(!0),E(We,null,rt(n.question.questions,(U,Z)=>(x(),E("button",{key:U.id,type:"button",class:Ue(["qstep-dot",{active:Z===i.value,answered:f(U.id)}]),"aria-selected":Z===i.value,"aria-label":C(o)("question.step",{current:Z+1,total:a.value}),onClick:ie=>d(Z)},[w("span",ife,R(Z+1),1)],10,sfe))),128))],8,ofe)):ue("",!0),l.value.header?(x(),E("div",rfe,[ae(qi,{variant:"neutral",size:"sm"},{default:Ie(()=>[ot(R(l.value.header),1)]),_:1})])):ue("",!0),w("div",lfe,R(l.value.question),1),l.value.body?(x(),Se(Q1,{key:2,text:l.value.body,class:"qmdbody"},null,8,["text"])):ue("",!0),w("div",afe,[(x(!0),E(We,null,rt(l.value.options,(U,Z)=>(x(),E("label",{key:U.id,class:Ue(["qopt",{selected:N(l.value.id,U.id)}]),onClick:St(ie=>l.value.multiSelect?g(l.value.id,U.id):k(l.value.id,U.id),["prevent"])},[w("span",ufe,R(Z+1),1),w("span",dfe,[l.value.multiSelect?(x(),E("span",ffe,R(N(l.value.id,U.id)?"■":"□"),1)):(x(),E("span",hfe,R(N(l.value.id,U.id)?"●":"○"),1))]),w("span",pfe,[w("span",mfe,R(U.label),1),U.description?(x(),E("span",gfe,R(U.description),1)):ue("",!0)])],10,cfe))),128)),l.value.allowOther?(x(),E("label",{key:0,class:Ue(["qopt",{selected:M(l.value.id)}]),onClick:O[4]||(O[4]=St(U=>I(l.value.id),["prevent"]))},[O[6]||(O[6]=w("span",{class:"qopt-key"},null,-1)),w("span",vfe,[l.value.multiSelect?(x(),E("span",yfe,R(M(l.value.id)?"■":"□"),1)):(x(),E("span",kfe,R(M(l.value.id)?"●":"○"),1))]),w("span",bfe,R(l.value.otherLabel??C(o)("question.otherDefault")),1),qn(w("input",{ref_key:"otherInputEl",ref:b,"onUpdate:modelValue":O[1]||(O[1]=U=>v.value[l.value.id]=U),class:"other-input",type:"text",placeholder:l.value.otherLabel??C(o)("question.otherDefault"),onInput:O[2]||(O[2]=U=>A(l.value.id)),onFocus:O[3]||(O[3]=U=>A(l.value.id))},null,40,xfe),[[Cs,v.value[l.value.id]]])],2)):ue("",!0)])])]),key:"0"},r.value?void 0:{name:"foot",fn:Ie(()=>[w("div",wfe,[i.value<a.value-1?(x(),Se(jt,{key:0,class:"qfoot-btn qfoot-main",size:"sm",variant:"primary",disabled:!h(),onClick:u},{default:Ie(()=>[ot(R(C(o)("question.nextQuestion")),1)]),_:1},8,["disabled"])):(x(),Se(jt,{key:1,class:"qfoot-btn qfoot-main",size:"sm",variant:"primary",disabled:!$(),loading:T.value,onClick:B},{default:Ie(()=>[ot(R(C(o)("question.submit")),1)]),_:1},8,["disabled","loading"])),a.value>1?(x(),Se(jt,{key:2,class:"qfoot-btn",size:"sm",variant:"secondary",disabled:i.value===0||S.value,onClick:c},{default:Ie(()=>[ot(R(C(o)("question.back")),1)]),_:1},8,["disabled"])):ue("",!0),ae(jt,{class:"qfoot-btn",size:"sm",variant:"ghost",loading:F.value,disabled:S.value,onClick:W},{default:Ie(()=>[ot(R(C(o)("question.dismiss")),1)]),_:1},8,["loading","disabled"])])]),key:"1"}]),1032,["class"]))}}),Sfe=dt(_fe,[["__scopeId","data-v-14c58ac1"]]),Cfe={class:"ah"},Afe={class:"akind"},Mfe={class:"apath"},Efe={class:"ah-path"},Tfe={key:1,class:"diff"},Nfe={class:"dg"},Ife={class:"dc"},Lfe={key:2,class:"body-shell"},$fe={class:"shell-cmd"},Ffe={key:0,class:"shell-cwd"},Ofe={key:1,class:"shell-danger"},Bfe={key:3,class:"body-file"},Rfe={class:"file-bar"},Dfe={class:"file-lang"},Pfe={class:"file-content"},Hfe={class:"file-ln"},Wfe={class:"file-text"},zfe={key:4,class:"body-chip"},Ufe={class:"chip-label"},qfe={class:"chip-value"},jfe={key:0,class:"chip-detail"},Vfe={key:5,class:"body-chip"},Kfe={key:0,class:"chip-label"},Gfe={class:"chip-value"},Yfe={key:6,class:"body-chip"},Zfe={class:"chip-label"},Xfe={class:"chip-value"},Qfe={key:0,class:"chip-detail"},Jfe={key:7,class:"body-chip"},ehe={class:"chip-label"},the={class:"chip-value"},nhe={key:0,class:"chip-detail"},ohe={key:8,class:"body-todo"},she={class:"todo-glyph"},ihe={key:9,class:"body-plan"},rhe={key:10,class:"body-generic"},lhe={class:"gen-text"},ahe={key:11,class:"feedback-wrap"},che=["placeholder"],uhe={class:"feedback-hint"},dhe={key:0,class:"plan-actions"},fhe={key:1,class:"abtn"},hhe=Je({__name:"ApprovalCard",props:{block:{},agentName:{},busy:{type:Boolean}},emits:["decide"],setup(e,{emit:t}){const n=e,o=t,{t:s}=$t(),i=D(()=>{const T=n.block;return T.kind!=="plan_review"?null:{plan:T.plan,path:T.path,options:T.options??[]}}),r=oe(!1),l=["shell","diff","file","fileop","url","search","invocation","todo","plan_review","generic"];function a(){const T=l.includes(n.block.kind)?n.block.kind:"generic";return s(`approval.title.${T}`)}const c=oe(!1),u=oe(""),d=oe(null);function f(){n.busy||(c.value=!0,u.value="",setTimeout(()=>d.value?.focus(),0))}function h(){if(n.busy)return;const T=u.value.trim();i.value?k("feedback",{decision:"rejected",selectedLabel:"Revise",feedback:T||void 0}):k("feedback",{decision:"rejected",feedback:T||void 0}),c.value=!1,u.value=""}function p(){c.value=!1,u.value=""}function m(T){T.key==="Enter"&&!T.shiftKey?(T.preventDefault(),h()):T.key==="Escape"&&(T.preventDefault(),p())}const y=oe(null);et(()=>n.busy,T=>{T||(y.value=null)});function k(T,F){n.busy||(y.value=T,o("decide",F))}function g(){k("approve",{decision:"approved"})}function v(){k("approveSession",{decision:"approved",scope:"session"})}function b(){k("reject",{decision:"rejected"})}function A(){k("approvePlan",{decision:"approved"})}function I(T){k(`option:${T}`,{decision:"approved",selectedLabel:T})}function N(){n.busy||f()}function M(){k("rejectAndExit",{decision:"rejected",selectedLabel:"Reject and Exit"})}function $(T){const F=(document.activeElement?.tagName??"").toLowerCase();if(F==="input"||F==="textarea"||n.busy||r.value)return;const S=i.value;if(S){if(S.options.length===0){T.key==="1"?(T.preventDefault(),A()):T.key==="2"?(T.preventDefault(),N()):T.key==="3"&&(T.preventDefault(),M());return}T.key==="1"&&S.options[0]?(T.preventDefault(),I(S.options[0].label)):T.key==="2"&&S.options[1]?(T.preventDefault(),I(S.options[1].label)):T.key==="3"&&S.options[2]&&(T.preventDefault(),I(S.options[2].label));return}T.key==="1"?(T.preventDefault(),g()):T.key==="2"?(T.preventDefault(),v()):T.key==="3"?(T.preventDefault(),b()):T.key==="4"&&(T.preventDefault(),f())}return An(()=>document.addEventListener("keydown",$)),On(()=>document.removeEventListener("keydown",$)),(T,F)=>(x(),Se(pb,{class:Ue(["appr",{minimized:r.value}])},ZA({head:Ie(()=>[w("div",Cfe,[F[2]||(F[2]=w("span",{class:"ah-ic"},"!",-1)),w("span",Afe,R(a()),1),w("span",Mfe,[e.block.kind==="diff"||e.block.kind==="file"||e.block.kind==="fileop"?(x(),E(We,{key:0},[ot(R(e.block.path),1)],64)):e.block.kind==="shell"?(x(),E(We,{key:1},[ot(R(e.block.command),1)],64)):e.block.kind==="url"?(x(),E(We,{key:2},[ot(R(e.block.url),1)],64)):e.block.kind==="search"?(x(),E(We,{key:3},[ot(R(e.block.query),1)],64)):e.block.kind==="invocation"?(x(),E(We,{key:4},[ot(R(e.block.name),1)],64)):e.block.kind==="generic"?(x(),E(We,{key:5},[ot(R(e.block.summary),1)],64)):ue("",!0)]),e.agentName&&!r.value?(x(),Se(qi,{key:0,variant:"neutral",size:"sm"},{default:Ie(()=>[ot(R(C(s)("approval.subagentBadge",{name:e.agentName})),1)]),_:1})):ue("",!0),r.value?ue("",!0):(x(),Se(qi,{key:1,variant:"warning",size:"sm",class:"aw"},{default:Ie(()=>[ot(R(C(s)("approval.required")),1)]),_:1})),ae(Xn,{class:"amin",size:"sm",label:r.value?C(s)("question.expand"):C(s)("question.minimize"),onClick:F[0]||(F[0]=S=>r.value=!r.value)},{default:Ie(()=>[r.value?(x(),Se(Ge,{key:0,name:"chevron-up",size:"md"})):(x(),Se(Ge,{key:1,name:"minus",size:"md"}))]),_:1},8,["label"])])]),_:2},[r.value?void 0:{name:"default",fn:Ie(()=>[e.block.kind==="plan_review"&&e.block.path?(x(),Se(an,{key:0,text:e.block.path},{default:Ie(()=>[w("div",Efe,R(e.block.path),1)]),_:1},8,["text"])):ue("",!0),e.block.kind==="diff"?(x(),E("div",Tfe,[(x(!0),E(We,null,rt(e.block.diff,(S,B)=>(x(),E("div",{key:B,class:Ue(["dl",S.kind==="add"?"add":S.kind==="rem"?"del":""])},[w("span",Nfe,R(S.gutter),1),w("span",Ife,R(S.text),1)],2))),128))])):e.block.kind==="shell"?(x(),E("div",Lfe,[w("div",$fe,[F[3]||(F[3]=w("span",{class:"shell-dollar"},"$",-1)),ot(" "+R(e.block.command),1)]),e.block.cwd?(x(),E("div",Ffe,"cwd: "+R(e.block.cwd),1)):ue("",!0),e.block.danger?(x(),E("div",Ofe,R(C(s)("approval.danger",{detail:e.block.danger})),1)):ue("",!0)])):e.block.kind==="file"?(x(),E("div",Bfe,[w("div",Rfe,[w("span",Dfe,R(e.block.language??""),1)]),w("div",Pfe,[(x(!0),E(We,null,rt(e.block.content.split(`
314
314
  `),(S,B)=>(x(),E("div",{key:B,class:"file-line"},[w("span",Hfe,R(B+1),1),w("span",Wfe,R(S),1)]))),128))])])):e.block.kind==="fileop"?(x(),E("div",zfe,[w("span",Ufe,R(e.block.op),1),w("span",qfe,R(e.block.path),1),e.block.detail?(x(),E("span",jfe,R(e.block.detail),1)):ue("",!0)])):e.block.kind==="url"?(x(),E("div",Vfe,[e.block.method?(x(),E("span",Kfe,R(e.block.method),1)):ue("",!0),w("span",Gfe,R(e.block.url),1)])):e.block.kind==="search"?(x(),E("div",Yfe,[w("span",Zfe,R(C(s)("approval.searchQueryLabel")),1),w("span",Xfe,R(e.block.query),1),e.block.scope?(x(),E("span",Qfe,R(C(s)("approval.searchScope",{scope:e.block.scope})),1)):ue("",!0)])):e.block.kind==="invocation"?(x(),E("div",Jfe,[w("span",ehe,R(e.block.kind2),1),w("span",the,R(e.block.name),1),e.block.description?(x(),E("span",nhe,R(e.block.description),1)):ue("",!0)])):e.block.kind==="todo"?(x(),E("div",ohe,[(x(!0),E(We,null,rt(e.block.items,(S,B)=>(x(),E("div",{key:B,class:"todo-item"},[w("span",she,R(S.status==="done"||S.status==="completed"?"✓":"○"),1),w("span",{class:Ue(["todo-title",{"todo-done":S.status==="done"||S.status==="completed"}])},R(S.title),3)]))),128))])):e.block.kind==="plan_review"?(x(),E("div",ihe,[ae(Q1,{text:e.block.plan},null,8,["text"])])):(x(),E("div",rhe,[w("span",lhe,R(e.block.summary),1)])),c.value?(x(),E("div",ahe,[qn(w("textarea",{ref_key:"feedbackRef",ref:d,"onUpdate:modelValue":F[1]||(F[1]=S=>u.value=S),class:"feedback-ta",placeholder:C(s)("approval.feedbackPlaceholder"),rows:"2",onKeydown:m},null,40,che),[[Cs,u.value]]),w("div",uhe,R(C(s)("approval.feedbackHint")),1)])):ue("",!0)]),key:"0"},r.value?void 0:{name:"foot",fn:Ie(()=>[i.value?(x(),E("div",dhe,[i.value.options.length>0?(x(!0),E(We,{key:0},rt(i.value.options,(S,B)=>(x(),Se(an,{key:B,text:S.description},{default:Ie(()=>[ae(jt,{class:"kbtn",size:"sm",variant:"primary",loading:y.value===`option:${S.label}`,disabled:e.busy,onClick:W=>I(S.label)},{default:Ie(()=>[ot(R(S.label),1),ae(Er,{class:"k",keys:[String(B+1)]},null,8,["keys"])]),_:2},1032,["loading","disabled","onClick"])]),_:2},1032,["text"]))),128)):(x(),Se(jt,{key:1,class:"kbtn",size:"sm",variant:"primary",loading:y.value==="approvePlan",disabled:e.busy,onClick:A},{default:Ie(()=>[ot(R(C(s)("approval.approvePlan")),1),ae(Er,{class:"k",keys:["1"]})]),_:1},8,["loading","disabled"])),ae(jt,{class:"kbtn",size:"sm",variant:"secondary",disabled:e.busy,onClick:N},{default:Ie(()=>[ot(R(C(s)("approval.revise")),1),i.value.options.length===0?(x(),Se(Er,{key:0,class:"k",keys:["2"]})):ue("",!0)]),_:1},8,["disabled"]),ae(jt,{class:"kbtn",size:"sm",variant:"danger-soft",loading:y.value==="rejectAndExit",disabled:e.busy,onClick:M},{default:Ie(()=>[ot(R(C(s)("approval.rejectAndExit")),1),i.value.options.length===0?(x(),Se(Er,{key:0,class:"k",keys:["3"]})):ue("",!0)]),_:1},8,["loading","disabled"])])):(x(),E("div",fhe,[ae(jt,{class:"kbtn",size:"sm",variant:"primary",loading:y.value==="approve",disabled:e.busy,onClick:g},{default:Ie(()=>[ot(R(C(s)("approval.approve")),1),ae(Er,{class:"k",keys:["1"]})]),_:1},8,["loading","disabled"]),ae(jt,{class:"kbtn",size:"sm",variant:"secondary",loading:y.value==="approveSession",disabled:e.busy,onClick:v},{default:Ie(()=>[ot(R(C(s)("approval.approveSession")),1),ae(Er,{class:"k",keys:["2"]})]),_:1},8,["loading","disabled"]),ae(jt,{class:"kbtn",size:"sm",variant:"secondary",loading:y.value==="reject",disabled:e.busy,onClick:b},{default:Ie(()=>[ot(R(C(s)("approval.reject")),1),ae(Er,{class:"k",keys:["3"]})]),_:1},8,["loading","disabled"]),ae(jt,{class:"kbtn",size:"sm",variant:"secondary",disabled:e.busy,onClick:f},{default:Ie(()=>[ot(R(C(s)("approval.feedback")),1),ae(Er,{class:"k",keys:["4"]})]),_:1},8,["disabled"])]))]),key:"1"}]),1032,["class"]))}}),phe=dt(hhe,[["__scopeId","data-v-458a9d7d"]]),mhe=Je({__name:"StatusGlyph",props:{status:{}},setup(e){const t=e,n={pending:"○",run:"●",done:"✓",fail:"✗"};return(o,s)=>(x(),E("span",{class:Ue(["status-glyph",`s-${t.status}`]),"aria-hidden":"true"},R(n[t.status]),3))}}),fT=dt(mhe,[["__scopeId","data-v-f595d935"]]),ghe={class:"taskspane"},vhe={class:"tp-head"},yhe={class:"tp-title"},khe={class:"tp-count"},bhe={class:"tp-list"},xhe={key:0,class:"tp-empty"},whe=["role","onClick"],_he={class:"tp-name"},She={class:"tp-time"},Che=["onClick"],Ahe={key:0,class:"tp-detail"},Mhe={key:0,class:"tp-codebox"},Ehe=["onClick"],The={class:"tp-pre"},Nhe={class:"tp-cmd"},Ihe={key:1,class:"tp-codebox"},Lhe=["onClick"],$he={class:"tp-pre"},Fhe=Je({__name:"TasksPane",props:{tasks:{}},emits:["cancel","open"],setup(e,{emit:t}){const n=t,{t:o}=$t(),s=zo(new Set),i=zo(new Set),r=zo(new Set);function l(p){return!!(p.output&&p.output.length>0||p.meta)}function a(p){if(p.kind==="subagent"){n("open",p.id);return}l(p)&&(s.has(p.id)?s.delete(p.id):s.add(p.id))}function c(p){return p.kind==="subagent"||l(p)}function u(p){return p==="run"||p==="done"||p==="fail"?p:"pending"}async function d(p,m,y){await Jo(p)&&(y.add(m),setTimeout(()=>y.delete(m),1500))}async function f(p){p.meta&&await d(p.meta,p.id,i)}async function h(p){const m=p.output?.join(`
315
315
  `)??"";m&&await d(m,p.id,r)}return(p,m)=>(x(),E("div",ghe,[w("div",vhe,[w("span",yhe,R(C(o)("tasks.tag")),1),w("span",khe,R(e.tasks.length),1)]),w("div",bhe,[e.tasks.length===0?(x(),E("div",xhe,R(C(o)("tasks.emptyTasks")),1)):(x(!0),E(We,{key:1},rt(e.tasks,y=>(x(),E("div",{key:y.id,class:Ue(["tp-row",{done:y.state==="done",fail:y.state==="fail",expandable:c(y)}])},[w("div",{class:"tp-main",role:c(y)?"button":void 0,onClick:k=>a(y)},[ae(fT,{status:u(y.state)},null,8,["status"]),w("span",_he,R(y.name),1),ae(qi,{variant:"neutral",size:"sm"},{default:Ie(()=>[ot(R(y.kind),1)]),_:2},1024),w("span",She,R(y.timing),1),y.state==="run"?(x(),E("button",{key:0,class:"tp-stop",onClick:St(k=>n("cancel",y.id),["stop"])},R(C(o)("tasks.stop")),9,Che)):ue("",!0),y.kind==="subagent"?(x(),Se(Ge,{key:1,class:"tp-chevron",name:"chevron-right",size:"sm"})):l(y)?(x(),Se(Ge,{key:2,class:Ue(["tp-chevron",{open:s.has(y.id)}]),name:"chevron-right",size:"sm"},null,8,["class"])):ue("",!0)],8,whe),s.has(y.id)&&l(y)?(x(),E("div",Ahe,[y.meta?(x(),E("div",Mhe,[w("button",{class:Ue(["tp-copy",{copied:i.has(y.id)}]),onClick:St(k=>f(y),["stop"])},R(i.has(y.id)?"已复制":"复制"),11,Ehe),w("pre",The,[w("code",null,[w("span",Nhe,R(y.meta),1)])])])):ue("",!0),y.output&&y.output.length>0?(x(),E("div",Ihe,[w("button",{class:Ue(["tp-copy",{copied:r.has(y.id)}]),onClick:St(k=>h(y),["stop"])},R(r.has(y.id)?"已复制":"复制"),11,Lhe),w("pre",$he,[w("code",null,[m[0]||(m[0]=ot(`
316
316
  `,-1)),(x(!0),E(We,null,rt(y.output,(k,g)=>(x(),E("span",{key:g,class:"tp-line"},R(k),1))),128)),m[1]||(m[1]=ot(`
@@ -338,5 +338,5 @@ ${Q}`)}const Ae=he.join(`
338
338
  `),compaction:{trigger:g?.trigger,tokensBefore:g?.tokensBefore,tokensAfter:g?.tokensAfter}});continue}if(h.role==="user"){const g=sye(h);if(c(),g!==void 0){i.push(lye(h,r++,g));continue}if(!aye(h))continue;const v=h.metadata?.origin,b=v?.kind==="skill_activation"&&v?.trigger==="user-slash",A=v?.kind==="plugin_command"&&v?.trigger==="user-slash",I=[],N=[];for(const M of h.content){if(M.type==="text")if(b)I.push(v.skillArgs??"");else if(A)I.push(v.commandArgs??"");else{const T=Uve(M.text);if(T&&(T.kind==="video"||T.kind==="image")&&n){const B=jve(T.path);if(B){N.push({url:n(B),kind:T.kind,fileId:B});continue}}const F=Kve(M.text);if(F){N.push({kind:"file",url:F.fileId&&n?n(F.fileId):"",fileId:F.fileId,name:F.name,mediaType:F.mediaType,size:F.size});continue}const S=Wve(M.text);if(S!==M.text&&S.trim().length===0)continue;I.push(S)}const $=f(M);if($){N.push({url:$.url,kind:$.kind,name:M.type==="file"?M.name:void 0,fileId:$.fileId});continue}M.type==="file"&&n&&N.push({kind:"file",url:n(M.fileId),fileId:M.fileId,name:M.name,mediaType:M.mediaType||void 0,size:M.size})}i.push({id:h.id,role:"user",no:r++,text:I.join(`
339
339
  `),attachments:N.length>0?N:void 0,skillActivation:b?{name:v.skillName,args:v.skillArgs}:void 0,pluginCommand:A?{pluginId:v.pluginId,commandName:v.commandName,args:v.commandArgs}:void 0,createdAt:h.createdAt});continue}if(h.role==="tool"){a&&u(a,h.content);continue}const p=h.promptId;uye(a,p)?a!==null&&a.promptId===void 0&&p!==void 0&&(a.promptId=p):(c(),a={id:h.id,promptId:p,textParts:[],thinkingParts:[],tools:[],blocks:[],approval:void 0,approvalId:void 0,foldedSigs:[],durationMs:h.durationMs});const y=a;if(y===null)continue;const k=fye(h.content);if(y.promptId!==void 0&&y.foldedSigs.some(g=>hye(g,k))){d(y,h.content);continue}y.foldedSigs.push(k),u(y,h.content)}return c(!0),i}function pye(e,t){const{pushOperationFailure:n,nextOptimisticMsgId:o,connectEventsIfNeeded:s,getEventConn:i,resolveThinkingForPrompt:r}=t,l=oe({}),a=D(()=>{const T=e.activeSessionId;if(!T)return null;const F=l.value[T];return F?{parentId:T,agentId:F.agentId}:null}),c=D(()=>a.value?.parentId??null),u=D(()=>a.value!==null),d=D(()=>{const T=a.value;return T?!!e.sideChatSendingByAgent[T.agentId]:!1}),f=D(()=>{const T=a.value;return T?e.sideChatSendingByAgent[T.agentId]?!0:(e.tasksBySession[T.parentId]??[]).some(F=>F.id===T.agentId&&F.status==="running"):!1}),h=D(()=>{const T=a.value;if(!T)return[];const F=e.sideChatMessagesByAgent[T.agentId]??[];return _T(F,[],S=>ht().getFileUrl(S),f.value)});function p(T,F){e.sideChatMessagesByAgent={...e.sideChatMessagesByAgent,[T]:F(e.sideChatMessagesByAgent[T]??[])}}function m(T,F){p(T,S=>[...S,F])}function y(T){p(T,F=>{const S=[...F].reverse().findIndex(W=>W.role==="user");if(S===-1)return F;const B=F.length-1-S;return F.filter((W,z)=>z!==B)})}function k(T,F){p(T,S=>{const B=[...S];for(let W=B.length-1;W>=0;W-=1){const z=B[W];if(z.role==="user")return B[W]={...z,promptId:z.promptId??F},B}return S})}function g(T,F,S){S&&p(T,B=>{const W=B.at(-1);if(W?.role==="assistant"){const z=W.content[0],L=z?.type==="text"?z.text:"";return[...B.slice(0,-1),{...W,content:[{type:"text",text:`${L}${S}`}]}]}return[...B,{id:o(),sessionId:F,role:"assistant",content:[{type:"text",text:S}],createdAt:new Date().toISOString()}]})}function v(T,F,S){if(e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[T]:!1},!S)return;const W=(e.sideChatMessagesByAgent[T]??[]).at(-1);(W?.role==="assistant"&&W.content[0]?.type==="text"?W.content[0].text:"").trim().length>0||g(T,F,S)}async function b(T){const F=e.activeSessionId;F&&await A(F,T)}async function A(T,F){if(!l.value[T]){let S;try{({agentId:S}=await ht().startBtw(T))}catch(B){n("openSideChat",B,{sessionId:T});return}e.sideChatMessagesByAgent={...e.sideChatMessagesByAgent,[S]:e.sideChatMessagesByAgent[S]??[]},l.value={...l.value,[T]:{agentId:S}},s(),i()?.markSideChannelAgent(S)}F&&F.trim()&&await I(T,F.trim())}async function I(T,F){const S=l.value[T],B=F.trim();if(!S||!B)return;const W=T,z=S.agentId;e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[z]:!0};const L={id:o(),sessionId:W,role:"user",content:[{type:"text",text:B}],createdAt:new Date().toISOString(),metadata:{"kimiWeb.optimisticUserMessage":!0}};m(z,L);try{const O=e.sessions.find(ie=>ie.id===W),U=(O?.model&&O.model.length>0?O.model:e.defaultModel)??void 0,Z=await ht().submitPrompt(W,{content:[{type:"text",text:B}],agentId:z,model:U,thinking:await r(W,U)??e.thinking,permissionMode:e.permission,planMode:e.planModeBySession[W]??!1,swarmMode:e.swarmModeBySession[W]??!1});k(z,Z.promptId),e.sideChatUserMessageIdsBySession={...e.sideChatUserMessageIdsBySession,[W]:[...e.sideChatUserMessageIdsBySession[W]??[],Z.userMessageId]}}catch(O){n("sendSideChatPrompt",O,{sessionId:W}),y(z),e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[z]:!1}}}function N(){const T=e.activeSessionId;if(!T)return;const{[T]:F,...S}=l.value;l.value=S}async function M(T){const F=a.value;F&&await I(F.parentId,T)}function $(T){if(!l.value[T])return;const{[T]:F,...S}=l.value;l.value=S}return{sideChatTargetBySession:l,sideChatSessionId:c,sideChatVisible:u,sideChatSending:d,sideChatRunning:f,sideChatTurns:h,appendSideChatAssistantText:g,finishSideChatAgent:v,openSideChat:b,openSideChatOn:A,closeSideChat:N,sendSideChatPrompt:M,clearSideChatForSession:$}}const mye="kimiWeb.optimisticUserMessage",Q3="Sub Agent";function gye(){return{sessions:[],activeSessionId:void 0,messagesBySession:{},approvalsBySession:{},planReviewByToolCallId:{},questionsBySession:{},tasksBySession:{},goalBySession:{},goalVersionBySession:{},lastSeqBySession:{},turnActiveBySession:{},compactionBySession:{},warnings:[]}}function vye(e){return{...e,sessions:e.sessions,messagesBySession:{...e.messagesBySession},approvalsBySession:{...e.approvalsBySession},planReviewByToolCallId:{...e.planReviewByToolCallId},questionsBySession:{...e.questionsBySession},tasksBySession:{...e.tasksBySession},goalBySession:{...e.goalBySession},goalVersionBySession:{...e.goalVersionBySession},lastSeqBySession:{...e.lastSeqBySession},turnActiveBySession:{...e.turnActiveBySession},compactionBySession:{...e.compactionBySession},warnings:[...e.warnings]}}function yye(e,t,n){if(t!==void 0&&n!==void 0&&n>0){const o=e.lastSeqBySession[t]??0;n>o&&(e.lastSeqBySession[t]=n)}}function Hv(e){return e.role==="user"&&e.metadata?.[mye]===!0}function kye(e){const t=e.metadata?.origin;return t?.kind==="cron_job"||t?.kind==="cron_missed"}function bye(e,t){return JSON.stringify(e.content)===JSON.stringify(t.content)}const xye=/^<(image|video|audio)\s+path="[^"]+"><\/\1>$/;function J3(e){let t="",n=0;for(const o of e.content)o.type==="text"?xye.test(o.text.trim())?n+=1:t+=o.text:(o.type==="image"||o.type==="video"||o.type==="file")&&(n+=1);return{text:t,media:n}}function wye(e,t){const n=J3(e),o=J3(t);return n.text===o.text&&n.media===o.media}function _ye(e,t){const n=t.promptId;if(n!==void 0)for(let o=e.length-1;o>=0;o--){const s=e[o];if(Hv(s)&&s.promptId===n)return o}for(let o=e.length-1;o>=0;o--){const s=e[o];if(Hv(s)&&bye(s,t))return o}for(let o=e.length-1;o>=0;o--){const s=e[o];if(Hv(s)&&wye(s,t))return o}return-1}function Sye(e,t,n){let o=!1;const s=e.map(i=>{let r=!1;const l=i.content.map(a=>a.type!=="toolUse"||a.toolCallId!==t?a:(r=!0,{...a,outputLines:[...a.outputLines??[],n]}));return r?(o=!0,{...i,content:l}):i});return o?s:e}const Cye={"provider.connection_error":"connection","provider.auth_error":"auth","provider.rate_limit":"rateLimit","provider.overloaded":"overloaded","provider.filtered":"filtered","provider.api_error":"api","context.overflow":"contextOverflow"};function Aye(e){const t=Rn.global.t,n=[],o=(r,l)=>{typeof l=="number"||typeof l=="boolean"?n.push({label:r,value:String(l)}):typeof l=="string"&&l.length>0&&n.push({label:r,value:l})};o(t("warnings.details.code"),e.code);const s=e.details??{};o(t("warnings.details.status"),s.statusCode),o(t("warnings.details.requestId"),s.requestId),o(t("warnings.details.errorName"),e.name);for(const[r,l]of Object.entries(s))r==="statusCode"||r==="requestId"||o(r,l);const i=(e.code!==void 0?Cye[e.code]:void 0)??"title";return{severity:"error",title:t(`warnings.agentError.${i}`),message:e.message,details:n.length>0?n:void 0}}function Mye(e,t,n){const o=vye(e);switch(yye(o,n.sessionId,n.seq),t.type){case"sessionCreated":{o.sessions.some(i=>i.id===t.session.id)||(o.sessions=[t.session,...o.sessions]);break}case"sessionUpdated":{o.sessions=o.sessions.map(s=>s.id===t.session.id?t.session:s);break}case"sessionDeleted":{const s=t.sessionId;o.sessions=o.sessions.filter(i=>i.id!==s),delete o.messagesBySession[s],delete o.tasksBySession[s],delete o.goalBySession[s],delete o.approvalsBySession[s],delete o.questionsBySession[s],delete o.lastSeqBySession[s],delete o.turnActiveBySession[s],o.activeSessionId===s&&(o.activeSessionId=void 0);break}case"sessionWorkChanged":{o.sessions=o.sessions.map(s=>s.id!==t.sessionId?s:{...s,busy:t.busy,mainTurnActive:t.mainTurnActive??(t.busy?s.mainTurnActive:!1),pendingInteraction:t.pendingInteraction??s.pendingInteraction,lastTurnReason:t.lastTurnReason}),t.mainTurnActive===!0?o.turnActiveBySession[t.sessionId]=!0:(t.mainTurnActive===!1||!t.busy)&&delete o.turnActiveBySession[t.sessionId];break}case"sessionMetaUpdated":{o.sessions=o.sessions.map(s=>s.id===t.sessionId?{...s,title:t.title??s.title,lastPrompt:t.lastPrompt??s.lastPrompt}:s);break}case"sessionUsageUpdated":{o.sessions=o.sessions.map(s=>{if(s.id!==t.sessionId)return s;const i=t.model&&t.model.length>0?t.model:s.model;return{...s,usage:t.usage,model:i}});break}case"historyCompacted":break;case"compactionStarted":{o.compactionBySession={...o.compactionBySession,[t.sessionId]:{status:"running",trigger:t.trigger}};break}case"compactionCompleted":{const s=t.sessionId,i=o.compactionBySession[s],{[s]:r,...l}=o.compactionBySession;if(o.compactionBySession=l,Object.prototype.hasOwnProperty.call(o.messagesBySession,s)){const a=o.messagesBySession[s]??[],c=`compaction_${s}_${n.seq}`;if(!a.some(u=>u.id===c)){const u={trigger:i?.trigger??"auto",tokensBefore:t.tokensBefore,tokensAfter:t.tokensAfter};o.messagesBySession[s]=[...a,{id:c,sessionId:s,role:"assistant",content:t.summary?[{type:"text",text:t.summary}]:[],createdAt:new Date().toISOString(),metadata:{origin:{kind:"compaction_summary"},[xT]:u}}]}}break}case"compactionCancelled":{const{[t.sessionId]:s,...i}=o.compactionBySession;o.compactionBySession=i;break}case"messageCreated":{const s=t.message.sessionId,i=t.message.createdAt;o.sessions=o.sessions.map(a=>a.id===s&&i>a.updatedAt?{...a,updatedAt:i}:a);const r=o.messagesBySession[s]??[];if(!r.some(a=>a.id===t.message.id)){if(t.message.role==="user"&&!kye(t.message)){const a=_ye(r,t.message);if(a!==-1){const c=[...r],u=c[a];c[a]={...t.message,id:u.id,promptId:t.message.promptId??u.promptId,metadata:{...t.message.metadata,...u.metadata}},o.messagesBySession[s]=c;break}}o.messagesBySession[s]=[...r,t.message]}break}case"messageUpdated":{const s=t.sessionId,i=o.messagesBySession[s]??[];o.messagesBySession[s]=i.map(r=>r.id!==t.messageId?r:{...r,content:t.content,durationMs:t.durationMs??r.durationMs});break}case"assistantDelta":{const s=t.sessionId,i=o.messagesBySession[s]??[];o.messagesBySession[s]=i.map(r=>{if(r.id!==t.messageId)return r;const l=[...r.content],a=t.contentIndex;for(;l.length<=a;)l.push({type:"text",text:""});const c=l[a];let u;return t.delta.text!==void 0?c.type==="text"?u={type:"text",text:c.text+t.delta.text}:u={type:"text",text:t.delta.text}:t.delta.thinking!==void 0?c.type==="thinking"?u={type:"thinking",thinking:c.thinking+t.delta.thinking,signature:c.signature}:u={type:"thinking",thinking:t.delta.thinking}:u=c,l[a]=u,{...r,content:l}});break}case"toolOutput":{const s=t.sessionId,i=o.messagesBySession[s]??[];o.messagesBySession[s]=Sye(i,t.toolCallId,t.outputChunk);break}case"approvalRequested":{const s=t.sessionId,i=o.approvalsBySession[s]??[];i.some(a=>a.approvalId===t.approval.approvalId)||(o.approvalsBySession[s]=[...i,t.approval]);const l=t.approval.display;l?.kind==="plan_review"&&typeof l.plan=="string"&&l.plan.length>0&&(o.planReviewByToolCallId={...o.planReviewByToolCallId,[t.approval.toolCallId]:{plan:l.plan,path:typeof l.path=="string"?l.path:void 0}});break}case"approvalResolved":case"approvalExpired":{const s=t.sessionId,i=t.approvalId,r=o.approvalsBySession[s]??[];o.approvalsBySession[s]=r.filter(l=>l.approvalId!==i);break}case"questionRequested":{const s=t.sessionId,i=o.questionsBySession[s]??[];i.some(l=>l.questionId===t.question.questionId)||(o.questionsBySession[s]=[...i,t.question]);break}case"questionAnswered":case"questionDismissed":{const s=t.sessionId,i=t.questionId,r=o.questionsBySession[s]??[];o.questionsBySession[s]=r.filter(l=>l.questionId!==i);break}case"taskCreated":{const s=t.sessionId,i=o.tasksBySession[s]??[],r=i.findIndex(l=>l.id===t.task.id);if(r===-1)o.tasksBySession[s]=[...i,t.task];else{const l=[...i],a=i[r];l[r]={...t.task,outputLines:a.outputLines,text:a.text,description:t.task.description===Q3&&a.description!==Q3?a.description:t.task.description,swarmIndex:t.task.swarmIndex??a.swarmIndex,parentToolCallId:t.task.parentToolCallId??a.parentToolCallId,subagentType:t.task.subagentType??a.subagentType,runInBackground:t.task.runInBackground??a.runInBackground,backgroundTaskId:t.task.backgroundTaskId??a.backgroundTaskId},o.tasksBySession[s]=l}break}case"taskProgress":{const s=t.sessionId,i=o.tasksBySession[s]??[];o.tasksBySession[s]=i.map(r=>{if(r.id!==t.taskId)return r;if(r.kind==="subagent"&&t.kind==="text")return{...r,text:(r.text??"")+t.outputChunk};const l=r.outputLines??[];if(l.at(-1)===t.outputChunk)return r;const a=[...l,t.outputChunk];return{...r,outputLines:r.kind==="subagent"?a:a.slice(-40)}});break}case"taskCompleted":{const s=t.sessionId,i=o.tasksBySession[s]??[];o.tasksBySession[s]=i.map(r=>r.id!==t.taskId?r:{...r,status:t.status,outputPreview:t.outputPreview,outputBytes:t.outputBytes});break}case"goalUpdated":{const s=t.sessionId;o.goalVersionBySession[s]=(o.goalVersionBySession[s]??0)+1,t.goal===null||t.goal.status==="complete"?delete o.goalBySession[s]:o.goalBySession[s]=t.goal;break}case"configChanged":{o.config=t.config;break}case"modelCatalogChanged":break;case"agentDelta":case"agentTurnEnded":break;case"promptCompleted":case"promptAborted":break;case"turnActiveChanged":{o.sessions=o.sessions.map(s=>s.id===t.sessionId?{...s,mainTurnActive:t.active}:s),t.active?o.turnActiveBySession[t.sessionId]=!0:delete o.turnActiveBySession[t.sessionId];break}case"unknown":{const s=t.raw;if(!(s&&s._noop===!0))if(s&&s._agentError)o.warnings=[...o.warnings,Aye(s)];else if(s&&s._agentWarning){const i=s.message??s.code??"agent warning";o.warnings=[...o.warnings,`${Rn.global.t("warnings.noteLabel")}: ${i}`]}else{const i=s?.type??"(unknown)";o.warnings=[...o.warnings,`Unhandled event: ${i}`]}break}}return o}function Eye(e){return e==="in_progress"?"in_progress":e==="done"||e==="completed"?"done":"pending"}function Tye(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.role==="assistant")for(let o=n.content.length-1;o>=0;o--){const s=n.content[o];if(s.type!=="toolUse"||Ja(s.toolName)!=="todo")continue;let i=s.input;if(typeof i=="string")try{i=JSON.parse(i)}catch{continue}const r=i?.todos;if(Array.isArray(r))return r.flatMap(l=>{const a=l??{},c=typeof a.title=="string"?a.title:typeof a.content=="string"?a.content:"";return c?[{title:c,status:Eye(a.status)}]:[]})}}return[]}const Nye=["queued","working","suspended","completed","failed"];function ST(e){return e.status==="completed"?"completed":e.status==="failed"||e.status==="cancelled"?"failed":e.subagentPhase?e.subagentPhase:"working"}function Iye(){return{queued:0,working:0,suspended:0,completed:0,failed:0}}function Lye(e){const t=new Map;for(const n of e){if(n.kind!=="subagent"||n.swarmIndex===void 0)continue;const o=n.parentToolCallId??"swarm",s=t.get(o)??[];s.push({id:n.id,name:n.description,subagentType:n.subagentType,phase:ST(n),summary:n.outputPreview,outputLines:n.outputLines,text:n.text,suspendedReason:n.suspendedReason,swarmIndex:n.swarmIndex}),t.set(o,s)}return[...t.entries()].map(([n,o])=>{const s=o.toSorted((r,l)=>r.swarmIndex-l.swarmIndex||r.id.localeCompare(l.id)),i=Iye();for(const r of s)i[r.phase]++;return{id:n,members:s,counts:i}}).filter(n=>n.members.length>1).toSorted((n,o)=>{const s=n.members.at(0)?.swarmIndex??0,i=o.members.at(0)?.swarmIndex??0;return s!==i?s-i:n.id.localeCompare(o.id)})}function $ye(e){let t=0,n=0;for(const o of e){n+=o.members.length;for(const s of Nye)(s==="completed"||s==="failed")&&(t+=o.counts[s])}return{done:t,total:n}}function Fye(e){const t=new Map;for(const n of e){if(n.kind!=="subagent"||!n.parentToolCallId)continue;const o=t.get(n.parentToolCallId)??[];o.push({id:n.id,name:n.description,subagentType:n.subagentType,phase:ST(n),summary:n.outputPreview,outputLines:n.outputLines,text:n.text,suspendedReason:n.suspendedReason,swarmIndex:n.swarmIndex??Number.MAX_SAFE_INTEGER}),t.set(n.parentToolCallId,o)}for(const[n,o]of t)t.set(n,o.toSorted((s,i)=>s.swarmIndex-i.swarmIndex||s.id.localeCompare(i.id)));return t}const Fr=vT(),lr=Jge(),Tf=lve(),CT=Dt.permission,AT=Dt.activeWorkspace,MT=Dt.planMode,ET=Dt.swarmMode,TT=Dt.goalMode,eA=40401,NT=Dt.onboarded;qa(Dt.codeFont);qa(Dt.theme);qa(Dt.thinking);function Oye(){try{const e=yo(CT);if(e==="auto"||e==="yolo"||e==="manual")return e}catch{}return"manual"}function Bye(e){try{Eo(CT,e)}catch{}}function Wv(e){const t=yo(e);if(!t)return{};try{const n=JSON.parse(t);if(!n||typeof n!="object"||Array.isArray(n))return{};const o={};for(const[s,i]of Object.entries(n))i===!0&&(o[s]=!0);return o}catch{return{}}}function Tb(e,t){try{const n={};for(const[o,s]of Object.entries(t))s&&(n[o]=!0);Eo(e,JSON.stringify(n))}catch{}}function IT(){Tb(MT,_e.planModeBySession)}function LT(){Tb(ET,_e.swarmModeBySession)}function $T(){Tb(TT,_e.goalModeBySession)}function Rye(){try{return yo(AT)}catch{return null}}const FT=Dt.hiddenWorkspaces;function Dye(){try{const e=yo(FT);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function Pye(e){try{Eo(FT,JSON.stringify(e))}catch{}}function Hye(e){try{Eo(AT,e)}catch{}}function Wye(e,t){if(t&&e.startsWith(t)){const o=e.slice(t.length);return o?`~${o}`:"~"}const n=e.match(/^\/(?:Users|home)\/[^/]+(\/.*)?$/);return n?`~${n[1]??""}`:e}const _e=zo({...gye(),connected:!1,serverVersion:"",dangerousBypassAuth:!1,backend:"v1",workspaceName:"kimi-web",connection:"disconnected",permission:Oye(),thinking:void 0,thinkingBySession:{},planModeBySession:Wv(MT),swarmModeBySession:Wv(ET),goalModeBySession:Wv(TT),loading:!1,sessionLoading:!1,queuedBySession:{},gitStatusBySession:{},promptIdBySession:{},inFlightBySession:{},unreadBySession:n2(),authReady:!1,defaultModel:null,managedProviderStatus:null,workspaces:[],activeWorkspaceId:Rye(),fsHome:null,recentRoots:[],hiddenWorkspaceRoots:Dye(),availableOpenInApps:[],config:null,sideChatMessagesByAgent:{},sideChatSendingByAgent:{},sideChatUserMessageIdsBySession:{},messagesLoadingMoreBySession:{},messagesHasMoreBySession:{},messagesLoadMoreErrorBySession:{},sessionsHasMoreByWorkspace:{},sessionsLoadingMoreByWorkspace:{},sessionsCursorByWorkspace:{},sessionsInitialCountByWorkspace:{},sessionsFullyLoaded:!1}),l0=zo({planMode:!1,swarmMode:!1,goalMode:!1});function OT(e){_e.sessions=e}function a0(e,t){_e.sessions=_e.sessions.map(n=>n.id===e?t(n):n)}function zye(e){_e.sessions=[e,..._e.sessions.filter(t=>t.id!==e.id)]}function Uye(e){_e.sessions=[..._e.sessions,e]}function qye(e){_e.sessions=_e.sessions.filter(t=>t.id!==e)}function BT(){const e=_e.activeSessionId;e&&_e.unreadBySession[e]&&typeof document<"u"&&document.visibilityState==="visible"&&(_e.unreadBySession={..._e.unreadBySession,[e]:!1},o2({[e]:!1}))}typeof window<"u"&&window.addEventListener("storage",e=>{e.key===Dt.unread&&(_e.unreadBySession=n2(),BT())});function xk(){if(Mi===null||!Mi.health().stale)return;_o("ws:stale-reconnect",{sessionId:_e.activeSessionId,status:"stale"}),Rr("ws: stale socket on focus, reconnecting",{activeSessionId:_e.activeSessionId}),Mi.reconnect();const e=_e.activeSessionId;e&&s1.request(e)}typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&(BT(),xk())});typeof window<"u"&&(window.addEventListener("focus",xk),window.addEventListener("online",xk));function Nb(e){_e.activeSessionId=e}function jye(e){_e.messagesBySession=e}function Vye(e,t){_e.messagesBySession={..._e.messagesBySession,[e]:t}}function RT(e,t){_e.messagesBySession={..._e.messagesBySession,[e]:t(_e.messagesBySession[e]??[])}}function Kye(e){const{[e]:t,...n}=_e.messagesBySession;_e.messagesBySession=n}function DT(e){Mi?.unsubscribe(e),vke(e),n1.discard(({meta:t})=>t.sessionId===e),qye(e),Kye(e),delete _e.approvalsBySession[e],delete _e.questionsBySession[e],delete _e.tasksBySession[e],delete _e.goalBySession[e],delete _e.gitStatusBySession[e],delete _e.lastSeqBySession[e],delete _e.compactionBySession[e],delete _e.messagesLoadingMoreBySession[e],delete _e.messagesHasMoreBySession[e],delete _e.messagesLoadMoreErrorBySession[e],delete wk[e],o1.delete(e),Vp.delete(e),ZT.delete(e),Cve(e),delete _e.queuedBySession[e],delete _e.promptIdBySession[e],delete _e.inFlightBySession[e],delete _e.turnActiveBySession[e],delete _e.planModeBySession[e],delete _e.swarmModeBySession[e],delete _e.goalModeBySession[e],delete _e.thinkingBySession[e],IT(),LT(),$T()}const PT=oe(null),HT=oe([]),WT=oe(!1),zT=oe(!1),UT=oe(null);async function Zf(e){let t;try{t=await ht().getSessionStatus(e)}catch{return}a0(e,n=>({...n,model:t.model||n.model,usage:{...n.usage,contextTokens:t.contextTokens,contextLimit:t.maxContextTokens}})),_e.swarmModeBySession={..._e.swarmModeBySession,[e]:t.swarmMode},_e.planModeBySession={..._e.planModeBySession,[e]:t.planMode},t.thinkingEffort.length>0&&(_e.thinkingBySession={..._e.thinkingBySession,[e]:t.thinkingEffort})}async function Gye(e){const t=_e.goalVersionBySession[e]??0;let n;try{n=await ht().getSessionGoal(e)}catch{return}if((_e.goalVersionBySession[e]??0)!==t)return;const o={..._e.goalBySession};n===null||n.status==="complete"?delete o[e]:o[e]=n,_e.goalBySession=o}function qT(e,t){const n=t??_e.activeSessionId;return n?Promise.resolve(ht().updateSession(n,e)).then(()=>Zf(n)).then(()=>!0).catch(o=>(Xf("persistSessionProfile",o,{sessionId:n}),!1)):Promise.resolve(!1)}const jT=Dt.conversationToc;function Yye(){try{const e=yo(jT);return e===null?!0:e==="true"}catch{return!0}}function Zye(e){try{Eo(jT,e?"true":"false")}catch{}}const VT=oe(Yye());function Xye(e){VT.value=e,Zye(e)}function Qye(e){try{return yo(e)??""}catch{return""}}const KT=oe(Qye(NT)==="1");function Jye(e){KT.value=e;try{Eo(NT,e?"1":"0")}catch{}}let Mi=null,tA=0;function GT(){return tA+=1,`msg_opt_${Date.now().toString(36)}_${tA}`}function eke(e,t,n){const o={sessions:_e.sessions,activeSessionId:_e.activeSessionId,messagesBySession:_e.messagesBySession,approvalsBySession:_e.approvalsBySession,planReviewByToolCallId:_e.planReviewByToolCallId,questionsBySession:_e.questionsBySession,tasksBySession:_e.tasksBySession,goalBySession:_e.goalBySession,goalVersionBySession:_e.goalVersionBySession,lastSeqBySession:_e.lastSeqBySession,turnActiveBySession:_e.turnActiveBySession,compactionBySession:_e.compactionBySession,config:_e.config,warnings:_e.warnings},s=Mye(o,e,{sessionId:t,seq:n});OT(s.sessions),Nb(s.activeSessionId),jye(s.messagesBySession),_e.approvalsBySession=s.approvalsBySession,_e.planReviewByToolCallId=s.planReviewByToolCallId,_e.questionsBySession=s.questionsBySession,_e.tasksBySession=s.tasksBySession,_e.goalBySession=s.goalBySession,_e.goalVersionBySession=s.goalVersionBySession,_e.lastSeqBySession=s.lastSeqBySession,_e.turnActiveBySession=s.turnActiveBySession,_e.compactionBySession=s.compactionBySession,_e.config=s.config??null,_e.warnings=s.warnings,e.type==="configChanged"&&(_e.defaultModel=e.config.defaultModel??null),e.type==="modelCatalogChanged"&&(Un.loadModels(),Un.loadProviders()),e.type==="sessionUsageUpdated"&&(e.swarmMode!==void 0&&(_e.swarmModeBySession={..._e.swarmModeBySession,[e.sessionId]:e.swarmMode}),e.planMode!==void 0&&(_e.planModeBySession={..._e.planModeBySession,[e.sessionId]:e.planMode}),e.thinking!==void 0&&(_e.thinkingBySession={..._e.thinkingBySession,[e.sessionId]:e.thinking}))}function tke(e,t){const n=_e.lastSeqBySession[t.sessionId]??0,o=_e.turnActiveBySession[t.sessionId]??!1;eke(e,t.sessionId,t.seq);const s=ps.sideChatTargetBySession.value[t.sessionId];if(s){const{agentId:i}=s,r=t.sessionId;e.type==="agentDelta"&&e.agentId===i?e.delta.text&&ps.appendSideChatAssistantText(i,r,e.delta.text):e.type==="agentTurnEnded"&&e.agentId===i?ps.finishSideChatAgent(i,r):e.type==="taskProgress"&&e.taskId===i?ps.appendSideChatAssistantText(i,r,e.outputChunk):e.type==="taskCompleted"&&e.taskId===i&&ps.finishSideChatAgent(i,r,e.outputPreview)}if(e.type==="messageCreated"&&e.message.role==="user"&&e.message.promptId!==void 0){const i=e.message.sessionId;_e.promptIdBySession[i]!==e.message.promptId&&(_e.promptIdBySession={..._e.promptIdBySession,[i]:e.message.promptId})}if(e.type==="assistantDelta"&&t.sessionId===_e.activeSessionId&&Fr.recordMoonDelta((e.delta.text?.length??0)+(e.delta.thinking?.length??0)),e.type==="turnActiveChanged"&&!e.active&&t.seq>n){const i=e.reason;_2e(e.sessionId,i==="cancelled"||i==="failed"||i==="blocked"?"aborted":"idle",o)}e.type==="sessionWorkChanged"&&(e.mainTurnActive===!1&&o||e.mainTurnActive===void 0&&!e.busy)&&t.seq>n&&w2e(e.sessionId),(e.type==="promptAborted"||e.type==="promptCompleted"&&e.reason==="blocked")&&t.seq>n&&_e.promptIdBySession[e.sessionId]===e.promptId&&ft.finishPromptLocal(e.sessionId),e.type==="questionRequested"&&S2e(e.sessionId,e.question),e.type==="approvalRequested"&&C2e(e.sessionId,e.approval)}const n1=xge(({appEvent:e,meta:t})=>tke(e,t),({appEvent:e})=>vge(e),{coalesce:_ge});function YT(){if(Mi!==null||typeof WebSocket>"u")return;_o("ws:connection",{status:"connecting"}),_e.connection="connecting",Mi=ht().connectEvents({onEvent(t,n){if(t.type==="workspaceCreated"||t.type==="workspaceUpdated"||t.type==="workspaceDeleted"){ft.applyWorkspaceEvent(t);return}for(const o of wge({appEvent:t,meta:n}))n1(o)},onResync(t,n,o){_o("ws:resync",{sessionId:t,status:"required",seq:n}),n1.flush(),o1.add(t),s1.request(t)},onError(t,n,o){_o("ws:error",{status:"failed",errorCode:t,fatal:o}),Ib({severity:"error",title:Rn.global.t("warnings.wsTitle"),message:n,details:[lo("message",n)].filter(s=>s!==void 0)})},onConnectionChange(t){_o("ws:connection",{status:t?"connected":"disconnected"}),_e.connected=t,_e.connection=t?"connected":"disconnected",t&&(cke(),ft.refreshServerMeta())}})}const wk={},o1=new Set,Vp=new Set,ZT=new Set;function nke(e){return wi(e)&&e.code===eA?!0:typeof e=="object"&&e!==null&&e.code===eA}function lo(e,t){if(!(t==null||t===""))return{label:Rn.global.t(`warnings.details.${e}`),value:XT(t)}}function XT(e){if(e instanceof Error)return typeof e.stack=="string"&&e.stack?e.stack:e.message?`${e.name}: ${e.message}`:e.name;if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function oke(e){return e instanceof Error||typeof e=="object"&&e!==null&&typeof e.name=="string"?e.name:void 0}function ske(e){return e instanceof Error||typeof e=="object"&&e!==null&&typeof e.message=="string"?e.message:void 0}function ike(e){return e instanceof Error&&typeof e.stack=="string"&&e.stack?e.stack:void 0}function rke(e){if(!(typeof e!="number"||!Number.isFinite(e)))return new Date(e).toISOString()}function nA(e){if(!(typeof e!="number"||!Number.isFinite(e)))return`${Math.round(e)}ms`}function lke(e,t,n){const o=ob(t),s=wi(t),i=o||s?t.timestamp:void 0,r=o||s?t.durationMs:void 0,l=[lo("operation",e),lo("sessionId",n??_e.activeSessionId),lo("connection",_e.connection),lo("timestamp",rke(i??Date.now()))];return o?l.push(lo("duration",nA(r)),lo("request",`${t.method} ${t.path}`),lo("endpoint",t.url),lo("requestId",t.requestId),lo("phase",t.phase),lo("timeout",`${t.timeoutMs}ms`),lo("status",t.status===void 0?void 0:`${t.status} ${t.statusText??""}`.trim()),lo("contentType",t.contentType),lo("responsePreview",t.bodyPreview),lo("cause",t.cause)):s?l.push(lo("duration",nA(r)),lo("code",t.code),lo("requestId",t.requestId),lo("message",t.message),lo("details",t.details)):l.push(lo("errorName",oke(t)),lo("message",ske(t)??XT(t)),lo("stack",ike(t))),l.filter(a=>a!==void 0)}function ake(e,t,n={}){const o=ob(t),s=wi(t),i=n.title??(o?Rn.global.t("warnings.daemonNetworkTitle"):s?Rn.global.t("warnings.daemonApiTitle"):Rn.global.t("warnings.operationFailedTitle")),r=n.message??(o?Rn.global.t("warnings.daemonNetworkMessage"):s?t.message:Rn.global.t("warnings.operationFailedMessage"));return{severity:"error",title:i,message:r,details:lke(e,t,n.sessionId)}}function Ib(e){_e.warnings=[..._e.warnings,e]}function cke(){const e=Rn.global.t("warnings.wsTitle"),t=_e.warnings.filter(n=>!(typeof n=="object"&&n!==null&&n.severity==="error"&&n.title===e));t.length!==_e.warnings.length&&(_e.warnings=t)}function Xf(e,t,n){console.error(`[kimi-web] operation failed: ${e}`,t);const o=wi(t),s=ob(t);_o("operation:failed",{sessionId:n?.sessionId,status:"failed",operation:e,errorName:t instanceof Error?t.name:typeof t,errorCode:o?t.code:void 0,requestId:o||s?t.requestId:void 0,phase:s?t.phase:void 0,httpStatus:s?t.status:void 0}),Ib(ake(e,t,n))}const uke={40913:"warnings.goal.alreadyExists",40914:"warnings.goal.notFound",40915:"warnings.goal.statusInvalid",40916:"warnings.goal.notResumable",40918:"warnings.goal.objectiveTooLong"};function dke(e){if(!wi(e))return;const t=uke[e.code];return t?Rn.global.t(t):void 0}async function fke(e){if(DT(e),_e.activeSessionId!==e)return;const t=_e.sessions[0];t?await ft.selectSession(t.id,{urlMode:"replace"}):(Nb(void 0),_e.sessionLoading=!1,ft.writeSessionUrl(void 0,"replace"))}const oA=new Set;async function hke(e){if(!oA.has(e)){oA.add(e);try{const t=await ht().getSessionWarnings(e),n=Rn.global.t("warnings.noteLabel");for(const o of t)Ib(`${n}: ${o.message}`)}catch{}}}async function Lb(e){const t=ft.localTurnStartState(e);try{const o=await ht().getSessionSnapshot(e);if(!_e.sessions.some(a=>a.id===e))return"ok";n1.flush();const s=_e.lastSeqBySession[e]??0,i=wk[e];if(!(o1.has(e)||i1.has(e))&&i!==void 0&&i===o.epoch&&s>o.asOfSeq)return Vp.delete(e)||(Vp.add(e),s1.request(e)),"ok";if(!ft.isLocalTurnSnapshotCurrent(e,t))return ft.afterLocalTurnStartsSettle(e,()=>{s1.request(e)}),"ok";const l=ik(o.session.usage);a0(e,a=>({...o.session,model:o.session.model&&o.session.model.length>0?o.session.model:a.model,usage:l?a.usage:o.session.usage})),Vye(e,hge(_e.messagesBySession[e]??[],o.messages)),_e.tasksBySession={..._e.tasksBySession,[e]:pge(o.subagents,_e.tasksBySession[e]??[])},_e.messagesHasMoreBySession={..._e.messagesHasMoreBySession,[e]:o.hasMoreMessages},_e.approvalsBySession={..._e.approvalsBySession,[e]:o.pendingApprovals};for(const a of o.pendingApprovals){const c=a.display;c?.kind==="plan_review"&&typeof c.plan=="string"&&c.plan.length>0&&(_e.planReviewByToolCallId={..._e.planReviewByToolCallId,[a.toolCallId]:{plan:c.plan,path:typeof c.path=="string"?c.path:void 0}})}_e.questionsBySession={..._e.questionsBySession,[e]:o.pendingQuestions},_e.lastSeqBySession={..._e.lastSeqBySession,[e]:o.asOfSeq},wk[e]=o.epoch,o1.delete(e),Vp.delete(e),ft.handleSessionSnapshot(e,{inFlightTurn:o.inFlightTurn,busy:o.session.busy});{const a={..._e.turnActiveBySession};o.session.mainTurnActive??(o.inFlightTurn!==null&&o.session.busy)?a[e]=!0:delete a[e],_e.turnActiveBySession=a}return YT(),Mi&&(Mi.seedSnapshot(e,o),Mi.subscribe(e,{seq:o.asOfSeq,epoch:o.epoch}),gke(e)),i1.delete(e),l&&Zf(e),hke(e),"ok"}catch(n){return nke(n)?(await fke(e),"not-found"):(Xf("getSessionSnapshot",n,{title:Rn.global.t("warnings.sessionSnapshotTitle"),message:Rn.global.t("warnings.sessionSnapshotMessage"),sessionId:e}),"failed")}}const s1=mge(Lb);function pke(e){return Object.prototype.hasOwnProperty.call(_e.messagesBySession,e)}const mke=4,Or=[],i1=new Set;function gke(e){const t=Or.indexOf(e);for(t!==-1&&Or.splice(t,1),Or.unshift(e);Or.length>mke;){let n=-1;for(let s=Or.length-1;s>=0;s--)if(Or[s]!==_e.activeSessionId){n=s;break}if(n===-1)break;const[o]=Or.splice(n,1);if(o===void 0)break;Mi?.unsubscribe(o),i1.add(o)}}function vke(e){const t=Or.indexOf(e);t!==-1&&Or.splice(t,1),i1.delete(e)}async function yke(e){return Lb(e)}function $b(e,t){return(_e.inFlightBySession[e]??!1)||(_e.turnActiveBySession[e]??!1)||(t??_e.sessions.find(n=>n.id===e)?.mainTurnActive??!1)}function Fb(e){try{const t=new Date(e),o=Date.now()-t.getTime(),s=o/36e5;if(o<6e4)return Rn.global.t("sessions.justNow");if(s<1)return`${Math.round(o/6e4)}m`;if(s<24)return`${Math.round(s)}h`;const i=o/864e5;return i<7?`${Math.round(i)}d`:i<30?`${Math.round(i/7)}w`:i<365?`${Math.round(i/30)}mo`:`${Math.round(i/365)}y`}catch{return e}}const kke=3e4,Nf=oe(0);let zv=null;function bke(){zv===null&&(zv=setInterval(()=>{Nf.value=(Nf.value+1)%Number.MAX_SAFE_INTEGER},kke),zv.unref?.())}function xke(e,t){const n=e.split(`
340
340
  `),o=t.split(`
341
- `),s=[];return n.forEach((i,r)=>{s.push({kind:"rem",gutter:String(r+1),text:`- ${i}`})}),o.forEach((i,r)=>{s.push({kind:"add",gutter:String(r+1),text:`+ ${i}`})}),s}function wke(e){const t=e.display??{},n=typeof t.kind=="string"?t.kind:"";if(n==="diff"){const o=typeof t.path=="string"?t.path:"";return Array.isArray(t.diff)?{kind:"diff",path:o,diff:t.diff}:typeof t.old_text=="string"&&typeof t.new_text=="string"?{kind:"diff",path:o,diff:xke(t.old_text,t.new_text)}:{kind:"diff",path:o,diff:[]}}if(n==="shell"||n==="command"){const o=typeof t.command=="string"?t.command:e.action,s=typeof t.cwd=="string"?t.cwd:void 0,i=typeof t.danger=="string"?t.danger:void 0;return{kind:"shell",command:o,cwd:s,danger:i}}if(n==="file_content"||n==="file"){const o=typeof t.path=="string"?t.path:"",s=typeof t.content=="string"?t.content:"",i=typeof t.language=="string"?t.language:void 0;return{kind:"file",path:o,content:s,language:i}}if(n==="file_op"||n==="fileop"){const o=typeof t.operation=="string"?t.operation:typeof t.op=="string"?t.op:n,s=typeof t.path=="string"?t.path:"",i=typeof t.detail=="string"?t.detail:void 0;return{kind:"fileop",op:o,path:s,detail:i}}if(n==="url_fetch"||n==="url"){const o=typeof t.url=="string"?t.url:e.action;return{kind:"url",method:typeof t.method=="string"?t.method:void 0,url:o}}if(n==="search"){const o=typeof t.query=="string"?t.query:e.action,s=typeof t.scope=="string"?t.scope:void 0;return{kind:"search",query:o,scope:s}}if(n==="invocation"||n==="agent_call"||n==="skill_call"){const o=typeof t.kind=="string"?t.kind:n,s=typeof t.name=="string"?t.name:e.toolName,i=typeof t.description=="string"?t.description:void 0;return{kind:"invocation",kind2:o,name:s,description:i}}if(n==="todo"||n==="todo_list")return{kind:"todo",items:(Array.isArray(t.items)?t.items:[]).map(i=>{const r=i??{};return{title:typeof r.title=="string"?r.title:"",status:typeof r.status=="string"?r.status:"pending"}})};if(n==="plan_review"){const o=typeof t.plan=="string"?t.plan:"",s=typeof t.path=="string"?t.path:void 0,r=(Array.isArray(t.options)?t.options:[]).map(l=>{const a=l??{},c=typeof a.label=="string"?a.label:"";if(!c)return null;const u=typeof a.description=="string"?a.description:void 0;return{label:c,description:u}}).filter(l=>l!==null);return{kind:"plan_review",plan:o,path:s,options:r.length>0?r:void 0}}return{kind:"generic",summary:e.action}}function _ke(e){return{questionId:e.questionId,sessionId:e.sessionId,questions:e.questions.map(t=>({id:t.id,question:t.question,header:t.header,body:t.body,options:t.options.map(n=>({id:n.id,label:n.label,description:n.description,recommended:n.recommended})),multiSelect:t.multiSelect,allowOther:t.allowOther,otherLabel:t.otherLabel}))}}function Ske(e){const t=_e.messagesBySession[e.sessionId];if(!t||t.length===0)return;const n=new Map;for(const s of t)if(s.role==="assistant")for(const i of s.content){if(i.type!=="toolUse"||i.toolName!=="Bash"&&i.toolName!=="bash")continue;const r=i.input,l=r&&typeof r.command=="string"?r.command:void 0;l&&n.set(i.toolCallId,l)}if(n.size===0)return;const o=`task_id: ${e.id}`;for(const s of t)if(s.role==="tool")for(const i of s.content){if(i.type!=="toolResult")continue;if((typeof i.output=="string"?i.output:i.output!==void 0?JSON.stringify(i.output):"").includes(o)){const l=n.get(i.toolCallId);if(l)return l}}}function Cke(e){let t;e.status==="running"?t="run":e.status==="completed"?t="done":t="fail";let n="";if(e.status==="running"&&e.startedAt){const r=Math.round((Date.now()-new Date(e.startedAt).getTime())/1e3),l=Math.floor(r/60),a=r%60;n=Rn.global.t("tasks.timingRunning",{time:`${l}:${String(a).padStart(2,"0")}`})}else if(e.completedAt&&e.startedAt){const r=Math.round((new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime())/1e3);n=Rn.global.t("tasks.timingDone",{sec:r})}else n=e.status;const o=e.outputLines&&e.outputLines.length>0?e.outputLines:e.outputPreview?e.outputPreview.split(/\r?\n/):void 0,s=e.command??Ske(e),i=e.kind==="bash"&&s?`$ ${s}`:void 0;return{id:e.id,name:e.description,kind:e.kind,state:t,timing:n,meta:i,output:o,runInBackground:e.runInBackground,parentToolCallId:e.parentToolCallId}}const Ake=D(()=>{const e=_e.sessions.find(n=>n.id===_e.activeSessionId),t=e?e.cwd.split("/").pop()??e.cwd:"main";return{name:_e.workspaceName,branch:t}}),Mke=D(()=>(Nf.value,_e.sessions.toSorted((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).map(e=>({id:e.id,title:e.title,time:Fb(e.updatedAt),busy:$b(e.id,e.mainTurnActive),pendingInteraction:e.pendingInteraction,lastTurnReason:e.lastTurnReason})))),Eke=D(()=>_e.activeSessionId??""),Tke=D(()=>{const e=_e.activeSessionId;if(e)return Un.skillsBySession.value[e]??[];const t=u0.value;return t?Un.skillsByWorkspace.value[t]??[]:[]}),Ob=D(()=>{const e=_e.activeSessionId;return e?_e.inFlightBySession[e]??!1:!1}),Nke=D(()=>ft.isStartingFirstPrompt()),ps=pye(_e,{pushOperationFailure:Xf,nextOptimisticMsgId:GT,connectEventsIfNeeded:YT,getEventConn:()=>Mi,resolveThinkingForPrompt:(e,t)=>Un.resolveThinkingForPrompt(e,t)}),Qf=D(()=>{const e=_e.activeSessionId;if(!e)return[];const t=ps.sideChatTargetBySession.value[e]?.agentId;return(_e.tasksBySession[e]??[]).filter(n=>n.id!==t)}),QT=uve(_e,Qf),Ike=D(()=>{const e=_e.activeSessionId;if(!e)return[];const t=new Set(_e.sideChatUserMessageIdsBySession[e]??[]),n=(_e.messagesBySession[e]??[]).filter(s=>!t.has(s.id)),o=_e.approvalsBySession[e]??[];return _T(n,o,s=>ht().getFileUrl(s),c0.value,_e.planReviewByToolCallId)}),c0=D(()=>{const e=_e.activeSessionId;return e?(_e.turnActiveBySession[e]??!1)||(_e.sessions.find(t=>t.id===e)?.mainTurnActive??!1):!1}),Lke=D(()=>Ob.value||c0.value),$ke=D(()=>(QT.taskClock.value,Qf.value.map(Cke))),JT=D(()=>Lye(Qf.value)),Fke=D(()=>Fye(Qf.value)),Wc=D(()=>{const e=_e.activeSessionId;return e?_e.goalBySession[e]??null:null}),Oke=D(()=>{const e=_e.activeSessionId;return e?Tye(_e.messagesBySession[e]??[]):[]}),Bke=D(()=>{const e=_e.activeSessionId;return e?_e.compactionBySession[e]??null:null}),Rke=D(()=>_e.connection),Dke=D(()=>_e.loading),Pke=D(()=>_e.sessionLoading),Hke=D(()=>{const e=_e.activeSessionId;return e?_e.messagesLoadingMoreBySession[e]??!1:!1}),Wke=D(()=>{const e=_e.activeSessionId;return e?_e.messagesHasMoreBySession[e]??!1:!1}),zke=D(()=>{const e=_e.activeSessionId;return e?_e.messagesLoadMoreErrorBySession[e]??!1:!1}),Uke=D(()=>_e.serverVersion),qke=D(()=>_e.backend),jke=D(()=>_e.dangerousBypassAuth);function Vke(){_e.dangerousBypassAuth=!1}const Kke=D(()=>_e.permission),Gke=D(()=>_e.thinking),eN=D(()=>{const e=_e.activeSessionId;return e?_e.planModeBySession[e]??!1:l0.planMode}),Yke=D(()=>{const e=_e.activeSessionId;return e?_e.swarmModeBySession[e]??!1:l0.swarmMode}),Zke=D(()=>{const e=_e.activeSessionId;return e?_e.goalModeBySession[e]??!1:l0.goalMode}),Xke=D(()=>{const e=$ye(JT.value);return{plan:eN.value,goal:Wc.value&&Wc.value.status!=="complete"?{status:Wc.value.status,turnsUsed:Wc.value.turnsUsed,elapsedMs:Wc.value.wallClockMs}:null,swarm:e.total>0?e:null}}),Qke=D(()=>{const e=_e.activeSessionId;if(!e)return[];const t=ht();return(_e.queuedBySession[e]??[]).map(n=>({text:n.text,attachmentCount:n.attachments?.length??0,attachments:n.attachments?.map(o=>({fileId:o.fileId,kind:o.kind,url:t.getFileUrl(o.fileId),name:o.name}))}))}),Jke=D(()=>_e.warnings),e2e=D(()=>{const e=_e.activeSessionId;return e?(_e.questionsBySession[e]??[]).map(_ke):[]}),t2e=D(()=>{const e=_e.activeSessionId;return e?(_e.approvalsBySession[e]??[]).map(t=>({approvalId:t.approvalId,block:wke(t),agentName:t.agentName})):[]}),Bb=D(()=>{const e=_e.activeSessionId;return e?(_e.approvalsBySession[e]??[]).length>0?"awaiting-approval":(_e.questionsBySession[e]??[]).length>0?"awaiting-question":Ob.value||c0.value?"running":"idle":"idle"}),Un=Ive(_e,{pushOperationFailure:Xf,refreshSessionStatus:Zf,persistSessionProfile:qT,activity:Bb,updateSession:a0,updateSessionMessages:RT}),_k=D(()=>{const e=_e.activeSessionId;if(!e)return null;const t=_e.gitStatusBySession[e];return t?{branch:t.branch,ahead:t.ahead,behind:t.behind}:null}),n2e=D(()=>{const e=_e.activeSessionId;return e?_e.gitStatusBySession[e]?.pullRequest??null:null}),o2e=D(()=>{const e=_e.activeSessionId;if(!e)return[];const t=_e.gitStatusBySession[e];return t?Object.entries(t.entries).map(([n,o])=>({path:n,status:o})).sort((n,o)=>n.path.localeCompare(o.path)):[]}),s2e=D(()=>{const e=_e.activeSessionId;if(!e)return null;const t=_e.gitStatusBySession[e];return t?{totalAdditions:t.additions,totalDeletions:t.deletions}:null}),tN=D(()=>{const e=_e.sessions.find(r=>r.id===_e.activeSessionId),t=_k.value?.branch??(e?e.cwd.split("/").pop()??e.cwd:"main"),n=e===void 0?Un.draftModel.value:null,o=(e?.model&&e.model.length>0?e.model:n??_e.defaultModel)??"—",s=Un.models.value.find(r=>r.id===o)??Un.models.value.find(r=>r.model===o);return{model:s?.displayName||s?.model||(o.includes("/")?o.split("/").pop():o),modelId:s?.id??o,ctxUsed:e?.usage.contextTokens??0,ctxMax:e?.usage.contextLimit??0,permission:_e.permission,branch:t,cwd:e?.cwd??"",isGitRepo:_k.value!==null}}),i2e=D(()=>HT.value),r2e=D(()=>_e.sessions.find(t=>t.id===_e.activeSessionId)?.usage.totalCostUsd??0),l2e=D(()=>_e.authReady),a2e=D(()=>_e.defaultModel),c2e=D(()=>_e.managedProviderStatus),u2e=D(()=>_e.config),d2e=D(()=>{const e=_e.activeSessionId;if(!e)return{};const t=_e.gitStatusBySession[e];return t?{...t.entries}:{}});function wu(e){const t=zi(e.cwd);return _e.workspaces.find(n=>zi(n.root)===t)?.id??e.workspaceId??e.cwd}const Rb=D(()=>fge({workspaces:_e.workspaces,sessions:_e.sessions,hiddenWorkspaceRoots:_e.hiddenWorkspaceRoots,sessionsHasMoreByWorkspace:_e.sessionsHasMoreByWorkspace})),r1=oe(mF()),_u=oe(gF()==="manual"?"manual":"recent");et(()=>[Rb.value.map(e=>e.id).join("\0"),_e.loading],([e,t])=>{if(t)return;const n=e?e.split("\0"):[],o=IF(n,r1.value);o!==null&&(r1.value=o,g6(o))});const Xa=D(()=>{const e=Rb.value.map(t=>({id:t.id,name:t.name,root:t.root,shortPath:Wye(t.root,_e.fsHome),sessionCount:t.sessionCount}));if(_u.value==="recent"){const t=new Map;for(const n of _e.sessions){if(n.parentSessionId)continue;const o=wu(n),s=new Date(n.updatedAt).getTime();s>(t.get(o)??Number.NEGATIVE_INFINITY)&&t.set(o,s)}return FF(e,t)}return LF(e,r1.value)}),u0=D(()=>{const e=_e.activeWorkspaceId,t=Xa.value;return e&&t.some(n=>n.id===e)?e:t[0]?.id??null});et(u0,e=>{e&&(Object.prototype.hasOwnProperty.call(Un.skillsByWorkspace.value,e)||Un.loadSkillsForWorkspace(e))},{immediate:!0});const f2e=D(()=>{const e=u0.value;return e?Xa.value.find(t=>t.id===e)??null:null}),h2e=D(()=>{Nf.value;const e=new Set(Xa.value.map(n=>n.id)),t=new Map(Xa.value.map(n=>[n.id,n.name]));return _e.sessions.filter(n=>!n.parentSessionId&&e.has(wu(n))).map(n=>{const o=wu(n);return{id:n.id,title:n.title,time:Fb(n.updatedAt),busy:$b(n.id,n.mainTurnActive),pendingInteraction:n.pendingInteraction,lastTurnReason:n.lastTurnReason,lastPrompt:n.lastPrompt,workspaceId:o,workspaceName:t.get(o)}})}),p2e=D(()=>{Nf.value;const e=new Map;for(const t of _e.sessions.toSorted((n,o)=>new Date(o.updatedAt).getTime()-new Date(n.updatedAt).getTime())){if(t.parentSessionId)continue;const n=wu(t),o={id:t.id,title:t.title,time:Fb(t.updatedAt),busy:$b(t.id,t.mainTurnActive),pendingInteraction:t.pendingInteraction,lastTurnReason:t.lastTurnReason,updatedAt:t.updatedAt},s=e.get(n)??[];s.push(o),e.set(n,s)}return Xa.value.map(t=>({workspace:t,sessions:e.get(t.id)??[],hasMore:_e.sessionsHasMoreByWorkspace[t.id]??!1,loadingMore:_e.sessionsLoadingMoreByWorkspace[t.id]??!1,initialCount:_e.sessionsInitialCountByWorkspace[t.id]??yk}))});function m2e(e){r1.value=e,g6(e),_u.value!=="manual"&&(_u.value="manual",v6("manual"))}function g2e(e){_u.value!==e&&(_u.value=e,v6(e))}const nN=D(()=>{const e={};for(const[t,n]of Object.entries(_e.approvalsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);for(const[t,n]of Object.entries(_e.questionsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);return e}),v2e=D(()=>{const e={};for(const[t,n]of Object.entries(_e.approvalsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).approvals=n.length);for(const[t,n]of Object.entries(_e.questionsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).questions=n.length);return e}),y2e=D(()=>{const e={};for(const[t,n]of Object.entries(_e.unreadBySession))n&&(e[t]=!0);return e}),k2e=D(()=>{const e={},t=nN.value;for(const n of _e.sessions){const o=t[n.id]??0;if(o<=0)continue;const s=wu(n);e[s]=(e[s]??0)+o}return e}),b2e=D(()=>_e.recentRoots),x2e=D(()=>_e.availableOpenInApps),ft=Eve(_e,{taskPoller:QT,sideChat:ps,modelProvider:Un,pushOperationFailure:Xf,activity:Bb,sessionsKnownEmpty:ZT,setSessions:OT,updateSession:a0,upsertSessionFront:zye,appendSession:Uye,forgetSession:DT,setActiveSessionId:Nb,updateSessionMessages:RT,nextOptimisticMsgId:GT,getEventConn:()=>Mi,syncSessionFromSnapshot:Lb,reopenSession:yke,hasLoadedMessages:pke,refreshSessionStatus:Zf,refreshSessionGoal:Gye,persistSessionProfile:qT,mergedWorkspaces:Rb,workspacesView:Xa,status:tN,workspaceIdForSession:wu,savePermissionToStorage:Bye,savePlanModeToStorage:IT,saveSwarmModeToStorage:LT,saveGoalModeToStorage:$T,draftModes:l0,saveUnread:o2,saveActiveWorkspaceToStorage:Hye,saveHiddenWorkspacesToStorage:Pye,goalErrorMessage:dke,resetFastMoon:Fr.resetFastMoon,initialized:zT,connectIssue:UT,selectedDiffPath:PT,fileDiffLines:HT,fileDiffLoading:WT});function Db(e){return e===_e.activeSessionId&&typeof document<"u"&&document.visibilityState==="visible"&&document.hasFocus()}function w2e(e){if(_e.turnActiveBySession[e]){const t={..._e.turnActiveBySession};delete t[e],_e.turnActiveBySession=t}_e.inFlightBySession[e]&&(_e.inFlightBySession={..._e.inFlightBySession,[e]:!1})}function _2e(e,t,n){const o=_e.promptIdBySession[e];ft.finishPromptLocal(e,{turnWasActive:n}),e===_e.activeSessionId?(ft.loadGitStatus(e),Zf(e)):t==="idle"&&(_e.unreadBySession={..._e.unreadBySession,[e]:!0},o2({[e]:!0}));const s=(_e.approvalsBySession[e]??[]).length>0,i=(_e.questionsBySession[e]??[]).length>0;zge(t,s,i)&&lr.maybeNotifyCompletion(e,{isUserWatching:Db(e),sessionTitle:_e.sessions.find(r=>r.id===e)?.title??"",promptId:o,onClick:()=>{ft.selectSession(e)}}),t==="idle"&&Tf.maybePlayCompletionSound()}function S2e(e,t){const n=t.questions[0],o=n?.header?.trim()??"",s=n?.question?.trim()??"",i=o&&s?`${o}: ${s}`:s||o;lr.maybeNotifyQuestion({isUserWatching:Db(e),sessionTitle:_e.sessions.find(r=>r.id===e)?.title??"",questionPreview:i,questionId:t.questionId,onClick:()=>{ft.selectSession(e)}}),Tf.maybePlayQuestionSound()}function C2e(e,t){lr.maybeNotifyApproval({isUserWatching:Db(e),sessionTitle:_e.sessions.find(n=>n.id===e)?.title??"",toolName:t.toolName,approvalId:t.approvalId,onClick:()=>{ft.selectSession(e)}}),Tf.maybePlayApprovalSound()}function Pb(){return bke(),{workspace:Ake,sessions:Mke,activeSessionId:Eke,workspacesView:Xa,workspaceSortMode:_u,visibleWorkspace:f2e,activeWorkspaceId:u0,sessionsForView:h2e,workspaceGroups:p2e,attentionBySession:nN,pendingBySession:v2e,attentionByWorkspace:k2e,unreadBySession:y2e,recentRoots:b2e,turns:Ike,tasks:$ke,activeAppTasks:Qf,todos:Oke,goal:Wc,swarms:JT,swarmMembersByToolCallId:Fke,activationBadges:Xke,compaction:Bke,status:tN,sessionCost:r2e,fileDiff:i2e,selectedDiffPath:PT,fileDiffLoading:WT,changes:o2e,gitInfo:_k,gitDiffStats:s2e,activePullRequest:n2e,changesByPath:d2e,pendingApprovals:t2e,availableOpenInApps:x2e,connection:Rke,loading:Dke,sessionLoading:Pke,loadingMoreMessages:Hke,hasMoreMessages:Wke,loadMoreMessagesError:zke,serverVersion:Uke,backend:qke,dangerousBypassAuth:jke,clearDangerousBypassAuth:Vke,initialized:zT,connectIssue:UT,permission:Kke,thinking:Gke,planMode:eN,swarmMode:Yke,goalMode:Zke,queued:Qke,warnings:Jke,questions:e2e,activity:Bb,turnActive:c0,inFlight:Ob,working:Lke,isStartingFirstPrompt:Nke,fastMoon:Fr.fastMoon,models:Un.models,starredModelIds:Un.starredModelIds,providers:Un.providers,uiFontSize:Fr.uiFontSize,setUiFontSize:Fr.setUiFontSize,conversationToc:VT,setConversationToc:Xye,colorScheme:Fr.colorScheme,setColorScheme:Fr.setColorScheme,accent:Fr.accent,setAccent:Fr.setAccent,notifyOnComplete:lr.notifyOnComplete,notifyOnQuestion:lr.notifyOnQuestion,notifyOnApproval:lr.notifyOnApproval,notifyPermission:lr.notifyPermission,setNotifyOnComplete:lr.setNotifyOnComplete,setNotifyOnQuestion:lr.setNotifyOnQuestion,setNotifyOnApproval:lr.setNotifyOnApproval,soundOnComplete:Tf.soundOnComplete,setSoundOnComplete:Tf.setSoundOnComplete,onboarded:KT,setOnboarded:Jye,load:ft.load,selectSession:ft.selectSession,clearActiveSession:ft.clearActiveSession,loadOlderMessages:ft.loadOlderMessages,loadWorkspaces:ft.loadWorkspaces,loadMoreSessions:ft.loadMoreSessions,loadAllSessions:ft.loadAllSessions,selectWorkspace:ft.selectWorkspace,openWorkspace:ft.openWorkspace,openWorkspaceDraft:ft.openWorkspaceDraft,startSessionAndSendPrompt:ft.startSessionAndSendPrompt,startSessionAndActivateSkill:ft.startSessionAndActivateSkill,startSessionAndOpenSideChat:ft.startSessionAndOpenSideChat,addWorkspaceByPath:ft.addWorkspaceByPath,browseFs:ft.browseFs,getFsHome:ft.getFsHome,sendPrompt:ft.sendPrompt,steerPrompt:ft.steerPrompt,sideChatVisible:ps.sideChatVisible,sideChatSessionId:ps.sideChatSessionId,sideChatTurns:ps.sideChatTurns,sideChatRunning:ps.sideChatRunning,sideChatSending:ps.sideChatSending,openSideChat:ps.openSideChat,closeSideChat:ps.closeSideChat,sendSideChatPrompt:ps.sendSideChatPrompt,uploadImage:ft.uploadImage,abortCurrentPrompt:ft.abortCurrentPrompt,respondApproval:ft.respondApproval,respondQuestion:ft.respondQuestion,dismissQuestion:ft.dismissQuestion,pendingQuestionActions:ft.pendingQuestionActions,pendingApprovalActions:ft.pendingApprovalActions,cancelTask:ft.cancelTask,setPermission:ft.setPermission,setThinking:Un.setThinking,setPlanMode:ft.setPlanMode,togglePlanMode:ft.togglePlanMode,setSwarmMode:ft.setSwarmMode,toggleSwarmMode:ft.toggleSwarmMode,setGoalMode:ft.setGoalMode,toggleGoalMode:ft.toggleGoalMode,createGoal:ft.createGoal,controlGoal:ft.controlGoal,enqueue:ft.enqueue,dismissWarning:ft.dismissWarning,renameSession:ft.renameSession,renameWorkspace:ft.renameWorkspace,deleteWorkspace:ft.deleteWorkspace,reorderWorkspaces:m2e,setWorkspaceSortMode:g2e,archiveSession:ft.archiveSession,exportSession:ft.exportSession,restoreSession:ft.restoreSession,loadArchivedSessions:ft.loadArchivedSessions,compact:ft.compact,forkSession:ft.forkSession,undo:ft.undo,unqueue:ft.unqueue,reorderQueue:ft.reorderQueue,searchFiles:ft.searchFiles,loadGitStatus:ft.loadGitStatus,loadFileDiff:ft.loadFileDiff,clearFileDiff:ft.clearFileDiff,listDir:ft.listDir,readFileContent:ft.readFileContent,getFileDownloadUrl:ft.getFileDownloadUrl,openWorkspaceFile:ft.openWorkspaceFile,openInApp:ft.openInApp,revealWorkspaceFile:ft.revealWorkspaceFile,resolveImageUrl:ft.resolveImageUrl,loadModels:Un.loadModels,loadProviders:Un.loadProviders,skills:Tke,activateSkill:Un.activateSkill,setModel:Un.setModel,toggleStarModel:Un.toggleStarModel,addProvider:Un.addProvider,deleteProvider:Un.deleteProvider,refreshProvider:Un.refreshProvider,refreshAllProviders:Un.refreshAllProviders,authReady:l2e,defaultModel:a2e,managedProviderStatus:c2e,config:u2e,updateConfig:ft.updateConfig,checkAuth:ft.checkAuth,startOAuthLogin:Un.startOAuthLogin,pollOAuthLogin:Un.pollOAuthLogin,cancelOAuthLogin:Un.cancelOAuthLogin,logout:ft.logout}}const oN=Je({__name:"LanguageSwitcher",setup(e){const{locale:t}=$t(),n=b6.map(s=>({value:s.code,label:s.label}));function o(s){t.value!==s&&x6(s)}return(s,i)=>(x(),Se(ys,{"model-value":C(t),options:C(n),"onUpdate:modelValue":o},null,8,["model-value","options"]))}}),A2e=["aria-checked","aria-label","disabled"],M2e=Je({__name:"Switch",props:{modelValue:{type:Boolean},disabled:{type:Boolean},label:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(o,s)=>(x(),E("button",{class:Ue(["ui-switch",{"is-on":e.modelValue}]),type:"button",role:"switch","aria-checked":e.modelValue,"aria-label":e.label,disabled:e.disabled,onClick:s[0]||(s[0]=i=>n("update:modelValue",!e.modelValue))},[...s[1]||(s[1]=[w("span",{class:"ui-switch__thumb"},null,-1)])],10,A2e))}}),Mr=dt(M2e,[["__scopeId","data-v-dbe22dc4"]]),E2e=["aria-label"],T2e=["aria-selected","onClick"],N2e={class:"body"},I2e={class:"panel"},L2e={class:"sec"},$2e={class:"sec-title"},F2e={class:"row"},O2e={class:"rlabel"},B2e={class:"row"},R2e={class:"rlabel"},D2e={class:"row"},P2e={class:"rlabel"},H2e={class:"num-field"},W2e=["value","aria-label"],z2e={class:"row"},U2e={class:"rlabel"},q2e={class:"row"},j2e={class:"rlabel"},V2e={class:"hint"},K2e={class:"sec"},G2e={class:"sec-title"},Y2e={class:"row"},Z2e={class:"rlabel"},X2e={key:0,class:"hint"},Q2e={class:"row"},J2e={class:"rlabel"},ebe={key:0,class:"hint"},tbe={class:"row"},nbe={class:"rlabel"},obe={key:0,class:"hint"},sbe={class:"row"},ibe={class:"rlabel"},rbe={class:"panel"},lbe={class:"sec"},abe={class:"sec-title"},cbe={class:"row"},ube={class:"rlabel"},dbe={key:0,class:"rvalue"},fbe={class:"actions"},hbe={class:"panel"},pbe={class:"sec"},mbe={class:"sec-head"},gbe={class:"sec-title"},vbe={key:0,class:"saving"},ybe={class:"row"},kbe={class:"rlabel"},bbe={class:"hint"},xbe={key:0,class:"select-wrap"},wbe={key:0,value:"",disabled:""},_be=["label"],Sbe=["value"],Cbe={key:1,class:"rvalue mono"},Abe={class:"row"},Mbe={class:"rlabel"},Ebe={class:"hint"},Tbe={class:"row"},Nbe={class:"rlabel"},Ibe={class:"hint"},Lbe={class:"row"},$be={class:"rlabel"},Fbe={class:"hint"},Obe={class:"row"},Bbe={class:"rlabel"},Rbe={class:"hint"},Dbe={key:1,class:"empty-config"},Pbe={class:"panel"},Hbe={class:"sec"},Wbe={class:"sec-title"},zbe={class:"row"},Ube={class:"rlabel"},qbe={class:"rvalue mono"},jbe={class:"row"},Vbe={class:"rlabel"},Kbe={class:"rvalue mono"},Gbe={class:"row"},Ybe={class:"rlabel"},Zbe={class:"rvalue mono"},Xbe={key:0,class:"row"},Qbe={class:"rlabel"},Jbe={class:"hint"},exe={class:"hint"},txe={class:"row"},nxe={class:"rlabel"},oxe={key:0,class:"hint"},sxe={class:"panel"},ixe={class:"panel-head"},rxe={class:"panel-title"},lxe={class:"panel-desc"},axe={class:"archive-toolbar"},cxe={class:"archive-search"},uxe=["placeholder"],dxe={value:"all"},fxe=["value"],hxe={key:0,class:"archive-empty"},pxe={key:0,class:"archive-list"},mxe={class:"archive-workspace"},gxe={class:"path"},vxe={class:"count"},yxe={class:"setting-card"},kxe={class:"archive-meta"},bxe={class:"archive-name"},xxe={class:"archive-time"},wxe={key:1,class:"archive-empty"},_xe=100,Sxe=Je({__name:"SettingsDialog",props:{colorScheme:{},accent:{},uiFontSize:{},authReady:{type:Boolean},accountModel:{},notify:{type:Boolean},notifyQuestion:{type:Boolean},notifyApproval:{type:Boolean},notifyPermission:{},sound:{type:Boolean},conversationToc:{type:Boolean},config:{},models:{},configSaving:{type:Boolean},serverVersion:{},backend:{}},emits:["setColorScheme","setAccent","setUiFontSize","setNotify","setNotifyQuestion","setNotifyApproval","setSound","setConversationToc","login","logout","openOnboarding","openProviders","updateConfig","close"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=oe("general"),r=[{id:"general",labelKey:"settings.tabs.general"},{id:"agent",labelKey:"settings.tabs.agent"},{id:"account",labelKey:"settings.tabs.account"},{id:"advanced",labelKey:"settings.tabs.advanced"},{id:"archived",labelKey:"settings.tabs.archived"}],l=_F(),a=D(()=>o.backend==="v2"?"v2 (kap-server)":"v1 (server)"),c=["manual","yolo","auto"],u={manual:"status.permissionManual",auto:"status.permissionAuto",yolo:"status.permissionYolo"},d=oe(null);mb(d);function f(ne){ne.key==="Escape"&&s("close")}An(()=>document.addEventListener("keydown",f)),On(()=>document.removeEventListener("keydown",f));function h(){zE()}const p=D(()=>{const ne=new Map;for(const j of o.models??[])ne.set(j.id,{id:j.id,label:j.displayName??j.model??j.id,provider:j.provider});for(const[j,K]of Object.entries(o.config?.models??{})){if(ne.has(j))continue;const ve=k(K);ne.set(j,{id:j,label:g(j,K,ve),provider:ve??j})}return Array.from(ne.values())}),m=D(()=>{const ne=new Map;for(const j of p.value){const K=ne.get(j.provider)??[];K.push(j),ne.set(j.provider,K)}for(const j of ne.values())j.sort((K,ve)=>K.label.localeCompare(ve.label));return Array.from(ne.entries()).toSorted(([j],[K])=>j.localeCompare(K)).map(([j,K])=>({provider:j,options:K}))}),y=D(()=>{const ne=o.config?.defaultPermissionMode;return ne==="auto"||ne==="yolo"||ne==="manual"?ne:"manual"});function k(ne){if(!ne||typeof ne!="object")return;const j=ne;return typeof j.provider=="string"?j.provider:void 0}function g(ne,j,K){if(!j||typeof j!="object")return ne;const ve=j,he=typeof ve.model=="string"?ve.model:void 0,Ae=K??k(j);return he&&Ae?`${ne} (${Ae}/${he})`:he?`${ne} (${he})`:ne}function v(ne){return ne===!0}function b(ne){!ne||ne===o.config?.defaultModel||s("updateConfig",{defaultModel:ne})}function A(ne){ne!==y.value&&s("updateConfig",{defaultPermissionMode:ne})}function I(ne){const j=o.config?.[ne];s("updateConfig",{[ne]:!v(j)})}function N(){const ne=o.config?.thinking;return!ne||typeof ne!="object"?!0:ne.enabled!==!1}function M(){s("updateConfig",{thinking:{enabled:!N()}})}function $(){const ne=o.config?.telemetry!==!1;s("updateConfig",{telemetry:!ne})}function T(ne){i.value=ne}const F=Pb(),S=oe([]),B=oe(!1),W=oe(!1),z=oe(""),L=oe("all"),O=oe("archived-desc");async function U(){if(!(B.value||W.value)){B.value=!0;try{const ne=[];let j;for(;;){const K=await F.loadArchivedSessions({beforeId:j,pageSize:_xe});if(ne.push(...K.items),!K.hasMore||K.items.length===0)break;const ve=K.items.at(-1)?.id;if(ve===void 0)break;j=ve}S.value=ne,W.value=!0}catch(ne){console.warn("loadAllArchived failed",ne)}finally{B.value=!1}}}et(i,ne=>{ne==="archived"&&!W.value&&U()});const Z=D(()=>{const ne=new Set;for(const j of S.value)ne.add(j.cwd);return Array.from(ne).sort((j,K)=>j.localeCompare(K))}),ie=D(()=>{const ne=z.value.trim().toLowerCase();let j=S.value.filter(K=>K.archived===!0);return L.value!=="all"&&(j=j.filter(K=>K.cwd===L.value)),ne&&(j=j.filter(K=>K.title.toLowerCase().includes(ne))),j=j.slice(),O.value==="archived-desc"?j.sort((K,ve)=>ve.updatedAt.localeCompare(K.updatedAt)):O.value==="created-desc"?j.sort((K,ve)=>ve.createdAt.localeCompare(K.createdAt)):j.sort((K,ve)=>K.title.localeCompare(ve.title,"zh")),j}),q=D(()=>{const ne=new Map;for(const j of ie.value){const K=ne.get(j.cwd)??[];K.push(j),ne.set(j.cwd,K)}return Array.from(ne.entries()).map(([j,K])=>({cwd:j,items:K}))});async function ee(ne){await F.restoreSession(ne)&&(S.value=S.value.filter(K=>K.id!==ne))}function fe(ne){const j=new Date(ne);if(Number.isNaN(j.getTime()))return ne;const K=ve=>String(ve).padStart(2,"0");return`${j.getFullYear()}-${K(j.getMonth()+1)}-${K(j.getDate())} ${K(j.getHours())}:${K(j.getMinutes())}`}return(ne,j)=>(x(),Se(Qr,{open:!0,"close-on-esc":!1,title:C(n)("settings.title"),size:"xl",height:"fixed",padded:!1,onClose:j[19]||(j[19]=K=>s("close"))},{default:Ie(()=>[w("div",{ref_key:"dialogRef",ref:d,class:"sd"},[w("nav",{class:"settings-tabs",role:"tablist","aria-label":C(n)("settings.title")},[(x(),E(We,null,rt(r,K=>w("button",{key:K.id,type:"button",class:Ue(["tab",{on:i.value===K.id}]),role:"tab","aria-selected":i.value===K.id,onClick:ve=>T(K.id)},R(C(n)(K.labelKey)),11,T2e)),64))],8,E2e),w("div",N2e,[qn(w("section",I2e,[w("section",L2e,[w("h3",$2e,R(C(n)("settings.appearance")),1),w("div",F2e,[w("span",O2e,R(C(n)("theme.colorSchemeLabel")),1),ae(ys,{"model-value":e.colorScheme,options:[{value:"light",label:C(n)("theme.light")},{value:"dark",label:C(n)("theme.dark")},{value:"system",label:C(n)("theme.system")}],"onUpdate:modelValue":j[0]||(j[0]=K=>s("setColorScheme",K))},null,8,["model-value","options"])]),w("div",B2e,[w("span",R2e,R(C(n)("theme.accentLabel")),1),ae(ys,{"model-value":e.accent,options:[{value:"blue",label:C(n)("theme.accentBlue")},{value:"mono",label:C(n)("theme.accentBlack")}],"onUpdate:modelValue":j[1]||(j[1]=K=>s("setAccent",K))},null,8,["model-value","options"])]),w("div",D2e,[w("span",P2e,R(C(n)("settings.uiFontSize")),1),w("label",H2e,[w("input",{class:"num-input",type:"number",min:"12",max:"20",step:"1",value:e.uiFontSize,"aria-label":C(n)("settings.uiFontSize"),onInput:j[2]||(j[2]=K=>s("setUiFontSize",Number(K.target.value)))},null,40,W2e),j[20]||(j[20]=w("span",{class:"num-unit"},"px",-1))])]),w("div",z2e,[w("span",U2e,R(C(n)("sidebar.language")),1),ae(oN)]),w("div",q2e,[w("span",j2e,[ot(R(C(n)("settings.conversationToc"))+" ",1),w("span",V2e,R(C(n)("settings.conversationTocHint")),1)]),ae(Mr,{"model-value":e.conversationToc??!0,label:C(n)("settings.conversationToc"),"onUpdate:modelValue":j[3]||(j[3]=K=>s("setConversationToc",K))},null,8,["model-value","label"])])]),w("section",K2e,[w("h3",G2e,R(C(n)("settings.notifications")),1),w("div",Y2e,[w("span",Z2e,[ot(R(C(n)("settings.notifyOnComplete"))+" ",1),e.notifyPermission==="denied"?(x(),E("span",X2e,R(C(n)("settings.notifyDenied")),1)):ue("",!0)]),ae(Mr,{"model-value":e.notify,disabled:e.notifyPermission==="denied",label:C(n)("settings.notifyOnComplete"),"onUpdate:modelValue":j[4]||(j[4]=K=>s("setNotify",K))},null,8,["model-value","disabled","label"])]),w("div",Q2e,[w("span",J2e,[ot(R(C(n)("settings.notifyOnQuestion"))+" ",1),e.notifyPermission==="denied"?(x(),E("span",ebe,R(C(n)("settings.notifyDenied")),1)):ue("",!0)]),ae(Mr,{"model-value":e.notifyQuestion,disabled:e.notifyPermission==="denied",label:C(n)("settings.notifyOnQuestion"),"onUpdate:modelValue":j[5]||(j[5]=K=>s("setNotifyQuestion",K))},null,8,["model-value","disabled","label"])]),w("div",tbe,[w("span",nbe,[ot(R(C(n)("settings.notifyOnApproval"))+" ",1),e.notifyPermission==="denied"?(x(),E("span",obe,R(C(n)("settings.notifyDenied")),1)):ue("",!0)]),ae(Mr,{"model-value":e.notifyApproval,disabled:e.notifyPermission==="denied",label:C(n)("settings.notifyOnApproval"),"onUpdate:modelValue":j[6]||(j[6]=K=>s("setNotifyApproval",K))},null,8,["model-value","disabled","label"])]),w("div",sbe,[w("span",ibe,R(C(n)("settings.soundOnComplete")),1),ae(Mr,{"model-value":e.sound,label:C(n)("settings.soundOnComplete"),"onUpdate:modelValue":j[7]||(j[7]=K=>s("setSound",K))},null,8,["model-value","label"])])])],512),[[xi,i.value==="general"]]),qn(w("section",rbe,[w("section",lbe,[w("h3",abe,R(C(n)("settings.account")),1),w("div",cbe,[w("span",ube,R(e.authReady?"managed:kimi-code":C(n)("sidebar.notSignedIn")),1),ae(an,{text:e.accountModel},{default:Ie(()=>[e.authReady&&e.accountModel?(x(),E("span",dbe,R(e.accountModel),1)):ue("",!0)]),_:1},8,["text"])]),w("div",fbe,[ae(jt,{variant:"secondary",size:"sm",onClick:j[8]||(j[8]=K=>{s("openOnboarding"),s("close")})},{default:Ie(()=>[ot(R(C(n)("onboarding.reopen")),1)]),_:1}),e.authReady?(x(),Se(jt,{key:0,variant:"danger-soft",size:"sm",onClick:j[9]||(j[9]=K=>s("logout"))},{default:Ie(()=>[ot(R(C(n)("sidebar.signOut")),1)]),_:1})):(x(),Se(jt,{key:1,variant:"primary",size:"sm",onClick:j[10]||(j[10]=K=>s("login"))},{default:Ie(()=>[ot(R(C(n)("sidebar.signIn")),1)]),_:1}))])])],512),[[xi,i.value==="account"]]),qn(w("section",hbe,[w("section",pbe,[w("div",mbe,[w("h3",gbe,R(C(n)("settings.agentDefaults")),1),e.configSaving?(x(),E("span",vbe,R(C(n)("settings.saving")),1)):ue("",!0)]),e.config?(x(),E(We,{key:0},[w("div",ybe,[w("span",kbe,[ot(R(C(n)("settings.defaultModel"))+" ",1),w("span",bbe,R(C(n)("settings.defaultModelHint")),1)]),m.value.length>0?(x(),E("div",xbe,[ae(pk,{"model-value":e.config.defaultModel??"",disabled:e.configSaving,"aria-label":C(n)("settings.defaultModel"),"onUpdate:modelValue":b},{default:Ie(()=>[e.config.defaultModel?ue("",!0):(x(),E("option",wbe,R(C(n)("settings.noDefaultModel")),1)),(x(!0),E(We,null,rt(m.value,K=>(x(),E("optgroup",{key:K.provider,label:K.provider},[(x(!0),E(We,null,rt(K.options,ve=>(x(),E("option",{key:ve.id,value:ve.id},R(ve.label),9,Sbe))),128))],8,_be))),128))]),_:1},8,["model-value","disabled","aria-label"])])):(x(),E("span",Cbe,R(e.config.defaultModel??C(n)("settings.noDefaultModel")),1))]),w("div",Abe,[w("span",Mbe,[ot(R(C(n)("settings.defaultPermission"))+" ",1),w("span",Ebe,R(C(n)("settings.defaultPermissionHint")),1)]),ae(ys,{"model-value":y.value,options:c.map(K=>({value:K,label:C(n)(u[K])})),"onUpdate:modelValue":j[11]||(j[11]=K=>A(K))},null,8,["model-value","options"])]),w("div",Tbe,[w("span",Nbe,[ot(R(C(n)("settings.defaultThinking"))+" ",1),w("span",Ibe,R(C(n)("settings.defaultThinkingHint")),1)]),ae(Mr,{"model-value":N(),disabled:e.configSaving,label:C(n)("settings.defaultThinking"),"onUpdate:modelValue":j[12]||(j[12]=K=>M())},null,8,["model-value","disabled","label"])]),w("div",Lbe,[w("span",$be,[ot(R(C(n)("settings.defaultPlanMode"))+" ",1),w("span",Fbe,R(C(n)("settings.defaultPlanModeHint")),1)]),ae(Mr,{"model-value":v(e.config.defaultPlanMode),disabled:e.configSaving,label:C(n)("settings.defaultPlanMode"),"onUpdate:modelValue":j[13]||(j[13]=K=>I("defaultPlanMode"))},null,8,["model-value","disabled","label"])]),w("div",Obe,[w("span",Bbe,[ot(R(C(n)("settings.mergeSkills"))+" ",1),w("span",Rbe,R(C(n)("settings.mergeSkillsHint")),1)]),ae(Mr,{"model-value":v(e.config.mergeAllAvailableSkills),disabled:e.configSaving,label:C(n)("settings.mergeSkills"),"onUpdate:modelValue":j[14]||(j[14]=K=>I("mergeAllAvailableSkills"))},null,8,["model-value","disabled","label"])])],64)):(x(),E("div",Dbe,R(C(n)("settings.configUnavailable")),1))])],512),[[xi,i.value==="agent"]]),qn(w("section",Pbe,[w("section",Hbe,[w("h3",Wbe,R(C(n)("settings.advanced")),1),w("div",zbe,[w("span",Ube,R(C(n)("sidebar.daemon")),1),w("span",qbe,R(C(l)),1)]),w("div",jbe,[w("span",Vbe,R(C(n)("settings.backend")),1),w("span",Kbe,R(a.value),1)]),w("div",Gbe,[w("span",Ybe,R(C(n)("settings.serverVersion")),1),w("span",Zbe,R(e.serverVersion||"-"),1)]),e.config?(x(),E("div",Xbe,[w("span",Qbe,[ot(R(C(n)("settings.telemetry"))+" ",1),w("span",Jbe,R(C(n)("settings.telemetryHint")),1),w("span",exe,R(C(n)("settings.telemetryRestartHint")),1)]),ae(Mr,{"model-value":e.config.telemetry!==!1,disabled:e.configSaving,label:C(n)("settings.telemetry"),"onUpdate:modelValue":j[15]||(j[15]=K=>$())},null,8,["model-value","disabled","label"])])):ue("",!0),w("div",txe,[w("span",nxe,[ot(R(C(n)("settings.exportLog"))+" ",1),C(Yi)()?ue("",!0):(x(),E("span",oxe,R(C(n)("settings.logHint")),1))]),ae(jt,{variant:"secondary",size:"sm",onClick:h},{default:Ie(()=>[ot(R(C(n)("settings.exportLogBtn")),1)]),_:1})])])],512),[[xi,i.value==="advanced"]]),qn(w("section",sxe,[w("div",ixe,[j[21]||(j[21]=w("div",{class:"panel-kicker"},"Archived sessions",-1)),w("h4",rxe,R(C(n)("settings.archivedTitle")),1),w("p",lxe,R(C(n)("settings.archivedDesc")),1)]),w("div",axe,[w("label",cxe,[j[22]||(j[22]=w("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[w("circle",{cx:"11",cy:"11",r:"7"}),w("path",{d:"m21 21-4.3-4.3"})],-1)),qn(w("input",{"onUpdate:modelValue":j[16]||(j[16]=K=>z.value=K),placeholder:C(n)("settings.archivedSearch")},null,8,uxe),[[Cs,z.value]])]),ae(pk,{"model-value":L.value,size:"sm","aria-label":C(n)("settings.archivedAllWorkspaces"),"onUpdate:modelValue":j[17]||(j[17]=K=>L.value=K)},{default:Ie(()=>[w("option",dxe,R(C(n)("settings.archivedAllWorkspaces")),1),(x(!0),E(We,null,rt(Z.value,K=>(x(),E("option",{key:K,value:K},R(K),9,fxe))),128))]),_:1},8,["model-value","aria-label"]),ae(ys,{size:"sm","model-value":O.value,options:[{value:"archived-desc",label:C(n)("settings.archivedSortArchived")},{value:"created-desc",label:C(n)("settings.archivedSortCreated")},{value:"name-asc",label:C(n)("settings.archivedSortName")}],"onUpdate:modelValue":j[18]||(j[18]=K=>O.value=K)},null,8,["model-value","options"])]),B.value?(x(),E("div",hxe,R(C(n)("settings.archivedLoadingAll")),1)):(x(),E(We,{key:1},[q.value.length>0?(x(),E("div",pxe,[(x(!0),E(We,null,rt(q.value,K=>(x(),E("section",{key:K.cwd,class:"archive-card"},[w("div",mxe,[j[23]||(j[23]=w("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[w("path",{d:"M3 7h6l2 2h10v9H3z"}),w("path",{d:"M3 7V5h6l2 2"})],-1)),w("span",gxe,R(K.cwd),1),w("span",vxe,R(C(n)("settings.archivedSessionsCount",{count:K.items.length})),1)]),w("div",yxe,[(x(!0),E(We,null,rt(K.items,ve=>(x(),E("div",{key:ve.id,class:"archive-row"},[w("div",kxe,[w("div",bxe,R(ve.title),1),w("div",xxe,R(C(n)("settings.archivedAt",{time:fe(ve.updatedAt)})),1)]),ae(jt,{variant:"secondary",size:"sm",onClick:he=>ee(ve.id)},{default:Ie(()=>[ot(R(C(n)("settings.archivedRestore")),1)]),_:1},8,["onClick"])]))),128))])]))),128))])):(x(),E("div",wxe,R(S.value.length===0?C(n)("settings.archivedEmpty"):C(n)("settings.archivedNoMatch")),1))],64))],512),[[xi,i.value==="archived"]])])],512)]),_:1},8,["title"]))}}),Cxe=dt(Sxe,[["__scopeId","data-v-1b1b3473"]]),Axe=/^(?:\/|~(?:\/|$)|[A-Za-z]:[\\/]|\\\\)/,sN=/^[A-Za-z]:[\\/]/,Mxe=/^\/\/(?!\/)/;function Uv(e){return Axe.test(e.trim())}function Exe(e,t){return e==="~"?t||e:e.startsWith("~/")?(t||"~")+e.slice(1):e}function Txe(e){return Mxe.test(e)?`//${e.slice(2).replaceAll(/\/{2,}/g,"/")}`:e.replaceAll(/\/{2,}/g,"/")}function Nxe(e){return sN.test(e)||e.startsWith("\\\\")||e.startsWith("//")}function Ixe(e){return sN.test(e)?3:e.startsWith("\\\\")||e.startsWith("//")?2:e.startsWith("/")?1:0}function Sk(e,t){let n=Txe(Exe(e.trim(),t));const o=Nxe(n),s=n==="/"||n==="//"||n==="\\\\"||/^[A-Za-z]:[\\/]$/.test(n),i=o?/[\\/]$/.test(n):n.endsWith("/");!s&&i&&(n=n.slice(0,-1));const r=n.lastIndexOf("/"),l=o?n.lastIndexOf("\\"):-1,a=Math.max(r,l),c=l>r?"\\":"/",u=Ixe(n),d=a<u?n.slice(0,u)||"/":n.slice(0,a)||"/";return{target:n,parent:d,base:n.slice(a+1),separator:c}}function Lxe(e,t,n){return`${e}${e.endsWith(n)?"":n}${t}`}function $xe(e,t,n){if(n===null)return null;const{target:o}=Sk(e,t);return o===n?n:null}const Fxe={class:"aw"},Oxe={key:0,class:"crumbbar"},Bxe={class:"crumbs"},Rxe={key:0,class:"crumb-sep"},Dxe=["onClick"],Pxe=["placeholder"],Hxe={key:2,class:"folder-list"},Wxe={key:0,class:"fl-loading"},zxe={key:0,class:"fl-loading"},Uxe={key:0,class:"fl-note"},qxe=["onClick"],jxe={class:"folder-name"},Vxe={key:1,class:"fl-empty fl-error"},Kxe={key:2,class:"fl-empty fl-error"},Gxe=["onClick"],Yxe={class:"folder-name search-rel"},Zxe={key:0,class:"fl-empty"},Xxe={key:1,class:"fl-loading"},Qxe=["onClick"],Jxe={class:"folder-name"},ewe={key:0,class:"fl-empty"},twe={key:3,class:"degraded-hint"},nwe={key:4,class:"add-error",role:"alert"},owe={class:"actions"},swe={class:"footer-hint"},iwe=600,rwe=6,sA=150,lwe=Je({__name:"AddWorkspaceDialog",props:{browseFs:{type:Function},getFsHome:{type:Function},defaultPath:{},error:{}},emits:["add","close"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=oe(!0),r=oe(!1),l=oe(!1),a=oe(""),c=oe(null),u=oe([]),d=oe(""),f=oe(!1),h=oe([]),p=D(()=>d.value.trim().length>0);let m=0,y=null;const k=D(()=>Uv(d.value)),g=oe("idle"),v=oe(""),b=oe("/"),A=oe([]),I=oe(""),N=oe(null),M=oe(null),$=D(()=>g.value!=="valid"?null:$xe(d.value,I.value,M.value));let T=0,F=null;function S(j,K){const ve=j.toLowerCase(),he=K.toLowerCase();let Ae=0;for(let re=0;re<he.length&&Ae<ve.length;re++)he[re]===ve[Ae]&&Ae++;return Ae===ve.length}async function B(j){const K=a.value,ve=j.trim();if(!K||ve===""){h.value=[],f.value=!1;return}const he=++m;f.value=!0;const Ae=[],re=[{path:K,depth:0}];let Y=0;for(;re.length>0&&Y<iwe&&Ae.length<sA;){if(he!==m)return;const Q=re.shift();Y++;let P;try{P=await o.browseFs(Q.path)}catch{continue}if(he!==m)return;for(const G of P.entries){if(!G.isDir)continue;const me=G.path.startsWith(K)?G.path.slice(K.length).replace(/^\/+/,""):G.path;if(S(ve,me||G.name)&&(Ae.push({path:G.path,name:G.name,rel:me||G.name}),Ae.length>=sA))break;Q.depth+1<rwe&&re.push({path:G.path,depth:Q.depth+1})}he===m&&(h.value=[...Ae])}he===m&&(f.value=!1)}et(d,j=>{y&&clearTimeout(y),F&&clearTimeout(F),T++,g.value="idle",A.value=[],M.value=null;const K=j.trim();if(K===""){m++,h.value=[],f.value=!1;return}if(Uv(K)){if(m++,h.value=[],f.value=!1,l.value)return;g.value="checking",F=setTimeout(()=>void W(K),150);return}y=setTimeout(()=>void B(j),220)});async function W(j){const K=++T;g.value="checking",M.value=null;const ve=Sk(j,I.value),{target:he}=ve;try{const re=await o.browseFs(he);if(K!==T)return;if(re.path){g.value="valid",A.value=[],M.value=he,a.value=re.path,c.value=re.parent,u.value=re.entries,l.value=!1;return}}catch{}if(K!==T)return;const Ae=ve.base.toLowerCase();v.value=ve.parent,b.value=ve.separator;try{const re=await o.browseFs(ve.parent);if(K!==T)return;if(re.path){A.value=re.entries.filter(Y=>Y.isDir&&Y.name.toLowerCase().startsWith(Ae)),g.value="not-found";return}}catch{}K===T&&(A.value=[],g.value="bad-parent")}function z(j){d.value=Lxe(v.value,j,b.value),N.value?.focus()}const L=D(()=>l.value?n("workspace.degradedPlaceholder"):n("workspace.searchPlaceholder")),O=D(()=>l.value?n("workspace.degradedHint"):k.value&&g.value==="valid"?n("workspace.pathFollowHint"):n("workspace.browseHint"));function U(j){if(j.key==="Escape"){d.value?d.value="":s("close");return}if(j.key!=="Enter")return;const K=d.value.trim();if(Uv(K)){if(j.preventDefault(),l.value){const{target:ve}=Sk(K,I.value);ve&&s("add",ve);return}g.value==="valid"?ne():g.value==="not-found"&&A.value[0]&&z(A.value[0].name)}}const Z=D(()=>{const j=a.value;if(!j)return[];const K=j.split("/").filter(Boolean),ve=[{label:"/",path:"/"}];let he="";for(const Ae of K)he+=`/${Ae}`,ve.push({label:Ae,path:he});return ve}),ie=D(()=>!(a.value.length===0||k.value&&$.value===null));async function q(j){r.value=!0;try{const K=await o.browseFs(j);if(!K.path){l.value=!0;return}a.value=K.path,c.value=K.parent,u.value=K.entries,d.value="",l.value=!1}catch{l.value=!0}finally{r.value=!1}}function ee(j){j.isDir&&q(j.path)}function fe(){c.value&&q(c.value)}function ne(){ie.value&&s("add",$.value??a.value)}return An(async()=>{r.value=!0;try{const j=await o.getFsHome().catch(()=>({home:"",recentRoots:[]}));if(j.home&&(I.value=j.home),o.defaultPath&&(await q(o.defaultPath),!l.value))return;I.value?await q(I.value):l.value=!0}catch{l.value=!0}finally{r.value=!1}}),On(()=>{y&&clearTimeout(y),F&&clearTimeout(F)}),(j,K)=>(x(),Se(Qr,{open:i.value,"onUpdate:open":K[2]||(K[2]=ve=>i.value=ve),title:C(n)("workspace.addTitle"),size:"lg",height:"fixed",onClose:K[3]||(K[3]=ve=>s("close"))},{default:Ie(()=>[w("div",Fxe,[l.value?ue("",!0):(x(),E("div",Oxe,[ae(Xn,{size:"sm",disabled:!c.value,label:C(n)("workspace.up"),onClick:fe},{default:Ie(()=>[ae(Ge,{name:"arrow-up",size:"md"})]),_:1},8,["disabled","label"]),w("div",Bxe,[(x(!0),E(We,null,rt(Z.value,(ve,he)=>(x(),E(We,{key:ve.path},[he>1?(x(),E("span",Rxe,"/")):ue("",!0),w("button",{class:Ue(["crumb",{last:he===Z.value.length-1}]),onClick:Ae=>q(ve.path)},R(ve.label),11,Dxe)],64))),128))])])),!r.value||l.value?(x(),E("div",{key:1,class:Ue(["filterbar",{"has-error":g.value==="not-found"||g.value==="bad-parent"}])},[ae(Ge,{class:"filter-icon",name:"search",size:"md"}),qn(w("input",{ref_key:"filterEl",ref:N,"onUpdate:modelValue":K[0]||(K[0]=ve=>d.value=ve),class:"filter-input",type:"text",placeholder:L.value,autocomplete:"off",spellcheck:"false",onKeydown:St(U,["stop"])},null,40,Pxe),[[Cs,d.value]]),f.value||g.value==="checking"?(x(),Se(Us,{key:0,size:"sm"})):ue("",!0)],2)):ue("",!0),l.value?(x(),E("div",twe,R(C(n)("workspace.degradedHint")),1)):(x(),E("div",Hxe,[r.value?(x(),E("div",Wxe,R(C(n)("workspace.browsing")),1)):k.value&&g.value!=="valid"?(x(),E(We,{key:1},[g.value==="checking"?(x(),E("div",zxe,R(C(n)("workspace.checkingPath")),1)):g.value==="not-found"?(x(),E(We,{key:1},[A.value.length>0?(x(),E("div",Uxe,R(C(n)("workspace.pathPickHint")),1)):ue("",!0),(x(!0),E(We,null,rt(A.value,ve=>(x(),E("button",{key:ve.path,class:"folder-row",onClick:he=>z(ve.name)},[ae(Ge,{class:"dir-icon",name:"folder-closed",size:"sm"}),w("span",jxe,R(ve.name),1)],8,qxe))),128)),A.value.length===0?(x(),E("div",Vxe,R(C(n)("workspace.noPathMatch",{parent:v.value})),1)):ue("",!0)],64)):g.value==="bad-parent"?(x(),E("div",Kxe,R(C(n)("workspace.badParent",{parent:v.value})),1)):ue("",!0)],64)):p.value&&!k.value?(x(),E(We,{key:2},[(x(!0),E(We,null,rt(h.value,ve=>(x(),E("button",{key:ve.path,class:"folder-row",onClick:he=>q(ve.path)},[ae(Ge,{class:"dir-icon",name:"folder-closed",size:"sm"}),w("span",Yxe,R(ve.rel),1)],8,Gxe))),128)),!f.value&&h.value.length===0?(x(),E("div",Zxe,R(C(n)("workspace.noFilterMatch",{q:d.value.trim()})),1)):f.value&&h.value.length===0?(x(),E("div",Xxe,R(C(n)("workspace.searching")),1)):ue("",!0)],64)):(x(),E(We,{key:3},[(x(!0),E(We,null,rt(u.value,ve=>(x(),E("button",{key:ve.path,class:"folder-row",onClick:he=>ee(ve)},[ae(Ge,{class:"dir-icon",name:"folder-closed",size:"sm"}),w("span",Jxe,R(ve.name),1)],8,Qxe))),128)),u.value.length===0?(x(),E("div",ewe,R(C(n)("workspace.noSubfolders")),1)):ue("",!0)],64))])),e.error?(x(),E("div",nwe,R(e.error),1)):ue("",!0),w("div",owe,[ae(an,{text:a.value},{default:Ie(()=>[l.value?ue("",!0):(x(),Se(jt,{key:0,variant:"primary",disabled:!ie.value,onClick:ne},{default:Ie(()=>[ot(R(C(n)("workspace.openThisFolder")),1)]),_:1},8,["disabled"]))]),_:1},8,["text"]),ae(jt,{variant:"secondary",onClick:K[1]||(K[1]=ve=>s("close"))},{default:Ie(()=>[ot(R(C(n)("workspace.cancel")),1)]),_:1})]),w("div",swe,R(O.value),1)])]),_:1},8,["open","title"]))}}),awe=dt(lwe,[["__scopeId","data-v-07cbb13d"]]),cwe={key:0,class:"confirm-dialog__message"},uwe=Je({__name:"ConfirmDialog",props:{open:{type:Boolean},title:{},message:{},confirmLabel:{},cancelLabel:{},variant:{default:"danger"},loading:{type:Boolean}},emits:["update:open","confirm","cancel"],setup(e,{emit:t}){const n=e,o=t,{t:s}=$t();function i(){n.loading||(o("update:open",!1),o("cancel"))}function r(l){if(l.key!=="Enter"||!n.open||n.loading)return;const a=l.target;a instanceof HTMLButtonElement||a instanceof HTMLAnchorElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement||a instanceof HTMLInputElement||(l.preventDefault(),o("confirm"))}return typeof window<"u"&&window.addEventListener("keydown",r),ho(()=>{typeof window<"u"&&window.removeEventListener("keydown",r)}),(l,a)=>(x(),Se(Qr,{open:e.open,title:e.title,height:"auto","initial-focus":".confirm-dialog__confirm","close-on-esc":!e.loading,"close-on-overlay":!e.loading,"onUpdate:open":a[1]||(a[1]=c=>o("update:open",c)),onClose:i},{foot:Ie(()=>[ae(jt,{variant:"secondary",disabled:e.loading,onClick:i},{default:Ie(()=>[ot(R(e.cancelLabel??C(s)("common.cancel")),1)]),_:1},8,["disabled"]),ae(jt,{class:"confirm-dialog__confirm",variant:e.variant,loading:e.loading,onClick:a[0]||(a[0]=c=>o("confirm"))},{default:Ie(()=>[ot(R(e.confirmLabel??C(s)("common.confirm")),1)]),_:1},8,["variant","loading"])]),default:Ie(()=>[e.message?(x(),E("p",cwe,R(e.message),1)):ue("",!0)]),_:1},8,["open","title","close-on-esc","close-on-overlay"]))}}),dwe=dt(uwe,[["__scopeId","data-v-2e719024"]]),fwe=Je({__name:"ConfirmDialogHost",setup(e){const{current:t,busy:n,settle:o,runAction:s}=Gf();function i(){s()}return(r,l)=>(x(),Se(dwe,{open:C(t)!==null,title:C(t)?.title??"",message:C(t)?.message,"confirm-label":C(t)?.confirmLabel,"cancel-label":C(t)?.cancelLabel,variant:C(t)?.variant,loading:C(n),onConfirm:i,onCancel:l[0]||(l[0]=a=>C(o)(!1))},null,8,["open","title","message","confirm-label","cancel-label","variant","loading"]))}}),hwe={class:"rows"},pwe={class:"row"},mwe={class:"row"},gwe={class:"row"},vwe={class:"row"},ywe={class:"row"},kwe={class:"row"},bwe={class:"ctx-text"},xwe={key:0,class:"bar"},wwe={class:"row"},_we=Je({__name:"StatusPanel",props:{status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},costUsd:{}},emits:["close"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=oe(!0),r=D(()=>o.status.ctxMax<=0?0:Math.min(100,Math.max(0,Math.ceil(o.status.ctxUsed/o.status.ctxMax*100)))),l=D(()=>o.status.ctxMax>0?n("status.statusContextValue",{used:pr(o.status.ctxUsed),max:pr(o.status.ctxMax),pct:r.value}):n("status.statusNone"));function a(p){return n(p==="yolo"?"status.permissionYolo":p==="auto"?"status.permissionAuto":"status.permissionManual")}const c=D(()=>{const p=o.status.permission;return p==="yolo"?"var(--color-warning)":p==="auto"?"var(--color-danger)":"var(--color-text)"}),u=D(()=>o.planMode?n("status.planOn"):n("status.planOff")),d=D(()=>o.swarmMode?n("status.swarmOn"):n("status.swarmOff")),f=D(()=>typeof o.costUsd=="number"&&o.costUsd>0),h=D(()=>f.value?`$${o.costUsd.toFixed(4)}`:n("status.statusNone"));return(p,m)=>(x(),Se(Qr,{open:i.value,"onUpdate:open":m[0]||(m[0]=y=>i.value=y),title:C(n)("status.statusPanelTitle"),onClose:m[1]||(m[1]=y=>s("close"))},{default:Ie(()=>[w("dl",hwe,[w("div",pwe,[w("dt",null,R(C(n)("status.statusModel")),1),w("dd",null,R(e.status.model),1)]),w("div",mwe,[w("dt",null,R(C(n)("status.statusThinking")),1),w("dd",null,R(e.thinking),1)]),w("div",gwe,[w("dt",null,R(C(n)("status.statusPermission")),1),w("dd",{style:on({color:c.value})},R(a(e.status.permission)),5)]),w("div",vwe,[w("dt",null,R(C(n)("status.statusPlanMode")),1),w("dd",{class:Ue({"plan-on":e.planMode})},R(u.value),3)]),w("div",ywe,[w("dt",null,R(C(n)("status.statusSwarmMode")),1),w("dd",{class:Ue({"swarm-on":e.swarmMode})},R(d.value),3)]),w("div",kwe,[w("dt",null,R(C(n)("status.statusContext")),1),w("dd",null,[w("span",bwe,R(l.value),1),e.status.ctxMax>0?(x(),E("span",xwe,[w("i",{style:on({width:r.value+"%"})},null,4)])):ue("",!0)])]),w("div",wwe,[w("dt",null,R(C(n)("status.statusCost")),1),w("dd",null,R(h.value),1)])])]),_:1},8,["open","title"]))}}),Swe=dt(_we,[["__scopeId","data-v-09f83ff0"]]),Cwe={class:"ui-toast__icon","aria-hidden":"true"},Awe={class:"ui-toast__body"},Mwe={class:"ui-toast__title"},Ewe={key:0,class:"ui-toast__msg"},Twe=Je({__name:"Toast",props:{variant:{default:"info"},title:{},message:{},dismissLabel:{default:"Dismiss"}},emits:["dismiss"],setup(e){return(t,n)=>(x(),E("div",{class:Ue(["ui-toast",`ui-toast--${e.variant}`])},[w("span",Cwe,[jn(t.$slots,"icon",{},()=>[e.variant==="success"?(x(),Se(Ge,{key:0,name:"check"})):e.variant==="danger"?(x(),Se(Ge,{key:1,name:"close"})):e.variant==="warning"?(x(),Se(Ge,{key:2,name:"alert-triangle"})):(x(),Se(Ge,{key:3,name:"info"}))],!0)]),w("div",Awe,[w("div",Mwe,R(e.title),1),e.message?(x(),E("div",Ewe,R(e.message),1)):ue("",!0),jn(t.$slots,"default",{},void 0,!0)]),ae(Xn,{class:"ui-toast__close",size:"sm",label:e.dismissLabel,onClick:n[0]||(n[0]=o=>t.$emit("dismiss"))},{default:Ie(()=>[ae(Ge,{name:"close",size:"sm"})]),_:1},8,["label"])],2))}}),Nwe=dt(Twe,[["__scopeId","data-v-adc6f346"]]),Iwe={key:0,class:"actions"},Lwe=["onClick"],$we=["onClick"],Fwe={key:1,class:"details"},Owe=Je({__name:"WarningToasts",props:{warnings:{}},emits:["dismiss"],setup(e,{emit:t}){const n=e,o=t,{t:s}=$t();function i(M){return typeof M=="object"&&M!==null}function r(M){return i(M)?M.title:M}function l(M){return i(M)?M.message??"":""}function a(M){return i(M)?M.details:void 0}function c(M){return i(M)?M.severity==="error":M.startsWith(`${s("warnings.errorLabel")}:`)||/\b4\d\d\b|error|失败|failed/i.test(M)}function u(M){return i(M)?`notice:${M.severity}:${M.title}:${M.message??""}:${JSON.stringify(M.details??[])}`:`text:${M}`}function d(M){if(!i(M))return M;const $=[M.title];M.message&&$.push(M.message);const T=M.details??[];if(T.length>0){$.push("",`${s("warnings.diagnostics")}:`);for(const F of T)$.push(`${F.label}: ${F.value}`)}return $.join(`
342
- `)}let f=1;const h=oe([]),p=new Map,m=new Map;function y(M){const $=c(M)?12e3:6e3;return typeof window<"u"&&window.matchMedia?.("(hover: none)").matches===!0?$+5e3:$}function k(M,$){const T=p.get(M)??{handle:null,deadline:0,remaining:0};T.handle=setTimeout(()=>N(M),$),T.deadline=Date.now()+$,p.set(M,T)}function g(M){const $=p.get(M);$&&$.handle!==null&&clearTimeout($.handle),p.delete(M)}function v(M){const $=p.get(M);!$||$.handle===null||(clearTimeout($.handle),$.handle=null,$.remaining=Math.max(0,$.deadline-Date.now()))}function b(M){if(h.value.find(F=>F.id===M)?.detailsOpen)return;const T=p.get(M);!T||T.handle!==null||k(M,T.remaining)}function A(M){M.detailsOpen=!M.detailsOpen,M.detailsOpen?v(M.id):b(M.id)}async function I(M){if(!await Jo(d(M.warning)))return;M.copied=!0;const T=m.get(M.id);T&&clearTimeout(T),m.set(M.id,setTimeout(()=>{M.copied=!1,m.delete(M.id)},1400))}function N(M){g(M);const $=m.get(M);$&&clearTimeout($),m.delete(M);const T=h.value.findIndex(F=>F.id===M);T!==-1&&(h.value=h.value.filter(F=>F.id!==M),o("dismiss",T))}return et(()=>n.warnings,M=>{const $=[...h.value];h.value=M.map(T=>{const F=u(T),S=$.findIndex(z=>z.key===F),B=S===-1?void 0:$.splice(S,1)[0];if(B)return B.warning=T,B;const W={id:f++,key:F,warning:T,detailsOpen:!1,copied:!1};return k(W.id,y(T)),W});for(const T of $){g(T.id);const F=m.get(T.id);F&&clearTimeout(F),m.delete(T.id)}},{immediate:!0,flush:"post"}),On(()=>{p.forEach(M=>{M.handle!==null&&clearTimeout(M.handle)}),p.clear(),m.forEach(M=>clearTimeout(M)),m.clear()}),(M,$)=>(x(),Se(Z7,{name:"toast",tag:"div",class:"toasts",role:"status","aria-live":"polite"},{default:Ie(()=>[(x(!0),E(We,null,rt(h.value,T=>(x(),Se(Nwe,{key:T.id,variant:c(T.warning)?"danger":"warning",title:r(T.warning),message:l(T.warning),"dismiss-label":C(s)("warnings.dismiss"),onDismiss:F=>N(T.id),onPointerenter:F=>v(T.id),onPointerleave:F=>b(T.id)},{default:Ie(()=>[a(T.warning)?.length?(x(),E("div",Iwe,[w("button",{class:"link",type:"button",onClick:F=>A(T)},R(T.detailsOpen?C(s)("warnings.hideDetails"):C(s)("warnings.showDetails")),9,Lwe),w("button",{class:"link",type:"button",onClick:F=>I(T)},R(T.copied?C(s)("warnings.copied"):C(s)("warnings.copyDetails")),9,$we)])):ue("",!0),T.detailsOpen&&a(T.warning)?.length?(x(),E("dl",Fwe,[(x(!0),E(We,null,rt(a(T.warning),F=>(x(),E("div",{key:`${F.label}:${F.value}`,class:"detail-row"},[w("dt",null,R(F.label),1),w("dd",null,R(F.value),1)]))),128))])):ue("",!0)]),_:2},1032,["variant","title","message","dismiss-label","onDismiss","onPointerenter","onPointerleave"]))),128))]),_:1}))}}),Bwe=dt(Owe,[["__scopeId","data-v-6cc72bd4"]]),Rwe={class:"topbar"},Dwe={class:"wsq"},Pwe=["aria-label"],Hwe={class:"tb-path"},Wwe={class:"ws"},zwe={class:"se"},Uwe={class:"tb-sub"},qwe=Je({__name:"MobileTopBar",props:{workspace:{default:null},sessionTitle:{default:""},running:{type:Boolean,default:!1},branch:{default:""},sessionCount:{default:0}},emits:["openSwitcher","openSettings"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=D(()=>{const a=o.workspace,u=(a?.name||a?.root||"").trim().charAt(0);return u?u.toUpperCase():"K"}),r=D(()=>o.workspace?.name??n("workspace.noWorkspace")),l=D(()=>o.running?n("mobile.running"):n("mobile.idle"));return(a,c)=>(x(),E("div",Rwe,[w("span",Dwe,R(i.value),1),w("button",{type:"button",class:"tb-mid","aria-label":C(n)("mobile.openSwitcher"),onClick:c[0]||(c[0]=u=>s("openSwitcher"))},[w("span",Hwe,[w("span",Wwe,R(r.value),1),e.sessionTitle?(x(),E(We,{key:0},[c[2]||(c[2]=w("span",{class:"sl"},"/",-1)),w("span",zwe,R(e.sessionTitle),1)],64)):ue("",!0),c[3]||(c[3]=w("span",{class:"cv"},"⌄",-1))]),w("span",Uwe,[w("span",{class:Ue(["rd",{on:e.running}])},null,2),w("span",null,R(l.value),1),e.branch?(x(),E(We,{key:0},[ot(" · "+R(e.branch),1)],64)):ue("",!0),e.sessionCount>0?(x(),E(We,{key:1},[ot(" · "+R(C(n)("mobile.sessionCount",{n:e.sessionCount})),1)],64)):ue("",!0)])],8,Pwe),ae(Xn,{size:"lg",label:C(n)("mobile.openSettings"),onClick:c[1]||(c[1]=u=>s("openSettings"))},{default:Ie(()=>[ae(Ge,{name:"sliders",size:"lg"})]),_:1},8,["label"])]))}}),jwe=dt(qwe,[["__scopeId","data-v-6b4b901f"]]),Vwe={key:0,class:"sheet-root"},Kwe=["aria-label"],Gwe=["aria-label"],Ywe={key:0,class:"sheet-head"},Zwe={class:"sheet-title"},Xwe={class:"sheet-body"},Qwe=Je({__name:"BottomSheet",props:{modelValue:{type:Boolean},title:{default:""}},emits:["update:modelValue","close"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t;function i(){s("update:modelValue",!1),s("close")}function r(l){l.key==="Escape"&&i()}return et(()=>o.modelValue,l=>{typeof document>"u"||(l?document.addEventListener("keydown",r):document.removeEventListener("keydown",r))},{immediate:!0}),On(()=>{typeof document<"u"&&document.removeEventListener("keydown",r)}),(l,a)=>(x(),Se(Ua,{name:"sheet"},{default:Ie(()=>[e.modelValue?(x(),E("div",Vwe,[w("div",{class:"sheet-scrim",onClick:i}),w("div",{class:"sheet-panel",role:"dialog","aria-label":e.title||C(n)("mobile.sheetLabel")},[w("button",{type:"button",class:"sheet-grab","aria-label":C(n)("mobile.closeSheet"),onClick:i},null,8,Gwe),e.title?(x(),E("div",Ywe,[w("span",Zwe,R(e.title),1)])):ue("",!0),w("div",Xwe,[jn(l.$slots,"default",{},void 0,!0)])],8,Kwe)])):ue("",!0)]),_:3}))}}),iN=dt(Qwe,[["__scopeId","data-v-745ee5a2"]]),Jwe={class:"mlist"},e_e={key:0,class:"mempty"},t_e=["onClick"],n_e={class:"mgh-main"},o_e={class:"mgh-name"},s_e={class:"mgh-path"},i_e={key:2,class:"att"},r_e={key:0,class:"mempty small"},l_e=["onClick"],a_e={class:"m"},c_e={class:"s"},u_e={key:0,class:"att"},d_e=["disabled","onClick"],f_e=["onClick"],h_e=Je({__name:"MobileSwitcherSheet",props:{modelValue:{type:Boolean},groups:{},activeWorkspaceId:{default:null},activeId:{},attentionBySession:{default:()=>({})},attentionByWorkspace:{default:()=>({})}},emits:["update:modelValue","select","create","createInWorkspace","addWorkspace","rename","archive","deleteWorkspace","loadMore"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t;function i(){s("update:modelValue",!1)}function r(F){s("select",F),i()}function l(F){s("createInWorkspace",F),i()}function a(){s("create"),i()}function c(){s("addWorkspace"),i()}const u=oe(new Set);function d(F){return u.value.has(F)}function f(F){const S=new Set(u.value);S.has(F)?S.delete(F):S.add(F),u.value=S,v.value=null,N.value=null}const h=oe(new Set);function p(F){return h.value.has(F)}function m(F){const S=new Set(h.value);S.has(F)?S.delete(F):S.add(F),h.value=S}function y(F){if(p(F.workspace.id))return F.sessions;const S=F.sessions.slice(0,F.initialCount);if(o.activeId&&!S.some(B=>B.id===o.activeId)){const B=F.sessions.find(W=>W.id===o.activeId);if(B)return[...S,B]}return S}function k(F){if(!h.value.has(F)){const S=new Set(h.value);S.add(F),h.value=S}s("loadMore",F)}function g(F){return o.attentionByWorkspace[F]??0}const v=oe(null);function b(F){v.value=v.value===F?null:F,N.value=null}function A(F){v.value=null;const B=(typeof window<"u"?window.prompt(n("sidebar.rename"),F.title):null)?.trim();B&&s("rename",F.id,B)}function I(F){v.value=null,s("archive",F)}const N=oe(null);function M(F){N.value=N.value===F?null:F,v.value=null}function $(F){Jo(F.root),N.value=null}function T(F){N.value=null,s("deleteWorkspace",F.id)}return(F,S)=>(x(),Se(iN,{"model-value":e.modelValue,"onUpdate:modelValue":S[2]||(S[2]=B=>s("update:modelValue",B))},{default:Ie(()=>[w("button",{type:"button",class:"newrow",onClick:a},[ae(Ge,{name:"message",size:"sm"}),ot(" "+R(C(n)("sidebar.newChat")),1)]),w("button",{type:"button",class:"newrow secondary",onClick:c},[ae(Ge,{name:"folder",size:"sm"}),ot(" "+R(C(n)("sidebar.newWorkspace")),1)]),w("div",Jwe,[e.groups.length===0?(x(),E("div",e_e,R(C(n)("workspace.noWorkspace")),1)):ue("",!0),(x(!0),E(We,null,rt(e.groups,B=>(x(),E("div",{key:B.workspace.id,class:"mgroup"},[w("div",{class:Ue(["mgh",{on:B.workspace.id===e.activeWorkspaceId}]),onClick:W=>f(B.workspace.id)},[d(B.workspace.id)?(x(),Se(Ge,{key:0,class:"mgh-folder",name:"folder-closed",size:"sm"})):(x(),Se(Ge,{key:1,class:"mgh-folder",name:"folder",size:"sm"})),w("div",n_e,[w("span",o_e,R(B.workspace.name),1),ae(an,{text:B.workspace.root},{default:Ie(()=>[w("span",s_e,R(B.workspace.shortPath),1)]),_:2},1032,["text"])]),d(B.workspace.id)&&g(B.workspace.id)>0?(x(),E("span",i_e,R(g(B.workspace.id)),1)):ue("",!0),ae(Xn,{size:"lg",class:"mgh-more",label:C(n)("sidebar.options"),onClick:St(W=>M(B.workspace.id),["stop"])},{default:Ie(()=>[ae(Ge,{name:"dots-horizontal",size:"md"})]),_:1},8,["label","onClick"]),ae(Xn,{size:"lg",class:"mgh-add",label:C(n)("workspace.newInGroup"),onClick:St(W=>l(B.workspace.id),["stop"])},{default:Ie(()=>[ae(Ge,{name:"plus",size:"md"})]),_:1},8,["label","onClick"]),N.value===B.workspace.id?(x(),Se(Ml,{key:3,class:"kmenu wsmenu",onClick:S[0]||(S[0]=St(()=>{},["stop"]))},{default:Ie(()=>[ae(Tn,{size:"lg",onClick:W=>$(B.workspace)},{default:Ie(()=>[ot(R(C(n)("sidebar.copyPath")),1)]),_:1},8,["onClick"]),ae(Tn,{size:"lg",danger:"",onClick:W=>T(B.workspace)},{default:Ie(()=>[ot(R(C(n)("sidebar.delete")),1)]),_:1},8,["onClick"])]),_:2},1024)):ue("",!0)],10,t_e),qn(w("div",null,[B.sessions.length===0?(x(),E("div",r_e,R(C(n)("sidebar.noSessions")),1)):ue("",!0),(x(!0),E(We,null,rt(y(B),W=>(x(),E("div",{key:W.id,class:Ue(["srow",{cur:W.id===e.activeId}]),onClick:z=>r(W.id)},[w("div",a_e,[w("div",{class:Ue(["t",{run:W.busy,aborted:!W.busy&&(e.attentionBySession[W.id]??0)===0&&(W.lastTurnReason==="cancelled"||W.lastTurnReason==="failed")}])},R(W.title),3),w("div",c_e,R(W.time),1)]),(e.attentionBySession[W.id]??0)>0?(x(),E("span",u_e,R(e.attentionBySession[W.id]),1)):ue("",!0),ae(Xn,{size:"lg",class:"kb",label:C(n)("sidebar.options"),onClick:St(z=>b(W.id),["stop"])},{default:Ie(()=>[ae(Ge,{name:"dots-horizontal",size:"md"})]),_:1},8,["label","onClick"]),v.value===W.id?(x(),Se(Ml,{key:1,class:"kmenu",onClick:S[1]||(S[1]=St(()=>{},["stop"]))},{default:Ie(()=>[ae(Tn,{size:"lg",onClick:z=>A(W)},{default:Ie(()=>[ot(R(C(n)("sidebar.rename")),1)]),_:1},8,["onClick"]),ae(Tn,{size:"lg",danger:"",onClick:z=>I(W.id)},{default:Ie(()=>[ot(R(C(n)("sidebar.archive")),1)]),_:1},8,["onClick"])]),_:2},1024)):ue("",!0)],10,l_e))),128)),B.hasMore||B.loadingMore?(x(),E("button",{key:1,type:"button",class:"mshow-more",disabled:B.loadingMore,onClick:St(W=>k(B.workspace.id),["stop"])},R(B.loadingMore?C(n)("sidebar.loadingMore"):C(n)("sidebar.showMore",{count:Math.max(0,B.workspace.sessionCount-B.sessions.length)})),9,d_e)):ue("",!0),B.sessions.length>B.initialCount?(x(),E("button",{key:2,type:"button",class:"mshow-more",onClick:St(W=>m(B.workspace.id),["stop"])},R(p(B.workspace.id)?C(n)("sidebar.showLess"):C(n)("sidebar.showAll",{count:B.sessions.length-B.initialCount})),9,f_e)):ue("",!0)],512),[[xi,!d(B.workspace.id)]])]))),128))])]),_:1},8,["model-value"]))}}),p_e=dt(h_e,[["__scopeId","data-v-df277098"]]),m_e={class:"group-title"},g_e={class:"srow-main"},v_e={class:"srow-label"},y_e={class:"srow-sub"},k_e={class:"srow read-only"},b_e={class:"srow-main"},x_e={class:"srow-label"},w_e={key:0,class:"srow-sub"},__e={class:"cache-note"},S_e={class:"srow-main"},C_e={class:"srow-label"},A_e={class:"srow-sub"},M_e=["aria-checked"],E_e={class:"srow-main"},T_e={class:"srow-label"},N_e={class:"srow-sub"},I_e=["aria-checked"],L_e={class:"srow-main"},$_e={class:"srow-label"},F_e={class:"srow read-only"},O_e={class:"srow-main"},B_e={class:"srow-label"},R_e={class:"srow-sub"},D_e=["aria-label"],P_e={class:"group-title"},H_e={class:"srow-main"},W_e={class:"srow-label"},z_e={class:"srow-sub"},U_e={class:"srow read-only pref"},q_e={class:"srow-main"},j_e={class:"srow-label"},V_e={class:"srow read-only pref"},K_e={class:"srow-main"},G_e={class:"srow-label"},Y_e={class:"srow read-only pref"},Z_e={class:"srow-main"},X_e={class:"srow-label"},Q_e={class:"num-field"},J_e=["value","aria-label"],eSe={class:"srow-main"},tSe={class:"srow-label"},nSe={class:"srow-sub"},oSe=["aria-checked"],sSe={class:"srow-main"},iSe={class:"srow-label"},rSe={class:"srow-main"},lSe={class:"srow-label"},aSe={key:2,class:"srow read-only"},cSe={class:"srow-main"},uSe={class:"srow-label"},dSe={class:"srow-val dim"},fSe={class:"arch-subhead"},hSe={class:"arch-count"},pSe={class:"arch-tools"},mSe={key:0,class:"arch-empty"},gSe={class:"arch-meta"},vSe={class:"arch-name"},ySe={class:"arch-time"},kSe={key:2,class:"arch-empty"},bSe=100,xSe=Je({__name:"MobileSettingsSheet",props:{modelValue:{type:Boolean},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},colorScheme:{default:"system"},uiFontSize:{default:14},authReady:{type:Boolean,default:!1},conversationToc:{type:Boolean},serverVersion:{default:""},models:{default:()=>[]}},emits:["update:modelValue","pickModel","setThinking","togglePlan","toggleSwarm","setPermission","setColorScheme","setUiFontSize","setConversationToc","login","logout"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t;function i(q){s("setColorScheme",q)}const r=["manual","yolo","auto"],l=D(()=>o.models?.find(q=>q.id===o.status?.modelId)),a=D(()=>o0(l.value)),c=D(()=>s0(l.value)),u=D(()=>Xm(l.value,o.thinking)),d=D(()=>c.value.includes(u.value)?u.value:""),f=D(()=>c.value.map(q=>({value:q,label:hk(q)}))),h=D(()=>o.planMode===!0),p=D(()=>o.swarmMode===!0),m=D(()=>{const q=o.status.permission;return q==="yolo"?"var(--color-warning)":q==="auto"?"var(--color-danger)":"var(--color-text-muted)"}),y=D(()=>{const q=o.status.permission,ee=n(q==="yolo"?"mobile.permYoloSub":q==="auto"?"mobile.permAutoSub":"mobile.permManualSub");return`${q} · ${ee}`}),k=D(()=>o.status.ctxMax>0?Math.min(100,Math.max(0,Math.ceil(o.status.ctxUsed/o.status.ctxMax*100))):0),g=D(()=>o.status.ctxMax>0?`${pr(o.status.ctxUsed)}/${pr(o.status.ctxMax)}`:n("status.statusNone"));function v(q){s("setThinking",hb(l.value,q))}function b(){const q=r.indexOf(o.status.permission),ee=r[(q+1)%r.length];s("setPermission",ee)}function A(){s("pickModel"),s("update:modelValue",!1)}function I(){s("login"),s("update:modelValue",!1)}function N(){s("logout"),s("update:modelValue",!1)}const M=Pb(),$=oe("main"),T=oe([]),F=oe(!1),S=oe(!1),B=oe(""),W=oe("archived-desc");async function z(){if(!F.value){F.value=!0,S.value=!1;try{const q=[];let ee;for(;;){const fe=await M.loadArchivedSessions({beforeId:ee,pageSize:bSe});if(q.push(...fe.items),!fe.hasMore||fe.items.length===0)break;const ne=fe.items.at(-1)?.id;if(ne===void 0)break;ee=ne}T.value=q,S.value=!0}catch(q){console.warn("loadAllArchived failed",q)}finally{F.value=!1}}}function L(){$.value="archived",B.value="",z()}function O(){$.value="main"}const U=D(()=>{const q=B.value.trim().toLowerCase();let ee=T.value.filter(fe=>fe.archived===!0);return q&&(ee=ee.filter(fe=>fe.title.toLowerCase().includes(q))),ee=ee.slice(),W.value==="archived-desc"?ee.sort((fe,ne)=>ne.updatedAt.localeCompare(fe.updatedAt)):W.value==="created-desc"?ee.sort((fe,ne)=>ne.createdAt.localeCompare(fe.createdAt)):ee.sort((fe,ne)=>fe.title.localeCompare(ne.title,"zh")),ee});async function Z(q){await M.restoreSession(q)&&(T.value=T.value.filter(fe=>fe.id!==q))}function ie(q){const ee=new Date(q);if(Number.isNaN(ee.getTime()))return q;const fe=ne=>String(ne).padStart(2,"0");return`${ee.getFullYear()}-${fe(ee.getMonth()+1)}-${fe(ee.getDate())} ${fe(ee.getHours())}:${fe(ee.getMinutes())}`}return et(()=>o.modelValue,q=>{q||($.value="main")}),(q,ee)=>(x(),Se(iN,{"model-value":e.modelValue,title:C(n)("mobile.settingsTitle"),"onUpdate:modelValue":ee[6]||(ee[6]=fe=>s("update:modelValue",fe))},{default:Ie(()=>[$.value==="main"?(x(),E(We,{key:0},[w("div",m_e,R(C(n)("mobile.groupSession")),1),w("button",{type:"button",class:"srow",onClick:A},[w("span",g_e,[w("span",v_e,R(C(n)("status.statusModel")),1),w("span",y_e,R(e.status.model),1)]),ee[7]||(ee[7]=w("span",{class:"chev"},"›",-1))]),w("div",k_e,[w("span",b_e,[w("span",x_e,R(C(n)("status.statusThinking")),1),a.value==="unsupported"?(x(),E("span",w_e,R(C(n)("status.modeNotSupported")),1)):ue("",!0)]),c.value.length>1?(x(),Se(ys,{key:0,"model-value":d.value,options:f.value,size:"sm","onUpdate:modelValue":v},null,8,["model-value","options"])):(x(),E("span",{key:1,class:Ue(["srow-val",{dim:u.value==="off"}])},R(u.value==="off"?C(n)("status.planOff"):C(hk)(u.value)),3))]),w("div",__e,R(C(n)("status.cacheNote")),1),w("button",{type:"button",class:"srow",onClick:ee[0]||(ee[0]=fe=>s("togglePlan"))},[w("span",S_e,[w("span",C_e,R(C(n)("status.statusPlanMode")),1),w("span",A_e,R(C(n)("mobile.planModeSub")),1)]),w("span",{class:Ue(["toggle",{on:h.value}]),role:"switch","aria-checked":h.value},null,10,M_e)]),w("button",{type:"button",class:"srow",onClick:ee[1]||(ee[1]=fe=>s("toggleSwarm"))},[w("span",E_e,[w("span",T_e,R(C(n)("status.statusSwarmMode")),1),w("span",N_e,R(C(n)("mobile.swarmModeSub")),1)]),w("span",{class:Ue(["toggle",{on:p.value}]),role:"switch","aria-checked":p.value},null,10,I_e)]),w("button",{type:"button",class:"srow",onClick:b},[w("span",L_e,[w("span",$_e,R(C(n)("status.statusPermission")),1),w("span",{class:"srow-sub",style:on({color:m.value})},R(y.value),5)]),ee[8]||(ee[8]=w("span",{class:"chev"},"›",-1))]),w("div",F_e,[w("span",O_e,[w("span",B_e,R(C(n)("status.statusContext")),1),w("span",R_e,R(g.value),1)]),w("span",{class:"ctx-meter","aria-label":g.value},[w("i",{style:on({width:k.value+"%"})},null,4)],8,D_e)]),w("div",P_e,R(C(n)("mobile.groupApp")),1),w("button",{type:"button",class:"srow",onClick:L},[w("span",H_e,[w("span",W_e,R(C(n)("mobile.archivedSessions")),1),w("span",z_e,R(C(n)("mobile.archivedSessionsSub")),1)]),ee[9]||(ee[9]=w("span",{class:"chev"},"›",-1))]),w("div",U_e,[w("span",q_e,[w("span",j_e,R(C(n)("theme.colorSchemeLabel")),1)]),ae(ys,{"model-value":e.colorScheme??"system",options:[{value:"light",label:C(n)("theme.light")},{value:"dark",label:C(n)("theme.dark")},{value:"system",label:C(n)("theme.system")}],"onUpdate:modelValue":i},null,8,["model-value","options"])]),w("div",V_e,[w("span",K_e,[w("span",G_e,R(C(n)("sidebar.language")),1)]),ae(oN)]),w("div",Y_e,[w("span",Z_e,[w("span",X_e,R(C(n)("settings.uiFontSize")),1)]),w("label",Q_e,[w("input",{class:"num-input",type:"number",min:"12",max:"20",step:"1",value:e.uiFontSize,"aria-label":C(n)("settings.uiFontSize"),onInput:ee[2]||(ee[2]=fe=>s("setUiFontSize",Number(fe.target.value)))},null,40,J_e),ee[10]||(ee[10]=w("span",{class:"num-unit"},"px",-1))])]),w("button",{type:"button",class:"srow",onClick:ee[3]||(ee[3]=fe=>s("setConversationToc",!e.conversationToc))},[w("span",eSe,[w("span",tSe,R(C(n)("settings.conversationToc")),1),w("span",nSe,R(C(n)("settings.conversationTocHint")),1)]),w("span",{class:Ue(["toggle",{on:e.conversationToc}]),role:"switch","aria-checked":e.conversationToc},null,10,oSe)]),e.authReady?(x(),E("button",{key:0,type:"button",class:"srow acct out",onClick:N},[w("span",sSe,[w("span",iSe,R(C(n)("sidebar.signOut")),1)])])):(x(),E("button",{key:1,type:"button",class:"srow acct in",onClick:I},[w("span",rSe,[w("span",lSe,R(C(n)("sidebar.signIn")),1)])])),e.serverVersion?(x(),E("div",aSe,[w("span",cSe,[w("span",uSe,R(C(n)("settings.serverVersion")),1)]),w("span",dSe,R(e.serverVersion),1)])):ue("",!0)],64)):(x(),E(We,{key:1},[w("div",fSe,[w("button",{type:"button",class:"arch-back",onClick:O},[ee[11]||(ee[11]=w("span",{class:"chev back"},"‹",-1)),ot(" "+R(C(n)("mobile.archivedBack")),1)]),w("span",hSe,R(C(n)("mobile.sessionCount",{n:U.value.length})),1)]),w("div",pSe,[ae(mu,{class:"arch-search-input","model-value":B.value,size:"sm",placeholder:C(n)("settings.archivedSearch"),"onUpdate:modelValue":ee[4]||(ee[4]=fe=>B.value=fe)},null,8,["model-value","placeholder"]),ae(ys,{size:"sm","model-value":W.value,options:[{value:"archived-desc",label:C(n)("settings.archivedSortArchived")},{value:"created-desc",label:C(n)("settings.archivedSortCreated")},{value:"name-asc",label:C(n)("settings.archivedSortName")}],"onUpdate:modelValue":ee[5]||(ee[5]=fe=>W.value=fe)},null,8,["model-value","options"])]),F.value?(x(),E("div",mSe,R(C(n)("settings.archivedLoadingAll")),1)):U.value.length>0?(x(!0),E(We,{key:1},rt(U.value,fe=>(x(),E("div",{key:fe.id,class:"arch-row"},[w("div",gSe,[w("div",vSe,R(fe.title),1),w("div",ySe,R(C(n)("settings.archivedAt",{time:ie(fe.updatedAt)})),1)]),ae(jt,{variant:"secondary",size:"sm",onClick:ne=>Z(fe.id)},{default:Ie(()=>[ot(R(C(n)("settings.archivedRestore")),1)]),_:1},8,["onClick"])]))),128)):(x(),E("div",kSe,R(T.value.length===0?C(n)("settings.archivedEmpty"):C(n)("settings.archivedNoMatch")),1))],64))]),_:1},8,["model-value","title"]))}}),wSe=dt(xSe,[["__scopeId","data-v-138e1e0a"]]),_Se={class:"ob-brand"},SSe={class:"ob-brand-text"},CSe={class:"ob-title"},ASe={class:"ob-sub"},MSe={class:"ob-sec"},ESe={class:"ob-label"},TSe={class:"ob-sec"},NSe={class:"ob-label"},ISe={class:"ob-sec"},LSe={class:"ob-label"},$Se=Je({__name:"Onboarding",emits:["complete","skip"],setup(e,{emit:t}){const n=t,{t:o,locale:s}=$t(),{colorScheme:i,accent:r,setColorScheme:l,setAccent:a}=vT();function c(d){s.value!==d&&x6(d)}function u(){n("complete")}return(d,f)=>(x(),Se(Qr,{open:!0,size:"md","close-on-overlay":!1,"close-on-esc":!1,onClose:f[3]||(f[3]=h=>n("skip"))},{head:Ie(()=>[w("div",_Se,[f[4]||(f[4]=w("svg",{class:"ob-logo",viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Kimi Code"},[w("defs",null,[w("mask",{id:"obKimiEyes",maskUnits:"userSpaceOnUse"},[w("rect",{x:"0",y:"0",width:"32",height:"22",fill:"#fff"}),w("g",{class:"ob-eyes",fill:"#000"},[w("rect",{class:"ob-eye",x:"11.8",y:"7",width:"2.8",height:"8",rx:"1.4"}),w("rect",{class:"ob-eye",x:"17.4",y:"7",width:"2.8",height:"8",rx:"1.4"})])])]),w("rect",{x:"1",y:"1",width:"30",height:"20",rx:"6",fill:"var(--color-accent)",mask:"url(#obKimiEyes)"})],-1)),w("div",SSe,[w("div",CSe,R(C(o)("onboarding.title")),1),w("div",ASe,R(C(o)("onboarding.subtitle")),1)])])]),default:Ie(()=>[w("section",MSe,[w("div",ESe,R(C(o)("onboarding.languageLabel")),1),ae(ys,{"model-value":C(s),options:C(b6).map(h=>({value:h.code,label:h.label})),"onUpdate:modelValue":f[0]||(f[0]=h=>c(h))},null,8,["model-value","options"])]),w("section",TSe,[w("div",NSe,R(C(o)("theme.colorSchemeLabel")),1),ae(ys,{"model-value":C(i),options:[{value:"light",label:C(o)("theme.light")},{value:"dark",label:C(o)("theme.dark")},{value:"system",label:C(o)("theme.system")}],"onUpdate:modelValue":f[1]||(f[1]=h=>C(l)(h))},null,8,["model-value","options"])]),w("section",ISe,[w("div",LSe,R(C(o)("theme.accentLabel")),1),ae(ys,{"model-value":C(r),options:[{value:"blue",label:C(o)("theme.accentBlue")},{value:"mono",label:C(o)("theme.accentBlack")}],"onUpdate:modelValue":f[2]||(f[2]=h=>C(a)(h))},null,8,["model-value","options"])]),ae(jt,{variant:"primary",size:"lg",class:"ob-start",onClick:u},{default:Ie(()=>[ot(R(C(o)("onboarding.start")),1)]),_:1})]),_:1}))}}),FSe=dt($Se,[["__scopeId","data-v-fbdd3eab"]]),OSe=["aria-label"],BSe={class:"gload-box"},RSe={class:"gload-text"},DSe={key:0,class:"gload-issue"},PSe={class:"gload-issue-detail"},HSe=Je({__name:"GlobalLoading",props:{issue:{}},setup(e){const{t}=$t();return(n,o)=>(x(),E("div",{class:"gload",role:"status","aria-label":C(t)("app.connecting")},[w("div",BSe,[o[0]||(o[0]=qk('<svg class="gload-logo" viewBox="0 0 96 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" data-v-0b6dec6a><path fill="currentColor" d="M35.767 31.329c0 .37.3.671.67.671h4.305c.371 0 .672-.3.672-.671V.67c0-.37-.3-.671-.672-.671h-4.304c-.37 0-.671.3-.671.671z" data-v-0b6dec6a></path><path fill="currentColor" d="M90.353 31.329c0 .37.3.671.67.671h4.305c.371 0 .672-.3.672-.671V.67c0-.37-.3-.671-.672-.671h-4.304a.67.67 0 0 0-.671.671z" data-v-0b6dec6a></path><path fill="currentColor" d="M73.256 0a.67.67 0 0 0-.652.512l-6.366 26.1c-.106.428-.607.428-.71 0L59.159.512A.67.67 0 0 0 58.511 0H47.725c-.37 0-.668.3-.668.671V31.33c0 .37.3.671.67.671h4.781c.37 0 .671-.292.671-.662V5.554c0-.515.604-.622.726-.127l6.358 26.06a.67.67 0 0 0 .653.513h9.931c.31 0 .58-.212.653-.512L77.855 5.43c.122-.495.726-.388.726.127v25.772c0 .37.3.671.671.671h4.78c.371 0 .672-.3.672-.671V.67c0-.37-.3-.671-.671-.671z" data-v-0b6dec6a></path><path fill="currentColor" d="M15.279 14.837 28.264 1.133A.671.671 0 0 0 27.777 0h-6.043a.67.67 0 0 0-.477.199L6.374 15.223c-.231.234-.573.025-.573-.35V.672c0-.37-.3-.671-.671-.671H.67a.67.67 0 0 0-.67.67V31.33c0 .37.3.671.671.671H5.13c.37 0 .671-.3.671-.671v-6.114a.5.5 0 0 1 .13-.35l4.594-4.69a.293.293 0 0 1 .386-.045l12.286 9.305c1.796 1.245 4.083 2.06 6.178 2.401a.645.645 0 0 0 .743-.648v-5.537a.7.7 0 0 0-.562-.677c-1.215-.262-2.565-.758-3.59-1.468L15.332 15.58c-.22-.152-.248-.544-.052-.744" data-v-0b6dec6a></path></svg>',1)),ae(Us,{size:"md",label:C(t)("app.connecting")},null,8,["label"]),w("div",RSe,R(C(t)("app.connecting")),1),e.issue?(x(),E("div",DSe,[w("div",null,R(C(t)("app.connectRetrying")),1),w("div",PSe,R(e.issue),1)])):ue("",!0)])],8,OSe))}}),WSe=dt(HSe,[["__scopeId","data-v-0b6dec6a"]]),zSe={class:"kap-root"},USe={class:"kap-head"},qSe={class:"kap-count"},jSe={class:"kap-head-actions"},VSe={class:"kap-filters"},KSe=["value"],GSe={class:"kap-check"},YSe={class:"kap-check"},ZSe={class:"kap-view-toggle",role:"group"},XSe={key:0,class:"kap-empty"},QSe=["onClick"],JSe={class:"kap-ts"},eCe={class:"kap-label"},tCe={key:0,class:"kap-detail"},nCe={class:"kap-detail-actions"},oCe=["onClick"],sCe={key:1,class:"kap-agg"},iCe={class:"mono"},rCe={class:"mono"},lCe={class:"num"},aCe={class:"num"},cCe={key:0},uCe={class:"mono"},dCe={class:"num"},fCe={class:"num"},hCe={key:0},pCe=Je({__name:"KapDebugView",emits:["close"],setup(e,{emit:t}){const n=t,o=oe("all"),s=oe(""),i=oe(""),r=oe(!1),l=oe("timeline"),a=D(()=>(tb.value,[...Die()])),c=D(()=>{const $=new Set;for(const T of a.value)T.sessionId&&$.add(T.sessionId);return[...$].sort()});function u($){return $.kind==="rest:error"||$.code!==void 0&&$.code!==0||$.eventType==="error"||$.eventType==="parse-error"}const d=D(()=>{const $=s.value.trim().toLowerCase();return a.value.filter(T=>!(o.value!=="all"&&T.source!==o.value||i.value&&T.sessionId!==i.value||r.value&&!u(T)||$&&!`${T.label} ${T.kind} ${T.eventType??""} ${T.sessionId??""} ${T.requestId??""}`.toLowerCase().includes($)))}),f=D(()=>{const $=new Map;for(const T of d.value){if(T.kind!=="ws:in"&&T.kind!=="ws:out")continue;const F=T.kind==="ws:in"?"←":"→",S=`${F} ${T.eventType??"?"} @ ${T.sessionId??"-"}`,B=$.get(S)??{key:S,sessionId:T.sessionId??"-",eventType:T.eventType??"?",dir:F,count:0};B.count++,T.seq!==void 0&&(B.lastSeq=T.seq),$.set(S,B)}return[...$.values()].sort((T,F)=>F.count-T.count)}),h=D(()=>{const $=new Map;for(const T of d.value){if(T.source!=="rest"||T.kind==="rest:request")continue;const F=`${T.method??"?"} ${T.path??"?"}`,S=$.get(F)??{count:0,errors:0,totalMs:0,timed:0};S.count++,u(T)&&S.errors++,T.durationMs!==void 0&&(S.totalMs+=T.durationMs,S.timed++),$.set(F,S)}return[...$.entries()].map(([T,F])=>({key:T,count:F.count,errors:F.errors,avgMs:F.timed>0?Math.round(F.totalMs/F.timed):0})).sort((T,F)=>F.count-T.count)}),p=oe(null),m=oe(!0),y=oe(null),k=oe(null);et(()=>d.value.length,async()=>{if(!m.value||l.value!=="timeline")return;await yt();const $=y.value;$&&($.scrollTop=$.scrollHeight)});function g($){p.value=p.value===$?null:$}function v($){const T=new Date($),F=(S,B=2)=>String(S).padStart(B,"0");return`${F(T.getHours())}:${F(T.getMinutes())}:${F(T.getSeconds())}.${F(T.getMilliseconds(),3)}`}function b($){return JSON.stringify($,null,2)}async function A($){await Jo(b($))&&(k.value=$.id,setTimeout(()=>{k.value===$.id&&(k.value=null)},1500))}function I(){zE(d.value)}function N($){return u($)||$.source==="client"?"b-err":$.source==="rest"?"b-rest":$.kind==="ws:lifecycle"?"b-life":$.kind==="ws:out"?"b-out":"b-in"}function M($){return $.source==="rest"?"REST":$.source==="client"?"APP":"WS"}return($,T)=>(x(),E("section",zSe,[w("header",USe,[T[11]||(T[11]=w("strong",null,"KAP debug",-1)),w("span",qSe,R(d.value.length)+"/"+R(a.value.length),1),w("div",jSe,[w("button",{type:"button",class:Ue({on:C(Nd)}),onClick:T[0]||(T[0]=F=>Nd.value=!C(Nd))},R(C(Nd)?"resume":"pause"),3),w("button",{type:"button",onClick:T[1]||(T[1]=F=>C(Pie)())},"clear"),w("button",{type:"button",onClick:T[2]||(T[2]=F=>I())},"export jsonl"),ae(an,{text:"Close window"},{default:Ie(()=>[w("button",{type:"button",onClick:T[3]||(T[3]=F=>n("close"))},"✕")]),_:1})])]),w("div",VSe,[qn(w("select",{"onUpdate:modelValue":T[4]||(T[4]=F=>o.value=F),"aria-label":"Source filter"},[...T[12]||(T[12]=[w("option",{value:"all"},"rest + ws + app",-1),w("option",{value:"rest"},"rest",-1),w("option",{value:"ws"},"ws",-1),w("option",{value:"client"},"app errors",-1)])],512),[[cy,o.value]]),qn(w("select",{"onUpdate:modelValue":T[5]||(T[5]=F=>i.value=F),"aria-label":"Session filter"},[T[13]||(T[13]=w("option",{value:""},"all sessions",-1)),(x(!0),E(We,null,rt(c.value,F=>(x(),E("option",{key:F,value:F},R(F),9,KSe))),128))],512),[[cy,i.value]]),qn(w("input",{"onUpdate:modelValue":T[6]||(T[6]=F=>s.value=F),type:"text",placeholder:"filter (type / path / id)","aria-label":"Text filter"},null,512),[[Cs,s.value]]),w("label",GSe,[qn(w("input",{"onUpdate:modelValue":T[7]||(T[7]=F=>r.value=F),type:"checkbox"},null,512),[[um,r.value]]),T[14]||(T[14]=ot(" errors",-1))]),w("label",YSe,[qn(w("input",{"onUpdate:modelValue":T[8]||(T[8]=F=>m.value=F),type:"checkbox"},null,512),[[um,m.value]]),T[15]||(T[15]=ot(" follow",-1))]),w("div",ZSe,[w("button",{type:"button",class:Ue({on:l.value==="timeline"}),onClick:T[9]||(T[9]=F=>l.value="timeline")},"timeline",2),w("button",{type:"button",class:Ue({on:l.value==="aggregate"}),onClick:T[10]||(T[10]=F=>l.value="aggregate")},"aggregate",2)])]),l.value==="timeline"?(x(),E("div",{key:0,ref_key:"listRef",ref:y,class:"kap-list"},[d.value.length===0?(x(),E("div",XSe," No trace entries yet. REST calls and WS frames will appear here. ")):ue("",!0),(x(!0),E(We,null,rt(d.value,F=>(x(),E("div",{key:F.id,class:"kap-row-wrap"},[w("button",{type:"button",class:Ue(["kap-row",{expanded:p.value===F.id}]),onClick:S=>g(F.id)},[w("span",JSe,R(v(F.ts)),1),w("span",{class:Ue(["kap-badge",N(F)])},R(M(F)),3),w("span",eCe,R(F.label),1)],10,QSe),p.value===F.id?(x(),E("div",tCe,[w("div",nCe,[w("button",{type:"button",onClick:S=>A(F)},R(k.value===F.id?"copied ✓":"copy json"),9,oCe)]),w("pre",null,R(b(F)),1)])):ue("",!0)]))),128))],512)):(x(),E("div",sCe,[T[20]||(T[20]=w("h4",null,"WS frames by session / type",-1)),w("table",null,[T[17]||(T[17]=w("thead",null,[w("tr",null,[w("th",null,"dir"),w("th",null,"type"),w("th",null,"session"),w("th",null,"count"),w("th",null,"last seq")])],-1)),w("tbody",null,[(x(!0),E(We,null,rt(f.value,F=>(x(),E("tr",{key:F.key},[w("td",null,R(F.dir),1),w("td",iCe,R(F.eventType),1),w("td",rCe,R(F.sessionId),1),w("td",lCe,R(F.count),1),w("td",aCe,R(F.lastSeq??"—"),1)]))),128)),f.value.length===0?(x(),E("tr",cCe,[...T[16]||(T[16]=[w("td",{colspan:"5",class:"kap-empty"},"no ws frames",-1)])])):ue("",!0)])]),T[21]||(T[21]=w("h4",null,"REST by endpoint",-1)),w("table",null,[T[19]||(T[19]=w("thead",null,[w("tr",null,[w("th",null,"endpoint"),w("th",null,"count"),w("th",null,"errors"),w("th",null,"avg ms")])],-1)),w("tbody",null,[(x(!0),E(We,null,rt(h.value,F=>(x(),E("tr",{key:F.key},[w("td",uCe,R(F.key),1),w("td",dCe,R(F.count),1),w("td",{class:Ue(["num",{err:F.errors>0}])},R(F.errors),3),w("td",fCe,R(F.avgMs),1)]))),128)),h.value.length===0?(x(),E("tr",hCe,[...T[18]||(T[18]=[w("td",{colspan:"4",class:"kap-empty"},"no rest calls",-1)])])):ue("",!0)])])]))]))}}),mCe=dt(pCe,[["__scopeId","data-v-3cda6fe3"]]),gCe=Je({__name:"DebugPanel",setup(e){const t=oe(!1);let n=null,o=null,s=null;const i=["data-color-scheme","data-accent"];function r(u){const d=document.documentElement,f=u.documentElement;for(const h of i){const p=d.getAttribute(h);p!==null?f.setAttribute(h,p):f.removeAttribute(h)}}function l(u){const d=u.document;d.title="KAP debug";const f=d.createElement("base");f.href=location.href,d.head.appendChild(f);for(const p of Array.from(document.querySelectorAll('style, link[rel="stylesheet"]')))d.head.appendChild(p.cloneNode(!0));r(d),d.body.style.margin="0";const h=d.createElement("div");return h.style.height="100vh",d.body.appendChild(h),h}function a(){s?.disconnect(),s=null;try{o?.unmount()}catch{}o=null,n=null,t.value=!1}function c(){if(n&&!n.closed){n.focus();return}const u=window.open("","kap-debug","popup=yes,width=1040,height=760");if(!u)return;n=u;const d=l(u),f=dm(mCe,{onClose:()=>u.close()});f.mount(d),o=f,t.value=!0,s=new MutationObserver(()=>{n&&!n.closed&&r(n.document)}),s.observe(document.documentElement,{attributes:!0,attributeFilter:[...i]}),u.addEventListener("pagehide",a),u.addEventListener("beforeunload",a)}return An(()=>{c()}),ho(()=>{n&&!n.closed&&n.close(),a()}),(u,d)=>(x(),Se(an,{text:t.value?"Focus KAP debug window":"Open KAP debug window"},{default:Ie(()=>[w("button",{class:"kap-fab",type:"button",onClick:c}," KAP ")]),_:1},8,["text"]))}}),vCe=dt(gCe,[["__scopeId","data-v-21346738"]]);function yCe({client:e,authLogoRef:t}){const n=D(()=>e.authReady.value),o=D(()=>e.initialized.value&&!n.value),s="/login",i=oe(null);let r=null;function l(){return typeof window>"u"?"/":`${window.location.pathname}${window.location.search}${window.location.hash}`}function a(u){typeof window>"u"||window.history.replaceState(window.history.state,"",u)}et(o,u=>{if(!(typeof window>"u")){if(u){window.location.pathname!==s&&(i.value=l(),a(s));return}window.location.pathname===s&&(a(i.value??"/"),i.value=null)}},{immediate:!0});function c(){const u=t.value;u&&(u.classList.remove("blink-now"),u.getBoundingClientRect(),u.classList.add("blink-now"),r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,u.classList.remove("blink-now")},300))}return On(()=>{r!==null&&clearTimeout(r)}),{showAuthGate:o,blinkAuthLogo:c}}function kCe({running:e,showAuthGate:t}){const{t:n}=$t(),o=["◐","◓","◑","◒"],s=oe(0);let i=null;function r(){i===null&&(s.value=0,i=setInterval(()=>{s.value=(s.value+1)%o.length},250))}function l(){i!==null&&(clearInterval(i),i=null),s.value=0}et(e,c=>{c?r():l()},{immediate:!0});const a=D(()=>{const c=e.value?`${o[s.value]} `:"";return t.value?`${c}${n("app.authPageTitle")} - Kimi Code Web`:`${c}Kimi Code Web`});DA(()=>{typeof document<"u"&&(document.title=a.value)}),On(()=>{l()})}const rN=oe(typeof window>"u"?0:window.innerWidth);let bp=0,l1=!1;function Ck(){rN.value=window.innerWidth}function bCe(){l1||typeof window>"u"||(window.addEventListener("resize",Ck),l1=!0,Ck())}function xCe(){!l1||typeof window>"u"||(window.removeEventListener("resize",Ck),l1=!1)}function lN(e,t,n){return Math.max(t,e-n)}function Ak(e,t,n){return Math.min(n,Math.max(t,e))}function aN(){return An(()=>{bp+=1,bCe()}),ho(()=>{bp=Math.max(0,bp-1),bp===0&&xCe()}),{viewportWidth:rN}}const wCe="kimi-web.file-preview-width",zc=320;function _Ce({client:e,sideWidth:t,detailTarget:n,closeFilePreview:o}){const{viewportWidth:s}=aN(),i=D(()=>Math.max(0,s.value-t.value)),r=D(()=>lN(i.value,zc,zc));function l(Q){return Ak(Math.round(Q),zc,r.value)}function a(){return l(i.value/2)}const c=D(()=>a()),u=oe(c.value),d=D(()=>Ak(u.value,zc,r.value)),f=oe(null),h=D(()=>{const Q=f.value;if(!Q)return null;const G=e.turns.value.find(me=>me.id===Q.turnId)?.blocks?.[Q.blockIndex];return G?.kind==="thinking"?G.thinking:null}),p=D(()=>h.value!==null);function m(Q){const P=f.value;if(P&&P.turnId===Q.turnId&&P.blockIndex===Q.blockIndex){f.value=null,n.value==="thinking"&&(n.value=null);return}n.value="thinking",f.value=Q}function y(){f.value=null,n.value==="thinking"&&(n.value=null)}const k=oe(null),g=D(()=>{const Q=k.value;if(!Q)return null;const P=e.turns.value.find(G=>G.id===Q.turnId);return P?.role==="compaction"&&P.text?P.text:null}),v=D(()=>g.value!==null);function b(Q){if(k.value?.turnId===Q.turnId){k.value=null,n.value==="compaction"&&(n.value=null);return}n.value="compaction",k.value=Q}function A(){k.value=null,n.value==="compaction"&&(n.value=null)}const I=oe(null);function N(Q){const P=e.activeAppTasks.value,G=P.find(ye=>ye.id===Q)??P.find(ye=>ye.parentToolCallId===Q);if(G)return G.id;const me=P.filter(ye=>ye.kind==="subagent"&&!ye.parentToolCallId);if(me.length===1)return me[0].id}const M=D(()=>{const Q=I.value;if(!Q)return null;const P=e.activeAppTasks.value.find(G=>G.id===Q.subagentId);return P?Jve(P):null}),$=D(()=>M.value!==null);function T(Q){const P=N(Q);if(P){if(I.value?.subagentId===P){I.value=null,n.value==="agent"&&(n.value=null);return}I.value={subagentId:P},n.value="agent"}}function F(){I.value=null,n.value==="agent"&&(n.value=null)}const S=oe(null),B=D(()=>{const Q=S.value;if(!Q)return null;const P=pU(e.turns.value,Q);return P?{id:Q,title:ec(P.name),path:hU(P.arg),lines:P.status==="error"?null:S6(P),output:P.output}:null}),W=D(()=>B.value!==null);function z(Q){if(n.value==="toolDiff"&&S.value===Q){L();return}n.value="toolDiff",S.value=Q}function L(){S.value=null,n.value==="toolDiff"&&(n.value=null)}const O=oe("list"),U=oe(null);function Z(){if(n.value==="diff"){ie();return}n.value="diff",O.value="list",U.value=null,e.loadGitStatus(e.activeSessionId.value)}function ie(){n.value==="diff"&&(n.value=null),O.value="list",U.value=null,e.clearFileDiff()}async function q(Q){O.value="detail",U.value=Q,await e.loadFileDiff(Q)}async function ee(Q){!e.activeSessionId.value&&e.activeWorkspaceId.value?await e.startSessionAndOpenSideChat(e.activeWorkspaceId.value,Q):await e.openSideChat(Q),n.value="btw"}function fe(){e.closeSideChat(),n.value==="btw"&&(n.value=null)}function ne(){n.value==="btw"&&(n.value=null)}const j=D(()=>e.sideChatVisible.value),K=D(()=>n.value!==null&&(n.value!=="thinking"||p.value)&&(n.value!=="compaction"||v.value)&&(n.value!=="agent"||$.value)&&(n.value!=="toolDiff"||W.value)&&(n.value!=="btw"||j.value)),ve=oe(!1),he=oe({});function Ae(){switch(n.value){case"thinking":return f.value?{kind:"thinking",...f.value}:null;case"compaction":return k.value?{kind:"compaction",...k.value}:null;case"agent":return I.value?{kind:"agent",...I.value}:null;case"toolDiff":return S.value?{kind:"toolDiff",toolId:S.value}:null;case"btw":return{kind:"btw"};default:return null}}function re(Q){if(Q)switch(Q.kind){case"thinking":f.value={turnId:Q.turnId,blockIndex:Q.blockIndex},n.value="thinking";break;case"compaction":k.value={turnId:Q.turnId},n.value="compaction";break;case"agent":I.value={subagentId:Q.subagentId},n.value="agent";break;case"toolDiff":S.value=Q.toolId,n.value="toolDiff";break;case"btw":e.sideChatVisible.value&&(n.value="btw");break}}function Y(){return n.value==="thinking"&&p.value?(y(),!0):n.value==="compaction"&&v.value?(A(),!0):n.value==="agent"&&$.value?(F(),!0):n.value==="toolDiff"&&W.value?(L(),!0):n.value==="file"?(o(),!0):n.value==="diff"?(ie(),!0):n.value==="btw"?(fe(),!0):!1}return et(e.activeSessionId,(Q,P)=>{if(P){const G=Ae();G?he.value[P]=G:delete he.value[P]}o(),y(),A(),F(),L(),ie(),ne(),Q&&re(he.value[Q])}),{PREVIEW_WIDTH_KEY:wCe,PREVIEW_MIN:zc,previewDefaultWidth:c,previewMax:r,previewWidth:u,previewPanelWidth:d,thinkingPanelText:h,thinkingVisible:p,openThinkingPanel:m,closeThinkingPanel:y,compactionPanelText:g,compactionPanelVisible:v,openCompactionPanel:b,closeCompactionPanel:A,agentPanelMember:M,agentPanelVisible:$,openAgentPanel:T,closeAgentPanel:F,toolDiffTarget:B,toolDiffVisible:W,openToolDiff:z,closeToolDiff:L,detailDiffMode:O,detailDiffPath:U,openDiffDetail:Z,closeDiffDetail:ie,selectDiffFile:q,btwVisible:j,openSideChatTab:ee,closeSideChat:fe,hideSideChatPanel:ne,sidePanelVisible:K,panelDragging:ve,closeOpenSidePanel:Y}}const SCe=Dt.sidebarWidth,iA=Dt.sidebarCollapsed,rA=270,qv=170,CCe=480,ACe=320;function MCe(e={}){const{viewportWidth:t}=aN(),n=oe(rA),o=oe(!1),s=oe(!1),i=D(()=>{const u=ACe+(NA(e.previewOpen)?zc:0);return Math.min(CCe,lN(t.value,qv,u))}),r=D(()=>Ak(n.value,qv,i.value));function l(){try{o.value=yo(iA)==="true"}catch{o.value=!1}}function a(){try{Eo(iA,String(o.value))}catch{}}function c(){o.value=!o.value,a()}return{SIDEBAR_WIDTH_KEY:SCe,SIDEBAR_DEFAULT:rA,SIDEBAR_MIN:qv,sidebarMax:i,sessionColWidth:n,sidebarCollapsed:o,sidebarDragging:s,sideWidth:r,loadSidebarCollapsed:l,toggleSidebarCollapse:c}}function ECe(e){return/^(?:https?:|blob:|data:)/i.test(e)}function TCe({client:e,detailTarget:t}){const{t:n}=$t(),o=oe(null),s=oe(null),i=oe(!1),r=oe(null),l=oe(null);let a=0,c=null;function u(){c!==null&&(URL.revokeObjectURL(c),c=null)}const d=D(()=>{const N=l.value;return N?e.getFileDownloadUrl(N):null}),f=D(()=>o.value!==null);function h(N){return N.length>1?N.replace(/\/+$/,""):N}function p(N){const M=[];for(const $ of N.split(/[\\/]+/))if(!(!$||$===".")){if($===".."){M.pop();continue}M.push($)}return M.join("/")}function m(N){const M=N.trim();if(!M)return{error:n("filePreview.errors.emptyPath")};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(M))return{error:n("filePreview.errors.unsupportedPath")};if(M.startsWith("~"))return{error:n("filePreview.errors.outsideWorkspace")};const $=h(e.status.value.cwd);if(M.startsWith("/")){if(!$||M!==$&&!M.startsWith(`${$}/`))return{error:n("filePreview.errors.outsideWorkspace")};const F=M===$?"":M.slice($.length+1);if(F.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const S=p(F);return S?{path:S}:{error:n("filePreview.errors.isDirectory")}}if(M.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const T=p(M);return T?{path:T}:{error:n("filePreview.errors.emptyPath")}}async function y(N){const M=o.value;if(t.value==="file"&&M&&M.path===N.path&&M.line===N.line){b();return}const $=++a;u(),t.value="file",s.value=null,r.value=null,i.value=!0,o.value=N,l.value=null;const T=m(N.path);if("error"in T){i.value=!1,r.value=T.error;return}l.value=T.path;try{const F=await e.readFileContent(T.path);if($!==a)return;F?s.value={...F,path:F.path||T.path}:r.value=n("filePreview.errors.loadFailed")}catch(F){if($!==a)return;r.value=F instanceof Error?F.message:n("filePreview.errors.loadFailed")}finally{$===a&&(i.value=!1)}}function k(N){return/^data:([^;,]+)/i.exec(N)?.[1]}function g(N){if(N.kind!=="image"&&N.kind!=="video")return;const M=++a;u(),t.value="file",o.value=null,l.value=null,r.value=null;const $=N.kind==="video",T={path:N.path??($?"Video":"ReadMediaFile image"),content:"",encoding:"utf-8",mime:N.mimeType??k(N.url)??($?"video/*":"image/*"),isBinary:!0,size:N.bytes??0};N.fileId?(i.value=!0,s.value=T,ht().getFileBlob(N.fileId).then(F=>{if(M===a){if(t.value!=="file"||!s.value){i.value=!1;return}c=URL.createObjectURL(F),s.value={...s.value,sourceUrl:c},i.value=!1}}).catch(()=>{M===a&&(s.value&&(s.value={...s.value,sourceUrl:N.url}),i.value=!1)})):(i.value=!1,s.value=ECe(N.url)?{...T,sourceUrl:N.url}:T)}function v(){a+=1,o.value=null,l.value=null,s.value=null,r.value=null,i.value=!1,u()}function b(){v(),t.value==="file"&&(t.value=null)}et(t,(N,M)=>{M==="file"&&N!=="file"&&v()});function A(){const N=s.value?.path??o.value?.path;N&&e.openWorkspaceFile(N,o.value?.line)}function I(){const N=s.value?.path??o.value?.path;N&&e.revealWorkspaceFile(N)}return{previewTarget:o,previewFile:s,previewLoading:i,previewError:r,previewDownloadUrl:d,previewExternalActions:f,openFilePreview:y,openMediaPreview:g,closeFilePreview:b,openPreviewInEditor:A,revealPreviewFile:I}}const NCe=640,ICe=`(max-width: ${NCe}px)`;function LCe(){const e=oe(!1);if(typeof window>"u"||typeof window.matchMedia!="function")return e;const t=window.matchMedia(ICe);e.value=t.matches;const n=o=>{e.value=o.matches};return typeof t.addEventListener=="function"?(t.addEventListener("change",n),On(()=>t.removeEventListener("change",n))):typeof t.addListener=="function"&&(t.addListener(n),On(()=>t.removeListener(n))),e}const $Ce={class:"server-auth-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"server-auth-title"},FCe={class:"server-auth-card"},OCe={class:"server-auth-body"},BCe={class:"server-auth-foot"},RCe=Je({__name:"ServerAuthDialog",setup(e){const t=oe(""),n=oe(null),o=oe(!1);An(()=>{yt(()=>n.value?.focus())});function s(){const r=t.value;!r||o.value||(o.value=!0,GE(r),window.location.reload())}function i(r){r.key==="Enter"&&(r.preventDefault(),s())}return(r,l)=>(x(),E("div",$Ce,[w("div",FCe,[l[1]||(l[1]=w("div",{class:"server-auth-head"},[w("h1",{id:"server-auth-title",class:"server-auth-title"},"Server token required"),w("p",{class:"server-auth-hint"},[ot(" This server is protected. Enter the bearer token printed when the server started (or the password set via "),w("code",null,"KIMI_CODE_PASSWORD"),ot("). ")])],-1)),w("div",OCe,[ae(mu,{ref_key:"inputRef",ref:n,modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=a=>t.value=a),type:"password",autocomplete:"current-password",placeholder:"Token",disabled:o.value,onKeydown:i},null,8,["modelValue","disabled"])]),w("div",BCe,[ae(jt,{variant:"primary",disabled:!t.value||o.value,loading:o.value,onClick:s},{default:Ie(()=>[ot(R(o.value?"Connecting…":"Connect"),1)]),_:1},8,["disabled","loading"])])])]))}}),DCe=dt(RCe,[["__scopeId","data-v-6f624612"]]),PCe=["aria-label"],HCe=Je({__name:"InternalBuildBanner",setup(e){const{t}=$t(),n=IH;return(o,s)=>C(n)?(x(),E("span",{key:0,class:"internal-build-tag",role:"note","aria-label":C(t)("app.internalBuildBanner")},[s[0]||(s[0]=w("svg",{viewBox:"0 0 16 16",width:"11",height:"11",fill:"none",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[w("path",{d:"M8 2 14 13H2L8 2Z"}),w("path",{d:"M8 6v3.5"}),w("path",{d:"M8 11.5h.01"})],-1)),w("span",null,R(C(t)("app.internalBuildBanner")),1)],8,PCe)):ue("",!0)}}),WCe=dt(HCe,[["__scopeId","data-v-166b3735"]]),zCe={class:"app-shell"},UCe={key:1,class:"auth-page"},qCe={class:"auth-page-inner"},jCe={class:"auth-page-copy"},VCe=["aria-label","aria-hidden"],KCe=Je({__name:"App",setup(e){Nre();const t=oe(!1);let n=null;const o=Pb(),s=D(()=>!o.dangerousBypassAuth.value&&t.value);Ln("resolveImage",o.resolveImageUrl),Ln("resolveSwarmMembers",Re=>o.swarmMembersByToolCallId.value.get(Re)??[]);const{t:i}=$t(),{confirm:r}=Gf(),l=Yi(),a=LCe(),c=oe(!1),u=oe(!1),d=D(()=>{const Re=o.activeSessionId.value;return o.sessions.value.find(le=>le.id===Re)?.title??""}),f=D(()=>o.visibleWorkspace.value?.sessionCount??0),h=D(()=>o.activity.value!=="idle"),p=oe(null),{showAuthGate:m,blinkAuthLogo:y}=yCe({client:o,authLogoRef:p});kCe({running:h,showAuthGate:m});function k(Re){const le=o.models.value.find(ze=>ze.id===o.status.value.modelId),Te=s0(le),ge=Te.indexOf(Xm(le,Re)),Ee=Te[(ge+1)%Te.length]??Te[0]??"off";return hb(le,Ee)}const g=D(()=>{const Re=o.models.value.find(le=>le.id===o.status.value.modelId);return Xm(Re,o.thinking.value)}),v=oe(!o.onboarded.value);function b(){o.setOnboarded(!0),v.value=!1}function A(){v.value=!0}let I=0;function N(){const Re=window.visualViewport,le=document.documentElement.style;le.setProperty("--app-height",`${Re?.height??window.innerHeight}px`),le.setProperty("--app-top",`${Re?.offsetTop??0}px`)}function M(){I||(I=requestAnimationFrame(()=>{I=0,N()}))}An(()=>{n=$re(()=>{t.value=!0,o.clearDangerousBypassAuth()}),o.load(),Q(),N(),window.visualViewport?.addEventListener("resize",M),window.visualViewport?.addEventListener("scroll",M),window.addEventListener("resize",M),document.addEventListener("keydown",$,!0)}),On(()=>{document.removeEventListener("keydown",$,!0),window.visualViewport?.removeEventListener("resize",M),window.visualViewport?.removeEventListener("scroll",M),window.removeEventListener("resize",M),I&&(cancelAnimationFrame(I),I=0),document.documentElement.style.removeProperty("--app-height"),document.documentElement.style.removeProperty("--app-top"),n!==null&&(n(),n=null)});function $(Re){Re.key==="Escape"&&(Be.value||so()&&(Re.stopPropagation(),Re.preventDefault()))}const T=oe(null),F=oe(!1);et(o.activeSessionId,()=>{F.value=!0,yt(()=>{F.value=!1})});const{previewTarget:S,previewFile:B,previewLoading:W,previewError:z,previewDownloadUrl:L,previewExternalActions:O,openFilePreview:U,openMediaPreview:Z,closeFilePreview:ie,openPreviewInEditor:q,revealPreviewFile:ee}=TCe({client:o,detailTarget:T}),fe=D(()=>T.value!==null),{SIDEBAR_WIDTH_KEY:ne,SIDEBAR_DEFAULT:j,SIDEBAR_MIN:K,sidebarMax:ve,sessionColWidth:he,sidebarCollapsed:Ae,sidebarDragging:re,sideWidth:Y,loadSidebarCollapsed:Q,toggleSidebarCollapse:P}=MCe({previewOpen:fe}),{PREVIEW_WIDTH_KEY:G,PREVIEW_MIN:me,previewDefaultWidth:ye,previewMax:de,previewWidth:V,previewPanelWidth:se,thinkingPanelText:pe,thinkingVisible:ke,openThinkingPanel:Ne,closeThinkingPanel:qe,compactionPanelText:be,compactionPanelVisible:xe,openCompactionPanel:Ze,closeCompactionPanel:tt,agentPanelMember:lt,openAgentPanel:ut,closeAgentPanel:mt,toolDiffTarget:Tt,openToolDiff:wt,closeToolDiff:Ft,detailDiffMode:en,detailDiffPath:Hn,openDiffDetail:Pt,closeDiffDetail:bn,selectDiffFile:pn,btwVisible:Kt,openSideChatTab:Nn,closeSideChat:Gt,sidePanelVisible:Wt,panelDragging:mn,closeOpenSidePanel:so}=_Ce({client:o,sideWidth:Y,detailTarget:T,closeFilePreview:ie}),gn=oe(null),to=oe(!1),vt=oe(!1),Wn=oe(!1),Bn=oe(!1),Qn=oe(!1),sn=oe(!1),es=oe(null),nt=oe(null),Be=D(()=>Rc.value>0||to.value||vt.value||Wn.value||Bn.value||Qn.value||sn.value||v.value||c.value||u.value),Bt=oe(!1),Yt=oe(!1),vn=oe(!1),xn=oe(!1),nn=oe(!1);async function Vn(){Bt.value=!0,Yt.value=!1,to.value=!0;try{await o.refreshAllProviders()}catch{Yt.value=!0}finally{Bt.value=!1}}async function Kn(){vn.value=!0,xn.value=!1,vt.value=!0;try{await o.loadProviders()}catch{xn.value=!0}finally{vn.value=!1}}function Jn(){Wn.value=!0}async function Oo(Re){to.value=!1,await ko(Re)}async function ko(Re){await o.setModel(Re)&&Re!==o.defaultModel.value&&o.updateConfig({defaultModel:Re})}async function li(Re){await o.addProvider(Re)}async function Uo(Re){await o.refreshProvider(Re)}async function As(Re){await r({title:i("sidebar.archive"),message:i("sidebar.archiveConfirm"),variant:"danger",action:()=>o.archiveSession(Re)})}async function cs(Re){const le=o.workspacesView.value.find(Te=>Te.id===Re)?.name??Re;await r({title:i("sidebar.removeWorkspace"),message:i("workspace.removeWorkspaceConfirm",{name:le}),variant:"danger",action:()=>o.deleteWorkspace(Re)})}async function qo(Re){await r({title:i("providers.delete"),message:i("providers.confirmDelete"),variant:"danger",action:()=>o.deleteProvider(Re)})}async function Bo(Re){nn.value=!0;try{await o.updateConfig(Re)&&await o.checkAuth()}finally{nn.value=!1}}async function ai(){return o.startOAuthLogin()}async function tn(){return o.pollOAuthLogin()}async function qs(){return o.cancelOAuthLogin()}async function io(){Wn.value=!1,await o.checkAuth(),await o.load()}async function js(Re){await o.undo(1),await yt(),gn.value?.loadComposerForEdit(Re.text,Re.attachments)}function ci(Re){if(Re==="/compact"||Re.startsWith("/compact ")){o.compact(Re.slice(8).trim()||void 0);return}if(Re==="/swarm"||Re.startsWith("/swarm ")){const le=Re.slice(6).trim();le==="on"?o.setSwarmMode(!0):le==="off"?o.setSwarmMode(!1):le?(o.setSwarmMode(!0),o.sendPrompt(le)):o.toggleSwarmMode();return}if(Re==="/goal"||Re.startsWith("/goal ")){const le=Re.slice(5).trim();le==="pause"||le==="resume"||le==="cancel"?o.controlGoal(le):le?o.createGoal(le):o.toggleGoalMode();return}if(Re==="/btw"||Re.startsWith("/btw ")){const le=Re.slice(4).trim();!le&&o.sideChatVisible.value?Gt():Nn(le||void 0);return}switch(Re){case"/new":case"/clear":No();break;case"/fork":o.forkSession();break;case"/export":o.exportSession();break;case"/undo":o.undo();break;case"/plan":o.togglePlanMode();break;case"/auto":o.setPermission("auto");break;case"/yolo":o.setPermission("yolo");break;case"/thinking":o.setThinking(k(o.thinking.value));break;case"/status":Qn.value=!0;break;case"/login":Jn();break;default:{const le=Re.indexOf(" "),Te=pue((le===-1?Re:Re.slice(0,le)).slice(1)),ge=le===-1?void 0:Re.slice(le+1).trim()||void 0;if(!Te)break;!o.activeSessionId.value&&o.activeWorkspaceId.value?o.startSessionAndActivateSkill(o.activeWorkspaceId.value,Te,ge):o.activateSkill(Te,ge);break}}}function Ni(Re){o.unqueue(Re)}function ui(Re){o.unqueue(Re)}function Vs(Re){o.reorderQueue(Re.from,Re.to)}async function ts(Re){const le=o.activeWorkspaceId.value;if(!o.activeSessionId.value&&le){await o.startSessionAndSendPrompt(le,Re.text,Re.attachments);return}if(!o.activeSessionId.value&&!le){es.value=Re,Bn.value=!0;return}o.sendPrompt(Re.text,Re.attachments)}async function ns(Re){if(nt.value=null,!await o.addWorkspaceByPath(Re)){nt.value=i("workspace.addFailed");return}Bn.value=!1;const Te=es.value;es.value=null;const ge=o.activeWorkspaceId.value;Te&&ge&&await o.startSessionAndSendPrompt(ge,Te.text,Te.attachments)}function zt(){es.value=null,nt.value=null,Bn.value=!1}function Ms(){yt(()=>{gn.value?.focusComposer()})}function No(){const Re=o.activeWorkspaceId.value;Re?o.openWorkspaceDraft(Re):o.clearActiveSession(),Ms()}function di(Re){o.openWorkspaceDraft(Re),Ms()}function Ke(Re){Re&&window.open(Re,"_blank","noopener")}return(Re,le)=>(x(),E("div",zCe,[s.value?(x(),Se(DCe,{key:0})):ue("",!0),C(m)?(x(),E("section",UCe,[w("div",qCe,[(x(),E("svg",{ref_key:"authLogoRef",ref:p,class:"auth-page-logo ch-logo",viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Kimi Code",onMousedown:le[0]||(le[0]=St(()=>{},["prevent"])),onClick:le[1]||(le[1]=(...Te)=>C(y)&&C(y)(...Te))},[...le[98]||(le[98]=[qk('<defs data-v-8cd3196b><mask id="authKimiEyes" maskUnits="userSpaceOnUse" data-v-8cd3196b><rect x="0" y="0" width="32" height="22" fill="#fff" data-v-8cd3196b></rect><g class="ch-eyes" fill="#000" data-v-8cd3196b><rect class="ch-eye" x="11.8" y="7" width="2.8" height="8" rx="1.4" data-v-8cd3196b></rect><rect class="ch-eye" x="17.4" y="7" width="2.8" height="8" rx="1.4" data-v-8cd3196b></rect></g></mask></defs><rect x="1" y="1" width="30" height="20" rx="6" fill="var(--logo)" mask="url(#authKimiEyes)" data-v-8cd3196b></rect>',2)])],544)),w("div",jCe,[w("h1",null,R(C(i)("app.authPageTitle")),1),w("p",null,R(C(i)("app.authPageMessage")),1)]),ae(jt,{class:"auth-page-btn",variant:"primary",onClick:Jn},{default:Ie(()=>[ae(Ge,{name:"log-in",size:"md"}),w("span",null,R(C(i)("app.authPageLogin")),1)]),_:1})])])):(x(),E("div",{key:2,class:Ue(["app",{mobile:C(a),"sidebar-collapsed":C(Ae)&&!C(a),"macos-desktop":C(iu)}]),style:on({"--preview-w":C(se)+"px"})},[C(a)?(x(),Se(jwe,{key:1,workspace:C(o).visibleWorkspace.value,"session-title":d.value,running:h.value,branch:C(o).status.value.branch,"session-count":f.value,onOpenSwitcher:le[19]||(le[19]=Te=>c.value=!0),onOpenSettings:le[20]||(le[20]=Te=>u.value=!0)},null,8,["workspace","session-title","running","branch","session-count"])):(x(),E(We,{key:0},[ae(eW,{collapsed:C(Ae),dragging:C(re),"col-width":C(Y),"active-workspace":C(o).visibleWorkspace.value,"active-workspace-id":C(o).activeWorkspaceId.value,sessions:C(o).sessionsForView.value,groups:C(o).workspaceGroups.value,"active-id":C(o).activeSessionId.value,"attention-by-session":C(o).attentionBySession.value,"pending-by-session":C(o).pendingBySession.value,"unread-by-session":C(o).unreadBySession.value,"workspace-sort-mode":C(o).workspaceSortMode.value,backend:C(o).backend.value,onSelect:le[2]||(le[2]=Te=>C(o).selectSession(Te)),onCreate:No,onCreateInWorkspace:le[3]||(le[3]=Te=>di(Te)),onSelectWorkspace:le[4]||(le[4]=Te=>C(o).openWorkspace(Te)),onAddWorkspace:le[5]||(le[5]=Te=>Bn.value=!0),onRename:le[6]||(le[6]=(Te,ge)=>C(o).renameSession(Te,ge)),onArchive:le[7]||(le[7]=Te=>As(Te)),onFork:le[8]||(le[8]=Te=>C(o).forkSession(Te)),onExport:le[9]||(le[9]=Te=>C(o).exportSession(Te)),onRenameWorkspace:le[10]||(le[10]=(Te,ge)=>C(o).renameWorkspace(Te,ge)),onDeleteWorkspace:le[11]||(le[11]=Te=>cs(Te)),onReorderWorkspaces:le[12]||(le[12]=Te=>C(o).reorderWorkspaces(Te)),onSetWorkspaceSortMode:le[13]||(le[13]=Te=>C(o).setWorkspaceSortMode(Te)),onLoadMoreSessions:le[14]||(le[14]=Te=>void C(o).loadMoreSessions(Te)),onLoadAllSessions:le[15]||(le[15]=Te=>void C(o).loadAllSessions()),onOpenSettings:le[16]||(le[16]=Te=>sn.value=!0),onCollapse:C(P)},null,8,["collapsed","dragging","col-width","active-workspace","active-workspace-id","sessions","groups","active-id","attention-by-session","pending-by-session","unread-by-session","workspace-sort-mode","backend","onCollapse"]),qn(ae(H_,{class:"side-handle","storage-key":C(ne),"default-width":C(j),min:C(K),max:C(ve),"onUpdate:width":le[17]||(le[17]=Te=>he.value=Te),"onUpdate:dragging":le[18]||(le[18]=Te=>re.value=Te)},null,8,["storage-key","default-width","min","max"]),[[xi,!C(Ae)]])],64)),ae(bpe,{ref_key:"conversationPaneRef",ref:gn,mobile:C(a),turns:C(o).turns.value,"session-id":C(o).activeSessionId.value,approvals:C(o).pendingApprovals.value,changes:C(o).changes.value,"git-info":C(o).gitInfo.value,tasks:C(o).tasks.value,todos:C(o).todos.value,goal:C(o).goal.value,"activation-badges":C(o).activationBadges.value,status:C(o).status.value,thinking:C(o).thinking.value,"plan-mode":C(o).planMode.value,"swarm-mode":C(o).swarmMode.value,"goal-mode":C(o).goalMode.value,models:C(o).models.value,"starred-ids":C(o).starredModelIds.value,skills:C(o).skills.value,questions:C(o).questions.value,"pending-question-actions":C(o).pendingQuestionActions,"pending-approval-actions":C(o).pendingApprovalActions,running:h.value,"turn-active":C(o).turnActive.value,queued:C(o).queued.value,"search-files":C(o).searchFiles,"upload-image":C(o).uploadImage,working:C(o).working.value,starting:C(o).isStartingFirstPrompt.value,"fast-moon":C(o).fastMoon.value,"file-reload-key":C(o).activeSessionId.value,"session-loading":C(o).sessionLoading.value,compaction:C(o).compaction.value,"has-more-messages":C(o).hasMoreMessages.value,"loading-more":C(o).loadingMoreMessages.value,"loading-more-error":C(o).loadMoreMessagesError.value,"load-older-messages":C(o).loadOlderMessages,"workspace-name":C(o).visibleWorkspace.value?.name,"workspace-root":C(o).visibleWorkspace.value?.root??C(o).status.value.cwd,"git-diff-stats":C(o).gitDiffStats.value,workspaces:C(o).workspacesView.value,"active-workspace-id":C(o).activeWorkspaceId.value,"session-title":d.value,pr:C(o).activePullRequest.value,"conversation-toc":C(o).conversationToc.value,onOpenChanges:le[21]||(le[21]=Te=>C(Pt)()),onSelectWorkspace:le[22]||(le[22]=Te=>di(Te)),onAddWorkspace:le[23]||(le[23]=Te=>Bn.value=!0),onOpenPr:Ke,onSubmit:le[24]||(le[24]=Te=>ts(Te)),onSteer:le[25]||(le[25]=Te=>C(o).steerPrompt(Te.text,Te.attachments)),onApproval:le[26]||(le[26]=(Te,ge)=>C(o).respondApproval(Te,ge)),onCancelTask:le[27]||(le[27]=Te=>C(o).cancelTask(Te)),onAnswer:le[28]||(le[28]=(Te,ge)=>C(o).respondQuestion(Te,ge)),onDismiss:le[29]||(le[29]=Te=>C(o).dismissQuestion(Te)),onCommand:ci,onInterrupt:le[30]||(le[30]=Te=>C(o).abortCurrentPrompt()),onUnqueue:Ni,onEditQueued:ui,onReorderQueue:Vs,onSetPermission:le[31]||(le[31]=Te=>C(o).setPermission(Te)),onSetThinking:le[32]||(le[32]=Te=>C(o).setThinking(Te)),onTogglePlan:le[33]||(le[33]=Te=>C(o).togglePlanMode()),onToggleSwarm:le[34]||(le[34]=Te=>C(o).toggleSwarmMode()),onToggleGoal:le[35]||(le[35]=Te=>C(o).toggleGoalMode()),onCreateGoal:le[36]||(le[36]=Te=>C(o).createGoal(Te)),onControlGoal:le[37]||(le[37]=Te=>C(o).controlGoal(Te)),onRefreshGitStatus:le[38]||(le[38]=Te=>C(o).activeSessionId.value&&C(o).loadGitStatus(C(o).activeSessionId.value)),onRenameSession:le[39]||(le[39]=(Te,ge)=>C(o).renameSession(Te,ge)),onForkSession:le[40]||(le[40]=Te=>C(o).forkSession(Te)),onArchiveSession:le[41]||(le[41]=Te=>As(Te)),onExportSession:le[42]||(le[42]=Te=>C(o).exportSession(Te)),onCompact:le[43]||(le[43]=Te=>C(o).compact()),onPickModel:le[44]||(le[44]=Te=>Vn()),onSelectModel:le[45]||(le[45]=Te=>ko(Te)),onOpenFile:le[46]||(le[46]=Te=>C(U)(Te)),onOpenMedia:le[47]||(le[47]=Te=>C(Z)(Te)),onOpenThinking:le[48]||(le[48]=Te=>C(Ne)(Te)),onOpenCompaction:le[49]||(le[49]=Te=>C(Ze)(Te)),onOpenAgent:le[50]||(le[50]=Te=>C(ut)(Te)),onOpenToolDiff:le[51]||(le[51]=Te=>C(wt)(Te)),onEditMessage:js},null,8,["mobile","turns","session-id","approvals","changes","git-info","tasks","todos","goal","activation-badges","status","thinking","plan-mode","swarm-mode","goal-mode","models","starred-ids","skills","questions","pending-question-actions","pending-approval-actions","running","turn-active","queued","search-files","upload-image","working","starting","fast-moon","file-reload-key","session-loading","compaction","has-more-messages","loading-more","loading-more-error","load-older-messages","workspace-name","workspace-root","git-diff-stats","workspaces","active-workspace-id","session-title","pr","conversation-toc"]),!C(a)&&(C(iu)||C(Ae))?(x(),Se(Xn,{key:2,class:"sidebar-toggle-btn",size:"sm",label:C(Ae)?C(i)("sidebar.expandSidebar"):C(i)("sidebar.collapseSidebar"),onClick:C(P)},{default:Ie(()=>[ae(Ge,{name:C(Ae)?"panel-expand":"panel-collapse"},null,8,["name"])]),_:1},8,["label","onClick"])):ue("",!0),C(Wt)&&!C(a)?(x(),Se(H_,{key:3,class:"preview-handle","storage-key":C(G),"default-width":C(ye),min:C(me),max:C(de),reverse:"","aria-label":C(i)("layout.resizePreviewAria"),"onUpdate:width":le[52]||(le[52]=Te=>V.value=Te),"onUpdate:dragging":le[53]||(le[53]=Te=>mn.value=Te)},null,8,["storage-key","default-width","min","max","aria-label"])):ue("",!0),!C(a)||C(Wt)?(x(),E("aside",{key:4,class:Ue(["global-preview",{open:C(Wt),mobile:C(a),"no-anim":C(mn)||F.value}]),role:"complementary","aria-label":C(i)("layout.detailPanelAria"),"aria-hidden":!C(Wt)},[T.value==="thinking"&&C(ke)?(x(),Se(W3,{key:0,text:C(pe)??"",onClose:C(qe)},null,8,["text","onClose"])):T.value==="compaction"&&C(xe)?(x(),Se(W3,{key:1,text:C(be)??"",subtitle:C(i)("conversation.summaryTitle"),onClose:C(tt)},null,8,["text","subtitle","onClose"])):T.value==="agent"&&C(lt)?(x(),Se(Vme,{key:2,member:C(lt),onClose:C(mt)},null,8,["member","onClose"])):T.value==="btw"&&C(Kt)?(x(),Se(h1e,{key:3,turns:C(o).sideChatTurns.value,running:C(o).sideChatRunning.value,sending:C(o).sideChatSending.value,onSend:le[54]||(le[54]=Te=>C(o).sendSideChatPrompt(Te)),onClose:C(Gt)},null,8,["turns","running","sending","onClose"])):T.value==="diff"?(x(),Se(W1e,{key:4,mode:C(en),changes:C(o).changes.value,"git-info":C(o).gitInfo.value,"file-diff":C(o).fileDiff.value,"selected-diff-path":C(o).selectedDiffPath.value,"file-diff-loading":C(o).fileDiffLoading.value,closable:"",onOpen:C(pn),onBack:le[55]||(le[55]=Te=>{en.value="list",Hn.value=null,C(o).clearFileDiff()}),onClose:C(bn)},null,8,["mode","changes","git-info","file-diff","selected-diff-path","file-diff-loading","onOpen","onClose"])):T.value==="toolDiff"&&C(Tt)?(x(),Se(i1e,{key:5,target:C(Tt),onClose:C(Ft)},null,8,["target","onClose"])):T.value==="file"?(x(),Se(Mme,{key:6,file:C(B),loading:C(W),error:C(z),line:C(S)?.line,"download-url":C(L),closable:"","external-actions":C(O),"open-file":C(U),onClose:C(ie),onOpenExternal:C(q),onReveal:C(ee)},null,8,["file","loading","error","line","download-url","external-actions","open-file","onClose","onOpenExternal","onReveal"])):ue("",!0)],10,VCe)):ue("",!0),ae(WCe,{class:"internal-build-fab"}),to.value?(x(),Se(r0e,{key:5,models:C(o).models.value,current:C(o).status.value.modelId,"starred-ids":C(o).starredModelIds.value,loading:Bt.value,unavailable:Yt.value,onSelect:le[56]||(le[56]=Te=>Oo(Te)),onToggleStar:le[57]||(le[57]=Te=>C(o).toggleStarModel(Te)),onClose:le[58]||(le[58]=Te=>to.value=!1)},null,8,["models","current","starred-ids","loading","unavailable"])):ue("",!0),sn.value?(x(),Se(Cxe,{key:6,"color-scheme":C(o).colorScheme.value,accent:C(o).accent.value,"ui-font-size":C(o).uiFontSize.value,"auth-ready":C(o).authReady.value,"account-model":C(o).defaultModel.value,notify:C(o).notifyOnComplete.value,"notify-question":C(o).notifyOnQuestion.value,"notify-approval":C(o).notifyOnApproval.value,"notify-permission":C(o).notifyPermission.value,sound:C(o).soundOnComplete.value,"conversation-toc":C(o).conversationToc.value,config:C(o).config.value,models:C(o).models.value,"config-saving":nn.value,"server-version":C(o).serverVersion.value,backend:C(o).backend.value,onSetColorScheme:le[59]||(le[59]=Te=>C(o).setColorScheme(Te)),onSetAccent:le[60]||(le[60]=Te=>C(o).setAccent(Te)),onSetUiFontSize:le[61]||(le[61]=Te=>C(o).setUiFontSize(Te)),onSetNotify:le[62]||(le[62]=Te=>C(o).setNotifyOnComplete(Te)),onSetNotifyQuestion:le[63]||(le[63]=Te=>C(o).setNotifyOnQuestion(Te)),onSetNotifyApproval:le[64]||(le[64]=Te=>C(o).setNotifyOnApproval(Te)),onSetSound:le[65]||(le[65]=Te=>C(o).setSoundOnComplete(Te)),onSetConversationToc:le[66]||(le[66]=Te=>C(o).setConversationToc(Te)),onUpdateConfig:le[67]||(le[67]=Te=>Bo(Te)),onLogin:le[68]||(le[68]=()=>{sn.value=!1,Jn()}),onLogout:C(o).logout,onOpenOnboarding:le[69]||(le[69]=()=>{sn.value=!1,A()}),onOpenProviders:le[70]||(le[70]=()=>{sn.value=!1,Kn()}),onClose:le[71]||(le[71]=Te=>sn.value=!1)},null,8,["color-scheme","accent","ui-font-size","auth-ready","account-model","notify","notify-question","notify-approval","notify-permission","sound","conversation-toc","config","models","config-saving","server-version","backend","onLogout"])):ue("",!0),vt.value?(x(),Se(I0e,{key:7,providers:C(o).providers.value,loading:vn.value,unavailable:xn.value,onAdd:le[72]||(le[72]=Te=>li(Te)),onRefresh:le[73]||(le[73]=Te=>Uo(Te)),onDelete:le[74]||(le[74]=Te=>qo(Te)),onOpenLogin:le[75]||(le[75]=()=>{vt.value=!1,Jn()}),onClose:le[76]||(le[76]=Te=>vt.value=!1)},null,8,["providers","loading","unavailable"])):ue("",!0),Qn.value?(x(),Se(Swe,{key:8,status:C(o).status.value,thinking:g.value,"plan-mode":C(o).planMode.value,"swarm-mode":C(o).swarmMode.value,"cost-usd":C(o).sessionCost.value,onClose:le[77]||(le[77]=Te=>Qn.value=!1)},null,8,["status","thinking","plan-mode","swarm-mode","cost-usd"])):ue("",!0),Bn.value?(x(),Se(awe,{key:9,"browse-fs":C(o).browseFs,"get-fs-home":C(o).getFsHome,"default-path":C(o).visibleWorkspace.value?.root??C(o).status.value.cwd,error:nt.value,onAdd:le[78]||(le[78]=Te=>ns(Te)),onClose:zt},null,8,["browse-fs","get-fs-home","default-path","error"])):ue("",!0),ae(Ua,{name:"gload-fade"},{default:Ie(()=>[C(o).initialized.value?ue("",!0):(x(),Se(WSe,{key:0,issue:C(o).connectIssue.value},null,8,["issue"]))]),_:1}),C(o).initialized.value&&v.value&&!C(m)?(x(),Se(FSe,{key:10,onComplete:b,onSkip:b})):ue("",!0),ae(Bwe,{warnings:C(o).warnings.value,onDismiss:C(o).dismissWarning},null,8,["warnings","onDismiss"]),C(l)?(x(),Se(vCe,{key:11})):ue("",!0),ae(fwe),C(a)?(x(),Se(p_e,{key:12,modelValue:c.value,"onUpdate:modelValue":le[79]||(le[79]=Te=>c.value=Te),groups:C(o).workspaceGroups.value,"active-workspace-id":C(o).activeWorkspaceId.value,"active-id":C(o).activeSessionId.value,"attention-by-session":C(o).attentionBySession.value,"attention-by-workspace":C(o).attentionByWorkspace.value,onSelect:le[80]||(le[80]=Te=>C(o).selectSession(Te)),onCreate:No,onCreateInWorkspace:le[81]||(le[81]=Te=>di(Te)),onAddWorkspace:le[82]||(le[82]=Te=>Bn.value=!0),onRename:le[83]||(le[83]=(Te,ge)=>C(o).renameSession(Te,ge)),onArchive:le[84]||(le[84]=Te=>As(Te)),onDeleteWorkspace:le[85]||(le[85]=Te=>cs(Te)),onLoadMore:le[86]||(le[86]=Te=>void C(o).loadMoreSessions(Te))},null,8,["modelValue","groups","active-workspace-id","active-id","attention-by-session","attention-by-workspace"])):ue("",!0),C(a)?(x(),Se(wSe,{key:13,modelValue:u.value,"onUpdate:modelValue":le[87]||(le[87]=Te=>u.value=Te),status:C(o).status.value,thinking:C(o).thinking.value,models:C(o).models.value,"plan-mode":C(o).planMode.value,"swarm-mode":C(o).swarmMode.value,"color-scheme":C(o).colorScheme.value,"ui-font-size":C(o).uiFontSize.value,"auth-ready":C(o).authReady.value,"conversation-toc":C(o).conversationToc.value,"server-version":C(o).serverVersion.value,onPickModel:le[88]||(le[88]=Te=>Vn()),onSetThinking:le[89]||(le[89]=Te=>C(o).setThinking(Te)),onTogglePlan:le[90]||(le[90]=Te=>C(o).togglePlanMode()),onToggleSwarm:le[91]||(le[91]=Te=>C(o).toggleSwarmMode()),onSetPermission:le[92]||(le[92]=Te=>C(o).setPermission(Te)),onSetColorScheme:le[93]||(le[93]=Te=>C(o).setColorScheme(Te)),onSetUiFontSize:le[94]||(le[94]=Te=>C(o).setUiFontSize(Te)),onSetConversationToc:le[95]||(le[95]=Te=>C(o).setConversationToc(Te)),onLogin:le[96]||(le[96]=()=>{u.value=!1,Jn()}),onLogout:C(o).logout},null,8,["modelValue","status","thinking","models","plan-mode","swarm-mode","color-scheme","ui-font-size","auth-ready","conversation-toc","server-version","onLogout"])):ue("",!0)],6)),Wn.value?(x(),Se(age,{key:3,"on-start-o-auth-login":ai,"on-poll-o-auth-login":tn,"on-cancel-o-auth-login":qs,onSuccess:io,onClose:le[97]||(le[97]=Te=>Wn.value=!1)})):ue("",!0)]))}}),GCe=dt(KCe,[["__scopeId","data-v-8cd3196b"]]);jie();dm(GCe).use(Rn).mount("#app");export{N9 as $,ZA as A,bI as B,So as C,j4e as D,hA as E,We as F,qk as G,ot as H,ae as I,eI as J,g4e as K,Hi as L,Je as M,j7 as N,b4e as O,x4e as P,S4e as Q,Gp as R,ou as S,_1 as T,w4e as U,Vk as V,k4e as W,K4e as X,_4e as Y,H4e as Z,YCe as _,UA as a,Ho as a$,Mo as a0,Tk as a1,n4e as a2,Fk as a3,bM as a4,Lt as a5,Cu as a6,a4e as a7,Z4e as a8,f4e as a9,GA as aA,II as aB,RI as aC,An as aD,BI as aE,OI as aF,Lf as aG,FI as aH,On as aI,Bk as aJ,iI as aK,x as aL,z7 as aM,r4e as aN,Ln as aO,IA as aP,i4e as aQ,Qp as aR,zo as aS,Gv as aT,oe as aU,F4e as aV,lL as aW,rt as aX,jn as aY,PI as aZ,v4e as a_,m4e as aa,p4e as ab,h4e as ac,B4e as ad,X4e as ae,Jt as af,x7 as ag,x1 as ah,Il as ai,Gr as aj,vo as ak,O4e as al,ei as am,Dl as an,gt as ao,M4e as ap,E4e as aq,Sn as ar,yt as as,A7 as at,Ue as au,C9 as av,on as aw,NI as ax,$I as ay,ho as az,s4e as b,Qte as b$,U4e as b0,sf as b1,sm as b2,W4e as b3,Rl as b4,Y9 as b5,XCe as b6,gr as b7,fI as b8,z4e as b9,Cs as bA,xi as bB,w7 as bC,D4e as bD,et as bE,DA as bF,c4e as bG,pI as bH,N4e as bI,Ie as bJ,C4e as bK,qn as bL,ur as bM,R4e as bN,St as bO,l4e as bP,Mn as bQ,vs as bR,o3e as bS,s3e as bT,aE as bU,i3e as bV,vte as bW,lE as bX,Hy as bY,c3e as bZ,tne as b_,ZCe as ba,R as bb,xp as bc,y4e as bd,fn as be,JCe as bf,QCe as bg,NA as bh,$4e as bi,X9 as bj,C as bk,Bf as bl,Y4e as bm,V4e as bn,K7 as bo,u4e as bp,I4e as bq,hI as br,G4e as bs,A4e as bt,d4e as bu,zA as bv,um as bw,nL as bx,BM as by,cy as bz,P4e as c,U2 as c0,W2 as c1,z2 as c2,d3e as c3,Rm as c4,Gc as c5,Om as c6,Gte as c7,Yte as c8,f3e as c9,u3e as ca,e3e as cb,h3e as cc,K1 as cd,Fs as ce,dne as cf,une as cg,ute as ch,n3e as ci,rte as cj,lte as ck,t3e as cl,q2 as cm,fne as cn,w4 as co,n4 as cp,kte as cq,Bm as cr,Fm as cs,r3e as ct,a3e as cu,J4e as cv,l3e as cw,Ge as cx,Q4e as cy,dt as cz,L4e as d,Ll as e,e4e as f,Ua as g,Z7 as h,t4e as i,o4e as j,Ei as k,$f as l,Fo as m,h1 as n,Yr as o,q4e as p,D as q,dm as r,Se as s,ue as t,E as u,w as v,l7 as w,T4e as x,r7 as y,aL as z};
341
+ `),s=[];return n.forEach((i,r)=>{s.push({kind:"rem",gutter:String(r+1),text:`- ${i}`})}),o.forEach((i,r)=>{s.push({kind:"add",gutter:String(r+1),text:`+ ${i}`})}),s}function wke(e){const t=e.display??{},n=typeof t.kind=="string"?t.kind:"";if(n==="diff"){const o=typeof t.path=="string"?t.path:"";return Array.isArray(t.diff)?{kind:"diff",path:o,diff:t.diff}:typeof t.old_text=="string"&&typeof t.new_text=="string"?{kind:"diff",path:o,diff:xke(t.old_text,t.new_text)}:{kind:"diff",path:o,diff:[]}}if(n==="shell"||n==="command"){const o=typeof t.command=="string"?t.command:e.action,s=typeof t.cwd=="string"?t.cwd:void 0,i=typeof t.danger=="string"?t.danger:void 0;return{kind:"shell",command:o,cwd:s,danger:i}}if(n==="file_content"||n==="file"){const o=typeof t.path=="string"?t.path:"",s=typeof t.content=="string"?t.content:"",i=typeof t.language=="string"?t.language:void 0;return{kind:"file",path:o,content:s,language:i}}if(n==="file_op"||n==="fileop"){const o=typeof t.operation=="string"?t.operation:typeof t.op=="string"?t.op:n,s=typeof t.path=="string"?t.path:"",i=typeof t.detail=="string"?t.detail:void 0;return{kind:"fileop",op:o,path:s,detail:i}}if(n==="url_fetch"||n==="url"){const o=typeof t.url=="string"?t.url:e.action;return{kind:"url",method:typeof t.method=="string"?t.method:void 0,url:o}}if(n==="search"){const o=typeof t.query=="string"?t.query:e.action,s=typeof t.scope=="string"?t.scope:void 0;return{kind:"search",query:o,scope:s}}if(n==="invocation"||n==="agent_call"||n==="skill_call"){const o=typeof t.kind=="string"?t.kind:n,s=typeof t.name=="string"?t.name:e.toolName,i=typeof t.description=="string"?t.description:void 0;return{kind:"invocation",kind2:o,name:s,description:i}}if(n==="todo"||n==="todo_list")return{kind:"todo",items:(Array.isArray(t.items)?t.items:[]).map(i=>{const r=i??{};return{title:typeof r.title=="string"?r.title:"",status:typeof r.status=="string"?r.status:"pending"}})};if(n==="plan_review"){const o=typeof t.plan=="string"?t.plan:"",s=typeof t.path=="string"?t.path:void 0,r=(Array.isArray(t.options)?t.options:[]).map(l=>{const a=l??{},c=typeof a.label=="string"?a.label:"";if(!c)return null;const u=typeof a.description=="string"?a.description:void 0;return{label:c,description:u}}).filter(l=>l!==null);return{kind:"plan_review",plan:o,path:s,options:r.length>0?r:void 0}}return{kind:"generic",summary:e.action}}function _ke(e){return{questionId:e.questionId,sessionId:e.sessionId,questions:e.questions.map(t=>({id:t.id,question:t.question,header:t.header,body:t.body,options:t.options.map(n=>({id:n.id,label:n.label,description:n.description,recommended:n.recommended})),multiSelect:t.multiSelect,allowOther:t.allowOther,otherLabel:t.otherLabel}))}}function Ske(e){const t=_e.messagesBySession[e.sessionId];if(!t||t.length===0)return;const n=new Map;for(const s of t)if(s.role==="assistant")for(const i of s.content){if(i.type!=="toolUse"||i.toolName!=="Bash"&&i.toolName!=="bash")continue;const r=i.input,l=r&&typeof r.command=="string"?r.command:void 0;l&&n.set(i.toolCallId,l)}if(n.size===0)return;const o=`task_id: ${e.id}`;for(const s of t)if(s.role==="tool")for(const i of s.content){if(i.type!=="toolResult")continue;if((typeof i.output=="string"?i.output:i.output!==void 0?JSON.stringify(i.output):"").includes(o)){const l=n.get(i.toolCallId);if(l)return l}}}function Cke(e){let t;e.status==="running"?t="run":e.status==="completed"?t="done":t="fail";let n="";if(e.status==="running"&&e.startedAt){const r=Math.round((Date.now()-new Date(e.startedAt).getTime())/1e3),l=Math.floor(r/60),a=r%60;n=Rn.global.t("tasks.timingRunning",{time:`${l}:${String(a).padStart(2,"0")}`})}else if(e.completedAt&&e.startedAt){const r=Math.round((new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime())/1e3);n=Rn.global.t("tasks.timingDone",{sec:r})}else n=e.status;const o=e.outputLines&&e.outputLines.length>0?e.outputLines:e.outputPreview?e.outputPreview.split(/\r?\n/):void 0,s=e.command??Ske(e),i=e.kind==="bash"&&s?`$ ${s}`:void 0;return{id:e.id,name:e.description,kind:e.kind,state:t,timing:n,meta:i,output:o,runInBackground:e.runInBackground,parentToolCallId:e.parentToolCallId}}const Ake=D(()=>{const e=_e.sessions.find(n=>n.id===_e.activeSessionId),t=e?e.cwd.split("/").pop()??e.cwd:"main";return{name:_e.workspaceName,branch:t}}),Mke=D(()=>(Nf.value,_e.sessions.toSorted((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).map(e=>({id:e.id,title:e.title,time:Fb(e.updatedAt),busy:$b(e.id,e.mainTurnActive),pendingInteraction:e.pendingInteraction,lastTurnReason:e.lastTurnReason})))),Eke=D(()=>_e.activeSessionId??""),Tke=D(()=>{const e=_e.activeSessionId;if(e)return Un.skillsBySession.value[e]??[];const t=u0.value;return t?Un.skillsByWorkspace.value[t]??[]:[]}),Ob=D(()=>{const e=_e.activeSessionId;return e?_e.inFlightBySession[e]??!1:!1}),Nke=D(()=>ft.isStartingFirstPrompt()),ps=pye(_e,{pushOperationFailure:Xf,nextOptimisticMsgId:GT,connectEventsIfNeeded:YT,getEventConn:()=>Mi,resolveThinkingForPrompt:(e,t)=>Un.resolveThinkingForPrompt(e,t)}),Qf=D(()=>{const e=_e.activeSessionId;if(!e)return[];const t=ps.sideChatTargetBySession.value[e]?.agentId;return(_e.tasksBySession[e]??[]).filter(n=>n.id!==t)}),QT=uve(_e,Qf),Ike=D(()=>{const e=_e.activeSessionId;if(!e)return[];const t=new Set(_e.sideChatUserMessageIdsBySession[e]??[]),n=(_e.messagesBySession[e]??[]).filter(s=>!t.has(s.id)),o=_e.approvalsBySession[e]??[];return _T(n,o,s=>ht().getFileUrl(s),c0.value,_e.planReviewByToolCallId)}),c0=D(()=>{const e=_e.activeSessionId;return e?(_e.turnActiveBySession[e]??!1)||(_e.sessions.find(t=>t.id===e)?.mainTurnActive??!1):!1}),Lke=D(()=>Ob.value||c0.value),$ke=D(()=>(QT.taskClock.value,Qf.value.map(Cke))),JT=D(()=>Lye(Qf.value)),Fke=D(()=>Fye(Qf.value)),Wc=D(()=>{const e=_e.activeSessionId;return e?_e.goalBySession[e]??null:null}),Oke=D(()=>{const e=_e.activeSessionId;return e?Tye(_e.messagesBySession[e]??[]):[]}),Bke=D(()=>{const e=_e.activeSessionId;return e?_e.compactionBySession[e]??null:null}),Rke=D(()=>_e.connection),Dke=D(()=>_e.loading),Pke=D(()=>_e.sessionLoading),Hke=D(()=>{const e=_e.activeSessionId;return e?_e.messagesLoadingMoreBySession[e]??!1:!1}),Wke=D(()=>{const e=_e.activeSessionId;return e?_e.messagesHasMoreBySession[e]??!1:!1}),zke=D(()=>{const e=_e.activeSessionId;return e?_e.messagesLoadMoreErrorBySession[e]??!1:!1}),Uke=D(()=>_e.serverVersion),qke=D(()=>_e.backend),jke=D(()=>_e.dangerousBypassAuth);function Vke(){_e.dangerousBypassAuth=!1}const Kke=D(()=>_e.permission),Gke=D(()=>_e.thinking),eN=D(()=>{const e=_e.activeSessionId;return e?_e.planModeBySession[e]??!1:l0.planMode}),Yke=D(()=>{const e=_e.activeSessionId;return e?_e.swarmModeBySession[e]??!1:l0.swarmMode}),Zke=D(()=>{const e=_e.activeSessionId;return e?_e.goalModeBySession[e]??!1:l0.goalMode}),Xke=D(()=>{const e=$ye(JT.value);return{plan:eN.value,goal:Wc.value&&Wc.value.status!=="complete"?{status:Wc.value.status,turnsUsed:Wc.value.turnsUsed,elapsedMs:Wc.value.wallClockMs}:null,swarm:e.total>0?e:null}}),Qke=D(()=>{const e=_e.activeSessionId;if(!e)return[];const t=ht();return(_e.queuedBySession[e]??[]).map(n=>({text:n.text,attachmentCount:n.attachments?.length??0,attachments:n.attachments?.map(o=>({fileId:o.fileId,kind:o.kind,url:t.getFileUrl(o.fileId),name:o.name}))}))}),Jke=D(()=>_e.warnings),e2e=D(()=>{const e=_e.activeSessionId;return e?(_e.questionsBySession[e]??[]).map(_ke):[]}),t2e=D(()=>{const e=_e.activeSessionId;return e?(_e.approvalsBySession[e]??[]).map(t=>({approvalId:t.approvalId,block:wke(t),agentName:t.agentName})):[]}),Bb=D(()=>{const e=_e.activeSessionId;return e?(_e.approvalsBySession[e]??[]).length>0?"awaiting-approval":(_e.questionsBySession[e]??[]).length>0?"awaiting-question":Ob.value||c0.value?"running":"idle":"idle"}),Un=Ive(_e,{pushOperationFailure:Xf,refreshSessionStatus:Zf,persistSessionProfile:qT,activity:Bb,updateSession:a0,updateSessionMessages:RT}),_k=D(()=>{const e=_e.activeSessionId;if(!e)return null;const t=_e.gitStatusBySession[e];return t?{branch:t.branch,ahead:t.ahead,behind:t.behind}:null}),n2e=D(()=>{const e=_e.activeSessionId;return e?_e.gitStatusBySession[e]?.pullRequest??null:null}),o2e=D(()=>{const e=_e.activeSessionId;if(!e)return[];const t=_e.gitStatusBySession[e];return t?Object.entries(t.entries).map(([n,o])=>({path:n,status:o})).sort((n,o)=>n.path.localeCompare(o.path)):[]}),s2e=D(()=>{const e=_e.activeSessionId;if(!e)return null;const t=_e.gitStatusBySession[e];return t?{totalAdditions:t.additions,totalDeletions:t.deletions}:null}),tN=D(()=>{const e=_e.sessions.find(r=>r.id===_e.activeSessionId),t=_k.value?.branch??(e?e.cwd.split("/").pop()??e.cwd:"main"),n=e===void 0?Un.draftModel.value:null,o=(e?.model&&e.model.length>0?e.model:n??_e.defaultModel)??"—",s=Un.models.value.find(r=>r.id===o)??Un.models.value.find(r=>r.model===o);return{model:s?.displayName||s?.model||(o.includes("/")?o.split("/").pop():o),modelId:s?.id??o,ctxUsed:e?.usage.contextTokens??0,ctxMax:e?.usage.contextLimit??0,permission:_e.permission,branch:t,cwd:e?.cwd??"",isGitRepo:_k.value!==null}}),i2e=D(()=>HT.value),r2e=D(()=>_e.sessions.find(t=>t.id===_e.activeSessionId)?.usage.totalCostUsd??0),l2e=D(()=>_e.authReady),a2e=D(()=>_e.defaultModel),c2e=D(()=>_e.managedProviderStatus),u2e=D(()=>_e.config),d2e=D(()=>{const e=_e.activeSessionId;if(!e)return{};const t=_e.gitStatusBySession[e];return t?{...t.entries}:{}});function wu(e){const t=zi(e.cwd);return _e.workspaces.find(n=>zi(n.root)===t)?.id??e.workspaceId??e.cwd}const Rb=D(()=>fge({workspaces:_e.workspaces,sessions:_e.sessions,hiddenWorkspaceRoots:_e.hiddenWorkspaceRoots,sessionsHasMoreByWorkspace:_e.sessionsHasMoreByWorkspace})),r1=oe(mF()),_u=oe(gF()==="manual"?"manual":"recent");et(()=>[Rb.value.map(e=>e.id).join("\0"),_e.loading],([e,t])=>{if(t)return;const n=e?e.split("\0"):[],o=IF(n,r1.value);o!==null&&(r1.value=o,g6(o))});const Xa=D(()=>{const e=Rb.value.map(t=>({id:t.id,name:t.name,root:t.root,shortPath:Wye(t.root,_e.fsHome),sessionCount:t.sessionCount}));if(_u.value==="recent"){const t=new Map;for(const n of _e.sessions){if(n.parentSessionId)continue;const o=wu(n),s=new Date(n.updatedAt).getTime();s>(t.get(o)??Number.NEGATIVE_INFINITY)&&t.set(o,s)}return FF(e,t)}return LF(e,r1.value)}),u0=D(()=>{const e=_e.activeWorkspaceId,t=Xa.value;return e&&t.some(n=>n.id===e)?e:t[0]?.id??null});et(u0,e=>{e&&(Object.prototype.hasOwnProperty.call(Un.skillsByWorkspace.value,e)||Un.loadSkillsForWorkspace(e))},{immediate:!0});const f2e=D(()=>{const e=u0.value;return e?Xa.value.find(t=>t.id===e)??null:null}),h2e=D(()=>{Nf.value;const e=new Set(Xa.value.map(n=>n.id)),t=new Map(Xa.value.map(n=>[n.id,n.name]));return _e.sessions.filter(n=>!n.parentSessionId&&e.has(wu(n))).map(n=>{const o=wu(n);return{id:n.id,title:n.title,time:Fb(n.updatedAt),busy:$b(n.id,n.mainTurnActive),pendingInteraction:n.pendingInteraction,lastTurnReason:n.lastTurnReason,lastPrompt:n.lastPrompt,workspaceId:o,workspaceName:t.get(o)}})}),p2e=D(()=>{Nf.value;const e=new Map;for(const t of _e.sessions.toSorted((n,o)=>new Date(o.updatedAt).getTime()-new Date(n.updatedAt).getTime())){if(t.parentSessionId)continue;const n=wu(t),o={id:t.id,title:t.title,time:Fb(t.updatedAt),busy:$b(t.id,t.mainTurnActive),pendingInteraction:t.pendingInteraction,lastTurnReason:t.lastTurnReason,updatedAt:t.updatedAt},s=e.get(n)??[];s.push(o),e.set(n,s)}return Xa.value.map(t=>({workspace:t,sessions:e.get(t.id)??[],hasMore:_e.sessionsHasMoreByWorkspace[t.id]??!1,loadingMore:_e.sessionsLoadingMoreByWorkspace[t.id]??!1,initialCount:_e.sessionsInitialCountByWorkspace[t.id]??yk}))});function m2e(e){r1.value=e,g6(e),_u.value!=="manual"&&(_u.value="manual",v6("manual"))}function g2e(e){_u.value!==e&&(_u.value=e,v6(e))}const nN=D(()=>{const e={};for(const[t,n]of Object.entries(_e.approvalsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);for(const[t,n]of Object.entries(_e.questionsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);return e}),v2e=D(()=>{const e={};for(const[t,n]of Object.entries(_e.approvalsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).approvals=n.length);for(const[t,n]of Object.entries(_e.questionsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).questions=n.length);return e}),y2e=D(()=>{const e={};for(const[t,n]of Object.entries(_e.unreadBySession))n&&(e[t]=!0);return e}),k2e=D(()=>{const e={},t=nN.value;for(const n of _e.sessions){const o=t[n.id]??0;if(o<=0)continue;const s=wu(n);e[s]=(e[s]??0)+o}return e}),b2e=D(()=>_e.recentRoots),x2e=D(()=>_e.availableOpenInApps),ft=Eve(_e,{taskPoller:QT,sideChat:ps,modelProvider:Un,pushOperationFailure:Xf,activity:Bb,sessionsKnownEmpty:ZT,setSessions:OT,updateSession:a0,upsertSessionFront:zye,appendSession:Uye,forgetSession:DT,setActiveSessionId:Nb,updateSessionMessages:RT,nextOptimisticMsgId:GT,getEventConn:()=>Mi,syncSessionFromSnapshot:Lb,reopenSession:yke,hasLoadedMessages:pke,refreshSessionStatus:Zf,refreshSessionGoal:Gye,persistSessionProfile:qT,mergedWorkspaces:Rb,workspacesView:Xa,status:tN,workspaceIdForSession:wu,savePermissionToStorage:Bye,savePlanModeToStorage:IT,saveSwarmModeToStorage:LT,saveGoalModeToStorage:$T,draftModes:l0,saveUnread:o2,saveActiveWorkspaceToStorage:Hye,saveHiddenWorkspacesToStorage:Pye,goalErrorMessage:dke,resetFastMoon:Fr.resetFastMoon,initialized:zT,connectIssue:UT,selectedDiffPath:PT,fileDiffLines:HT,fileDiffLoading:WT});function Db(e){return e===_e.activeSessionId&&typeof document<"u"&&document.visibilityState==="visible"&&document.hasFocus()}function w2e(e){if(_e.turnActiveBySession[e]){const t={..._e.turnActiveBySession};delete t[e],_e.turnActiveBySession=t}_e.inFlightBySession[e]&&(_e.inFlightBySession={..._e.inFlightBySession,[e]:!1})}function _2e(e,t,n){const o=_e.promptIdBySession[e];ft.finishPromptLocal(e,{turnWasActive:n}),e===_e.activeSessionId?(ft.loadGitStatus(e),Zf(e)):t==="idle"&&(_e.unreadBySession={..._e.unreadBySession,[e]:!0},o2({[e]:!0}));const s=(_e.approvalsBySession[e]??[]).length>0,i=(_e.questionsBySession[e]??[]).length>0;zge(t,s,i)&&lr.maybeNotifyCompletion(e,{isUserWatching:Db(e),sessionTitle:_e.sessions.find(r=>r.id===e)?.title??"",promptId:o,onClick:()=>{ft.selectSession(e)}}),t==="idle"&&Tf.maybePlayCompletionSound()}function S2e(e,t){const n=t.questions[0],o=n?.header?.trim()??"",s=n?.question?.trim()??"",i=o&&s?`${o}: ${s}`:s||o;lr.maybeNotifyQuestion({isUserWatching:Db(e),sessionTitle:_e.sessions.find(r=>r.id===e)?.title??"",questionPreview:i,questionId:t.questionId,onClick:()=>{ft.selectSession(e)}}),Tf.maybePlayQuestionSound()}function C2e(e,t){lr.maybeNotifyApproval({isUserWatching:Db(e),sessionTitle:_e.sessions.find(n=>n.id===e)?.title??"",toolName:t.toolName,approvalId:t.approvalId,onClick:()=>{ft.selectSession(e)}}),Tf.maybePlayApprovalSound()}function Pb(){return bke(),{workspace:Ake,sessions:Mke,activeSessionId:Eke,workspacesView:Xa,workspaceSortMode:_u,visibleWorkspace:f2e,activeWorkspaceId:u0,sessionsForView:h2e,workspaceGroups:p2e,attentionBySession:nN,pendingBySession:v2e,attentionByWorkspace:k2e,unreadBySession:y2e,recentRoots:b2e,turns:Ike,tasks:$ke,activeAppTasks:Qf,todos:Oke,goal:Wc,swarms:JT,swarmMembersByToolCallId:Fke,activationBadges:Xke,compaction:Bke,status:tN,sessionCost:r2e,fileDiff:i2e,selectedDiffPath:PT,fileDiffLoading:WT,changes:o2e,gitInfo:_k,gitDiffStats:s2e,activePullRequest:n2e,changesByPath:d2e,pendingApprovals:t2e,availableOpenInApps:x2e,connection:Rke,loading:Dke,sessionLoading:Pke,loadingMoreMessages:Hke,hasMoreMessages:Wke,loadMoreMessagesError:zke,serverVersion:Uke,backend:qke,dangerousBypassAuth:jke,clearDangerousBypassAuth:Vke,initialized:zT,connectIssue:UT,permission:Kke,thinking:Gke,planMode:eN,swarmMode:Yke,goalMode:Zke,queued:Qke,warnings:Jke,questions:e2e,activity:Bb,turnActive:c0,inFlight:Ob,working:Lke,isStartingFirstPrompt:Nke,fastMoon:Fr.fastMoon,models:Un.models,starredModelIds:Un.starredModelIds,providers:Un.providers,uiFontSize:Fr.uiFontSize,setUiFontSize:Fr.setUiFontSize,conversationToc:VT,setConversationToc:Xye,colorScheme:Fr.colorScheme,setColorScheme:Fr.setColorScheme,accent:Fr.accent,setAccent:Fr.setAccent,notifyOnComplete:lr.notifyOnComplete,notifyOnQuestion:lr.notifyOnQuestion,notifyOnApproval:lr.notifyOnApproval,notifyPermission:lr.notifyPermission,setNotifyOnComplete:lr.setNotifyOnComplete,setNotifyOnQuestion:lr.setNotifyOnQuestion,setNotifyOnApproval:lr.setNotifyOnApproval,soundOnComplete:Tf.soundOnComplete,setSoundOnComplete:Tf.setSoundOnComplete,onboarded:KT,setOnboarded:Jye,load:ft.load,selectSession:ft.selectSession,clearActiveSession:ft.clearActiveSession,loadOlderMessages:ft.loadOlderMessages,loadWorkspaces:ft.loadWorkspaces,loadMoreSessions:ft.loadMoreSessions,loadAllSessions:ft.loadAllSessions,selectWorkspace:ft.selectWorkspace,openWorkspace:ft.openWorkspace,openWorkspaceDraft:ft.openWorkspaceDraft,startSessionAndSendPrompt:ft.startSessionAndSendPrompt,startSessionAndActivateSkill:ft.startSessionAndActivateSkill,startSessionAndOpenSideChat:ft.startSessionAndOpenSideChat,addWorkspaceByPath:ft.addWorkspaceByPath,browseFs:ft.browseFs,getFsHome:ft.getFsHome,sendPrompt:ft.sendPrompt,steerPrompt:ft.steerPrompt,sideChatVisible:ps.sideChatVisible,sideChatSessionId:ps.sideChatSessionId,sideChatTurns:ps.sideChatTurns,sideChatRunning:ps.sideChatRunning,sideChatSending:ps.sideChatSending,openSideChat:ps.openSideChat,closeSideChat:ps.closeSideChat,sendSideChatPrompt:ps.sendSideChatPrompt,uploadImage:ft.uploadImage,abortCurrentPrompt:ft.abortCurrentPrompt,respondApproval:ft.respondApproval,respondQuestion:ft.respondQuestion,dismissQuestion:ft.dismissQuestion,pendingQuestionActions:ft.pendingQuestionActions,pendingApprovalActions:ft.pendingApprovalActions,cancelTask:ft.cancelTask,setPermission:ft.setPermission,setThinking:Un.setThinking,setPlanMode:ft.setPlanMode,togglePlanMode:ft.togglePlanMode,setSwarmMode:ft.setSwarmMode,toggleSwarmMode:ft.toggleSwarmMode,setGoalMode:ft.setGoalMode,toggleGoalMode:ft.toggleGoalMode,createGoal:ft.createGoal,controlGoal:ft.controlGoal,enqueue:ft.enqueue,dismissWarning:ft.dismissWarning,renameSession:ft.renameSession,renameWorkspace:ft.renameWorkspace,deleteWorkspace:ft.deleteWorkspace,reorderWorkspaces:m2e,setWorkspaceSortMode:g2e,archiveSession:ft.archiveSession,exportSession:ft.exportSession,restoreSession:ft.restoreSession,loadArchivedSessions:ft.loadArchivedSessions,compact:ft.compact,forkSession:ft.forkSession,undo:ft.undo,unqueue:ft.unqueue,reorderQueue:ft.reorderQueue,searchFiles:ft.searchFiles,loadGitStatus:ft.loadGitStatus,loadFileDiff:ft.loadFileDiff,clearFileDiff:ft.clearFileDiff,listDir:ft.listDir,readFileContent:ft.readFileContent,getFileDownloadUrl:ft.getFileDownloadUrl,openWorkspaceFile:ft.openWorkspaceFile,openInApp:ft.openInApp,revealWorkspaceFile:ft.revealWorkspaceFile,resolveImageUrl:ft.resolveImageUrl,loadModels:Un.loadModels,loadProviders:Un.loadProviders,skills:Tke,activateSkill:Un.activateSkill,setModel:Un.setModel,toggleStarModel:Un.toggleStarModel,addProvider:Un.addProvider,deleteProvider:Un.deleteProvider,refreshProvider:Un.refreshProvider,refreshAllProviders:Un.refreshAllProviders,authReady:l2e,defaultModel:a2e,managedProviderStatus:c2e,config:u2e,updateConfig:ft.updateConfig,checkAuth:ft.checkAuth,startOAuthLogin:Un.startOAuthLogin,pollOAuthLogin:Un.pollOAuthLogin,cancelOAuthLogin:Un.cancelOAuthLogin,logout:ft.logout}}const oN=Je({__name:"LanguageSwitcher",setup(e){const{locale:t}=$t(),n=b6.map(s=>({value:s.code,label:s.label}));function o(s){t.value!==s&&x6(s)}return(s,i)=>(x(),Se(ys,{"model-value":C(t),options:C(n),"onUpdate:modelValue":o},null,8,["model-value","options"]))}}),A2e=["aria-checked","aria-label","disabled"],M2e=Je({__name:"Switch",props:{modelValue:{type:Boolean},disabled:{type:Boolean},label:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(o,s)=>(x(),E("button",{class:Ue(["ui-switch",{"is-on":e.modelValue}]),type:"button",role:"switch","aria-checked":e.modelValue,"aria-label":e.label,disabled:e.disabled,onClick:s[0]||(s[0]=i=>n("update:modelValue",!e.modelValue))},[...s[1]||(s[1]=[w("span",{class:"ui-switch__thumb"},null,-1)])],10,A2e))}}),Mr=dt(M2e,[["__scopeId","data-v-e5aecc8e"]]),E2e=["aria-label"],T2e=["aria-selected","onClick"],N2e={class:"body"},I2e={class:"panel"},L2e={class:"sec"},$2e={class:"sec-title"},F2e={class:"row"},O2e={class:"rlabel"},B2e={class:"row"},R2e={class:"rlabel"},D2e={class:"row"},P2e={class:"rlabel"},H2e={class:"num-field"},W2e=["value","aria-label"],z2e={class:"row"},U2e={class:"rlabel"},q2e={class:"row"},j2e={class:"rlabel"},V2e={class:"hint"},K2e={class:"sec"},G2e={class:"sec-title"},Y2e={class:"row"},Z2e={class:"rlabel"},X2e={key:0,class:"hint"},Q2e={class:"row"},J2e={class:"rlabel"},ebe={key:0,class:"hint"},tbe={class:"row"},nbe={class:"rlabel"},obe={key:0,class:"hint"},sbe={class:"row"},ibe={class:"rlabel"},rbe={class:"panel"},lbe={class:"sec"},abe={class:"sec-title"},cbe={class:"row"},ube={class:"rlabel"},dbe={key:0,class:"rvalue"},fbe={class:"actions"},hbe={class:"panel"},pbe={class:"sec"},mbe={class:"sec-head"},gbe={class:"sec-title"},vbe={key:0,class:"saving"},ybe={class:"row"},kbe={class:"rlabel"},bbe={class:"hint"},xbe={key:0,class:"select-wrap"},wbe={key:0,value:"",disabled:""},_be=["label"],Sbe=["value"],Cbe={key:1,class:"rvalue mono"},Abe={class:"row"},Mbe={class:"rlabel"},Ebe={class:"hint"},Tbe={class:"row"},Nbe={class:"rlabel"},Ibe={class:"hint"},Lbe={class:"row"},$be={class:"rlabel"},Fbe={class:"hint"},Obe={class:"row"},Bbe={class:"rlabel"},Rbe={class:"hint"},Dbe={key:1,class:"empty-config"},Pbe={class:"panel"},Hbe={class:"sec"},Wbe={class:"sec-title"},zbe={class:"row"},Ube={class:"rlabel"},qbe={class:"rvalue mono"},jbe={class:"row"},Vbe={class:"rlabel"},Kbe={class:"rvalue mono"},Gbe={class:"row"},Ybe={class:"rlabel"},Zbe={class:"rvalue mono"},Xbe={key:0,class:"row"},Qbe={class:"rlabel"},Jbe={class:"hint"},exe={class:"hint"},txe={class:"row"},nxe={class:"rlabel"},oxe={key:0,class:"hint"},sxe={class:"panel"},ixe={class:"panel-head"},rxe={class:"panel-title"},lxe={class:"panel-desc"},axe={class:"archive-toolbar"},cxe={class:"archive-search"},uxe=["placeholder"],dxe={value:"all"},fxe=["value"],hxe={key:0,class:"archive-empty"},pxe={key:0,class:"archive-list"},mxe={class:"archive-workspace"},gxe={class:"path"},vxe={class:"count"},yxe={class:"setting-card"},kxe={class:"archive-meta"},bxe={class:"archive-name"},xxe={class:"archive-time"},wxe={key:1,class:"archive-empty"},_xe=100,Sxe=Je({__name:"SettingsDialog",props:{colorScheme:{},accent:{},uiFontSize:{},authReady:{type:Boolean},accountModel:{},notify:{type:Boolean},notifyQuestion:{type:Boolean},notifyApproval:{type:Boolean},notifyPermission:{},sound:{type:Boolean},conversationToc:{type:Boolean},config:{},models:{},configSaving:{type:Boolean},serverVersion:{},backend:{}},emits:["setColorScheme","setAccent","setUiFontSize","setNotify","setNotifyQuestion","setNotifyApproval","setSound","setConversationToc","login","logout","openOnboarding","openProviders","updateConfig","close"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=oe("general"),r=[{id:"general",labelKey:"settings.tabs.general"},{id:"agent",labelKey:"settings.tabs.agent"},{id:"account",labelKey:"settings.tabs.account"},{id:"advanced",labelKey:"settings.tabs.advanced"},{id:"archived",labelKey:"settings.tabs.archived"}],l=_F(),a=D(()=>o.backend==="v2"?"v2 (kap-server)":"v1 (server)"),c=["manual","yolo","auto"],u={manual:"status.permissionManual",auto:"status.permissionAuto",yolo:"status.permissionYolo"},d=oe(null);mb(d);function f(ne){ne.key==="Escape"&&s("close")}An(()=>document.addEventListener("keydown",f)),On(()=>document.removeEventListener("keydown",f));function h(){zE()}const p=D(()=>{const ne=new Map;for(const j of o.models??[])ne.set(j.id,{id:j.id,label:j.displayName??j.model??j.id,provider:j.provider});for(const[j,K]of Object.entries(o.config?.models??{})){if(ne.has(j))continue;const ve=k(K);ne.set(j,{id:j,label:g(j,K,ve),provider:ve??j})}return Array.from(ne.values())}),m=D(()=>{const ne=new Map;for(const j of p.value){const K=ne.get(j.provider)??[];K.push(j),ne.set(j.provider,K)}for(const j of ne.values())j.sort((K,ve)=>K.label.localeCompare(ve.label));return Array.from(ne.entries()).toSorted(([j],[K])=>j.localeCompare(K)).map(([j,K])=>({provider:j,options:K}))}),y=D(()=>{const ne=o.config?.defaultPermissionMode;return ne==="auto"||ne==="yolo"||ne==="manual"?ne:"manual"});function k(ne){if(!ne||typeof ne!="object")return;const j=ne;return typeof j.provider=="string"?j.provider:void 0}function g(ne,j,K){if(!j||typeof j!="object")return ne;const ve=j,he=typeof ve.model=="string"?ve.model:void 0,Ae=K??k(j);return he&&Ae?`${ne} (${Ae}/${he})`:he?`${ne} (${he})`:ne}function v(ne){return ne===!0}function b(ne){!ne||ne===o.config?.defaultModel||s("updateConfig",{defaultModel:ne})}function A(ne){ne!==y.value&&s("updateConfig",{defaultPermissionMode:ne})}function I(ne){const j=o.config?.[ne];s("updateConfig",{[ne]:!v(j)})}function N(){const ne=o.config?.thinking;return!ne||typeof ne!="object"?!0:ne.enabled!==!1}function M(){s("updateConfig",{thinking:{enabled:!N()}})}function $(){const ne=o.config?.telemetry!==!1;s("updateConfig",{telemetry:!ne})}function T(ne){i.value=ne}const F=Pb(),S=oe([]),B=oe(!1),W=oe(!1),z=oe(""),L=oe("all"),O=oe("archived-desc");async function U(){if(!(B.value||W.value)){B.value=!0;try{const ne=[];let j;for(;;){const K=await F.loadArchivedSessions({beforeId:j,pageSize:_xe});if(ne.push(...K.items),!K.hasMore||K.items.length===0)break;const ve=K.items.at(-1)?.id;if(ve===void 0)break;j=ve}S.value=ne,W.value=!0}catch(ne){console.warn("loadAllArchived failed",ne)}finally{B.value=!1}}}et(i,ne=>{ne==="archived"&&!W.value&&U()});const Z=D(()=>{const ne=new Set;for(const j of S.value)ne.add(j.cwd);return Array.from(ne).sort((j,K)=>j.localeCompare(K))}),ie=D(()=>{const ne=z.value.trim().toLowerCase();let j=S.value.filter(K=>K.archived===!0);return L.value!=="all"&&(j=j.filter(K=>K.cwd===L.value)),ne&&(j=j.filter(K=>K.title.toLowerCase().includes(ne))),j=j.slice(),O.value==="archived-desc"?j.sort((K,ve)=>ve.updatedAt.localeCompare(K.updatedAt)):O.value==="created-desc"?j.sort((K,ve)=>ve.createdAt.localeCompare(K.createdAt)):j.sort((K,ve)=>K.title.localeCompare(ve.title,"zh")),j}),q=D(()=>{const ne=new Map;for(const j of ie.value){const K=ne.get(j.cwd)??[];K.push(j),ne.set(j.cwd,K)}return Array.from(ne.entries()).map(([j,K])=>({cwd:j,items:K}))});async function ee(ne){await F.restoreSession(ne)&&(S.value=S.value.filter(K=>K.id!==ne))}function fe(ne){const j=new Date(ne);if(Number.isNaN(j.getTime()))return ne;const K=ve=>String(ve).padStart(2,"0");return`${j.getFullYear()}-${K(j.getMonth()+1)}-${K(j.getDate())} ${K(j.getHours())}:${K(j.getMinutes())}`}return(ne,j)=>(x(),Se(Qr,{open:!0,"close-on-esc":!1,title:C(n)("settings.title"),size:"xl",height:"fixed",padded:!1,onClose:j[19]||(j[19]=K=>s("close"))},{default:Ie(()=>[w("div",{ref_key:"dialogRef",ref:d,class:"sd"},[w("nav",{class:"settings-tabs",role:"tablist","aria-label":C(n)("settings.title")},[(x(),E(We,null,rt(r,K=>w("button",{key:K.id,type:"button",class:Ue(["tab",{on:i.value===K.id}]),role:"tab","aria-selected":i.value===K.id,onClick:ve=>T(K.id)},R(C(n)(K.labelKey)),11,T2e)),64))],8,E2e),w("div",N2e,[qn(w("section",I2e,[w("section",L2e,[w("h3",$2e,R(C(n)("settings.appearance")),1),w("div",F2e,[w("span",O2e,R(C(n)("theme.colorSchemeLabel")),1),ae(ys,{"model-value":e.colorScheme,options:[{value:"light",label:C(n)("theme.light")},{value:"dark",label:C(n)("theme.dark")},{value:"system",label:C(n)("theme.system")}],"onUpdate:modelValue":j[0]||(j[0]=K=>s("setColorScheme",K))},null,8,["model-value","options"])]),w("div",B2e,[w("span",R2e,R(C(n)("theme.accentLabel")),1),ae(ys,{"model-value":e.accent,options:[{value:"blue",label:C(n)("theme.accentBlue")},{value:"mono",label:C(n)("theme.accentBlack")}],"onUpdate:modelValue":j[1]||(j[1]=K=>s("setAccent",K))},null,8,["model-value","options"])]),w("div",D2e,[w("span",P2e,R(C(n)("settings.uiFontSize")),1),w("label",H2e,[w("input",{class:"num-input",type:"number",min:"12",max:"20",step:"1",value:e.uiFontSize,"aria-label":C(n)("settings.uiFontSize"),onInput:j[2]||(j[2]=K=>s("setUiFontSize",Number(K.target.value)))},null,40,W2e),j[20]||(j[20]=w("span",{class:"num-unit"},"px",-1))])]),w("div",z2e,[w("span",U2e,R(C(n)("sidebar.language")),1),ae(oN)]),w("div",q2e,[w("span",j2e,[ot(R(C(n)("settings.conversationToc"))+" ",1),w("span",V2e,R(C(n)("settings.conversationTocHint")),1)]),ae(Mr,{"model-value":e.conversationToc??!0,label:C(n)("settings.conversationToc"),"onUpdate:modelValue":j[3]||(j[3]=K=>s("setConversationToc",K))},null,8,["model-value","label"])])]),w("section",K2e,[w("h3",G2e,R(C(n)("settings.notifications")),1),w("div",Y2e,[w("span",Z2e,[ot(R(C(n)("settings.notifyOnComplete"))+" ",1),e.notifyPermission==="denied"?(x(),E("span",X2e,R(C(n)("settings.notifyDenied")),1)):ue("",!0)]),ae(Mr,{"model-value":e.notify,disabled:e.notifyPermission==="denied",label:C(n)("settings.notifyOnComplete"),"onUpdate:modelValue":j[4]||(j[4]=K=>s("setNotify",K))},null,8,["model-value","disabled","label"])]),w("div",Q2e,[w("span",J2e,[ot(R(C(n)("settings.notifyOnQuestion"))+" ",1),e.notifyPermission==="denied"?(x(),E("span",ebe,R(C(n)("settings.notifyDenied")),1)):ue("",!0)]),ae(Mr,{"model-value":e.notifyQuestion,disabled:e.notifyPermission==="denied",label:C(n)("settings.notifyOnQuestion"),"onUpdate:modelValue":j[5]||(j[5]=K=>s("setNotifyQuestion",K))},null,8,["model-value","disabled","label"])]),w("div",tbe,[w("span",nbe,[ot(R(C(n)("settings.notifyOnApproval"))+" ",1),e.notifyPermission==="denied"?(x(),E("span",obe,R(C(n)("settings.notifyDenied")),1)):ue("",!0)]),ae(Mr,{"model-value":e.notifyApproval,disabled:e.notifyPermission==="denied",label:C(n)("settings.notifyOnApproval"),"onUpdate:modelValue":j[6]||(j[6]=K=>s("setNotifyApproval",K))},null,8,["model-value","disabled","label"])]),w("div",sbe,[w("span",ibe,R(C(n)("settings.soundOnComplete")),1),ae(Mr,{"model-value":e.sound,label:C(n)("settings.soundOnComplete"),"onUpdate:modelValue":j[7]||(j[7]=K=>s("setSound",K))},null,8,["model-value","label"])])])],512),[[xi,i.value==="general"]]),qn(w("section",rbe,[w("section",lbe,[w("h3",abe,R(C(n)("settings.account")),1),w("div",cbe,[w("span",ube,R(e.authReady?"managed:kimi-code":C(n)("sidebar.notSignedIn")),1),ae(an,{text:e.accountModel},{default:Ie(()=>[e.authReady&&e.accountModel?(x(),E("span",dbe,R(e.accountModel),1)):ue("",!0)]),_:1},8,["text"])]),w("div",fbe,[ae(jt,{variant:"secondary",size:"sm",onClick:j[8]||(j[8]=K=>{s("openOnboarding"),s("close")})},{default:Ie(()=>[ot(R(C(n)("onboarding.reopen")),1)]),_:1}),e.authReady?(x(),Se(jt,{key:0,variant:"danger-soft",size:"sm",onClick:j[9]||(j[9]=K=>s("logout"))},{default:Ie(()=>[ot(R(C(n)("sidebar.signOut")),1)]),_:1})):(x(),Se(jt,{key:1,variant:"primary",size:"sm",onClick:j[10]||(j[10]=K=>s("login"))},{default:Ie(()=>[ot(R(C(n)("sidebar.signIn")),1)]),_:1}))])])],512),[[xi,i.value==="account"]]),qn(w("section",hbe,[w("section",pbe,[w("div",mbe,[w("h3",gbe,R(C(n)("settings.agentDefaults")),1),e.configSaving?(x(),E("span",vbe,R(C(n)("settings.saving")),1)):ue("",!0)]),e.config?(x(),E(We,{key:0},[w("div",ybe,[w("span",kbe,[ot(R(C(n)("settings.defaultModel"))+" ",1),w("span",bbe,R(C(n)("settings.defaultModelHint")),1)]),m.value.length>0?(x(),E("div",xbe,[ae(pk,{"model-value":e.config.defaultModel??"",disabled:e.configSaving,"aria-label":C(n)("settings.defaultModel"),"onUpdate:modelValue":b},{default:Ie(()=>[e.config.defaultModel?ue("",!0):(x(),E("option",wbe,R(C(n)("settings.noDefaultModel")),1)),(x(!0),E(We,null,rt(m.value,K=>(x(),E("optgroup",{key:K.provider,label:K.provider},[(x(!0),E(We,null,rt(K.options,ve=>(x(),E("option",{key:ve.id,value:ve.id},R(ve.label),9,Sbe))),128))],8,_be))),128))]),_:1},8,["model-value","disabled","aria-label"])])):(x(),E("span",Cbe,R(e.config.defaultModel??C(n)("settings.noDefaultModel")),1))]),w("div",Abe,[w("span",Mbe,[ot(R(C(n)("settings.defaultPermission"))+" ",1),w("span",Ebe,R(C(n)("settings.defaultPermissionHint")),1)]),ae(ys,{"model-value":y.value,options:c.map(K=>({value:K,label:C(n)(u[K])})),"onUpdate:modelValue":j[11]||(j[11]=K=>A(K))},null,8,["model-value","options"])]),w("div",Tbe,[w("span",Nbe,[ot(R(C(n)("settings.defaultThinking"))+" ",1),w("span",Ibe,R(C(n)("settings.defaultThinkingHint")),1)]),ae(Mr,{"model-value":N(),disabled:e.configSaving,label:C(n)("settings.defaultThinking"),"onUpdate:modelValue":j[12]||(j[12]=K=>M())},null,8,["model-value","disabled","label"])]),w("div",Lbe,[w("span",$be,[ot(R(C(n)("settings.defaultPlanMode"))+" ",1),w("span",Fbe,R(C(n)("settings.defaultPlanModeHint")),1)]),ae(Mr,{"model-value":v(e.config.defaultPlanMode),disabled:e.configSaving,label:C(n)("settings.defaultPlanMode"),"onUpdate:modelValue":j[13]||(j[13]=K=>I("defaultPlanMode"))},null,8,["model-value","disabled","label"])]),w("div",Obe,[w("span",Bbe,[ot(R(C(n)("settings.mergeSkills"))+" ",1),w("span",Rbe,R(C(n)("settings.mergeSkillsHint")),1)]),ae(Mr,{"model-value":v(e.config.mergeAllAvailableSkills),disabled:e.configSaving,label:C(n)("settings.mergeSkills"),"onUpdate:modelValue":j[14]||(j[14]=K=>I("mergeAllAvailableSkills"))},null,8,["model-value","disabled","label"])])],64)):(x(),E("div",Dbe,R(C(n)("settings.configUnavailable")),1))])],512),[[xi,i.value==="agent"]]),qn(w("section",Pbe,[w("section",Hbe,[w("h3",Wbe,R(C(n)("settings.advanced")),1),w("div",zbe,[w("span",Ube,R(C(n)("sidebar.daemon")),1),w("span",qbe,R(C(l)),1)]),w("div",jbe,[w("span",Vbe,R(C(n)("settings.backend")),1),w("span",Kbe,R(a.value),1)]),w("div",Gbe,[w("span",Ybe,R(C(n)("settings.serverVersion")),1),w("span",Zbe,R(e.serverVersion||"-"),1)]),e.config?(x(),E("div",Xbe,[w("span",Qbe,[ot(R(C(n)("settings.telemetry"))+" ",1),w("span",Jbe,R(C(n)("settings.telemetryHint")),1),w("span",exe,R(C(n)("settings.telemetryRestartHint")),1)]),ae(Mr,{"model-value":e.config.telemetry!==!1,disabled:e.configSaving,label:C(n)("settings.telemetry"),"onUpdate:modelValue":j[15]||(j[15]=K=>$())},null,8,["model-value","disabled","label"])])):ue("",!0),w("div",txe,[w("span",nxe,[ot(R(C(n)("settings.exportLog"))+" ",1),C(Yi)()?ue("",!0):(x(),E("span",oxe,R(C(n)("settings.logHint")),1))]),ae(jt,{variant:"secondary",size:"sm",onClick:h},{default:Ie(()=>[ot(R(C(n)("settings.exportLogBtn")),1)]),_:1})])])],512),[[xi,i.value==="advanced"]]),qn(w("section",sxe,[w("div",ixe,[j[21]||(j[21]=w("div",{class:"panel-kicker"},"Archived sessions",-1)),w("h4",rxe,R(C(n)("settings.archivedTitle")),1),w("p",lxe,R(C(n)("settings.archivedDesc")),1)]),w("div",axe,[w("label",cxe,[j[22]||(j[22]=w("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[w("circle",{cx:"11",cy:"11",r:"7"}),w("path",{d:"m21 21-4.3-4.3"})],-1)),qn(w("input",{"onUpdate:modelValue":j[16]||(j[16]=K=>z.value=K),placeholder:C(n)("settings.archivedSearch")},null,8,uxe),[[Cs,z.value]])]),ae(pk,{"model-value":L.value,size:"sm","aria-label":C(n)("settings.archivedAllWorkspaces"),"onUpdate:modelValue":j[17]||(j[17]=K=>L.value=K)},{default:Ie(()=>[w("option",dxe,R(C(n)("settings.archivedAllWorkspaces")),1),(x(!0),E(We,null,rt(Z.value,K=>(x(),E("option",{key:K,value:K},R(K),9,fxe))),128))]),_:1},8,["model-value","aria-label"]),ae(ys,{size:"sm","model-value":O.value,options:[{value:"archived-desc",label:C(n)("settings.archivedSortArchived")},{value:"created-desc",label:C(n)("settings.archivedSortCreated")},{value:"name-asc",label:C(n)("settings.archivedSortName")}],"onUpdate:modelValue":j[18]||(j[18]=K=>O.value=K)},null,8,["model-value","options"])]),B.value?(x(),E("div",hxe,R(C(n)("settings.archivedLoadingAll")),1)):(x(),E(We,{key:1},[q.value.length>0?(x(),E("div",pxe,[(x(!0),E(We,null,rt(q.value,K=>(x(),E("section",{key:K.cwd,class:"archive-card"},[w("div",mxe,[j[23]||(j[23]=w("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[w("path",{d:"M3 7h6l2 2h10v9H3z"}),w("path",{d:"M3 7V5h6l2 2"})],-1)),w("span",gxe,R(K.cwd),1),w("span",vxe,R(C(n)("settings.archivedSessionsCount",{count:K.items.length})),1)]),w("div",yxe,[(x(!0),E(We,null,rt(K.items,ve=>(x(),E("div",{key:ve.id,class:"archive-row"},[w("div",kxe,[w("div",bxe,R(ve.title),1),w("div",xxe,R(C(n)("settings.archivedAt",{time:fe(ve.updatedAt)})),1)]),ae(jt,{variant:"secondary",size:"sm",onClick:he=>ee(ve.id)},{default:Ie(()=>[ot(R(C(n)("settings.archivedRestore")),1)]),_:1},8,["onClick"])]))),128))])]))),128))])):(x(),E("div",wxe,R(S.value.length===0?C(n)("settings.archivedEmpty"):C(n)("settings.archivedNoMatch")),1))],64))],512),[[xi,i.value==="archived"]])])],512)]),_:1},8,["title"]))}}),Cxe=dt(Sxe,[["__scopeId","data-v-1b1b3473"]]),Axe=/^(?:\/|~(?:\/|$)|[A-Za-z]:[\\/]|\\\\)/,sN=/^[A-Za-z]:[\\/]/,Mxe=/^\/\/(?!\/)/;function Uv(e){return Axe.test(e.trim())}function Exe(e,t){return e==="~"?t||e:e.startsWith("~/")?(t||"~")+e.slice(1):e}function Txe(e){return Mxe.test(e)?`//${e.slice(2).replaceAll(/\/{2,}/g,"/")}`:e.replaceAll(/\/{2,}/g,"/")}function Nxe(e){return sN.test(e)||e.startsWith("\\\\")||e.startsWith("//")}function Ixe(e){return sN.test(e)?3:e.startsWith("\\\\")||e.startsWith("//")?2:e.startsWith("/")?1:0}function Sk(e,t){let n=Txe(Exe(e.trim(),t));const o=Nxe(n),s=n==="/"||n==="//"||n==="\\\\"||/^[A-Za-z]:[\\/]$/.test(n),i=o?/[\\/]$/.test(n):n.endsWith("/");!s&&i&&(n=n.slice(0,-1));const r=n.lastIndexOf("/"),l=o?n.lastIndexOf("\\"):-1,a=Math.max(r,l),c=l>r?"\\":"/",u=Ixe(n),d=a<u?n.slice(0,u)||"/":n.slice(0,a)||"/";return{target:n,parent:d,base:n.slice(a+1),separator:c}}function Lxe(e,t,n){return`${e}${e.endsWith(n)?"":n}${t}`}function $xe(e,t,n){if(n===null)return null;const{target:o}=Sk(e,t);return o===n?n:null}const Fxe={class:"aw"},Oxe={key:0,class:"crumbbar"},Bxe={class:"crumbs"},Rxe={key:0,class:"crumb-sep"},Dxe=["onClick"],Pxe=["placeholder"],Hxe={key:2,class:"folder-list"},Wxe={key:0,class:"fl-loading"},zxe={key:0,class:"fl-loading"},Uxe={key:0,class:"fl-note"},qxe=["onClick"],jxe={class:"folder-name"},Vxe={key:1,class:"fl-empty fl-error"},Kxe={key:2,class:"fl-empty fl-error"},Gxe=["onClick"],Yxe={class:"folder-name search-rel"},Zxe={key:0,class:"fl-empty"},Xxe={key:1,class:"fl-loading"},Qxe=["onClick"],Jxe={class:"folder-name"},ewe={key:0,class:"fl-empty"},twe={key:3,class:"degraded-hint"},nwe={key:4,class:"add-error",role:"alert"},owe={class:"actions"},swe={class:"footer-hint"},iwe=600,rwe=6,sA=150,lwe=Je({__name:"AddWorkspaceDialog",props:{browseFs:{type:Function},getFsHome:{type:Function},defaultPath:{},error:{}},emits:["add","close"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=oe(!0),r=oe(!1),l=oe(!1),a=oe(""),c=oe(null),u=oe([]),d=oe(""),f=oe(!1),h=oe([]),p=D(()=>d.value.trim().length>0);let m=0,y=null;const k=D(()=>Uv(d.value)),g=oe("idle"),v=oe(""),b=oe("/"),A=oe([]),I=oe(""),N=oe(null),M=oe(null),$=D(()=>g.value!=="valid"?null:$xe(d.value,I.value,M.value));let T=0,F=null;function S(j,K){const ve=j.toLowerCase(),he=K.toLowerCase();let Ae=0;for(let re=0;re<he.length&&Ae<ve.length;re++)he[re]===ve[Ae]&&Ae++;return Ae===ve.length}async function B(j){const K=a.value,ve=j.trim();if(!K||ve===""){h.value=[],f.value=!1;return}const he=++m;f.value=!0;const Ae=[],re=[{path:K,depth:0}];let Y=0;for(;re.length>0&&Y<iwe&&Ae.length<sA;){if(he!==m)return;const Q=re.shift();Y++;let P;try{P=await o.browseFs(Q.path)}catch{continue}if(he!==m)return;for(const G of P.entries){if(!G.isDir)continue;const me=G.path.startsWith(K)?G.path.slice(K.length).replace(/^\/+/,""):G.path;if(S(ve,me||G.name)&&(Ae.push({path:G.path,name:G.name,rel:me||G.name}),Ae.length>=sA))break;Q.depth+1<rwe&&re.push({path:G.path,depth:Q.depth+1})}he===m&&(h.value=[...Ae])}he===m&&(f.value=!1)}et(d,j=>{y&&clearTimeout(y),F&&clearTimeout(F),T++,g.value="idle",A.value=[],M.value=null;const K=j.trim();if(K===""){m++,h.value=[],f.value=!1;return}if(Uv(K)){if(m++,h.value=[],f.value=!1,l.value)return;g.value="checking",F=setTimeout(()=>void W(K),150);return}y=setTimeout(()=>void B(j),220)});async function W(j){const K=++T;g.value="checking",M.value=null;const ve=Sk(j,I.value),{target:he}=ve;try{const re=await o.browseFs(he);if(K!==T)return;if(re.path){g.value="valid",A.value=[],M.value=he,a.value=re.path,c.value=re.parent,u.value=re.entries,l.value=!1;return}}catch{}if(K!==T)return;const Ae=ve.base.toLowerCase();v.value=ve.parent,b.value=ve.separator;try{const re=await o.browseFs(ve.parent);if(K!==T)return;if(re.path){A.value=re.entries.filter(Y=>Y.isDir&&Y.name.toLowerCase().startsWith(Ae)),g.value="not-found";return}}catch{}K===T&&(A.value=[],g.value="bad-parent")}function z(j){d.value=Lxe(v.value,j,b.value),N.value?.focus()}const L=D(()=>l.value?n("workspace.degradedPlaceholder"):n("workspace.searchPlaceholder")),O=D(()=>l.value?n("workspace.degradedHint"):k.value&&g.value==="valid"?n("workspace.pathFollowHint"):n("workspace.browseHint"));function U(j){if(j.key==="Escape"){d.value?d.value="":s("close");return}if(j.key!=="Enter")return;const K=d.value.trim();if(Uv(K)){if(j.preventDefault(),l.value){const{target:ve}=Sk(K,I.value);ve&&s("add",ve);return}g.value==="valid"?ne():g.value==="not-found"&&A.value[0]&&z(A.value[0].name)}}const Z=D(()=>{const j=a.value;if(!j)return[];const K=j.split("/").filter(Boolean),ve=[{label:"/",path:"/"}];let he="";for(const Ae of K)he+=`/${Ae}`,ve.push({label:Ae,path:he});return ve}),ie=D(()=>!(a.value.length===0||k.value&&$.value===null));async function q(j){r.value=!0;try{const K=await o.browseFs(j);if(!K.path){l.value=!0;return}a.value=K.path,c.value=K.parent,u.value=K.entries,d.value="",l.value=!1}catch{l.value=!0}finally{r.value=!1}}function ee(j){j.isDir&&q(j.path)}function fe(){c.value&&q(c.value)}function ne(){ie.value&&s("add",$.value??a.value)}return An(async()=>{r.value=!0;try{const j=await o.getFsHome().catch(()=>({home:"",recentRoots:[]}));if(j.home&&(I.value=j.home),o.defaultPath&&(await q(o.defaultPath),!l.value))return;I.value?await q(I.value):l.value=!0}catch{l.value=!0}finally{r.value=!1}}),On(()=>{y&&clearTimeout(y),F&&clearTimeout(F)}),(j,K)=>(x(),Se(Qr,{open:i.value,"onUpdate:open":K[2]||(K[2]=ve=>i.value=ve),title:C(n)("workspace.addTitle"),size:"lg",height:"fixed",onClose:K[3]||(K[3]=ve=>s("close"))},{default:Ie(()=>[w("div",Fxe,[l.value?ue("",!0):(x(),E("div",Oxe,[ae(Xn,{size:"sm",disabled:!c.value,label:C(n)("workspace.up"),onClick:fe},{default:Ie(()=>[ae(Ge,{name:"arrow-up",size:"md"})]),_:1},8,["disabled","label"]),w("div",Bxe,[(x(!0),E(We,null,rt(Z.value,(ve,he)=>(x(),E(We,{key:ve.path},[he>1?(x(),E("span",Rxe,"/")):ue("",!0),w("button",{class:Ue(["crumb",{last:he===Z.value.length-1}]),onClick:Ae=>q(ve.path)},R(ve.label),11,Dxe)],64))),128))])])),!r.value||l.value?(x(),E("div",{key:1,class:Ue(["filterbar",{"has-error":g.value==="not-found"||g.value==="bad-parent"}])},[ae(Ge,{class:"filter-icon",name:"search",size:"md"}),qn(w("input",{ref_key:"filterEl",ref:N,"onUpdate:modelValue":K[0]||(K[0]=ve=>d.value=ve),class:"filter-input",type:"text",placeholder:L.value,autocomplete:"off",spellcheck:"false",onKeydown:St(U,["stop"])},null,40,Pxe),[[Cs,d.value]]),f.value||g.value==="checking"?(x(),Se(Us,{key:0,size:"sm"})):ue("",!0)],2)):ue("",!0),l.value?(x(),E("div",twe,R(C(n)("workspace.degradedHint")),1)):(x(),E("div",Hxe,[r.value?(x(),E("div",Wxe,R(C(n)("workspace.browsing")),1)):k.value&&g.value!=="valid"?(x(),E(We,{key:1},[g.value==="checking"?(x(),E("div",zxe,R(C(n)("workspace.checkingPath")),1)):g.value==="not-found"?(x(),E(We,{key:1},[A.value.length>0?(x(),E("div",Uxe,R(C(n)("workspace.pathPickHint")),1)):ue("",!0),(x(!0),E(We,null,rt(A.value,ve=>(x(),E("button",{key:ve.path,class:"folder-row",onClick:he=>z(ve.name)},[ae(Ge,{class:"dir-icon",name:"folder-closed",size:"sm"}),w("span",jxe,R(ve.name),1)],8,qxe))),128)),A.value.length===0?(x(),E("div",Vxe,R(C(n)("workspace.noPathMatch",{parent:v.value})),1)):ue("",!0)],64)):g.value==="bad-parent"?(x(),E("div",Kxe,R(C(n)("workspace.badParent",{parent:v.value})),1)):ue("",!0)],64)):p.value&&!k.value?(x(),E(We,{key:2},[(x(!0),E(We,null,rt(h.value,ve=>(x(),E("button",{key:ve.path,class:"folder-row",onClick:he=>q(ve.path)},[ae(Ge,{class:"dir-icon",name:"folder-closed",size:"sm"}),w("span",Yxe,R(ve.rel),1)],8,Gxe))),128)),!f.value&&h.value.length===0?(x(),E("div",Zxe,R(C(n)("workspace.noFilterMatch",{q:d.value.trim()})),1)):f.value&&h.value.length===0?(x(),E("div",Xxe,R(C(n)("workspace.searching")),1)):ue("",!0)],64)):(x(),E(We,{key:3},[(x(!0),E(We,null,rt(u.value,ve=>(x(),E("button",{key:ve.path,class:"folder-row",onClick:he=>ee(ve)},[ae(Ge,{class:"dir-icon",name:"folder-closed",size:"sm"}),w("span",Jxe,R(ve.name),1)],8,Qxe))),128)),u.value.length===0?(x(),E("div",ewe,R(C(n)("workspace.noSubfolders")),1)):ue("",!0)],64))])),e.error?(x(),E("div",nwe,R(e.error),1)):ue("",!0),w("div",owe,[ae(an,{text:a.value},{default:Ie(()=>[l.value?ue("",!0):(x(),Se(jt,{key:0,variant:"primary",disabled:!ie.value,onClick:ne},{default:Ie(()=>[ot(R(C(n)("workspace.openThisFolder")),1)]),_:1},8,["disabled"]))]),_:1},8,["text"]),ae(jt,{variant:"secondary",onClick:K[1]||(K[1]=ve=>s("close"))},{default:Ie(()=>[ot(R(C(n)("workspace.cancel")),1)]),_:1})]),w("div",swe,R(O.value),1)])]),_:1},8,["open","title"]))}}),awe=dt(lwe,[["__scopeId","data-v-07cbb13d"]]),cwe={key:0,class:"confirm-dialog__message"},uwe=Je({__name:"ConfirmDialog",props:{open:{type:Boolean},title:{},message:{},confirmLabel:{},cancelLabel:{},variant:{default:"danger"},loading:{type:Boolean}},emits:["update:open","confirm","cancel"],setup(e,{emit:t}){const n=e,o=t,{t:s}=$t();function i(){n.loading||(o("update:open",!1),o("cancel"))}function r(l){if(l.key!=="Enter"||!n.open||n.loading)return;const a=l.target;a instanceof HTMLButtonElement||a instanceof HTMLAnchorElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement||a instanceof HTMLInputElement||(l.preventDefault(),o("confirm"))}return typeof window<"u"&&window.addEventListener("keydown",r),ho(()=>{typeof window<"u"&&window.removeEventListener("keydown",r)}),(l,a)=>(x(),Se(Qr,{open:e.open,title:e.title,height:"auto","initial-focus":".confirm-dialog__confirm","close-on-esc":!e.loading,"close-on-overlay":!e.loading,"onUpdate:open":a[1]||(a[1]=c=>o("update:open",c)),onClose:i},{foot:Ie(()=>[ae(jt,{variant:"secondary",disabled:e.loading,onClick:i},{default:Ie(()=>[ot(R(e.cancelLabel??C(s)("common.cancel")),1)]),_:1},8,["disabled"]),ae(jt,{class:"confirm-dialog__confirm",variant:e.variant,loading:e.loading,onClick:a[0]||(a[0]=c=>o("confirm"))},{default:Ie(()=>[ot(R(e.confirmLabel??C(s)("common.confirm")),1)]),_:1},8,["variant","loading"])]),default:Ie(()=>[e.message?(x(),E("p",cwe,R(e.message),1)):ue("",!0)]),_:1},8,["open","title","close-on-esc","close-on-overlay"]))}}),dwe=dt(uwe,[["__scopeId","data-v-2e719024"]]),fwe=Je({__name:"ConfirmDialogHost",setup(e){const{current:t,busy:n,settle:o,runAction:s}=Gf();function i(){s()}return(r,l)=>(x(),Se(dwe,{open:C(t)!==null,title:C(t)?.title??"",message:C(t)?.message,"confirm-label":C(t)?.confirmLabel,"cancel-label":C(t)?.cancelLabel,variant:C(t)?.variant,loading:C(n),onConfirm:i,onCancel:l[0]||(l[0]=a=>C(o)(!1))},null,8,["open","title","message","confirm-label","cancel-label","variant","loading"]))}}),hwe={class:"rows"},pwe={class:"row"},mwe={class:"row"},gwe={class:"row"},vwe={class:"row"},ywe={class:"row"},kwe={class:"row"},bwe={class:"ctx-text"},xwe={key:0,class:"bar"},wwe={class:"row"},_we=Je({__name:"StatusPanel",props:{status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},costUsd:{}},emits:["close"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=oe(!0),r=D(()=>o.status.ctxMax<=0?0:Math.min(100,Math.max(0,Math.ceil(o.status.ctxUsed/o.status.ctxMax*100)))),l=D(()=>o.status.ctxMax>0?n("status.statusContextValue",{used:pr(o.status.ctxUsed),max:pr(o.status.ctxMax),pct:r.value}):n("status.statusNone"));function a(p){return n(p==="yolo"?"status.permissionYolo":p==="auto"?"status.permissionAuto":"status.permissionManual")}const c=D(()=>{const p=o.status.permission;return p==="yolo"?"var(--color-warning)":p==="auto"?"var(--color-danger)":"var(--color-text)"}),u=D(()=>o.planMode?n("status.planOn"):n("status.planOff")),d=D(()=>o.swarmMode?n("status.swarmOn"):n("status.swarmOff")),f=D(()=>typeof o.costUsd=="number"&&o.costUsd>0),h=D(()=>f.value?`$${o.costUsd.toFixed(4)}`:n("status.statusNone"));return(p,m)=>(x(),Se(Qr,{open:i.value,"onUpdate:open":m[0]||(m[0]=y=>i.value=y),title:C(n)("status.statusPanelTitle"),onClose:m[1]||(m[1]=y=>s("close"))},{default:Ie(()=>[w("dl",hwe,[w("div",pwe,[w("dt",null,R(C(n)("status.statusModel")),1),w("dd",null,R(e.status.model),1)]),w("div",mwe,[w("dt",null,R(C(n)("status.statusThinking")),1),w("dd",null,R(e.thinking),1)]),w("div",gwe,[w("dt",null,R(C(n)("status.statusPermission")),1),w("dd",{style:on({color:c.value})},R(a(e.status.permission)),5)]),w("div",vwe,[w("dt",null,R(C(n)("status.statusPlanMode")),1),w("dd",{class:Ue({"plan-on":e.planMode})},R(u.value),3)]),w("div",ywe,[w("dt",null,R(C(n)("status.statusSwarmMode")),1),w("dd",{class:Ue({"swarm-on":e.swarmMode})},R(d.value),3)]),w("div",kwe,[w("dt",null,R(C(n)("status.statusContext")),1),w("dd",null,[w("span",bwe,R(l.value),1),e.status.ctxMax>0?(x(),E("span",xwe,[w("i",{style:on({width:r.value+"%"})},null,4)])):ue("",!0)])]),w("div",wwe,[w("dt",null,R(C(n)("status.statusCost")),1),w("dd",null,R(h.value),1)])])]),_:1},8,["open","title"]))}}),Swe=dt(_we,[["__scopeId","data-v-09f83ff0"]]),Cwe={class:"ui-toast__icon","aria-hidden":"true"},Awe={class:"ui-toast__body"},Mwe={class:"ui-toast__title"},Ewe={key:0,class:"ui-toast__msg"},Twe=Je({__name:"Toast",props:{variant:{default:"info"},title:{},message:{},dismissLabel:{default:"Dismiss"}},emits:["dismiss"],setup(e){return(t,n)=>(x(),E("div",{class:Ue(["ui-toast",`ui-toast--${e.variant}`])},[w("span",Cwe,[jn(t.$slots,"icon",{},()=>[e.variant==="success"?(x(),Se(Ge,{key:0,name:"check"})):e.variant==="danger"?(x(),Se(Ge,{key:1,name:"close"})):e.variant==="warning"?(x(),Se(Ge,{key:2,name:"alert-triangle"})):(x(),Se(Ge,{key:3,name:"info"}))],!0)]),w("div",Awe,[w("div",Mwe,R(e.title),1),e.message?(x(),E("div",Ewe,R(e.message),1)):ue("",!0),jn(t.$slots,"default",{},void 0,!0)]),ae(Xn,{class:"ui-toast__close",size:"sm",label:e.dismissLabel,onClick:n[0]||(n[0]=o=>t.$emit("dismiss"))},{default:Ie(()=>[ae(Ge,{name:"close",size:"sm"})]),_:1},8,["label"])],2))}}),Nwe=dt(Twe,[["__scopeId","data-v-adc6f346"]]),Iwe={key:0,class:"actions"},Lwe=["onClick"],$we=["onClick"],Fwe={key:1,class:"details"},Owe=Je({__name:"WarningToasts",props:{warnings:{}},emits:["dismiss"],setup(e,{emit:t}){const n=e,o=t,{t:s}=$t();function i(M){return typeof M=="object"&&M!==null}function r(M){return i(M)?M.title:M}function l(M){return i(M)?M.message??"":""}function a(M){return i(M)?M.details:void 0}function c(M){return i(M)?M.severity==="error":M.startsWith(`${s("warnings.errorLabel")}:`)||/\b4\d\d\b|error|失败|failed/i.test(M)}function u(M){return i(M)?`notice:${M.severity}:${M.title}:${M.message??""}:${JSON.stringify(M.details??[])}`:`text:${M}`}function d(M){if(!i(M))return M;const $=[M.title];M.message&&$.push(M.message);const T=M.details??[];if(T.length>0){$.push("",`${s("warnings.diagnostics")}:`);for(const F of T)$.push(`${F.label}: ${F.value}`)}return $.join(`
342
+ `)}let f=1;const h=oe([]),p=new Map,m=new Map;function y(M){const $=c(M)?12e3:6e3;return typeof window<"u"&&window.matchMedia?.("(hover: none)").matches===!0?$+5e3:$}function k(M,$){const T=p.get(M)??{handle:null,deadline:0,remaining:0};T.handle=setTimeout(()=>N(M),$),T.deadline=Date.now()+$,p.set(M,T)}function g(M){const $=p.get(M);$&&$.handle!==null&&clearTimeout($.handle),p.delete(M)}function v(M){const $=p.get(M);!$||$.handle===null||(clearTimeout($.handle),$.handle=null,$.remaining=Math.max(0,$.deadline-Date.now()))}function b(M){if(h.value.find(F=>F.id===M)?.detailsOpen)return;const T=p.get(M);!T||T.handle!==null||k(M,T.remaining)}function A(M){M.detailsOpen=!M.detailsOpen,M.detailsOpen?v(M.id):b(M.id)}async function I(M){if(!await Jo(d(M.warning)))return;M.copied=!0;const T=m.get(M.id);T&&clearTimeout(T),m.set(M.id,setTimeout(()=>{M.copied=!1,m.delete(M.id)},1400))}function N(M){g(M);const $=m.get(M);$&&clearTimeout($),m.delete(M);const T=h.value.findIndex(F=>F.id===M);T!==-1&&(h.value=h.value.filter(F=>F.id!==M),o("dismiss",T))}return et(()=>n.warnings,M=>{const $=[...h.value];h.value=M.map(T=>{const F=u(T),S=$.findIndex(z=>z.key===F),B=S===-1?void 0:$.splice(S,1)[0];if(B)return B.warning=T,B;const W={id:f++,key:F,warning:T,detailsOpen:!1,copied:!1};return k(W.id,y(T)),W});for(const T of $){g(T.id);const F=m.get(T.id);F&&clearTimeout(F),m.delete(T.id)}},{immediate:!0,flush:"post"}),On(()=>{p.forEach(M=>{M.handle!==null&&clearTimeout(M.handle)}),p.clear(),m.forEach(M=>clearTimeout(M)),m.clear()}),(M,$)=>(x(),Se(Z7,{name:"toast",tag:"div",class:"toasts",role:"status","aria-live":"polite"},{default:Ie(()=>[(x(!0),E(We,null,rt(h.value,T=>(x(),Se(Nwe,{key:T.id,variant:c(T.warning)?"danger":"warning",title:r(T.warning),message:l(T.warning),"dismiss-label":C(s)("warnings.dismiss"),onDismiss:F=>N(T.id),onPointerenter:F=>v(T.id),onPointerleave:F=>b(T.id)},{default:Ie(()=>[a(T.warning)?.length?(x(),E("div",Iwe,[w("button",{class:"link",type:"button",onClick:F=>A(T)},R(T.detailsOpen?C(s)("warnings.hideDetails"):C(s)("warnings.showDetails")),9,Lwe),w("button",{class:"link",type:"button",onClick:F=>I(T)},R(T.copied?C(s)("warnings.copied"):C(s)("warnings.copyDetails")),9,$we)])):ue("",!0),T.detailsOpen&&a(T.warning)?.length?(x(),E("dl",Fwe,[(x(!0),E(We,null,rt(a(T.warning),F=>(x(),E("div",{key:`${F.label}:${F.value}`,class:"detail-row"},[w("dt",null,R(F.label),1),w("dd",null,R(F.value),1)]))),128))])):ue("",!0)]),_:2},1032,["variant","title","message","dismiss-label","onDismiss","onPointerenter","onPointerleave"]))),128))]),_:1}))}}),Bwe=dt(Owe,[["__scopeId","data-v-6cc72bd4"]]),Rwe={class:"topbar"},Dwe={class:"wsq"},Pwe=["aria-label"],Hwe={class:"tb-path"},Wwe={class:"ws"},zwe={class:"se"},Uwe={class:"tb-sub"},qwe=Je({__name:"MobileTopBar",props:{workspace:{default:null},sessionTitle:{default:""},running:{type:Boolean,default:!1},branch:{default:""},sessionCount:{default:0}},emits:["openSwitcher","openSettings"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t,i=D(()=>{const a=o.workspace,u=(a?.name||a?.root||"").trim().charAt(0);return u?u.toUpperCase():"K"}),r=D(()=>o.workspace?.name??n("workspace.noWorkspace")),l=D(()=>o.running?n("mobile.running"):n("mobile.idle"));return(a,c)=>(x(),E("div",Rwe,[w("span",Dwe,R(i.value),1),w("button",{type:"button",class:"tb-mid","aria-label":C(n)("mobile.openSwitcher"),onClick:c[0]||(c[0]=u=>s("openSwitcher"))},[w("span",Hwe,[w("span",Wwe,R(r.value),1),e.sessionTitle?(x(),E(We,{key:0},[c[2]||(c[2]=w("span",{class:"sl"},"/",-1)),w("span",zwe,R(e.sessionTitle),1)],64)):ue("",!0),c[3]||(c[3]=w("span",{class:"cv"},"⌄",-1))]),w("span",Uwe,[w("span",{class:Ue(["rd",{on:e.running}])},null,2),w("span",null,R(l.value),1),e.branch?(x(),E(We,{key:0},[ot(" · "+R(e.branch),1)],64)):ue("",!0),e.sessionCount>0?(x(),E(We,{key:1},[ot(" · "+R(C(n)("mobile.sessionCount",{n:e.sessionCount})),1)],64)):ue("",!0)])],8,Pwe),ae(Xn,{size:"lg",label:C(n)("mobile.openSettings"),onClick:c[1]||(c[1]=u=>s("openSettings"))},{default:Ie(()=>[ae(Ge,{name:"sliders",size:"lg"})]),_:1},8,["label"])]))}}),jwe=dt(qwe,[["__scopeId","data-v-6b4b901f"]]),Vwe={key:0,class:"sheet-root"},Kwe=["aria-label"],Gwe=["aria-label"],Ywe={key:0,class:"sheet-head"},Zwe={class:"sheet-title"},Xwe={class:"sheet-body"},Qwe=Je({__name:"BottomSheet",props:{modelValue:{type:Boolean},title:{default:""}},emits:["update:modelValue","close"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t;function i(){s("update:modelValue",!1),s("close")}function r(l){l.key==="Escape"&&i()}return et(()=>o.modelValue,l=>{typeof document>"u"||(l?document.addEventListener("keydown",r):document.removeEventListener("keydown",r))},{immediate:!0}),On(()=>{typeof document<"u"&&document.removeEventListener("keydown",r)}),(l,a)=>(x(),Se(Ua,{name:"sheet"},{default:Ie(()=>[e.modelValue?(x(),E("div",Vwe,[w("div",{class:"sheet-scrim",onClick:i}),w("div",{class:"sheet-panel",role:"dialog","aria-label":e.title||C(n)("mobile.sheetLabel")},[w("button",{type:"button",class:"sheet-grab","aria-label":C(n)("mobile.closeSheet"),onClick:i},null,8,Gwe),e.title?(x(),E("div",Ywe,[w("span",Zwe,R(e.title),1)])):ue("",!0),w("div",Xwe,[jn(l.$slots,"default",{},void 0,!0)])],8,Kwe)])):ue("",!0)]),_:3}))}}),iN=dt(Qwe,[["__scopeId","data-v-745ee5a2"]]),Jwe={class:"mlist"},e_e={key:0,class:"mempty"},t_e=["onClick"],n_e={class:"mgh-main"},o_e={class:"mgh-name"},s_e={class:"mgh-path"},i_e={key:2,class:"att"},r_e={key:0,class:"mempty small"},l_e=["onClick"],a_e={class:"m"},c_e={class:"s"},u_e={key:0,class:"att"},d_e=["disabled","onClick"],f_e=["onClick"],h_e=Je({__name:"MobileSwitcherSheet",props:{modelValue:{type:Boolean},groups:{},activeWorkspaceId:{default:null},activeId:{},attentionBySession:{default:()=>({})},attentionByWorkspace:{default:()=>({})}},emits:["update:modelValue","select","create","createInWorkspace","addWorkspace","rename","archive","deleteWorkspace","loadMore"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t;function i(){s("update:modelValue",!1)}function r(F){s("select",F),i()}function l(F){s("createInWorkspace",F),i()}function a(){s("create"),i()}function c(){s("addWorkspace"),i()}const u=oe(new Set);function d(F){return u.value.has(F)}function f(F){const S=new Set(u.value);S.has(F)?S.delete(F):S.add(F),u.value=S,v.value=null,N.value=null}const h=oe(new Set);function p(F){return h.value.has(F)}function m(F){const S=new Set(h.value);S.has(F)?S.delete(F):S.add(F),h.value=S}function y(F){if(p(F.workspace.id))return F.sessions;const S=F.sessions.slice(0,F.initialCount);if(o.activeId&&!S.some(B=>B.id===o.activeId)){const B=F.sessions.find(W=>W.id===o.activeId);if(B)return[...S,B]}return S}function k(F){if(!h.value.has(F)){const S=new Set(h.value);S.add(F),h.value=S}s("loadMore",F)}function g(F){return o.attentionByWorkspace[F]??0}const v=oe(null);function b(F){v.value=v.value===F?null:F,N.value=null}function A(F){v.value=null;const B=(typeof window<"u"?window.prompt(n("sidebar.rename"),F.title):null)?.trim();B&&s("rename",F.id,B)}function I(F){v.value=null,s("archive",F)}const N=oe(null);function M(F){N.value=N.value===F?null:F,v.value=null}function $(F){Jo(F.root),N.value=null}function T(F){N.value=null,s("deleteWorkspace",F.id)}return(F,S)=>(x(),Se(iN,{"model-value":e.modelValue,"onUpdate:modelValue":S[2]||(S[2]=B=>s("update:modelValue",B))},{default:Ie(()=>[w("button",{type:"button",class:"newrow",onClick:a},[ae(Ge,{name:"message",size:"sm"}),ot(" "+R(C(n)("sidebar.newChat")),1)]),w("button",{type:"button",class:"newrow secondary",onClick:c},[ae(Ge,{name:"folder",size:"sm"}),ot(" "+R(C(n)("sidebar.newWorkspace")),1)]),w("div",Jwe,[e.groups.length===0?(x(),E("div",e_e,R(C(n)("workspace.noWorkspace")),1)):ue("",!0),(x(!0),E(We,null,rt(e.groups,B=>(x(),E("div",{key:B.workspace.id,class:"mgroup"},[w("div",{class:Ue(["mgh",{on:B.workspace.id===e.activeWorkspaceId}]),onClick:W=>f(B.workspace.id)},[d(B.workspace.id)?(x(),Se(Ge,{key:0,class:"mgh-folder",name:"folder-closed",size:"sm"})):(x(),Se(Ge,{key:1,class:"mgh-folder",name:"folder",size:"sm"})),w("div",n_e,[w("span",o_e,R(B.workspace.name),1),ae(an,{text:B.workspace.root},{default:Ie(()=>[w("span",s_e,R(B.workspace.shortPath),1)]),_:2},1032,["text"])]),d(B.workspace.id)&&g(B.workspace.id)>0?(x(),E("span",i_e,R(g(B.workspace.id)),1)):ue("",!0),ae(Xn,{size:"lg",class:"mgh-more",label:C(n)("sidebar.options"),onClick:St(W=>M(B.workspace.id),["stop"])},{default:Ie(()=>[ae(Ge,{name:"dots-horizontal",size:"md"})]),_:1},8,["label","onClick"]),ae(Xn,{size:"lg",class:"mgh-add",label:C(n)("workspace.newInGroup"),onClick:St(W=>l(B.workspace.id),["stop"])},{default:Ie(()=>[ae(Ge,{name:"plus",size:"md"})]),_:1},8,["label","onClick"]),N.value===B.workspace.id?(x(),Se(Ml,{key:3,class:"kmenu wsmenu",onClick:S[0]||(S[0]=St(()=>{},["stop"]))},{default:Ie(()=>[ae(Tn,{size:"lg",onClick:W=>$(B.workspace)},{default:Ie(()=>[ot(R(C(n)("sidebar.copyPath")),1)]),_:1},8,["onClick"]),ae(Tn,{size:"lg",danger:"",onClick:W=>T(B.workspace)},{default:Ie(()=>[ot(R(C(n)("sidebar.delete")),1)]),_:1},8,["onClick"])]),_:2},1024)):ue("",!0)],10,t_e),qn(w("div",null,[B.sessions.length===0?(x(),E("div",r_e,R(C(n)("sidebar.noSessions")),1)):ue("",!0),(x(!0),E(We,null,rt(y(B),W=>(x(),E("div",{key:W.id,class:Ue(["srow",{cur:W.id===e.activeId}]),onClick:z=>r(W.id)},[w("div",a_e,[w("div",{class:Ue(["t",{run:W.busy,aborted:!W.busy&&(e.attentionBySession[W.id]??0)===0&&(W.lastTurnReason==="cancelled"||W.lastTurnReason==="failed")}])},R(W.title),3),w("div",c_e,R(W.time),1)]),(e.attentionBySession[W.id]??0)>0?(x(),E("span",u_e,R(e.attentionBySession[W.id]),1)):ue("",!0),ae(Xn,{size:"lg",class:"kb",label:C(n)("sidebar.options"),onClick:St(z=>b(W.id),["stop"])},{default:Ie(()=>[ae(Ge,{name:"dots-horizontal",size:"md"})]),_:1},8,["label","onClick"]),v.value===W.id?(x(),Se(Ml,{key:1,class:"kmenu",onClick:S[1]||(S[1]=St(()=>{},["stop"]))},{default:Ie(()=>[ae(Tn,{size:"lg",onClick:z=>A(W)},{default:Ie(()=>[ot(R(C(n)("sidebar.rename")),1)]),_:1},8,["onClick"]),ae(Tn,{size:"lg",danger:"",onClick:z=>I(W.id)},{default:Ie(()=>[ot(R(C(n)("sidebar.archive")),1)]),_:1},8,["onClick"])]),_:2},1024)):ue("",!0)],10,l_e))),128)),B.hasMore||B.loadingMore?(x(),E("button",{key:1,type:"button",class:"mshow-more",disabled:B.loadingMore,onClick:St(W=>k(B.workspace.id),["stop"])},R(B.loadingMore?C(n)("sidebar.loadingMore"):C(n)("sidebar.showMore",{count:Math.max(0,B.workspace.sessionCount-B.sessions.length)})),9,d_e)):ue("",!0),B.sessions.length>B.initialCount?(x(),E("button",{key:2,type:"button",class:"mshow-more",onClick:St(W=>m(B.workspace.id),["stop"])},R(p(B.workspace.id)?C(n)("sidebar.showLess"):C(n)("sidebar.showAll",{count:B.sessions.length-B.initialCount})),9,f_e)):ue("",!0)],512),[[xi,!d(B.workspace.id)]])]))),128))])]),_:1},8,["model-value"]))}}),p_e=dt(h_e,[["__scopeId","data-v-d83960da"]]),m_e={class:"group-title"},g_e={class:"srow-main"},v_e={class:"srow-label"},y_e={class:"srow-sub"},k_e={class:"srow read-only"},b_e={class:"srow-main"},x_e={class:"srow-label"},w_e={key:0,class:"srow-sub"},__e={class:"cache-note"},S_e={class:"srow-main"},C_e={class:"srow-label"},A_e={class:"srow-sub"},M_e=["aria-checked"],E_e={class:"srow-main"},T_e={class:"srow-label"},N_e={class:"srow-sub"},I_e=["aria-checked"],L_e={class:"srow-main"},$_e={class:"srow-label"},F_e={class:"srow read-only"},O_e={class:"srow-main"},B_e={class:"srow-label"},R_e={class:"srow-sub"},D_e=["aria-label"],P_e={class:"group-title"},H_e={class:"srow-main"},W_e={class:"srow-label"},z_e={class:"srow-sub"},U_e={class:"srow read-only pref"},q_e={class:"srow-main"},j_e={class:"srow-label"},V_e={class:"srow read-only pref"},K_e={class:"srow-main"},G_e={class:"srow-label"},Y_e={class:"srow read-only pref"},Z_e={class:"srow-main"},X_e={class:"srow-label"},Q_e={class:"num-field"},J_e=["value","aria-label"],eSe={class:"srow-main"},tSe={class:"srow-label"},nSe={class:"srow-sub"},oSe=["aria-checked"],sSe={class:"srow-main"},iSe={class:"srow-label"},rSe={class:"srow-main"},lSe={class:"srow-label"},aSe={key:2,class:"srow read-only"},cSe={class:"srow-main"},uSe={class:"srow-label"},dSe={class:"srow-val dim"},fSe={class:"arch-subhead"},hSe={class:"arch-count"},pSe={class:"arch-tools"},mSe={key:0,class:"arch-empty"},gSe={class:"arch-meta"},vSe={class:"arch-name"},ySe={class:"arch-time"},kSe={key:2,class:"arch-empty"},bSe=100,xSe=Je({__name:"MobileSettingsSheet",props:{modelValue:{type:Boolean},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},colorScheme:{default:"system"},uiFontSize:{default:14},authReady:{type:Boolean,default:!1},conversationToc:{type:Boolean},serverVersion:{default:""},models:{default:()=>[]}},emits:["update:modelValue","pickModel","setThinking","togglePlan","toggleSwarm","setPermission","setColorScheme","setUiFontSize","setConversationToc","login","logout"],setup(e,{emit:t}){const{t:n}=$t(),o=e,s=t;function i(q){s("setColorScheme",q)}const r=["manual","yolo","auto"],l=D(()=>o.models?.find(q=>q.id===o.status?.modelId)),a=D(()=>o0(l.value)),c=D(()=>s0(l.value)),u=D(()=>Xm(l.value,o.thinking)),d=D(()=>c.value.includes(u.value)?u.value:""),f=D(()=>c.value.map(q=>({value:q,label:hk(q)}))),h=D(()=>o.planMode===!0),p=D(()=>o.swarmMode===!0),m=D(()=>{const q=o.status.permission;return q==="yolo"?"var(--color-warning)":q==="auto"?"var(--color-danger)":"var(--color-text-muted)"}),y=D(()=>{const q=o.status.permission,ee=n(q==="yolo"?"mobile.permYoloSub":q==="auto"?"mobile.permAutoSub":"mobile.permManualSub");return`${q} · ${ee}`}),k=D(()=>o.status.ctxMax>0?Math.min(100,Math.max(0,Math.ceil(o.status.ctxUsed/o.status.ctxMax*100))):0),g=D(()=>o.status.ctxMax>0?`${pr(o.status.ctxUsed)}/${pr(o.status.ctxMax)}`:n("status.statusNone"));function v(q){s("setThinking",hb(l.value,q))}function b(){const q=r.indexOf(o.status.permission),ee=r[(q+1)%r.length];s("setPermission",ee)}function A(){s("pickModel"),s("update:modelValue",!1)}function I(){s("login"),s("update:modelValue",!1)}function N(){s("logout"),s("update:modelValue",!1)}const M=Pb(),$=oe("main"),T=oe([]),F=oe(!1),S=oe(!1),B=oe(""),W=oe("archived-desc");async function z(){if(!F.value){F.value=!0,S.value=!1;try{const q=[];let ee;for(;;){const fe=await M.loadArchivedSessions({beforeId:ee,pageSize:bSe});if(q.push(...fe.items),!fe.hasMore||fe.items.length===0)break;const ne=fe.items.at(-1)?.id;if(ne===void 0)break;ee=ne}T.value=q,S.value=!0}catch(q){console.warn("loadAllArchived failed",q)}finally{F.value=!1}}}function L(){$.value="archived",B.value="",z()}function O(){$.value="main"}const U=D(()=>{const q=B.value.trim().toLowerCase();let ee=T.value.filter(fe=>fe.archived===!0);return q&&(ee=ee.filter(fe=>fe.title.toLowerCase().includes(q))),ee=ee.slice(),W.value==="archived-desc"?ee.sort((fe,ne)=>ne.updatedAt.localeCompare(fe.updatedAt)):W.value==="created-desc"?ee.sort((fe,ne)=>ne.createdAt.localeCompare(fe.createdAt)):ee.sort((fe,ne)=>fe.title.localeCompare(ne.title,"zh")),ee});async function Z(q){await M.restoreSession(q)&&(T.value=T.value.filter(fe=>fe.id!==q))}function ie(q){const ee=new Date(q);if(Number.isNaN(ee.getTime()))return q;const fe=ne=>String(ne).padStart(2,"0");return`${ee.getFullYear()}-${fe(ee.getMonth()+1)}-${fe(ee.getDate())} ${fe(ee.getHours())}:${fe(ee.getMinutes())}`}return et(()=>o.modelValue,q=>{q||($.value="main")}),(q,ee)=>(x(),Se(iN,{"model-value":e.modelValue,title:C(n)("mobile.settingsTitle"),"onUpdate:modelValue":ee[6]||(ee[6]=fe=>s("update:modelValue",fe))},{default:Ie(()=>[$.value==="main"?(x(),E(We,{key:0},[w("div",m_e,R(C(n)("mobile.groupSession")),1),w("button",{type:"button",class:"srow",onClick:A},[w("span",g_e,[w("span",v_e,R(C(n)("status.statusModel")),1),w("span",y_e,R(e.status.model),1)]),ee[7]||(ee[7]=w("span",{class:"chev"},"›",-1))]),w("div",k_e,[w("span",b_e,[w("span",x_e,R(C(n)("status.statusThinking")),1),a.value==="unsupported"?(x(),E("span",w_e,R(C(n)("status.modeNotSupported")),1)):ue("",!0)]),c.value.length>1?(x(),Se(ys,{key:0,"model-value":d.value,options:f.value,size:"sm","onUpdate:modelValue":v},null,8,["model-value","options"])):(x(),E("span",{key:1,class:Ue(["srow-val",{dim:u.value==="off"}])},R(u.value==="off"?C(n)("status.planOff"):C(hk)(u.value)),3))]),w("div",__e,R(C(n)("status.cacheNote")),1),w("button",{type:"button",class:"srow",onClick:ee[0]||(ee[0]=fe=>s("togglePlan"))},[w("span",S_e,[w("span",C_e,R(C(n)("status.statusPlanMode")),1),w("span",A_e,R(C(n)("mobile.planModeSub")),1)]),w("span",{class:Ue(["toggle",{on:h.value}]),role:"switch","aria-checked":h.value},null,10,M_e)]),w("button",{type:"button",class:"srow",onClick:ee[1]||(ee[1]=fe=>s("toggleSwarm"))},[w("span",E_e,[w("span",T_e,R(C(n)("status.statusSwarmMode")),1),w("span",N_e,R(C(n)("mobile.swarmModeSub")),1)]),w("span",{class:Ue(["toggle",{on:p.value}]),role:"switch","aria-checked":p.value},null,10,I_e)]),w("button",{type:"button",class:"srow",onClick:b},[w("span",L_e,[w("span",$_e,R(C(n)("status.statusPermission")),1),w("span",{class:"srow-sub",style:on({color:m.value})},R(y.value),5)]),ee[8]||(ee[8]=w("span",{class:"chev"},"›",-1))]),w("div",F_e,[w("span",O_e,[w("span",B_e,R(C(n)("status.statusContext")),1),w("span",R_e,R(g.value),1)]),w("span",{class:"ctx-meter","aria-label":g.value},[w("i",{style:on({width:k.value+"%"})},null,4)],8,D_e)]),w("div",P_e,R(C(n)("mobile.groupApp")),1),w("button",{type:"button",class:"srow",onClick:L},[w("span",H_e,[w("span",W_e,R(C(n)("mobile.archivedSessions")),1),w("span",z_e,R(C(n)("mobile.archivedSessionsSub")),1)]),ee[9]||(ee[9]=w("span",{class:"chev"},"›",-1))]),w("div",U_e,[w("span",q_e,[w("span",j_e,R(C(n)("theme.colorSchemeLabel")),1)]),ae(ys,{"model-value":e.colorScheme??"system",options:[{value:"light",label:C(n)("theme.light")},{value:"dark",label:C(n)("theme.dark")},{value:"system",label:C(n)("theme.system")}],"onUpdate:modelValue":i},null,8,["model-value","options"])]),w("div",V_e,[w("span",K_e,[w("span",G_e,R(C(n)("sidebar.language")),1)]),ae(oN)]),w("div",Y_e,[w("span",Z_e,[w("span",X_e,R(C(n)("settings.uiFontSize")),1)]),w("label",Q_e,[w("input",{class:"num-input",type:"number",min:"12",max:"20",step:"1",value:e.uiFontSize,"aria-label":C(n)("settings.uiFontSize"),onInput:ee[2]||(ee[2]=fe=>s("setUiFontSize",Number(fe.target.value)))},null,40,J_e),ee[10]||(ee[10]=w("span",{class:"num-unit"},"px",-1))])]),w("button",{type:"button",class:"srow",onClick:ee[3]||(ee[3]=fe=>s("setConversationToc",!e.conversationToc))},[w("span",eSe,[w("span",tSe,R(C(n)("settings.conversationToc")),1),w("span",nSe,R(C(n)("settings.conversationTocHint")),1)]),w("span",{class:Ue(["toggle",{on:e.conversationToc}]),role:"switch","aria-checked":e.conversationToc},null,10,oSe)]),e.authReady?(x(),E("button",{key:0,type:"button",class:"srow acct out",onClick:N},[w("span",sSe,[w("span",iSe,R(C(n)("sidebar.signOut")),1)])])):(x(),E("button",{key:1,type:"button",class:"srow acct in",onClick:I},[w("span",rSe,[w("span",lSe,R(C(n)("sidebar.signIn")),1)])])),e.serverVersion?(x(),E("div",aSe,[w("span",cSe,[w("span",uSe,R(C(n)("settings.serverVersion")),1)]),w("span",dSe,R(e.serverVersion),1)])):ue("",!0)],64)):(x(),E(We,{key:1},[w("div",fSe,[w("button",{type:"button",class:"arch-back",onClick:O},[ee[11]||(ee[11]=w("span",{class:"chev back"},"‹",-1)),ot(" "+R(C(n)("mobile.archivedBack")),1)]),w("span",hSe,R(C(n)("mobile.sessionCount",{n:U.value.length})),1)]),w("div",pSe,[ae(mu,{class:"arch-search-input","model-value":B.value,size:"sm",placeholder:C(n)("settings.archivedSearch"),"onUpdate:modelValue":ee[4]||(ee[4]=fe=>B.value=fe)},null,8,["model-value","placeholder"]),ae(ys,{size:"sm","model-value":W.value,options:[{value:"archived-desc",label:C(n)("settings.archivedSortArchived")},{value:"created-desc",label:C(n)("settings.archivedSortCreated")},{value:"name-asc",label:C(n)("settings.archivedSortName")}],"onUpdate:modelValue":ee[5]||(ee[5]=fe=>W.value=fe)},null,8,["model-value","options"])]),F.value?(x(),E("div",mSe,R(C(n)("settings.archivedLoadingAll")),1)):U.value.length>0?(x(!0),E(We,{key:1},rt(U.value,fe=>(x(),E("div",{key:fe.id,class:"arch-row"},[w("div",gSe,[w("div",vSe,R(fe.title),1),w("div",ySe,R(C(n)("settings.archivedAt",{time:ie(fe.updatedAt)})),1)]),ae(jt,{variant:"secondary",size:"sm",onClick:ne=>Z(fe.id)},{default:Ie(()=>[ot(R(C(n)("settings.archivedRestore")),1)]),_:1},8,["onClick"])]))),128)):(x(),E("div",kSe,R(T.value.length===0?C(n)("settings.archivedEmpty"):C(n)("settings.archivedNoMatch")),1))],64))]),_:1},8,["model-value","title"]))}}),wSe=dt(xSe,[["__scopeId","data-v-138e1e0a"]]),_Se={class:"ob-brand"},SSe={class:"ob-brand-text"},CSe={class:"ob-title"},ASe={class:"ob-sub"},MSe={class:"ob-sec"},ESe={class:"ob-label"},TSe={class:"ob-sec"},NSe={class:"ob-label"},ISe={class:"ob-sec"},LSe={class:"ob-label"},$Se=Je({__name:"Onboarding",emits:["complete","skip"],setup(e,{emit:t}){const n=t,{t:o,locale:s}=$t(),{colorScheme:i,accent:r,setColorScheme:l,setAccent:a}=vT();function c(d){s.value!==d&&x6(d)}function u(){n("complete")}return(d,f)=>(x(),Se(Qr,{open:!0,size:"md","close-on-overlay":!1,"close-on-esc":!1,onClose:f[3]||(f[3]=h=>n("skip"))},{head:Ie(()=>[w("div",_Se,[f[4]||(f[4]=w("svg",{class:"ob-logo",viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Kimi Code"},[w("defs",null,[w("mask",{id:"obKimiEyes",maskUnits:"userSpaceOnUse"},[w("rect",{x:"0",y:"0",width:"32",height:"22",fill:"#fff"}),w("g",{class:"ob-eyes",fill:"#000"},[w("rect",{class:"ob-eye",x:"11.8",y:"7",width:"2.8",height:"8",rx:"1.4"}),w("rect",{class:"ob-eye",x:"17.4",y:"7",width:"2.8",height:"8",rx:"1.4"})])])]),w("rect",{x:"1",y:"1",width:"30",height:"20",rx:"6",fill:"var(--color-accent)",mask:"url(#obKimiEyes)"})],-1)),w("div",SSe,[w("div",CSe,R(C(o)("onboarding.title")),1),w("div",ASe,R(C(o)("onboarding.subtitle")),1)])])]),default:Ie(()=>[w("section",MSe,[w("div",ESe,R(C(o)("onboarding.languageLabel")),1),ae(ys,{"model-value":C(s),options:C(b6).map(h=>({value:h.code,label:h.label})),"onUpdate:modelValue":f[0]||(f[0]=h=>c(h))},null,8,["model-value","options"])]),w("section",TSe,[w("div",NSe,R(C(o)("theme.colorSchemeLabel")),1),ae(ys,{"model-value":C(i),options:[{value:"light",label:C(o)("theme.light")},{value:"dark",label:C(o)("theme.dark")},{value:"system",label:C(o)("theme.system")}],"onUpdate:modelValue":f[1]||(f[1]=h=>C(l)(h))},null,8,["model-value","options"])]),w("section",ISe,[w("div",LSe,R(C(o)("theme.accentLabel")),1),ae(ys,{"model-value":C(r),options:[{value:"blue",label:C(o)("theme.accentBlue")},{value:"mono",label:C(o)("theme.accentBlack")}],"onUpdate:modelValue":f[2]||(f[2]=h=>C(a)(h))},null,8,["model-value","options"])]),ae(jt,{variant:"primary",size:"lg",class:"ob-start",onClick:u},{default:Ie(()=>[ot(R(C(o)("onboarding.start")),1)]),_:1})]),_:1}))}}),FSe=dt($Se,[["__scopeId","data-v-fbdd3eab"]]),OSe=["aria-label"],BSe={class:"gload-box"},RSe={class:"gload-text"},DSe={key:0,class:"gload-issue"},PSe={class:"gload-issue-detail"},HSe=Je({__name:"GlobalLoading",props:{issue:{}},setup(e){const{t}=$t();return(n,o)=>(x(),E("div",{class:"gload",role:"status","aria-label":C(t)("app.connecting")},[w("div",BSe,[o[0]||(o[0]=qk('<svg class="gload-logo" viewBox="0 0 96 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" data-v-0b6dec6a><path fill="currentColor" d="M35.767 31.329c0 .37.3.671.67.671h4.305c.371 0 .672-.3.672-.671V.67c0-.37-.3-.671-.672-.671h-4.304c-.37 0-.671.3-.671.671z" data-v-0b6dec6a></path><path fill="currentColor" d="M90.353 31.329c0 .37.3.671.67.671h4.305c.371 0 .672-.3.672-.671V.67c0-.37-.3-.671-.672-.671h-4.304a.67.67 0 0 0-.671.671z" data-v-0b6dec6a></path><path fill="currentColor" d="M73.256 0a.67.67 0 0 0-.652.512l-6.366 26.1c-.106.428-.607.428-.71 0L59.159.512A.67.67 0 0 0 58.511 0H47.725c-.37 0-.668.3-.668.671V31.33c0 .37.3.671.67.671h4.781c.37 0 .671-.292.671-.662V5.554c0-.515.604-.622.726-.127l6.358 26.06a.67.67 0 0 0 .653.513h9.931c.31 0 .58-.212.653-.512L77.855 5.43c.122-.495.726-.388.726.127v25.772c0 .37.3.671.671.671h4.78c.371 0 .672-.3.672-.671V.67c0-.37-.3-.671-.671-.671z" data-v-0b6dec6a></path><path fill="currentColor" d="M15.279 14.837 28.264 1.133A.671.671 0 0 0 27.777 0h-6.043a.67.67 0 0 0-.477.199L6.374 15.223c-.231.234-.573.025-.573-.35V.672c0-.37-.3-.671-.671-.671H.67a.67.67 0 0 0-.67.67V31.33c0 .37.3.671.671.671H5.13c.37 0 .671-.3.671-.671v-6.114a.5.5 0 0 1 .13-.35l4.594-4.69a.293.293 0 0 1 .386-.045l12.286 9.305c1.796 1.245 4.083 2.06 6.178 2.401a.645.645 0 0 0 .743-.648v-5.537a.7.7 0 0 0-.562-.677c-1.215-.262-2.565-.758-3.59-1.468L15.332 15.58c-.22-.152-.248-.544-.052-.744" data-v-0b6dec6a></path></svg>',1)),ae(Us,{size:"md",label:C(t)("app.connecting")},null,8,["label"]),w("div",RSe,R(C(t)("app.connecting")),1),e.issue?(x(),E("div",DSe,[w("div",null,R(C(t)("app.connectRetrying")),1),w("div",PSe,R(e.issue),1)])):ue("",!0)])],8,OSe))}}),WSe=dt(HSe,[["__scopeId","data-v-0b6dec6a"]]),zSe={class:"kap-root"},USe={class:"kap-head"},qSe={class:"kap-count"},jSe={class:"kap-head-actions"},VSe={class:"kap-filters"},KSe=["value"],GSe={class:"kap-check"},YSe={class:"kap-check"},ZSe={class:"kap-view-toggle",role:"group"},XSe={key:0,class:"kap-empty"},QSe=["onClick"],JSe={class:"kap-ts"},eCe={class:"kap-label"},tCe={key:0,class:"kap-detail"},nCe={class:"kap-detail-actions"},oCe=["onClick"],sCe={key:1,class:"kap-agg"},iCe={class:"mono"},rCe={class:"mono"},lCe={class:"num"},aCe={class:"num"},cCe={key:0},uCe={class:"mono"},dCe={class:"num"},fCe={class:"num"},hCe={key:0},pCe=Je({__name:"KapDebugView",emits:["close"],setup(e,{emit:t}){const n=t,o=oe("all"),s=oe(""),i=oe(""),r=oe(!1),l=oe("timeline"),a=D(()=>(tb.value,[...Die()])),c=D(()=>{const $=new Set;for(const T of a.value)T.sessionId&&$.add(T.sessionId);return[...$].sort()});function u($){return $.kind==="rest:error"||$.code!==void 0&&$.code!==0||$.eventType==="error"||$.eventType==="parse-error"}const d=D(()=>{const $=s.value.trim().toLowerCase();return a.value.filter(T=>!(o.value!=="all"&&T.source!==o.value||i.value&&T.sessionId!==i.value||r.value&&!u(T)||$&&!`${T.label} ${T.kind} ${T.eventType??""} ${T.sessionId??""} ${T.requestId??""}`.toLowerCase().includes($)))}),f=D(()=>{const $=new Map;for(const T of d.value){if(T.kind!=="ws:in"&&T.kind!=="ws:out")continue;const F=T.kind==="ws:in"?"←":"→",S=`${F} ${T.eventType??"?"} @ ${T.sessionId??"-"}`,B=$.get(S)??{key:S,sessionId:T.sessionId??"-",eventType:T.eventType??"?",dir:F,count:0};B.count++,T.seq!==void 0&&(B.lastSeq=T.seq),$.set(S,B)}return[...$.values()].sort((T,F)=>F.count-T.count)}),h=D(()=>{const $=new Map;for(const T of d.value){if(T.source!=="rest"||T.kind==="rest:request")continue;const F=`${T.method??"?"} ${T.path??"?"}`,S=$.get(F)??{count:0,errors:0,totalMs:0,timed:0};S.count++,u(T)&&S.errors++,T.durationMs!==void 0&&(S.totalMs+=T.durationMs,S.timed++),$.set(F,S)}return[...$.entries()].map(([T,F])=>({key:T,count:F.count,errors:F.errors,avgMs:F.timed>0?Math.round(F.totalMs/F.timed):0})).sort((T,F)=>F.count-T.count)}),p=oe(null),m=oe(!0),y=oe(null),k=oe(null);et(()=>d.value.length,async()=>{if(!m.value||l.value!=="timeline")return;await yt();const $=y.value;$&&($.scrollTop=$.scrollHeight)});function g($){p.value=p.value===$?null:$}function v($){const T=new Date($),F=(S,B=2)=>String(S).padStart(B,"0");return`${F(T.getHours())}:${F(T.getMinutes())}:${F(T.getSeconds())}.${F(T.getMilliseconds(),3)}`}function b($){return JSON.stringify($,null,2)}async function A($){await Jo(b($))&&(k.value=$.id,setTimeout(()=>{k.value===$.id&&(k.value=null)},1500))}function I(){zE(d.value)}function N($){return u($)||$.source==="client"?"b-err":$.source==="rest"?"b-rest":$.kind==="ws:lifecycle"?"b-life":$.kind==="ws:out"?"b-out":"b-in"}function M($){return $.source==="rest"?"REST":$.source==="client"?"APP":"WS"}return($,T)=>(x(),E("section",zSe,[w("header",USe,[T[11]||(T[11]=w("strong",null,"KAP debug",-1)),w("span",qSe,R(d.value.length)+"/"+R(a.value.length),1),w("div",jSe,[w("button",{type:"button",class:Ue({on:C(Nd)}),onClick:T[0]||(T[0]=F=>Nd.value=!C(Nd))},R(C(Nd)?"resume":"pause"),3),w("button",{type:"button",onClick:T[1]||(T[1]=F=>C(Pie)())},"clear"),w("button",{type:"button",onClick:T[2]||(T[2]=F=>I())},"export jsonl"),ae(an,{text:"Close window"},{default:Ie(()=>[w("button",{type:"button",onClick:T[3]||(T[3]=F=>n("close"))},"✕")]),_:1})])]),w("div",VSe,[qn(w("select",{"onUpdate:modelValue":T[4]||(T[4]=F=>o.value=F),"aria-label":"Source filter"},[...T[12]||(T[12]=[w("option",{value:"all"},"rest + ws + app",-1),w("option",{value:"rest"},"rest",-1),w("option",{value:"ws"},"ws",-1),w("option",{value:"client"},"app errors",-1)])],512),[[cy,o.value]]),qn(w("select",{"onUpdate:modelValue":T[5]||(T[5]=F=>i.value=F),"aria-label":"Session filter"},[T[13]||(T[13]=w("option",{value:""},"all sessions",-1)),(x(!0),E(We,null,rt(c.value,F=>(x(),E("option",{key:F,value:F},R(F),9,KSe))),128))],512),[[cy,i.value]]),qn(w("input",{"onUpdate:modelValue":T[6]||(T[6]=F=>s.value=F),type:"text",placeholder:"filter (type / path / id)","aria-label":"Text filter"},null,512),[[Cs,s.value]]),w("label",GSe,[qn(w("input",{"onUpdate:modelValue":T[7]||(T[7]=F=>r.value=F),type:"checkbox"},null,512),[[um,r.value]]),T[14]||(T[14]=ot(" errors",-1))]),w("label",YSe,[qn(w("input",{"onUpdate:modelValue":T[8]||(T[8]=F=>m.value=F),type:"checkbox"},null,512),[[um,m.value]]),T[15]||(T[15]=ot(" follow",-1))]),w("div",ZSe,[w("button",{type:"button",class:Ue({on:l.value==="timeline"}),onClick:T[9]||(T[9]=F=>l.value="timeline")},"timeline",2),w("button",{type:"button",class:Ue({on:l.value==="aggregate"}),onClick:T[10]||(T[10]=F=>l.value="aggregate")},"aggregate",2)])]),l.value==="timeline"?(x(),E("div",{key:0,ref_key:"listRef",ref:y,class:"kap-list"},[d.value.length===0?(x(),E("div",XSe," No trace entries yet. REST calls and WS frames will appear here. ")):ue("",!0),(x(!0),E(We,null,rt(d.value,F=>(x(),E("div",{key:F.id,class:"kap-row-wrap"},[w("button",{type:"button",class:Ue(["kap-row",{expanded:p.value===F.id}]),onClick:S=>g(F.id)},[w("span",JSe,R(v(F.ts)),1),w("span",{class:Ue(["kap-badge",N(F)])},R(M(F)),3),w("span",eCe,R(F.label),1)],10,QSe),p.value===F.id?(x(),E("div",tCe,[w("div",nCe,[w("button",{type:"button",onClick:S=>A(F)},R(k.value===F.id?"copied ✓":"copy json"),9,oCe)]),w("pre",null,R(b(F)),1)])):ue("",!0)]))),128))],512)):(x(),E("div",sCe,[T[20]||(T[20]=w("h4",null,"WS frames by session / type",-1)),w("table",null,[T[17]||(T[17]=w("thead",null,[w("tr",null,[w("th",null,"dir"),w("th",null,"type"),w("th",null,"session"),w("th",null,"count"),w("th",null,"last seq")])],-1)),w("tbody",null,[(x(!0),E(We,null,rt(f.value,F=>(x(),E("tr",{key:F.key},[w("td",null,R(F.dir),1),w("td",iCe,R(F.eventType),1),w("td",rCe,R(F.sessionId),1),w("td",lCe,R(F.count),1),w("td",aCe,R(F.lastSeq??"—"),1)]))),128)),f.value.length===0?(x(),E("tr",cCe,[...T[16]||(T[16]=[w("td",{colspan:"5",class:"kap-empty"},"no ws frames",-1)])])):ue("",!0)])]),T[21]||(T[21]=w("h4",null,"REST by endpoint",-1)),w("table",null,[T[19]||(T[19]=w("thead",null,[w("tr",null,[w("th",null,"endpoint"),w("th",null,"count"),w("th",null,"errors"),w("th",null,"avg ms")])],-1)),w("tbody",null,[(x(!0),E(We,null,rt(h.value,F=>(x(),E("tr",{key:F.key},[w("td",uCe,R(F.key),1),w("td",dCe,R(F.count),1),w("td",{class:Ue(["num",{err:F.errors>0}])},R(F.errors),3),w("td",fCe,R(F.avgMs),1)]))),128)),h.value.length===0?(x(),E("tr",hCe,[...T[18]||(T[18]=[w("td",{colspan:"4",class:"kap-empty"},"no rest calls",-1)])])):ue("",!0)])])]))]))}}),mCe=dt(pCe,[["__scopeId","data-v-3cda6fe3"]]),gCe=Je({__name:"DebugPanel",setup(e){const t=oe(!1);let n=null,o=null,s=null;const i=["data-color-scheme","data-accent"];function r(u){const d=document.documentElement,f=u.documentElement;for(const h of i){const p=d.getAttribute(h);p!==null?f.setAttribute(h,p):f.removeAttribute(h)}}function l(u){const d=u.document;d.title="KAP debug";const f=d.createElement("base");f.href=location.href,d.head.appendChild(f);for(const p of Array.from(document.querySelectorAll('style, link[rel="stylesheet"]')))d.head.appendChild(p.cloneNode(!0));r(d),d.body.style.margin="0";const h=d.createElement("div");return h.style.height="100vh",d.body.appendChild(h),h}function a(){s?.disconnect(),s=null;try{o?.unmount()}catch{}o=null,n=null,t.value=!1}function c(){if(n&&!n.closed){n.focus();return}const u=window.open("","kap-debug","popup=yes,width=1040,height=760");if(!u)return;n=u;const d=l(u),f=dm(mCe,{onClose:()=>u.close()});f.mount(d),o=f,t.value=!0,s=new MutationObserver(()=>{n&&!n.closed&&r(n.document)}),s.observe(document.documentElement,{attributes:!0,attributeFilter:[...i]}),u.addEventListener("pagehide",a),u.addEventListener("beforeunload",a)}return An(()=>{c()}),ho(()=>{n&&!n.closed&&n.close(),a()}),(u,d)=>(x(),Se(an,{text:t.value?"Focus KAP debug window":"Open KAP debug window"},{default:Ie(()=>[w("button",{class:"kap-fab",type:"button",onClick:c}," KAP ")]),_:1},8,["text"]))}}),vCe=dt(gCe,[["__scopeId","data-v-21346738"]]);function yCe({client:e,authLogoRef:t}){const n=D(()=>e.authReady.value),o=D(()=>e.initialized.value&&!n.value),s="/login",i=oe(null);let r=null;function l(){return typeof window>"u"?"/":`${window.location.pathname}${window.location.search}${window.location.hash}`}function a(u){typeof window>"u"||window.history.replaceState(window.history.state,"",u)}et(o,u=>{if(!(typeof window>"u")){if(u){window.location.pathname!==s&&(i.value=l(),a(s));return}window.location.pathname===s&&(a(i.value??"/"),i.value=null)}},{immediate:!0});function c(){const u=t.value;u&&(u.classList.remove("blink-now"),u.getBoundingClientRect(),u.classList.add("blink-now"),r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,u.classList.remove("blink-now")},300))}return On(()=>{r!==null&&clearTimeout(r)}),{showAuthGate:o,blinkAuthLogo:c}}function kCe({running:e,showAuthGate:t}){const{t:n}=$t(),o=["◐","◓","◑","◒"],s=oe(0);let i=null;function r(){i===null&&(s.value=0,i=setInterval(()=>{s.value=(s.value+1)%o.length},250))}function l(){i!==null&&(clearInterval(i),i=null),s.value=0}et(e,c=>{c?r():l()},{immediate:!0});const a=D(()=>{const c=e.value?`${o[s.value]} `:"";return t.value?`${c}${n("app.authPageTitle")} - Kimi Code Web`:`${c}Kimi Code Web`});DA(()=>{typeof document<"u"&&(document.title=a.value)}),On(()=>{l()})}const rN=oe(typeof window>"u"?0:window.innerWidth);let bp=0,l1=!1;function Ck(){rN.value=window.innerWidth}function bCe(){l1||typeof window>"u"||(window.addEventListener("resize",Ck),l1=!0,Ck())}function xCe(){!l1||typeof window>"u"||(window.removeEventListener("resize",Ck),l1=!1)}function lN(e,t,n){return Math.max(t,e-n)}function Ak(e,t,n){return Math.min(n,Math.max(t,e))}function aN(){return An(()=>{bp+=1,bCe()}),ho(()=>{bp=Math.max(0,bp-1),bp===0&&xCe()}),{viewportWidth:rN}}const wCe="kimi-web.file-preview-width",zc=320;function _Ce({client:e,sideWidth:t,detailTarget:n,closeFilePreview:o}){const{viewportWidth:s}=aN(),i=D(()=>Math.max(0,s.value-t.value)),r=D(()=>lN(i.value,zc,zc));function l(Q){return Ak(Math.round(Q),zc,r.value)}function a(){return l(i.value/2)}const c=D(()=>a()),u=oe(c.value),d=D(()=>Ak(u.value,zc,r.value)),f=oe(null),h=D(()=>{const Q=f.value;if(!Q)return null;const G=e.turns.value.find(me=>me.id===Q.turnId)?.blocks?.[Q.blockIndex];return G?.kind==="thinking"?G.thinking:null}),p=D(()=>h.value!==null);function m(Q){const P=f.value;if(P&&P.turnId===Q.turnId&&P.blockIndex===Q.blockIndex){f.value=null,n.value==="thinking"&&(n.value=null);return}n.value="thinking",f.value=Q}function y(){f.value=null,n.value==="thinking"&&(n.value=null)}const k=oe(null),g=D(()=>{const Q=k.value;if(!Q)return null;const P=e.turns.value.find(G=>G.id===Q.turnId);return P?.role==="compaction"&&P.text?P.text:null}),v=D(()=>g.value!==null);function b(Q){if(k.value?.turnId===Q.turnId){k.value=null,n.value==="compaction"&&(n.value=null);return}n.value="compaction",k.value=Q}function A(){k.value=null,n.value==="compaction"&&(n.value=null)}const I=oe(null);function N(Q){const P=e.activeAppTasks.value,G=P.find(ye=>ye.id===Q)??P.find(ye=>ye.parentToolCallId===Q);if(G)return G.id;const me=P.filter(ye=>ye.kind==="subagent"&&!ye.parentToolCallId);if(me.length===1)return me[0].id}const M=D(()=>{const Q=I.value;if(!Q)return null;const P=e.activeAppTasks.value.find(G=>G.id===Q.subagentId);return P?Jve(P):null}),$=D(()=>M.value!==null);function T(Q){const P=N(Q);if(P){if(I.value?.subagentId===P){I.value=null,n.value==="agent"&&(n.value=null);return}I.value={subagentId:P},n.value="agent"}}function F(){I.value=null,n.value==="agent"&&(n.value=null)}const S=oe(null),B=D(()=>{const Q=S.value;if(!Q)return null;const P=pU(e.turns.value,Q);return P?{id:Q,title:ec(P.name),path:hU(P.arg),lines:P.status==="error"?null:S6(P),output:P.output}:null}),W=D(()=>B.value!==null);function z(Q){if(n.value==="toolDiff"&&S.value===Q){L();return}n.value="toolDiff",S.value=Q}function L(){S.value=null,n.value==="toolDiff"&&(n.value=null)}const O=oe("list"),U=oe(null);function Z(){if(n.value==="diff"){ie();return}n.value="diff",O.value="list",U.value=null,e.loadGitStatus(e.activeSessionId.value)}function ie(){n.value==="diff"&&(n.value=null),O.value="list",U.value=null,e.clearFileDiff()}async function q(Q){O.value="detail",U.value=Q,await e.loadFileDiff(Q)}async function ee(Q){!e.activeSessionId.value&&e.activeWorkspaceId.value?await e.startSessionAndOpenSideChat(e.activeWorkspaceId.value,Q):await e.openSideChat(Q),n.value="btw"}function fe(){e.closeSideChat(),n.value==="btw"&&(n.value=null)}function ne(){n.value==="btw"&&(n.value=null)}const j=D(()=>e.sideChatVisible.value),K=D(()=>n.value!==null&&(n.value!=="thinking"||p.value)&&(n.value!=="compaction"||v.value)&&(n.value!=="agent"||$.value)&&(n.value!=="toolDiff"||W.value)&&(n.value!=="btw"||j.value)),ve=oe(!1),he=oe({});function Ae(){switch(n.value){case"thinking":return f.value?{kind:"thinking",...f.value}:null;case"compaction":return k.value?{kind:"compaction",...k.value}:null;case"agent":return I.value?{kind:"agent",...I.value}:null;case"toolDiff":return S.value?{kind:"toolDiff",toolId:S.value}:null;case"btw":return{kind:"btw"};default:return null}}function re(Q){if(Q)switch(Q.kind){case"thinking":f.value={turnId:Q.turnId,blockIndex:Q.blockIndex},n.value="thinking";break;case"compaction":k.value={turnId:Q.turnId},n.value="compaction";break;case"agent":I.value={subagentId:Q.subagentId},n.value="agent";break;case"toolDiff":S.value=Q.toolId,n.value="toolDiff";break;case"btw":e.sideChatVisible.value&&(n.value="btw");break}}function Y(){return n.value==="thinking"&&p.value?(y(),!0):n.value==="compaction"&&v.value?(A(),!0):n.value==="agent"&&$.value?(F(),!0):n.value==="toolDiff"&&W.value?(L(),!0):n.value==="file"?(o(),!0):n.value==="diff"?(ie(),!0):n.value==="btw"?(fe(),!0):!1}return et(e.activeSessionId,(Q,P)=>{if(P){const G=Ae();G?he.value[P]=G:delete he.value[P]}o(),y(),A(),F(),L(),ie(),ne(),Q&&re(he.value[Q])}),{PREVIEW_WIDTH_KEY:wCe,PREVIEW_MIN:zc,previewDefaultWidth:c,previewMax:r,previewWidth:u,previewPanelWidth:d,thinkingPanelText:h,thinkingVisible:p,openThinkingPanel:m,closeThinkingPanel:y,compactionPanelText:g,compactionPanelVisible:v,openCompactionPanel:b,closeCompactionPanel:A,agentPanelMember:M,agentPanelVisible:$,openAgentPanel:T,closeAgentPanel:F,toolDiffTarget:B,toolDiffVisible:W,openToolDiff:z,closeToolDiff:L,detailDiffMode:O,detailDiffPath:U,openDiffDetail:Z,closeDiffDetail:ie,selectDiffFile:q,btwVisible:j,openSideChatTab:ee,closeSideChat:fe,hideSideChatPanel:ne,sidePanelVisible:K,panelDragging:ve,closeOpenSidePanel:Y}}const SCe=Dt.sidebarWidth,iA=Dt.sidebarCollapsed,rA=270,qv=170,CCe=480,ACe=320;function MCe(e={}){const{viewportWidth:t}=aN(),n=oe(rA),o=oe(!1),s=oe(!1),i=D(()=>{const u=ACe+(NA(e.previewOpen)?zc:0);return Math.min(CCe,lN(t.value,qv,u))}),r=D(()=>Ak(n.value,qv,i.value));function l(){try{o.value=yo(iA)==="true"}catch{o.value=!1}}function a(){try{Eo(iA,String(o.value))}catch{}}function c(){o.value=!o.value,a()}return{SIDEBAR_WIDTH_KEY:SCe,SIDEBAR_DEFAULT:rA,SIDEBAR_MIN:qv,sidebarMax:i,sessionColWidth:n,sidebarCollapsed:o,sidebarDragging:s,sideWidth:r,loadSidebarCollapsed:l,toggleSidebarCollapse:c}}function ECe(e){return/^(?:https?:|blob:|data:)/i.test(e)}function TCe({client:e,detailTarget:t}){const{t:n}=$t(),o=oe(null),s=oe(null),i=oe(!1),r=oe(null),l=oe(null);let a=0,c=null;function u(){c!==null&&(URL.revokeObjectURL(c),c=null)}const d=D(()=>{const N=l.value;return N?e.getFileDownloadUrl(N):null}),f=D(()=>o.value!==null);function h(N){return N.length>1?N.replace(/\/+$/,""):N}function p(N){const M=[];for(const $ of N.split(/[\\/]+/))if(!(!$||$===".")){if($===".."){M.pop();continue}M.push($)}return M.join("/")}function m(N){const M=N.trim();if(!M)return{error:n("filePreview.errors.emptyPath")};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(M))return{error:n("filePreview.errors.unsupportedPath")};if(M.startsWith("~"))return{error:n("filePreview.errors.outsideWorkspace")};const $=h(e.status.value.cwd);if(M.startsWith("/")){if(!$||M!==$&&!M.startsWith(`${$}/`))return{error:n("filePreview.errors.outsideWorkspace")};const F=M===$?"":M.slice($.length+1);if(F.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const S=p(F);return S?{path:S}:{error:n("filePreview.errors.isDirectory")}}if(M.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const T=p(M);return T?{path:T}:{error:n("filePreview.errors.emptyPath")}}async function y(N){const M=o.value;if(t.value==="file"&&M&&M.path===N.path&&M.line===N.line){b();return}const $=++a;u(),t.value="file",s.value=null,r.value=null,i.value=!0,o.value=N,l.value=null;const T=m(N.path);if("error"in T){i.value=!1,r.value=T.error;return}l.value=T.path;try{const F=await e.readFileContent(T.path);if($!==a)return;F?s.value={...F,path:F.path||T.path}:r.value=n("filePreview.errors.loadFailed")}catch(F){if($!==a)return;r.value=F instanceof Error?F.message:n("filePreview.errors.loadFailed")}finally{$===a&&(i.value=!1)}}function k(N){return/^data:([^;,]+)/i.exec(N)?.[1]}function g(N){if(N.kind!=="image"&&N.kind!=="video")return;const M=++a;u(),t.value="file",o.value=null,l.value=null,r.value=null;const $=N.kind==="video",T={path:N.path??($?"Video":"ReadMediaFile image"),content:"",encoding:"utf-8",mime:N.mimeType??k(N.url)??($?"video/*":"image/*"),isBinary:!0,size:N.bytes??0};N.fileId?(i.value=!0,s.value=T,ht().getFileBlob(N.fileId).then(F=>{if(M===a){if(t.value!=="file"||!s.value){i.value=!1;return}c=URL.createObjectURL(F),s.value={...s.value,sourceUrl:c},i.value=!1}}).catch(()=>{M===a&&(s.value&&(s.value={...s.value,sourceUrl:N.url}),i.value=!1)})):(i.value=!1,s.value=ECe(N.url)?{...T,sourceUrl:N.url}:T)}function v(){a+=1,o.value=null,l.value=null,s.value=null,r.value=null,i.value=!1,u()}function b(){v(),t.value==="file"&&(t.value=null)}et(t,(N,M)=>{M==="file"&&N!=="file"&&v()});function A(){const N=s.value?.path??o.value?.path;N&&e.openWorkspaceFile(N,o.value?.line)}function I(){const N=s.value?.path??o.value?.path;N&&e.revealWorkspaceFile(N)}return{previewTarget:o,previewFile:s,previewLoading:i,previewError:r,previewDownloadUrl:d,previewExternalActions:f,openFilePreview:y,openMediaPreview:g,closeFilePreview:b,openPreviewInEditor:A,revealPreviewFile:I}}const NCe=640,ICe=`(max-width: ${NCe}px)`;function LCe(){const e=oe(!1);if(typeof window>"u"||typeof window.matchMedia!="function")return e;const t=window.matchMedia(ICe);e.value=t.matches;const n=o=>{e.value=o.matches};return typeof t.addEventListener=="function"?(t.addEventListener("change",n),On(()=>t.removeEventListener("change",n))):typeof t.addListener=="function"&&(t.addListener(n),On(()=>t.removeListener(n))),e}const $Ce={class:"server-auth-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"server-auth-title"},FCe={class:"server-auth-card"},OCe={class:"server-auth-body"},BCe={class:"server-auth-foot"},RCe=Je({__name:"ServerAuthDialog",setup(e){const t=oe(""),n=oe(null),o=oe(!1);An(()=>{yt(()=>n.value?.focus())});function s(){const r=t.value;!r||o.value||(o.value=!0,GE(r),window.location.reload())}function i(r){r.key==="Enter"&&(r.preventDefault(),s())}return(r,l)=>(x(),E("div",$Ce,[w("div",FCe,[l[1]||(l[1]=w("div",{class:"server-auth-head"},[w("h1",{id:"server-auth-title",class:"server-auth-title"},"Server token required"),w("p",{class:"server-auth-hint"},[ot(" This server is protected. Enter the bearer token printed when the server started (or the password set via "),w("code",null,"KIMI_CODE_PASSWORD"),ot("). ")])],-1)),w("div",OCe,[ae(mu,{ref_key:"inputRef",ref:n,modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=a=>t.value=a),type:"password",autocomplete:"current-password",placeholder:"Token",disabled:o.value,onKeydown:i},null,8,["modelValue","disabled"])]),w("div",BCe,[ae(jt,{variant:"primary",disabled:!t.value||o.value,loading:o.value,onClick:s},{default:Ie(()=>[ot(R(o.value?"Connecting…":"Connect"),1)]),_:1},8,["disabled","loading"])])])]))}}),DCe=dt(RCe,[["__scopeId","data-v-6f624612"]]),PCe=["aria-label"],HCe=Je({__name:"InternalBuildBanner",setup(e){const{t}=$t(),n=IH;return(o,s)=>C(n)?(x(),E("span",{key:0,class:"internal-build-tag",role:"note","aria-label":C(t)("app.internalBuildBanner")},[s[0]||(s[0]=w("svg",{viewBox:"0 0 16 16",width:"11",height:"11",fill:"none",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[w("path",{d:"M8 2 14 13H2L8 2Z"}),w("path",{d:"M8 6v3.5"}),w("path",{d:"M8 11.5h.01"})],-1)),w("span",null,R(C(t)("app.internalBuildBanner")),1)],8,PCe)):ue("",!0)}}),WCe=dt(HCe,[["__scopeId","data-v-166b3735"]]),zCe={class:"app-shell"},UCe={key:1,class:"auth-page"},qCe={class:"auth-page-inner"},jCe={class:"auth-page-copy"},VCe=["aria-label","aria-hidden"],KCe=Je({__name:"App",setup(e){Nre();const t=oe(!1);let n=null;const o=Pb(),s=D(()=>!o.dangerousBypassAuth.value&&t.value);Ln("resolveImage",o.resolveImageUrl),Ln("resolveSwarmMembers",Re=>o.swarmMembersByToolCallId.value.get(Re)??[]);const{t:i}=$t(),{confirm:r}=Gf(),l=Yi(),a=LCe(),c=oe(!1),u=oe(!1),d=D(()=>{const Re=o.activeSessionId.value;return o.sessions.value.find(le=>le.id===Re)?.title??""}),f=D(()=>o.visibleWorkspace.value?.sessionCount??0),h=D(()=>o.activity.value!=="idle"),p=oe(null),{showAuthGate:m,blinkAuthLogo:y}=yCe({client:o,authLogoRef:p});kCe({running:h,showAuthGate:m});function k(Re){const le=o.models.value.find(ze=>ze.id===o.status.value.modelId),Te=s0(le),ge=Te.indexOf(Xm(le,Re)),Ee=Te[(ge+1)%Te.length]??Te[0]??"off";return hb(le,Ee)}const g=D(()=>{const Re=o.models.value.find(le=>le.id===o.status.value.modelId);return Xm(Re,o.thinking.value)}),v=oe(!o.onboarded.value);function b(){o.setOnboarded(!0),v.value=!1}function A(){v.value=!0}let I=0;function N(){const Re=window.visualViewport,le=document.documentElement.style;le.setProperty("--app-height",`${Re?.height??window.innerHeight}px`),le.setProperty("--app-top",`${Re?.offsetTop??0}px`)}function M(){I||(I=requestAnimationFrame(()=>{I=0,N()}))}An(()=>{n=$re(()=>{t.value=!0,o.clearDangerousBypassAuth()}),o.load(),Q(),N(),window.visualViewport?.addEventListener("resize",M),window.visualViewport?.addEventListener("scroll",M),window.addEventListener("resize",M),document.addEventListener("keydown",$,!0)}),On(()=>{document.removeEventListener("keydown",$,!0),window.visualViewport?.removeEventListener("resize",M),window.visualViewport?.removeEventListener("scroll",M),window.removeEventListener("resize",M),I&&(cancelAnimationFrame(I),I=0),document.documentElement.style.removeProperty("--app-height"),document.documentElement.style.removeProperty("--app-top"),n!==null&&(n(),n=null)});function $(Re){Re.key==="Escape"&&(Be.value||so()&&(Re.stopPropagation(),Re.preventDefault()))}const T=oe(null),F=oe(!1);et(o.activeSessionId,()=>{F.value=!0,yt(()=>{F.value=!1})});const{previewTarget:S,previewFile:B,previewLoading:W,previewError:z,previewDownloadUrl:L,previewExternalActions:O,openFilePreview:U,openMediaPreview:Z,closeFilePreview:ie,openPreviewInEditor:q,revealPreviewFile:ee}=TCe({client:o,detailTarget:T}),fe=D(()=>T.value!==null),{SIDEBAR_WIDTH_KEY:ne,SIDEBAR_DEFAULT:j,SIDEBAR_MIN:K,sidebarMax:ve,sessionColWidth:he,sidebarCollapsed:Ae,sidebarDragging:re,sideWidth:Y,loadSidebarCollapsed:Q,toggleSidebarCollapse:P}=MCe({previewOpen:fe}),{PREVIEW_WIDTH_KEY:G,PREVIEW_MIN:me,previewDefaultWidth:ye,previewMax:de,previewWidth:V,previewPanelWidth:se,thinkingPanelText:pe,thinkingVisible:ke,openThinkingPanel:Ne,closeThinkingPanel:qe,compactionPanelText:be,compactionPanelVisible:xe,openCompactionPanel:Ze,closeCompactionPanel:tt,agentPanelMember:lt,openAgentPanel:ut,closeAgentPanel:mt,toolDiffTarget:Tt,openToolDiff:wt,closeToolDiff:Ft,detailDiffMode:en,detailDiffPath:Hn,openDiffDetail:Pt,closeDiffDetail:bn,selectDiffFile:pn,btwVisible:Kt,openSideChatTab:Nn,closeSideChat:Gt,sidePanelVisible:Wt,panelDragging:mn,closeOpenSidePanel:so}=_Ce({client:o,sideWidth:Y,detailTarget:T,closeFilePreview:ie}),gn=oe(null),to=oe(!1),vt=oe(!1),Wn=oe(!1),Bn=oe(!1),Qn=oe(!1),sn=oe(!1),es=oe(null),nt=oe(null),Be=D(()=>Rc.value>0||to.value||vt.value||Wn.value||Bn.value||Qn.value||sn.value||v.value||c.value||u.value),Bt=oe(!1),Yt=oe(!1),vn=oe(!1),xn=oe(!1),nn=oe(!1);async function Vn(){Bt.value=!0,Yt.value=!1,to.value=!0;try{await o.refreshAllProviders()}catch{Yt.value=!0}finally{Bt.value=!1}}async function Kn(){vn.value=!0,xn.value=!1,vt.value=!0;try{await o.loadProviders()}catch{xn.value=!0}finally{vn.value=!1}}function Jn(){Wn.value=!0}async function Oo(Re){to.value=!1,await ko(Re)}async function ko(Re){await o.setModel(Re)&&Re!==o.defaultModel.value&&o.updateConfig({defaultModel:Re})}async function li(Re){await o.addProvider(Re)}async function Uo(Re){await o.refreshProvider(Re)}async function As(Re){await r({title:i("sidebar.archive"),message:i("sidebar.archiveConfirm"),variant:"danger",action:()=>o.archiveSession(Re)})}async function cs(Re){const le=o.workspacesView.value.find(Te=>Te.id===Re)?.name??Re;await r({title:i("sidebar.removeWorkspace"),message:i("workspace.removeWorkspaceConfirm",{name:le}),variant:"danger",action:()=>o.deleteWorkspace(Re)})}async function qo(Re){await r({title:i("providers.delete"),message:i("providers.confirmDelete"),variant:"danger",action:()=>o.deleteProvider(Re)})}async function Bo(Re){nn.value=!0;try{await o.updateConfig(Re)&&await o.checkAuth()}finally{nn.value=!1}}async function ai(){return o.startOAuthLogin()}async function tn(){return o.pollOAuthLogin()}async function qs(){return o.cancelOAuthLogin()}async function io(){Wn.value=!1,await o.checkAuth(),await o.load()}async function js(Re){await o.undo(1),await yt(),gn.value?.loadComposerForEdit(Re.text,Re.attachments)}function ci(Re){if(Re==="/compact"||Re.startsWith("/compact ")){o.compact(Re.slice(8).trim()||void 0);return}if(Re==="/swarm"||Re.startsWith("/swarm ")){const le=Re.slice(6).trim();le==="on"?o.setSwarmMode(!0):le==="off"?o.setSwarmMode(!1):le?(o.setSwarmMode(!0),o.sendPrompt(le)):o.toggleSwarmMode();return}if(Re==="/goal"||Re.startsWith("/goal ")){const le=Re.slice(5).trim();le==="pause"||le==="resume"||le==="cancel"?o.controlGoal(le):le?o.createGoal(le):o.toggleGoalMode();return}if(Re==="/btw"||Re.startsWith("/btw ")){const le=Re.slice(4).trim();!le&&o.sideChatVisible.value?Gt():Nn(le||void 0);return}switch(Re){case"/new":case"/clear":No();break;case"/fork":o.forkSession();break;case"/export":o.exportSession();break;case"/undo":o.undo();break;case"/plan":o.togglePlanMode();break;case"/auto":o.setPermission("auto");break;case"/yolo":o.setPermission("yolo");break;case"/thinking":o.setThinking(k(o.thinking.value));break;case"/status":Qn.value=!0;break;case"/login":Jn();break;default:{const le=Re.indexOf(" "),Te=pue((le===-1?Re:Re.slice(0,le)).slice(1)),ge=le===-1?void 0:Re.slice(le+1).trim()||void 0;if(!Te)break;!o.activeSessionId.value&&o.activeWorkspaceId.value?o.startSessionAndActivateSkill(o.activeWorkspaceId.value,Te,ge):o.activateSkill(Te,ge);break}}}function Ni(Re){o.unqueue(Re)}function ui(Re){o.unqueue(Re)}function Vs(Re){o.reorderQueue(Re.from,Re.to)}async function ts(Re){const le=o.activeWorkspaceId.value;if(!o.activeSessionId.value&&le){await o.startSessionAndSendPrompt(le,Re.text,Re.attachments);return}if(!o.activeSessionId.value&&!le){es.value=Re,Bn.value=!0;return}o.sendPrompt(Re.text,Re.attachments)}async function ns(Re){if(nt.value=null,!await o.addWorkspaceByPath(Re)){nt.value=i("workspace.addFailed");return}Bn.value=!1;const Te=es.value;es.value=null;const ge=o.activeWorkspaceId.value;Te&&ge&&await o.startSessionAndSendPrompt(ge,Te.text,Te.attachments)}function zt(){es.value=null,nt.value=null,Bn.value=!1}function Ms(){yt(()=>{gn.value?.focusComposer()})}function No(){const Re=o.activeWorkspaceId.value;Re?o.openWorkspaceDraft(Re):o.clearActiveSession(),Ms()}function di(Re){o.openWorkspaceDraft(Re),Ms()}function Ke(Re){Re&&window.open(Re,"_blank","noopener")}return(Re,le)=>(x(),E("div",zCe,[s.value?(x(),Se(DCe,{key:0})):ue("",!0),C(m)?(x(),E("section",UCe,[w("div",qCe,[(x(),E("svg",{ref_key:"authLogoRef",ref:p,class:"auth-page-logo ch-logo",viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Kimi Code",onMousedown:le[0]||(le[0]=St(()=>{},["prevent"])),onClick:le[1]||(le[1]=(...Te)=>C(y)&&C(y)(...Te))},[...le[98]||(le[98]=[qk('<defs data-v-8cd3196b><mask id="authKimiEyes" maskUnits="userSpaceOnUse" data-v-8cd3196b><rect x="0" y="0" width="32" height="22" fill="#fff" data-v-8cd3196b></rect><g class="ch-eyes" fill="#000" data-v-8cd3196b><rect class="ch-eye" x="11.8" y="7" width="2.8" height="8" rx="1.4" data-v-8cd3196b></rect><rect class="ch-eye" x="17.4" y="7" width="2.8" height="8" rx="1.4" data-v-8cd3196b></rect></g></mask></defs><rect x="1" y="1" width="30" height="20" rx="6" fill="var(--logo)" mask="url(#authKimiEyes)" data-v-8cd3196b></rect>',2)])],544)),w("div",jCe,[w("h1",null,R(C(i)("app.authPageTitle")),1),w("p",null,R(C(i)("app.authPageMessage")),1)]),ae(jt,{class:"auth-page-btn",variant:"primary",onClick:Jn},{default:Ie(()=>[ae(Ge,{name:"log-in",size:"md"}),w("span",null,R(C(i)("app.authPageLogin")),1)]),_:1})])])):(x(),E("div",{key:2,class:Ue(["app",{mobile:C(a),"sidebar-collapsed":C(Ae)&&!C(a),"macos-desktop":C(iu)}]),style:on({"--preview-w":C(se)+"px"})},[C(a)?(x(),Se(jwe,{key:1,workspace:C(o).visibleWorkspace.value,"session-title":d.value,running:h.value,branch:C(o).status.value.branch,"session-count":f.value,onOpenSwitcher:le[19]||(le[19]=Te=>c.value=!0),onOpenSettings:le[20]||(le[20]=Te=>u.value=!0)},null,8,["workspace","session-title","running","branch","session-count"])):(x(),E(We,{key:0},[ae(eW,{collapsed:C(Ae),dragging:C(re),"col-width":C(Y),"active-workspace":C(o).visibleWorkspace.value,"active-workspace-id":C(o).activeWorkspaceId.value,sessions:C(o).sessionsForView.value,groups:C(o).workspaceGroups.value,"active-id":C(o).activeSessionId.value,"attention-by-session":C(o).attentionBySession.value,"pending-by-session":C(o).pendingBySession.value,"unread-by-session":C(o).unreadBySession.value,"workspace-sort-mode":C(o).workspaceSortMode.value,backend:C(o).backend.value,onSelect:le[2]||(le[2]=Te=>C(o).selectSession(Te)),onCreate:No,onCreateInWorkspace:le[3]||(le[3]=Te=>di(Te)),onSelectWorkspace:le[4]||(le[4]=Te=>C(o).openWorkspace(Te)),onAddWorkspace:le[5]||(le[5]=Te=>Bn.value=!0),onRename:le[6]||(le[6]=(Te,ge)=>C(o).renameSession(Te,ge)),onArchive:le[7]||(le[7]=Te=>As(Te)),onFork:le[8]||(le[8]=Te=>C(o).forkSession(Te)),onExport:le[9]||(le[9]=Te=>C(o).exportSession(Te)),onRenameWorkspace:le[10]||(le[10]=(Te,ge)=>C(o).renameWorkspace(Te,ge)),onDeleteWorkspace:le[11]||(le[11]=Te=>cs(Te)),onReorderWorkspaces:le[12]||(le[12]=Te=>C(o).reorderWorkspaces(Te)),onSetWorkspaceSortMode:le[13]||(le[13]=Te=>C(o).setWorkspaceSortMode(Te)),onLoadMoreSessions:le[14]||(le[14]=Te=>void C(o).loadMoreSessions(Te)),onLoadAllSessions:le[15]||(le[15]=Te=>void C(o).loadAllSessions()),onOpenSettings:le[16]||(le[16]=Te=>sn.value=!0),onCollapse:C(P)},null,8,["collapsed","dragging","col-width","active-workspace","active-workspace-id","sessions","groups","active-id","attention-by-session","pending-by-session","unread-by-session","workspace-sort-mode","backend","onCollapse"]),qn(ae(H_,{class:"side-handle","storage-key":C(ne),"default-width":C(j),min:C(K),max:C(ve),"onUpdate:width":le[17]||(le[17]=Te=>he.value=Te),"onUpdate:dragging":le[18]||(le[18]=Te=>re.value=Te)},null,8,["storage-key","default-width","min","max"]),[[xi,!C(Ae)]])],64)),ae(bpe,{ref_key:"conversationPaneRef",ref:gn,mobile:C(a),turns:C(o).turns.value,"session-id":C(o).activeSessionId.value,approvals:C(o).pendingApprovals.value,changes:C(o).changes.value,"git-info":C(o).gitInfo.value,tasks:C(o).tasks.value,todos:C(o).todos.value,goal:C(o).goal.value,"activation-badges":C(o).activationBadges.value,status:C(o).status.value,thinking:C(o).thinking.value,"plan-mode":C(o).planMode.value,"swarm-mode":C(o).swarmMode.value,"goal-mode":C(o).goalMode.value,models:C(o).models.value,"starred-ids":C(o).starredModelIds.value,skills:C(o).skills.value,questions:C(o).questions.value,"pending-question-actions":C(o).pendingQuestionActions,"pending-approval-actions":C(o).pendingApprovalActions,running:h.value,"turn-active":C(o).turnActive.value,queued:C(o).queued.value,"search-files":C(o).searchFiles,"upload-image":C(o).uploadImage,working:C(o).working.value,starting:C(o).isStartingFirstPrompt.value,"fast-moon":C(o).fastMoon.value,"file-reload-key":C(o).activeSessionId.value,"session-loading":C(o).sessionLoading.value,compaction:C(o).compaction.value,"has-more-messages":C(o).hasMoreMessages.value,"loading-more":C(o).loadingMoreMessages.value,"loading-more-error":C(o).loadMoreMessagesError.value,"load-older-messages":C(o).loadOlderMessages,"workspace-name":C(o).visibleWorkspace.value?.name,"workspace-root":C(o).visibleWorkspace.value?.root??C(o).status.value.cwd,"git-diff-stats":C(o).gitDiffStats.value,workspaces:C(o).workspacesView.value,"active-workspace-id":C(o).activeWorkspaceId.value,"session-title":d.value,pr:C(o).activePullRequest.value,"conversation-toc":C(o).conversationToc.value,onOpenChanges:le[21]||(le[21]=Te=>C(Pt)()),onSelectWorkspace:le[22]||(le[22]=Te=>di(Te)),onAddWorkspace:le[23]||(le[23]=Te=>Bn.value=!0),onOpenPr:Ke,onSubmit:le[24]||(le[24]=Te=>ts(Te)),onSteer:le[25]||(le[25]=Te=>C(o).steerPrompt(Te.text,Te.attachments)),onApproval:le[26]||(le[26]=(Te,ge)=>C(o).respondApproval(Te,ge)),onCancelTask:le[27]||(le[27]=Te=>C(o).cancelTask(Te)),onAnswer:le[28]||(le[28]=(Te,ge)=>C(o).respondQuestion(Te,ge)),onDismiss:le[29]||(le[29]=Te=>C(o).dismissQuestion(Te)),onCommand:ci,onInterrupt:le[30]||(le[30]=Te=>C(o).abortCurrentPrompt()),onUnqueue:Ni,onEditQueued:ui,onReorderQueue:Vs,onSetPermission:le[31]||(le[31]=Te=>C(o).setPermission(Te)),onSetThinking:le[32]||(le[32]=Te=>C(o).setThinking(Te)),onTogglePlan:le[33]||(le[33]=Te=>C(o).togglePlanMode()),onToggleSwarm:le[34]||(le[34]=Te=>C(o).toggleSwarmMode()),onToggleGoal:le[35]||(le[35]=Te=>C(o).toggleGoalMode()),onCreateGoal:le[36]||(le[36]=Te=>C(o).createGoal(Te)),onControlGoal:le[37]||(le[37]=Te=>C(o).controlGoal(Te)),onRefreshGitStatus:le[38]||(le[38]=Te=>C(o).activeSessionId.value&&C(o).loadGitStatus(C(o).activeSessionId.value)),onRenameSession:le[39]||(le[39]=(Te,ge)=>C(o).renameSession(Te,ge)),onForkSession:le[40]||(le[40]=Te=>C(o).forkSession(Te)),onArchiveSession:le[41]||(le[41]=Te=>As(Te)),onExportSession:le[42]||(le[42]=Te=>C(o).exportSession(Te)),onCompact:le[43]||(le[43]=Te=>C(o).compact()),onPickModel:le[44]||(le[44]=Te=>Vn()),onSelectModel:le[45]||(le[45]=Te=>ko(Te)),onOpenFile:le[46]||(le[46]=Te=>C(U)(Te)),onOpenMedia:le[47]||(le[47]=Te=>C(Z)(Te)),onOpenThinking:le[48]||(le[48]=Te=>C(Ne)(Te)),onOpenCompaction:le[49]||(le[49]=Te=>C(Ze)(Te)),onOpenAgent:le[50]||(le[50]=Te=>C(ut)(Te)),onOpenToolDiff:le[51]||(le[51]=Te=>C(wt)(Te)),onEditMessage:js},null,8,["mobile","turns","session-id","approvals","changes","git-info","tasks","todos","goal","activation-badges","status","thinking","plan-mode","swarm-mode","goal-mode","models","starred-ids","skills","questions","pending-question-actions","pending-approval-actions","running","turn-active","queued","search-files","upload-image","working","starting","fast-moon","file-reload-key","session-loading","compaction","has-more-messages","loading-more","loading-more-error","load-older-messages","workspace-name","workspace-root","git-diff-stats","workspaces","active-workspace-id","session-title","pr","conversation-toc"]),!C(a)&&(C(iu)||C(Ae))?(x(),Se(Xn,{key:2,class:"sidebar-toggle-btn",size:"sm",label:C(Ae)?C(i)("sidebar.expandSidebar"):C(i)("sidebar.collapseSidebar"),onClick:C(P)},{default:Ie(()=>[ae(Ge,{name:C(Ae)?"panel-expand":"panel-collapse"},null,8,["name"])]),_:1},8,["label","onClick"])):ue("",!0),C(Wt)&&!C(a)?(x(),Se(H_,{key:3,class:"preview-handle","storage-key":C(G),"default-width":C(ye),min:C(me),max:C(de),reverse:"","aria-label":C(i)("layout.resizePreviewAria"),"onUpdate:width":le[52]||(le[52]=Te=>V.value=Te),"onUpdate:dragging":le[53]||(le[53]=Te=>mn.value=Te)},null,8,["storage-key","default-width","min","max","aria-label"])):ue("",!0),!C(a)||C(Wt)?(x(),E("aside",{key:4,class:Ue(["global-preview",{open:C(Wt),mobile:C(a),"no-anim":C(mn)||F.value}]),role:"complementary","aria-label":C(i)("layout.detailPanelAria"),"aria-hidden":!C(Wt)},[T.value==="thinking"&&C(ke)?(x(),Se(W3,{key:0,text:C(pe)??"",onClose:C(qe)},null,8,["text","onClose"])):T.value==="compaction"&&C(xe)?(x(),Se(W3,{key:1,text:C(be)??"",subtitle:C(i)("conversation.summaryTitle"),onClose:C(tt)},null,8,["text","subtitle","onClose"])):T.value==="agent"&&C(lt)?(x(),Se(Vme,{key:2,member:C(lt),onClose:C(mt)},null,8,["member","onClose"])):T.value==="btw"&&C(Kt)?(x(),Se(h1e,{key:3,turns:C(o).sideChatTurns.value,running:C(o).sideChatRunning.value,sending:C(o).sideChatSending.value,onSend:le[54]||(le[54]=Te=>C(o).sendSideChatPrompt(Te)),onClose:C(Gt)},null,8,["turns","running","sending","onClose"])):T.value==="diff"?(x(),Se(W1e,{key:4,mode:C(en),changes:C(o).changes.value,"git-info":C(o).gitInfo.value,"file-diff":C(o).fileDiff.value,"selected-diff-path":C(o).selectedDiffPath.value,"file-diff-loading":C(o).fileDiffLoading.value,closable:"",onOpen:C(pn),onBack:le[55]||(le[55]=Te=>{en.value="list",Hn.value=null,C(o).clearFileDiff()}),onClose:C(bn)},null,8,["mode","changes","git-info","file-diff","selected-diff-path","file-diff-loading","onOpen","onClose"])):T.value==="toolDiff"&&C(Tt)?(x(),Se(i1e,{key:5,target:C(Tt),onClose:C(Ft)},null,8,["target","onClose"])):T.value==="file"?(x(),Se(Mme,{key:6,file:C(B),loading:C(W),error:C(z),line:C(S)?.line,"download-url":C(L),closable:"","external-actions":C(O),"open-file":C(U),onClose:C(ie),onOpenExternal:C(q),onReveal:C(ee)},null,8,["file","loading","error","line","download-url","external-actions","open-file","onClose","onOpenExternal","onReveal"])):ue("",!0)],10,VCe)):ue("",!0),ae(WCe,{class:"internal-build-fab"}),to.value?(x(),Se(r0e,{key:5,models:C(o).models.value,current:C(o).status.value.modelId,"starred-ids":C(o).starredModelIds.value,loading:Bt.value,unavailable:Yt.value,onSelect:le[56]||(le[56]=Te=>Oo(Te)),onToggleStar:le[57]||(le[57]=Te=>C(o).toggleStarModel(Te)),onClose:le[58]||(le[58]=Te=>to.value=!1)},null,8,["models","current","starred-ids","loading","unavailable"])):ue("",!0),sn.value?(x(),Se(Cxe,{key:6,"color-scheme":C(o).colorScheme.value,accent:C(o).accent.value,"ui-font-size":C(o).uiFontSize.value,"auth-ready":C(o).authReady.value,"account-model":C(o).defaultModel.value,notify:C(o).notifyOnComplete.value,"notify-question":C(o).notifyOnQuestion.value,"notify-approval":C(o).notifyOnApproval.value,"notify-permission":C(o).notifyPermission.value,sound:C(o).soundOnComplete.value,"conversation-toc":C(o).conversationToc.value,config:C(o).config.value,models:C(o).models.value,"config-saving":nn.value,"server-version":C(o).serverVersion.value,backend:C(o).backend.value,onSetColorScheme:le[59]||(le[59]=Te=>C(o).setColorScheme(Te)),onSetAccent:le[60]||(le[60]=Te=>C(o).setAccent(Te)),onSetUiFontSize:le[61]||(le[61]=Te=>C(o).setUiFontSize(Te)),onSetNotify:le[62]||(le[62]=Te=>C(o).setNotifyOnComplete(Te)),onSetNotifyQuestion:le[63]||(le[63]=Te=>C(o).setNotifyOnQuestion(Te)),onSetNotifyApproval:le[64]||(le[64]=Te=>C(o).setNotifyOnApproval(Te)),onSetSound:le[65]||(le[65]=Te=>C(o).setSoundOnComplete(Te)),onSetConversationToc:le[66]||(le[66]=Te=>C(o).setConversationToc(Te)),onUpdateConfig:le[67]||(le[67]=Te=>Bo(Te)),onLogin:le[68]||(le[68]=()=>{sn.value=!1,Jn()}),onLogout:C(o).logout,onOpenOnboarding:le[69]||(le[69]=()=>{sn.value=!1,A()}),onOpenProviders:le[70]||(le[70]=()=>{sn.value=!1,Kn()}),onClose:le[71]||(le[71]=Te=>sn.value=!1)},null,8,["color-scheme","accent","ui-font-size","auth-ready","account-model","notify","notify-question","notify-approval","notify-permission","sound","conversation-toc","config","models","config-saving","server-version","backend","onLogout"])):ue("",!0),vt.value?(x(),Se(I0e,{key:7,providers:C(o).providers.value,loading:vn.value,unavailable:xn.value,onAdd:le[72]||(le[72]=Te=>li(Te)),onRefresh:le[73]||(le[73]=Te=>Uo(Te)),onDelete:le[74]||(le[74]=Te=>qo(Te)),onOpenLogin:le[75]||(le[75]=()=>{vt.value=!1,Jn()}),onClose:le[76]||(le[76]=Te=>vt.value=!1)},null,8,["providers","loading","unavailable"])):ue("",!0),Qn.value?(x(),Se(Swe,{key:8,status:C(o).status.value,thinking:g.value,"plan-mode":C(o).planMode.value,"swarm-mode":C(o).swarmMode.value,"cost-usd":C(o).sessionCost.value,onClose:le[77]||(le[77]=Te=>Qn.value=!1)},null,8,["status","thinking","plan-mode","swarm-mode","cost-usd"])):ue("",!0),Bn.value?(x(),Se(awe,{key:9,"browse-fs":C(o).browseFs,"get-fs-home":C(o).getFsHome,"default-path":C(o).visibleWorkspace.value?.root??C(o).status.value.cwd,error:nt.value,onAdd:le[78]||(le[78]=Te=>ns(Te)),onClose:zt},null,8,["browse-fs","get-fs-home","default-path","error"])):ue("",!0),ae(Ua,{name:"gload-fade"},{default:Ie(()=>[C(o).initialized.value?ue("",!0):(x(),Se(WSe,{key:0,issue:C(o).connectIssue.value},null,8,["issue"]))]),_:1}),C(o).initialized.value&&v.value&&!C(m)?(x(),Se(FSe,{key:10,onComplete:b,onSkip:b})):ue("",!0),ae(Bwe,{warnings:C(o).warnings.value,onDismiss:C(o).dismissWarning},null,8,["warnings","onDismiss"]),C(l)?(x(),Se(vCe,{key:11})):ue("",!0),ae(fwe),C(a)?(x(),Se(p_e,{key:12,modelValue:c.value,"onUpdate:modelValue":le[79]||(le[79]=Te=>c.value=Te),groups:C(o).workspaceGroups.value,"active-workspace-id":C(o).activeWorkspaceId.value,"active-id":C(o).activeSessionId.value,"attention-by-session":C(o).attentionBySession.value,"attention-by-workspace":C(o).attentionByWorkspace.value,onSelect:le[80]||(le[80]=Te=>C(o).selectSession(Te)),onCreate:No,onCreateInWorkspace:le[81]||(le[81]=Te=>di(Te)),onAddWorkspace:le[82]||(le[82]=Te=>Bn.value=!0),onRename:le[83]||(le[83]=(Te,ge)=>C(o).renameSession(Te,ge)),onArchive:le[84]||(le[84]=Te=>As(Te)),onDeleteWorkspace:le[85]||(le[85]=Te=>cs(Te)),onLoadMore:le[86]||(le[86]=Te=>void C(o).loadMoreSessions(Te))},null,8,["modelValue","groups","active-workspace-id","active-id","attention-by-session","attention-by-workspace"])):ue("",!0),C(a)?(x(),Se(wSe,{key:13,modelValue:u.value,"onUpdate:modelValue":le[87]||(le[87]=Te=>u.value=Te),status:C(o).status.value,thinking:C(o).thinking.value,models:C(o).models.value,"plan-mode":C(o).planMode.value,"swarm-mode":C(o).swarmMode.value,"color-scheme":C(o).colorScheme.value,"ui-font-size":C(o).uiFontSize.value,"auth-ready":C(o).authReady.value,"conversation-toc":C(o).conversationToc.value,"server-version":C(o).serverVersion.value,onPickModel:le[88]||(le[88]=Te=>Vn()),onSetThinking:le[89]||(le[89]=Te=>C(o).setThinking(Te)),onTogglePlan:le[90]||(le[90]=Te=>C(o).togglePlanMode()),onToggleSwarm:le[91]||(le[91]=Te=>C(o).toggleSwarmMode()),onSetPermission:le[92]||(le[92]=Te=>C(o).setPermission(Te)),onSetColorScheme:le[93]||(le[93]=Te=>C(o).setColorScheme(Te)),onSetUiFontSize:le[94]||(le[94]=Te=>C(o).setUiFontSize(Te)),onSetConversationToc:le[95]||(le[95]=Te=>C(o).setConversationToc(Te)),onLogin:le[96]||(le[96]=()=>{u.value=!1,Jn()}),onLogout:C(o).logout},null,8,["modelValue","status","thinking","models","plan-mode","swarm-mode","color-scheme","ui-font-size","auth-ready","conversation-toc","server-version","onLogout"])):ue("",!0)],6)),Wn.value?(x(),Se(age,{key:3,"on-start-o-auth-login":ai,"on-poll-o-auth-login":tn,"on-cancel-o-auth-login":qs,onSuccess:io,onClose:le[97]||(le[97]=Te=>Wn.value=!1)})):ue("",!0)]))}}),GCe=dt(KCe,[["__scopeId","data-v-8cd3196b"]]);jie();dm(GCe).use(Rn).mount("#app");export{N9 as $,ZA as A,bI as B,So as C,j4e as D,hA as E,We as F,qk as G,ot as H,ae as I,eI as J,g4e as K,Hi as L,Je as M,j7 as N,b4e as O,x4e as P,S4e as Q,Gp as R,ou as S,_1 as T,w4e as U,Vk as V,k4e as W,K4e as X,_4e as Y,H4e as Z,YCe as _,UA as a,Ho as a$,Mo as a0,Tk as a1,n4e as a2,Fk as a3,bM as a4,Lt as a5,Cu as a6,a4e as a7,Z4e as a8,f4e as a9,GA as aA,II as aB,RI as aC,An as aD,BI as aE,OI as aF,Lf as aG,FI as aH,On as aI,Bk as aJ,iI as aK,x as aL,z7 as aM,r4e as aN,Ln as aO,IA as aP,i4e as aQ,Qp as aR,zo as aS,Gv as aT,oe as aU,F4e as aV,lL as aW,rt as aX,jn as aY,PI as aZ,v4e as a_,m4e as aa,p4e as ab,h4e as ac,B4e as ad,X4e as ae,Jt as af,x7 as ag,x1 as ah,Il as ai,Gr as aj,vo as ak,O4e as al,ei as am,Dl as an,gt as ao,M4e as ap,E4e as aq,Sn as ar,yt as as,A7 as at,Ue as au,C9 as av,on as aw,NI as ax,$I as ay,ho as az,s4e as b,Qte as b$,U4e as b0,sf as b1,sm as b2,W4e as b3,Rl as b4,Y9 as b5,XCe as b6,gr as b7,fI as b8,z4e as b9,Cs as bA,xi as bB,w7 as bC,D4e as bD,et as bE,DA as bF,c4e as bG,pI as bH,N4e as bI,Ie as bJ,C4e as bK,qn as bL,ur as bM,R4e as bN,St as bO,l4e as bP,Mn as bQ,vs as bR,o3e as bS,s3e as bT,aE as bU,i3e as bV,vte as bW,lE as bX,Hy as bY,c3e as bZ,tne as b_,ZCe as ba,R as bb,xp as bc,y4e as bd,fn as be,JCe as bf,QCe as bg,NA as bh,$4e as bi,X9 as bj,C as bk,Bf as bl,Y4e as bm,V4e as bn,K7 as bo,u4e as bp,I4e as bq,hI as br,G4e as bs,A4e as bt,d4e as bu,zA as bv,um as bw,nL as bx,BM as by,cy as bz,P4e as c,U2 as c0,W2 as c1,z2 as c2,d3e as c3,Rm as c4,Gc as c5,Om as c6,Gte as c7,Yte as c8,f3e as c9,u3e as ca,e3e as cb,h3e as cc,K1 as cd,Fs as ce,dne as cf,une as cg,ute as ch,n3e as ci,rte as cj,lte as ck,t3e as cl,q2 as cm,fne as cn,w4 as co,n4 as cp,kte as cq,Bm as cr,Fm as cs,r3e as ct,a3e as cu,J4e as cv,l3e as cw,Ge as cx,Q4e as cy,dt as cz,L4e as d,Ll as e,e4e as f,Ua as g,Z7 as h,t4e as i,o4e as j,Ei as k,$f as l,Fo as m,h1 as n,Yr as o,q4e as p,D as q,dm as r,Se as s,ue as t,E as u,w as v,l7 as w,T4e as x,r7 as y,aL as z};