diffing 0.13.0 → 0.13.1

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 (149) hide show
  1. package/dist/client/assets/{angular-html-gcUdctE_.js → angular-html-CjzmejZ2.js} +1 -1
  2. package/dist/client/assets/{angular-ts-BkjLgJJH.js → angular-ts-DhODVdiO.js} +1 -1
  3. package/dist/client/assets/{apl-BtuEza96.js → apl-KYCqHKQc.js} +1 -1
  4. package/dist/client/assets/{arc-yk_3cjs2.js → arc-BTiemUXN.js} +1 -1
  5. package/dist/client/assets/{architectureDiagram-3BPJPVTR-DDVXPdzY.js → architectureDiagram-3BPJPVTR-C036F4I_.js} +1 -1
  6. package/dist/client/assets/{astro-DfUNgEjV.js → astro-DDY2SFEm.js} +1 -1
  7. package/dist/client/assets/{blade-uv3PNTww.js → blade-B9Mved2V.js} +1 -1
  8. package/dist/client/assets/{blockDiagram-GPEHLZMM-DlMLqbfD.js → blockDiagram-GPEHLZMM-ezdKSZRk.js} +1 -1
  9. package/dist/client/assets/{c-DcsMh0kd.js → c-BU4c8hQj.js} +1 -1
  10. package/dist/client/assets/{c4Diagram-AAUBKEIU-C4ZZJAMJ.js → c4Diagram-AAUBKEIU-BjbMz8Go.js} +1 -1
  11. package/dist/client/assets/channel-CiiG2TKm.js +1 -0
  12. package/dist/client/assets/{chunk-2J33WTMH-CwkSvLT8.js → chunk-2J33WTMH-DauPE73Z.js} +1 -1
  13. package/dist/client/assets/{chunk-3OPIFGDE-s6UH12Df.js → chunk-3OPIFGDE-BsKvhBCg.js} +1 -1
  14. package/dist/client/assets/{chunk-4BX2VUAB-wGjYymx_.js → chunk-4BX2VUAB-0ToMTxXn.js} +1 -1
  15. package/dist/client/assets/{chunk-55IACEB6-DObbP11Q.js → chunk-55IACEB6-CCAvsTMg.js} +1 -1
  16. package/dist/client/assets/{chunk-5ZQYHXKU-DwbkzQEJ.js → chunk-5ZQYHXKU-7a8TYhF5.js} +1 -1
  17. package/dist/client/assets/{chunk-727SXJPM-DzoJfly4.js → chunk-727SXJPM-DsMUzRtp.js} +1 -1
  18. package/dist/client/assets/{chunk-AQP2D5EJ-f1kNxYS3.js → chunk-AQP2D5EJ-BsBse6t1.js} +1 -1
  19. package/dist/client/assets/{chunk-BSJP7CBP-CTBkVJEp.js → chunk-BSJP7CBP-BRW98vVd.js} +1 -1
  20. package/dist/client/assets/{chunk-CSCIHK7Q-C6dvEyPX.js → chunk-CSCIHK7Q-aCJK7F2t.js} +1 -1
  21. package/dist/client/assets/{chunk-FMBD7UC4-C166WZ7L.js → chunk-FMBD7UC4-Dqfmok6Y.js} +1 -1
  22. package/dist/client/assets/{chunk-KSCS5N6A-CaVyQHxA.js → chunk-KSCS5N6A-D6wKRsyG.js} +1 -1
  23. package/dist/client/assets/{chunk-L5ZTLDWV-CdW7usF5.js → chunk-L5ZTLDWV-Cop-6vuh.js} +1 -1
  24. package/dist/client/assets/{chunk-LZXEDZCA-imRCFVGq.js → chunk-LZXEDZCA-DOK9MVkj.js} +2 -2
  25. package/dist/client/assets/{chunk-ND2GUHAM-BJCVPOgO.js → chunk-ND2GUHAM-D4ydI1Xl.js} +1 -1
  26. package/dist/client/assets/{chunk-NZK2D7GU-DodLkks9.js → chunk-NZK2D7GU-5L2wTsAU.js} +1 -1
  27. package/dist/client/assets/{chunk-O5CBEL6O-DYxYE_dt.js → chunk-O5CBEL6O-ATeCgJd_.js} +1 -1
  28. package/dist/client/assets/chunk-QZHKN3VN-BgSjRmyr.js +1 -0
  29. package/dist/client/assets/chunk-WU5MYG2G-tQV9amHv.js +1 -0
  30. package/dist/client/assets/{chunk-XPW4576I-DkPXlA-y.js → chunk-XPW4576I-CDOLAUs-.js} +1 -1
  31. package/dist/client/assets/classDiagram-4FO5ZUOK-S7JMn6cj.js +1 -0
  32. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-bWQM1WnL.js +1 -0
  33. package/dist/client/assets/{cobol-B5tSUxVN.js → cobol-BRTNaQEL.js} +1 -1
  34. package/dist/client/assets/{coffee-B2Q8w4Zu.js → coffee-BklNhfGV.js} +1 -1
  35. package/dist/client/assets/{cose-bilkent-S5V4N54A-Bg2tspSU.js → cose-bilkent-S5V4N54A-DqtIDrNy.js} +1 -1
  36. package/dist/client/assets/{cpp-CfzAEc1z.js → cpp-BKMsxxTF.js} +1 -1
  37. package/dist/client/assets/{crystal-BDxAjW7-.js → crystal-CsarWpvB.js} +1 -1
  38. package/dist/client/assets/{css-nC3_RAjk.js → css-Dv67WWLO.js} +1 -1
  39. package/dist/client/assets/{dagre-BM42HDAG-BZiNHe27.js → dagre-BM42HDAG-2kISkU7F.js} +1 -1
  40. package/dist/client/assets/{diagram-2AECGRRQ-D3Vd2itQ.js → diagram-2AECGRRQ-B3rOrr1p.js} +1 -1
  41. package/dist/client/assets/{diagram-5GNKFQAL-D44Rm6ep.js → diagram-5GNKFQAL-BSCW3vsr.js} +1 -1
  42. package/dist/client/assets/{diagram-KO2AKTUF-DwoQejb5.js → diagram-KO2AKTUF-B4emGSGw.js} +1 -1
  43. package/dist/client/assets/{diagram-LMA3HP47-C1eaDL4X.js → diagram-LMA3HP47-6EETroK5.js} +1 -1
  44. package/dist/client/assets/{diagram-OG6HWLK6-BtBJHHnj.js → diagram-OG6HWLK6-BNjaPw8L.js} +1 -1
  45. package/dist/client/assets/{dist-DUBmiUQf.js → dist-6S1F6myp.js} +1 -1
  46. package/dist/client/assets/{edge-WCfPDabs.js → edge-B4WfWboP.js} +1 -1
  47. package/dist/client/assets/{elixir-CazmTZo9.js → elixir-BldSdPyz.js} +1 -1
  48. package/dist/client/assets/{elm-CTqaOirp.js → elm-Baz9wiad.js} +1 -1
  49. package/dist/client/assets/{erDiagram-TEJ5UH35-CqjpbNDt.js → erDiagram-TEJ5UH35-De8q4-8o.js} +1 -1
  50. package/dist/client/assets/{erb-CK9x36t2.js → erb-_hp6QFA9.js} +1 -1
  51. package/dist/client/assets/{flowDiagram-I6XJVG4X-CSHJZmlA.js → flowDiagram-I6XJVG4X-BiqO2ROW.js} +1 -1
  52. package/dist/client/assets/{ganttDiagram-6RSMTGT7-D6KxkDpI.js → ganttDiagram-6RSMTGT7-CJEE9dI3.js} +1 -1
  53. package/dist/client/assets/{git-rebase-Bn8xQDxV.js → git-rebase-CVUn24-q.js} +1 -1
  54. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-ZGSlrHF5.js → gitGraphDiagram-PVQCEYII-C9__0BRT.js} +1 -1
  55. package/dist/client/assets/{glimmer-js-h7wFfOLo.js → glimmer-js-DzJxhDKm.js} +1 -1
  56. package/dist/client/assets/{glimmer-ts-vlZuiamP.js → glimmer-ts-C6Y0EC83.js} +1 -1
  57. package/dist/client/assets/{glsl-CNutENPV.js → glsl-CEgGa7dW.js} +1 -1
  58. package/dist/client/assets/{graphql-BfddKr9j.js → graphql-OMSQo6QZ.js} +1 -1
  59. package/dist/client/assets/{hack-BkYH75Gx.js → hack-DeuNiRTG.js} +1 -1
  60. package/dist/client/assets/{haml-CM-xW5RI.js → haml-MTFzbqPZ.js} +1 -1
  61. package/dist/client/assets/{handlebars-CklcCbzf.js → handlebars-aV-3jqy-.js} +1 -1
  62. package/dist/client/assets/{html-bltTcC3c.js → html-Dk7NFvoe.js} +1 -1
  63. package/dist/client/assets/{html-derivative-C4R1a7Nf.js → html-derivative-Dj5eILVA.js} +1 -1
  64. package/dist/client/assets/{http-B6uXoDkp.js → http-CrTYPxrq.js} +1 -1
  65. package/dist/client/assets/{hurl-gquKVFPU.js → hurl-67mqykeb.js} +1 -1
  66. package/dist/client/assets/{index-BsuX6HVI.css → index-BmrUfJcW.css} +1 -1
  67. package/dist/client/assets/{index-yhKiqbkK.js → index-DsE97mBG.js} +94 -91
  68. package/dist/client/assets/{infoDiagram-5YYISTIA-DCQv5BKv.js → infoDiagram-5YYISTIA-BNodlxnx.js} +1 -1
  69. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-BqXC35qz.js → ishikawaDiagram-YF4QCWOH-2hqxFXYT.js} +1 -1
  70. package/dist/client/assets/{java-DZLUJ7qo.js → java-dUpx0fOI.js} +1 -1
  71. package/dist/client/assets/{javascript-CayXc7uP.js → javascript-BAe3TrQC.js} +1 -1
  72. package/dist/client/assets/{jinja-CQQUTC0y.js → jinja-DkZ6M3Ab.js} +1 -1
  73. package/dist/client/assets/{jison-CvzuCn2x.js → jison-DM35qhgH.js} +1 -1
  74. package/dist/client/assets/{journeyDiagram-JHISSGLW-bRlSO5Sv.js → journeyDiagram-JHISSGLW-D1K8YBBZ.js} +1 -1
  75. package/dist/client/assets/{json-BsMA0GaP.js → json-BllrVlVX.js} +1 -1
  76. package/dist/client/assets/{jsx-Dbxr4aPH.js → jsx-D7cROKfU.js} +1 -1
  77. package/dist/client/assets/{julia-CZ38GzHV.js → julia-D9WQ8mfH.js} +1 -1
  78. package/dist/client/assets/{just-BQwFLV1D.js → just-DaRB3DJQ.js} +1 -1
  79. package/dist/client/assets/{kanban-definition-UN3LZRKU-BVjoqA0y.js → kanban-definition-UN3LZRKU-DyyK3SjG.js} +1 -1
  80. package/dist/client/assets/{latex-BGyrMdgQ.js → latex-DF20a121.js} +1 -1
  81. package/dist/client/assets/{line-DacHFvZH.js → line-CIqf1T-G.js} +1 -1
  82. package/dist/client/assets/{linear-BPGHNTSb.js → linear-DRktwZya.js} +1 -1
  83. package/dist/client/assets/{liquid-CiA2vjOH.js → liquid-1TnFZcmx.js} +1 -1
  84. package/dist/client/assets/{lua-D9k3fxwM.js → lua-DiFnBrnv.js} +1 -1
  85. package/dist/client/assets/{marko-CwBH4-2T.js → marko-BwZ8-6ja.js} +1 -1
  86. package/dist/client/assets/{mdc-D4WuuVvw.js → mdc-P-pYOfTm.js} +1 -1
  87. package/dist/client/assets/{mermaid-parser.core-DuXqm2Gp.js → mermaid-parser.core-ZB3FBqrQ.js} +1 -1
  88. package/dist/client/assets/{mermaid.core-DRh_KVT1.js → mermaid.core-ChEL4MWP.js} +3 -3
  89. package/dist/client/assets/{mindmap-definition-RKZ34NQL-C5wytjbD.js → mindmap-definition-RKZ34NQL-D2iiEHt1.js} +1 -1
  90. package/dist/client/assets/{nginx-DHMa03ia.js → nginx-Dsk_n7oR.js} +1 -1
  91. package/dist/client/assets/{nim-8gK3mQXD.js → nim-Ck1s300a.js} +1 -1
  92. package/dist/client/assets/{perl-DqXBmOB_.js → perl-B41o_jjC.js} +1 -1
  93. package/dist/client/assets/{php-CruAnpl2.js → php-CMujlzV0.js} +1 -1
  94. package/dist/client/assets/{pieDiagram-4H26LBE5-Cv2Csp1M.js → pieDiagram-4H26LBE5-C8ENYMuT.js} +1 -1
  95. package/dist/client/assets/{pug-C7a5y4Mi.js → pug-D11187PM.js} +1 -1
  96. package/dist/client/assets/{qml-mgWY__NW.js → qml-DTIWhV-g.js} +1 -1
  97. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-DHQIHzFU.js → quadrantDiagram-W4KKPZXB-C9Gl58SH.js} +1 -1
  98. package/dist/client/assets/{r-Do5QoKdS.js → r-BZAS-COm.js} +1 -1
  99. package/dist/client/assets/{razor-BqdDbm9d.js → razor-CBm_RlUZ.js} +1 -1
  100. package/dist/client/assets/{regexp-CNMlPqVr.js → regexp-BEybnWDb.js} +1 -1
  101. package/dist/client/assets/{requirementDiagram-4Y6WPE33-rUeJykKo.js → requirementDiagram-4Y6WPE33-nDCWYz0l.js} +1 -1
  102. package/dist/client/assets/{review-export-BgwyN8Ky.js → review-export-D5JAvT15.js} +1 -1
  103. package/dist/client/assets/{rst-PYCtADQ2.js → rst-BOC8MHym.js} +1 -1
  104. package/dist/client/assets/{ruby-B8JdoeHE.js → ruby-DaL2rAtC.js} +1 -1
  105. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-Bsga6dQU.js → sankeyDiagram-5OEKKPKP-C4_qZSDA.js} +1 -1
  106. package/dist/client/assets/{sas-kIev4j3d.js → sas-JlJDv85T.js} +1 -1
  107. package/dist/client/assets/{scss-cf-rl7q3.js → scss-uXJKsv_B.js} +1 -1
  108. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-BVcwcOB2.js → sequenceDiagram-3UESZ5HK-aWpy-ufU.js} +1 -1
  109. package/dist/client/assets/{shellscript-BHMFbkaV.js → shellscript-HMUWC9b7.js} +1 -1
  110. package/dist/client/assets/{shellsession-y_3kBnoK.js → shellsession-C8yhvjix.js} +1 -1
  111. package/dist/client/assets/{soy-Coc7dfRW.js → soy-Dz4Z0AvF.js} +1 -1
  112. package/dist/client/assets/{sql-CsZYO19m.js → sql-DeGOlIES.js} +1 -1
  113. package/dist/client/assets/{src-ujohT29p.js → src-DppXJDZm.js} +1 -1
  114. package/dist/client/assets/{stata-BFa4m_Eh.js → stata-B56wP_fZ.js} +1 -1
  115. package/dist/client/assets/{stateDiagram-AJRCARHV-DBElJIPe.js → stateDiagram-AJRCARHV-B-LApCfg.js} +1 -1
  116. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-Dsaju7vd.js +1 -0
  117. package/dist/client/assets/{surrealql-DlwfRFnC.js → surrealql-C-EnKGgM.js} +1 -1
  118. package/dist/client/assets/{svelte-RrLklQOZ.js → svelte-B-gz1UqK.js} +1 -1
  119. package/dist/client/assets/{templ-BDbBg7z2.js → templ-DbohGIUJ.js} +1 -1
  120. package/dist/client/assets/{tex-BeAp-Hqv.js → tex-BeTSKLqn.js} +1 -1
  121. package/dist/client/assets/{timeline-definition-PNZ67QCA-Det2OiYV.js → timeline-definition-PNZ67QCA-CIXefp7c.js} +1 -1
  122. package/dist/client/assets/{ts-tags-Dz-1CFmn.js → ts-tags-BkO3jza8.js} +1 -1
  123. package/dist/client/assets/{tsx-Dfi08w8H.js → tsx-DaFYbbmG.js} +1 -1
  124. package/dist/client/assets/{twig-BfzYY6Hd.js → twig-DzCVyQww.js} +1 -1
  125. package/dist/client/assets/{typescript-6FNAPG3Z.js → typescript-Dln4zzcr.js} +1 -1
  126. package/dist/client/assets/{vennDiagram-CIIHVFJN-DhH4H0vl.js → vennDiagram-CIIHVFJN-CGlY8H3X.js} +1 -1
  127. package/dist/client/assets/{vue-DTPedjqE.js → vue-BzONpLvY.js} +1 -1
  128. package/dist/client/assets/{vue-html-B4sC29Oj.js → vue-html-COcQmVJc.js} +1 -1
  129. package/dist/client/assets/{vue-vine-BWzpqJ4r.js → vue-vine-DVjvhNim.js} +1 -1
  130. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-BC8K10yP.js → wardleyDiagram-YWT4CUSO-Ceqd_0r2.js} +1 -1
  131. package/dist/client/assets/{xml-BK8ACjht.js → xml-BdpFphXw.js} +1 -1
  132. package/dist/client/assets/{xsl-rjlrbfou.js → xsl-B0CVAfmA.js} +1 -1
  133. package/dist/client/assets/{xychartDiagram-2RQKCTM6-DwcVZiB5.js → xychartDiagram-2RQKCTM6-DVSLRUjt.js} +1 -1
  134. package/dist/client/assets/{yaml-DM6lgMhS.js → yaml-DS_pFZ8s.js} +1 -1
  135. package/dist/client/index.html +2 -2
  136. package/dist/native/tui-darwin-arm64/diffing-tui +0 -0
  137. package/dist/native/tui-darwin-x64/diffing-tui +0 -0
  138. package/dist/native/tui-linux-arm64-gnu/diffing-tui +0 -0
  139. package/dist/native/tui-linux-arm64-musl/diffing-tui +0 -0
  140. package/dist/native/tui-linux-x64-gnu/diffing-tui +0 -0
  141. package/dist/native/tui-linux-x64-musl/diffing-tui +0 -0
  142. package/dist/native/tui-win32-x64-msvc/diffing-tui.exe +0 -0
  143. package/package.json +1 -1
  144. package/dist/client/assets/channel-CPOnEOhs.js +0 -1
  145. package/dist/client/assets/chunk-QZHKN3VN-7sNTyEOs.js +0 -1
  146. package/dist/client/assets/chunk-WU5MYG2G-DluN2oZF.js +0 -1
  147. package/dist/client/assets/classDiagram-4FO5ZUOK-CHofrzZI.js +0 -1
  148. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-B8fKe5FS.js +0 -1
  149. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-BocZ498b.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-gcUdctE_.js","assets/html-bltTcC3c.js","assets/css-nC3_RAjk.js","assets/javascript-CayXc7uP.js","assets/angular-ts-BkjLgJJH.js","assets/scss-cf-rl7q3.js","assets/apl-BtuEza96.js","assets/json-BsMA0GaP.js","assets/xml-BK8ACjht.js","assets/java-DZLUJ7qo.js","assets/astro-DfUNgEjV.js","assets/postcss-BHCm7Qae.js","assets/tsx-Dfi08w8H.js","assets/typescript-6FNAPG3Z.js","assets/blade-uv3PNTww.js","assets/html-derivative-C4R1a7Nf.js","assets/sql-CsZYO19m.js","assets/bsl-BrHd4RA2.js","assets/sdbl-AL_m-RO_.js","assets/cairo-BDZ6TRZS.js","assets/python-D1NFioGW.js","assets/cobol-B5tSUxVN.js","assets/coffee-B2Q8w4Zu.js","assets/cpp-CfzAEc1z.js","assets/glsl-CNutENPV.js","assets/c-DcsMh0kd.js","assets/regexp-CNMlPqVr.js","assets/crystal-BDxAjW7-.js","assets/shellscript-BHMFbkaV.js","assets/edge-WCfPDabs.js","assets/elixir-CazmTZo9.js","assets/elm-CTqaOirp.js","assets/erb-CK9x36t2.js","assets/ruby-B8JdoeHE.js","assets/graphql-BfddKr9j.js","assets/jsx-Dbxr4aPH.js","assets/haml-CM-xW5RI.js","assets/lua-D9k3fxwM.js","assets/yaml-DM6lgMhS.js","assets/erlang-cuhwpmsu.js","assets/markdown-DXxotAxn.js","assets/fortran-fixed-form-DWr0EnJn.js","assets/fortran-free-form-Br4jRtSc.js","assets/fsharp-CQ5iYSPA.js","assets/gdresource-CN-lsNu5.js","assets/gdscript-hSAZM1eh.js","assets/gdshader-D4XNAEs9.js","assets/git-commit-6e79eN7Q.js","assets/diff-CW0RWGd9.js","assets/git-rebase-Bn8xQDxV.js","assets/glimmer-js-h7wFfOLo.js","assets/glimmer-ts-vlZuiamP.js","assets/hack-BkYH75Gx.js","assets/handlebars-CklcCbzf.js","assets/http-B6uXoDkp.js","assets/hurl-gquKVFPU.js","assets/csv-BBwiVr0X.js","assets/hxml-nwJci6H5.js","assets/haxe-DMg0jS3a.js","assets/jinja-CQQUTC0y.js","assets/jison-CvzuCn2x.js","assets/julia-CZ38GzHV.js","assets/r-Do5QoKdS.js","assets/just-BQwFLV1D.js","assets/perl-DqXBmOB_.js","assets/latex-BGyrMdgQ.js","assets/tex-BeAp-Hqv.js","assets/liquid-CiA2vjOH.js","assets/marko-CwBH4-2T.js","assets/less-DyHub3ow.js","assets/mdc-D4WuuVvw.js","assets/nextflow-DSfydIxt.js","assets/nextflow-groovy-DV4H3hok.js","assets/nginx-DHMa03ia.js","assets/nim-8gK3mQXD.js","assets/php-CruAnpl2.js","assets/pug-C7a5y4Mi.js","assets/qml-mgWY__NW.js","assets/razor-BqdDbm9d.js","assets/csharp-C3YlYcLV.js","assets/rst-PYCtADQ2.js","assets/cmake-DaqQuj4A.js","assets/sas-kIev4j3d.js","assets/shaderlab-CbbQwRPF.js","assets/hlsl-DPe9L0Dt.js","assets/shellsession-y_3kBnoK.js","assets/soy-Coc7dfRW.js","assets/sparql-DEoxFJ5d.js","assets/turtle-BM-MG8WY.js","assets/stata-BFa4m_Eh.js","assets/surrealql-DlwfRFnC.js","assets/svelte-RrLklQOZ.js","assets/templ-BDbBg7z2.js","assets/go-BJpWXZEs.js","assets/ts-tags-Dz-1CFmn.js","assets/twig-BfzYY6Hd.js","assets/vue-DTPedjqE.js","assets/vue-html-B4sC29Oj.js","assets/vue-vine-BWzpqJ4r.js","assets/stylus-B_iq45Sj.js","assets/xsl-rjlrbfou.js","assets/mermaid.core-DRh_KVT1.js","assets/chunk-O5CBEL6O-DYxYE_dt.js","assets/src-ujohT29p.js","assets/chunk-5ZQYHXKU-DwbkzQEJ.js","assets/dist-DUBmiUQf.js","assets/chunk-CSCIHK7Q-C6dvEyPX.js","assets/chunk-3OPIFGDE-s6UH12Df.js","assets/chunk-L5ZTLDWV-CdW7usF5.js","assets/chunk-NZK2D7GU-DodLkks9.js","assets/rough.esm-BBrzuQ0N.js","assets/chunk-BSJP7CBP-CTBkVJEp.js","assets/chunk-KSCS5N6A-CaVyQHxA.js","assets/line-DacHFvZH.js","assets/path-g3G46IZB.js","assets/array-CkF66D10.js","assets/chunk-LZXEDZCA-imRCFVGq.js","assets/chunk-WU5MYG2G-DluN2oZF.js","assets/chunk-XPW4576I-DkPXlA-y.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-CjzmejZ2.js","assets/html-Dk7NFvoe.js","assets/css-Dv67WWLO.js","assets/javascript-BAe3TrQC.js","assets/angular-ts-DhODVdiO.js","assets/scss-uXJKsv_B.js","assets/apl-KYCqHKQc.js","assets/json-BllrVlVX.js","assets/xml-BdpFphXw.js","assets/java-dUpx0fOI.js","assets/astro-DDY2SFEm.js","assets/postcss-BHCm7Qae.js","assets/tsx-DaFYbbmG.js","assets/typescript-Dln4zzcr.js","assets/blade-B9Mved2V.js","assets/html-derivative-Dj5eILVA.js","assets/sql-DeGOlIES.js","assets/bsl-BrHd4RA2.js","assets/sdbl-AL_m-RO_.js","assets/cairo-BDZ6TRZS.js","assets/python-D1NFioGW.js","assets/cobol-BRTNaQEL.js","assets/coffee-BklNhfGV.js","assets/cpp-BKMsxxTF.js","assets/glsl-CEgGa7dW.js","assets/c-BU4c8hQj.js","assets/regexp-BEybnWDb.js","assets/crystal-CsarWpvB.js","assets/shellscript-HMUWC9b7.js","assets/edge-B4WfWboP.js","assets/elixir-BldSdPyz.js","assets/elm-Baz9wiad.js","assets/erb-_hp6QFA9.js","assets/ruby-DaL2rAtC.js","assets/graphql-OMSQo6QZ.js","assets/jsx-D7cROKfU.js","assets/haml-MTFzbqPZ.js","assets/lua-DiFnBrnv.js","assets/yaml-DS_pFZ8s.js","assets/erlang-cuhwpmsu.js","assets/markdown-DXxotAxn.js","assets/fortran-fixed-form-DWr0EnJn.js","assets/fortran-free-form-Br4jRtSc.js","assets/fsharp-CQ5iYSPA.js","assets/gdresource-CN-lsNu5.js","assets/gdscript-hSAZM1eh.js","assets/gdshader-D4XNAEs9.js","assets/git-commit-6e79eN7Q.js","assets/diff-CW0RWGd9.js","assets/git-rebase-CVUn24-q.js","assets/glimmer-js-DzJxhDKm.js","assets/glimmer-ts-C6Y0EC83.js","assets/hack-DeuNiRTG.js","assets/handlebars-aV-3jqy-.js","assets/http-CrTYPxrq.js","assets/hurl-67mqykeb.js","assets/csv-BBwiVr0X.js","assets/hxml-nwJci6H5.js","assets/haxe-DMg0jS3a.js","assets/jinja-DkZ6M3Ab.js","assets/jison-DM35qhgH.js","assets/julia-D9WQ8mfH.js","assets/r-BZAS-COm.js","assets/just-DaRB3DJQ.js","assets/perl-B41o_jjC.js","assets/latex-DF20a121.js","assets/tex-BeTSKLqn.js","assets/liquid-1TnFZcmx.js","assets/marko-BwZ8-6ja.js","assets/less-DyHub3ow.js","assets/mdc-P-pYOfTm.js","assets/nextflow-DSfydIxt.js","assets/nextflow-groovy-DV4H3hok.js","assets/nginx-Dsk_n7oR.js","assets/nim-Ck1s300a.js","assets/php-CMujlzV0.js","assets/pug-D11187PM.js","assets/qml-DTIWhV-g.js","assets/razor-CBm_RlUZ.js","assets/csharp-C3YlYcLV.js","assets/rst-BOC8MHym.js","assets/cmake-DaqQuj4A.js","assets/sas-JlJDv85T.js","assets/shaderlab-CbbQwRPF.js","assets/hlsl-DPe9L0Dt.js","assets/shellsession-C8yhvjix.js","assets/soy-Dz4Z0AvF.js","assets/sparql-DEoxFJ5d.js","assets/turtle-BM-MG8WY.js","assets/stata-B56wP_fZ.js","assets/surrealql-C-EnKGgM.js","assets/svelte-B-gz1UqK.js","assets/templ-DbohGIUJ.js","assets/go-BJpWXZEs.js","assets/ts-tags-BkO3jza8.js","assets/twig-DzCVyQww.js","assets/vue-BzONpLvY.js","assets/vue-html-COcQmVJc.js","assets/vue-vine-DVjvhNim.js","assets/stylus-B_iq45Sj.js","assets/xsl-B0CVAfmA.js","assets/mermaid.core-ChEL4MWP.js","assets/chunk-O5CBEL6O-ATeCgJd_.js","assets/src-DppXJDZm.js","assets/chunk-5ZQYHXKU-7a8TYhF5.js","assets/dist-6S1F6myp.js","assets/chunk-CSCIHK7Q-aCJK7F2t.js","assets/chunk-3OPIFGDE-BsKvhBCg.js","assets/chunk-L5ZTLDWV-Cop-6vuh.js","assets/chunk-NZK2D7GU-5L2wTsAU.js","assets/rough.esm-BBrzuQ0N.js","assets/chunk-BSJP7CBP-BRW98vVd.js","assets/chunk-KSCS5N6A-D6wKRsyG.js","assets/line-CIqf1T-G.js","assets/path-g3G46IZB.js","assets/array-CkF66D10.js","assets/chunk-LZXEDZCA-DOK9MVkj.js","assets/chunk-WU5MYG2G-tQV9amHv.js","assets/chunk-XPW4576I-CDOLAUs-.js"])))=>i.map(i=>d[i]);
2
2
  var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.4`})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=p();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.4`})),h=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=d(),n=p(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},z=[],B=-1;function V(e){return{current:e}}function H(e){0>B||(e.current=z[B],z[B]=null,B--)}function U(e,t){B++,z[B]=e.current,e.current=t}var W=V(null),ee=V(null),te=V(null),ne=V(null);function re(e,t){switch(U(te,t),U(ee,e),U(W,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Wd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Wd(t),e=Gd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}H(W),U(W,e)}function ie(){H(W),H(ee),H(te)}function ae(e){e.memoizedState!==null&&U(ne,e);var t=W.current,n=Gd(t,e.type);t!==n&&(U(ee,e),U(W,n))}function oe(e){ee.current===e&&(H(W),H(ee)),ne.current===e&&(H(ne),tp._currentValue=R)}var G,se;function K(e){if(G===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);G=t&&t[1]||``,se=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+G+e+se}var ce=!1;function le(e,t){if(!e||ce)return``;ce=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -18,7 +18,7 @@ Error generating stack: `+e.message+`
18
18
  \f\r "&'<=>\``.split(``)],[`\0
19
19
  \f\r "&'<=>\``.split(``),`\0
20
20
  \f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function Ta(e,t,n,r){let i=r.schema,a=i.space===`svg`?!1:r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=mi);let l=Ea(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!va(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!na(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function Ea(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=Da(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function Da(e,t,n){let r=ui(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=e.settings.allowDangerousCharacters?0:1,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=Ri(r.attribute,Object.assign({},e.settings.characterReferences,{subset:wa.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Gi:Ki)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=Ri(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:wa.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&Wi(n,o)>Wi(n,e.alternative)&&(o=e.alternative),s=o+Ri(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?wa.single:wa.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var Oa=[`<`,`&`];function ka(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:Ri(e.value,Object.assign({},r.settings.characterReferences,{subset:Oa}))}function Aa(e,t,n,r){return r.settings.allowDangerousHtml?e.value:ka(e,t,n,r)}function ja(e,t,n,r){return r.all(e)}var Ma=gi(`type`,{invalid:Na,unknown:Pa,handlers:{comment:Hi,doctype:Ui,element:Ta,raw:Aa,root:ja,text:ka}});function Na(e){throw Error("Expected node, not `"+e+"`")}function Pa(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var Fa={},Ia={},La=[];function Ra(e,t){let n=t||Fa,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:za,all:Ba,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Pr,characterReferences:n.characterReferences||Ia,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?mi:pi,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function za(e,t,n){return Ma(e,t,n,this)}function Ba(e){let t=[],n=e&&e.children||La,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}function Va(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function Ha(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Ua(e){return Array.isArray(e)?e:[e]}async function Wa(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function Ga(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function Ka(e){return e===`ansi`||Ga(e)}function qa(e){return e===`none`}function Ja(e){return qa(e)}function Ya(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(/\s+/g);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function Xa(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(/(\r?\n)/g),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}function Za(e){let t=Xa(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t[t.length-1].length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function Qa(e,t,n){let r=new Set;for(let t of e.matchAll(/:?lang=["']([^"']+)["']/g)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(/(?:```|~~~)([\w-]+)/g)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(/\\begin\{([\w-]+)\}/g)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)){let e=t[1].toLowerCase().trim(),n=e.includes(`/`)?e.split(`/`).pop():e;n&&r.add(n)}if(!n)return Array.from(r);let i=n.getBundledLanguages();return Array.from(r).filter(e=>e&&i[e])}var $a=`light-dark()`,eo=[`color`,`background-color`];function to(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function no(e,t){let n=Array.from(t instanceof Set?t:new Set(t)).sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=n.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);return t.length?to(e,t):e})):e}function ro(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>io(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&eo.includes(a))if(r===$a&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new Yt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');c[a]=`light-dark(${o[e][a]||`inherit`}, ${o[r][a]||`inherit`})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s;else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function io(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&_n.Italic&&(t[`font-style`]=`italic`),e.fontStyle&_n.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&_n.Underline&&n.push(`underline`),e.fontStyle&_n.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function ao(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}var oo=new WeakMap;function so(e,t){oo.set(e,t)}function co(e){return oo.get(e)}var lo=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(Ua(n).map(e=>[e,Nr])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return uo(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function uo(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function fo(e,t){if(!(e instanceof lo))throw new Yt(`Invalid grammar state`);return e.getInternalStack(t)}function po(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=function(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new Yt(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...r.indexToPos(e),offset:e}}else{let t=r.lines[e.line];if(t===void 0)throw new Yt(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${r.lines.length}`);let n=e.character;if(n<0&&(n=t.length+n),n<0||n>t.length)throw new Yt(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:r.posToIndex(e.line,n)}}},r=Za(t.source),i=(t.options.decorations||[]).map(e=>({...e,start:n(e.start),end:n(e.end)}));mo(i),e.set(t.meta,{decorations:i,converter:r,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return no(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=Array.from(e.children).filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new Yt(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=ho(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new Yt(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new Yt(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&Ya(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function mo(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new Yt(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new Yt(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function ho(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(ho).join(``):``}var go=[po()];function _o(e){let t=vo(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...go]}function vo(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var yo=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],bo={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function xo(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function So(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}else if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function Co(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)t.push({type:`resetAll`});else if(r<=9)bo[r]&&t.push({type:`setDecoration`,value:bo[r]});else if(r<=29){let e=bo[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:yo[r-30]}});else if(r===38){let n=So(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:yo[r-40]}});else if(r===48){let n=So(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:yo[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:yo[r-100+8]}})}return t}function wo(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=xo(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=Co(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var To={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function Eo(e=To){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<yo.length;e++)r.push(t(yo[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var Do={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function Oo(e,t,n){let r=Va(e,n),i=Xa(t),a=Eo(Object.fromEntries(yo.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||Do[t]]}))),o=wo();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=Ha(i,r),o=Ha(o,r),n.decorations.has(`dim`)&&(i=ko(i));let s=_n.None;return n.decorations.has(`bold`)&&(s|=_n.Bold),n.decorations.has(`italic`)&&(s|=_n.Italic),n.decorations.has(`underline`)&&(s|=_n.Underline),n.decorations.has(`strikethrough`)&&(s|=_n.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function ko(e){let t=e.match(/#([0-9a-f]{3,8})/i);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}else if(e.length===6)return`#${e}80`;else if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}else if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function Ao(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n,i=e.resolveLangAlias(n.lang||`text`);if(Ga(i)||qa(r))return Xa(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:a,colorMap:o}=e.setTheme(r);if(i===`ansi`)return Oo(a,t,n);let s=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==s.name)throw new Yt(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${s.name}"`);if(!n.grammarState.themes.includes(a.name))throw new Yt(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${a.name}"`)}return Mo(t,s,a,o,n)}function jo(...e){if(e.length===2)return co(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(Ga(i)||qa(a))throw new Yt(`Plain language does not have grammar state`);if(i===`ansi`)throw new Yt(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new lo(No(n,c,o,s,r).stateStack,c.name,o.name)}function Mo(e,t,n,r,i){let a=No(e,t,n,r,i),o=new lo(a.stateStack,t.name,n.name);return so(a.tokens,o),a.tokens}function No(e,t,n,r,i){let a=Va(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500}=i,c=Xa(e),l=i.grammarState?fo(i.grammarState,n.name)??Nr:i.grammarContextCode==null?Nr:No(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,u=[],d=[];for(let e=0,f=c.length;e<f;e++){let[f,p]=c[e];if(f===``){u=[],d.push([]);continue}if(o>0&&f.length>=o){u=[],d.push([{content:f,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;i.includeExplanation&&(m=t.tokenizeLine(f,l,s),h=m.tokens,g=0);let _=t.tokenizeLine2(f,l,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:f.length;if(t===o)continue;let s=_.tokens[2*e+1],c=Ha(r[Cn.getForeground(s)],a),l=Cn.getFontStyle(s),d={content:f.substring(t,o),offset:p+t,color:c,fontStyle:l};if(i.includeExplanation){let e=[];if(i.includeExplanation!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(/,/).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(/ /))})}d.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=f.substring(t.startIndex,t.endIndex);r+=n.length,d.explanation.push({content:n,scopes:i.includeExplanation===`scopeName`?Po(t.scopes):Fo(e,t.scopes)}),g+=1}}u.push(d)}d.push(u),u=[],l=_.ruleStack}return{tokens:d,stateStack:l}}function Po(e){return e.map(e=>({scopeName:e}))}function Fo(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:Ro(e,i,t.slice(0,r))}}return n}function Io(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function Lo(e,t,n){if(!Io(e[e.length-1],t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)Io(e[r],n[i])&&--r,--i;return r===-1}function Ro(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(Lo(e,t,n)){r.push(a);break}return r}function zo(e,t,n){let r=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),i=r.map(r=>{let i=Ao(e,t,{...n,theme:r.theme});return{tokens:i,state:co(i),theme:typeof r.theme==`string`?r.theme:r.theme.name}}),a=Bo(...i.map(e=>e.tokens)),o=a[0].map((e,t)=>e.map((e,i)=>{let o={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(o.explanation=e.explanation),a.forEach((e,n)=>{let{content:a,explanation:s,offset:c,...l}=e[t][i];o.variants[r[n].color]=l}),o})),s=i[0].state?new lo(Object.fromEntries(i.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),i[0].state.lang):void 0;return s&&so(o,s),o}function Bo(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}function Vo(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:t.color===l?1:0);if(f.length===0)throw new Yt("`themes` option must not be empty");let p=zo(e,t,n);if(c=co(p),l&&$a!==l&&!f.find(e=>e.color===l))throw new Yt(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>ro(e,h,u,l,d))),c&&so(a,c);let g=f.map(e=>Va(e.theme,n));i=Ho(f,m,g,u,l,`fg`,d),r=Ho(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=Va(n.theme,n);a=Ao(e,t,n);let l=e.getTheme(n.theme);r=Ha(l.bg,s),i=Ha(l.fg,s),o=l.name,c=co(a)}else throw new Yt("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function Ho(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=Ha(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===$a&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new Yt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Ha(t[r][a],n[r])||`inherit`}, ${Ha(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}function Uo(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>Uo(e,t,n),codeToTokens:(t,n)=>Vo(e,t,n)}){let i=t;for(let e of _o(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=Vo(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=Go(a):d===`never`&&(a=Ko(a)),f&&(a=qo(a));let p={...r,get source(){return i}};for(let e of _o(n))a=e.tokens?.call(p,a)||a;return Wo(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function Wo(e,t,n,r=co(e)){let i=_o(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(t.rootStyle==null?l.style=`background-color:${t.bg};color:${t.fg}`:l.style=t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:Ya,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
21
- `}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=ao(a.htmlStyle||io(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&so(m,r),m}function Go(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&_n.Underline||i.fontStyle&_n.Strikethrough));o&&i.content.match(/^\s+$/)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function Ko(e){return e.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;let t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function qo(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t[t.length-1],r=ao(e.htmlStyle||io(e)),i=ao(n.htmlStyle||io(n)),a=e.fontStyle&&(e.fontStyle&_n.Underline||e.fontStyle&_n.Strikethrough),o=n.fontStyle&&(n.fontStyle&_n.Underline||n.fontStyle&_n.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var Jo=Ra;function Yo(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Uo(e,t,n),codeToTokens:(t,n)=>Vo(e,t,n)},i=Jo(Uo(e,t,n,r));for(let e of _o(n))i=e.postprocess?.call(r,i,n)||i;return i}var Xo={light:`#333333`,dark:`#bbbbbb`},Zo={light:`#fffffe`,dark:`#1e1e1e`},Qo=`__shiki_resolved`;function $o(e){if(e?.[Qo])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?Xo.light:Xo.dark,n||=t.type===`light`?Zo.light:Zo.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,Qo,{enumerable:!1,writable:!1,value:!0}),t}async function es(e){return Array.from(new Set((await Promise.all(e.filter(e=>!Ka(e)).map(async e=>await Wa(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function ts(e){return(await Promise.all(e.map(async e=>Ja(e)?null:$o(await Wa(e))))).filter(e=>!!e)}var ns=3,rs=!1;function is(e,t=3){if(ns&&!(typeof ns==`number`&&t>ns)){if(rs)throw Error(`[SHIKI DEPRECATE]: ${e}`);console.trace(`[SHIKI DEPRECATE]: ${e}`)}}var as=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function os(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new as(`Circular alias \`${Array.from(n).join(` -> `)} -> ${e}\``);n.add(e)}}return e}var ss=class extends Mr{constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=$o(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=un.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=os(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=Array.from(this._langGraph.entries()),n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new as(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},cs=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},ls=0;function us(e){ls+=1,e.warnings!==!1&&ls>=10&&ls%10==0&&console.warn(`[Shiki] ${ls} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new as("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map($o),i=new ss(new cs(e.engine,n),r,n,e.langAlias),a;function o(t){return os(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new as(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new as(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await es(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await ts(e))}function g(){if(t)throw new as(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--ls)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function ds(e){e.engine||is("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([ts(e.themes||[]),es(e.langs||[]),e.engine]);return us({...e,themes:t,langs:n,engine:r})}async function fs(e){let t=await ds(e);return{getLastGrammarState:(...e)=>jo(t,...e),codeToTokensBase:(e,n)=>Ao(t,e,n),codeToTokensWithThemes:(e,n)=>zo(t,e,n),codeToTokens:(e,n)=>Vo(t,e,n),codeToHast:(e,n)=>Uo(t,e,n),codeToHtml:(e,n)=>Yo(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function ps(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(n=e.langAlias?.[n]||n,Ka(n))return[];let r=t[n];if(!r)throw new Yt(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(Ja(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new Yt(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await fs({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function ms(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}else{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function hs(e,t){let n=ms(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var gs=`modulepreload`,_s=function(e){return`/`+e},vs={},X=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=_s(t,n),t in vs)return;vs[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:gs,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},ys=[{id:`abap`,name:`ABAP`,import:(()=>X(()=>import(`./abap-cWYhO34H.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,import:(()=>X(()=>import(`./actionscript-3-B80ndJsD.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>X(()=>import(`./ada-C0C0SoYB.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>X(()=>import(`./angular-html-gcUdctE_.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>X(()=>import(`./angular-ts-BkjLgJJH.js`),__vite__mapDeps([4,0,1,2,3,5])))},{id:`apache`,name:`Apache Conf`,import:(()=>X(()=>import(`./apache-DBwBm4bB.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>X(()=>import(`./apex-FcV7UxQi.js`),[]))},{id:`apl`,name:`APL`,import:(()=>X(()=>import(`./apl-BtuEza96.js`),__vite__mapDeps([6,2,1,3,7,8,9])))},{id:`applescript`,name:`AppleScript`,import:(()=>X(()=>import(`./applescript-hQs8VNpS.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>X(()=>import(`./ara-BOadBOZg.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>X(()=>import(`./asciidoc-BsfqiBck.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>X(()=>import(`./asm-C2vUqzqz.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>X(()=>import(`./astro-DfUNgEjV.js`),__vite__mapDeps([10,2,3,7,11,12,13])))},{id:`awk`,name:`AWK`,import:(()=>X(()=>import(`./awk-D4e-eeZT.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>X(()=>import(`./ballerina-BzvFqbha.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`],import:(()=>X(()=>import(`./bat-CFyw2ERn.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>X(()=>import(`./beancount-a6Gsu5WX.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>X(()=>import(`./berry-C2jyz4Ah.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>X(()=>import(`./bibtex-Dyet-B83.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>X(()=>import(`./bicep-CghvUIvy.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>X(()=>import(`./bird2-nHigvs-R.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>X(()=>import(`./blade-uv3PNTww.js`),__vite__mapDeps([14,2,15,1,3,7,16,8,9])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>X(()=>import(`./bsl-BrHd4RA2.js`),__vite__mapDeps([17,18])))},{id:`c`,name:`C`,import:(()=>X(()=>import(`./c-DcsMh0kd.js`).then(e=>e.n),[]))},{id:`c3`,name:`C3`,import:(()=>X(()=>import(`./c3-9ZrcmAmr.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>X(()=>import(`./cadence-BPDgYNWy.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>X(()=>import(`./cairo-BDZ6TRZS.js`),__vite__mapDeps([19,20])))},{id:`clarity`,name:`Clarity`,import:(()=>X(()=>import(`./clarity-Cmao5KSK.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>X(()=>import(`./clojure-D2dPuTkk.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>X(()=>import(`./cmake-DaqQuj4A.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>X(()=>import(`./cobol-B5tSUxVN.js`),__vite__mapDeps([21,1,2,3,9])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>X(()=>import(`./codeowners-B748jmvc.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>X(()=>import(`./codeql-CXb_8gHR.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>X(()=>import(`./coffee-B2Q8w4Zu.js`),__vite__mapDeps([22,3])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>X(()=>import(`./common-lisp-UZn9nc_5.js`),[]))},{id:`coq`,name:`Coq`,import:(()=>X(()=>import(`./coq-DtO6yBIf.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>X(()=>import(`./cpp-CfzAEc1z.js`).then(e=>e.n),__vite__mapDeps([23,24,25,26,16])))},{id:`crystal`,name:`Crystal`,import:(()=>X(()=>import(`./crystal-BDxAjW7-.js`),__vite__mapDeps([27,25,2,1,3,28,16])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>X(()=>import(`./csharp-C3YlYcLV.js`),[]))},{id:`css`,name:`CSS`,import:(()=>X(()=>import(`./css-nC3_RAjk.js`).then(e=>e.n),[]))},{id:`csv`,name:`CSV`,import:(()=>X(()=>import(`./csv-BBwiVr0X.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>X(()=>import(`./cue-ScBFXY5f.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>X(()=>import(`./cypher-CGStaC1X.js`),[]))},{id:`d`,name:`D`,import:(()=>X(()=>import(`./d-CuTCIvnX.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>X(()=>import(`./dart-CqEodbm2.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>X(()=>import(`./dax-UdE5S0Dh.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>X(()=>import(`./desktop-DfmsfHJA.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>X(()=>import(`./diff-CW0RWGd9.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>X(()=>import(`./docker-B1qtW4ha.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>X(()=>import(`./dotenv-BUzOh1k8.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>X(()=>import(`./dream-maker-CBvk18nW.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>X(()=>import(`./edge-WCfPDabs.js`),__vite__mapDeps([29,15,1,2,3,13])))},{id:`elixir`,name:`Elixir`,import:(()=>X(()=>import(`./elixir-CazmTZo9.js`),__vite__mapDeps([30,1,2,3])))},{id:`elm`,name:`Elm`,import:(()=>X(()=>import(`./elm-CTqaOirp.js`),__vite__mapDeps([31,24,25])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>X(()=>import(`./emacs-lisp-DvSgLhDc.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>X(()=>import(`./erb-CK9x36t2.js`),__vite__mapDeps([32,1,2,3,33,25,23,24,26,16,34,35,12,13,36,37,28,8,9,38])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>X(()=>import(`./erlang-cuhwpmsu.js`),__vite__mapDeps([39,40])))},{id:`fennel`,name:`Fennel`,import:(()=>X(()=>import(`./fennel-C-1kWlGf.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>X(()=>import(`./fish-CCpdtwqS.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>X(()=>import(`./fluent-BLg032oD.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>X(()=>import(`./fortran-fixed-form-DWr0EnJn.js`),__vite__mapDeps([41,42])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>X(()=>import(`./fortran-free-form-Br4jRtSc.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>X(()=>import(`./fsharp-CQ5iYSPA.js`),__vite__mapDeps([43,40])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>X(()=>import(`./gdresource-CN-lsNu5.js`),__vite__mapDeps([44,45,46])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>X(()=>import(`./gdscript-hSAZM1eh.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>X(()=>import(`./gdshader-D4XNAEs9.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>X(()=>import(`./genie-DmN-ICAN.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>X(()=>import(`./gherkin-cuHHmRcX.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>X(()=>import(`./git-commit-6e79eN7Q.js`),__vite__mapDeps([47,48])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>X(()=>import(`./git-rebase-Bn8xQDxV.js`),__vite__mapDeps([49,28])))},{id:`gleam`,name:`Gleam`,import:(()=>X(()=>import(`./gleam-D8VhqPDN.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>X(()=>import(`./glimmer-js-h7wFfOLo.js`),__vite__mapDeps([50,2,1,3,13])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>X(()=>import(`./glimmer-ts-vlZuiamP.js`),__vite__mapDeps([51,2,1,3,13])))},{id:`glsl`,name:`GLSL`,import:(()=>X(()=>import(`./glsl-CNutENPV.js`).then(e=>e.n),__vite__mapDeps([24,25])))},{id:`gn`,name:`GN`,import:(()=>X(()=>import(`./gn-BjGRlX27.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>X(()=>import(`./gnuplot-BZCXuE4q.js`),[]))},{id:`go`,name:`Go`,import:(()=>X(()=>import(`./go-BJpWXZEs.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>X(()=>import(`./graphql-BfddKr9j.js`).then(e=>e.n),__vite__mapDeps([34,3,35,12,13])))},{id:`groovy`,name:`Groovy`,import:(()=>X(()=>import(`./groovy-D9w3Dn-z.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>X(()=>import(`./hack-BkYH75Gx.js`),__vite__mapDeps([52,1,2,3,16])))},{id:`haml`,name:`Ruby Haml`,import:(()=>X(()=>import(`./haml-CM-xW5RI.js`).then(e=>e.n),__vite__mapDeps([36,2,3])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>X(()=>import(`./handlebars-CklcCbzf.js`),__vite__mapDeps([53,2,1,3,38])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>X(()=>import(`./haskell-DqDdKEgk.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>X(()=>import(`./haxe-DMg0jS3a.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>X(()=>import(`./hcl-SZIZUK_X.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>X(()=>import(`./hjson-DF1VspiE.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>X(()=>import(`./hlsl-DPe9L0Dt.js`),[]))},{id:`html`,name:`HTML`,import:(()=>X(()=>import(`./html-bltTcC3c.js`).then(e=>e.n),__vite__mapDeps([1,2,3])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>X(()=>import(`./html-derivative-C4R1a7Nf.js`),__vite__mapDeps([15,1,2,3])))},{id:`http`,name:`HTTP`,import:(()=>X(()=>import(`./http-B6uXoDkp.js`),__vite__mapDeps([54,34,3,35,12,13,7,28,8,9])))},{id:`hurl`,name:`Hurl`,import:(()=>X(()=>import(`./hurl-gquKVFPU.js`),__vite__mapDeps([55,56,34,3,35,12,13,8,9])))},{id:`hxml`,name:`HXML`,import:(()=>X(()=>import(`./hxml-nwJci6H5.js`),__vite__mapDeps([57,58])))},{id:`hy`,name:`Hy`,import:(()=>X(()=>import(`./hy-B0f-B1mH.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>X(()=>import(`./imba-Bq3j1cW5.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>X(()=>import(`./ini-BayloP2U.js`),[]))},{id:`java`,name:`Java`,import:(()=>X(()=>import(`./java-DZLUJ7qo.js`).then(e=>e.n),[]))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>X(()=>import(`./javascript-CayXc7uP.js`).then(e=>e.n),[]))},{id:`jinja`,name:`Jinja`,import:(()=>X(()=>import(`./jinja-CQQUTC0y.js`),__vite__mapDeps([59,1,2,3])))},{id:`jison`,name:`Jison`,import:(()=>X(()=>import(`./jison-CvzuCn2x.js`),__vite__mapDeps([60,3])))},{id:`json`,name:`JSON`,import:(()=>X(()=>import(`./json-BsMA0GaP.js`).then(e=>e.n),[]))},{id:`json5`,name:`JSON5`,import:(()=>X(()=>import(`./json5-CRSfdIrY.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>X(()=>import(`./jsonc-y4g9DQPx.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>X(()=>import(`./jsonl-D2paVn9r.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>X(()=>import(`./jsonnet-CLH27mtz.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>X(()=>import(`./jssm-CPPYaqX-.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>X(()=>import(`./jsx-Dbxr4aPH.js`).then(e=>e.n),[]))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>X(()=>import(`./julia-CZ38GzHV.js`),__vite__mapDeps([61,23,24,25,26,16,3,20,62])))},{id:`just`,name:`Just`,import:(()=>X(()=>import(`./just-BQwFLV1D.js`),__vite__mapDeps([63,3,64,2,1,16,8,9,20,33,25,23,24,26,34,35,12,13,36,37,28,38])))},{id:`kdl`,name:`KDL`,import:(()=>X(()=>import(`./kdl-D1BQjjnw.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>X(()=>import(`./kotlin-ndCaDnf0.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>X(()=>import(`./kusto-D-4nbkD3.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>X(()=>import(`./latex-BGyrMdgQ.js`),__vite__mapDeps([65,66,62])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>X(()=>import(`./lean-YmtAsB0p.js`),[]))},{id:`less`,name:`Less`,import:(()=>X(()=>import(`./less-DyHub3ow.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>X(()=>import(`./liquid-CiA2vjOH.js`),__vite__mapDeps([67,2,1,3,7])))},{id:`llvm`,name:`LLVM IR`,import:(()=>X(()=>import(`./llvm-DCcqrY0D.js`),[]))},{id:`log`,name:`Log file`,import:(()=>X(()=>import(`./log-DWAAMNbe.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>X(()=>import(`./logo-ClQMGkNL.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>X(()=>import(`./lua-D9k3fxwM.js`).then(e=>e.n),__vite__mapDeps([37,25])))},{id:`luau`,name:`Luau`,import:(()=>X(()=>import(`./luau-CmcXFvLt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>X(()=>import(`./make-DcfJyUzm.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>X(()=>import(`./markdown-DXxotAxn.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>X(()=>import(`./marko-CwBH4-2T.js`),__vite__mapDeps([68,2,69,5,13])))},{id:`matlab`,name:`MATLAB`,import:(()=>X(()=>import(`./matlab-BlfbTznR.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>X(()=>import(`./mdc-D4WuuVvw.js`),__vite__mapDeps([70,15,1,2,3,40,38])))},{id:`mdx`,name:`MDX`,import:(()=>X(()=>import(`./mdx-H8fyPQd8.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>X(()=>import(`./mermaid-CWAV2dmV.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>X(()=>import(`./mipsasm-BWYFAm2s.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>X(()=>import(`./mojo-DZcPJEIN.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>X(()=>import(`./moonbit-6eslNlJL.js`),[]))},{id:`move`,name:`Move`,import:(()=>X(()=>import(`./move-DxFc9-QU.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>X(()=>import(`./narrat-gv38dJOT.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>X(()=>import(`./nextflow-DSfydIxt.js`),__vite__mapDeps([71,72])))},{id:`nextflow-groovy`,name:`nextflow-groovy`,import:(()=>X(()=>import(`./nextflow-groovy-DV4H3hok.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>X(()=>import(`./nginx-DHMa03ia.js`),__vite__mapDeps([73,37,25])))},{id:`nim`,name:`Nim`,import:(()=>X(()=>import(`./nim-8gK3mQXD.js`),__vite__mapDeps([74,25,2,24,1,3,40,8,9])))},{id:`nix`,name:`Nix`,import:(()=>X(()=>import(`./nix-NlOz3HGM.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>X(()=>import(`./nushell-D86Z8aFF.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>X(()=>import(`./objective-c-iuJvUjCv.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>X(()=>import(`./objective-cpp-C62JvfMT.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>X(()=>import(`./ocaml-Rbryo9lg.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>X(()=>import(`./odin-CfaOVNP_.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>X(()=>import(`./openscad-DCRhgheK.js`),[]))},{id:`pascal`,name:`Pascal`,import:(()=>X(()=>import(`./pascal-CTesTHtV.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>X(()=>import(`./perl-DqXBmOB_.js`),__vite__mapDeps([64,2,1,3,16,8,9])))},{id:`php`,name:`PHP`,import:(()=>X(()=>import(`./php-CruAnpl2.js`),__vite__mapDeps([75,2,1,3,7,16,8,9])))},{id:`pkl`,name:`Pkl`,import:(()=>X(()=>import(`./pkl-BjUMjQkt.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>X(()=>import(`./plsql-BgKEZSSo.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>X(()=>import(`./po-C5s_CVt8.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>X(()=>import(`./polar-y4hX8qM0.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>X(()=>import(`./postcss-BHCm7Qae.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>X(()=>import(`./powerquery-C2vMt8aZ.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`],import:(()=>X(()=>import(`./powershell-DEcjmg1c.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>X(()=>import(`./prisma-Ba-Tcxy5.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>X(()=>import(`./prolog-B4o261Jv.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>X(()=>import(`./proto-o3IZKiMR.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>X(()=>import(`./pug-C7a5y4Mi.js`),__vite__mapDeps([76,2,1,3])))},{id:`puppet`,name:`Puppet`,import:(()=>X(()=>import(`./puppet-BC0dqZ31.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>X(()=>import(`./purescript-CLDw1y5G.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>X(()=>import(`./python-D1NFioGW.js`),[]))},{id:`qml`,name:`QML`,import:(()=>X(()=>import(`./qml-mgWY__NW.js`),__vite__mapDeps([77,3])))},{id:`qmldir`,name:`QML Directory`,import:(()=>X(()=>import(`./qmldir-B7i9e9Vn.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>X(()=>import(`./qss-DIe6oKX8.js`),[]))},{id:`r`,name:`R`,import:(()=>X(()=>import(`./r-Do5QoKdS.js`).then(e=>e.n),[]))},{id:`racket`,name:`Racket`,import:(()=>X(()=>import(`./racket-CAOC_yyk.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>X(()=>import(`./raku-Ccua3vW6.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>X(()=>import(`./razor-BqdDbm9d.js`),__vite__mapDeps([78,79,1,2,3])))},{id:`reg`,name:`Windows Registry Script`,import:(()=>X(()=>import(`./reg-CAYZT9kE.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>X(()=>import(`./regexp-CNMlPqVr.js`).then(e=>e.n),[]))},{id:`rel`,name:`Rel`,import:(()=>X(()=>import(`./rel-cvB6F5nO.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>X(()=>import(`./riscv-SYGtE4EN.js`),[]))},{id:`ron`,name:`RON`,import:(()=>X(()=>import(`./ron-CRt869SB.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>X(()=>import(`./rosmsg-BwrfJ66Z.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>X(()=>import(`./rst-PYCtADQ2.js`),__vite__mapDeps([80,81,23,24,25,26,16,15,1,2,3,20,33,34,35,12,13,36,37,28,8,9,38])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>X(()=>import(`./ruby-B8JdoeHE.js`),__vite__mapDeps([33,25,23,24,26,16,2,34,3,35,12,13,36,1,37,28,8,9,38])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>X(()=>import(`./rust-DCKTTPxN.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>X(()=>import(`./sas-kIev4j3d.js`),__vite__mapDeps([82,16])))},{id:`sass`,name:`Sass`,import:(()=>X(()=>import(`./sass-CorcwySt.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>X(()=>import(`./scala-DlI-OmYj.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>X(()=>import(`./scheme-CcNEGkZH.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>X(()=>import(`./scss-cf-rl7q3.js`).then(e=>e.n),__vite__mapDeps([5,2])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>X(()=>import(`./sdbl-AL_m-RO_.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>X(()=>import(`./shaderlab-CbbQwRPF.js`),__vite__mapDeps([83,84])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>X(()=>import(`./shellscript-BHMFbkaV.js`).then(e=>e.n),[]))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>X(()=>import(`./shellsession-y_3kBnoK.js`),__vite__mapDeps([85,28])))},{id:`smalltalk`,name:`Smalltalk`,import:(()=>X(()=>import(`./smalltalk-Y2ogrfbk.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>X(()=>import(`./solidity-Bfbm9QZQ.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>X(()=>import(`./soy-Coc7dfRW.js`),__vite__mapDeps([86,1,2,3])))},{id:`sparql`,name:`SPARQL`,import:(()=>X(()=>import(`./sparql-DEoxFJ5d.js`),__vite__mapDeps([87,88])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>X(()=>import(`./splunk-6DJA2XFa.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>X(()=>import(`./sql-CsZYO19m.js`).then(e=>e.n),[]))},{id:`ssh-config`,name:`SSH Config`,import:(()=>X(()=>import(`./ssh-config-CbQtdF-u.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>X(()=>import(`./stata-BFa4m_Eh.js`),__vite__mapDeps([89,16])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>X(()=>import(`./stylus-B_iq45Sj.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>X(()=>import(`./surrealql-DlwfRFnC.js`),__vite__mapDeps([90,3])))},{id:`svelte`,name:`Svelte`,import:(()=>X(()=>import(`./svelte-RrLklQOZ.js`),__vite__mapDeps([91,2,3,11,13])))},{id:`swift`,name:`Swift`,import:(()=>X(()=>import(`./swift-C7KIgN-p.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>X(()=>import(`./system-verilog-C3G9wERd.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>X(()=>import(`./systemd-CwxGrojj.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>X(()=>import(`./talonscript-DqnSo1EO.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>X(()=>import(`./tasl-T8ethp86.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>X(()=>import(`./tcl-Ccl366o0.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>X(()=>import(`./templ-BDbBg7z2.js`),__vite__mapDeps([92,2,93,3])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>X(()=>import(`./terraform-BBf6ZI_0.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>X(()=>import(`./tex-BeAp-Hqv.js`),__vite__mapDeps([66,62])))},{id:`toml`,name:`TOML`,import:(()=>X(()=>import(`./toml-C5Z_BR4r.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>X(()=>import(`./ts-tags-Dz-1CFmn.js`),__vite__mapDeps([94,2,24,25,1,3,16,13,8,9])))},{id:`tsv`,name:`TSV`,import:(()=>X(()=>import(`./tsv-rX8sUJs7.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>X(()=>import(`./tsx-Dfi08w8H.js`).then(e=>e.n),[]))},{id:`turtle`,name:`Turtle`,import:(()=>X(()=>import(`./turtle-BM-MG8WY.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>X(()=>import(`./twig-BfzYY6Hd.js`),__vite__mapDeps([95,2,3,75,1,7,16,8,9,20,33,25,23,24,26,34,35,12,13,36,37,28,38,5])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>X(()=>import(`./typescript-6FNAPG3Z.js`).then(e=>e.n),[]))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>X(()=>import(`./typespec-C5gKydvR.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>X(()=>import(`./typst--_5VchrY.js`),[]))},{id:`v`,name:`V`,import:(()=>X(()=>import(`./v-C6PwpmTC.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>X(()=>import(`./vala-4pTaceSj.js`),[]))},{id:`vb`,name:`Visual Basic`,aliases:[`cmd`],import:(()=>X(()=>import(`./vb-DhoR5A6S.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>X(()=>import(`./verilog-B9f_1lPn.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>X(()=>import(`./vhdl-Cy4RAmOe.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>X(()=>import(`./viml-CFQW-CcD.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>X(()=>import(`./vue-DTPedjqE.js`),__vite__mapDeps([96,2,15,1,3,7,13])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>X(()=>import(`./vue-html-B4sC29Oj.js`),__vite__mapDeps([97,3])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>X(()=>import(`./vue-vine-BWzpqJ4r.js`),__vite__mapDeps([98,2,3,69,11,5,99])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>X(()=>import(`./vyper-BW5zj9bE.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>X(()=>import(`./wasm-BigxSLnm.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>X(()=>import(`./wenyan-BZzM1SQT.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>X(()=>import(`./wgsl-xBPHbLlq.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>X(()=>import(`./wikitext-BXJWUNJK.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>X(()=>import(`./wit-2GnUs67P.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>X(()=>import(`./wolfram-DIFDmw-g.js`),[]))},{id:`xml`,name:`XML`,import:(()=>X(()=>import(`./xml-BK8ACjht.js`).then(e=>e.n),__vite__mapDeps([8,9])))},{id:`xsl`,name:`XSL`,import:(()=>X(()=>import(`./xsl-rjlrbfou.js`),__vite__mapDeps([100,8,9])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>X(()=>import(`./yaml-DM6lgMhS.js`).then(e=>e.n),[]))},{id:`zenscript`,name:`ZenScript`,import:(()=>X(()=>import(`./zenscript-DQaUUjbx.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>X(()=>import(`./zig-BDepRvBi.js`),[]))}],bs=Object.fromEntries(ys.map(e=>[e.id,e.import])),xs=Object.fromEntries(ys.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),Ss={...bs,...xs},Cs=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>X(()=>import(`./andromeeda-Ch2kWS7s.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>X(()=>import(`./aurora-x-BHLqzt7j.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>X(()=>import(`./ayu-dark-DCotN_ZT.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>X(()=>import(`./ayu-light-CKB6o_im.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>X(()=>import(`./ayu-mirage-B38lW-C5.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>X(()=>import(`./catppuccin-frappe-BY_2ofjk.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>X(()=>import(`./catppuccin-latte-D6GXPBmA.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>X(()=>import(`./catppuccin-macchiato-BuW8_cyo.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>X(()=>import(`./catppuccin-mocha-znex9DPe.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>X(()=>import(`./dark-plus-BvePH-r3.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>X(()=>import(`./dracula-kJQjC_Gy.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>X(()=>import(`./dracula-soft-B3XhEjCl.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>X(()=>import(`./everforest-dark-u0zLn75q.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>X(()=>import(`./everforest-light-D3syIoAR.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>X(()=>import(`./github-dark-CEBLh0--.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>X(()=>import(`./github-dark-default-Dq0Z4Xai.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>X(()=>import(`./github-dark-dimmed-D90YmS4w.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>X(()=>import(`./github-dark-high-contrast-B6BWv1iC.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>X(()=>import(`./github-light-lXSVSq5T.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>X(()=>import(`./github-light-default-DsPWmj4v.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>X(()=>import(`./github-light-high-contrast-C7aLb3kp.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>X(()=>import(`./gruvbox-dark-hard-_deksD0U.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>X(()=>import(`./gruvbox-dark-medium-CT31284j.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>X(()=>import(`./gruvbox-dark-soft-BZuEUCbj.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>X(()=>import(`./gruvbox-light-hard-dxv4n_ZS.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>X(()=>import(`./gruvbox-light-medium-BsW_fVfR.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>X(()=>import(`./gruvbox-light-soft-BiGy99gD.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>X(()=>import(`./horizon-Ngud75Kn.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`dark`,import:(()=>X(()=>import(`./horizon-bright-Cnljd0XD.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>X(()=>import(`./houston-BenZxlMr.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>X(()=>import(`./kanagawa-dragon-Bt5mhLu1.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>X(()=>import(`./kanagawa-lotus-FGA3pRJk.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>X(()=>import(`./kanagawa-wave-DnLVZPAD.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>X(()=>import(`./laserwave-D2qAZkaG.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>X(()=>import(`./light-plus-CP13QUvm.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>X(()=>import(`./material-theme-JFoPTBSr.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>X(()=>import(`./material-theme-darker-BHaqZ19v.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>X(()=>import(`./material-theme-lighter-CGnnS2bs.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>X(()=>import(`./material-theme-ocean-Drhewjqf.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>X(()=>import(`./material-theme-palenight-DbUypmpb.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>X(()=>import(`./min-dark-BEelvXUB.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>X(()=>import(`./min-light-CTPBOACR.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>X(()=>import(`./monokai-DQlZXbkg.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>X(()=>import(`./night-owl-BLcrYhaC.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>X(()=>import(`./night-owl-light-BG-tBJOz.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>X(()=>import(`./nord-Dm2F5_QB.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>X(()=>import(`./one-dark-pro-DC9SHdX0.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>X(()=>import(`./one-light-Doo39p0H.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>X(()=>import(`./plastic-B3CcSpon.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>X(()=>import(`./poimandres-BsK70ma5.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>X(()=>import(`./red-DtDH206x.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>X(()=>import(`./rose-pine-CjBfSJ5b.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>X(()=>import(`./rose-pine-dawn-C0xwy7iJ.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>X(()=>import(`./rose-pine-moon-BSNy9Ty0.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>X(()=>import(`./slack-dark-rMhrfPm6.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>X(()=>import(`./slack-ochin-9w8X74hU.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>X(()=>import(`./snazzy-light-DHr9ygpP.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>X(()=>import(`./solarized-dark-UPcKev9Q.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>X(()=>import(`./solarized-light-DUsjROvl.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>X(()=>import(`./synthwave-84-lf_Wt0K_.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>X(()=>import(`./tokyo-night-BF5ata25.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>X(()=>import(`./vesper-CmBi_iCT.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>X(()=>import(`./vitesse-black-CE8RoBJP.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>X(()=>import(`./vitesse-dark-BpF142p_.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>X(()=>import(`./vitesse-light-CMwxPBrg.js`),[]))}].map(e=>[e.id,e.import])),ws=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Ts(){return 2147483648}function Es(){return typeof performance<`u`?performance.now():Date.now()}var Ds=(e,t)=>e+(t-e%t)%t;async function Os(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=Ts();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,Ds(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:Es,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var ks=Object.defineProperty,As=(e,t,n)=>t in e?ks(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,js=(e,t,n)=>As(e,typeof t==`symbol`?t:t+``,n),Ms=null;function Ns(e){throw new ws(e.UTF8ToString(e.getLastOnigError()))}var Ps=class e{constructor(t){js(this,`utf16Length`),js(this,`utf8Length`),js(this,`utf16Value`),js(this,`utf8Value`),js(this,`utf16OffsetToUtf8`),js(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}a<=127?t+=1:a<=2047?t+=2:a<=65535?t+=3:t+=4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},Fs=class e{constructor(t){if(js(this,`id`,++e.LAST_ID),js(this,`_onigBinding`),js(this,`content`),js(this,`utf16Length`),js(this,`utf8Length`),js(this,`utf16OffsetToUtf8`),js(this,`utf8OffsetToUtf16`),js(this,`ptr`),!Ms)throw new ws(`Must invoke loadWasm first.`);this._onigBinding=Ms,this.content=t;let n=new Ps(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=Ms.omalloc(1e4),e._sharedPtrInUse=!0,Ms.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(Ms)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};js(Fs,`LAST_ID`,0),js(Fs,`_sharedPtr`,0),js(Fs,`_sharedPtrInUse`,!1);var Is=Fs,Ls=class{constructor(e){if(js(this,`_onigBinding`),js(this,`_ptr`),!Ms)throw new ws(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new Ps(e[r]);t[r]=i.createString(Ms),n[r]=i.utf8Length}let r=Ms.omalloc(4*e.length);Ms.HEAPU32.set(t,r/4);let i=Ms.omalloc(4*e.length);Ms.HEAPU32.set(n,i/4);let a=Ms.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)Ms.ofree(t[n]);Ms.ofree(i),Ms.ofree(r),a===0&&Ns(Ms),this._onigBinding=Ms,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new Is(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function Rs(e){return typeof e.instantiator==`function`}function zs(e){return typeof e.default==`function`}function Bs(e){return e.data!==void 0}function Vs(e){return typeof Response<`u`&&e instanceof Response}function Hs(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var Us;function Ws(e){if(Us)return Us;async function t(){Ms=await Os(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Rs(n)?n=await n.instantiator(t):zs(n)?n=await n.default(t):(Bs(n)&&(n=n.data),Vs(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Ks(n)(t):await qs(n)(t):Hs(n)||n instanceof WebAssembly.Module?n=await Gs(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Gs(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Us=t(),Us}function Gs(e){return t=>WebAssembly.instantiate(e,t)}function Ks(e){return t=>WebAssembly.instantiateStreaming(e,t)}function qs(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function Js(e){return e&&await Ws(e),{createScanner(e){return new Ls(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new Is(e)}}}var Ys=ps({langs:Ss,themes:Cs,engine:()=>Js(X(()=>import(`./wasm-CSccDuAq.js`),[]))}),{codeToHtml:Xs,codeToHast:Zs,codeToTokens:Qs,codeToTokensBase:$s,codeToTokensWithThemes:ec,getSingletonHighlighter:tc,getLastGrammarState:nc}=hs(Ys,{guessEmbeddedLanguages:Qa});function rc(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function ic(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var ac=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),oc=String.raw;function sc(e,t){if(e==null)throw Error(t??`Value expected`);return e}var cc=oc`\[\^?`,lc=`c.? | C(?:-.?)?|${oc`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${oc`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${oc`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${oc`o\{[^\}]*\}?`}|${oc`\d{1,3}`}`,uc=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,dc=new RegExp(oc`
21
+ `}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=ao(a.htmlStyle||io(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&so(m,r),m}function Go(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&_n.Underline||i.fontStyle&_n.Strikethrough));o&&i.content.match(/^\s+$/)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function Ko(e){return e.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;let t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function qo(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t[t.length-1],r=ao(e.htmlStyle||io(e)),i=ao(n.htmlStyle||io(n)),a=e.fontStyle&&(e.fontStyle&_n.Underline||e.fontStyle&_n.Strikethrough),o=n.fontStyle&&(n.fontStyle&_n.Underline||n.fontStyle&_n.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var Jo=Ra;function Yo(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Uo(e,t,n),codeToTokens:(t,n)=>Vo(e,t,n)},i=Jo(Uo(e,t,n,r));for(let e of _o(n))i=e.postprocess?.call(r,i,n)||i;return i}var Xo={light:`#333333`,dark:`#bbbbbb`},Zo={light:`#fffffe`,dark:`#1e1e1e`},Qo=`__shiki_resolved`;function $o(e){if(e?.[Qo])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?Xo.light:Xo.dark,n||=t.type===`light`?Zo.light:Zo.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,Qo,{enumerable:!1,writable:!1,value:!0}),t}async function es(e){return Array.from(new Set((await Promise.all(e.filter(e=>!Ka(e)).map(async e=>await Wa(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function ts(e){return(await Promise.all(e.map(async e=>Ja(e)?null:$o(await Wa(e))))).filter(e=>!!e)}var ns=3,rs=!1;function is(e,t=3){if(ns&&!(typeof ns==`number`&&t>ns)){if(rs)throw Error(`[SHIKI DEPRECATE]: ${e}`);console.trace(`[SHIKI DEPRECATE]: ${e}`)}}var as=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function os(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new as(`Circular alias \`${Array.from(n).join(` -> `)} -> ${e}\``);n.add(e)}}return e}var ss=class extends Mr{constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=$o(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=un.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=os(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=Array.from(this._langGraph.entries()),n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new as(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},cs=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},ls=0;function us(e){ls+=1,e.warnings!==!1&&ls>=10&&ls%10==0&&console.warn(`[Shiki] ${ls} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new as("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map($o),i=new ss(new cs(e.engine,n),r,n,e.langAlias),a;function o(t){return os(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new as(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new as(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await es(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await ts(e))}function g(){if(t)throw new as(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--ls)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function ds(e){e.engine||is("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([ts(e.themes||[]),es(e.langs||[]),e.engine]);return us({...e,themes:t,langs:n,engine:r})}async function fs(e){let t=await ds(e);return{getLastGrammarState:(...e)=>jo(t,...e),codeToTokensBase:(e,n)=>Ao(t,e,n),codeToTokensWithThemes:(e,n)=>zo(t,e,n),codeToTokens:(e,n)=>Vo(t,e,n),codeToHast:(e,n)=>Uo(t,e,n),codeToHtml:(e,n)=>Yo(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function ps(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(n=e.langAlias?.[n]||n,Ka(n))return[];let r=t[n];if(!r)throw new Yt(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(Ja(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new Yt(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await fs({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function ms(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}else{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function hs(e,t){let n=ms(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var gs=`modulepreload`,_s=function(e){return`/`+e},vs={},X=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=_s(t,n),t in vs)return;vs[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:gs,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},ys=[{id:`abap`,name:`ABAP`,import:(()=>X(()=>import(`./abap-cWYhO34H.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,import:(()=>X(()=>import(`./actionscript-3-B80ndJsD.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>X(()=>import(`./ada-C0C0SoYB.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>X(()=>import(`./angular-html-CjzmejZ2.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>X(()=>import(`./angular-ts-DhODVdiO.js`),__vite__mapDeps([4,0,1,2,3,5])))},{id:`apache`,name:`Apache Conf`,import:(()=>X(()=>import(`./apache-DBwBm4bB.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>X(()=>import(`./apex-FcV7UxQi.js`),[]))},{id:`apl`,name:`APL`,import:(()=>X(()=>import(`./apl-KYCqHKQc.js`),__vite__mapDeps([6,2,1,3,7,8,9])))},{id:`applescript`,name:`AppleScript`,import:(()=>X(()=>import(`./applescript-hQs8VNpS.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>X(()=>import(`./ara-BOadBOZg.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>X(()=>import(`./asciidoc-BsfqiBck.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>X(()=>import(`./asm-C2vUqzqz.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>X(()=>import(`./astro-DDY2SFEm.js`),__vite__mapDeps([10,2,3,7,11,12,13])))},{id:`awk`,name:`AWK`,import:(()=>X(()=>import(`./awk-D4e-eeZT.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>X(()=>import(`./ballerina-BzvFqbha.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`],import:(()=>X(()=>import(`./bat-CFyw2ERn.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>X(()=>import(`./beancount-a6Gsu5WX.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>X(()=>import(`./berry-C2jyz4Ah.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>X(()=>import(`./bibtex-Dyet-B83.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>X(()=>import(`./bicep-CghvUIvy.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>X(()=>import(`./bird2-nHigvs-R.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>X(()=>import(`./blade-B9Mved2V.js`),__vite__mapDeps([14,2,15,1,3,7,16,8,9])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>X(()=>import(`./bsl-BrHd4RA2.js`),__vite__mapDeps([17,18])))},{id:`c`,name:`C`,import:(()=>X(()=>import(`./c-BU4c8hQj.js`).then(e=>e.n),[]))},{id:`c3`,name:`C3`,import:(()=>X(()=>import(`./c3-9ZrcmAmr.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>X(()=>import(`./cadence-BPDgYNWy.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>X(()=>import(`./cairo-BDZ6TRZS.js`),__vite__mapDeps([19,20])))},{id:`clarity`,name:`Clarity`,import:(()=>X(()=>import(`./clarity-Cmao5KSK.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>X(()=>import(`./clojure-D2dPuTkk.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>X(()=>import(`./cmake-DaqQuj4A.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>X(()=>import(`./cobol-BRTNaQEL.js`),__vite__mapDeps([21,1,2,3,9])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>X(()=>import(`./codeowners-B748jmvc.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>X(()=>import(`./codeql-CXb_8gHR.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>X(()=>import(`./coffee-BklNhfGV.js`),__vite__mapDeps([22,3])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>X(()=>import(`./common-lisp-UZn9nc_5.js`),[]))},{id:`coq`,name:`Coq`,import:(()=>X(()=>import(`./coq-DtO6yBIf.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>X(()=>import(`./cpp-BKMsxxTF.js`).then(e=>e.n),__vite__mapDeps([23,24,25,26,16])))},{id:`crystal`,name:`Crystal`,import:(()=>X(()=>import(`./crystal-CsarWpvB.js`),__vite__mapDeps([27,25,2,1,3,28,16])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>X(()=>import(`./csharp-C3YlYcLV.js`),[]))},{id:`css`,name:`CSS`,import:(()=>X(()=>import(`./css-Dv67WWLO.js`).then(e=>e.n),[]))},{id:`csv`,name:`CSV`,import:(()=>X(()=>import(`./csv-BBwiVr0X.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>X(()=>import(`./cue-ScBFXY5f.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>X(()=>import(`./cypher-CGStaC1X.js`),[]))},{id:`d`,name:`D`,import:(()=>X(()=>import(`./d-CuTCIvnX.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>X(()=>import(`./dart-CqEodbm2.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>X(()=>import(`./dax-UdE5S0Dh.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>X(()=>import(`./desktop-DfmsfHJA.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>X(()=>import(`./diff-CW0RWGd9.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>X(()=>import(`./docker-B1qtW4ha.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>X(()=>import(`./dotenv-BUzOh1k8.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>X(()=>import(`./dream-maker-CBvk18nW.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>X(()=>import(`./edge-B4WfWboP.js`),__vite__mapDeps([29,15,1,2,3,13])))},{id:`elixir`,name:`Elixir`,import:(()=>X(()=>import(`./elixir-BldSdPyz.js`),__vite__mapDeps([30,1,2,3])))},{id:`elm`,name:`Elm`,import:(()=>X(()=>import(`./elm-Baz9wiad.js`),__vite__mapDeps([31,24,25])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>X(()=>import(`./emacs-lisp-DvSgLhDc.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>X(()=>import(`./erb-_hp6QFA9.js`),__vite__mapDeps([32,1,2,3,33,25,23,24,26,16,34,35,12,13,36,37,28,8,9,38])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>X(()=>import(`./erlang-cuhwpmsu.js`),__vite__mapDeps([39,40])))},{id:`fennel`,name:`Fennel`,import:(()=>X(()=>import(`./fennel-C-1kWlGf.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>X(()=>import(`./fish-CCpdtwqS.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>X(()=>import(`./fluent-BLg032oD.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>X(()=>import(`./fortran-fixed-form-DWr0EnJn.js`),__vite__mapDeps([41,42])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>X(()=>import(`./fortran-free-form-Br4jRtSc.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>X(()=>import(`./fsharp-CQ5iYSPA.js`),__vite__mapDeps([43,40])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>X(()=>import(`./gdresource-CN-lsNu5.js`),__vite__mapDeps([44,45,46])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>X(()=>import(`./gdscript-hSAZM1eh.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>X(()=>import(`./gdshader-D4XNAEs9.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>X(()=>import(`./genie-DmN-ICAN.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>X(()=>import(`./gherkin-cuHHmRcX.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>X(()=>import(`./git-commit-6e79eN7Q.js`),__vite__mapDeps([47,48])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>X(()=>import(`./git-rebase-CVUn24-q.js`),__vite__mapDeps([49,28])))},{id:`gleam`,name:`Gleam`,import:(()=>X(()=>import(`./gleam-D8VhqPDN.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>X(()=>import(`./glimmer-js-DzJxhDKm.js`),__vite__mapDeps([50,2,1,3,13])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>X(()=>import(`./glimmer-ts-C6Y0EC83.js`),__vite__mapDeps([51,2,1,3,13])))},{id:`glsl`,name:`GLSL`,import:(()=>X(()=>import(`./glsl-CEgGa7dW.js`).then(e=>e.n),__vite__mapDeps([24,25])))},{id:`gn`,name:`GN`,import:(()=>X(()=>import(`./gn-BjGRlX27.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>X(()=>import(`./gnuplot-BZCXuE4q.js`),[]))},{id:`go`,name:`Go`,import:(()=>X(()=>import(`./go-BJpWXZEs.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>X(()=>import(`./graphql-OMSQo6QZ.js`).then(e=>e.n),__vite__mapDeps([34,3,35,12,13])))},{id:`groovy`,name:`Groovy`,import:(()=>X(()=>import(`./groovy-D9w3Dn-z.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>X(()=>import(`./hack-DeuNiRTG.js`),__vite__mapDeps([52,1,2,3,16])))},{id:`haml`,name:`Ruby Haml`,import:(()=>X(()=>import(`./haml-MTFzbqPZ.js`).then(e=>e.n),__vite__mapDeps([36,2,3])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>X(()=>import(`./handlebars-aV-3jqy-.js`),__vite__mapDeps([53,2,1,3,38])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>X(()=>import(`./haskell-DqDdKEgk.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>X(()=>import(`./haxe-DMg0jS3a.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>X(()=>import(`./hcl-SZIZUK_X.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>X(()=>import(`./hjson-DF1VspiE.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>X(()=>import(`./hlsl-DPe9L0Dt.js`),[]))},{id:`html`,name:`HTML`,import:(()=>X(()=>import(`./html-Dk7NFvoe.js`).then(e=>e.n),__vite__mapDeps([1,2,3])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>X(()=>import(`./html-derivative-Dj5eILVA.js`),__vite__mapDeps([15,1,2,3])))},{id:`http`,name:`HTTP`,import:(()=>X(()=>import(`./http-CrTYPxrq.js`),__vite__mapDeps([54,34,3,35,12,13,7,28,8,9])))},{id:`hurl`,name:`Hurl`,import:(()=>X(()=>import(`./hurl-67mqykeb.js`),__vite__mapDeps([55,56,34,3,35,12,13,8,9])))},{id:`hxml`,name:`HXML`,import:(()=>X(()=>import(`./hxml-nwJci6H5.js`),__vite__mapDeps([57,58])))},{id:`hy`,name:`Hy`,import:(()=>X(()=>import(`./hy-B0f-B1mH.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>X(()=>import(`./imba-Bq3j1cW5.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>X(()=>import(`./ini-BayloP2U.js`),[]))},{id:`java`,name:`Java`,import:(()=>X(()=>import(`./java-dUpx0fOI.js`).then(e=>e.n),[]))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>X(()=>import(`./javascript-BAe3TrQC.js`).then(e=>e.n),[]))},{id:`jinja`,name:`Jinja`,import:(()=>X(()=>import(`./jinja-DkZ6M3Ab.js`),__vite__mapDeps([59,1,2,3])))},{id:`jison`,name:`Jison`,import:(()=>X(()=>import(`./jison-DM35qhgH.js`),__vite__mapDeps([60,3])))},{id:`json`,name:`JSON`,import:(()=>X(()=>import(`./json-BllrVlVX.js`).then(e=>e.n),[]))},{id:`json5`,name:`JSON5`,import:(()=>X(()=>import(`./json5-CRSfdIrY.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>X(()=>import(`./jsonc-y4g9DQPx.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>X(()=>import(`./jsonl-D2paVn9r.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>X(()=>import(`./jsonnet-CLH27mtz.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>X(()=>import(`./jssm-CPPYaqX-.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>X(()=>import(`./jsx-D7cROKfU.js`).then(e=>e.n),[]))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>X(()=>import(`./julia-D9WQ8mfH.js`),__vite__mapDeps([61,23,24,25,26,16,3,20,62])))},{id:`just`,name:`Just`,import:(()=>X(()=>import(`./just-DaRB3DJQ.js`),__vite__mapDeps([63,3,64,2,1,16,8,9,20,33,25,23,24,26,34,35,12,13,36,37,28,38])))},{id:`kdl`,name:`KDL`,import:(()=>X(()=>import(`./kdl-D1BQjjnw.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>X(()=>import(`./kotlin-ndCaDnf0.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>X(()=>import(`./kusto-D-4nbkD3.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>X(()=>import(`./latex-DF20a121.js`),__vite__mapDeps([65,66,62])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>X(()=>import(`./lean-YmtAsB0p.js`),[]))},{id:`less`,name:`Less`,import:(()=>X(()=>import(`./less-DyHub3ow.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>X(()=>import(`./liquid-1TnFZcmx.js`),__vite__mapDeps([67,2,1,3,7])))},{id:`llvm`,name:`LLVM IR`,import:(()=>X(()=>import(`./llvm-DCcqrY0D.js`),[]))},{id:`log`,name:`Log file`,import:(()=>X(()=>import(`./log-DWAAMNbe.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>X(()=>import(`./logo-ClQMGkNL.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>X(()=>import(`./lua-DiFnBrnv.js`).then(e=>e.n),__vite__mapDeps([37,25])))},{id:`luau`,name:`Luau`,import:(()=>X(()=>import(`./luau-CmcXFvLt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>X(()=>import(`./make-DcfJyUzm.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>X(()=>import(`./markdown-DXxotAxn.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>X(()=>import(`./marko-BwZ8-6ja.js`),__vite__mapDeps([68,2,69,5,13])))},{id:`matlab`,name:`MATLAB`,import:(()=>X(()=>import(`./matlab-BlfbTznR.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>X(()=>import(`./mdc-P-pYOfTm.js`),__vite__mapDeps([70,15,1,2,3,40,38])))},{id:`mdx`,name:`MDX`,import:(()=>X(()=>import(`./mdx-H8fyPQd8.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>X(()=>import(`./mermaid-CWAV2dmV.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>X(()=>import(`./mipsasm-BWYFAm2s.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>X(()=>import(`./mojo-DZcPJEIN.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>X(()=>import(`./moonbit-6eslNlJL.js`),[]))},{id:`move`,name:`Move`,import:(()=>X(()=>import(`./move-DxFc9-QU.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>X(()=>import(`./narrat-gv38dJOT.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>X(()=>import(`./nextflow-DSfydIxt.js`),__vite__mapDeps([71,72])))},{id:`nextflow-groovy`,name:`nextflow-groovy`,import:(()=>X(()=>import(`./nextflow-groovy-DV4H3hok.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>X(()=>import(`./nginx-Dsk_n7oR.js`),__vite__mapDeps([73,37,25])))},{id:`nim`,name:`Nim`,import:(()=>X(()=>import(`./nim-Ck1s300a.js`),__vite__mapDeps([74,25,2,24,1,3,40,8,9])))},{id:`nix`,name:`Nix`,import:(()=>X(()=>import(`./nix-NlOz3HGM.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>X(()=>import(`./nushell-D86Z8aFF.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>X(()=>import(`./objective-c-iuJvUjCv.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>X(()=>import(`./objective-cpp-C62JvfMT.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>X(()=>import(`./ocaml-Rbryo9lg.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>X(()=>import(`./odin-CfaOVNP_.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>X(()=>import(`./openscad-DCRhgheK.js`),[]))},{id:`pascal`,name:`Pascal`,import:(()=>X(()=>import(`./pascal-CTesTHtV.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>X(()=>import(`./perl-B41o_jjC.js`),__vite__mapDeps([64,2,1,3,16,8,9])))},{id:`php`,name:`PHP`,import:(()=>X(()=>import(`./php-CMujlzV0.js`),__vite__mapDeps([75,2,1,3,7,16,8,9])))},{id:`pkl`,name:`Pkl`,import:(()=>X(()=>import(`./pkl-BjUMjQkt.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>X(()=>import(`./plsql-BgKEZSSo.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>X(()=>import(`./po-C5s_CVt8.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>X(()=>import(`./polar-y4hX8qM0.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>X(()=>import(`./postcss-BHCm7Qae.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>X(()=>import(`./powerquery-C2vMt8aZ.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`],import:(()=>X(()=>import(`./powershell-DEcjmg1c.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>X(()=>import(`./prisma-Ba-Tcxy5.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>X(()=>import(`./prolog-B4o261Jv.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>X(()=>import(`./proto-o3IZKiMR.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>X(()=>import(`./pug-D11187PM.js`),__vite__mapDeps([76,2,1,3])))},{id:`puppet`,name:`Puppet`,import:(()=>X(()=>import(`./puppet-BC0dqZ31.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>X(()=>import(`./purescript-CLDw1y5G.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>X(()=>import(`./python-D1NFioGW.js`),[]))},{id:`qml`,name:`QML`,import:(()=>X(()=>import(`./qml-DTIWhV-g.js`),__vite__mapDeps([77,3])))},{id:`qmldir`,name:`QML Directory`,import:(()=>X(()=>import(`./qmldir-B7i9e9Vn.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>X(()=>import(`./qss-DIe6oKX8.js`),[]))},{id:`r`,name:`R`,import:(()=>X(()=>import(`./r-BZAS-COm.js`).then(e=>e.n),[]))},{id:`racket`,name:`Racket`,import:(()=>X(()=>import(`./racket-CAOC_yyk.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>X(()=>import(`./raku-Ccua3vW6.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>X(()=>import(`./razor-CBm_RlUZ.js`),__vite__mapDeps([78,79,1,2,3])))},{id:`reg`,name:`Windows Registry Script`,import:(()=>X(()=>import(`./reg-CAYZT9kE.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>X(()=>import(`./regexp-BEybnWDb.js`).then(e=>e.n),[]))},{id:`rel`,name:`Rel`,import:(()=>X(()=>import(`./rel-cvB6F5nO.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>X(()=>import(`./riscv-SYGtE4EN.js`),[]))},{id:`ron`,name:`RON`,import:(()=>X(()=>import(`./ron-CRt869SB.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>X(()=>import(`./rosmsg-BwrfJ66Z.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>X(()=>import(`./rst-BOC8MHym.js`),__vite__mapDeps([80,81,23,24,25,26,16,15,1,2,3,20,33,34,35,12,13,36,37,28,8,9,38])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>X(()=>import(`./ruby-DaL2rAtC.js`),__vite__mapDeps([33,25,23,24,26,16,2,34,3,35,12,13,36,1,37,28,8,9,38])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>X(()=>import(`./rust-DCKTTPxN.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>X(()=>import(`./sas-JlJDv85T.js`),__vite__mapDeps([82,16])))},{id:`sass`,name:`Sass`,import:(()=>X(()=>import(`./sass-CorcwySt.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>X(()=>import(`./scala-DlI-OmYj.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>X(()=>import(`./scheme-CcNEGkZH.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>X(()=>import(`./scss-uXJKsv_B.js`).then(e=>e.n),__vite__mapDeps([5,2])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>X(()=>import(`./sdbl-AL_m-RO_.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>X(()=>import(`./shaderlab-CbbQwRPF.js`),__vite__mapDeps([83,84])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>X(()=>import(`./shellscript-HMUWC9b7.js`).then(e=>e.n),[]))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>X(()=>import(`./shellsession-C8yhvjix.js`),__vite__mapDeps([85,28])))},{id:`smalltalk`,name:`Smalltalk`,import:(()=>X(()=>import(`./smalltalk-Y2ogrfbk.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>X(()=>import(`./solidity-Bfbm9QZQ.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>X(()=>import(`./soy-Dz4Z0AvF.js`),__vite__mapDeps([86,1,2,3])))},{id:`sparql`,name:`SPARQL`,import:(()=>X(()=>import(`./sparql-DEoxFJ5d.js`),__vite__mapDeps([87,88])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>X(()=>import(`./splunk-6DJA2XFa.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>X(()=>import(`./sql-DeGOlIES.js`).then(e=>e.n),[]))},{id:`ssh-config`,name:`SSH Config`,import:(()=>X(()=>import(`./ssh-config-CbQtdF-u.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>X(()=>import(`./stata-B56wP_fZ.js`),__vite__mapDeps([89,16])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>X(()=>import(`./stylus-B_iq45Sj.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>X(()=>import(`./surrealql-C-EnKGgM.js`),__vite__mapDeps([90,3])))},{id:`svelte`,name:`Svelte`,import:(()=>X(()=>import(`./svelte-B-gz1UqK.js`),__vite__mapDeps([91,2,3,11,13])))},{id:`swift`,name:`Swift`,import:(()=>X(()=>import(`./swift-C7KIgN-p.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>X(()=>import(`./system-verilog-C3G9wERd.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>X(()=>import(`./systemd-CwxGrojj.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>X(()=>import(`./talonscript-DqnSo1EO.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>X(()=>import(`./tasl-T8ethp86.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>X(()=>import(`./tcl-Ccl366o0.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>X(()=>import(`./templ-DbohGIUJ.js`),__vite__mapDeps([92,2,93,3])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>X(()=>import(`./terraform-BBf6ZI_0.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>X(()=>import(`./tex-BeTSKLqn.js`),__vite__mapDeps([66,62])))},{id:`toml`,name:`TOML`,import:(()=>X(()=>import(`./toml-C5Z_BR4r.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>X(()=>import(`./ts-tags-BkO3jza8.js`),__vite__mapDeps([94,2,24,25,1,3,16,13,8,9])))},{id:`tsv`,name:`TSV`,import:(()=>X(()=>import(`./tsv-rX8sUJs7.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>X(()=>import(`./tsx-DaFYbbmG.js`).then(e=>e.n),[]))},{id:`turtle`,name:`Turtle`,import:(()=>X(()=>import(`./turtle-BM-MG8WY.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>X(()=>import(`./twig-DzCVyQww.js`),__vite__mapDeps([95,2,3,75,1,7,16,8,9,20,33,25,23,24,26,34,35,12,13,36,37,28,38,5])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>X(()=>import(`./typescript-Dln4zzcr.js`).then(e=>e.n),[]))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>X(()=>import(`./typespec-C5gKydvR.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>X(()=>import(`./typst--_5VchrY.js`),[]))},{id:`v`,name:`V`,import:(()=>X(()=>import(`./v-C6PwpmTC.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>X(()=>import(`./vala-4pTaceSj.js`),[]))},{id:`vb`,name:`Visual Basic`,aliases:[`cmd`],import:(()=>X(()=>import(`./vb-DhoR5A6S.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>X(()=>import(`./verilog-B9f_1lPn.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>X(()=>import(`./vhdl-Cy4RAmOe.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>X(()=>import(`./viml-CFQW-CcD.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>X(()=>import(`./vue-BzONpLvY.js`),__vite__mapDeps([96,2,15,1,3,7,13])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>X(()=>import(`./vue-html-COcQmVJc.js`),__vite__mapDeps([97,3])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>X(()=>import(`./vue-vine-DVjvhNim.js`),__vite__mapDeps([98,2,3,69,11,5,99])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>X(()=>import(`./vyper-BW5zj9bE.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>X(()=>import(`./wasm-BigxSLnm.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>X(()=>import(`./wenyan-BZzM1SQT.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>X(()=>import(`./wgsl-xBPHbLlq.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>X(()=>import(`./wikitext-BXJWUNJK.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>X(()=>import(`./wit-2GnUs67P.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>X(()=>import(`./wolfram-DIFDmw-g.js`),[]))},{id:`xml`,name:`XML`,import:(()=>X(()=>import(`./xml-BdpFphXw.js`).then(e=>e.n),__vite__mapDeps([8,9])))},{id:`xsl`,name:`XSL`,import:(()=>X(()=>import(`./xsl-B0CVAfmA.js`),__vite__mapDeps([100,8,9])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>X(()=>import(`./yaml-DS_pFZ8s.js`).then(e=>e.n),[]))},{id:`zenscript`,name:`ZenScript`,import:(()=>X(()=>import(`./zenscript-DQaUUjbx.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>X(()=>import(`./zig-BDepRvBi.js`),[]))}],bs=Object.fromEntries(ys.map(e=>[e.id,e.import])),xs=Object.fromEntries(ys.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),Ss={...bs,...xs},Cs=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>X(()=>import(`./andromeeda-Ch2kWS7s.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>X(()=>import(`./aurora-x-BHLqzt7j.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>X(()=>import(`./ayu-dark-DCotN_ZT.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>X(()=>import(`./ayu-light-CKB6o_im.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>X(()=>import(`./ayu-mirage-B38lW-C5.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>X(()=>import(`./catppuccin-frappe-BY_2ofjk.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>X(()=>import(`./catppuccin-latte-D6GXPBmA.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>X(()=>import(`./catppuccin-macchiato-BuW8_cyo.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>X(()=>import(`./catppuccin-mocha-znex9DPe.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>X(()=>import(`./dark-plus-BvePH-r3.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>X(()=>import(`./dracula-kJQjC_Gy.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>X(()=>import(`./dracula-soft-B3XhEjCl.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>X(()=>import(`./everforest-dark-u0zLn75q.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>X(()=>import(`./everforest-light-D3syIoAR.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>X(()=>import(`./github-dark-CEBLh0--.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>X(()=>import(`./github-dark-default-Dq0Z4Xai.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>X(()=>import(`./github-dark-dimmed-D90YmS4w.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>X(()=>import(`./github-dark-high-contrast-B6BWv1iC.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>X(()=>import(`./github-light-lXSVSq5T.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>X(()=>import(`./github-light-default-DsPWmj4v.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>X(()=>import(`./github-light-high-contrast-C7aLb3kp.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>X(()=>import(`./gruvbox-dark-hard-_deksD0U.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>X(()=>import(`./gruvbox-dark-medium-CT31284j.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>X(()=>import(`./gruvbox-dark-soft-BZuEUCbj.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>X(()=>import(`./gruvbox-light-hard-dxv4n_ZS.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>X(()=>import(`./gruvbox-light-medium-BsW_fVfR.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>X(()=>import(`./gruvbox-light-soft-BiGy99gD.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>X(()=>import(`./horizon-Ngud75Kn.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`dark`,import:(()=>X(()=>import(`./horizon-bright-Cnljd0XD.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>X(()=>import(`./houston-BenZxlMr.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>X(()=>import(`./kanagawa-dragon-Bt5mhLu1.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>X(()=>import(`./kanagawa-lotus-FGA3pRJk.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>X(()=>import(`./kanagawa-wave-DnLVZPAD.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>X(()=>import(`./laserwave-D2qAZkaG.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>X(()=>import(`./light-plus-CP13QUvm.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>X(()=>import(`./material-theme-JFoPTBSr.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>X(()=>import(`./material-theme-darker-BHaqZ19v.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>X(()=>import(`./material-theme-lighter-CGnnS2bs.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>X(()=>import(`./material-theme-ocean-Drhewjqf.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>X(()=>import(`./material-theme-palenight-DbUypmpb.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>X(()=>import(`./min-dark-BEelvXUB.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>X(()=>import(`./min-light-CTPBOACR.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>X(()=>import(`./monokai-DQlZXbkg.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>X(()=>import(`./night-owl-BLcrYhaC.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>X(()=>import(`./night-owl-light-BG-tBJOz.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>X(()=>import(`./nord-Dm2F5_QB.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>X(()=>import(`./one-dark-pro-DC9SHdX0.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>X(()=>import(`./one-light-Doo39p0H.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>X(()=>import(`./plastic-B3CcSpon.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>X(()=>import(`./poimandres-BsK70ma5.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>X(()=>import(`./red-DtDH206x.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>X(()=>import(`./rose-pine-CjBfSJ5b.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>X(()=>import(`./rose-pine-dawn-C0xwy7iJ.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>X(()=>import(`./rose-pine-moon-BSNy9Ty0.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>X(()=>import(`./slack-dark-rMhrfPm6.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>X(()=>import(`./slack-ochin-9w8X74hU.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>X(()=>import(`./snazzy-light-DHr9ygpP.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>X(()=>import(`./solarized-dark-UPcKev9Q.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>X(()=>import(`./solarized-light-DUsjROvl.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>X(()=>import(`./synthwave-84-lf_Wt0K_.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>X(()=>import(`./tokyo-night-BF5ata25.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>X(()=>import(`./vesper-CmBi_iCT.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>X(()=>import(`./vitesse-black-CE8RoBJP.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>X(()=>import(`./vitesse-dark-BpF142p_.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>X(()=>import(`./vitesse-light-CMwxPBrg.js`),[]))}].map(e=>[e.id,e.import])),ws=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Ts(){return 2147483648}function Es(){return typeof performance<`u`?performance.now():Date.now()}var Ds=(e,t)=>e+(t-e%t)%t;async function Os(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=Ts();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,Ds(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:Es,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var ks=Object.defineProperty,As=(e,t,n)=>t in e?ks(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,js=(e,t,n)=>As(e,typeof t==`symbol`?t:t+``,n),Ms=null;function Ns(e){throw new ws(e.UTF8ToString(e.getLastOnigError()))}var Ps=class e{constructor(t){js(this,`utf16Length`),js(this,`utf8Length`),js(this,`utf16Value`),js(this,`utf8Value`),js(this,`utf16OffsetToUtf8`),js(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}a<=127?t+=1:a<=2047?t+=2:a<=65535?t+=3:t+=4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},Fs=class e{constructor(t){if(js(this,`id`,++e.LAST_ID),js(this,`_onigBinding`),js(this,`content`),js(this,`utf16Length`),js(this,`utf8Length`),js(this,`utf16OffsetToUtf8`),js(this,`utf8OffsetToUtf16`),js(this,`ptr`),!Ms)throw new ws(`Must invoke loadWasm first.`);this._onigBinding=Ms,this.content=t;let n=new Ps(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=Ms.omalloc(1e4),e._sharedPtrInUse=!0,Ms.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(Ms)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};js(Fs,`LAST_ID`,0),js(Fs,`_sharedPtr`,0),js(Fs,`_sharedPtrInUse`,!1);var Is=Fs,Ls=class{constructor(e){if(js(this,`_onigBinding`),js(this,`_ptr`),!Ms)throw new ws(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new Ps(e[r]);t[r]=i.createString(Ms),n[r]=i.utf8Length}let r=Ms.omalloc(4*e.length);Ms.HEAPU32.set(t,r/4);let i=Ms.omalloc(4*e.length);Ms.HEAPU32.set(n,i/4);let a=Ms.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)Ms.ofree(t[n]);Ms.ofree(i),Ms.ofree(r),a===0&&Ns(Ms),this._onigBinding=Ms,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new Is(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function Rs(e){return typeof e.instantiator==`function`}function zs(e){return typeof e.default==`function`}function Bs(e){return e.data!==void 0}function Vs(e){return typeof Response<`u`&&e instanceof Response}function Hs(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var Us;function Ws(e){if(Us)return Us;async function t(){Ms=await Os(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Rs(n)?n=await n.instantiator(t):zs(n)?n=await n.default(t):(Bs(n)&&(n=n.data),Vs(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Ks(n)(t):await qs(n)(t):Hs(n)||n instanceof WebAssembly.Module?n=await Gs(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Gs(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Us=t(),Us}function Gs(e){return t=>WebAssembly.instantiate(e,t)}function Ks(e){return t=>WebAssembly.instantiateStreaming(e,t)}function qs(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function Js(e){return e&&await Ws(e),{createScanner(e){return new Ls(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new Is(e)}}}var Ys=ps({langs:Ss,themes:Cs,engine:()=>Js(X(()=>import(`./wasm-CSccDuAq.js`),[]))}),{codeToHtml:Xs,codeToHast:Zs,codeToTokens:Qs,codeToTokensBase:$s,codeToTokensWithThemes:ec,getSingletonHighlighter:tc,getLastGrammarState:nc}=hs(Ys,{guessEmbeddedLanguages:Qa});function rc(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function ic(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var ac=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),oc=String.raw;function sc(e,t){if(e==null)throw Error(t??`Value expected`);return e}var cc=oc`\[\^?`,lc=`c.? | C(?:-.?)?|${oc`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${oc`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${oc`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${oc`o\{[^\}]*\}?`}|${oc`\d{1,3}`}`,uc=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,dc=new RegExp(oc`
22
22
  \\ (?:
23
23
  ${lc}
24
24
  | [gk]<[^>]*>?
@@ -1879,7 +1879,7 @@ XID_Start XIDS`.split(/\s/).map(e=>[jl(e),e])),Tu=new Map([[`s`,lu(383)],[lu(383
1879
1879
  `),r=``;r=n?`\n${e.lineContent.split(`
1880
1880
  `).map(e=>`${t} ${e}`).join(`
1881
1881
  `)}\n`:`${t} ${e.lineContent}`,c.push(` <code><![CDATA[${r}]]></code>`)}if(c.push(` <body><![CDATA[${e.body}]]></body>`),e.replies&&e.replies.length>0){c.push(` <replies>`);for(let t of e.replies){let e=new Date(t.createdAt).toISOString(),n=t.role?` role="${t.role}"`:` role="agent"`,r=t.model?` model="${t.model}"`:``;c.push(` <reply id="${t.id}" created-at="${e}"${n}${r}>`),c.push(` <![CDATA[${t.body}]]>`),c.push(` </reply>`)}c.push(` </replies>`)}c.push(` </comment>`)}c.push(` </file>`)}return c.push(`</code-review-comments>`),c.join(`
1882
- `)}var CE=[`comments`];async function wE(){return(await fetch(`/api/comments`)).json()}function TE(){let e=Re(),{data:t=[],isLoading:n}=$e({queryKey:CE,queryFn:wE});(0,q.useEffect)(()=>gE(`comments`,()=>{e.invalidateQueries({queryKey:CE})}),[e]);let[r,i]=(0,q.useState)({round:0,waiters:0,lastSentAt:null,lastDecision:void 0,lastOpenCount:void 0});(0,q.useEffect)(()=>{let e=!1;fetch(`/api/review/status`).then(e=>e.json()).then(t=>{e||i(t)}).catch(()=>{});let t=gE(`agent-status`,e=>{try{i(JSON.parse(e))}catch{}});return()=>{e=!0,t()}},[]);let a=(0,q.useRef)(null),[o,s]=(0,q.useState)(null);(0,q.useEffect)(()=>{if(n)return;let e=a.current===null;a.current===null&&(a.current=new Set);let r=a.current,i=null;for(let n of t)for(let t of n.replies??[])r.has(t.id)||(r.add(t.id),!e&&n.status!==`resolved`&&(t.role===`agent`||t.role==null&&t.model)&&(!i||t.createdAt>i.at)&&(i={at:t.createdAt,commentId:n.id,filePath:n.filePath,model:t.model,body:t.body}));i&&s(i)},[t,n]);let c=et({mutationFn:async e=>(await fetch(`/api/comments`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).json(),onSuccess:t=>{e.setQueryData(CE,(e=[])=>[...e,t])}}),l=et({mutationFn:async e=>(await fetch(`/api/comments/${e}`,{method:`DELETE`}),e),onSuccess:t=>{e.setQueryData(CE,(e=[])=>e.filter(e=>e.id!==t))}}),u=et({mutationFn:async({id:e,body:t,status:n})=>(await fetch(`/api/comments/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:t,status:n})})).json(),onSuccess:t=>{e.setQueryData(CE,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),d=et({mutationFn:async({id:e,body:t})=>(await fetch(`/api/comments/${e}/replies`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:t,role:`user`})})).json(),onSuccess:t=>{e.setQueryData(CE,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),f=et({mutationFn:async({commentId:e,replyId:t})=>(await fetch(`/api/comments/${e}/replies/${t}`,{method:`DELETE`})).json(),onSuccess:t=>{e.setQueryData(CE,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),p=et({mutationFn:async({commentId:e,replyId:t,body:n})=>(await fetch(`/api/comments/${e}/replies/${t}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:n})})).json(),onSuccess:t=>{e.setQueryData(CE,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),m=et({mutationFn:async({decision:e,generalComment:t,mode:n,force:r})=>{let i=await fetch(`/api/review/send`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({decision:e,generalComment:t?.trim()||void 0,mode:n,force:!!r})});if(i.status===400){let e=await i.json().catch(()=>null);if(e?.error===`secrets-detected`){let t=Error(`Secrets detected`);throw t.kind=`secrets`,t.findings=e.findings??[],t}}if(!i.ok)throw Error(`Failed to send to agent`);return i.json()}}),h=et({mutationFn:async e=>{let t=await fetch(`/api/comments/${e}/apply-suggestion`,{method:`POST`});if(!t.ok){let e=await t.json();throw Error(e.error||`Failed to apply suggestion`)}return t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:CE})}}),g=(0,q.useCallback)((e,t,n,r,i,a,o)=>{c.mutate({filePath:e,side:t,lineNumber:n,startLineNumber:a,lineContent:r,body:i,severity:o&&o!==`none`?o:void 0})},[c.mutate]),_=(0,q.useCallback)(e=>{l.mutate(e)},[l.mutate]),v=(0,q.useCallback)((e,t)=>{u.mutate({id:e,body:t})},[u.mutate]),y=(0,q.useCallback)(e=>{u.mutate({id:e,status:`resolved`})},[u.mutate]),b=(0,q.useCallback)(e=>{u.mutate({id:e,status:`open`})},[u.mutate]),x=(0,q.useCallback)((e,t)=>{d.mutate({id:e,body:t})},[d.mutate]),S=(0,q.useCallback)((e,t)=>{f.mutate({commentId:e,replyId:t})},[f.mutate]),C=(0,q.useCallback)((e,t,n)=>{p.mutate({commentId:e,replyId:t,body:n})},[p.mutate]),w=(0,q.useCallback)(async e=>{await h.mutateAsync(e)},[h.mutateAsync]),T=(0,q.useCallback)(()=>SE(t),[t]),E=(0,q.useCallback)(e=>t.filter(t=>t.filePath===e).map(e=>({side:e.side,lineNumber:e.lineNumber,metadata:e})),[t]),D=(0,q.useCallback)(async()=>{let e=T();await navigator.clipboard.writeText(e)},[T]),O=(0,q.useCallback)(async()=>{let{formatCommentsMarkdown:e}=await X(async()=>{let{formatCommentsMarkdown:e}=await import(`./review-export-BgwyN8Ky.js`);return{formatCommentsMarkdown:e}},[]),n=e(t);n&&await navigator.clipboard.writeText(n)},[t]),k=(0,q.useCallback)((e,t,n,r)=>m.mutateAsync({decision:e,generalComment:t,mode:n,force:r}),[m.mutateAsync]),A=et({mutationFn:async()=>{let e=await fetch(`/api/comments/resolve-all`,{method:`POST`});if(!e.ok)throw Error(`Failed to resolve all comments`);return await e.json()},onSuccess:()=>{e.invalidateQueries({queryKey:CE})}}),j=(0,q.useCallback)(()=>A.mutateAsync(),[A]);return{comments:t,addComment:g,removeComment:_,editComment:v,resolveComment:y,unresolveComment:b,addReply:x,removeReply:S,editReply:C,applySuggestion:w,getAnnotationsForFile:E,formatAllComments:T,copyAllComments:D,copyAllCommentsMarkdown:O,agentActivity:o,clearAgentActivity:(0,q.useCallback)(()=>s(null),[]),sendToAgent:k,sending:m.isPending,agentWaiting:r.waiters>0||(r.agents?.length??0)>0,waitingAgents:r.agents??[],lastSend:r.lastSentAt==null?null:{round:r.round,sentAt:r.lastSentAt,decision:r.lastDecision,openCount:r.lastOpenCount??null},resolveAllOpen:j,resolvingAll:A.isPending}}var EE=[`plans`];async function DE(){let e=await fetch(`/api/plans`);if(!e.ok)return[];let t=await e.json();return Array.isArray(t)?t:[]}function OE(){let e=Re(),{data:t=[],isLoading:n}=$e({queryKey:EE,queryFn:DE});(0,q.useEffect)(()=>gE(`plans`,()=>{e.invalidateQueries({queryKey:EE})}),[e]);let[r,i]=(0,q.useState)({round:0,waiters:0,lastDecidedAt:null});(0,q.useEffect)(()=>{let e=!1;fetch(`/api/plan-review/status`).then(e=>e.json()).then(t=>{e||i(t)}).catch(()=>{});let t=gE(`plan-review-status`,e=>{try{i(JSON.parse(e))}catch{}});return()=>{e=!0,t()}},[]);let a=(0,q.useRef)(null),[o,s]=(0,q.useState)(null);(0,q.useEffect)(()=>{if(n)return;let e=a.current===null;a.current===null&&(a.current=new Set);let r=a.current,i=null;for(let n of t)for(let t of n.comments??[])for(let a of t.replies??[])r.has(a.id)||(r.add(a.id),!e&&t.status!==`resolved`&&(a.role===`agent`||a.role==null&&a.model)&&(!i||a.createdAt>i.at)&&(i={at:a.createdAt,planId:n.id,commentId:t.id,model:a.model,body:a.body}));i&&s(i)},[t,n]);let c=(0,q.useCallback)(t=>{e.setQueryData(EE,(e=[])=>e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[...e,t])},[e]),l=et({mutationFn:async({planId:e,...t})=>(await fetch(`/api/plans/${e}/comments`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})).json(),onSuccess:c}),u=et({mutationFn:async({planId:e,commentId:t,body:n,status:r})=>(await fetch(`/api/plans/${e}/comments/${t}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:n,status:r})})).json(),onSuccess:c}),d=et({mutationFn:async({planId:e,commentId:t})=>(await fetch(`/api/plans/${e}/comments/${t}`,{method:`DELETE`})).json(),onSuccess:c}),f=et({mutationFn:async({planId:e,commentId:t,body:n})=>(await fetch(`/api/plans/${e}/comments/${t}/replies`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:n,role:`user`})})).json(),onSuccess:c}),p=et({mutationFn:async({planId:e,commentId:t,replyId:n,body:r})=>(await fetch(`/api/plans/${e}/comments/${t}/replies/${n}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:r})})).json(),onSuccess:c}),m=et({mutationFn:async({planId:e,commentId:t,replyId:n})=>(await fetch(`/api/plans/${e}/comments/${t}/replies/${n}`,{method:`DELETE`})).json(),onSuccess:c}),h=et({mutationFn:async({planId:e,decision:t,decisionComment:n,mode:r})=>{let i=await fetch(`/api/plans/${e}/decision`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({decision:t,decisionComment:n?.trim()||void 0,mode:r})});if(!i.ok)throw Error(`Failed to submit plan decision`);return i.json()},onSuccess:()=>e.invalidateQueries({queryKey:EE})}),g=et({mutationFn:async e=>(await fetch(`/api/plans/${e}`,{method:`DELETE`}),e),onSuccess:t=>{e.setQueryData(EE,(e=[])=>e.filter(e=>e.id!==t))}}),_=et({mutationFn:async({planId:e,title:t,body:n,source:r,model:i})=>{let a=await fetch(`/api/plans/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:t,body:n,source:r,model:i})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(typeof e.error==`string`?e.error:`Failed to update plan (${a.status})`)}return a.json()},onSuccess:c}),v=et({mutationFn:async({planId:e,title:t,body:n,source:r,model:i})=>{let a=await fetch(`/api/plans`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:e,title:t,body:n,source:r,model:i})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(typeof e.error==`string`?e.error:`Failed to save plan version (${a.status})`)}return a.json()},onSuccess:c});return{plans:t,getPlan:(0,q.useCallback)(e=>t.find(t=>t.id===e)??null,[t]),addPlanComment:(0,q.useCallback)(e=>l.mutate(e),[l.mutate]),editPlanComment:(0,q.useCallback)((e,t,n)=>u.mutate({planId:e,commentId:t,body:n}),[u.mutate]),resolvePlanComment:(0,q.useCallback)((e,t)=>u.mutate({planId:e,commentId:t,status:`resolved`}),[u.mutate]),unresolvePlanComment:(0,q.useCallback)((e,t)=>u.mutate({planId:e,commentId:t,status:`open`}),[u.mutate]),removePlanComment:(0,q.useCallback)((e,t)=>d.mutate({planId:e,commentId:t}),[d.mutate]),addPlanReply:(0,q.useCallback)((e,t,n)=>f.mutate({planId:e,commentId:t,body:n}),[f.mutate]),editPlanReply:(0,q.useCallback)((e,t,n,r)=>p.mutate({planId:e,commentId:t,replyId:n,body:r}),[p.mutate]),removePlanReply:(0,q.useCallback)((e,t,n)=>m.mutate({planId:e,commentId:t,replyId:n}),[m.mutate]),removePlan:(0,q.useCallback)(e=>g.mutate(e),[g.mutate]),updatePlan:(0,q.useCallback)((e,t)=>_.mutateAsync({planId:e,...t}),[_.mutateAsync]),submitPlanVersion:(0,q.useCallback)((e,t)=>v.mutateAsync({planId:e,...t}),[v.mutateAsync]),updatingPlan:_.isPending,submittingPlanVersion:v.isPending,submitDecision:(0,q.useCallback)((e,t,n,r)=>h.mutateAsync({planId:e,decision:t,decisionComment:n,mode:r}),[h.mutateAsync]),submitting:h.isPending,agentWaiting:r.waiters>0,agentActivity:o,clearAgentActivity:(0,q.useCallback)(()=>s(null),[]),isLoading:n}}var kE=new Set;function AE(){for(let e of kE)e()}function jE(e,t={}){let n=cE(e);n!==window.location.pathname+window.location.search&&(t.replace?window.history.replaceState(null,``,n):window.history.pushState(null,``,n),AE())}function ME(e){return kE.add(e),window.addEventListener(`popstate`,e),()=>{kE.delete(e),window.removeEventListener(`popstate`,e)}}function NE(){return window.location.pathname}function PE(){return`/`}function FE(){return(0,q.useSyncExternalStore)(ME,NE,PE)}function IE(e){let[t,n]=(0,q.useState)({inMerge:!1,conflicts:[]}),r=(0,q.useCallback)(()=>{fetch(`/api/merge-status`).then(e=>e.ok?e.json():{inMerge:!1,conflicts:[]}).then(n).catch(()=>n({inMerge:!1,conflicts:[]}))},[]);return(0,q.useEffect)(()=>{r()},[r,e]),{status:t,refresh:r}}var LE={defaultMode:`web`,staged:!0,untracked:!0,diffStyle:`split`,defaultTabSize:4,theme:`rose-pine`,editorIDE:`default`,lineDiffType:`word`,lineWrap:!1,diffIndicators:`classic`,showLineNumbers:!0,hunkSeparators:`line-info`,lineHoverHighlight:`both`,fontSize:13,expandContextByDefault:!1,collapsedContextThreshold:10,expansionLineCount:20,haptics:!0,sounds:!0,uiFont:null,monoFont:null,density:`comfortable`,autoCollapseLineThreshold:400,requireViewAllBeforeSend:!1,showStatusBar:!0,savedReplies:[],ignoreSpaceChange:!1,ignoreAllSpace:!1},RE=`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;function zE(e){return e?`"${e}", ${RE}`:`"JetBrains Mono", ${RE}`}function BE(){let[e,t]=(0,q.useState)(LE),[n,r]=(0,q.useState)(!1),i=(0,q.useRef)(!0);return(0,q.useEffect)(()=>{fetch(`/api/settings`).then(e=>e.json()).then(e=>{i.current=!0,t({...LE,...e}),r(!0)}).catch(()=>r(!0))},[]),(0,q.useEffect)(()=>{if(i.current){i.current=!1;return}let t=setTimeout(()=>{fetch(`/api/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}).catch(()=>{})},300);return()=>clearTimeout(t)},[e]),{settings:e,loaded:n,updateSettings:(0,q.useCallback)(e=>{t(t=>({...t,...e}))},[])}}function VE(e,t,n){(0,q.useEffect)(()=>{let r=`, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;if(!e)return;let i=`gfonts-preconnect`,a=`gfonts-preconnect-static`,o=`gfonts-link`,s=`diffing-fonts-override`,c=()=>{if(!document.getElementById(i)){let e=document.createElement(`link`);e.id=i,e.rel=`preconnect`,e.href=`https://fonts.googleapis.com`,document.head.appendChild(e)}if(!document.getElementById(a)){let e=document.createElement(`link`);e.id=a,e.rel=`preconnect`,e.href=`https://fonts.gstatic.com`,e.crossOrigin=`anonymous`,document.head.appendChild(e)}},l=e=>encodeURIComponent(e.trim()).replace(/%20/g,`+`),u=t?.trim()?l(t):`Geist+Mono:ital,wght@0,100..900;1,100..900`,d=n?.trim()?l(n):`JetBrains+Mono:ital,wght@0,100..800;1,100..800`,f=[...new Set([u,d].filter(Boolean))];c();let p=`https://fonts.googleapis.com/css2?family=${f.join(`&family=`)}&display=swap`,m=document.getElementById(o);m||(m=document.createElement(`link`),m.id=o,m.rel=`stylesheet`,document.head.appendChild(m)),m.getAttribute(`href`)!==p&&m.setAttribute(`href`,p);let h=document.getElementById(s);h||(h=document.createElement(`style`),h.id=s,document.head.appendChild(h));let g=t?`"${t}"`:`"Geist Mono"`,_=n?`"${n}"`:`"JetBrains Mono"`;return h.innerHTML=`
1882
+ `)}var CE=[`comments`];async function wE(){return(await fetch(`/api/comments`)).json()}function TE(){let e=Re(),{data:t=[],isLoading:n}=$e({queryKey:CE,queryFn:wE});(0,q.useEffect)(()=>gE(`comments`,()=>{e.invalidateQueries({queryKey:CE})}),[e]);let[r,i]=(0,q.useState)({round:0,waiters:0,lastSentAt:null,lastDecision:void 0,lastOpenCount:void 0});(0,q.useEffect)(()=>{let e=!1;fetch(`/api/review/status`).then(e=>e.json()).then(t=>{e||i(t)}).catch(()=>{});let t=gE(`agent-status`,e=>{try{i(JSON.parse(e))}catch{}});return()=>{e=!0,t()}},[]);let a=(0,q.useRef)(null),[o,s]=(0,q.useState)(null);(0,q.useEffect)(()=>{if(n)return;let e=a.current===null;a.current===null&&(a.current=new Set);let r=a.current,i=null;for(let n of t)for(let t of n.replies??[])r.has(t.id)||(r.add(t.id),!e&&n.status!==`resolved`&&(t.role===`agent`||t.role==null&&t.model)&&(!i||t.createdAt>i.at)&&(i={at:t.createdAt,commentId:n.id,filePath:n.filePath,model:t.model,body:t.body}));i&&s(i)},[t,n]);let c=et({mutationFn:async e=>(await fetch(`/api/comments`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).json(),onSuccess:t=>{e.setQueryData(CE,(e=[])=>[...e,t])}}),l=et({mutationFn:async e=>(await fetch(`/api/comments/${e}`,{method:`DELETE`}),e),onSuccess:t=>{e.setQueryData(CE,(e=[])=>e.filter(e=>e.id!==t))}}),u=et({mutationFn:async({id:e,body:t,status:n})=>(await fetch(`/api/comments/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:t,status:n})})).json(),onSuccess:t=>{e.setQueryData(CE,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),d=et({mutationFn:async({id:e,body:t})=>(await fetch(`/api/comments/${e}/replies`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:t,role:`user`})})).json(),onSuccess:t=>{e.setQueryData(CE,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),f=et({mutationFn:async({commentId:e,replyId:t})=>(await fetch(`/api/comments/${e}/replies/${t}`,{method:`DELETE`})).json(),onSuccess:t=>{e.setQueryData(CE,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),p=et({mutationFn:async({commentId:e,replyId:t,body:n})=>(await fetch(`/api/comments/${e}/replies/${t}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:n})})).json(),onSuccess:t=>{e.setQueryData(CE,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),m=et({mutationFn:async({decision:e,generalComment:t,mode:n,force:r})=>{let i=await fetch(`/api/review/send`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({decision:e,generalComment:t?.trim()||void 0,mode:n,force:!!r})});if(i.status===400){let e=await i.json().catch(()=>null);if(e?.error===`secrets-detected`){let t=Error(`Secrets detected`);throw t.kind=`secrets`,t.findings=e.findings??[],t}}if(!i.ok)throw Error(`Failed to send to agent`);return i.json()}}),h=et({mutationFn:async e=>{let t=await fetch(`/api/comments/${e}/apply-suggestion`,{method:`POST`});if(!t.ok){let e=await t.json();throw Error(e.error||`Failed to apply suggestion`)}return t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:CE})}}),g=(0,q.useCallback)((e,t,n,r,i,a,o)=>{c.mutate({filePath:e,side:t,lineNumber:n,startLineNumber:a,lineContent:r,body:i,severity:o&&o!==`none`?o:void 0})},[c.mutate]),_=(0,q.useCallback)(e=>{l.mutate(e)},[l.mutate]),v=(0,q.useCallback)((e,t)=>{u.mutate({id:e,body:t})},[u.mutate]),y=(0,q.useCallback)(e=>{u.mutate({id:e,status:`resolved`})},[u.mutate]),b=(0,q.useCallback)(e=>{u.mutate({id:e,status:`open`})},[u.mutate]),x=(0,q.useCallback)((e,t)=>{d.mutate({id:e,body:t})},[d.mutate]),S=(0,q.useCallback)((e,t)=>{f.mutate({commentId:e,replyId:t})},[f.mutate]),C=(0,q.useCallback)((e,t,n)=>{p.mutate({commentId:e,replyId:t,body:n})},[p.mutate]),w=(0,q.useCallback)(async e=>{await h.mutateAsync(e)},[h.mutateAsync]),T=(0,q.useCallback)(()=>SE(t),[t]),E=(0,q.useCallback)(e=>t.filter(t=>t.filePath===e).map(e=>({side:e.side,lineNumber:e.lineNumber,metadata:e})),[t]),D=(0,q.useCallback)(async()=>{let e=T();await navigator.clipboard.writeText(e)},[T]),O=(0,q.useCallback)(async()=>{let{formatCommentsMarkdown:e}=await X(async()=>{let{formatCommentsMarkdown:e}=await import(`./review-export-D5JAvT15.js`);return{formatCommentsMarkdown:e}},[]),n=e(t);n&&await navigator.clipboard.writeText(n)},[t]),k=(0,q.useCallback)((e,t,n,r)=>m.mutateAsync({decision:e,generalComment:t,mode:n,force:r}),[m.mutateAsync]),A=et({mutationFn:async()=>{let e=await fetch(`/api/comments/resolve-all`,{method:`POST`});if(!e.ok)throw Error(`Failed to resolve all comments`);return await e.json()},onSuccess:()=>{e.invalidateQueries({queryKey:CE})}}),j=(0,q.useCallback)(()=>A.mutateAsync(),[A]);return{comments:t,addComment:g,removeComment:_,editComment:v,resolveComment:y,unresolveComment:b,addReply:x,removeReply:S,editReply:C,applySuggestion:w,getAnnotationsForFile:E,formatAllComments:T,copyAllComments:D,copyAllCommentsMarkdown:O,agentActivity:o,clearAgentActivity:(0,q.useCallback)(()=>s(null),[]),sendToAgent:k,sending:m.isPending,agentWaiting:r.waiters>0||(r.agents?.length??0)>0,waitingAgents:r.agents??[],lastSend:r.lastSentAt==null?null:{round:r.round,sentAt:r.lastSentAt,decision:r.lastDecision,openCount:r.lastOpenCount??null},resolveAllOpen:j,resolvingAll:A.isPending}}var EE=[`plans`];async function DE(){let e=await fetch(`/api/plans`);if(!e.ok)return[];let t=await e.json();return Array.isArray(t)?t:[]}function OE(){let e=Re(),{data:t=[],isLoading:n}=$e({queryKey:EE,queryFn:DE});(0,q.useEffect)(()=>gE(`plans`,()=>{e.invalidateQueries({queryKey:EE})}),[e]);let[r,i]=(0,q.useState)({round:0,waiters:0,lastDecidedAt:null});(0,q.useEffect)(()=>{let e=!1;fetch(`/api/plan-review/status`).then(e=>e.json()).then(t=>{e||i(t)}).catch(()=>{});let t=gE(`plan-review-status`,e=>{try{i(JSON.parse(e))}catch{}});return()=>{e=!0,t()}},[]);let a=(0,q.useRef)(null),[o,s]=(0,q.useState)(null);(0,q.useEffect)(()=>{if(n)return;let e=a.current===null;a.current===null&&(a.current=new Set);let r=a.current,i=null;for(let n of t)for(let t of n.comments??[])for(let a of t.replies??[])r.has(a.id)||(r.add(a.id),!e&&t.status!==`resolved`&&(a.role===`agent`||a.role==null&&a.model)&&(!i||a.createdAt>i.at)&&(i={at:a.createdAt,planId:n.id,commentId:t.id,model:a.model,body:a.body}));i&&s(i)},[t,n]);let c=(0,q.useCallback)(t=>{e.setQueryData(EE,(e=[])=>e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[...e,t])},[e]),l=et({mutationFn:async({planId:e,...t})=>(await fetch(`/api/plans/${e}/comments`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})).json(),onSuccess:c}),u=et({mutationFn:async({planId:e,commentId:t,body:n,status:r})=>(await fetch(`/api/plans/${e}/comments/${t}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:n,status:r})})).json(),onSuccess:c}),d=et({mutationFn:async({planId:e,commentId:t})=>(await fetch(`/api/plans/${e}/comments/${t}`,{method:`DELETE`})).json(),onSuccess:c}),f=et({mutationFn:async({planId:e,commentId:t,body:n})=>(await fetch(`/api/plans/${e}/comments/${t}/replies`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:n,role:`user`})})).json(),onSuccess:c}),p=et({mutationFn:async({planId:e,commentId:t,replyId:n,body:r})=>(await fetch(`/api/plans/${e}/comments/${t}/replies/${n}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:r})})).json(),onSuccess:c}),m=et({mutationFn:async({planId:e,commentId:t,replyId:n})=>(await fetch(`/api/plans/${e}/comments/${t}/replies/${n}`,{method:`DELETE`})).json(),onSuccess:c}),h=et({mutationFn:async({planId:e,decision:t,decisionComment:n,mode:r})=>{let i=await fetch(`/api/plans/${e}/decision`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({decision:t,decisionComment:n?.trim()||void 0,mode:r})});if(!i.ok)throw Error(`Failed to submit plan decision`);return i.json()},onSuccess:()=>e.invalidateQueries({queryKey:EE})}),g=et({mutationFn:async e=>(await fetch(`/api/plans/${e}`,{method:`DELETE`}),e),onSuccess:t=>{e.setQueryData(EE,(e=[])=>e.filter(e=>e.id!==t))}}),_=et({mutationFn:async({planId:e,title:t,body:n,source:r,model:i})=>{let a=await fetch(`/api/plans/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:t,body:n,source:r,model:i})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(typeof e.error==`string`?e.error:`Failed to update plan (${a.status})`)}return a.json()},onSuccess:c}),v=et({mutationFn:async({planId:e,title:t,body:n,source:r,model:i})=>{let a=await fetch(`/api/plans`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:e,title:t,body:n,source:r,model:i})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(typeof e.error==`string`?e.error:`Failed to save plan version (${a.status})`)}return a.json()},onSuccess:c});return{plans:t,getPlan:(0,q.useCallback)(e=>t.find(t=>t.id===e)??null,[t]),addPlanComment:(0,q.useCallback)(e=>l.mutate(e),[l.mutate]),editPlanComment:(0,q.useCallback)((e,t,n)=>u.mutate({planId:e,commentId:t,body:n}),[u.mutate]),resolvePlanComment:(0,q.useCallback)((e,t)=>u.mutate({planId:e,commentId:t,status:`resolved`}),[u.mutate]),unresolvePlanComment:(0,q.useCallback)((e,t)=>u.mutate({planId:e,commentId:t,status:`open`}),[u.mutate]),removePlanComment:(0,q.useCallback)((e,t)=>d.mutate({planId:e,commentId:t}),[d.mutate]),addPlanReply:(0,q.useCallback)((e,t,n)=>f.mutate({planId:e,commentId:t,body:n}),[f.mutate]),editPlanReply:(0,q.useCallback)((e,t,n,r)=>p.mutate({planId:e,commentId:t,replyId:n,body:r}),[p.mutate]),removePlanReply:(0,q.useCallback)((e,t,n)=>m.mutate({planId:e,commentId:t,replyId:n}),[m.mutate]),removePlan:(0,q.useCallback)(e=>g.mutate(e),[g.mutate]),updatePlan:(0,q.useCallback)((e,t)=>_.mutateAsync({planId:e,...t}),[_.mutateAsync]),submitPlanVersion:(0,q.useCallback)((e,t)=>v.mutateAsync({planId:e,...t}),[v.mutateAsync]),updatingPlan:_.isPending,submittingPlanVersion:v.isPending,submitDecision:(0,q.useCallback)((e,t,n,r)=>h.mutateAsync({planId:e,decision:t,decisionComment:n,mode:r}),[h.mutateAsync]),submitting:h.isPending,agentWaiting:r.waiters>0,agentActivity:o,clearAgentActivity:(0,q.useCallback)(()=>s(null),[]),isLoading:n}}var kE=new Set;function AE(){for(let e of kE)e()}function jE(e,t={}){let n=cE(e);n!==window.location.pathname+window.location.search&&(t.replace?window.history.replaceState(null,``,n):window.history.pushState(null,``,n),AE())}function ME(e){return kE.add(e),window.addEventListener(`popstate`,e),()=>{kE.delete(e),window.removeEventListener(`popstate`,e)}}function NE(){return window.location.pathname}function PE(){return`/`}function FE(){return(0,q.useSyncExternalStore)(ME,NE,PE)}function IE(e){let[t,n]=(0,q.useState)({inMerge:!1,conflicts:[]}),r=(0,q.useCallback)(()=>{fetch(`/api/merge-status`).then(e=>e.ok?e.json():{inMerge:!1,conflicts:[]}).then(n).catch(()=>n({inMerge:!1,conflicts:[]}))},[]);return(0,q.useEffect)(()=>{r()},[r,e]),{status:t,refresh:r}}var LE={defaultMode:`web`,staged:!0,untracked:!0,diffStyle:`split`,defaultTabSize:4,theme:`rose-pine`,editorIDE:`default`,lineDiffType:`word`,lineWrap:!1,diffIndicators:`classic`,showLineNumbers:!0,hunkSeparators:`line-info`,lineHoverHighlight:`both`,fontSize:13,expandContextByDefault:!1,collapsedContextThreshold:10,expansionLineCount:20,haptics:!0,sounds:!0,uiFont:null,monoFont:null,density:`comfortable`,autoCollapseLineThreshold:400,requireViewAllBeforeSend:!1,showStatusBar:!0,savedReplies:[],ignoreSpaceChange:!1,ignoreAllSpace:!1},RE=`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;function zE(e){return e?`"${e}", ${RE}`:`"JetBrains Mono", ${RE}`}function BE(){let[e,t]=(0,q.useState)(LE),[n,r]=(0,q.useState)(!1),i=(0,q.useRef)(!0);return(0,q.useEffect)(()=>{fetch(`/api/settings`).then(e=>e.json()).then(e=>{i.current=!0,t({...LE,...e}),r(!0)}).catch(()=>r(!0))},[]),(0,q.useEffect)(()=>{if(i.current){i.current=!1;return}let t=setTimeout(()=>{fetch(`/api/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}).catch(()=>{})},300);return()=>clearTimeout(t)},[e]),{settings:e,loaded:n,updateSettings:(0,q.useCallback)(e=>{t(t=>({...t,...e}))},[])}}function VE(e,t,n){(0,q.useEffect)(()=>{let r=`, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;if(!e)return;let i=`gfonts-preconnect`,a=`gfonts-preconnect-static`,o=`gfonts-link`,s=`diffing-fonts-override`,c=()=>{if(!document.getElementById(i)){let e=document.createElement(`link`);e.id=i,e.rel=`preconnect`,e.href=`https://fonts.googleapis.com`,document.head.appendChild(e)}if(!document.getElementById(a)){let e=document.createElement(`link`);e.id=a,e.rel=`preconnect`,e.href=`https://fonts.gstatic.com`,e.crossOrigin=`anonymous`,document.head.appendChild(e)}},l=e=>encodeURIComponent(e.trim()).replace(/%20/g,`+`),u=t?.trim()?l(t):`Geist+Mono:ital,wght@0,100..900;1,100..900`,d=n?.trim()?l(n):`JetBrains+Mono:ital,wght@0,100..800;1,100..800`,f=[...new Set([u,d].filter(Boolean))];c();let p=`https://fonts.googleapis.com/css2?family=${f.join(`&family=`)}&display=swap`,m=document.getElementById(o);m||(m=document.createElement(`link`),m.id=o,m.rel=`stylesheet`,document.head.appendChild(m)),m.getAttribute(`href`)!==p&&m.setAttribute(`href`,p);let h=document.getElementById(s);h||(h=document.createElement(`style`),h.id=s,document.head.appendChild(h));let g=t?`"${t}"`:`"Geist Mono"`,_=n?`"${n}"`:`"JetBrains Mono"`;return h.innerHTML=`
1883
1883
  :root {
1884
1884
  --font-sans: ${g}${r} !important;
1885
1885
  --font-mono: ${_}${r} !important;
@@ -1929,7 +1929,7 @@ XID_Start XIDS`.split(/\s/).map(e=>[jl(e),e])),Tu=new Map([[`s`,lu(383)],[lu(383
1929
1929
  `},l]}}var Yz=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Xz=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),Zz=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),Qz=[...Xz,...Zz],$z=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),eB=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),tB=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),nB=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse(),rB=eB.concat(tB).sort().reverse();function iB(e){let t=Yz(e),n=rB,r=`[\\w-]+`,i=`(`+r+`|@\\{[\\w-]+\\})`,a=[],o=[],s=function(e){return{className:`string`,begin:`~?`+e+`.*?`+e}},c=function(e,t,n){return{className:e,begin:t,relevance:n}},l={$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:$z.join(` `)},u={begin:`\\(`,end:`\\)`,contains:o,keywords:l,relevance:0};o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s(`'`),s(`"`),t.CSS_NUMBER_MODE,{begin:`(url|data-uri)\\(`,starts:{className:`string`,end:`[\\)\\n]`,excludeEnd:!0}},t.HEXCOLOR,u,c(`variable`,`@@?`+r,10),c(`variable`,`@\\{`+r+`\\}`),c(`built_in`,"~?`[^`]*?`"),{className:`attribute`,begin:r+`\\s*:`,end:`:`,returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:`and not`},t.FUNCTION_DISPATCH);let d=o.concat({begin:/\{/,end:/\}/,contains:a}),f={beginKeywords:`when`,endsWithParent:!0,contains:[{beginKeywords:`and not`}].concat(o)},p={begin:i+`\\s*:`,returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+nB.join(`|`)+`)\\b`,end:/(?=:)/,starts:{endsWithParent:!0,illegal:`[<=$]`,relevance:0,contains:o}}]},m={className:`keyword`,begin:`@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b`,starts:{end:`[;{}]`,keywords:l,returnEnd:!0,contains:o,relevance:0}},h={className:`variable`,variants:[{begin:`@`+r+`\\s*:`,relevance:15},{begin:`@`+r}],starts:{end:`[;}]`,returnEnd:!0,contains:d}},g={variants:[{begin:`[\\.#:&\\[>]`,end:`[;{}]`},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,f,c(`keyword`,`all\\b`),c(`variable`,`@\\{`+r+`\\}`),{begin:`\\b(`+Qz.join(`|`)+`)\\b`,className:`selector-tag`},t.CSS_NUMBER_MODE,c(`selector-tag`,i,0),c(`selector-id`,`#`+i),c(`selector-class`,`\\.`+i,0),c(`selector-tag`,`&`,0),t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,begin:`:(`+eB.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+tB.join(`|`)+`)`},{begin:/\(/,end:/\)/,relevance:0,contains:d},{begin:`!important`},t.FUNCTION_DISPATCH]},_={begin:`[\\w-]+:(:)?(${n.join(`|`)})`,returnBegin:!0,contains:[g]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,m,h,_,p,g,f,t.FUNCTION_DISPATCH),{name:`Less`,case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function aB(e){let t=`\\[=*\\[`,n=`\\]=*\\]`,r={begin:t,end:n,contains:[`self`]},i=[e.COMMENT(`--(?!`+t+`)`,`$`),e.COMMENT(`--`+t,n,{contains:[r],relevance:10})];return{name:`Lua`,aliases:[`pluto`],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:`true false nil`,keyword:`and break do else elseif end for goto if in local not or repeat return then until while`,built_in:`_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove`},contains:i.concat([{className:`function`,beginKeywords:`function`,end:`\\)`,contains:[e.inherit(e.TITLE_MODE,{begin:`([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*`}),{className:`params`,begin:`\\(`,endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:`string`,begin:t,end:n,contains:[r],relevance:5}])}}function oB(e){let t={className:`variable`,variants:[{begin:`\\$\\(`+e.UNDERSCORE_IDENT_RE+`\\)`,contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:`variable`,begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:`subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value`},contains:[t,n]},i={begin:`^`+e.UNDERSCORE_IDENT_RE+`\\s*(?=[:+?]?=)`},a={className:`meta`,begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:`.PHONY`}},o={className:`section`,begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:`Makefile`,aliases:[`mk`,`mak`,`make`],keywords:{$pattern:/[\w-]+/,keyword:`define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath`},contains:[e.HASH_COMMENT_MODE,t,n,r,i,a,o]}}function sB(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:`>`,subLanguage:`xml`,relevance:0},r={begin:`^[-\\*]{3,}`,end:`$`},i={className:`code`,variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:`(~{3,})[^~](.|\\n)*?\\1~*[ ]*`},{begin:"```",end:"```+[ ]*$"},{begin:`~~~`,end:`~~~+[ ]*$`},{begin:"`.+?`"},{begin:`(?=^( {4}|\\t))`,contains:[{begin:`^( {4}|\\t)`,end:`(\\n)$`}],relevance:0}]},a={className:`bullet`,begin:`^[ ]*([*+-]|(\\d+\\.))(?=\\s+)`,end:`\\s+`,excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:`symbol`,begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:`link`,begin:/:\s*/,end:/$/,excludeBegin:!0}]},s={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:`string`,relevance:0,begin:`\\[`,end:`\\]`,excludeBegin:!0,returnEnd:!0},{className:`link`,relevance:0,begin:`\\]\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0},{className:`symbol`,relevance:0,begin:`\\]\\[`,end:`\\]`,excludeBegin:!0,excludeEnd:!0}]},c={className:`strong`,contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},l={className:`emphasis`,contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=e.inherit(c,{contains:[]}),d=e.inherit(l,{contains:[]});c.contains.push(d),l.contains.push(u);let f=[n,s];return[c,l,u,d].forEach(e=>{e.contains=e.contains.concat(f)}),f=f.concat(c,l),{name:`Markdown`,aliases:[`md`,`mkdown`,`mkd`],contains:[{className:`section`,variants:[{begin:`^#{1,6}`,end:`$`,contains:f},{begin:`(?=^.+?\\n[=-]{2,}$)`,contains:[{begin:`^[=-]*$`},{begin:`^`,end:`\\n`,contains:f}]}]},n,a,c,l,{className:`quote`,begin:`^>\\s+`,contains:f,end:`$`},i,r,s,o,{scope:`literal`,match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function cB(e){let t={className:`built_in`,begin:`\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+`},n=/[a-zA-Z@][a-zA-Z0-9_]*/,r=[`int`,`float`,`char`,`unsigned`,`signed`,`short`,`long`,`double`,`wchar_t`,`unichar`,`void`,`bool`,`BOOL`,`id|0`,`_Bool`],i=`while.export.sizeof.typedef.const.struct.for.union.volatile.static.mutable.if.do.return.goto.enum.else.break.extern.asm.case.default.register.explicit.typename.switch.continue.inline.readonly.assign.readwrite.self.@synchronized.id.typeof.nonatomic.IBOutlet.IBAction.strong.weak.copy.in.out.inout.bycopy.byref.oneway.__strong.__weak.__block.__autoreleasing.@private.@protected.@public.@try.@property.@end.@throw.@catch.@finally.@autoreleasepool.@synthesize.@dynamic.@selector.@optional.@required.@encode.@package.@import.@defs.@compatibility_alias.__bridge.__bridge_transfer.__bridge_retained.__bridge_retain.__covariant.__contravariant.__kindof._Nonnull._Nullable._Null_unspecified.__FUNCTION__.__PRETTY_FUNCTION__.__attribute__.getter.setter.retain.unsafe_unretained.nonnull.nullable.null_unspecified.null_resettable.class.instancetype.NS_DESIGNATED_INITIALIZER.NS_UNAVAILABLE.NS_REQUIRES_SUPER.NS_RETURNS_INNER_POINTER.NS_INLINE.NS_AVAILABLE.NS_DEPRECATED.NS_ENUM.NS_OPTIONS.NS_SWIFT_UNAVAILABLE.NS_ASSUME_NONNULL_BEGIN.NS_ASSUME_NONNULL_END.NS_REFINED_FOR_SWIFT.NS_SWIFT_NAME.NS_SWIFT_NOTHROW.NS_DURING.NS_HANDLER.NS_ENDHANDLER.NS_VALUERETURN.NS_VOIDRETURN`.split(`.`),a=[`false`,`true`,`FALSE`,`TRUE`,`nil`,`YES`,`NO`,`NULL`],o=[`dispatch_once_t`,`dispatch_queue_t`,`dispatch_sync`,`dispatch_async`,`dispatch_once`],s={"variable.language":[`this`,`super`],$pattern:n,keyword:i,literal:a,built_in:o,type:r},c={$pattern:n,keyword:[`@interface`,`@class`,`@protocol`,`@implementation`]};return{name:`Objective-C`,aliases:[`mm`,`objc`,`obj-c`,`obj-c++`,`objective-c++`],keywords:s,illegal:`</`,contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:`string`,variants:[{begin:`@"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]}]},{className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),{className:`string`,begin:/<.*?>/,end:/$/,illegal:`\\n`},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:`class`,begin:`(`+c.keyword.join(`|`)+`)\\b`,end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:`\\.`+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function lB(e){let t=e.regex,n=`abs.accept.alarm.and.atan2.bind.binmode.bless.break.caller.chdir.chmod.chomp.chop.chown.chr.chroot.class.close.closedir.connect.continue.cos.crypt.dbmclose.dbmopen.defined.delete.die.do.dump.each.else.elsif.endgrent.endhostent.endnetent.endprotoent.endpwent.endservent.eof.eval.exec.exists.exit.exp.fcntl.field.fileno.flock.for.foreach.fork.format.formline.getc.getgrent.getgrgid.getgrnam.gethostbyaddr.gethostbyname.gethostent.getlogin.getnetbyaddr.getnetbyname.getnetent.getpeername.getpgrp.getpriority.getprotobyname.getprotobynumber.getprotoent.getpwent.getpwnam.getpwuid.getservbyname.getservbyport.getservent.getsockname.getsockopt.given.glob.gmtime.goto.grep.gt.hex.if.index.int.ioctl.join.keys.kill.last.lc.lcfirst.length.link.listen.local.localtime.log.lstat.lt.ma.map.method.mkdir.msgctl.msgget.msgrcv.msgsnd.my.ne.next.no.not.oct.open.opendir.or.ord.our.pack.package.pipe.pop.pos.print.printf.prototype.push.q|0.qq.quotemeta.qw.qx.rand.read.readdir.readline.readlink.readpipe.recv.redo.ref.rename.require.reset.return.reverse.rewinddir.rindex.rmdir.say.scalar.seek.seekdir.select.semctl.semget.semop.send.setgrent.sethostent.setnetent.setpgrp.setpriority.setprotoent.setpwent.setservent.setsockopt.shift.shmctl.shmget.shmread.shmwrite.shutdown.sin.sleep.socket.socketpair.sort.splice.split.sprintf.sqrt.srand.stat.state.study.sub.substr.symlink.syscall.sysopen.sysread.sysseek.system.syswrite.tell.telldir.tie.tied.time.times.tr.truncate.uc.ucfirst.umask.undef.unless.unlink.unpack.unshift.untie.until.use.utime.values.vec.wait.waitpid.wantarray.warn.when.while.write.x|0.xor.y|0`.split(`.`),r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(` `)},a={className:`subst`,begin:`[$@]\\{`,end:`\\}`,keywords:i},o={begin:/->\{/,end:/\}/},s={scope:`attr`,match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:`variable`,variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,`(?![A-Za-z])(?![@$%])`)},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[s]},l={className:`number`,variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[e.BACKSLASH_ESCAPE,a,c],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(e,n,i=`\\1`)=>{let a=i===`\\1`?i:t.concat(i,n);return t.concat(t.concat(`(?:`,e,`)`),n,/(?:\\.|[^\\\/])*?/,a,/(?:\\.|[^\\\/])*?/,i,r)},p=(e,n,i)=>t.concat(t.concat(`(?:`,e,`)`),n,/(?:\\.|[^\\\/])*?/,i,r),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:`string`,contains:u,variants:[{begin:`q[qwxr]?\\s*\\(`,end:`\\)`,relevance:5},{begin:`q[qwxr]?\\s*\\[`,end:`\\]`,relevance:5},{begin:`q[qwxr]?\\s*\\{`,end:`\\}`,relevance:5},{begin:`q[qwxr]?\\s*\\|`,end:`\\|`,relevance:5},{begin:`q[qwxr]?\\s*<`,end:`>`,relevance:5},{begin:`qw\\s+q`,end:`q`,relevance:5},{begin:`'`,end:`'`,contains:[e.BACKSLASH_ESCAPE]},{begin:`"`,end:`"`},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:`-?\\w+\\s*=>`,relevance:0}]},l,{begin:`(\\/\\/|`+e.RE_STARTERS_RE+`|\\b(split|return|print|reverse|grep)\\b)\\s*`,keywords:`split return print reverse grep`,relevance:0,contains:[e.HASH_COMMENT_MODE,{className:`regexp`,variants:[{begin:f(`s|tr|y`,t.either(...d,{capture:!0}))},{begin:f(`s|tr|y`,`\\(`,`\\)`)},{begin:f(`s|tr|y`,`\\[`,`\\]`)},{begin:f(`s|tr|y`,`\\{`,`\\}`)}],relevance:2},{className:`regexp`,variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p(`(?:m|qr)?`,/\//,/\//)},{begin:p(`m|qr`,t.either(...d,{capture:!0}),/\1/)},{begin:p(`m|qr`,/\(/,/\)/)},{begin:p(`m|qr`,/\[/,/\]/)},{begin:p(`m|qr`,/\{/,/\}/)}]}]},{className:`function`,beginKeywords:`sub method`,end:`(\\s*\\(.*?\\))?[;{]`,excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s]},{className:`class`,beginKeywords:`class`,end:`[;{]`,excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s,l]},{begin:`-\\w\\b`,relevance:0},{begin:`^__DATA__$`,end:`^__END__$`,subLanguage:`mojolicious`,contains:[{begin:`^@@.*`,end:`$`,className:`comment`}]}];return a.contains=m,o.contains=m,{name:`Perl`,aliases:[`pl`,`pm`],keywords:i,contains:m}}function uB(e){let t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),a=t.concat(/[A-Z]+/,n),o={scope:`variable`,match:`\\$+`+r},s={scope:`meta`,variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:`subst`,variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},l=e.inherit(e.APOS_STRING_MODE,{illegal:null}),u=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(e,t)=>{t.data._beginMatch=e[1]||e[2]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}},f=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
1930
1930
  ]`,m={scope:`string`,variants:[u,l,d,f]},h={scope:`number`,variants:[{begin:`\\b0[bB][01]+(?:_[01]+)*\\b`},{begin:`\\b0[oO][0-7]+(?:_[0-7]+)*\\b`},{begin:`\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b`},{begin:`(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?`}],relevance:0},g=[`false`,`null`,`true`],_=`__CLASS__.__DIR__.__FILE__.__FUNCTION__.__COMPILER_HALT_OFFSET__.__LINE__.__METHOD__.__NAMESPACE__.__TRAIT__.die.echo.exit.include.include_once.print.require.require_once.array.abstract.and.as.binary.bool.boolean.break.callable.case.catch.class.clone.const.continue.declare.default.do.double.else.elseif.empty.enddeclare.endfor.endforeach.endif.endswitch.endwhile.enum.eval.extends.final.finally.float.for.foreach.from.global.goto.if.implements.instanceof.insteadof.int.integer.interface.isset.iterable.list.match|0.mixed.new.never.object.or.private.protected.public.readonly.real.return.string.switch.throw.trait.try.unset.use.var.void.while.xor.yield`.split(`.`),v=`Error|0.AppendIterator.ArgumentCountError.ArithmeticError.ArrayIterator.ArrayObject.AssertionError.BadFunctionCallException.BadMethodCallException.CachingIterator.CallbackFilterIterator.CompileError.Countable.DirectoryIterator.DivisionByZeroError.DomainException.EmptyIterator.ErrorException.Exception.FilesystemIterator.FilterIterator.GlobIterator.InfiniteIterator.InvalidArgumentException.IteratorIterator.LengthException.LimitIterator.LogicException.MultipleIterator.NoRewindIterator.OutOfBoundsException.OutOfRangeException.OuterIterator.OverflowException.ParentIterator.ParseError.RangeException.RecursiveArrayIterator.RecursiveCachingIterator.RecursiveCallbackFilterIterator.RecursiveDirectoryIterator.RecursiveFilterIterator.RecursiveIterator.RecursiveIteratorIterator.RecursiveRegexIterator.RecursiveTreeIterator.RegexIterator.RuntimeException.SeekableIterator.SplDoublyLinkedList.SplFileInfo.SplFileObject.SplFixedArray.SplHeap.SplMaxHeap.SplMinHeap.SplObjectStorage.SplObserver.SplPriorityQueue.SplQueue.SplStack.SplSubject.SplTempFileObject.TypeError.UnderflowException.UnexpectedValueException.UnhandledMatchError.ArrayAccess.BackedEnum.Closure.Fiber.Generator.Iterator.IteratorAggregate.Serializable.Stringable.Throwable.Traversable.UnitEnum.WeakReference.WeakMap.Directory.__PHP_Incomplete_Class.parent.php_user_filter.self.static.stdClass`.split(`.`),y={keyword:_,literal:(e=>{let t=[];return e.forEach(e=>{t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase())}),t})(g),built_in:v},b=e=>e.map(e=>e.replace(/\|\d+$/,``)),x={variants:[{match:[/new/,t.concat(p,`+`),t.concat(`(?!`,b(v).join(`\\b|`),`\\b)`),i],scope:{1:`keyword`,4:`title.class`}}]},S=t.concat(r,`\\b(?!\\()`),C={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{2:`variable.constant`}},{match:[/::/,/class/],scope:{2:`variable.language`}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{1:`title.class`,3:`variable.constant`}},{match:[i,t.concat(`::`,t.lookahead(/(?!class\b)/))],scope:{1:`title.class`}},{match:[i,/::/,/class/],scope:{1:`title.class`,3:`variable.language`}}]},w={scope:`attr`,match:t.concat(r,t.lookahead(`:`),t.lookahead(/(?!::)/))},T={relevance:0,begin:/\(/,end:/\)/,keywords:y,contains:[w,o,C,e.C_BLOCK_COMMENT_MODE,m,h,x]},E={relevance:0,match:[/\b/,t.concat(`(?!fn\\b|function\\b|`,b(_).join(`\\b|`),`|`,b(v).join(`\\b|`),`\\b)`),r,t.concat(p,`*`),t.lookahead(/(?=\()/)],scope:{3:`title.function.invoke`},contains:[T]};T.contains.push(E);let D=[w,C,e.C_BLOCK_COMMENT_MODE,m,h,x],O={begin:t.concat(/#\[\s*\\?/,t.either(i,a)),beginScope:`meta`,end:/]/,endScope:`meta`,keywords:{literal:g,keyword:[`new`,`array`]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:[`new`,`array`]},contains:[`self`,...D]},...D,{scope:`meta`,variants:[{match:i},{match:a}]}]};return{case_insensitive:!1,keywords:y,contains:[O,e.HASH_COMMENT_MODE,e.COMMENT(`//`,`$`),e.COMMENT(`/\\*`,`\\*/`,{contains:[{scope:`doctag`,match:`@[A-Za-z]+`}]}),{match:/__halt_compiler\(\);/,keywords:`__halt_compiler`,starts:{scope:`comment`,end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:`meta`,endsParent:!0}]}},s,{scope:`variable.language`,match:/\$this\b/},o,E,C,{match:[/const/,/\s/,r],scope:{1:`keyword`,3:`variable.constant`}},x,{scope:`function`,relevance:0,beginKeywords:`fn function`,end:/[;{]/,excludeEnd:!0,illegal:`[$%\\[]`,contains:[{beginKeywords:`use`},e.UNDERSCORE_TITLE_MODE,{begin:`=>`,endsParent:!0},{scope:`params`,begin:`\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0,keywords:y,contains:[`self`,O,o,C,e.C_BLOCK_COMMENT_MODE,m,h]}]},{scope:`class`,variants:[{beginKeywords:`enum`,illegal:/[($"]/},{beginKeywords:`class interface trait`,illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:`extends implements`},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:`namespace`,relevance:0,end:`;`,illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:`title.class`})]},{beginKeywords:`use`,relevance:0,end:`;`,contains:[{match:/\b(as|const|function)\b/,scope:`keyword`},e.UNDERSCORE_TITLE_MODE]},m,h]}}function dB(e){return{name:`PHP template`,subLanguage:`xml`,contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:`php`,contains:[{begin:`/\\*`,end:`\\*/`,skip:!0},{begin:`b"`,end:`"`,skip:!0},{begin:`b'`,end:`'`,skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function fB(e){return{name:`Plain text`,aliases:[`text`,`txt`],disableAutodetect:!0}}function pB(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.all.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}function mB(e){return{aliases:[`pycon`],contains:[{className:`meta.prompt`,starts:{end:/ |$/,starts:{end:`$`,subLanguage:`python`}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function hB(e){let t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,a=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:`R`,keywords:{$pattern:n,keyword:`function if in break next repeat else for while`,literal:`NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10`,built_in:`LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm`},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:`doctag`,match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:`doctag`,begin:`@param`,end:/$/,contains:[{scope:`variable`,variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:`doctag`,match:/@[a-zA-Z]+/},{scope:`keyword`,match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:`"`,end:`"`,relevance:0},{begin:`'`,end:`'`,relevance:0}]},{relevance:0,variants:[{scope:{1:`operator`,2:`number`},match:[i,r]},{scope:{1:`operator`,2:`number`},match:[/%[^%]*%/,r]},{scope:{1:`punctuation`,2:`number`},match:[a,r]},{scope:{2:`number`},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:`operator`},match:[n,/\s+/,/<-/,/\s+/]},{scope:`operator`,relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:`punctuation`,relevance:0,match:a},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function gB(e){let t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(r,/(::\w+)*/),a=[`include`,`extend`,`prepend`,`public`,`private`,`protected`,`raise`,`throw`],o={"variable.constant":[`__FILE__`,`__LINE__`,`__ENCODING__`],"variable.language":[`self`,`super`],keyword:[`alias`,`and`,`begin`,`BEGIN`,`break`,`case`,`class`,`defined`,`do`,`else`,`elsif`,`end`,`END`,`ensure`,`for`,`if`,`in`,`module`,`next`,`not`,`or`,`redo`,`require`,`rescue`,`retry`,`return`,`then`,`undef`,`unless`,`until`,`when`,`while`,`yield`,...a],built_in:[`proc`,`lambda`,`attr_accessor`,`attr_reader`,`attr_writer`,`define_method`,`private_constant`,`module_function`],literal:[`true`,`false`,`nil`]},s={className:`doctag`,begin:`@[A-Za-z]+`},c={begin:`#<`,end:`>`},l=[e.COMMENT(`#`,`$`,{contains:[s]}),e.COMMENT(`^=begin`,`^=end`,{contains:[s],relevance:10}),e.COMMENT(`^__END__`,e.MATCH_NOTHING_RE)],u={className:`subst`,begin:/#\{/,end:/\}/,keywords:o},d={className:`string`,contains:[e.BACKSLASH_ESCAPE,u],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,u]})]}]},f=`[0-9](_?[0-9])*`,p={className:`number`,relevance:0,variants:[{begin:`\\b([1-9](_?[0-9])*|0)(\\.(${f}))?([eE][+-]?(${f})|r)?i?\\b`},{begin:`\\b0[dD][0-9](_?[0-9])*r?i?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*r?i?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*r?i?\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b`},{begin:`\\b0(_?[0-7])+r?i?\\b`}]},m={variants:[{match:/\(\)/},{className:`params`,begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},h={match:[/(include|extend)\s+/,i],scope:{2:`title.class`},keywords:o},g={variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:`title.class`,4:`title.class.inherited`},keywords:o},_={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`},v={match:[/def/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},y=[d,g,h,{relevance:0,match:[i,/\.new[. (]/],scope:{1:`title.class`}},_,{relevance:0,match:r,scope:`title.class`},v,{begin:e.IDENT_RE+`::`},{className:`symbol`,begin:e.UNDERSCORE_IDENT_RE+`(!|\\?)?:`,relevance:0},{className:`symbol`,begin:`:(?!\\s)`,contains:[d,{begin:n}],relevance:0},p,{className:`variable`,begin:`(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])`},{className:`params`,begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:`(`+e.RE_STARTERS_RE+`|unless)\\s*`,keywords:`unless`,contains:[{className:`regexp`,contains:[e.BACKSLASH_ESCAPE,u],illegal:/\n/,variants:[{begin:`/`,end:`/[a-z]*`},{begin:/%r\{/,end:/\}[a-z]*/},{begin:`%r\\(`,end:`\\)[a-z]*`},{begin:`%r!`,end:`![a-z]*`},{begin:`%r\\[`,end:`\\][a-z]*`}]}].concat(c,l),relevance:0}].concat(c,l);u.contains=y,m.contains=y;let b=[{begin:/^\s*=>/,starts:{end:`$`,contains:y}},{className:`meta.prompt`,begin:`^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])`,starts:{end:`$`,keywords:o,contains:y}}];return l.unshift(c),{name:`Ruby`,aliases:[`rb`,`gemspec`,`podspec`,`thor`,`irb`],keywords:o,illegal:/\/\*/,contains:[e.SHEBANG({binary:`ruby`})].concat(b,l,y)}}function _B(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),a={className:`title.function.invoke`,relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},o=`([ui](8|16|32|64|128|size)|f(32|64))?`,s=`abstract.as.async.await.become.box.break.const.continue.crate.do.dyn.else.enum.extern.false.final.fn.for.if.impl.in.let.loop.macro.match.mod.move.mut.override.priv.pub.ref.return.self.Self.static.struct.super.trait.true.try.type.typeof.union.unsafe.unsized.use.virtual.where.while.yield`.split(`.`),c=[`true`,`false`,`Some`,`None`,`Ok`,`Err`],l=`drop .Copy.Send.Sized.Sync.Drop.Fn.FnMut.FnOnce.ToOwned.Clone.Debug.PartialEq.PartialOrd.Eq.Ord.AsRef.AsMut.Into.From.Default.Iterator.Extend.IntoIterator.DoubleEndedIterator.ExactSizeIterator.SliceConcatExt.ToString.assert!.assert_eq!.bitflags!.bytes!.cfg!.col!.concat!.concat_idents!.debug_assert!.debug_assert_eq!.env!.eprintln!.panic!.file!.format!.format_args!.include_bytes!.include_str!.line!.local_data_key!.module_path!.option_env!.print!.println!.select!.stringify!.try!.unimplemented!.unreachable!.vec!.write!.writeln!.macro_rules!.assert_ne!.debug_assert_ne!`.split(`.`),u=[`i8`,`i16`,`i32`,`i64`,`i128`,`isize`,`u8`,`u16`,`u32`,`u64`,`u128`,`usize`,`f32`,`f64`,`str`,`char`,`bool`,`Box`,`Option`,`Result`,`String`,`Vec`];return{name:`Rust`,aliases:[`rs`],keywords:{$pattern:e.IDENT_RE+`!?`,type:u,keyword:s,literal:c,built_in:l},illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:`symbol`,begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:`string`,variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:`char.escape`,match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:`number`,variants:[{begin:`\\b0b([01_]+)`+o},{begin:`\\b0o([0-7_]+)`+o},{begin:`\\b0x([A-Fa-f0-9_]+)`+o},{begin:`\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)`+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:`keyword`,3:`title.function`}},{className:`meta`,begin:`#!?\\[`,end:`\\]`,contains:[{className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:`keyword`,3:`keyword`,4:`variable`}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:`keyword`,3:`variable`,5:`keyword`}},{begin:[/type/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:e.IDENT_RE+`::`,keywords:{keyword:`Self`,built_in:l,type:u}},{className:`punctuation`,begin:`->`},a]}}var vB=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),yB=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),bB=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),xB=[...yB,...bB],SB=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),CB=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),wB=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),TB=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function EB(e){let t=vB(e),n=wB,r=CB,i=`@[a-z-]+`,a={className:`variable`,begin:`(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b`,relevance:0};return{name:`SCSS`,case_insensitive:!0,illegal:`[=/|']`,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:`selector-id`,begin:`#[A-Za-z0-9_-]+`,relevance:0},{className:`selector-class`,begin:`\\.[A-Za-z0-9_-]+`,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-tag`,begin:`\\b(`+xB.join(`|`)+`)\\b`,relevance:0},{className:`selector-pseudo`,begin:`:(`+r.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+n.join(`|`)+`)`},a,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+TB.join(`|`)+`)\\b`},{begin:`\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b`},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,a,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:`@(page|font-face)`,keywords:{$pattern:i,keyword:`@page @font-face`}},{begin:`@`,end:`[{;]`,returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:SB.join(` `)},contains:[{begin:i,className:`keyword`},{begin:/[a-z-]+(?=:)/,className:`attribute`},a,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function DB(e){return{name:`Shell Session`,aliases:[`console`,`shellsession`],contains:[{className:`meta.prompt`,begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:`bash`}}]}}function OB(e){let t=e.regex,n=e.COMMENT(`--`,`$`),r={scope:`string`,variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=[`true`,`false`,`unknown`],o=[`double precision`,`large object`,`with timezone`,`without timezone`],s=`bigint.binary.blob.boolean.char.character.clob.date.dec.decfloat.decimal.float.int.integer.interval.nchar.nclob.national.numeric.real.row.smallint.time.timestamp.varchar.varying.varbinary`.split(`.`),c=[`add`,`asc`,`collation`,`desc`,`final`,`first`,`last`,`view`],l=`abs.acos.all.allocate.alter.and.any.are.array.array_agg.array_max_cardinality.as.asensitive.asin.asymmetric.at.atan.atomic.authorization.avg.begin.begin_frame.begin_partition.between.bigint.binary.blob.boolean.both.by.call.called.cardinality.cascaded.case.cast.ceil.ceiling.char.char_length.character.character_length.check.classifier.clob.close.coalesce.collate.collect.column.commit.condition.connect.constraint.contains.convert.copy.corr.corresponding.cos.cosh.count.covar_pop.covar_samp.create.cross.cube.cume_dist.current.current_catalog.current_date.current_default_transform_group.current_path.current_role.current_row.current_schema.current_time.current_timestamp.current_path.current_role.current_transform_group_for_type.current_user.cursor.cycle.date.day.deallocate.dec.decimal.decfloat.declare.default.define.delete.dense_rank.deref.describe.deterministic.disconnect.distinct.double.drop.dynamic.each.element.else.empty.end.end_frame.end_partition.end-exec.equals.escape.every.except.exec.execute.exists.exp.external.extract.false.fetch.filter.first_value.float.floor.for.foreign.frame_row.free.from.full.function.fusion.get.global.grant.group.grouping.groups.having.hold.hour.identity.in.indicator.initial.inner.inout.insensitive.insert.int.integer.intersect.intersection.interval.into.is.join.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.language.large.last_value.lateral.lead.leading.left.like.like_regex.listagg.ln.local.localtime.localtimestamp.log.log10.lower.match.match_number.match_recognize.matches.max.member.merge.method.min.minute.mod.modifies.module.month.multiset.national.natural.nchar.nclob.new.no.none.normalize.not.nth_value.ntile.null.nullif.numeric.octet_length.occurrences_regex.of.offset.old.omit.on.one.only.open.or.order.out.outer.over.overlaps.overlay.parameter.partition.pattern.per.percent.percent_rank.percentile_cont.percentile_disc.period.portion.position.position_regex.power.precedes.precision.prepare.primary.procedure.ptf.range.rank.reads.real.recursive.ref.references.referencing.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.release.result.return.returns.revoke.right.rollback.rollup.row.row_number.rows.running.savepoint.scope.scroll.search.second.seek.select.sensitive.session_user.set.show.similar.sin.sinh.skip.smallint.some.specific.specifictype.sql.sqlexception.sqlstate.sqlwarning.sqrt.start.static.stddev_pop.stddev_samp.submultiset.subset.substring.substring_regex.succeeds.sum.symmetric.system.system_time.system_user.table.tablesample.tan.tanh.then.time.timestamp.timezone_hour.timezone_minute.to.trailing.translate.translate_regex.translation.treat.trigger.trim.trim_array.true.truncate.uescape.union.unique.unknown.unnest.update.upper.user.using.value.values.value_of.var_pop.var_samp.varbinary.varchar.varying.versioning.when.whenever.where.width_bucket.window.with.within.without.year`.split(`.`),u=`abs.acos.array_agg.asin.atan.avg.cast.ceil.ceiling.coalesce.corr.cos.cosh.count.covar_pop.covar_samp.cume_dist.dense_rank.deref.element.exp.extract.first_value.floor.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.last_value.lead.listagg.ln.log.log10.lower.max.min.mod.nth_value.ntile.nullif.percent_rank.percentile_cont.percentile_disc.position.position_regex.power.rank.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.row_number.sin.sinh.sqrt.stddev_pop.stddev_samp.substring.substring_regex.sum.tan.tanh.translate.translate_regex.treat.trim.trim_array.unnest.upper.value_of.var_pop.var_samp.width_bucket`.split(`.`),d=[`current_catalog`,`current_date`,`current_default_transform_group`,`current_path`,`current_role`,`current_schema`,`current_transform_group_for_type`,`current_user`,`session_user`,`system_time`,`system_user`,`current_time`,`localtime`,`current_timestamp`,`localtimestamp`],f=[`create table`,`insert into`,`primary key`,`foreign key`,`not null`,`alter table`,`add constraint`,`grouping sets`,`on overflow`,`character set`,`respect nulls`,`ignore nulls`,`nulls first`,`nulls last`,`depth first`,`breadth first`],p=u,m=[...l,...c].filter(e=>!u.includes(e)),h={scope:`variable`,match:/@[a-z0-9][a-z0-9_]*/},g={scope:`operator`,match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,`\\s+`))),/\b/)}let y={scope:`keyword`,match:v(f),relevance:0};function b(e,{exceptions:t,when:n}={}){let r=n;return t||=[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:r(e)?`${e}|0`:e)}return{name:`SQL`,case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:b(m,{when:e=>e.length<3}),literal:a,type:s,built_in:d},contains:[{scope:`type`,match:v(o)},y,_,h,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,g]}}function kB(e){return e?typeof e==`string`?e:e.source:null}function AB(e){return jB(`(?=`,e,`)`)}function jB(...e){return e.map(e=>kB(e)).join(``)}function MB(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function NB(...e){return`(`+(MB(e).capture?``:`?:`)+e.map(e=>kB(e)).join(`|`)+`)`}var PB=e=>jB(/\b/,e,/\w$/.test(e)?/\b/:/\B/),FB=[`Protocol`,`Type`].map(PB),IB=[`init`,`self`].map(PB),LB=[`Any`,`Self`],RB=[`actor`,`any`,`associatedtype`,`async`,`await`,/as\?/,/as!/,`as`,`borrowing`,`break`,`case`,`catch`,`class`,`consume`,`consuming`,`continue`,`convenience`,`copy`,`default`,`defer`,`deinit`,`didSet`,`distributed`,`do`,`dynamic`,`each`,`else`,`enum`,`extension`,`fallthrough`,/fileprivate\(set\)/,`fileprivate`,`final`,`for`,`func`,`get`,`guard`,`if`,`import`,`indirect`,`infix`,/init\?/,/init!/,`inout`,/internal\(set\)/,`internal`,`in`,`is`,`isolated`,`nonisolated`,`lazy`,`let`,`macro`,`mutating`,`nonmutating`,/open\(set\)/,`open`,`operator`,`optional`,`override`,`package`,`postfix`,`precedencegroup`,`prefix`,/private\(set\)/,`private`,`protocol`,/public\(set\)/,`public`,`repeat`,`required`,`rethrows`,`return`,`set`,`some`,`static`,`struct`,`subscript`,`super`,`switch`,`throws`,`throw`,/try\?/,/try!/,`try`,`typealias`,/unowned\(safe\)/,/unowned\(unsafe\)/,`unowned`,`var`,`weak`,`where`,`while`,`willSet`],zB=[`false`,`nil`,`true`],BB=[`assignment`,`associativity`,`higherThan`,`left`,`lowerThan`,`none`,`right`],VB=[`#colorLiteral`,`#column`,`#dsohandle`,`#else`,`#elseif`,`#endif`,`#error`,`#file`,`#fileID`,`#fileLiteral`,`#filePath`,`#function`,`#if`,`#imageLiteral`,`#keyPath`,`#line`,`#selector`,`#sourceLocation`,`#warning`],HB=`abs.all.any.assert.assertionFailure.debugPrint.dump.fatalError.getVaList.isKnownUniquelyReferenced.max.min.numericCast.pointwiseMax.pointwiseMin.precondition.preconditionFailure.print.readLine.repeatElement.sequence.stride.swap.swift_unboxFromSwiftValueWithType.transcode.type.unsafeBitCast.unsafeDowncast.withExtendedLifetime.withUnsafeMutablePointer.withUnsafePointer.withVaList.withoutActuallyEscaping.zip`.split(`.`),UB=NB(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),WB=NB(UB,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),GB=jB(UB,WB,`*`),KB=NB(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),qB=NB(KB,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),JB=jB(KB,qB,`*`),YB=jB(/[A-Z]/,qB,`*`),XB=[`attached`,`autoclosure`,jB(/convention\(/,NB(`swift`,`block`,`c`),/\)/),`discardableResult`,`dynamicCallable`,`dynamicMemberLookup`,`escaping`,`freestanding`,`frozen`,`GKInspectable`,`IBAction`,`IBDesignable`,`IBInspectable`,`IBOutlet`,`IBSegueAction`,`inlinable`,`main`,`nonobjc`,`NSApplicationMain`,`NSCopying`,`NSManaged`,jB(/objc\(/,JB,/\)/),`objc`,`objcMembers`,`propertyWrapper`,`requires_stored_property_inits`,`resultBuilder`,`Sendable`,`testable`,`UIApplicationMain`,`unchecked`,`unknown`,`usableFromInline`,`warn_unqualified_access`],ZB=[`iOS`,`iOSApplicationExtension`,`macOS`,`macOSApplicationExtension`,`macCatalyst`,`macCatalystApplicationExtension`,`watchOS`,`watchOSApplicationExtension`,`tvOS`,`tvOSApplicationExtension`,`swift`];function QB(e){let t={match:/\s+/,relevance:0},n=e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,NB(...FB,...IB)],className:{2:`keyword`}},a={match:jB(/\./,NB(...RB)),relevance:0},o=RB.filter(e=>typeof e==`string`).concat([`_|0`]),s={variants:[{className:`keyword`,match:NB(...RB.filter(e=>typeof e!=`string`).concat(LB).map(PB),...IB)}]},c={$pattern:NB(/\b\w+/,/#\w+/),keyword:o.concat(VB),literal:zB},l=[i,a,s],u=[{match:jB(/\./,NB(...HB)),relevance:0},{className:`built_in`,match:jB(/\b/,NB(...HB),/(?=\()/)}],d={match:/->/,relevance:0},f=[d,{className:`operator`,relevance:0,variants:[{match:GB},{match:`\\.(\\.|${WB})+`}]}],p=`([0-9]_*)+`,m=`([0-9a-fA-F]_*)+`,h={className:`number`,relevance:0,variants:[{match:`\\b(${p})(\\.(${p}))?([eE][+-]?(${p}))?\\b`},{match:`\\b0x(${m})(\\.(${m}))?([pP][+-]?(${p}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},g=(e=``)=>({className:`subst`,variants:[{match:jB(/\\/,e,/[0\\tnr"']/)},{match:jB(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(e=``)=>({className:`subst`,match:jB(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),v=(e=``)=>({className:`subst`,label:`interpol`,begin:jB(/\\/,e,/\(/),end:/\)/}),y=(e=``)=>({begin:jB(e,/"""/),end:jB(/"""/,e),contains:[g(e),_(e),v(e)]}),b=(e=``)=>({begin:jB(e,/"/),end:jB(/"/,e),contains:[g(e),v(e)]}),x={className:`string`,variants:[y(),y(`#`),y(`##`),y(`###`),b(),b(`#`),b(`##`),b(`###`)]},S=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],C={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:S},w=e=>{let t=jB(e,/\//),n=jB(/\//,e);return{begin:t,end:n,contains:[...S,{scope:`comment`,begin:`#(?!.*${n})`,end:/$/}]}},T={scope:`regexp`,variants:[w(`###`),w(`##`),w(`#`),C]},E={match:jB(/`/,JB,/`/)},D=[E,{className:`variable`,match:/\$\d+/},{className:`variable`,match:`\\$${qB}+`}],O=[{match:/(@|#(un)?)available/,scope:`keyword`,starts:{contains:[{begin:/\(/,end:/\)/,keywords:ZB,contains:[...f,h,x]}]}},{scope:`keyword`,match:jB(/@/,NB(...XB),AB(NB(/\(/,/\s+/)))},{scope:`meta`,match:jB(/@/,JB)}],k={match:AB(/\b[A-Z]/),relevance:0,contains:[{className:`type`,match:jB(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,qB,`+`)},{className:`type`,match:YB,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:jB(/\s+&\s+/,AB(YB)),relevance:0}]},A={begin:/</,end:/>/,keywords:c,contains:[...r,...l,...O,d,k]};k.contains.push(A);let j={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:[`self`,{match:jB(JB,/\s*:/),keywords:`_|0`,relevance:0},...r,T,...l,...u,...f,h,x,...D,...O,k]},M={begin:/</,end:/>/,keywords:`repeat each`,contains:[...r,k]},N={begin:/\(/,end:/\)/,keywords:c,contains:[{begin:NB(AB(jB(JB,/\s*:/)),AB(jB(JB,/\s+/,JB,/\s*:/))),end:/:/,relevance:0,contains:[{className:`keyword`,match:/\b_\b/},{className:`params`,match:JB}]},...r,...l,...f,h,x,...O,k,j],endsParent:!0,illegal:/["']/},P={match:[/(func|macro)/,/\s+/,NB(E.match,JB,GB)],className:{1:`keyword`,3:`title.function`},contains:[M,N,t],illegal:[/\[/,/%/]},F={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:`keyword`},contains:[M,N,t],illegal:/\[|%/},I={match:[/operator/,/\s+/,GB],className:{1:`keyword`,3:`title`}},L={begin:[/precedencegroup/,/\s+/,YB],className:{1:`keyword`,3:`title`},contains:[k],keywords:[...BB,...zB],end:/}/},R={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:`keyword`,3:`keyword`,5:`title.function`}},z={match:[/class\b/,/\s+/,/var\b/],scope:{1:`keyword`,3:`keyword`}},B={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,JB,/\s*/],beginScope:{1:`keyword`,3:`title.class`},keywords:c,contains:[M,...l,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:`title.class.inherited`,match:YB},...l],relevance:0}]};for(let e of x.variants){let t=e.contains.find(e=>e.label===`interpol`);t.keywords=c;let n=[...l,...u,...f,h,x,...D];t.contains=[...n,{begin:/\(/,end:/\)/,contains:[`self`,...n]}]}return{name:`Swift`,keywords:c,contains:[...r,P,F,R,z,B,I,L,{beginKeywords:`import`,end:/$/,contains:[...r],relevance:0},T,...l,...u,...f,h,x,...D,...O,k,j]}}var $B=`[A-Za-z$_][0-9A-Za-z$_]*`,eV=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),tV=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],nV=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),rV=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],iV=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],aV=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],oV=[].concat(iV,nV,rV);function sV(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=$B,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:$B,keyword:eV,literal:tV,built_in:oV,"variable.language":aV},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:r+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...nV,...rV]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...iV,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},j=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},M,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:j,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$`+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function cV(e){let t=e.regex,n=sV(e),r=$B,i=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},o={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:i},contains:[n.exports.CLASS_REFERENCE]},s={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},c={$pattern:$B,keyword:eV.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:tV,built_in:oV.concat(i),"variable.language":aV},l={className:`meta`,begin:`@`+r},u=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(l);let d=n.contains.find(e=>e.scope===`attr`),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([l,a,o,f]),u(n,`shebang`,e.SHEBANG()),u(n,`use_strict`,s);let p=n.contains.find(e=>e.label===`func.def`);return p.relevance=0,Object.assign(n,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),n}function lV(e){let t=e.regex,n={className:`string`,begin:/"(""|[^/n])"C\b/},r={className:`string`,begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,c={className:`literal`,variants:[{begin:t.concat(/# */,t.either(a,i),/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(a,i),/ +/,t.either(o,s),/ *#/)}]},l={className:`number`,relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:`label`,begin:/^\w+:/},d=e.COMMENT(/'''/,/$/,{contains:[{className:`doctag`,begin:/<\/?/,end:/>/}]}),f=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:`Visual Basic .NET`,aliases:[`vb`],case_insensitive:!0,classNameAliases:{label:`symbol`},keywords:{keyword:`addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield`,built_in:`addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort`,type:`boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort`,literal:`true false nothing`},illegal:`//|\\{|\\}|endif|gosub|variant|wend|^\\$ `,contains:[n,r,c,l,u,d,f,{className:`meta`,begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:`const disable else elseif enable end externalsource if region then`},contains:[f]}]}}function uV(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);t.contains.push(`self`);let n=e.COMMENT(/;;/,/$/),r=`anyfunc,block,br,br_if,br_table,call,call_indirect,data,drop,elem,else,end,export,func,global.get,global.set,local.get,local.set,local.tee,get_global,get_local,global,if,import,local,loop,memory,memory.grow,memory.size,module,mut,nop,offset,param,result,return,select,set_global,set_local,start,table,tee_local,then,type,unreachable`.split(`,`),i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:`keyword`,3:`title.function`}},a={className:`variable`,begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:`punctuation`,relevance:0},s={className:`number`,relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:`type`},l={className:`keyword`,match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:`WebAssembly`,keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:`keyword`,3:`operator`}},a,o,i,e.QUOTE_STRING_MODE,c,l,s]}}function dV(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:`symbol`,begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:`keyword`,begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:`string`}),c=e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:`attr`,begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:`string`,endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:`HTML, XML`,aliases:[`html`,`xhtml`,`rss`,`atom`,`xjb`,`xsd`,`xsl`,`plist`,`wsf`,`svg`],case_insensitive:!0,unicodeRegex:!0,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,c,s,o,{begin:/\[/,end:/\]/,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,contains:[a,o,c,s]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:`meta`,end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:`tag`,begin:/<style(?=\s|>)/,end:/>/,keywords:{name:`style`},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:[`css`,`xml`]}},{className:`tag`,begin:/<script(?=\s|>)/,end:/>/,keywords:{name:`script`},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:[`javascript`,`handlebars`,`xml`]}},{className:`tag`,begin:/<>|<\/>/},{className:`tag`,begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:`name`,begin:n,relevance:0,starts:l}]},{className:`tag`,begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:`name`,begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function fV(e){let t=`true false yes no null`,n=`[\\w#;/?:@&=+$,.~*'()[\\]]+`,r={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},a={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},o={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},s=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),c={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},l={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},u={begin:/\{/,end:/\}/,contains:[l],illegal:`\\n`,relevance:0},d={begin:`\\[`,end:`\\]`,contains:[l],illegal:`\\n`,relevance:0},f=[r,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+!`+n},{className:`type`,begin:`!<`+n+`>`},{className:`type`,begin:`!`+n},{className:`type`,begin:`!!`+n},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},c,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},u,d,a,o],p=[...f];return p.pop(),p.push(s),l.contains=p,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:f}}var pV={arduino:uz,bash:dz,c:fz,cpp:pz,csharp:mz,css:Cz,diff:wz,go:Tz,graphql:Ez,ini:Dz,java:Nz,javascript:Hz,json:Uz,kotlin:Jz,less:iB,lua:aB,makefile:oB,markdown:sB,objectivec:cB,perl:lB,php:uB,"php-template":dB,plaintext:fB,python:pB,"python-repl":mB,r:hB,ruby:gB,rust:_B,scss:EB,shell:DB,sql:OB,swift:QB,typescript:cV,vbnet:lV,wasm:uV,xml:dV,yaml:fV},mV=l(o(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#x27;`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],e[0]===`(`&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,j=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},M={begin:`\\\\[\\s\\S]`,relevance:0},N={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[M]},P={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[M]},F={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},I=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},L=I(`//`,`$`),R=I(`/\\*`,`\\*/`),z=I(`#`,`$`),B={scope:`number`,begin:D,relevance:0},V={scope:`number`,begin:O,relevance:0},H={scope:`number`,begin:k,relevance:0},U={scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M,{begin:/\[/,end:/\]/,relevance:0,contains:[M]}]},W={scope:`title`,begin:T,relevance:0},ee={scope:`title`,begin:E,relevance:0},te={begin:`\\.\\s*`+E,relevance:0},ne=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:M,BINARY_NUMBER_MODE:H,BINARY_NUMBER_RE:k,COMMENT:I,C_BLOCK_COMMENT_MODE:R,C_LINE_COMMENT_MODE:L,C_NUMBER_MODE:V,C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:z,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:te,NUMBER_MODE:B,NUMBER_RE:D,PHRASAL_WORDS_MODE:F,QUOTE_STRING_MODE:P,REGEXP_MODE:U,RE_STARTERS_RE:A,SHEBANG:j,TITLE_MODE:W,UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:ee});function re(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function ie(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function ae(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=re,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function oe(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function G(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function se(e,t){e.relevance===void 0&&(e.relevance=1)}var K=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},ce=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],le=`keyword`;function ue(e,t,n=le){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,ue(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,de(n[0],n[1])]})}}function de(e,t){return t?Number(t):fe(e)?0:1}function fe(e){return ce.includes(e.toLowerCase())}var pe={},me=e=>{console.error(e)},he=(e,...t)=>{console.log(`WARN: ${e}`,...t)},ge=(e,t)=>{pe[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),pe[`${e}/${t}`]=!0)},_e=Error();function ve(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function ye(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw me(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),_e;if(typeof e.beginScope!=`object`||e.beginScope===null)throw me(`beginScope must be object`),_e;ve(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function be(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw me(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),_e;if(typeof e.endScope!=`object`||e.endScope===null)throw me(`endScope must be object`),_e;ve(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function xe(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Se(e){xe(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),ye(e),be(e)}function Ce(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null),this.matcherRe=t(C(this.regexes.map(e=>e[1]),{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[ie,G,Se,K].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[ae,oe,se].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=ue(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return Te(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function we(e){return e?e.endsWithParent||we(e.starts):!1}function Te(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:we(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var Ee=`11.11.1`,De=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},Oe=i,ke=a,Ae=Symbol(`nomatch`),je=7,Me=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(he(s.replace(`{}`,n[1])),he(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||N(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(ge(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),ge(`10.7.0`,`Please use highlight(code, options) instead.
1931
1931
  https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};z(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,z(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!A.keywords){M.addText(P);return}let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(P),n=``;for(;t;){n+=P.substring(e,t.index);let r=D.case_insensitive?t[0].toLowerCase():t[0],i=u(A,r);if(i){let[e,a]=i;if(M.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=je&&(F+=a),e.startsWith(`_`))n+=t[0];else{let n=D.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(P)}n+=P.substring(e),M.addText(n)}function f(){if(P===``)return;let e=null;if(typeof A.subLanguage==`string`){if(!t[A.subLanguage]){M.addText(P);return}e=v(A.subLanguage,P,!0,j[A.subLanguage]),j[A.subLanguage]=e._top}else e=S(P,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(F+=e.relevance),M.__addSublanguage(e._emitter,e.language)}function p(){A.subLanguage==null?d():f(),P=``}function m(e,t){e!==``&&(M.startScope(t),M.addText(e),M.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=D.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(P=i,d(),P=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&M.openNode(D.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(P,D.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),P=``):e.beginScope._multi&&(h(e.beginScope,t),P=``)),A=Object.create(e,{parent:{value:A}}),A}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return A.matcher.regexIndex===0?(P+=e[0],1):(R=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?P+=t:(n.excludeBegin&&(P+=t),p(),!n.returnBegin&&!n.excludeBegin&&(P=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(A,e,r);if(!i)return Ae;let a=A;A.endScope&&A.endScope._wrap?(p(),m(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),h(A.endScope,e)):a.skip?P+=t:(a.returnEnd||a.excludeEnd||(P+=t),p(),a.excludeEnd&&(P=t));do A.scope&&M.closeNode(),!A.skip&&!A.subLanguage&&(F+=A.relevance),A=A.parent;while(A!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=A;t!==D;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>M.openNode(e))}let T={};function E(t,r){let a=r&&r[0];if(P+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(P+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(A.scope||`<unnamed>`)+`"`);throw e.mode=A,e}else if(r.type===`end`){let e=C(r);if(e!==Ae)return e}if(r.type===`illegal`&&a===``)return P+=`
1932
- `,1;if(L>1e5&&L>r.index*3)throw Error(`potential infinite loop, way more iterations than matches`);return P+=a,a.length}let D=N(e);if(!D)throw me(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let O=Ce(D),k=``,A=a||O,j={},M=new l.__emitter(l);w();let P=``,F=0,I=0,L=0,R=!1;try{if(D.__emitTokens)D.__emitTokens(n,M);else{for(A.matcher.considerAll();;){L++,R?R=!1:A.matcher.considerAll(),A.matcher.lastIndex=I;let e=A.matcher.exec(n);if(!e)break;let t=E(n.substring(I,e.index),e);I=e.index+t}E(n.substring(I))}return M.finalize(),k=M.toHTML(),{language:e,value:k,relevance:F,illegal:!1,_emitter:M,_top:A}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:Oe(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:I,context:n.slice(I-100,I+100),mode:t.mode,resultSoFar:k},_emitter:M};if(o)return{language:e,value:Oe(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:A};throw t}}function b(e){let t={value:Oe(e),illegal:!1,relevance:0,_top:c,_emitter:new l.__emitter(l)};return t._emitter.addText(e),t}function S(e,n){n=n||l.languages||Object.keys(t);let r=b(e),i=n.filter(N).filter(F).map(t=>v(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(N(e.language).supersetOf===t.language)return 1;if(N(t.language).supersetOf===e.language)return-1}return 0}),s=a;return s.secondBest=o,s}function C(e,t,n){let r=t&&i[t]||n;e.classList.add(`hljs`),e.classList.add(`language-${r}`)}function w(e){let t=null,n=d(e);if(u(n))return;if(z(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(l.ignoreUnescapedHTML||(console.warn(`One of your code blocks includes unescaped HTML. This is a potentially serious security risk.`),console.warn(`https://github.com/highlightjs/highlight.js/wiki/security`),console.warn(`The element with unescaped HTML:`),console.warn(e)),l.throwUnescapedHTML))throw new De(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?p(r,{language:n,ignoreIllegals:!0}):S(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,C(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),z(`after:highlightElement`,{el:e,result:i,text:r})}function T(e){l=ke(l,e)}let E=()=>{k(),ge(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function D(){k(),ge(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let O=!1;function k(){function e(){k()}if(document.readyState===`loading`){O||window.addEventListener(`DOMContentLoaded`,e,!1),O=!0;return}document.querySelectorAll(l.cssSelector).forEach(w)}function A(n,r){let i=null;try{i=r(e)}catch(e){if(me(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)me(e);else throw e;i=c}i.name||=n,t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&P(i.aliases,{languageName:n})}function j(e){delete t[e];for(let t of Object.keys(i))i[t]===e&&delete i[t]}function M(){return Object.keys(t)}function N(e){return e=(e||``).toLowerCase(),t[e]||t[i[e]]}function P(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function F(e){let t=N(e);return t&&!t.disableAutodetect}function I(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function L(e){I(e),a.push(e)}function R(e){let t=a.indexOf(e);t!==-1&&a.splice(t,1)}function z(e,t){let n=e;a.forEach(function(e){e[n]&&e[n](t)})}function B(e){return ge(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),ge(`10.7.0`,`Please use highlightElement now.`),w(e)}Object.assign(e,{highlight:p,highlightAuto:S,highlightAll:k,highlightElement:w,highlightBlock:B,configure:T,initHighlighting:E,initHighlightingOnLoad:D,registerLanguage:A,unregisterLanguage:j,listLanguages:M,getLanguage:N,registerAliases:P,autoDetection:F,inherit:ke,addPlugin:L,removePlugin:R}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=Ee,e.regex={concat:_,lookahead:m,either:y,optional:g,anyNumberOfTimes:h};for(let e in ne)typeof ne[e]==`object`&&n(ne[e]);return Object.assign(e,ne),e},Ne=Me({});Ne.newInstance=()=>Me({}),t.exports=Ne,Ne.HighlightJS=Ne,Ne.default=Ne}))()).default,hV={},gV=`hljs-`;function _V(e){let t=mV.newInstance();return e&&a(e),{highlight:n,highlightAuto:r,listLanguages:i,register:a,registerAlias:o,registered:s};function n(e,n,r){let i=r||hV,a=typeof i.prefix==`string`?i.prefix:gV;if(!t.getLanguage(e))throw Error("Unknown language: `"+e+"` is not registered");t.configure({__emitter:vV,classPrefix:a});let o=t.highlight(n,{ignoreIllegals:!0,language:e});if(o.errorRaised)throw Error("Could not highlight with `Highlight.js`",{cause:o.errorRaised});let s=o._emitter.root,c=s.data;return c.language=o.language,c.relevance=o.relevance,s}function r(e,r){let a=(r||hV).subset||i(),o=-1,s=0,c;for(;++o<a.length;){let i=a[o];if(!t.getLanguage(i))continue;let l=n(i,e,r);l.data&&l.data.relevance!==void 0&&l.data.relevance>s&&(s=l.data.relevance,c=l)}return c||{type:`root`,children:[],data:{language:void 0,relevance:s}}}function i(){return t.listLanguages()}function a(e,n){if(typeof e==`string`)t.registerLanguage(e,n);else{let n;for(n in e)Object.hasOwn(e,n)&&t.registerLanguage(n,e[n])}}function o(e,n){if(typeof e==`string`)t.registerAliases(typeof n==`string`?n:[...n],{languageName:e});else{let n;for(n in e)if(Object.hasOwn(e,n)){let r=e[n];t.registerAliases(typeof r==`string`?r:[...r],{languageName:n})}}}function s(e){return!!t.getLanguage(e)}}var vV=class{constructor(e){this.options=e,this.root={type:`root`,children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e===``)return;let t=this.stack[this.stack.length-1],n=t.children[t.children.length-1];n&&n.type===`text`?n.value+=e:t.children.push({type:`text`,value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){let n=this.stack[this.stack.length-1],r=e.root.children;t?n.children.push({type:`element`,tagName:`span`,properties:{className:[t]},children:r}):n.children.push(...r)}openNode(e){let t=this,n=e.split(`.`).map(function(e,n){return n?e+`_`.repeat(n):t.options.classPrefix+e}),r=this.stack[this.stack.length-1],i={type:`element`,tagName:`span`,properties:{className:n},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return``}},yV={};function bV(e){let t=e||yV,n=t.aliases,r=t.detect||!1,i=t.languages||pV,a=t.plainText,o=t.prefix,s=t.subset,c=`hljs`,l=_V(i);if(n&&l.registerAlias(n),o){let e=o.indexOf(`-`);c=e===-1?o:o.slice(0,e)}return function(e,t){NP(e,`element`,function(e,n,i){if(e.tagName!==`code`||!i||i.type!==`element`||i.tagName!==`pre`)return;let u=xV(e);if(u===!1||!u&&!r||u&&a&&a.includes(u))return;Array.isArray(e.properties.className)||(e.properties.className=[]),e.properties.className.includes(c)||e.properties.className.unshift(c);let d=$R(e,{whitespace:`pre`}),f;try{f=u?l.highlight(u,d,{prefix:o}):l.highlightAuto(d,{prefix:o,subset:s})}catch(n){let r=n;if(u&&/Unknown language/.test(r.message)){t.message("Cannot highlight as `"+u+"`, it’s not registered",{ancestors:[i,e],cause:r,place:e.position,ruleId:`missing-language`,source:`rehype-highlight`});return}throw r}!u&&f.data&&f.data.language&&e.properties.className.push(`language-`+f.data.language),f.children.length>0&&(e.children=f.children)})}}function xV(e){let t=e.properties.className,n=-1;if(!Array.isArray(t))return;let r;for(;++n<t.length;){let e=String(t[n]);if(e===`no-highlight`||e===`nohighlight`)return!1;!r&&e.slice(0,5)===`lang-`&&(r=e.slice(5)),!r&&e.slice(0,9)===`language-`&&(r=e.slice(9))}return r}var SV=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],CV={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...SV,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...SV],h2:[[`className`,`sr-only`]],img:[...SV,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...SV,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...SV],table:[...SV],ul:[...SV,[`className`,`contains-task-list`]],"*":`abbr.accept.acceptCharset.accessKey.action.align.alt.axis.border.cellPadding.cellSpacing.char.charOff.charSet.checked.clear.colSpan.color.cols.compact.coords.dateTime.dir.encType.frame.hSpace.headers.height.hrefLang.htmlFor.id.isMap.itemProp.label.lang.maxLength.media.method.multiple.name.noHref.noShade.noWrap.open.prompt.readOnly.rev.rowSpan.rows.rules.scope.selected.shape.size.span.start.summary.tabIndex.title.useMap.vAlign.value.width`.split(`.`)},clobber:[`ariaDescribedBy`,`ariaLabelledBy`,`id`,`name`],clobberPrefix:`user-content-`,protocols:{cite:[`http`,`https`],href:[`http`,`https`,`irc`,`ircs`,`mailto`,`xmpp`],longDesc:[`http`,`https`],src:[`http`,`https`]},required:{input:{disabled:!0,type:`checkbox`}},strip:[`script`],tagNames:`a.b.blockquote.br.code.dd.del.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.input.ins.kbd.li.ol.p.picture.pre.q.rp.rt.ruby.s.samp.section.source.span.strike.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.tt.ul.var`.split(`.`)},wV={}.hasOwnProperty;function TV(e,t){let n={type:`root`,children:[]},r=EV({schema:t?{...CV,...t}:CV,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function EV(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return DV(e,n);case`doctype`:return OV(e,n);case`element`:return kV(e,n);case`root`:return AV(e,n);case`text`:return jV(e,n);default:}}}function DV(e,t){if(e.schema.allowComments){let e=typeof t.value==`string`?t.value:``,n=e.indexOf(`-->`),r={type:`comment`,value:n<0?e:e.slice(0,n)};return RV(r,t),r}}function OV(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return RV(e,t),e}}function kV(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=MV(e,t.children),i=NV(e,t.properties);e.stack.pop();let a=!1;if(n&&n!==`*`&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&wV.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(a=!1;++r<t.length;)e.stack.includes(t[r])&&(a=!0)}if(!a)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;let o={type:`element`,tagName:n,properties:i,children:r};return RV(o,t),o}function AV(e,t){let n={type:`root`,children:MV(e,t.children)};return RV(n,t),n}function jV(e,t){let n={type:`text`,value:typeof t.value==`string`?t.value:``};return RV(n,t),n}function MV(e,t){let n=[];if(Array.isArray(t)){let r=t,i=-1;for(;++i<r.length;){let t=EV(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function NV(e,t){let n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,a=r&&wV.call(r,n)?r[n]:void 0,o=r&&wV.call(r,`*`)?r[`*`]:void 0,s=t&&typeof t==`object`?t:{},c={},l;for(l in s)if(wV.call(s,l)){let t=s[l],n=PV(e,zV(a,l),l,t);n??=PV(e,zV(o,l),l,t),n!=null&&(c[l]=n)}if(i&&wV.call(i,n)){let e=i[n];for(l in e)wV.call(e,l)&&!wV.call(c,l)&&(c[l]=e[l])}return c}function PV(e,t,n,r){return t?Array.isArray(r)?FV(e,t,n,r):IV(e,t,n,r):void 0}function FV(e,t,n,r){let i=-1,a=[];for(;++i<r.length;){let o=IV(e,t,n,r[i]);(typeof o==`number`||typeof o==`string`)&&a.push(o)}return a}function IV(e,t,n,r){if(!(typeof r!=`boolean`&&typeof r!=`number`&&typeof r!=`string`)&&LV(e,n,r)){if(typeof t==`object`&&t.length>1){let e=!1,n=0;for(;++n<t.length;){let i=t[n];if(i&&typeof i==`object`&&`flags`in i){if(i.test(String(r))){e=!0;break}}else if(i===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function LV(e,t,n){let r=e.schema.protocols&&wV.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;let i=String(n),a=i.indexOf(`:`),o=i.indexOf(`?`),s=i.indexOf(`#`),c=i.indexOf(`/`);if(a<0||c>-1&&a>c||o>-1&&a>o||s>-1&&a>s)return!0;let l=-1;for(;++l<r.length;){let e=r[l];if(a===e.length&&i.slice(0,e.length)===e)return!0}return!1}function RV(e,t){let n=Kk(t);t.data&&(e.data=vP(t.data)),n&&(e.position=n)}function zV(e,t){let n,r=-1;if(e)for(;++r<e.length;){let i=e[r],a=typeof i==`string`?i:i[0];if(a===t)return i;a===`data*`&&(n=i)}if(t.length>4&&t.slice(0,4).toLowerCase()===`data`)return n}function BV(e){return function(t){return TV(t,e)}}function VV(){return typeof document>`u`?`dark`:(LT[document.documentElement.getAttribute(`data-theme`)||`rose-pine`]?.type??`dark`)===`light`?`default`:`dark`}var HV=(0,q.memo)(function({chart:e}){let t=(0,q.useRef)(null),n=`mermaid-${(0,q.useId)().replace(/[^a-zA-Z0-9]/g,``)}`,[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(null);return(0,q.useEffect)(()=>{let r=!1;return(async()=>{try{let a=(await X(async()=>{let{default:e}=await import(`./mermaid.core-DRh_KVT1.js`);return{default:e}},__vite__mapDeps([101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118]))).default;a.initialize({startOnLoad:!1,securityLevel:`strict`,theme:VV()});let{svg:s,bindFunctions:c}=await a.render(n,e);if(r)return;o(s),i(null),requestAnimationFrame(()=>{r||!t.current||c?.(t.current)})}catch(e){r||i(e instanceof Error?e.message:String(e))}})(),()=>{r=!0}},[e,n]),r?(0,J.jsxs)(`div`,{className:`mermaid-error`,children:[(0,J.jsxs)(`div`,{className:`mermaid-error-note`,children:[`Failed to render diagram: `,r]}),(0,J.jsx)(`pre`,{children:(0,J.jsx)(`code`,{children:e})})]}):(0,J.jsx)(`div`,{className:`mermaid`,ref:t,role:`img`,"aria-label":`Mermaid diagram`,dangerouslySetInnerHTML:a?{__html:a}:void 0})}),UV=[PR,LR],WV=[[BV,{...CV,protocols:{...CV.protocols,href:[...CV.protocols?.href??[],`file`,`file-mention`]},attributes:{...CV.attributes,h1:[...CV.attributes?.h1??[],`id`],h2:[...CV.attributes?.h2??[],`id`],h3:[...CV.attributes?.h3??[],`id`],h4:[...CV.attributes?.h4??[],`id`],h5:[...CV.attributes?.h5??[],`id`],h6:[...CV.attributes?.h6??[],`id`]}}],[bV,{ignoreMissing:!0,plainText:[`mermaid`,`suggestion`]}]];function GV(e){return e.startsWith(`file://`)||e.startsWith(`file-mention://`)?e:FF(e)}function KV(e){return e==null||e===!1||e===!0?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(KV).join(``):(0,q.isValidElement)(e)?KV(e.props.children):``}function qV(e){return typeof e==`string`?/language-([\w-]+)/.exec(e)?.[1]??null:null}function JV(e){return e.toLowerCase().trim().replace(/[`*_~[\]()#.!?,:'"]/g,``).replace(/[^\w\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``).slice(0,80)||`section`}function YV({language:e,codeText:t,children:n}){let[r,i]=(0,q.useState)(!1),a=(0,q.useCallback)(()=>{typeof navigator>`u`||!navigator.clipboard||navigator.clipboard.writeText(t).then(()=>{i(!0),window.setTimeout(()=>i(!1),1400)},()=>{})},[t]);return(0,J.jsxs)(`div`,{className:`md-code-block`,children:[(0,J.jsxs)(`div`,{className:`md-code-toolbar`,children:[(0,J.jsx)(`span`,{className:`md-code-lang`,children:e||`code`}),(0,J.jsx)(`button`,{type:`button`,className:`md-code-copy`,onClick:a,"aria-label":`Copy code`,children:r?`Copied`:`Copy`})]}),(0,J.jsx)(`pre`,{children:n})]})}function XV(e){return{pre({children:e}){let t=qV((0,q.isValidElement)(e)?e.props.className:void 0);return t===`mermaid`?(0,J.jsx)(HV,{chart:KV(e).replace(/\n$/,``)}):t===`suggestion`?null:(0,J.jsx)(YV,{language:t,codeText:KV(e).replace(/\n$/,``),children:e})},a({href:e,children:t}){return typeof e==`string`&&e.startsWith(`file-mention://`)?(0,J.jsx)(`span`,{className:`mention-file`,title:e.slice(15),children:t}):(0,J.jsx)(`a`,{href:e,...typeof e==`string`&&/^https?:\/\//.test(e)?{target:`_blank`,rel:`noopener noreferrer`}:{},children:t})},h1:ZV(`h1`,e),h2:ZV(`h2`,e),h3:ZV(`h3`,e),h4:ZV(`h4`,e),h5:ZV(`h5`,e),h6:ZV(`h6`,e)}}function ZV(e,t){return function({children:n,...r}){let i=KV(n),a=JV(i),o=t.get(a)??0;return t.set(a,o+1),o>0&&(a=`${a}-${o+1}`),(0,J.jsxs)(e,{id:a,className:`md-heading`,...r,children:[(0,J.jsx)(`a`,{href:`#${a}`,className:`md-heading-anchor`,"aria-label":`Link to ${i}`,children:`#`}),n]})}}function QV({content:e,className:t}){return(0,J.jsx)(`div`,{className:t,children:(0,J.jsx)(jF,{remarkPlugins:UV,rehypePlugins:WV,urlTransform:GV,components:(0,q.useMemo)(()=>XV(new Map),[e]),children:e})})}function $V(e,t){let n=e.slice(0,t);for(let e=t-1;e>=0;e--){let t=n[e];if(t===`@`){if(e===0||/\s/.test(n[e-1])){let t=n.slice(e+1);if(!/\s/.test(t))return{atStart:e,query:t}}return null}if(t===`
1932
+ `,1;if(L>1e5&&L>r.index*3)throw Error(`potential infinite loop, way more iterations than matches`);return P+=a,a.length}let D=N(e);if(!D)throw me(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let O=Ce(D),k=``,A=a||O,j={},M=new l.__emitter(l);w();let P=``,F=0,I=0,L=0,R=!1;try{if(D.__emitTokens)D.__emitTokens(n,M);else{for(A.matcher.considerAll();;){L++,R?R=!1:A.matcher.considerAll(),A.matcher.lastIndex=I;let e=A.matcher.exec(n);if(!e)break;let t=E(n.substring(I,e.index),e);I=e.index+t}E(n.substring(I))}return M.finalize(),k=M.toHTML(),{language:e,value:k,relevance:F,illegal:!1,_emitter:M,_top:A}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:Oe(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:I,context:n.slice(I-100,I+100),mode:t.mode,resultSoFar:k},_emitter:M};if(o)return{language:e,value:Oe(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:A};throw t}}function b(e){let t={value:Oe(e),illegal:!1,relevance:0,_top:c,_emitter:new l.__emitter(l)};return t._emitter.addText(e),t}function S(e,n){n=n||l.languages||Object.keys(t);let r=b(e),i=n.filter(N).filter(F).map(t=>v(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(N(e.language).supersetOf===t.language)return 1;if(N(t.language).supersetOf===e.language)return-1}return 0}),s=a;return s.secondBest=o,s}function C(e,t,n){let r=t&&i[t]||n;e.classList.add(`hljs`),e.classList.add(`language-${r}`)}function w(e){let t=null,n=d(e);if(u(n))return;if(z(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(l.ignoreUnescapedHTML||(console.warn(`One of your code blocks includes unescaped HTML. This is a potentially serious security risk.`),console.warn(`https://github.com/highlightjs/highlight.js/wiki/security`),console.warn(`The element with unescaped HTML:`),console.warn(e)),l.throwUnescapedHTML))throw new De(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?p(r,{language:n,ignoreIllegals:!0}):S(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,C(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),z(`after:highlightElement`,{el:e,result:i,text:r})}function T(e){l=ke(l,e)}let E=()=>{k(),ge(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function D(){k(),ge(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let O=!1;function k(){function e(){k()}if(document.readyState===`loading`){O||window.addEventListener(`DOMContentLoaded`,e,!1),O=!0;return}document.querySelectorAll(l.cssSelector).forEach(w)}function A(n,r){let i=null;try{i=r(e)}catch(e){if(me(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)me(e);else throw e;i=c}i.name||=n,t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&P(i.aliases,{languageName:n})}function j(e){delete t[e];for(let t of Object.keys(i))i[t]===e&&delete i[t]}function M(){return Object.keys(t)}function N(e){return e=(e||``).toLowerCase(),t[e]||t[i[e]]}function P(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function F(e){let t=N(e);return t&&!t.disableAutodetect}function I(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function L(e){I(e),a.push(e)}function R(e){let t=a.indexOf(e);t!==-1&&a.splice(t,1)}function z(e,t){let n=e;a.forEach(function(e){e[n]&&e[n](t)})}function B(e){return ge(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),ge(`10.7.0`,`Please use highlightElement now.`),w(e)}Object.assign(e,{highlight:p,highlightAuto:S,highlightAll:k,highlightElement:w,highlightBlock:B,configure:T,initHighlighting:E,initHighlightingOnLoad:D,registerLanguage:A,unregisterLanguage:j,listLanguages:M,getLanguage:N,registerAliases:P,autoDetection:F,inherit:ke,addPlugin:L,removePlugin:R}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=Ee,e.regex={concat:_,lookahead:m,either:y,optional:g,anyNumberOfTimes:h};for(let e in ne)typeof ne[e]==`object`&&n(ne[e]);return Object.assign(e,ne),e},Ne=Me({});Ne.newInstance=()=>Me({}),t.exports=Ne,Ne.HighlightJS=Ne,Ne.default=Ne}))()).default,hV={},gV=`hljs-`;function _V(e){let t=mV.newInstance();return e&&a(e),{highlight:n,highlightAuto:r,listLanguages:i,register:a,registerAlias:o,registered:s};function n(e,n,r){let i=r||hV,a=typeof i.prefix==`string`?i.prefix:gV;if(!t.getLanguage(e))throw Error("Unknown language: `"+e+"` is not registered");t.configure({__emitter:vV,classPrefix:a});let o=t.highlight(n,{ignoreIllegals:!0,language:e});if(o.errorRaised)throw Error("Could not highlight with `Highlight.js`",{cause:o.errorRaised});let s=o._emitter.root,c=s.data;return c.language=o.language,c.relevance=o.relevance,s}function r(e,r){let a=(r||hV).subset||i(),o=-1,s=0,c;for(;++o<a.length;){let i=a[o];if(!t.getLanguage(i))continue;let l=n(i,e,r);l.data&&l.data.relevance!==void 0&&l.data.relevance>s&&(s=l.data.relevance,c=l)}return c||{type:`root`,children:[],data:{language:void 0,relevance:s}}}function i(){return t.listLanguages()}function a(e,n){if(typeof e==`string`)t.registerLanguage(e,n);else{let n;for(n in e)Object.hasOwn(e,n)&&t.registerLanguage(n,e[n])}}function o(e,n){if(typeof e==`string`)t.registerAliases(typeof n==`string`?n:[...n],{languageName:e});else{let n;for(n in e)if(Object.hasOwn(e,n)){let r=e[n];t.registerAliases(typeof r==`string`?r:[...r],{languageName:n})}}}function s(e){return!!t.getLanguage(e)}}var vV=class{constructor(e){this.options=e,this.root={type:`root`,children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e===``)return;let t=this.stack[this.stack.length-1],n=t.children[t.children.length-1];n&&n.type===`text`?n.value+=e:t.children.push({type:`text`,value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){let n=this.stack[this.stack.length-1],r=e.root.children;t?n.children.push({type:`element`,tagName:`span`,properties:{className:[t]},children:r}):n.children.push(...r)}openNode(e){let t=this,n=e.split(`.`).map(function(e,n){return n?e+`_`.repeat(n):t.options.classPrefix+e}),r=this.stack[this.stack.length-1],i={type:`element`,tagName:`span`,properties:{className:n},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return``}},yV={};function bV(e){let t=e||yV,n=t.aliases,r=t.detect||!1,i=t.languages||pV,a=t.plainText,o=t.prefix,s=t.subset,c=`hljs`,l=_V(i);if(n&&l.registerAlias(n),o){let e=o.indexOf(`-`);c=e===-1?o:o.slice(0,e)}return function(e,t){NP(e,`element`,function(e,n,i){if(e.tagName!==`code`||!i||i.type!==`element`||i.tagName!==`pre`)return;let u=xV(e);if(u===!1||!u&&!r||u&&a&&a.includes(u))return;Array.isArray(e.properties.className)||(e.properties.className=[]),e.properties.className.includes(c)||e.properties.className.unshift(c);let d=$R(e,{whitespace:`pre`}),f;try{f=u?l.highlight(u,d,{prefix:o}):l.highlightAuto(d,{prefix:o,subset:s})}catch(n){let r=n;if(u&&/Unknown language/.test(r.message)){t.message("Cannot highlight as `"+u+"`, it’s not registered",{ancestors:[i,e],cause:r,place:e.position,ruleId:`missing-language`,source:`rehype-highlight`});return}throw r}!u&&f.data&&f.data.language&&e.properties.className.push(`language-`+f.data.language),f.children.length>0&&(e.children=f.children)})}}function xV(e){let t=e.properties.className,n=-1;if(!Array.isArray(t))return;let r;for(;++n<t.length;){let e=String(t[n]);if(e===`no-highlight`||e===`nohighlight`)return!1;!r&&e.slice(0,5)===`lang-`&&(r=e.slice(5)),!r&&e.slice(0,9)===`language-`&&(r=e.slice(9))}return r}var SV=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],CV={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...SV,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...SV],h2:[[`className`,`sr-only`]],img:[...SV,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...SV,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...SV],table:[...SV],ul:[...SV,[`className`,`contains-task-list`]],"*":`abbr.accept.acceptCharset.accessKey.action.align.alt.axis.border.cellPadding.cellSpacing.char.charOff.charSet.checked.clear.colSpan.color.cols.compact.coords.dateTime.dir.encType.frame.hSpace.headers.height.hrefLang.htmlFor.id.isMap.itemProp.label.lang.maxLength.media.method.multiple.name.noHref.noShade.noWrap.open.prompt.readOnly.rev.rowSpan.rows.rules.scope.selected.shape.size.span.start.summary.tabIndex.title.useMap.vAlign.value.width`.split(`.`)},clobber:[`ariaDescribedBy`,`ariaLabelledBy`,`id`,`name`],clobberPrefix:`user-content-`,protocols:{cite:[`http`,`https`],href:[`http`,`https`,`irc`,`ircs`,`mailto`,`xmpp`],longDesc:[`http`,`https`],src:[`http`,`https`]},required:{input:{disabled:!0,type:`checkbox`}},strip:[`script`],tagNames:`a.b.blockquote.br.code.dd.del.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.input.ins.kbd.li.ol.p.picture.pre.q.rp.rt.ruby.s.samp.section.source.span.strike.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.tt.ul.var`.split(`.`)},wV={}.hasOwnProperty;function TV(e,t){let n={type:`root`,children:[]},r=EV({schema:t?{...CV,...t}:CV,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function EV(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return DV(e,n);case`doctype`:return OV(e,n);case`element`:return kV(e,n);case`root`:return AV(e,n);case`text`:return jV(e,n);default:}}}function DV(e,t){if(e.schema.allowComments){let e=typeof t.value==`string`?t.value:``,n=e.indexOf(`-->`),r={type:`comment`,value:n<0?e:e.slice(0,n)};return RV(r,t),r}}function OV(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return RV(e,t),e}}function kV(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=MV(e,t.children),i=NV(e,t.properties);e.stack.pop();let a=!1;if(n&&n!==`*`&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&wV.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(a=!1;++r<t.length;)e.stack.includes(t[r])&&(a=!0)}if(!a)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;let o={type:`element`,tagName:n,properties:i,children:r};return RV(o,t),o}function AV(e,t){let n={type:`root`,children:MV(e,t.children)};return RV(n,t),n}function jV(e,t){let n={type:`text`,value:typeof t.value==`string`?t.value:``};return RV(n,t),n}function MV(e,t){let n=[];if(Array.isArray(t)){let r=t,i=-1;for(;++i<r.length;){let t=EV(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function NV(e,t){let n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,a=r&&wV.call(r,n)?r[n]:void 0,o=r&&wV.call(r,`*`)?r[`*`]:void 0,s=t&&typeof t==`object`?t:{},c={},l;for(l in s)if(wV.call(s,l)){let t=s[l],n=PV(e,zV(a,l),l,t);n??=PV(e,zV(o,l),l,t),n!=null&&(c[l]=n)}if(i&&wV.call(i,n)){let e=i[n];for(l in e)wV.call(e,l)&&!wV.call(c,l)&&(c[l]=e[l])}return c}function PV(e,t,n,r){return t?Array.isArray(r)?FV(e,t,n,r):IV(e,t,n,r):void 0}function FV(e,t,n,r){let i=-1,a=[];for(;++i<r.length;){let o=IV(e,t,n,r[i]);(typeof o==`number`||typeof o==`string`)&&a.push(o)}return a}function IV(e,t,n,r){if(!(typeof r!=`boolean`&&typeof r!=`number`&&typeof r!=`string`)&&LV(e,n,r)){if(typeof t==`object`&&t.length>1){let e=!1,n=0;for(;++n<t.length;){let i=t[n];if(i&&typeof i==`object`&&`flags`in i){if(i.test(String(r))){e=!0;break}}else if(i===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function LV(e,t,n){let r=e.schema.protocols&&wV.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;let i=String(n),a=i.indexOf(`:`),o=i.indexOf(`?`),s=i.indexOf(`#`),c=i.indexOf(`/`);if(a<0||c>-1&&a>c||o>-1&&a>o||s>-1&&a>s)return!0;let l=-1;for(;++l<r.length;){let e=r[l];if(a===e.length&&i.slice(0,e.length)===e)return!0}return!1}function RV(e,t){let n=Kk(t);t.data&&(e.data=vP(t.data)),n&&(e.position=n)}function zV(e,t){let n,r=-1;if(e)for(;++r<e.length;){let i=e[r],a=typeof i==`string`?i:i[0];if(a===t)return i;a===`data*`&&(n=i)}if(t.length>4&&t.slice(0,4).toLowerCase()===`data`)return n}function BV(e){return function(t){return TV(t,e)}}function VV(){return typeof document>`u`?`dark`:(LT[document.documentElement.getAttribute(`data-theme`)||`rose-pine`]?.type??`dark`)===`light`?`default`:`dark`}var HV=(0,q.memo)(function({chart:e}){let t=(0,q.useRef)(null),n=`mermaid-${(0,q.useId)().replace(/[^a-zA-Z0-9]/g,``)}`,[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(null);return(0,q.useEffect)(()=>{let r=!1;return(async()=>{try{let a=(await X(async()=>{let{default:e}=await import(`./mermaid.core-ChEL4MWP.js`);return{default:e}},__vite__mapDeps([101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118]))).default;a.initialize({startOnLoad:!1,securityLevel:`strict`,theme:VV()});let{svg:s,bindFunctions:c}=await a.render(n,e);if(r)return;o(s),i(null),requestAnimationFrame(()=>{r||!t.current||c?.(t.current)})}catch(e){r||i(e instanceof Error?e.message:String(e))}})(),()=>{r=!0}},[e,n]),r?(0,J.jsxs)(`div`,{className:`mermaid-error`,children:[(0,J.jsxs)(`div`,{className:`mermaid-error-note`,children:[`Failed to render diagram: `,r]}),(0,J.jsx)(`pre`,{children:(0,J.jsx)(`code`,{children:e})})]}):(0,J.jsx)(`div`,{className:`mermaid`,ref:t,role:`img`,"aria-label":`Mermaid diagram`,dangerouslySetInnerHTML:a?{__html:a}:void 0})}),UV=[PR,LR],WV=[[BV,{...CV,protocols:{...CV.protocols,href:[...CV.protocols?.href??[],`file`,`file-mention`]},attributes:{...CV.attributes,h1:[...CV.attributes?.h1??[],`id`],h2:[...CV.attributes?.h2??[],`id`],h3:[...CV.attributes?.h3??[],`id`],h4:[...CV.attributes?.h4??[],`id`],h5:[...CV.attributes?.h5??[],`id`],h6:[...CV.attributes?.h6??[],`id`]}}],[bV,{ignoreMissing:!0,plainText:[`mermaid`,`suggestion`]}]];function GV(e){return e.startsWith(`file://`)||e.startsWith(`file-mention://`)?e:FF(e)}function KV(e){return e==null||e===!1||e===!0?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(KV).join(``):(0,q.isValidElement)(e)?KV(e.props.children):``}function qV(e){return typeof e==`string`?/language-([\w-]+)/.exec(e)?.[1]??null:null}function JV(e){return e.toLowerCase().trim().replace(/[`*_~[\]()#.!?,:'"]/g,``).replace(/[^\w\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``).slice(0,80)||`section`}function YV({language:e,codeText:t,children:n}){let[r,i]=(0,q.useState)(!1),a=(0,q.useCallback)(()=>{typeof navigator>`u`||!navigator.clipboard||navigator.clipboard.writeText(t).then(()=>{i(!0),window.setTimeout(()=>i(!1),1400)},()=>{})},[t]);return(0,J.jsxs)(`div`,{className:`md-code-block`,children:[(0,J.jsxs)(`div`,{className:`md-code-toolbar`,children:[(0,J.jsx)(`span`,{className:`md-code-lang`,children:e||`code`}),(0,J.jsx)(`button`,{type:`button`,className:`md-code-copy`,onClick:a,"aria-label":`Copy code`,children:r?`Copied`:`Copy`})]}),(0,J.jsx)(`pre`,{children:n})]})}function XV(e){return{pre({children:e}){let t=qV((0,q.isValidElement)(e)?e.props.className:void 0);return t===`mermaid`?(0,J.jsx)(HV,{chart:KV(e).replace(/\n$/,``)}):t===`suggestion`?null:(0,J.jsx)(YV,{language:t,codeText:KV(e).replace(/\n$/,``),children:e})},a({href:e,children:t}){return typeof e==`string`&&e.startsWith(`file-mention://`)?(0,J.jsx)(`span`,{className:`mention-file`,title:e.slice(15),children:t}):(0,J.jsx)(`a`,{href:e,...typeof e==`string`&&/^https?:\/\//.test(e)?{target:`_blank`,rel:`noopener noreferrer`}:{},children:t})},h1:ZV(`h1`,e),h2:ZV(`h2`,e),h3:ZV(`h3`,e),h4:ZV(`h4`,e),h5:ZV(`h5`,e),h6:ZV(`h6`,e)}}function ZV(e,t){return function({children:n,...r}){let i=KV(n),a=JV(i),o=t.get(a)??0;return t.set(a,o+1),o>0&&(a=`${a}-${o+1}`),(0,J.jsxs)(e,{id:a,className:`md-heading`,...r,children:[(0,J.jsx)(`a`,{href:`#${a}`,className:`md-heading-anchor`,"aria-label":`Link to ${i}`,children:`#`}),n]})}}function QV({content:e,className:t}){return(0,J.jsx)(`div`,{className:t,children:(0,J.jsx)(jF,{remarkPlugins:UV,rehypePlugins:WV,urlTransform:GV,components:(0,q.useMemo)(()=>XV(new Map),[e]),children:e})})}function $V(e,t){let n=e.slice(0,t);for(let e=t-1;e>=0;e--){let t=n[e];if(t===`@`){if(e===0||/\s/.test(n[e-1])){let t=n.slice(e+1);if(!/\s/.test(t))return{atStart:e,query:t}}return null}if(t===`
1933
1933
  `)return null}return null}function eH(e,t){let n=(0,q.useRef)(null),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(0),[l,u]=(0,q.useState)(0),d=(0,q.useRef)(0),f=(0,q.useRef)(e);(0,q.useEffect)(()=>{f.current=e},[e]);let p=(0,q.useCallback)(e=>{n.current=e,i(e)},[]),m=(0,q.useCallback)(()=>{let e=n.current;if(!e)return;let t=e.selectionStart;d.current=t;let r=f.current,i=$V(r,t);if(o(i),!i)return;c(0);let a=getComputedStyle(e),s=parseFloat(a.lineHeight);Number.isFinite(s)||(s=(parseFloat(a.fontSize)||14)*1.5);let l=(r.slice(0,t).match(/\n/g)||[]).length;u((parseFloat(a.paddingTop)||0)+(l+1)*s-e.scrollTop+4)},[]);(0,q.useEffect)(()=>{m()},[e,m]),(0,q.useEffect)(()=>{if(!r)return;let e=()=>m();return r.addEventListener(`scroll`,e),r.addEventListener(`select`,e),r.addEventListener(`click`,e),()=>{r.removeEventListener(`scroll`,e),r.removeEventListener(`select`,e),r.removeEventListener(`click`,e)}},[r,m]);let h=a?.query??``,g=$e({queryKey:[`file-mention`,h],enabled:a!==null,placeholderData:U,staleTime:5e3,queryFn:async({signal:e})=>{let t=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},signal:e,body:JSON.stringify({scope:`files`,query:h})});if(!t.ok)throw Error(`Search failed (${t.status})`);return await t.json()}}),_=g.data?.items??[],v=a!==null&&(_.length>0||g.isFetching),y=(0,q.useCallback)(r=>{if(!a)return;let i=n.current;if(!i)return;let s=e.slice(0,a.atStart),c=e.slice(d.current),l=`@${r} `;t(s+l+c),o(null),requestAnimationFrame(()=>{i.selectionStart=i.selectionEnd=(s+l).length,i.focus()})},[a,e,t]),b=(0,q.useCallback)(e=>{if(!v)return!1;if(e.key===`ArrowDown`){e.preventDefault();let t=_.length;return t>0&&c(e=>(e+1)%t),!0}if(e.key===`ArrowUp`){e.preventDefault();let t=_.length;return t>0&&c(e=>e===0?t-1:e-1),!0}return(e.key===`Enter`||e.key===`Tab`)&&_[s]?(e.preventDefault(),y(_[s].path),!0):e.key===`Escape`?(e.preventDefault(),o(null),!0):!1},[v,_,s,y]),x=(0,q.useCallback)(e=>y(e),[y]);return{isOpen:v,results:_,focusedIndex:s,query:h,isFetching:g.isFetching,cursorTop:l,handleKeyDown:b,onSelect:x,setFocusedIndex:c,setTextareaRef:p}}function tH(e,t){let n=t.trim().toLowerCase();if(!n)return[];let r=e.toLowerCase(),i=[],a=0;for(let e=0;e<r.length&&a<n.length;e++)if(r[e]===n[a]){let t=i[i.length-1];t&&t[1]===e?t[1]=e+1:i.push([e,e+1]),a++}return a===n.length?i:[]}function nH({text:e,ranges:t}){if(!t.length)return(0,J.jsx)(J.Fragment,{children:e});let n=[],r=0;return t.forEach(([t,i],a)=>{t>r&&n.push(e.slice(r,t)),n.push((0,J.jsx)(`mark`,{className:`mention-highlight`,children:e.slice(t,i)},a)),r=i}),r<e.length&&n.push(e.slice(r)),(0,J.jsx)(J.Fragment,{children:n})}var rH=e=>{let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t+1)},iH=e=>{let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)};function aH({results:e,focusedIndex:t,query:n,cursorTop:r,onSelect:i,onHover:a}){let o=(0,q.useRef)(null);return(0,q.useEffect)(()=>{(o.current?.querySelector(`[data-focused="true"]`))?.scrollIntoView({block:`nearest`})},[t]),e.length===0?null:(0,J.jsx)(`div`,{className:`mention-dropdown`,ref:o,role:`listbox`,"aria-label":`File suggestions`,style:{top:r},children:e.map((e,r)=>{let o=iH(e.path),s=tH(o,n),c=r===t;return(0,J.jsxs)(`div`,{role:`option`,"aria-selected":c,"data-focused":c,className:`mention-item ${c?`mention-item-focused`:``}`,onMouseDown:t=>{t.preventDefault(),i(e.path)},onMouseEnter:()=>a(r),children:[(0,J.jsx)(`span`,{className:`mention-icon`,children:(0,J.jsx)(qD,{size:13})}),(0,J.jsxs)(`div`,{className:`mention-info`,children:[(0,J.jsx)(`span`,{className:`mention-name`,children:(0,J.jsx)(nH,{text:o,ranges:s})}),(0,J.jsx)(`span`,{className:`mention-dir`,children:rH(e.path)||`./`})]})]},e.path)})})}function oH(e){return e.replace(/@([^\s@]+)/g,(e,t)=>`[${t.split(`/`).pop()||t}](file-mention://${t})`)}function sH({id:e,value:t,onChange:n,placeholder:r,rows:i=3,ariaLabel:a,textareaClassName:o,onSubmitShortcut:s}){let[c,l]=(0,q.useState)(`write`),u=(0,q.useRef)(null),d=(0,q.useRef)(null),f=eH(t,n),p=(0,q.useRef)(t);(0,q.useEffect)(()=>{p.current=t},[t]),(0,q.useEffect)(()=>{c===`preview`&&d.current?.focus()},[c]);let m=async e=>{let r=e.clipboardData.items,i=null;for(let e=0;e<r.length;e++){let t=r[e];if(t.kind===`file`&&t.type.startsWith(`image/`)){i=t.getAsFile();break}}if(!i)return;e.preventDefault();let a=u.current;if(!a)return;let o=a.selectionStart,s=a.selectionEnd,c=Math.random().toString(36).slice(2,8),l=`![Uploading image… ${c}]()`,d=t.slice(0,o)+l+t.slice(s);n(d),p.current=d;try{let e=new FormData;e.append(`file`,i,i.name||`pasted-${c}.png`);let t=await fetch(`/api/attachments`,{method:`POST`,body:e});if(!t.ok)throw Error(`HTTP ${t.status}`);let r=await t.json();if(!r.url)throw Error(r.error||`Upload failed`);n(p.current.replace(l,`![pasted image](${r.url})`))}catch(e){console.error(`Image upload failed:`,e),n(p.current.replace(l,`![upload failed]()`))}};return(0,J.jsxs)(`div`,{className:`md-field`,children:[(0,J.jsxs)(`div`,{className:`comment-form-tabs`,role:`tablist`,"aria-label":`Markdown editor mode`,children:[(0,J.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":c===`write`,onClick:()=>l(`write`),onKeyDown:e=>{e.key===`ArrowRight`&&(e.preventDefault(),l(`preview`))},className:`comment-form-tab-btn ${c===`write`?`comment-form-tab-btn-active`:`comment-form-tab-btn-inactive`}`,children:`Write`}),(0,J.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":c===`preview`,onClick:()=>l(`preview`),onKeyDown:e=>{e.key===`ArrowLeft`&&(e.preventDefault(),l(`write`))},className:`comment-form-tab-btn ${c===`preview`?`comment-form-tab-btn-active`:`comment-form-tab-btn-inactive`}`,children:`Preview`})]}),c===`write`?(0,J.jsxs)(`div`,{style:{position:`relative`},children:[(0,J.jsx)(`textarea`,{id:e,ref:e=>{u.current=e,f.setTextareaRef(e)},className:o,value:t,rows:i,placeholder:r,"aria-label":a,onChange:e=>n(e.target.value),onPaste:m,onKeyDown:e=>{f.handleKeyDown(e)||(e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),s?.()),e.key===`p`&&(e.metaKey||e.ctrlKey)&&e.shiftKey&&(e.preventDefault(),l(e=>e===`write`?`preview`:`write`)))}}),f.isOpen&&(0,J.jsx)(aH,{results:f.results,focusedIndex:f.focusedIndex,query:f.query,cursorTop:f.cursorTop,onSelect:f.onSelect,onHover:f.setFocusedIndex})]}):(0,J.jsx)(`div`,{ref:d,className:`md-field-preview markdown-body`,role:`tabpanel`,"aria-label":`Markdown preview`,tabIndex:0,onKeyDown:e=>{e.key===`p`&&(e.metaKey||e.ctrlKey)&&e.shiftKey&&(e.preventDefault(),l(`write`))},children:t.trim()?(0,J.jsx)(QV,{content:oH(t)}):(0,J.jsx)(`span`,{className:`md-field-empty`,children:`Nothing to preview`})})]})}var cH=`diffing-submit-panel-height`,lH=`diffing-submit-panel-width`,uH=[{label:`S`,width:420,height:340},{label:`M`,width:480,height:440},{label:`L`,width:560,height:560},{label:`XL`,width:640,height:760}],dH=480,fH=520;function pH(e){return Number.isFinite(e)?Math.max(280,Math.min(760,e)):dH}function mH(e){return Number.isFinite(e)?Math.max(360,Math.min(720,e)):fH}function hH(){let e=iD(cH);if(e==null)return dH;let t=Number(e);return Number.isFinite(t)?pH(t):dH}function gH(){let e=iD(lH);if(e==null)return fH;let t=Number(e);return Number.isFinite(t)?mH(t):fH}function _H(e,t){if(!(!e||typeof e.setPointerCapture!=`function`))try{e.setPointerCapture(t)}catch{}}function vH(e,t){if(!(!e||typeof e.releasePointerCapture!=`function`))try{e.hasPointerCapture?.(t)&&e.releasePointerCapture(t)}catch{}}function yH(){let[e,t]=(0,q.useState)(()=>hH()),[n,r]=(0,q.useState)(()=>gH()),i=(0,q.useRef)(null),a=(0,q.useRef)(e);a.current=e;let o=(0,q.useRef)(n);o.current=n;let s=(0,q.useRef)(!1),c=(0,q.useRef)(0),l=(0,q.useCallback)(()=>{s.current=!0,c.current=1/0},[]),u=(0,q.useCallback)(()=>{s.current=!1,c.current=Date.now()+200},[]),d=(0,q.useCallback)(()=>s.current||Date.now()<c.current,[]),f=(0,q.useCallback)((e,t,n)=>{if(!e&&d()){t?.cancel?.();return}n(e)},[d]),p=(0,q.useCallback)(e=>{let n=pH(e);t(n),cD(cH,String(n))},[]),m=(0,q.useCallback)(e=>{let t=mH(e);r(t),cD(lH,String(t))},[]),h=(0,q.useCallback)(e=>{m(e.width),p(e.height)},[m,p]),g=(()=>{for(let t=0;t<uH.length;t++){let r=uH[t];if(Math.abs(e-r.height)<1&&Math.abs(n-r.width)<1)return t}return-1})(),_=(0,q.useCallback)(e=>{if(e.button!==0)return;e.preventDefault();let n=i.current;if(!n)return;let r=e.currentTarget,o=e.pointerId;_H(r,o),l();let s=e.clientY,c=a.current,d=c,f=0,p=()=>{f=0,n.style.setProperty(`--submit-panel-height`,`${d}px`)},m=e=>{e.pointerId===o&&(d=pH(c+(e.clientY-s)),f||=requestAnimationFrame(p))},h=e=>{e.pointerId===o&&(f&&cancelAnimationFrame(f),t(d),cD(cH,String(d)),vH(r,o),u(),document.removeEventListener(`pointermove`,m),document.removeEventListener(`pointerup`,h),document.removeEventListener(`pointercancel`,h),document.body.style.cursor=``,document.body.style.userSelect=``)};document.addEventListener(`pointermove`,m),document.addEventListener(`pointerup`,h),document.addEventListener(`pointercancel`,h),document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`},[l,u]),v=(0,q.useCallback)(e=>{if(e.button!==0)return;e.preventDefault();let t=i.current;if(!t)return;let n=e.currentTarget,a=e.pointerId;_H(n,a),l();let s=e.clientX,c=o.current,d=c,f=0,p=()=>{f=0,t.style.setProperty(`--submit-panel-width`,`${d}px`)},m=e=>{e.pointerId===a&&(d=mH(c+(s-e.clientX)),f||=requestAnimationFrame(p))},h=e=>{e.pointerId===a&&(f&&cancelAnimationFrame(f),r(d),cD(lH,String(d)),vH(n,a),u(),document.removeEventListener(`pointermove`,m),document.removeEventListener(`pointerup`,h),document.removeEventListener(`pointercancel`,h),document.body.style.cursor=``,document.body.style.userSelect=``)};document.addEventListener(`pointermove`,m),document.addEventListener(`pointerup`,h),document.addEventListener(`pointercancel`,h),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[l,u]),y=(0,q.useCallback)(e=>{if(e.button!==0)return;e.preventDefault();let n=i.current;if(!n)return;let s=e.currentTarget,c=e.pointerId;_H(s,c),l();let d=e.clientX,f=e.clientY,p=o.current,m=a.current,h=p,g=m,_=0,v=()=>{_=0,n.style.setProperty(`--submit-panel-width`,`${h}px`),n.style.setProperty(`--submit-panel-height`,`${g}px`)},y=e=>{if(e.pointerId!==c)return;let t=d-e.clientX,n=e.clientY-f;h=mH(p+t),g=pH(m+n),_||=requestAnimationFrame(v)},b=e=>{e.pointerId===c&&(_&&cancelAnimationFrame(_),r(h),t(g),cD(lH,String(h)),cD(cH,String(g)),vH(s,c),u(),document.removeEventListener(`pointermove`,y),document.removeEventListener(`pointerup`,b),document.removeEventListener(`pointercancel`,b),document.body.style.cursor=``,document.body.style.userSelect=``)};document.addEventListener(`pointermove`,y),document.addEventListener(`pointerup`,b),document.addEventListener(`pointercancel`,b),document.body.style.cursor=`nesw-resize`,document.body.style.userSelect=`none`},[l,u]);return(0,q.useEffect)(()=>()=>{document.body.style.cursor=``,document.body.style.userSelect=``},[]),{height:e,width:n,setHeight:p,setWidth:m,applyPreset:h,activePreset:g,startResize:_,startLeftResize:v,startCornerResize:y,handleOpenChange:f,popoverStyle:{"--submit-panel-height":`${e}px`,"--submit-panel-width":`${n}px`},panelRef:i}}var bH=q.createContext(void 0);function xH(e){let t=q.useContext(bH);if(e===!1&&t===void 0)throw Error(kg(27));return t}var SH={...vw,...cw},CH=q.forwardRef(function(e,t){let{render:n,className:r,forceRender:i=!1,...a}=e,{store:o}=xH(),s=o.useState(`open`),c=o.useState(`nested`),l=o.useState(`mounted`),u=o.useState(`transitionStatus`);return ex(`div`,e,{state:q.useMemo(()=>({open:s,transitionStatus:u}),[s,u]),ref:[o.context.backdropRef,t],stateAttributesMapping:SH,props:[{role:`presentation`,hidden:!l,style:{userSelect:`none`,WebkitUserSelect:`none`}},a],enabled:i||!c})}),wH=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),TH=function(e){return e[e.open=lw.open]=`open`,e[e.closed=lw.closed]=`closed`,e[e.startingStyle=lw.startingStyle]=`startingStyle`,e[e.endingStyle=lw.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),EH=q.createContext(void 0);function DH(){let e=q.useContext(EH);if(e===void 0)throw Error(kg(26));return e}var OH={...vw,...cw,nestedDialogOpen(e){return e?{[TH.nestedDialogOpen]:``}:null}},kH=q.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,...o}=e,{store:s}=xH(),c=s.useState(`descriptionElementId`),l=s.useState(`disablePointerDismissal`),u=s.useState(`floatingRootContext`),d=s.useState(`popupProps`),f=s.useState(`modal`),p=s.useState(`mounted`),m=s.useState(`nested`),h=s.useState(`nestedOpenDialogCount`),g=s.useState(`open`),_=s.useState(`openMethod`),v=s.useState(`titleElementId`),y=s.useState(`transitionStatus`),b=s.useState(`role`);DH(),mC({open:g,ref:s.context.popupRef,onComplete(){g&&s.context.onOpenChangeComplete?.(!0)}});function x(e){return e===`touch`?s.context.popupRef.current:!0}let S=i===void 0?x:i,C=h>0,w=ex(`div`,e,{state:q.useMemo(()=>({open:g,nested:m,transitionStatus:y,nestedDialogOpen:C}),[g,m,y,C]),props:[d,{"aria-labelledby":v??void 0,"aria-describedby":c??void 0,role:b,tabIndex:-1,hidden:!p,onKeyDown(e){kk.has(e.key)&&e.stopPropagation()},style:{[wH.nestedDialogs]:h}},o],ref:[t,s.context.popupRef,s.useStateSetter(`popupElement`)],stateAttributesMapping:OH});return(0,J.jsx)(bx,{context:u,openInteractionType:_,disabled:!p,closeOnFocusOut:!l,initialFocus:S,returnFocus:r,modal:f!==!1,restoreFocus:`popup`,children:w})}),AH=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=xH(),a=i.useState(`mounted`),o=i.useState(`modal`);return a||n?(0,J.jsx)(EH.Provider,{value:n,children:(0,J.jsxs)(lx,{ref:t,...r,children:[a&&o===!0&&(0,J.jsx)(yk,{ref:i.context.internalBackdropRef,inert:Xw(!open)}),e.children]})}):null});function jH(e){let{store:t,parentContext:n,actionsRef:r}=e,i=t.useState(`open`),a=t.useState(`disablePointerDismissal`),o=t.useState(`modal`),s=t.useState(`popupElement`),{openMethod:c,triggerProps:l,reset:u}=ak(i);_C(t);let{forceUnmount:d}=vC(i,t,()=>{u()}),f=m_(e=>{let n=ab(e);return n.preventUnmountOnClose=()=>{t.set(`preventUnmountingOnClose`,!0)},n}),p=q.useCallback(()=>{t.setOpen(!1,f(rb))},[t,f]);q.useImperativeHandle(r,()=>({unmount:d,close:p}),[d,p]);let m=TC({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[h,g]=q.useState(0),_=h===0,v=YC(m),y=IS(m,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=R_(e);if(_&&!a){let e=n;return o&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||L_(e,s)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:_});QO(i&&o===!0,s);let{getReferenceProps:b,getFloatingProps:x,getTriggerProps:S}=RC([v,y]);t.useContextCallback(`onNestedDialogOpen`,e=>{g(e+1)}),t.useContextCallback(`onNestedDialogClose`,()=>{g(0)}),q.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(h),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[i,n,h]);let C=q.useMemo(()=>b(l),[b,l]),w=q.useMemo(()=>S(l),[S,l]),T=q.useMemo(()=>x(),[x]);t.useSyncedValues({openMethod:c,activeTriggerProps:C,inactiveTriggerProps:w,popupProps:T,floatingRootContext:m,nestedOpenDialogCount:h})}var MH={...SC,modal:Q(e=>e.modal),nested:Q(e=>e.nested),nestedOpenDialogCount:Q(e=>e.nestedOpenDialogCount),disablePointerDismissal:Q(e=>e.disablePointerDismissal),openMethod:Q(e=>e.openMethod),descriptionElementId:Q(e=>e.descriptionElementId),titleElementId:Q(e=>e.titleElementId),viewportElement:Q(e=>e.viewportElement),role:Q(e=>e.role)},NH=class extends lC{constructor(e){super(PH(e),{popupRef:q.createRef(),backdropRef:q.createRef(),internalBackdropRef:q.createRef(),triggerElements:new yC,onOpenChange:void 0,onOpenChangeComplete:void 0},MH)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;let n={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit(`openchange`,n);let r={open:e},i=t.trigger?.id??null;(i||e)&&(r.activeTriggerId=i,r.activeTriggerElement=t.trigger??null),this.update(r)}};function PH(e={}){return{...xC(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:`dialog`,...e}}function FH(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null}=e,f=xH(!0),p=!!f,m=Ng(()=>l?.store??new NH({open:n??r,activeTriggerId:u===void 0?d:u,modal:s,disablePointerDismissal:o,nested:p})).current;m.useControlledProp(`open`,n,r),m.useControlledProp(`activeTriggerId`,u,d),m.useSyncedValues({disablePointerDismissal:o,nested:p,modal:s}),m.useContextCallback(`onOpenChange`,i),m.useContextCallback(`onOpenChangeComplete`,a);let h=m.useState(`payload`);jH({store:m,actionsRef:c,parentContext:f?.store.context,onOpenChange:i,triggerIdProp:u});let g=q.useMemo(()=>({store:m}),[m]);return(0,J.jsx)(bH.Provider,{value:g,children:typeof t==`function`?t({payload:h}):t})}function IH({open:e,onClose:t,className:n,ariaLabel:r,initialFocus:i,onKeyDown:a,role:o=`dialog`,ariaBusy:s,children:c}){return(0,J.jsx)(FH,{open:e,onOpenChange:e=>{e||t()},children:(0,J.jsxs)(AH,{children:[(0,J.jsx)(CH,{className:`ui-modal-backdrop`}),(0,J.jsx)(kH,{className:`ui-modal-popup ${n??``}`,"aria-label":r,initialFocus:i,onKeyDown:a,role:o,"aria-busy":s||void 0,children:c})]})})}function LH({open:e,title:t,description:n,detail:r,confirmLabel:i=`Confirm`,cancelLabel:a=`Cancel`,busyLabel:o=`Working…`,variant:s=`danger`,icon:c,busy:l=!1,error:u,onConfirm:d,onCancel:f}){let p=(0,q.useRef)(null);return(0,J.jsxs)(IH,{open:e,onClose:()=>{l||f()},className:`confirm-dialog`,ariaLabel:t,initialFocus:p,role:`alertdialog`,ariaBusy:l,children:[(0,J.jsxs)(`div`,{className:`confirm-dialog-header`,children:[(0,J.jsx)(`span`,{className:`confirm-dialog-icon confirm-dialog-icon-${s}`,"aria-hidden":`true`,children:c??(0,J.jsx)(BO,{size:18})}),(0,J.jsx)(`h2`,{className:`confirm-dialog-title`,children:t})]}),n&&(0,J.jsx)(`p`,{className:`confirm-dialog-desc`,children:n}),r?.trim()&&(0,J.jsx)(`blockquote`,{className:`confirm-dialog-detail`,title:r,children:r.trim()}),u&&(0,J.jsx)(`p`,{className:`confirm-dialog-error`,role:`alert`,children:u}),(0,J.jsxs)(`div`,{className:`confirm-dialog-footer`,children:[(0,J.jsx)(`button`,{ref:p,type:`button`,className:`btn btn-sm confirm-dialog-cancel`,onClick:f,disabled:l,children:a}),(0,J.jsxs)(`button`,{type:`button`,className:`btn btn-sm confirm-dialog-confirm confirm-dialog-confirm-${s}`,onClick:()=>void d(),disabled:l,children:[l&&(0,J.jsx)(cO,{size:13,className:`spin`,"aria-hidden":`true`}),l?o:i]})]})]})}var RH=[{value:`approved`,label:`Approve`,description:`The changes look good — the agent can proceed.`,icon:wD,className:`plan-verdict-approve`},{value:`changes-requested`,label:`Request edits`,description:`The agent should address the comments and apply edits.`,icon:mO,className:`plan-verdict-changes`},{value:`rejected`,label:`Reject`,description:`Don't keep building on this — the approach needs rethinking.`,icon:WO,className:`plan-verdict-reject`},{value:`comment-only`,label:`Comment only`,description:`Agent must NOT edit files — only reply to comments. General note goes to chat.`,icon:hO,className:`plan-verdict-comment-only`}];function zH({comments:e,totalFileCount:t,viewedFileCount:n,requireViewAllBeforeSend:r,onEditComment:i,onDeleteComment:a,onSend:o,sending:s,agentWaiting:c,waitingAgents:l=[],onCopyComments:u,onCopyMarkdown:d}){let{haptic:f,sound:p}=xT(),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(``),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(!1),[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(null),{popoverStyle:A,activePreset:j,applyPreset:M,startResize:N,startLeftResize:P,startCornerResize:F,handleOpenChange:I,panelRef:L}=yH(),R=async()=>{u&&(await u(),x(!0),setTimeout(()=>x(!1),2e3))},z=e.length,B=(0,q.useMemo)(()=>[...e].sort((e,t)=>e.createdAt-t.createdAt),[e]),V=Math.max(0,t-n),H=async e=>{if(!v)return`blocked`;k(null),f(`heavy`),p(`send`);let t=v===`comment-only`?`comment-only`:`standard`;try{return await o(v,g,t,e),_(``),y(null),h(!1),C(null),T(!1),`sent`}catch(e){return e?.kind===`secrets`?(C(e.findings),T(!1),`blocked`):(k(e?.message??`The review could not be sent. Please try again.`),`error`)}},U=async()=>{if(v){if(r&&V>0&&!w){f(`medium`),k(null),D(!0);return}await H(w)}};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Pk,{open:m,onOpenChange:(e,t)=>I(e,t,h),ariaLabel:`Submit your review to the agent`,className:`send-review-popover`,trigger:(0,J.jsxs)(`button`,{className:`btn btn-primary btn-sm send-review-btn`,disabled:s,title:l.length>0?`Waiting: ${l.map(e=>e.label||e.model||e.id.slice(0,8)).join(`, `)}`:c?`Agent waiting for your review`:`Submit review to agent`,"aria-label":s?`Sending review`:z>0?`Send review with ${z} comment${z===1?``:`s`}`:`Send review to agent`,children:[c&&(0,J.jsx)(`span`,{className:`agent-waiting-dot`,"aria-hidden":`true`}),(0,J.jsx)(SD,{size:14,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`btn-label`,children:s?`Sending…`:l.length>1?`Send (${l.length})`:z>0?`Send (${z})`:`Send review`})]}),children:(0,J.jsxs)(`div`,{className:`srp`,ref:L,style:A,children:[(0,J.jsx)(`div`,{className:`srp-resize-handle-left`,onPointerDown:P,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize submit panel width`,tabIndex:0}),(0,J.jsxs)(`div`,{className:`srp-head`,children:[(0,J.jsx)(SD,{size:15,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`srp-title`,children:`Submit review`}),(0,J.jsx)(`div`,{className:`srp-size-presets`,role:`group`,"aria-label":`Panel size`,children:uH.map((e,t)=>(0,J.jsx)(`button`,{className:`srp-preset-btn`,role:`radio`,"aria-checked":j===t,"aria-pressed":j===t,onClick:()=>M(e),title:`${e.width}×${e.height}px`,children:e.label},e.label))}),z>0&&(0,J.jsxs)(`span`,{className:`srp-count`,children:[z,` comment`,z===1?``:`s`]})]}),l.length>0&&(0,J.jsxs)(`div`,{className:`srp-agents`,"aria-label":`Waiting agents`,children:[(0,J.jsx)(`span`,{className:`srp-agents-label`,children:l.length===1?`Agent waiting`:`${l.length} agents waiting`}),(0,J.jsx)(`ul`,{className:`srp-agents-list`,children:l.map(e=>(0,J.jsxs)(`li`,{className:`srp-agent-chip`,title:e.id,children:[(0,J.jsx)(`span`,{className:`agent-waiting-dot`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`srp-agent-name`,children:e.label||e.model||e.id.slice(0,8)}),e.model&&e.label&&(0,J.jsx)(`span`,{className:`srp-agent-model`,children:e.model})]},e.id))})]}),(0,J.jsxs)(`div`,{className:`srp-scroll`,children:[(0,J.jsx)(`div`,{className:`plan-verdict-options`,role:`radiogroup`,"aria-label":`Verdict`,children:RH.map(e=>{let t=e.icon,n=v===e.value;return(0,J.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,className:`plan-verdict-option ${e.className} ${n?`plan-verdict-option-selected`:``}`,onClick:()=>y(e.value),children:[(0,J.jsx)(`span`,{className:`plan-verdict-icon`,children:(0,J.jsx)(t,{size:15,"aria-hidden":`true`})}),(0,J.jsxs)(`span`,{className:`plan-verdict-text`,children:[(0,J.jsx)(`span`,{className:`plan-verdict-label`,children:e.label}),(0,J.jsx)(`span`,{className:`plan-verdict-desc`,children:e.description})]}),(0,J.jsx)(`span`,{className:`plan-verdict-radio`,"aria-hidden":`true`})]},e.value)})}),z>0?(0,J.jsx)(`ul`,{className:`srp-list`,"aria-label":`Comments to send`,children:B.map(e=>(0,J.jsx)(BH,{comment:e,onEdit:i,onDelete:a},e.id))}):(0,J.jsx)(`p`,{className:`srp-empty`,children:`No inline comments — your verdict and overall note will be sent on their own.`}),V>0&&(0,J.jsx)(`div`,{className:`srp-warning`,role:`note`,"data-tone":`muted`,children:(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`strong`,{children:V}),` of `,(0,J.jsx)(`strong`,{children:t}),` file`,t===1?``:`s`,` still unviewed.`,r&&(0,J.jsx)(J.Fragment,{children:` Sending will require an extra confirmation.`})]})}),S&&(0,J.jsxs)(`div`,{className:`srp-warning srp-warning-danger`,role:`alert`,"data-tone":`danger`,children:[(0,J.jsxs)(`div`,{className:`srp-warning-head`,children:[(0,J.jsx)(FO,{size:14,"aria-hidden":`true`}),(0,J.jsxs)(`strong`,{children:[S.length,` possible secret`,S.length===1?``:`s`,` detected`]})]}),(0,J.jsx)(`ul`,{className:`srp-warning-list`,children:S.map((e,t)=>(0,J.jsxs)(`li`,{children:[(0,J.jsx)(`code`,{children:e.rule}),`: `,(0,J.jsx)(`code`,{children:e.snippet}),` `,(0,J.jsxs)(`span`,{className:`srp-warning-source`,children:[`in `,e.source]})]},t))}),(0,J.jsxs)(`div`,{className:`srp-warning-actions`,children:[(0,J.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>C(null),disabled:s,children:`Cancel & edit`}),(0,J.jsx)(`button`,{className:`btn btn-sm btn-danger`,onClick:()=>{T(!0),C(null),H(!0)},disabled:s,children:`Send anyway`})]})]}),O&&(0,J.jsxs)(`div`,{className:`srp-warning srp-warning-danger`,role:`alert`,"data-tone":`danger`,children:[(0,J.jsx)(FO,{size:14,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:O})]}),(0,J.jsxs)(`div`,{className:`srp-general`,children:[(0,J.jsxs)(`label`,{className:`srp-general-label`,htmlFor:`srp-general-input`,children:[`Overall comment `,(0,J.jsx)(`span`,{className:`srp-optional`,children:`(optional · Markdown)`})]}),(0,J.jsx)(sH,{id:`srp-general-input`,value:g,onChange:_,textareaClassName:`srp-general-input`,placeholder:`Add an overall note for the agent that applies to the whole review…`,rows:3,ariaLabel:`Overall review comment`,onSubmitShortcut:U})]})]}),(0,J.jsxs)(`div`,{className:`srp-footer`,children:[u&&(0,J.jsxs)(`div`,{style:{marginRight:`auto`,display:`flex`,gap:6},children:[(0,J.jsx)(`button`,{className:`btn btn-sm`,onClick:R,disabled:z===0,children:b?`Copied!`:`Copy XML`}),d&&(0,J.jsx)(`button`,{className:`btn btn-sm`,onClick:async()=>{try{await d(),x(!0),setTimeout(()=>x(!1),1500)}catch{}},disabled:z===0,title:`Copy review as Markdown`,children:`Copy MD`})]}),(0,J.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>h(!1),disabled:s,children:`Cancel`}),(0,J.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:U,disabled:!v||s,children:s?`Sending…`:`Send review`})]}),(0,J.jsx)(`div`,{className:`srp-resize-handle`,onPointerDown:N,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize submit panel`,tabIndex:0}),(0,J.jsx)(`div`,{className:`srp-resize-handle-corner`,onPointerDown:F,role:`separator`,"aria-label":`Resize submit panel width and height`,tabIndex:0})]})}),(0,J.jsx)(LH,{open:E,title:`Send with ${V} unviewed file${V===1?``:`s`}?`,description:`The review may miss changes in files you have not marked as viewed. Send only if you intentionally want to continue.`,confirmLabel:`Send anyway`,busyLabel:`Sending…`,variant:`warning`,busy:s,error:O,onConfirm:async()=>{T(!0),await H(!0)!==`error`&&D(!1)},onCancel:()=>{D(!1),T(!1),k(null)}})]})}function BH({comment:e,onEdit:t,onDelete:n}){let[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.body),s=(0,q.useRef)(null);(0,q.useEffect)(()=>{r&&(s.current?.focus(),s.current?.select())},[r]);let c=e.lineNumber>0?e.startLineNumber&&e.startLineNumber!==e.lineNumber?`:${e.startLineNumber}-${e.lineNumber}`:`:${e.lineNumber}`:` · file`,l=()=>{let n=a.trim();n&&n!==e.body&&t(e.id,n),i(!1)};return(0,J.jsxs)(`li`,{className:`srp-item`,children:[(0,J.jsxs)(`div`,{className:`srp-item-top`,children:[(0,J.jsxs)(`span`,{className:`srp-item-loc`,children:[(0,J.jsx)(`span`,{className:`srp-item-file`,children:IT(e.filePath)}),(0,J.jsx)(`span`,{className:`srp-item-line`,children:c})]}),e.status===`resolved`&&(0,J.jsx)(`span`,{className:`srp-item-resolved`,children:`resolved`}),(0,J.jsxs)(`span`,{className:`srp-item-actions`,children:[r?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{className:`srp-icon-btn`,onClick:l,title:`Save edit`,children:(0,J.jsx)(wD,{size:13,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{className:`srp-icon-btn`,onClick:()=>{o(e.body),i(!1)},title:`Cancel edit`,children:(0,J.jsx)(WO,{size:13,"aria-hidden":`true`})})]}):(0,J.jsx)(`button`,{className:`srp-icon-btn`,onClick:()=>i(!0),title:`Edit comment`,children:(0,J.jsx)(DO,{size:13,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{className:`srp-icon-btn srp-icon-btn-danger`,onClick:()=>n(e.id),title:`Remove from review`,children:(0,J.jsx)(zO,{size:13,"aria-hidden":`true`})})]})]}),e.lineContent?.trim()&&(0,J.jsx)(`code`,{className:`srp-item-code`,children:e.lineContent.trim().slice(0,160)}),r?(0,J.jsx)(`textarea`,{ref:s,className:`srp-item-edit`,value:a,rows:2,onChange:e=>o(e.target.value),onKeyDown:t=>{t.key===`Enter`&&(t.metaKey||t.ctrlKey)?(t.preventDefault(),l()):t.key===`Escape`&&(t.preventDefault(),o(e.body),i(!1))}}):(0,J.jsx)(`p`,{className:`srp-item-body`,children:e.body})]})}function VH({lastRound:e}){let{data:t=[],isFetching:n,refetch:r}=$e({queryKey:[`review-history`],queryFn:async()=>{let e=await fetch(`/api/review/history`);return e.ok?(await e.json()).rounds??[]:[]},enabled:!1});return!e||e<1?null:(0,J.jsxs)(Pk,{side:`bottom`,align:`start`,ariaLabel:`Review history`,className:`review-history-popup`,onOpenChange:e=>{e&&r()},trigger:(0,J.jsxs)(`button`,{type:`button`,className:`toolbar-last-send toolbar-last-send-btn`,title:`Review history — past handoff rounds`,"aria-label":`Open review history`,children:[(0,J.jsx)(nO,{size:12,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`toolbar-last-send-dot`,"aria-hidden":`true`}),`Round `,e]}),children:[(0,J.jsxs)(`div`,{className:`review-history-header`,children:[(0,J.jsx)(nO,{size:14}),(0,J.jsx)(`strong`,{children:`Review history`}),n&&(0,J.jsx)(`span`,{className:`review-history-loading`,children:`Loading…`})]}),t.length===0?(0,J.jsx)(`p`,{className:`review-history-empty`,children:`No handoffs recorded yet (history is in-memory).`}):(0,J.jsx)(`ul`,{className:`review-history-list`,children:t.map(e=>(0,J.jsxs)(`li`,{className:`review-history-item`,children:[(0,J.jsxs)(`div`,{className:`review-history-item-top`,children:[(0,J.jsxs)(`span`,{className:`review-history-round`,children:[`Round `,e.round]}),e.decision&&(0,J.jsx)(`span`,{className:`review-history-decision`,"data-decision":e.decision,children:e.decision}),e.mode&&e.mode!==`standard`&&(0,J.jsx)(`span`,{className:`review-history-mode`,children:e.mode}),(0,J.jsx)(`span`,{className:`review-history-time`,title:new Date(e.sentAt).toLocaleString(),children:FT(e.sentAt)})]}),(0,J.jsxs)(`div`,{className:`review-history-item-meta`,children:[e.openCount,` open · `,e.filePaths.length,` file`,e.filePaths.length===1?``:`s`]}),e.filePaths.length>0&&(0,J.jsxs)(`div`,{className:`review-history-files`,children:[e.filePaths.slice(0,6).map(e=>(0,J.jsxs)(`span`,{className:`review-history-file`,title:e,children:[(0,J.jsx)(GD,{size:10}),e.split(`/`).pop()]},e)),e.filePaths.length>6&&(0,J.jsxs)(`span`,{className:`review-history-file-more`,children:[`+`,e.filePaths.length-6]})]})]},e.round))})]})}var HH=(0,q.memo)(function({size:e=22,className:t,decorative:n=!0}){return(0,J.jsx)(`img`,{className:t??`brand-mark`,src:`/favicon.svg`,alt:n?``:`diffing`,width:e,height:e,draggable:!1})});function UH(e){let t=q.useRef(!0);t.current&&(t.current=!1,e())}function WH({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=q.useRef(e!==void 0),[a,o]=q.useState(t);return[i?e:a,q.useCallback(e=>{i||o(e)},[])]}var GH=q.createContext(null),KH=q.createContext(null);function qH(){let e=q.useContext(GH);if(e===null)throw Error(kg(60));return e}function JH(){let e=q.useContext(KH);if(e===null)throw Error(kg(61));return e}var YH=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),XH={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},ZH={valid(e){return e===null?null:e?{[YH.valid]:``}:{[YH.invalid]:``}}},QH=q.createContext({invalid:void 0,name:void 0,validityData:{state:XH,errors:[],error:``,value:``,initialValue:null},setValidityData:Ry,disabled:void 0,touched:!1,setTouched:Ry,dirty:!1,setDirty:Ry,filled:!1,setFilled:Ry,focused:!1,setFocused:Ry,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=By)=>e,getInputValidationProps:(e=By)=>e,inputRef:{current:null},commit:async()=>{}}});function $H(e=!0){let t=q.useContext(QH);if(t.setValidityData===Ry&&!e)throw Error(kg(28));return t}var eU=q.createContext({controlId:void 0,setControlId:Ry,labelId:void 0,setLabelId:Ry,messageIds:[],setMessageIds:Ry,getDescriptionProps:e=>e});function tU(){return q.useContext(eU)}function nU(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,setControlId:a}=tU(),o=yw(t);return Z(()=>{if(!(!n&&!t||a===Ry)){if(n){let e=r?.current;Wg(e)&&e.closest(`label`)!=null?a(t??null):a(i??o)}else t&&a(t);return()=>{t&&a(void 0)}}},[t,r,i,a,n,o]),i??o}var rU=(e,t)=>Object.is(e,t);function iU(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function aU(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:iU(e,t,n))}function oU(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:iU(e,t,n))}function sU(e,t,n){return e.filter(e=>!iU(e,t,n))}function cU(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function lU(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function uU(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return cU(e)}function dU(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?cU(e.value):cU(e)}function fU(e,t,n){if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??uU(e,n);if(Array.isArray(t)){let r=lU(t)?t.flatMap(e=>e.items):t;if(e==null){let t=r.find(e=>e.value==null);return t&&t.label!=null?t.label:uU(e,n)}if(typeof e!=`object`){let t=r.find(t=>t&&t.value===e);return t&&t.label!=null?t.label:uU(e,n)}if(`value`in e){let t=r.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return uU(e,n)}function pU(e,t){return!Array.isArray(e)||e.length===0?``:e.map(e=>uU(e,t)).join(`, `)}var mU={id:Q(e=>e.id),modal:Q(e=>e.modal),multiple:Q(e=>e.multiple),items:Q(e=>e.items),itemToStringLabel:Q(e=>e.itemToStringLabel),itemToStringValue:Q(e=>e.itemToStringValue),isItemEqualToValue:Q(e=>e.isItemEqualToValue),value:Q(e=>e.value),open:Q(e=>e.open),mounted:Q(e=>e.mounted),forceMount:Q(e=>e.forceMount),transitionStatus:Q(e=>e.transitionStatus),touchModality:Q(e=>e.touchModality),activeIndex:Q(e=>e.activeIndex),selectedIndex:Q(e=>e.selectedIndex),isActive:Q((e,t)=>e.activeIndex===t),isSelected:Q((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>iU(e,n,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:iU(i,n,r)}),isSelectedByFocus:Q((e,t)=>e.selectedIndex===t),popupProps:Q(e=>e.popupProps),triggerProps:Q(e=>e.triggerProps),triggerElement:Q(e=>e.triggerElement),positionerElement:Q(e=>e.positionerElement),listElement:Q(e=>e.listElement),scrollUpArrowVisible:Q(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Q(e=>e.scrollDownArrowVisible),hasScrollArrows:Q(e=>e.hasScrollArrows),serializedValue:Q(e=>{let{multiple:t,value:n,itemToStringValue:r}=e;return t&&Array.isArray(n)&&n.length===0?``:dU(n,r)})},hU=q.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Ry,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function gU(){return q.useContext(hU)}function _U(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function vU(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=gU(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=$H(),f=m_(e.getValue);Z(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),Z(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:_U(u,c),validate(){let e=n;e===void 0&&(e=f()),l.current=!0,ix.flushSync(()=>o(e))}})},[o,a,t,s,f,r,c,l,i,u,n]),Z(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}function yU(e,t){let n=q.useRef(e),r=m_(t);Z(()=>{n.current!==e&&r(n.current)},[e,r]),Z(()=>{n.current=e},[e])}function bU(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,disabled:l=!1,readOnly:u=!1,required:d=!1,modal:f=!0,actionsRef:p,inputRef:m,onOpenChangeComplete:h,items:g,multiple:_=!1,itemToStringLabel:v,itemToStringValue:y,isItemEqualToValue:b=rU,highlightItemOnHover:x=!0,children:S}=e,{clearErrors:C}=gU(),{setDirty:w,shouldValidateOnChange:T,validityData:E,setFilled:D,name:O,disabled:k,validation:A}=$H(),{controlId:j}=tU(),M=nU({id:t}),N=k||l,P=O??c,[F,I]=WH({controlled:n,default:_?r??zy:r,name:`Select`,state:`value`}),[L,R]=WH({controlled:a,default:o,name:`Select`,state:`open`}),z=q.useRef([]),B=q.useRef([]),V=q.useRef(null),H=q.useRef(null),U=q.useRef(0),W=q.useRef(null),ee=q.useRef([]),te=q.useRef(!1),ne=q.useRef(!1),re=q.useRef(null),ie=q.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ae=q.useRef(!1),{mounted:oe,setMounted:G,transitionStatus:se}=fC(L),K=Ng(()=>new cC({id:M,modal:f,multiple:_,itemToStringLabel:v,itemToStringValue:y,isItemEqualToValue:b,value:F,open:L,mounted:oe,transitionStatus:se,items:g,forceMount:!1,touchModality:!1,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ce=aC(K,mU.activeIndex),le=aC(K,mU.selectedIndex),ue=aC(K,mU.triggerElement),de=aC(K,mU.positionerElement),fe=q.useMemo(()=>_&&Array.isArray(F)&&F.length===0?``:dU(F,y),[_,F,y]),pe=u_(K.state.triggerElement);vU({id:M,commit:A.commit,value:F,controlRef:pe,name:P,getValue:()=>F});let me=q.useRef(F);Z(()=>{F!==me.current&&K.set(`forceMount`,!0)},[K,F]),Z(()=>{D(F!==null)},[F,D]),Z(function(){if(L)return;let e=ee.current;if(_){let t=Array.isArray(F)?F:[];if(t.length===0){K.set(`selectedIndex`,null);return}let n=t[t.length-1],r=oU(e,n,b);K.set(`selectedIndex`,r===-1?null:r);return}let t=oU(e,F,b);K.set(`selectedIndex`,t===-1?null:t)},[_,L,F,ee,b,K]),yU(F,()=>{C(P),w(F!==E.initialValue),T()?A.commit(F):A.commit(F,!0)});let he=m_((e,t)=>{if(s?.(e,t),!t.isCanceled&&(R(e),!e&&K.state.activeIndex!==null)){let e=z.current[K.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),ge=m_(()=>{G(!1),K.set(`activeIndex`,null),h?.(!1)});mC({enabled:!p,open:L,ref:V,onComplete(){L||ge()}}),q.useImperativeHandle(p,()=>({unmount:ge}),[ge]);let _e=m_((e,t)=>{i?.(e,t),!t.isCanceled&&I(e)}),ve=m_(()=>{let e=K.state.listElement||V.current;if(!e)return;let t=e.scrollTop,n=e.scrollTop+e.clientHeight,r=t>1,i=n<e.scrollHeight-1;K.state.scrollUpArrowVisible!==r&&K.set(`scrollUpArrowVisible`,r),K.state.scrollDownArrowVisible!==i&&K.set(`scrollDownArrowVisible`,i)}),ye=CC({open:L,onOpenChange:he,elements:{reference:ue,floating:de}}),{getReferenceProps:be,getFloatingProps:xe,getItemProps:Se}=RC([xx(ye,{enabled:!u&&!N,event:`mousedown`}),IS(ye,{bubbles:!1}),qC(ye,{enabled:!u&&!N,listRef:z,activeIndex:ce,selectedIndex:le,disabledIndices:zy,onNavigate(e){e===null&&!L||K.set(`activeIndex`,e)},focusItemOnHover:!1}),XC(ye,{enabled:!u&&!N&&(L||!_),listRef:B,activeIndex:ce,selectedIndex:le,onMatch(e){L?K.set(`activeIndex`,e):_e(ee.current[e],ab(`none`))},onTypingChange(e){te.current=e}})]);UH(()=>{K.update({popupProps:xe(),triggerProps:be()})}),Z(()=>{K.update({id:M,modal:f,multiple:_,value:F,open:L,mounted:oe,transitionStatus:se,popupProps:xe(),triggerProps:be(),items:g,itemToStringLabel:v,itemToStringValue:y,isItemEqualToValue:b})},[K,M,f,_,F,L,oe,se,xe,be,g,v,y,b]);let Ce=q.useMemo(()=>({store:K,name:P,required:d,disabled:N,readOnly:u,multiple:_,itemToStringLabel:v,itemToStringValue:y,highlightItemOnHover:x,setValue:_e,setOpen:he,listRef:z,popupRef:V,scrollHandlerRef:H,handleScrollArrowVisibility:ve,scrollArrowsMountedCountRef:U,getItemProps:Se,events:ye.context.events,valueRef:W,valuesRef:ee,labelsRef:B,typingRef:te,selectionRef:ie,selectedItemTextRef:re,validation:A,onOpenChangeComplete:h,keyboardActiveRef:ne,alignItemWithTriggerActiveRef:ae,initialValueRef:me}),[K,P,d,N,u,_,v,y,x,_e,he,Se,ye.context.events,A,h,ve]),we=db(m,A.inputRef),Te=_&&Array.isArray(F)&&F.length>0,Ee=q.useMemo(()=>!_||!Array.isArray(F)||!P?null:F.map(e=>{let t=dU(e,y);return(0,J.jsx)(`input`,{type:`hidden`,name:P,value:t},t)}),[_,F,P,y]);return(0,J.jsx)(GH.Provider,{value:Ce,children:(0,J.jsxs)(KH.Provider,{value:ye,children:[S,(0,J.jsx)(`input`,{...A.getInputValidationProps({onFocus(){K.state.triggerElement?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.value,n=ab(Ky,e.nativeEvent);function r(){if(_)return;let e=ee.current.find(e=>dU(e,y).toLowerCase()===t.toLowerCase());e!=null&&(w(e!==E.initialValue),_e(e,n),T()&&A.commit(e))}K.set(`forceMount`,!0),queueMicrotask(r)}}),id:t||j||void 0,name:_?void 0:P,value:fe,disabled:N,required:d&&!Te,readOnly:u,ref:we,style:_b,tabIndex:-1,"aria-hidden":!0}),Ee]})})}function xU(e){let t=e.getBoundingClientRect(),n=window.getComputedStyle(e,`::before`),r=window.getComputedStyle(e,`::after`);if(!(n.content!==`none`||r.content!==`none`))return t;let i=parseFloat(n.width)||0,a=parseFloat(n.height)||0,o=parseFloat(r.width)||0,s=parseFloat(r.height)||0,c=Math.max(t.width,i,o),l=Math.max(t.height,a,s),u=c-t.width,d=l-t.height;return{left:t.left-u/2,right:t.right+u/2,top:t.top-d/2,bottom:t.bottom+d/2}}var SU=2,CU={..._w,...ZH,value:()=>null},wU=q.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,...o}=e,{setTouched:s,setFocused:c,validationMode:l,state:u,disabled:d}=$H(),{labelId:f}=tU(),{store:p,setOpen:m,selectionRef:h,validation:g,readOnly:_,alignItemWithTriggerActiveRef:v,disabled:y,keyboardActiveRef:b}=qH(),x=d||y||i,S=aC(p,mU.open),C=aC(p,mU.value),w=aC(p,mU.triggerProps),T=aC(p,mU.positionerElement),E=aC(p,mU.listElement),D=aC(p,mU.serializedValue),O=u_(T),k=q.useRef(null),A=Rg(),j=Rg(),{getButtonProps:M,buttonRef:N}=dk({disabled:x,native:a}),P=db(t,k,N,m_(e=>{p.set(`triggerElement`,e)})),F=Rg(),I=Rg();q.useEffect(()=>{if(S)return I.start(200,()=>{h.current.allowUnselectedMouseUp=!0,F.start(200,()=>{h.current.allowSelectedMouseUp=!0})}),()=>{F.clear(),I.clear()};h.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},j.clear()},[S,h,j,F,I]);let L=q.useMemo(()=>E?.id??G_(T)?.id,[E,T]),R=Ub(w,{role:`combobox`,"aria-expanded":S?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":S?L:void 0,"aria-labelledby":f,"aria-readonly":_||void 0,tabIndex:x?-1:0,ref:P,onFocus(e){c(!0),S&&v.current&&m(!1,ab(Qy,e.nativeEvent)),A.start(0,()=>{p.set(`forceMount`,!0)})},onBlur(){s(!0),c(!1),l===`onBlur`&&g.commit(C)},onPointerMove({pointerType:e}){b.current=!1,p.set(`touchModality`,e===`touch`)},onPointerDown({pointerType:e}){p.set(`touchModality`,e===`touch`)},onKeyDown(){b.current=!0},onMouseDown(e){if(S)return;let t=Sb(e.currentTarget);function n(e){if(!k.current)return;let t=e.target;if(L_(k.current,t)||L_(O.current,t)||t===k.current)return;let n=xU(k.current);e.clientX>=n.left-SU&&e.clientX<=n.right+SU&&e.clientY>=n.top-SU&&e.clientY<=n.bottom+SU||m(!1,ab(tb,e))}j.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},g.getValidationProps,o,M);R.role=`combobox`;let z=q.useMemo(()=>({...u,open:S,disabled:x,value:C,readOnly:_,placeholder:!D}),[u,S,x,C,_,D]);return ex(`button`,e,{ref:[t,k],state:z,stateAttributesMapping:CU,props:R})}),TU={value:()=>null},EU=q.forwardRef(function(e,t){let{className:n,render:r,children:i,...a}=e,{store:o,valueRef:s}=qH(),c=aC(o,mU.value),l=aC(o,mU.items),u=aC(o,mU.itemToStringLabel),d=aC(o,mU.serializedValue),f=q.useMemo(()=>({value:c,placeholder:!d}),[c,d]),p=typeof i==`function`?i(c):i??(Array.isArray(c)?pU(c,u):fU(c,l,u));return ex(`span`,e,{state:f,ref:[t,s],props:[{children:p},a],stateAttributesMapping:TU})}),DU=q.forwardRef(function(e,t){let{className:n,render:r,...i}=e,{store:a}=qH(),o=aC(a,mU.open);return ex(`span`,e,{state:q.useMemo(()=>({open:o}),[o]),ref:t,props:[{"aria-hidden":!0,children:`▼`},i],stateAttributesMapping:gw})}),OU=q.createContext(void 0),kU=q.forwardRef(function(e,t){let{store:n}=qH(),r=aC(n,mU.mounted),i=aC(n,mU.forceMount);return r||i?(0,J.jsx)(OU.Provider,{value:!0,children:(0,J.jsx)(lx,{ref:t,...e})}):null}),AU=q.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function jU(){return q.useContext(AU)}function MU(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=m_(i),o=q.useRef(0),s=Ng(PU).current,c=Ng(NU).current,[l,u]=q.useState(0),d=q.useRef(l),f=m_((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=m_(e=>{c.delete(e),d.current+=1,u(d.current)}),m=q.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(FU).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);Z(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),Z(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),Z(()=>()=>{n.current=[]},[n]),Z(()=>()=>{r&&(r.current=[])},[r]);let h=m_(e=>(s.add(e),()=>{s.delete(e)}));Z(()=>{s.forEach(e=>e(m))},[s,m]);let g=q.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,J.jsx)(AU.Provider,{value:g,children:t})}function NU(){return new Map}function PU(){return new Set}function FU(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var IU=q.createContext(void 0);function LU(){let e=q.useContext(IU);if(!e)throw Error(kg(59));return e}function RU(e,t){e&&Object.assign(e.style,t)}var zU={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},BU={position:`fixed`},VU=q.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=Uy,..._}=e,{store:v,listRef:y,labelsRef:b,alignItemWithTriggerActiveRef:x,selectedItemTextRef:S,valuesRef:C,initialValueRef:w,popupRef:T,setValue:E}=qH(),D=JH(),O=aC(v,mU.open),k=aC(v,mU.mounted),A=aC(v,mU.modal),j=aC(v,mU.value),M=aC(v,mU.touchModality),N=aC(v,mU.positionerElement),P=aC(v,mU.triggerElement),F=aC(v,mU.isItemEqualToValue),I=q.useRef(null),L=q.useRef(null),[R,z]=q.useState(h),B=k&&R&&!M;!k&&R!==h&&z(h),Z(()=>{k||(mU.scrollUpArrowVisible(v.state)&&v.set(`scrollUpArrowVisible`,!1),mU.scrollDownArrowVisible(v.state)&&v.set(`scrollDownArrowVisible`,!1))},[v,k]),q.useImperativeHandle(x,()=>B),QO((B||A)&&O&&!M,P);let V=Rw({anchor:n,floatingRootContext:D,positionMethod:r,mounted:k,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??B,collisionAvoidance:g,keepMounted:!0}),H=B?`none`:V.side,U=B?BU:V.positionerStyles,W=q.useMemo(()=>{let e={};return O||(e.pointerEvents=`none`),{role:`presentation`,hidden:!k,style:{...U,...e}}},[O,k,U]),ee=q.useMemo(()=>({open:O,side:H,align:V.align,anchorHidden:V.anchorHidden}),[O,H,V.align,V.anchorHidden]),te=ex(`div`,e,{ref:[t,m_(e=>{v.set(`positionerElement`,e)})],state:ee,stateAttributesMapping:vw,props:[W,_]}),ne=q.useRef(0),re=m_(e=>{if(e.size===0&&ne.current===0||C.current.length===0)return;let t=ne.current;if(ne.current=e.size,e.size===t)return;let n=ab(Ky);if(t!==0&&!v.state.multiple&&j!==null&&oU(C.current,j,F)===-1){let e=w.current,t=e!=null&&aU(C.current,e,F)?e:null;E(t,n),t===null&&(v.set(`selectedIndex`,null),S.current=null)}if(t!==0&&v.state.multiple&&Array.isArray(j)){let e=j.filter(e=>aU(C.current,e,F));(e.length!==j.length||e.some(e=>!aU(j,e,F)))&&(E(e,n),e.length===0&&(v.set(`selectedIndex`,null),S.current=null))}if(O&&B){v.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};RU(N,e),RU(T.current,e)}}),ie=q.useMemo(()=>({...V,side:H,alignItemWithTriggerActive:B,setControlledAlignItemWithTrigger:z,scrollUpArrowRef:I,scrollDownArrowRef:L}),[V,H,B,z]);return(0,J.jsx)(MU,{elementsRef:y,labelsRef:b,onMapChange:re,children:(0,J.jsxs)(IU.Provider,{value:ie,children:[k&&A&&(0,J.jsx)(yk,{inert:Xw(!O),cutout:P}),te]})})});function HU(e){let t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}var UU=`base-ui-disable-scrollbar`,WU={className:UU,element:(0,J.jsx)(`style`,{href:UU,precedence:`base-ui:low`,children:`.${UU}{scrollbar-width:none}.${UU}::-webkit-scrollbar{display:none}`})},GU={...vw,...cw},KU=q.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{store:a,popupRef:o,onOpenChangeComplete:s,setOpen:c,valueRef:l,selectedItemTextRef:u,keyboardActiveRef:d,multiple:f,handleScrollArrowVisibility:p,scrollHandlerRef:m}=qH(),{side:h,align:g,alignItemWithTriggerActive:_,setControlledAlignItemWithTrigger:v,scrollDownArrowRef:y,scrollUpArrowRef:b}=LU(),x=jk(!0)!=null,S=JH(),C=Rg(),w=aC(a,mU.id),T=aC(a,mU.open),E=aC(a,mU.mounted),D=aC(a,mU.popupProps),O=aC(a,mU.transitionStatus),k=aC(a,mU.triggerElement),A=aC(a,mU.positionerElement),j=aC(a,mU.listElement),M=q.useRef(0),N=q.useRef(!1),P=q.useRef(0),F=q.useRef(!1),I=q.useRef({}),L=xb(),R=m_(e=>{if(!A||!o.current||!F.current)return;if(N.current||!_){p();return}let t=A.style.top===`0px`,n=A.style.bottom===`0px`,r=A.getBoundingClientRect().height,i=Sb(A),a=getComputedStyle(A),s=parseFloat(a.marginTop),c=parseFloat(a.marginBottom),l=i.documentElement.clientHeight-s-c,u=e.scrollTop,d=e.scrollHeight-e.clientHeight,f=null,m=null,h=!1;if(t){let e=r+(d-u),t=Math.min(e,l);f=t,t===l?h=!0:m=d}else if(n){let e=u-0,t=r+e,n=Math.min(t,l),i=t-l;f=n,n===l?(h=!0,u<d&&(m=u-(e-i))):m=0}f!=null&&(A.style.height=`${f}px`),m!=null&&(e.scrollTop=m),h&&(N.current=!0),p()});q.useImperativeHandle(m,()=>R,[R]),mC({open:T,ref:o,onComplete(){T&&s?.(!0)}});let z=q.useMemo(()=>({open:T,transitionStatus:O,side:h,align:g}),[T,O,h,g]);Z(()=>{!A||!o.current||Object.keys(I.current).length||(I.current={top:A.style.top||`0`,left:A.style.left||`0`,right:A.style.right,height:A.style.height,bottom:A.style.bottom,minHeight:A.style.minHeight,maxHeight:A.style.maxHeight,marginTop:A.style.marginTop,marginBottom:A.style.marginBottom})},[o,A]),Z(()=>{E||_||(F.current=!1,N.current=!1,M.current=0,P.current=0,RU(A,I.current))},[E,_,A,o]),Z(()=>{let e=o.current;if(!(!E||!k||!A||!e)){if(!_){F.current=!0,L.request(p);return}queueMicrotask(()=>{let t=getComputedStyle(A),n=getComputedStyle(e),r=Sb(k),i=Vg(A),a=k.getBoundingClientRect(),o=A.getBoundingClientRect(),s=a.left,c=a.height,d=j||e,f=d.scrollHeight,m=parseFloat(n.borderBottomWidth),h=parseFloat(t.marginTop)||10,g=parseFloat(t.marginBottom)||10,_=parseFloat(t.minHeight)||100,y=r.documentElement.clientHeight-h-g,b=r.documentElement.clientWidth,x=y-a.bottom+c,S=u.current,C=l.current,w=0,T=0;if(S&&C){let e=C.getBoundingClientRect(),t=S.getBoundingClientRect(),n=e.left-s,r=t.left-o.left,i=e.top-a.top+e.height/2,c=t.top-o.top+t.height/2;w=n-r,T=c-i}let E=x+T+g+m,D=Math.min(y,E),O=y-h-g,P=E-D,L=Math.max(5,s+w),R=b-5,z=Math.max(0,L+o.width-R);A.style.left=`${L-z}px`,A.style.height=`${D}px`,A.style.maxHeight=`auto`,A.style.marginTop=`${h}px`,A.style.marginBottom=`${g}px`,e.style.height=`100%`;let B=d.scrollHeight-d.clientHeight,V=P>=B;V&&(D=Math.min(y,o.height)-(P-B));let H=a.top<20||a.bottom>y-20||D<Math.min(f,_),U=(i.visualViewport?.scale??1)!==1&&x_;if(H||U){F.current=!0,RU(A,I.current),ix.flushSync(()=>v(!1));return}if(V){let e=Math.max(0,y-E);A.style.top=o.height>=O?`0`:`${e}px`,A.style.height=`${D}px`,d.scrollTop=d.scrollHeight-d.clientHeight,M.current=Math.max(_,D)}else A.style.bottom=`0`,M.current=Math.max(_,D),d.scrollTop=P;M.current===y&&(N.current=!0),p(),setTimeout(()=>{F.current=!0})})}},[a,E,A,k,l,u,o,p,_,v,L,y,b,j]),q.useEffect(()=>{if(!_||!A||!E)return;let e=Vg(A);function t(e){c(!1,ab(ib,e))}return e.addEventListener(`resize`,t),()=>{e.removeEventListener(`resize`,t)}},[c,_,A,E]);let B={...j?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":f||void 0,id:`${w}-list`},onKeyDown(e){d.current=!0,x&&kk.has(e.key)&&e.stopPropagation()},onMouseMove(){d.current=!1},onPointerLeave(e){if(HU(e)||e.pointerType===`touch`)return;let t=e.currentTarget;C.start(0,()=>{a.set(`activeIndex`,null),t.focus({preventScroll:!0})})},onScroll(e){j||m.current?.(e.currentTarget)},..._&&{style:j?{height:`100%`}:zU}},V=ex(`div`,e,{ref:[t,o],state:z,stateAttributesMapping:GU,props:[D,B,Bw(O),{className:!j&&_?WU.className:void 0},i]});return(0,J.jsxs)(q.Fragment,{children:[WU.element,(0,J.jsx)(bx,{context:S,modal:!1,disabled:!E,restoreFocus:!0,children:V})]})}),qU=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function JU(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=jU(),f=q.useRef(-1),[p,m]=q.useState(a??(i===qU.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=q.useRef(null),g=q.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return Z(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),Z(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),q.useMemo(()=>({ref:g,index:p}),[p,g])}var YU=q.createContext(void 0);function XU(){let e=q.useContext(YU);if(!e)throw Error(kg(57));return e}var ZU=q.memo(q.forwardRef(function(e,t){let{render:n,className:r,value:i=null,label:a,disabled:o=!1,nativeButton:s=!1,...c}=e,l=q.useRef(null),u=JU({label:a,textRef:l,indexGuessBehavior:qU.GuessFromOrder}),{store:d,getItemProps:f,setOpen:p,setValue:m,selectionRef:h,typingRef:g,valuesRef:_,keyboardActiveRef:v,multiple:y,highlightItemOnHover:b}=qH(),x=Rg(),S=aC(d,mU.isActive,u.index),C=aC(d,mU.isSelected,u.index,i),w=aC(d,mU.isSelectedByFocus,u.index),T=aC(d,mU.isItemEqualToValue),E=u.index,D=E!==-1,O=q.useRef(null),k=u_(E);Z(()=>{if(!D)return;let e=_.current;return e[E]=i,()=>{delete e[E]}},[D,E,i,_]),Z(()=>{if(!D)return;let e=d.state.value,t=e;y&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&iU(t,i,T)&&d.set(`selectedIndex`,E)},[D,E,y,T,d,i]);let A=q.useMemo(()=>({disabled:o,selected:C,highlighted:S}),[o,C,S]),j=f({active:S,selected:C});j.onFocus=void 0,j.id=void 0;let M=q.useRef(null),N=q.useRef(`mouse`),P=q.useRef(!1),{getButtonProps:F,buttonRef:I}=dk({disabled:o,focusableWhenDisabled:!0,native:s});function L(e){let t=d.state.value;if(y){let n=Array.isArray(t)?t:[];m(C?sU(n,i,T):[...n,i],ab(Zy,e))}else m(i,ab(Zy,e)),p(!1,ab(Zy,e))}let R={role:`option`,"aria-selected":C,"aria-disabled":o||void 0,tabIndex:S?0:-1,onFocus(){d.set(`activeIndex`,E)},onMouseEnter(){!v.current&&d.state.selectedIndex===null&&d.set(`activeIndex`,E)},onMouseMove(){b&&d.set(`activeIndex`,E)},onMouseLeave(e){!b||v.current||HU(e)||x.start(0,()=>{d.state.activeIndex===E&&d.set(`activeIndex`,null)})},onTouchStart(){h.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(e){M.current=e.key,d.set(`activeIndex`,E)},onClick(e){P.current=!1,!(e.type===`keydown`&&M.current===null)&&(o||M.current===` `&&g.current||N.current!==`touch`&&!S||(M.current=null,L(e.nativeEvent)))},onPointerEnter(e){N.current=e.pointerType},onPointerDown(e){N.current=e.pointerType,P.current=!0},onMouseUp(e){if(o)return;if(P.current){P.current=!1;return}let t=!h.current.allowSelectedMouseUp&&C,n=!h.current.allowUnselectedMouseUp&&!C;t||n||N.current!==`touch`&&!S||L(e.nativeEvent)}},z=ex(`div`,e,{ref:[I,t,u.ref,O],state:A,props:[j,R,c,F]}),B=q.useMemo(()=>({selected:C,indexRef:k,textRef:l,selectedByFocus:w,hasRegistered:D}),[C,k,l,w,D]);return(0,J.jsx)(YU.Provider,{value:B,children:z})})),QU=q.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=XU();return n||r?(0,J.jsx)($U,{...e,ref:t}):null}),$U=q.memo(q.forwardRef((e,t)=>{let{render:n,className:r,keepMounted:i,...a}=e,{selected:o}=XU(),s=q.useRef(null),{transitionStatus:c,setMounted:l}=fC(o),u=q.useMemo(()=>({selected:o,transitionStatus:c}),[o,c]),d=ex(`span`,e,{ref:[t,s],state:u,props:[{"aria-hidden":!0,children:`✔️`},a],stateAttributesMapping:cw});return mC({open:o,ref:s,onComplete(){o||l(!1)}}),d})),eW=q.memo(q.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=XU(),{selectedItemTextRef:o}=qH(),{className:s,render:c,...l}=e;return ex(`div`,e,{ref:[q.useCallback(e=>{if(!e||!a)return;let t=o.current===null||!o.current.isConnected;(i||t&&n.current===0)&&(o.current=e)},[o,n,i,a]),t,r],props:l})}));function tW({value:e,onValueChange:t,options:n,ariaLabel:r,className:i}){return(0,J.jsxs)(bU,{value:e,onValueChange:e=>t(e),modal:!1,children:[(0,J.jsxs)(wU,{className:`ui-select-trigger ${i??``}`,"aria-label":r,children:[(0,J.jsx)(EU,{children:e=>n.find(t=>t.value===e)?.label??e}),(0,J.jsx)(DU,{className:`ui-select-icon`,children:(0,J.jsx)(OD,{size:12})})]}),(0,J.jsx)(kU,{children:(0,J.jsx)(VU,{className:`ui-select-positioner`,sideOffset:4,align:`end`,side:`bottom`,alignItemWithTrigger:!1,children:(0,J.jsx)(KU,{className:`ui-select-popup`,children:n.map(e=>(0,J.jsxs)(ZU,{value:e.value,className:`ui-select-item`,children:[(0,J.jsx)(eW,{children:e.label}),(0,J.jsx)(QU,{className:`ui-select-indicator`,children:(0,J.jsx)(wD,{size:13})})]},e.value))})})})]})}var nW=[{value:`word`,label:`Word`},{value:`word-alt`,label:`Word (alt)`},{value:`char`,label:`Character`},{value:`none`,label:`None`}],rW=[{value:`classic`,label:`Classic (+/−)`},{value:`bars`,label:`Bars`},{value:`none`,label:`None`}],iW=[{value:`line-info`,label:`Line info + context`},{value:`line-info-basic`,label:`Line info`},{value:`metadata`,label:`Metadata only`},{value:`simple`,label:`Simple`}],aW=[{value:`both`,label:`Both`},{value:`line`,label:`Line only`},{value:`number`,label:`Number only`},{value:`disabled`,label:`Disabled`}],oW=[11,12,13,14,15,16].map(e=>({value:String(e),label:`${e}px`})),sW=[2,4,8].map(e=>({value:String(e),label:String(e)})),cW=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`}],lW=[{value:`0`,label:`Disabled`},{value:`100`,label:`100 lines`},{value:`200`,label:`200 lines`},{value:`400`,label:`400 lines`},{value:`800`,label:`800 lines`}],uW=[{value:``,label:`Default`},{value:`chrome`,label:`Chrome`},{value:`firefox`,label:`Firefox`},{value:`edge`,label:`Edge`},{value:`brave`,label:`Brave`}],dW=[{value:`default`,label:`Default / System`},{value:`vscode`,label:`VS Code`},{value:`zed`,label:`Zed`},{value:`vim`,label:`Vim`},{value:`neovim`,label:`Neovim`}];function fW({diffStyle:e,diffOptions:t,defaultTabSize:n,browser:r,editorIDE:i,lineDiffType:a,lineWrap:o,diffIndicators:s,showLineNumbers:c,hunkSeparators:l,lineHoverHighlight:u,fontSize:d,haptics:f,sounds:p,uiFont:m,monoFont:h,density:g,autoCollapseLineThreshold:_,requireViewAllBeforeSend:v=!1,showStatusBar:y,ignoreSpaceChange:b=!1,ignoreAllSpace:x=!1,onDiffStyleChange:S,onDiffOptionsChange:C,onDefaultTabSizeChange:w,onBrowserChange:T,onOpenThemeModal:E,onEditorIDEChange:D,onLineDiffTypeChange:O,onLineWrapChange:k,onDiffIndicatorsChange:A,onShowLineNumbersChange:j,onHunkSeparatorsChange:M,onLineHoverHighlightChange:N,onFontSizeChange:P,onHapticsChange:F,onSoundsChange:I,onDensityChange:L,onAutoCollapseLineThresholdChange:R,onRequireViewAllBeforeSendChange:z,onShowStatusBarChange:B,onIgnoreSpaceChange:V,onIgnoreAllSpaceChange:H,onOpenUiFontModal:U,onOpenMonoFontModal:W,showSource:ee=!0,showWhitespace:te=!0,showExternalTools:ne=!0,showSendPolicy:re=!0}){let[ie,ae]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&(e.key===`,`||e.code===`Comma`)&&(e.preventDefault(),ae(e=>!e))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]),(0,J.jsx)(Pk,{open:ie,onOpenChange:ae,ariaLabel:`Settings`,className:`settings-popover`,trigger:(0,J.jsxs)(`button`,{className:`btn btn-sm settings-btn ${ie?`btn-active`:``}`,title:`Settings (⌘,)`,"aria-label":`Settings`,children:[(0,J.jsx)(PO,{size:14}),(0,J.jsx)(`span`,{className:`btn-label`,children:`Settings`})]}),children:(0,J.jsxs)(`div`,{className:`popover-scroll settings-panel`,children:[ee&&t&&C&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`settings-section-label`,children:`Source`}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:t.staged,onChange:e=>C({...t,staged:e.target.checked})}),`Show staged`]}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:t.untracked,onChange:e=>C({...t,untracked:e.target.checked})}),`Show untracked`]})]}),(0,J.jsx)(`div`,{className:`settings-section-label`,children:`Display`}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Inline diff`}),(0,J.jsx)(tW,{value:a,onValueChange:e=>O(e),options:nW,ariaLabel:`Inline diff style`})]}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>k(e.target.checked)}),`Wrap long lines`]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Diff indicators`}),(0,J.jsx)(tW,{value:s,onValueChange:e=>A(e),options:rW,ariaLabel:`Diff indicators`})]}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>j(e.target.checked)}),`Show line numbers`]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Hunk separator`}),(0,J.jsx)(tW,{value:l,onValueChange:e=>M(e),options:iW,ariaLabel:`Hunk separator style`})]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Hover highlight`}),(0,J.jsx)(tW,{value:u,onValueChange:e=>N(e),options:aW,ariaLabel:`Hover highlight`})]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Font size`}),(0,J.jsx)(tW,{value:String(d),onValueChange:e=>P(Number(e)),options:oW,ariaLabel:`Font size`})]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Default tab size`}),(0,J.jsx)(tW,{value:String(n),onValueChange:e=>w(Number(e)),options:sW,ariaLabel:`Default tab size`})]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`UI font`}),(0,J.jsxs)(`button`,{className:`btn btn-sm settings-btn`,onClick:()=>{ae(!1),U()},title:m??`Default (Geist Mono)`,children:[(0,J.jsx)(VO,{size:13}),(0,J.jsx)(`span`,{className:`settings-value-label`,children:m??`Default…`})]})]}),(0,J.jsx)(`div`,{className:`settings-section-label`,children:`Comfort`}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Density`}),(0,J.jsx)(tW,{value:g,onValueChange:e=>L(e),options:cW,ariaLabel:`UI density`})]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Auto-collapse huge files`}),(0,J.jsx)(tW,{value:String(_),onValueChange:e=>R(Number(e)),options:lW,ariaLabel:`Auto-collapse line threshold`})]}),re&&z&&(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:v,onChange:e=>z(e.target.checked)}),(0,J.jsxs)(`span`,{className:`settings-icon-label`,children:[(0,J.jsx)(IO,{size:12}),` Warn before sending if files are unviewed`]})]}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>B(e.target.checked)}),(0,J.jsxs)(`span`,{className:`settings-icon-label`,children:[(0,J.jsx)(aO,{size:12}),` Show status bar`]})]}),te&&V&&H&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`settings-section-label`,children:`Whitespace`}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>V(e.target.checked)}),`Ignore space-change (-b)`]}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>H(e.target.checked)}),`Ignore all space (-w)`]})]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Code font`}),(0,J.jsxs)(`button`,{className:`btn btn-sm settings-btn`,onClick:()=>{ae(!1),W()},title:h??`Default (JetBrains Mono)`,children:[(0,J.jsx)(VO,{size:13}),(0,J.jsx)(`span`,{className:`settings-value-label`,children:h??`Default…`})]})]}),ne&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`settings-section-label`,children:`External tools`}),T&&(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Browser`}),(0,J.jsx)(tW,{value:r||``,onValueChange:T,options:uW,ariaLabel:`Browser`})]}),D&&(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Preferred IDE`}),(0,J.jsx)(tW,{value:i||`default`,onValueChange:D,options:dW,ariaLabel:`Preferred IDE`})]})]}),(0,J.jsx)(`div`,{className:`settings-section-label`,children:`Appearance`}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Diff style`}),(0,J.jsx)(tW,{value:e,onValueChange:e=>S(e),options:[{value:`split`,label:`Split`},{value:`unified`,label:`Unified`}],ariaLabel:`Diff style`})]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Theme`}),(0,J.jsxs)(`button`,{className:`btn btn-sm settings-btn`,onClick:()=>{ae(!1),E()},children:[(0,J.jsx)(SO,{size:14}),` Switch Theme…`]})]}),(0,J.jsx)(`div`,{className:`settings-section-label`,children:`Feedback`}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>F(e.target.checked)}),`Haptic feedback`]}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>I(e.target.checked)}),`Sound effects`]})]})})}function pW({commentCount:e,onResolveAllOpen:t}){let[n,r]=(0,q.useState)(!1),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(null);if(e<1)return null;let c=()=>{r(!1),s(null)},l=async()=>{a(!0),s(null);try{await t(),c()}catch(e){s(e instanceof Error?e.message:`Could not resolve the open comments.`)}finally{a(!1)}};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`btn btn-sm toolbar-resolve-all-btn`,onClick:()=>r(!0),title:`Resolve all open comments`,"aria-haspopup":`dialog`,children:[(0,J.jsx)(CD,{size:14}),(0,J.jsx)(`span`,{className:`btn-label`,children:`Resolve all`})]}),(0,J.jsx)(LH,{open:n,title:`Resolve all ${e} open comment${e===1?``:`s`}?`,description:`Every open review thread will be marked as resolved. You can reopen individual threads later.`,confirmLabel:e===1?`Resolve comment`:`Resolve all ${e}`,busyLabel:`Resolving…`,variant:`primary`,icon:(0,J.jsx)(CD,{size:18}),busy:i,error:o,onConfirm:l,onCancel:c})]})}var mW=(0,q.memo)(function({repoName:e,branch:t,fileCount:n,totalFileCount:r,additions:i,deletions:a,commentCount:o,planCount:s,pendingPlanCount:c,lastSend:l,onOpenPlans:u,diffStyle:d,diffOptions:f,defaultTabSize:p,browser:m,theme:h,editorIDE:g,customMode:_,showMode:v,showCommitCount:y,lineDiffType:b,lineWrap:x,diffIndicators:S,showLineNumbers:C,hunkSeparators:w,lineHoverHighlight:T,fontSize:E,haptics:D,sounds:O,uiFont:k,monoFont:A,density:j,autoCollapseLineThreshold:M,requireViewAllBeforeSend:N,showStatusBar:P,ignoreSpaceChange:F,ignoreAllSpace:I,onDiffStyleChange:L,onDiffOptionsChange:R,onDefaultTabSizeChange:z,onBrowserChange:B,onOpenThemeModal:V,onEditorIDEChange:H,onLineDiffTypeChange:U,onLineWrapChange:W,onDiffIndicatorsChange:ee,onShowLineNumbersChange:te,onHunkSeparatorsChange:ne,onLineHoverHighlightChange:re,onFontSizeChange:ie,onHapticsChange:ae,onSoundsChange:oe,onDensityChange:G,onAutoCollapseLineThresholdChange:se,onRequireViewAllBeforeSendChange:K,onShowStatusBarChange:ce,onIgnoreSpaceChange:le,onIgnoreAllSpaceChange:ue,onResolveAllOpen:de,onOpenUiFontModal:fe,onOpenMonoFontModal:pe,onOpenSearch:me,onCopyComments:he,onCopyMarkdown:ge,onSendToAgent:_e,agentWaiting:ve,waitingAgents:ye=[],sending:be,comments:xe,viewedFileCount:Se,onEditComment:Ce,onDeleteComment:we,sidebarCollapsed:Te,onToggleSidebar:Ee}){let De=v?`${y} commit${y===1?``:`s`}`:n===r?`${n} file${n===1?``:`s`}`:`${n}/${r} files`;return(0,J.jsxs)(`header`,{className:`toolbar diff-app-toolbar`,role:`banner`,children:[(0,J.jsxs)(`div`,{className:`toolbar-left`,children:[Ee&&(0,J.jsx)(`button`,{className:`toolbar-mobile-toggle`,onClick:Ee,"aria-label":Te?`Open file tree`:`Close file tree`,"aria-expanded":!Te,title:Te?`Open sidebar · b`:`Close sidebar · b`,children:(0,J.jsx)(dO,{size:18})}),(0,J.jsxs)(`div`,{className:`toolbar-brand`,children:[(0,J.jsx)(HH,{size:20,className:`toolbar-brand-mark`}),(0,J.jsxs)(`div`,{className:`toolbar-brand-text`,children:[(0,J.jsx)(`h1`,{className:`toolbar-title`,children:e||`diffing`}),t&&(0,J.jsxs)(`span`,{className:`toolbar-branch-inline`,title:t,children:[(0,J.jsx)(XD,{size:11,"aria-hidden":`true`}),t]})]})]}),(0,J.jsxs)(`div`,{className:`toolbar-meta`,"aria-label":`Diff summary`,children:[(0,J.jsx)(`span`,{className:`toolbar-chip`,children:De}),(i>0||a>0)&&(0,J.jsxs)(`span`,{className:`toolbar-chip toolbar-chip-diff`,children:[i>0&&(0,J.jsxs)(`span`,{className:`stat-additions`,children:[`+`,i]}),a>0&&(0,J.jsxs)(`span`,{className:`stat-deletions`,children:[`−`,a]})]}),o>0&&(0,J.jsxs)(`span`,{className:`toolbar-chip toolbar-chip-comments`,children:[o,` open`]}),l&&l.round>0&&(0,J.jsx)(VH,{lastRound:l.round})]})]}),(0,J.jsxs)(`div`,{className:`toolbar-right`,children:[(0,J.jsxs)(`button`,{className:`btn btn-sm toolbar-search-btn`,onClick:me,title:`Search files, text, symbols (⌘K)`,"aria-label":`Search`,children:[(0,J.jsx)(NO,{size:14}),(0,J.jsx)(`span`,{className:`btn-label`,children:`Search`}),(0,J.jsx)(`kbd`,{className:`toolbar-search-kbd`,children:`⌘K`})]}),s>0&&(0,J.jsxs)(`button`,{className:`btn btn-sm toolbar-plans-btn ${c>0?`toolbar-plans-btn-pending`:``}`,onClick:u,title:c>0?`${c} plan${c===1?``:`s`} awaiting review`:`Open plan review`,children:[c>0&&(0,J.jsx)(`span`,{className:`agent-waiting-dot`,"aria-hidden":`true`}),(0,J.jsx)(ID,{size:14}),(0,J.jsx)(`span`,{className:`btn-label`,children:`Plans`}),c>0&&(0,J.jsx)(`span`,{className:`toolbar-plans-badge`,children:c})]}),(0,J.jsx)(pW,{commentCount:o,onResolveAllOpen:de}),(0,J.jsx)(fW,{diffStyle:d,diffOptions:f,defaultTabSize:p,browser:m,editorIDE:g,lineDiffType:b,lineWrap:x,diffIndicators:S,showLineNumbers:C,hunkSeparators:w,lineHoverHighlight:T,fontSize:E,haptics:D,sounds:O,uiFont:k,monoFont:A,density:j,autoCollapseLineThreshold:M,requireViewAllBeforeSend:N,showStatusBar:P,ignoreSpaceChange:F,ignoreAllSpace:I,onDiffStyleChange:L,onDiffOptionsChange:R,onDefaultTabSizeChange:z,onBrowserChange:B,onOpenThemeModal:V,onEditorIDEChange:H,onLineDiffTypeChange:U,onLineWrapChange:W,onDiffIndicatorsChange:ee,onShowLineNumbersChange:te,onHunkSeparatorsChange:ne,onLineHoverHighlightChange:re,onFontSizeChange:ie,onHapticsChange:ae,onSoundsChange:oe,onDensityChange:G,onAutoCollapseLineThresholdChange:se,onRequireViewAllBeforeSendChange:K,onShowStatusBarChange:ce,onIgnoreSpaceChange:le,onIgnoreAllSpaceChange:ue,onOpenUiFontModal:fe,onOpenMonoFontModal:pe,showSource:!_}),(0,J.jsx)(zH,{comments:xe,totalFileCount:r,viewedFileCount:Se,requireViewAllBeforeSend:N,onEditComment:Ce,onDeleteComment:we,onSend:_e,sending:be,agentWaiting:ve,waitingAgents:ye,onCopyComments:he,onCopyMarkdown:ge})]})]})});function hW({overview:e,commits:t}){let[n,r]=(0,q.useState)(!1),i=e.commitSubjects.length>0,a=e.truncated>0,o=!!e.subtitle||a||i;return(0,J.jsxs)(`section`,{className:`diff-overview-banner`,"data-kind":e.kind,"aria-label":`Diff overview: ${e.headline}`,children:[(0,J.jsxs)(`header`,{className:`diff-overview-banner-header`,children:[(0,J.jsxs)(`div`,{className:`diff-overview-banner-line`,children:[(0,J.jsx)(yW,{kind:e.kind}),(0,J.jsx)(`h2`,{className:`diff-overview-banner-headline`,children:e.headline})]}),o&&(0,J.jsxs)(`div`,{className:`diff-overview-banner-meta`,children:[e.subtitle&&(0,J.jsx)(`span`,{className:`diff-overview-banner-subtitle`,children:e.subtitle}),a&&(0,J.jsxs)(`span`,{className:`diff-overview-banner-truncated-badge`,title:`${e.truncated} additional ${e.truncated===1?`commit`:`commits`} not shown`,children:[`+`,e.truncated]}),i&&(0,J.jsxs)(`button`,{type:`button`,className:`diff-overview-banner-details-toggle`,onClick:()=>r(e=>!e),"aria-expanded":n,"aria-controls":`diff-overview-banner-details`,children:[n?(0,J.jsx)(TD,{size:14}):(0,J.jsx)(DD,{size:14}),(0,J.jsx)(qD,{size:13,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[n?`Hide`:`Show`,` `,e.commitSubjects.length,` `,`commit`,e.commitSubjects.length===1?``:`s`]})]})]})]}),i&&n&&(0,J.jsx)(gW,{overview:e,commits:t,id:`diff-overview-banner-details`})]})}function gW({overview:e,commits:t,id:n}){return t&&t.length>0?(0,J.jsxs)(`ul`,{id:n,className:`diff-overview-banner-subjects`,children:[t.map((e,n)=>(0,J.jsx)(_W,{commit:e,index:n,total:t.length},e.sha)),e.truncated>0&&(0,J.jsxs)(`li`,{className:`diff-overview-banner-truncated`,role:`status`,children:[`+ `,e.truncated,` more commit`,e.truncated===1?``:`s`,` not shown`]})]}):(0,J.jsx)(`ul`,{id:n,className:`diff-overview-banner-subjects`,children:e.commitSubjects.map((t,n)=>{let r=n===0||n===e.commitSubjects.length-1;return(0,J.jsxs)(`li`,{className:`diff-overview-banner-subject-row`,children:[(0,J.jsx)(ZD,{size:12,className:`diff-overview-banner-subject-icon`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`diff-overview-banner-subject-text`,children:t}),r&&e.fromDate&&e.toDate&&(0,J.jsx)(`span`,{className:`diff-overview-banner-subject-dates`,children:n===0?e.fromDate:e.toDate})]},`${n}-${t}`)})})}function _W({commit:e,index:t,total:n}){let[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1),s=async()=>{try{await navigator.clipboard.writeText(e.sha),i(!0),setTimeout(()=>i(!1),1500)}catch{}},c=e.body.trim().length>0,l=e.parents.length>1,u=n>1?`Commit ${t+1} of ${n}: ${e.subject}`:`Commit: ${e.subject}`;return(0,J.jsxs)(`li`,{className:`diff-overview-banner-commit-row`,"aria-label":u,children:[(0,J.jsxs)(`div`,{className:`diff-overview-banner-commit-line`,children:[(0,J.jsx)(ZD,{size:12,className:`diff-overview-banner-subject-icon`,"aria-hidden":`true`}),(0,J.jsxs)(`button`,{type:`button`,className:`diff-overview-banner-commit-sha`,onClick:s,title:r?`Copied full SHA`:`Click to copy full SHA`,"aria-label":`Copy full SHA ${e.sha}`,children:[(0,J.jsx)(`span`,{children:e.shortSha}),r?(0,J.jsx)(wD,{size:12,"aria-hidden":`true`}):(0,J.jsx)(VD,{size:12,"aria-hidden":`true`})]}),l&&(0,J.jsx)(`span`,{className:`diff-overview-banner-merge-badge`,title:`Merge commit with ${e.parents.length} parents`,children:`merge`}),(0,J.jsx)(`span`,{className:`diff-overview-banner-commit-subject`,children:e.subject})]}),(0,J.jsxs)(`div`,{className:`diff-overview-banner-commit-meta`,children:[(0,J.jsxs)(`span`,{className:`diff-overview-banner-commit-author`,children:[(0,J.jsx)(`span`,{className:`diff-overview-banner-commit-author-name`,children:e.authorName}),(0,J.jsxs)(`span`,{className:`diff-overview-banner-commit-author-email`,children:[`<`,e.authorEmail,`>`]})]}),(0,J.jsx)(`span`,{className:`diff-overview-banner-commit-date`,title:e.authorDate,children:vW(e.authorDate)}),e.committerName!==e.authorName||e.committerEmail!==e.authorEmail?(0,J.jsxs)(`span`,{className:`diff-overview-banner-commit-committer`,title:`Committed by ${e.committerName} <${e.committerEmail}> at ${e.committerDate}`,children:[(0,J.jsx)(`span`,{className:`diff-overview-banner-commit-committer-label`,children:`committed by`}),` `,(0,J.jsx)(`span`,{children:e.committerName})]}):null]}),c&&(0,J.jsxs)(`div`,{className:`diff-overview-banner-commit-body`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`diff-overview-banner-commit-body-toggle`,onClick:()=>o(e=>!e),"aria-expanded":a,"aria-controls":`diff-overview-commit-body-${e.shortSha}`,children:[a?(0,J.jsx)(TD,{size:14}):(0,J.jsx)(DD,{size:14}),(0,J.jsx)(qD,{size:13,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:a?`Hide message`:`Show message`})]}),a&&(0,J.jsx)(`pre`,{id:`diff-overview-commit-body-${e.shortSha}`,className:`diff-overview-banner-commit-body-pre`,children:e.body})]})]})}function vW(e){try{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}catch{return e}}function yW({kind:e}){let t={size:14,className:`diff-overview-banner-icon`,"aria-hidden":!0};switch(e){case`working-tree`:case`staged-only`:return(0,J.jsx)(iO,{...t});case`range`:return(0,J.jsx)(XD,{...t});case`commit-single`:case`commit-series`:return(0,J.jsx)(ZD,{...t});case`pr`:return(0,J.jsx)(eO,{...t})}}function bW(e,t){return JSON.stringify(e.overview)===JSON.stringify(t.overview)&&JSON.stringify(e.commits)===JSON.stringify(t.commits)}var xW=(0,q.memo)(hW,bW),SW=`
1934
1934
  .comment-bubble-canvas {
1935
1935
  width: min(720px, calc(100% - 40px), calc(100vw - 80px)) !important;
@@ -2015,13 +2015,13 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
2015
2015
  `;async function CW(e,t){let n=await fetch(`/api/file-text?path=${encodeURIComponent(e)}&version=${t}`);if(!n.ok){if(n.status===404)return null;throw Error(`HTTP ${n.status} fetching ${t} ${e}`)}let r=await n.json();if(r.missing)return null;if(r.error)throw Error(r.error);return r.content??``}function wW(e,t,n=e){let[r,i]=(0,q.useState)({loading:!1,error:null,oldContent:null,newContent:null});return(0,q.useEffect)(()=>{if(!t||!e)return;let r=!1;return i(e=>({...e,loading:!0,error:null})),Promise.all([CW(n,`old`),CW(e,`new`)]).then(([e,t])=>{r||i({loading:!1,error:null,oldContent:e,newContent:t})}).catch(e=>{r||i({loading:!1,error:e.message,oldContent:null,newContent:null})}),()=>{r=!0}},[e,n,t]),r}function TW(e){return e===`deletions`||e===`additions`}var EW=`diffing-draft-`,DW=10080*60*1e3;function OW(...e){return EW+e.join(`:`)}function kW(...e){try{let t=iD(OW(...e));if(!t)return null;let n=JSON.parse(t);return Date.now()-n.timestamp>DW?(lD(OW(...e)),null):n.body}catch{return null}}var AW={};function jW(e,...t){let n=OW(...t);AW[n]&&clearTimeout(AW[n]),AW[n]=setTimeout(()=>{MW(e,...t),delete AW[n]},500)}function MW(e,...t){let n=OW(...t);try{e.trim()?cD(n,JSON.stringify({body:e,timestamp:Date.now()})):lD(n)}catch{}}function NW(...e){try{lD(OW(...e))}catch{}}function PW({open:e,title:t,description:n,label:r,initialValue:i=``,placeholder:a,confirmLabel:o=`Save`,cancelLabel:s=`Cancel`,maxLength:c,onConfirm:l,onCancel:u}){let[d,f]=(0,q.useState)(i),p=(0,q.useRef)(null),m=(0,q.useId)();(0,q.useEffect)(()=>{e&&f(i)},[i,e]);let h=()=>{let e=d.trim();e&&l(e)};return(0,J.jsxs)(IH,{open:e,onClose:u,className:`confirm-dialog input-dialog`,ariaLabel:t,initialFocus:p,children:[(0,J.jsxs)(`div`,{className:`confirm-dialog-header`,children:[(0,J.jsx)(`span`,{className:`confirm-dialog-icon confirm-dialog-icon-primary`,"aria-hidden":`true`,children:(0,J.jsx)(EO,{size:18})}),(0,J.jsx)(`h2`,{className:`confirm-dialog-title`,children:t})]}),n&&(0,J.jsx)(`p`,{className:`confirm-dialog-desc`,children:n}),(0,J.jsxs)(`form`,{className:`input-dialog-form`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,J.jsx)(`label`,{className:`input-dialog-label`,htmlFor:m,children:r}),(0,J.jsx)(`input`,{ref:p,id:m,className:`input-dialog-input`,value:d,onChange:e=>f(e.target.value),placeholder:a,maxLength:c,autoComplete:`off`}),(0,J.jsxs)(`div`,{className:`confirm-dialog-footer`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm confirm-dialog-cancel`,onClick:u,children:s}),(0,J.jsx)(`button`,{type:`submit`,className:`btn btn-sm confirm-dialog-confirm confirm-dialog-confirm-primary`,disabled:!d.trim(),children:o})]})]})]})}function FW(e){return e.replace(/@([^\s@]+)/g,(e,t)=>`[${t.split(`/`).pop()||t}](file-mention://${t})`)}var IW=[{value:`none`,label:`None`,hint:`Untriaged`,icon:(0,J.jsx)(vO,{size:13})},{value:`blocking`,label:`Blocking`,hint:`Must fix before merge`,icon:(0,J.jsx)(xO,{size:13})},{value:`nit`,label:`Nit`,hint:`Optional polish`,icon:(0,J.jsx)(jD,{size:13})},{value:`question`,label:`Question`,hint:`Needs an answer`,icon:(0,J.jsx)(ND,{size:13})},{value:`praise`,label:`Praise`,hint:`No change required`,icon:(0,J.jsx)(IO,{size:13})}];function LW({value:e,onChange:t}){let n=IW.find(t=>t.value===e)??IW[0];return(0,J.jsxs)(bU,{value:e,onValueChange:e=>t(e),modal:!1,children:[(0,J.jsxs)(wU,{className:`ui-select-trigger comment-severity-trigger comment-severity-trigger-${e}`,"aria-label":`Comment severity`,"data-severity":e,children:[(0,J.jsxs)(`span`,{className:`comment-severity-trigger-inner`,children:[(0,J.jsx)(`span`,{className:`comment-severity-icon`,"data-severity":e,"aria-hidden":`true`,children:n.icon}),(0,J.jsx)(EU,{children:e=>IW.find(t=>t.value===e)?.label??e})]}),(0,J.jsx)(DU,{className:`ui-select-icon`,children:(0,J.jsx)(OD,{size:12})})]}),(0,J.jsx)(kU,{children:(0,J.jsx)(VU,{className:`ui-select-positioner comment-severity-positioner`,sideOffset:4,align:`start`,side:`top`,alignItemWithTrigger:!1,children:(0,J.jsx)(KU,{className:`ui-select-popup comment-severity-popup`,"aria-label":`Severity`,children:IW.map(e=>(0,J.jsxs)(ZU,{value:e.value,className:`ui-select-item comment-severity-item comment-severity-item-${e.value}`,children:[(0,J.jsxs)(`span`,{className:`comment-severity-item-main`,children:[(0,J.jsx)(`span`,{className:`comment-severity-icon`,"data-severity":e.value,"aria-hidden":`true`,children:e.icon}),(0,J.jsxs)(`span`,{className:`comment-severity-item-text`,children:[(0,J.jsx)(eW,{className:`comment-severity-item-label`,children:e.label}),(0,J.jsx)(`span`,{className:`comment-severity-item-hint`,children:e.hint})]})]}),(0,J.jsx)(QU,{className:`ui-select-indicator`,children:(0,J.jsx)(wD,{size:13})})]},e.value))})})})]})}function RW({initialBody:e,lineContent:t,lineLabel:n,range:r,onAdjustStart:i,onAdjustEnd:a,draftKey:o,onSubmit:s,onCancel:c,showSeverity:l=!0}){let{haptic:u,sound:d}=xT(),{settings:f,updateSettings:p}=BE(),m=f.savedReplies??[],[h,g]=(0,q.useState)(()=>{if(o){let e=kW(o);if(e)return e}return e||``}),[_,v]=(0,q.useState)(`none`),[y,b]=(0,q.useState)(`write`),[x,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(!1),T=(0,q.useRef)(null),E=(0,q.useRef)(null),D=eH(h,g),O=e=>{g(t=>t.trim()?`${t.trimEnd()}\n\n${e.body}`:e.body),S(!1),b(`write`),requestAnimationFrame(()=>T.current?.focus())},k=()=>{h.trim()&&w(!0)},A=e=>{let t=h.trim();t&&(p({savedReplies:[...m,{id:crypto.randomUUID(),title:e,body:t}]}),w(!1))};(0,q.useEffect)(()=>{y===`write`?T.current?.focus():E.current?.focus()},[y]),(0,q.useEffect)(()=>{o&&jW(h,o)},[h,o]);let j=()=>{let e=h.trim();e&&(o&&NW(o),u(`success`),d(`success`),s(e,_===`none`?void 0:_))},M=()=>{if(!t)return;let e=`\`\`\`suggestion\n${t.split(`
2016
2016
  `).map(e=>e.replace(/^[+\- ]/,``)).join(`
2017
2017
  `)}\n\`\`\`\n`;g(t=>t.trim()?t.includes("```suggestion")?t:`${t.trimEnd()}\n\n${e}`:e),b(`write`),requestAnimationFrame(()=>T.current?.focus())},N=e=>{if(!D.handleKeyDown(e)&&(e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),j()),e.key===`p`&&(e.metaKey||e.ctrlKey)&&e.shiftKey&&(e.preventDefault(),b(e=>e===`write`?`preview`:`write`)),e.key===`Escape`)){if(h.includes(`
2018
- `))return;c()}},P=async e=>{let t=e.clipboardData.items,n=null;for(let e=0;e<t.length;e++){let r=t[e];if(r.kind===`file`&&r.type.startsWith(`image/`)){n=r.getAsFile();break}}if(!n)return;e.preventDefault();let r=T.current;if(!r)return;let i=r.selectionStart,a=r.selectionEnd,o=Math.random().toString(36).slice(2,8),s=`![Uploading image… ${o}]()`,c=r.value;g(c.slice(0,i)+s+c.slice(a));try{let e=new FormData;e.append(`file`,n,n.name||`pasted-${o}.png`);let t=await fetch(`/api/attachments`,{method:`POST`,body:e});if(!t.ok)throw Error(`HTTP ${t.status}`);let r=await t.json();if(!r.url)throw Error(r.error||`Upload failed`);let i=`![pasted image](${r.url})`;g(e=>e.replace(s,i))}catch(e){console.error(`Image upload failed:`,e),g(e=>e.replace(s,`![upload failed]()`))}},F=!!(r&&i&&a),I=r?Math.abs(r.end-r.start)+1:0,L=F&&(r.canAdjustStart?.(-1)??!0),R=F&&(r.canAdjustStart?.(1)??!0),z=F&&(r.canAdjustEnd?.(-1)??!0),B=F&&(r.canAdjustEnd?.(1)??!0),V=e=>{e.preventDefault()};return(0,J.jsxs)(`div`,{className:`comment-form comment-form-sheet`,role:`form`,"aria-label":`Comment form`,children:[F&&r?(0,J.jsxs)(`div`,{className:`comment-form-range`,"aria-live":`polite`,children:[(0,J.jsx)(`span`,{className:`comment-form-range-prefix`,children:`Commenting on`}),(0,J.jsxs)(`div`,{className:`comment-form-range-controls`,role:`group`,"aria-label":`Comment line range`,children:[(0,J.jsxs)(`div`,{className:`comment-form-range-edge`,"aria-label":`Range start`,children:[(0,J.jsx)(`button`,{type:`button`,className:`comment-form-range-btn`,"aria-label":`Expand range upward`,title:`Expand range upward`,disabled:!L,onMouseDown:V,onClick:()=>i(-1),children:`−`}),(0,J.jsxs)(`span`,{className:`comment-form-range-num`,"aria-label":`Start line ${r.start}`,children:[`L`,r.start]}),(0,J.jsx)(`button`,{type:`button`,className:`comment-form-range-btn`,"aria-label":`Shrink range from top`,title:`Shrink range from top`,disabled:!R,onMouseDown:V,onClick:()=>i(1),children:`+`})]}),(0,J.jsx)(`span`,{className:`comment-form-range-sep`,"aria-hidden":`true`,children:`–`}),(0,J.jsxs)(`div`,{className:`comment-form-range-edge`,"aria-label":`Range end`,children:[(0,J.jsx)(`button`,{type:`button`,className:`comment-form-range-btn`,"aria-label":`Shrink range from bottom`,title:`Shrink range from bottom`,disabled:!z,onMouseDown:V,onClick:()=>a(-1),children:`−`}),(0,J.jsxs)(`span`,{className:`comment-form-range-num`,"aria-label":`End line ${r.end}`,children:[`L`,r.end]}),(0,J.jsx)(`button`,{type:`button`,className:`comment-form-range-btn`,"aria-label":`Expand range downward`,title:`Expand range downward`,disabled:!B,onMouseDown:V,onClick:()=>a(1),children:`+`})]})]}),(0,J.jsxs)(`span`,{className:`comment-form-range-meta`,children:[(0,J.jsx)(`span`,{className:`comment-form-range-side`,children:r.sideLabel}),(0,J.jsxs)(`span`,{className:`comment-form-range-count`,children:[I,` line`,I===1?``:`s`]})]})]}):n?(0,J.jsxs)(`div`,{className:`comment-form-line-label`,"aria-live":`polite`,children:[`Commenting on `,(0,J.jsx)(`strong`,{children:n})]}):null,(0,J.jsxs)(`div`,{className:`comment-form-tabs`,role:`tablist`,"aria-label":`Comment form mode`,children:[(0,J.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":y===`write`,"aria-controls":`comment-write-panel`,onClick:()=>b(`write`),onKeyDown:e=>{e.key===`ArrowRight`&&(e.preventDefault(),b(`preview`))},className:`comment-form-tab-btn ${y===`write`?`comment-form-tab-btn-active`:`comment-form-tab-btn-inactive`}`,children:`Write`}),(0,J.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":y===`preview`,"aria-controls":`comment-preview-panel`,onClick:()=>b(`preview`),onKeyDown:e=>{e.key===`ArrowLeft`&&(e.preventDefault(),b(`write`))},className:`comment-form-tab-btn ${y===`preview`?`comment-form-tab-btn-active`:`comment-form-tab-btn-inactive`}`,children:`Preview`})]}),y===`write`?(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`comment-form-suggest-row`,children:[m.length>0&&(0,J.jsxs)(`div`,{className:`comment-form-saved-replies`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm comment-form-suggest-btn`,onClick:()=>S(e=>!e),"aria-expanded":x,title:`Insert a saved reply template`,children:`Saved replies`}),x&&(0,J.jsx)(`ul`,{className:`comment-form-saved-list`,role:`listbox`,children:m.map(e=>(0,J.jsxs)(`li`,{children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>O(e),role:`option`,children:e.title}),(0,J.jsx)(`button`,{type:`button`,className:`comment-form-saved-delete`,"aria-label":`Delete template ${e.title}`,onClick:()=>p({savedReplies:m.filter(t=>t.id!==e.id)}),children:`×`})]},e.id))})]}),h.trim()&&(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm comment-form-suggest-btn`,onClick:k,title:`Save current body as a reusable template`,children:`Save template`}),t?(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm comment-form-suggest-btn`,onClick:M,title:"Insert a ```suggestion block pre-filled with the selected line(s)",children:`Suggest change`}):null]}),(0,J.jsxs)(`div`,{className:`comment-form-editor`,children:[(0,J.jsx)(`textarea`,{id:`comment-write-panel`,ref:e=>{T.current=e,D.setTextareaRef(e)},value:h,onChange:e=>g(e.target.value),onKeyDown:N,onPaste:P,placeholder:`Leave a review comment (supports Markdown and Pasting Clipboard Images)...`,rows:4,"aria-label":`Comment body`,className:`comment-form-textarea`}),D.isOpen&&(0,J.jsx)(aH,{results:D.results,focusedIndex:D.focusedIndex,query:D.query,cursorTop:D.cursorTop,onSelect:D.onSelect,onHover:D.setFocusedIndex})]})]}):(0,J.jsxs)(`div`,{id:`comment-preview-panel`,ref:E,role:`tabpanel`,"aria-label":`Preview`,tabIndex:0,onKeyDown:e=>{e.key===`p`&&(e.metaKey||e.ctrlKey)&&e.shiftKey&&(e.preventDefault(),b(`write`))},className:`comment-preview-panel`,children:[(()=>{let e=!!h.match(/```suggestion\n([\s\S]*?)```/);return h.replace(/```suggestion\n([\s\S]*?)```/g,``).trim().length>0||!e?(0,J.jsx)(`div`,{className:`comment-preview markdown-body`,children:h.trim()?(0,J.jsx)(QV,{content:FW(h)}):(0,J.jsx)(`span`,{className:`comment-preview-empty`,children:`Nothing to preview`})}):null})(),(()=>{let e=h.match(/```suggestion\n([\s\S]*?)```/),n=!!e,r=e?e[1].trimEnd():``;return n?(0,J.jsxs)(`div`,{className:`suggestion-card`,children:[(0,J.jsx)(`div`,{className:`suggestion-header`,children:(0,J.jsx)(`span`,{className:`suggestion-header-label`,children:`Suggested Change Preview`})}),(0,J.jsxs)(`div`,{className:`suggestion-diff`,children:[t&&(0,J.jsxs)(`div`,{className:`suggestion-diff-line suggestion-diff-line-deletion`,children:[(0,J.jsx)(`span`,{className:`suggestion-diff-sign`,children:`-`}),(0,J.jsx)(`span`,{className:`suggestion-diff-code`,children:t})]}),(0,J.jsxs)(`div`,{className:`suggestion-diff-line suggestion-diff-line-addition`,children:[(0,J.jsx)(`span`,{className:`suggestion-diff-sign`,children:`+`}),(0,J.jsx)(`span`,{className:`suggestion-diff-code`,children:r})]})]})]}):null})()]}),(0,J.jsxs)(`div`,{className:`comment-form-actions`,children:[l&&(0,J.jsxs)(`div`,{className:`comment-form-severity`,"data-severity":_,children:[(0,J.jsx)(`span`,{className:`comment-form-severity-label`,children:`Severity`}),(0,J.jsx)(LW,{value:_,onChange:v})]}),(0,J.jsxs)(`div`,{className:`comment-form-actions-right`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-secondary btn-sm`,onClick:c,children:`Cancel`}),(0,J.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,onClick:j,disabled:!h.trim(),children:e?`Save`:`Comment`})]})]}),(0,J.jsx)(PW,{open:C,title:`Save reply template`,description:`Give this reusable review response a short, recognizable name.`,label:`Template name`,initialValue:h.trim().slice(0,40),placeholder:`Example: Add regression coverage`,confirmLabel:`Save template`,maxLength:80,onConfirm:A,onCancel:()=>w(!1)})]})}function zW({open:e,title:t,description:n,closeLabel:r=`Close`,tone:i=`danger`,onClose:a}){let o=(0,q.useRef)(null);return(0,J.jsxs)(IH,{open:e,onClose:a,className:`confirm-dialog notice-dialog`,ariaLabel:t,role:`alertdialog`,initialFocus:o,children:[(0,J.jsxs)(`div`,{className:`confirm-dialog-header`,children:[(0,J.jsx)(`span`,{className:`confirm-dialog-icon confirm-dialog-icon-${i}`,"aria-hidden":`true`,children:(0,J.jsx)(kD,{size:18})}),(0,J.jsx)(`h2`,{className:`confirm-dialog-title`,children:t})]}),(0,J.jsx)(`p`,{className:`confirm-dialog-desc`,children:n}),(0,J.jsx)(`div`,{className:`confirm-dialog-footer`,children:(0,J.jsx)(`button`,{ref:o,type:`button`,className:`btn btn-sm confirm-dialog-confirm confirm-dialog-confirm-primary`,onClick:a,children:r})})]})}function BW({role:e,size:t=16}){return e===`agent`?(0,J.jsx)(`div`,{className:`comment-avatar-circle comment-avatar-agent comment-avatar-size-${t}`,children:(0,J.jsx)(SD,{size:t,"aria-hidden":`true`})}):(0,J.jsx)(`div`,{className:`comment-avatar-circle comment-avatar-user comment-avatar-size-${t}`,children:(0,J.jsx)(UO,{size:t,"aria-hidden":`true`})})}function VW({comment:e,onDelete:t}){let[,n]=(0,q.useState)(0),{resolveComment:r,unresolveComment:i,addReply:a,removeReply:o,editReply:s,applySuggestion:c,editComment:l}=TE(),u=e.status===`resolved`,[d,f]=(0,q.useState)(u),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(null),[x,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(null),T=(0,q.useRef)(null),E=e.body.replace(/```suggestion\n([\s\S]*?)```/g,``).trim().length>0,D=e.body.replace(/\s+/g,` `).trim().slice(0,72),O=e.replies?.length??0;(0,q.useEffect)(()=>{e.status===`resolved`&&f(!0)},[e.status]),(0,q.useEffect)(()=>{let e=setInterval(()=>n(e=>e+1),3e4);return()=>clearInterval(e)},[]);let k=()=>r(e.id),A=()=>i(e.id),j=e=>{b(e)},M=t=>{o(e.id,t)},N=(0,J.jsxs)(J.Fragment,{children:[e.lineNumber===0&&(0,J.jsx)(`span`,{className:`comment-file-chip`,children:`File`}),e.outdated&&(0,J.jsxs)(`span`,{className:`comment-outdated-badge`,title:`Anchored code no longer matches the live diff`,children:[(0,J.jsx)(BO,{size:10}),` outdated`]}),e.severity&&e.severity!==`none`&&(0,J.jsx)(`span`,{className:`comment-severity-badge`,"data-severity":e.severity,children:e.severity}),e.startLineNumber&&e.startLineNumber!==e.lineNumber&&(0,J.jsxs)(`span`,{className:`comment-range-chip`,children:[`L`,e.startLineNumber,`–`,e.lineNumber]}),e.lineNumber>0&&!(e.startLineNumber&&e.startLineNumber!==e.lineNumber)&&(0,J.jsxs)(`span`,{className:`comment-range-chip`,children:[`L`,e.lineNumber]})]});return d&&!h?(0,J.jsxs)(`div`,{className:`comment-collapsed-bar ${u?`comment-collapsed-bar-resolved`:``}`,id:`comment-${e.id}`,role:`article`,children:[(0,J.jsx)(`button`,{type:`button`,className:`comment-collapsed-toggle`,onClick:()=>f(!1),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f(!1))},"aria-expanded":!1,"aria-label":u?`Show resolved conversation`:`Expand comment thread`,title:`Expand`,children:(0,J.jsx)(DD,{size:14,"aria-hidden":`true`})}),(0,J.jsxs)(`div`,{className:`comment-collapsed-main`,children:[u?(0,J.jsx)(AD,{size:14,className:`comment-collapsed-resolved-icon`,"aria-hidden":`true`}):(0,J.jsx)(BW,{role:`user`,size:11}),(0,J.jsx)(`span`,{className:`comment-collapsed-label`,children:u?`Resolved`:`User`}),N,(0,J.jsxs)(`span`,{className:`comment-collapsed-preview`,title:e.body,children:[D,e.body.length>72?`…`:``]}),(0,J.jsx)(`span`,{className:`comment-collapsed-meta`,children:O>0?`${O+1} comments`:`1 comment`})]}),(0,J.jsx)(`button`,{type:`button`,className:`comment-collapsed-expand-btn`,onClick:()=>f(!1),"aria-label":u?`Show resolved conversation`:`Expand comment thread`,children:`Expand`})]}):h?(0,J.jsx)(`div`,{className:`comment-bubble-canvas`,id:`comment-${e.id}`,role:`article`,"aria-label":`Edit comment`,children:(0,J.jsxs)(`div`,{className:`comment-node`,children:[(0,J.jsx)(`div`,{className:`comment-avatar-col`,children:(0,J.jsx)(BW,{role:`user`,size:16})}),(0,J.jsxs)(`div`,{className:`comment-content-col`,children:[(0,J.jsxs)(`div`,{className:`comment-node-header`,children:[(0,J.jsx)(`span`,{className:`comment-node-author`,children:`User`}),(0,J.jsx)(`span`,{className:`comment-node-badge comment-node-badge-user`,children:`User`}),(0,J.jsxs)(`span`,{className:`comment-node-time comment-node-meta`,children:[FT(e.createdAt),e.lineNumber===0&&(0,J.jsx)(`span`,{className:`comment-file-chip`,children:`File Comment`}),e.outdated&&(0,J.jsxs)(`span`,{className:`comment-outdated-badge`,title:`Anchored code no longer matches the live diff`,children:[(0,J.jsx)(BO,{size:10}),` outdated`]}),e.severity&&e.severity!==`none`&&(0,J.jsx)(`span`,{className:`comment-severity-badge`,"data-severity":e.severity,children:e.severity}),e.startLineNumber&&e.startLineNumber!==e.lineNumber&&(0,J.jsxs)(`span`,{className:`comment-range-chip`,children:[`L`,e.startLineNumber,`–`,e.lineNumber]})]})]}),(0,J.jsx)(`div`,{className:`comment-edit-form-wrap`,children:(0,J.jsx)(RW,{draftKey:`edit:${e.id}`,initialBody:e.body,lineContent:e.lineContent,onSubmit:t=>{l(e.id,t),g(!1)},onCancel:()=>g(!1)})})]})]})}):(0,J.jsxs)(`div`,{className:`comment-bubble-canvas ${u?`comment-bubble-canvas-resolved`:``}`,id:`comment-${e.id}`,role:`article`,"aria-label":e.lineNumber===0?`File-level comment`:`Comment by user on line ${e.lineNumber}`,children:[(0,J.jsxs)(`div`,{className:`comment-node ${u?`comment-node-resolved`:``}`,children:[(0,J.jsx)(`div`,{className:`comment-avatar-col`,children:(0,J.jsx)(BW,{role:`user`,size:16})}),(0,J.jsxs)(`div`,{className:`comment-content-col`,children:[(0,J.jsxs)(`div`,{className:`comment-node-header`,children:[(0,J.jsx)(`button`,{type:`button`,className:`comment-collapse-btn`,onClick:()=>f(!0),"aria-expanded":!0,"aria-label":`Collapse comment thread`,title:`Collapse`,children:(0,J.jsx)(TD,{size:14,"aria-hidden":`true`})}),(0,J.jsx)(`span`,{className:`comment-node-author`,children:`User`}),(0,J.jsx)(`span`,{className:`comment-node-badge comment-node-badge-user`,children:`User`}),(0,J.jsxs)(`span`,{className:`comment-node-time comment-node-meta`,children:[FT(e.createdAt),e.lineNumber===0&&(0,J.jsx)(`span`,{className:`comment-file-chip`,children:`File Comment`}),e.startLineNumber&&e.startLineNumber!==e.lineNumber&&(0,J.jsxs)(`span`,{className:`comment-range-chip`,children:[`L`,e.startLineNumber,`–`,e.lineNumber]})]}),u&&(0,J.jsxs)(`span`,{className:`comment-canvas-resolved-banner comment-resolved-inline`,children:[(0,J.jsx)(AD,{size:13}),`Resolved`]}),!u&&(0,J.jsxs)(`div`,{className:`comment-node-actions`,children:[(0,J.jsx)(`button`,{ref:T,className:`comment-node-btn`,onClick:()=>g(!0),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),g(!0))},title:`Edit comment`,"aria-label":`Edit comment`,tabIndex:0,children:(0,J.jsx)(DO,{size:13,"aria-hidden":`true`})}),_?(0,J.jsxs)(`div`,{className:`comment-delete-confirm`,children:[(0,J.jsxs)(`button`,{className:`comment-node-btn comment-node-btn-delete comment-delete-confirm-yes`,onClick:()=>t(e.id),title:`Confirm delete`,"aria-label":`Confirm delete comment`,children:[(0,J.jsx)(BO,{size:11}),`Delete?`]}),(0,J.jsx)(`button`,{className:`comment-node-btn comment-delete-confirm-cancel`,onClick:()=>v(!1),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v(!1))},title:`Cancel delete`,"aria-label":`Cancel delete`,children:`Cancel`})]}):(0,J.jsx)(`button`,{className:`comment-node-btn comment-node-btn-delete`,onClick:()=>v(!0),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v(!0))},title:`Delete comment`,"aria-label":`Delete comment`,tabIndex:0,children:(0,J.jsx)(zO,{size:13,"aria-hidden":`true`})})]})]}),E&&(0,J.jsx)(QV,{content:e.body,className:`comment-node-body markdown-body ${u?`comment-resolved-line`:``}`}),(()=>{let t=e.body.match(/```suggestion\n([\s\S]*?)```/),n=!!t&&e.side===`additions`,r=t?t[1].trimEnd():``;return n?(0,J.jsxs)(`div`,{className:`suggestion-card comment-suggestion-card`,children:[(0,J.jsxs)(`div`,{className:`suggestion-header`,children:[(0,J.jsx)(`span`,{className:`suggestion-header-label`,children:`Suggested Change`}),u?(0,J.jsxs)(`span`,{className:`suggestion-applied`,children:[(0,J.jsx)(AD,{size:12}),` Applied`]}):(0,J.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,disabled:x,onClick:async()=>{S(!0);try{await c(e.id)}catch(e){w(e instanceof Error?e.message:`The suggestion could not be applied.`)}finally{S(!1)}},children:x?`Applying…`:`Apply Suggestion`})]}),(0,J.jsxs)(`div`,{className:`suggestion-diff`,children:[(0,J.jsxs)(`div`,{className:`suggestion-diff-line suggestion-diff-line-deletion`,children:[(0,J.jsx)(`span`,{className:`suggestion-diff-sign`,children:`-`}),(0,J.jsx)(`span`,{className:`suggestion-diff-code`,children:e.lineContent})]}),(0,J.jsxs)(`div`,{className:`suggestion-diff-line suggestion-diff-line-addition`,children:[(0,J.jsx)(`span`,{className:`suggestion-diff-sign`,children:`+`}),(0,J.jsx)(`span`,{className:`suggestion-diff-code`,children:r})]})]})]}):null})()]})]}),e.replies?.length>0&&(0,J.jsx)(`div`,{className:`comment-replies`,role:`list`,"aria-label":`Replies`,children:e.replies.map((t,n)=>{let r=t.role===`agent`,i=y===t.id;return(0,J.jsxs)(`div`,{className:`comment-node ${r?`comment-node-agent`:`comment-node-user`} ${u?`comment-node-resolved`:``}`,role:`listitem`,"aria-label":`${r?`Agent`:`User`} reply ${n+1}`,children:[(0,J.jsx)(`div`,{className:`comment-avatar-col`,children:(0,J.jsx)(BW,{role:r?`agent`:`user`,size:14})}),(0,J.jsxs)(`div`,{className:`comment-content-col`,children:[(0,J.jsxs)(`div`,{className:`comment-node-header`,children:[(0,J.jsx)(`span`,{className:`comment-node-author`,children:r?`Agent`:`User`}),(0,J.jsx)(`span`,{className:`comment-node-badge ${r?`comment-node-badge-agent`:`comment-node-badge-user`}`,children:r?`Agent`:`User`}),r&&t.model&&(0,J.jsx)(`span`,{className:`comment-model-chip`,children:t.model}),(0,J.jsx)(`span`,{className:`comment-node-time`,children:FT(t.createdAt)}),!u&&(0,J.jsxs)(`div`,{className:`comment-node-actions`,children:[(0,J.jsx)(`button`,{className:`comment-node-btn`,onClick:()=>j(t.id),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),j(t.id))},title:`Edit reply`,"aria-label":`Edit reply`,tabIndex:0,children:(0,J.jsx)(DO,{size:12,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{className:`comment-node-btn comment-node-btn-delete`,onClick:()=>M(t.id),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),M(t.id))},title:`Delete reply`,"aria-label":`Delete reply`,tabIndex:0,children:(0,J.jsx)(zO,{size:12,"aria-hidden":`true`})})]})]}),i?(0,J.jsx)(`div`,{className:`comment-reply-editor`,children:(0,J.jsx)(RW,{draftKey:`reply-edit:${e.id}:${t.id}`,initialBody:t.body,onSubmit:n=>{s(e.id,t.id,n),b(null)},onCancel:()=>b(null)})}):(0,J.jsx)(QV,{content:t.body,className:`comment-node-body markdown-body`})]})]},t.id)})}),(0,J.jsxs)(`div`,{className:`comment-canvas-footer`,children:[!p&&(0,J.jsxs)(`div`,{className:`comment-canvas-footer-row`,children:[(0,J.jsxs)(`button`,{onClick:()=>m(!0),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),m(!0))},className:`comment-reply-trigger`,"aria-label":`Write a reply`,tabIndex:0,children:[(0,J.jsx)(AO,{size:14,"aria-hidden":`true`}),`Reply...`]}),u?(0,J.jsxs)(`div`,{className:`comment-canvas-footer-actions`,children:[(0,J.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:()=>f(!0),"aria-label":`Hide resolved conversation`,children:`Hide`}),(0,J.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:A,"aria-label":`Unresolve conversation`,children:`Unresolve`})]}):(0,J.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:k,"aria-label":`Resolve conversation`,children:`Resolve conversation`})]}),p&&(0,J.jsx)(`div`,{className:`comment-reply-composer`,children:(0,J.jsx)(RW,{draftKey:`reply:${e.id}`,onSubmit:t=>{a(e.id,t),m(!1)},onCancel:()=>{m(!1),T.current?.focus()}})})]}),(0,J.jsx)(zW,{open:C!==null,title:`Could not apply suggestion`,description:C??`The suggestion could not be applied.`,closeLabel:`Return to review`,onClose:()=>w(null)})]})}function HW({comment:e,lineContent:t,onReply:n,onEdit:r,onDelete:i,onSetResolved:a}){let[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(e.body),[b,x]=(0,q.useState)(!1),[S,C]=(0,q.useState)(!1);(0,q.useEffect)(()=>{g||y(e.body)},[e.body,g]);let w=e.state?{APPROVED:{icon:AD,label:`Approved`,cls:`badge-approved`},CHANGES_REQUESTED:{icon:BO,label:`Changes requested`,cls:`badge-changes`},COMMENTED:{icon:fO,label:`Commented`,cls:`badge-commented`},PENDING:{icon:fO,label:`Pending`,cls:`badge-pending`},DISMISSED:{icon:BO,label:`Dismissed`,cls:`badge-dismissed`}}[e.state]:null,T=UW(e.body),E=async()=>{let t=u.trim();if(!(!t||!n)){p(!0),h(null);try{await n(e.id,t),d(``),l(!1),s(!0)}catch(e){h(e?.message??`Failed to reply`)}finally{p(!1)}}},D=async e=>{x(!0),h(null);try{await e()}catch(e){throw h(e?.message??`GitHub update failed`),e}finally{x(!1)}},O=async()=>{let t=v.trim();if(!(!t||!r))try{await D(()=>r(e.id,t)),_(!1)}catch{}};return(0,J.jsxs)(`div`,{className:`pr-existing-bubble ${e.isResolved?`is-resolved`:``}`,children:[(0,J.jsxs)(`div`,{className:`pr-existing-bubble-head`,children:[e.author?(0,J.jsx)(`img`,{className:`pr-existing-avatar`,src:e.author.avatarUrl,alt:e.author.login}):(0,J.jsx)(`div`,{className:`pr-existing-avatar pr-existing-avatar-fallback`}),(0,J.jsxs)(`div`,{className:`pr-existing-bubble-meta`,children:[(0,J.jsxs)(`span`,{className:`pr-existing-bubble-author`,children:[`@`,e.author?.login??`unknown`]}),(0,J.jsx)(`span`,{className:`pr-existing-bubble-date`,children:new Date(e.createdAt).toLocaleString()})]}),(0,J.jsx)(`span`,{className:`pr-existing-bubble-source`,children:`from GitHub`}),e.line!=null&&(0,J.jsxs)(`span`,{className:`pr-existing-bubble-location`,children:[`L`,e.line,` · `,e.side===`LEFT`?`base`:`head`]}),w&&(0,J.jsxs)(`span`,{className:`pr-existing-bubble-badge ${w.cls}`,children:[(0,J.jsx)(w.icon,{size:11}),` `,w.label]}),e.isOutdated&&(0,J.jsxs)(`span`,{className:`pr-existing-bubble-badge badge-outdated`,children:[(0,J.jsx)(BO,{size:11}),` outdated`]}),e.isResolved&&(0,J.jsxs)(`span`,{className:`pr-existing-bubble-badge badge-approved`,children:[(0,J.jsx)(AD,{size:11}),` resolved`]}),(0,J.jsxs)(`span`,{className:`pr-existing-bubble-actions`,children:[e.threadId&&a&&(0,J.jsx)(`button`,{type:`button`,className:`file-diff-icon-btn`,disabled:b||(e.isResolved?e.viewerCanUnresolve===!1:e.viewerCanResolve===!1),onClick:()=>{D(()=>a(e.threadId,!e.isResolved)).catch(()=>void 0)},title:e.isResolved?`Reopen conversation on GitHub`:`Resolve conversation on GitHub`,"aria-label":e.isResolved?`Reopen conversation`:`Resolve conversation`,children:e.isResolved?(0,J.jsx)(jO,{size:12}):(0,J.jsx)(AD,{size:12})}),r&&e.viewerDidAuthor!==!1&&(0,J.jsx)(`button`,{type:`button`,className:`file-diff-icon-btn`,disabled:b,onClick:()=>_(!0),title:`Edit on GitHub`,"aria-label":`Edit GitHub comment`,children:(0,J.jsx)(DO,{size:12})}),i&&e.viewerDidAuthor!==!1&&(0,J.jsx)(`button`,{type:`button`,className:`file-diff-icon-btn danger`,disabled:b,onClick:()=>{h(null),C(!0)},title:`Delete from GitHub`,"aria-label":`Delete GitHub comment`,children:(0,J.jsx)(zO,{size:12})})]})]}),g?(0,J.jsxs)(`div`,{className:`pr-existing-edit-form`,children:[(0,J.jsx)(`textarea`,{value:v,onChange:e=>y(e.target.value),rows:3,"aria-label":`Edit GitHub comment body`}),(0,J.jsxs)(`div`,{className:`pr-existing-reply-form-actions`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:b,onClick:()=>{_(!1),y(e.body)},children:`Cancel`}),(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,disabled:b||!v.trim(),onClick:()=>{O()},children:b?`Saving…`:`Save on GitHub`})]})]}):(0,J.jsxs)(J.Fragment,{children:[T.remainingBody&&(0,J.jsx)(QV,{content:T.remainingBody,className:`pr-existing-bubble-body markdown-body`}),T.code!=null&&(0,J.jsxs)(`div`,{className:`pr-existing-suggestion`,"aria-label":`Suggested change preview`,children:[(0,J.jsxs)(`div`,{className:`pr-existing-suggestion-head`,children:[(0,J.jsx)(`span`,{children:`Suggested change`}),(0,J.jsx)(`span`,{className:`pr-existing-suggestion-preview-label`,children:`Preview`})]}),(0,J.jsxs)(`div`,{className:`pr-existing-suggestion-diff`,children:[t!=null&&t!==``&&(0,J.jsxs)(`div`,{className:`pr-existing-suggestion-line is-removed`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`−`}),(0,J.jsx)(`code`,{children:t})]}),(0,J.jsxs)(`div`,{className:`pr-existing-suggestion-line is-added`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`+`}),(0,J.jsx)(`code`,{children:T.code})]})]})]})]}),e.replies.length>0&&(0,J.jsxs)(`button`,{type:`button`,className:`pr-existing-bubble-toggle`,onClick:()=>s(e=>!e),children:[o?`Hide`:`Show`,` `,e.replies.length,` repl`,e.replies.length===1?`y`:`ies`]}),o&&e.replies.length>0&&(0,J.jsx)(`ul`,{className:`pr-existing-replies`,children:e.replies.map(e=>(0,J.jsx)(WW,{reply:e,onEdit:r,onDelete:i},e.id))}),n&&(0,J.jsx)(`div`,{className:`pr-existing-reply-actions`,children:c?(0,J.jsxs)(`div`,{className:`pr-existing-reply-form`,children:[(0,J.jsx)(`textarea`,{value:u,onChange:e=>d(e.target.value),rows:3,placeholder:`Reply to this thread on GitHub…`,"aria-label":`Reply body`}),m&&(0,J.jsx)(`p`,{className:`pr-existing-reply-error`,children:m}),(0,J.jsxs)(`div`,{className:`pr-existing-reply-form-actions`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>{l(!1),d(``),h(null)},disabled:f,children:`Cancel`}),(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:E,disabled:f||!u.trim(),children:f?`Sending…`:`Post reply`})]})]}):(0,J.jsxs)(`button`,{type:`button`,className:`btn btn-sm pr-existing-reply-btn`,onClick:()=>l(!0),children:[(0,J.jsx)(HD,{size:12}),`Reply on GitHub`]})}),m&&!c&&(0,J.jsx)(`p`,{className:`pr-existing-reply-error`,role:`alert`,children:m}),(0,J.jsx)(LH,{open:S,title:`Delete published GitHub comment?`,description:`This removes the comment from GitHub for everyone and cannot be undone.`,detail:e.body,confirmLabel:`Delete comment`,busyLabel:`Deleting…`,variant:`danger`,busy:b,error:m,onConfirm:async()=>{if(i)try{await D(()=>i(e.id)),C(!1)}catch{}},onCancel:()=>{C(!1),h(null)}})]})}function UW(e){let t=/```suggestion[^\r\n]*\r?\n([\s\S]*?)```/i.exec(e);return t?{remainingBody:e.replace(/```suggestion[^\r\n]*\r?\n[\s\S]*?```/gi,``).trim(),code:t[1].replace(/\r\n/g,`
2019
- `).replace(/\n$/,``)}:{remainingBody:e,code:null}}function WW({reply:e,onEdit:t,onDelete:n}){let[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.body),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(!1);(0,q.useEffect)(()=>{r||o(e.body)},[e.body,r]);let p=async()=>{if(!(!t||!a.trim())){c(!0),u(null);try{await t(e.id,a.trim()),i(!1)}catch(e){u(e?.message??`Failed to edit reply`)}finally{c(!1)}}},m=async()=>{if(n){c(!0),u(null);try{await n(e.id),f(!1)}catch(e){u(e?.message??`Failed to delete reply`)}finally{c(!1)}}};return(0,J.jsxs)(`li`,{className:`pr-existing-reply`,children:[(0,J.jsxs)(`div`,{className:`pr-existing-bubble-meta`,children:[(0,J.jsxs)(`span`,{className:`pr-existing-bubble-author`,children:[`@`,e.author?.login??`unknown`]}),(0,J.jsx)(`span`,{className:`pr-existing-bubble-date`,children:new Date(e.createdAt).toLocaleString()}),(0,J.jsxs)(`span`,{className:`pr-existing-bubble-actions`,children:[t&&e.viewerDidAuthor!==!1&&(0,J.jsx)(`button`,{type:`button`,className:`file-diff-icon-btn`,disabled:s,onClick:()=>i(!0),"aria-label":`Edit GitHub reply`,children:(0,J.jsx)(DO,{size:11})}),n&&e.viewerDidAuthor!==!1&&(0,J.jsx)(`button`,{type:`button`,className:`file-diff-icon-btn danger`,disabled:s,onClick:()=>{u(null),f(!0)},"aria-label":`Delete GitHub reply`,children:(0,J.jsx)(zO,{size:11})})]})]}),r?(0,J.jsxs)(`div`,{className:`pr-existing-edit-form is-reply`,children:[(0,J.jsx)(`textarea`,{value:a,onChange:e=>o(e.target.value),rows:3,"aria-label":`Edit GitHub reply body`}),(0,J.jsxs)(`div`,{className:`pr-existing-reply-form-actions`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:s,onClick:()=>{i(!1),o(e.body)},children:`Cancel`}),(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,disabled:s||!a.trim(),onClick:()=>{p()},children:s?`Saving…`:`Save`})]})]}):(0,J.jsx)(`p`,{children:e.body}),l&&(0,J.jsx)(`p`,{className:`pr-existing-reply-error`,role:`alert`,children:l}),(0,J.jsx)(LH,{open:d,title:`Delete published GitHub reply?`,description:`This removes the reply from GitHub for everyone and cannot be undone.`,detail:e.body,confirmLabel:`Delete reply`,busyLabel:`Deleting…`,variant:`danger`,busy:s,error:l,onConfirm:m,onCancel:()=>{f(!1),u(null)}})]})}function GW(e){let t=e.hunks??[];if(t.length===0)return[];let n=t.map(e=>{let t=e.additionCount??e.additionLines??0,n=e.deletionCount??e.deletionLines??0;return Math.max(1,t+n)}),r=n.reduce((e,t)=>e+t,0)||1,i=0;return t.map((e,t)=>{let a=e.additionCount??e.additionLines??0,o=e.deletionCount??e.deletionLines??0,s=n[t]/r,c=i;i+=s;let l=`change`;a>0&&o===0?l=`add`:o>0&&a===0&&(l=`del`);let u=e.additionStart||0,d=e.deletionStart||0,f=u||d||1,p=u&&a>0?u+Math.max(0,a-1):d&&o>0?d+Math.max(0,o-1):f,m=p===f?`L${f}`:`L${f}–${p}`;return{start:c,height:s,kind:l,line:f,index:t+1,additions:a,deletions:o,rangeLabel:m}})}function KW(e){return e===`add`?`Added`:e===`del`?`Removed`:`Modified`}function qW(e){let t=[];return e.additions>0&&t.push(`+${e.additions}`),e.deletions>0&&t.push(`−${e.deletions}`),t.join(` `)||`empty`}function JW(e){return[`Hunk ${e.index}`,KW(e.kind),qW(e),e.rangeLabel,`Click to jump`].join(` · `)}var YW=(0,q.memo)(function({fileDiff:e,filePath:t,onJump:n}){let r=(0,q.useMemo)(()=>GW(e),[e]),[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(null),c=(0,q.useMemo)(()=>{let e=0,t=0;for(let n of r)e+=n.additions,t+=n.deletions;return{additions:e,deletions:t,hunks:r.length}},[r]),l=(0,q.useCallback)(e=>{if(s(e.index),n){n(t,e.line);return}(document.getElementById(`file-${CSS.escape(t)}`)??document.querySelector(`[data-file-path="${CSS.escape(t)}"]`))?.scrollIntoView({behavior:`smooth`,block:`start`})},[t,n]);if(r.length===0)return null;let u=i==null?null:r.find(e=>e.index===i);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`diff-minimap-header`,role:`region`,"aria-label":`Change map for ${t}`,children:[(0,J.jsxs)(`div`,{className:`diff-minimap-meta`,children:[(0,J.jsxs)(`span`,{className:`diff-minimap-title`,children:[(0,J.jsx)(lO,{size:12,"aria-hidden":`true`}),`Change map`]}),(0,J.jsxs)(`span`,{className:`diff-minimap-summary`,children:[c.hunks,` hunk`,c.hunks===1?``:`s`,c.additions>0&&(0,J.jsxs)(`span`,{className:`diff-minimap-stat-add`,children:[` +`,c.additions]}),c.deletions>0&&(0,J.jsxs)(`span`,{className:`diff-minimap-stat-del`,children:[` −`,c.deletions]})]}),(0,J.jsx)(`span`,{className:`diff-minimap-hint`,children:`Hover the bar on the right · Click to jump`})]}),(0,J.jsxs)(`div`,{className:`diff-minimap-footer`,children:[(0,J.jsxs)(`div`,{className:`diff-minimap-legend`,"aria-hidden":`true`,children:[(0,J.jsxs)(`span`,{className:`diff-minimap-legend-item`,children:[(0,J.jsx)(`i`,{className:`diff-minimap-dot diff-minimap-dot-add`}),` Added`]}),(0,J.jsxs)(`span`,{className:`diff-minimap-legend-item`,children:[(0,J.jsx)(`i`,{className:`diff-minimap-dot diff-minimap-dot-del`}),` Removed`]}),(0,J.jsxs)(`span`,{className:`diff-minimap-legend-item`,children:[(0,J.jsx)(`i`,{className:`diff-minimap-dot diff-minimap-dot-change`}),` Modified`]})]}),u?(0,J.jsxs)(`div`,{className:`diff-minimap-live`,"aria-live":`polite`,children:[(0,J.jsxs)(`strong`,{children:[`#`,u.index]}),(0,J.jsx)(`span`,{children:KW(u.kind)}),(0,J.jsx)(`span`,{className:`diff-minimap-live-stats`,children:qW(u)}),(0,J.jsx)(`span`,{className:`diff-minimap-live-range`,children:u.rangeLabel})]}):(0,J.jsx)(`div`,{className:`diff-minimap-live diff-minimap-live-idle`,children:`Hover a block for details`})]})]}),(0,J.jsx)(`div`,{className:`diff-minimap`,role:`navigation`,"aria-label":`Jump to changes in ${t}`,children:(0,J.jsx)(`div`,{className:`diff-minimap-track`,role:`list`,children:r.map(e=>{let t=i===e.index||o===e.index;return(0,J.jsx)(Qw,{content:JW(e),side:`left`,children:(0,J.jsx)(`button`,{type:`button`,role:`listitem`,className:[`diff-minimap-seg`,`diff-minimap-seg-${e.kind}`,t?`diff-minimap-seg-hot`:``,o===e.index?`diff-minimap-seg-active`:``].filter(Boolean).join(` `),style:{top:`${e.start*100}%`,height:`${Math.max(e.height*100,3)}%`},onClick:t=>{t.stopPropagation(),l(e)},onMouseEnter:()=>a(e.index),onMouseLeave:()=>a(null),onFocus:()=>a(e.index),onBlur:()=>a(null),"aria-label":JW(e)})},e.index)})})})]})});function XW(e){return e.endSide??e.side??`additions`}function ZW(e){return e.side??e.endSide??`additions`}function QW(e){if(e.startSide&&e.startSide!==e.side){if(e.startLineNumber==null||e.startLineNumber===e.lineNumber){let{startLineNumber:t,startSide:n,...r}=e;return r}return e}let t=e.startLineNumber==null?e.lineNumber:Math.min(e.startLineNumber,e.lineNumber),n=e.startLineNumber==null?e.lineNumber:Math.max(e.startLineNumber,e.lineNumber);return t===n?{side:e.side,lineNumber:n}:{side:e.side,lineNumber:n,startLineNumber:t}}function $W(e){let t=ZW(e),n=XW(e);if(t===n){let t=Math.min(e.start,e.end),r=Math.max(e.start,e.end);return QW({side:n,lineNumber:r,startLineNumber:t===r?void 0:t})}return{side:n,lineNumber:e.end,startLineNumber:e.start===e.end?void 0:e.start,startSide:t}}function eG(e){return e.side===`deletions`?`old`:`new`}function tG(e){let t=eG(e);return e.startLineNumber!=null&&e.startLineNumber!==e.lineNumber?`L${Math.min(e.startLineNumber,e.lineNumber)}–L${Math.max(e.startLineNumber,e.lineNumber)} · ${t}`:`L${e.lineNumber} · ${t}`}function nG(e){return e.startSide&&e.startSide!==e.side?{start:e.startLineNumber??e.lineNumber,end:e.lineNumber}:{start:e.startLineNumber==null?e.lineNumber:Math.min(e.startLineNumber,e.lineNumber),end:e.startLineNumber==null?e.lineNumber:Math.max(e.startLineNumber,e.lineNumber)}}function rG(e){return e.startLineNumber!=null&&e.startLineNumber!==e.lineNumber?{start:e.startLineNumber,end:e.lineNumber,side:e.startSide??e.side,...e.startSide&&e.startSide!==e.side?{endSide:e.side}:{}}:{start:e.lineNumber,end:e.lineNumber,side:e.side}}function iG(e,t,n){if(e.startSide&&e.startSide!==e.side)return e;if(!Number.isFinite(t)||t===0)return QW(e);let{start:r,end:i}=nG(e),a=r+t;return n&&(a=Math.max(n.min,Math.min(n.max,a))),a=Math.min(a,i),QW({side:e.side,lineNumber:i,startLineNumber:a})}function aG(e,t,n){if(e.startSide&&e.startSide!==e.side)return e;if(!Number.isFinite(t)||t===0)return QW(e);let{start:r,end:i}=nG(e),a=i+t;return n&&(a=Math.max(n.min,Math.min(n.max,a))),a=Math.max(a,r),QW({side:e.side,lineNumber:a,startLineNumber:r})}function oG(e,t,n){if(e.startSide&&e.startSide!==e.side)return!1;let r=iG(e,t,n);return r.startLineNumber!==e.startLineNumber||r.lineNumber!==e.lineNumber}function sG(e,t,n){if(e.startSide&&e.startSide!==e.side)return!1;let r=aG(e,t,n);return r.startLineNumber!==e.startLineNumber||r.lineNumber!==e.lineNumber}function cG(e,t){if(t.isOutdated||t.line==null||t.line<1||t.side==null)return!1;let n=t.side===`LEFT`?`deletions`:`additions`,r=n===`additions`?`additionStart`:`deletionStart`,i=n===`additions`?`additionCount`:`deletionCount`;return e.hunks.some(e=>t.line>=e[r]&&t.line<e[r]+e[i])}function lG(e,t,n){let r=t===`additions`?`additionStart`:`deletionStart`,i=t===`additions`?`additionCount`:`deletionCount`,a=1/0,o=0;for(let t of e.hunks){let e=t[r],n=t[i];n<=0||(a=Math.min(a,e),o=Math.max(o,e+n-1))}return n&&n>0&&(a=Math.min(a===1/0?1:a,1),o=Math.max(o,n)),!Number.isFinite(a)||o<1?{min:1,max:Math.max(1,n??1)}:{min:a,max:o}}function uG(e){return e.filter(e=>e.lineNumber>0&&TW(e.side))}var dG=(0,q.memo)(function({id:e,fileDiff:t,filePath:n,annotations:r,existingComments:i=[],diffStyle:a,tabSize:o,viewed:s,theme:c,editorIDE:l,lineDiffType:u,lineWrap:d,diffIndicators:f,showLineNumbers:p,hunkSeparators:m,lineHoverHighlight:h,fontSize:g,monoFontFamily:_,expandContextByDefault:v,collapsedContextThreshold:y,expansionLineCount:b,autoCollapseLineThreshold:x,onViewedChange:S,onAddComment:C,onDeleteComment:w,onReplyExisting:T,onEditExisting:E,onDeleteExisting:D,onSetExistingResolved:O,allowLocalActions:k=!0,onCardToggleCollapse:A}){let[j,M]=(0,q.useState)(null),[N,P]=(0,q.useState)(null),[F,I]=(0,q.useState)(0),L=(0,q.useRef)(null),[R,z]=(0,q.useState)(null),[B,V]=(0,q.useState)(!1),H=t.additionLines.length+t.deletionLines.length,[U,W]=(0,q.useState)(s||x>0&&H>x),[ee,te]=(0,q.useState)(!1),[ne,re]=(0,q.useState)(!1),[ie,ae]=(0,q.useState)(v),[oe,G]=(0,q.useState)(null),[se,K]=(0,q.useState)(null),[ce,le]=(0,q.useState)(null),ue=(0,q.useRef)(null),[de,fe]=(0,q.useState)(!1),pe=e=>{e.stopPropagation(),!(typeof navigator>`u`||!navigator.clipboard)&&navigator.clipboard.writeText(n).then(()=>{V(!0),window.setTimeout(()=>V(!1),1500)},()=>{})},me=async e=>{if(oe===null){G(e),K(null);try{let t=await fetch(`/api/revert-hunk`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:n,hunkIndex:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`HTTP ${t.status}`)}}catch(e){K(e.message)}finally{G(null)}}},he=t.type===`change`||t.type===`rename-changed`,ge=!U&&he,_e=t.prevName??n,{loading:ve,oldContent:ye,newContent:be}=wW(n,ie&&ge,_e),xe=ie&&ye!==null&&be!==null;(0,q.useLayoutEffect)(()=>{W(s)},[s]),(0,q.useEffect)(()=>{if(de||U)return;let e=ue.current;if(!e||typeof IntersectionObserver>`u`){fe(!0);return}let t=e.getBoundingClientRect();if(t.bottom>=-800&&t.top<=(typeof window<`u`?window.innerHeight+800:2e3)){fe(!0);return}let n=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(fe(!0),n.disconnect())},{root:null,rootMargin:`800px 0px`,threshold:0});return n.observe(e),()=>n.disconnect()},[U,de]);let Se=LT[c]||LT[`rose-pine`],Ce=(0,q.useMemo)(()=>pG(o,g,_),[o,g,_]),we=(e,n,r)=>{let i=r??n,a=n,o=Math.min(i,a),s=Math.max(i,a),c=[],l=xe?(e===`additions`?be:ye)?.replace(/\r\n/g,`
2018
+ `))return;c()}},P=async e=>{let t=e.clipboardData.items,n=null;for(let e=0;e<t.length;e++){let r=t[e];if(r.kind===`file`&&r.type.startsWith(`image/`)){n=r.getAsFile();break}}if(!n)return;e.preventDefault();let r=T.current;if(!r)return;let i=r.selectionStart,a=r.selectionEnd,o=Math.random().toString(36).slice(2,8),s=`![Uploading image… ${o}]()`,c=r.value;g(c.slice(0,i)+s+c.slice(a));try{let e=new FormData;e.append(`file`,n,n.name||`pasted-${o}.png`);let t=await fetch(`/api/attachments`,{method:`POST`,body:e});if(!t.ok)throw Error(`HTTP ${t.status}`);let r=await t.json();if(!r.url)throw Error(r.error||`Upload failed`);let i=`![pasted image](${r.url})`;g(e=>e.replace(s,i))}catch(e){console.error(`Image upload failed:`,e),g(e=>e.replace(s,`![upload failed]()`))}},F=!!(r&&i&&a),I=r?Math.abs(r.end-r.start)+1:0,L=F&&(r.canAdjustStart?.(-1)??!0),R=F&&(r.canAdjustStart?.(1)??!0),z=F&&(r.canAdjustEnd?.(-1)??!0),B=F&&(r.canAdjustEnd?.(1)??!0),V=e=>{e.preventDefault()};return(0,J.jsxs)(`div`,{className:`comment-form comment-form-sheet`,role:`form`,"aria-label":`Comment form`,children:[F&&r?(0,J.jsxs)(`div`,{className:`comment-form-range`,"aria-live":`polite`,children:[(0,J.jsx)(`span`,{className:`comment-form-range-prefix`,children:`Commenting on`}),(0,J.jsxs)(`div`,{className:`comment-form-range-controls`,role:`group`,"aria-label":`Comment line range`,children:[(0,J.jsxs)(`div`,{className:`comment-form-range-edge`,"aria-label":`Range start`,children:[(0,J.jsx)(`button`,{type:`button`,className:`comment-form-range-btn`,"aria-label":`Expand range upward`,title:`Expand range upward`,disabled:!L,onMouseDown:V,onClick:()=>i(-1),children:`−`}),(0,J.jsxs)(`span`,{className:`comment-form-range-num`,"aria-label":`Start line ${r.start}`,children:[`L`,r.start]}),(0,J.jsx)(`button`,{type:`button`,className:`comment-form-range-btn`,"aria-label":`Shrink range from top`,title:`Shrink range from top`,disabled:!R,onMouseDown:V,onClick:()=>i(1),children:`+`})]}),(0,J.jsx)(`span`,{className:`comment-form-range-sep`,"aria-hidden":`true`,children:`–`}),(0,J.jsxs)(`div`,{className:`comment-form-range-edge`,"aria-label":`Range end`,children:[(0,J.jsx)(`button`,{type:`button`,className:`comment-form-range-btn`,"aria-label":`Shrink range from bottom`,title:`Shrink range from bottom`,disabled:!z,onMouseDown:V,onClick:()=>a(-1),children:`−`}),(0,J.jsxs)(`span`,{className:`comment-form-range-num`,"aria-label":`End line ${r.end}`,children:[`L`,r.end]}),(0,J.jsx)(`button`,{type:`button`,className:`comment-form-range-btn`,"aria-label":`Expand range downward`,title:`Expand range downward`,disabled:!B,onMouseDown:V,onClick:()=>a(1),children:`+`})]})]}),(0,J.jsxs)(`span`,{className:`comment-form-range-meta`,children:[(0,J.jsx)(`span`,{className:`comment-form-range-side`,children:r.sideLabel}),(0,J.jsxs)(`span`,{className:`comment-form-range-count`,children:[I,` line`,I===1?``:`s`]})]})]}):n?(0,J.jsxs)(`div`,{className:`comment-form-line-label`,"aria-live":`polite`,children:[`Commenting on `,(0,J.jsx)(`strong`,{children:n})]}):null,(0,J.jsxs)(`div`,{className:`comment-form-tabs`,role:`tablist`,"aria-label":`Comment form mode`,children:[(0,J.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":y===`write`,"aria-controls":`comment-write-panel`,onClick:()=>b(`write`),onKeyDown:e=>{e.key===`ArrowRight`&&(e.preventDefault(),b(`preview`))},className:`comment-form-tab-btn ${y===`write`?`comment-form-tab-btn-active`:`comment-form-tab-btn-inactive`}`,children:`Write`}),(0,J.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":y===`preview`,"aria-controls":`comment-preview-panel`,onClick:()=>b(`preview`),onKeyDown:e=>{e.key===`ArrowLeft`&&(e.preventDefault(),b(`write`))},className:`comment-form-tab-btn ${y===`preview`?`comment-form-tab-btn-active`:`comment-form-tab-btn-inactive`}`,children:`Preview`})]}),y===`write`?(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`comment-form-suggest-row`,children:[m.length>0&&(0,J.jsxs)(`div`,{className:`comment-form-saved-replies`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm comment-form-suggest-btn`,onClick:()=>S(e=>!e),"aria-expanded":x,title:`Insert a saved reply template`,children:`Saved replies`}),x&&(0,J.jsx)(`ul`,{className:`comment-form-saved-list`,role:`listbox`,children:m.map(e=>(0,J.jsxs)(`li`,{children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>O(e),role:`option`,children:e.title}),(0,J.jsx)(`button`,{type:`button`,className:`comment-form-saved-delete`,"aria-label":`Delete template ${e.title}`,onClick:()=>p({savedReplies:m.filter(t=>t.id!==e.id)}),children:`×`})]},e.id))})]}),h.trim()&&(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm comment-form-suggest-btn`,onClick:k,title:`Save current body as a reusable template`,children:`Save template`}),t?(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm comment-form-suggest-btn`,onClick:M,title:"Insert a ```suggestion block pre-filled with the selected line(s)",children:`Suggest change`}):null]}),(0,J.jsxs)(`div`,{className:`comment-form-editor`,children:[(0,J.jsx)(`textarea`,{id:`comment-write-panel`,ref:e=>{T.current=e,D.setTextareaRef(e)},value:h,onChange:e=>g(e.target.value),onKeyDown:N,onPaste:P,placeholder:`Leave a review comment (supports Markdown and Pasting Clipboard Images)...`,rows:4,"aria-label":`Comment body`,className:`comment-form-textarea`}),D.isOpen&&(0,J.jsx)(aH,{results:D.results,focusedIndex:D.focusedIndex,query:D.query,cursorTop:D.cursorTop,onSelect:D.onSelect,onHover:D.setFocusedIndex})]})]}):(0,J.jsxs)(`div`,{id:`comment-preview-panel`,ref:E,role:`tabpanel`,"aria-label":`Preview`,tabIndex:0,onKeyDown:e=>{e.key===`p`&&(e.metaKey||e.ctrlKey)&&e.shiftKey&&(e.preventDefault(),b(`write`))},className:`comment-preview-panel`,children:[(()=>{let e=!!h.match(/```suggestion\n([\s\S]*?)```/);return h.replace(/```suggestion\n([\s\S]*?)```/g,``).trim().length>0||!e?(0,J.jsx)(`div`,{className:`comment-preview markdown-body`,children:h.trim()?(0,J.jsx)(QV,{content:FW(h)}):(0,J.jsx)(`span`,{className:`comment-preview-empty`,children:`Nothing to preview`})}):null})(),(()=>{let e=h.match(/```suggestion\n([\s\S]*?)```/),n=!!e,r=e?e[1].trimEnd():``;return n?(0,J.jsxs)(`div`,{className:`suggestion-card`,children:[(0,J.jsx)(`div`,{className:`suggestion-header`,children:(0,J.jsx)(`span`,{className:`suggestion-header-label`,children:`Suggested Change Preview`})}),(0,J.jsxs)(`div`,{className:`suggestion-diff`,children:[t&&(0,J.jsxs)(`div`,{className:`suggestion-diff-line suggestion-diff-line-deletion`,children:[(0,J.jsx)(`span`,{className:`suggestion-diff-sign`,children:`-`}),(0,J.jsx)(`span`,{className:`suggestion-diff-code`,children:t})]}),(0,J.jsxs)(`div`,{className:`suggestion-diff-line suggestion-diff-line-addition`,children:[(0,J.jsx)(`span`,{className:`suggestion-diff-sign`,children:`+`}),(0,J.jsx)(`span`,{className:`suggestion-diff-code`,children:r})]})]})]}):null})()]}),(0,J.jsxs)(`div`,{className:`comment-form-actions`,children:[l&&(0,J.jsxs)(`div`,{className:`comment-form-severity`,"data-severity":_,children:[(0,J.jsx)(`span`,{className:`comment-form-severity-label`,children:`Severity`}),(0,J.jsx)(LW,{value:_,onChange:v})]}),(0,J.jsxs)(`div`,{className:`comment-form-actions-right`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-secondary btn-sm`,onClick:c,children:`Cancel`}),(0,J.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,onClick:j,disabled:!h.trim(),children:e?`Save`:`Comment`})]})]}),(0,J.jsx)(PW,{open:C,title:`Save reply template`,description:`Give this reusable review response a short, recognizable name.`,label:`Template name`,initialValue:h.trim().slice(0,40),placeholder:`Example: Add regression coverage`,confirmLabel:`Save template`,maxLength:80,onConfirm:A,onCancel:()=>w(!1)})]})}var zW={none:{label:`None`,Icon:vO},blocking:{label:`Blocking`,Icon:xO},nit:{label:`Nit`,Icon:jD},question:{label:`Question`,Icon:ND},praise:{label:`Praise`,Icon:IO}};function BW({severity:e,className:t,title:n}){let r=zW[e]??zW.none,{Icon:i}=r;return(0,J.jsxs)(`span`,{className:`comment-sev-badge-soft${t?` ${t}`:``}`,"data-severity":e,title:n??`Severity: ${r.label}`,children:[(0,J.jsx)(i,{size:10,"aria-hidden":`true`}),r.label.toLowerCase()]})}function VW({open:e,title:t,description:n,closeLabel:r=`Close`,tone:i=`danger`,onClose:a}){let o=(0,q.useRef)(null);return(0,J.jsxs)(IH,{open:e,onClose:a,className:`confirm-dialog notice-dialog`,ariaLabel:t,role:`alertdialog`,initialFocus:o,children:[(0,J.jsxs)(`div`,{className:`confirm-dialog-header`,children:[(0,J.jsx)(`span`,{className:`confirm-dialog-icon confirm-dialog-icon-${i}`,"aria-hidden":`true`,children:(0,J.jsx)(kD,{size:18})}),(0,J.jsx)(`h2`,{className:`confirm-dialog-title`,children:t})]}),(0,J.jsx)(`p`,{className:`confirm-dialog-desc`,children:n}),(0,J.jsx)(`div`,{className:`confirm-dialog-footer`,children:(0,J.jsx)(`button`,{ref:o,type:`button`,className:`btn btn-sm confirm-dialog-confirm confirm-dialog-confirm-primary`,onClick:a,children:r})})]})}function HW({role:e,size:t=16}){return e===`agent`?(0,J.jsx)(`div`,{className:`comment-avatar-circle comment-avatar-agent comment-avatar-size-${t}`,children:(0,J.jsx)(SD,{size:t,"aria-hidden":`true`})}):(0,J.jsx)(`div`,{className:`comment-avatar-circle comment-avatar-user comment-avatar-size-${t}`,children:(0,J.jsx)(UO,{size:t,"aria-hidden":`true`})})}function UW({comment:e,onDelete:t}){let[,n]=(0,q.useState)(0),{resolveComment:r,unresolveComment:i,addReply:a,removeReply:o,editReply:s,applySuggestion:c,editComment:l}=TE(),u=e.status===`resolved`,[d,f]=(0,q.useState)(u),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(null),[x,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(null),T=(0,q.useRef)(null),E=e.body.replace(/```suggestion\n([\s\S]*?)```/g,``).trim().length>0,D=e.body.replace(/\s+/g,` `).trim().slice(0,72),O=e.replies?.length??0;(0,q.useEffect)(()=>{e.status===`resolved`&&f(!0)},[e.status]),(0,q.useEffect)(()=>{let e=setInterval(()=>n(e=>e+1),3e4);return()=>clearInterval(e)},[]);let k=()=>r(e.id),A=()=>i(e.id),j=e=>{b(e)},M=t=>{o(e.id,t)},N=(0,J.jsxs)(J.Fragment,{children:[e.lineNumber===0&&(0,J.jsx)(`span`,{className:`comment-file-chip`,children:`File`}),e.outdated&&(0,J.jsxs)(`span`,{className:`comment-outdated-badge`,title:`Anchored code no longer matches the live diff`,children:[(0,J.jsx)(BO,{size:10}),` outdated`]}),e.severity&&e.severity!==`none`&&(0,J.jsx)(BW,{severity:e.severity}),e.startLineNumber&&e.startLineNumber!==e.lineNumber&&(0,J.jsxs)(`span`,{className:`comment-range-chip`,children:[`L`,e.startLineNumber,`–`,e.lineNumber]}),e.lineNumber>0&&!(e.startLineNumber&&e.startLineNumber!==e.lineNumber)&&(0,J.jsxs)(`span`,{className:`comment-range-chip`,children:[`L`,e.lineNumber]})]});return d&&!h?(0,J.jsxs)(`div`,{className:`comment-collapsed-bar ${u?`comment-collapsed-bar-resolved`:``}`,id:`comment-${e.id}`,role:`article`,children:[(0,J.jsx)(`button`,{type:`button`,className:`comment-collapsed-toggle`,onClick:()=>f(!1),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f(!1))},"aria-expanded":!1,"aria-label":u?`Show resolved conversation`:`Expand comment thread`,title:`Expand`,children:(0,J.jsx)(DD,{size:14,"aria-hidden":`true`})}),(0,J.jsxs)(`div`,{className:`comment-collapsed-main`,children:[u?(0,J.jsx)(AD,{size:14,className:`comment-collapsed-resolved-icon`,"aria-hidden":`true`}):(0,J.jsx)(HW,{role:`user`,size:11}),(0,J.jsx)(`span`,{className:`comment-collapsed-label`,children:u?`Resolved`:`User`}),N,(0,J.jsxs)(`span`,{className:`comment-collapsed-preview`,title:e.body,children:[D,e.body.length>72?`…`:``]}),(0,J.jsx)(`span`,{className:`comment-collapsed-meta`,children:O>0?`${O+1} comments`:`1 comment`})]}),(0,J.jsx)(`button`,{type:`button`,className:`comment-collapsed-expand-btn`,onClick:()=>f(!1),"aria-label":u?`Show resolved conversation`:`Expand comment thread`,children:`Expand`})]}):h?(0,J.jsx)(`div`,{className:`comment-bubble-canvas`,id:`comment-${e.id}`,role:`article`,"aria-label":`Edit comment`,children:(0,J.jsxs)(`div`,{className:`comment-node`,children:[(0,J.jsx)(`div`,{className:`comment-avatar-col`,children:(0,J.jsx)(HW,{role:`user`,size:16})}),(0,J.jsxs)(`div`,{className:`comment-content-col`,children:[(0,J.jsxs)(`div`,{className:`comment-node-header`,children:[(0,J.jsx)(`span`,{className:`comment-node-author`,children:`User`}),(0,J.jsx)(`span`,{className:`comment-node-badge comment-node-badge-user`,children:`User`}),(0,J.jsxs)(`span`,{className:`comment-node-time comment-node-meta`,children:[FT(e.createdAt),e.lineNumber===0&&(0,J.jsx)(`span`,{className:`comment-file-chip`,children:`File Comment`}),e.outdated&&(0,J.jsxs)(`span`,{className:`comment-outdated-badge`,title:`Anchored code no longer matches the live diff`,children:[(0,J.jsx)(BO,{size:10}),` outdated`]}),e.severity&&e.severity!==`none`&&(0,J.jsx)(BW,{severity:e.severity}),e.startLineNumber&&e.startLineNumber!==e.lineNumber&&(0,J.jsxs)(`span`,{className:`comment-range-chip`,children:[`L`,e.startLineNumber,`–`,e.lineNumber]})]})]}),(0,J.jsx)(`div`,{className:`comment-edit-form-wrap`,children:(0,J.jsx)(RW,{draftKey:`edit:${e.id}`,initialBody:e.body,lineContent:e.lineContent,onSubmit:t=>{l(e.id,t),g(!1)},onCancel:()=>g(!1)})})]})]})}):(0,J.jsxs)(`div`,{className:`comment-bubble-canvas ${u?`comment-bubble-canvas-resolved`:``}`,id:`comment-${e.id}`,role:`article`,"aria-label":e.lineNumber===0?`File-level comment`:`Comment by user on line ${e.lineNumber}`,children:[(0,J.jsxs)(`div`,{className:`comment-node ${u?`comment-node-resolved`:``}`,children:[(0,J.jsx)(`div`,{className:`comment-avatar-col`,children:(0,J.jsx)(HW,{role:`user`,size:16})}),(0,J.jsxs)(`div`,{className:`comment-content-col`,children:[(0,J.jsxs)(`div`,{className:`comment-node-header`,children:[(0,J.jsx)(`button`,{type:`button`,className:`comment-collapse-btn`,onClick:()=>f(!0),"aria-expanded":!0,"aria-label":`Collapse comment thread`,title:`Collapse`,children:(0,J.jsx)(TD,{size:14,"aria-hidden":`true`})}),(0,J.jsx)(`span`,{className:`comment-node-author`,children:`User`}),(0,J.jsx)(`span`,{className:`comment-node-badge comment-node-badge-user`,children:`User`}),(0,J.jsxs)(`span`,{className:`comment-node-time comment-node-meta`,children:[FT(e.createdAt),e.lineNumber===0&&(0,J.jsx)(`span`,{className:`comment-file-chip`,children:`File Comment`}),e.startLineNumber&&e.startLineNumber!==e.lineNumber&&(0,J.jsxs)(`span`,{className:`comment-range-chip`,children:[`L`,e.startLineNumber,`–`,e.lineNumber]})]}),u&&(0,J.jsxs)(`span`,{className:`comment-canvas-resolved-banner comment-resolved-inline`,children:[(0,J.jsx)(AD,{size:13}),`Resolved`]}),!u&&(0,J.jsxs)(`div`,{className:`comment-node-actions`,children:[(0,J.jsx)(`button`,{ref:T,className:`comment-node-btn`,onClick:()=>g(!0),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),g(!0))},title:`Edit comment`,"aria-label":`Edit comment`,tabIndex:0,children:(0,J.jsx)(DO,{size:13,"aria-hidden":`true`})}),_?(0,J.jsxs)(`div`,{className:`comment-delete-confirm`,children:[(0,J.jsxs)(`button`,{className:`comment-node-btn comment-node-btn-delete comment-delete-confirm-yes`,onClick:()=>t(e.id),title:`Confirm delete`,"aria-label":`Confirm delete comment`,children:[(0,J.jsx)(BO,{size:11}),`Delete?`]}),(0,J.jsx)(`button`,{className:`comment-node-btn comment-delete-confirm-cancel`,onClick:()=>v(!1),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v(!1))},title:`Cancel delete`,"aria-label":`Cancel delete`,children:`Cancel`})]}):(0,J.jsx)(`button`,{className:`comment-node-btn comment-node-btn-delete`,onClick:()=>v(!0),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v(!0))},title:`Delete comment`,"aria-label":`Delete comment`,tabIndex:0,children:(0,J.jsx)(zO,{size:13,"aria-hidden":`true`})})]})]}),E&&(0,J.jsx)(QV,{content:e.body,className:`comment-node-body markdown-body ${u?`comment-resolved-line`:``}`}),(()=>{let t=e.body.match(/```suggestion\n([\s\S]*?)```/),n=!!t&&e.side===`additions`,r=t?t[1].trimEnd():``;return n?(0,J.jsxs)(`div`,{className:`suggestion-card comment-suggestion-card`,children:[(0,J.jsxs)(`div`,{className:`suggestion-header`,children:[(0,J.jsx)(`span`,{className:`suggestion-header-label`,children:`Suggested Change`}),u?(0,J.jsxs)(`span`,{className:`suggestion-applied`,children:[(0,J.jsx)(AD,{size:12}),` Applied`]}):(0,J.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,disabled:x,onClick:async()=>{S(!0);try{await c(e.id)}catch(e){w(e instanceof Error?e.message:`The suggestion could not be applied.`)}finally{S(!1)}},children:x?`Applying…`:`Apply Suggestion`})]}),(0,J.jsxs)(`div`,{className:`suggestion-diff`,children:[(0,J.jsxs)(`div`,{className:`suggestion-diff-line suggestion-diff-line-deletion`,children:[(0,J.jsx)(`span`,{className:`suggestion-diff-sign`,children:`-`}),(0,J.jsx)(`span`,{className:`suggestion-diff-code`,children:e.lineContent})]}),(0,J.jsxs)(`div`,{className:`suggestion-diff-line suggestion-diff-line-addition`,children:[(0,J.jsx)(`span`,{className:`suggestion-diff-sign`,children:`+`}),(0,J.jsx)(`span`,{className:`suggestion-diff-code`,children:r})]})]})]}):null})()]})]}),e.replies?.length>0&&(0,J.jsx)(`div`,{className:`comment-replies`,role:`list`,"aria-label":`Replies`,children:e.replies.map((t,n)=>{let r=t.role===`agent`,i=y===t.id;return(0,J.jsxs)(`div`,{className:`comment-node ${r?`comment-node-agent`:`comment-node-user`} ${u?`comment-node-resolved`:``}`,role:`listitem`,"aria-label":`${r?`Agent`:`User`} reply ${n+1}`,children:[(0,J.jsx)(`div`,{className:`comment-avatar-col`,children:(0,J.jsx)(HW,{role:r?`agent`:`user`,size:14})}),(0,J.jsxs)(`div`,{className:`comment-content-col`,children:[(0,J.jsxs)(`div`,{className:`comment-node-header`,children:[(0,J.jsx)(`span`,{className:`comment-node-author`,children:r?`Agent`:`User`}),(0,J.jsx)(`span`,{className:`comment-node-badge ${r?`comment-node-badge-agent`:`comment-node-badge-user`}`,children:r?`Agent`:`User`}),r&&t.model&&(0,J.jsx)(`span`,{className:`comment-model-chip`,children:t.model}),(0,J.jsx)(`span`,{className:`comment-node-time`,children:FT(t.createdAt)}),!u&&(0,J.jsxs)(`div`,{className:`comment-node-actions`,children:[(0,J.jsx)(`button`,{className:`comment-node-btn`,onClick:()=>j(t.id),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),j(t.id))},title:`Edit reply`,"aria-label":`Edit reply`,tabIndex:0,children:(0,J.jsx)(DO,{size:12,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{className:`comment-node-btn comment-node-btn-delete`,onClick:()=>M(t.id),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),M(t.id))},title:`Delete reply`,"aria-label":`Delete reply`,tabIndex:0,children:(0,J.jsx)(zO,{size:12,"aria-hidden":`true`})})]})]}),i?(0,J.jsx)(`div`,{className:`comment-reply-editor`,children:(0,J.jsx)(RW,{draftKey:`reply-edit:${e.id}:${t.id}`,initialBody:t.body,onSubmit:n=>{s(e.id,t.id,n),b(null)},onCancel:()=>b(null)})}):(0,J.jsx)(QV,{content:t.body,className:`comment-node-body markdown-body`})]})]},t.id)})}),(0,J.jsxs)(`div`,{className:`comment-canvas-footer`,children:[!p&&(e.severity&&e.severity!==`none`||e.outdated)&&(0,J.jsxs)(`div`,{className:`comment-canvas-footer-meta`,children:[e.severity&&e.severity!==`none`&&(0,J.jsx)(BW,{severity:e.severity}),e.outdated&&(0,J.jsxs)(`span`,{className:`comment-outdated-badge`,title:`Anchored code no longer matches the current diff`,children:[(0,J.jsx)(BO,{size:10,"aria-hidden":`true`}),`outdated`]})]}),!p&&(0,J.jsxs)(`div`,{className:`comment-canvas-footer-row`,children:[(0,J.jsxs)(`button`,{onClick:()=>m(!0),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),m(!0))},className:`comment-reply-trigger`,"aria-label":`Write a reply`,tabIndex:0,children:[(0,J.jsx)(AO,{size:14,"aria-hidden":`true`}),`Reply...`]}),u?(0,J.jsxs)(`div`,{className:`comment-canvas-footer-actions`,children:[(0,J.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:()=>f(!0),"aria-label":`Hide resolved conversation`,children:`Hide`}),(0,J.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:A,"aria-label":`Unresolve conversation`,children:`Unresolve`})]}):(0,J.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:k,"aria-label":`Resolve conversation`,children:`Resolve conversation`})]}),p&&(0,J.jsx)(`div`,{className:`comment-reply-composer`,children:(0,J.jsx)(RW,{draftKey:`reply:${e.id}`,onSubmit:t=>{a(e.id,t),m(!1)},onCancel:()=>{m(!1),T.current?.focus()}})})]}),(0,J.jsx)(VW,{open:C!==null,title:`Could not apply suggestion`,description:C??`The suggestion could not be applied.`,closeLabel:`Return to review`,onClose:()=>w(null)})]})}function WW({comment:e,lineContent:t,onReply:n,onEdit:r,onDelete:i,onSetResolved:a}){let[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(e.body),[b,x]=(0,q.useState)(!1),[S,C]=(0,q.useState)(!1);(0,q.useEffect)(()=>{g||y(e.body)},[e.body,g]);let w=e.state?{APPROVED:{icon:AD,label:`Approved`,cls:`badge-approved`},CHANGES_REQUESTED:{icon:BO,label:`Changes requested`,cls:`badge-changes`},COMMENTED:{icon:fO,label:`Commented`,cls:`badge-commented`},PENDING:{icon:fO,label:`Pending`,cls:`badge-pending`},DISMISSED:{icon:BO,label:`Dismissed`,cls:`badge-dismissed`}}[e.state]:null,T=GW(e.body),E=async()=>{let t=u.trim();if(!(!t||!n)){p(!0),h(null);try{await n(e.id,t),d(``),l(!1),s(!0)}catch(e){h(e?.message??`Failed to reply`)}finally{p(!1)}}},D=async e=>{x(!0),h(null);try{await e()}catch(e){throw h(e?.message??`GitHub update failed`),e}finally{x(!1)}},O=async()=>{let t=v.trim();if(!(!t||!r))try{await D(()=>r(e.id,t)),_(!1)}catch{}};return(0,J.jsxs)(`div`,{className:`pr-existing-bubble ${e.isResolved?`is-resolved`:``}`,children:[(0,J.jsxs)(`div`,{className:`pr-existing-bubble-head`,children:[e.author?(0,J.jsx)(`img`,{className:`pr-existing-avatar`,src:e.author.avatarUrl,alt:e.author.login}):(0,J.jsx)(`div`,{className:`pr-existing-avatar pr-existing-avatar-fallback`}),(0,J.jsxs)(`div`,{className:`pr-existing-bubble-meta`,children:[(0,J.jsxs)(`span`,{className:`pr-existing-bubble-author`,children:[`@`,e.author?.login??`unknown`]}),(0,J.jsx)(`span`,{className:`pr-existing-bubble-date`,children:new Date(e.createdAt).toLocaleString()})]}),(0,J.jsx)(`span`,{className:`pr-existing-bubble-source`,children:`from GitHub`}),e.line!=null&&(0,J.jsxs)(`span`,{className:`pr-existing-bubble-location`,children:[`L`,e.line,` · `,e.side===`LEFT`?`base`:`head`]}),w&&(0,J.jsxs)(`span`,{className:`pr-existing-bubble-badge ${w.cls}`,children:[(0,J.jsx)(w.icon,{size:11}),` `,w.label]}),e.isOutdated&&(0,J.jsxs)(`span`,{className:`pr-existing-bubble-badge badge-outdated`,children:[(0,J.jsx)(BO,{size:11}),` outdated`]}),e.isResolved&&(0,J.jsxs)(`span`,{className:`pr-existing-bubble-badge badge-approved`,children:[(0,J.jsx)(AD,{size:11}),` resolved`]}),(0,J.jsxs)(`span`,{className:`pr-existing-bubble-actions`,children:[e.threadId&&a&&(0,J.jsx)(`button`,{type:`button`,className:`file-diff-icon-btn`,disabled:b||(e.isResolved?e.viewerCanUnresolve===!1:e.viewerCanResolve===!1),onClick:()=>{D(()=>a(e.threadId,!e.isResolved)).catch(()=>void 0)},title:e.isResolved?`Reopen conversation on GitHub`:`Resolve conversation on GitHub`,"aria-label":e.isResolved?`Reopen conversation`:`Resolve conversation`,children:e.isResolved?(0,J.jsx)(jO,{size:12}):(0,J.jsx)(AD,{size:12})}),r&&e.viewerDidAuthor!==!1&&(0,J.jsx)(`button`,{type:`button`,className:`file-diff-icon-btn`,disabled:b,onClick:()=>_(!0),title:`Edit on GitHub`,"aria-label":`Edit GitHub comment`,children:(0,J.jsx)(DO,{size:12})}),i&&e.viewerDidAuthor!==!1&&(0,J.jsx)(`button`,{type:`button`,className:`file-diff-icon-btn danger`,disabled:b,onClick:()=>{h(null),C(!0)},title:`Delete from GitHub`,"aria-label":`Delete GitHub comment`,children:(0,J.jsx)(zO,{size:12})})]})]}),g?(0,J.jsxs)(`div`,{className:`pr-existing-edit-form`,children:[(0,J.jsx)(`textarea`,{value:v,onChange:e=>y(e.target.value),rows:3,"aria-label":`Edit GitHub comment body`}),(0,J.jsxs)(`div`,{className:`pr-existing-reply-form-actions`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:b,onClick:()=>{_(!1),y(e.body)},children:`Cancel`}),(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,disabled:b||!v.trim(),onClick:()=>{O()},children:b?`Saving…`:`Save on GitHub`})]})]}):(0,J.jsxs)(J.Fragment,{children:[T.remainingBody&&(0,J.jsx)(QV,{content:T.remainingBody,className:`pr-existing-bubble-body markdown-body`}),T.code!=null&&(0,J.jsxs)(`div`,{className:`pr-existing-suggestion`,"aria-label":`Suggested change preview`,children:[(0,J.jsxs)(`div`,{className:`pr-existing-suggestion-head`,children:[(0,J.jsx)(`span`,{children:`Suggested change`}),(0,J.jsx)(`span`,{className:`pr-existing-suggestion-preview-label`,children:`Preview`})]}),(0,J.jsxs)(`div`,{className:`pr-existing-suggestion-diff`,children:[t!=null&&t!==``&&(0,J.jsxs)(`div`,{className:`pr-existing-suggestion-line is-removed`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`−`}),(0,J.jsx)(`code`,{children:t})]}),(0,J.jsxs)(`div`,{className:`pr-existing-suggestion-line is-added`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`+`}),(0,J.jsx)(`code`,{children:T.code})]})]})]})]}),e.replies.length>0&&(0,J.jsxs)(`button`,{type:`button`,className:`pr-existing-bubble-toggle`,onClick:()=>s(e=>!e),children:[o?`Hide`:`Show`,` `,e.replies.length,` repl`,e.replies.length===1?`y`:`ies`]}),o&&e.replies.length>0&&(0,J.jsx)(`ul`,{className:`pr-existing-replies`,children:e.replies.map(e=>(0,J.jsx)(KW,{reply:e,onEdit:r,onDelete:i},e.id))}),n&&(0,J.jsx)(`div`,{className:`pr-existing-reply-actions`,children:c?(0,J.jsxs)(`div`,{className:`pr-existing-reply-form`,children:[(0,J.jsx)(`textarea`,{value:u,onChange:e=>d(e.target.value),rows:3,placeholder:`Reply to this thread on GitHub…`,"aria-label":`Reply body`}),m&&(0,J.jsx)(`p`,{className:`pr-existing-reply-error`,children:m}),(0,J.jsxs)(`div`,{className:`pr-existing-reply-form-actions`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>{l(!1),d(``),h(null)},disabled:f,children:`Cancel`}),(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:E,disabled:f||!u.trim(),children:f?`Sending…`:`Post reply`})]})]}):(0,J.jsxs)(`button`,{type:`button`,className:`btn btn-sm pr-existing-reply-btn`,onClick:()=>l(!0),children:[(0,J.jsx)(HD,{size:12}),`Reply on GitHub`]})}),m&&!c&&(0,J.jsx)(`p`,{className:`pr-existing-reply-error`,role:`alert`,children:m}),(0,J.jsx)(LH,{open:S,title:`Delete published GitHub comment?`,description:`This removes the comment from GitHub for everyone and cannot be undone.`,detail:e.body,confirmLabel:`Delete comment`,busyLabel:`Deleting…`,variant:`danger`,busy:b,error:m,onConfirm:async()=>{if(i)try{await D(()=>i(e.id)),C(!1)}catch{}},onCancel:()=>{C(!1),h(null)}})]})}function GW(e){let t=/```suggestion[^\r\n]*\r?\n([\s\S]*?)```/i.exec(e);return t?{remainingBody:e.replace(/```suggestion[^\r\n]*\r?\n[\s\S]*?```/gi,``).trim(),code:t[1].replace(/\r\n/g,`
2019
+ `).replace(/\n$/,``)}:{remainingBody:e,code:null}}function KW({reply:e,onEdit:t,onDelete:n}){let[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.body),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(!1);(0,q.useEffect)(()=>{r||o(e.body)},[e.body,r]);let p=async()=>{if(!(!t||!a.trim())){c(!0),u(null);try{await t(e.id,a.trim()),i(!1)}catch(e){u(e?.message??`Failed to edit reply`)}finally{c(!1)}}},m=async()=>{if(n){c(!0),u(null);try{await n(e.id),f(!1)}catch(e){u(e?.message??`Failed to delete reply`)}finally{c(!1)}}};return(0,J.jsxs)(`li`,{className:`pr-existing-reply`,children:[(0,J.jsxs)(`div`,{className:`pr-existing-bubble-meta`,children:[(0,J.jsxs)(`span`,{className:`pr-existing-bubble-author`,children:[`@`,e.author?.login??`unknown`]}),(0,J.jsx)(`span`,{className:`pr-existing-bubble-date`,children:new Date(e.createdAt).toLocaleString()}),(0,J.jsxs)(`span`,{className:`pr-existing-bubble-actions`,children:[t&&e.viewerDidAuthor!==!1&&(0,J.jsx)(`button`,{type:`button`,className:`file-diff-icon-btn`,disabled:s,onClick:()=>i(!0),"aria-label":`Edit GitHub reply`,children:(0,J.jsx)(DO,{size:11})}),n&&e.viewerDidAuthor!==!1&&(0,J.jsx)(`button`,{type:`button`,className:`file-diff-icon-btn danger`,disabled:s,onClick:()=>{u(null),f(!0)},"aria-label":`Delete GitHub reply`,children:(0,J.jsx)(zO,{size:11})})]})]}),r?(0,J.jsxs)(`div`,{className:`pr-existing-edit-form is-reply`,children:[(0,J.jsx)(`textarea`,{value:a,onChange:e=>o(e.target.value),rows:3,"aria-label":`Edit GitHub reply body`}),(0,J.jsxs)(`div`,{className:`pr-existing-reply-form-actions`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:s,onClick:()=>{i(!1),o(e.body)},children:`Cancel`}),(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,disabled:s||!a.trim(),onClick:()=>{p()},children:s?`Saving…`:`Save`})]})]}):(0,J.jsx)(`p`,{children:e.body}),l&&(0,J.jsx)(`p`,{className:`pr-existing-reply-error`,role:`alert`,children:l}),(0,J.jsx)(LH,{open:d,title:`Delete published GitHub reply?`,description:`This removes the reply from GitHub for everyone and cannot be undone.`,detail:e.body,confirmLabel:`Delete reply`,busyLabel:`Deleting…`,variant:`danger`,busy:s,error:l,onConfirm:m,onCancel:()=>{f(!1),u(null)}})]})}function qW(e){let t=e.hunks??[];if(t.length===0)return[];let n=t.map(e=>{let t=e.additionCount??e.additionLines??0,n=e.deletionCount??e.deletionLines??0;return Math.max(1,t+n)}),r=n.reduce((e,t)=>e+t,0)||1,i=0;return t.map((e,t)=>{let a=e.additionCount??e.additionLines??0,o=e.deletionCount??e.deletionLines??0,s=n[t]/r,c=i;i+=s;let l=`change`;a>0&&o===0?l=`add`:o>0&&a===0&&(l=`del`);let u=e.additionStart||0,d=e.deletionStart||0,f=u||d||1,p=u&&a>0?u+Math.max(0,a-1):d&&o>0?d+Math.max(0,o-1):f,m=p===f?`L${f}`:`L${f}–${p}`;return{start:c,height:s,kind:l,line:f,index:t+1,additions:a,deletions:o,rangeLabel:m}})}function JW(e){return e===`add`?`Added`:e===`del`?`Removed`:`Modified`}function YW(e){let t=[];return e.additions>0&&t.push(`+${e.additions}`),e.deletions>0&&t.push(`−${e.deletions}`),t.join(` `)||`empty`}function XW(e){return[`Hunk ${e.index}`,JW(e.kind),YW(e),e.rangeLabel,`Click to jump`].join(` · `)}var ZW=(0,q.memo)(function({fileDiff:e,filePath:t,onJump:n}){let r=(0,q.useMemo)(()=>qW(e),[e]),[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(null),c=(0,q.useMemo)(()=>{let e=0,t=0;for(let n of r)e+=n.additions,t+=n.deletions;return{additions:e,deletions:t,hunks:r.length}},[r]),l=(0,q.useCallback)(e=>{if(s(e.index),n){n(t,e.line);return}(document.getElementById(`file-${CSS.escape(t)}`)??document.querySelector(`[data-file-path="${CSS.escape(t)}"]`))?.scrollIntoView({behavior:`smooth`,block:`start`})},[t,n]);if(r.length===0)return null;let u=i==null?null:r.find(e=>e.index===i);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`diff-minimap-header`,role:`region`,"aria-label":`Change map for ${t}`,children:[(0,J.jsxs)(`div`,{className:`diff-minimap-meta`,children:[(0,J.jsxs)(`span`,{className:`diff-minimap-title`,children:[(0,J.jsx)(lO,{size:12,"aria-hidden":`true`}),`Change map`]}),(0,J.jsxs)(`span`,{className:`diff-minimap-summary`,children:[c.hunks,` hunk`,c.hunks===1?``:`s`,c.additions>0&&(0,J.jsxs)(`span`,{className:`diff-minimap-stat-add`,children:[` +`,c.additions]}),c.deletions>0&&(0,J.jsxs)(`span`,{className:`diff-minimap-stat-del`,children:[` −`,c.deletions]})]}),(0,J.jsx)(`span`,{className:`diff-minimap-hint`,children:`Hover the bar on the right · Click to jump`})]}),(0,J.jsxs)(`div`,{className:`diff-minimap-footer`,children:[(0,J.jsxs)(`div`,{className:`diff-minimap-legend`,"aria-hidden":`true`,children:[(0,J.jsxs)(`span`,{className:`diff-minimap-legend-item`,children:[(0,J.jsx)(`i`,{className:`diff-minimap-dot diff-minimap-dot-add`}),` Added`]}),(0,J.jsxs)(`span`,{className:`diff-minimap-legend-item`,children:[(0,J.jsx)(`i`,{className:`diff-minimap-dot diff-minimap-dot-del`}),` Removed`]}),(0,J.jsxs)(`span`,{className:`diff-minimap-legend-item`,children:[(0,J.jsx)(`i`,{className:`diff-minimap-dot diff-minimap-dot-change`}),` Modified`]})]}),u?(0,J.jsxs)(`div`,{className:`diff-minimap-live`,"aria-live":`polite`,children:[(0,J.jsxs)(`strong`,{children:[`#`,u.index]}),(0,J.jsx)(`span`,{children:JW(u.kind)}),(0,J.jsx)(`span`,{className:`diff-minimap-live-stats`,children:YW(u)}),(0,J.jsx)(`span`,{className:`diff-minimap-live-range`,children:u.rangeLabel})]}):(0,J.jsx)(`div`,{className:`diff-minimap-live diff-minimap-live-idle`,children:`Hover a block for details`})]})]}),(0,J.jsx)(`div`,{className:`diff-minimap`,role:`navigation`,"aria-label":`Jump to changes in ${t}`,children:(0,J.jsx)(`div`,{className:`diff-minimap-track`,role:`list`,children:r.map(e=>{let t=i===e.index||o===e.index;return(0,J.jsx)(Qw,{content:XW(e),side:`left`,children:(0,J.jsx)(`button`,{type:`button`,role:`listitem`,className:[`diff-minimap-seg`,`diff-minimap-seg-${e.kind}`,t?`diff-minimap-seg-hot`:``,o===e.index?`diff-minimap-seg-active`:``].filter(Boolean).join(` `),style:{top:`${e.start*100}%`,height:`${Math.max(e.height*100,3)}%`},onClick:t=>{t.stopPropagation(),l(e)},onMouseEnter:()=>a(e.index),onMouseLeave:()=>a(null),onFocus:()=>a(e.index),onBlur:()=>a(null),"aria-label":XW(e)})},e.index)})})})]})});function QW(e){return e.endSide??e.side??`additions`}function $W(e){return e.side??e.endSide??`additions`}function eG(e){if(e.startSide&&e.startSide!==e.side){if(e.startLineNumber==null||e.startLineNumber===e.lineNumber){let{startLineNumber:t,startSide:n,...r}=e;return r}return e}let t=e.startLineNumber==null?e.lineNumber:Math.min(e.startLineNumber,e.lineNumber),n=e.startLineNumber==null?e.lineNumber:Math.max(e.startLineNumber,e.lineNumber);return t===n?{side:e.side,lineNumber:n}:{side:e.side,lineNumber:n,startLineNumber:t}}function tG(e){let t=$W(e),n=QW(e);if(t===n){let t=Math.min(e.start,e.end),r=Math.max(e.start,e.end);return eG({side:n,lineNumber:r,startLineNumber:t===r?void 0:t})}return{side:n,lineNumber:e.end,startLineNumber:e.start===e.end?void 0:e.start,startSide:t}}function nG(e){return e.side===`deletions`?`old`:`new`}function rG(e){let t=nG(e);return e.startLineNumber!=null&&e.startLineNumber!==e.lineNumber?`L${Math.min(e.startLineNumber,e.lineNumber)}–L${Math.max(e.startLineNumber,e.lineNumber)} · ${t}`:`L${e.lineNumber} · ${t}`}function iG(e){return e.startSide&&e.startSide!==e.side?{start:e.startLineNumber??e.lineNumber,end:e.lineNumber}:{start:e.startLineNumber==null?e.lineNumber:Math.min(e.startLineNumber,e.lineNumber),end:e.startLineNumber==null?e.lineNumber:Math.max(e.startLineNumber,e.lineNumber)}}function aG(e){return e.startLineNumber!=null&&e.startLineNumber!==e.lineNumber?{start:e.startLineNumber,end:e.lineNumber,side:e.startSide??e.side,...e.startSide&&e.startSide!==e.side?{endSide:e.side}:{}}:{start:e.lineNumber,end:e.lineNumber,side:e.side}}function oG(e,t,n){if(e.startSide&&e.startSide!==e.side)return e;if(!Number.isFinite(t)||t===0)return eG(e);let{start:r,end:i}=iG(e),a=r+t;return n&&(a=Math.max(n.min,Math.min(n.max,a))),a=Math.min(a,i),eG({side:e.side,lineNumber:i,startLineNumber:a})}function sG(e,t,n){if(e.startSide&&e.startSide!==e.side)return e;if(!Number.isFinite(t)||t===0)return eG(e);let{start:r,end:i}=iG(e),a=i+t;return n&&(a=Math.max(n.min,Math.min(n.max,a))),a=Math.max(a,r),eG({side:e.side,lineNumber:a,startLineNumber:r})}function cG(e,t,n){if(e.startSide&&e.startSide!==e.side)return!1;let r=oG(e,t,n);return r.startLineNumber!==e.startLineNumber||r.lineNumber!==e.lineNumber}function lG(e,t,n){if(e.startSide&&e.startSide!==e.side)return!1;let r=sG(e,t,n);return r.startLineNumber!==e.startLineNumber||r.lineNumber!==e.lineNumber}function uG(e,t){if(t.isOutdated||t.line==null||t.line<1||t.side==null)return!1;let n=t.side===`LEFT`?`deletions`:`additions`,r=n===`additions`?`additionStart`:`deletionStart`,i=n===`additions`?`additionCount`:`deletionCount`;return e.hunks.some(e=>t.line>=e[r]&&t.line<e[r]+e[i])}function dG(e,t,n){let r=t===`additions`?`additionStart`:`deletionStart`,i=t===`additions`?`additionCount`:`deletionCount`,a=1/0,o=0;for(let t of e.hunks){let e=t[r],n=t[i];n<=0||(a=Math.min(a,e),o=Math.max(o,e+n-1))}return n&&n>0&&(a=Math.min(a===1/0?1:a,1),o=Math.max(o,n)),!Number.isFinite(a)||o<1?{min:1,max:Math.max(1,n??1)}:{min:a,max:o}}function fG(e){return e.filter(e=>e.lineNumber>0&&TW(e.side))}var pG=(0,q.memo)(function({id:e,fileDiff:t,filePath:n,annotations:r,existingComments:i=[],diffStyle:a,tabSize:o,viewed:s,theme:c,editorIDE:l,lineDiffType:u,lineWrap:d,diffIndicators:f,showLineNumbers:p,hunkSeparators:m,lineHoverHighlight:h,fontSize:g,monoFontFamily:_,expandContextByDefault:v,collapsedContextThreshold:y,expansionLineCount:b,autoCollapseLineThreshold:x,onViewedChange:S,onAddComment:C,onDeleteComment:w,onReplyExisting:T,onEditExisting:E,onDeleteExisting:D,onSetExistingResolved:O,allowLocalActions:k=!0,onCardToggleCollapse:A}){let[j,M]=(0,q.useState)(null),[N,P]=(0,q.useState)(null),[F,I]=(0,q.useState)(0),L=(0,q.useRef)(null),[R,z]=(0,q.useState)(null),[B,V]=(0,q.useState)(!1),H=t.additionLines.length+t.deletionLines.length,[U,W]=(0,q.useState)(s||x>0&&H>x),[ee,te]=(0,q.useState)(!1),[ne,re]=(0,q.useState)(!1),[ie,ae]=(0,q.useState)(v),[oe,G]=(0,q.useState)(null),[se,K]=(0,q.useState)(null),[ce,le]=(0,q.useState)(null),ue=(0,q.useRef)(null),[de,fe]=(0,q.useState)(!1),pe=e=>{e.stopPropagation(),!(typeof navigator>`u`||!navigator.clipboard)&&navigator.clipboard.writeText(n).then(()=>{V(!0),window.setTimeout(()=>V(!1),1500)},()=>{})},me=async e=>{if(oe===null){G(e),K(null);try{let t=await fetch(`/api/revert-hunk`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:n,hunkIndex:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`HTTP ${t.status}`)}}catch(e){K(e.message)}finally{G(null)}}},he=t.type===`change`||t.type===`rename-changed`,ge=!U&&he,_e=t.prevName??n,{loading:ve,oldContent:ye,newContent:be}=wW(n,ie&&ge,_e),xe=ie&&ye!==null&&be!==null;(0,q.useLayoutEffect)(()=>{W(s)},[s]),(0,q.useEffect)(()=>{if(de||U)return;let e=ue.current;if(!e||typeof IntersectionObserver>`u`){fe(!0);return}let t=e.getBoundingClientRect();if(t.bottom>=-800&&t.top<=(typeof window<`u`?window.innerHeight+800:2e3)){fe(!0);return}let n=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(fe(!0),n.disconnect())},{root:null,rootMargin:`800px 0px`,threshold:0});return n.observe(e),()=>n.disconnect()},[U,de]);let Se=LT[c]||LT[`rose-pine`],Ce=(0,q.useMemo)(()=>hG(o,g,_),[o,g,_]),we=(e,n,r)=>{let i=r??n,a=n,o=Math.min(i,a),s=Math.max(i,a),c=[],l=xe?(e===`additions`?be:ye)?.replace(/\r\n/g,`
2020
2020
  `).split(`
2021
2021
  `):void 0;for(let n=o;n<=s;n++){let r=e===`additions`?t.additionLines:t.deletionLines,i=e===`additions`?`additionStart`:`deletionStart`,a=e===`additions`?`additionCount`:`deletionCount`,o=e===`additions`?`additionLineIndex`:`deletionLineIndex`,s=!1;for(let e of t.hunks){let t=e[i],l=e[a];if(n>=t&&n<t+l){let i=e[o]+(n-t);c.push(r[i]??``),s=!0;break}}s||c.push(l?.[n-1]??``)}return c.join(`
2022
- `)},Te=(0,q.useCallback)(e=>{let t=QW(e);L.current||=crypto.randomUUID(),M(t),P(rG(t)),I(0)},[]),Ee=(0,q.useCallback)(()=>{M(null),P(null),I(0),L.current=null},[]),De=(0,q.useMemo)(()=>{if(!j)return;let e=xe&&j.side===`additions`?(be??``).split(`
2022
+ `)},Te=(0,q.useCallback)(e=>{let t=eG(e);L.current||=crypto.randomUUID(),M(t),P(aG(t)),I(0)},[]),Ee=(0,q.useCallback)(()=>{M(null),P(null),I(0),L.current=null},[]),De=(0,q.useMemo)(()=>{if(!j)return;let e=xe&&j.side===`additions`?(be??``).split(`
2023
2023
  `).length:xe&&j.side===`deletions`?(ye??``).split(`
2024
- `).length:void 0;return lG(t,j.side,e)},[j,t,xe,be,ye]),Oe=(0,q.useCallback)(e=>{let t=QW(e);M(t),P(rG(t))},[]);(0,q.useEffect)(()=>{if(!j)return;let e=window.requestAnimationFrame(()=>{let e=ue.current?.querySelector(`.comment-form, [data-annotation-slot]`);e instanceof HTMLElement&&e.scrollIntoView({block:`nearest`,behavior:`smooth`})});return()=>cancelAnimationFrame(e)},[j?.side,j?.lineNumber]);let ke=async e=>{if(e.stopPropagation(),t.type!==`deleted`){te(!0);try{await fetch(`/api/open-file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:n,editor:l})})}catch(e){console.error(`Failed to open file in IDE editor:`,e)}finally{te(!1)}}},Ae=()=>{switch(t.type){case`new`:return(0,J.jsx)(`span`,{className:`diff-status-badge diff-status-new`,children:`Added`});case`deleted`:return(0,J.jsx)(`span`,{className:`diff-status-badge diff-status-deleted`,children:`Deleted`});case`rename-pure`:case`rename-changed`:return(0,J.jsx)(`span`,{className:`diff-status-badge diff-status-renamed`,children:`Renamed`});default:return(0,J.jsx)(`span`,{className:`diff-status-badge diff-status-modified`,children:`Modified`})}},je=r.filter(e=>e.lineNumber===0),Me=uG(r),Ne=i.filter(e=>cG(t,e)).map(e=>({side:e.side===`LEFT`?`deletions`:`additions`,lineNumber:e.line,metadata:{_existingPr:!0,comment:e}})),Pe=i.filter(e=>!cG(t,e)),Fe=e=>{if(`_pending`in e.metadata){if(!j)return null;let e=L.current??`open`,t=`new:${n}:${j.side}:${e}`,r=we(j.side,j.lineNumber,j.startLineNumber),i=nG(j),a=De;return(0,J.jsx)(RW,{draftKey:t,lineContent:r,lineLabel:tG(j),range:{start:i.start,end:i.end,sideLabel:eG(j),canAdjustStart:e=>oG(j,e,a),canAdjustEnd:e=>sG(j,e,a)},onAdjustStart:e=>{Oe(iG(j,e,a))},onAdjustEnd:e=>{Oe(aG(j,e,a))},onSubmit:(e,t)=>{let r=we(j.side,j.lineNumber,j.startLineNumber);C(n,j.side,j.lineNumber,r,e,j.startLineNumber,t),Ee()},onCancel:Ee})}return`_existingPr`in e.metadata?(0,J.jsx)(HW,{comment:e.metadata.comment,lineContent:we(e.side,e.lineNumber,e.metadata.comment.startLine??void 0),onReply:T,onEdit:E,onDelete:D,onSetResolved:O}):(0,J.jsx)(VW,{comment:e.metadata,onDelete:w})},Ie=(0,q.useCallback)(()=>{I(0),M(null),P(null),L.current=null},[]),Le=(0,q.useCallback)(e=>{I(e?Math.abs(e.end-e.start)+1:0)},[]),Re=(0,q.useCallback)(e=>{I(0),e&&Te($W(e))},[Te]),ze=(0,q.useCallback)(e=>{Te($W(e))},[Te]),Be=[...Me,...Ne,...j?[{side:j.side,lineNumber:j.lineNumber,metadata:{_pending:!0}}]:[]];return(0,J.jsxs)(`div`,{ref:ue,className:`file-diff-card ${s?`file-diff-viewed`:``} ${U?`file-diff-collapsed`:``}`,id:e,"data-file-path":n,children:[(0,J.jsxs)(`div`,{className:`file-diff-card-header`,onClick:()=>{let e=!U;W(e),A?.(n,e)},children:[(0,J.jsxs)(`div`,{className:`file-diff-header-left`,children:[(0,J.jsx)(`span`,{className:`file-diff-collapse-indicator`,"aria-hidden":`true`,children:U?(0,J.jsx)(DD,{size:14}):(0,J.jsx)(TD,{size:14})}),(0,J.jsxs)(`div`,{className:`file-diff-title-row`,children:[(0,J.jsx)(`span`,{className:`file-diff-name`,title:n,children:n}),(0,J.jsx)(`button`,{className:`file-diff-copy-path-btn`,onClick:pe,title:`Copy file path to clipboard`,"aria-label":`Copy file path to clipboard`,children:B?(0,J.jsx)(wD,{size:12}):(0,J.jsx)(VD,{size:12})}),Ae(),Me.length+Ne.length>0&&(0,J.jsxs)(`span`,{className:`file-diff-comment-badge`,title:`${Me.length+Ne.length} inline comment${Me.length+Ne.length===1?``:`s`}`,children:[(0,J.jsx)(hO,{size:10}),Me.length+Ne.length]}),F>0&&(0,J.jsxs)(`span`,{className:`file-diff-selection-badge`,"aria-live":`polite`,children:[F,` line`,F===1?``:`s`,` selected`]}),B&&(0,J.jsx)(`span`,{className:`file-diff-permalink-flash`,role:`status`,children:`Copied path`}),R&&(0,J.jsxs)(`span`,{className:`file-diff-permalink-flash`,role:`status`,children:[`Copied `,R]})]})]}),(0,J.jsxs)(`div`,{className:`file-diff-header-right`,onClick:e=>e.stopPropagation(),children:[ge&&(0,J.jsx)(Qw,{content:ie?`Hide unchanged context`:`Expand full-file context`,side:`bottom`,children:(0,J.jsx)(`button`,{className:`file-diff-icon-btn ${ie?`is-active`:``}`,onClick:()=>ae(e=>!e),disabled:ve,"aria-label":ve?`Loading context`:ie?`Hide context`:`Expand context`,children:ve?(0,J.jsx)(cO,{size:13,className:`spin`}):(0,J.jsx)(uO,{size:13})})}),k&&t.type!==`deleted`&&(0,J.jsx)(Qw,{content:`Open in editor`,side:`bottom`,children:(0,J.jsx)(`button`,{className:`file-diff-icon-btn`,onClick:ke,disabled:ee,"aria-label":ee?`Opening file`:`Edit file`,children:ee?(0,J.jsx)(cO,{size:13,className:`spin`}):(0,J.jsx)(TO,{size:13})})}),(0,J.jsx)(Qw,{content:`Comment on entire file`,side:`bottom`,children:(0,J.jsx)(`button`,{className:`file-diff-icon-btn`,onClick:()=>{W(!1),re(!0)},"aria-label":`Add file comment`,children:(0,J.jsx)(hO,{size:13})})}),(0,J.jsxs)(`label`,{className:`viewed-label ${s?`viewed-checked`:``}`,title:s?`Mark unviewed · v`:`Mark viewed · v`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:s,"aria-label":s?`Mark as unviewed`:`Mark as viewed`,onChange:e=>{let t=e.target.checked;W(t),S(n,t)}}),(0,J.jsx)(`span`,{className:`viewed-label-text`,children:`Viewed`})]})]})]}),k&&!U&&t.hunks.length>0&&(0,J.jsxs)(`div`,{className:`file-diff-hunk-actions`,onClick:e=>e.stopPropagation(),children:[(0,J.jsxs)(`div`,{className:`file-diff-hunk-actions-meta`,children:[(0,J.jsx)(`span`,{className:`file-diff-hunk-actions-label`,children:`Revert hunks`}),(0,J.jsx)(Qw,{content:`Preview and undo specific change blocks via git apply --reverse`,side:`top`,children:(0,J.jsx)(ND,{size:12,className:`file-diff-hunk-help`})}),(0,J.jsxs)(`span`,{className:`file-diff-hunk-count`,children:[t.hunks.length,` block`,t.hunks.length===1?``:`s`]})]}),(0,J.jsx)(`div`,{className:`file-diff-hunk-actions-buttons`,children:t.hunks.map((e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:`file-diff-hunk-revert-btn`,onClick:()=>le(t),disabled:oe!==null,title:`Preview and revert hunk #${t+1} (lines @${e.additionStart}+${e.additionLines??e.additionCount})`,children:[oe===t?(0,J.jsx)(cO,{size:10,className:`spin`}):(0,J.jsx)(HO,{size:10}),(0,J.jsxs)(`span`,{children:[`Hunk #`,t+1]})]},t))}),se&&(0,J.jsxs)(`span`,{className:`file-diff-hunk-error`,role:`alert`,children:[(0,J.jsx)(kD,{size:11}),se]})]}),k&&ce!==null&&(()=>{let e=t.hunks[ce];if(!e)return null;let r=t.deletionLines.slice(e.deletionLineIndex,e.deletionLineIndex+(e.deletionCount??e.deletionLines??0)),i=t.additionLines.slice(e.additionLineIndex,e.additionLineIndex+(e.additionStart!==void 0&&e.additionLines!==void 0?e.additionLines:e.additionCount??0));return(0,J.jsxs)(IH,{open:ce!==null,onClose:()=>le(null),className:`hunk-revert-modal`,ariaLabel:`Selective Revert Preview Hunk #${ce+1}`,children:[(0,J.jsxs)(`div`,{className:`shortcuts-header`,children:[(0,J.jsxs)(`div`,{className:`shortcuts-header-title`,children:[(0,J.jsx)(HO,{size:18,className:`shortcuts-icon`}),(0,J.jsxs)(`h2`,{children:[`Revert Hunk #`,ce+1]})]}),(0,J.jsx)(`button`,{className:`shortcuts-close-btn`,onClick:()=>le(null),"aria-label":`Close dialog`,children:(0,J.jsx)(WO,{size:16})})]}),(0,J.jsxs)(`div`,{className:`shortcuts-body`,children:[(0,J.jsxs)(`div`,{className:`hunk-preview-intro`,children:[`Reverting this hunk will restore the deleted (`,(0,J.jsx)(`span`,{className:`hunk-preview-negative`,children:`red`}),`) lines and remove the added (`,(0,J.jsx)(`span`,{className:`hunk-preview-positive`,children:`green`}),`) lines from`,` `,(0,J.jsx)(`strong`,{children:n.split(`/`).pop()}),`.`]}),(0,J.jsxs)(`div`,{className:`hunk-preview-container`,children:[(0,J.jsxs)(`div`,{className:`hunk-preview-header`,children:[(0,J.jsx)(`span`,{children:n}),(0,J.jsxs)(`span`,{children:[`Lines: @-`,e.deletionStart,`,`,e.deletionCount??e.deletionLines??0,` @+`,e.additionStart,`,`,e.additionLines??e.additionCount??0]})]}),(0,J.jsxs)(`div`,{className:`hunk-preview-code`,children:[r.map((e,t)=>(0,J.jsxs)(`div`,{className:`hunk-preview-line hunk-preview-line-deletion`,children:[(0,J.jsx)(`span`,{className:`hunk-preview-sign`,children:`-`}),(0,J.jsx)(`span`,{className:`hunk-preview-text`,children:e})]},`del-${t}`)),i.map((e,t)=>(0,J.jsxs)(`div`,{className:`hunk-preview-line hunk-preview-line-addition`,children:[(0,J.jsx)(`span`,{className:`hunk-preview-sign`,children:`+`}),(0,J.jsx)(`span`,{className:`hunk-preview-text`,children:e})]},`add-${t}`)),r.length===0&&i.length===0&&(0,J.jsx)(`div`,{className:`hunk-preview-line hunk-preview-empty`,children:`No changes in this hunk.`})]})]}),(0,J.jsx)(fG,{filePath:n,deletionStart:e.deletionStart,deletionCount:e.deletionCount??e.deletionLines??0})]}),(0,J.jsxs)(`div`,{className:`modal-footer`,children:[(0,J.jsx)(`button`,{className:`hunk-revert-btn-secondary`,onClick:()=>le(null),children:`Cancel`}),(0,J.jsx)(`button`,{className:`hunk-revert-btn-primary`,onClick:async()=>{let e=ce;le(null),await me(e)},children:`Revert Changes`})]})]})})(),!U&&(0,J.jsxs)(`div`,{className:`file-diff-card-body`,children:[!de&&(0,J.jsx)(`div`,{className:`file-diff-body-placeholder`,"aria-hidden":`true`,children:`Loading diff…`}),de&&t.hunks.length>0&&(0,J.jsx)(YW,{fileDiff:t,filePath:n,onJump:(e,t)=>{VT(e,t,`additions`)}}),de&&(je.length>0||Pe.length>0||ne)&&(0,J.jsxs)(`div`,{className:`file-level-comments-section`,children:[(0,J.jsxs)(`div`,{className:`file-level-comments-header`,children:[(0,J.jsx)(hO,{size:14}),(0,J.jsxs)(`span`,{children:[`File-Level Comments (`,je.length+Pe.length,`)`]})]}),je.length>0&&(0,J.jsx)(`div`,{className:`file-level-comments-list`,children:je.map(e=>(0,J.jsx)(VW,{comment:e.metadata,onDelete:w},e.metadata.id))}),Pe.map(e=>(0,J.jsx)(HW,{comment:e,onReply:T,onEdit:E,onDelete:D,onSetResolved:O},`github-${e.id}`)),ne&&(0,J.jsx)(`div`,{className:`file-level-comment-form`,children:(0,J.jsx)(RW,{draftKey:`file-comment:${n}`,lineContent:``,onSubmit:(e,t)=>{C(n,`additions`,0,``,e,void 0,t),re(!1)},onCancel:()=>re(!1)})})]}),de&&xe?(0,J.jsx)(Jh,{oldFile:{name:_e,contents:ye??``},newFile:{name:n,contents:be??``},options:{diffStyle:a,enableGutterUtility:!0,enableLineSelection:!0,disableFileHeader:!0,lineDiffType:u,overflow:d?`wrap`:`scroll`,diffIndicators:f,disableLineNumbers:!p,hunkSeparators:m,lineHoverHighlight:h,expandUnchanged:!1,collapsedContextThreshold:y,expansionLineCount:b,onLineSelectionStart:Ie,onLineSelectionChange:Le,onLineSelectionEnd:Re,onGutterUtilityClick:ze,onLineNumberClick:e=>{let t=e.annotationSide===`deletions`?`deletions`:`additions`,r=`${n}:${t===`deletions`?`-`:`+`}${e.lineNumber}`,i=new URLSearchParams({file:n,line:String(e.lineNumber),side:t}),a=typeof window<`u`?`${window.location.origin}${window.location.pathname}?${i}`:r;navigator.clipboard?.writeText(a).then(()=>{z(r),setTimeout(()=>z(null),1600)},()=>{})},theme:{dark:Se.type===`dark`?Se.themeName:`rose-pine`,light:Se.type===`light`?Se.themeName:`github-light`},themeType:Se.type,unsafeCSS:Ce},selectedLines:j?N:void 0,lineAnnotations:Be,renderHeaderMetadata:()=>null,renderAnnotation:Fe}):de?(0,J.jsx)(qh,{fileDiff:t,options:{diffStyle:a,enableGutterUtility:!0,enableLineSelection:!0,disableFileHeader:!0,lineDiffType:u,overflow:d?`wrap`:`scroll`,diffIndicators:f,disableLineNumbers:!p,hunkSeparators:m,lineHoverHighlight:h,onLineSelectionStart:Ie,onLineSelectionChange:Le,onLineSelectionEnd:Re,onGutterUtilityClick:ze,onLineNumberClick:e=>{let t=e.annotationSide===`deletions`?`deletions`:`additions`,r=`${n}:${t===`deletions`?`-`:`+`}${e.lineNumber}`,i=new URLSearchParams({file:n,line:String(e.lineNumber),side:t}),a=typeof window<`u`?`${window.location.origin}${window.location.pathname}?${i}`:r;navigator.clipboard?.writeText(a).then(()=>{z(r),setTimeout(()=>z(null),1600)},()=>{})},theme:{dark:Se.type===`dark`?Se.themeName:`rose-pine`,light:Se.type===`light`?Se.themeName:`github-light`},themeType:Se.type,unsafeCSS:Ce},selectedLines:j?N:void 0,lineAnnotations:Be,renderHeaderMetadata:()=>null,renderAnnotation:Fe}):null]})]})});function fG({filePath:e,deletionStart:t,deletionCount:n}){let[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(null);if((0,q.useEffect)(()=>{let r=!0;return(async()=>{o(!0),c(null);try{let a=new URLSearchParams({filePath:e,deletionStart:String(t),deletionCount:String(n)}),o=await fetch(`/api/hunk-history?${a}`);if(!o.ok)throw Error(`HTTP ${o.status}`);let s=await o.json();r&&i(s)}catch(e){r&&c(e.message||`Failed to fetch hunk history`)}finally{r&&o(!1)}})(),()=>{r=!1}},[e,t,n]),a)return(0,J.jsxs)(`div`,{className:`hunk-history-loading`,children:[(0,J.jsx)(cO,{size:14,className:`spin hunk-history-status-icon`}),(0,J.jsx)(`span`,{children:`Loading git history & origin blame…`})]});if(s)return(0,J.jsxs)(`div`,{className:`hunk-history-error`,children:[(0,J.jsx)(kD,{size:14,className:`hunk-history-status-icon hunk-history-error-icon`}),(0,J.jsxs)(`span`,{children:[`Failed to load git history: `,s]})]});if(!r)return null;let l=Array.from(new Map(r.blame.map(e=>[e.commit,e])).values());return(0,J.jsxs)(`div`,{className:`hunk-history-section`,children:[l.length>0&&(0,J.jsxs)(`div`,{className:`hunk-history-block`,children:[(0,J.jsx)(`h3`,{className:`hunk-history-title`,children:`Commit(s) introducing deleted lines`}),(0,J.jsx)(`div`,{className:`hunk-history-commits`,children:l.map(e=>(0,J.jsxs)(`div`,{className:`hunk-history-commit-card`,children:[(0,J.jsxs)(`div`,{className:`hunk-history-commit-header`,children:[(0,J.jsx)(`span`,{className:`hunk-history-commit-hash`,children:e.commit}),(0,J.jsxs)(`span`,{className:`hunk-history-commit-author`,children:[(0,J.jsx)(UO,{size:11}),(0,J.jsx)(`span`,{children:e.author})]}),(0,J.jsxs)(`span`,{className:`hunk-history-commit-date`,children:[(0,J.jsx)(RD,{size:11}),(0,J.jsx)(`span`,{children:e.date})]})]}),(0,J.jsx)(`div`,{className:`hunk-history-commit-msg`,children:e.summary})]},e.commit))})]}),r.recentCommits.length>0&&(0,J.jsxs)(`div`,{className:`hunk-history-block`,children:[(0,J.jsx)(`h3`,{className:`hunk-history-title`,children:`Recent File Modification History`}),(0,J.jsx)(`div`,{className:`hunk-history-log`,children:r.recentCommits.map(e=>(0,J.jsxs)(`div`,{className:`hunk-history-log-row`,children:[(0,J.jsx)(`span`,{className:`hunk-history-log-hash`,children:e.hash}),(0,J.jsx)(`span`,{className:`hunk-history-log-msg`,title:e.summary,children:e.summary}),(0,J.jsx)(`span`,{className:`hunk-history-log-author`,children:e.author}),(0,J.jsx)(`span`,{className:`hunk-history-log-date`,children:e.date})]},e.hash))})]})]})}function pG(e,t,n){return`
2024
+ `).length:void 0;return dG(t,j.side,e)},[j,t,xe,be,ye]),Oe=(0,q.useCallback)(e=>{let t=eG(e);M(t),P(aG(t))},[]);(0,q.useEffect)(()=>{if(!j)return;let e=window.requestAnimationFrame(()=>{let e=ue.current?.querySelector(`.comment-form, [data-annotation-slot]`);e instanceof HTMLElement&&e.scrollIntoView({block:`nearest`,behavior:`smooth`})});return()=>cancelAnimationFrame(e)},[j?.side,j?.lineNumber]);let ke=async e=>{if(e.stopPropagation(),t.type!==`deleted`){te(!0);try{await fetch(`/api/open-file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:n,editor:l})})}catch(e){console.error(`Failed to open file in IDE editor:`,e)}finally{te(!1)}}},Ae=()=>{switch(t.type){case`new`:return(0,J.jsx)(`span`,{className:`diff-status-badge diff-status-new`,children:`Added`});case`deleted`:return(0,J.jsx)(`span`,{className:`diff-status-badge diff-status-deleted`,children:`Deleted`});case`rename-pure`:case`rename-changed`:return(0,J.jsx)(`span`,{className:`diff-status-badge diff-status-renamed`,children:`Renamed`});default:return(0,J.jsx)(`span`,{className:`diff-status-badge diff-status-modified`,children:`Modified`})}},je=r.filter(e=>e.lineNumber===0),Me=fG(r),Ne=i.filter(e=>uG(t,e)).map(e=>({side:e.side===`LEFT`?`deletions`:`additions`,lineNumber:e.line,metadata:{_existingPr:!0,comment:e}})),Pe=i.filter(e=>!uG(t,e)),Fe=e=>{if(`_pending`in e.metadata){if(!j)return null;let e=L.current??`open`,t=`new:${n}:${j.side}:${e}`,r=we(j.side,j.lineNumber,j.startLineNumber),i=iG(j),a=De;return(0,J.jsx)(RW,{draftKey:t,lineContent:r,lineLabel:rG(j),range:{start:i.start,end:i.end,sideLabel:nG(j),canAdjustStart:e=>cG(j,e,a),canAdjustEnd:e=>lG(j,e,a)},onAdjustStart:e=>{Oe(oG(j,e,a))},onAdjustEnd:e=>{Oe(sG(j,e,a))},onSubmit:(e,t)=>{let r=we(j.side,j.lineNumber,j.startLineNumber);C(n,j.side,j.lineNumber,r,e,j.startLineNumber,t),Ee()},onCancel:Ee})}return`_existingPr`in e.metadata?(0,J.jsx)(WW,{comment:e.metadata.comment,lineContent:we(e.side,e.lineNumber,e.metadata.comment.startLine??void 0),onReply:T,onEdit:E,onDelete:D,onSetResolved:O}):(0,J.jsx)(UW,{comment:e.metadata,onDelete:w})},Ie=(0,q.useCallback)(()=>{I(0),M(null),P(null),L.current=null},[]),Le=(0,q.useCallback)(e=>{I(e?Math.abs(e.end-e.start)+1:0)},[]),Re=(0,q.useCallback)(e=>{I(0),e&&Te(tG(e))},[Te]),ze=(0,q.useCallback)(e=>{Te(tG(e))},[Te]),Be=[...Me,...Ne,...j?[{side:j.side,lineNumber:j.lineNumber,metadata:{_pending:!0}}]:[]];return(0,J.jsxs)(`div`,{ref:ue,className:`file-diff-card ${s?`file-diff-viewed`:``} ${U?`file-diff-collapsed`:``}`,id:e,"data-file-path":n,children:[(0,J.jsxs)(`div`,{className:`file-diff-card-header`,onClick:()=>{let e=!U;W(e),A?.(n,e)},children:[(0,J.jsxs)(`div`,{className:`file-diff-header-left`,children:[(0,J.jsx)(`span`,{className:`file-diff-collapse-indicator`,"aria-hidden":`true`,children:U?(0,J.jsx)(DD,{size:14}):(0,J.jsx)(TD,{size:14})}),(0,J.jsxs)(`div`,{className:`file-diff-title-row`,children:[(0,J.jsx)(`span`,{className:`file-diff-name`,title:n,children:n}),(0,J.jsx)(`button`,{className:`file-diff-copy-path-btn`,onClick:pe,title:`Copy file path to clipboard`,"aria-label":`Copy file path to clipboard`,children:B?(0,J.jsx)(wD,{size:12}):(0,J.jsx)(VD,{size:12})}),Ae(),Me.length+Ne.length>0&&(0,J.jsxs)(`span`,{className:`file-diff-comment-badge`,title:`${Me.length+Ne.length} inline comment${Me.length+Ne.length===1?``:`s`}`,children:[(0,J.jsx)(hO,{size:10}),Me.length+Ne.length]}),F>0&&(0,J.jsxs)(`span`,{className:`file-diff-selection-badge`,"aria-live":`polite`,children:[F,` line`,F===1?``:`s`,` selected`]}),B&&(0,J.jsx)(`span`,{className:`file-diff-permalink-flash`,role:`status`,children:`Copied path`}),R&&(0,J.jsxs)(`span`,{className:`file-diff-permalink-flash`,role:`status`,children:[`Copied `,R]})]})]}),(0,J.jsxs)(`div`,{className:`file-diff-header-right`,onClick:e=>e.stopPropagation(),children:[ge&&(0,J.jsx)(Qw,{content:ie?`Hide unchanged context`:`Expand full-file context`,side:`bottom`,children:(0,J.jsx)(`button`,{className:`file-diff-icon-btn ${ie?`is-active`:``}`,onClick:()=>ae(e=>!e),disabled:ve,"aria-label":ve?`Loading context`:ie?`Hide context`:`Expand context`,children:ve?(0,J.jsx)(cO,{size:13,className:`spin`}):(0,J.jsx)(uO,{size:13})})}),k&&t.type!==`deleted`&&(0,J.jsx)(Qw,{content:`Open in editor`,side:`bottom`,children:(0,J.jsx)(`button`,{className:`file-diff-icon-btn`,onClick:ke,disabled:ee,"aria-label":ee?`Opening file`:`Edit file`,children:ee?(0,J.jsx)(cO,{size:13,className:`spin`}):(0,J.jsx)(TO,{size:13})})}),(0,J.jsx)(Qw,{content:`Comment on entire file`,side:`bottom`,children:(0,J.jsx)(`button`,{className:`file-diff-icon-btn`,onClick:()=>{W(!1),re(!0)},"aria-label":`Add file comment`,children:(0,J.jsx)(hO,{size:13})})}),(0,J.jsxs)(`label`,{className:`viewed-label ${s?`viewed-checked`:``}`,title:s?`Mark unviewed · v`:`Mark viewed · v`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:s,"aria-label":s?`Mark as unviewed`:`Mark as viewed`,onChange:e=>{let t=e.target.checked;W(t),S(n,t)}}),(0,J.jsx)(`span`,{className:`viewed-label-text`,children:`Viewed`})]})]})]}),k&&!U&&t.hunks.length>0&&(0,J.jsxs)(`div`,{className:`file-diff-hunk-actions`,onClick:e=>e.stopPropagation(),children:[(0,J.jsxs)(`div`,{className:`file-diff-hunk-actions-meta`,children:[(0,J.jsx)(`span`,{className:`file-diff-hunk-actions-label`,children:`Revert hunks`}),(0,J.jsx)(Qw,{content:`Preview and undo specific change blocks via git apply --reverse`,side:`top`,children:(0,J.jsx)(ND,{size:12,className:`file-diff-hunk-help`})}),(0,J.jsxs)(`span`,{className:`file-diff-hunk-count`,children:[t.hunks.length,` block`,t.hunks.length===1?``:`s`]})]}),(0,J.jsx)(`div`,{className:`file-diff-hunk-actions-buttons`,children:t.hunks.map((e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:`file-diff-hunk-revert-btn`,onClick:()=>le(t),disabled:oe!==null,title:`Preview and revert hunk #${t+1} (lines @${e.additionStart}+${e.additionLines??e.additionCount})`,children:[oe===t?(0,J.jsx)(cO,{size:10,className:`spin`}):(0,J.jsx)(HO,{size:10}),(0,J.jsxs)(`span`,{children:[`Hunk #`,t+1]})]},t))}),se&&(0,J.jsxs)(`span`,{className:`file-diff-hunk-error`,role:`alert`,children:[(0,J.jsx)(kD,{size:11}),se]})]}),k&&ce!==null&&(()=>{let e=t.hunks[ce];if(!e)return null;let r=t.deletionLines.slice(e.deletionLineIndex,e.deletionLineIndex+(e.deletionCount??e.deletionLines??0)),i=t.additionLines.slice(e.additionLineIndex,e.additionLineIndex+(e.additionStart!==void 0&&e.additionLines!==void 0?e.additionLines:e.additionCount??0));return(0,J.jsxs)(IH,{open:ce!==null,onClose:()=>le(null),className:`hunk-revert-modal`,ariaLabel:`Selective Revert Preview Hunk #${ce+1}`,children:[(0,J.jsxs)(`div`,{className:`shortcuts-header`,children:[(0,J.jsxs)(`div`,{className:`shortcuts-header-title`,children:[(0,J.jsx)(HO,{size:18,className:`shortcuts-icon`}),(0,J.jsxs)(`h2`,{children:[`Revert Hunk #`,ce+1]})]}),(0,J.jsx)(`button`,{className:`shortcuts-close-btn`,onClick:()=>le(null),"aria-label":`Close dialog`,children:(0,J.jsx)(WO,{size:16})})]}),(0,J.jsxs)(`div`,{className:`shortcuts-body`,children:[(0,J.jsxs)(`div`,{className:`hunk-preview-intro`,children:[`Reverting this hunk will restore the deleted (`,(0,J.jsx)(`span`,{className:`hunk-preview-negative`,children:`red`}),`) lines and remove the added (`,(0,J.jsx)(`span`,{className:`hunk-preview-positive`,children:`green`}),`) lines from`,` `,(0,J.jsx)(`strong`,{children:n.split(`/`).pop()}),`.`]}),(0,J.jsxs)(`div`,{className:`hunk-preview-container`,children:[(0,J.jsxs)(`div`,{className:`hunk-preview-header`,children:[(0,J.jsx)(`span`,{children:n}),(0,J.jsxs)(`span`,{children:[`Lines: @-`,e.deletionStart,`,`,e.deletionCount??e.deletionLines??0,` @+`,e.additionStart,`,`,e.additionLines??e.additionCount??0]})]}),(0,J.jsxs)(`div`,{className:`hunk-preview-code`,children:[r.map((e,t)=>(0,J.jsxs)(`div`,{className:`hunk-preview-line hunk-preview-line-deletion`,children:[(0,J.jsx)(`span`,{className:`hunk-preview-sign`,children:`-`}),(0,J.jsx)(`span`,{className:`hunk-preview-text`,children:e})]},`del-${t}`)),i.map((e,t)=>(0,J.jsxs)(`div`,{className:`hunk-preview-line hunk-preview-line-addition`,children:[(0,J.jsx)(`span`,{className:`hunk-preview-sign`,children:`+`}),(0,J.jsx)(`span`,{className:`hunk-preview-text`,children:e})]},`add-${t}`)),r.length===0&&i.length===0&&(0,J.jsx)(`div`,{className:`hunk-preview-line hunk-preview-empty`,children:`No changes in this hunk.`})]})]}),(0,J.jsx)(mG,{filePath:n,deletionStart:e.deletionStart,deletionCount:e.deletionCount??e.deletionLines??0})]}),(0,J.jsxs)(`div`,{className:`modal-footer`,children:[(0,J.jsx)(`button`,{className:`hunk-revert-btn-secondary`,onClick:()=>le(null),children:`Cancel`}),(0,J.jsx)(`button`,{className:`hunk-revert-btn-primary`,onClick:async()=>{let e=ce;le(null),await me(e)},children:`Revert Changes`})]})]})})(),!U&&(0,J.jsxs)(`div`,{className:`file-diff-card-body`,children:[!de&&(0,J.jsx)(`div`,{className:`file-diff-body-placeholder`,"aria-hidden":`true`,children:`Loading diff…`}),de&&t.hunks.length>0&&(0,J.jsx)(ZW,{fileDiff:t,filePath:n,onJump:(e,t)=>{VT(e,t,`additions`)}}),de&&(je.length>0||Pe.length>0||ne)&&(0,J.jsxs)(`div`,{className:`file-level-comments-section`,children:[(0,J.jsxs)(`div`,{className:`file-level-comments-header`,children:[(0,J.jsx)(hO,{size:14}),(0,J.jsxs)(`span`,{children:[`File-Level Comments (`,je.length+Pe.length,`)`]})]}),je.length>0&&(0,J.jsx)(`div`,{className:`file-level-comments-list`,children:je.map(e=>(0,J.jsx)(UW,{comment:e.metadata,onDelete:w},e.metadata.id))}),Pe.map(e=>(0,J.jsx)(WW,{comment:e,onReply:T,onEdit:E,onDelete:D,onSetResolved:O},`github-${e.id}`)),ne&&(0,J.jsx)(`div`,{className:`file-level-comment-form`,children:(0,J.jsx)(RW,{draftKey:`file-comment:${n}`,lineContent:``,onSubmit:(e,t)=>{C(n,`additions`,0,``,e,void 0,t),re(!1)},onCancel:()=>re(!1)})})]}),de&&xe?(0,J.jsx)(Jh,{oldFile:{name:_e,contents:ye??``},newFile:{name:n,contents:be??``},options:{diffStyle:a,enableGutterUtility:!0,enableLineSelection:!0,disableFileHeader:!0,lineDiffType:u,overflow:d?`wrap`:`scroll`,diffIndicators:f,disableLineNumbers:!p,hunkSeparators:m,lineHoverHighlight:h,expandUnchanged:!1,collapsedContextThreshold:y,expansionLineCount:b,onLineSelectionStart:Ie,onLineSelectionChange:Le,onLineSelectionEnd:Re,onGutterUtilityClick:ze,onLineNumberClick:e=>{let t=e.annotationSide===`deletions`?`deletions`:`additions`,r=`${n}:${t===`deletions`?`-`:`+`}${e.lineNumber}`,i=new URLSearchParams({file:n,line:String(e.lineNumber),side:t}),a=typeof window<`u`?`${window.location.origin}${window.location.pathname}?${i}`:r;navigator.clipboard?.writeText(a).then(()=>{z(r),setTimeout(()=>z(null),1600)},()=>{})},theme:{dark:Se.type===`dark`?Se.themeName:`rose-pine`,light:Se.type===`light`?Se.themeName:`github-light`},themeType:Se.type,unsafeCSS:Ce},selectedLines:j?N:void 0,lineAnnotations:Be,renderHeaderMetadata:()=>null,renderAnnotation:Fe}):de?(0,J.jsx)(qh,{fileDiff:t,options:{diffStyle:a,enableGutterUtility:!0,enableLineSelection:!0,disableFileHeader:!0,lineDiffType:u,overflow:d?`wrap`:`scroll`,diffIndicators:f,disableLineNumbers:!p,hunkSeparators:m,lineHoverHighlight:h,onLineSelectionStart:Ie,onLineSelectionChange:Le,onLineSelectionEnd:Re,onGutterUtilityClick:ze,onLineNumberClick:e=>{let t=e.annotationSide===`deletions`?`deletions`:`additions`,r=`${n}:${t===`deletions`?`-`:`+`}${e.lineNumber}`,i=new URLSearchParams({file:n,line:String(e.lineNumber),side:t}),a=typeof window<`u`?`${window.location.origin}${window.location.pathname}?${i}`:r;navigator.clipboard?.writeText(a).then(()=>{z(r),setTimeout(()=>z(null),1600)},()=>{})},theme:{dark:Se.type===`dark`?Se.themeName:`rose-pine`,light:Se.type===`light`?Se.themeName:`github-light`},themeType:Se.type,unsafeCSS:Ce},selectedLines:j?N:void 0,lineAnnotations:Be,renderHeaderMetadata:()=>null,renderAnnotation:Fe}):null]})]})});function mG({filePath:e,deletionStart:t,deletionCount:n}){let[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(null);if((0,q.useEffect)(()=>{let r=!0;return(async()=>{o(!0),c(null);try{let a=new URLSearchParams({filePath:e,deletionStart:String(t),deletionCount:String(n)}),o=await fetch(`/api/hunk-history?${a}`);if(!o.ok)throw Error(`HTTP ${o.status}`);let s=await o.json();r&&i(s)}catch(e){r&&c(e.message||`Failed to fetch hunk history`)}finally{r&&o(!1)}})(),()=>{r=!1}},[e,t,n]),a)return(0,J.jsxs)(`div`,{className:`hunk-history-loading`,children:[(0,J.jsx)(cO,{size:14,className:`spin hunk-history-status-icon`}),(0,J.jsx)(`span`,{children:`Loading git history & origin blame…`})]});if(s)return(0,J.jsxs)(`div`,{className:`hunk-history-error`,children:[(0,J.jsx)(kD,{size:14,className:`hunk-history-status-icon hunk-history-error-icon`}),(0,J.jsxs)(`span`,{children:[`Failed to load git history: `,s]})]});if(!r)return null;let l=Array.from(new Map(r.blame.map(e=>[e.commit,e])).values());return(0,J.jsxs)(`div`,{className:`hunk-history-section`,children:[l.length>0&&(0,J.jsxs)(`div`,{className:`hunk-history-block`,children:[(0,J.jsx)(`h3`,{className:`hunk-history-title`,children:`Commit(s) introducing deleted lines`}),(0,J.jsx)(`div`,{className:`hunk-history-commits`,children:l.map(e=>(0,J.jsxs)(`div`,{className:`hunk-history-commit-card`,children:[(0,J.jsxs)(`div`,{className:`hunk-history-commit-header`,children:[(0,J.jsx)(`span`,{className:`hunk-history-commit-hash`,children:e.commit}),(0,J.jsxs)(`span`,{className:`hunk-history-commit-author`,children:[(0,J.jsx)(UO,{size:11}),(0,J.jsx)(`span`,{children:e.author})]}),(0,J.jsxs)(`span`,{className:`hunk-history-commit-date`,children:[(0,J.jsx)(RD,{size:11}),(0,J.jsx)(`span`,{children:e.date})]})]}),(0,J.jsx)(`div`,{className:`hunk-history-commit-msg`,children:e.summary})]},e.commit))})]}),r.recentCommits.length>0&&(0,J.jsxs)(`div`,{className:`hunk-history-block`,children:[(0,J.jsx)(`h3`,{className:`hunk-history-title`,children:`Recent File Modification History`}),(0,J.jsx)(`div`,{className:`hunk-history-log`,children:r.recentCommits.map(e=>(0,J.jsxs)(`div`,{className:`hunk-history-log-row`,children:[(0,J.jsx)(`span`,{className:`hunk-history-log-hash`,children:e.hash}),(0,J.jsx)(`span`,{className:`hunk-history-log-msg`,title:e.summary,children:e.summary}),(0,J.jsx)(`span`,{className:`hunk-history-log-author`,children:e.author}),(0,J.jsx)(`span`,{className:`hunk-history-log-date`,children:e.date})]},e.hash))})]})]})}function hG(e,t,n){return`
2025
2025
  :host {
2026
2026
  --diffs-tab-size: ${e} !important;
2027
2027
  --diffs-font-family: ${n} !important;
@@ -2063,7 +2063,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
2063
2063
  background-color: var(--gl-selected) !important;
2064
2064
  }
2065
2065
  ${SW}
2066
- `}var mG=new Set([`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`,`.bmp`,`.svg`,`.ico`,`.avif`]);function hG(e){let t=e.slice(e.lastIndexOf(`.`)).toLowerCase();return mG.has(t)}function gG({filePath:e,info:t,viewed:n,onViewedChange:r}){let i=hG(e);return(0,J.jsxs)(`div`,{className:`file-diff-card ${n?`file-diff-viewed`:``}`,id:`file-${e}`,children:[(0,J.jsxs)(`div`,{className:`binary-diff-header`,children:[(0,J.jsx)(`span`,{className:`binary-diff-name`,children:e}),(0,J.jsxs)(`label`,{className:`viewed-label`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:n,onChange:t=>r(e,t.target.checked)}),`Viewed`]})]}),!n&&(0,J.jsx)(`div`,{className:`binary-diff-body`,children:i?(0,J.jsx)(_G,{filePath:e,changeType:t.type}):(0,J.jsxs)(`div`,{className:`binary-diff-message`,children:[`Binary file `,t.type===`added`?`added`:t.type===`untracked`?`untracked`:t.type===`deleted`?`deleted`:`changed`]})})]})}function _G({filePath:e,changeType:t}){let n=`/api/file-content?path=${encodeURIComponent(e)}&version=old`,r=`/api/file-content?path=${encodeURIComponent(e)}&version=new`;return t===`added`||t===`untracked`?(0,J.jsx)(`div`,{className:`image-preview`,children:(0,J.jsxs)(`div`,{className:`image-preview-panel`,children:[(0,J.jsx)(`div`,{className:`image-preview-label image-preview-label-added`,children:`Added`}),(0,J.jsx)(`img`,{src:r,alt:e,className:`image-preview-img`})]})}):t===`deleted`?(0,J.jsx)(`div`,{className:`image-preview`,children:(0,J.jsxs)(`div`,{className:`image-preview-panel`,children:[(0,J.jsx)(`div`,{className:`image-preview-label image-preview-label-deleted`,children:`Deleted`}),(0,J.jsx)(`img`,{src:n,alt:e,className:`image-preview-img image-preview-deleted`})]})}):(0,J.jsxs)(`div`,{className:`image-preview image-preview-compare`,children:[(0,J.jsxs)(`div`,{className:`image-preview-panel`,children:[(0,J.jsx)(`div`,{className:`image-preview-label`,children:`Before`}),(0,J.jsx)(`img`,{src:n,alt:`${e} (before)`,className:`image-preview-img`})]}),(0,J.jsxs)(`div`,{className:`image-preview-panel`,children:[(0,J.jsx)(`div`,{className:`image-preview-label`,children:`After`}),(0,J.jsx)(`img`,{src:r,alt:`${e} (after)`,className:`image-preview-img`})]})]})}var vG=[];function yG(e,t){let n=e.name.split(`/`),r=t.name.split(`/`),i=Math.min(n.length,r.length);for(let e=0;e<i;e++){let t=e<n.length-1;if(t!==e<r.length-1)return t?-1:1;let i=n[e].localeCompare(r[e]);if(i!==0)return i}return n.length-r.length}var bG=(0,q.memo)(function({files:e,diffStyle:t,tabSizeMap:n,defaultTabSize:r,viewedFiles:i,binaryFiles:a,theme:o,editorIDE:s,lineDiffType:c,lineWrap:l,diffIndicators:u,showLineNumbers:d,hunkSeparators:f,lineHoverHighlight:p,fontSize:m,monoFontFamily:h,expandContextByDefault:g,collapsedContextThreshold:_,expansionLineCount:v,autoCollapseLineThreshold:y,onViewedChange:b,fileAnnotationsMap:x,existingCommentsMap:S,onAddComment:C,onDeleteComment:w,onReplyExisting:T,onEditExisting:E,onDeleteExisting:D,onSetExistingResolved:O,allowLocalActions:k=!0,onCardToggleCollapse:A}){return e.length===0?(0,J.jsxs)(`div`,{className:`empty-state`,role:`status`,children:[(0,J.jsx)(`div`,{className:`empty-state-icon`,"aria-hidden":`true`,children:(0,J.jsx)(QD,{size:24,strokeWidth:1.75})}),(0,J.jsx)(`p`,{className:`empty-state-title`,children:`All clean`}),(0,J.jsx)(`p`,{className:`empty-state-hint`,children:`No changes found. Stage, edit, or pick a different range to review.`})]}):(0,J.jsx)(`div`,{className:`diff-viewer`,children:e.map(e=>{let j=e.name,M=a.get(j);return M?(0,J.jsx)(gG,{filePath:j,info:M,viewed:i.has(j),onViewedChange:b},j):(0,J.jsx)(dG,{id:`file-${j}`,fileDiff:e,filePath:j,annotations:x.get(j)??vG,existingComments:S?.get(j)??[],diffStyle:t,tabSize:n[j]??r,viewed:i.has(j),theme:o,editorIDE:s,lineDiffType:c,lineWrap:l,diffIndicators:u,showLineNumbers:d,hunkSeparators:f,lineHoverHighlight:p,fontSize:m,monoFontFamily:h,expandContextByDefault:g,collapsedContextThreshold:_,expansionLineCount:v,autoCollapseLineThreshold:y,onViewedChange:b,onAddComment:C,onDeleteComment:w,onReplyExisting:T,onEditExisting:E,onDeleteExisting:D,onSetExistingResolved:O,allowLocalActions:k,onCardToggleCollapse:A},j)})})}),xG={current:{label:`Current`,icon:wD,title:`Keep the current/HEAD side`},incoming:{label:`Incoming`,icon:WO,title:`Keep the incoming side`},both:{label:`Both`,icon:OO,title:`Keep both sides (current then incoming)`}},SG=(0,q.memo)(function({filePath:e,theme:t,fontSize:n,monoFontFamily:r,tabSize:i,onSaved:a}){let o=LT[t]||LT[`rose-pine`],[s,c]=(0,q.useState)({loading:!0,error:null,file:null}),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(0),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1),y=(0,q.useRef)(null);(0,q.useEffect)(()=>{let t=!1;return c({loading:!0,error:null,file:null}),u(null),f(0),v(!1),g(null),fetch(`/api/file-text?path=${encodeURIComponent(e)}&version=new`).then(e=>e.json()).then(n=>{if(!t){if(n.error){c({loading:!1,error:n.error,file:null});return}c({loading:!1,error:null,file:{name:e,contents:n.content??``}})}}).catch(e=>{t||c({loading:!1,error:e.message,file:null})}),()=>{t=!0}},[e]);let b=(e,t)=>{let n=y.current;if(!n)return;let r=n.resolveConflict(e,t);r&&r.file&&(u(r.file),f(e=>e+1))};return s.loading?(0,J.jsxs)(`div`,{className:`merge-conflict-card merge-conflict-card-loading`,children:[(0,J.jsx)(cO,{size:14,className:`spin`}),(0,J.jsxs)(`span`,{children:[`Loading `,e,`…`]})]}):s.error||!s.file?(0,J.jsxs)(`div`,{className:`merge-conflict-card merge-conflict-card-error`,children:[(0,J.jsx)(kD,{size:14}),(0,J.jsxs)(`span`,{children:[`Could not load `,e,`: `,s.error??`unknown error`]})]}):(0,J.jsxs)(`div`,{className:`merge-conflict-card`,children:[(0,J.jsxs)(`div`,{className:`merge-conflict-header`,children:[(0,J.jsxs)(`div`,{className:`merge-conflict-title`,children:[(0,J.jsx)($D,{size:14}),(0,J.jsx)(`span`,{className:`merge-conflict-name`,title:e,children:e})]}),(0,J.jsxs)(`div`,{className:`merge-conflict-actions`,children:[d>0&&(0,J.jsxs)(`span`,{className:`merge-conflict-status`,children:[d,` resolution`,d===1?``:`s`,` pending`]}),(0,J.jsxs)(`button`,{className:`file-diff-edit-btn`,onClick:async()=>{let t=l??s.file;if(t){m(!0),g(null);try{let n=await fetch(`/api/save-file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:e,content:t.contents,gitAdd:!0})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`HTTP ${n.status}`)}v(!0),a()}catch(e){g(e.message)}finally{m(!1)}}},disabled:p||_,title:"Write the resolved file to disk and `git add` it",children:[p?(0,J.jsx)(cO,{size:11,className:`spin`}):_?(0,J.jsx)(AD,{size:11}):(0,J.jsx)(MO,{size:11}),(0,J.jsx)(`span`,{children:p?`Saving…`:_?`Saved + staged`:`Save & stage`})]})]})]}),h&&(0,J.jsxs)(`div`,{className:`merge-conflict-card-error`,role:`alert`,children:[(0,J.jsx)(kD,{size:14}),(0,J.jsx)(`span`,{children:h})]}),(0,J.jsx)(Dg,{file:l??s.file,options:{disableFileHeader:!0,enableGutterUtility:!1,mergeConflictActionsType:`custom`,theme:{dark:o.type===`dark`?o.themeName:`rose-pine`,light:o.type===`light`?o.themeName:`github-light`},themeType:o.type,unsafeCSS:`
2066
+ `}var gG=new Set([`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`,`.bmp`,`.svg`,`.ico`,`.avif`]);function _G(e){let t=e.slice(e.lastIndexOf(`.`)).toLowerCase();return gG.has(t)}function vG({filePath:e,info:t,viewed:n,onViewedChange:r}){let i=_G(e);return(0,J.jsxs)(`div`,{className:`file-diff-card ${n?`file-diff-viewed`:``}`,id:`file-${e}`,children:[(0,J.jsxs)(`div`,{className:`binary-diff-header`,children:[(0,J.jsx)(`span`,{className:`binary-diff-name`,children:e}),(0,J.jsxs)(`label`,{className:`viewed-label`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:n,onChange:t=>r(e,t.target.checked)}),`Viewed`]})]}),!n&&(0,J.jsx)(`div`,{className:`binary-diff-body`,children:i?(0,J.jsx)(yG,{filePath:e,changeType:t.type}):(0,J.jsxs)(`div`,{className:`binary-diff-message`,children:[`Binary file `,t.type===`added`?`added`:t.type===`untracked`?`untracked`:t.type===`deleted`?`deleted`:`changed`]})})]})}function yG({filePath:e,changeType:t}){let n=`/api/file-content?path=${encodeURIComponent(e)}&version=old`,r=`/api/file-content?path=${encodeURIComponent(e)}&version=new`;return t===`added`||t===`untracked`?(0,J.jsx)(`div`,{className:`image-preview`,children:(0,J.jsxs)(`div`,{className:`image-preview-panel`,children:[(0,J.jsx)(`div`,{className:`image-preview-label image-preview-label-added`,children:`Added`}),(0,J.jsx)(`img`,{src:r,alt:e,className:`image-preview-img`})]})}):t===`deleted`?(0,J.jsx)(`div`,{className:`image-preview`,children:(0,J.jsxs)(`div`,{className:`image-preview-panel`,children:[(0,J.jsx)(`div`,{className:`image-preview-label image-preview-label-deleted`,children:`Deleted`}),(0,J.jsx)(`img`,{src:n,alt:e,className:`image-preview-img image-preview-deleted`})]})}):(0,J.jsxs)(`div`,{className:`image-preview image-preview-compare`,children:[(0,J.jsxs)(`div`,{className:`image-preview-panel`,children:[(0,J.jsx)(`div`,{className:`image-preview-label`,children:`Before`}),(0,J.jsx)(`img`,{src:n,alt:`${e} (before)`,className:`image-preview-img`})]}),(0,J.jsxs)(`div`,{className:`image-preview-panel`,children:[(0,J.jsx)(`div`,{className:`image-preview-label`,children:`After`}),(0,J.jsx)(`img`,{src:r,alt:`${e} (after)`,className:`image-preview-img`})]})]})}var bG=[];function xG(e,t){let n=e.name.split(`/`),r=t.name.split(`/`),i=Math.min(n.length,r.length);for(let e=0;e<i;e++){let t=e<n.length-1;if(t!==e<r.length-1)return t?-1:1;let i=n[e].localeCompare(r[e]);if(i!==0)return i}return n.length-r.length}var SG=(0,q.memo)(function({files:e,diffStyle:t,tabSizeMap:n,defaultTabSize:r,viewedFiles:i,binaryFiles:a,theme:o,editorIDE:s,lineDiffType:c,lineWrap:l,diffIndicators:u,showLineNumbers:d,hunkSeparators:f,lineHoverHighlight:p,fontSize:m,monoFontFamily:h,expandContextByDefault:g,collapsedContextThreshold:_,expansionLineCount:v,autoCollapseLineThreshold:y,onViewedChange:b,fileAnnotationsMap:x,existingCommentsMap:S,onAddComment:C,onDeleteComment:w,onReplyExisting:T,onEditExisting:E,onDeleteExisting:D,onSetExistingResolved:O,allowLocalActions:k=!0,onCardToggleCollapse:A}){return e.length===0?(0,J.jsxs)(`div`,{className:`empty-state`,role:`status`,children:[(0,J.jsx)(`div`,{className:`empty-state-icon`,"aria-hidden":`true`,children:(0,J.jsx)(QD,{size:24,strokeWidth:1.75})}),(0,J.jsx)(`p`,{className:`empty-state-title`,children:`All clean`}),(0,J.jsx)(`p`,{className:`empty-state-hint`,children:`No changes found. Stage, edit, or pick a different range to review.`})]}):(0,J.jsx)(`div`,{className:`diff-viewer`,children:e.map(e=>{let j=e.name,M=a.get(j);return M?(0,J.jsx)(vG,{filePath:j,info:M,viewed:i.has(j),onViewedChange:b},j):(0,J.jsx)(pG,{id:`file-${j}`,fileDiff:e,filePath:j,annotations:x.get(j)??bG,existingComments:S?.get(j)??[],diffStyle:t,tabSize:n[j]??r,viewed:i.has(j),theme:o,editorIDE:s,lineDiffType:c,lineWrap:l,diffIndicators:u,showLineNumbers:d,hunkSeparators:f,lineHoverHighlight:p,fontSize:m,monoFontFamily:h,expandContextByDefault:g,collapsedContextThreshold:_,expansionLineCount:v,autoCollapseLineThreshold:y,onViewedChange:b,onAddComment:C,onDeleteComment:w,onReplyExisting:T,onEditExisting:E,onDeleteExisting:D,onSetExistingResolved:O,allowLocalActions:k,onCardToggleCollapse:A},j)})})}),CG={current:{label:`Current`,icon:wD,title:`Keep the current/HEAD side`},incoming:{label:`Incoming`,icon:WO,title:`Keep the incoming side`},both:{label:`Both`,icon:OO,title:`Keep both sides (current then incoming)`}},wG=(0,q.memo)(function({filePath:e,theme:t,fontSize:n,monoFontFamily:r,tabSize:i,onSaved:a}){let o=LT[t]||LT[`rose-pine`],[s,c]=(0,q.useState)({loading:!0,error:null,file:null}),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(0),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1),y=(0,q.useRef)(null);(0,q.useEffect)(()=>{let t=!1;return c({loading:!0,error:null,file:null}),u(null),f(0),v(!1),g(null),fetch(`/api/file-text?path=${encodeURIComponent(e)}&version=new`).then(e=>e.json()).then(n=>{if(!t){if(n.error){c({loading:!1,error:n.error,file:null});return}c({loading:!1,error:null,file:{name:e,contents:n.content??``}})}}).catch(e=>{t||c({loading:!1,error:e.message,file:null})}),()=>{t=!0}},[e]);let b=(e,t)=>{let n=y.current;if(!n)return;let r=n.resolveConflict(e,t);r&&r.file&&(u(r.file),f(e=>e+1))};return s.loading?(0,J.jsxs)(`div`,{className:`merge-conflict-card merge-conflict-card-loading`,children:[(0,J.jsx)(cO,{size:14,className:`spin`}),(0,J.jsxs)(`span`,{children:[`Loading `,e,`…`]})]}):s.error||!s.file?(0,J.jsxs)(`div`,{className:`merge-conflict-card merge-conflict-card-error`,children:[(0,J.jsx)(kD,{size:14}),(0,J.jsxs)(`span`,{children:[`Could not load `,e,`: `,s.error??`unknown error`]})]}):(0,J.jsxs)(`div`,{className:`merge-conflict-card`,children:[(0,J.jsxs)(`div`,{className:`merge-conflict-header`,children:[(0,J.jsxs)(`div`,{className:`merge-conflict-title`,children:[(0,J.jsx)($D,{size:14}),(0,J.jsx)(`span`,{className:`merge-conflict-name`,title:e,children:e})]}),(0,J.jsxs)(`div`,{className:`merge-conflict-actions`,children:[d>0&&(0,J.jsxs)(`span`,{className:`merge-conflict-status`,children:[d,` resolution`,d===1?``:`s`,` pending`]}),(0,J.jsxs)(`button`,{className:`file-diff-edit-btn`,onClick:async()=>{let t=l??s.file;if(t){m(!0),g(null);try{let n=await fetch(`/api/save-file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:e,content:t.contents,gitAdd:!0})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`HTTP ${n.status}`)}v(!0),a()}catch(e){g(e.message)}finally{m(!1)}}},disabled:p||_,title:"Write the resolved file to disk and `git add` it",children:[p?(0,J.jsx)(cO,{size:11,className:`spin`}):_?(0,J.jsx)(AD,{size:11}):(0,J.jsx)(MO,{size:11}),(0,J.jsx)(`span`,{children:p?`Saving…`:_?`Saved + staged`:`Save & stage`})]})]})]}),h&&(0,J.jsxs)(`div`,{className:`merge-conflict-card-error`,role:`alert`,children:[(0,J.jsx)(kD,{size:14}),(0,J.jsx)(`span`,{children:h})]}),(0,J.jsx)(Dg,{file:l??s.file,options:{disableFileHeader:!0,enableGutterUtility:!1,mergeConflictActionsType:`custom`,theme:{dark:o.type===`dark`?o.themeName:`rose-pine`,light:o.type===`light`?o.themeName:`github-light`},themeType:o.type,unsafeCSS:`
2067
2067
  :host {
2068
2068
  --diffs-tab-size: ${i} !important;
2069
2069
  --diffs-font-family: ${r} !important;
@@ -2082,7 +2082,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
2082
2082
  color: var(--gl-gutter) !important;
2083
2083
  opacity: 1 !important;
2084
2084
  }
2085
- `},renderMergeConflictUtility:(e,t)=>{let n=t();return n&&(y.current=n),(0,J.jsx)(`div`,{className:`merge-conflict-buttons`,children:[`current`,`incoming`,`both`].map(t=>{let{label:n,icon:r,title:i}=xG[t];return(0,J.jsxs)(`button`,{type:`button`,className:`merge-conflict-btn merge-conflict-btn-${t}`,title:i,onClick:()=>b(e.conflictIndex,t),children:[(0,J.jsx)(r,{size:11}),(0,J.jsx)(`span`,{children:n})]},t)})})}})]})}),CG=`file-tree-container`,wG=`data-file-tree-style`,TG=`data-file-tree-unsafe-css`,EG=`data-file-tree-scrollbar-measure`,DG=`data-file-tree-scrollbar-gutter-measured`,OG=`--trees-scrollbar-gutter-measured`,kG=`header`,AG=`context-menu`,jG=`context-menu-trigger`,MG=typeof window>`u`?q.useEffect:q.useLayoutEffect;function NG(e,t,n){let r=e==null?null:(0,J.jsx)(`div`,{slot:kG,children:e}),i=t!=null&&n!=null?(0,J.jsx)(`div`,{slot:AG,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,J.jsxs)(J.Fragment,{children:[r,i]})}function PG(e,t){return typeof window>`u`&&t!=null?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,J.jsx)(J.Fragment,{children:e})}function FG(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function IG(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function LG({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(null),u=(0,q.useRef)(n.getComposition()),d=(0,q.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,q.useCallback)(()=>{s(null)},[]),m=(0,q.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,q.useMemo)(()=>IG(h,e,f,p,m),[h,p,m,f,e]),_=(0,q.useCallback)(e=>{l(e)},[]);(0,q.useEffect)(()=>{f||s(null)},[f]),MG(()=>{n.setComposition(g)},[g,n]),MG(()=>{if(c!=null)return r!=null&&FG(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=PG(NG(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,J.jsx)(CG,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}var RG=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
2085
+ `},renderMergeConflictUtility:(e,t)=>{let n=t();return n&&(y.current=n),(0,J.jsx)(`div`,{className:`merge-conflict-buttons`,children:[`current`,`incoming`,`both`].map(t=>{let{label:n,icon:r,title:i}=CG[t];return(0,J.jsxs)(`button`,{type:`button`,className:`merge-conflict-btn merge-conflict-btn-${t}`,title:i,onClick:()=>b(e.conflictIndex,t),children:[(0,J.jsx)(r,{size:11}),(0,J.jsx)(`span`,{children:n})]},t)})})}})]})}),TG=`file-tree-container`,EG=`data-file-tree-style`,DG=`data-file-tree-unsafe-css`,OG=`data-file-tree-scrollbar-measure`,kG=`data-file-tree-scrollbar-gutter-measured`,AG=`--trees-scrollbar-gutter-measured`,jG=`header`,MG=`context-menu`,NG=`context-menu-trigger`,PG=typeof window>`u`?q.useEffect:q.useLayoutEffect;function FG(e,t,n){let r=e==null?null:(0,J.jsx)(`div`,{slot:jG,children:e}),i=t!=null&&n!=null?(0,J.jsx)(`div`,{slot:MG,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,J.jsxs)(J.Fragment,{children:[r,i]})}function IG(e,t){return typeof window>`u`&&t!=null?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,J.jsx)(J.Fragment,{children:e})}function LG(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function RG(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function zG({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(null),u=(0,q.useRef)(n.getComposition()),d=(0,q.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,q.useCallback)(()=>{s(null)},[]),m=(0,q.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,q.useMemo)(()=>RG(h,e,f,p,m),[h,p,m,f,e]),_=(0,q.useCallback)(e=>{l(e)},[]);(0,q.useEffect)(()=>{f||s(null)},[f]),PG(()=>{n.setComposition(g)},[g,n]),PG(()=>{if(c!=null)return r!=null&&LG(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=IG(FG(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,J.jsx)(TG,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}var BG=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
2086
2086
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
2087
2087
  <path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
2088
2088
  </symbol>
@@ -2099,72 +2099,72 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
2099
2099
  <symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
2100
2100
  <path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />
2101
2101
  </symbol>
2102
- </svg>`,zG=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
2102
+ </svg>`,VG=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
2103
2103
  <path fill="currentColor" d="M6.08 13.92c-.63-.57-.81-1.79-.55-2.67.45.56 1.08.73 1.73.83 1 .15 1.99.1 2.92-.37l.32-.19q.13.38.08.78a2.1 2.1 0 0 1-.9 1.5q-.3.24-.61.43c-.64.44-.81.95-.57 1.69l.02.08a1.7 1.7 0 0 1-.74-.64 2 2 0 0 1-.3-.98q0-.27-.02-.52-.07-.61-.61-.62a.7.7 0 0 0-.75.6z" class="bg" opacity=".6"/>
2104
2104
  <path fill="currentColor" d="M2.5 11.1s1.86-.9 3.72-.9l1.4-4.39c.05-.21.2-.36.38-.36s.33.15.38.36l1.4 4.38c2.2 0 3.72.92 3.72.92l-3.16-8.69q-.13-.4-.45-.42H6.11q-.3.02-.45.42z" class="fg"/>
2105
- </symbol>`,BG=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
2105
+ </symbol>`,HG=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
2106
2106
  <path fill="currentColor" fill-rule="evenodd" d="M9.49.5q1.92.05 2.66.54 1.27.6 1.35 1.52v.23a4 4 0 0 1-.53 1.9l-1.38 1.24q-.74.38-.72.63c.77.82 1.33 1.29.85 2.42q-.47 1.1-2.04 2.28c-.5.32-1.88 1.35-2.96 1.86-1.64.77-3.1 1.4-4.65 1.89-.51.16-1.5.16-1.5.16L.5 15A76 76 0 0 0 5.76 3.49q-.1-.08-.1-.2.1 0 .32-.35l-.03-.09q-1.17.39-2.38 1.3l-.13.03q0-.1-.21-.16-.46.31-.82.7l-.13-.19.16-.06-.03-.16-.34.29L2 4.5q.36-.48.72-.54l.04-.1V3.8q.16 0 .15-.06l.13-.06a6 6 0 0 0 1.13-.9v-.03H4.1l-.12.07q0-.1-.1-.1l-.15.07-.04-.1q.93-.52 1.63-1.05Q7.89.65 9.5.5M8.46 7.83l-.32.04c-1.31.54-2.31.82-2.91.88a71 71 0 0 0-2.2 4.54h.07q.58-.04 3.04-1.42.13 0 1.66-1.05L9.18 9.7v.03q.45-.2.81-1.3v-.2q-.5-.46-1.53-.4m.28-5.75c-.5.1-.75.19-.72.38l-1.16 2.6q-.17.1-.34.95-.3.48-.25.77v.1l.22.05A15 15 0 0 1 8.86 6c1.1-.71 2.12-1.38 2.8-2.54q.24-.33.21-.54-.02-.33-.4-.54c-.54 0-1.07-.34-1.63-.28l-.94-.03z" clip-rule="evenodd"/>
2107
- </symbol>`,VG=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
2107
+ </symbol>`,UG=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
2108
2108
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
2109
2109
  <path fill="currentColor" d="M11.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zM7 6.75C7 6.42 6.64 6 6 6s-1 .42-1 .75q-.01.25.22.41.26.21.89.35.74.14 1.28.53c.37.29.61.7.61 1.21 0 .87-.68 1.5-1.5 1.7v.55a.5.5 0 0 1-1 0v-.56c-.82-.18-1.5-.82-1.5-1.69a.5.5 0 0 1 1 0c0 .33.36.75 1 .75s1-.42 1-.75q.01-.25-.22-.41a2 2 0 0 0-.89-.35q-.74-.14-1.28-.53A1.5 1.5 0 0 1 4 6.75c0-.87.68-1.5 1.5-1.7V4.5a.5.5 0 0 1 1 0v.56c.82.18 1.5.82 1.5 1.69a.5.5 0 0 1-1 0" class="fg-stroke"/>
2110
- </symbol>`,HG=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
2110
+ </symbol>`,WG=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
2111
2111
  <path fill="currentColor" d="M8 2 4.88 7.35a7 7 0 0 1 3.7-.13l1.04.25-.99 4.16-1.05-.25a2.7 2.7 0 0 0-3.07 1.45l-.98-.47a4 4 0 0 1 1.07-1.31 3.8 3.8 0 0 1 3.23-.71l.5-2.08a6 6 0 0 0-5.07 1.12A5.9 5.9 0 0 0 1 14h14z"/>
2112
- </symbol>`,UG=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
2112
+ </symbol>`,GG=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
2113
2113
  <path fill="currentColor" fill-rule="evenodd" d="M11.72 1.5A2.5 2.5 0 0 1 14.2 4q.02 1.08.3 2.09c.22.73.56 1.24 1.08 1.45.22.08.4.27.4.5s-.18.43-.4.51q-.76.34-1.08 1.45c-.2.65-.27 1.32-.3 2a2.5 2.5 0 0 1-2.48 2.5H4.25A2.6 2.6 0 0 1 1.7 12c-.04-.85-.1-1.68-.22-2.04C1.26 9.23.92 8.7.4 8.5.18 8.42 0 8.23 0 8s.18-.42.4-.5q.77-.35 1.09-1.46c.1-.36.17-1.19.2-2.04a2.6 2.6 0 0 1 2.56-2.5z" class="bg" clip-rule="evenodd" opacity=".2"/>
2114
2114
  <path fill="currentColor" fill-rule="evenodd" d="M8.47 4.54c1.23 0 2.04.68 2.04 1.73 0 .73-.55 1.39-1.24 1.5v.04c.94.1 1.58.77 1.58 1.7 0 1.2-.9 1.95-2.37 1.95H5.97a.3.3 0 0 1-.2-.08.3.3 0 0 1-.08-.2V4.82a.3.3 0 0 1 .08-.2.3.3 0 0 1 .2-.08zm-1.7 6.04h1.49q1.47-.01 1.49-1.15Q9.74 8.31 8.2 8.3H6.77zm0-5.16v2.06h1.21c.93 0 1.45-.38 1.45-1.06 0-.65-.44-1-1.22-1z" class="fg" clip-rule="evenodd"/>
2115
- </symbol>`,WG=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
2115
+ </symbol>`,KG=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
2116
2116
  <path fill="currentColor" d="M8.88 6.96c0 3.82 3.72 4.7 5.7 3.74-.23.9-1.04 1.67-2.35 1.93-.02.4.42 1.28.82 1.63-.9.35-1.94-.12-2.51-.48a5 5 0 0 0-.32 1.87c-.68 0-1.57-1-1.8-1.37-.3.18-.85 1.15-.96 1.72a2.4 2.4 0 0 1-.81-.86 2.4 2.4 0 0 1-.3-1.15c-.38.27-1.48.95-1.99 1.18-.25-.58-.15-1.3 0-2.06-.21.12-1.8.27-2.43.12.32-.36.75-1.19.94-1.57A4.5 4.5 0 0 1 .44 10.6c.48-.22.97-.53 1.49-1.06C1.26 9.17.24 8.64 0 7.7a6 6 0 0 0 1.79-.32C1.28 7.08.44 6.15.6 5.01c.42.21 1.3.37 1.73.3a3.4 3.4 0 0 1-.25-2.75 5 5 0 0 0 1.48 1c-.08-.8.3-2.31.8-2.71.2.46.73 1.21 1.08 1.4.09-.61.87-2.06 1.57-2.25 0 .5.27 1.4.5 1.67.51-.54 2.25-1.44 3.64-1.13-.43.45-.75.61-.86.98 1.05 0 2.78.34 4.27 1.93-2.34-.89-5.69.56-5.69 3.5" class="bg" opacity=".5"/>
2117
2117
  <path fill="currentColor" d="M11.21 3.59a4.1 4.1 0 0 0 2.47 2.89c.24-.22.61-.38.95-.19.76.44.2 1.26-.34 1.66l-.07.06a13 13 0 0 1-4.49 1.61l-.3-.43a10.5 10.5 0 0 0 4.13-1.31 1 1 0 0 0 .23-.25.5.5 0 0 0-.21-.69l-.15-.06a4.5 4.5 0 0 1-1.77-1.31 4.5 4.5 0 0 1-.88-1.77q.2-.12.43-.21"/>
2118
2118
  <path fill="currentColor" d="M10.36 5.18a.4.4 0 0 0-.03.38c.09.2.3.3.46.23s.24-.3.15-.5l-.01-.02q.23.13.34.39a.83.83 0 0 1-.43 1.08.8.8 0 0 1-1.08-.43.83.83 0 0 1 .6-1.13"/>
2119
- </symbol>`,GG=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
2119
+ </symbol>`,qG=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
2120
2120
  <path fill="currentColor" d="M8 14c3.87 0 7-2.46 7-5.49 0-1.88-1.2-3.53-3.04-4.52q-1.1-.61-1.84-1.07C9.2 2.35 8.64 2 8 2s-1.36.45-2.31 1.03A29 29 0 0 1 4.04 4C2.2 4.98 1 6.63 1 8.51 1 11.54 4.13 14 8 14M7.18 3.88q.3-.66.3-1.37c0-.08.11-.1.13-.01.38 1.57-.53 2.35-1.2 2.61-.08.03-.12-.07-.06-.12a3 3 0 0 0 .83-1.12m1.2-.05a3 3 0 0 0-.45-1.3V2.5c-.04-.07.05-.15.1-.1 1.15 1.2.77 2.3.33 2.87-.05.05-.13 0-.11-.08q.21-.67.13-1.37m1.04-.32a3 3 0 0 0-.94-1.02v-.01c-.06-.05-.01-.16.07-.12 1.51.61 1.61 1.8 1.43 2.5l-.03.03a.07.07 0 0 1-.1-.06 3 3 0 0 0-.43-1.32m-2.97.32c-.36.3-.74.43-1.2.56q-.11 0-.1-.1a3.5 3.5 0 0 0 1.76-1.57s.09-.07.1.04c0 .18-.2.76-.56 1.07m2.89 6.36q-.13.52-.55.88a1.3 1.3 0 0 1-.75.35 1.3 1.3 0 0 1-.77-.35 1.7 1.7 0 0 1-.54-.88.13.13 0 0 1 .15-.15h2.31a.14.14 0 0 1 .15.15M6.15 8.95a1.1 1.1 0 0 1-1.39-.14A1.1 1.1 0 0 1 5.12 7a1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1-.17 1.69m4.96 0a1.1 1.1 0 0 1-1.4-.14 1.1 1.1 0 0 1 .37-1.8 1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1 .24 1.2 1 1 0 0 1-.41.5"/>
2121
- </symbol>`,KG=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
2121
+ </symbol>`,JG=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
2122
2122
  <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
2123
- </symbol>`,qG=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
2123
+ </symbol>`,YG=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
2124
2124
  <path fill="currentColor" d="M3.75 10.31 6.5 8.77l.04-.14-.04-.07h-.14l-.46-.03-1.57-.04-1.38-.07-1.33-.07-.34-.07L1 7.86l.03-.21.28-.18.4.03.89.07 1.33.08.97.06 1.43.16h.22l.03-.1-.07-.05-.06-.06-1.39-.92-1.48-.98-.79-.57-.42-.28-.2-.28-.1-.6.39-.41.52.04.12.03.52.4 1.12.86L6.2 6.04l.2.17.09-.06.01-.04-.1-.15-.76-1.46-.85-1.46-.37-.6-.1-.36a1 1 0 0 1-.06-.42l.42-.59.25-.07.6.08.22.2.36.84.58 1.3.9 1.77.29.53.14.47.04.14h.1v-.07l.07-1 .14-1.22.14-1.57.04-.45.23-.53.42-.28.36.15.28.41-.04.25-.16 1.08-.36 1.7-.21 1.14h.12l.14-.15.58-.76.97-1.2.42-.5.5-.51.32-.25h.6l.44.66-.2.68-.61.79-.52.65-.74 1-.45.8.04.05h.1l1.68-.36.9-.16 1.06-.18.5.23.05.22-.2.48-1.15.28-1.34.28-2 .46-.04.01.03.04.9.09.4.03h.94l1.77.14.46.28.27.37-.04.28-.72.37-.95-.23-2.24-.53-.76-.18h-.11v.06l.64.63L12 10.86l1.48 1.35.07.34-.18.28-.2-.03-1.29-.98-.5-.42-1.12-.95h-.07v.1l.25.38 1.37 2.05.07.63-.1.2-.36.14-.38-.08-.8-1.12-.85-1.26-.66-1.15-.07.05-.4 4.23-.19.21-.42.17-.35-.28-.2-.42.2-.87.23-1.12.18-.9.17-1.1.1-.36v-.03h-.1l-.84 1.16-1.27 1.72-1 1.07-.24.1-.42-.22.04-.39.22-.32 1.4-1.8.84-1.1.57-.64-.02-.07h-.04l-3.7 2.4-.66.09-.28-.28.03-.42.14-.14 1.12-.77z"/>
2125
- </symbol>`,JG=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
2125
+ </symbol>`,XG=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
2126
2126
  <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
2127
- </symbol>`,YG=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
2127
+ </symbol>`,ZG=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
2128
2128
  <path fill="currentColor" d="M8 15c-5.76 0-7-1.24-7-7V2a1 1 0 0 1 1-1h6c5.77 0 7 1.24 7 7s-1.24 7-7 7" class="vector" opacity=".2"/>
2129
2129
  <path fill="currentColor" d="M10.1 9.19h.73c.03.49.22.6 1 .6.76 0 .93-.12.93-.68 0-.52-.17-.67-.94-.85-1.38-.3-1.68-.56-1.68-1.47 0-1.05.3-1.29 1.67-1.29 1.29 0 1.57.2 1.6 1.13h-.74c-.01-.34-.17-.42-.85-.42-.77 0-.94.1-.94.58 0 .42.17.55.96.73 1.36.3 1.66.58 1.66 1.59 0 1.14-.31 1.39-1.73 1.39-1.39 0-1.69-.24-1.67-1.31m-3.9 0h.74c.03.49.21.6.99.6.76 0 .93-.12.93-.68 0-.52-.17-.67-.93-.85-1.39-.3-1.69-.56-1.69-1.47 0-1.05.3-1.29 1.67-1.29 1.3 0 1.58.2 1.6 1.13h-.73c-.02-.34-.18-.42-.85-.42-.78 0-.95.1-.95.58 0 .42.17.55.96.73 1.37.3 1.67.58 1.67 1.59 0 1.14-.32 1.39-1.74 1.39-1.38 0-1.68-.24-1.66-1.31m-1.22 0h.75c-.09 1.07-.37 1.31-1.56 1.31-1.37 0-1.68-.45-1.68-2.5 0-1.96.36-2.5 1.68-2.5 1.16 0 1.44.25 1.52 1.35h-.76c-.08-.52-.22-.64-.76-.64-.74 0-.9.33-.9 1.78 0 1.47.16 1.8.9 1.8.58 0 .74-.11.8-.6"/>
2130
- </symbol>`,XG=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
2130
+ </symbol>`,QG=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
2131
2131
  <path fill="currentColor" d="M14.953 9.733a12.4 12.4 0 0 1-.244 1.936c-.207.933-.532 1.58-.996 2.044s-1.11.789-2.044.996C10.73 14.918 9.533 15 8 15s-2.73-.082-3.669-.291c-.933-.207-1.58-.532-2.044-.996s-.789-1.11-.996-2.044c-.122-.547-.2-1.182-.244-1.92q.23.364.532.667c.64.639 1.482 1.031 2.533 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265a4 4 0 0 0 .541-.683"/>
2132
2132
  <path fill="currentColor" d="M14.93 5.924c-.046.663-.118 1.24-.23 1.743-.207.932-.532 1.579-.995 2.042s-1.11.789-2.042.996c-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997s-.789-1.11-.996-2.042a12 12 0 0 1-.227-1.683l.016-.188a4 4 0 0 0 .5.62c.638.639 1.48 1.031 2.532 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265.192-.192.357-.404.506-.633z"/>
2133
2133
  <path fill="currentColor" d="M8 1c1.533 0 2.73.082 3.669.291.933.207 1.58.533 2.044.996.403.404.904.944.91 1.695.004.764-.509 1.318-.918 1.727-.463.463-1.11.789-2.042.996-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997-.406-.406-.915-.953-.915-1.71 0-.758.509-1.305.915-1.712.464-.463 1.11-.789 2.044-.996C5.27 1.082 6.467 1 8 1"/>
2134
- </symbol>`,ZG=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
2134
+ </symbol>`,$G=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
2135
2135
  <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".4"/>
2136
2136
  <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
2137
- </symbol>`,QG=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
2137
+ </symbol>`,eK=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
2138
2138
  <path fill="currentColor" d="M15.85 6.54c-.05-.04-.45-.36-1.31-.36q-.34 0-.68.06a2.7 2.7 0 0 0-1.14-1.79l-.23-.14-.15.23a3 3 0 0 0-.4 1q-.24 1.01.26 1.84c-.4.24-1.03.3-1.17.3H.5a.5.5 0 0 0-.5.52q-.01 1.46.46 2.83.55 1.5 1.6 2.18c.79.5 2.08.79 3.54.79q.96 0 1.94-.18a8 8 0 0 0 2.55-.97 7 7 0 0 0 1.73-1.5 10 10 0 0 0 1.7-3.06h.15a2.4 2.4 0 0 0 1.8-.7 2 2 0 0 0 .47-.74l.06-.2z"/>
2139
2139
  <path fill="currentColor" d="M1.48 7.36h1.4a.14.14 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H1.48a.13.13 0 0 0-.13.14v1.32q.02.13.13.13m1.94 0h1.41a.14.14 0 0 0 .13-.13V5.91q-.01-.12-.13-.14h-1.4a.13.13 0 0 0-.13.14v1.32q0 .13.12.13m1.98 0h1.4q.13 0 .14-.13V5.91a.13.13 0 0 0-.14-.14H5.4q-.1.01-.12.14v1.32q0 .13.12.13m1.95 0h1.42q.1 0 .12-.13V5.91q0-.12-.12-.14H7.35q-.1.01-.12.14v1.32q.01.13.12.13M3.42 5.5h1.41c.07 0 .13-.08.13-.15V4.03a.13.13 0 0 0-.13-.14h-1.4q-.12 0-.13.14v1.31q0 .13.12.15m1.98 0h1.4c.08 0 .14-.08.14-.15V4.03q0-.13-.14-.14H5.4q-.1 0-.12.14v1.31q0 .13.12.15m1.95 0h1.42c.06 0 .12-.08.12-.15V4.03q-.01-.13-.12-.14H7.35q-.1 0-.12.14v1.31q.01.13.12.15m0-1.9h1.42q.1-.02.12-.14v-1.3Q8.88 2 8.77 2H7.35q-.1 0-.12.14v1.3q.01.13.12.14m1.97 3.78h1.4a.13.13 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H9.32q-.1.01-.12.14v1.32q.01.13.12.13" opacity=".5"/>
2140
- </symbol>`,$G=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
2140
+ </symbol>`,tK=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
2141
2141
  <path fill="currentColor" d="M11.16 6.1 8.12 4.35a.3.3 0 0 0-.24 0L4.84 6.1a.3.3 0 0 0-.12.2v3.5q0 .14.12.22l3.04 1.74q.12.08.24 0l3.04-1.74a.2.2 0 0 0 .13-.22V6.3a.3.3 0 0 0-.13-.2" opacity=".5"/>
2142
2142
  <path fill="currentColor" d="m.1 7.69 3.63-6.3A.8.8 0 0 1 4.37 1h7.26c.26 0 .5.17.64.4l3.63 6.27a.8.8 0 0 1 0 .75l-3.63 6.24a.7.7 0 0 1-.64.34H4.37a.7.7 0 0 1-.64-.34L.1 8.41a.7.7 0 0 1 0-.72m3 3.02q.01.15.14.23l4.63 2.66q.13.06.26 0l4.63-2.66a.3.3 0 0 0 .14-.23V5.4a.3.3 0 0 0-.14-.23L8.13 2.52a.3.3 0 0 0-.26 0L3.24 5.17a.3.3 0 0 0-.14.23z"/>
2143
- </symbol>`,eK=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
2143
+ </symbol>`,nK=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
2144
2144
  <path fill="currentColor" d="M12.3 13c-1.59 0-2.68-.99-2.68-2.5 0-1.43 1-2.34 2.88-2.35h2.16v-.83c0-1.08-.62-1.68-1.73-1.68-1.05 0-1.66.54-1.73 1.36H9.93c.09-1.43 1.06-2.48 3.05-2.48 1.75 0 3.02.95 3.02 2.68v5.66h-1.29v-1.02h-.04c-.41.66-1.16 1.16-2.37 1.16m.36-1.12c1.14 0 2-.72 2-1.74v-.96H12.6c-1.12 0-1.6.54-1.6 1.28 0 .97.8 1.42 1.66 1.42m-11.24.98H0L3.8 2h1.39l3.8 10.86H7.54l-1.08-3.2H2.5zm3.09-9.25h-.04l-1.6 4.95H6.1z"/>
2145
- </symbol>`,tK=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
2145
+ </symbol>`,rK=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
2146
2146
  <path fill="currentColor" d="M14.74 7.38 8.62 1.26a.9.9 0 0 0-1.27 0L6.08 2.53l1.61 1.61a1.07 1.07 0 0 1 1.36 1.37l1.55 1.55a1.07 1.07 0 0 1 1.1 1.77 1.07 1.07 0 0 1-1.74-1.16L8.5 6.22v3.8a1.07 1.07 0 1 1-.89-.02V6.15a1.07 1.07 0 0 1-.58-1.4l-1.58-1.6-4.2 4.2a.9.9 0 0 0 0 1.27l6.12 6.12a.9.9 0 0 0 1.27 0l6.09-6.09a.9.9 0 0 0 0-1.27"/>
2147
- </symbol>`,nK=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
2147
+ </symbol>`,iK=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
2148
2148
  <path fill="currentColor" fill-rule="evenodd" d="M4.41 4.57A3.2 3.2 0 0 1 6.87 5q.74.49 1.08 1.29.08.12-.1.16l-1.55.4c-.14.03-.15.04-.27-.1a1 1 0 0 0-.44-.34 1.6 1.6 0 0 0-1.68.14q-.95.61-.94 1.73c0 .73.52 1.33 1.25 1.43q.95.1 1.58-.6l.25-.34h-1.8c-.19 0-.24-.12-.17-.27.12-.28.34-.76.47-1a.3.3 0 0 1 .24-.14h2.98a4 4 0 0 1 .64-1.19 4 4 0 0 1 2.6-1.52 3.5 3.5 0 0 1 2.64.46q1.13.73 1.31 2.04a3.5 3.5 0 0 1-1.06 3.09q-.93.92-2.23 1.17l-.74.08a3.5 3.5 0 0 1-2.27-.8 3 3 0 0 1-.93-1.42 4 4 0 0 1-.39.61 4 4 0 0 1-2.64 1.56 3.3 3.3 0 0 1-2.5-.6 3 3 0 0 1-1.18-2.03 3.5 3.5 0 0 1 .8-2.67 4 4 0 0 1 2.6-1.58M13.1 7.5a1.53 1.53 0 0 0-1.9-1.21q-1.3.3-1.62 1.59a1.5 1.5 0 0 0 .85 1.72q.77.33 1.52-.05a2 2 0 0 0 1.18-1.74q0-.17-.03-.3" clip-rule="evenodd"/>
2149
- </symbol>`,rK=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
2149
+ </symbol>`,aK=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
2150
2150
  <path fill="currentColor" fill-rule="evenodd" d="M8 1a1.25 1.25 0 0 1 1.18 1.65l2.8 1.61q.33-.25.77-.26a1.25 1.25 0 0 1 .48 2.4v3.2a1.25 1.25 0 1 1-1.25 2.13l-2.8 1.62A1.25 1.25 0 0 1 8 15a1.25 1.25 0 0 1-1.18-1.65l-2.8-1.62q-.33.26-.77.27a1.25 1.25 0 0 1-.48-2.4V6.4a1.25 1.25 0 1 1 1.25-2.14l2.8-1.61A1.25 1.25 0 0 1 8 1M4.44 11.14l-.06.13 2.75 1.58a1.25 1.25 0 0 1 1.74 0l2.74-1.58-.05-.13zm3.89-7.68a1.3 1.3 0 0 1-.66 0L4.03 9.77q.37.3.45.78h7.04q.08-.48.45-.78zM4.38 4.73a1.24 1.24 0 0 1-1.02 1.76v3.02l.13.01 3.67-6.35-.03-.02zm4.46-1.56 3.67 6.35.13-.01V6.49a1.25 1.25 0 0 1-1.03-1.76L8.87 3.15z" clip-rule="evenodd"/>
2151
- </symbol>`,iK=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
2151
+ </symbol>`,oK=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
2152
2152
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
2153
2153
  <path fill="currentColor" d="M10.48 3.76a.5.5 0 0 1 .4.58L10.6 5.8h1.14a.5.5 0 0 1 0 1h-1.32L10 9.2h1.08a.5.5 0 0 1 0 1H9.8l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H6.4l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H4.25a.5.5 0 0 1 0-1h1.32L6 6.8H4.93a.5.5 0 0 1 0-1H6.2l.3-1.64a.5.5 0 1 1 .98.18L7.2 5.8h2.4l.3-1.64a.5.5 0 0 1 .58-.4M6.58 9.2h2.4l.44-2.4h-2.4z" class="fg"/>
2154
- </symbol>`,aK=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
2154
+ </symbol>`,sK=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
2155
2155
  <path fill="currentColor" d="M12.5 2A2.5 2.5 0 0 1 15 4.5v4.67l-4.05-3.54-4.08 4.08-3-2L1 10.6V4.5A2.5 2.5 0 0 1 3.5 2z" opacity=".3"/>
2156
2156
  <path fill="currentColor" d="M15 10.5v1a2.5 2.5 0 0 1-2.5 2.5h-9a2.5 2.5 0 0 1-2.46-2.04L4 9l3 2 4-4zm-7-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>
2157
- </symbol>`,oK=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
2157
+ </symbol>`,cK=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
2158
2158
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
2159
2159
  <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66M3.5 9.5h.98c0 .76.15.92.85.92.77 0 .94-.18.94-1.02V5.1h1v4.34c0 1.54-.35 1.87-1.92 1.87-1.55 0-1.89-.32-1.86-1.8"/>
2160
- </symbol>`,sK=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
2160
+ </symbol>`,lK=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
2161
2161
  <path fill="currentColor" d="M13.25 11.5V9.75a.5.5 0 0 1 .36-.48l.55-.15a1.16 1.16 0 0 0 0-2.24l-.55-.15a.5.5 0 0 1-.36-.48V4.5a2.5 2.5 0 0 0-2.5-2.5h-.25a.5.5 0 0 0 0 1h.25a1.5 1.5 0 0 1 1.5 1.5v1.75a1.5 1.5 0 0 0 1.09 1.44l.54.15a.16.16 0 0 1 0 .32l-.54.15a1.5 1.5 0 0 0-1.09 1.44v1.75a1.5 1.5 0 0 1-1.5 1.5h-.25a.5.5 0 0 0 0 1h.25a2.5 2.5 0 0 0 2.5-2.5m-10.5 0V9.75a.5.5 0 0 0-.36-.48l-.55-.15a1.16 1.16 0 0 1 0-2.24l.55-.15a.5.5 0 0 0 .36-.48V4.5A2.5 2.5 0 0 1 5.25 2h.25a.5.5 0 0 1 0 1h-.25a1.5 1.5 0 0 0-1.5 1.5v1.75a1.5 1.5 0 0 1-1.09 1.44l-.54.15a.16.16 0 0 0 0 .32l.54.15a1.5 1.5 0 0 1 1.09 1.45v1.74a1.5 1.5 0 0 0 1.5 1.5h.25a.5.5 0 0 1 0 1h-.25a2.5 2.5 0 0 1-2.5-2.5"/>
2162
- </symbol>`,cK=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
2162
+ </symbol>`,uK=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
2163
2163
  <path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
2164
- </symbol>`,lK=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
2164
+ </symbol>`,dK=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
2165
2165
  <path fill="currentColor" d="M9.26-.04a3 3 0 0 1 2 .82 2.8 2.8 0 0 1 .8 2.35 2.9 2.9 0 0 1 2.41.8l.03.02a2.74 2.74 0 0 1 0 3.94l-5.8 5.69-.04.06-.02.07q0 .04.02.07.01.04.04.06l1.2 1.17a.55.55 0 0 1 0 .79.6.6 0 0 1-.81 0l-1.2-1.17a1.3 1.3 0 0 1 0-1.84L13.7 7.1a1.65 1.65 0 0 0 .37-1.82 2 2 0 0 0-.37-.54l-.03-.03a1.73 1.73 0 0 0-2.4 0L6.47 9.4l-.07.06a.58.58 0 0 1-.92-.18.6.6 0 0 1 .12-.6l4.85-4.76a1.65 1.65 0 0 0 0-2.36 1.73 1.73 0 0 0-2.4 0l-6.43 6.3a.6.6 0 0 1-.8 0 .55.55 0 0 1 0-.8L7.25.79a3 3 0 0 1 2-.82"/>
2166
2166
  <path fill="currentColor" d="M9.26 2.19a.6.6 0 0 1 .52.34.6.6 0 0 1 0 .43l-.12.18L4.9 7.79a1.65 1.65 0 0 0 0 2.36 1.73 1.73 0 0 0 2.4 0l4.75-4.66a.58.58 0 0 1 .93.18.6.6 0 0 1-.12.61l-4.75 4.66a2.9 2.9 0 0 1-4.01 0 2.75 2.75 0 0 1-.62-3.04A3 3 0 0 1 4.1 7l4.74-4.65a.6.6 0 0 1 .4-.16"/>
2167
- </symbol>`,uK=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
2167
+ </symbol>`,fK=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
2168
2168
  <defs>
2169
2169
  <linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
2170
2170
  <stop stop-color="currentColor"/>
@@ -2174,82 +2174,82 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
2174
2174
  <path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
2175
2175
  <path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
2176
2176
  <path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
2177
- </symbol>`,dK=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
2177
+ </symbol>`,pK=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
2178
2178
  <path fill="currentColor" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z" class="vector" opacity=".2"/>
2179
2179
  <path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
2180
- </symbol>`,fK=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
2180
+ </symbol>`,mK=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
2181
2181
  <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .5.5V3h3.5a.5.5 0 0 1 .38.83L10.5 7.69v1.44q.41.04.95-.16a4 4 0 0 0 .72-.35l.04-.03h.01a.5.5 0 0 1 .67.1l2 2.5a.5.5 0 0 1 0 .62c-.76.96-3.14 2.69-6.89 2.69s-6.13-1.73-6.89-2.69a.5.5 0 0 1 0-.62l2-2.5a.5.5 0 0 1 .67-.1l.05.03.16.09q.22.13.56.26.54.2.95.16V7.69L2.12 3.83A.5.5 0 0 1 2.5 3H6V1.5a.5.5 0 0 1 .5-.5zM7 3.5a.5.5 0 0 1-.5.5H3.6l2.78 3.17a.5.5 0 0 1 .12.33v2a.5.5 0 0 1-.28.45c-.7.35-1.5.15-2.02-.05a5 5 0 0 1-.58-.26l-1.46 1.84c.82.78 2.8 2.02 5.84 2.02s5.02-1.24 5.84-2.02l-1.46-1.83a5 5 0 0 1-.58.26c-.52.2-1.33.39-2.02.04a.5.5 0 0 1-.28-.45v-2a.5.5 0 0 1 .12-.33L12.4 4H9.5a.5.5 0 0 1-.5-.5V2H7z"/>
2182
- </symbol>`,pK=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
2182
+ </symbol>`,hK=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
2183
2183
  <path fill="currentColor" d="M14.5 8a6.5 6.5 0 0 0-5.9-6.47l5.42 8.93A7 7 0 0 0 14.5 8M2.88 12A6.5 6.5 0 0 0 8 14.5c2.08 0 3.93-.98 5.12-2.5zm8.62-1h1.68L11.5 8.24zm-1-.55a4 4 0 0 1-.7.55h.7zM8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M5.5 11h.7a4 4 0 0 1-.7-.55zm-2.68 0H4.5V8.24zm3.76-6.2A4 4 0 0 1 8 4.5q.76 0 1.42.3L8 2.46zM1.5 8q0 1.31.48 2.46L7.4 1.53A6.5 6.5 0 0 0 1.5 8m14 0a7.5 7.5 0 0 1-.99 3.72l-.01.03-.02.03A7.5 7.5 0 0 1 8 15.5a7.5 7.5 0 0 1-6.5-3.75l-.01-.03A7.5 7.5 0 1 1 15.5 8"/>
2184
- </symbol>`,mK=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
2184
+ </symbol>`,gK=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
2185
2185
  <path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
2186
2186
  <path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
2187
2187
  <path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
2188
2188
  <path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
2189
- </symbol>`,hK=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
2189
+ </symbol>`,_K=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
2190
2190
  <path fill="currentColor" d="M8.33 8.4H10c1.16 0 1.9-.73 1.9-1.86V5.08q0-.24.25-.24h.74c.75 0 1.33.32 1.66.97q.4.73.41 1.46c.09.9.09 1.78-.24 2.67-.25.73-.75 1.3-1.58 1.46h-4.8c-.08 0-.25 0-.25.08v.4s.17.09.25.09h2.82q.34-.02.33.32v1.06c0 .56-.25.97-.75 1.13-.41.16-.83.33-1.24.4a7 7 0 0 1-2.98-.07 3 3 0 0 1-1.16-.49c-.33-.32-.58-.65-.5-1.14v-2.91c0-1.13.67-1.78 1.82-1.78q.89-.1 1.66-.08m2.32 4.86a.65.65 0 0 0-.66-.65c-.34 0-.67.33-.67.65s.33.57.67.65a.65.65 0 0 0 .66-.65" class="bg" opacity=".8"/>
2191
2191
  <path fill="currentColor" d="M7.67 7.6H6c-1.16 0-1.9.73-1.9 1.86v1.46q0 .24-.25.24h-.74c-.75 0-1.33-.32-1.66-.97a3 3 0 0 1-.41-1.46 6 6 0 0 1 .24-2.67c.25-.73.75-1.3 1.58-1.46h4.8c.08 0 .25 0 .25-.08v-.4s-.17-.09-.25-.09H4.85c-.24 0-.33-.08-.33-.32V2.65c0-.56.25-.97.75-1.13.41-.16.83-.33 1.24-.4a7 7 0 0 1 2.98.07c.41.09.83.25 1.16.49.33.32.58.65.5 1.13v2.92c0 1.14-.67 1.78-1.82 1.78-.58.08-1.16.08-1.66.08M5.35 2.73c0 .33.25.65.66.65.33 0 .66-.32.66-.65 0-.32-.33-.56-.66-.64a.65.65 0 0 0-.66.64" class="fg"/>
2192
- </symbol>`,gK=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
2192
+ </symbol>`,vK=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
2193
2193
  <path fill="currentColor" d="M8 6.65c.73 0 1.31.6 1.31 1.35S8.73 9.35 8 9.35 6.69 8.75 6.69 8 7.27 6.65 8 6.65"/>
2194
2194
  <path fill="currentColor" fill-rule="evenodd" d="M8 2.55c1.3-.99 2.59-1.34 3.5-.8.92.55 1.27 1.87 1.08 3.53C14.06 5.94 15 6.9 15 8s-.94 2.06-2.42 2.72c.19 1.65-.16 2.98-1.08 3.52-.91.55-2.2.2-3.5-.8-1.3 1-2.58 1.35-3.5.8-.91-.54-1.27-1.87-1.08-3.52C1.94 10.06 1 9.1 1 8s.94-2.06 2.42-2.72c-.19-1.66.17-2.98 1.08-3.52s2.2-.2 3.5.8M4.26 11.2c-.08 1.34.28 2.03.68 2.26s1.15.22 2.25-.52l.11-.09a12 12 0 0 1-1.24-1.39 11 11 0 0 1-1.8-.41zm7.47-.15q-.83.27-1.79.41-.6.8-1.24 1.4l.11.08c1.1.74 1.86.76 2.25.52.4-.23.76-.92.68-2.26zm-3.04.54a14 14 0 0 1-1.38 0q.34.38.69.7.35-.32.7-.7M8 5.29q-.76 0-1.47.1A13 13 0 0 0 5.07 8a14 14 0 0 0 1.46 2.62 13 13 0 0 0 2.94 0A13 13 0 0 0 10.93 8a14 14 0 0 0-1.46-2.62A13 13 0 0 0 8 5.3M4.64 9.18q-.15.5-.25.96.44.16.94.27a15 15 0 0 1-.7-1.23m6.73 0a15 15 0 0 1-.7 1.23q.5-.11.95-.27a10 10 0 0 0-.25-.96M3.44 6.26C2.27 6.86 1.87 7.53 1.87 8s.4 1.14 1.57 1.74l.13.07q.18-.88.55-1.81a12 12 0 0 1-.55-1.8q-.07.02-.13.06m8.99-.07A12 12 0 0 1 11.88 8q.36.94.55 1.8l.13-.06c1.17-.6 1.56-1.27 1.56-1.74s-.39-1.14-1.56-1.74zm-7.1-.6q-.5.11-.94.27.1.46.25.96a15 15 0 0 1 .69-1.23m5.34 0a15 15 0 0 1 .7 1.23q.14-.5.24-.96-.44-.15-.94-.27M7.18 3.06c-1.09-.74-1.85-.76-2.24-.52s-.76.92-.69 2.26l.01.15a11 11 0 0 1 1.8-.41q.6-.8 1.24-1.4zm3.88-.52c-.4-.24-1.15-.22-2.25.52l-.12.08q.65.6 1.25 1.4.96.15 1.8.41v-.14c.08-1.35-.28-2.04-.68-2.27M8 3.7a10 10 0 0 0-.7.7 14 14 0 0 1 1.4 0 10 10 0 0 0-.7-.7" clip-rule="evenodd"/>
2195
- </symbol>`,_K=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
2195
+ </symbol>`,yK=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
2196
2196
  <path fill="currentColor" fill-rule="evenodd" d="M11.04 2c.48 0 .92.23 1.18.6l2.54 3.65c.37.52.3 1.23-.15 1.69l-5.58 5.64a1.47 1.47 0 0 1-2.06 0L1.39 7.94a1.3 1.3 0 0 1-.15-1.7l2.54-3.63q.2-.3.5-.45.33-.16.68-.16zm.84 2.17a.5.5 0 0 0-.7-.05L8 6.84 4.83 4.12a.5.5 0 0 0-.65.76L6.65 7H3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1H9.35l2.48-2.12a.5.5 0 0 0 .05-.7" clip-rule="evenodd"/>
2197
- </symbol>`,vK=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
2197
+ </symbol>`,bK=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
2198
2198
  <path fill="currentColor" fill-rule="evenodd" d="M8 .8a.2.2 0 0 1 .18.1l.38.6.16.02.5-.53.01-.01a.2.2 0 0 1 .33.08l.25.68.16.05.59-.43h.02a.2.2 0 0 1 .3.14l.12.71.15.08.65-.3a.2.2 0 0 1 .2.02.2.2 0 0 1 .1.18l-.03.72.12.1.71-.16a.2.2 0 0 1 .25.25l-.17.7q.06.06.1.13l.73-.03A.2.2 0 0 1 14 4a.2.2 0 0 1 .02.2l-.3.66.08.14.71.12a.2.2 0 0 1 .14.32l-.43.59.05.16.68.25a.2.2 0 0 1 .07.35l-.53.49.01.16.62.38a.2.2 0 0 1 0 .36l-.62.38-.01.16.53.5a.2.2 0 0 1-.07.34l-.68.25-.05.16.43.59a.2.2 0 0 1-.14.32l-.72.12-.07.15.3.65a.2.2 0 0 1-.02.2.2.2 0 0 1-.18.1l-.72-.03-.1.13.16.7a.2.2 0 0 1-.25.25l-.7-.17-.13.1.03.73a.2.2 0 0 1-.1.18.2.2 0 0 1-.2.02l-.66-.3-.14.08-.12.71a.2.2 0 0 1-.32.14l-.59-.43-.16.05-.25.68a.2.2 0 0 1-.34.07l-.5-.53-.16.01-.38.62a.2.2 0 0 1-.36 0l-.38-.62-.16-.01-.5.53a.2.2 0 0 1-.34-.07l-.25-.68-.16-.05-.59.43a.2.2 0 0 1-.32-.14L5 13.78l-.15-.07-.65.3a.2.2 0 0 1-.2-.02.2.2 0 0 1-.1-.18l.03-.72-.13-.1-.7.16a.2.2 0 0 1-.25-.25l.17-.7-.1-.13-.73.03a.2.2 0 0 1-.2-.3l.3-.66-.08-.14-.71-.12a.2.2 0 0 1-.14-.32l.43-.59-.05-.16-.68-.25A.2.2 0 0 1 1 9.22l.53-.5-.02-.16-.6-.38A.2.2 0 0 1 .8 8a.2.2 0 0 1 .1-.18l.6-.38.02-.16-.53-.5a.2.2 0 0 1 .07-.34l.68-.25.05-.16-.43-.59a.2.2 0 0 1 .14-.32L2.2 5l.08-.15L2 4.2a.2.2 0 0 1 .2-.3l.72.03.1-.13-.16-.7a.2.2 0 0 1 .25-.25l.7.16.13-.1-.03-.72A.2.2 0 0 1 4 2a.2.2 0 0 1 .2-.02l.65.3L5 2.2l.12-.71v-.03a.2.2 0 0 1 .32-.1l.59.41.16-.04.25-.68.01-.02A.2.2 0 0 1 6.8.99l.49.53.16-.02.38-.61.02-.02A.2.2 0 0 1 8 .79M6.8 9.45h1.26l.06.01q.03.01.03.05v1.52q0 .07-.09.06h-4.5A5.4 5.4 0 0 0 8 13.42a5.4 5.4 0 0 0 4.45-2.33h-2.42c-.36 0-.68-.5-.77-.75-.08-.22-.2-.91-.25-1.12-.15-.61-.59-.71-.78-.73H6.8zM8 2.58a5.4 5.4 0 0 0-4.07 1.85h5.74l.17.02c.23.03.6.12.96.35.34.23.83.68.83 1.4 0 .66-.55 1.16-1.08 1.5.42.33.7.53.86 1.44.04.17.34.32.62.29.29-.03.62-.16.62-.75v-.24q0-.1.07-.1h.68A5.43 5.43 0 0 0 8 2.59M2.96 6.03a5.4 5.4 0 0 0-.19 3.37h1.66V6.03zM6.8 7.06h1.66c.35 0 .77-.12.77-.47 0-.42-.55-.53-.65-.53H6.8z" clip-rule="evenodd"/>
2199
- </symbol>`,yK=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
2199
+ </symbol>`,xK=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
2200
2200
  <path fill="currentColor" fill-rule="evenodd" d="M8.08 1.44c2.41-.91 4.96-.37 5.35 1.27.39 1.62-.92 3.56-2.6 4.25a5 5 0 0 1-3.26.35c-.58-.2-.92-.62-1-.85-.03-.09-.09-.24 0-.3.05-.03.08-.02.22.15s.7.6 1.75.48c2.78-.34 4.45-2.64 3.92-3.88-.37-.87-2.5-1.26-5.18.16C4.03 4.81 3.85 6.24 3.82 6.8c-.08 1.5 1.73 2.28 2.7 3.4q.04.03.07.08c.3-.12.7-.19 1.35-.2 1.58-.03 2.47 1.08 2.43 2.08-.03.78-.7 1.1-.82 1.13-.1.01-.14.02-.15-.06q-.03-.06.13-.15c.16-.09.42-.3.48-.72.05-.43-.24-1.44-1.76-1.63a3 3 0 0 0-1.33.08c.27.62.32 1.87-.29 2.83-.63 1-1.8 1.61-2.93 1.27-.37-.1-.93-.92-.45-2.05.46-1.07 2.4-2.12 2.66-2.26-.9-.83-3.08-1.95-3.4-3.65-.08-.49.13-1.65 1.46-2.98a12 12 0 0 1 4.11-2.52m-1.88 9.7c-.01.01-.9.47-1.52 1.17-.59.66-.75 1.48-.43 1.69.3.18 1-.04 1.51-.62a3 3 0 0 0 .5-.9q.2-.64.02-1.39z" clip-rule="evenodd"/>
2201
- </symbol>`,bK=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
2201
+ </symbol>`,SK=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
2202
2202
  <path fill="currentColor" d="M4 3v3.5l1.5-1L7 15 .5 6l1-1.5L0 3l2.5-2h1zm12 0-1.5 1.5 1 1.5L9 15l1.5-9.5 1.5 1V3l.5-2h1zm-8 8.5a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1"/>
2203
2203
  <path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
2204
- </symbol>`,xK=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
2204
+ </symbol>`,CK=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
2205
2205
  <path fill="currentColor" d="m3.98 3.7 3.36-2.08a4.5 4.5 0 0 1 5.9 1.23 4 4 0 0 1 .7 3.02q-.16.75-.58 1.4c.42.77.56 1.66.4 2.52a3.7 3.7 0 0 1-1.57 2.4l-.17.1-3.36 2.09a4.5 4.5 0 0 1-5.9-1.23 4 4 0 0 1-.66-1.44 4 4 0 0 1-.04-1.58 4 4 0 0 1 .58-1.4 4 4 0 0 1-.4-2.52 3.7 3.7 0 0 1 1.57-2.4zl3.36-2.08zm7.87 0a2.7 2.7 0 0 0-1.26-.95 2.7 2.7 0 0 0-1.6-.07 3 3 0 0 0-.52.2l-.16.09-3.36 2.08a2 2 0 0 0-.69.64 2 2 0 0 0-.36.86 2.3 2.3 0 0 0 .42 1.81A2.7 2.7 0 0 0 7.18 9.4q.28-.06.53-.2l.16-.09 1.28-.79.2-.09a.8.8 0 0 1 .87.31.7.7 0 0 1 .13.55.7.7 0 0 1-.24.4l-.08.05-3.36 2.08-.2.09a1 1 0 0 1-.49-.02 1 1 0 0 1-.38-.3 1 1 0 0 1-.13-.37v-.1l.01-.13-.13-.03a4 4 0 0 1-1.1-.5l-.2-.14-.18-.12-.07.18-.08.3a2.3 2.3 0 0 0 .43 1.82q.45.64 1.19.93.73.28 1.51.14l.16-.04q.27-.07.52-.2l.16-.09 3.36-2.08q.4-.25.69-.64.27-.4.36-.86a2.3 2.3 0 0 0-.42-1.82 2.7 2.7 0 0 0-1.27-.95 2.7 2.7 0 0 0-1.6-.08q-.27.07-.52.2l-.16.1-1.28.79-.2.09a1 1 0 0 1-.49-.03 1 1 0 0 1-.38-.29.7.7 0 0 1-.13-.54.7.7 0 0 1 .24-.4l.08-.06L9.33 4.4l.2-.1a.8.8 0 0 1 .87.32 1 1 0 0 1 .13.38v.22l.11.04q.6.18 1.12.5l.2.14.17.12.06-.19.08-.3a2.3 2.3 0 0 0-.42-1.81z"/>
2206
- </symbol>`,SK=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
2206
+ </symbol>`,wK=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
2207
2207
  <path fill="currentColor" d="M5 7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z"/>
2208
2208
  <path fill="currentColor" d="M6 1a5 5 0 0 1 4.58 3H7a3 3 0 0 0-3 3v3.58A5 5 0 0 1 6 1" opacity=".5"/>
2209
- </symbol>`,CK=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
2209
+ </symbol>`,TK=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
2210
2210
  <path fill="currentColor" d="M9.43 4.8A.6.6 0 1 1 9.19 6l-.56.96a1.2 1.2 0 0 1 .32 1.58l.7.53a.89.89 0 1 1-.17.22l-.7-.52a1.2 1.2 0 0 1-1.4.25l-.56.87a.75.75 0 1 1-.57-.2 1 1 0 0 1 .32.05l.56-.87a1.2 1.2 0 0 1-.4-1.24l-1.2-.47a.56.56 0 1 1 .1-.28v.02l1.2.47a1.2 1.2 0 0 1 1.56-.55l.56-.97a.6.6 0 0 1-.15-.64.6.6 0 0 1 .63-.4"/>
2211
2211
  <path fill="currentColor" fill-rule="evenodd" d="M9.17 1q.16.63.27 1.26a6 6 0 0 1 1.61.67q.52-.38 1.08-.71l1.65 1.64q-.32.56-.68 1.05.48.78.72 1.67.6.09 1.18.25v2.32q-.55.15-1.11.24a6 6 0 0 1-.7 1.82q.31.44.59.91l-1.65 1.65-.85-.55a6 6 0 0 1-1.9.83q-.08.47-.2.95H6.84q-.12-.46-.2-.93a6 6 0 0 1-1.96-.81q-.39.27-.8.51l-1.65-1.65q.25-.43.53-.84a6 6 0 0 1-.75-1.9L1 9.16V6.83q.54-.14 1.09-.24a6 6 0 0 1 .77-1.74q-.33-.47-.63-.98l1.65-1.65q.54.32 1.03.68a6 6 0 0 1 1.66-.66q.1-.61.26-1.24zM7.96 3.73a4 4 0 0 0-1.74.36 4.5 4.5 0 0 0-2.3 2.3 4.4 4.4 0 0 0-.1 3.29l.03.06a4.4 4.4 0 0 0 2.4 2.47 4.4 4.4 0 0 0 3.48-.02l.03-.02a4.4 4.4 0 0 0 2.3-2.42l.06-.14a4.4 4.4 0 0 0-.2-3.4 4.4 4.4 0 0 0-2.13-2.07L9.47 4a4 4 0 0 0-1.51-.27" clip-rule="evenodd"/>
2212
- </symbol>`,wK=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
2212
+ </symbol>`,EK=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
2213
2213
  <path fill="currentColor" d="M9.63 1c6.15 4.35 4.16 9.15 4.16 9.15s1.75 2.05 1.04 3.85c0 0-.72-1.26-1.93-1.26-1.17 0-1.85 1.26-4.2 1.26C3.47 14 1 9.46 1 9.46c4.71 3.22 7.93.94 7.93.94C6.8 9.12 2.29 3 2.29 3c3.93 3.47 5.63 4.39 5.63 4.39-1.01-.87-3.86-5.13-3.86-5.13C6.34 4.66 10.86 8 10.86 8c1.28-3.7-1.23-7-1.23-7"/>
2214
- </symbol>`,TK=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
2214
+ </symbol>`,DK=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
2215
2215
  <path fill="currentColor" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" opacity=".4"/>
2216
2216
  <path fill="currentColor" d="M11.5 8a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5zM5 12h2.5v-1H5zm3.5 0H11v-1H8.5zM5 10h2.5V9H5zm3.5 0H11V9H8.5zm1-9a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
2217
- </symbol>`,EK=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
2217
+ </symbol>`,OK=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
2218
2218
  <path fill="currentColor" fill-rule="evenodd" d="M8 4Q5.2 4 4.5 6.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C8.98 7.23 9.77 8 11.5 8q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C10.52 4.77 9.73 4 8 4M4.5 8Q1.7 8 1 10.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C5.48 11.23 6.26 12 8 12q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C7.02 8.77 6.24 8 4.5 8" clip-rule="evenodd"/>
2219
- </symbol>`,DK=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
2219
+ </symbol>`,kK=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
2220
2220
  <path fill="currentColor" d="M1 0v5.05l4.35 2.53V2.53zm9.18 5.34L5.83 2.82v5.05l4.35 2.53zm.47 5.06V5.34L15 2.82v5.05zm-.48 5.6-4.35-2.53V8.42l4.35 2.53z"/>
2221
- </symbol>`,OK=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
2221
+ </symbol>`,AK=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
2222
2222
  <path fill="currentColor" fill-rule="evenodd" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" clip-rule="evenodd" opacity=".4"/>
2223
2223
  <path fill="currentColor" d="M8.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zm2-2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm-1-8a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z"/>
2224
- </symbol>`,kK=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
2224
+ </symbol>`,jK=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
2225
2225
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
2226
2226
  <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66m-3 1.57V5.99H3.5v-.9h4.21v.9H6.1v5.22z"/>
2227
- </symbol>`,AK=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
2227
+ </symbol>`,MK=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
2228
2228
  <path fill="currentColor" d="M8.57 14.87c-.18.26-.55.11-.55-.22v-3.18l-.05-.27-.13-.22-.2-.15-.24-.06H4.29c-.26 0-.4-.32-.26-.55L6.08 7c.3-.46 0-1.1-.5-1.1H1.8c-.25 0-.4-.32-.25-.56l2.65-4.2A.3.3 0 0 1 4.46 1h7.9c.26 0 .4.32.26.55l-2.05 3.23c-.29.46 0 1.1.5 1.1h3.12c.26 0 .4.34.24.57z"/>
2229
- </symbol>`,jK=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
2229
+ </symbol>`,NK=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
2230
2230
  <path fill="currentColor" d="m5.11 9.68-2.4 1.84a.6.6 0 0 1-.75-.04l-.77-.7a.6.6 0 0 1 0-.87L3.28 8zm5.52-8.42a.51.51 0 0 1 .87.36V4.8L7.32 8 5.1 6.32z" opacity=".75"/>
2231
2231
  <path fill="currentColor" d="M11.1 14.99h.03zM1.96 4.52a.6.6 0 0 1 .75-.04l8.8 6.71v3.19a.51.51 0 0 1-.88.36L1.19 6.1a.6.6 0 0 1 0-.87z" opacity=".65"/>
2232
2232
  <path fill="currentColor" d="M11.62 14.91a.9.9 0 0 1-1-.17.51.51 0 0 0 .88-.36V1.62a.51.51 0 0 0-.87-.36.9.9 0 0 1 1-.17l2.87 1.39a.9.9 0 0 1 .5.8v9.44a.9.9 0 0 1-.5.8z"/>
2233
- </symbol>`,MK=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
2233
+ </symbol>`,PK=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
2234
2234
  <path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
2235
2235
  <path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
2236
- </symbol>`,NK=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
2236
+ </symbol>`,FK=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
2237
2237
  <path fill="currentColor" d="M13 1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h3a2 2 0 1 0 4 0z" class="subtract" opacity=".2"/>
2238
2238
  <path fill="currentColor" d="M4.64 11.4h.02l.8-3.4h.91l.73 3.45L7.88 8h.96l-1.25 5h-.97L5.9 9.6 5.1 13h-1L3 8h.98z"/>
2239
2239
  <path fill="currentColor" fill-rule="evenodd" d="M13 13h-1.02l-.33-1.11H9.9L9.64 13h-.97l1.26-5h1.54zm-2.49-3.77-.42 1.84h1.32l-.49-1.84z" clip-rule="evenodd"/>
2240
- </symbol>`,PK=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
2240
+ </symbol>`,IK=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
2241
2241
  <path fill="currentColor" d="M14.1 11.79 8.26 15v-2.5l3.64-1.94zm.4-.35V4.73l-2.14 1.2v4.3zm-12.6.35L7.74 15v-2.5L4.1 10.56zm-.4-.35V4.73l2.14 1.2v4.3zm.25-7.15 6-3.29v2.42L3.9 5.47l-.03.01zm12.5 0L8.25 1v2.42l3.85 2.05.03.01z" class="bg" opacity=".4"/>
2242
2242
  <path fill="currentColor" d="m7.74 11.93-3.59-1.92v-3.8l3.6 2.02zm.52 0 3.59-1.92v-3.8l-3.6 2.02zM4.4 5.77 8 3.85l3.6 1.93L8 7.8z" class="fg"/>
2243
- </symbol>`,FK=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
2243
+ </symbol>`,LK=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
2244
2244
  <path fill="currentColor" d="M7.5 2A1.5 1.5 0 0 1 9 3.5v3A1.5 1.5 0 0 1 7.5 8h-2v2A1.5 1.5 0 0 0 7 11.5v-1A1.5 1.5 0 0 1 8.5 9h5a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 7 13.5v-1A2.5 2.5 0 0 1 4.5 10V8h-2A1.5 1.5 0 0 1 1 6.5v-3A1.5 1.5 0 0 1 2.5 2zm1 8a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm-6-7a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5z"/>
2245
- </symbol>`,IK=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
2245
+ </symbol>`,RK=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
2246
2246
  <path fill="currentColor" d="m14.73 1.5-7.29 8.82h4.17l-1.73 2.04H5.76L1.27 14.5l7.3-8.91H4.39l1.73-2.05h4.12z"/>
2247
2247
  <path fill="currentColor" d="M5.21 3.54 3.56 5.6h-.55v4.73h.83L2.1 12.36H1V3.54zm9.79 0v8.82h-4.3l1.74-2.04h.55V5.68h-.83l1.74-2.14z"/>
2248
- </symbol>`,LK=[VG,KG,JG,YG,XG,ZG,eK,tK,nK,iK,aK,oK,sK,cK,lK,hK,_K,vK,wK,TK,OK,kK,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
2248
+ </symbol>`,zK=[UG,JG,XG,ZG,QG,$G,nK,rK,iK,oK,sK,cK,lK,uK,dK,_K,yK,bK,EK,DK,AK,jK,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
2249
2249
  <path fill="currentColor" d="M4.585 2a2 2 0 0 1 1.028.285l1.788 1.072a1 1 0 0 0 .514.143H12A2 2 0 0 1 13.935 5H0V4a2 2 0 0 1 2-2z" class="bg" opacity=".5"/>
2250
2250
  <path fill="currentColor" fill-rule="evenodd" d="M14 12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-1.25h1v-1H0V6h14zM9.9 8.25c-.883 0-1.9.5-1.9.5H7v1h1v1s1.017.5 1.9.5c.884 0 1.6-.672 1.6-1.5s-.716-1.5-1.6-1.5M2 9.75v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1zm-5-1v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1z" class="fg" clip-rule="evenodd"/>
2251
- </symbol>`],RK=[zG,BG,HG,UG,WG,GG,qG,QG,$G,rK,uK,dK,fK,pK,mK,gK,yK,bK,xK,SK,CK,EK,DK,AK,jK,MK,NK,PK,FK,IK];function zK(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
2252
- `)}\n</svg>`)}var BK=zK(RG,LK),VK={minimal:RG,standard:BK,complete:zK(BK,RK)},HK={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},UK={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},WK={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},GK=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),KK=new Set([`complete`]);function qK(e){return VK[e===`none`?`minimal`:e]}function JK(e){return`file-tree-builtin-${e}`}function YK(e){return e!==`none`&&KK.has(e)}function XK(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=HK[t.toLowerCase()];if(i!=null&&(r||GK.has(i)))return i;for(let e of n){if(r){let t=WK[e];if(t!=null)return t}let t=UK[e];if(t!=null&&(r||GK.has(t)))return t}return`default`}function ZK(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function QK(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(ZK(e)?`none`:`complete`),colored:e.colored??!0}}var $K={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function eq(e,t){if(typeof e==`number`)return{itemHeight:t??$K.default.itemHeight,factor:e};let n=$K[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var tq=$K.default.itemHeight,nq=`@layer base, theme, unsafe;
2251
+ </symbol>`],BK=[VG,HG,WG,GG,KG,qG,YG,eK,tK,aK,fK,pK,mK,hK,gK,vK,xK,SK,CK,wK,TK,OK,kK,MK,NK,PK,FK,IK,LK,RK];function VK(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
2252
+ `)}\n</svg>`)}var HK=VK(BG,zK),UK={minimal:BG,standard:HK,complete:VK(HK,BK)},WK={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},GK={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},KK={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},qK=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),JK=new Set([`complete`]);function YK(e){return UK[e===`none`?`minimal`:e]}function XK(e){return`file-tree-builtin-${e}`}function ZK(e){return e!==`none`&&JK.has(e)}function QK(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=WK[t.toLowerCase()];if(i!=null&&(r||qK.has(i)))return i;for(let e of n){if(r){let t=KK[e];if(t!=null)return t}let t=GK[e];if(t!=null&&(r||qK.has(t)))return t}return`default`}function $K(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function eq(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??($K(e)?`none`:`complete`),colored:e.colored??!0}}var tq={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function nq(e,t){if(typeof e==`number`)return{itemHeight:t??tq.default.itemHeight,factor:e};let n=tq[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var rq=tq.default.itemHeight,iq=`@layer base, theme, unsafe;
2253
2253
 
2254
2254
  @layer base {
2255
2255
  :host {
@@ -3913,14 +3913,14 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
3913
3913
  }
3914
3914
  }
3915
3915
  }
3916
- `,rq=`@layer base, unsafe;`;function iq(e){return`${rq}
3916
+ `,aq=`@layer base, unsafe;`;function oq(e){return`${aq}
3917
3917
  @layer base {
3918
3918
  ${e}
3919
- }`}function aq(e){return`${rq}
3919
+ }`}function sq(e){return`${aq}
3920
3920
  @layer unsafe {
3921
3921
  ${e}
3922
- }`}var oq=new WeakMap;function sq(e){let t=oq.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(EG,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),oq.set(e,i),i}function cq(e,t){if(!e.isConnected)return;let n=sq(t);if(n==null)return;let r=t.querySelector(`style[${DG}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(DG,``),t.appendChild(i)),i.textContent=`:host { ${OG}: ${n}px; }`}var lq;function uq(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){lq??(lq=new CSSStyleSheet,lq.replaceSync(iq(nq)));let t=!1;try{e.adoptedStyleSheets=[lq],t=!0}catch{}if(t){e.querySelector(`style[${wG}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(wG,``),t.textContent=iq(nq),e.prepend(t)}}function dq(e,t){fq(e,t),uq(t),cq(e,t)}function fq(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});dq(this,e)}}if(customElements.define(CG,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(CG)))e instanceof HTMLElement&&dq(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var pq=5,mq=1<<pq,hq=mq*4;function gq(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function _q(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function vq(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function yq(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function bq(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function xq(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function Sq(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,Eq(e,t)}function Cq(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=yq(e).get(t);if(i===void 0)return;let a=i>>pq;e.childVisibleChunkSums[a]+=r}function wq(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=Dq(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=mq}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function Tq(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>pq;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<pq}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function Eq(e,t){if(t.childIds.length<hq){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/mq),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>pq]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function Dq(e,t,n,r){let i=Math.min(t.childIds.length,n+mq),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var Oq=7,kq=3,Aq=1<<kq,jq=4;function Mq(e,t,n=0){return e<<jq|n<<kq|t}function Nq(e){return e.depthAndFlags>>>jq}function Pq(e){return(e.depthAndFlags&Aq)>>kq}function Fq(e){return(e.depthAndFlags&Aq)!==0}function Iq(e){return e.depthAndFlags&Oq}function Lq(e,t){return(Iq(e)&t)!==0}function Rq(e,t){e.depthAndFlags|=t}function zq(e,t){e.depthAndFlags=Mq(t,Iq(e),Pq(e))}var Bq=Symbol(`benchmarkInstrumentation`);function Vq(e,t){return t==null||Object.defineProperty(e,Bq,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Hq(e){return e==null?null:e[Bq]??null}function Uq(e,t,n){return e==null?n():e.measurePhase(t,n)}function Wq(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Gq(e){return e>=48&&e<=57}function Kq(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Gq(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&Gq(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function qq(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Kq(t)}}function Jq(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function Yq(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=Jq(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Xq(e,t,n){let r=Yq(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Zq(e,t){return Xq(e,t,qq)}function Qq(e,t){return t===e.segments.length-1?e.isDirectory?1:0:1}function $q(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=Qq(e,r);return a===Qq(t,r)?Zq(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function eJ(e,t){return $q(e,t)}function tJ(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=qq(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=Qq(e,n);return o===Qq(t,n)?Xq(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function nJ(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=qq(r);return e.sortKeyById[t]=i,i}function rJ(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function iJ(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function aJ(e){let{hasTrailingSlash:t,segments:n}=iJ(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function oJ(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=iJ(e);return{requiresDirectory:t,segments:n}}var sJ=``;function cJ(){let e=new Map;return e.set(sJ,0),{idByValue:e,valueById:[sJ],sortKeyById:[qq(sJ)]}}function lJ(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function uJ(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var dJ=Symbol(`pathStorePreparedInputKind`);function fJ(e,t){return e[dJ]=t,e}function pJ(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function mJ(e,t,n){return n===`default`?eJ(e,t):n(pJ(e),pJ(t))}function hJ(){return{depthAndFlags:Mq(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function gJ(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function _J(e){return e.isDirectory?e.segments.length:e.segments.length-1}function vJ(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function yJ(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function bJ(e,t={}){return EJ(e,t).map(e=>e.path)}function xJ(e,t={}){let n=EJ(e,t);return fJ({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function SJ(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return fJ({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function CJ(e){let t=e,n=t.preparedPaths;if(t[dJ]===`prepared`&&n!=null)return n;if(!vJ(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function wJ(e){let t=e;return t[dJ]===`presorted`&&t.presortedPaths!=null||yJ(t.presortedPaths)?t.presortedPaths:null}function TJ(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function EJ(e,t={}){let n=rJ(t),r=Hq(t);Wq(r,`workload.inputFiles`,e.length);let i=Uq(r,`store.preparePathEntries.parse`,()=>e.map(e=>aJ(e)));return Uq(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>mJ(e,t,n.sort))),i}var DJ=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[hJ()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=cJ();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Hq(e),this.options=rJ(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,gq())}appendPaths(e){return Uq(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>aJ(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Uq(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Uq(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:Mq(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:Mq(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:Mq(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=aJ(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:Mq(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:Mq(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=aJ(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Uq(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Uq(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort===`default`?tJ(this.lastPreparedPath,e,this.segmentSortKeyCache):mJ(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=_J(e),i=n==null?0:_J(n),a=n==null?0:gJ(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=lJ(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:Mq(Nq(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),bq(i,s),s}createFileChildUnchecked(e,t){let n=lJ(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Mq(Nq(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),bq(r,a),a}getOrCreateDirectoryChild(e,t){let n=lJ(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!Fq(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Mq(Nq(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),bq(r,a),this.directories.set(a,gq()),a}createDirectoryChild(e,t){let n=lJ(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Mq(Nq(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),bq(r,a),this.directories.set(a,gq()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!Fq(n))throw Error(`Path is not a directory: "${t}"`);if(Lq(n,1))throw Error(`Duplicate path: "${t}"`);Rq(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,_q());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(Fq(a)){let t=_q();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;Fq(n)&&this.directories.set(t,gq());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),bq(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!Fq(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return Sq(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function OJ(e,t=`closed`,n=null){let r=AJ(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function kJ(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function AJ(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function jJ(e,t){return Lq(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:Nq(t)<=e.defaultExpansion}function MJ(e,t,n=e.snapshot.nodes[t]){return n==null||!Fq(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:jJ(e,n)}function NJ(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!Fq(r))return;let i=jJ(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function PJ(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function FJ(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function IJ(e,t){let n=PJ(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function LJ(e,t){let n=PJ(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function RJ(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function zJ(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function BJ(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function VJ(e,t){e.directoryLoadInfoById.delete(t)}function HJ(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function UJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function WJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function GJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function KJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function qJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function JJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function YJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function XJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function ZJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function QJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function $J(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function eY(e,t,n){return{...n,visibleCountDelta:dY(e)-t}}function tY(e,t){let n=dY(e),r=kJ();e.transactionStack.push(r);try{t()}catch(t){throw iY(e,r,!1),t}iY(e,r,!0,dY(e)-n)}function nY(e,t){let n=e.instrumentation;if(n==null){rY(e,t);return}Uq(n,`store.events.record`,()=>rY(e,t))}function rY(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){lY(e,t);return}n.events.push(t),cY(n,t)}function iY(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?sY(i,t):Uq(n,`store.events.batch.merge`,()=>sY(i,t));return}let a=aY(t,r),o=e.instrumentation;if(o==null){lY(e,a);return}Uq(o,`store.events.batch.commit`,()=>lY(e,a))}function aY(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function oY(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function sY(e,t){for(let n of t.events)e.events.push(n);oY(e,t)}function cY(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function lY(e,t){let n=e.instrumentation;if(n==null){uY(e,t);return}Uq(n,`store.events.emit`,()=>uY(e,t))}function uY(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function dY(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function fY(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!Fq(n)||Lq(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!Fq(a)?null:i}function pY(e,t){let n=t;for(;;){let t=fY(e,n);if(t==null)return n;n=t}}function mY(e,t){let n=[t],r=t;for(;;){let t=fY(e,r);if(t==null)return n;n.push(t),r=t}}function hY(e,t){let n=t==null?e.snapshot.rootId:TY(e,t);return n==null?[]:kY(e,n)}function gY(e,t){let n=aJ(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=WY(e,UY(e,r)),{createdNodeIds:a,directoryId:o}=AY(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=OY(e,o);if(Lq(n,1))throw Error(`Path already exists: "${t}"`);Rq(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=MY(e,o,n.basename),s.add(c);SY(e,o);let l=WY(e,o);return UJ({affectedAncestorIds:wY(e,c),affectedNodeIds:[...s],path:t,projectionChanged:GY(i,l)})}function _Y(e,t,n){let r=TY(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=OY(e,r);if(Lq(i,2))throw Error(`The root node cannot be removed`);if(Fq(i)&&DY(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=WY(e,a),s=VY(e,r);FY(e,a,r,i.nameId),HY(e,a),SY(e,a);let c=WY(e,a);return WJ({affectedAncestorIds:wY(e,a),affectedNodeIds:s,path:t,projectionChanged:GY(o,c),recursive:n.recursive===!0})}function vY(e,t,n,r){let i=TY(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=OY(e,i);if(Lq(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=zY(e,i,n),c=WY(e,a.parentId),l=WY(e,s.parentId),u=uJ(e.snapshot.segmentTable,a.nameId),d=lJ(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(Fq(a)&&YY(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=vq(e.snapshot.nodes,DY(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&BY(e,p,o,Pq(a))===`skip`)return null;let m=a.parentId;FY(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),JY(e,i),PY(e,s.parentId,i),HY(e,m),e.pathCacheVersion++,SY(e,m),s.parentId!==m&&SY(e,s.parentId);let h=WY(e,m),g=WY(e,s.parentId);return GJ({affectedAncestorIds:[...new Set([...wY(e,m),...wY(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:KY([c,l],[h,g]),to:xY(e,i)})}function yY(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function bY(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function xY(e,t){let n=OY(e,t),r=yY(e,t);if(r!=null)return r;if(Lq(n,2))return bY(e,t,``);let i=xY(e,n.parentId),a=uJ(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return bY(e,t,Fq(n)?`${o}/`:o)}function SY(e,t){let n=e.instrumentation;if(n==null){ZY(e,t);return}Uq(n,`store.recomputeCountsUpwardFrom`,()=>ZY(e,t))}function CY(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!Fq(o)){XY(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){XY(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function wY(e,t){let n=[],r=t;for(;r!=null;){let t=OY(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function TY(e,t){if(t.length===0)return e.snapshot.rootId;let n=oJ(t);return EY(e,n.segments,n.requiresDirectory)}function EY(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=DY(e,r),a=vq(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=OY(e,r);return n&&!Fq(i)?null:r}function DY(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function OY(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Lq(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function kY(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Lq(n,4))return[];if(!Fq(n))return[xY(e,t)];if(DY(e,t).childIds.length===0)return Lq(n,1)&&!Lq(n,2)?[xY(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||Lq(n,4)){i.pop();continue}if(!Fq(n)){r.push(xY(e,t.nodeId)),i.pop();continue}let a=DY(e,t.nodeId);if(a.childIds.length===0){Lq(n,1)&&!Lq(n,2)&&r.push(xY(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function AY(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=lJ(e.snapshot.segmentTable,i),a=DY(e,r),o=vq(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!Fq(OY(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=jY(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function jY(e,t,n){let r=OY(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Mq(Nq(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,gq()),PY(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function MY(e,t,n){let r=lJ(e.snapshot.segmentTable,n),i=DY(e,t);if(vq(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${$Y(e,t,n)}"`);let a=OY(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Mq(Nq(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),PY(e,t,o),e.activeNodeCount++,o}function NY(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}IY(e,n,o)<0?i=a:r=a+1}return r}function PY(e,t,n){let r=DY(e,t),i=OY(e,n);vq(e.snapshot.nodes,r).set(i.nameId,n),Cq(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=NY(e,r,n);r.childIds.splice(a,0,n),xq(r,a),Eq(e.snapshot.nodes,r)}function FY(e,t,n,r){let i=DY(e,t),a=yq(i),o=a.get(n)??-1;vq(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Cq(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),xq(i,o),Eq(e.snapshot.nodes,i))}function IY(e,t,n){let r=e.snapshot.options.sort;return r===`default`?LY(e,t,n):r(RY(e,t),RY(e,n))}function LY(e,t,n){let r=OY(e,t),i=OY(e,n),a=Fq(r);if(a!==Fq(i))return a?-1:1;let o=Yq(nJ(e.snapshot.segmentTable,r.nameId),nJ(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=uJ(e.snapshot.segmentTable,r.nameId),c=uJ(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function RY(e,t){let n=OY(e,t),r=xY(e,t),i=Fq(n),a=i?r.slice(0,-1):r;return{basename:uJ(e.snapshot.segmentTable,n.nameId),depth:Nq(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function zY(e,t,n){let r=OY(e,t),i=TY(e,n);if(i!=null){let t=OY(e,i);if(Fq(t))return{basename:uJ(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=oJ(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=oJ(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:EY(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function BY(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${xY(e,t)}"`);let i=OY(e,t);if(Pq(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(Fq(i)&&DY(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return VY(e,t),FY(e,a,t,o),HY(e,a),SY(e,a),`handled`}function VY(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=OY(e,t.nodeId);if(t.visitedChildren||!Fq(i)){Fq(i)&&e.snapshot.directories.delete(t.nodeId),Rq(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),VJ(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=DY(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function HY(e,t){let n=t;for(;n!=null;){let t=OY(e,n);if(!Fq(t)||Lq(t,2)||DY(e,n).childIds.length>0)return;Rq(t,1),n=t.parentId===n?null:t.parentId}}function UY(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=vq(e.snapshot.nodes,DY(e,n)).get(t);if(i==null||!Fq(OY(e,i)))break;n=i}return n}function WY(e,t){let n=qY(e,t);if(n==null)return null;let r=pY(e,n),i=OY(e,r),a=n===r?null:mY(e,n).map(t=>xY(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:DY(e,r).childIds.length>0,path:xY(e,r),terminalKind:Pq(i)})}function GY(e,t){return KY([e],[t])}function KY(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function qY(e,t){let n=t;for(;n!=null;){let t=OY(e,n);if(!Fq(t)||Lq(t,2))return null;if(!MJ(e,n,t))return n;n=t.parentId}return null}function JY(e,t){let n=OY(e,t);if(zq(n,(t===e.snapshot.rootId?-1:Nq(OY(e,n.parentId)))+1),!Fq(n))return;let r=DY(e,t);for(let t of r.childIds)JY(e,t)}function YY(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=OY(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function XY(e,t,n=OY(e,t),r=!1){let i=e.instrumentation;if(i==null){QY(e,t,n,r);return}Uq(i,`store.recomputeNodeCounts`,()=>QY(e,t,n,r))}function ZY(e,t){let n=t;for(;n!=null;){let t=OY(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(XY(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Cq(DY(e,s),n,a,o),n=s}}function QY(e,t,n,r){if(!Fq(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=DY(e,t);if(r){let t=e.instrumentation;t==null?Sq(e.snapshot.nodes,i):Uq(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>Sq(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,Lq(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=fY(e,t)==null?MJ(e,t,n)?1+o:1:o}function $Y(e,t,n){let r=xY(e,t);return r.length===0?n:`${r}${n}`}function eX(e){return e!=null&&!Lq(e,4)}function tX(e,t){let n=e.snapshot.nodes[t];return!eX(n)||!Fq(n)||Lq(n,2)?null:n}function nX(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&eX(e.snapshot.nodes[n])&&(t+=1);return t}function rX(e){return Math.max(0,e.valueById.length-1)}function iX(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:nX(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:rX(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function aX(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function oX(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)tX(e,n)!=null&&t.push(xY(e,n));for(let t of e.expandedDirectoryIds)tX(e,t)!=null&&n.push(xY(e,t));return{collapsedPaths:t,expandedPaths:n}}function sX(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)tX(e,n)==null||FJ(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:xY(e,n)});return t}function cX(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=TY(e,n);t!=null&&NJ(e,t,!0,OY(e,t))}for(let n of t.collapsedPaths){let t=TY(e,n);t!=null&&NJ(e,t,!1,OY(e,t))}}function lX(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=TY(e,n.path);t!=null&&tX(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function uX(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function dX(e){let t=e.snapshot.segmentTable,n=cJ();for(let r of e.snapshot.nodes)if(eX(r)){if(Lq(r,2)){r.nameId=0;continue}r.nameId=lJ(n,uJ(t,r.nameId))}e.snapshot.segmentTable=n}function fX(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!eX(r)||!Fq(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return eX(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[OY(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),Sq(e.snapshot.nodes,n)}}function pX(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(eX(n))break;--t}e.snapshot.nodes.length=t+1}function mX(e){let t=oX(e),n=sX(e);Uq(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>uX(e)),Uq(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>dX(e)),Uq(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>fX(e)),Uq(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>pX(e)),Uq(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>cX(e,t)),Uq(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>lX(e,n)),Uq(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>CY(e,e.snapshot.rootId))}function hX(e){let t=oX(e),n=sX(e),r=Uq(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>hY(e)),i=Vq({...e.snapshot.options},e.instrumentation),a=Uq(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new DJ(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,Uq(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>cX(e,t)),Uq(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>lX(e,n)),Uq(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>CY(e,e.snapshot.rootId))}function gX(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function _X(e,t){let n=iX(e);t===`stable`?Uq(e.instrumentation,`store.cleanup.stable`,()=>mX(e)):Uq(e.instrumentation,`store.cleanup.aggressive`,()=>hX(e));let r=iX(e);return aX(t,t===`stable`,n,r)}var vX=64;function yX(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function bX(e){return OY(e,e.snapshot.rootId).visibleSubtreeCount}function xX(e,t,n,r){let i=OY(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function SX(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:VX(e,t.cursor),setSize:t.setSize,subtreeEndIndex:xX(e,t.cursor,t.index,n)}}function CX(e,t,n,r,i,a){let o=DY(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=wq(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return wX(e,u,l,r+c,i+1,s,o.childIds.length,a)}function wX(e,t,n,r,i,a,o,s){if(!Fq(OY(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=FX(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=OY(e,c.terminalNodeId);if(!Fq(l)||!MJ(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return CX(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function TX(e,t){let n=bX(e);if(t<0||t>=n)return null;let r=CX(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>xY(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=SX(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:VX(e,r.cursor),setSize:r.setSize,subtreeEndIndex:xX(e,r.cursor,r.index,n)}}function EX(e,t,n){let r=e.instrumentation,i=bX(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return BX(e,o+1);let t=[],n=MX(e,a);for(let r=a;r<=o&&n!=null;r++){let r=VX(e,n);t.push(r),n=LX(e,n)}return t}let s=[],c=0,l=0,u=Uq(r,`store.getVisibleSlice.selectFirstRow`,()=>MX(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Uq(r,`store.getVisibleSlice.materializeRow`,()=>VX(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Uq(r,`store.getVisibleSlice.advanceCursor`,()=>LX(e,u))}return Wq(r,`workload.visibleRowsRead`,s.length),Wq(r,`workload.flattenedRowsRead`,c),Wq(r,`workload.flattenedSegmentsRead`,l),s}function DX(e,t=bX(e)){let n=e.instrumentation;return n==null?zX(e,t):Uq(n,`store.getVisibleTreeProjection`,()=>zX(e,t))}function OX(e){return RX(DX(e))}function kX(e,t){let n=TY(e,t);if(n==null||n===e.snapshot.rootId||Fq(OY(e,n))&&pY(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=OY(e,i).parentId,n=DY(e,t),s=yq(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=Tq(a,n,s),t!==o){let n=OY(e,t),a=fY(e,t);if(!MJ(e,t,n)&&a!==i)return null;pY(e,t)===t&&(r+=1)}i=t}return r}function AX(e,t){let n=TY(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=OY(e,n);if(!Fq(r))throw Error(`Path is not a directory: "${t}"`);return MJ(e,n,r)?null:(NJ(e,n,!0,r),SY(e,n),KJ({affectedAncestorIds:wY(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function jX(e,t){let n=TY(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=OY(e,n);if(!Fq(r))throw Error(`Path is not a directory: "${t}"`);return MJ(e,n,r)?(NJ(e,n,!1,r),SY(e,n),qJ({affectedAncestorIds:wY(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function MX(e,t){return t<0||t>=bX(e)?null:NX(e,e.snapshot.rootId,t,-1)}function NX(e,t,n,r){let i=DY(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?wq(e.snapshot.nodes,i,n):Uq(a,`store.getVisibleSlice.selectChildIndex`,()=>wq(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return PX(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function PX(e,t,n,r){if(!Fq(OY(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=FX(e,t,r);if(n===0)return i;let a=OY(e,i.terminalNodeId);if(!Fq(a)||!MJ(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return NX(e,i.terminalNodeId,n-1,i.visibleDepth)}function FX(e,t,n){return Fq(OY(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:pY(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Uq(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>pY(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function IX(e,t){let n=OY(e,t);if(!Fq(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:fY(e,r)!==t}function LX(e,t){let n=OY(e,t.terminalNodeId);if(Fq(n)){let r=DY(e,t.terminalNodeId);if(MJ(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:PX(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=OY(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=DY(e,n),o=yq(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return PX(e,s,0,i);IX(e,r)&&i--,r=n}}function RX(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function zX(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(vX);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=yX(o,y);let x,S=_;if(Fq(v))S=f?pY(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:xY(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&Fq(C)&&MJ(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function BX(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!Fq(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:xY(e,f)};continue}let h=l?pY(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=VX(e,g);let _=i[h];_!=null&&Fq(_)&&MJ(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function VX(e,t){let n=OY(e,t.terminalNodeId),r=Fq(n)?HX(e,t):null,i=xY(e,t.terminalNodeId),a=uJ(e.snapshot.segmentTable,n.nameId),o=Fq(n)&&DY(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?mY(e,t.headNodeId).map(n=>{let r=OY(e,n);return{isTerminal:n===t.terminalNodeId,name:uJ(e.snapshot.segmentTable,r.nameId),nodeId:n,path:xY(e,n)}}):Uq(c,`store.getVisibleSlice.flatten.collectSegments`,()=>mY(e,t.headNodeId).map(n=>{let r=OY(e,n);return{isTerminal:n===t.terminalNodeId,name:uJ(e.snapshot.segmentTable,r.nameId),nodeId:n,path:xY(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:Fq(n)&&MJ(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:Fq(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function HX(e,t){if(t.headNodeId===t.terminalNodeId)return FJ(e,t.terminalNodeId);let n=mY(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=FJ(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function UX(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!Fq(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&Eq(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&Fq(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,Eq(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function WX(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var GX=class e{#e;constructor(e={}){let t=Hq(e),n=Uq(t,`store.builder.create`,()=>new DJ(e));if(e.preparedInput!=null){let t=wJ(e.preparedInput);t==null?n.appendPreparedPaths(CJ(e.preparedInput),!1):n.appendPresortedPaths(t,TJ(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Uq(t,`store.preparePathEntries`,()=>EJ(r,e)))}let r=Uq(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Uq(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Uq(t,`store.state.create`,()=>OJ(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Uq(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||WX(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Uq(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?Uq(t,`store.state.initializeOpenVisibleCounts`,()=>UX(this.#e)):Uq(t,`store.state.recomputeCounts`,()=>CY(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return bJ(e,t)}static prepareInput(e,t={}){return xJ(e,t)}static preparePresortedInput(e){return SJ(e)}list(e){return Uq(this.#e.instrumentation,`store.list`,()=>hY(this.#e,e))}add(e){Uq(this.#e.instrumentation,`store.add`,()=>{let t=bX(this.#e);nY(this.#e,eY(this.#e,t,gY(this.#e,e)))})}remove(e,t={}){Uq(this.#e.instrumentation,`store.remove`,()=>{let n=bX(this.#e);nY(this.#e,eY(this.#e,n,_Y(this.#e,e,t)))})}move(e,t,n={}){Uq(this.#e.instrumentation,`store.move`,()=>{let r=bX(this.#e),i=vY(this.#e,e,t,n);i!=null&&nY(this.#e,eY(this.#e,r,i))})}batch(e){tY(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return Uq(this.#e.instrumentation,`store.getVisibleCount`,()=>bX(this.#e))}getVisibleSlice(e,t){return Uq(this.#e.instrumentation,`store.getVisibleSlice`,()=>EX(this.#e,e,t))}getVisibleRowContext(e){return Uq(this.#e.instrumentation,`store.getVisibleRowContext`,()=>TX(this.#e,e))}getVisibleTreeProjection(){return OX(this.#e)}getVisibleTreeProjectionData(e){return DX(this.#e,e)}getVisibleIndex(e){return Uq(this.#e.instrumentation,`store.getVisibleIndex`,()=>kX(this.#e,e))}getPathInfo(e){return Uq(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=TY(this.#e,e);if(t==null)return null;let n=OY(this.#e,t);return{depth:Nq(n),kind:Fq(n)?`directory`:`file`,path:xY(this.#e,t)}})}isExpanded(e){return Uq(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=OY(this.#e,t);return MJ(this.#e,t,n)})}expand(e){Uq(this.#e.instrumentation,`store.expand`,()=>{let t=bX(this.#e),n=AX(this.#e,e);n!=null&&nY(this.#e,eY(this.#e,t,n))})}collapse(e){Uq(this.#e.instrumentation,`store.collapse`,()=>{let t=bX(this.#e),n=jX(this.#e,e);n!=null&&nY(this.#e,eY(this.#e,t,n))})}on(e,t){return HJ(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return FJ(this.#e,t)}markDirectoryUnloaded(e){Uq(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(DY(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=bX(this.#e);LJ(this.#e,t),nY(this.#e,eY(this.#e,n,JJ({affectedAncestorIds:wY(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Uq(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=bX(this.#e),r=IJ(this.#e,t);return nY(this.#e,eY(this.#e,n,YJ({affectedAncestorIds:wY(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Uq(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||FJ(this.#e,n)!==`loading`||!zJ(this.#e,n,e.attemptId))return!1;let r=xY(this.#e,n);this.validateChildPatch(r,t);let i=bX(this.#e),a=[];for(let e of t.operations){KX(r,e);let t=bX(this.#e);switch(e.type){case`add`:a.push(eY(this.#e,t,gY(this.#e,e.path)));break;case`remove`:a.push(eY(this.#e,t,_Y(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=vY(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(eY(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return nY(this.#e,eY(this.#e,i,XJ({affectedAncestorIds:wY(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:xY(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Uq(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=bX(this.#e),r=RJ(this.#e,t,e.attemptId);return nY(this.#e,eY(this.#e,n,ZJ({affectedAncestorIds:wY(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:xY(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Uq(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=bX(this.#e),i=BJ(this.#e,n,e.attemptId,t);return nY(this.#e,eY(this.#e,r,QJ({affectedAncestorIds:wY(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:xY(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Uq(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(gX(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=bX(this.#e),n=_X(this.#e,e.mode??`stable`);return nY(this.#e,eY(this.#e,t,$J({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=DY(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??qq(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=Yq(nJ(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!Fq(OY(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=OY(this.#e,n);MJ(this.#e,n,i)||(NJ(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=OY(this.#e,e);if(!MJ(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=TY(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!Fq(OY(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!Fq(OY(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=OY(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=OY(this.#e,e),r=fY(this.#e,e);if(!MJ(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function KX(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var qX=e=>e.startsWith(`f::`)?e.slice(3):e;function JX(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function YX(e,t){return e===``?t:`${e}/${t}`}function XX({files:e,path:t,isFolder:n,nextBasename:r}){let i=qX(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=JX(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=YX(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function ZX(e){return e.endsWith(`/`)}function QX(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function $X(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function eZ(e,t){return t.includes(e)?$X(t):[e]}function tZ(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function nZ(e,t){return{draggedPaths:e,target:t}}function rZ(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(ZX(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function iZ(e,t){return t.kind===`root`||t.directoryPath==null?QX(e):t.directoryPath}function aZ(e,t){let n=e.map(e=>{let n=iZ(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function oZ(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function sZ(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!oZ(GX.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function cZ(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function lZ(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function uZ(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function dZ(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return uZ(e,t.path)?n?e:null:e;case`move`:return lZ(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=dZ(r,e,n),r==null)return null;return r}}}function fZ(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function pZ(e){switch(e.operation){case`add`:return{...fZ(e),operation:`add`,path:e.path};case`remove`:return{...fZ(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...fZ(e),from:e.from,operation:`move`,to:e.to}}}function mZ(e){return{...fZ(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>pZ(e)),operation:`batch`}}function hZ(e){switch(e.operation){case`add`:case`remove`:case`move`:return pZ(e);case`batch`:return mZ(e);default:return null}}function gZ(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function _Z(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function vZ(e){return _Z(e).at(-1)??null}function yZ(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function bZ(e){return e.endsWith(`/`)}var xZ=e=>e.toLowerCase();function SZ(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function CZ(e){return e.endsWith(`/`)?e.slice(0,-1):e}function wZ(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var TZ=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},EZ=Symbol(`FILE_TREE_RENAME_VIEW`),DZ=512,OZ=512;function kZ(e){return e===`top`||e===`center`?e:`nearest`}function AZ(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=_Z(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function jZ(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:AZ(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var MZ=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=sZ({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=vZ(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:kZ(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=OZ){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=eZ(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=nZ(t.draggedPaths,n);(rZ(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}tZ(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=nZ(e.draggedPaths,t);if(rZ(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=aZ(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=bZ(r),a=CZ(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of _Z(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=SZ(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[EZ](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,bZ(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,bZ(e)?{recursive:!0}:void 0);return}let t=bZ(e),n=XX({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:CZ(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(wZ(n.sourcePath,t),wZ(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=sZ({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!gZ(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=vZ(e),n=yZ(e,t),r=null,i=null;for(let e of this.#be()){if(vZ(e)!==t)continue;let a=yZ(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=_Z(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!gZ(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new GX({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of _Z(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(xZ),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(xZ),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of _Z(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:TZ(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of _Z(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of _Z(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=jZ(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,DZ)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#De()))}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=dZ(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=dZ(this.#c,e,!0),r=[...this.#B].map(t=>dZ(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=dZ(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return gZ(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&cZ(e)&&(this.#i=null);let t=cZ(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=hZ(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},NZ=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function PZ(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function FZ(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function IZ(e,t){return t?`${e}/`:e}function LZ(e,t=null){let n=NZ(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=PZ(t.path);if(e==null)continue;let n=IZ(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of FZ(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var RZ=e=>e.trim().toLowerCase(),zZ=e=>e.split(`/`).at(-1)??e,BZ=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function VZ(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function HZ(e){let t=QK(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(RZ(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let n=zZ(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return VZ(c,e);for(let[t,n]of a)if(s.includes(t))return VZ(n,e);let l=BZ(n);for(let t of l){let n=i.get(t);if(n!=null)return VZ(n,e)}let u=XK(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:JK(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:VZ(s,e)}}}var UZ,WZ,GZ,KZ,qZ,JZ,YZ,XZ,ZZ,QZ,$Z={},eQ=[],tQ=Array.isArray,nQ=eQ.slice,rQ=Object.assign;function iQ(e){e&&e.parentNode&&e.remove()}function aQ(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?nQ.call(arguments,2):n),oQ(e,o,r,i,null)}function oQ(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++WZ,__i:-1,__u:0};return i==null&&UZ.vnode!=null&&UZ.vnode(a),a}function sQ(e){return e.children}function cQ(e,t){this.props=e,this.context=t,this.__g=0}function lQ(e,t){if(t==null)return e.__?lQ(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?lQ(e):null}function uQ(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return uQ(e)}}function dQ(e){(8&e.__g||!(e.__g|=8)||!GZ.push(e)||qZ++)&&KZ==UZ.debounceRendering||((KZ=UZ.debounceRendering)||queueMicrotask)(fQ)}function fQ(){for(var e,t,n,r,i,a,o,s,c=1;GZ.length;)GZ.length>c&&GZ.sort(JZ),e=GZ.shift(),c=GZ.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=rQ({},r)).__v=r.__v+1,UZ.vnode&&UZ.vnode(n),bQ(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??lQ(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,SQ(a,n,o),n.__e!=i&&uQ(n)));qZ=0}function pQ(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||eQ,b=t.length;for(c=mQ(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?$Z:y[m.__i]||$Z,m.__i=f,_=bQ(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&TQ(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=hQ(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function mQ(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?oQ(null,o,null,null,null):tQ(o)?oQ(sQ,{children:o},null,null,null):o.constructor==null&&o.__b>0?oQ(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=gQ(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=lQ(s)),EQ(s,s));return r}function hQ(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=hQ(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=lQ(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function gQ(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function _Q(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function vQ(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||_Q(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||_Q(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(YZ,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=XZ,e.addEventListener(t,a?QZ:ZZ,a)):e.removeEventListener(t,a?QZ:ZZ,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function yQ(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=XZ++;else if(t.u<n.l)return;return n(UZ.event?UZ.event(t):t)}}}function bQ(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=UZ.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new M(v,x):(t.__c=f=new cQ(v,x),f.constructor=M,f.render=DQ),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=rQ({},f.__s)),rQ(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=UZ.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=rQ({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===sQ&&d.key==null&&(E=CQ(d.props.children)),s=pQ(e,tQ(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)iQ(a[j]);xQ(t)}else t.__e=n.__e,t.__k=n.__k,e.then||xQ(t);UZ.__e(e,t,n)}else s=t.__e=wQ(n.__e,t,n,r,i,a,o,c,l,u);return(d=UZ.diffed)&&d(t),128&t.__u?void 0:s}function xQ(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(xQ)}function SQ(e,t,n){for(var r=0;r<n.length;r++)TQ(n[r],n[++r],n[++r]);UZ.__c&&UZ.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){UZ.__e(e,t.__v)}})}function CQ(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:tQ(e)?e.map(CQ):rQ({},e)}function wQ(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(UZ.__m&&UZ.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=nQ.call(e.childNodes),v=n.props||$Z,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;vQ(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||vQ(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),pQ(b==`template`?e.content:e,tQ(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&lQ(n,0),s,c,l),a!=null)for(u=a.length;u--;)iQ(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||vQ(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&vQ(e,u,g,v[u],i))}return e}function TQ(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){UZ.__e(e,n)}}function EQ(e,t,n){var r,i;if(UZ.unmount&&UZ.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||TQ(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){UZ.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&EQ(r[i],t,n||typeof e.type!=`function`);n||iQ(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function DQ(e,t,n){return this.constructor(e,n)}function OQ(e,t){var n,r,i,a;t==document&&(t=document.documentElement),UZ.__&&UZ.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=aQ(sQ,null,[e]),i=[],a=[],bQ(t,e,r||$Z,$Z,t.namespaceURI,r?null:t.firstChild?nQ.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),SQ(i,e,a)}function kQ(e,t){e.__u|=32,OQ(e,t)}UZ={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw qZ=0,e}},WZ=0,cQ.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=rQ({},this.state);typeof e==`function`&&(e=e(rQ({},n),this.props)),e&&rQ(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),dQ(this))},cQ.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),dQ(this))},cQ.prototype.render=sQ,GZ=[],qZ=0,JZ=function(e,t){return e.__v.__b-t.__v.__b},YZ=/(PointerCapture)$|Capture$/i,XZ=0,ZZ=yQ(!1),QZ=yQ(!0);var AQ=0;Array.isArray;function jQ(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--AQ,__i:-1,__u:0,__source:i,__self:a};return UZ.vnode&&UZ.vnode(l),l}var MQ=16,NQ=16,PQ={};function FQ({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=PQ[e]??{width:MQ,height:NQ},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`,h=o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`};return jQ(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...h,viewBox:m,width:f,height:p,children:jQ(`use`,{href:c})})}var IQ=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},LQ=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},RQ=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},zQ=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},BQ=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},VQ=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function HQ({children:e,marker:t,variant:n=`default`}){"use no memo";let r=n===`fade`;return jQ(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:jQ(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):r?jQ(`span`,{"data-truncate-fade":!0}):t})})}function UQ(e){"use no memo";let{mode:t,children:n}=e;return jQ(`div`,{children:[jQ(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?jQ(`span`,{children:n}):n}),jQ(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?jQ(`span`,{children:n}):n})]})}function WQ({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=jQ(UQ,{mode:t,children:e},`content`),o=jQ(HQ,{marker:n,mode:t,variant:r},`marker`),s=jQ(`div`,{"data-truncate-fill":!0},`fill`);return jQ(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:jQ(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function GQ({children:e,...t}){"use no memo";return jQ(WQ,{mode:`truncate`,...t,children:e})}function KQ({children:e,...t}){"use no memo";return jQ(WQ,{mode:`fruncate`,...t,children:e})}function qQ({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=jQ(GQ,{...s,children:t[0]}),l=jQ(KQ,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return jQ(`div`,{className:a,style:o});if(e.length<i)return jQ(n===`end`?KQ:GQ,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=IQ:r===`extension`?t=LQ:r===`leaf-path`&&(t=RQ);else if(typeof r==`number`)t=zQ,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=BQ:e===`first`&&(t=VQ)}else typeof r==`function`&&(t=r);t??=IQ;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=jQ(GQ,{...s,..._,children:f}),l=jQ(KQ,{...s,...v,children:p})}return jQ(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[jQ(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),jQ(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var JQ={endIndex:-1,startIndex:-1};function YQ(e,t,n){return Math.min(Math.max(e,t),n)}function XQ(e,t){return e<0||t<e?JQ:{endIndex:t,startIndex:e}}function ZQ(e){return e.startIndex<0||e.endIndex<e.startIndex}function QQ(e,t){return ZQ(e)?0:(e.endIndex-e.startIndex+1)*t}function $Q(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function e$(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function t$(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function n$(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function r$(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function i$(e,t,n){if(e.length===0||t<=0)return[];let r=r$(e),i=t$(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=n$(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function a$(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=YQ(t.scrollTop,0,o),c=t.stickyRows??i$(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=$Q(s,n,t.itemHeight),m=$Q(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?JQ:XQ(m,e$(u+d,n,t.itemHeight)),y=g+1,b=ZQ(v)?JQ:XQ(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=QQ(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:ZQ(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var o$={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},s$={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},c$=`Contains git status items`;function l$(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function u$(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return l$({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function d$(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function f$(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function p$(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function m$(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function h$(e,t){return e!=null&&e>0?e:t}function g$(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function _$(e,t,n,r,i=0){let a=l$({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function v$(e,t,n,r,i,a,o=0){let s=u$({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function y$(e,t,n,r,i,a){let o=d$({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function b$(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function x$(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function S$({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return jQ(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function C$(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function w$(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var T$,E$,D$,O$,k$=Object.is,A$=0,j$=[],M$=UZ,N$=M$.__b,P$=M$.__r,F$=M$.diffed,I$=M$.__c,L$=M$.unmount,R$=M$.__;function z$(e,t){M$.__h&&M$.__h(E$,e,A$||t),A$=0;var n=E$.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function B$(e){return A$=1,V$($$,e)}function V$(e,t,n){var r=z$(T$++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):$$(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);k$(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=E$,!E$.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,k$(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};E$.__f=!0;var a=E$.shouldComponentUpdate,o=E$.componentWillUpdate;E$.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},E$.shouldComponentUpdate=i}return r.__N||r.__}function H$(e,t){var n=z$(T$++,3);!M$.__s&&Q$(n.__H,t)&&(n.__=e,n.u=t,E$.__H.__h.push(n))}function U$(e,t){var n=z$(T$++,4);!M$.__s&&Q$(n.__H,t)&&(n.__=e,n.u=t,E$.__h.push(n))}function W$(e){return A$=5,G$(function(){return{current:e}},[])}function G$(e,t){var n=z$(T$++,7);return Q$(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function K$(e,t){return A$=8,G$(function(){return e},t)}function q$(){for(var e;e=j$.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(X$),e.__H.__h.forEach(Z$),e.__H.__h=[]}catch(t){e.__H.__h=[],M$.__e(t,e.__v)}}M$.__b=function(e){E$=null,N$&&N$(e)},M$.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),R$&&R$(e,t)},M$.__r=function(e){P$&&P$(e),T$=0;var t=(E$=e.__c).__H;t&&(D$===E$?(t.__h=[],E$.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(X$),t.__h.forEach(Z$),t.__h=[],T$=0)),D$=E$},M$.diffed=function(e){F$&&F$(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(j$.push(t)!==1&&O$===M$.requestAnimationFrame||((O$=M$.requestAnimationFrame)||Y$)(q$)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),D$=E$=null},M$.__c=function(e,t){t.some(function(e){try{e.__h.forEach(X$),e.__h=e.__h.filter(function(e){return!e.__||Z$(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],M$.__e(n,e.__v)}}),I$&&I$(e,t)},M$.unmount=function(e){L$&&L$(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{X$(e)}catch(e){t=e}}),n.__H=void 0,t&&M$.__e(t,n.__v))};var J$=typeof requestAnimationFrame==`function`;function Y$(e){var t,n=function(){clearTimeout(r),J$&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);J$&&(t=requestAnimationFrame(n))}function X$(e){var t=E$,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),E$=t}function Z$(e){var t=E$;e.__c=e.__(),E$=t}function Q$(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!k$(t,e[n])})}function $$(e,t){return typeof t==`function`?t(e):t}function e1(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:jQ(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return jQ(sQ,{children:[jQ(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:jQ(GQ,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function t1(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function n1(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function r1(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function i1({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=a$(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:r1(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?r1(u,1,t,o):i&&r<=0&&c.length>0?i$(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var a1=400,o1=10,s1=40,c1=18;function l1(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?u1(e,t,n):a instanceof HTMLElement?a:null}function u1(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function d1(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function f1(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function p1(){return navigator.vendor!==`Apple Computer, Inc.`}function m1(e,t){let n=e-t.top;if(n<s1)return-Math.ceil((s1-Math.max(0,n))/s1*c1);let r=t.bottom-e;return r<s1?Math.ceil((s1-Math.max(0,r))/s1*c1):0}function h1(e,t){if(e!=null){let t=o$[e];return t==null?null:{text:t,title:s$[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:c$}:null}function g1(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function _1(e){return e!=null&&`toggle`in e}function v1(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function y1(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function b1(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function x1(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function S1(e,t){return t&&x1(e)||(e.ctrlKey||e.metaKey)&&v1(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var C1=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function w1(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function T1(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function E1(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function D1(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function O1(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function k1(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function A1(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function j1(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function M1(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=j1(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function N1(e,t){return{kind:e.kind,name:n1(e),path:t}}function P1(e){return e==null?void 0:`${e}__tree`}function F1(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function I1(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function L1(e,t){if(e==null)return null;if(`text`in e)return jQ(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?I1(e.icon)?t(e.icon):{name:e.icon}:I1(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return jQ(`span`,{title:e.title,children:jQ(FQ,{...n})})}function R1(e){e!=null&&f$(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function z1(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=t1(e);return jQ(sQ,{children:[e.depth>0?jQ(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>jQ(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,jQ(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?jQ(FQ,{...t(`file-tree-icon-chevron`)}):jQ(FQ,{...t(`file-tree-icon-file`,u)})}),jQ(`div`,{"data-item-section":`content`,children:e.isFlattened?e1(e,c,a):c??jQ(qQ,{minimumLength:5,split:`extension`,children:e.name})}),i?jQ(`div`,{"data-item-section":`decoration`,children:r==null?null:L1(r,t)}):null,s?jQ(`div`,{"data-item-section":`git`,children:L1(o,t)}):null,n?jQ(`div`,{"data-item-section":`action`,children:l?jQ(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:jQ(FQ,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function B1(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=t1(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??g1(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=h1(z,B),U=S&&w,W=V!=null||x||U,ee=U&&T===`always`,te=a.getPath()===P,ne=te?a.getValue():``,re=R||!te?null:jQ(S$,{ref:D,ariaLabel:`Rename ${n1(t)}`,isFlattened:t.isFlattened,value:ne,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ie=z1(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:re,showDecorativeActionAffordance:ee}),ae={...C$({ariaLabel:n1(t),domId:t.isFocused?F1(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:U,contextMenuButtonVisibility:U?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:B,effectiveGitStatus:z,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(P),j(t,P,{anchorRect:E1(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&te?jQ(`div`,{...ae,children:ie}):jQ(`button`,{...ae,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:ie})}function V1(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(t1(e))).map((n,r)=>B1(e,n,t.start+r))}function H1({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=tq,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=W$(null),v=W$(null),y=W$(!1),b=W$(null),x=W$(null),S=W$(null),C=W$(null),w=W$(null),T=W$(new Map),E=W$(new Map),D=W$(()=>{}),O=W$(null),k=W$(0),A=W$(!1),j=W$(null);j.current!==t&&(A.current=!1,j.current=t);let M=W$(!1),N=W$(null),P=W$(null),F=W$(!1),I=W$(null),L=W$(null),R=W$(null),z=W$(null),B=W$(null),V=W$(null),H=W$(null),U=W$(null),W=W$(!1),ee=W$(null),te=W$(null),ne=W$(null),re=W$(null),ie=G$(()=>new Map,[]),[,ae]=B$(0),[oe,G]=B$(null),[se,K]=B$(null),[ce,le]=B$(null),[ue,de]=B$(null),[fe,pe]=B$(0),[me,he]=B$(null),ge=W$(me);ge.current=me;let _e=W$(null),ve=W$(null),ye=W$(null),be=W$(null),xe=W$(null),Se=W$(!1),Ce=()=>{ve.current=null,ye.current=null,be.current=null},we=(e,t)=>{ve.current=e,ye.current=null,be.current=t==null?null:{path:e,scrollTop:t}},Te=(e,t)=>{ve.current=null,ye.current={path:e,viewportOffset:t},be.current=null},Ee=W$(d===`retain`&&t.isSearchOpen()),[De,Oe]=B$(p);H$(()=>{p||Oe(!1)},[p]);let ke=W$(!1),Ae=K$(()=>{ke.current=!0,Oe(e=>e&&!1)},[]),[je,Me]=B$(()=>i1({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ne,Pe]=B$(!1);H$(()=>{Pe(!0)},[]);let Fe=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ie=e?.contextMenu?.triggerMode??(Fe?`right-click`:`both`),q=Ie===`both`||Ie===`button`,J=e?.contextMenu?.buttonVisibility??`when-needed`,Le=Ie===`both`||Ie===`right-click`;U$(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;xe.current=t,K(t),de(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Se.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Re=K$((e,t)=>{O1(T.current,e,t)},[]),ze=K$((e,t)=>{O1(E.current,e,t)},[]),Be=K$(e=>{x.current=e},[]),Ve=K$(e=>k1(e,E.current,T.current),[]),He=n!=null||r!=null||i!=null,{resolveIcon:Ue}=G$(()=>HZ(a),[a]),We=t[EZ](),Ge=We.getPath(),Ke=Ge!=null,qe=t.isSearchOpen(),Je=t.getSearchValue(),Ye=t.getFocusedPath(),Xe=t.getFocusedIndex(),Ze=t.getScrollRequest(),Qe=t.isDragAndDropEnabled(),$e=t.getDragSession(),et=G$(()=>$e==null?null:new Set($e.draggedPaths),[$e]),tt=$e?.target??null,nt=$e?.primaryPath??null,rt=P1(o),{overlayHeight:it,overlayRows:at,snapshot:ot,visibleRows:st}=je,ct=ot.physical.viewportHeight,lt=G$(()=>({end:ot.window.endIndex,start:ot.window.startIndex}),[ot.window.endIndex,ot.window.startIndex]),ut=at,dt=ot.sticky.rows,ft=ot.physical.totalHeight,pt=ot.sticky.height,mt=G$(()=>new Set(dt.map(e=>t1(e.row))),[dt]),ht=Xe>=0&&Xe>=lt.start&&Xe<=lt.end,gt=K$((e,t)=>u?.({item:N1(e,t),row:e})??null,[u]),_t=K$(e=>f$(e==null?null:T.current.get(e)??null)?!0:f$(S.current),[]),vt=K$(e=>{_t(t.focusNearestPath(e))},[t,_t]),yt=W$(vt);yt.current=vt;let bt=W$(!0),xt=W$(()=>{}),St=K$((t=!0)=>{let n=ge.current;n!=null&&(bt.current=bt.current&&t,he(null),e?.contextMenu?.onClose?.(),bt.current&&vt(n.path))},[e?.contextMenu,vt]);xt.current=St;let Ct=K$(e=>{let t=e==null?null:D1(S.current,e);le(e=>e===t?e:t)},[]),wt=K$((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Ve(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;we(n,e?.scrollTop??null),M.current=!0,G(e=>e===n?e:n)}i.focus(),Ct(a),bt.current=!0,he({anchorRect:r?.anchorRect??null,item:N1(e,n),path:n,source:r?.source??`keyboard`})},[t,Ve,Ct]),Tt=K$(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=m$(e,ct);I.current=Xe<0||e==null?null:Math.max(0,Math.min(Xe*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(de(`focus`),ae(e=>e+1))}},[t,Xe,s,l,ct]),Et=K$((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=m$(i,ct),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:i1({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,y$(i,a,s,l,u,d),D.current(),_e.current=n?e:null,!0},[t,s,c,ct,h]),Dt=()=>y.current===!0||re.current!=null||W.current===!0,Ot=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),kt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},At=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},jt=()=>{V.current?.remove(),V.current=null},Mt=()=>{kt(L.current),L.current=null,B.current=null},Nt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Pt=()=>{U.current?.(),U.current=null,re.current!=null&&(clearTimeout(re.current),re.current=null),W.current=!1,ee.current=null,ne.current=null,te.current!=null&&(te.current.setAttribute(`draggable`,`true`),te.current.style.removeProperty(`touch-action`),te.current=null),jt(),At(),Mt(),H.current=null},Ft=(e,n)=>{let r=S.current?.getRootNode(),i=d1(l1(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},It=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){At();return}let r=t.getItem(e.directoryPath),i=_1(r)?r:null;if(i==null||i.isExpanded()){At();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(At(),R.current=a,z.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Lt=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=m1(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),It(Ft(e.clientX,e.clientY)),L.current=Ot(Lt)},Rt=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=Ot(Lt)},zt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Pt(),jt(),At(),Mt(),t.startDrag(r)===!1){e.preventDefault();return}if(H.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),p1())){let t=f1(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Nt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Bt=()=>{jt(),At(),Mt(),H.current=null,t.cancelDrag()},Vt=(e,n,r)=>{if(re.current!=null||W.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ne.current={clientX:i.clientX,clientY:i.clientY},te.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!W.current;re.current!=null&&(clearTimeout(re.current),re.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),U.current===o&&(U.current=null),t&&(a.setAttribute(`draggable`,`true`),te.current===a&&(te.current=null),ne.current=null)},s=e=>{let t=e.touches[0],n=ne.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=o1*o1||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,re.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),te.current===a&&(te.current=null),ne.current=null;return}W.current=!0,te.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),H.current=n;let e=a.getBoundingClientRect(),s=f1(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Nt(s),V.current=s,ee.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=ee.current;n!=null&&V.current!=null&&(V.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),It(Ft(t.clientX,t.clientY)),Rt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Ft(n.clientX,n.clientY),t.completeDrag(),Pt()},u=()=>{t.cancelDrag(),Pt()};U.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},a1)},Ht=e=>{if(me!=null){if(e.key===`Escape`){St(),e.preventDefault(),e.stopPropagation();return}C1.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(We.isActive()){if(e.key===`Escape`)We.cancel();else if(e.key===`Enter`)We.commit();else return;de(`focus`),ae(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Tt(Ye??void 0),e.preventDefault(),e.stopPropagation();return}if(qe){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=m$(n,ct);I.current=Xe<0||n==null?null:Math.max(0,Math.min(Xe*s-n.scrollTop,Math.max(0,r-s))),F.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;de(`focus`),ae(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&y1(e)){t.openSearch(e.key),ae(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Fe&&x1(e),r=S1(e,Fe),i=r&&S.current!=null?p$(S.current):null,a=r?new Set(A1(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Ye&&a.has(o)){let e=C.current;we(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=_1(p)?p:null,h=u!=null&&(mt.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=k1(u,E.current,T.current);e==null||n==null?y=!1:wt(e,u)}else if((e.ctrlKey||e.metaKey)&&v1(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;de(`focus`);let b=t.getFocusedPath(),x=b!=null&&(mt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))we(b,v?.scrollTop??null),M.current=!0,G(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Te(b,M1(S.current,v,i,u,s,pt,ct)),M.current=!0,G(e=>e===b?e:b)):Ce()}ae(e=>e+1),e.preventDefault(),e.stopPropagation()};U$(()=>{if(!(!f||!qe)){if(Ee.current){Ee.current=!1;return}f$(w.current)}},[qe,f]),U$(()=>{let e=x.current;switch(x$({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:Ge})){case`reset`:P.current=null;return;case`reveal-canonical`:Ge!=null&&Et(Ge,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(_e.current=null,P.current=Ge,f$(e),e.select());return}},[lt.end,lt.start,Ge,Et,mt]),U$(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=p$(e)?.dataset.itemPath??null;G(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,p$(e)!=null){r();return}M.current=!1,G(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,G(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;G(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),U$(()=>{let e=S.current;e!=null&&(ot.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[ot.physical.scrollTop]),U$(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=m$(n,g);let a=()=>{let e=t.getVisibleCount(),r=h$(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Me(i1({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=h$(O.current,g),i=t.getVisibleRows(e,e)[0]??null;_$(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=!1,l=t.subscribe(()=>{o?ae(e=>e+1):o=!0,a()}),u=()=>{Se.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,pe(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||Se.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),ge.current!=null&&y.current&&xt.current(),Se.current===!0){y.current=!1;return}K(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:g$(e[0]))??m$(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),U$(()=>{Fe||me==null||St(!1)},[St,Fe,me]);let Ut=G$(()=>me==null?null:`${me.path}::${me.source}`,[me]);U$(()=>{if(Ut==null){m?.clearSlotContent(AG);return}let t=ge.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??T1(n.getBoundingClientRect()),close:e=>{xt.current(e?.restoreFocus??!0)},restoreFocus:()=>{bt.current&&yt.current(ge.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(AG,i),e?.contextMenu?.onOpen?.(t.item,r),R1(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&R1(i)}),()=>{m?.clearSlotContent(AG)}},[Ut,e?.contextMenu,m]),U$(()=>{me!=null&&t.getItem(me.path)==null&&St()},[St,me,t]),U$(()=>{if(me==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(w1(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&St())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),St())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[St,me]),U$(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=Ye;return}let r=Ye==null?null:T.current.get(Ye)??null,i=p$(n),a=i?.dataset.itemPath??null,o=Ke&&x.current===i,c=f&&w.current===i,l=F.current&&!qe,u=I.current??0,d=_e.current,p=ve.current,m=ye.current,g=be.current,_=i!=null,v=M.current||_,y=N.current!==Ye,b=p!=null&&p===Ye&&Ye!=null,E=!1,O=!1;if(Ze!=null&&Ze.id!==k.current){k.current=Ze.id;let n=Ze.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,ct-s))):pt;E=!0,O=v$(e,n,s,ct,ft,Ze.offset,t)}t.clearScrollRequest(Ze.id)}let A=!E&&l&&y$(e,Xe,s,ct,ft,u),j=!E&&d!=null&&d===Ye&&y$(e,Xe,s,ct,ft,pt),P=!E&&m!=null&&m.path===Ye&&y$(e,Xe,s,ct,ft,m.viewportOffset),L=!E&&g!=null&&g.path===Ye&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==Ye&&!b&&_$(e,Xe,s,ct,pt))&&D.current(),E){N.current=Ye;return}if(!v){N.current=Ye;return}if(o){N.current=Ye;return}if(c&&!l){N.current=Ye;return}if(r==null){l&&Xe>=0&&(y$(e,Xe,s,ct,ft,u),D.current()),N.current=Ye;return}(y||l||d===Ye||p===Ye||m?.path===Ye||g?.path===Ye||a==null||a!==Ye)&&(f$(r),d===Ye&&(_e.current=null),p===Ye&&(ve.current=null),m?.path===Ye&&(ye.current=null),g?.path===Ye&&(be.current=null),F.current=!1,I.current=null),N.current=Ye},[t,Xe,Ye,ht,s,Ke,qe,lt,ct,f,Ze,h,pt,ft,st]);let Wt=Xe>=0&&Xe>=ot.visible.startIndex&&Xe<=ot.visible.endIndex,Gt=Ye!=null&&ut.some(e=>t1(e.row)===Ye),Kt=Wt||Gt,qt=q&&M.current===!0&&Kt?Ye:null,Jt=ue===`pointer`?se:null,Yt=me?.path??xe.current??Jt??qt??se,Xt=me?.source===`right-click`;U$(()=>{y.current&&me==null||Ct(Ve(Yt))},[me,Ve,lt,ct,fe,ut,Yt,Ct,st]);let Zt=K$(e=>{if(y.current||w1(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&de(e=>e===`pointer`?e:`pointer`),K(e=>e===i?e:i)},[]),Qt=K$(()=>{K(null)},[]);U$(()=>{if(!Qe)return;let e=()=>{Pt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Pt(),t.cancelDrag()}},[t,Qe]);let $t=e=>{if(!Qe||t.getDragSession()==null||W.current)return;let n=d1(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),It(t.getDragSession()?.target??null),Rt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},en=e=>{if(!Qe||t.getDragSession()==null||W.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(At(),Mt(),t.setDragTarget(null))},tn=e=>{!Qe||t.getDragSession()==null||W.current||(e.preventDefault(),Ft(e.clientX,e.clientY),t.completeDrag(),jt(),At(),Mt(),H.current=null)},nn=ot.window.height,rn=ot.window.offsetTop,an=Math.min(0,ct-nn),on=Math.min(0,ct-nn-pt),sn=oe===Ye||F.current,cn=Ye!=null&&sn&&!ht&&Xe>=0?st[Xe]??t.getVisibleRows(Xe,Xe)[0]??null:null,ln=cn==null?null:b$(Xe,s,lt,nn),un=H.current,dn=nt!=null&&un!=null&&un.path===nt&&un.index>=lt.start&&un.index<=lt.end,fn=nt!=null&&un!=null&&un.path===nt&&!dn&&un.path!==cn?.path?un:null,pn=fn==null?null:b$(fn.index,s,lt,nn),mn=b1((Xe>=0?st[Xe]??t.getVisibleRows(Xe,Xe)[0]??null:null)?.ancestorPaths.at(-1)??null),hn=qe&&Ye!=null?F1(o,Ye,!ht):void 0,gn=me?.path??(qe?Ye:oe),_n=me?.path??se,vn=Ve(Yt),yn=Fe&&q&&!Xt&&!Ke&&vn!=null&&ce!=null&&Yt!=null,bn=Fe&&(yn||me!=null),xn=me?.anchorRect,Sn=xn==null&&vn!=null&&ce!=null&&(me!=null||yn)?ce:null,Cn=xn==null?Sn==null?void 0:{top:`${Sn}px`}:{left:`${xn.left}px`,position:`fixed`,right:`auto`,top:`${xn.top}px`},wn=Xt?{opacity:`0`}:void 0,Tn=K$((e,n,r,i)=>{let a=w$({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:qe,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=ot.visible.startIndex&&n.index<=ot.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,G(e=>e===c?e:c),de(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Et(c,{targetOffset:`sticky-parents`})},[t,qe,ot.visible.endIndex,ot.visible.startIndex,Et]),En=()=>{if(y.current||!q||Yt==null||vn==null)return;let e=t.getItem(Yt);e!=null&&(Ct(vn),bt.current=!0,he({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:vn.getAttribute(`aria-label`)??Yt,path:e.getPath()},path:e.getPath(),source:`button`}))},Dn={contextHoverPath:_n,contextMenuButtonTriggerEnabled:q,contextMenuButtonVisibility:J,contextMenuEnabled:Fe,contextMenuRightClickEnabled:Le,contextMenuTriggerMode:Ie,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Qe,draggedPathSet:et,dragTarget:tt,gitLaneActive:He,gitStatusByPath:n,handleRowDragEnd:Bt,handleRowDragStart:zt,handleRowTouchStart:Vt,ignoredGitDirectories:r,ignoredInheritanceCache:ie,instanceId:o,itemHeight:s,onKeyDown:Ht,onRowClick:Tn,openContextMenuForRow:wt,registerButton:Re,registerRenameInput:Be,renameView:We,renderDecorationForRow:gt,resolveIcon:Ue,shouldSuppressContextMenu:Dt,visualFocusPath:gn},On={...Dn,registerButton:ze};return jQ(`div`,{ref:S,id:rt,"data-file-tree-context-menu-button-visibility":Fe&&q?J:void 0,"data-file-tree-context-menu-trigger-mode":Fe?Ie:void 0,"data-file-tree-has-context-menu-action-lane":Fe&&q?`true`:void 0,"data-file-tree-has-git-lane":He?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:Qe?en:void 0,onDragOver:Qe?$t:void 0,onDrop:Qe?tn:void 0,onKeyDown:Ht,onPointerLeave:Fe?Qt:void 0,onPointerOver:Fe?Zt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[jQ(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:mn}}),jQ(`slot`,{name:kG,"data-type":`header-slot`}),f?jQ(`div`,{"data-file-tree-search-container":!0,"data-open":qe?`true`:`false`,children:jQ(`input`,{ref:w,"aria-activedescendant":hn,"aria-controls":rt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":De?`true`:void 0,value:Je,onBlur:()=>{d===`retain`&&!ke.current||t.closeSearch()},onFocus:Ae,onPointerDown:Ae,onInput:e=>{Ae();let n=e.currentTarget;t.setSearch(n.value)}})}):null,jQ(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ne&&ut.length>0?jQ(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:jQ(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${it}px`},children:ut.map((e,t)=>B1(On,e.row,`sticky:${t1(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ut.length-t}`}}))})}):null,jQ(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${ft}px`},children:[jQ(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${rn}px`}}),jQ(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${nn}px`,top:`${an}px`,bottom:`${on}px`},children:[V1(Dn,lt,mt),cn!=null&&ln!=null?B1(Dn,cn,`parked:${cn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:nt===cn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${ln}px`}}):null,fn!=null&&pn!=null?B1(Dn,fn,`parked-drag:${fn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${pn}px`}}):null]})]})]}),Fe?jQ(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":bn?`true`:`false`,style:Cn,children:[jQ(`button`,{ref:v,type:`button`,"data-type":jG,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":me==null?`false`:`true`,"data-visible":yn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),me!=null){St();return}En()},tabIndex:-1,style:wn,children:jQ(FQ,{...Ue(`file-tree-icon-ellipsis`)})}),me==null?null:jQ(`slot`,{name:AG})]}):null,me==null?null:jQ(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),St()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),St()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var U1={hydrateRoot:(e,t)=>{kQ(aQ(H1,t),e)},renderRoot:(e,t)=>{OQ(aQ(H1,t),e)},unmountRoot:e=>{OQ(null,e)}};function W1(e,t){U1.renderRoot(e,t)}function G1(e,t){U1.hydrateRoot(e,t)}function K1(e){U1.unmountRoot(e)}var q1=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},J1=`__c`,Y1=`__k`,X1=`__d`,Z1=`__s`,Q1=/[\s\n\\/='"\0<>]/,$1=/^(xlink|xmlns|xml)([A-Z])/,e0=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,t0=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,n0=new Set([`draggable`,`spellcheck`]);function r0(e){e.__g===void 0?e[X1]=!0:e.__g|=8}function i0(e){e.__g===void 0?e[X1]=!1:e.__g&=-9}function a0(e){return e.__g===void 0?!0===e[X1]:!!(8&e.__g)}var o0=/["&<]/;function s0(e){if(e.length===0||!1===o0.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var c0={},l0=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),u0=/[A-Z]/g;function d0(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:c0[n]||(c0[n]=n.replace(u0,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||l0.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function f0(){this.__d=!0}function p0(e,t){return{__v:e,context:t,props:e.props,setState:f0,forceUpdate:f0,__d:!0,__h:[]}}function m0(e,t,n){if(!e.s){if(n instanceof h0){if(!n.s)return void(n.o=m0.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(m0.bind(null,e,t),m0.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var h0=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{m0(r,1,a(this.v))}catch(e){m0(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?m0(r,1,t?t(i):i):n?m0(r,1,n(i)):m0(r,2,i)}catch(e){m0(r,2,e)}},r},e}(),g0,_0,v0,y0,b0={},x0=Array.isArray,S0=Object.assign,C0=``,w0=`<!--$s-->`,T0=`<!--/$s-->`;function E0(e,t){var n,r=e.type,i=!0;return e[J1]?(i=!1,(n=e[J1]).state=n[Z1]):n=new r(e.props,t),e[J1]=n,n.__v=e,n.props=e.props,n.context=t,r0(n),n.state??=b0,n[Z1]??(n[Z1]=n.state),r.getDerivedStateFromProps?n.state=S0({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[Z1]===n.state?n.state:n[Z1]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),v0&&v0(e),n.render(n.props,n.state,t)}function D0(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===C0)return C0;var s=typeof e;if(s!=`object`)return s==`function`?C0:s==`string`?s0(e):e+C0;if(x0(e)){var c,l=C0;i[Y1]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=D0(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=C0,x0(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return C0;e.__=i,g0&&g0(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===sQ){if(`tpl`in g){for(var x=C0,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!x0(C)?x+=C:x+=D0(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+s0(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=E0(e,b),y=e[J1];else{e[J1]=y=p0(e,b);for(var E=0;a0(y)&&E++<25;){i0(y),v0&&v0(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}r0(y)}if(y.getChildContext!=null&&(t=S0({},t,y.getChildContext())),T&&UZ.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===sQ&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return D0(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[Z1]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,b0),a0(y)?(v=E0(e,t),(y=e[J1]).getChildContext!=null&&(t=S0({},t,y.getChildContext())),D0(v=v!=null&&v.type===sQ&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):C0}finally{_0&&_0(e),y0&&y0(e)}}}v=v!=null&&v.type===sQ&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=D0(v,t,n,r,e,a,o);return _0&&_0(e),UZ.unmount&&UZ.unmount(e),e._suspended?typeof D==`string`?w0+D+T0:x0(D)?(D.unshift(w0),D.push(T0),D):D.then(function(e){return w0+e+T0}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return D0(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=UZ.__e;return k&&k(i,e),C0}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=D0(v,t,n,r,e,a,o);return e._suspended?w0+s+T0:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=C0;for(var N in g){var P=g[N];if(typeof(P=k0(P)?P.value:P)!=`function`||N===`class`||N===`className`){switch(N){case`children`:A=P;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;N=`for`;break;case`className`:if(`class`in g)continue;N=`class`;break;case`defaultChecked`:N=`checked`;break;case`defaultSelected`:N=`selected`;break;case`defaultValue`:case`value`:switch(N=`value`,h){case`textarea`:A=P;continue;case`select`:r=P;continue;case`option`:r!=P||`selected`in g||(j+=` selected`)}break;case`dangerouslySetInnerHTML`:M=P&&P.__html;continue;case`style`:typeof P==`object`&&(P=d0(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if($1.test(N))N=N.replace($1,`$1:$2`).toLowerCase();else{if(Q1.test(N))continue;N[4]!==`-`&&!n0.has(N)||P==null?n?t0.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):e0.test(N)&&(N=N.toLowerCase()):P+=C0}}P!=null&&!1!==P&&(j=!0===P||P===C0?j+` `+N:j+` `+N+`="`+(typeof P==`string`?s0(P):P+C0)+`"`)}}if(Q1.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=s0(A):A!=null&&!1!==A&&!0!==A&&(M=D0(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),_0&&_0(e),y0&&y0(e),!M&&O0.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return x0(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var O0=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function k0(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var A0=0;function j0(e){return e!=null&&e.length>0?e:(A0+=1,`pst_ft_${A0}`)}function M0({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??tq)}function N0(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function P0(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function F0(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var I0=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new q1;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=j0(a),this.#p=LZ(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=eq(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new MZ({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(K1(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),W1(t.wrapper,this.#w()))}setGitStatus(e){this.#p=LZ(e,this.#p);let t=this.#T();t!=null&&W1(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),W1(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),G1(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),W1(r,this.#w())}#C(){return{initialViewportHeight:M0({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(kG,e());return}this.#l.setSlotHtml(kG,this.#e?.header?.html??null)}#k(e){let t=F0(e).find(e=>P0(e)),n=N0(qK(QK(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=F0(e),n=t.find(e=>P0(e)),r=t.filter(e=>e!==n),i=QK(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=N0(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=QK(this.#m);t.colored&&YK(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${TG}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(TG,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=aq(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return dq(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}};function L0(e){let[t]=(0,q.useState)(()=>new I0(e)),n=(0,q.useRef)({timeout:null,model:t});return(0,q.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}function R0(e){let t=[];for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(e.length===0)continue;let r=e.startsWith(`./`)?e.slice(2):e;r.length!==0&&t.push(r)}let n=new Set,r=[];for(let e of t)n.has(e)||(n.add(e),r.push(e));let i=new Set;for(let e of r){let t=e.split(`/`);for(let e=1;e<t.length;e++)i.add(t.slice(0,e).join(`/`))}let a=[],o=[];for(let e of r)i.has(e)?o.push(e):a.push(e);return{paths:a,dropped:o}}function z0(e){let{paths:t}=R0(e),n=new Set;for(let e of t){let t=e.split(`/`);for(let e=1;e<t.length;e++)n.add(t.slice(0,e).join(`/`))}return Array.from(n)}var B0=class extends q.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.error(`FileTree crashed:`,e,t.componentStack)}render(){return this.state.hasError?(0,J.jsxs)(`div`,{style:{padding:16,textAlign:`center`,color:`var(--text-muted, #888)`},children:[(0,J.jsx)(`p`,{children:`⚠️ File tree failed to render.`}),(0,J.jsx)(`p`,{style:{fontSize:`0.85em`},children:`Reload the review to retry.`})]}):this.props.children}},V0=(0,q.memo)(function({files:e,activeFile:t,commentCounts:n,viewedFiles:r,untrackedFiles:i,onFileClick:a,collapsed:o,onToggleCollapse:s,appliedExtensions:c=[],onApplyExtensions:l,chipFilter:u=`all`,onChipFilterChange:d,sinceLastFiles:f,sinceLastAvailable:p=!1}){let[m,h]=(0,q.useState)(``),[g,_]=(0,q.useState)(()=>XE(c));(0,q.useEffect)(()=>{_(XE(c))},[c]);let v=(0,q.useMemo)(()=>{let t=0;for(let n of e)t+=n.additionLines.length+n.deletionLines.length;return t},[e]),y=tD(e.length,v),b=(0,q.useMemo)(()=>eD(e.map(e=>e.name)),[e]),x=(0,q.useCallback)(e=>{let t=XE(e);_(t),l?.(t)},[l]),S=(0,q.useCallback)(e=>{_(t=>{let n=new Set(t);n.has(e)?n.delete(e):n.add(e);let r=XE([...n]);return y||l?.(r),r})},[y,l]),C=!ZE(g,c),w=(0,q.useMemo)(()=>{let t=e;if(c.length>0&&(t=t.filter(e=>QE(e.name,c))),u===`unviewed`)t=t.filter(e=>!r.has(e.name));else if(u===`has-comments`)t=t.filter(e=>(n[e.name]??0)>0);else if(u===`since-last`){let e=f??new Set;t=t.filter(t=>e.has(t.name))}return t},[e,c,u,r,n,f]),{paths:T,dropped:E}=(0,q.useMemo)(()=>R0(w.map(e=>e.name)),[w]),D=(0,q.useMemo)(()=>new Set(T),[T]),O=(0,q.useMemo)(()=>z0(T),[T]),k=(0,q.useMemo)(()=>w.filter(e=>D.has(e.name)).map(e=>{let t=`modified`;if(i.has(e.name))t=`untracked`;else if(e.prevName)t=`renamed`;else{let n=e.prevObjectId,r=e.newObjectId;n===`0000000`||n===`0000000000000000000000000000000000000000`?t=`added`:(r===`0000000`||r===`0000000000000000000000000000000000000000`)&&(t=`deleted`)}return{path:e.name,status:t}}),[w,i,D]),A=(0,q.useRef)({commentCounts:n,viewedFiles:r,sinceLastFiles:f??new Set});A.current={commentCounts:n,viewedFiles:r,sinceLastFiles:f??new Set};let{model:j}=L0({paths:T,fileTreeSearchMode:`hide-non-matches`,gitStatus:k,renderRowDecoration:(0,q.useCallback)(e=>{let t=e.item.path,{commentCounts:n,viewedFiles:r,sinceLastFiles:i}=A.current,a=r.has(t),o=n[t]??0,s=i.has(t),c=[],l=[];return s&&(c.push(`Δ`),l.push(`Changed since last review handoff`)),a&&(c.push(`✓`),l.push(`Viewed`)),o>0&&(c.push(`💬 ${o}`),l.push(`${o} comment${o>1?`s`:``}`)),c.length===0?null:{text:c.join(` `),title:l.join(` · `)}},[]),initialSelectedPaths:t&&D.has(t)?[t]:[],initialExpandedPaths:O,onSelectionChange:e=>{e.length>0&&e[0]!==t&&a(e[0])}});if((0,q.useEffect)(()=>{j.resetPaths(T,{initialExpandedPaths:O})},[T,O,j]),(0,q.useEffect)(()=>{j.setGitStatus(k)},[k,n,r,j]),(0,q.useEffect)(()=>{if(!(!t||!D.has(t)))try{j.focusPath(t),j.scrollToPath(t,{focus:!0,offset:`nearest`})}catch(e){console.error(`Failed to scroll to active file:`,e)}},[t,j,D]),(0,q.useEffect)(()=>{j.setSearch(m||null)},[m,j]),o)return(0,J.jsx)(`div`,{className:`ft ft-collapsed`,children:s&&(0,J.jsx)(Qw,{content:`Expand sidebar · b`,side:`right`,children:(0,J.jsx)(`button`,{className:`sidebar-toggle`,onClick:s,"aria-label":`Expand sidebar`,children:(0,J.jsx)(wO,{size:16})})})});let M=$E(c),N=e.length,P=w.length,F=N-P,I=b.length>0&&!!l;return(0,J.jsxs)(`div`,{className:`ft`,style:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,J.jsxs)(`div`,{className:`ft-chrome`,children:[(0,J.jsxs)(`div`,{className:`ft-search-row`,children:[s&&(0,J.jsx)(Qw,{content:`Collapse sidebar · b`,side:`right`,children:(0,J.jsx)(`button`,{className:`sidebar-toggle`,onClick:s,"aria-label":`Collapse sidebar`,children:(0,J.jsx)(CO,{size:16})})}),(0,J.jsxs)(`div`,{className:`ft-search-wrapper`,children:[(0,J.jsx)(NO,{size:14,className:`ft-search-icon`,"aria-hidden":`true`}),(0,J.jsx)(`input`,{type:`text`,placeholder:`Filter files…`,value:m,onChange:e=>h(e.target.value),className:`ft-search-input`,"aria-label":`Filter files`})]})]}),I&&(0,J.jsxs)(`div`,{className:`ft-ext-panel`,"aria-label":`Filter by file extension`,children:[(0,J.jsxs)(`div`,{className:`ft-ext-header`,children:[(0,J.jsx)(YD,{size:12,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`ft-ext-title`,children:`Extensions`}),c.length>0&&(0,J.jsxs)(`span`,{className:`ft-ext-applied`,title:M,children:[c.length,` applied`]}),C&&y&&(0,J.jsx)(`span`,{className:`ft-ext-pending`,children:`unsaved`})]}),(0,J.jsx)(`div`,{className:`ft-ext-chips`,role:`group`,"aria-label":`File extensions`,children:b.map(e=>{let t=g.includes(e);return(0,J.jsxs)(`button`,{type:`button`,className:`ft-ext-chip ${t?`ft-ext-chip-active`:``}`,"aria-pressed":t,title:t?`Remove .${e}`:`Include .${e}`,onClick:()=>S(e),children:[`.`,e]},e)})}),(0,J.jsxs)(`div`,{className:`ft-ext-actions`,children:[y?(0,J.jsxs)(`button`,{type:`button`,className:`ft-ext-apply`,disabled:!C,onClick:()=>x(g),title:`Apply the selected extensions to the file tree and diff list`,children:[(0,J.jsx)(wD,{size:12}),`Apply`,C&&g.length>0?` (${g.length})`:C?` (all)`:``]}):(0,J.jsx)(`span`,{className:`ft-ext-hint`,children:`Live filter`}),(g.length>0||c.length>0)&&(0,J.jsxs)(`button`,{type:`button`,className:`ft-ext-clear`,onClick:()=>x([]),"aria-label":`Clear extension filter`,title:`Show all extensions`,children:[(0,J.jsx)(WO,{size:12}),`Clear`]})]})]}),d&&(0,J.jsx)(`div`,{className:`ft-chips`,role:`group`,"aria-label":`Smart file filters`,children:[{id:`all`,label:`All`},{id:`unviewed`,label:`Unviewed`},{id:`has-comments`,label:`Comments`},...p?[{id:`since-last`,label:`Since last`}]:[]].map(e=>(0,J.jsx)(`button`,{type:`button`,className:`ft-chip ${u===e.id?`ft-chip-active`:``}`,"aria-pressed":u===e.id,title:e.id===`since-last`?`Files added or modified since the last Send to agent`:void 0,onClick:()=>d(e.id),children:e.label},e.id))}),F>0&&(0,J.jsx)(`div`,{className:`ft-filter-status`,children:(0,J.jsxs)(`span`,{className:`ft-filter-status-text`,title:M,children:[P,` of `,N]})})]}),E.length>0&&(0,J.jsxs)(`div`,{className:`ft-collision-warning`,title:E.join(`
3923
- `),style:{fontSize:`0.75rem`,padding:`4px 8px`,background:`var(--bg-warning, #fff3cd)`,color:`var(--text-warning, #856404)`},children:[`⚠ `,E.length,` file(s) hidden due to path collision (hover for details)`]}),(0,J.jsx)(`div`,{style:{flex:1,minHeight:0,overflow:`auto`},children:(0,J.jsx)(B0,{children:(0,J.jsx)(LG,{model:j,className:`ft-pierre-tree`})})})]})});function H0(e){return e.status===`resolved`?`resolved`:e.replies?.length?`replied`:`open`}var U0=[{key:`all`,label:`All`},{key:`open`,label:`Open`},{key:`replied`,label:`Replied`},{key:`resolved`,label:`Resolved`}],W0=[{key:`all`,label:`Any`},{key:`blocking`,label:`Blocking`},{key:`nit`,label:`Nit`},{key:`question`,label:`Question`},{key:`praise`,label:`Praise`},{key:`outdated`,label:`Outdated`}];function G0({comments:e,resolveComment:t,unresolveComment:n,removeComment:r,addReply:i,editComment:a,editReply:o,removeReply:s}){let[c,l]=(0,q.useState)(`all`),[u,d]=(0,q.useState)(`all`),f=(0,q.useMemo)(()=>{let t={all:e.length,open:0,replied:0,resolved:0};for(let n of e)t[H0(n)]++;return t},[e]),p=(0,q.useMemo)(()=>{let t={all:e.length,blocking:0,nit:0,question:0,praise:0,none:0,outdated:0};for(let n of e){n.outdated&&t.outdated++;let e=n.severity&&n.severity!==`none`?n.severity:`none`;t[e]++}return t},[e]),m=(0,q.useMemo)(()=>[...e].sort((e,t)=>t.createdAt-e.createdAt),[e]),h=(0,q.useMemo)(()=>m.filter(e=>c!==`all`&&H0(e)!==c?!1:u===`outdated`?!!e.outdated:!(u!==`all`&&(e.severity&&e.severity!==`none`?e.severity:null)!==u)),[m,c,u]),g=(0,q.useMemo)(()=>e.some(e=>e.outdated||e.severity&&e.severity!==`none`),[e]);return e.length===0?null:(0,J.jsxs)(`div`,{className:`cmt`,role:`complementary`,"aria-label":`Review comments`,children:[(0,J.jsxs)(`div`,{className:`cmt-head`,children:[(0,J.jsxs)(`div`,{className:`cmt-title`,children:[(0,J.jsx)(hO,{size:14,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`Comments`}),(0,J.jsx)(`span`,{className:`cmt-total`,children:e.length})]}),(0,J.jsx)(`div`,{className:`cmt-filters`,role:`tablist`,"aria-label":`Filter by status`,children:U0.map(e=>(0,J.jsxs)(`button`,{role:`tab`,"aria-selected":c===e.key,className:`cmt-filter ${c===e.key?`cmt-filter-active`:``}`,onClick:()=>l(e.key),disabled:e.key!==`all`&&f[e.key]===0,children:[e.label,(0,J.jsx)(`span`,{className:`cmt-filter-count`,children:f[e.key]})]},e.key))}),g&&(0,J.jsx)(`div`,{className:`cmt-filters cmt-filters-severity`,role:`tablist`,"aria-label":`Filter by severity`,children:W0.filter(e=>e.key===`all`||(p[e.key]??0)>0).map(e=>(0,J.jsxs)(`button`,{role:`tab`,"aria-selected":u===e.key,className:`cmt-filter cmt-filter-sev ${u===e.key?`cmt-filter-active`:``}`,"data-severity":e.key,onClick:()=>d(e.key),children:[e.label,(0,J.jsx)(`span`,{className:`cmt-filter-count`,children:p[e.key]})]},e.key))})]}),(0,J.jsx)(`ul`,{className:`cmt-list`,"aria-label":`Comment threads`,children:h.length===0?(0,J.jsx)(`li`,{className:`cmt-empty`,children:`No matching comments`}):h.map(e=>(0,J.jsx)(K0,{comment:e,resolveComment:t,unresolveComment:n,removeComment:r,addReply:i,editComment:a,editReply:o,removeReply:s},e.id))})]})}function K0({comment:e,resolveComment:t,unresolveComment:n,removeComment:r,addReply:i,editComment:a,editReply:o,removeReply:s}){let c=H0(e),l=e.status===`resolved`,u=e.replies?.length??0,{haptic:d,sound:f}=xT(),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(!1),[x,S]=(0,q.useState)(null),C=(0,q.useCallback)(()=>{e.lineNumber>0?VT(e.filePath,e.lineNumber,e.side):document.getElementById(`file-${e.filePath}`)?.scrollIntoView({block:`start`})},[e.filePath,e.lineNumber,e.side]),w=e.lineNumber>0?`:${e.lineNumber}`:` · file`;return(0,J.jsxs)(`li`,{className:`cmt-card cmt-card-${c} ${l?`cmt-card-resolved`:``}`,children:[(0,J.jsxs)(`div`,{className:`cmt-card-top`,children:[(0,J.jsx)(`span`,{className:`cmt-dot cmt-dot-${c}`,"aria-hidden":`true`}),(0,J.jsxs)(`button`,{className:`cmt-loc`,onClick:C,title:`Jump to ${e.filePath}${w}`,children:[(0,J.jsx)(`span`,{className:`cmt-loc-file`,children:IT(e.filePath)}),(0,J.jsx)(`span`,{className:`cmt-loc-line`,children:w})]}),e.severity&&e.severity!==`none`&&(0,J.jsx)(`span`,{className:`comment-severity-badge`,"data-severity":e.severity,children:e.severity}),e.outdated&&(0,J.jsxs)(`span`,{className:`comment-outdated-badge`,title:`Anchored code no longer matches`,children:[(0,J.jsx)(BO,{size:10}),` outdated`]}),(0,J.jsx)(`span`,{className:`cmt-time`,children:FT(e.createdAt)})]}),e.lineContent?.trim()&&(0,J.jsx)(`button`,{className:`cmt-codeline`,onClick:C,title:`Jump to line`,children:(0,J.jsx)(`code`,{children:e.lineContent.trim().slice(0,160)})}),_?(0,J.jsx)(RW,{draftKey:`tracker-edit:${e.id}`,initialBody:e.body,onCancel:()=>v(!1),onSubmit:t=>{a(e.id,t),v(!1)}}):(0,J.jsx)(QV,{content:e.body,className:`cmt-body markdown-body`}),(0,J.jsxs)(`div`,{className:`cmt-actions`,children:[(0,J.jsxs)(`button`,{className:`cmt-act`,onClick:()=>{g(e=>!e),m(!0)},title:`Reply`,children:[(0,J.jsx)(HD,{size:13,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`Reply`})]}),(0,J.jsx)(`button`,{className:`cmt-act`,onClick:()=>v(e=>!e),title:`Edit comment`,children:(0,J.jsx)(DO,{size:13,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{className:`cmt-act ${l?`cmt-act-resolved`:``}`,onClick:()=>{l?(n(e.id),d(`light`),f(`toggle`)):(t(e.id),d(`success`),f(`resolve`))},title:l?`Reopen`:`Resolve`,children:l?(0,J.jsx)(jO,{size:13,"aria-hidden":`true`}):(0,J.jsx)(wD,{size:13,"aria-hidden":`true`})}),y?(0,J.jsxs)(`span`,{className:`cmt-confirm`,children:[(0,J.jsx)(`button`,{className:`cmt-act cmt-act-danger`,onClick:()=>{r(e.id),d(`medium`),f(`remove`)},title:`Confirm delete`,children:`Delete?`}),(0,J.jsx)(`button`,{className:`cmt-act`,onClick:()=>b(!1),title:`Cancel`,children:(0,J.jsx)(WO,{size:13,"aria-hidden":`true`})})]}):(0,J.jsx)(`button`,{className:`cmt-act cmt-act-del`,onClick:()=>b(!0),title:`Delete comment`,children:(0,J.jsx)(zO,{size:13,"aria-hidden":`true`})})]}),u>0&&(0,J.jsxs)(`button`,{className:`cmt-thread-toggle`,onClick:()=>m(e=>!e),"aria-expanded":p,children:[(0,J.jsx)(DD,{size:12,className:`cmt-chev ${p?`cmt-chev-open`:``}`,"aria-hidden":`true`}),u,` `,u===1?`reply`:`replies`]}),p&&u>0&&(0,J.jsx)(`ul`,{className:`cmt-replies`,children:e.replies.map(t=>(0,J.jsx)(q0,{reply:t,onEdit:n=>o(e.id,t.id,n),onRemove:()=>s(e.id,t.id)},t.id))}),h&&(0,J.jsxs)(`div`,{className:`cmt-reply-composer`,children:[(0,J.jsx)(RW,{draftKey:`reply:${e.id}`,onCancel:()=>{g(!1),S(null)},onSubmit:async t=>{S(null),m(!0);try{await i(e.id,t),d(`light`),f(`success`),g(!1)}catch(e){S(e instanceof Error?e.message:`Failed to save reply`)}}}),x&&(0,J.jsx)(`p`,{className:`cmt-reply-error`,role:`alert`,children:x})]})]})}function q0({reply:e,onEdit:t,onRemove:n}){let r=e.role===`agent`||e.role==null&&!!e.model,[i,a]=(0,q.useState)(!1);return(0,J.jsxs)(`li`,{className:`cmt-reply ${r?`cmt-reply-agent`:``}`,children:[(0,J.jsxs)(`div`,{className:`cmt-reply-head`,children:[(0,J.jsxs)(`span`,{className:`cmt-reply-who ${r?`cmt-reply-who-agent`:``}`,children:[r?(0,J.jsx)(SD,{size:11,"aria-hidden":`true`}):null,r?e.model||`Agent`:`You`]}),(0,J.jsx)(`span`,{className:`cmt-time`,children:FT(e.createdAt)}),!r&&(0,J.jsx)(`button`,{className:`cmt-reply-act`,onClick:()=>a(e=>!e),title:`Edit reply`,children:(0,J.jsx)(DO,{size:11,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{className:`cmt-reply-act cmt-act-del`,onClick:n,title:`Delete reply`,children:(0,J.jsx)(zO,{size:11,"aria-hidden":`true`})})]}),i?(0,J.jsx)(RW,{draftKey:`tracker-reply-edit:${e.id}`,initialBody:e.body,onCancel:()=>a(!1),onSubmit:e=>{t(e),a(!1)}}):(0,J.jsx)(QV,{content:e.body,className:`cmt-reply-body markdown-body`})]})}function J0(e){return $e({queryKey:[`file-text`,e],enabled:!!e,staleTime:300*1e3,queryFn:async({signal:t})=>{let n=await fetch(`/api/file-text?path=${encodeURIComponent(e)}&version=new`,{signal:t});if(n.status===415)return{content:null,missing:!1,binary:!0};if(!n.ok)throw Error(`Failed to load file (${n.status})`);let r=await n.json();if(r.error){if(/binary/i.test(r.error))return{content:null,missing:!1,binary:!0};throw Error(r.error)}return r.missing?{content:null,missing:!0,binary:!1}:{content:r.content??``,missing:!1,binary:!1}}})}var Y0=[{key:`all`,label:`All`,Icon:iO},{key:`files`,label:`Files`,Icon:qD},{key:`text`,label:`Text`,Icon:VO},{key:`symbols`,label:`Symbols`,Icon:zD}],X0={function:`ƒ`,method:`m`,class:`C`,variable:`v`,interface:`I`,type:`T`,enum:`E`,struct:`S`,impl:`i`,trait:`t`};function Z0(e){switch(e){case`modified`:return{label:`M`,title:`modified`};case`untracked`:return{label:`U`,title:`untracked`};case`staged_new`:case`added`:return{label:`A`,title:`added`};case`deleted`:return{label:`D`,title:`deleted`};case`renamed`:return{label:`R`,title:`renamed`};case``:case`clean`:return null;default:return{label:e.charAt(0).toUpperCase(),title:e}}}function Q0({text:e,ranges:t}){if(!t.length)return(0,J.jsx)(J.Fragment,{children:e});let n=[],r=0;return t.forEach(([t,i],a)=>{t>r&&n.push(e.slice(r,t)),n.push((0,J.jsx)(`mark`,{className:`searchpalette-mark`,children:e.slice(t,i)},a)),r=i}),r<e.length&&n.push(e.slice(r)),(0,J.jsx)(J.Fragment,{children:n})}function $0(e,t){let n=t.trim().toLowerCase();if(!n)return[];let r=e.toLowerCase(),i=[],a=0;for(let e=0;e<r.length&&a<n.length;e++)if(r[e]===n[a]){let t=i[i.length-1];t&&t[1]===e?t[1]=e+1:i.push([e,e+1]),a++}return a===n.length?i:[]}var e2=e=>{let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t+1)};function t2(e,t){let n=e.length-e.trimStart().length,r=e.slice(n),i=n;if(r.length>400){let e=t.find(e=>e[0]>=n),a=e?Math.max(0,e[0]-n-24):0,o=a>0?`…`:``;r=o+r.slice(a,a+400),i=n+a-o.length}let a=t.map(([e,t])=>[e-i,t-i]).filter(([e,t])=>t>0&&e<r.length).map(([e,t])=>[Math.max(0,e),Math.min(r.length,t)]);return{text:r,ranges:a}}function n2({isOpen:e,onClose:t,initialScope:n,initialChangedOnly:r,onChangedOnlyPreference:i,onSessionSnapshot:a,files:o,changedEntries:s,customMode:c,staged:l,onNavigateFile:u,theme:d,fontSize:f,monoFontFamily:p,defaultTabSize:m,lineWrap:h,showLineNumbers:g,lineHoverHighlight:_}){let[v,y]=(0,q.useState)(``),[b,x]=(0,q.useState)(n),[S,C]=(0,q.useState)(!1),[w,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(0),[O,k]=(0,q.useState)(null),A=(0,q.useRef)(null),j=(0,q.useRef)(null),M=(0,q.useRef)(!1),N=(0,q.useMemo)(()=>TT(o),[o]),P=(0,q.useMemo)(()=>ET(s),[s]),F=WT({scope:b,query:v,regex:S,changedOnly:w,changedPaths:(0,q.useMemo)(()=>[...N],[N]),open:e}),I=F.data&&F.data.scope===b?F.data:void 0,L=I?.error,R=$e({queryKey:[`repo-files-fallback`],enabled:e&&b===`files`&&!!L,staleTime:6e4,queryFn:async()=>(await(await fetch(`/api/repo-files`)).json()).files??[]});(0,q.useEffect)(()=>{e&&(y(``),x(n),C(!1),T(r??KT(n)),D(0),k(null))},[e,n,r]),(0,q.useEffect)(()=>{e&&A.current?.focus()},[e]),(0,q.useEffect)(()=>{D(0),k(null)},[v,b]);let z=(0,q.useMemo)(()=>{let e=v.trim(),t=e.toLowerCase(),n=[];if(b===`files`&&L&&R.data)n=R.data.map(e=>({path:e,score:t?NT(e,t):0})).filter(e=>e.score!==null).sort((e,t)=>t.score-e.score).slice(0,60).map(({path:e})=>({kind:`file`,key:e,hit:{path:e,fileName:IT(e),gitStatus:``,matchType:``,exact:!1},inDiff:N.has(e)}));else if(I)I.scope===`files`?n=I.items.map(e=>({kind:`file`,key:e.path,hit:e,inDiff:N.has(e.path)})):I.scope===`text`?n=I.items.map(e=>({kind:`text`,key:`${e.path}:${e.line}:${e.col}`,hit:e,inDiff:N.has(e.path)})):I.scope===`symbols`?n=I.items.map(e=>({kind:`symbol`,key:`${e.path}:${e.line}:${e.name}`,hit:e,inDiff:N.has(e.path)})):I.scope===`all`&&(n=I.items.map(e=>e.kind===`file`?{kind:`file`,key:`all:${e.hit.path}`,hit:e.hit,inDiff:N.has(e.hit.path)}:e.kind===`text`?{kind:`text`,key:`all:${e.hit.path}:${e.hit.line}:${e.hit.col}`,hit:e.hit,inDiff:N.has(e.hit.path)}:{kind:`symbol`,key:`all:${e.hit.path}:${e.hit.line}:${e.hit.name}`,hit:e.hit,inDiff:N.has(e.hit.path)}));else if(b===`symbols`&&e.length<2){let e=PT(s);n=(t?e.filter(e=>e.name.toLowerCase().includes(t)):e).map(e=>({kind:`symbol`,key:`local:${e.path}:${e.line}:${e.name}`,hit:e,inDiff:!0}))}let r=n.filter(e=>e.inDiff),i=n.filter(e=>!e.inDiff);return[...r,...i]},[I,L,R.data,b,N,v,s]);(0,q.useEffect)(()=>{E>=z.length&&D(0)},[z.length,E]),(0,q.useEffect)(()=>{(j.current?.querySelector(`[data-focused="true"]`))?.scrollIntoView({block:`nearest`})},[E,z]);let B=(0,q.useCallback)(e=>{!a||z.length===0||a({hits:qT(z,v),index:e,query:v.trim()})},[a,z,v]),V=(0,q.useCallback)(()=>{y(``),k(null)},[]);(0,q.useEffect)(()=>{M.current&&!e&&B(E),M.current=e},[e,B,E]);let H=(0,q.useMemo)(()=>({diffFileSet:N,changedKeys:P,customMode:c,staged:l}),[N,P,c,l]),U=(0,q.useCallback)((e,n)=>{let r=z[e];if(!r)return;let i=r.hit.path,a=v.trim();if(GT(a,i),r.kind===`file`){if(n){k({path:i});return}DT({kind:`file`,path:i},H).type===`scrollFile`?(B(e),t(),requestAnimationFrame(()=>u(i))):k({path:i});return}let o=r.hit.line,s=r.kind===`symbol`?r.hit.name:a;if(n){k({path:i,line:o,match:s});return}let c=DT({kind:`line`,path:i,line:o,match:s},H);c.type===`scrollLine`?(B(e),t(),requestAnimationFrame(()=>VT(i,c.line,c.side,c.match))):k({path:i,line:o,match:s})},[z,v,H,t,u,B]),W=(0,q.useCallback)(e=>{x(t=>Y0[(Y0.findIndex(e=>e.key===t)+e+Y0.length)%Y0.length].key)},[]),ee=(0,q.useCallback)(e=>{if(e.key===`PageDown`){e.preventDefault(),document.querySelector(`.searchpalette-preview-body`)?.scrollBy({top:150,behavior:`auto`});return}if(e.key===`PageUp`){e.preventDefault(),document.querySelector(`.searchpalette-preview-body`)?.scrollBy({top:-150,behavior:`auto`});return}if(e.altKey&&(e.key===`ArrowDown`||e.key===`j`)){e.preventDefault(),document.querySelector(`.searchpalette-preview-body`)?.scrollBy({top:80,behavior:`auto`});return}if(e.altKey&&(e.key===`ArrowUp`||e.key===`k`)){e.preventDefault(),document.querySelector(`.searchpalette-preview-body`)?.scrollBy({top:-80,behavior:`auto`});return}if(e.shiftKey&&(e.key===`ArrowDown`||e.key===`j`)){e.preventDefault(),document.querySelector(`.searchpalette-preview-body`)?.scrollBy({top:80,behavior:`auto`});return}if(e.shiftKey&&(e.key===`ArrowUp`||e.key===`k`)){e.preventDefault(),document.querySelector(`.searchpalette-preview-body`)?.scrollBy({top:-80,behavior:`auto`});return}if(e.key===`Tab`){e.preventDefault(),W(e.shiftKey?-1:1);return}let t=e=>{z.length!==0&&D(t=>(t+e+z.length)%z.length)};e.key===`ArrowDown`||e.ctrlKey&&(e.key===`n`||e.key===`j`)?(e.preventDefault(),t(1)):e.key===`ArrowUp`||e.ctrlKey&&(e.key===`p`||e.key===`k`)?(e.preventDefault(),t(-1)):e.ctrlKey&&e.key===`d`?(e.preventDefault(),t(8)):e.ctrlKey&&e.key===`u`?(e.preventDefault(),t(-8)):e.ctrlKey&&e.key===`g`?(e.preventDefault(),T(e=>{let t=!e;return i?.(t),t})):e.ctrlKey&&e.key===`r`&&b===`text`?(e.preventDefault(),C(e=>!e)):e.ctrlKey&&e.key===`l`?(e.preventDefault(),V()):e.key===`Enter`&&(e.preventDefault(),U(E,e.metaKey||e.ctrlKey))},[W,z.length,U,E,b,i,V]),te=(0,q.useCallback)(()=>{O?k(null):(B(E),t())},[O,t,B,E]),ne=I?.total??z.length,re=(F.isFetching||F.pending)&&F.enabled,ie=I?.indexing;return(0,J.jsxs)(IH,{open:e,onClose:te,className:`searchpalette ui-modal--palette ${O?`searchpalette--split`:``}`,ariaLabel:`Search files, text and symbols`,initialFocus:A,onKeyDown:ee,children:[(0,J.jsxs)(`div`,{className:`searchpalette-header`,children:[(0,J.jsxs)(`div`,{className:`searchpalette-input-row`,children:[(0,J.jsx)(NO,{size:15,className:`searchpalette-search-icon`}),(0,J.jsx)(`input`,{ref:A,type:`text`,className:`searchpalette-input`,placeholder:b===`all`?`Search files, text and symbols…`:b===`files`?`Search files in the repo…`:b===`text`?S?`Search by regular expression…`:`Search file contents…`:`Search symbol definitions…`,value:v,onChange:e=>y(e.target.value),role:`combobox`,"aria-expanded":z.length>0,"aria-controls":`searchpalette-list`,"aria-activedescendant":z[E]?`sp-row-${E}`:void 0,spellCheck:!1,autoComplete:`off`}),re&&(0,J.jsx)(cO,{size:14,className:`searchpalette-spinner spin`}),v&&(0,J.jsx)(`button`,{className:`searchpalette-clear`,onClick:V,"aria-label":`Clear search`,children:(0,J.jsx)(WO,{size:14})}),(0,J.jsx)(`span`,{className:`searchpalette-count`,children:ie?`indexing…`:I?`${z.length} of ${ne}`:``})]}),(0,J.jsxs)(`div`,{className:`searchpalette-controls`,children:[(0,J.jsx)(`div`,{className:`searchpalette-scopes`,role:`tablist`,"aria-label":`Search scope`,children:Y0.map(e=>(0,J.jsxs)(`button`,{role:`tab`,"aria-selected":b===e.key,className:`searchpalette-scope ${b===e.key?`is-active`:``}`,onClick:()=>x(e.key),children:[(0,J.jsx)(e.Icon,{size:12}),e.label]},e.key))}),(0,J.jsxs)(`div`,{className:`searchpalette-toggles`,children:[b===`text`&&(0,J.jsx)(`button`,{className:`searchpalette-toggle ${S?`is-active`:``}`,onClick:()=>C(e=>!e),title:`Regular expression`,"aria-pressed":S,children:`.*`}),(0,J.jsxs)(`button`,{className:`searchpalette-toggle ${w?`is-active`:``}`,onClick:()=>{T(e=>{let t=!e;return i?.(t),t})},title:`Limit to files in the current diff`,"aria-pressed":w,children:[(0,J.jsx)(QD,{size:12}),`Changed`]})]})]}),I?.regexError&&(0,J.jsx)(`div`,{className:`searchpalette-note`,children:`Invalid regex — showing literal matches`})]}),(0,J.jsxs)(`div`,{className:`searchpalette-body`,children:[(0,J.jsx)(`div`,{className:`searchpalette-list`,id:`searchpalette-list`,role:`listbox`,ref:j,children:(0,J.jsx)(r2,{rows:z,scope:b,query:v,focusedIndex:E,engineError:L,isFetching:F.isFetching,enabled:F.enabled,minLength:F.minLength,regex:S,changedOnly:w,onHover:D,onActivate:(e,t)=>U(e,t?t.metaKey||t.ctrlKey:!1),onRetry:()=>F.refetch()})}),O&&(0,J.jsx)(l2,{preview:O,theme:d,fontSize:f,monoFontFamily:p,defaultTabSize:m,lineWrap:h,showLineNumbers:g,lineHoverHighlight:_,onClose:()=>k(null),inDiff:N.has(O.path),onGoToDiff:()=>{B(E),t(),O.line?requestAnimationFrame(()=>VT(O.path,O.line,`additions`,O.match)):requestAnimationFrame(()=>u(O.path))}},O.path)]}),(0,J.jsxs)(`div`,{className:`searchpalette-foot`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`Tab`}),` scope`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`Ctrl`}),`+`,(0,J.jsx)(`kbd`,{children:`G`}),` changed`]}),b===`text`&&(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`Ctrl`}),`+`,(0,J.jsx)(`kbd`,{children:`R`}),` regex`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`Ctrl`}),`+`,(0,J.jsx)(`kbd`,{children:`L`}),` clear`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`Ctrl`}),`+`,(0,J.jsx)(`kbd`,{children:`U`}),`/`,(0,J.jsx)(`kbd`,{children:`D`}),` page`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`↑↓`}),` move`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`n`}),`/`,(0,J.jsx)(`kbd`,{children:`N`}),` after close`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`↵`}),` `,O&&N.has(O.path)?`view in diff`:`open`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`⌘↵`}),` peek`]}),O&&(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`⌥↑↓`}),` / `,(0,J.jsx)(`kbd`,{children:`⇧↑↓`}),` scroll preview`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`esc`}),` `,O?`unfocus preview`:`close`]})]})]})}function r2({rows:e,scope:t,query:n,focusedIndex:r,engineError:i,isFetching:a,enabled:o,minLength:s,regex:c,changedOnly:l,onHover:u,onActivate:d,onRetry:f}){return i&&t!==`files`?(0,J.jsxs)(`div`,{className:`searchpalette-state searchpalette-state--error`,children:[(0,J.jsx)(`p`,{children:`Search engine unavailable`}),(0,J.jsx)(`span`,{className:`searchpalette-state-detail`,children:i}),(0,J.jsx)(`button`,{className:`searchpalette-retry`,onClick:f,children:`Retry`})]}):e.length>0?(0,J.jsx)(J.Fragment,{children:e.map((e,t)=>(0,J.jsx)(i2,{row:e,index:t,query:n,focused:t===r,onHover:u,onActivate:d},e.key))}):o?a?(0,J.jsxs)(`div`,{className:`searchpalette-state`,children:[(0,J.jsx)(cO,{size:15,className:`spin`}),` Searching…`]}):(0,J.jsxs)(`div`,{className:`searchpalette-state`,children:[(0,J.jsxs)(`p`,{children:[`No matches`,n.trim()?` for “${n.trim()}”`:``]}),(0,J.jsx)(`span`,{className:`searchpalette-state-detail`,children:l?`Searching only changed files — turn off Changed to search the whole repo`:t===`text`&&!c?`Try Tab to switch scope, or enable .* for regex`:`Try Tab to switch scope`})]}):(0,J.jsx)(`div`,{className:`searchpalette-state`,children:t===`symbols`?n.trim()?`No matching symbols in the current diff. Type at least 2 characters to search the whole repository.`:`No symbols found in the current diff. Type at least 2 characters to search the whole repository.`:t===`text`?`Type to search file contents`:`Type to filter — or browse all files`})}function i2({row:e,index:t,query:n,focused:r,onHover:i,onActivate:a}){let o=Z0(e.hit.gitStatus);return(0,J.jsxs)(`div`,{id:`sp-row-${t}`,role:`option`,"aria-selected":r,"data-focused":r,className:`searchpalette-row ${r?`is-focused`:``} ${e.inDiff?`is-indiff`:``}`,onMouseEnter:()=>i(t),onClick:e=>a(t,e),children:[e.kind===`file`&&(0,J.jsx)(a2,{hit:e.hit,query:n}),e.kind===`text`&&(0,J.jsx)(o2,{hit:e.hit,query:n}),e.kind===`symbol`&&(0,J.jsx)(s2,{hit:e.hit}),(0,J.jsxs)(`div`,{className:`searchpalette-rail`,children:[e.inDiff&&(0,J.jsx)(`span`,{className:`searchpalette-pill searchpalette-pill--diff`,children:`diff`}),o&&(0,J.jsx)(`span`,{className:`searchpalette-git searchpalette-git--${o.title}`,title:o.title,children:o.label})]})]})}function a2({hit:e,query:t}){let n=e.fileName,r=$0(n,t);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`searchpalette-tile searchpalette-tile--file`,children:(0,J.jsx)(qD,{size:13})}),(0,J.jsxs)(`div`,{className:`searchpalette-info`,children:[(0,J.jsx)(`span`,{className:`searchpalette-primary`,children:(0,J.jsx)(Q0,{text:n,ranges:r})}),(0,J.jsx)(`span`,{className:`searchpalette-secondary`,children:e2(e.path)||`./`})]})]})}function o2({hit:e,query:t}){let n=jT(e.content,e.matchRanges,t),{text:r,ranges:i}=t2(e.content,n);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`searchpalette-tile searchpalette-tile--text`,children:(0,J.jsx)(VO,{size:13})}),(0,J.jsxs)(`div`,{className:`searchpalette-info`,children:[(0,J.jsx)(`span`,{className:`searchpalette-primary searchpalette-code`,children:(0,J.jsx)(Q0,{text:r,ranges:i})}),(0,J.jsxs)(`span`,{className:`searchpalette-secondary`,children:[e.fileName,`:`,e.line,(0,J.jsx)(`span`,{className:`searchpalette-crumb`,children:e2(e.path)})]})]})]})}function s2({hit:e}){let t=e.content.indexOf(e.name),n=t>=0?e.content.slice(t+e.name.length).trimEnd():``,r=jT(e.name,e.matchRanges.length?c2(e):void 0,e.name);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`searchpalette-tile searchpalette-tile--symbol`,title:e.kind,children:X0[e.kind]??`?`}),(0,J.jsxs)(`div`,{className:`searchpalette-info`,children:[(0,J.jsxs)(`span`,{className:`searchpalette-primary`,children:[(0,J.jsx)(Q0,{text:e.name,ranges:r}),n&&(0,J.jsx)(`span`,{className:`searchpalette-sigtail`,children:n.slice(0,60)})]}),(0,J.jsxs)(`span`,{className:`searchpalette-secondary`,children:[e.fileName,`:`,e.line,(0,J.jsx)(`span`,{className:`searchpalette-crumb`,children:e2(e.path)})]})]}),(0,J.jsx)(`span`,{className:`searchpalette-kind-badge`,children:e.kind})]})}function c2(e){let t=e.content.indexOf(e.name);if(t<0)return;let n=[];for(let[r,i]of e.matchRanges){let a=r-t,o=i-t;o>0&&a<e.name.length&&n.push([Math.max(0,a),Math.min(e.name.length,o)])}return n.length?n:void 0}function l2({preview:e,theme:t,fontSize:n,monoFontFamily:r,defaultTabSize:i,lineWrap:a,showLineNumbers:o,lineHoverHighlight:s,onClose:c,inDiff:l,onGoToDiff:u}){let d=LT[t]||LT[`rose-pine`],{data:f,isLoading:p,error:m}=J0(e.path),h=(0,q.useRef)(null);return(0,q.useEffect)(()=>{!f?.content||!e.line||!h.current||BT(h.current,e.line,e.match)},[f?.content,e.line,e.match]),(0,J.jsxs)(`div`,{className:`searchpalette-preview`,children:[(0,J.jsxs)(`div`,{className:`searchpalette-preview-head`,children:[(0,J.jsx)(qD,{size:12}),(0,J.jsx)(`span`,{className:`searchpalette-preview-path`,children:e.path}),l&&(0,J.jsxs)(`button`,{className:`searchpalette-preview-diff-btn`,onClick:u,title:`Open this file and line in the main diff viewer (Enter)`,style:{padding:`2.5px 8px`,fontSize:`10.5px`,background:`var(--accent-subtle)`,border:`1px solid var(--accent)`,borderRadius:`4px`,color:`var(--text-primary)`,cursor:`pointer`,fontWeight:600,marginRight:`8px`,display:`inline-flex`,alignItems:`center`,gap:`4px`},children:[(0,J.jsx)(QD,{size:11}),`View in Diff`]}),(0,J.jsx)(`button`,{className:`searchpalette-clear`,onClick:c,"aria-label":`Close preview`,children:(0,J.jsx)(WO,{size:14})})]}),(0,J.jsx)(`div`,{className:`searchpalette-preview-body`,ref:h,children:p?(0,J.jsxs)(`div`,{className:`searchpalette-state`,children:[(0,J.jsx)(cO,{size:15,className:`spin`}),` Loading `,e.path,`…`]}):m?(0,J.jsx)(`div`,{className:`searchpalette-state searchpalette-state--error`,children:m.message}):f?.binary?(0,J.jsx)(`div`,{className:`searchpalette-state`,children:`Binary file — no preview`}):f?.missing?(0,J.jsx)(`div`,{className:`searchpalette-state`,children:`File not present in the working tree`}):f?(0,J.jsx)(Rm,{file:{name:e.path,contents:f.content??``},options:{disableFileHeader:!0,overflow:a?`wrap`:`scroll`,disableLineNumbers:!o,lineHoverHighlight:s,theme:{dark:d.type===`dark`?d.themeName:`rose-pine`,light:d.type===`light`?d.themeName:`github-light`},themeType:d.type,unsafeCSS:`
3922
+ }`}var cq=new WeakMap;function lq(e){let t=cq.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(OG,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),cq.set(e,i),i}function uq(e,t){if(!e.isConnected)return;let n=lq(t);if(n==null)return;let r=t.querySelector(`style[${kG}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(kG,``),t.appendChild(i)),i.textContent=`:host { ${AG}: ${n}px; }`}var dq;function fq(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){dq??(dq=new CSSStyleSheet,dq.replaceSync(oq(iq)));let t=!1;try{e.adoptedStyleSheets=[dq],t=!0}catch{}if(t){e.querySelector(`style[${EG}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(EG,``),t.textContent=oq(iq),e.prepend(t)}}function pq(e,t){mq(e,t),fq(t),uq(e,t)}function mq(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});pq(this,e)}}if(customElements.define(TG,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(TG)))e instanceof HTMLElement&&pq(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var hq=5,gq=1<<hq,_q=gq*4;function vq(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function yq(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function bq(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function xq(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function Sq(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function Cq(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function wq(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,Oq(e,t)}function Tq(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=xq(e).get(t);if(i===void 0)return;let a=i>>hq;e.childVisibleChunkSums[a]+=r}function Eq(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=kq(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=gq}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function Dq(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>hq;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<hq}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function Oq(e,t){if(t.childIds.length<_q){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/gq),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>hq]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function kq(e,t,n,r){let i=Math.min(t.childIds.length,n+gq),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var Aq=7,jq=3,Mq=1<<jq,Nq=4;function Pq(e,t,n=0){return e<<Nq|n<<jq|t}function Fq(e){return e.depthAndFlags>>>Nq}function Iq(e){return(e.depthAndFlags&Mq)>>jq}function Lq(e){return(e.depthAndFlags&Mq)!==0}function Rq(e){return e.depthAndFlags&Aq}function zq(e,t){return(Rq(e)&t)!==0}function Bq(e,t){e.depthAndFlags|=t}function Vq(e,t){e.depthAndFlags=Pq(t,Rq(e),Iq(e))}var Hq=Symbol(`benchmarkInstrumentation`);function Uq(e,t){return t==null||Object.defineProperty(e,Hq,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Wq(e){return e==null?null:e[Hq]??null}function Gq(e,t,n){return e==null?n():e.measurePhase(t,n)}function Kq(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function qq(e){return e>=48&&e<=57}function Jq(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!qq(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&qq(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function Yq(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Jq(t)}}function Xq(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function Zq(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=Xq(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Qq(e,t,n){let r=Zq(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function $q(e,t){return Qq(e,t,Yq)}function eJ(e,t){return t===e.segments.length-1?e.isDirectory?1:0:1}function tJ(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=eJ(e,r);return a===eJ(t,r)?$q(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function nJ(e,t){return tJ(e,t)}function rJ(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Yq(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=eJ(e,n);return o===eJ(t,n)?Qq(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function iJ(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Yq(r);return e.sortKeyById[t]=i,i}function aJ(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function oJ(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function sJ(e){let{hasTrailingSlash:t,segments:n}=oJ(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function cJ(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=oJ(e);return{requiresDirectory:t,segments:n}}var lJ=``;function uJ(){let e=new Map;return e.set(lJ,0),{idByValue:e,valueById:[lJ],sortKeyById:[Yq(lJ)]}}function dJ(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function fJ(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var pJ=Symbol(`pathStorePreparedInputKind`);function mJ(e,t){return e[pJ]=t,e}function hJ(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function gJ(e,t,n){return n===`default`?nJ(e,t):n(hJ(e),hJ(t))}function _J(){return{depthAndFlags:Pq(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function vJ(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function yJ(e){return e.isDirectory?e.segments.length:e.segments.length-1}function bJ(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function xJ(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function SJ(e,t={}){return OJ(e,t).map(e=>e.path)}function CJ(e,t={}){let n=OJ(e,t);return mJ({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function wJ(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return mJ({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function TJ(e){let t=e,n=t.preparedPaths;if(t[pJ]===`prepared`&&n!=null)return n;if(!bJ(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function EJ(e){let t=e;return t[pJ]===`presorted`&&t.presortedPaths!=null||xJ(t.presortedPaths)?t.presortedPaths:null}function DJ(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function OJ(e,t={}){let n=aJ(t),r=Wq(t);Kq(r,`workload.inputFiles`,e.length);let i=Gq(r,`store.preparePathEntries.parse`,()=>e.map(e=>sJ(e)));return Gq(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>gJ(e,t,n.sort))),i}var kJ=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[_J()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=uJ();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Wq(e),this.options=aJ(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,vq())}appendPaths(e){return Gq(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>sJ(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Gq(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Gq(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:Pq(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:Pq(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:Pq(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=sJ(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:Pq(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:Pq(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=sJ(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Gq(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Gq(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort===`default`?rJ(this.lastPreparedPath,e,this.segmentSortKeyCache):gJ(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=yJ(e),i=n==null?0:yJ(n),a=n==null?0:vJ(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=dJ(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:Pq(Fq(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),Sq(i,s),s}createFileChildUnchecked(e,t){let n=dJ(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Pq(Fq(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Sq(r,a),a}getOrCreateDirectoryChild(e,t){let n=dJ(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!Lq(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Pq(Fq(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Sq(r,a),this.directories.set(a,vq()),a}createDirectoryChild(e,t){let n=dJ(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Pq(Fq(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Sq(r,a),this.directories.set(a,vq()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!Lq(n))throw Error(`Path is not a directory: "${t}"`);if(zq(n,1))throw Error(`Duplicate path: "${t}"`);Bq(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,yq());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(Lq(a)){let t=yq();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;Lq(n)&&this.directories.set(t,vq());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),Sq(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!Lq(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return wq(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function AJ(e,t=`closed`,n=null){let r=MJ(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function jJ(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function MJ(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function NJ(e,t){return zq(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:Fq(t)<=e.defaultExpansion}function PJ(e,t,n=e.snapshot.nodes[t]){return n==null||!Lq(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:NJ(e,n)}function FJ(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!Lq(r))return;let i=NJ(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function IJ(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function LJ(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function RJ(e,t){let n=IJ(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function zJ(e,t){let n=IJ(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function BJ(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function VJ(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function HJ(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function UJ(e,t){e.directoryLoadInfoById.delete(t)}function WJ(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function GJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function KJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function qJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function JJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function YJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function XJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function ZJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function QJ(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function $J(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function eY(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function tY(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function nY(e,t,n){return{...n,visibleCountDelta:pY(e)-t}}function rY(e,t){let n=pY(e),r=jJ();e.transactionStack.push(r);try{t()}catch(t){throw oY(e,r,!1),t}oY(e,r,!0,pY(e)-n)}function iY(e,t){let n=e.instrumentation;if(n==null){aY(e,t);return}Gq(n,`store.events.record`,()=>aY(e,t))}function aY(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){dY(e,t);return}n.events.push(t),uY(n,t)}function oY(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?lY(i,t):Gq(n,`store.events.batch.merge`,()=>lY(i,t));return}let a=sY(t,r),o=e.instrumentation;if(o==null){dY(e,a);return}Gq(o,`store.events.batch.commit`,()=>dY(e,a))}function sY(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function cY(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function lY(e,t){for(let n of t.events)e.events.push(n);cY(e,t)}function uY(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function dY(e,t){let n=e.instrumentation;if(n==null){fY(e,t);return}Gq(n,`store.events.emit`,()=>fY(e,t))}function fY(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function pY(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function mY(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!Lq(n)||zq(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!Lq(a)?null:i}function hY(e,t){let n=t;for(;;){let t=mY(e,n);if(t==null)return n;n=t}}function gY(e,t){let n=[t],r=t;for(;;){let t=mY(e,r);if(t==null)return n;n.push(t),r=t}}function _Y(e,t){let n=t==null?e.snapshot.rootId:DY(e,t);return n==null?[]:jY(e,n)}function vY(e,t){let n=sJ(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=KY(e,GY(e,r)),{createdNodeIds:a,directoryId:o}=MY(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=AY(e,o);if(zq(n,1))throw Error(`Path already exists: "${t}"`);Bq(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=PY(e,o,n.basename),s.add(c);wY(e,o);let l=KY(e,o);return GJ({affectedAncestorIds:EY(e,c),affectedNodeIds:[...s],path:t,projectionChanged:qY(i,l)})}function yY(e,t,n){let r=DY(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=AY(e,r);if(zq(i,2))throw Error(`The root node cannot be removed`);if(Lq(i)&&kY(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=KY(e,a),s=UY(e,r);LY(e,a,r,i.nameId),WY(e,a),wY(e,a);let c=KY(e,a);return KJ({affectedAncestorIds:EY(e,a),affectedNodeIds:s,path:t,projectionChanged:qY(o,c),recursive:n.recursive===!0})}function bY(e,t,n,r){let i=DY(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=AY(e,i);if(zq(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=VY(e,i,n),c=KY(e,a.parentId),l=KY(e,s.parentId),u=fJ(e.snapshot.segmentTable,a.nameId),d=dJ(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(Lq(a)&&ZY(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=bq(e.snapshot.nodes,kY(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&HY(e,p,o,Iq(a))===`skip`)return null;let m=a.parentId;LY(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),XY(e,i),IY(e,s.parentId,i),WY(e,m),e.pathCacheVersion++,wY(e,m),s.parentId!==m&&wY(e,s.parentId);let h=KY(e,m),g=KY(e,s.parentId);return qJ({affectedAncestorIds:[...new Set([...EY(e,m),...EY(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:JY([c,l],[h,g]),to:CY(e,i)})}function xY(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function SY(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function CY(e,t){let n=AY(e,t),r=xY(e,t);if(r!=null)return r;if(zq(n,2))return SY(e,t,``);let i=CY(e,n.parentId),a=fJ(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return SY(e,t,Lq(n)?`${o}/`:o)}function wY(e,t){let n=e.instrumentation;if(n==null){$Y(e,t);return}Gq(n,`store.recomputeCountsUpwardFrom`,()=>$Y(e,t))}function TY(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!Lq(o)){QY(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){QY(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function EY(e,t){let n=[],r=t;for(;r!=null;){let t=AY(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function DY(e,t){if(t.length===0)return e.snapshot.rootId;let n=cJ(t);return OY(e,n.segments,n.requiresDirectory)}function OY(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=kY(e,r),a=bq(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=AY(e,r);return n&&!Lq(i)?null:r}function kY(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function AY(e,t){let n=e.snapshot.nodes[t];if(n===void 0||zq(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function jY(e,t){let n=e.snapshot.nodes[t];if(n===void 0||zq(n,4))return[];if(!Lq(n))return[CY(e,t)];if(kY(e,t).childIds.length===0)return zq(n,1)&&!zq(n,2)?[CY(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||zq(n,4)){i.pop();continue}if(!Lq(n)){r.push(CY(e,t.nodeId)),i.pop();continue}let a=kY(e,t.nodeId);if(a.childIds.length===0){zq(n,1)&&!zq(n,2)&&r.push(CY(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function MY(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=dJ(e.snapshot.segmentTable,i),a=kY(e,r),o=bq(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!Lq(AY(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=NY(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function NY(e,t,n){let r=AY(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Pq(Fq(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,vq()),IY(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function PY(e,t,n){let r=dJ(e.snapshot.segmentTable,n),i=kY(e,t);if(bq(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${tX(e,t,n)}"`);let a=AY(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Pq(Fq(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),IY(e,t,o),e.activeNodeCount++,o}function FY(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}RY(e,n,o)<0?i=a:r=a+1}return r}function IY(e,t,n){let r=kY(e,t),i=AY(e,n);bq(e.snapshot.nodes,r).set(i.nameId,n),Tq(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=FY(e,r,n);r.childIds.splice(a,0,n),Cq(r,a),Oq(e.snapshot.nodes,r)}function LY(e,t,n,r){let i=kY(e,t),a=xq(i),o=a.get(n)??-1;bq(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Tq(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),Cq(i,o),Oq(e.snapshot.nodes,i))}function RY(e,t,n){let r=e.snapshot.options.sort;return r===`default`?zY(e,t,n):r(BY(e,t),BY(e,n))}function zY(e,t,n){let r=AY(e,t),i=AY(e,n),a=Lq(r);if(a!==Lq(i))return a?-1:1;let o=Zq(iJ(e.snapshot.segmentTable,r.nameId),iJ(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=fJ(e.snapshot.segmentTable,r.nameId),c=fJ(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function BY(e,t){let n=AY(e,t),r=CY(e,t),i=Lq(n),a=i?r.slice(0,-1):r;return{basename:fJ(e.snapshot.segmentTable,n.nameId),depth:Fq(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function VY(e,t,n){let r=AY(e,t),i=DY(e,n);if(i!=null){let t=AY(e,i);if(Lq(t))return{basename:fJ(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=cJ(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=cJ(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:OY(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function HY(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${CY(e,t)}"`);let i=AY(e,t);if(Iq(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(Lq(i)&&kY(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return UY(e,t),LY(e,a,t,o),WY(e,a),wY(e,a),`handled`}function UY(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=AY(e,t.nodeId);if(t.visitedChildren||!Lq(i)){Lq(i)&&e.snapshot.directories.delete(t.nodeId),Bq(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),UJ(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=kY(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function WY(e,t){let n=t;for(;n!=null;){let t=AY(e,n);if(!Lq(t)||zq(t,2)||kY(e,n).childIds.length>0)return;Bq(t,1),n=t.parentId===n?null:t.parentId}}function GY(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=bq(e.snapshot.nodes,kY(e,n)).get(t);if(i==null||!Lq(AY(e,i)))break;n=i}return n}function KY(e,t){let n=YY(e,t);if(n==null)return null;let r=hY(e,n),i=AY(e,r),a=n===r?null:gY(e,n).map(t=>CY(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:kY(e,r).childIds.length>0,path:CY(e,r),terminalKind:Iq(i)})}function qY(e,t){return JY([e],[t])}function JY(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function YY(e,t){let n=t;for(;n!=null;){let t=AY(e,n);if(!Lq(t)||zq(t,2))return null;if(!PJ(e,n,t))return n;n=t.parentId}return null}function XY(e,t){let n=AY(e,t);if(Vq(n,(t===e.snapshot.rootId?-1:Fq(AY(e,n.parentId)))+1),!Lq(n))return;let r=kY(e,t);for(let t of r.childIds)XY(e,t)}function ZY(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=AY(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function QY(e,t,n=AY(e,t),r=!1){let i=e.instrumentation;if(i==null){eX(e,t,n,r);return}Gq(i,`store.recomputeNodeCounts`,()=>eX(e,t,n,r))}function $Y(e,t){let n=t;for(;n!=null;){let t=AY(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(QY(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Tq(kY(e,s),n,a,o),n=s}}function eX(e,t,n,r){if(!Lq(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=kY(e,t);if(r){let t=e.instrumentation;t==null?wq(e.snapshot.nodes,i):Gq(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>wq(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,zq(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=mY(e,t)==null?PJ(e,t,n)?1+o:1:o}function tX(e,t,n){let r=CY(e,t);return r.length===0?n:`${r}${n}`}function nX(e){return e!=null&&!zq(e,4)}function rX(e,t){let n=e.snapshot.nodes[t];return!nX(n)||!Lq(n)||zq(n,2)?null:n}function iX(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&nX(e.snapshot.nodes[n])&&(t+=1);return t}function aX(e){return Math.max(0,e.valueById.length-1)}function oX(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:iX(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:aX(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function sX(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function cX(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)rX(e,n)!=null&&t.push(CY(e,n));for(let t of e.expandedDirectoryIds)rX(e,t)!=null&&n.push(CY(e,t));return{collapsedPaths:t,expandedPaths:n}}function lX(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)rX(e,n)==null||LJ(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:CY(e,n)});return t}function uX(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=DY(e,n);t!=null&&FJ(e,t,!0,AY(e,t))}for(let n of t.collapsedPaths){let t=DY(e,n);t!=null&&FJ(e,t,!1,AY(e,t))}}function dX(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=DY(e,n.path);t!=null&&rX(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function fX(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function pX(e){let t=e.snapshot.segmentTable,n=uJ();for(let r of e.snapshot.nodes)if(nX(r)){if(zq(r,2)){r.nameId=0;continue}r.nameId=dJ(n,fJ(t,r.nameId))}e.snapshot.segmentTable=n}function mX(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!nX(r)||!Lq(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return nX(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[AY(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),wq(e.snapshot.nodes,n)}}function hX(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(nX(n))break;--t}e.snapshot.nodes.length=t+1}function gX(e){let t=cX(e),n=lX(e);Gq(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>fX(e)),Gq(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>pX(e)),Gq(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>mX(e)),Gq(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>hX(e)),Gq(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>uX(e,t)),Gq(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>dX(e,n)),Gq(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>TY(e,e.snapshot.rootId))}function _X(e){let t=cX(e),n=lX(e),r=Gq(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>_Y(e)),i=Uq({...e.snapshot.options},e.instrumentation),a=Gq(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new kJ(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,Gq(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>uX(e,t)),Gq(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>dX(e,n)),Gq(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>TY(e,e.snapshot.rootId))}function vX(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function yX(e,t){let n=oX(e);t===`stable`?Gq(e.instrumentation,`store.cleanup.stable`,()=>gX(e)):Gq(e.instrumentation,`store.cleanup.aggressive`,()=>_X(e));let r=oX(e);return sX(t,t===`stable`,n,r)}var bX=64;function xX(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function SX(e){return AY(e,e.snapshot.rootId).visibleSubtreeCount}function CX(e,t,n,r){let i=AY(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function wX(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:UX(e,t.cursor),setSize:t.setSize,subtreeEndIndex:CX(e,t.cursor,t.index,n)}}function TX(e,t,n,r,i,a){let o=kY(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=Eq(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return EX(e,u,l,r+c,i+1,s,o.childIds.length,a)}function EX(e,t,n,r,i,a,o,s){if(!Lq(AY(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=LX(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=AY(e,c.terminalNodeId);if(!Lq(l)||!PJ(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return TX(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function DX(e,t){let n=SX(e);if(t<0||t>=n)return null;let r=TX(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>CY(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=wX(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:UX(e,r.cursor),setSize:r.setSize,subtreeEndIndex:CX(e,r.cursor,r.index,n)}}function OX(e,t,n){let r=e.instrumentation,i=SX(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return HX(e,o+1);let t=[],n=PX(e,a);for(let r=a;r<=o&&n!=null;r++){let r=UX(e,n);t.push(r),n=zX(e,n)}return t}let s=[],c=0,l=0,u=Gq(r,`store.getVisibleSlice.selectFirstRow`,()=>PX(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Gq(r,`store.getVisibleSlice.materializeRow`,()=>UX(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Gq(r,`store.getVisibleSlice.advanceCursor`,()=>zX(e,u))}return Kq(r,`workload.visibleRowsRead`,s.length),Kq(r,`workload.flattenedRowsRead`,c),Kq(r,`workload.flattenedSegmentsRead`,l),s}function kX(e,t=SX(e)){let n=e.instrumentation;return n==null?VX(e,t):Gq(n,`store.getVisibleTreeProjection`,()=>VX(e,t))}function AX(e){return BX(kX(e))}function jX(e,t){let n=DY(e,t);if(n==null||n===e.snapshot.rootId||Lq(AY(e,n))&&hY(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=AY(e,i).parentId,n=kY(e,t),s=xq(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=Dq(a,n,s),t!==o){let n=AY(e,t),a=mY(e,t);if(!PJ(e,t,n)&&a!==i)return null;hY(e,t)===t&&(r+=1)}i=t}return r}function MX(e,t){let n=DY(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=AY(e,n);if(!Lq(r))throw Error(`Path is not a directory: "${t}"`);return PJ(e,n,r)?null:(FJ(e,n,!0,r),wY(e,n),JJ({affectedAncestorIds:EY(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function NX(e,t){let n=DY(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=AY(e,n);if(!Lq(r))throw Error(`Path is not a directory: "${t}"`);return PJ(e,n,r)?(FJ(e,n,!1,r),wY(e,n),YJ({affectedAncestorIds:EY(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function PX(e,t){return t<0||t>=SX(e)?null:FX(e,e.snapshot.rootId,t,-1)}function FX(e,t,n,r){let i=kY(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?Eq(e.snapshot.nodes,i,n):Gq(a,`store.getVisibleSlice.selectChildIndex`,()=>Eq(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return IX(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function IX(e,t,n,r){if(!Lq(AY(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=LX(e,t,r);if(n===0)return i;let a=AY(e,i.terminalNodeId);if(!Lq(a)||!PJ(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return FX(e,i.terminalNodeId,n-1,i.visibleDepth)}function LX(e,t,n){return Lq(AY(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:hY(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Gq(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>hY(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function RX(e,t){let n=AY(e,t);if(!Lq(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:mY(e,r)!==t}function zX(e,t){let n=AY(e,t.terminalNodeId);if(Lq(n)){let r=kY(e,t.terminalNodeId);if(PJ(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:IX(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=AY(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=kY(e,n),o=xq(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return IX(e,s,0,i);RX(e,r)&&i--,r=n}}function BX(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function VX(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(bX);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=xX(o,y);let x,S=_;if(Lq(v))S=f?hY(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:CY(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&Lq(C)&&PJ(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function HX(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!Lq(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:CY(e,f)};continue}let h=l?hY(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=UX(e,g);let _=i[h];_!=null&&Lq(_)&&PJ(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function UX(e,t){let n=AY(e,t.terminalNodeId),r=Lq(n)?WX(e,t):null,i=CY(e,t.terminalNodeId),a=fJ(e.snapshot.segmentTable,n.nameId),o=Lq(n)&&kY(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?gY(e,t.headNodeId).map(n=>{let r=AY(e,n);return{isTerminal:n===t.terminalNodeId,name:fJ(e.snapshot.segmentTable,r.nameId),nodeId:n,path:CY(e,n)}}):Gq(c,`store.getVisibleSlice.flatten.collectSegments`,()=>gY(e,t.headNodeId).map(n=>{let r=AY(e,n);return{isTerminal:n===t.terminalNodeId,name:fJ(e.snapshot.segmentTable,r.nameId),nodeId:n,path:CY(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:Lq(n)&&PJ(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:Lq(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function WX(e,t){if(t.headNodeId===t.terminalNodeId)return LJ(e,t.terminalNodeId);let n=gY(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=LJ(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function GX(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!Lq(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&Oq(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&Lq(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,Oq(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function KX(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var qX=class e{#e;constructor(e={}){let t=Wq(e),n=Gq(t,`store.builder.create`,()=>new kJ(e));if(e.preparedInput!=null){let t=EJ(e.preparedInput);t==null?n.appendPreparedPaths(TJ(e.preparedInput),!1):n.appendPresortedPaths(t,DJ(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Gq(t,`store.preparePathEntries`,()=>OJ(r,e)))}let r=Gq(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Gq(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Gq(t,`store.state.create`,()=>AJ(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Gq(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||KX(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Gq(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?Gq(t,`store.state.initializeOpenVisibleCounts`,()=>GX(this.#e)):Gq(t,`store.state.recomputeCounts`,()=>TY(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return SJ(e,t)}static prepareInput(e,t={}){return CJ(e,t)}static preparePresortedInput(e){return wJ(e)}list(e){return Gq(this.#e.instrumentation,`store.list`,()=>_Y(this.#e,e))}add(e){Gq(this.#e.instrumentation,`store.add`,()=>{let t=SX(this.#e);iY(this.#e,nY(this.#e,t,vY(this.#e,e)))})}remove(e,t={}){Gq(this.#e.instrumentation,`store.remove`,()=>{let n=SX(this.#e);iY(this.#e,nY(this.#e,n,yY(this.#e,e,t)))})}move(e,t,n={}){Gq(this.#e.instrumentation,`store.move`,()=>{let r=SX(this.#e),i=bY(this.#e,e,t,n);i!=null&&iY(this.#e,nY(this.#e,r,i))})}batch(e){rY(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return Gq(this.#e.instrumentation,`store.getVisibleCount`,()=>SX(this.#e))}getVisibleSlice(e,t){return Gq(this.#e.instrumentation,`store.getVisibleSlice`,()=>OX(this.#e,e,t))}getVisibleRowContext(e){return Gq(this.#e.instrumentation,`store.getVisibleRowContext`,()=>DX(this.#e,e))}getVisibleTreeProjection(){return AX(this.#e)}getVisibleTreeProjectionData(e){return kX(this.#e,e)}getVisibleIndex(e){return Gq(this.#e.instrumentation,`store.getVisibleIndex`,()=>jX(this.#e,e))}getPathInfo(e){return Gq(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=DY(this.#e,e);if(t==null)return null;let n=AY(this.#e,t);return{depth:Fq(n),kind:Lq(n)?`directory`:`file`,path:CY(this.#e,t)}})}isExpanded(e){return Gq(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=AY(this.#e,t);return PJ(this.#e,t,n)})}expand(e){Gq(this.#e.instrumentation,`store.expand`,()=>{let t=SX(this.#e),n=MX(this.#e,e);n!=null&&iY(this.#e,nY(this.#e,t,n))})}collapse(e){Gq(this.#e.instrumentation,`store.collapse`,()=>{let t=SX(this.#e),n=NX(this.#e,e);n!=null&&iY(this.#e,nY(this.#e,t,n))})}on(e,t){return WJ(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return LJ(this.#e,t)}markDirectoryUnloaded(e){Gq(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(kY(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=SX(this.#e);zJ(this.#e,t),iY(this.#e,nY(this.#e,n,XJ({affectedAncestorIds:EY(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Gq(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=SX(this.#e),r=RJ(this.#e,t);return iY(this.#e,nY(this.#e,n,ZJ({affectedAncestorIds:EY(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Gq(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||LJ(this.#e,n)!==`loading`||!VJ(this.#e,n,e.attemptId))return!1;let r=CY(this.#e,n);this.validateChildPatch(r,t);let i=SX(this.#e),a=[];for(let e of t.operations){JX(r,e);let t=SX(this.#e);switch(e.type){case`add`:a.push(nY(this.#e,t,vY(this.#e,e.path)));break;case`remove`:a.push(nY(this.#e,t,yY(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=bY(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(nY(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return iY(this.#e,nY(this.#e,i,QJ({affectedAncestorIds:EY(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:CY(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Gq(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=SX(this.#e),r=BJ(this.#e,t,e.attemptId);return iY(this.#e,nY(this.#e,n,$J({affectedAncestorIds:EY(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:CY(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Gq(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=SX(this.#e),i=HJ(this.#e,n,e.attemptId,t);return iY(this.#e,nY(this.#e,r,eY({affectedAncestorIds:EY(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:CY(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Gq(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(vX(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=SX(this.#e),n=yX(this.#e,e.mode??`stable`);return iY(this.#e,nY(this.#e,t,tY({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=kY(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Yq(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=Zq(iJ(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!Lq(AY(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=AY(this.#e,n);PJ(this.#e,n,i)||(FJ(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=AY(this.#e,e);if(!PJ(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=DY(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!Lq(AY(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!Lq(AY(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=AY(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=AY(this.#e,e),r=mY(this.#e,e);if(!PJ(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function JX(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var YX=e=>e.startsWith(`f::`)?e.slice(3):e;function XX(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function ZX(e,t){return e===``?t:`${e}/${t}`}function QX({files:e,path:t,isFolder:n,nextBasename:r}){let i=YX(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=XX(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=ZX(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function $X(e){return e.endsWith(`/`)}function eZ(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function tZ(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function nZ(e,t){return t.includes(e)?tZ(t):[e]}function rZ(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function iZ(e,t){return{draggedPaths:e,target:t}}function aZ(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if($X(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function oZ(e,t){return t.kind===`root`||t.directoryPath==null?eZ(e):t.directoryPath}function sZ(e,t){let n=e.map(e=>{let n=oZ(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function cZ(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function lZ(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!cZ(qX.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function uZ(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function dZ(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function fZ(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function pZ(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return fZ(e,t.path)?n?e:null:e;case`move`:return dZ(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=pZ(r,e,n),r==null)return null;return r}}}function mZ(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function hZ(e){switch(e.operation){case`add`:return{...mZ(e),operation:`add`,path:e.path};case`remove`:return{...mZ(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...mZ(e),from:e.from,operation:`move`,to:e.to}}}function gZ(e){return{...mZ(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>hZ(e)),operation:`batch`}}function _Z(e){switch(e.operation){case`add`:case`remove`:case`move`:return hZ(e);case`batch`:return gZ(e);default:return null}}function vZ(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function yZ(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function bZ(e){return yZ(e).at(-1)??null}function xZ(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function SZ(e){return e.endsWith(`/`)}var CZ=e=>e.toLowerCase();function wZ(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function TZ(e){return e.endsWith(`/`)?e.slice(0,-1):e}function EZ(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var DZ=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},OZ=Symbol(`FILE_TREE_RENAME_VIEW`),kZ=512,AZ=512;function jZ(e){return e===`top`||e===`center`?e:`nearest`}function MZ(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=yZ(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function NZ(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:MZ(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var PZ=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=lZ({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=bZ(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:jZ(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=AZ){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=nZ(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=iZ(t.draggedPaths,n);(aZ(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}rZ(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=iZ(e.draggedPaths,t);if(aZ(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=sZ(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=SZ(r),a=TZ(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of yZ(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=wZ(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[OZ](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,SZ(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,SZ(e)?{recursive:!0}:void 0);return}let t=SZ(e),n=QX({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:TZ(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(EZ(n.sourcePath,t),EZ(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=lZ({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!vZ(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=bZ(e),n=xZ(e,t),r=null,i=null;for(let e of this.#be()){if(bZ(e)!==t)continue;let a=xZ(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=yZ(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!vZ(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new qX({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of yZ(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(CZ),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(CZ),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of yZ(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:DZ(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of yZ(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of yZ(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=NZ(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,kZ)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#De()))}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=pZ(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=pZ(this.#c,e,!0),r=[...this.#B].map(t=>pZ(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=pZ(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return vZ(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&uZ(e)&&(this.#i=null);let t=uZ(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=_Z(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},FZ=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function IZ(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function LZ(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function RZ(e,t){return t?`${e}/`:e}function zZ(e,t=null){let n=FZ(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=IZ(t.path);if(e==null)continue;let n=RZ(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of LZ(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var BZ=e=>e.trim().toLowerCase(),VZ=e=>e.split(`/`).at(-1)??e,HZ=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function UZ(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function WZ(e){let t=eq(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(BZ(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let n=VZ(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return UZ(c,e);for(let[t,n]of a)if(s.includes(t))return UZ(n,e);let l=HZ(n);for(let t of l){let n=i.get(t);if(n!=null)return UZ(n,e)}let u=QK(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:XK(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:UZ(s,e)}}}var GZ,KZ,qZ,JZ,YZ,XZ,ZZ,QZ,$Z,eQ,tQ={},nQ=[],rQ=Array.isArray,iQ=nQ.slice,aQ=Object.assign;function oQ(e){e&&e.parentNode&&e.remove()}function sQ(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?iQ.call(arguments,2):n),cQ(e,o,r,i,null)}function cQ(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++KZ,__i:-1,__u:0};return i==null&&GZ.vnode!=null&&GZ.vnode(a),a}function lQ(e){return e.children}function uQ(e,t){this.props=e,this.context=t,this.__g=0}function dQ(e,t){if(t==null)return e.__?dQ(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?dQ(e):null}function fQ(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return fQ(e)}}function pQ(e){(8&e.__g||!(e.__g|=8)||!qZ.push(e)||YZ++)&&JZ==GZ.debounceRendering||((JZ=GZ.debounceRendering)||queueMicrotask)(mQ)}function mQ(){for(var e,t,n,r,i,a,o,s,c=1;qZ.length;)qZ.length>c&&qZ.sort(XZ),e=qZ.shift(),c=qZ.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=aQ({},r)).__v=r.__v+1,GZ.vnode&&GZ.vnode(n),SQ(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??dQ(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,wQ(a,n,o),n.__e!=i&&fQ(n)));YZ=0}function hQ(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||nQ,b=t.length;for(c=gQ(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?tQ:y[m.__i]||tQ,m.__i=f,_=SQ(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&DQ(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=_Q(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function gQ(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?cQ(null,o,null,null,null):rQ(o)?cQ(lQ,{children:o},null,null,null):o.constructor==null&&o.__b>0?cQ(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=vQ(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=dQ(s)),OQ(s,s));return r}function _Q(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=_Q(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=dQ(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function vQ(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function yQ(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function bQ(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||yQ(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||yQ(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(ZZ,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=QZ,e.addEventListener(t,a?eQ:$Z,a)):e.removeEventListener(t,a?eQ:$Z,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function xQ(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=QZ++;else if(t.u<n.l)return;return n(GZ.event?GZ.event(t):t)}}}function SQ(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=GZ.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new M(v,x):(t.__c=f=new uQ(v,x),f.constructor=M,f.render=kQ),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=aQ({},f.__s)),aQ(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=GZ.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=aQ({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===lQ&&d.key==null&&(E=TQ(d.props.children)),s=hQ(e,rQ(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)oQ(a[j]);CQ(t)}else t.__e=n.__e,t.__k=n.__k,e.then||CQ(t);GZ.__e(e,t,n)}else s=t.__e=EQ(n.__e,t,n,r,i,a,o,c,l,u);return(d=GZ.diffed)&&d(t),128&t.__u?void 0:s}function CQ(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(CQ)}function wQ(e,t,n){for(var r=0;r<n.length;r++)DQ(n[r],n[++r],n[++r]);GZ.__c&&GZ.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){GZ.__e(e,t.__v)}})}function TQ(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:rQ(e)?e.map(TQ):aQ({},e)}function EQ(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(GZ.__m&&GZ.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=iQ.call(e.childNodes),v=n.props||tQ,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;bQ(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||bQ(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),hQ(b==`template`?e.content:e,rQ(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&dQ(n,0),s,c,l),a!=null)for(u=a.length;u--;)oQ(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||bQ(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&bQ(e,u,g,v[u],i))}return e}function DQ(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){GZ.__e(e,n)}}function OQ(e,t,n){var r,i;if(GZ.unmount&&GZ.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||DQ(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){GZ.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&OQ(r[i],t,n||typeof e.type!=`function`);n||oQ(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function kQ(e,t,n){return this.constructor(e,n)}function AQ(e,t){var n,r,i,a;t==document&&(t=document.documentElement),GZ.__&&GZ.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=sQ(lQ,null,[e]),i=[],a=[],SQ(t,e,r||tQ,tQ,t.namespaceURI,r?null:t.firstChild?iQ.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),wQ(i,e,a)}function jQ(e,t){e.__u|=32,AQ(e,t)}GZ={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw YZ=0,e}},KZ=0,uQ.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=aQ({},this.state);typeof e==`function`&&(e=e(aQ({},n),this.props)),e&&aQ(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),pQ(this))},uQ.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),pQ(this))},uQ.prototype.render=lQ,qZ=[],YZ=0,XZ=function(e,t){return e.__v.__b-t.__v.__b},ZZ=/(PointerCapture)$|Capture$/i,QZ=0,$Z=xQ(!1),eQ=xQ(!0);var MQ=0;Array.isArray;function NQ(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--MQ,__i:-1,__u:0,__source:i,__self:a};return GZ.vnode&&GZ.vnode(l),l}var PQ=16,FQ=16,IQ={};function LQ({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=IQ[e]??{width:PQ,height:FQ},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`,h=o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`};return NQ(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...h,viewBox:m,width:f,height:p,children:NQ(`use`,{href:c})})}var RQ=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},zQ=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},BQ=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},VQ=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},HQ=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},UQ=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function WQ({children:e,marker:t,variant:n=`default`}){"use no memo";let r=n===`fade`;return NQ(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:NQ(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):r?NQ(`span`,{"data-truncate-fade":!0}):t})})}function GQ(e){"use no memo";let{mode:t,children:n}=e;return NQ(`div`,{children:[NQ(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?NQ(`span`,{children:n}):n}),NQ(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?NQ(`span`,{children:n}):n})]})}function KQ({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=NQ(GQ,{mode:t,children:e},`content`),o=NQ(WQ,{marker:n,mode:t,variant:r},`marker`),s=NQ(`div`,{"data-truncate-fill":!0},`fill`);return NQ(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:NQ(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function qQ({children:e,...t}){"use no memo";return NQ(KQ,{mode:`truncate`,...t,children:e})}function JQ({children:e,...t}){"use no memo";return NQ(KQ,{mode:`fruncate`,...t,children:e})}function YQ({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=NQ(qQ,{...s,children:t[0]}),l=NQ(JQ,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return NQ(`div`,{className:a,style:o});if(e.length<i)return NQ(n===`end`?JQ:qQ,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=RQ:r===`extension`?t=zQ:r===`leaf-path`&&(t=BQ);else if(typeof r==`number`)t=VQ,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=HQ:e===`first`&&(t=UQ)}else typeof r==`function`&&(t=r);t??=RQ;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=NQ(qQ,{...s,..._,children:f}),l=NQ(JQ,{...s,...v,children:p})}return NQ(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[NQ(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),NQ(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var XQ={endIndex:-1,startIndex:-1};function ZQ(e,t,n){return Math.min(Math.max(e,t),n)}function QQ(e,t){return e<0||t<e?XQ:{endIndex:t,startIndex:e}}function $Q(e){return e.startIndex<0||e.endIndex<e.startIndex}function e$(e,t){return $Q(e)?0:(e.endIndex-e.startIndex+1)*t}function t$(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function n$(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function r$(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function i$(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function a$(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function o$(e,t,n){if(e.length===0||t<=0)return[];let r=a$(e),i=r$(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=i$(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function s$(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=ZQ(t.scrollTop,0,o),c=t.stickyRows??o$(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=t$(s,n,t.itemHeight),m=t$(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?XQ:QQ(m,n$(u+d,n,t.itemHeight)),y=g+1,b=$Q(v)?XQ:QQ(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=e$(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:$Q(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var c$={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},l$={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},u$=`Contains git status items`;function d$(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function f$(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return d$({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function p$(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function m$(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function h$(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function g$(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function _$(e,t){return e!=null&&e>0?e:t}function v$(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function y$(e,t,n,r,i=0){let a=d$({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function b$(e,t,n,r,i,a,o=0){let s=f$({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function x$(e,t,n,r,i,a){let o=p$({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function S$(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function C$(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function w$({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return NQ(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function T$(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function E$(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var D$,O$,k$,A$,j$=Object.is,M$=0,N$=[],P$=GZ,F$=P$.__b,I$=P$.__r,L$=P$.diffed,R$=P$.__c,z$=P$.unmount,B$=P$.__;function V$(e,t){P$.__h&&P$.__h(O$,e,M$||t),M$=0;var n=O$.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function H$(e){return M$=1,U$(t1,e)}function U$(e,t,n){var r=V$(D$++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):t1(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);j$(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=O$,!O$.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,j$(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};O$.__f=!0;var a=O$.shouldComponentUpdate,o=O$.componentWillUpdate;O$.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},O$.shouldComponentUpdate=i}return r.__N||r.__}function W$(e,t){var n=V$(D$++,3);!P$.__s&&e1(n.__H,t)&&(n.__=e,n.u=t,O$.__H.__h.push(n))}function G$(e,t){var n=V$(D$++,4);!P$.__s&&e1(n.__H,t)&&(n.__=e,n.u=t,O$.__h.push(n))}function K$(e){return M$=5,q$(function(){return{current:e}},[])}function q$(e,t){var n=V$(D$++,7);return e1(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function J$(e,t){return M$=8,q$(function(){return e},t)}function Y$(){for(var e;e=N$.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Q$),e.__H.__h.forEach($$),e.__H.__h=[]}catch(t){e.__H.__h=[],P$.__e(t,e.__v)}}P$.__b=function(e){O$=null,F$&&F$(e)},P$.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),B$&&B$(e,t)},P$.__r=function(e){I$&&I$(e),D$=0;var t=(O$=e.__c).__H;t&&(k$===O$?(t.__h=[],O$.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(Q$),t.__h.forEach($$),t.__h=[],D$=0)),k$=O$},P$.diffed=function(e){L$&&L$(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(N$.push(t)!==1&&A$===P$.requestAnimationFrame||((A$=P$.requestAnimationFrame)||Z$)(Y$)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),k$=O$=null},P$.__c=function(e,t){t.some(function(e){try{e.__h.forEach(Q$),e.__h=e.__h.filter(function(e){return!e.__||$$(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],P$.__e(n,e.__v)}}),R$&&R$(e,t)},P$.unmount=function(e){z$&&z$(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{Q$(e)}catch(e){t=e}}),n.__H=void 0,t&&P$.__e(t,n.__v))};var X$=typeof requestAnimationFrame==`function`;function Z$(e){var t,n=function(){clearTimeout(r),X$&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);X$&&(t=requestAnimationFrame(n))}function Q$(e){var t=O$,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),O$=t}function $$(e){var t=O$;e.__c=e.__(),O$=t}function e1(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!j$(t,e[n])})}function t1(e,t){return typeof t==`function`?t(e):t}function n1(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:NQ(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return NQ(lQ,{children:[NQ(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:NQ(qQ,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function r1(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function i1(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function a1(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function o1({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=s$(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:a1(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?a1(u,1,t,o):i&&r<=0&&c.length>0?o$(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var s1=400,c1=10,l1=40,u1=18;function d1(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?f1(e,t,n):a instanceof HTMLElement?a:null}function f1(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function p1(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function m1(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function h1(){return navigator.vendor!==`Apple Computer, Inc.`}function g1(e,t){let n=e-t.top;if(n<l1)return-Math.ceil((l1-Math.max(0,n))/l1*u1);let r=t.bottom-e;return r<l1?Math.ceil((l1-Math.max(0,r))/l1*u1):0}function _1(e,t){if(e!=null){let t=c$[e];return t==null?null:{text:t,title:l$[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:u$}:null}function v1(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function y1(e){return e!=null&&`toggle`in e}function b1(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function x1(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function S1(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function C1(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function w1(e,t){return t&&C1(e)||(e.ctrlKey||e.metaKey)&&b1(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var T1=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function E1(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function D1(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function O1(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function k1(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function A1(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function j1(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function M1(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function N1(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function P1(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=N1(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function F1(e,t){return{kind:e.kind,name:i1(e),path:t}}function I1(e){return e==null?void 0:`${e}__tree`}function L1(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function R1(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function z1(e,t){if(e==null)return null;if(`text`in e)return NQ(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?R1(e.icon)?t(e.icon):{name:e.icon}:R1(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return NQ(`span`,{title:e.title,children:NQ(LQ,{...n})})}function B1(e){e!=null&&m$(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function V1(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=r1(e);return NQ(lQ,{children:[e.depth>0?NQ(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>NQ(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,NQ(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?NQ(LQ,{...t(`file-tree-icon-chevron`)}):NQ(LQ,{...t(`file-tree-icon-file`,u)})}),NQ(`div`,{"data-item-section":`content`,children:e.isFlattened?n1(e,c,a):c??NQ(YQ,{minimumLength:5,split:`extension`,children:e.name})}),i?NQ(`div`,{"data-item-section":`decoration`,children:r==null?null:z1(r,t)}):null,s?NQ(`div`,{"data-item-section":`git`,children:z1(o,t)}):null,n?NQ(`div`,{"data-item-section":`action`,children:l?NQ(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:NQ(LQ,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function H1(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=r1(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??v1(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=_1(z,B),U=S&&w,W=V!=null||x||U,ee=U&&T===`always`,te=a.getPath()===P,ne=te?a.getValue():``,re=R||!te?null:NQ(w$,{ref:D,ariaLabel:`Rename ${i1(t)}`,isFlattened:t.isFlattened,value:ne,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ie=V1(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:re,showDecorativeActionAffordance:ee}),ae={...T$({ariaLabel:i1(t),domId:t.isFocused?L1(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:U,contextMenuButtonVisibility:U?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:B,effectiveGitStatus:z,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(P),j(t,P,{anchorRect:O1(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&te?NQ(`div`,{...ae,children:ie}):NQ(`button`,{...ae,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:ie})}function U1(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(r1(e))).map((n,r)=>H1(e,n,t.start+r))}function W1({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=rq,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=K$(null),v=K$(null),y=K$(!1),b=K$(null),x=K$(null),S=K$(null),C=K$(null),w=K$(null),T=K$(new Map),E=K$(new Map),D=K$(()=>{}),O=K$(null),k=K$(0),A=K$(!1),j=K$(null);j.current!==t&&(A.current=!1,j.current=t);let M=K$(!1),N=K$(null),P=K$(null),F=K$(!1),I=K$(null),L=K$(null),R=K$(null),z=K$(null),B=K$(null),V=K$(null),H=K$(null),U=K$(null),W=K$(!1),ee=K$(null),te=K$(null),ne=K$(null),re=K$(null),ie=q$(()=>new Map,[]),[,ae]=H$(0),[oe,G]=H$(null),[se,K]=H$(null),[ce,le]=H$(null),[ue,de]=H$(null),[fe,pe]=H$(0),[me,he]=H$(null),ge=K$(me);ge.current=me;let _e=K$(null),ve=K$(null),ye=K$(null),be=K$(null),xe=K$(null),Se=K$(!1),Ce=()=>{ve.current=null,ye.current=null,be.current=null},we=(e,t)=>{ve.current=e,ye.current=null,be.current=t==null?null:{path:e,scrollTop:t}},Te=(e,t)=>{ve.current=null,ye.current={path:e,viewportOffset:t},be.current=null},Ee=K$(d===`retain`&&t.isSearchOpen()),[De,Oe]=H$(p);W$(()=>{p||Oe(!1)},[p]);let ke=K$(!1),Ae=J$(()=>{ke.current=!0,Oe(e=>e&&!1)},[]),[je,Me]=H$(()=>o1({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ne,Pe]=H$(!1);W$(()=>{Pe(!0)},[]);let Fe=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ie=e?.contextMenu?.triggerMode??(Fe?`right-click`:`both`),q=Ie===`both`||Ie===`button`,J=e?.contextMenu?.buttonVisibility??`when-needed`,Le=Ie===`both`||Ie===`right-click`;G$(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;xe.current=t,K(t),de(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Se.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Re=J$((e,t)=>{A1(T.current,e,t)},[]),ze=J$((e,t)=>{A1(E.current,e,t)},[]),Be=J$(e=>{x.current=e},[]),Ve=J$(e=>j1(e,E.current,T.current),[]),He=n!=null||r!=null||i!=null,{resolveIcon:Ue}=q$(()=>WZ(a),[a]),We=t[OZ](),Ge=We.getPath(),Ke=Ge!=null,qe=t.isSearchOpen(),Je=t.getSearchValue(),Ye=t.getFocusedPath(),Xe=t.getFocusedIndex(),Ze=t.getScrollRequest(),Qe=t.isDragAndDropEnabled(),$e=t.getDragSession(),et=q$(()=>$e==null?null:new Set($e.draggedPaths),[$e]),tt=$e?.target??null,nt=$e?.primaryPath??null,rt=I1(o),{overlayHeight:it,overlayRows:at,snapshot:ot,visibleRows:st}=je,ct=ot.physical.viewportHeight,lt=q$(()=>({end:ot.window.endIndex,start:ot.window.startIndex}),[ot.window.endIndex,ot.window.startIndex]),ut=at,dt=ot.sticky.rows,ft=ot.physical.totalHeight,pt=ot.sticky.height,mt=q$(()=>new Set(dt.map(e=>r1(e.row))),[dt]),ht=Xe>=0&&Xe>=lt.start&&Xe<=lt.end,gt=J$((e,t)=>u?.({item:F1(e,t),row:e})??null,[u]),_t=J$(e=>m$(e==null?null:T.current.get(e)??null)?!0:m$(S.current),[]),vt=J$(e=>{_t(t.focusNearestPath(e))},[t,_t]),yt=K$(vt);yt.current=vt;let bt=K$(!0),xt=K$(()=>{}),St=J$((t=!0)=>{let n=ge.current;n!=null&&(bt.current=bt.current&&t,he(null),e?.contextMenu?.onClose?.(),bt.current&&vt(n.path))},[e?.contextMenu,vt]);xt.current=St;let Ct=J$(e=>{let t=e==null?null:k1(S.current,e);le(e=>e===t?e:t)},[]),wt=J$((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Ve(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;we(n,e?.scrollTop??null),M.current=!0,G(e=>e===n?e:n)}i.focus(),Ct(a),bt.current=!0,he({anchorRect:r?.anchorRect??null,item:F1(e,n),path:n,source:r?.source??`keyboard`})},[t,Ve,Ct]),Tt=J$(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=g$(e,ct);I.current=Xe<0||e==null?null:Math.max(0,Math.min(Xe*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(de(`focus`),ae(e=>e+1))}},[t,Xe,s,l,ct]),Et=J$((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=g$(i,ct),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:o1({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,x$(i,a,s,l,u,d),D.current(),_e.current=n?e:null,!0},[t,s,c,ct,h]),Dt=()=>y.current===!0||re.current!=null||W.current===!0,Ot=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),kt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},At=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},jt=()=>{V.current?.remove(),V.current=null},Mt=()=>{kt(L.current),L.current=null,B.current=null},Nt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Pt=()=>{U.current?.(),U.current=null,re.current!=null&&(clearTimeout(re.current),re.current=null),W.current=!1,ee.current=null,ne.current=null,te.current!=null&&(te.current.setAttribute(`draggable`,`true`),te.current.style.removeProperty(`touch-action`),te.current=null),jt(),At(),Mt(),H.current=null},Ft=(e,n)=>{let r=S.current?.getRootNode(),i=p1(d1(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},It=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){At();return}let r=t.getItem(e.directoryPath),i=y1(r)?r:null;if(i==null||i.isExpanded()){At();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(At(),R.current=a,z.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Lt=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=g1(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),It(Ft(e.clientX,e.clientY)),L.current=Ot(Lt)},Rt=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=Ot(Lt)},zt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Pt(),jt(),At(),Mt(),t.startDrag(r)===!1){e.preventDefault();return}if(H.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),h1())){let t=m1(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Nt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Bt=()=>{jt(),At(),Mt(),H.current=null,t.cancelDrag()},Vt=(e,n,r)=>{if(re.current!=null||W.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ne.current={clientX:i.clientX,clientY:i.clientY},te.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!W.current;re.current!=null&&(clearTimeout(re.current),re.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),U.current===o&&(U.current=null),t&&(a.setAttribute(`draggable`,`true`),te.current===a&&(te.current=null),ne.current=null)},s=e=>{let t=e.touches[0],n=ne.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=c1*c1||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,re.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),te.current===a&&(te.current=null),ne.current=null;return}W.current=!0,te.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),H.current=n;let e=a.getBoundingClientRect(),s=m1(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Nt(s),V.current=s,ee.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=ee.current;n!=null&&V.current!=null&&(V.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),It(Ft(t.clientX,t.clientY)),Rt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Ft(n.clientX,n.clientY),t.completeDrag(),Pt()},u=()=>{t.cancelDrag(),Pt()};U.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},s1)},Ht=e=>{if(me!=null){if(e.key===`Escape`){St(),e.preventDefault(),e.stopPropagation();return}T1.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(We.isActive()){if(e.key===`Escape`)We.cancel();else if(e.key===`Enter`)We.commit();else return;de(`focus`),ae(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Tt(Ye??void 0),e.preventDefault(),e.stopPropagation();return}if(qe){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=g$(n,ct);I.current=Xe<0||n==null?null:Math.max(0,Math.min(Xe*s-n.scrollTop,Math.max(0,r-s))),F.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;de(`focus`),ae(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&x1(e)){t.openSearch(e.key),ae(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Fe&&C1(e),r=w1(e,Fe),i=r&&S.current!=null?h$(S.current):null,a=r?new Set(M1(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Ye&&a.has(o)){let e=C.current;we(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=y1(p)?p:null,h=u!=null&&(mt.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=j1(u,E.current,T.current);e==null||n==null?y=!1:wt(e,u)}else if((e.ctrlKey||e.metaKey)&&b1(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;de(`focus`);let b=t.getFocusedPath(),x=b!=null&&(mt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))we(b,v?.scrollTop??null),M.current=!0,G(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Te(b,P1(S.current,v,i,u,s,pt,ct)),M.current=!0,G(e=>e===b?e:b)):Ce()}ae(e=>e+1),e.preventDefault(),e.stopPropagation()};G$(()=>{if(!(!f||!qe)){if(Ee.current){Ee.current=!1;return}m$(w.current)}},[qe,f]),G$(()=>{let e=x.current;switch(C$({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:Ge})){case`reset`:P.current=null;return;case`reveal-canonical`:Ge!=null&&Et(Ge,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(_e.current=null,P.current=Ge,m$(e),e.select());return}},[lt.end,lt.start,Ge,Et,mt]),G$(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=h$(e)?.dataset.itemPath??null;G(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,h$(e)!=null){r();return}M.current=!1,G(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,G(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;G(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),G$(()=>{let e=S.current;e!=null&&(ot.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[ot.physical.scrollTop]),G$(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=g$(n,g);let a=()=>{let e=t.getVisibleCount(),r=_$(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Me(o1({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=_$(O.current,g),i=t.getVisibleRows(e,e)[0]??null;y$(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=!1,l=t.subscribe(()=>{o?ae(e=>e+1):o=!0,a()}),u=()=>{Se.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,pe(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||Se.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),ge.current!=null&&y.current&&xt.current(),Se.current===!0){y.current=!1;return}K(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:v$(e[0]))??g$(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),G$(()=>{Fe||me==null||St(!1)},[St,Fe,me]);let Ut=q$(()=>me==null?null:`${me.path}::${me.source}`,[me]);G$(()=>{if(Ut==null){m?.clearSlotContent(MG);return}let t=ge.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??D1(n.getBoundingClientRect()),close:e=>{xt.current(e?.restoreFocus??!0)},restoreFocus:()=>{bt.current&&yt.current(ge.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(MG,i),e?.contextMenu?.onOpen?.(t.item,r),B1(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&B1(i)}),()=>{m?.clearSlotContent(MG)}},[Ut,e?.contextMenu,m]),G$(()=>{me!=null&&t.getItem(me.path)==null&&St()},[St,me,t]),G$(()=>{if(me==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(E1(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&St())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),St())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[St,me]),G$(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=Ye;return}let r=Ye==null?null:T.current.get(Ye)??null,i=h$(n),a=i?.dataset.itemPath??null,o=Ke&&x.current===i,c=f&&w.current===i,l=F.current&&!qe,u=I.current??0,d=_e.current,p=ve.current,m=ye.current,g=be.current,_=i!=null,v=M.current||_,y=N.current!==Ye,b=p!=null&&p===Ye&&Ye!=null,E=!1,O=!1;if(Ze!=null&&Ze.id!==k.current){k.current=Ze.id;let n=Ze.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,ct-s))):pt;E=!0,O=b$(e,n,s,ct,ft,Ze.offset,t)}t.clearScrollRequest(Ze.id)}let A=!E&&l&&x$(e,Xe,s,ct,ft,u),j=!E&&d!=null&&d===Ye&&x$(e,Xe,s,ct,ft,pt),P=!E&&m!=null&&m.path===Ye&&x$(e,Xe,s,ct,ft,m.viewportOffset),L=!E&&g!=null&&g.path===Ye&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==Ye&&!b&&y$(e,Xe,s,ct,pt))&&D.current(),E){N.current=Ye;return}if(!v){N.current=Ye;return}if(o){N.current=Ye;return}if(c&&!l){N.current=Ye;return}if(r==null){l&&Xe>=0&&(x$(e,Xe,s,ct,ft,u),D.current()),N.current=Ye;return}(y||l||d===Ye||p===Ye||m?.path===Ye||g?.path===Ye||a==null||a!==Ye)&&(m$(r),d===Ye&&(_e.current=null),p===Ye&&(ve.current=null),m?.path===Ye&&(ye.current=null),g?.path===Ye&&(be.current=null),F.current=!1,I.current=null),N.current=Ye},[t,Xe,Ye,ht,s,Ke,qe,lt,ct,f,Ze,h,pt,ft,st]);let Wt=Xe>=0&&Xe>=ot.visible.startIndex&&Xe<=ot.visible.endIndex,Gt=Ye!=null&&ut.some(e=>r1(e.row)===Ye),Kt=Wt||Gt,qt=q&&M.current===!0&&Kt?Ye:null,Jt=ue===`pointer`?se:null,Yt=me?.path??xe.current??Jt??qt??se,Xt=me?.source===`right-click`;G$(()=>{y.current&&me==null||Ct(Ve(Yt))},[me,Ve,lt,ct,fe,ut,Yt,Ct,st]);let Zt=J$(e=>{if(y.current||E1(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&de(e=>e===`pointer`?e:`pointer`),K(e=>e===i?e:i)},[]),Qt=J$(()=>{K(null)},[]);G$(()=>{if(!Qe)return;let e=()=>{Pt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Pt(),t.cancelDrag()}},[t,Qe]);let $t=e=>{if(!Qe||t.getDragSession()==null||W.current)return;let n=p1(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),It(t.getDragSession()?.target??null),Rt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},en=e=>{if(!Qe||t.getDragSession()==null||W.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(At(),Mt(),t.setDragTarget(null))},tn=e=>{!Qe||t.getDragSession()==null||W.current||(e.preventDefault(),Ft(e.clientX,e.clientY),t.completeDrag(),jt(),At(),Mt(),H.current=null)},nn=ot.window.height,rn=ot.window.offsetTop,an=Math.min(0,ct-nn),on=Math.min(0,ct-nn-pt),sn=oe===Ye||F.current,cn=Ye!=null&&sn&&!ht&&Xe>=0?st[Xe]??t.getVisibleRows(Xe,Xe)[0]??null:null,ln=cn==null?null:S$(Xe,s,lt,nn),un=H.current,dn=nt!=null&&un!=null&&un.path===nt&&un.index>=lt.start&&un.index<=lt.end,fn=nt!=null&&un!=null&&un.path===nt&&!dn&&un.path!==cn?.path?un:null,pn=fn==null?null:S$(fn.index,s,lt,nn),mn=S1((Xe>=0?st[Xe]??t.getVisibleRows(Xe,Xe)[0]??null:null)?.ancestorPaths.at(-1)??null),hn=qe&&Ye!=null?L1(o,Ye,!ht):void 0,gn=me?.path??(qe?Ye:oe),_n=me?.path??se,vn=Ve(Yt),yn=Fe&&q&&!Xt&&!Ke&&vn!=null&&ce!=null&&Yt!=null,bn=Fe&&(yn||me!=null),xn=me?.anchorRect,Sn=xn==null&&vn!=null&&ce!=null&&(me!=null||yn)?ce:null,Cn=xn==null?Sn==null?void 0:{top:`${Sn}px`}:{left:`${xn.left}px`,position:`fixed`,right:`auto`,top:`${xn.top}px`},wn=Xt?{opacity:`0`}:void 0,Tn=J$((e,n,r,i)=>{let a=E$({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:qe,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=ot.visible.startIndex&&n.index<=ot.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,G(e=>e===c?e:c),de(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Et(c,{targetOffset:`sticky-parents`})},[t,qe,ot.visible.endIndex,ot.visible.startIndex,Et]),En=()=>{if(y.current||!q||Yt==null||vn==null)return;let e=t.getItem(Yt);e!=null&&(Ct(vn),bt.current=!0,he({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:vn.getAttribute(`aria-label`)??Yt,path:e.getPath()},path:e.getPath(),source:`button`}))},Dn={contextHoverPath:_n,contextMenuButtonTriggerEnabled:q,contextMenuButtonVisibility:J,contextMenuEnabled:Fe,contextMenuRightClickEnabled:Le,contextMenuTriggerMode:Ie,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Qe,draggedPathSet:et,dragTarget:tt,gitLaneActive:He,gitStatusByPath:n,handleRowDragEnd:Bt,handleRowDragStart:zt,handleRowTouchStart:Vt,ignoredGitDirectories:r,ignoredInheritanceCache:ie,instanceId:o,itemHeight:s,onKeyDown:Ht,onRowClick:Tn,openContextMenuForRow:wt,registerButton:Re,registerRenameInput:Be,renameView:We,renderDecorationForRow:gt,resolveIcon:Ue,shouldSuppressContextMenu:Dt,visualFocusPath:gn},On={...Dn,registerButton:ze};return NQ(`div`,{ref:S,id:rt,"data-file-tree-context-menu-button-visibility":Fe&&q?J:void 0,"data-file-tree-context-menu-trigger-mode":Fe?Ie:void 0,"data-file-tree-has-context-menu-action-lane":Fe&&q?`true`:void 0,"data-file-tree-has-git-lane":He?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:Qe?en:void 0,onDragOver:Qe?$t:void 0,onDrop:Qe?tn:void 0,onKeyDown:Ht,onPointerLeave:Fe?Qt:void 0,onPointerOver:Fe?Zt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[NQ(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:mn}}),NQ(`slot`,{name:jG,"data-type":`header-slot`}),f?NQ(`div`,{"data-file-tree-search-container":!0,"data-open":qe?`true`:`false`,children:NQ(`input`,{ref:w,"aria-activedescendant":hn,"aria-controls":rt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":De?`true`:void 0,value:Je,onBlur:()=>{d===`retain`&&!ke.current||t.closeSearch()},onFocus:Ae,onPointerDown:Ae,onInput:e=>{Ae();let n=e.currentTarget;t.setSearch(n.value)}})}):null,NQ(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ne&&ut.length>0?NQ(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:NQ(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${it}px`},children:ut.map((e,t)=>H1(On,e.row,`sticky:${r1(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ut.length-t}`}}))})}):null,NQ(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${ft}px`},children:[NQ(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${rn}px`}}),NQ(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${nn}px`,top:`${an}px`,bottom:`${on}px`},children:[U1(Dn,lt,mt),cn!=null&&ln!=null?H1(Dn,cn,`parked:${cn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:nt===cn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${ln}px`}}):null,fn!=null&&pn!=null?H1(Dn,fn,`parked-drag:${fn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${pn}px`}}):null]})]})]}),Fe?NQ(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":bn?`true`:`false`,style:Cn,children:[NQ(`button`,{ref:v,type:`button`,"data-type":NG,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":me==null?`false`:`true`,"data-visible":yn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),me!=null){St();return}En()},tabIndex:-1,style:wn,children:NQ(LQ,{...Ue(`file-tree-icon-ellipsis`)})}),me==null?null:NQ(`slot`,{name:MG})]}):null,me==null?null:NQ(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),St()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),St()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var G1={hydrateRoot:(e,t)=>{jQ(sQ(W1,t),e)},renderRoot:(e,t)=>{AQ(sQ(W1,t),e)},unmountRoot:e=>{AQ(null,e)}};function K1(e,t){G1.renderRoot(e,t)}function q1(e,t){G1.hydrateRoot(e,t)}function J1(e){G1.unmountRoot(e)}var Y1=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},X1=`__c`,Z1=`__k`,Q1=`__d`,$1=`__s`,e0=/[\s\n\\/='"\0<>]/,t0=/^(xlink|xmlns|xml)([A-Z])/,n0=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,r0=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,i0=new Set([`draggable`,`spellcheck`]);function a0(e){e.__g===void 0?e[Q1]=!0:e.__g|=8}function o0(e){e.__g===void 0?e[Q1]=!1:e.__g&=-9}function s0(e){return e.__g===void 0?!0===e[Q1]:!!(8&e.__g)}var c0=/["&<]/;function l0(e){if(e.length===0||!1===c0.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var u0={},d0=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),f0=/[A-Z]/g;function p0(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:u0[n]||(u0[n]=n.replace(f0,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||d0.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function m0(){this.__d=!0}function h0(e,t){return{__v:e,context:t,props:e.props,setState:m0,forceUpdate:m0,__d:!0,__h:[]}}function g0(e,t,n){if(!e.s){if(n instanceof _0){if(!n.s)return void(n.o=g0.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(g0.bind(null,e,t),g0.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var _0=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{g0(r,1,a(this.v))}catch(e){g0(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?g0(r,1,t?t(i):i):n?g0(r,1,n(i)):g0(r,2,i)}catch(e){g0(r,2,e)}},r},e}(),v0,y0,b0,x0,S0={},C0=Array.isArray,w0=Object.assign,T0=``,E0=`<!--$s-->`,D0=`<!--/$s-->`;function O0(e,t){var n,r=e.type,i=!0;return e[X1]?(i=!1,(n=e[X1]).state=n[$1]):n=new r(e.props,t),e[X1]=n,n.__v=e,n.props=e.props,n.context=t,a0(n),n.state??=S0,n[$1]??(n[$1]=n.state),r.getDerivedStateFromProps?n.state=w0({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[$1]===n.state?n.state:n[$1]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),b0&&b0(e),n.render(n.props,n.state,t)}function k0(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===T0)return T0;var s=typeof e;if(s!=`object`)return s==`function`?T0:s==`string`?l0(e):e+T0;if(C0(e)){var c,l=T0;i[Z1]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=k0(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=T0,C0(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return T0;e.__=i,v0&&v0(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===lQ){if(`tpl`in g){for(var x=T0,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!C0(C)?x+=C:x+=k0(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+l0(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=O0(e,b),y=e[X1];else{e[X1]=y=h0(e,b);for(var E=0;s0(y)&&E++<25;){o0(y),b0&&b0(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}a0(y)}if(y.getChildContext!=null&&(t=w0({},t,y.getChildContext())),T&&GZ.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===lQ&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return k0(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[$1]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,S0),s0(y)?(v=O0(e,t),(y=e[X1]).getChildContext!=null&&(t=w0({},t,y.getChildContext())),k0(v=v!=null&&v.type===lQ&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):T0}finally{y0&&y0(e),x0&&x0(e)}}}v=v!=null&&v.type===lQ&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=k0(v,t,n,r,e,a,o);return y0&&y0(e),GZ.unmount&&GZ.unmount(e),e._suspended?typeof D==`string`?E0+D+D0:C0(D)?(D.unshift(E0),D.push(D0),D):D.then(function(e){return E0+e+D0}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return k0(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=GZ.__e;return k&&k(i,e),T0}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=k0(v,t,n,r,e,a,o);return e._suspended?E0+s+D0:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=T0;for(var N in g){var P=g[N];if(typeof(P=j0(P)?P.value:P)!=`function`||N===`class`||N===`className`){switch(N){case`children`:A=P;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;N=`for`;break;case`className`:if(`class`in g)continue;N=`class`;break;case`defaultChecked`:N=`checked`;break;case`defaultSelected`:N=`selected`;break;case`defaultValue`:case`value`:switch(N=`value`,h){case`textarea`:A=P;continue;case`select`:r=P;continue;case`option`:r!=P||`selected`in g||(j+=` selected`)}break;case`dangerouslySetInnerHTML`:M=P&&P.__html;continue;case`style`:typeof P==`object`&&(P=p0(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(t0.test(N))N=N.replace(t0,`$1:$2`).toLowerCase();else{if(e0.test(N))continue;N[4]!==`-`&&!i0.has(N)||P==null?n?r0.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):n0.test(N)&&(N=N.toLowerCase()):P+=T0}}P!=null&&!1!==P&&(j=!0===P||P===T0?j+` `+N:j+` `+N+`="`+(typeof P==`string`?l0(P):P+T0)+`"`)}}if(e0.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=l0(A):A!=null&&!1!==A&&!0!==A&&(M=k0(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),y0&&y0(e),x0&&x0(e),!M&&A0.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return C0(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var A0=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function j0(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var M0=0;function N0(e){return e!=null&&e.length>0?e:(M0+=1,`pst_ft_${M0}`)}function P0({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??rq)}function F0(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function I0(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function L0(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var R0=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new Y1;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=N0(a),this.#p=zZ(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=nq(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new PZ({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(J1(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),K1(t.wrapper,this.#w()))}setGitStatus(e){this.#p=zZ(e,this.#p);let t=this.#T();t!=null&&K1(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),K1(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),q1(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),K1(r,this.#w())}#C(){return{initialViewportHeight:P0({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(jG,e());return}this.#l.setSlotHtml(jG,this.#e?.header?.html??null)}#k(e){let t=L0(e).find(e=>I0(e)),n=F0(YK(eq(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=L0(e),n=t.find(e=>I0(e)),r=t.filter(e=>e!==n),i=eq(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=F0(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=eq(this.#m);t.colored&&ZK(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${DG}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(DG,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=sq(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return pq(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}};function z0(e){let[t]=(0,q.useState)(()=>new R0(e)),n=(0,q.useRef)({timeout:null,model:t});return(0,q.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}function B0(e){let t=[];for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(e.length===0)continue;let r=e.startsWith(`./`)?e.slice(2):e;r.length!==0&&t.push(r)}let n=new Set,r=[];for(let e of t)n.has(e)||(n.add(e),r.push(e));let i=new Set;for(let e of r){let t=e.split(`/`);for(let e=1;e<t.length;e++)i.add(t.slice(0,e).join(`/`))}let a=[],o=[];for(let e of r)i.has(e)?o.push(e):a.push(e);return{paths:a,dropped:o}}function V0(e){let{paths:t}=B0(e),n=new Set;for(let e of t){let t=e.split(`/`);for(let e=1;e<t.length;e++)n.add(t.slice(0,e).join(`/`))}return Array.from(n)}var H0=class extends q.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.error(`FileTree crashed:`,e,t.componentStack)}render(){return this.state.hasError?(0,J.jsxs)(`div`,{style:{padding:16,textAlign:`center`,color:`var(--text-muted, #888)`},children:[(0,J.jsx)(`p`,{children:`⚠️ File tree failed to render.`}),(0,J.jsx)(`p`,{style:{fontSize:`0.85em`},children:`Reload the review to retry.`})]}):this.props.children}},U0=(0,q.memo)(function({files:e,activeFile:t,commentCounts:n,viewedFiles:r,untrackedFiles:i,onFileClick:a,collapsed:o,onToggleCollapse:s,appliedExtensions:c=[],onApplyExtensions:l,chipFilter:u=`all`,onChipFilterChange:d,sinceLastFiles:f,sinceLastAvailable:p=!1}){let[m,h]=(0,q.useState)(``),[g,_]=(0,q.useState)(()=>XE(c));(0,q.useEffect)(()=>{_(XE(c))},[c]);let v=(0,q.useMemo)(()=>{let t=0;for(let n of e)t+=n.additionLines.length+n.deletionLines.length;return t},[e]),y=tD(e.length,v),b=(0,q.useMemo)(()=>eD(e.map(e=>e.name)),[e]),x=(0,q.useCallback)(e=>{let t=XE(e);_(t),l?.(t)},[l]),S=(0,q.useCallback)(e=>{_(t=>{let n=new Set(t);n.has(e)?n.delete(e):n.add(e);let r=XE([...n]);return y||l?.(r),r})},[y,l]),C=!ZE(g,c),w=(0,q.useMemo)(()=>{let t=e;if(c.length>0&&(t=t.filter(e=>QE(e.name,c))),u===`unviewed`)t=t.filter(e=>!r.has(e.name));else if(u===`has-comments`)t=t.filter(e=>(n[e.name]??0)>0);else if(u===`since-last`){let e=f??new Set;t=t.filter(t=>e.has(t.name))}return t},[e,c,u,r,n,f]),{paths:T,dropped:E}=(0,q.useMemo)(()=>B0(w.map(e=>e.name)),[w]),D=(0,q.useMemo)(()=>new Set(T),[T]),O=(0,q.useMemo)(()=>V0(T),[T]),k=(0,q.useMemo)(()=>w.filter(e=>D.has(e.name)).map(e=>{let t=`modified`;if(i.has(e.name))t=`untracked`;else if(e.prevName)t=`renamed`;else{let n=e.prevObjectId,r=e.newObjectId;n===`0000000`||n===`0000000000000000000000000000000000000000`?t=`added`:(r===`0000000`||r===`0000000000000000000000000000000000000000`)&&(t=`deleted`)}return{path:e.name,status:t}}),[w,i,D]),A=(0,q.useRef)({commentCounts:n,viewedFiles:r,sinceLastFiles:f??new Set});A.current={commentCounts:n,viewedFiles:r,sinceLastFiles:f??new Set};let{model:j}=z0({paths:T,fileTreeSearchMode:`hide-non-matches`,gitStatus:k,renderRowDecoration:(0,q.useCallback)(e=>{let t=e.item.path,{commentCounts:n,viewedFiles:r,sinceLastFiles:i}=A.current,a=r.has(t),o=n[t]??0,s=i.has(t),c=[],l=[];return s&&(c.push(`Δ`),l.push(`Changed since last review handoff`)),a&&(c.push(`✓`),l.push(`Viewed`)),o>0&&(c.push(`💬 ${o}`),l.push(`${o} comment${o>1?`s`:``}`)),c.length===0?null:{text:c.join(` `),title:l.join(` · `)}},[]),initialSelectedPaths:t&&D.has(t)?[t]:[],initialExpandedPaths:O,onSelectionChange:e=>{e.length>0&&e[0]!==t&&a(e[0])}});if((0,q.useEffect)(()=>{j.resetPaths(T,{initialExpandedPaths:O})},[T,O,j]),(0,q.useEffect)(()=>{j.setGitStatus(k)},[k,n,r,j]),(0,q.useEffect)(()=>{if(!(!t||!D.has(t)))try{j.focusPath(t),j.scrollToPath(t,{focus:!0,offset:`nearest`})}catch(e){console.error(`Failed to scroll to active file:`,e)}},[t,j,D]),(0,q.useEffect)(()=>{j.setSearch(m||null)},[m,j]),o)return(0,J.jsx)(`div`,{className:`ft ft-collapsed`,children:s&&(0,J.jsx)(Qw,{content:`Expand sidebar · b`,side:`right`,children:(0,J.jsx)(`button`,{className:`sidebar-toggle`,onClick:s,"aria-label":`Expand sidebar`,children:(0,J.jsx)(wO,{size:16})})})});let M=$E(c),N=e.length,P=w.length,F=N-P,I=b.length>0&&!!l;return(0,J.jsxs)(`div`,{className:`ft`,style:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,J.jsxs)(`div`,{className:`ft-chrome`,children:[(0,J.jsxs)(`div`,{className:`ft-search-row`,children:[s&&(0,J.jsx)(Qw,{content:`Collapse sidebar · b`,side:`right`,children:(0,J.jsx)(`button`,{className:`sidebar-toggle`,onClick:s,"aria-label":`Collapse sidebar`,children:(0,J.jsx)(CO,{size:16})})}),(0,J.jsxs)(`div`,{className:`ft-search-wrapper`,children:[(0,J.jsx)(NO,{size:14,className:`ft-search-icon`,"aria-hidden":`true`}),(0,J.jsx)(`input`,{type:`text`,placeholder:`Filter files…`,value:m,onChange:e=>h(e.target.value),className:`ft-search-input`,"aria-label":`Filter files`})]})]}),I&&(0,J.jsxs)(`div`,{className:`ft-ext-panel`,"aria-label":`Filter by file extension`,children:[(0,J.jsxs)(`div`,{className:`ft-ext-header`,children:[(0,J.jsx)(YD,{size:12,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`ft-ext-title`,children:`Extensions`}),c.length>0&&(0,J.jsxs)(`span`,{className:`ft-ext-applied`,title:M,children:[c.length,` applied`]}),C&&y&&(0,J.jsx)(`span`,{className:`ft-ext-pending`,children:`unsaved`})]}),(0,J.jsx)(`div`,{className:`ft-ext-chips`,role:`group`,"aria-label":`File extensions`,children:b.map(e=>{let t=g.includes(e);return(0,J.jsxs)(`button`,{type:`button`,className:`ft-ext-chip ${t?`ft-ext-chip-active`:``}`,"aria-pressed":t,title:t?`Remove .${e}`:`Include .${e}`,onClick:()=>S(e),children:[`.`,e]},e)})}),(0,J.jsxs)(`div`,{className:`ft-ext-actions`,children:[y?(0,J.jsxs)(`button`,{type:`button`,className:`ft-ext-apply`,disabled:!C,onClick:()=>x(g),title:`Apply the selected extensions to the file tree and diff list`,children:[(0,J.jsx)(wD,{size:12}),`Apply`,C&&g.length>0?` (${g.length})`:C?` (all)`:``]}):(0,J.jsx)(`span`,{className:`ft-ext-hint`,children:`Live filter`}),(g.length>0||c.length>0)&&(0,J.jsxs)(`button`,{type:`button`,className:`ft-ext-clear`,onClick:()=>x([]),"aria-label":`Clear extension filter`,title:`Show all extensions`,children:[(0,J.jsx)(WO,{size:12}),`Clear`]})]})]}),d&&(0,J.jsx)(`div`,{className:`ft-chips`,role:`group`,"aria-label":`Smart file filters`,children:[{id:`all`,label:`All`},{id:`unviewed`,label:`Unviewed`},{id:`has-comments`,label:`Comments`},...p?[{id:`since-last`,label:`Since last`}]:[]].map(e=>(0,J.jsx)(`button`,{type:`button`,className:`ft-chip ${u===e.id?`ft-chip-active`:``}`,"aria-pressed":u===e.id,title:e.id===`since-last`?`Files added or modified since the last Send to agent`:void 0,onClick:()=>d(e.id),children:e.label},e.id))}),F>0&&(0,J.jsx)(`div`,{className:`ft-filter-status`,children:(0,J.jsxs)(`span`,{className:`ft-filter-status-text`,title:M,children:[P,` of `,N]})})]}),E.length>0&&(0,J.jsxs)(`div`,{className:`ft-collision-warning`,title:E.join(`
3923
+ `),style:{fontSize:`0.75rem`,padding:`4px 8px`,background:`var(--bg-warning, #fff3cd)`,color:`var(--text-warning, #856404)`},children:[`⚠ `,E.length,` file(s) hidden due to path collision (hover for details)`]}),(0,J.jsx)(`div`,{style:{flex:1,minHeight:0,overflow:`auto`},children:(0,J.jsx)(H0,{children:(0,J.jsx)(zG,{model:j,className:`ft-pierre-tree`})})})]})});function W0(e){return e.status===`resolved`?`resolved`:e.replies?.length?`replied`:`open`}var G0=[{key:`all`,label:`All`},{key:`open`,label:`Open`},{key:`replied`,label:`Replied`},{key:`resolved`,label:`Resolved`}],K0=[{key:`all`,label:`Any`},{key:`blocking`,label:`Blocking`},{key:`nit`,label:`Nit`},{key:`question`,label:`Question`},{key:`praise`,label:`Praise`},{key:`outdated`,label:`Outdated`}];function q0({comments:e,resolveComment:t,unresolveComment:n,removeComment:r,addReply:i,editComment:a,editReply:o,removeReply:s}){let[c,l]=(0,q.useState)(`all`),[u,d]=(0,q.useState)(`all`),f=(0,q.useMemo)(()=>{let t={all:e.length,open:0,replied:0,resolved:0};for(let n of e)t[W0(n)]++;return t},[e]),p=(0,q.useMemo)(()=>{let t={all:e.length,blocking:0,nit:0,question:0,praise:0,none:0,outdated:0};for(let n of e){n.outdated&&t.outdated++;let e=n.severity&&n.severity!==`none`?n.severity:`none`;t[e]++}return t},[e]),m=(0,q.useMemo)(()=>[...e].sort((e,t)=>t.createdAt-e.createdAt),[e]),h=(0,q.useMemo)(()=>m.filter(e=>c!==`all`&&W0(e)!==c?!1:u===`outdated`?!!e.outdated:!(u!==`all`&&(e.severity&&e.severity!==`none`?e.severity:null)!==u)),[m,c,u]),g=(0,q.useMemo)(()=>e.some(e=>e.outdated||e.severity&&e.severity!==`none`),[e]);return e.length===0?null:(0,J.jsxs)(`div`,{className:`cmt`,role:`complementary`,"aria-label":`Review comments`,children:[(0,J.jsxs)(`div`,{className:`cmt-head`,children:[(0,J.jsxs)(`div`,{className:`cmt-title`,children:[(0,J.jsx)(hO,{size:14,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`Comments`}),(0,J.jsx)(`span`,{className:`cmt-total`,children:e.length})]}),(0,J.jsx)(`div`,{className:`cmt-filters`,role:`tablist`,"aria-label":`Filter by status`,children:G0.map(e=>(0,J.jsxs)(`button`,{role:`tab`,"aria-selected":c===e.key,className:`cmt-filter ${c===e.key?`cmt-filter-active`:``}`,onClick:()=>l(e.key),disabled:e.key!==`all`&&f[e.key]===0,children:[e.label,(0,J.jsx)(`span`,{className:`cmt-filter-count`,children:f[e.key]})]},e.key))}),g&&(0,J.jsx)(`div`,{className:`cmt-filters cmt-filters-severity`,role:`tablist`,"aria-label":`Filter by severity`,children:K0.filter(e=>e.key===`all`||(p[e.key]??0)>0).map(e=>(0,J.jsxs)(`button`,{role:`tab`,"aria-selected":u===e.key,className:`cmt-filter cmt-filter-sev ${u===e.key?`cmt-filter-active`:``}`,"data-severity":e.key,onClick:()=>d(e.key),children:[e.label,(0,J.jsx)(`span`,{className:`cmt-filter-count`,children:p[e.key]})]},e.key))})]}),(0,J.jsx)(`ul`,{className:`cmt-list`,"aria-label":`Comment threads`,children:h.length===0?(0,J.jsx)(`li`,{className:`cmt-empty`,children:`No matching comments`}):h.map(e=>(0,J.jsx)(J0,{comment:e,resolveComment:t,unresolveComment:n,removeComment:r,addReply:i,editComment:a,editReply:o,removeReply:s},e.id))})]})}function J0({comment:e,resolveComment:t,unresolveComment:n,removeComment:r,addReply:i,editComment:a,editReply:o,removeReply:s}){let c=W0(e),l=e.status===`resolved`,u=e.replies?.length??0,{haptic:d,sound:f}=xT(),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(!1),[x,S]=(0,q.useState)(null),C=(0,q.useCallback)(()=>{e.lineNumber>0?VT(e.filePath,e.lineNumber,e.side):document.getElementById(`file-${e.filePath}`)?.scrollIntoView({block:`start`})},[e.filePath,e.lineNumber,e.side]),w=e.lineNumber>0?`:${e.lineNumber}`:` · file`;return(0,J.jsxs)(`li`,{className:`cmt-card cmt-card-${c} ${l?`cmt-card-resolved`:``}`,children:[(0,J.jsxs)(`div`,{className:`cmt-card-top`,children:[(0,J.jsx)(`span`,{className:`cmt-dot cmt-dot-${c}`,"aria-hidden":`true`}),(0,J.jsxs)(`button`,{className:`cmt-loc`,onClick:C,title:`Jump to ${e.filePath}${w}`,children:[(0,J.jsx)(`span`,{className:`cmt-loc-file`,children:IT(e.filePath)}),(0,J.jsx)(`span`,{className:`cmt-loc-line`,children:w})]}),e.severity&&e.severity!==`none`&&(0,J.jsx)(BW,{severity:e.severity}),e.outdated&&(0,J.jsxs)(`span`,{className:`comment-outdated-badge`,title:`Anchored code no longer matches`,children:[(0,J.jsx)(BO,{size:10}),` outdated`]}),(0,J.jsx)(`span`,{className:`cmt-time`,children:FT(e.createdAt)})]}),e.lineContent?.trim()&&(0,J.jsx)(`button`,{className:`cmt-codeline`,onClick:C,title:`Jump to line`,children:(0,J.jsx)(`code`,{children:e.lineContent.trim().slice(0,160)})}),_?(0,J.jsx)(RW,{draftKey:`tracker-edit:${e.id}`,initialBody:e.body,onCancel:()=>v(!1),onSubmit:t=>{a(e.id,t),v(!1)}}):(0,J.jsx)(QV,{content:e.body,className:`cmt-body markdown-body`}),(0,J.jsxs)(`div`,{className:`cmt-actions`,children:[(0,J.jsxs)(`button`,{className:`cmt-act`,onClick:()=>{g(e=>!e),m(!0)},title:`Reply`,children:[(0,J.jsx)(HD,{size:13,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`Reply`})]}),(0,J.jsx)(`button`,{className:`cmt-act`,onClick:()=>v(e=>!e),title:`Edit comment`,children:(0,J.jsx)(DO,{size:13,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{className:`cmt-act ${l?`cmt-act-resolved`:``}`,onClick:()=>{l?(n(e.id),d(`light`),f(`toggle`)):(t(e.id),d(`success`),f(`resolve`))},title:l?`Reopen`:`Resolve`,children:l?(0,J.jsx)(jO,{size:13,"aria-hidden":`true`}):(0,J.jsx)(wD,{size:13,"aria-hidden":`true`})}),y?(0,J.jsxs)(`span`,{className:`cmt-confirm`,children:[(0,J.jsx)(`button`,{className:`cmt-act cmt-act-danger`,onClick:()=>{r(e.id),d(`medium`),f(`remove`)},title:`Confirm delete`,children:`Delete?`}),(0,J.jsx)(`button`,{className:`cmt-act`,onClick:()=>b(!1),title:`Cancel`,children:(0,J.jsx)(WO,{size:13,"aria-hidden":`true`})})]}):(0,J.jsx)(`button`,{className:`cmt-act cmt-act-del`,onClick:()=>b(!0),title:`Delete comment`,children:(0,J.jsx)(zO,{size:13,"aria-hidden":`true`})})]}),u>0&&(0,J.jsxs)(`button`,{className:`cmt-thread-toggle`,onClick:()=>m(e=>!e),"aria-expanded":p,children:[(0,J.jsx)(DD,{size:12,className:`cmt-chev ${p?`cmt-chev-open`:``}`,"aria-hidden":`true`}),u,` `,u===1?`reply`:`replies`]}),p&&u>0&&(0,J.jsx)(`ul`,{className:`cmt-replies`,children:e.replies.map(t=>(0,J.jsx)(Y0,{reply:t,onEdit:n=>o(e.id,t.id,n),onRemove:()=>s(e.id,t.id)},t.id))}),h&&(0,J.jsxs)(`div`,{className:`cmt-reply-composer`,children:[(0,J.jsx)(RW,{draftKey:`reply:${e.id}`,onCancel:()=>{g(!1),S(null)},onSubmit:async t=>{S(null),m(!0);try{await i(e.id,t),d(`light`),f(`success`),g(!1)}catch(e){S(e instanceof Error?e.message:`Failed to save reply`)}}}),x&&(0,J.jsx)(`p`,{className:`cmt-reply-error`,role:`alert`,children:x})]})]})}function Y0({reply:e,onEdit:t,onRemove:n}){let r=e.role===`agent`||e.role==null&&!!e.model,[i,a]=(0,q.useState)(!1);return(0,J.jsxs)(`li`,{className:`cmt-reply ${r?`cmt-reply-agent`:``}`,children:[(0,J.jsxs)(`div`,{className:`cmt-reply-head`,children:[(0,J.jsxs)(`span`,{className:`cmt-reply-who ${r?`cmt-reply-who-agent`:``}`,children:[r?(0,J.jsx)(SD,{size:11,"aria-hidden":`true`}):null,r?e.model||`Agent`:`You`]}),(0,J.jsx)(`span`,{className:`cmt-time`,children:FT(e.createdAt)}),!r&&(0,J.jsx)(`button`,{className:`cmt-reply-act`,onClick:()=>a(e=>!e),title:`Edit reply`,children:(0,J.jsx)(DO,{size:11,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{className:`cmt-reply-act cmt-act-del`,onClick:n,title:`Delete reply`,children:(0,J.jsx)(zO,{size:11,"aria-hidden":`true`})})]}),i?(0,J.jsx)(RW,{draftKey:`tracker-reply-edit:${e.id}`,initialBody:e.body,onCancel:()=>a(!1),onSubmit:e=>{t(e),a(!1)}}):(0,J.jsx)(QV,{content:e.body,className:`cmt-reply-body markdown-body`})]})}function X0(e){return $e({queryKey:[`file-text`,e],enabled:!!e,staleTime:300*1e3,queryFn:async({signal:t})=>{let n=await fetch(`/api/file-text?path=${encodeURIComponent(e)}&version=new`,{signal:t});if(n.status===415)return{content:null,missing:!1,binary:!0};if(!n.ok)throw Error(`Failed to load file (${n.status})`);let r=await n.json();if(r.error){if(/binary/i.test(r.error))return{content:null,missing:!1,binary:!0};throw Error(r.error)}return r.missing?{content:null,missing:!0,binary:!1}:{content:r.content??``,missing:!1,binary:!1}}})}var Z0=[{key:`all`,label:`All`,Icon:iO},{key:`files`,label:`Files`,Icon:qD},{key:`text`,label:`Text`,Icon:VO},{key:`symbols`,label:`Symbols`,Icon:zD}],Q0={function:`ƒ`,method:`m`,class:`C`,variable:`v`,interface:`I`,type:`T`,enum:`E`,struct:`S`,impl:`i`,trait:`t`};function $0(e){switch(e){case`modified`:return{label:`M`,title:`modified`};case`untracked`:return{label:`U`,title:`untracked`};case`staged_new`:case`added`:return{label:`A`,title:`added`};case`deleted`:return{label:`D`,title:`deleted`};case`renamed`:return{label:`R`,title:`renamed`};case``:case`clean`:return null;default:return{label:e.charAt(0).toUpperCase(),title:e}}}function e2({text:e,ranges:t}){if(!t.length)return(0,J.jsx)(J.Fragment,{children:e});let n=[],r=0;return t.forEach(([t,i],a)=>{t>r&&n.push(e.slice(r,t)),n.push((0,J.jsx)(`mark`,{className:`searchpalette-mark`,children:e.slice(t,i)},a)),r=i}),r<e.length&&n.push(e.slice(r)),(0,J.jsx)(J.Fragment,{children:n})}function t2(e,t){let n=t.trim().toLowerCase();if(!n)return[];let r=e.toLowerCase(),i=[],a=0;for(let e=0;e<r.length&&a<n.length;e++)if(r[e]===n[a]){let t=i[i.length-1];t&&t[1]===e?t[1]=e+1:i.push([e,e+1]),a++}return a===n.length?i:[]}var n2=e=>{let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t+1)};function r2(e,t){let n=e.length-e.trimStart().length,r=e.slice(n),i=n;if(r.length>400){let e=t.find(e=>e[0]>=n),a=e?Math.max(0,e[0]-n-24):0,o=a>0?`…`:``;r=o+r.slice(a,a+400),i=n+a-o.length}let a=t.map(([e,t])=>[e-i,t-i]).filter(([e,t])=>t>0&&e<r.length).map(([e,t])=>[Math.max(0,e),Math.min(r.length,t)]);return{text:r,ranges:a}}function i2({isOpen:e,onClose:t,initialScope:n,initialChangedOnly:r,onChangedOnlyPreference:i,onSessionSnapshot:a,files:o,changedEntries:s,customMode:c,staged:l,onNavigateFile:u,theme:d,fontSize:f,monoFontFamily:p,defaultTabSize:m,lineWrap:h,showLineNumbers:g,lineHoverHighlight:_}){let[v,y]=(0,q.useState)(``),[b,x]=(0,q.useState)(n),[S,C]=(0,q.useState)(!1),[w,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(0),[O,k]=(0,q.useState)(null),A=(0,q.useRef)(null),j=(0,q.useRef)(null),M=(0,q.useRef)(!1),N=(0,q.useMemo)(()=>TT(o),[o]),P=(0,q.useMemo)(()=>ET(s),[s]),F=WT({scope:b,query:v,regex:S,changedOnly:w,changedPaths:(0,q.useMemo)(()=>[...N],[N]),open:e}),I=F.data&&F.data.scope===b?F.data:void 0,L=I?.error,R=$e({queryKey:[`repo-files-fallback`],enabled:e&&b===`files`&&!!L,staleTime:6e4,queryFn:async()=>(await(await fetch(`/api/repo-files`)).json()).files??[]});(0,q.useEffect)(()=>{e&&(y(``),x(n),C(!1),T(r??KT(n)),D(0),k(null))},[e,n,r]),(0,q.useEffect)(()=>{e&&A.current?.focus()},[e]),(0,q.useEffect)(()=>{D(0),k(null)},[v,b]);let z=(0,q.useMemo)(()=>{let e=v.trim(),t=e.toLowerCase(),n=[];if(b===`files`&&L&&R.data)n=R.data.map(e=>({path:e,score:t?NT(e,t):0})).filter(e=>e.score!==null).sort((e,t)=>t.score-e.score).slice(0,60).map(({path:e})=>({kind:`file`,key:e,hit:{path:e,fileName:IT(e),gitStatus:``,matchType:``,exact:!1},inDiff:N.has(e)}));else if(I)I.scope===`files`?n=I.items.map(e=>({kind:`file`,key:e.path,hit:e,inDiff:N.has(e.path)})):I.scope===`text`?n=I.items.map(e=>({kind:`text`,key:`${e.path}:${e.line}:${e.col}`,hit:e,inDiff:N.has(e.path)})):I.scope===`symbols`?n=I.items.map(e=>({kind:`symbol`,key:`${e.path}:${e.line}:${e.name}`,hit:e,inDiff:N.has(e.path)})):I.scope===`all`&&(n=I.items.map(e=>e.kind===`file`?{kind:`file`,key:`all:${e.hit.path}`,hit:e.hit,inDiff:N.has(e.hit.path)}:e.kind===`text`?{kind:`text`,key:`all:${e.hit.path}:${e.hit.line}:${e.hit.col}`,hit:e.hit,inDiff:N.has(e.hit.path)}:{kind:`symbol`,key:`all:${e.hit.path}:${e.hit.line}:${e.hit.name}`,hit:e.hit,inDiff:N.has(e.hit.path)}));else if(b===`symbols`&&e.length<2){let e=PT(s);n=(t?e.filter(e=>e.name.toLowerCase().includes(t)):e).map(e=>({kind:`symbol`,key:`local:${e.path}:${e.line}:${e.name}`,hit:e,inDiff:!0}))}let r=n.filter(e=>e.inDiff),i=n.filter(e=>!e.inDiff);return[...r,...i]},[I,L,R.data,b,N,v,s]);(0,q.useEffect)(()=>{E>=z.length&&D(0)},[z.length,E]),(0,q.useEffect)(()=>{(j.current?.querySelector(`[data-focused="true"]`))?.scrollIntoView({block:`nearest`})},[E,z]);let B=(0,q.useCallback)(e=>{!a||z.length===0||a({hits:qT(z,v),index:e,query:v.trim()})},[a,z,v]),V=(0,q.useCallback)(()=>{y(``),k(null)},[]);(0,q.useEffect)(()=>{M.current&&!e&&B(E),M.current=e},[e,B,E]);let H=(0,q.useMemo)(()=>({diffFileSet:N,changedKeys:P,customMode:c,staged:l}),[N,P,c,l]),U=(0,q.useCallback)((e,n)=>{let r=z[e];if(!r)return;let i=r.hit.path,a=v.trim();if(GT(a,i),r.kind===`file`){if(n){k({path:i});return}DT({kind:`file`,path:i},H).type===`scrollFile`?(B(e),t(),requestAnimationFrame(()=>u(i))):k({path:i});return}let o=r.hit.line,s=r.kind===`symbol`?r.hit.name:a;if(n){k({path:i,line:o,match:s});return}let c=DT({kind:`line`,path:i,line:o,match:s},H);c.type===`scrollLine`?(B(e),t(),requestAnimationFrame(()=>VT(i,c.line,c.side,c.match))):k({path:i,line:o,match:s})},[z,v,H,t,u,B]),W=(0,q.useCallback)(e=>{x(t=>Z0[(Z0.findIndex(e=>e.key===t)+e+Z0.length)%Z0.length].key)},[]),ee=(0,q.useCallback)(e=>{if(e.key===`PageDown`){e.preventDefault(),document.querySelector(`.searchpalette-preview-body`)?.scrollBy({top:150,behavior:`auto`});return}if(e.key===`PageUp`){e.preventDefault(),document.querySelector(`.searchpalette-preview-body`)?.scrollBy({top:-150,behavior:`auto`});return}if(e.altKey&&(e.key===`ArrowDown`||e.key===`j`)){e.preventDefault(),document.querySelector(`.searchpalette-preview-body`)?.scrollBy({top:80,behavior:`auto`});return}if(e.altKey&&(e.key===`ArrowUp`||e.key===`k`)){e.preventDefault(),document.querySelector(`.searchpalette-preview-body`)?.scrollBy({top:-80,behavior:`auto`});return}if(e.shiftKey&&(e.key===`ArrowDown`||e.key===`j`)){e.preventDefault(),document.querySelector(`.searchpalette-preview-body`)?.scrollBy({top:80,behavior:`auto`});return}if(e.shiftKey&&(e.key===`ArrowUp`||e.key===`k`)){e.preventDefault(),document.querySelector(`.searchpalette-preview-body`)?.scrollBy({top:-80,behavior:`auto`});return}if(e.key===`Tab`){e.preventDefault(),W(e.shiftKey?-1:1);return}let t=e=>{z.length!==0&&D(t=>(t+e+z.length)%z.length)};e.key===`ArrowDown`||e.ctrlKey&&(e.key===`n`||e.key===`j`)?(e.preventDefault(),t(1)):e.key===`ArrowUp`||e.ctrlKey&&(e.key===`p`||e.key===`k`)?(e.preventDefault(),t(-1)):e.ctrlKey&&e.key===`d`?(e.preventDefault(),t(8)):e.ctrlKey&&e.key===`u`?(e.preventDefault(),t(-8)):e.ctrlKey&&e.key===`g`?(e.preventDefault(),T(e=>{let t=!e;return i?.(t),t})):e.ctrlKey&&e.key===`r`&&b===`text`?(e.preventDefault(),C(e=>!e)):e.ctrlKey&&e.key===`l`?(e.preventDefault(),V()):e.key===`Enter`&&(e.preventDefault(),U(E,e.metaKey||e.ctrlKey))},[W,z.length,U,E,b,i,V]),te=(0,q.useCallback)(()=>{O?k(null):(B(E),t())},[O,t,B,E]),ne=I?.total??z.length,re=(F.isFetching||F.pending)&&F.enabled,ie=I?.indexing;return(0,J.jsxs)(IH,{open:e,onClose:te,className:`searchpalette ui-modal--palette ${O?`searchpalette--split`:``}`,ariaLabel:`Search files, text and symbols`,initialFocus:A,onKeyDown:ee,children:[(0,J.jsxs)(`div`,{className:`searchpalette-header`,children:[(0,J.jsxs)(`div`,{className:`searchpalette-input-row`,children:[(0,J.jsx)(NO,{size:15,className:`searchpalette-search-icon`}),(0,J.jsx)(`input`,{ref:A,type:`text`,className:`searchpalette-input`,placeholder:b===`all`?`Search files, text and symbols…`:b===`files`?`Search files in the repo…`:b===`text`?S?`Search by regular expression…`:`Search file contents…`:`Search symbol definitions…`,value:v,onChange:e=>y(e.target.value),role:`combobox`,"aria-expanded":z.length>0,"aria-controls":`searchpalette-list`,"aria-activedescendant":z[E]?`sp-row-${E}`:void 0,spellCheck:!1,autoComplete:`off`}),re&&(0,J.jsx)(cO,{size:14,className:`searchpalette-spinner spin`}),v&&(0,J.jsx)(`button`,{className:`searchpalette-clear`,onClick:V,"aria-label":`Clear search`,children:(0,J.jsx)(WO,{size:14})}),(0,J.jsx)(`span`,{className:`searchpalette-count`,children:ie?`indexing…`:I?`${z.length} of ${ne}`:``})]}),(0,J.jsxs)(`div`,{className:`searchpalette-controls`,children:[(0,J.jsx)(`div`,{className:`searchpalette-scopes`,role:`tablist`,"aria-label":`Search scope`,children:Z0.map(e=>(0,J.jsxs)(`button`,{role:`tab`,"aria-selected":b===e.key,className:`searchpalette-scope ${b===e.key?`is-active`:``}`,onClick:()=>x(e.key),children:[(0,J.jsx)(e.Icon,{size:12}),e.label]},e.key))}),(0,J.jsxs)(`div`,{className:`searchpalette-toggles`,children:[b===`text`&&(0,J.jsx)(`button`,{className:`searchpalette-toggle ${S?`is-active`:``}`,onClick:()=>C(e=>!e),title:`Regular expression`,"aria-pressed":S,children:`.*`}),(0,J.jsxs)(`button`,{className:`searchpalette-toggle ${w?`is-active`:``}`,onClick:()=>{T(e=>{let t=!e;return i?.(t),t})},title:`Limit to files in the current diff`,"aria-pressed":w,children:[(0,J.jsx)(QD,{size:12}),`Changed`]})]})]}),I?.regexError&&(0,J.jsx)(`div`,{className:`searchpalette-note`,children:`Invalid regex — showing literal matches`})]}),(0,J.jsxs)(`div`,{className:`searchpalette-body`,children:[(0,J.jsx)(`div`,{className:`searchpalette-list`,id:`searchpalette-list`,role:`listbox`,ref:j,children:(0,J.jsx)(a2,{rows:z,scope:b,query:v,focusedIndex:E,engineError:L,isFetching:F.isFetching,enabled:F.enabled,minLength:F.minLength,regex:S,changedOnly:w,onHover:D,onActivate:(e,t)=>U(e,t?t.metaKey||t.ctrlKey:!1),onRetry:()=>F.refetch()})}),O&&(0,J.jsx)(d2,{preview:O,theme:d,fontSize:f,monoFontFamily:p,defaultTabSize:m,lineWrap:h,showLineNumbers:g,lineHoverHighlight:_,onClose:()=>k(null),inDiff:N.has(O.path),onGoToDiff:()=>{B(E),t(),O.line?requestAnimationFrame(()=>VT(O.path,O.line,`additions`,O.match)):requestAnimationFrame(()=>u(O.path))}},O.path)]}),(0,J.jsxs)(`div`,{className:`searchpalette-foot`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`Tab`}),` scope`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`Ctrl`}),`+`,(0,J.jsx)(`kbd`,{children:`G`}),` changed`]}),b===`text`&&(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`Ctrl`}),`+`,(0,J.jsx)(`kbd`,{children:`R`}),` regex`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`Ctrl`}),`+`,(0,J.jsx)(`kbd`,{children:`L`}),` clear`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`Ctrl`}),`+`,(0,J.jsx)(`kbd`,{children:`U`}),`/`,(0,J.jsx)(`kbd`,{children:`D`}),` page`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`↑↓`}),` move`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`n`}),`/`,(0,J.jsx)(`kbd`,{children:`N`}),` after close`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`↵`}),` `,O&&N.has(O.path)?`view in diff`:`open`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`⌘↵`}),` peek`]}),O&&(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`⌥↑↓`}),` / `,(0,J.jsx)(`kbd`,{children:`⇧↑↓`}),` scroll preview`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`esc`}),` `,O?`unfocus preview`:`close`]})]})]})}function a2({rows:e,scope:t,query:n,focusedIndex:r,engineError:i,isFetching:a,enabled:o,minLength:s,regex:c,changedOnly:l,onHover:u,onActivate:d,onRetry:f}){return i&&t!==`files`?(0,J.jsxs)(`div`,{className:`searchpalette-state searchpalette-state--error`,children:[(0,J.jsx)(`p`,{children:`Search engine unavailable`}),(0,J.jsx)(`span`,{className:`searchpalette-state-detail`,children:i}),(0,J.jsx)(`button`,{className:`searchpalette-retry`,onClick:f,children:`Retry`})]}):e.length>0?(0,J.jsx)(J.Fragment,{children:e.map((e,t)=>(0,J.jsx)(o2,{row:e,index:t,query:n,focused:t===r,onHover:u,onActivate:d},e.key))}):o?a?(0,J.jsxs)(`div`,{className:`searchpalette-state`,children:[(0,J.jsx)(cO,{size:15,className:`spin`}),` Searching…`]}):(0,J.jsxs)(`div`,{className:`searchpalette-state`,children:[(0,J.jsxs)(`p`,{children:[`No matches`,n.trim()?` for “${n.trim()}”`:``]}),(0,J.jsx)(`span`,{className:`searchpalette-state-detail`,children:l?`Searching only changed files — turn off Changed to search the whole repo`:t===`text`&&!c?`Try Tab to switch scope, or enable .* for regex`:`Try Tab to switch scope`})]}):(0,J.jsx)(`div`,{className:`searchpalette-state`,children:t===`symbols`?n.trim()?`No matching symbols in the current diff. Type at least 2 characters to search the whole repository.`:`No symbols found in the current diff. Type at least 2 characters to search the whole repository.`:t===`text`?`Type to search file contents`:`Type to filter — or browse all files`})}function o2({row:e,index:t,query:n,focused:r,onHover:i,onActivate:a}){let o=$0(e.hit.gitStatus);return(0,J.jsxs)(`div`,{id:`sp-row-${t}`,role:`option`,"aria-selected":r,"data-focused":r,className:`searchpalette-row ${r?`is-focused`:``} ${e.inDiff?`is-indiff`:``}`,onMouseEnter:()=>i(t),onClick:e=>a(t,e),children:[e.kind===`file`&&(0,J.jsx)(s2,{hit:e.hit,query:n}),e.kind===`text`&&(0,J.jsx)(c2,{hit:e.hit,query:n}),e.kind===`symbol`&&(0,J.jsx)(l2,{hit:e.hit}),(0,J.jsxs)(`div`,{className:`searchpalette-rail`,children:[e.inDiff&&(0,J.jsx)(`span`,{className:`searchpalette-pill searchpalette-pill--diff`,children:`diff`}),o&&(0,J.jsx)(`span`,{className:`searchpalette-git searchpalette-git--${o.title}`,title:o.title,children:o.label})]})]})}function s2({hit:e,query:t}){let n=e.fileName,r=t2(n,t);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`searchpalette-tile searchpalette-tile--file`,children:(0,J.jsx)(qD,{size:13})}),(0,J.jsxs)(`div`,{className:`searchpalette-info`,children:[(0,J.jsx)(`span`,{className:`searchpalette-primary`,children:(0,J.jsx)(e2,{text:n,ranges:r})}),(0,J.jsx)(`span`,{className:`searchpalette-secondary`,children:n2(e.path)||`./`})]})]})}function c2({hit:e,query:t}){let n=jT(e.content,e.matchRanges,t),{text:r,ranges:i}=r2(e.content,n);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`searchpalette-tile searchpalette-tile--text`,children:(0,J.jsx)(VO,{size:13})}),(0,J.jsxs)(`div`,{className:`searchpalette-info`,children:[(0,J.jsx)(`span`,{className:`searchpalette-primary searchpalette-code`,children:(0,J.jsx)(e2,{text:r,ranges:i})}),(0,J.jsxs)(`span`,{className:`searchpalette-secondary`,children:[e.fileName,`:`,e.line,(0,J.jsx)(`span`,{className:`searchpalette-crumb`,children:n2(e.path)})]})]})]})}function l2({hit:e}){let t=e.content.indexOf(e.name),n=t>=0?e.content.slice(t+e.name.length).trimEnd():``,r=jT(e.name,e.matchRanges.length?u2(e):void 0,e.name);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`searchpalette-tile searchpalette-tile--symbol`,title:e.kind,children:Q0[e.kind]??`?`}),(0,J.jsxs)(`div`,{className:`searchpalette-info`,children:[(0,J.jsxs)(`span`,{className:`searchpalette-primary`,children:[(0,J.jsx)(e2,{text:e.name,ranges:r}),n&&(0,J.jsx)(`span`,{className:`searchpalette-sigtail`,children:n.slice(0,60)})]}),(0,J.jsxs)(`span`,{className:`searchpalette-secondary`,children:[e.fileName,`:`,e.line,(0,J.jsx)(`span`,{className:`searchpalette-crumb`,children:n2(e.path)})]})]}),(0,J.jsx)(`span`,{className:`searchpalette-kind-badge`,children:e.kind})]})}function u2(e){let t=e.content.indexOf(e.name);if(t<0)return;let n=[];for(let[r,i]of e.matchRanges){let a=r-t,o=i-t;o>0&&a<e.name.length&&n.push([Math.max(0,a),Math.min(e.name.length,o)])}return n.length?n:void 0}function d2({preview:e,theme:t,fontSize:n,monoFontFamily:r,defaultTabSize:i,lineWrap:a,showLineNumbers:o,lineHoverHighlight:s,onClose:c,inDiff:l,onGoToDiff:u}){let d=LT[t]||LT[`rose-pine`],{data:f,isLoading:p,error:m}=X0(e.path),h=(0,q.useRef)(null);return(0,q.useEffect)(()=>{!f?.content||!e.line||!h.current||BT(h.current,e.line,e.match)},[f?.content,e.line,e.match]),(0,J.jsxs)(`div`,{className:`searchpalette-preview`,children:[(0,J.jsxs)(`div`,{className:`searchpalette-preview-head`,children:[(0,J.jsx)(qD,{size:12}),(0,J.jsx)(`span`,{className:`searchpalette-preview-path`,children:e.path}),l&&(0,J.jsxs)(`button`,{className:`searchpalette-preview-diff-btn`,onClick:u,title:`Open this file and line in the main diff viewer (Enter)`,style:{padding:`2.5px 8px`,fontSize:`10.5px`,background:`var(--accent-subtle)`,border:`1px solid var(--accent)`,borderRadius:`4px`,color:`var(--text-primary)`,cursor:`pointer`,fontWeight:600,marginRight:`8px`,display:`inline-flex`,alignItems:`center`,gap:`4px`},children:[(0,J.jsx)(QD,{size:11}),`View in Diff`]}),(0,J.jsx)(`button`,{className:`searchpalette-clear`,onClick:c,"aria-label":`Close preview`,children:(0,J.jsx)(WO,{size:14})})]}),(0,J.jsx)(`div`,{className:`searchpalette-preview-body`,ref:h,children:p?(0,J.jsxs)(`div`,{className:`searchpalette-state`,children:[(0,J.jsx)(cO,{size:15,className:`spin`}),` Loading `,e.path,`…`]}):m?(0,J.jsx)(`div`,{className:`searchpalette-state searchpalette-state--error`,children:m.message}):f?.binary?(0,J.jsx)(`div`,{className:`searchpalette-state`,children:`Binary file — no preview`}):f?.missing?(0,J.jsx)(`div`,{className:`searchpalette-state`,children:`File not present in the working tree`}):f?(0,J.jsx)(Rm,{file:{name:e.path,contents:f.content??``},options:{disableFileHeader:!0,overflow:a?`wrap`:`scroll`,disableLineNumbers:!o,lineHoverHighlight:s,theme:{dark:d.type===`dark`?d.themeName:`rose-pine`,light:d.type===`light`?d.themeName:`github-light`},themeType:d.type,unsafeCSS:`
3924
3924
  :host {
3925
3925
  --diffs-tab-size: ${i} !important;
3926
3926
  --diffs-font-family: ${r} !important;
@@ -3939,45 +3939,48 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
3939
3939
  color: var(--gl-gutter) !important;
3940
3940
  opacity: 1 !important;
3941
3941
  }
3942
- `}}):null})]})}var u2=(0,q.memo)(function({activeFile:e,onShowHelp:t,placeholder:n=`No active file (J/K to jump)`,statusMessage:r=null,visible:i=!0}){if(!i)return null;let[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!0),l=(0,q.useRef)(null);(0,q.useEffect)(()=>{let e=()=>{let e=document.activeElement;if(e){let t=e.tagName.toLowerCase();o(t===`input`||t===`textarea`||e.hasAttribute(`contenteditable`))}else o(!1)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,e);let t=setInterval(e,400);return()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,e),clearInterval(t)}},[]),(0,q.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`b`&&(e.preventDefault(),c(e=>!e))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let u=e?e.split(`/`).pop():null,d=e&&e.includes(`/`)?e.split(`/`).slice(0,-1).join(`/`)+`/`:``,f=(0,q.useCallback)(e=>{e?.stopPropagation(),c(e=>!e)},[]);return(0,J.jsxs)(`div`,{className:`vim-status-bar ${s?`vim-status-collapsed`:``}`,children:[(0,J.jsx)(`div`,{className:`vim-mode-badge ${a?`vim-mode-insert`:`vim-mode-normal`}`,children:a?`INSERT`:`NORMAL`}),!s&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`vim-status-content`,children:[(0,J.jsx)(RO,{size:12,className:`vim-status-icon`}),e?(0,J.jsxs)(`span`,{className:`vim-status-file`,title:e,children:[(0,J.jsx)(`span`,{className:`vim-file-dir`,children:d}),(0,J.jsx)(`strong`,{className:`vim-file-name`,children:u})]}):r?(0,J.jsx)(`span`,{className:`vim-status-placeholder vim-status-flash`,children:r}):(0,J.jsx)(`span`,{className:`vim-status-placeholder`,children:n})]}),(0,J.jsxs)(`button`,{className:`vim-status-help-btn`,onClick:t,title:`View Keyboard Shortcuts (?)`,children:[(0,J.jsx)(ND,{size:13}),(0,J.jsx)(`span`,{children:`Shortcuts`}),(0,J.jsx)(`kbd`,{className:`vim-kbd-small`,children:`?`})]})]}),(0,J.jsx)(`button`,{ref:l,className:`vim-status-toggle`,onClick:f,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f(e))},title:s?`Expand status bar (⌘B)`:`Collapse status bar (⌘B)`,"aria-label":s?`Expand status bar`:`Collapse status bar`,tabIndex:0,children:s?(0,J.jsx)(DD,{size:12}):(0,J.jsx)(ED,{size:12})})]})}),d2=(0,q.memo)(function({isOpen:e,onClose:t,mode:n=`diff`}){let r=[{title:`Scrolling & Diffs`,icon:(0,J.jsx)(bO,{size:15}),items:[{keys:[`j`],description:`Scroll Down slightly`},{keys:[`k`],description:`Scroll Up slightly`},{keys:[`Ctrl`,`d`],description:`Scroll Down half page`},{keys:[`Ctrl`,`u`],description:`Scroll Up half page`},{keys:[`g`,`g`],description:`Scroll to Top of diffs`},{keys:[`G`],description:`Scroll to Bottom of diffs`}]},{title:`File Navigation`,icon:(0,J.jsx)(rO,{size:15}),items:[{keys:[`J`],description:`Jump to Next File Diff`},{keys:[`K`],description:`Jump to Previous File Diff`},{keys:[`v`],description:`Toggle Viewed state for Active File`},{keys:[`b`],description:`Toggle Sidebar Panel collapse`}]},{title:`Commit Walk`,icon:(0,J.jsx)(ZD,{size:15}),items:[{keys:[`]`],description:`Next commit (diffing show multi-commit)`},{keys:[`[`],description:`Previous commit (diffing show multi-commit)`},{keys:[`UI`],description:`Walk bar: Show all returns to the full range patch`}]},{title:`Search & Dialogs`,icon:(0,J.jsx)(WD,{size:15}),items:[{keys:[`⌘`,`K`],description:`Open Search Palette (all scopes)`},{keys:[`g`,`f`],description:`Open Search Palette (all scopes, same as ⌘K)`},{keys:[`/`],description:`Open Search Palette (All scopes, changed files only)`},{keys:[`f`],description:`Browse files (Files scope, changed files only)`},{keys:[`g`,`v`],description:`Browse files (same as f)`},{keys:[`s`],description:`Search symbols (Symbols scope, changed files only)`},{keys:[`g`,`s`],description:`Search symbols (same as s)`},{keys:[`g`,`t`],description:`Open Theme Selection Modal`},{keys:[`Tab`],description:`Cycle search scope while palette is open`},{keys:[`Ctrl`,`G`],description:`Toggle Changed-only filter (in palette)`},{keys:[`Ctrl`,`R`],description:`Toggle regex mode (Text scope, in palette)`},{keys:[`Ctrl`,`L`],description:`Clear search query (in palette)`},{keys:[`Ctrl`,`U`],description:`Page result list up (in palette)`},{keys:[`Ctrl`,`D`],description:`Page result list down (in palette)`},{keys:[`↑`,`↓`],description:`Move selection in result list (in palette)`},{keys:[`Enter`],description:`Jump to selected match (in palette)`},{keys:[`⌘`,`↵`],description:`Peek a result in the preview pane (in palette)`},{keys:[`Esc`],description:`Close palette, or unfocus preview first (two-stage, in palette)`},{keys:[`n`],description:`Next search result (after palette closes)`},{keys:[`N`],description:`Previous search result (after palette closes)`},{keys:[`?`],description:`Open Keyboard Shortcuts Guide`},{keys:[`⌘`,`?`],description:`Open Keyboard Shortcuts Guide`}]},{title:`Views & Formatting`,icon:(0,J.jsx)(hO,{size:15}),items:[{keys:[`m`],description:`Toggle Diff Style (Unified ↔ Split)`},{keys:[`t`],description:`Cycle Tab Indentation Size (2 → 4 → 8)`},{keys:[`w`],description:`Toggle Soft-Wrap Long Lines`},{keys:[`#`],description:`Toggle Line Numbers`},{keys:[`g`,`n`],description:`Toggle Line Numbers (same as #)`},{keys:[`Settings`],description:`Toggle Line Numbers (settings panel)`},{keys:[`i`],description:`Cycle Diff Indicator Style (+/− → bars → none)`},{keys:[`I`],description:`Cycle Inline Diff Style (word → word-alt → char → none)`},{keys:[`⌘`,`Shift`,`P`],description:`Toggle Preview Mode in Comments`}]},{title:`Review & Comments`,icon:(0,J.jsx)(hO,{size:15}),items:[{keys:[`UI`],description:`Select lines or gutter + to start an inline comment`},{keys:[`v`],description:`Toggle Viewed on the active file (collapses card)`},{keys:[`UI`],description:`File header icons: expand context · edit · file comment`},{keys:[`UI`],description:`Round badge → open review history timeline`},{keys:[`UI`],description:`File-tree chips: Unviewed · Comments · Since last`},{keys:[`UI`],description:"Comment form “Suggest change” inserts ```suggestion fence"},{keys:[`click #`],description:`Line number copies a deep permalink (?file&line&side)`},{keys:[`UI`],description:`Minimap: change-map + density strip scroll targets`},{keys:[`UI`],description:`Send review: pick verdict, optional note, hand off to agent`}]},{title:`Dialogs & Settings`,icon:(0,J.jsx)(rO,{size:15}),items:[{keys:[`?`],description:`Open Keyboard Shortcuts Guide`},{keys:[`⌘`,`?`],description:`Open Keyboard Shortcuts Guide`},{keys:[`⌘`,`,`],description:`Open Settings`},{keys:[`⌘`,`K`],description:`Open Search Palette`},{keys:[`⌘`,`B`],description:`Collapse / expand the vim status bar`},{keys:[`g`,`t`],description:`Open Theme Selection Modal`},{keys:[`Esc`],description:`Close preview / dialog / this guide`}]}],i=[{title:`Scrolling & Content`,icon:(0,J.jsx)(bO,{size:15}),items:[{keys:[`j`],description:`Scroll Down slightly`},{keys:[`k`],description:`Scroll Up slightly`},{keys:[`Ctrl`,`d`],description:`Scroll Down half page`},{keys:[`Ctrl`,`u`],description:`Scroll Up half page`},{keys:[`g`,`g`],description:`Scroll to Top of plan`},{keys:[`G`],description:`Scroll to Bottom of plan`}]},{title:`Plan Navigation`,icon:(0,J.jsx)(rO,{size:15}),items:[{keys:[`J`],description:`Jump to Next Plan in list`},{keys:[`K`],description:`Jump to Previous Plan in list`},{keys:[`b`],description:`Toggle Plans Sidebar collapse`}]},{title:`Views & Layout`,icon:(0,J.jsx)(WD,{size:15}),items:[{keys:[`m`],description:`Cycle view mode (Source → Read → Split)`},{keys:[`UI`],description:`Toolbar Source / Read / Split switches the same modes`},{keys:[`z`],description:`Toggle Zen reading (enters Read if needed; full-width focus)`},{keys:[`UI`],description:`Read mode: expand icon also toggles Zen`},{keys:[`Esc`],description:`Exit Zen reading mode`},{keys:[`e`],description:`Toggle live plan edit (Source editor + Read preview; current version only)`},{keys:[`⌘`,`S`],description:`While editing: flush autosave now`},{keys:[`UI`],description:`Edit mode: Save · Save as new version · Discard (recent and/or roll back to original)`},{keys:[`Esc`],description:`Edit mode: open Discard (or exit edit if nothing to discard)`},{keys:[`o`],description:`Toggle Outline sidebar (left TOC)`},{keys:[`c`],description:`Toggle Comments map sidebar (right rail)`},{keys:[`drag`],description:`Split mode: drag the center divider to resize panes`},{keys:[`dbl-click`],description:`Split mode: double-click divider to reset 50/50`},{keys:[`←`,`→`],description:`Split mode: focus divider, nudge width ±2%`},{keys:[`t`],description:`Cycle Tab Indentation Size (2 → 4 → 8)`},{keys:[`w`],description:`Toggle Soft-Wrap Long Lines`},{keys:[`n`],description:`Toggle Line Numbers`}]},{title:`Comments & Review`,icon:(0,J.jsx)(hO,{size:15}),items:[{keys:[`c`],description:`Toggle Comments map sidebar (right rail)`},{keys:[`o`],description:`Toggle Outline sidebar (left TOC)`},{keys:[`UI`],description:`Source: select lines or click gutter + to comment`},{keys:[`UI`],description:`Read: highlight text → Add comment (multiple drafts OK)`},{keys:[`UI`],description:`Edit mode: new comments disabled; existing threads still resolvable`},{keys:[`Esc`],description:`Dismiss Add-comment chip / close draft (asks if dirty)`},{keys:[`UI`],description:`Header icons: copy link · copy markdown · open in editor · edit`},{keys:[`UI`],description:`Header: Outline (o) · Comments map (c)`},{keys:[`⌘`,`Shift`,`P`],description:`Toggle Preview Mode in Comments`}]},{title:`Dialogs & Settings`,icon:(0,J.jsx)(rO,{size:15}),items:[{keys:[`?`],description:`Open Keyboard Shortcuts Guide`},{keys:[`⌘`,`?`],description:`Open Keyboard Shortcuts Guide`},{keys:[`⌘`,`,`],description:`Open Settings`},{keys:[`⌘`,`B`],description:`Collapse / expand the vim status bar`},{keys:[`g`,`t`],description:`Open Theme Selection Modal`},{keys:[`Esc`],description:`Close preview / dialog / this guide`}]}],a=r.filter(e=>e.title!==`Commit Walk`).map(e=>e.title===`Review & Comments`?{...e,items:[{keys:[`UI`],description:`Select lines or gutter + to start a GitHub review comment`},{keys:[`v`],description:`Toggle Viewed on the active PR file (collapses card)`},{keys:[`UI`],description:`File header icons: expand context · file comment · viewed`},{keys:[`UI`],description:`File-tree chips: Unviewed · Comments`},{keys:[`click #`],description:`Line number copies a deep permalink (?file&line&side)`},{keys:[`UI`],description:`Checks pill: live successful · failed · pending GitHub actions`},{keys:[`UI`],description:`Submit to GitHub: approve · comment · request changes · draft`}]}:e),o=n===`plan`?i:n===`pr`?a:r,s=n===`plan`?`Vim-style keybindings for plan review. Cycle Source / Read / Split with m, jump plans with J/K, and comment from line selection or text highlight.`:n===`pr`?`The same Vim-style diff keybindings used by local review, scoped to GitHub PR navigation, formatting, search, and comments.`:`Vim-style keybindings for reviewing diffs. Jump files with J/K, walk commits with [ / ], and open search with ⌘K.`;return(0,J.jsxs)(IH,{open:e,onClose:t,className:`shortcuts-modal`,ariaLabel:`Keyboard shortcuts`,children:[(0,J.jsxs)(`div`,{className:`shortcuts-header`,children:[(0,J.jsxs)(`div`,{className:`shortcuts-header-title`,children:[(0,J.jsx)(HH,{size:22,className:`shortcuts-mark`}),(0,J.jsx)(`h2`,{children:n===`plan`?`Plan Review Shortcuts`:n===`pr`?`GitHub PR Review Shortcuts`:`Developer Keyboard Shortcuts`})]}),(0,J.jsx)(`button`,{className:`shortcuts-close-btn`,onClick:t,"aria-label":`Close dialog`,children:(0,J.jsx)(WO,{size:16})})]}),(0,J.jsxs)(`div`,{className:`shortcuts-body`,children:[(0,J.jsx)(`div`,{className:`shortcuts-intro`,children:s}),(0,J.jsx)(`div`,{className:`shortcuts-grid`,children:o.map((e,t)=>(0,J.jsxs)(`div`,{className:`shortcuts-section`,children:[(0,J.jsxs)(`h3`,{className:`shortcuts-section-title`,children:[e.icon,(0,J.jsx)(`span`,{children:e.title})]}),(0,J.jsx)(`div`,{className:`shortcuts-list`,children:e.items.map((e,t)=>(0,J.jsxs)(`div`,{className:`shortcuts-row`,children:[(0,J.jsx)(`span`,{className:`shortcuts-desc`,children:e.description}),(0,J.jsx)(`div`,{className:`shortcuts-keys`,children:e.keys.map((t,n)=>(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{className:`vim-kbd`,children:t}),n<e.keys.length-1&&(0,J.jsx)(`span`,{className:`kbd-plus`,children:`+`})]},n))})]},t))})]},t))})]}),(0,J.jsxs)(`div`,{className:`shortcuts-footer`,children:[`Press `,(0,J.jsx)(`kbd`,{className:`vim-kbd-small`,children:`?`}),n===`plan`&&(0,J.jsxs)(J.Fragment,{children:[` `,`or `,(0,J.jsx)(`kbd`,{className:`vim-kbd-small`,children:`Esc`})]}),` `,`to dismiss this menu at any time.`]})]})});function f2({activity:e,onDismiss:t,onJump:n}){if((0,q.useEffect)(()=>{if(!e)return;let n=setTimeout(t,8e3);return()=>clearTimeout(n)},[e,t]),!e)return null;let r=e.body.length>120?`${e.body.slice(0,120)}…`:e.body;return(0,J.jsxs)(`div`,{className:`agent-toast`,role:`status`,"aria-live":`polite`,children:[(0,J.jsxs)(`button`,{className:`agent-toast-body`,onClick:()=>{n(e.filePath),t()},title:`Jump to the file`,children:[(0,J.jsx)(`span`,{className:`agent-toast-icon`,children:(0,J.jsx)(SD,{size:16})}),(0,J.jsxs)(`span`,{className:`agent-toast-text`,children:[(0,J.jsxs)(`span`,{className:`agent-toast-title`,children:[`Agent replied`,e.model?` · ${e.model}`:``]}),(0,J.jsx)(`span`,{className:`agent-toast-file`,children:e.filePath}),(0,J.jsx)(`span`,{className:`agent-toast-preview`,children:r})]})]}),(0,J.jsx)(`button`,{className:`agent-toast-close`,onClick:t,"aria-label":`Dismiss`,children:(0,J.jsx)(WO,{size:14})})]})}var p2=[{id:`nord`,name:`Nord`,type:`dark`,colors:{bg:`#2e3440`,secondary:`#242933`,accent:`#88c0d0`}},{id:`github-dark`,name:`GitHub Dark`,type:`dark`,colors:{bg:`#0d1117`,secondary:`#161b22`,accent:`#58a6ff`}},{id:`github-dark-dimmed`,name:`GitHub Dark Dimmed`,type:`dark`,colors:{bg:`#22272e`,secondary:`#1c2128`,accent:`#539bf5`}},{id:`github-dark-high-contrast`,name:`GitHub Dark HC`,type:`dark`,colors:{bg:`#0a0c10`,secondary:`#010409`,accent:`#409eff`}},{id:`github-light`,name:`GitHub Light`,type:`light`,colors:{bg:`#ffffff`,secondary:`#f6f8fa`,accent:`#0969da`}},{id:`github-light-high-contrast`,name:`GitHub Light HC`,type:`light`,colors:{bg:`#ffffff`,secondary:`#f6f8fa`,accent:`#0969da`}},{id:`dracula`,name:`Dracula`,type:`dark`,colors:{bg:`#282a36`,secondary:`#1e1f29`,accent:`#bd93f9`}},{id:`one-dark`,name:`One Dark`,type:`dark`,colors:{bg:`#282c34`,secondary:`#21252b`,accent:`#61afef`}},{id:`synthwave-84`,name:`Synthwave '84`,type:`dark`,colors:{bg:`#2b213a`,secondary:`#241b2f`,accent:`#f92aad`}},{id:`tokyo-night`,name:`Tokyo Night`,type:`dark`,colors:{bg:`#1a1b26`,secondary:`#16161e`,accent:`#7aa2f7`}},{id:`catppuccin-mocha`,name:`Catppuccin Mocha`,type:`dark`,colors:{bg:`#1e1e2e`,secondary:`#181825`,accent:`#cba6f7`}},{id:`catppuccin-frappe`,name:`Catppuccin Frappé`,type:`dark`,colors:{bg:`#303446`,secondary:`#292c3c`,accent:`#ca9ee6`}},{id:`catppuccin-macchiato`,name:`Catppuccin Macchiato`,type:`dark`,colors:{bg:`#24273a`,secondary:`#1e2030`,accent:`#c6a0f6`}},{id:`catppuccin-latte`,name:`Catppuccin Latte`,type:`light`,colors:{bg:`#eff1f5`,secondary:`#e6e9ef`,accent:`#8839ef`}},{id:`solarized-dark`,name:`Solarized Dark`,type:`dark`,colors:{bg:`#002b36`,secondary:`#073642`,accent:`#268bd2`}},{id:`solarized-light`,name:`Solarized Light`,type:`light`,colors:{bg:`#fdf6e3`,secondary:`#eee8d5`,accent:`#268bd2`}},{id:`monokai`,name:`Monokai`,type:`dark`,colors:{bg:`#272822`,secondary:`#1d1e19`,accent:`#f92672`}},{id:`ayu-dark`,name:`Ayu Dark`,type:`dark`,colors:{bg:`#0a0e14`,secondary:`#0d1117`,accent:`#e6b450`}},{id:`ayu-light`,name:`Ayu Light`,type:`light`,colors:{bg:`#fafafa`,secondary:`#f3f3f3`,accent:`#ff9900`}},{id:`nightfox`,name:`Nightfox`,type:`dark`,colors:{bg:`#192330`,secondary:`#131a24`,accent:`#719cd6`}},{id:`nordfox`,name:`Nordfox`,type:`dark`,colors:{bg:`#2e3440`,secondary:`#232831`,accent:`#81a1c1`}},{id:`duskfox`,name:`Duskfox`,type:`dark`,colors:{bg:`#232136`,secondary:`#1d1b2d`,accent:`#86b3b3`}},{id:`terafox`,name:`Terafox`,type:`dark`,colors:{bg:`#152528`,secondary:`#0f1c1e`,accent:`#5a93aa`}},{id:`carbonfox`,name:`Carbonfox`,type:`dark`,colors:{bg:`#161616`,secondary:`#111111`,accent:`#78a9ff`}},{id:`dayfox`,name:`Dayfox`,type:`light`,colors:{bg:`#f6f2ee`,secondary:`#ebe5df`,accent:`#2848a9`}},{id:`dawnfox`,name:`Dawnfox`,type:`light`,colors:{bg:`#eae5e5`,secondary:`#e0d8d8`,accent:`#614d85`}},{id:`andromeeda`,name:`Andromeeda`,type:`dark`,colors:{bg:`#090b10`,secondary:`#0e1117`,accent:`#00e8c6`}},{id:`aurora-x`,name:`Aurora X`,type:`dark`,colors:{bg:`#07090f`,secondary:`#0c0e15`,accent:`#2eb5e5`}},{id:`dark-plus`,name:`Dark+ (VS Code)`,type:`dark`,colors:{bg:`#1e1e1e`,secondary:`#252526`,accent:`#0e639c`}},{id:`light-plus`,name:`Light+ (VS Code)`,type:`light`,colors:{bg:`#ffffff`,secondary:`#f3f3f3`,accent:`#007acc`}},{id:`houston`,name:`Houston (Astro)`,type:`dark`,colors:{bg:`#131415`,secondary:`#17191e`,accent:`#ff5d01`}},{id:`laserwave`,name:`Laserwave`,type:`dark`,colors:{bg:`#1b1d28`,secondary:`#181a23`,accent:`#ffe261`}},{id:`material-theme`,name:`Material Theme`,type:`dark`,colors:{bg:`#263238`,secondary:`#1e272c`,accent:`#80cbd8`}},{id:`material-theme-darker`,name:`Material Darker`,type:`dark`,colors:{bg:`#212121`,secondary:`#1a1a1a`,accent:`#80cbd8`}},{id:`material-theme-lighter`,name:`Material Lighter`,type:`light`,colors:{bg:`#fafafa`,secondary:`#eeeded`,accent:`#80cbd8`}},{id:`material-theme-ocean`,name:`Material Ocean`,type:`dark`,colors:{bg:`#0f111a`,secondary:`#090b10`,accent:`#80cbd8`}},{id:`material-theme-palenight`,name:`Material Palenight`,type:`dark`,colors:{bg:`#292d3e`,secondary:`#202331`,accent:`#80cbd8`}},{id:`min-dark`,name:`Min Dark`,type:`dark`,colors:{bg:`#1f1f1f`,secondary:`#181818`,accent:`#ffffff`}},{id:`min-light`,name:`Min Light`,type:`light`,colors:{bg:`#ffffff`,secondary:`#f5f5f5`,accent:`#111111`}},{id:`night-owl`,name:`Night Owl`,type:`dark`,colors:{bg:`#011627`,secondary:`#0b2942`,accent:`#7fdbca`}},{id:`one-light`,name:`One Light`,type:`light`,colors:{bg:`#fafafa`,secondary:`#f0f0f0`,accent:`#40a9ff`}},{id:`plastic`,name:`Plastic`,type:`dark`,colors:{bg:`#21252b`,secondary:`#1b1d23`,accent:`#61afef`}},{id:`poimandres`,name:`Poimandres`,type:`dark`,colors:{bg:`#1b1e28`,secondary:`#171922`,accent:`#50cad2`}},{id:`rose-pine`,name:`Rosé Pine (Main)`,type:`dark`,colors:{bg:`#191724`,secondary:`#1f1d2e`,accent:`#c4a7e7`}},{id:`rose-pine-moon`,name:`Rosé Pine Moon`,type:`dark`,colors:{bg:`#232136`,secondary:`#2a283e`,accent:`#c4a7e7`}},{id:`rose-pine-dawn`,name:`Rosé Pine Dawn`,type:`light`,colors:{bg:`#faf4ed`,secondary:`#f2e9e1`,accent:`#907aa9`}},{id:`slack-dark`,name:`Slack Dark`,type:`dark`,colors:{bg:`#1a1d21`,secondary:`#222529`,accent:`#36c5f0`}},{id:`slack-ochre`,name:`Slack Ochre`,type:`dark`,colors:{bg:`#222222`,secondary:`#2b2b2b`,accent:`#e8912d`}},{id:`vesper`,name:`Vesper`,type:`dark`,colors:{bg:`#101010`,secondary:`#161616`,accent:`#ffc600`}},{id:`vitesse-black`,name:`Vitesse Black`,type:`dark`,colors:{bg:`#000000`,secondary:`#0b0b0b`,accent:`#4d9375`}},{id:`vitesse-dark`,name:`Vitesse Dark`,type:`dark`,colors:{bg:`#121212`,secondary:`#181818`,accent:`#4d9375`}},{id:`vitesse-light`,name:`Vitesse Light`,type:`light`,colors:{bg:`#ffffff`,secondary:`#fafafa`,accent:`#1b655f`}}];function m2({open:e,activeTheme:t,onThemeChange:n,onClose:r}){let[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(0),u=(0,q.useRef)(null),d=(0,q.useRef)(null),f=(0,q.useRef)([]);(0,q.useEffect)(()=>{e&&(a(``),s(`all`),l(0),setTimeout(()=>{u.current?.focus()},50))},[e]);let p=(0,q.useMemo)(()=>{let e=i.toLowerCase().trim();return p2.filter(t=>{let n=t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e),r=o===`all`||t.type===o;return n&&r})},[i,o]);return(0,q.useEffect)(()=>{c>=p.length&&l(Math.max(0,p.length-1))},[p,c]),(0,q.useEffect)(()=>{e&&f.current[c]&&f.current[c]?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[c,e]),(0,J.jsx)(IH,{open:e,onClose:r,className:`theme-modal`,ariaLabel:`Theme Selector Modal`,children:(0,J.jsxs)(`div`,{className:`theme-modal-content`,onKeyDown:e=>{let t=p.length;if(e.key===`Escape`){e.preventDefault(),r();return}if(t!==0)switch(e.key){case`ArrowRight`:e.preventDefault(),l(e=>Math.min(e+1,t-1));break;case`ArrowLeft`:e.preventDefault(),l(e=>Math.max(e-1,0));break;case`ArrowDown`:e.preventDefault(),c+2<t?l(c+2):l(t-1);break;case`ArrowUp`:e.preventDefault(),c-2>=0&&l(c-2);break;case`Enter`:e.preventDefault(),p[c]&&(n(p[c].id),r());break;default:break}},children:[(0,J.jsxs)(`div`,{className:`theme-modal-header`,children:[(0,J.jsxs)(`div`,{className:`theme-modal-title-row`,children:[(0,J.jsx)(HH,{size:24,className:`theme-modal-mark`}),(0,J.jsx)(`h2`,{className:`theme-modal-title`,children:`Select Color Theme`}),(0,J.jsx)(`button`,{className:`theme-modal-close-btn`,onClick:r,"aria-label":`Close`,children:(0,J.jsx)(WO,{size:16})})]}),(0,J.jsxs)(`div`,{className:`theme-modal-search-wrapper`,children:[(0,J.jsx)(NO,{className:`theme-modal-search-icon`,size:16}),(0,J.jsx)(`input`,{ref:u,type:`text`,className:`theme-modal-search-input`,placeholder:`Search themes... (e.g. nordfox, github)`,value:i,onChange:e=>{a(e.target.value),l(0)}}),i&&(0,J.jsx)(`button`,{className:`theme-modal-clear-btn`,onClick:()=>{a(``),l(0),u.current?.focus()},children:(0,J.jsx)(WO,{size:14})})]}),(0,J.jsxs)(`div`,{className:`theme-modal-filters`,children:[(0,J.jsxs)(`button`,{className:`theme-filter-tab ${o===`all`?`active`:``}`,onClick:()=>{s(`all`),l(0),u.current?.focus()},children:[`All Themes (`,p2.length,`)`]}),(0,J.jsxs)(`button`,{className:`theme-filter-tab ${o===`dark`?`active`:``}`,onClick:()=>{s(`dark`),l(0),u.current?.focus()},children:[(0,J.jsx)(yO,{size:12,style:{marginRight:`6px`}}),`Dark (`,p2.filter(e=>e.type===`dark`).length,`)`]}),(0,J.jsxs)(`button`,{className:`theme-filter-tab ${o===`light`?`active`:``}`,onClick:()=>{s(`light`),l(0),u.current?.focus()},children:[(0,J.jsx)(LO,{size:12,style:{marginRight:`6px`}}),`Light (`,p2.filter(e=>e.type===`light`).length,`)`]})]})]}),(0,J.jsx)(`div`,{ref:d,className:`theme-modal-list`,children:p.length===0?(0,J.jsxs)(`div`,{className:`theme-modal-empty`,children:[(0,J.jsxs)(`p`,{className:`theme-modal-empty-text`,children:[`No themes matching "`,i,`"`]}),(0,J.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>{a(``),s(`all`),l(0),u.current?.focus()},children:`Reset Search`})]}):(0,J.jsx)(`div`,{className:`theme-modal-grid`,children:p.map((e,i)=>{let a=t===e.id;return(0,J.jsxs)(`button`,{ref:e=>{f.current[i]=e},type:`button`,className:`theme-modal-card ${a?`active`:``} ${c===i?`focused`:``}`,onClick:()=>{n(e.id),r()},onMouseEnter:()=>l(i),children:[(0,J.jsxs)(`div`,{className:`theme-card-info`,children:[(0,J.jsx)(`span`,{className:`theme-card-name`,children:e.name}),(0,J.jsx)(`span`,{className:`theme-card-meta`,children:e.type===`dark`?(0,J.jsx)(`span`,{className:`theme-meta-tag dark-tag`,children:`Dark`}):(0,J.jsx)(`span`,{className:`theme-meta-tag light-tag`,children:`Light`})})]}),(0,J.jsxs)(`div`,{className:`theme-card-right`,children:[(0,J.jsxs)(`span`,{className:`theme-swatches`,children:[(0,J.jsx)(`span`,{className:`theme-swatch`,style:{background:e.colors.bg},title:`Background`}),(0,J.jsx)(`span`,{className:`theme-swatch`,style:{background:e.colors.secondary},title:`Secondary`}),(0,J.jsx)(`span`,{className:`theme-swatch`,style:{background:e.colors.accent},title:`Accent`})]}),(0,J.jsx)(`span`,{className:`theme-card-status`,children:a&&(0,J.jsx)(wD,{size:14,className:`theme-check-icon`})})]})]},e.id)})})}),(0,J.jsxs)(`div`,{className:`theme-modal-footer`,children:[(0,J.jsxs)(`span`,{className:`theme-footer-item`,children:[(0,J.jsx)(`kbd`,{children:`↑`}),` `,(0,J.jsx)(`kbd`,{children:`↓`}),` `,(0,J.jsx)(`kbd`,{children:`←`}),` `,(0,J.jsx)(`kbd`,{children:`→`}),` Navigate`]}),(0,J.jsxs)(`span`,{className:`theme-footer-item`,children:[(0,J.jsx)(`kbd`,{children:`Enter`}),` Select`]}),(0,J.jsxs)(`span`,{className:`theme-footer-item`,children:[(0,J.jsx)(`kbd`,{children:`ESC`}),` Close`]})]})]})})}var h2=`Cascadia Code.Cascadia Mono.Consolas.Courier New.Dank Mono.Fantasque Sans Mono.Fira Code.Fira Mono.Geist Mono.Hack.IBM Plex Mono.Inconsolata.Input Mono.JetBrains Mono.Maple Mono.Menlo.Monaco.Monoid.Monaspace Argon.Monaspace Krypton.Monaspace Neon.Monaspace Radon.Monaspace Xenon.Noto Sans Mono.Operator Mono.Roboto Mono.SF Mono.Source Code Pro.Space Mono.Ubuntu Mono.Victor Mono`.split(`.`);async function g2(){if(`queryLocalFonts`in window)try{let e=await window.queryLocalFonts();return[...new Set(e.map(e=>e.family))].sort((e,t)=>e.localeCompare(t))}catch{}return h2}function _2({open:e,title:t,defaultLabel:n,activeFont:r,onFontChange:i,onClose:a}){let[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)([]),[u,d]=(0,q.useState)(!1),[f,p]=(0,q.useState)(0),m=(0,q.useRef)(null),h=(0,q.useRef)(null),g=(0,q.useRef)([]);(0,q.useEffect)(()=>{e&&(s(``),p(0),setTimeout(()=>m.current?.focus(),50),!(c.length>0)&&(d(!0),g2().then(e=>{l(e),d(!1)})))},[e]);let _=(0,q.useMemo)(()=>{let e=o.toLowerCase().trim();return e?c.filter(t=>t.toLowerCase().includes(e)):c},[c,o]),v=_.length+1;(0,q.useEffect)(()=>{f>=v&&p(Math.max(0,v-1))},[v,f]),(0,q.useEffect)(()=>{e&&(f===0?g.current[0]:g.current[f])?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[f,e]);let y=e=>{i(e),a()},b=e=>{if(e.key===`Escape`){e.preventDefault(),a();return}if(v!==0)switch(e.key){case`ArrowDown`:e.preventDefault(),p(e=>Math.min(e+1,v-1));break;case`ArrowUp`:e.preventDefault(),p(e=>Math.max(e-1,0));break;case`Enter`:e.preventDefault(),f===0?y(null):_[f-1]&&y(_[f-1]);break}},x=!r;return(0,J.jsx)(IH,{open:e,onClose:a,className:`theme-modal`,ariaLabel:`${t} Modal`,children:(0,J.jsxs)(`div`,{className:`theme-modal-content`,onKeyDown:b,children:[(0,J.jsxs)(`div`,{className:`theme-modal-header`,children:[(0,J.jsxs)(`div`,{className:`theme-modal-title-row`,children:[(0,J.jsx)(`h2`,{className:`theme-modal-title`,children:t}),(0,J.jsx)(`button`,{className:`theme-modal-close-btn`,onClick:a,"aria-label":`Close`,children:(0,J.jsx)(WO,{size:16})})]}),(0,J.jsxs)(`div`,{className:`theme-modal-search-wrapper`,children:[(0,J.jsx)(NO,{className:`theme-modal-search-icon`,size:16}),(0,J.jsx)(`input`,{ref:m,type:`text`,className:`theme-modal-search-input`,placeholder:`Search fonts...`,value:o,onChange:e=>{s(e.target.value),p(0)}}),o&&(0,J.jsx)(`button`,{className:`theme-modal-clear-btn`,onClick:()=>{s(``),p(0),m.current?.focus()},children:(0,J.jsx)(WO,{size:14})})]})]}),(0,J.jsx)(`div`,{ref:h,className:`theme-modal-list`,children:u?(0,J.jsx)(`div`,{className:`theme-modal-empty`,children:(0,J.jsx)(`p`,{className:`theme-modal-empty-text`,children:`Loading fonts…`})}):(0,J.jsxs)(`div`,{className:`font-picker-list`,children:[(0,J.jsxs)(`button`,{ref:e=>{g.current[0]=e},type:`button`,className:`font-picker-item ${x?`active`:``} ${f===0?`focused`:``}`,onClick:()=>y(null),onMouseEnter:()=>p(0),children:[(0,J.jsxs)(`span`,{className:`font-picker-name font-picker-default-name`,children:[(0,J.jsx)(VO,{size:13,style:{marginRight:`6px`,opacity:.6}}),n]}),(0,J.jsx)(`span`,{className:`font-picker-status`,children:x&&(0,J.jsx)(wD,{size:14,className:`theme-check-icon`})})]},`__default__`),_.length===0&&o?(0,J.jsxs)(`div`,{className:`theme-modal-empty`,style:{paddingTop:`16px`},children:[(0,J.jsxs)(`p`,{className:`theme-modal-empty-text`,children:[`No fonts matching "`,o,`"`]}),(0,J.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>{s(``),p(0),m.current?.focus()},children:`Reset Search`})]}):_.map((e,t)=>{let n=r===e,i=f===t+1;return(0,J.jsxs)(`button`,{ref:e=>{g.current[t+1]=e},type:`button`,className:`font-picker-item ${n?`active`:``} ${i?`focused`:``}`,onClick:()=>y(e),onMouseEnter:()=>p(t+1),children:[(0,J.jsx)(`span`,{className:`font-picker-name`,style:{fontFamily:`"${e}", ui-monospace, monospace`},children:e}),(0,J.jsx)(`span`,{className:`font-picker-status`,children:n&&(0,J.jsx)(wD,{size:14,className:`theme-check-icon`})})]},e)})]})}),(0,J.jsxs)(`div`,{className:`theme-modal-footer`,children:[(0,J.jsxs)(`span`,{className:`theme-footer-item`,children:[(0,J.jsx)(`kbd`,{children:`↑`}),` `,(0,J.jsx)(`kbd`,{children:`↓`}),` Navigate`]}),(0,J.jsxs)(`span`,{className:`theme-footer-item`,children:[(0,J.jsx)(`kbd`,{children:`Enter`}),` Select`]}),(0,J.jsxs)(`span`,{className:`theme-footer-item`,children:[(0,J.jsx)(`kbd`,{children:`ESC`}),` Close`]})]})]})})}function v2(e){return e.split(`
3942
+ `}}):null})]})}var f2=(0,q.memo)(function({activeFile:e,onShowHelp:t,placeholder:n=`No active file (J/K to jump)`,statusMessage:r=null,visible:i=!0}){if(!i)return null;let[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!0),l=(0,q.useRef)(null);(0,q.useEffect)(()=>{let e=()=>{let e=document.activeElement;if(e){let t=e.tagName.toLowerCase();o(t===`input`||t===`textarea`||e.hasAttribute(`contenteditable`))}else o(!1)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,e);let t=setInterval(e,400);return()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,e),clearInterval(t)}},[]),(0,q.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`b`&&(e.preventDefault(),c(e=>!e))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let u=e?e.split(`/`).pop():null,d=e&&e.includes(`/`)?e.split(`/`).slice(0,-1).join(`/`)+`/`:``,f=(0,q.useCallback)(e=>{e?.stopPropagation(),c(e=>!e)},[]);return(0,J.jsxs)(`div`,{className:`vim-status-bar ${s?`vim-status-collapsed`:``}`,children:[(0,J.jsx)(`div`,{className:`vim-mode-badge ${a?`vim-mode-insert`:`vim-mode-normal`}`,children:a?`INSERT`:`NORMAL`}),!s&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`vim-status-content`,children:[(0,J.jsx)(RO,{size:12,className:`vim-status-icon`}),e?(0,J.jsxs)(`span`,{className:`vim-status-file`,title:e,children:[(0,J.jsx)(`span`,{className:`vim-file-dir`,children:d}),(0,J.jsx)(`strong`,{className:`vim-file-name`,children:u})]}):r?(0,J.jsx)(`span`,{className:`vim-status-placeholder vim-status-flash`,children:r}):(0,J.jsx)(`span`,{className:`vim-status-placeholder`,children:n})]}),(0,J.jsxs)(`button`,{className:`vim-status-help-btn`,onClick:t,title:`View Keyboard Shortcuts (?)`,children:[(0,J.jsx)(ND,{size:13}),(0,J.jsx)(`span`,{children:`Shortcuts`}),(0,J.jsx)(`kbd`,{className:`vim-kbd-small`,children:`?`})]})]}),(0,J.jsx)(`button`,{ref:l,className:`vim-status-toggle`,onClick:f,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f(e))},title:s?`Expand status bar (⌘B)`:`Collapse status bar (⌘B)`,"aria-label":s?`Expand status bar`:`Collapse status bar`,tabIndex:0,children:s?(0,J.jsx)(DD,{size:12}):(0,J.jsx)(ED,{size:12})})]})}),p2=(0,q.memo)(function({isOpen:e,onClose:t,mode:n=`diff`}){let r=[{title:`Scrolling & Diffs`,icon:(0,J.jsx)(bO,{size:15}),items:[{keys:[`j`],description:`Scroll Down slightly`},{keys:[`k`],description:`Scroll Up slightly`},{keys:[`Ctrl`,`d`],description:`Scroll Down half page`},{keys:[`Ctrl`,`u`],description:`Scroll Up half page`},{keys:[`g`,`g`],description:`Scroll to Top of diffs`},{keys:[`G`],description:`Scroll to Bottom of diffs`}]},{title:`File Navigation`,icon:(0,J.jsx)(rO,{size:15}),items:[{keys:[`J`],description:`Jump to Next File Diff`},{keys:[`K`],description:`Jump to Previous File Diff`},{keys:[`v`],description:`Toggle Viewed state for Active File`},{keys:[`b`],description:`Toggle Sidebar Panel collapse`}]},{title:`Commit Walk`,icon:(0,J.jsx)(ZD,{size:15}),items:[{keys:[`]`],description:`Next commit (diffing show multi-commit)`},{keys:[`[`],description:`Previous commit (diffing show multi-commit)`},{keys:[`UI`],description:`Walk bar: Show all returns to the full range patch`}]},{title:`Search & Dialogs`,icon:(0,J.jsx)(WD,{size:15}),items:[{keys:[`⌘`,`K`],description:`Open Search Palette (all scopes)`},{keys:[`g`,`f`],description:`Open Search Palette (all scopes, same as ⌘K)`},{keys:[`/`],description:`Open Search Palette (All scopes, changed files only)`},{keys:[`f`],description:`Browse files (Files scope, changed files only)`},{keys:[`g`,`v`],description:`Browse files (same as f)`},{keys:[`s`],description:`Search symbols (Symbols scope, changed files only)`},{keys:[`g`,`s`],description:`Search symbols (same as s)`},{keys:[`g`,`t`],description:`Open Theme Selection Modal`},{keys:[`Tab`],description:`Cycle search scope while palette is open`},{keys:[`Ctrl`,`G`],description:`Toggle Changed-only filter (in palette)`},{keys:[`Ctrl`,`R`],description:`Toggle regex mode (Text scope, in palette)`},{keys:[`Ctrl`,`L`],description:`Clear search query (in palette)`},{keys:[`Ctrl`,`U`],description:`Page result list up (in palette)`},{keys:[`Ctrl`,`D`],description:`Page result list down (in palette)`},{keys:[`↑`,`↓`],description:`Move selection in result list (in palette)`},{keys:[`Enter`],description:`Jump to selected match (in palette)`},{keys:[`⌘`,`↵`],description:`Peek a result in the preview pane (in palette)`},{keys:[`Esc`],description:`Close palette, or unfocus preview first (two-stage, in palette)`},{keys:[`n`],description:`Next search result (after palette closes)`},{keys:[`N`],description:`Previous search result (after palette closes)`},{keys:[`?`],description:`Open Keyboard Shortcuts Guide`},{keys:[`⌘`,`?`],description:`Open Keyboard Shortcuts Guide`}]},{title:`Views & Formatting`,icon:(0,J.jsx)(hO,{size:15}),items:[{keys:[`m`],description:`Toggle Diff Style (Unified ↔ Split)`},{keys:[`t`],description:`Cycle Tab Indentation Size (2 → 4 → 8)`},{keys:[`w`],description:`Toggle Soft-Wrap Long Lines`},{keys:[`#`],description:`Toggle Line Numbers`},{keys:[`g`,`n`],description:`Toggle Line Numbers (same as #)`},{keys:[`Settings`],description:`Toggle Line Numbers (settings panel)`},{keys:[`i`],description:`Cycle Diff Indicator Style (+/− → bars → none)`},{keys:[`I`],description:`Cycle Inline Diff Style (word → word-alt → char → none)`},{keys:[`⌘`,`Shift`,`P`],description:`Toggle Preview Mode in Comments`}]},{title:`Review & Comments`,icon:(0,J.jsx)(hO,{size:15}),items:[{keys:[`UI`],description:`Select lines or gutter + to start an inline comment`},{keys:[`v`],description:`Toggle Viewed on the active file (collapses card)`},{keys:[`UI`],description:`File header icons: expand context · edit · file comment`},{keys:[`UI`],description:`Round badge → open review history timeline`},{keys:[`UI`],description:`File-tree chips: Unviewed · Comments · Since last`},{keys:[`UI`],description:"Comment form “Suggest change” inserts ```suggestion fence"},{keys:[`click #`],description:`Line number copies a deep permalink (?file&line&side)`},{keys:[`UI`],description:`Minimap: change-map + density strip scroll targets`},{keys:[`UI`],description:`Send review: pick verdict, optional note, hand off to agent`}]},{title:`Dialogs & Settings`,icon:(0,J.jsx)(rO,{size:15}),items:[{keys:[`?`],description:`Open Keyboard Shortcuts Guide`},{keys:[`⌘`,`?`],description:`Open Keyboard Shortcuts Guide`},{keys:[`⌘`,`,`],description:`Open Settings`},{keys:[`⌘`,`K`],description:`Open Search Palette`},{keys:[`⌘`,`B`],description:`Collapse / expand the vim status bar`},{keys:[`g`,`t`],description:`Open Theme Selection Modal`},{keys:[`Esc`],description:`Close preview / dialog / this guide`}]}],i=[{title:`Scrolling & Content`,icon:(0,J.jsx)(bO,{size:15}),items:[{keys:[`j`],description:`Scroll Down slightly`},{keys:[`k`],description:`Scroll Up slightly`},{keys:[`Ctrl`,`d`],description:`Scroll Down half page`},{keys:[`Ctrl`,`u`],description:`Scroll Up half page`},{keys:[`g`,`g`],description:`Scroll to Top of plan`},{keys:[`G`],description:`Scroll to Bottom of plan`}]},{title:`Plan Navigation`,icon:(0,J.jsx)(rO,{size:15}),items:[{keys:[`J`],description:`Jump to Next Plan in list`},{keys:[`K`],description:`Jump to Previous Plan in list`},{keys:[`b`],description:`Toggle Plans Sidebar collapse`}]},{title:`Views & Layout`,icon:(0,J.jsx)(WD,{size:15}),items:[{keys:[`m`],description:`Cycle view mode (Source → Read → Split)`},{keys:[`UI`],description:`Toolbar Source / Read / Split switches the same modes`},{keys:[`z`],description:`Toggle Zen reading (enters Read if needed; full-width focus)`},{keys:[`UI`],description:`Read mode: expand icon also toggles Zen`},{keys:[`Esc`],description:`Exit Zen reading mode`},{keys:[`e`],description:`Toggle live plan edit (Source editor + Read preview; current version only)`},{keys:[`⌘`,`S`],description:`While editing: flush autosave now`},{keys:[`UI`],description:`Edit mode: Save · Save as new version · Discard (recent and/or roll back to original)`},{keys:[`Esc`],description:`Edit mode: open Discard (or exit edit if nothing to discard)`},{keys:[`o`],description:`Toggle Outline sidebar (left TOC)`},{keys:[`c`],description:`Toggle Comments map sidebar (right rail)`},{keys:[`drag`],description:`Split mode: drag the center divider to resize panes`},{keys:[`dbl-click`],description:`Split mode: double-click divider to reset 50/50`},{keys:[`←`,`→`],description:`Split mode: focus divider, nudge width ±2%`},{keys:[`t`],description:`Cycle Tab Indentation Size (2 → 4 → 8)`},{keys:[`w`],description:`Toggle Soft-Wrap Long Lines`},{keys:[`n`],description:`Toggle Line Numbers`}]},{title:`Comments & Review`,icon:(0,J.jsx)(hO,{size:15}),items:[{keys:[`c`],description:`Toggle Comments map sidebar (right rail)`},{keys:[`o`],description:`Toggle Outline sidebar (left TOC)`},{keys:[`UI`],description:`Source: select lines or click gutter + to comment`},{keys:[`UI`],description:`Read: highlight text → Add comment (multiple drafts OK)`},{keys:[`UI`],description:`Edit mode: new comments disabled; existing threads still resolvable`},{keys:[`Esc`],description:`Dismiss Add-comment chip / close draft (asks if dirty)`},{keys:[`UI`],description:`Header icons: copy link · copy markdown · open in editor · edit`},{keys:[`UI`],description:`Header: Outline (o) · Comments map (c)`},{keys:[`⌘`,`Shift`,`P`],description:`Toggle Preview Mode in Comments`}]},{title:`Dialogs & Settings`,icon:(0,J.jsx)(rO,{size:15}),items:[{keys:[`?`],description:`Open Keyboard Shortcuts Guide`},{keys:[`⌘`,`?`],description:`Open Keyboard Shortcuts Guide`},{keys:[`⌘`,`,`],description:`Open Settings`},{keys:[`⌘`,`B`],description:`Collapse / expand the vim status bar`},{keys:[`g`,`t`],description:`Open Theme Selection Modal`},{keys:[`Esc`],description:`Close preview / dialog / this guide`}]}],a=r.filter(e=>e.title!==`Commit Walk`).map(e=>e.title===`Review & Comments`?{...e,items:[{keys:[`UI`],description:`Select lines or gutter + to start a GitHub review comment`},{keys:[`v`],description:`Toggle Viewed on the active PR file (collapses card)`},{keys:[`UI`],description:`File header icons: expand context · file comment · viewed`},{keys:[`UI`],description:`File-tree chips: Unviewed · Comments`},{keys:[`click #`],description:`Line number copies a deep permalink (?file&line&side)`},{keys:[`UI`],description:`Checks pill: live successful · failed · pending GitHub actions`},{keys:[`UI`],description:`Submit to GitHub: approve · comment · request changes · draft`}]}:e),o=n===`plan`?i:n===`pr`?a:r,s=n===`plan`?`Vim-style keybindings for plan review. Cycle Source / Read / Split with m, jump plans with J/K, and comment from line selection or text highlight.`:n===`pr`?`The same Vim-style diff keybindings used by local review, scoped to GitHub PR navigation, formatting, search, and comments.`:`Vim-style keybindings for reviewing diffs. Jump files with J/K, walk commits with [ / ], and open search with ⌘K.`;return(0,J.jsxs)(IH,{open:e,onClose:t,className:`shortcuts-modal`,ariaLabel:`Keyboard shortcuts`,children:[(0,J.jsxs)(`div`,{className:`shortcuts-header`,children:[(0,J.jsxs)(`div`,{className:`shortcuts-header-title`,children:[(0,J.jsx)(HH,{size:22,className:`shortcuts-mark`}),(0,J.jsx)(`h2`,{children:n===`plan`?`Plan Review Shortcuts`:n===`pr`?`GitHub PR Review Shortcuts`:`Developer Keyboard Shortcuts`})]}),(0,J.jsx)(`button`,{className:`shortcuts-close-btn`,onClick:t,"aria-label":`Close dialog`,children:(0,J.jsx)(WO,{size:16})})]}),(0,J.jsxs)(`div`,{className:`shortcuts-body`,children:[(0,J.jsx)(`div`,{className:`shortcuts-intro`,children:s}),(0,J.jsx)(`div`,{className:`shortcuts-grid`,children:o.map((e,t)=>(0,J.jsxs)(`div`,{className:`shortcuts-section`,children:[(0,J.jsxs)(`h3`,{className:`shortcuts-section-title`,children:[e.icon,(0,J.jsx)(`span`,{children:e.title})]}),(0,J.jsx)(`div`,{className:`shortcuts-list`,children:e.items.map((e,t)=>(0,J.jsxs)(`div`,{className:`shortcuts-row`,children:[(0,J.jsx)(`span`,{className:`shortcuts-desc`,children:e.description}),(0,J.jsx)(`div`,{className:`shortcuts-keys`,children:e.keys.map((t,n)=>(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{className:`vim-kbd`,children:t}),n<e.keys.length-1&&(0,J.jsx)(`span`,{className:`kbd-plus`,children:`+`})]},n))})]},t))})]},t))})]}),(0,J.jsxs)(`div`,{className:`shortcuts-footer`,children:[`Press `,(0,J.jsx)(`kbd`,{className:`vim-kbd-small`,children:`?`}),n===`plan`&&(0,J.jsxs)(J.Fragment,{children:[` `,`or `,(0,J.jsx)(`kbd`,{className:`vim-kbd-small`,children:`Esc`})]}),` `,`to dismiss this menu at any time.`]})]})});function m2({activity:e,onDismiss:t,onJump:n}){if((0,q.useEffect)(()=>{if(!e)return;let n=setTimeout(t,8e3);return()=>clearTimeout(n)},[e,t]),!e)return null;let r=e.body.length>120?`${e.body.slice(0,120)}…`:e.body;return(0,J.jsxs)(`div`,{className:`agent-toast`,role:`status`,"aria-live":`polite`,children:[(0,J.jsxs)(`button`,{className:`agent-toast-body`,onClick:()=>{n(e.filePath),t()},title:`Jump to the file`,children:[(0,J.jsx)(`span`,{className:`agent-toast-icon`,children:(0,J.jsx)(SD,{size:16})}),(0,J.jsxs)(`span`,{className:`agent-toast-text`,children:[(0,J.jsxs)(`span`,{className:`agent-toast-title`,children:[`Agent replied`,e.model?` · ${e.model}`:``]}),(0,J.jsx)(`span`,{className:`agent-toast-file`,children:e.filePath}),(0,J.jsx)(`span`,{className:`agent-toast-preview`,children:r})]})]}),(0,J.jsx)(`button`,{className:`agent-toast-close`,onClick:t,"aria-label":`Dismiss`,children:(0,J.jsx)(WO,{size:14})})]})}var h2=[{id:`nord`,name:`Nord`,type:`dark`,colors:{bg:`#2e3440`,secondary:`#242933`,accent:`#88c0d0`}},{id:`github-dark`,name:`GitHub Dark`,type:`dark`,colors:{bg:`#0d1117`,secondary:`#161b22`,accent:`#58a6ff`}},{id:`github-dark-dimmed`,name:`GitHub Dark Dimmed`,type:`dark`,colors:{bg:`#22272e`,secondary:`#1c2128`,accent:`#539bf5`}},{id:`github-dark-high-contrast`,name:`GitHub Dark HC`,type:`dark`,colors:{bg:`#0a0c10`,secondary:`#010409`,accent:`#409eff`}},{id:`github-light`,name:`GitHub Light`,type:`light`,colors:{bg:`#ffffff`,secondary:`#f6f8fa`,accent:`#0969da`}},{id:`github-light-high-contrast`,name:`GitHub Light HC`,type:`light`,colors:{bg:`#ffffff`,secondary:`#f6f8fa`,accent:`#0969da`}},{id:`dracula`,name:`Dracula`,type:`dark`,colors:{bg:`#282a36`,secondary:`#1e1f29`,accent:`#bd93f9`}},{id:`one-dark`,name:`One Dark`,type:`dark`,colors:{bg:`#282c34`,secondary:`#21252b`,accent:`#61afef`}},{id:`synthwave-84`,name:`Synthwave '84`,type:`dark`,colors:{bg:`#2b213a`,secondary:`#241b2f`,accent:`#f92aad`}},{id:`tokyo-night`,name:`Tokyo Night`,type:`dark`,colors:{bg:`#1a1b26`,secondary:`#16161e`,accent:`#7aa2f7`}},{id:`catppuccin-mocha`,name:`Catppuccin Mocha`,type:`dark`,colors:{bg:`#1e1e2e`,secondary:`#181825`,accent:`#cba6f7`}},{id:`catppuccin-frappe`,name:`Catppuccin Frappé`,type:`dark`,colors:{bg:`#303446`,secondary:`#292c3c`,accent:`#ca9ee6`}},{id:`catppuccin-macchiato`,name:`Catppuccin Macchiato`,type:`dark`,colors:{bg:`#24273a`,secondary:`#1e2030`,accent:`#c6a0f6`}},{id:`catppuccin-latte`,name:`Catppuccin Latte`,type:`light`,colors:{bg:`#eff1f5`,secondary:`#e6e9ef`,accent:`#8839ef`}},{id:`solarized-dark`,name:`Solarized Dark`,type:`dark`,colors:{bg:`#002b36`,secondary:`#073642`,accent:`#268bd2`}},{id:`solarized-light`,name:`Solarized Light`,type:`light`,colors:{bg:`#fdf6e3`,secondary:`#eee8d5`,accent:`#268bd2`}},{id:`monokai`,name:`Monokai`,type:`dark`,colors:{bg:`#272822`,secondary:`#1d1e19`,accent:`#f92672`}},{id:`ayu-dark`,name:`Ayu Dark`,type:`dark`,colors:{bg:`#0a0e14`,secondary:`#0d1117`,accent:`#e6b450`}},{id:`ayu-light`,name:`Ayu Light`,type:`light`,colors:{bg:`#fafafa`,secondary:`#f3f3f3`,accent:`#ff9900`}},{id:`nightfox`,name:`Nightfox`,type:`dark`,colors:{bg:`#192330`,secondary:`#131a24`,accent:`#719cd6`}},{id:`nordfox`,name:`Nordfox`,type:`dark`,colors:{bg:`#2e3440`,secondary:`#232831`,accent:`#81a1c1`}},{id:`duskfox`,name:`Duskfox`,type:`dark`,colors:{bg:`#232136`,secondary:`#1d1b2d`,accent:`#86b3b3`}},{id:`terafox`,name:`Terafox`,type:`dark`,colors:{bg:`#152528`,secondary:`#0f1c1e`,accent:`#5a93aa`}},{id:`carbonfox`,name:`Carbonfox`,type:`dark`,colors:{bg:`#161616`,secondary:`#111111`,accent:`#78a9ff`}},{id:`dayfox`,name:`Dayfox`,type:`light`,colors:{bg:`#f6f2ee`,secondary:`#ebe5df`,accent:`#2848a9`}},{id:`dawnfox`,name:`Dawnfox`,type:`light`,colors:{bg:`#eae5e5`,secondary:`#e0d8d8`,accent:`#614d85`}},{id:`andromeeda`,name:`Andromeeda`,type:`dark`,colors:{bg:`#090b10`,secondary:`#0e1117`,accent:`#00e8c6`}},{id:`aurora-x`,name:`Aurora X`,type:`dark`,colors:{bg:`#07090f`,secondary:`#0c0e15`,accent:`#2eb5e5`}},{id:`dark-plus`,name:`Dark+ (VS Code)`,type:`dark`,colors:{bg:`#1e1e1e`,secondary:`#252526`,accent:`#0e639c`}},{id:`light-plus`,name:`Light+ (VS Code)`,type:`light`,colors:{bg:`#ffffff`,secondary:`#f3f3f3`,accent:`#007acc`}},{id:`houston`,name:`Houston (Astro)`,type:`dark`,colors:{bg:`#131415`,secondary:`#17191e`,accent:`#ff5d01`}},{id:`laserwave`,name:`Laserwave`,type:`dark`,colors:{bg:`#1b1d28`,secondary:`#181a23`,accent:`#ffe261`}},{id:`material-theme`,name:`Material Theme`,type:`dark`,colors:{bg:`#263238`,secondary:`#1e272c`,accent:`#80cbd8`}},{id:`material-theme-darker`,name:`Material Darker`,type:`dark`,colors:{bg:`#212121`,secondary:`#1a1a1a`,accent:`#80cbd8`}},{id:`material-theme-lighter`,name:`Material Lighter`,type:`light`,colors:{bg:`#fafafa`,secondary:`#eeeded`,accent:`#80cbd8`}},{id:`material-theme-ocean`,name:`Material Ocean`,type:`dark`,colors:{bg:`#0f111a`,secondary:`#090b10`,accent:`#80cbd8`}},{id:`material-theme-palenight`,name:`Material Palenight`,type:`dark`,colors:{bg:`#292d3e`,secondary:`#202331`,accent:`#80cbd8`}},{id:`min-dark`,name:`Min Dark`,type:`dark`,colors:{bg:`#1f1f1f`,secondary:`#181818`,accent:`#ffffff`}},{id:`min-light`,name:`Min Light`,type:`light`,colors:{bg:`#ffffff`,secondary:`#f5f5f5`,accent:`#111111`}},{id:`night-owl`,name:`Night Owl`,type:`dark`,colors:{bg:`#011627`,secondary:`#0b2942`,accent:`#7fdbca`}},{id:`one-light`,name:`One Light`,type:`light`,colors:{bg:`#fafafa`,secondary:`#f0f0f0`,accent:`#40a9ff`}},{id:`plastic`,name:`Plastic`,type:`dark`,colors:{bg:`#21252b`,secondary:`#1b1d23`,accent:`#61afef`}},{id:`poimandres`,name:`Poimandres`,type:`dark`,colors:{bg:`#1b1e28`,secondary:`#171922`,accent:`#50cad2`}},{id:`rose-pine`,name:`Rosé Pine (Main)`,type:`dark`,colors:{bg:`#191724`,secondary:`#1f1d2e`,accent:`#c4a7e7`}},{id:`rose-pine-moon`,name:`Rosé Pine Moon`,type:`dark`,colors:{bg:`#232136`,secondary:`#2a283e`,accent:`#c4a7e7`}},{id:`rose-pine-dawn`,name:`Rosé Pine Dawn`,type:`light`,colors:{bg:`#faf4ed`,secondary:`#f2e9e1`,accent:`#907aa9`}},{id:`slack-dark`,name:`Slack Dark`,type:`dark`,colors:{bg:`#1a1d21`,secondary:`#222529`,accent:`#36c5f0`}},{id:`slack-ochre`,name:`Slack Ochre`,type:`dark`,colors:{bg:`#222222`,secondary:`#2b2b2b`,accent:`#e8912d`}},{id:`vesper`,name:`Vesper`,type:`dark`,colors:{bg:`#101010`,secondary:`#161616`,accent:`#ffc600`}},{id:`vitesse-black`,name:`Vitesse Black`,type:`dark`,colors:{bg:`#000000`,secondary:`#0b0b0b`,accent:`#4d9375`}},{id:`vitesse-dark`,name:`Vitesse Dark`,type:`dark`,colors:{bg:`#121212`,secondary:`#181818`,accent:`#4d9375`}},{id:`vitesse-light`,name:`Vitesse Light`,type:`light`,colors:{bg:`#ffffff`,secondary:`#fafafa`,accent:`#1b655f`}}];function g2({open:e,activeTheme:t,onThemeChange:n,onClose:r}){let[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(0),u=(0,q.useRef)(null),d=(0,q.useRef)(null),f=(0,q.useRef)([]);(0,q.useEffect)(()=>{e&&(a(``),s(`all`),l(0),setTimeout(()=>{u.current?.focus()},50))},[e]);let p=(0,q.useMemo)(()=>{let e=i.toLowerCase().trim();return h2.filter(t=>{let n=t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e),r=o===`all`||t.type===o;return n&&r})},[i,o]);return(0,q.useEffect)(()=>{c>=p.length&&l(Math.max(0,p.length-1))},[p,c]),(0,q.useEffect)(()=>{e&&f.current[c]&&f.current[c]?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[c,e]),(0,J.jsx)(IH,{open:e,onClose:r,className:`theme-modal`,ariaLabel:`Theme Selector Modal`,children:(0,J.jsxs)(`div`,{className:`theme-modal-content`,onKeyDown:e=>{let t=p.length;if(e.key===`Escape`){e.preventDefault(),r();return}if(t!==0)switch(e.key){case`ArrowRight`:e.preventDefault(),l(e=>Math.min(e+1,t-1));break;case`ArrowLeft`:e.preventDefault(),l(e=>Math.max(e-1,0));break;case`ArrowDown`:e.preventDefault(),c+2<t?l(c+2):l(t-1);break;case`ArrowUp`:e.preventDefault(),c-2>=0&&l(c-2);break;case`Enter`:e.preventDefault(),p[c]&&(n(p[c].id),r());break;default:break}},children:[(0,J.jsxs)(`div`,{className:`theme-modal-header`,children:[(0,J.jsxs)(`div`,{className:`theme-modal-title-row`,children:[(0,J.jsx)(HH,{size:24,className:`theme-modal-mark`}),(0,J.jsx)(`h2`,{className:`theme-modal-title`,children:`Select Color Theme`}),(0,J.jsx)(`button`,{className:`theme-modal-close-btn`,onClick:r,"aria-label":`Close`,children:(0,J.jsx)(WO,{size:16})})]}),(0,J.jsxs)(`div`,{className:`theme-modal-search-wrapper`,children:[(0,J.jsx)(NO,{className:`theme-modal-search-icon`,size:16}),(0,J.jsx)(`input`,{ref:u,type:`text`,className:`theme-modal-search-input`,placeholder:`Search themes... (e.g. nordfox, github)`,value:i,onChange:e=>{a(e.target.value),l(0)}}),i&&(0,J.jsx)(`button`,{className:`theme-modal-clear-btn`,onClick:()=>{a(``),l(0),u.current?.focus()},children:(0,J.jsx)(WO,{size:14})})]}),(0,J.jsxs)(`div`,{className:`theme-modal-filters`,children:[(0,J.jsxs)(`button`,{className:`theme-filter-tab ${o===`all`?`active`:``}`,onClick:()=>{s(`all`),l(0),u.current?.focus()},children:[`All Themes (`,h2.length,`)`]}),(0,J.jsxs)(`button`,{className:`theme-filter-tab ${o===`dark`?`active`:``}`,onClick:()=>{s(`dark`),l(0),u.current?.focus()},children:[(0,J.jsx)(yO,{size:12,style:{marginRight:`6px`}}),`Dark (`,h2.filter(e=>e.type===`dark`).length,`)`]}),(0,J.jsxs)(`button`,{className:`theme-filter-tab ${o===`light`?`active`:``}`,onClick:()=>{s(`light`),l(0),u.current?.focus()},children:[(0,J.jsx)(LO,{size:12,style:{marginRight:`6px`}}),`Light (`,h2.filter(e=>e.type===`light`).length,`)`]})]})]}),(0,J.jsx)(`div`,{ref:d,className:`theme-modal-list`,children:p.length===0?(0,J.jsxs)(`div`,{className:`theme-modal-empty`,children:[(0,J.jsxs)(`p`,{className:`theme-modal-empty-text`,children:[`No themes matching "`,i,`"`]}),(0,J.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>{a(``),s(`all`),l(0),u.current?.focus()},children:`Reset Search`})]}):(0,J.jsx)(`div`,{className:`theme-modal-grid`,children:p.map((e,i)=>{let a=t===e.id;return(0,J.jsxs)(`button`,{ref:e=>{f.current[i]=e},type:`button`,className:`theme-modal-card ${a?`active`:``} ${c===i?`focused`:``}`,onClick:()=>{n(e.id),r()},onMouseEnter:()=>l(i),children:[(0,J.jsxs)(`div`,{className:`theme-card-info`,children:[(0,J.jsx)(`span`,{className:`theme-card-name`,children:e.name}),(0,J.jsx)(`span`,{className:`theme-card-meta`,children:e.type===`dark`?(0,J.jsx)(`span`,{className:`theme-meta-tag dark-tag`,children:`Dark`}):(0,J.jsx)(`span`,{className:`theme-meta-tag light-tag`,children:`Light`})})]}),(0,J.jsxs)(`div`,{className:`theme-card-right`,children:[(0,J.jsxs)(`span`,{className:`theme-swatches`,children:[(0,J.jsx)(`span`,{className:`theme-swatch`,style:{background:e.colors.bg},title:`Background`}),(0,J.jsx)(`span`,{className:`theme-swatch`,style:{background:e.colors.secondary},title:`Secondary`}),(0,J.jsx)(`span`,{className:`theme-swatch`,style:{background:e.colors.accent},title:`Accent`})]}),(0,J.jsx)(`span`,{className:`theme-card-status`,children:a&&(0,J.jsx)(wD,{size:14,className:`theme-check-icon`})})]})]},e.id)})})}),(0,J.jsxs)(`div`,{className:`theme-modal-footer`,children:[(0,J.jsxs)(`span`,{className:`theme-footer-item`,children:[(0,J.jsx)(`kbd`,{children:`↑`}),` `,(0,J.jsx)(`kbd`,{children:`↓`}),` `,(0,J.jsx)(`kbd`,{children:`←`}),` `,(0,J.jsx)(`kbd`,{children:`→`}),` Navigate`]}),(0,J.jsxs)(`span`,{className:`theme-footer-item`,children:[(0,J.jsx)(`kbd`,{children:`Enter`}),` Select`]}),(0,J.jsxs)(`span`,{className:`theme-footer-item`,children:[(0,J.jsx)(`kbd`,{children:`ESC`}),` Close`]})]})]})})}var _2=`Cascadia Code.Cascadia Mono.Consolas.Courier New.Dank Mono.Fantasque Sans Mono.Fira Code.Fira Mono.Geist Mono.Hack.IBM Plex Mono.Inconsolata.Input Mono.JetBrains Mono.Maple Mono.Menlo.Monaco.Monoid.Monaspace Argon.Monaspace Krypton.Monaspace Neon.Monaspace Radon.Monaspace Xenon.Noto Sans Mono.Operator Mono.Roboto Mono.SF Mono.Source Code Pro.Space Mono.Ubuntu Mono.Victor Mono`.split(`.`);async function v2(){if(`queryLocalFonts`in window)try{let e=await window.queryLocalFonts();return[...new Set(e.map(e=>e.family))].sort((e,t)=>e.localeCompare(t))}catch{}return _2}function y2({open:e,title:t,defaultLabel:n,activeFont:r,onFontChange:i,onClose:a}){let[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)([]),[u,d]=(0,q.useState)(!1),[f,p]=(0,q.useState)(0),m=(0,q.useRef)(null),h=(0,q.useRef)(null),g=(0,q.useRef)([]);(0,q.useEffect)(()=>{e&&(s(``),p(0),setTimeout(()=>m.current?.focus(),50),!(c.length>0)&&(d(!0),v2().then(e=>{l(e),d(!1)})))},[e]);let _=(0,q.useMemo)(()=>{let e=o.toLowerCase().trim();return e?c.filter(t=>t.toLowerCase().includes(e)):c},[c,o]),v=_.length+1;(0,q.useEffect)(()=>{f>=v&&p(Math.max(0,v-1))},[v,f]),(0,q.useEffect)(()=>{e&&(f===0?g.current[0]:g.current[f])?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[f,e]);let y=e=>{i(e),a()},b=e=>{if(e.key===`Escape`){e.preventDefault(),a();return}if(v!==0)switch(e.key){case`ArrowDown`:e.preventDefault(),p(e=>Math.min(e+1,v-1));break;case`ArrowUp`:e.preventDefault(),p(e=>Math.max(e-1,0));break;case`Enter`:e.preventDefault(),f===0?y(null):_[f-1]&&y(_[f-1]);break}},x=!r;return(0,J.jsx)(IH,{open:e,onClose:a,className:`theme-modal`,ariaLabel:`${t} Modal`,children:(0,J.jsxs)(`div`,{className:`theme-modal-content`,onKeyDown:b,children:[(0,J.jsxs)(`div`,{className:`theme-modal-header`,children:[(0,J.jsxs)(`div`,{className:`theme-modal-title-row`,children:[(0,J.jsx)(`h2`,{className:`theme-modal-title`,children:t}),(0,J.jsx)(`button`,{className:`theme-modal-close-btn`,onClick:a,"aria-label":`Close`,children:(0,J.jsx)(WO,{size:16})})]}),(0,J.jsxs)(`div`,{className:`theme-modal-search-wrapper`,children:[(0,J.jsx)(NO,{className:`theme-modal-search-icon`,size:16}),(0,J.jsx)(`input`,{ref:m,type:`text`,className:`theme-modal-search-input`,placeholder:`Search fonts...`,value:o,onChange:e=>{s(e.target.value),p(0)}}),o&&(0,J.jsx)(`button`,{className:`theme-modal-clear-btn`,onClick:()=>{s(``),p(0),m.current?.focus()},children:(0,J.jsx)(WO,{size:14})})]})]}),(0,J.jsx)(`div`,{ref:h,className:`theme-modal-list`,children:u?(0,J.jsx)(`div`,{className:`theme-modal-empty`,children:(0,J.jsx)(`p`,{className:`theme-modal-empty-text`,children:`Loading fonts…`})}):(0,J.jsxs)(`div`,{className:`font-picker-list`,children:[(0,J.jsxs)(`button`,{ref:e=>{g.current[0]=e},type:`button`,className:`font-picker-item ${x?`active`:``} ${f===0?`focused`:``}`,onClick:()=>y(null),onMouseEnter:()=>p(0),children:[(0,J.jsxs)(`span`,{className:`font-picker-name font-picker-default-name`,children:[(0,J.jsx)(VO,{size:13,style:{marginRight:`6px`,opacity:.6}}),n]}),(0,J.jsx)(`span`,{className:`font-picker-status`,children:x&&(0,J.jsx)(wD,{size:14,className:`theme-check-icon`})})]},`__default__`),_.length===0&&o?(0,J.jsxs)(`div`,{className:`theme-modal-empty`,style:{paddingTop:`16px`},children:[(0,J.jsxs)(`p`,{className:`theme-modal-empty-text`,children:[`No fonts matching "`,o,`"`]}),(0,J.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>{s(``),p(0),m.current?.focus()},children:`Reset Search`})]}):_.map((e,t)=>{let n=r===e,i=f===t+1;return(0,J.jsxs)(`button`,{ref:e=>{g.current[t+1]=e},type:`button`,className:`font-picker-item ${n?`active`:``} ${i?`focused`:``}`,onClick:()=>y(e),onMouseEnter:()=>p(t+1),children:[(0,J.jsx)(`span`,{className:`font-picker-name`,style:{fontFamily:`"${e}", ui-monospace, monospace`},children:e}),(0,J.jsx)(`span`,{className:`font-picker-status`,children:n&&(0,J.jsx)(wD,{size:14,className:`theme-check-icon`})})]},e)})]})}),(0,J.jsxs)(`div`,{className:`theme-modal-footer`,children:[(0,J.jsxs)(`span`,{className:`theme-footer-item`,children:[(0,J.jsx)(`kbd`,{children:`↑`}),` `,(0,J.jsx)(`kbd`,{children:`↓`}),` Navigate`]}),(0,J.jsxs)(`span`,{className:`theme-footer-item`,children:[(0,J.jsx)(`kbd`,{children:`Enter`}),` Select`]}),(0,J.jsxs)(`span`,{className:`theme-footer-item`,children:[(0,J.jsx)(`kbd`,{children:`ESC`}),` Close`]})]})]})})}function b2(e){return e.split(`
3943
3943
  `).map(e=>e.replace(/^[+\- ]/,``)).join(`
3944
- `).trimEnd()}function y2(e,t){if(e.lineNumber===0)return!1;let n=v2(e.lineContent??``);if(!n||t==null||t===``)return!1;let r=n.replace(/\r\n/g,`
3944
+ `).trimEnd()}function x2(e,t){if(!e||!t)return;let n=e.replace(/\r\n/g,`
3945
+ `).split(`
3946
+ `),r=-1;for(let e=0;e<n.length;e++){let i=n[e];if(!i.startsWith(`diff --git `))continue;let a=/^diff --git a\/.* b\/(.+)$/.exec(i);if(a&&a[1]===t){r=e;break}if(i.includes(` b/${t}`)){r=e;break}}if(r===-1)return;let i=n.length;for(let e=r+1;e<n.length;e++)if(n[e].startsWith(`diff --git `)){i=e;break}let a=[];for(let e=r;e<i;e++){let t=n[e];if(t.startsWith(`diff --git `)||t.startsWith(`index `)||t.startsWith(`--- `)||t.startsWith(`+++ `)||t.startsWith(`new file mode`)||t.startsWith(`deleted file mode`)||t.startsWith(`old mode`)||t.startsWith(`new mode`)||t.startsWith(`similarity index`)||t.startsWith(`rename from`)||t.startsWith(`rename to`)||t.startsWith(`copy from`)||t.startsWith(`copy to`)||t.startsWith(`Binary files`)||t.startsWith(`GIT binary patch`)||t.startsWith(`@@`)||t.startsWith(`\\ No newline`))continue;if(t===``){a.push(``);continue}let r=t[0];if(r===`+`)a.push(t.slice(1));else if(r===` `)a.push(t.slice(1));else if(r===`-`)continue;else a.push(t)}return a.join(`
3947
+ `)}function S2(e,t){if(e.lineNumber===0)return!1;let n=b2(e.lineContent??``);if(!n||t==null||t===``)return!1;let r=n.replace(/\r\n/g,`
3945
3948
  `);return!t.replace(/\r\n/g,`
3946
- `).includes(r)}function b2(e,t){return e.map(e=>{let n=t.get(e.filePath);if(n===void 0)return e;let r=y2(e,n);return e.outdated===r?e:{...e,outdated:r}})}function x2(e){let t=new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),n=t.get(`file`)||void 0,r=t.get(`line`),i=r!=null&&r!==``?Number(r):void 0,a=t.get(`side`),o=a===`additions`||a===`deletions`?a:void 0,s=t.get(`comment`)||void 0;return{file:n,line:i!=null&&Number.isFinite(i)?i:void 0,side:o,comment:s}}function S2(e,t,n){if(t<2)return e;let r=e===null,i=e??0;return n===`next`?r?0:i>=t-1?null:i+1:r?t-1:i<=0?null:i-1}function C2({commits:e,activeIndex:t,onChange:n}){if(e.length<2)return null;let r=e.length,i=t===null,a=t??0,o=i?null:e[a],s=()=>n(S2(t,r,`prev`)),c=()=>n(S2(t,r,`next`));return(0,J.jsxs)(`div`,{className:`commit-walk-bar`,role:`navigation`,"aria-label":`Walk commits`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm commit-walk-btn`,onClick:s,"aria-label":`Previous commit`,title:`Previous commit ([)`,children:(0,J.jsx)(ED,{size:14})}),(0,J.jsxs)(`div`,{className:`commit-walk-center`,children:[(0,J.jsx)(ZD,{size:14,"aria-hidden":`true`}),i?(0,J.jsxs)(`span`,{className:`commit-walk-label`,children:[`All `,r,` commits`]}):(0,J.jsxs)(`span`,{className:`commit-walk-label`,title:o?.subject,children:[(0,J.jsxs)(`span`,{className:`commit-walk-count`,children:[a+1,` / `,r]}),(0,J.jsx)(`code`,{className:`commit-walk-sha`,children:o?.shortSha??o?.sha.slice(0,7)}),(0,J.jsx)(`span`,{className:`commit-walk-subject`,children:o?.subject})]})]}),(0,J.jsxs)(`div`,{className:`commit-walk-trailing`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm commit-walk-all`,onClick:()=>n(null),disabled:i,title:i?void 0:`Show all commits`,"aria-label":`Show all commits`,children:`Show all`}),(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm commit-walk-btn`,onClick:c,"aria-label":`Next commit`,title:`Next commit (])`,children:(0,J.jsx)(DD,{size:14})})]})]})}function w2(){let[e,t]=(0,q.useState)(null);return(0,q.useEffect)(()=>gE(`agent-progress`,e=>{try{t(JSON.parse(e))}catch{}}),[]),(0,q.useEffect)(()=>{if(!e)return;let n=setTimeout(()=>t(null),1e4);return()=>clearTimeout(n)},[e]),e?(0,J.jsxs)(`div`,{className:`agent-progress-toast`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(`div`,{className:`agent-progress-toast-icon`,children:(0,J.jsx)(SD,{size:16})}),(0,J.jsxs)(`div`,{className:`agent-progress-toast-body`,children:[(0,J.jsxs)(`div`,{className:`agent-progress-toast-title`,children:[e.model||e.agentId||`Agent`,e.pct!=null&&(0,J.jsxs)(`span`,{className:`agent-progress-toast-pct`,children:[Math.round(e.pct),`%`]})]}),(0,J.jsx)(`div`,{className:`agent-progress-toast-msg`,children:e.message}),e.pct!=null&&(0,J.jsx)(`div`,{className:`agent-progress-bar`,"aria-hidden":`true`,children:(0,J.jsx)(`div`,{className:`agent-progress-bar-fill`,style:{width:`${e.pct}%`}})})]}),(0,J.jsx)(`button`,{type:`button`,className:`agent-progress-toast-close`,onClick:()=>t(null),"aria-label":`Dismiss`,children:(0,J.jsx)(WO,{size:14})})]}):null}var T2=[`review-since-last`];function E2(e=!0){let t=Re(),n=$e({queryKey:T2,queryFn:async()=>{let e=await fetch(`/api/review/since-last`);return e.ok?e.json():{hasBaseline:!1,round:0,changed:[],added:[],removed:[],reviewFiles:[]}},enabled:e,staleTime:2e3});(0,q.useEffect)(()=>{if(!e)return;let n=()=>{t.invalidateQueries({queryKey:T2})},r=gE(`change`,n),i=gE(`agent-status`,n);return()=>{r(),i()}},[e,t]);let r=n.data,i=(0,q.useMemo)(()=>new Set(r?.reviewFiles??[]),[r?.reviewFiles]);return{sinceLast:r??null,reviewSet:i,hasBaseline:!!r?.hasBaseline,loading:n.isLoading,refetch:n.refetch}}function D2(){let e=Op(),{settings:t,loaded:n,updateSettings:r}=BE(),[,i]=(0,q.useTransition)(),{patch:a,repoName:o,branch:s,customMode:c,showMode:l,commits:u,truncated:d,binaryFiles:f,tabSizeMap:p,untrackedFiles:m,overview:h,loading:g,refreshing:_,error:v}=bE({staged:t.staged,untracked:t.untracked},!0),{comments:y,addComment:b,removeComment:x,resolveComment:S,unresolveComment:C,addReply:w,editComment:T,editReply:E,removeReply:D,copyAllComments:O,copyAllCommentsMarkdown:k,agentActivity:A,clearAgentActivity:j,sendToAgent:M,sending:N,agentWaiting:P,waitingAgents:F,resolveAllOpen:I,lastSend:L}=TE(),R=(0,q.useMemo)(()=>{if(!a)return y;let e=new Map;for(let t of y)e.has(t.filePath)||e.set(t.filePath,a);return b2(y,e)},[y,a]),{plans:z}=OE(),B=(0,q.useMemo)(()=>z.filter(e=>e.decision===`pending`).length,[z]),{status:V,refresh:H}=IE(a),[U,W]=(0,q.useState)(null),[ee,te]=(0,q.useState)(()=>{try{let e=iD(`diffing-sidebar-collapsed`);if(e!=null)return e===`true`}catch{}return typeof window<`u`&&window.innerWidth<=768}),[ne,re]=(0,q.useState)(()=>{try{let e=iD(`diffing-sidebar-width`);return e?Number(e):320}catch{return 320}}),[ie,ae]=(0,q.useState)(()=>{try{return YE(iD(`diffing-extension-filter`)??``)}catch{return[]}});(0,q.useEffect)(()=>{cD(`diffing-extension-filter`,ie.join(`,`))},[ie]);let[oe,G]=(0,q.useState)(()=>{try{let e=iD(`diffing-chip-filter`);if(e===`unviewed`||e===`has-comments`||e===`all`||e===`since-last`)return e}catch{}return`all`});(0,q.useEffect)(()=>{cD(`diffing-chip-filter`,oe)},[oe]);let{reviewSet:se,hasBaseline:K}=E2(!0);(0,q.useEffect)(()=>{!K&&oe===`since-last`&&G(`all`)},[K,oe]);let[ce,le]=(0,q.useState)(null);(0,q.useEffect)(()=>{le(null)},[u]);let ue=(0,q.useRef)(ne);ue.current=ne;let de=(0,q.useRef)(null),fe=(0,q.useRef)(null),pe=(0,q.useRef)(null),me=(0,q.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=ue.current,r=fe.current,i=pe.current,a=r?r.getBoundingClientRect().left:0,o=n,s=0,c=()=>{s=0,i&&(i.style.transform=`translateX(${a+o}px)`)};i&&(i.style.transform=`translateX(${a+n}px)`,i.classList.add(`sidebar-resize-guide-active`));let l=e=>{let r=e.clientX-t;o=Math.max(240,Math.min(640,n+r)),s||=requestAnimationFrame(c)},u=()=>{s&&cancelAnimationFrame(s),i&&i.classList.remove(`sidebar-resize-guide-active`),re(o);try{cD(`diffing-sidebar-width`,String(o))}catch{}document.removeEventListener(`mousemove`,l),document.removeEventListener(`mouseup`,u),document.body.style.cursor=``,document.body.style.userSelect=``};document.addEventListener(`mousemove`,l),document.addEventListener(`mouseup`,u),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]),[he,ge]=(0,q.useState)({open:!1,scope:`files`,changedOnly:!1}),_e=(0,q.useRef)(!0),ve=(0,q.useCallback)(e=>{ge({open:!0,scope:e,changedOnly:!0})},[]),ye=(0,q.useCallback)(()=>{ge(e=>e.open?{...e,open:!1}:{open:!0,scope:`all`,changedOnly:_e.current})},[]),be=(0,q.useCallback)(()=>ge(e=>({...e,open:!1})),[]),xe=(0,q.useCallback)(e=>{_e.current=e,ge(t=>({...t,changedOnly:e}))},[]),[Se,Ce]=(0,q.useState)(!1),[we,Te]=(0,q.useState)(!1),[Ee,De]=(0,q.useState)(!1),[Oe,ke]=(0,q.useState)(!1),[Ae,je]=(0,q.useState)(()=>{try{let e=iD(`diffing-comment-panel-height`);return e?Number(e):220}catch{return 220}}),Me=(0,q.useRef)(Ae);Me.current=Ae;let Ne=(0,q.useCallback)(e=>{e.preventDefault();let t=e.clientY,n=Me.current,r=de.current,i=n,a=0,o=()=>{a=0,r?.style.setProperty(`--comment-panel-height`,`${i}px`)},s=e=>{let r=t-e.clientY;i=Math.max(100,Math.min(600,n+r)),a||=requestAnimationFrame(o)},c=()=>{a&&cancelAnimationFrame(a),je(i);try{cD(`diffing-comment-panel-height`,String(i))}catch{}document.removeEventListener(`mousemove`,s),document.removeEventListener(`mouseup`,c),document.body.style.cursor=``,document.body.style.userSelect=``};document.addEventListener(`mousemove`,s),document.addEventListener(`mouseup`,c),document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`},[]);(0,q.useEffect)(()=>{try{cD(`diffing-comment-panel-height`,String(Ae))}catch{}},[Ae]);let{viewedFiles:Pe,setViewed:Fe}=GE(),Ie=(0,q.useRef)(null);(0,q.useEffect)(()=>{try{cD(`diffing-sidebar-collapsed`,String(ee))}catch{}},[ee]);let Le=(0,q.useMemo)(()=>new Set(m),[m]),Re=(0,q.useRef)([]),ze=(0,q.useMemo)(()=>l&&ce!=null&&u[ce]?.patch?u[ce].patch:a,[l,ce,u,a]),Be=(0,q.useMemo)(()=>{if(!ze)return[];try{let e=Mh(ze).flatMap(e=>e.files),t=new Set(e.map(e=>e.name));for(let n of f)if(!t.has(n.path)){let t={name:n.path,type:n.type===`added`||n.type===`untracked`?`new`:n.type===`deleted`?`deleted`:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:!0,deletionLines:[],additionLines:[]};e.push(t)}let n=new Set,r=e.filter(e=>n.has(e.name)?!1:(n.add(e.name),!0)).map(e=>{let t=Re.current.find(t=>t.name===e.name);return t&&t.type===e.type&&t.isPartial===e.isPartial&&t.deletionLines.length===e.deletionLines.length&&t.additionLines.length===e.additionLines.length&&JSON.stringify(t.hunks)===JSON.stringify(e.hunks)?t:e});return Re.current=r,r}catch{return[]}},[ze,f]),Ve=(0,q.useMemo)(()=>{let e={};for(let t of R)e[t.filePath]=(e[t.filePath]??0)+1;return e},[R]),He=(0,q.useMemo)(()=>[...Be].sort(yG),[Be]),Ue=(0,q.useMemo)(()=>{let e=Be;return ie.length>0&&(e=e.filter(e=>QE(e.name,ie))),oe===`unviewed`?e=e.filter(e=>!Pe.has(e.name)):oe===`has-comments`?e=e.filter(e=>(Ve[e.name]??0)>0):oe===`since-last`&&(e=e.filter(e=>se.has(e.name))),e},[Be,ie,oe,Pe,Ve,se]),We=(0,q.useMemo)(()=>[...Ue].sort(yG),[Ue]),Ge=(0,q.useRef)(!1);(0,q.useEffect)(()=>{if(Ge.current||g||We.length===0||typeof window>`u`)return;let e=x2(window.location.search);!e.file&&!e.comment||(Ge.current=!0,e.file&&(W(e.file),e.line!=null&&requestAnimationFrame(()=>{VT(e.file,e.line,e.side??`additions`)})),e.comment&&requestAnimationFrame(()=>{document.getElementById(`comment-${e.comment}`)?.scrollIntoView({behavior:`smooth`,block:`center`})}))},[g,We.length]);let Ke=JE(We),qe=uD(We),Je=(0,q.useMemo)(()=>({diffFileSet:TT(Ue),changedKeys:ET(qe),customMode:c,staged:t.staged}),[Ue,qe,c,t.staged]),Ye=(0,q.useMemo)(()=>{let e=0,t=0;for(let n of Ue)e+=n.additionLines.length,t+=n.deletionLines.length;return{additions:e,deletions:t}},[Ue]),Xe=(0,q.useMemo)(()=>{let e=new Map;for(let t of f)e.set(t.path,t);return e},[f]),Ze=(0,q.useRef)(new Map),Qe=(0,q.useMemo)(()=>{let e=new Map,t=new Map;for(let e of R){let n=t.get(e.filePath);n||(n=[],t.set(e.filePath,n)),n.push(e)}for(let[n,r]of t){let t=r.map(e=>({side:e.side,lineNumber:e.lineNumber,metadata:e})),i=Ze.current.get(n);i&&JSON.stringify(i)===JSON.stringify(t)?e.set(n,i):e.set(n,t)}return Ze.current=e,e},[R]),$e=(0,q.useCallback)(e=>{W(e);let t=document.getElementById(`file-${e}`);t&&t.scrollIntoView({block:`start`})},[]),et=(0,q.useCallback)(e=>{i(()=>{ae(XE(e))})},[]),tt=(0,q.useCallback)((e,t)=>{Fe(e,t),t&&Ke(e)},[Fe,Ke]),nt=(0,q.useCallback)(e=>{i(()=>{r({diffStyle:e})})},[r]),rt=(0,q.useCallback)(e=>{i(()=>{r(e)})},[r]),it=(0,q.useCallback)(e=>{i(()=>{r({defaultTabSize:e})})},[r]),at=(0,q.useCallback)(e=>{i(()=>{r({browser:e})})},[r]),ot=(0,q.useCallback)(e=>{i(()=>{r({theme:e})})},[r]),st=(0,q.useCallback)(e=>{i(()=>{r({editorIDE:e})})},[r]),ct=(0,q.useCallback)(e=>{i(()=>{r({lineDiffType:e})})},[r]),lt=(0,q.useCallback)(e=>{i(()=>{r({lineWrap:e})})},[r]),ut=(0,q.useCallback)(e=>{i(()=>{r({diffIndicators:e})})},[r]),dt=(0,q.useCallback)(e=>{i(()=>{r({showLineNumbers:e})})},[r]),ft=(0,q.useCallback)(e=>{i(()=>{r({hunkSeparators:e})})},[r]),pt=(0,q.useCallback)(e=>{i(()=>{r({lineHoverHighlight:e})})},[r]),mt=(0,q.useCallback)(e=>{i(()=>{r({fontSize:e})})},[r]),ht=(0,q.useCallback)(e=>{r({haptics:e})},[r]),gt=(0,q.useCallback)(e=>{r({sounds:e})},[r]),_t=(0,q.useCallback)(e=>{r({uiFont:e})},[r]),vt=(0,q.useCallback)(e=>{r({monoFont:e})},[r]),yt=(0,q.useCallback)(e=>{r({density:e})},[r]),bt=(0,q.useCallback)(e=>{r({autoCollapseLineThreshold:e})},[r]),xt=(0,q.useCallback)(e=>{r({requireViewAllBeforeSend:e})},[r]),St=(0,q.useCallback)(e=>{r({showStatusBar:e})},[r]),Ct=(0,q.useCallback)(e=>{r({ignoreSpaceChange:e})},[r]),wt=(0,q.useCallback)(e=>{r({ignoreAllSpace:e})},[r]);(0,q.useCallback)(e=>{r({showVimStatusBar:e})},[r]);let Tt=(0,q.useCallback)(async()=>{let e=await I();yT(`selection`,`toggle`),e.resolved},[I,yT]),Et=(0,q.useCallback)(()=>{i(()=>{r({showLineNumbers:!t.showLineNumbers})})},[r,t.showLineNumbers]),Dt=(0,q.useCallback)(()=>{lt(!t.lineWrap)},[t.lineWrap,lt]),Ot=(0,q.useCallback)(()=>{let e=[`classic`,`bars`,`none`],n=t.diffIndicators||`classic`,r=e[(e.indexOf(n)+1)%e.length];ut(r)},[t.diffIndicators,ut]),kt=(0,q.useCallback)(()=>{let e=[`word`,`word-alt`,`char`,`none`],n=t.lineDiffType||`word`,r=e[(e.indexOf(n)+1)%e.length];ct(r)},[t.lineDiffType,ct]),At=(0,q.useCallback)(()=>{te(e=>!e)},[]),jt=(0,q.useCallback)(e=>{if(We.length===0)return;let t=U?We.findIndex(e=>e.name===U):-1,n=e===`next`?Math.min(t+1,We.length-1):Math.max(t-1,0),r=We[Math.max(0,n)]?.name;if(!r)return;W(r);let i=document.getElementById(`file-${r}`);i&&i.scrollIntoView({block:`start`})},[We,U,W]),Mt=(0,q.useCallback)(e=>{!l||u.length<2||le(t=>S2(t,u.length,e))},[l,u.length]),Nt=(0,q.useCallback)(()=>{if(!U)return;let e=Pe.has(U);Fe(U,!e),e||Ke(U)},[U,Pe,Fe,Ke]),Pt=(0,q.useCallback)((e,t)=>{t&&Ke(e)},[Ke]),Ft=(0,q.useCallback)(()=>{nt(t.diffStyle===`split`?`unified`:`split`)},[t.diffStyle,nt]),It=(0,q.useCallback)(()=>{let e=[2,4,8],n=t.defaultTabSize||4;it(e[(e.indexOf(n)+1)%e.length])},[t.defaultTabSize,it]),Lt=(0,q.useCallback)(()=>{At()},[At]),{setSnapshot:Rt,nextHit:zt,prevHit:Bt,statusMessage:Vt}=ZT(Je,$e);ST((0,q.useMemo)(()=>({onNavigateFile:jt,onNavigateCommit:l&&u.length>1?Mt:void 0,onToggleViewed:Nt,onToggleDiffStyle:Ft,onCycleTabSize:It,onToggleSidebar:Lt,onToggleLineWrap:Dt,onToggleLineNumbers:Et,onCycleDiffIndicators:Ot,onCycleLineDiffType:kt,onOpenPalette:ve,onTogglePalette:ye,onNextSearchHit:zt,onPrevSearchHit:Bt,onOpenTheme:()=>Te(!0),onOpenShortcuts:()=>Ce(!0)}),[jt,l,u.length,Mt,Nt,Ft,It,Lt,Dt,Et,Ot,kt,ve,ye,zt,Bt]));let Ht=(0,q.useMemo)(()=>({staged:t.staged,untracked:t.untracked}),[t.staged,t.untracked]);(0,q.useEffect)(()=>{let e=t.theme||`rose-pine`,n=document.documentElement;n.classList.add(`theme-switching`),n.setAttribute(`data-theme`,e),n.setAttribute(`data-density`,t.density||`comfortable`);let r=requestAnimationFrame(()=>{requestAnimationFrame(()=>n.classList.remove(`theme-switching`))});return()=>cancelAnimationFrame(r)},[t.theme,t.density]),VE(n,t.uiFont,t.monoFont);let Ut=(0,q.useMemo)(()=>zE(t.monoFont),[t.monoFont]),Wt=(0,q.useMemo)(()=>LT[t.theme||`rose-pine`]||LT[`rose-pine`],[t.theme]);return(0,q.useEffect)(()=>{e&&e.setRenderOptions({theme:{dark:Wt.type===`dark`?Wt.themeName:`rose-pine`,light:Wt.type===`light`?Wt.themeName:`github-light`}}).catch(e=>{console.error(`Failed to set worker pool render options:`,e)})},[e,Wt]),(0,q.useEffect)(()=>{let e=Wt.type===`dark`?Wt.themeName:`rose-pine`,t=Wt.type===`light`?Wt.themeName:`github-light`;Bd({themes:Array.from(new Set([e,t])),langs:[]}).catch(()=>{})},[Wt]),(0,q.useEffect)(()=>{let e=[o,s].filter(Boolean);return document.title=e.length>0?`${e.join(` · `)} · diffing`:`diffing`,()=>{document.title=`diffing`}},[o,s]),g?(0,J.jsxs)(`div`,{className:`app skeleton-app`,style:{"--sidebar-width":`${ne}px`,"--comment-panel-height":`${Ae}px`},children:[(0,J.jsxs)(`header`,{className:`skeleton-toolbar`,children:[(0,J.jsx)(`div`,{className:`skeleton-item skeleton-logo`}),(0,J.jsx)(`div`,{className:`skeleton-item skeleton-stats`}),(0,J.jsx)(`div`,{className:`skeleton-item skeleton-actions`})]}),(0,J.jsxs)(`div`,{className:`app-body`,children:[(0,J.jsx)(`aside`,{className:`sidebar skeleton-sidebar ${ee?`sidebar-collapsed`:``}`,children:!ee&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`skeleton-search`}),(0,J.jsx)(`div`,{className:`skeleton-tree-nodes`,children:Array.from({length:8}).map((e,t)=>(0,J.jsxs)(`div`,{className:`skeleton-tree-node`,style:{paddingLeft:`${t%3*16+16}px`},children:[(0,J.jsx)(`div`,{className:`skeleton-node-icon`}),(0,J.jsx)(`div`,{className:`skeleton-node-text`,style:{width:`${60+t*12%60}px`}})]},t))})]})}),!ee&&(0,J.jsx)(`div`,{className:`sidebar-resize-handle`,style:{cursor:`default`}}),(0,J.jsx)(`main`,{className:`main skeleton-main`,children:(0,J.jsx)(`div`,{className:`diff-viewer`,children:Array.from({length:3}).map((e,t)=>(0,J.jsxs)(`div`,{className:`file-diff-card skeleton-card`,children:[(0,J.jsxs)(`div`,{className:`skeleton-card-header`,children:[(0,J.jsx)(`div`,{className:`skeleton-card-title`,style:{width:`${120+t*45%150}px`}}),(0,J.jsx)(`div`,{className:`skeleton-card-badge`})]}),(0,J.jsx)(`div`,{className:`skeleton-card-body`,children:Array.from({length:5}).map((e,t)=>(0,J.jsx)(`div`,{className:`skeleton-code-line`,style:{width:`${50+t*15%45}%`}},t))})]},t))})})]})]}):v?(0,J.jsxs)(`div`,{className:`error empty-state`,role:`alert`,children:[(0,J.jsx)(`div`,{className:`empty-state-icon empty-state-icon-danger`,"aria-hidden":`true`,children:(0,J.jsx)(BO,{size:24,strokeWidth:1.75})}),(0,J.jsx)(`p`,{className:`empty-state-title`,children:`Couldn't load the diff`}),(0,J.jsx)(`p`,{className:`empty-state-hint`,children:v})]}):(0,J.jsx)(bT,{enabled:t.haptics??!0,soundsEnabled:t.sounds??!0,children:(0,J.jsxs)(`div`,{className:`app`,ref:de,style:{"--sidebar-width":`${ne}px`,"--comment-panel-height":`${Ae}px`},children:[(0,J.jsx)(`a`,{href:`#diff-main`,className:`skip-to-main`,children:`Skip to diff`}),_&&(0,J.jsx)(`div`,{className:`refresh-bar`,role:`status`,"aria-live":`polite`,"aria-label":`Refreshing diff`}),(0,J.jsx)(`div`,{className:`sidebar-resize-guide`,ref:pe,"aria-hidden":`true`}),(0,J.jsx)(mW,{repoName:o,branch:s,fileCount:Ue.length,totalFileCount:Be.length,additions:Ye.additions,deletions:Ye.deletions,commentCount:R.length,planCount:z.length,pendingPlanCount:B,lastSend:L,onOpenPlans:()=>jE(`/plan`),diffStyle:t.diffStyle,diffOptions:Ht,defaultTabSize:t.defaultTabSize,browser:t.browser,theme:t.theme||`rose-pine`,editorIDE:t.editorIDE,customMode:c,showMode:l,showCommitCount:u.length,lineDiffType:t.lineDiffType,lineWrap:t.lineWrap,diffIndicators:t.diffIndicators,showLineNumbers:t.showLineNumbers,hunkSeparators:t.hunkSeparators,lineHoverHighlight:t.lineHoverHighlight,fontSize:t.fontSize,haptics:t.haptics??!0,sounds:t.sounds??!0,uiFont:t.uiFont,monoFont:t.monoFont,sidebarCollapsed:ee,onToggleSidebar:At,onDiffStyleChange:nt,onDiffOptionsChange:rt,onDefaultTabSizeChange:it,onBrowserChange:at,onOpenThemeModal:()=>Te(!0),onEditorIDEChange:st,onLineDiffTypeChange:ct,onLineWrapChange:lt,onDiffIndicatorsChange:ut,onShowLineNumbersChange:dt,onHunkSeparatorsChange:ft,onLineHoverHighlightChange:pt,onFontSizeChange:mt,onHapticsChange:ht,onSoundsChange:gt,density:t.density,autoCollapseLineThreshold:t.autoCollapseLineThreshold,requireViewAllBeforeSend:t.requireViewAllBeforeSend,showStatusBar:t.showStatusBar??!0,ignoreSpaceChange:t.ignoreSpaceChange??!1,ignoreAllSpace:t.ignoreAllSpace??!1,onDensityChange:yt,onAutoCollapseLineThresholdChange:bt,onRequireViewAllBeforeSendChange:xt,onShowStatusBarChange:St,onIgnoreSpaceChange:Ct,onIgnoreAllSpaceChange:wt,onResolveAllOpen:Tt,onOpenUiFontModal:()=>De(!0),onOpenMonoFontModal:()=>ke(!0),onOpenSearch:()=>ve(`all`),onCopyComments:O,onCopyMarkdown:k,onSendToAgent:M,agentWaiting:P,waitingAgents:F,sending:N,comments:R,viewedFileCount:Pe.size,onEditComment:T,onDeleteComment:x}),!ee&&(0,J.jsx)(`div`,{className:`sidebar-mobile-backdrop`,onClick:At,"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`app-body`,children:[(0,J.jsxs)(`aside`,{ref:fe,className:`sidebar ${ee?`sidebar-collapsed`:``}`,children:[(0,J.jsx)(`div`,{style:{flex:1,minHeight:0,overflow:`hidden`},children:(0,J.jsx)(V0,{files:He,activeFile:U,commentCounts:Ve,viewedFiles:Pe,untrackedFiles:Le,onFileClick:$e,collapsed:ee,onToggleCollapse:At,appliedExtensions:ie,onApplyExtensions:et,chipFilter:oe,onChipFilterChange:G,sinceLastFiles:se,sinceLastAvailable:K})}),!ee&&R.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`ct-resize-handle`,onMouseDown:Ne,role:`separator`,"aria-label":`Resize comments panel`,"aria-orientation":`horizontal`,tabIndex:0}),(0,J.jsx)(`div`,{className:`ct-wrapper`,style:{flexShrink:0},children:(0,J.jsx)(G0,{comments:R,resolveComment:S,unresolveComment:C,removeComment:x,addReply:w,editComment:T,editReply:E,removeReply:D})})]})]}),!ee&&(0,J.jsx)(`div`,{className:`sidebar-resize-handle`,onMouseDown:me,role:`separator`,"aria-label":`Resize sidebar`,"aria-orientation":`vertical`,tabIndex:0}),(0,J.jsxs)(`main`,{className:`main`,ref:Ie,id:`diff-main`,tabIndex:-1,children:[h&&(0,J.jsx)(xW,{overview:h,commits:l?u:void 0}),l&&u.length>1&&(0,J.jsx)(C2,{commits:u,activeIndex:ce,onChange:le}),V.inMerge&&V.conflicts.length>0&&(0,J.jsxs)(`div`,{className:`merge-conflict-banner`,children:[(0,J.jsx)(`strong`,{children:`Merge in progress`}),(0,J.jsxs)(`span`,{children:[V.conflicts.length,` unresolved file`,V.conflicts.length===1?``:`s`,` below. Use the inline buttons to accept current/incoming/both, then "Save & stage".`]})]}),V.conflicts.map(e=>(0,J.jsx)(SG,{filePath:e,theme:t.theme||`rose-pine`,fontSize:t.fontSize,monoFontFamily:Ut,tabSize:p[e]??t.defaultTabSize,onSaved:()=>{H()}},e)),(0,J.jsx)(bG,{files:We,diffStyle:t.diffStyle,tabSizeMap:p,defaultTabSize:t.defaultTabSize,viewedFiles:Pe,binaryFiles:Xe,theme:t.theme||`rose-pine`,editorIDE:t.editorIDE,lineDiffType:t.lineDiffType,lineWrap:t.lineWrap,diffIndicators:t.diffIndicators,showLineNumbers:t.showLineNumbers,hunkSeparators:t.hunkSeparators,lineHoverHighlight:t.lineHoverHighlight,fontSize:t.fontSize,monoFontFamily:Ut,expandContextByDefault:t.expandContextByDefault,collapsedContextThreshold:t.collapsedContextThreshold,expansionLineCount:t.expansionLineCount,autoCollapseLineThreshold:t.autoCollapseLineThreshold,onViewedChange:tt,fileAnnotationsMap:Qe,onAddComment:b,onDeleteComment:x,onCardToggleCollapse:Pt})]})]}),(0,J.jsx)(n2,{isOpen:he.open,onClose:be,initialScope:he.scope,initialChangedOnly:he.changedOnly,onChangedOnlyPreference:xe,onSessionSnapshot:Rt,files:Ue,changedEntries:qe,customMode:c,staged:t.staged,onNavigateFile:$e,theme:t.theme||`rose-pine`,fontSize:t.fontSize,monoFontFamily:Ut,defaultTabSize:t.defaultTabSize,lineWrap:t.lineWrap,showLineNumbers:t.showLineNumbers,lineHoverHighlight:t.lineHoverHighlight}),(0,J.jsx)(u2,{activeFile:U,onShowHelp:()=>Ce(!0),visible:t.showStatusBar??!0,statusMessage:Vt,placeholder:l&&u.length>1?`No active file (J/K files · [ / ] commits)`:void 0}),(0,J.jsx)(d2,{isOpen:Se,onClose:()=>Ce(!1)}),(0,J.jsx)(m2,{open:we,activeTheme:t.theme||`rose-pine`,onThemeChange:ot,onClose:()=>Te(!1)}),(0,J.jsx)(_2,{open:Ee,title:`Select UI Font`,defaultLabel:`Default (Geist Mono, from CDN)`,activeFont:t.uiFont,onFontChange:_t,onClose:()=>De(!1)}),(0,J.jsx)(_2,{open:Oe,title:`Select Code Font`,defaultLabel:`Default (JetBrains Mono, from CDN)`,activeFont:t.monoFont,onFontChange:vt,onClose:()=>ke(!1)}),(0,J.jsx)(f2,{activity:A,onDismiss:j,onJump:$e}),(0,J.jsx)(w2,{})]})})}function O2(e){(0,q.useEffect)(()=>{let t=``,n,r=0,i=()=>{t=``,clearTimeout(n)},a=a=>{let o=document.activeElement;if(o){let e=o.tagName.toLowerCase();if(e===`input`||e===`textarea`||o.hasAttribute(`contenteditable`))return}if(a.metaKey||a.altKey)return;clearTimeout(n);let s=a.key;if(a.ctrlKey){(s===`d`||s===`u`)&&(a.preventDefault(),window.scrollBy({top:s===`d`?window.innerHeight/2:-window.innerHeight/2,behavior:`auto`}),yT(`selection`,`navigate`),i());return}if(s.length>1&&s!==`Escape`&&s!==`Enter`)return;t+=s,n=setTimeout(()=>{t=``},800);let c=(e,t=`toggle`)=>{a.preventDefault(),e(),yT(t===`open`?`medium`:`selection`,t),i()};if(t===`j`||t===`k`){a.preventDefault(),window.scrollBy({top:t===`j`?100:-100,behavior:`auto`});let e=Date.now();e-r>80&&(_T(`navigate`),r=e),i()}else t===`gg`?c(()=>window.scrollTo({top:0,behavior:`auto`}),`navigate`):t===`G`?c(()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:`auto`}),`navigate`):t===`J`?c(()=>e.onNavigatePlan(`next`),`navigate`):t===`K`?c(()=>e.onNavigatePlan(`prev`),`navigate`):t===`m`?c(e.onToggleViewMode):t===`z`?c(e.onToggleZenMode):t===`c`?c(e.onToggleCommentsRail):t===`o`?c(e.onToggleOutline):t===`t`?c(e.onCycleTabSize):t===`b`?c(e.onToggleSidebar):t===`w`?c(e.onToggleLineWrap):t===`n`?c(e.onToggleLineNumbers):t===`gt`?c(e.onOpenTheme,`open`):t===`?`?c(e.onOpenShortcuts,`open`):t.length>=2&&i()};return window.addEventListener(`keydown`,a),()=>{window.removeEventListener(`keydown`,a),clearTimeout(n)}},[e])}function k2(e,t){if(t<1)return;let n=e.split(`
3947
- `),r=Math.min(t,n.length);for(let e=r-1;e>=0;e--){let t=/^\s{0,3}(#{1,6})\s+(.*?)\s*#*\s*$/.exec(n[e]);if(t)return t[2].trim()}}function A2(e,t,n){if(t<1)return``;let r=e.split(`
3949
+ `).includes(r)}function C2(e,t){return e.map(e=>{let n=t.get(e.filePath);if(n===void 0)return e;let r=S2(e,n);return e.outdated===r?e:{...e,outdated:r}})}function w2(e){let t=new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),n=t.get(`file`)||void 0,r=t.get(`line`),i=r!=null&&r!==``?Number(r):void 0,a=t.get(`side`),o=a===`additions`||a===`deletions`?a:void 0,s=t.get(`comment`)||void 0;return{file:n,line:i!=null&&Number.isFinite(i)?i:void 0,side:o,comment:s}}function T2(e,t,n){if(t<2)return e;let r=e===null,i=e??0;return n===`next`?r?0:i>=t-1?null:i+1:r?t-1:i<=0?null:i-1}function E2({commits:e,activeIndex:t,onChange:n}){if(e.length<2)return null;let r=e.length,i=t===null,a=t??0,o=i?null:e[a],s=()=>n(T2(t,r,`prev`)),c=()=>n(T2(t,r,`next`));return(0,J.jsxs)(`div`,{className:`commit-walk-bar`,role:`navigation`,"aria-label":`Walk commits`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm commit-walk-btn`,onClick:s,"aria-label":`Previous commit`,title:`Previous commit ([)`,children:(0,J.jsx)(ED,{size:14})}),(0,J.jsxs)(`div`,{className:`commit-walk-center`,children:[(0,J.jsx)(ZD,{size:14,"aria-hidden":`true`}),i?(0,J.jsxs)(`span`,{className:`commit-walk-label`,children:[`All `,r,` commits`]}):(0,J.jsxs)(`span`,{className:`commit-walk-label`,title:o?.subject,children:[(0,J.jsxs)(`span`,{className:`commit-walk-count`,children:[a+1,` / `,r]}),(0,J.jsx)(`code`,{className:`commit-walk-sha`,children:o?.shortSha??o?.sha.slice(0,7)}),(0,J.jsx)(`span`,{className:`commit-walk-subject`,children:o?.subject})]})]}),(0,J.jsxs)(`div`,{className:`commit-walk-trailing`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm commit-walk-all`,onClick:()=>n(null),disabled:i,title:i?void 0:`Show all commits`,"aria-label":`Show all commits`,children:`Show all`}),(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm commit-walk-btn`,onClick:c,"aria-label":`Next commit`,title:`Next commit (])`,children:(0,J.jsx)(DD,{size:14})})]})]})}function D2(){let[e,t]=(0,q.useState)(null);return(0,q.useEffect)(()=>gE(`agent-progress`,e=>{try{t(JSON.parse(e))}catch{}}),[]),(0,q.useEffect)(()=>{if(!e)return;let n=setTimeout(()=>t(null),1e4);return()=>clearTimeout(n)},[e]),e?(0,J.jsxs)(`div`,{className:`agent-progress-toast`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(`div`,{className:`agent-progress-toast-icon`,children:(0,J.jsx)(SD,{size:16})}),(0,J.jsxs)(`div`,{className:`agent-progress-toast-body`,children:[(0,J.jsxs)(`div`,{className:`agent-progress-toast-title`,children:[e.model||e.agentId||`Agent`,e.pct!=null&&(0,J.jsxs)(`span`,{className:`agent-progress-toast-pct`,children:[Math.round(e.pct),`%`]})]}),(0,J.jsx)(`div`,{className:`agent-progress-toast-msg`,children:e.message}),e.pct!=null&&(0,J.jsx)(`div`,{className:`agent-progress-bar`,"aria-hidden":`true`,children:(0,J.jsx)(`div`,{className:`agent-progress-bar-fill`,style:{width:`${e.pct}%`}})})]}),(0,J.jsx)(`button`,{type:`button`,className:`agent-progress-toast-close`,onClick:()=>t(null),"aria-label":`Dismiss`,children:(0,J.jsx)(WO,{size:14})})]}):null}var O2=[`review-since-last`];function k2(e=!0){let t=Re(),n=$e({queryKey:O2,queryFn:async()=>{let e=await fetch(`/api/review/since-last`);return e.ok?e.json():{hasBaseline:!1,round:0,changed:[],added:[],removed:[],reviewFiles:[]}},enabled:e,staleTime:2e3});(0,q.useEffect)(()=>{if(!e)return;let n=()=>{t.invalidateQueries({queryKey:O2})},r=gE(`change`,n),i=gE(`agent-status`,n);return()=>{r(),i()}},[e,t]);let r=n.data,i=(0,q.useMemo)(()=>new Set(r?.reviewFiles??[]),[r?.reviewFiles]);return{sinceLast:r??null,reviewSet:i,hasBaseline:!!r?.hasBaseline,loading:n.isLoading,refetch:n.refetch}}function A2(){let e=Op(),{settings:t,loaded:n,updateSettings:r}=BE(),[,i]=(0,q.useTransition)(),{patch:a,repoName:o,branch:s,customMode:c,showMode:l,commits:u,truncated:d,binaryFiles:f,tabSizeMap:p,untrackedFiles:m,overview:h,loading:g,refreshing:_,error:v}=bE({staged:t.staged,untracked:t.untracked},!0),{comments:y,addComment:b,removeComment:x,resolveComment:S,unresolveComment:C,addReply:w,editComment:T,editReply:E,removeReply:D,copyAllComments:O,copyAllCommentsMarkdown:k,agentActivity:A,clearAgentActivity:j,sendToAgent:M,sending:N,agentWaiting:P,waitingAgents:F,resolveAllOpen:I,lastSend:L}=TE(),R=(0,q.useMemo)(()=>{if(!a)return y;let e=new Map;for(let t of y){if(e.has(t.filePath))continue;let n=x2(a,t.filePath);n!==void 0&&e.set(t.filePath,n)}return C2(y,e)},[y,a]),{plans:z}=OE(),B=(0,q.useMemo)(()=>z.filter(e=>e.decision===`pending`).length,[z]),{status:V,refresh:H}=IE(a),[U,W]=(0,q.useState)(null),[ee,te]=(0,q.useState)(()=>{try{let e=iD(`diffing-sidebar-collapsed`);if(e!=null)return e===`true`}catch{}return typeof window<`u`&&window.innerWidth<=768}),[ne,re]=(0,q.useState)(()=>{try{let e=iD(`diffing-sidebar-width`);return e?Number(e):320}catch{return 320}}),[ie,ae]=(0,q.useState)(()=>{try{return YE(iD(`diffing-extension-filter`)??``)}catch{return[]}});(0,q.useEffect)(()=>{cD(`diffing-extension-filter`,ie.join(`,`))},[ie]);let[oe,G]=(0,q.useState)(()=>{try{let e=iD(`diffing-chip-filter`);if(e===`unviewed`||e===`has-comments`||e===`all`||e===`since-last`)return e}catch{}return`all`});(0,q.useEffect)(()=>{cD(`diffing-chip-filter`,oe)},[oe]);let{reviewSet:se,hasBaseline:K}=k2(!0);(0,q.useEffect)(()=>{!K&&oe===`since-last`&&G(`all`)},[K,oe]);let[ce,le]=(0,q.useState)(null);(0,q.useEffect)(()=>{le(null)},[u]);let ue=(0,q.useRef)(ne);ue.current=ne;let de=(0,q.useRef)(null),fe=(0,q.useRef)(null),pe=(0,q.useRef)(null),me=(0,q.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=ue.current,r=fe.current,i=pe.current,a=r?r.getBoundingClientRect().left:0,o=n,s=0,c=()=>{s=0,i&&(i.style.transform=`translateX(${a+o}px)`)};i&&(i.style.transform=`translateX(${a+n}px)`,i.classList.add(`sidebar-resize-guide-active`));let l=e=>{let r=e.clientX-t;o=Math.max(240,Math.min(640,n+r)),s||=requestAnimationFrame(c)},u=()=>{s&&cancelAnimationFrame(s),i&&i.classList.remove(`sidebar-resize-guide-active`),re(o);try{cD(`diffing-sidebar-width`,String(o))}catch{}document.removeEventListener(`mousemove`,l),document.removeEventListener(`mouseup`,u),document.body.style.cursor=``,document.body.style.userSelect=``};document.addEventListener(`mousemove`,l),document.addEventListener(`mouseup`,u),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]),[he,ge]=(0,q.useState)({open:!1,scope:`files`,changedOnly:!1}),_e=(0,q.useRef)(!0),ve=(0,q.useCallback)(e=>{ge({open:!0,scope:e,changedOnly:!0})},[]),ye=(0,q.useCallback)(()=>{ge(e=>e.open?{...e,open:!1}:{open:!0,scope:`all`,changedOnly:_e.current})},[]),be=(0,q.useCallback)(()=>ge(e=>({...e,open:!1})),[]),xe=(0,q.useCallback)(e=>{_e.current=e,ge(t=>({...t,changedOnly:e}))},[]),[Se,Ce]=(0,q.useState)(!1),[we,Te]=(0,q.useState)(!1),[Ee,De]=(0,q.useState)(!1),[Oe,ke]=(0,q.useState)(!1),[Ae,je]=(0,q.useState)(()=>{try{let e=iD(`diffing-comment-panel-height`);return e?Number(e):220}catch{return 220}}),Me=(0,q.useRef)(Ae);Me.current=Ae;let Ne=(0,q.useCallback)(e=>{e.preventDefault();let t=e.clientY,n=Me.current,r=de.current,i=n,a=0,o=()=>{a=0,r?.style.setProperty(`--comment-panel-height`,`${i}px`)},s=e=>{let r=t-e.clientY;i=Math.max(100,Math.min(600,n+r)),a||=requestAnimationFrame(o)},c=()=>{a&&cancelAnimationFrame(a),je(i);try{cD(`diffing-comment-panel-height`,String(i))}catch{}document.removeEventListener(`mousemove`,s),document.removeEventListener(`mouseup`,c),document.body.style.cursor=``,document.body.style.userSelect=``};document.addEventListener(`mousemove`,s),document.addEventListener(`mouseup`,c),document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`},[]);(0,q.useEffect)(()=>{try{cD(`diffing-comment-panel-height`,String(Ae))}catch{}},[Ae]);let{viewedFiles:Pe,setViewed:Fe}=GE(),Ie=(0,q.useRef)(null);(0,q.useEffect)(()=>{try{cD(`diffing-sidebar-collapsed`,String(ee))}catch{}},[ee]);let Le=(0,q.useMemo)(()=>new Set(m),[m]),Re=(0,q.useRef)([]),ze=(0,q.useMemo)(()=>l&&ce!=null&&u[ce]?.patch?u[ce].patch:a,[l,ce,u,a]),Be=(0,q.useMemo)(()=>{if(!ze)return[];try{let e=Mh(ze).flatMap(e=>e.files),t=new Set(e.map(e=>e.name));for(let n of f)if(!t.has(n.path)){let t={name:n.path,type:n.type===`added`||n.type===`untracked`?`new`:n.type===`deleted`?`deleted`:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:!0,deletionLines:[],additionLines:[]};e.push(t)}let n=new Set,r=e.filter(e=>n.has(e.name)?!1:(n.add(e.name),!0)).map(e=>{let t=Re.current.find(t=>t.name===e.name);return t&&t.type===e.type&&t.isPartial===e.isPartial&&t.deletionLines.length===e.deletionLines.length&&t.additionLines.length===e.additionLines.length&&JSON.stringify(t.hunks)===JSON.stringify(e.hunks)?t:e});return Re.current=r,r}catch{return[]}},[ze,f]),Ve=(0,q.useMemo)(()=>{let e={};for(let t of R)e[t.filePath]=(e[t.filePath]??0)+1;return e},[R]),He=(0,q.useMemo)(()=>[...Be].sort(xG),[Be]),Ue=(0,q.useMemo)(()=>{let e=Be;return ie.length>0&&(e=e.filter(e=>QE(e.name,ie))),oe===`unviewed`?e=e.filter(e=>!Pe.has(e.name)):oe===`has-comments`?e=e.filter(e=>(Ve[e.name]??0)>0):oe===`since-last`&&(e=e.filter(e=>se.has(e.name))),e},[Be,ie,oe,Pe,Ve,se]),We=(0,q.useMemo)(()=>[...Ue].sort(xG),[Ue]),Ge=(0,q.useRef)(!1);(0,q.useEffect)(()=>{if(Ge.current||g||We.length===0||typeof window>`u`)return;let e=w2(window.location.search);!e.file&&!e.comment||(Ge.current=!0,e.file&&(W(e.file),e.line!=null&&requestAnimationFrame(()=>{VT(e.file,e.line,e.side??`additions`)})),e.comment&&requestAnimationFrame(()=>{document.getElementById(`comment-${e.comment}`)?.scrollIntoView({behavior:`smooth`,block:`center`})}))},[g,We.length]);let Ke=JE(We),qe=uD(We),Je=(0,q.useMemo)(()=>({diffFileSet:TT(Ue),changedKeys:ET(qe),customMode:c,staged:t.staged}),[Ue,qe,c,t.staged]),Ye=(0,q.useMemo)(()=>{let e=0,t=0;for(let n of Ue)e+=n.additionLines.length,t+=n.deletionLines.length;return{additions:e,deletions:t}},[Ue]),Xe=(0,q.useMemo)(()=>{let e=new Map;for(let t of f)e.set(t.path,t);return e},[f]),Ze=(0,q.useRef)(new Map),Qe=(0,q.useMemo)(()=>{let e=new Map,t=new Map;for(let e of R){let n=t.get(e.filePath);n||(n=[],t.set(e.filePath,n)),n.push(e)}for(let[n,r]of t){let t=r.map(e=>({side:e.side,lineNumber:e.lineNumber,metadata:e})),i=Ze.current.get(n);i&&JSON.stringify(i)===JSON.stringify(t)?e.set(n,i):e.set(n,t)}return Ze.current=e,e},[R]),$e=(0,q.useCallback)(e=>{W(e);let t=document.getElementById(`file-${e}`);t&&t.scrollIntoView({block:`start`})},[]),et=(0,q.useCallback)(e=>{i(()=>{ae(XE(e))})},[]),tt=(0,q.useCallback)((e,t)=>{Fe(e,t),t&&Ke(e)},[Fe,Ke]),nt=(0,q.useCallback)(e=>{i(()=>{r({diffStyle:e})})},[r]),rt=(0,q.useCallback)(e=>{i(()=>{r(e)})},[r]),it=(0,q.useCallback)(e=>{i(()=>{r({defaultTabSize:e})})},[r]),at=(0,q.useCallback)(e=>{i(()=>{r({browser:e})})},[r]),ot=(0,q.useCallback)(e=>{i(()=>{r({theme:e})})},[r]),st=(0,q.useCallback)(e=>{i(()=>{r({editorIDE:e})})},[r]),ct=(0,q.useCallback)(e=>{i(()=>{r({lineDiffType:e})})},[r]),lt=(0,q.useCallback)(e=>{i(()=>{r({lineWrap:e})})},[r]),ut=(0,q.useCallback)(e=>{i(()=>{r({diffIndicators:e})})},[r]),dt=(0,q.useCallback)(e=>{i(()=>{r({showLineNumbers:e})})},[r]),ft=(0,q.useCallback)(e=>{i(()=>{r({hunkSeparators:e})})},[r]),pt=(0,q.useCallback)(e=>{i(()=>{r({lineHoverHighlight:e})})},[r]),mt=(0,q.useCallback)(e=>{i(()=>{r({fontSize:e})})},[r]),ht=(0,q.useCallback)(e=>{r({haptics:e})},[r]),gt=(0,q.useCallback)(e=>{r({sounds:e})},[r]),_t=(0,q.useCallback)(e=>{r({uiFont:e})},[r]),vt=(0,q.useCallback)(e=>{r({monoFont:e})},[r]),yt=(0,q.useCallback)(e=>{r({density:e})},[r]),bt=(0,q.useCallback)(e=>{r({autoCollapseLineThreshold:e})},[r]),xt=(0,q.useCallback)(e=>{r({requireViewAllBeforeSend:e})},[r]),St=(0,q.useCallback)(e=>{r({showStatusBar:e})},[r]),Ct=(0,q.useCallback)(e=>{r({ignoreSpaceChange:e})},[r]),wt=(0,q.useCallback)(e=>{r({ignoreAllSpace:e})},[r]);(0,q.useCallback)(e=>{r({showVimStatusBar:e})},[r]);let Tt=(0,q.useCallback)(async()=>{let e=await I();yT(`selection`,`toggle`),e.resolved},[I,yT]),Et=(0,q.useCallback)(()=>{i(()=>{r({showLineNumbers:!t.showLineNumbers})})},[r,t.showLineNumbers]),Dt=(0,q.useCallback)(()=>{lt(!t.lineWrap)},[t.lineWrap,lt]),Ot=(0,q.useCallback)(()=>{let e=[`classic`,`bars`,`none`],n=t.diffIndicators||`classic`,r=e[(e.indexOf(n)+1)%e.length];ut(r)},[t.diffIndicators,ut]),kt=(0,q.useCallback)(()=>{let e=[`word`,`word-alt`,`char`,`none`],n=t.lineDiffType||`word`,r=e[(e.indexOf(n)+1)%e.length];ct(r)},[t.lineDiffType,ct]),At=(0,q.useCallback)(()=>{te(e=>!e)},[]),jt=(0,q.useCallback)(e=>{if(We.length===0)return;let t=U?We.findIndex(e=>e.name===U):-1,n=e===`next`?Math.min(t+1,We.length-1):Math.max(t-1,0),r=We[Math.max(0,n)]?.name;if(!r)return;W(r);let i=document.getElementById(`file-${r}`);i&&i.scrollIntoView({block:`start`})},[We,U,W]),Mt=(0,q.useCallback)(e=>{!l||u.length<2||le(t=>T2(t,u.length,e))},[l,u.length]),Nt=(0,q.useCallback)(()=>{if(!U)return;let e=Pe.has(U);Fe(U,!e),e||Ke(U)},[U,Pe,Fe,Ke]),Pt=(0,q.useCallback)((e,t)=>{t&&Ke(e)},[Ke]),Ft=(0,q.useCallback)(()=>{nt(t.diffStyle===`split`?`unified`:`split`)},[t.diffStyle,nt]),It=(0,q.useCallback)(()=>{let e=[2,4,8],n=t.defaultTabSize||4;it(e[(e.indexOf(n)+1)%e.length])},[t.defaultTabSize,it]),Lt=(0,q.useCallback)(()=>{At()},[At]),{setSnapshot:Rt,nextHit:zt,prevHit:Bt,statusMessage:Vt}=ZT(Je,$e);ST((0,q.useMemo)(()=>({onNavigateFile:jt,onNavigateCommit:l&&u.length>1?Mt:void 0,onToggleViewed:Nt,onToggleDiffStyle:Ft,onCycleTabSize:It,onToggleSidebar:Lt,onToggleLineWrap:Dt,onToggleLineNumbers:Et,onCycleDiffIndicators:Ot,onCycleLineDiffType:kt,onOpenPalette:ve,onTogglePalette:ye,onNextSearchHit:zt,onPrevSearchHit:Bt,onOpenTheme:()=>Te(!0),onOpenShortcuts:()=>Ce(!0)}),[jt,l,u.length,Mt,Nt,Ft,It,Lt,Dt,Et,Ot,kt,ve,ye,zt,Bt]));let Ht=(0,q.useMemo)(()=>({staged:t.staged,untracked:t.untracked}),[t.staged,t.untracked]);(0,q.useEffect)(()=>{let e=t.theme||`rose-pine`,n=document.documentElement;n.classList.add(`theme-switching`),n.setAttribute(`data-theme`,e),n.setAttribute(`data-density`,t.density||`comfortable`);let r=requestAnimationFrame(()=>{requestAnimationFrame(()=>n.classList.remove(`theme-switching`))});return()=>cancelAnimationFrame(r)},[t.theme,t.density]),VE(n,t.uiFont,t.monoFont);let Ut=(0,q.useMemo)(()=>zE(t.monoFont),[t.monoFont]),Wt=(0,q.useMemo)(()=>LT[t.theme||`rose-pine`]||LT[`rose-pine`],[t.theme]);return(0,q.useEffect)(()=>{e&&e.setRenderOptions({theme:{dark:Wt.type===`dark`?Wt.themeName:`rose-pine`,light:Wt.type===`light`?Wt.themeName:`github-light`}}).catch(e=>{console.error(`Failed to set worker pool render options:`,e)})},[e,Wt]),(0,q.useEffect)(()=>{let e=Wt.type===`dark`?Wt.themeName:`rose-pine`,t=Wt.type===`light`?Wt.themeName:`github-light`;Bd({themes:Array.from(new Set([e,t])),langs:[]}).catch(()=>{})},[Wt]),(0,q.useEffect)(()=>{let e=[o,s].filter(Boolean);return document.title=e.length>0?`${e.join(` · `)} · diffing`:`diffing`,()=>{document.title=`diffing`}},[o,s]),g?(0,J.jsxs)(`div`,{className:`app skeleton-app`,style:{"--sidebar-width":`${ne}px`,"--comment-panel-height":`${Ae}px`},children:[(0,J.jsxs)(`header`,{className:`skeleton-toolbar`,children:[(0,J.jsx)(`div`,{className:`skeleton-item skeleton-logo`}),(0,J.jsx)(`div`,{className:`skeleton-item skeleton-stats`}),(0,J.jsx)(`div`,{className:`skeleton-item skeleton-actions`})]}),(0,J.jsxs)(`div`,{className:`app-body`,children:[(0,J.jsx)(`aside`,{className:`sidebar skeleton-sidebar ${ee?`sidebar-collapsed`:``}`,children:!ee&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`skeleton-search`}),(0,J.jsx)(`div`,{className:`skeleton-tree-nodes`,children:Array.from({length:8}).map((e,t)=>(0,J.jsxs)(`div`,{className:`skeleton-tree-node`,style:{paddingLeft:`${t%3*16+16}px`},children:[(0,J.jsx)(`div`,{className:`skeleton-node-icon`}),(0,J.jsx)(`div`,{className:`skeleton-node-text`,style:{width:`${60+t*12%60}px`}})]},t))})]})}),!ee&&(0,J.jsx)(`div`,{className:`sidebar-resize-handle`,style:{cursor:`default`}}),(0,J.jsx)(`main`,{className:`main skeleton-main`,children:(0,J.jsx)(`div`,{className:`diff-viewer`,children:Array.from({length:3}).map((e,t)=>(0,J.jsxs)(`div`,{className:`file-diff-card skeleton-card`,children:[(0,J.jsxs)(`div`,{className:`skeleton-card-header`,children:[(0,J.jsx)(`div`,{className:`skeleton-card-title`,style:{width:`${120+t*45%150}px`}}),(0,J.jsx)(`div`,{className:`skeleton-card-badge`})]}),(0,J.jsx)(`div`,{className:`skeleton-card-body`,children:Array.from({length:5}).map((e,t)=>(0,J.jsx)(`div`,{className:`skeleton-code-line`,style:{width:`${50+t*15%45}%`}},t))})]},t))})})]})]}):v?(0,J.jsxs)(`div`,{className:`error empty-state`,role:`alert`,children:[(0,J.jsx)(`div`,{className:`empty-state-icon empty-state-icon-danger`,"aria-hidden":`true`,children:(0,J.jsx)(BO,{size:24,strokeWidth:1.75})}),(0,J.jsx)(`p`,{className:`empty-state-title`,children:`Couldn't load the diff`}),(0,J.jsx)(`p`,{className:`empty-state-hint`,children:v})]}):(0,J.jsx)(bT,{enabled:t.haptics??!0,soundsEnabled:t.sounds??!0,children:(0,J.jsxs)(`div`,{className:`app`,ref:de,style:{"--sidebar-width":`${ne}px`,"--comment-panel-height":`${Ae}px`},children:[(0,J.jsx)(`a`,{href:`#diff-main`,className:`skip-to-main`,children:`Skip to diff`}),_&&(0,J.jsx)(`div`,{className:`refresh-bar`,role:`status`,"aria-live":`polite`,"aria-label":`Refreshing diff`}),(0,J.jsx)(`div`,{className:`sidebar-resize-guide`,ref:pe,"aria-hidden":`true`}),(0,J.jsx)(mW,{repoName:o,branch:s,fileCount:Ue.length,totalFileCount:Be.length,additions:Ye.additions,deletions:Ye.deletions,commentCount:R.length,planCount:z.length,pendingPlanCount:B,lastSend:L,onOpenPlans:()=>jE(`/plan`),diffStyle:t.diffStyle,diffOptions:Ht,defaultTabSize:t.defaultTabSize,browser:t.browser,theme:t.theme||`rose-pine`,editorIDE:t.editorIDE,customMode:c,showMode:l,showCommitCount:u.length,lineDiffType:t.lineDiffType,lineWrap:t.lineWrap,diffIndicators:t.diffIndicators,showLineNumbers:t.showLineNumbers,hunkSeparators:t.hunkSeparators,lineHoverHighlight:t.lineHoverHighlight,fontSize:t.fontSize,haptics:t.haptics??!0,sounds:t.sounds??!0,uiFont:t.uiFont,monoFont:t.monoFont,sidebarCollapsed:ee,onToggleSidebar:At,onDiffStyleChange:nt,onDiffOptionsChange:rt,onDefaultTabSizeChange:it,onBrowserChange:at,onOpenThemeModal:()=>Te(!0),onEditorIDEChange:st,onLineDiffTypeChange:ct,onLineWrapChange:lt,onDiffIndicatorsChange:ut,onShowLineNumbersChange:dt,onHunkSeparatorsChange:ft,onLineHoverHighlightChange:pt,onFontSizeChange:mt,onHapticsChange:ht,onSoundsChange:gt,density:t.density,autoCollapseLineThreshold:t.autoCollapseLineThreshold,requireViewAllBeforeSend:t.requireViewAllBeforeSend,showStatusBar:t.showStatusBar??!0,ignoreSpaceChange:t.ignoreSpaceChange??!1,ignoreAllSpace:t.ignoreAllSpace??!1,onDensityChange:yt,onAutoCollapseLineThresholdChange:bt,onRequireViewAllBeforeSendChange:xt,onShowStatusBarChange:St,onIgnoreSpaceChange:Ct,onIgnoreAllSpaceChange:wt,onResolveAllOpen:Tt,onOpenUiFontModal:()=>De(!0),onOpenMonoFontModal:()=>ke(!0),onOpenSearch:()=>ve(`all`),onCopyComments:O,onCopyMarkdown:k,onSendToAgent:M,agentWaiting:P,waitingAgents:F,sending:N,comments:R,viewedFileCount:Pe.size,onEditComment:T,onDeleteComment:x}),!ee&&(0,J.jsx)(`div`,{className:`sidebar-mobile-backdrop`,onClick:At,"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`app-body`,children:[(0,J.jsxs)(`aside`,{ref:fe,className:`sidebar ${ee?`sidebar-collapsed`:``}`,children:[(0,J.jsx)(`div`,{style:{flex:1,minHeight:0,overflow:`hidden`},children:(0,J.jsx)(U0,{files:He,activeFile:U,commentCounts:Ve,viewedFiles:Pe,untrackedFiles:Le,onFileClick:$e,collapsed:ee,onToggleCollapse:At,appliedExtensions:ie,onApplyExtensions:et,chipFilter:oe,onChipFilterChange:G,sinceLastFiles:se,sinceLastAvailable:K})}),!ee&&R.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`ct-resize-handle`,onMouseDown:Ne,role:`separator`,"aria-label":`Resize comments panel`,"aria-orientation":`horizontal`,tabIndex:0}),(0,J.jsx)(`div`,{className:`ct-wrapper`,style:{flexShrink:0},children:(0,J.jsx)(q0,{comments:R,resolveComment:S,unresolveComment:C,removeComment:x,addReply:w,editComment:T,editReply:E,removeReply:D})})]})]}),!ee&&(0,J.jsx)(`div`,{className:`sidebar-resize-handle`,onMouseDown:me,role:`separator`,"aria-label":`Resize sidebar`,"aria-orientation":`vertical`,tabIndex:0}),(0,J.jsxs)(`main`,{className:`main`,ref:Ie,id:`diff-main`,tabIndex:-1,children:[h&&(0,J.jsx)(xW,{overview:h,commits:l?u:void 0}),l&&u.length>1&&(0,J.jsx)(E2,{commits:u,activeIndex:ce,onChange:le}),V.inMerge&&V.conflicts.length>0&&(0,J.jsxs)(`div`,{className:`merge-conflict-banner`,children:[(0,J.jsx)(`strong`,{children:`Merge in progress`}),(0,J.jsxs)(`span`,{children:[V.conflicts.length,` unresolved file`,V.conflicts.length===1?``:`s`,` below. Use the inline buttons to accept current/incoming/both, then "Save & stage".`]})]}),V.conflicts.map(e=>(0,J.jsx)(wG,{filePath:e,theme:t.theme||`rose-pine`,fontSize:t.fontSize,monoFontFamily:Ut,tabSize:p[e]??t.defaultTabSize,onSaved:()=>{H()}},e)),(0,J.jsx)(SG,{files:We,diffStyle:t.diffStyle,tabSizeMap:p,defaultTabSize:t.defaultTabSize,viewedFiles:Pe,binaryFiles:Xe,theme:t.theme||`rose-pine`,editorIDE:t.editorIDE,lineDiffType:t.lineDiffType,lineWrap:t.lineWrap,diffIndicators:t.diffIndicators,showLineNumbers:t.showLineNumbers,hunkSeparators:t.hunkSeparators,lineHoverHighlight:t.lineHoverHighlight,fontSize:t.fontSize,monoFontFamily:Ut,expandContextByDefault:t.expandContextByDefault,collapsedContextThreshold:t.collapsedContextThreshold,expansionLineCount:t.expansionLineCount,autoCollapseLineThreshold:t.autoCollapseLineThreshold,onViewedChange:tt,fileAnnotationsMap:Qe,onAddComment:b,onDeleteComment:x,onCardToggleCollapse:Pt})]})]}),(0,J.jsx)(i2,{isOpen:he.open,onClose:be,initialScope:he.scope,initialChangedOnly:he.changedOnly,onChangedOnlyPreference:xe,onSessionSnapshot:Rt,files:Ue,changedEntries:qe,customMode:c,staged:t.staged,onNavigateFile:$e,theme:t.theme||`rose-pine`,fontSize:t.fontSize,monoFontFamily:Ut,defaultTabSize:t.defaultTabSize,lineWrap:t.lineWrap,showLineNumbers:t.showLineNumbers,lineHoverHighlight:t.lineHoverHighlight}),(0,J.jsx)(f2,{activeFile:U,onShowHelp:()=>Ce(!0),visible:t.showStatusBar??!0,statusMessage:Vt,placeholder:l&&u.length>1?`No active file (J/K files · [ / ] commits)`:void 0}),(0,J.jsx)(p2,{isOpen:Se,onClose:()=>Ce(!1)}),(0,J.jsx)(g2,{open:we,activeTheme:t.theme||`rose-pine`,onThemeChange:ot,onClose:()=>Te(!1)}),(0,J.jsx)(y2,{open:Ee,title:`Select UI Font`,defaultLabel:`Default (Geist Mono, from CDN)`,activeFont:t.uiFont,onFontChange:_t,onClose:()=>De(!1)}),(0,J.jsx)(y2,{open:Oe,title:`Select Code Font`,defaultLabel:`Default (JetBrains Mono, from CDN)`,activeFont:t.monoFont,onFontChange:vt,onClose:()=>ke(!1)}),(0,J.jsx)(m2,{activity:A,onDismiss:j,onJump:$e}),(0,J.jsx)(D2,{})]})})}function j2(e){(0,q.useEffect)(()=>{let t=``,n,r=0,i=()=>{t=``,clearTimeout(n)},a=a=>{let o=document.activeElement;if(o){let e=o.tagName.toLowerCase();if(e===`input`||e===`textarea`||o.hasAttribute(`contenteditable`))return}if(a.metaKey||a.altKey)return;clearTimeout(n);let s=a.key;if(a.ctrlKey){(s===`d`||s===`u`)&&(a.preventDefault(),window.scrollBy({top:s===`d`?window.innerHeight/2:-window.innerHeight/2,behavior:`auto`}),yT(`selection`,`navigate`),i());return}if(s.length>1&&s!==`Escape`&&s!==`Enter`)return;t+=s,n=setTimeout(()=>{t=``},800);let c=(e,t=`toggle`)=>{a.preventDefault(),e(),yT(t===`open`?`medium`:`selection`,t),i()};if(t===`j`||t===`k`){a.preventDefault(),window.scrollBy({top:t===`j`?100:-100,behavior:`auto`});let e=Date.now();e-r>80&&(_T(`navigate`),r=e),i()}else t===`gg`?c(()=>window.scrollTo({top:0,behavior:`auto`}),`navigate`):t===`G`?c(()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:`auto`}),`navigate`):t===`J`?c(()=>e.onNavigatePlan(`next`),`navigate`):t===`K`?c(()=>e.onNavigatePlan(`prev`),`navigate`):t===`m`?c(e.onToggleViewMode):t===`z`?c(e.onToggleZenMode):t===`c`?c(e.onToggleCommentsRail):t===`o`?c(e.onToggleOutline):t===`t`?c(e.onCycleTabSize):t===`b`?c(e.onToggleSidebar):t===`w`?c(e.onToggleLineWrap):t===`n`?c(e.onToggleLineNumbers):t===`gt`?c(e.onOpenTheme,`open`):t===`?`?c(e.onOpenShortcuts,`open`):t.length>=2&&i()};return window.addEventListener(`keydown`,a),()=>{window.removeEventListener(`keydown`,a),clearTimeout(n)}},[e])}function M2(e,t){if(t<1)return;let n=e.split(`
3950
+ `),r=Math.min(t,n.length);for(let e=r-1;e>=0;e--){let t=/^\s{0,3}(#{1,6})\s+(.*?)\s*#*\s*$/.exec(n[e]);if(t)return t[2].trim()}}function N2(e,t,n){if(t<1)return``;let r=e.split(`
3948
3951
  `),i=Math.max(1,t),a=Math.min(n,r.length);return a<i?``:r.slice(i-1,a).join(`
3949
- `)}function j2({role:e,size:t=16}){return e===`agent`?(0,J.jsx)(`div`,{className:`comment-avatar-circle comment-avatar-agent comment-avatar-size-${t}`,children:(0,J.jsx)(SD,{size:t,"aria-hidden":`true`})}):(0,J.jsx)(`div`,{className:`comment-avatar-circle comment-avatar-user comment-avatar-size-${t}`,children:(0,J.jsx)(UO,{size:t,"aria-hidden":`true`})})}function M2({comment:e,onResolve:t,onUnresolve:n,onDelete:r,onEdit:i,onReply:a,onEditReply:o,onDeleteReply:s}){let[,c]=(0,q.useState)(0),l=e.status===`resolved`,[u,d]=(0,q.useState)(l),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),S=(0,J.jsxs)(`div`,{className:`comment-delete-confirm`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`comment-node-btn comment-node-btn-delete comment-delete-confirm-yes`,onClick:()=>{_(!1),r()},title:`Confirm delete`,"aria-label":`Confirm delete comment`,children:[(0,J.jsx)(BO,{size:11}),`Delete?`]}),(0,J.jsx)(`button`,{type:`button`,className:`comment-node-btn comment-delete-confirm-cancel`,onClick:()=>_(!1),title:`Cancel delete`,"aria-label":`Cancel delete`,children:`Cancel`})]});(0,q.useEffect)(()=>{e.status===`resolved`&&d(!0)},[e.status]),(0,q.useEffect)(()=>{let e=setInterval(()=>c(e=>e+1),3e4);return()=>clearInterval(e)},[]);let C=e.lineNumber===0,w=e.startLineNumber&&e.startLineNumber!==e.lineNumber,T=e.body.replace(/\s+/g,` `).trim().slice(0,72),E=e.replies?.length??0,D=e.lineContent&&e.lineContent.trim()!==e.selectedQuote?.trim()?e.lineContent:``,O=!!(e.selectedQuote||D),k=Math.max(1,(D||e.selectedQuote||``).split(`
3950
- `).filter(e=>e.length>0).length),[A,j]=(0,q.useState)(k<=1),M=(0,J.jsxs)(J.Fragment,{children:[e.sectionTitle&&(0,J.jsxs)(`span`,{className:`plan-comment-section-chip`,title:`Section: ${e.sectionTitle}`,children:[`§\xA0`,e.sectionTitle]}),C?(0,J.jsx)(`span`,{className:`plan-comment-line-chip plan-comment-line-chip-general`,children:`Whole plan`}):(0,J.jsx)(`span`,{className:`plan-comment-line-chip`,children:w?`L${e.startLineNumber}–${e.lineNumber}`:`L${e.lineNumber}`}),e.severity&&e.severity!==`none`&&(0,J.jsx)(`span`,{className:`plan-comment-severity plan-comment-severity-${e.severity}`,children:e.severity})]});return u&&!m?(0,J.jsxs)(`div`,{className:`comment-collapsed-bar ${l?`comment-collapsed-bar-resolved`:``}`,id:`plan-comment-${e.id}`,role:`article`,children:[(0,J.jsx)(`button`,{type:`button`,className:`comment-collapsed-toggle`,onClick:()=>d(!1),"aria-expanded":!1,"aria-label":`Expand comment thread`,title:`Expand`,children:(0,J.jsx)(DD,{size:14,"aria-hidden":`true`})}),(0,J.jsxs)(`div`,{className:`comment-collapsed-main`,children:[l?(0,J.jsx)(AD,{size:14,className:`comment-collapsed-resolved-icon`,"aria-hidden":`true`}):(0,J.jsx)(j2,{role:`user`,size:11}),(0,J.jsx)(`span`,{className:`comment-collapsed-label`,children:l?`Resolved`:`User`}),M,(0,J.jsxs)(`span`,{className:`comment-collapsed-preview`,title:e.body,children:[T,e.body.length>72?`…`:``]}),(0,J.jsx)(`span`,{className:`comment-collapsed-meta`,children:E>0?`${E+1} comments`:`1 comment`})]}),(0,J.jsxs)(`div`,{className:`comment-collapsed-actions`,children:[g?S:(0,J.jsx)(`button`,{type:`button`,className:`comment-node-btn comment-node-btn-delete`,onClick:()=>_(!0),title:`Delete comment`,"aria-label":`Delete comment`,children:(0,J.jsx)(zO,{size:13,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{type:`button`,className:`comment-collapsed-expand-btn`,onClick:()=>d(!1),children:`Expand`})]})]}):(0,J.jsxs)(`div`,{className:`comment-bubble-canvas ${l?`comment-bubble-canvas-resolved`:``}`,id:`plan-comment-${e.id}`,role:`article`,children:[(0,J.jsxs)(`div`,{className:`comment-node ${l?`comment-node-resolved`:``}`,children:[(0,J.jsx)(`div`,{className:`comment-avatar-col`,children:(0,J.jsx)(j2,{role:`user`,size:16})}),(0,J.jsxs)(`div`,{className:`comment-content-col`,children:[(0,J.jsxs)(`div`,{className:`comment-node-header`,children:[(0,J.jsx)(`button`,{type:`button`,className:`comment-collapse-btn`,onClick:()=>d(!0),"aria-expanded":!0,"aria-label":`Collapse comment thread`,title:`Collapse`,children:(0,J.jsx)(TD,{size:14,"aria-hidden":`true`})}),(0,J.jsx)(`span`,{className:`comment-node-author`,children:`User`}),(0,J.jsx)(`span`,{className:`comment-node-badge comment-node-badge-user`,children:`User`}),(0,J.jsxs)(`span`,{className:`comment-node-time comment-node-meta`,children:[FT(e.createdAt),M]}),l&&(0,J.jsxs)(`span`,{className:`comment-canvas-resolved-banner comment-resolved-inline`,children:[(0,J.jsx)(AD,{size:13}),`Resolved`]}),!m&&(0,J.jsxs)(`div`,{className:`comment-node-actions`,children:[!l&&(0,J.jsx)(`button`,{type:`button`,className:`comment-node-btn`,onClick:()=>h(!0),title:`Edit comment`,"aria-label":`Edit comment`,children:(0,J.jsx)(DO,{size:13,"aria-hidden":`true`})}),g?S:(0,J.jsx)(`button`,{type:`button`,className:`comment-node-btn comment-node-btn-delete`,onClick:()=>_(!0),title:`Delete comment`,"aria-label":`Delete comment`,children:(0,J.jsx)(zO,{size:13,"aria-hidden":`true`})})]})]}),O&&!m&&(0,J.jsxs)(`div`,{className:`comment-context-block`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`comment-context-toggle`,onClick:()=>j(e=>!e),"aria-expanded":A,title:A?`Hide source preview`:`Show source preview`,children:[A?(0,J.jsx)(TD,{size:13,"aria-hidden":`true`}):(0,J.jsx)(DD,{size:13,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{className:`comment-context-toggle-label`,children:[A?`Hide`:`Show`,` source`]}),(0,J.jsxs)(`span`,{className:`comment-context-toggle-meta`,children:[k,` line`,k===1?``:`s`,w?` · L${e.startLineNumber}–${e.lineNumber}`:e.lineNumber>0?` · L${e.lineNumber}`:``]})]}),A&&(0,J.jsxs)(`div`,{className:`plan-comment-context`,title:`Anchored plan context for the agent`,children:[e.selectedQuote&&(0,J.jsxs)(`blockquote`,{className:`plan-comment-quote`,children:[`“`,e.selectedQuote,`”`]}),D?(0,J.jsx)(`pre`,{className:`plan-comment-source`,children:D}):null]})]}),m?(0,J.jsx)(`div`,{className:`comment-edit-form-wrap`,children:(0,J.jsx)(RW,{draftKey:`plan-edit:${e.id}`,initialBody:e.body,lineContent:e.selectedQuote?`Selected: “${e.selectedQuote}”\nSource:\n${e.lineContent}`:e.lineContent,onSubmit:e=>{i(e),h(!1)},onCancel:()=>h(!1)})}):(0,J.jsx)(QV,{content:e.body,className:`comment-node-body markdown-body ${l?`comment-resolved-line`:``}`})]})]}),e.replies?.length>0&&(0,J.jsx)(`div`,{className:`comment-replies`,role:`list`,"aria-label":`Replies`,children:e.replies.map((t,n)=>{let r=t.role===`agent`,i=b===t.id;return(0,J.jsxs)(`div`,{className:`comment-node ${r?`comment-node-agent`:`comment-node-user`} ${l?`comment-node-resolved`:``}`,role:`listitem`,"aria-label":`${r?`Agent`:`User`} reply ${n+1}`,children:[(0,J.jsx)(`div`,{className:`comment-avatar-col`,children:(0,J.jsx)(j2,{role:r?`agent`:`user`,size:14})}),(0,J.jsxs)(`div`,{className:`comment-content-col`,children:[(0,J.jsxs)(`div`,{className:`comment-node-header`,children:[(0,J.jsx)(`span`,{className:`comment-node-author`,children:r?`Agent`:`User`}),(0,J.jsx)(`span`,{className:`comment-node-badge ${r?`comment-node-badge-agent`:`comment-node-badge-user`}`,children:r?`Agent`:`User`}),r&&t.model&&(0,J.jsx)(`span`,{className:`comment-model-chip`,children:t.model}),(0,J.jsx)(`span`,{className:`comment-node-time`,children:FT(t.createdAt)}),(0,J.jsxs)(`div`,{className:`comment-node-actions`,children:[!l&&(0,J.jsx)(`button`,{type:`button`,className:`comment-node-btn`,onClick:()=>x(t.id),title:`Edit reply`,"aria-label":`Edit reply`,children:(0,J.jsx)(DO,{size:12,"aria-hidden":`true`})}),v===t.id?(0,J.jsxs)(`div`,{className:`comment-delete-confirm`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`comment-node-btn comment-node-btn-delete comment-delete-confirm-yes`,onClick:()=>{y(null),s(t.id)},title:`Confirm delete reply`,"aria-label":`Confirm delete reply`,children:[(0,J.jsx)(BO,{size:11}),`Delete?`]}),(0,J.jsx)(`button`,{type:`button`,className:`comment-node-btn comment-delete-confirm-cancel`,onClick:()=>y(null),title:`Cancel delete`,"aria-label":`Cancel delete reply`,children:`Cancel`})]}):(0,J.jsx)(`button`,{type:`button`,className:`comment-node-btn comment-node-btn-delete`,onClick:()=>y(t.id),title:`Delete reply`,"aria-label":`Delete reply`,children:(0,J.jsx)(zO,{size:12,"aria-hidden":`true`})})]})]}),i?(0,J.jsx)(`div`,{className:`comment-reply-editor`,children:(0,J.jsx)(RW,{draftKey:`plan-reply-edit:${e.id}:${t.id}`,initialBody:t.body,onSubmit:e=>{o(t.id,e),x(null)},onCancel:()=>x(null)})}):(0,J.jsx)(QV,{content:t.body,className:`comment-node-body markdown-body`})]})]},t.id)})}),(0,J.jsxs)(`div`,{className:`comment-canvas-footer`,children:[!f&&(0,J.jsxs)(`div`,{className:`comment-canvas-footer-row`,children:[(0,J.jsxs)(`button`,{onClick:()=>p(!0),className:`comment-reply-trigger`,children:[(0,J.jsx)(AO,{size:14,"aria-hidden":`true`}),`Reply...`]}),l?(0,J.jsxs)(`div`,{className:`comment-canvas-footer-actions`,children:[(0,J.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:()=>d(!0),children:`Hide`}),(0,J.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:n,children:`Unresolve`})]}):(0,J.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:t,children:`Resolve`})]}),f&&(0,J.jsx)(`div`,{className:`comment-reply-composer`,children:(0,J.jsx)(RW,{draftKey:`plan-reply:${e.id}`,onSubmit:e=>{a(e),p(!1)},onCancel:()=>p(!1)})})]})]})}function N2(e,t){if(!e.length||t<1)return null;let n=null;for(let r of e)if(r.line<=t)n=r;else break;return n}function P2(e){return e.lineNumber<=0?`General`:e.startLineNumber!=null&&e.startLineNumber!==e.lineNumber?`L${Math.min(e.startLineNumber,e.lineNumber)}–L${Math.max(e.startLineNumber,e.lineNumber)}`:`L${e.lineNumber}`}function F2(e,t,n){let r=e.replace(/\r\n/g,`
3952
+ `)}function P2({role:e,size:t=16}){return e===`agent`?(0,J.jsx)(`div`,{className:`comment-avatar-circle comment-avatar-agent comment-avatar-size-${t}`,children:(0,J.jsx)(SD,{size:t,"aria-hidden":`true`})}):(0,J.jsx)(`div`,{className:`comment-avatar-circle comment-avatar-user comment-avatar-size-${t}`,children:(0,J.jsx)(UO,{size:t,"aria-hidden":`true`})})}function F2({comment:e,onResolve:t,onUnresolve:n,onDelete:r,onEdit:i,onReply:a,onEditReply:o,onDeleteReply:s}){let[,c]=(0,q.useState)(0),l=e.status===`resolved`,[u,d]=(0,q.useState)(l),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),S=(0,J.jsxs)(`div`,{className:`comment-delete-confirm`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`comment-node-btn comment-node-btn-delete comment-delete-confirm-yes`,onClick:()=>{_(!1),r()},title:`Confirm delete`,"aria-label":`Confirm delete comment`,children:[(0,J.jsx)(BO,{size:11}),`Delete?`]}),(0,J.jsx)(`button`,{type:`button`,className:`comment-node-btn comment-delete-confirm-cancel`,onClick:()=>_(!1),title:`Cancel delete`,"aria-label":`Cancel delete`,children:`Cancel`})]});(0,q.useEffect)(()=>{e.status===`resolved`&&d(!0)},[e.status]),(0,q.useEffect)(()=>{let e=setInterval(()=>c(e=>e+1),3e4);return()=>clearInterval(e)},[]);let C=e.lineNumber===0,w=e.startLineNumber&&e.startLineNumber!==e.lineNumber,T=e.body.replace(/\s+/g,` `).trim().slice(0,72),E=e.replies?.length??0,D=e.lineContent&&e.lineContent.trim()!==e.selectedQuote?.trim()?e.lineContent:``,O=!!(e.selectedQuote||D),k=Math.max(1,(D||e.selectedQuote||``).split(`
3953
+ `).filter(e=>e.length>0).length),[A,j]=(0,q.useState)(k<=1),M=(0,J.jsxs)(J.Fragment,{children:[e.sectionTitle&&(0,J.jsxs)(`span`,{className:`plan-comment-section-chip`,title:`Section: ${e.sectionTitle}`,children:[`§\xA0`,e.sectionTitle]}),C?(0,J.jsx)(`span`,{className:`plan-comment-line-chip plan-comment-line-chip-general`,children:`Whole plan`}):(0,J.jsx)(`span`,{className:`plan-comment-line-chip`,children:w?`L${e.startLineNumber}–${e.lineNumber}`:`L${e.lineNumber}`}),e.severity&&e.severity!==`none`&&(0,J.jsx)(`span`,{className:`plan-comment-severity plan-comment-severity-${e.severity}`,children:e.severity})]});return u&&!m?(0,J.jsxs)(`div`,{className:`comment-collapsed-bar ${l?`comment-collapsed-bar-resolved`:``}`,id:`plan-comment-${e.id}`,role:`article`,children:[(0,J.jsx)(`button`,{type:`button`,className:`comment-collapsed-toggle`,onClick:()=>d(!1),"aria-expanded":!1,"aria-label":`Expand comment thread`,title:`Expand`,children:(0,J.jsx)(DD,{size:14,"aria-hidden":`true`})}),(0,J.jsxs)(`div`,{className:`comment-collapsed-main`,children:[l?(0,J.jsx)(AD,{size:14,className:`comment-collapsed-resolved-icon`,"aria-hidden":`true`}):(0,J.jsx)(P2,{role:`user`,size:11}),(0,J.jsx)(`span`,{className:`comment-collapsed-label`,children:l?`Resolved`:`User`}),M,(0,J.jsxs)(`span`,{className:`comment-collapsed-preview`,title:e.body,children:[T,e.body.length>72?`…`:``]}),(0,J.jsx)(`span`,{className:`comment-collapsed-meta`,children:E>0?`${E+1} comments`:`1 comment`})]}),(0,J.jsxs)(`div`,{className:`comment-collapsed-actions`,children:[g?S:(0,J.jsx)(`button`,{type:`button`,className:`comment-node-btn comment-node-btn-delete`,onClick:()=>_(!0),title:`Delete comment`,"aria-label":`Delete comment`,children:(0,J.jsx)(zO,{size:13,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{type:`button`,className:`comment-collapsed-expand-btn`,onClick:()=>d(!1),children:`Expand`})]})]}):(0,J.jsxs)(`div`,{className:`comment-bubble-canvas ${l?`comment-bubble-canvas-resolved`:``}`,id:`plan-comment-${e.id}`,role:`article`,children:[(0,J.jsxs)(`div`,{className:`comment-node ${l?`comment-node-resolved`:``}`,children:[(0,J.jsx)(`div`,{className:`comment-avatar-col`,children:(0,J.jsx)(P2,{role:`user`,size:16})}),(0,J.jsxs)(`div`,{className:`comment-content-col`,children:[(0,J.jsxs)(`div`,{className:`comment-node-header`,children:[(0,J.jsx)(`button`,{type:`button`,className:`comment-collapse-btn`,onClick:()=>d(!0),"aria-expanded":!0,"aria-label":`Collapse comment thread`,title:`Collapse`,children:(0,J.jsx)(TD,{size:14,"aria-hidden":`true`})}),(0,J.jsx)(`span`,{className:`comment-node-author`,children:`User`}),(0,J.jsx)(`span`,{className:`comment-node-badge comment-node-badge-user`,children:`User`}),(0,J.jsxs)(`span`,{className:`comment-node-time comment-node-meta`,children:[FT(e.createdAt),M]}),l&&(0,J.jsxs)(`span`,{className:`comment-canvas-resolved-banner comment-resolved-inline`,children:[(0,J.jsx)(AD,{size:13}),`Resolved`]}),!m&&(0,J.jsxs)(`div`,{className:`comment-node-actions`,children:[!l&&(0,J.jsx)(`button`,{type:`button`,className:`comment-node-btn`,onClick:()=>h(!0),title:`Edit comment`,"aria-label":`Edit comment`,children:(0,J.jsx)(DO,{size:13,"aria-hidden":`true`})}),g?S:(0,J.jsx)(`button`,{type:`button`,className:`comment-node-btn comment-node-btn-delete`,onClick:()=>_(!0),title:`Delete comment`,"aria-label":`Delete comment`,children:(0,J.jsx)(zO,{size:13,"aria-hidden":`true`})})]})]}),O&&!m&&(0,J.jsxs)(`div`,{className:`comment-context-block`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`comment-context-toggle`,onClick:()=>j(e=>!e),"aria-expanded":A,title:A?`Hide source preview`:`Show source preview`,children:[A?(0,J.jsx)(TD,{size:13,"aria-hidden":`true`}):(0,J.jsx)(DD,{size:13,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{className:`comment-context-toggle-label`,children:[A?`Hide`:`Show`,` source`]}),(0,J.jsxs)(`span`,{className:`comment-context-toggle-meta`,children:[k,` line`,k===1?``:`s`,w?` · L${e.startLineNumber}–${e.lineNumber}`:e.lineNumber>0?` · L${e.lineNumber}`:``]})]}),A&&(0,J.jsxs)(`div`,{className:`plan-comment-context`,title:`Anchored plan context for the agent`,children:[e.selectedQuote&&(0,J.jsxs)(`blockquote`,{className:`plan-comment-quote`,children:[`“`,e.selectedQuote,`”`]}),D?(0,J.jsx)(`pre`,{className:`plan-comment-source`,children:D}):null]})]}),m?(0,J.jsx)(`div`,{className:`comment-edit-form-wrap`,children:(0,J.jsx)(RW,{draftKey:`plan-edit:${e.id}`,initialBody:e.body,lineContent:e.selectedQuote?`Selected: “${e.selectedQuote}”\nSource:\n${e.lineContent}`:e.lineContent,onSubmit:e=>{i(e),h(!1)},onCancel:()=>h(!1)})}):(0,J.jsx)(QV,{content:e.body,className:`comment-node-body markdown-body ${l?`comment-resolved-line`:``}`})]})]}),e.replies?.length>0&&(0,J.jsx)(`div`,{className:`comment-replies`,role:`list`,"aria-label":`Replies`,children:e.replies.map((t,n)=>{let r=t.role===`agent`,i=b===t.id;return(0,J.jsxs)(`div`,{className:`comment-node ${r?`comment-node-agent`:`comment-node-user`} ${l?`comment-node-resolved`:``}`,role:`listitem`,"aria-label":`${r?`Agent`:`User`} reply ${n+1}`,children:[(0,J.jsx)(`div`,{className:`comment-avatar-col`,children:(0,J.jsx)(P2,{role:r?`agent`:`user`,size:14})}),(0,J.jsxs)(`div`,{className:`comment-content-col`,children:[(0,J.jsxs)(`div`,{className:`comment-node-header`,children:[(0,J.jsx)(`span`,{className:`comment-node-author`,children:r?`Agent`:`User`}),(0,J.jsx)(`span`,{className:`comment-node-badge ${r?`comment-node-badge-agent`:`comment-node-badge-user`}`,children:r?`Agent`:`User`}),r&&t.model&&(0,J.jsx)(`span`,{className:`comment-model-chip`,children:t.model}),(0,J.jsx)(`span`,{className:`comment-node-time`,children:FT(t.createdAt)}),(0,J.jsxs)(`div`,{className:`comment-node-actions`,children:[!l&&(0,J.jsx)(`button`,{type:`button`,className:`comment-node-btn`,onClick:()=>x(t.id),title:`Edit reply`,"aria-label":`Edit reply`,children:(0,J.jsx)(DO,{size:12,"aria-hidden":`true`})}),v===t.id?(0,J.jsxs)(`div`,{className:`comment-delete-confirm`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`comment-node-btn comment-node-btn-delete comment-delete-confirm-yes`,onClick:()=>{y(null),s(t.id)},title:`Confirm delete reply`,"aria-label":`Confirm delete reply`,children:[(0,J.jsx)(BO,{size:11}),`Delete?`]}),(0,J.jsx)(`button`,{type:`button`,className:`comment-node-btn comment-delete-confirm-cancel`,onClick:()=>y(null),title:`Cancel delete`,"aria-label":`Cancel delete reply`,children:`Cancel`})]}):(0,J.jsx)(`button`,{type:`button`,className:`comment-node-btn comment-node-btn-delete`,onClick:()=>y(t.id),title:`Delete reply`,"aria-label":`Delete reply`,children:(0,J.jsx)(zO,{size:12,"aria-hidden":`true`})})]})]}),i?(0,J.jsx)(`div`,{className:`comment-reply-editor`,children:(0,J.jsx)(RW,{draftKey:`plan-reply-edit:${e.id}:${t.id}`,initialBody:t.body,onSubmit:e=>{o(t.id,e),x(null)},onCancel:()=>x(null)})}):(0,J.jsx)(QV,{content:t.body,className:`comment-node-body markdown-body`})]})]},t.id)})}),(0,J.jsxs)(`div`,{className:`comment-canvas-footer`,children:[!f&&(0,J.jsxs)(`div`,{className:`comment-canvas-footer-row`,children:[(0,J.jsxs)(`button`,{onClick:()=>p(!0),className:`comment-reply-trigger`,children:[(0,J.jsx)(AO,{size:14,"aria-hidden":`true`}),`Reply...`]}),l?(0,J.jsxs)(`div`,{className:`comment-canvas-footer-actions`,children:[(0,J.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:()=>d(!0),children:`Hide`}),(0,J.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:n,children:`Unresolve`})]}):(0,J.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:t,children:`Resolve`})]}),f&&(0,J.jsx)(`div`,{className:`comment-reply-composer`,children:(0,J.jsx)(RW,{draftKey:`plan-reply:${e.id}`,onSubmit:e=>{a(e),p(!1)},onCancel:()=>p(!1)})})]})]})}function I2(e,t){if(!e.length||t<1)return null;let n=null;for(let r of e)if(r.line<=t)n=r;else break;return n}function L2(e){return e.lineNumber<=0?`General`:e.startLineNumber!=null&&e.startLineNumber!==e.lineNumber?`L${Math.min(e.startLineNumber,e.lineNumber)}–L${Math.max(e.startLineNumber,e.lineNumber)}`:`L${e.lineNumber}`}function R2(e,t,n){let r=e.replace(/\r\n/g,`
3951
3954
  `).split(`
3952
- `),i=Math.max(1,r.length),a=n.filter(e=>e.lineNumber>0),o=[];if(t.length===0)o.push({key:`preamble`,startLine:1,endLine:i});else{t[0].line>1&&o.push({key:`preamble`,startLine:1,endLine:t[0].line-1});for(let e=0;e<t.length;e++){let n=t[e],r=t[e+1];o.push({key:n.id,startLine:n.line,endLine:r?r.line-1:i})}}let s=new Map;for(let e of o)s.set(e.key,[]);for(let e of a){let n=e.lineNumber,r=N2(t,n)?.id??`preamble`;s.has(r)||(r=o.find(e=>n>=e.startLine&&n<=e.endLine)?.key??o[o.length-1].key),s.get(r).push(e)}for(let e of s.values())e.sort((e,t)=>{if(e.status!==t.status)return e.status===`open`?-1:1;let n=e.startLineNumber??e.lineNumber,r=t.startLineNumber??t.lineNumber;return n===r?e.lineNumber-t.lineNumber:n-r});return o.map(e=>{let t=r.slice(e.startLine-1,e.endLine).join(`
3953
- `);return{key:e.key,startLine:e.startLine,endLine:e.endLine,markdown:t,comments:s.get(e.key)??[]}})}function I2({body:e,outline:t,comments:n,onResolve:r,onUnresolve:i,onDelete:a,onEdit:o,onReply:s,onEditReply:c,onDeleteReply:l}){let u=(0,q.useMemo)(()=>n.filter(e=>e.lineNumber>0),[n]),d=(0,q.useMemo)(()=>F2(e,t,u),[e,t,u]);if(d.length===0){let t=Math.max(1,e.replace(/\r\n/g,`
3955
+ `),i=Math.max(1,r.length),a=n.filter(e=>e.lineNumber>0),o=[];if(t.length===0)o.push({key:`preamble`,startLine:1,endLine:i});else{t[0].line>1&&o.push({key:`preamble`,startLine:1,endLine:t[0].line-1});for(let e=0;e<t.length;e++){let n=t[e],r=t[e+1];o.push({key:n.id,startLine:n.line,endLine:r?r.line-1:i})}}let s=new Map;for(let e of o)s.set(e.key,[]);for(let e of a){let n=e.lineNumber,r=I2(t,n)?.id??`preamble`;s.has(r)||(r=o.find(e=>n>=e.startLine&&n<=e.endLine)?.key??o[o.length-1].key),s.get(r).push(e)}for(let e of s.values())e.sort((e,t)=>{if(e.status!==t.status)return e.status===`open`?-1:1;let n=e.startLineNumber??e.lineNumber,r=t.startLineNumber??t.lineNumber;return n===r?e.lineNumber-t.lineNumber:n-r});return o.map(e=>{let t=r.slice(e.startLine-1,e.endLine).join(`
3956
+ `);return{key:e.key,startLine:e.startLine,endLine:e.endLine,markdown:t,comments:s.get(e.key)??[]}})}function z2({body:e,outline:t,comments:n,onResolve:r,onUnresolve:i,onDelete:a,onEdit:o,onReply:s,onEditReply:c,onDeleteReply:l}){let u=(0,q.useMemo)(()=>n.filter(e=>e.lineNumber>0),[n]),d=(0,q.useMemo)(()=>R2(e,t,u),[e,t,u]);if(d.length===0){let t=Math.max(1,e.replace(/\r\n/g,`
3954
3957
  `).split(`
3955
- `).length);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`plan-read-segment`,"data-plan-segment":`body`,"data-plan-source-start":1,"data-plan-source-end":t,children:(0,J.jsx)(QV,{content:e})}),u.map(e=>(0,J.jsx)(`div`,{className:`plan-read-comment-host`,"data-plan-read-comment-host":e.id,children:(0,J.jsx)(`div`,{className:`plan-read-comment-slot`,children:(0,J.jsx)(M2,{comment:e,onResolve:()=>r(e.id),onUnresolve:()=>i(e.id),onDelete:()=>a(e.id),onEdit:t=>o(e.id,t),onReply:t=>s(e.id,t),onEditReply:(t,n)=>c(e.id,t,n),onDeleteReply:t=>l(e.id,t)})})},e.id))]})}return(0,J.jsx)(J.Fragment,{children:d.map(e=>(0,J.jsxs)(`div`,{className:`plan-read-segment`,"data-plan-segment":e.key,"data-plan-source-start":e.startLine,"data-plan-source-end":e.endLine,children:[e.markdown.trim().length>0&&(0,J.jsx)(QV,{content:e.markdown}),e.comments.map(e=>(0,J.jsx)(`div`,{className:`plan-read-comment-host`,"data-plan-read-comment-host":e.id,children:(0,J.jsx)(`div`,{className:`plan-read-comment-slot`,"data-plan-line":e.lineNumber,"data-plan-line-start":e.startLineNumber!=null&&e.startLineNumber!==e.lineNumber?e.startLineNumber:void 0,children:(0,J.jsx)(M2,{comment:e,onResolve:()=>r(e.id),onUnresolve:()=>i(e.id),onDelete:()=>a(e.id),onEdit:t=>o(e.id,t),onReply:t=>s(e.id,t),onEditReply:(t,n)=>c(e.id,t,n),onDeleteReply:t=>l(e.id,t)})})},e.id))]},e.key))})}var L2=(0,q.memo)(function({isOpen:e,filePath:t,onClose:n}){let{data:r,isLoading:i,error:a}=J0(t),o=t?t.split(`/`).pop():``;return(0,J.jsxs)(IH,{open:e,onClose:n,className:`shortcuts-modal file-preview-modal`,ariaLabel:`File preview`,children:[(0,J.jsxs)(`div`,{className:`shortcuts-header`,children:[(0,J.jsxs)(`div`,{className:`shortcuts-header-title`,children:[(0,J.jsx)(qD,{size:18,className:`shortcuts-icon`}),(0,J.jsxs)(`h2`,{children:[`Preview: `,o]}),(0,J.jsx)(`span`,{style:{fontSize:`11px`,color:`var(--text-muted)`,marginLeft:`8px`},children:t})]}),(0,J.jsx)(`button`,{className:`shortcuts-close-btn`,onClick:n,"aria-label":`Close dialog`,children:(0,J.jsx)(WO,{size:16})})]}),(0,J.jsxs)(`div`,{className:`shortcuts-body`,style:{maxHeight:`60vh`,display:`flex`,flexDirection:`column`},children:[i&&(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`40px`,gap:`8px`,color:`var(--text-muted)`},children:[(0,J.jsx)(cO,{size:16,className:`spin`}),(0,J.jsx)(`span`,{children:`Loading file content...`})]}),a&&(0,J.jsxs)(`div`,{style:{padding:`20px`,color:`var(--danger)`,background:`var(--feedback-danger-bg)`,borderRadius:`6px`},children:[`Failed to load file: `,a.message||String(a)]}),r&&(0,J.jsx)(`div`,{style:{flex:1,overflow:`auto`,background:`var(--bg-secondary)`,borderRadius:`6px`,border:`1px solid var(--border-normal)`},children:r.binary?(0,J.jsx)(`div`,{style:{padding:`40px`,textAlign:`center`,color:`var(--text-muted)`},children:`Binary file cannot be previewed.`}):r.missing?(0,J.jsx)(`div`,{style:{padding:`40px`,textAlign:`center`,color:`var(--text-muted)`},children:`File does not exist or has been deleted.`}):(0,J.jsx)(`pre`,{style:{margin:0,padding:`16px`,fontFamily:`var(--font-mono)`,fontSize:`13px`,lineHeight:`1.6`,overflowX:`auto`,whiteSpace:`pre-wrap`,wordBreak:`break-all`},children:(0,J.jsx)(`code`,{children:r.content})})})]}),(0,J.jsx)(`div`,{className:`shortcuts-footer`,style:{justifyContent:`flex-end`},children:(0,J.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:n,children:`Close Preview`})})]})});function R2(e){return e.toLowerCase().trim().replace(/[`*_~[\]()#.!?,:'"]/g,``).replace(/[^\w\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``).slice(0,80)||`section`}function z2(e){let t=e.replace(/\r\n/g,`
3958
+ `).length);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`plan-read-segment`,"data-plan-segment":`body`,"data-plan-source-start":1,"data-plan-source-end":t,children:(0,J.jsx)(QV,{content:e})}),u.map(e=>(0,J.jsx)(`div`,{className:`plan-read-comment-host`,"data-plan-read-comment-host":e.id,children:(0,J.jsx)(`div`,{className:`plan-read-comment-slot`,children:(0,J.jsx)(F2,{comment:e,onResolve:()=>r(e.id),onUnresolve:()=>i(e.id),onDelete:()=>a(e.id),onEdit:t=>o(e.id,t),onReply:t=>s(e.id,t),onEditReply:(t,n)=>c(e.id,t,n),onDeleteReply:t=>l(e.id,t)})})},e.id))]})}return(0,J.jsx)(J.Fragment,{children:d.map(e=>(0,J.jsxs)(`div`,{className:`plan-read-segment`,"data-plan-segment":e.key,"data-plan-source-start":e.startLine,"data-plan-source-end":e.endLine,children:[e.markdown.trim().length>0&&(0,J.jsx)(QV,{content:e.markdown}),e.comments.map(e=>(0,J.jsx)(`div`,{className:`plan-read-comment-host`,"data-plan-read-comment-host":e.id,children:(0,J.jsx)(`div`,{className:`plan-read-comment-slot`,"data-plan-line":e.lineNumber,"data-plan-line-start":e.startLineNumber!=null&&e.startLineNumber!==e.lineNumber?e.startLineNumber:void 0,children:(0,J.jsx)(F2,{comment:e,onResolve:()=>r(e.id),onUnresolve:()=>i(e.id),onDelete:()=>a(e.id),onEdit:t=>o(e.id,t),onReply:t=>s(e.id,t),onEditReply:(t,n)=>c(e.id,t,n),onDeleteReply:t=>l(e.id,t)})})},e.id))]},e.key))})}var B2=(0,q.memo)(function({isOpen:e,filePath:t,onClose:n}){let{data:r,isLoading:i,error:a}=X0(t),o=t?t.split(`/`).pop():``;return(0,J.jsxs)(IH,{open:e,onClose:n,className:`shortcuts-modal file-preview-modal`,ariaLabel:`File preview`,children:[(0,J.jsxs)(`div`,{className:`shortcuts-header`,children:[(0,J.jsxs)(`div`,{className:`shortcuts-header-title`,children:[(0,J.jsx)(qD,{size:18,className:`shortcuts-icon`}),(0,J.jsxs)(`h2`,{children:[`Preview: `,o]}),(0,J.jsx)(`span`,{style:{fontSize:`11px`,color:`var(--text-muted)`,marginLeft:`8px`},children:t})]}),(0,J.jsx)(`button`,{className:`shortcuts-close-btn`,onClick:n,"aria-label":`Close dialog`,children:(0,J.jsx)(WO,{size:16})})]}),(0,J.jsxs)(`div`,{className:`shortcuts-body`,style:{maxHeight:`60vh`,display:`flex`,flexDirection:`column`},children:[i&&(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`40px`,gap:`8px`,color:`var(--text-muted)`},children:[(0,J.jsx)(cO,{size:16,className:`spin`}),(0,J.jsx)(`span`,{children:`Loading file content...`})]}),a&&(0,J.jsxs)(`div`,{style:{padding:`20px`,color:`var(--danger)`,background:`var(--feedback-danger-bg)`,borderRadius:`6px`},children:[`Failed to load file: `,a.message||String(a)]}),r&&(0,J.jsx)(`div`,{style:{flex:1,overflow:`auto`,background:`var(--bg-secondary)`,borderRadius:`6px`,border:`1px solid var(--border-normal)`},children:r.binary?(0,J.jsx)(`div`,{style:{padding:`40px`,textAlign:`center`,color:`var(--text-muted)`},children:`Binary file cannot be previewed.`}):r.missing?(0,J.jsx)(`div`,{style:{padding:`40px`,textAlign:`center`,color:`var(--text-muted)`},children:`File does not exist or has been deleted.`}):(0,J.jsx)(`pre`,{style:{margin:0,padding:`16px`,fontFamily:`var(--font-mono)`,fontSize:`13px`,lineHeight:`1.6`,overflowX:`auto`,whiteSpace:`pre-wrap`,wordBreak:`break-all`},children:(0,J.jsx)(`code`,{children:r.content})})})]}),(0,J.jsx)(`div`,{className:`shortcuts-footer`,style:{justifyContent:`flex-end`},children:(0,J.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:n,children:`Close Preview`})})]})});function V2(e){return e.toLowerCase().trim().replace(/[`*_~[\]()#.!?,:'"]/g,``).replace(/[^\w\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``).slice(0,80)||`section`}function H2(e){let t=e.replace(/\r\n/g,`
3956
3959
  `).split(`
3957
- `),n=[],r=new Map;for(let e=0;e<t.length;e++){let i=/^(#{1,6})\s+(.+?)\s*#*\s*$/.exec(t[e]);if(!i)continue;let a=i[1].length,o=i[2].replace(/\s+#+\s*$/,``).trim();if(!o)continue;let s=R2(o),c=r.get(s)??0;r.set(s,c+1),c>0&&(s=`${s}-${c+1}`),n.push({level:a,text:o,id:s,line:e+1})}return n}function B2(e){return e.replace(/\u00a0/g,` `).replace(/\u200b/g,``).replace(/\r\n/g,`
3960
+ `),n=[],r=new Map;for(let e=0;e<t.length;e++){let i=/^(#{1,6})\s+(.+?)\s*#*\s*$/.exec(t[e]);if(!i)continue;let a=i[1].length,o=i[2].replace(/\s+#+\s*$/,``).trim();if(!o)continue;let s=V2(o),c=r.get(s)??0;r.set(s,c+1),c>0&&(s=`${s}-${c+1}`),n.push({level:a,text:o,id:s,line:e+1})}return n}function U2(e){return e.replace(/\u00a0/g,` `).replace(/\u200b/g,``).replace(/\r\n/g,`
3958
3961
  `).replace(/[ \t]+\n/g,`
3959
- `).trim()}function V2(e,t){if(!e.rangeCount)return!1;try{let n=e.getRangeAt(0);if(t.contains(n.commonAncestorContainer)||e.anchorNode&&t.contains(e.anchorNode)||e.focusNode&&t.contains(e.focusNode))return!0;let r=document.createRange();return r.selectNodeContents(t),n.compareBoundaryPoints(Range.START_TO_END,r)<0&&n.compareBoundaryPoints(Range.END_TO_START,r)>0}catch{return!1}}function H2(e,t){if(!e.rangeCount)return null;try{let n=e.getRangeAt(0).cloneRange();if(t.contains(n.commonAncestorContainer))return n;let r=document.createRange();return r.selectNodeContents(t),t.contains(n.startContainer)||n.setStart(r.startContainer,r.startOffset),t.contains(n.endContainer)||n.setEnd(r.endContainer,r.endOffset),n.collapsed||!t.contains(n.commonAncestorContainer)&&!V2(e,t)?null:n}catch{return null}}function U2(e,t){return t<=0?1:e.slice(0,t).split(`
3960
- `).length}function W2(e,t){let n=B2(t);if(!n)return null;let r=e.replace(/\r\n/g,`
3961
- `),i=r.indexOf(n);if(i!==-1){let e=U2(r,i);return{text:n,startLine:e,endLine:e+n.split(`
3962
- `).length-1}}let a=n.replace(/\s+/g,` `).trim();if(a){let e=r.replace(/\s+/g,` `).indexOf(a);if(e!==-1){let t=G2(r,e);if(t!==-1){let e=U2(r,t),i=e+Math.max(0,n.split(`
3962
+ `).trim()}function W2(e,t){if(!e.rangeCount)return!1;try{let n=e.getRangeAt(0);if(t.contains(n.commonAncestorContainer)||e.anchorNode&&t.contains(e.anchorNode)||e.focusNode&&t.contains(e.focusNode))return!0;let r=document.createRange();return r.selectNodeContents(t),n.compareBoundaryPoints(Range.START_TO_END,r)<0&&n.compareBoundaryPoints(Range.END_TO_START,r)>0}catch{return!1}}function G2(e,t){if(!e.rangeCount)return null;try{let n=e.getRangeAt(0).cloneRange();if(t.contains(n.commonAncestorContainer))return n;let r=document.createRange();return r.selectNodeContents(t),t.contains(n.startContainer)||n.setStart(r.startContainer,r.startOffset),t.contains(n.endContainer)||n.setEnd(r.endContainer,r.endOffset),n.collapsed||!t.contains(n.commonAncestorContainer)&&!W2(e,t)?null:n}catch{return null}}function K2(e,t){return t<=0?1:e.slice(0,t).split(`
3963
+ `).length}function q2(e,t){let n=U2(t);if(!n)return null;let r=e.replace(/\r\n/g,`
3964
+ `),i=r.indexOf(n);if(i!==-1){let e=K2(r,i);return{text:n,startLine:e,endLine:e+n.split(`
3965
+ `).length-1}}let a=n.replace(/\s+/g,` `).trim();if(a){let e=r.replace(/\s+/g,` `).indexOf(a);if(e!==-1){let t=Z2(r,e);if(t!==-1){let e=K2(r,t),i=e+Math.max(0,n.split(`
3963
3966
  `).length-1);return{text:n,startLine:e,endLine:Math.min(i,r.split(`
3964
3967
  `).length)}}}}let o=n.split(`
3965
3968
  `).find(e=>e.trim())?.trim()??``;if(o.length>=1){let e=r.split(`
3966
3969
  `);for(let t=0;t<e.length;t++){let r=e[t],i=r.replace(/^\s*([-*+]|\d+\.)\s+/,``).trim();if(r.includes(o)||i.includes(o)||o.includes(i)&&i.length>=2){let r=n.split(`
3967
- `).filter(e=>e.trim()).length||1,i=t+1;return{text:n,startLine:i,endLine:Math.min(e.length,i+r-1)}}}}if(a.replace(/\s+/g,``).length>=3){let e=a.slice(0,Math.min(32,a.length)),t=new RegExp(e.split(``).map(e=>/[.*+?^${}()|[\]\\]/.test(e)?`\\${e}`:e).join(`\\s*`),`i`).exec(r);if(t&&t.index!=null){let e=U2(r,t.index);return{text:n,startLine:e,endLine:e}}}return null}function G2(e,t){let n=0,r=0,i=!1;for(;r<e.length&&n<t;){let t=e[r];/\s/.test(t)?(i||=(n+=1,!0),r+=1):(i=!1,n+=1,r+=1)}for(;r<e.length&&/\s/.test(e[r]);)r+=1;return r<e.length?r:-1}function K2(e){return e?!!e.closest([`.plan-read-comment-host`,`.plan-float-highlights`,`.plan-float-highlight`,`.plan-selection-comment`,`.plan-selection-popup`,`.comment-bubble-canvas`,`.comment-collapsed-bar`,`.plan-toc`,`button`,`textarea`,`input`].join(`,`)):!0}function q2(e){let t=window.scrollX,n=window.scrollY;return Array.from(e.getClientRects()).filter(e=>e.width>0&&e.height>0).map(e=>({top:e.top+n,left:e.left+t,width:e.width,height:e.height}))}function J2(e,t){let n=t.trim();if(!n||n.length<2)return[];let r=[],i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){let t=e.parentElement;return K2(t)?NodeFilter.FILTER_REJECT:e.textContent?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),a;for(;a=i.nextNode();)r.push(a);if(r.length===0)return[];let o=``,s=[];for(let e of r){let t=e.textContent||``;s.push({node:e,start:o.length,end:o.length+t.length}),o+=t}let c=[n,...n.split(`
3970
+ `).filter(e=>e.trim()).length||1,i=t+1;return{text:n,startLine:i,endLine:Math.min(e.length,i+r-1)}}}}if(a.replace(/\s+/g,``).length>=3){let e=a.slice(0,Math.min(32,a.length)),t=new RegExp(e.split(``).map(e=>/[.*+?^${}()|[\]\\]/.test(e)?`\\${e}`:e).join(`\\s*`),`i`).exec(r);if(t&&t.index!=null){let e=K2(r,t.index);return{text:n,startLine:e,endLine:e}}}return null}function J2(e){if(!e)return null;if(e.nodeType===Node.ELEMENT_NODE)return e.closest(`.plan-read-segment`);let t=e.parentElement;return t?t.closest(`.plan-read-segment`):null}function Y2(e,t){if(!e)return null;let n=e.dataset[t],r=n==null?NaN:Number(n);return Number.isFinite(r)&&r>=1?r:null}function X2(e,t,n){let r=U2(t);if(!r)return null;let i=r.replace(/^#\s*/,``),a=[];i&&i!==r&&a.push(i),a.push(r);let o=J2(n.startContainer),s=n.collapsed?o:J2(n.endContainer),c=Y2(o,`planSourceStart`),l=Y2(s,`planSourceEnd`);if(c!=null&&l!=null){let t=N2(e,c,l);for(let e of a){let n=q2(t,e);if(n)return{text:e,startLine:c+n.startLine-1,endLine:c+n.endLine-1}}return{text:a[0]??r,startLine:c,endLine:Math.max(c,l)}}for(let t of a){let n=q2(e,t);if(n)return n}return null}function Z2(e,t){let n=0,r=0,i=!1;for(;r<e.length&&n<t;){let t=e[r];/\s/.test(t)?(i||=(n+=1,!0),r+=1):(i=!1,n+=1,r+=1)}for(;r<e.length&&/\s/.test(e[r]);)r+=1;return r<e.length?r:-1}function Q2(e){return e?!!e.closest([`.plan-read-comment-host`,`.plan-float-highlights`,`.plan-float-highlight`,`.plan-selection-comment`,`.plan-selection-popup`,`.comment-bubble-canvas`,`.comment-collapsed-bar`,`.plan-toc`,`button`,`textarea`,`input`].join(`,`)):!0}function $2(e){let t=window.scrollX,n=window.scrollY;return Array.from(e.getClientRects()).filter(e=>e.width>0&&e.height>0).map(e=>({top:e.top+n,left:e.left+t,width:e.width,height:e.height}))}function e4(e,t){let n=t.trim();if(!n||n.length<2)return[];let r=[],i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){let t=e.parentElement;return Q2(t)?NodeFilter.FILTER_REJECT:e.textContent?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),a;for(;a=i.nextNode();)r.push(a);if(r.length===0)return[];let o=``,s=[];for(let e of r){let t=e.textContent||``;s.push({node:e,start:o.length,end:o.length+t.length}),o+=t}let c=[n,...n.split(`
3968
3971
  `).map(e=>e.trim()).filter(e=>e.length>=3)],l=-1,u=-1;for(let e of c){let t=o.indexOf(e);if(t>=0){l=t,u=t+e.length;break}}if(l<0){let e=o.replace(/\s+/g,` `),t=n.replace(/\s+/g,` `);if(e.indexOf(t)<0)return[];let r=n.split(`
3969
- `).map(e=>e.trim()).find(e=>e.length>=3);if(!r)return[];let i=o.indexOf(r);if(i<0)return[];l=i,u=i+r.length}let d=s.find(e=>l>=e.start&&l<e.end),f=s.find(e=>u>e.start&&u<=e.end)??s.find(e=>u>e.start&&u-1<e.end);if(!d||!f)return[];try{let e=document.createRange();return e.setStart(d.node,l-d.start),e.setEnd(f.node,Math.min(f.node.textContent.length,u-f.start)),q2(e)}catch{return[]}}var Y2={viewMode:`diffing-plan-view-mode`,lastSingleViewMode:`diffing-plan-last-single-view-mode`,tocOpen:`diffing-plan-toc-open`,commentsRail:`diffing-plan-comments-rail`,decisionFilter:`diffing-plan-decision-filter`,splitRatio:`diffing-plan-split-ratio`,zenMode:`diffing-plan-zen-mode`};function X2(e,t,n){return t&&e===`split`?n:e}function Z2(e=`rendered`){try{let e=iD(Y2.lastSingleViewMode);if(e===`rendered`||e===`source`)return e}catch{}return e}function Q2(){if(typeof window>`u`)return!0;let e=window.innerWidth;return!(e>768&&e<=1024)}function $2(e,t){try{let t=iD(e);if(t===`true`)return!0;if(t===`false`)return!1}catch{}return t}function e4(e=50){try{let e=iD(Y2.splitRatio);if(e!=null&&e!==``){let t=Number(e);if(Number.isFinite(t))return t4(t)}}catch{}return t4(e)}function t4(e){return Math.max(20,Math.min(80,Math.round(e*10)/10))}function n4(e){let[t,n]=(0,q.useState)(()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(e).matches);return(0,q.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function r4(){return n4(`(max-width: 960px)`)}function i4(){return n4(`(max-width: 1024px)`)}var a4=300,o4=240,s4=12;function c4(e,t,n,r){let i=Math.max(a4,window.innerWidth-s4*2),a=Math.max(o4,window.innerHeight-s4*2),o=Math.min(Math.max(a4,n),i),s=Math.min(Math.max(o4,r),a),c=e,l=t;return c+o>window.innerWidth-s4&&(c=window.innerWidth-s4-o),l+s>window.innerHeight-s4&&(l=window.innerHeight-s4-s),c<s4&&(c=s4),l<s4&&(l=s4),o=Math.min(o,window.innerWidth-s4-c),s=Math.min(s,window.innerHeight-s4-l),o=Math.max(a4,o),s=Math.max(o4,s),{left:c,top:l,width:o,height:s}}function l4(e,t,n=400,r=420){let i=c4(e,t,n,r);return{left:i.left,top:i.top}}function u4(e){let t=window.scrollX,n=window.scrollY;return Array.from(e.getClientRects()).filter(e=>e.width>0&&e.height>0).map(e=>({top:e.top+n,left:e.left+t,width:e.width,height:e.height}))}function d4(e,t){return`plan-float:${e}:${t}`}function f4(e,t){let n=kW(d4(e,t));return!!(n&&n.trim())}function p4({planId:e,composers:t,onChange:n,onSubmit:r,planBody:i,buildSourceContext:a,renderedRootRef:o,layoutEpoch:s}){let c=(0,q.useRef)(null),l=(0,q.useRef)(null),[u,d]=(0,q.useState)(null),f=(0,q.useCallback)((e,t)=>{n(n=>n.map(n=>n.id===e?{...n,...t}:n))},[n]),p=(0,q.useMemo)(()=>{if(!i)return;let e=i.replace(/\r\n/g,`
3972
+ `).map(e=>e.trim()).find(e=>e.length>=3);if(!r)return[];let i=o.indexOf(r);if(i<0)return[];l=i,u=i+r.length}let d=s.find(e=>l>=e.start&&l<e.end),f=s.find(e=>u>e.start&&u<=e.end)??s.find(e=>u>e.start&&u-1<e.end);if(!d||!f)return[];try{let e=document.createRange();return e.setStart(d.node,l-d.start),e.setEnd(f.node,Math.min(f.node.textContent.length,u-f.start)),$2(e)}catch{return[]}}var t4={viewMode:`diffing-plan-view-mode`,lastSingleViewMode:`diffing-plan-last-single-view-mode`,tocOpen:`diffing-plan-toc-open`,commentsRail:`diffing-plan-comments-rail`,decisionFilter:`diffing-plan-decision-filter`,splitRatio:`diffing-plan-split-ratio`,zenMode:`diffing-plan-zen-mode`};function n4(e,t,n){return t&&e===`split`?n:e}function r4(e=`rendered`){try{let e=iD(t4.lastSingleViewMode);if(e===`rendered`||e===`source`)return e}catch{}return e}function i4(){if(typeof window>`u`)return!0;let e=window.innerWidth;return!(e>768&&e<=1024)}function a4(e,t){try{let t=iD(e);if(t===`true`)return!0;if(t===`false`)return!1}catch{}return t}function o4(e=50){try{let e=iD(t4.splitRatio);if(e!=null&&e!==``){let t=Number(e);if(Number.isFinite(t))return s4(t)}}catch{}return s4(e)}function s4(e){return Math.max(20,Math.min(80,Math.round(e*10)/10))}function c4(e){let[t,n]=(0,q.useState)(()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(e).matches);return(0,q.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function l4(){return c4(`(max-width: 960px)`)}function u4(){return c4(`(max-width: 1024px)`)}var d4=300,f4=240,p4=12;function m4(e,t,n,r){let i=Math.max(d4,window.innerWidth-p4*2),a=Math.max(f4,window.innerHeight-p4*2),o=Math.min(Math.max(d4,n),i),s=Math.min(Math.max(f4,r),a),c=e,l=t;return c+o>window.innerWidth-p4&&(c=window.innerWidth-p4-o),l+s>window.innerHeight-p4&&(l=window.innerHeight-p4-s),c<p4&&(c=p4),l<p4&&(l=p4),o=Math.min(o,window.innerWidth-p4-c),s=Math.min(s,window.innerHeight-p4-l),o=Math.max(d4,o),s=Math.max(f4,s),{left:c,top:l,width:o,height:s}}function h4(e,t,n=400,r=420){let i=m4(e,t,n,r);return{left:i.left,top:i.top}}function g4(e){let t=window.scrollX,n=window.scrollY;return Array.from(e.getClientRects()).filter(e=>e.width>0&&e.height>0).map(e=>({top:e.top+n,left:e.left+t,width:e.width,height:e.height}))}function _4(e,t){return`plan-float:${e}:${t}`}function v4(e,t){let n=kW(_4(e,t));return!!(n&&n.trim())}function y4({planId:e,composers:t,onChange:n,onSubmit:r,planBody:i,buildSourceContext:a,renderedRootRef:o,layoutEpoch:s}){let c=(0,q.useRef)(null),l=(0,q.useRef)(null),[u,d]=(0,q.useState)(null),f=(0,q.useCallback)((e,t)=>{n(n=>n.map(n=>n.id===e?{...n,...t}:n))},[n]),p=(0,q.useMemo)(()=>{if(!i)return;let e=i.replace(/\r\n/g,`
3970
3973
  `).split(`
3971
- `).length;return{min:1,max:Math.max(1,e)}},[i]),m=(0,q.useCallback)((e,t,n)=>{if(!i||!p)return;let r=QW({side:`additions`,lineNumber:e.lineNumber,startLineNumber:e.startLineNumber}),o=t===`start`?iG(r,n,p):aG(r,n,p),s=o.startLineNumber??o.lineNumber,c=o.lineNumber,l=A2(i,s,c);f(e.id,{lineNumber:c,startLineNumber:o.startLineNumber,exactLines:l,sourceContext:a?a(s,c):l})},[i,p,a,f]),h=(0,q.useCallback)(t=>{NW(d4(e,t)),n(e=>e.filter(e=>e.id!==t))},[n,e]),g=(0,q.useCallback)(n=>{let r=t.find(e=>e.id===n);if(r){if(f4(e,n)){d({id:n,quote:r.selectedQuote});return}h(n)}},[t,e,h]),_=(0,q.useCallback)(()=>{u&&(h(u.id),d(null))},[u,h]),v=(0,q.useCallback)((e,r)=>{if(r.target.closest(`button, input, textarea, select, a, .plan-float-resize`))return;let i=t.find(t=>t.id===e);if(!i||i.minimized)return;r.preventDefault(),c.current={id:e,startX:r.clientX,startY:r.clientY,origLeft:i.panelPos.left,origTop:i.panelPos.top};let a=t=>{if(!c.current||c.current.id!==e)return;let r=c.current.origLeft+(t.clientX-c.current.startX),i=c.current.origTop+(t.clientY-c.current.startY);n(t=>t.map(t=>{if(t.id!==e)return t;let n=t.panelSize??{width:400,height:420},a=c4(r,i,n.width,n.height);return{...t,panelPos:{left:a.left,top:a.top},panelSize:{width:a.width,height:a.height}}}))},o=()=>{c.current=null,window.removeEventListener(`mousemove`,a),window.removeEventListener(`mouseup`,o)};window.addEventListener(`mousemove`,a),window.addEventListener(`mouseup`,o)},[t,n]),y=(0,q.useCallback)((e,r,i)=>{i.preventDefault(),i.stopPropagation();let a=t.find(t=>t.id===e);if(!a||a.minimized)return;let o=a.panelSize??{width:400,height:420};l.current={id:e,edge:r,startX:i.clientX,startY:i.clientY,origLeft:a.panelPos.left,origTop:a.panelPos.top,origW:o.width,origH:o.height};let s=t=>{let r=l.current;if(!r||r.id!==e)return;let i=t.clientX-r.startX,a=t.clientY-r.startY,o=r.origLeft,s=r.origTop,c=r.origW,u=r.origH;r.edge.includes(`e`)&&(c=r.origW+i),r.edge.includes(`s`)&&(u=r.origH+a),r.edge.includes(`w`)&&(c=r.origW-i,o=r.origLeft+i),r.edge.includes(`n`)&&(u=r.origH-a,s=r.origTop+a),c<a4&&(r.edge.includes(`w`)&&(o=r.origLeft+r.origW-a4),c=a4),u<o4&&(r.edge.includes(`n`)&&(s=r.origTop+r.origH-o4),u=o4);let d=c4(o,s,c,u);n(t=>t.map(t=>t.id===e?{...t,panelPos:{left:d.left,top:d.top},panelSize:{width:d.width,height:d.height}}:t))},c=()=>{l.current=null,window.removeEventListener(`mousemove`,s),window.removeEventListener(`mouseup`,c)};window.addEventListener(`mousemove`,s),window.addEventListener(`mouseup`,c)},[t,n]);if((0,q.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let n=[...t].reverse().find(e=>!e.minimized);n&&(e.preventDefault(),e.stopPropagation(),g(n.id))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[t,g]),(0,q.useEffect)(()=>{if(t.length===0)return;let e=()=>{n(e=>e.map(e=>{let t=e.panelSize??{width:400,height:420},n=c4(e.panelPos.left,e.panelPos.top,t.width,t.height);return{...e,panelPos:{left:n.left,top:n.top},panelSize:{width:n.width,height:n.height}}}))};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[t.length,n]),(0,q.useEffect)(()=>{if(t.length===0)return;let e=o?.current;if(!e)return;let r=0,i=()=>{n(t=>{let n=!1,r=t.map(t=>{let r=(t.selectedQuote||t.exactLines||``).trim();if(!r)return t;let i=J2(e,r);return i.length===0||i.length===t.highlightRects.length&&i.every((e,n)=>{let r=t.highlightRects[n];return r&&Math.abs(r.top-e.top)<.5&&Math.abs(r.left-e.left)<.5&&Math.abs(r.width-e.width)<.5&&Math.abs(r.height-e.height)<.5})?t:(n=!0,{...t,highlightRects:i})});return n?r:t})};return r=requestAnimationFrame(()=>{r=requestAnimationFrame(i)}),()=>cancelAnimationFrame(r)},[s,t.length,o,n]),t.length===0||typeof document>`u`)return null;let b=t.filter(e=>e.minimized),x=t.filter(e=>!e.minimized),S=[`n`,`s`,`e`,`w`,`ne`,`nw`,`se`,`sw`];return(0,ix.createPortal)((0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`plan-float-highlights`,"aria-hidden":`true`,children:t.map(e=>e.highlightRects.map((t,n)=>(0,J.jsx)(`div`,{className:`plan-float-highlight`,style:{top:t.top,left:t.left,width:t.width,height:t.height}},`${e.id}-hl-${n}`)))}),x.map((t,a)=>{let o=t.sectionTitle,s=t.panelSize??{width:400,height:420};return(0,J.jsxs)(`div`,{className:`plan-selection-comment plan-selection-comment-floating`,role:`dialog`,"aria-label":`Add plan comment ${a+1}`,style:{left:t.panelPos.left,top:t.panelPos.top,width:s.width,height:s.height,zIndex:110+a},children:[S.map(e=>(0,J.jsx)(`div`,{className:`plan-float-resize plan-float-resize-${e}`,onMouseDown:n=>y(t.id,e,n),"aria-hidden":`true`},e)),(0,J.jsxs)(`div`,{className:`plan-selection-comment-drag`,onMouseDown:e=>v(t.id,e),title:`Drag to move`,children:[(0,J.jsx)(tO,{size:14,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{className:`plan-selection-comment-meta`,children:[`Commenting on`,` `,t.startLineNumber&&t.startLineNumber!==t.lineNumber?`L${t.startLineNumber}–L${t.lineNumber}`:`L${t.lineNumber}`,o?` · § ${o}`:``]}),(0,J.jsx)(`button`,{type:`button`,className:`plan-selection-comment-close`,"aria-label":`Minimize`,title:`Minimize`,onClick:()=>f(t.id,{minimized:!0}),children:(0,J.jsx)(vO,{size:14})}),(0,J.jsx)(`button`,{type:`button`,className:`plan-selection-comment-close`,"aria-label":`Close comment form`,title:`Close (Esc)`,onClick:()=>g(t.id),children:(0,J.jsx)(WO,{size:14})})]}),(0,J.jsxs)(`div`,{className:`plan-selection-comment-body`,children:[(0,J.jsxs)(`div`,{className:`plan-selection-comment-context`,children:[t.selectedQuote.trim()?(0,J.jsxs)(`blockquote`,{className:`plan-comment-quote`,cite:`L${t.lineNumber}`,children:[`“`,t.selectedQuote.trim(),`”`]}):null,(0,J.jsx)(`pre`,{className:`plan-comment-source`,"aria-label":`Source context for agent`,children:t.sourceContext||t.exactLines||`(no source lines)`})]}),(0,J.jsx)(`div`,{className:`plan-selection-comment-form`,children:(0,J.jsx)(RW,{draftKey:d4(e,t.id),lineContent:t.exactLines,lineLabel:t.startLineNumber&&t.startLineNumber!==t.lineNumber?`L${t.startLineNumber}–L${t.lineNumber} · source`:`L${t.lineNumber} · source`,showSeverity:!0,range:i&&p?(()=>{let e=QW({side:`additions`,lineNumber:t.lineNumber,startLineNumber:t.startLineNumber}),n=nG(e);return{start:n.start,end:n.end,sideLabel:`source`,canAdjustStart:t=>oG(e,t,p),canAdjustEnd:t=>sG(e,t,p)}})():void 0,onAdjustStart:i?e=>m(t,`start`,e):void 0,onAdjustEnd:i?e=>m(t,`end`,e):void 0,onSubmit:(i,a)=>{r(t,i,a),NW(d4(e,t.id)),n(e=>e.filter(e=>e.id!==t.id))},onCancel:()=>g(t.id)})})]})]},t.id)}),b.length>0&&(0,J.jsx)(`div`,{className:`plan-float-tray`,role:`toolbar`,"aria-label":`Minimized comment drafts`,children:b.map(e=>(0,J.jsxs)(`div`,{className:`plan-float-tray-chip-wrap`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`plan-float-tray-chip`,title:e.selectedQuote,onClick:()=>f(e.id,{minimized:!1}),children:[(0,J.jsx)(pO,{size:12,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{className:`plan-float-tray-line`,children:[`L`,e.startLineNumber&&e.startLineNumber!==e.lineNumber?`${e.startLineNumber}–${e.lineNumber}`:e.lineNumber]}),(0,J.jsxs)(`span`,{className:`plan-float-tray-quote`,children:[e.selectedQuote.slice(0,28),e.selectedQuote.length>28?`…`:``]}),(0,J.jsx)(uO,{size:12,"aria-hidden":`true`})]}),(0,J.jsx)(`button`,{type:`button`,className:`plan-float-tray-close`,"aria-label":`Close draft`,title:`Close`,onClick:()=>g(e.id),children:(0,J.jsx)(WO,{size:12})})]},e.id))}),(0,J.jsx)(LH,{open:!!u,title:`Discard comment draft?`,description:`Unsaved text in this floating comment will be lost.`,detail:u?.quote?`“${u.quote.slice(0,120)}${u.quote.length>120?`…`:``}”`:void 0,confirmLabel:`Discard`,cancelLabel:`Keep editing`,variant:`danger`,onConfirm:_,onCancel:()=>d(null)})]}),document.body)}function m4(e,t){if(!e||t<=0)return 1;let n=Math.min(t,e.length),r=1;for(let t=0;t<n;t++)e.charCodeAt(t)===10&&r++;return r}function h4(e,t){if(!e.length||t<1)return null;for(let n of e)if(t>=n.startLine&&t<=n.endLine)return n;let n=null,r=1/0;for(let i of e){let e=t<i.startLine?i.startLine-t:t>i.endLine?t-i.endLine:0;e<r&&(r=e,n=i)}return n}function g4(e,t){let n=e.endLine-e.startLine;if(n<=0)return 0;let r=(t-e.startLine)/n;return Math.max(0,Math.min(1,r))}function _4(e){if(!e||typeof window>`u`)return null;let t=e.parentElement;for(;t&&t!==document.body&&t!==document.documentElement;){let e=window.getComputedStyle(t).overflowY,n=e===`auto`||e===`scroll`||e===`overlay`;if(n&&t.scrollHeight>t.clientHeight+1||n&&(t.classList.contains(`plan-rendered-layout`)||t.classList.contains(`plan-file`)||t.hasAttribute(`data-plan-scroll-pane`)))return t;t=t.parentElement}return null}function v4(e,t,n,r){let i=e.getBoundingClientRect(),a=t.getBoundingClientRect(),o=Math.max(0,Math.min(1,n)),s=a.top-i.top+e.scrollTop+a.height*o;return Math.max(0,s-r)}function y4(e,t,n,r=48){let i=e.getBoundingClientRect(),a=t.getBoundingClientRect(),o=Math.max(0,Math.min(1,n)),s=a.top+a.height*o;return s>=i.top+r&&s<=i.bottom-r}function b4(e){if(!e)return[];let t=e.querySelectorAll(`[data-plan-source-start]`),n=[];for(let e of t){let t=Number(e.getAttribute(`data-plan-source-start`)),r=Number(e.getAttribute(`data-plan-source-end`)??t);!Number.isFinite(t)||t<1||n.push({startLine:t,endLine:Number.isFinite(r)&&r>=t?r:t,element:e})}return n.sort((e,t)=>e.startLine-t.startLine),n}function x4(e,t,n={}){let{scrollContainer:r=null,onlyIfOutOfView:i=!0,behavior:a=`auto`}=n,o=b4(e);if(!o.length)return!1;let s=h4(o.map(({startLine:e,endLine:t})=>({startLine:e,endLine:t})),t);if(!s)return!1;let c=o.find(e=>e.startLine===s.startLine&&e.endLine===s.endLine);if(!c)return!1;let l=r??_4(c.element)??c.element.closest(`.plan-rendered-layout`);if(!l||l===document.documentElement||l===document.body)return!1;let u=g4(s,t);if(i&&y4(l,c.element,u))return!1;let d=n.anchorY??Math.max(32,Math.round(l.clientHeight*.22)),f=v4(l,c.element,u,d),p=Math.max(0,l.scrollHeight-l.clientHeight),m=Math.max(0,Math.min(p,f));return Math.abs(l.scrollTop-m)<1?!1:(a===`smooth`&&typeof l.scrollTo==`function`?l.scrollTo({top:m,behavior:`smooth`}):l.scrollTop=m,!0)}function S4({value:e,onChange:t,onActiveLineChange:n,fontSize:r,monoFontFamily:i,defaultTabSize:a,lineWrap:o,showLineNumbers:s,ariaLabel:c=`Plan source editor`,className:l}){let u=(0,q.useRef)(null),d=(0,q.useRef)(null),f=(0,q.useRef)(1),p=(0,q.useMemo)(()=>e?e.replace(/\r\n/g,`
3974
+ `).length;return{min:1,max:Math.max(1,e)}},[i]),m=(0,q.useCallback)((e,t,n)=>{if(!i||!p)return;let r=eG({side:`additions`,lineNumber:e.lineNumber,startLineNumber:e.startLineNumber}),o=t===`start`?oG(r,n,p):sG(r,n,p),s=o.startLineNumber??o.lineNumber,c=o.lineNumber,l=N2(i,s,c);f(e.id,{lineNumber:c,startLineNumber:o.startLineNumber,exactLines:l,sourceContext:a?a(s,c):l})},[i,p,a,f]),h=(0,q.useCallback)(t=>{NW(_4(e,t)),n(e=>e.filter(e=>e.id!==t))},[n,e]),g=(0,q.useCallback)(n=>{let r=t.find(e=>e.id===n);if(r){if(v4(e,n)){d({id:n,quote:r.selectedQuote});return}h(n)}},[t,e,h]),_=(0,q.useCallback)(()=>{u&&(h(u.id),d(null))},[u,h]),v=(0,q.useCallback)((e,r)=>{if(r.target.closest(`button, input, textarea, select, a, .plan-float-resize`))return;let i=t.find(t=>t.id===e);if(!i||i.minimized)return;r.preventDefault(),c.current={id:e,startX:r.clientX,startY:r.clientY,origLeft:i.panelPos.left,origTop:i.panelPos.top};let a=t=>{if(!c.current||c.current.id!==e)return;let r=c.current.origLeft+(t.clientX-c.current.startX),i=c.current.origTop+(t.clientY-c.current.startY);n(t=>t.map(t=>{if(t.id!==e)return t;let n=t.panelSize??{width:400,height:420},a=m4(r,i,n.width,n.height);return{...t,panelPos:{left:a.left,top:a.top},panelSize:{width:a.width,height:a.height}}}))},o=()=>{c.current=null,window.removeEventListener(`mousemove`,a),window.removeEventListener(`mouseup`,o)};window.addEventListener(`mousemove`,a),window.addEventListener(`mouseup`,o)},[t,n]),y=(0,q.useCallback)((e,r,i)=>{i.preventDefault(),i.stopPropagation();let a=t.find(t=>t.id===e);if(!a||a.minimized)return;let o=a.panelSize??{width:400,height:420};l.current={id:e,edge:r,startX:i.clientX,startY:i.clientY,origLeft:a.panelPos.left,origTop:a.panelPos.top,origW:o.width,origH:o.height};let s=t=>{let r=l.current;if(!r||r.id!==e)return;let i=t.clientX-r.startX,a=t.clientY-r.startY,o=r.origLeft,s=r.origTop,c=r.origW,u=r.origH;r.edge.includes(`e`)&&(c=r.origW+i),r.edge.includes(`s`)&&(u=r.origH+a),r.edge.includes(`w`)&&(c=r.origW-i,o=r.origLeft+i),r.edge.includes(`n`)&&(u=r.origH-a,s=r.origTop+a),c<d4&&(r.edge.includes(`w`)&&(o=r.origLeft+r.origW-d4),c=d4),u<f4&&(r.edge.includes(`n`)&&(s=r.origTop+r.origH-f4),u=f4);let d=m4(o,s,c,u);n(t=>t.map(t=>t.id===e?{...t,panelPos:{left:d.left,top:d.top},panelSize:{width:d.width,height:d.height}}:t))},c=()=>{l.current=null,window.removeEventListener(`mousemove`,s),window.removeEventListener(`mouseup`,c)};window.addEventListener(`mousemove`,s),window.addEventListener(`mouseup`,c)},[t,n]);if((0,q.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let n=[...t].reverse().find(e=>!e.minimized);n&&(e.preventDefault(),e.stopPropagation(),g(n.id))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[t,g]),(0,q.useEffect)(()=>{if(t.length===0)return;let e=()=>{n(e=>e.map(e=>{let t=e.panelSize??{width:400,height:420},n=m4(e.panelPos.left,e.panelPos.top,t.width,t.height);return{...e,panelPos:{left:n.left,top:n.top},panelSize:{width:n.width,height:n.height}}}))};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[t.length,n]),(0,q.useEffect)(()=>{if(t.length===0)return;let e=o?.current;if(!e)return;let r=0,i=()=>{n(t=>{let n=!1,r=t.map(t=>{let r=(t.selectedQuote||t.exactLines||``).trim();if(!r)return t;let i=e4(e,r);return i.length===0||i.length===t.highlightRects.length&&i.every((e,n)=>{let r=t.highlightRects[n];return r&&Math.abs(r.top-e.top)<.5&&Math.abs(r.left-e.left)<.5&&Math.abs(r.width-e.width)<.5&&Math.abs(r.height-e.height)<.5})?t:(n=!0,{...t,highlightRects:i})});return n?r:t})};return r=requestAnimationFrame(()=>{r=requestAnimationFrame(i)}),()=>cancelAnimationFrame(r)},[s,t.length,o,n]),t.length===0||typeof document>`u`)return null;let b=t.filter(e=>e.minimized),x=t.filter(e=>!e.minimized),S=[`n`,`s`,`e`,`w`,`ne`,`nw`,`se`,`sw`];return(0,ix.createPortal)((0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`plan-float-highlights`,"aria-hidden":`true`,children:t.map(e=>e.highlightRects.map((t,n)=>(0,J.jsx)(`div`,{className:`plan-float-highlight`,style:{top:t.top,left:t.left,width:t.width,height:t.height}},`${e.id}-hl-${n}`)))}),x.map((t,a)=>{let o=t.sectionTitle,s=t.panelSize??{width:400,height:420};return(0,J.jsxs)(`div`,{className:`plan-selection-comment plan-selection-comment-floating`,role:`dialog`,"aria-label":`Add plan comment ${a+1}`,style:{left:t.panelPos.left,top:t.panelPos.top,width:s.width,height:s.height,zIndex:110+a},children:[S.map(e=>(0,J.jsx)(`div`,{className:`plan-float-resize plan-float-resize-${e}`,onMouseDown:n=>y(t.id,e,n),"aria-hidden":`true`},e)),(0,J.jsxs)(`div`,{className:`plan-selection-comment-drag`,onMouseDown:e=>v(t.id,e),title:`Drag to move`,children:[(0,J.jsx)(tO,{size:14,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{className:`plan-selection-comment-meta`,children:[`Commenting on`,` `,t.startLineNumber&&t.startLineNumber!==t.lineNumber?`L${t.startLineNumber}–L${t.lineNumber}`:`L${t.lineNumber}`,o?` · § ${o}`:``]}),(0,J.jsx)(`button`,{type:`button`,className:`plan-selection-comment-close`,"aria-label":`Minimize`,title:`Minimize`,onClick:()=>f(t.id,{minimized:!0}),children:(0,J.jsx)(vO,{size:14})}),(0,J.jsx)(`button`,{type:`button`,className:`plan-selection-comment-close`,"aria-label":`Close comment form`,title:`Close (Esc)`,onClick:()=>g(t.id),children:(0,J.jsx)(WO,{size:14})})]}),(0,J.jsxs)(`div`,{className:`plan-selection-comment-body`,children:[(0,J.jsxs)(`div`,{className:`plan-selection-comment-context`,children:[t.selectedQuote.trim()?(0,J.jsxs)(`blockquote`,{className:`plan-comment-quote`,cite:`L${t.lineNumber}`,children:[`“`,t.selectedQuote.trim(),`”`]}):null,(0,J.jsx)(`pre`,{className:`plan-comment-source`,"aria-label":`Source context for agent`,children:t.sourceContext||t.exactLines||`(no source lines)`})]}),(0,J.jsx)(`div`,{className:`plan-selection-comment-form`,children:(0,J.jsx)(RW,{draftKey:_4(e,t.id),lineContent:t.exactLines,lineLabel:t.startLineNumber&&t.startLineNumber!==t.lineNumber?`L${t.startLineNumber}–L${t.lineNumber} · source`:`L${t.lineNumber} · source`,showSeverity:!0,range:i&&p?(()=>{let e=eG({side:`additions`,lineNumber:t.lineNumber,startLineNumber:t.startLineNumber}),n=iG(e);return{start:n.start,end:n.end,sideLabel:`source`,canAdjustStart:t=>cG(e,t,p),canAdjustEnd:t=>lG(e,t,p)}})():void 0,onAdjustStart:i?e=>m(t,`start`,e):void 0,onAdjustEnd:i?e=>m(t,`end`,e):void 0,onSubmit:(i,a)=>{r(t,i,a),NW(_4(e,t.id)),n(e=>e.filter(e=>e.id!==t.id))},onCancel:()=>g(t.id)})})]})]},t.id)}),b.length>0&&(0,J.jsx)(`div`,{className:`plan-float-tray`,role:`toolbar`,"aria-label":`Minimized comment drafts`,children:b.map(e=>(0,J.jsxs)(`div`,{className:`plan-float-tray-chip-wrap`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`plan-float-tray-chip`,title:e.selectedQuote,onClick:()=>f(e.id,{minimized:!1}),children:[(0,J.jsx)(pO,{size:12,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{className:`plan-float-tray-line`,children:[`L`,e.startLineNumber&&e.startLineNumber!==e.lineNumber?`${e.startLineNumber}–${e.lineNumber}`:e.lineNumber]}),(0,J.jsxs)(`span`,{className:`plan-float-tray-quote`,children:[e.selectedQuote.slice(0,28),e.selectedQuote.length>28?`…`:``]}),(0,J.jsx)(uO,{size:12,"aria-hidden":`true`})]}),(0,J.jsx)(`button`,{type:`button`,className:`plan-float-tray-close`,"aria-label":`Close draft`,title:`Close`,onClick:()=>g(e.id),children:(0,J.jsx)(WO,{size:12})})]},e.id))}),(0,J.jsx)(LH,{open:!!u,title:`Discard comment draft?`,description:`Unsaved text in this floating comment will be lost.`,detail:u?.quote?`“${u.quote.slice(0,120)}${u.quote.length>120?`…`:``}”`:void 0,confirmLabel:`Discard`,cancelLabel:`Keep editing`,variant:`danger`,onConfirm:_,onCancel:()=>d(null)})]}),document.body)}function b4(e,t){if(!e||t<=0)return 1;let n=Math.min(t,e.length),r=1;for(let t=0;t<n;t++)e.charCodeAt(t)===10&&r++;return r}function x4(e,t){if(!e.length||t<1)return null;for(let n of e)if(t>=n.startLine&&t<=n.endLine)return n;let n=null,r=1/0;for(let i of e){let e=t<i.startLine?i.startLine-t:t>i.endLine?t-i.endLine:0;e<r&&(r=e,n=i)}return n}function S4(e,t){let n=e.endLine-e.startLine;if(n<=0)return 0;let r=(t-e.startLine)/n;return Math.max(0,Math.min(1,r))}function C4(e){if(!e||typeof window>`u`)return null;let t=e.parentElement;for(;t&&t!==document.body&&t!==document.documentElement;){let e=window.getComputedStyle(t).overflowY,n=e===`auto`||e===`scroll`||e===`overlay`;if(n&&t.scrollHeight>t.clientHeight+1||n&&(t.classList.contains(`plan-rendered-layout`)||t.classList.contains(`plan-file`)||t.hasAttribute(`data-plan-scroll-pane`)))return t;t=t.parentElement}return null}function w4(e,t,n,r){let i=e.getBoundingClientRect(),a=t.getBoundingClientRect(),o=Math.max(0,Math.min(1,n)),s=a.top-i.top+e.scrollTop+a.height*o;return Math.max(0,s-r)}function T4(e,t,n,r=48){let i=e.getBoundingClientRect(),a=t.getBoundingClientRect(),o=Math.max(0,Math.min(1,n)),s=a.top+a.height*o;return s>=i.top+r&&s<=i.bottom-r}function E4(e){if(!e)return[];let t=e.querySelectorAll(`[data-plan-source-start]`),n=[];for(let e of t){let t=Number(e.getAttribute(`data-plan-source-start`)),r=Number(e.getAttribute(`data-plan-source-end`)??t);!Number.isFinite(t)||t<1||n.push({startLine:t,endLine:Number.isFinite(r)&&r>=t?r:t,element:e})}return n.sort((e,t)=>e.startLine-t.startLine),n}function D4(e,t,n={}){let{scrollContainer:r=null,onlyIfOutOfView:i=!0,behavior:a=`auto`}=n,o=E4(e);if(!o.length)return!1;let s=x4(o.map(({startLine:e,endLine:t})=>({startLine:e,endLine:t})),t);if(!s)return!1;let c=o.find(e=>e.startLine===s.startLine&&e.endLine===s.endLine);if(!c)return!1;let l=r??C4(c.element)??c.element.closest(`.plan-rendered-layout`);if(!l||l===document.documentElement||l===document.body)return!1;let u=S4(s,t);if(i&&T4(l,c.element,u))return!1;let d=n.anchorY??Math.max(32,Math.round(l.clientHeight*.22)),f=w4(l,c.element,u,d),p=Math.max(0,l.scrollHeight-l.clientHeight),m=Math.max(0,Math.min(p,f));return Math.abs(l.scrollTop-m)<1?!1:(a===`smooth`&&typeof l.scrollTo==`function`?l.scrollTo({top:m,behavior:`smooth`}):l.scrollTop=m,!0)}function O4({value:e,onChange:t,onActiveLineChange:n,fontSize:r,monoFontFamily:i,defaultTabSize:a,lineWrap:o,showLineNumbers:s,ariaLabel:c=`Plan source editor`,className:l}){let u=(0,q.useRef)(null),d=(0,q.useRef)(null),f=(0,q.useRef)(1),p=(0,q.useMemo)(()=>e?e.replace(/\r\n/g,`
3972
3975
  `).split(`
3973
- `).length:1,[e]),m=(0,q.useMemo)(()=>{let e=Math.max(1,p),t=``;for(let n=1;n<=e;n++)t+=n===e?String(n):`${n}\n`;return t},[p]),h=(0,q.useCallback)(()=>{let e=u.current;if(!e||!n)return;let t=m4(e.value,e.selectionStart??0);t!==f.current&&(f.current=t,n(t))},[n]),g=(0,q.useCallback)(()=>{let e=u.current,t=d.current;!e||!t||(t.scrollTop=e.scrollTop)},[]);(0,q.useEffect)(()=>{h()},[e,h]);let _=e=>{t(e.target.value),requestAnimationFrame(h)},v=n=>{if(n.key!==`Tab`||n.metaKey||n.ctrlKey||n.altKey)return;n.preventDefault();let r=n.currentTarget,i=r.selectionStart,a=r.selectionEnd;t(e.slice(0,i)+` `+e.slice(a)),requestAnimationFrame(()=>{if(!u.current)return;let e=i+1;u.current.selectionStart=e,u.current.selectionEnd=e,h()})},y=Math.round(r*1.7),b=Math.max(2.5,String(p).length+1.25);return(0,J.jsxs)(`div`,{className:[`plan-source-editor`,l].filter(Boolean).join(` `),style:{"--plan-editor-font-size":`${r}px`,"--plan-editor-font-family":i,"--plan-editor-line-height":`${y}px`,"--plan-editor-tab-size":String(a),"--plan-editor-gutter-ch":`${b}ch`},children:[s&&(0,J.jsx)(`div`,{ref:d,className:`plan-source-editor-gutter`,"aria-hidden":`true`,children:(0,J.jsx)(`pre`,{className:`plan-source-editor-gutter-text`,children:m})}),(0,J.jsx)(`textarea`,{ref:u,className:`plan-source-editor-textarea ${o?`is-wrap`:`is-scroll`}`,value:e,onChange:_,onKeyDown:v,onKeyUp:h,onClick:h,onSelect:h,onScroll:g,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-label":c,wrap:o?`soft`:`off`})]})}function C4({open:e,canDiscardRecent:t,canRollbackOriginal:n,onChoose:r,onCancel:i,busy:a=!1}){let o=t&&n,s=t&&!n,c=n&&!t;return(0,J.jsxs)(IH,{open:e,onClose:i,className:`confirm-dialog plan-discard-dialog`,ariaLabel:`Discard plan edits`,children:[(0,J.jsxs)(`div`,{className:`confirm-dialog-header`,children:[(0,J.jsx)(`span`,{className:`confirm-dialog-icon confirm-dialog-icon-danger`,"aria-hidden":`true`,children:(0,J.jsx)(BO,{size:18})}),(0,J.jsx)(`h2`,{className:`confirm-dialog-title`,children:o?`Discard which edits?`:c?`Roll back to original?`:`Discard edits?`})]}),o?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`confirm-dialog-desc`,children:`You have edits from this session, and earlier changes already saved on this version. Choose how far to roll back. This cannot be undone.`}),(0,J.jsxs)(`div`,{className:`plan-discard-choices`,role:`group`,"aria-label":`Discard options`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`plan-discard-choice`,disabled:a,onClick:()=>r(`recent`),autoFocus:!0,children:[(0,J.jsx)(`span`,{className:`plan-discard-choice-icon`,"aria-hidden":`true`,children:(0,J.jsx)(jO,{size:16})}),(0,J.jsxs)(`span`,{className:`plan-discard-choice-text`,children:[(0,J.jsx)(`span`,{className:`plan-discard-choice-title`,children:`Discard recent edits`}),(0,J.jsx)(`span`,{className:`plan-discard-choice-desc`,children:`Restore to when you started this edit session. Keeps earlier saved edits.`})]})]}),(0,J.jsxs)(`button`,{type:`button`,className:`plan-discard-choice plan-discard-choice-danger`,disabled:a,onClick:()=>r(`original`),children:[(0,J.jsx)(`span`,{className:`plan-discard-choice-icon`,"aria-hidden":`true`,children:(0,J.jsx)(nO,{size:16})}),(0,J.jsxs)(`span`,{className:`plan-discard-choice-text`,children:[(0,J.jsx)(`span`,{className:`plan-discard-choice-title`,children:`Roll back to original`}),(0,J.jsx)(`span`,{className:`plan-discard-choice-desc`,children:`Restore the plan to before you started editing this version at all.`})]})]})]})]}):c?(0,J.jsx)(`p`,{className:`confirm-dialog-desc`,children:`Earlier edits from a previous session were saved into this version. Roll back to the plan as it was before you started editing? This cannot be undone.`}):(0,J.jsx)(`p`,{className:`confirm-dialog-desc`,children:`Restore the plan body and title to when you started this edit session. This undoes unsaved changes and any autosaves from this session. This cannot be undone.`}),(0,J.jsxs)(`div`,{className:`confirm-dialog-footer plan-discard-footer`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`btn btn-sm confirm-dialog-cancel`,onClick:i,disabled:a,children:[(0,J.jsx)(WO,{size:13,"aria-hidden":`true`}),`Keep editing`]}),!o&&(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm confirm-dialog-confirm confirm-dialog-confirm-danger`,onClick:()=>r(c?`original`:`recent`),disabled:a||!s&&!c,autoFocus:!0,children:c?`Roll back to original`:`Discard all edits`})]})]})}var w4=700;function T4(e){return QW({side:`additions`,lineNumber:e.lineNumber,startLineNumber:e.startLineNumber})}function E4(e){let t=QW(e);return t.startLineNumber!=null&&t.startLineNumber!==t.lineNumber?{lineNumber:t.lineNumber,startLineNumber:t.startLineNumber}:{lineNumber:t.lineNumber}}var D4={pending:{label:`Pending review`,className:`plan-badge-pending`,icon:RD},approved:{label:`Approved`,className:`plan-badge-approved`,icon:wD},"changes-requested":{label:`Changes requested`,className:`plan-badge-changes`,icon:mO},rejected:{label:`Rejected`,className:`plan-badge-rejected`,icon:WO},"comment-only":{label:`Comment only`,className:`plan-badge-comment-only`,icon:hO}};function O4({plan:e,theme:t,fontSize:n,monoFontFamily:r,defaultTabSize:i,lineWrap:a,showLineNumbers:o,lineHoverHighlight:s,viewMode:c,onViewModeChange:l,editorIDE:u,tocOpen:d,onTocOpenChange:f,commentsRailOpen:p,onCommentsRailOpenChange:m,zenMode:h,onZenModeChange:g}){let{addPlanComment:_,editPlanComment:v,resolvePlanComment:y,unresolvePlanComment:b,removePlanComment:x,addPlanReply:S,editPlanReply:C,removePlanReply:w,updatePlan:T,submitPlanVersion:E,submittingPlanVersion:D}=OE(),[O,k]=(0,q.useState)(null),A=(0,q.useRef)(null),[j,M]=(0,q.useState)([]),[N,P]=(0,q.useState)(null),[F,I]=(0,q.useState)(0),[L,R]=(0,q.useState)(null),[z,B]=(0,q.useState)(null),[V,H]=(0,q.useState)(()=>$2(Y2.tocOpen,!0)),[U,W]=(0,q.useState)(()=>$2(Y2.commentsRail,Q2())),ee=d??V,te=p??U,ne=i4(),re=(0,q.useCallback)(e=>{let t=typeof e==`function`?e(ee):e;f?f(t):(H(t),cD(Y2.tocOpen,String(t)))},[ee,f]),ie=(0,q.useCallback)(e=>{let t=typeof e==`function`?e(te):e;m?m(t):(W(t),cD(Y2.commentsRail,String(t)))},[te,m]),[ae,oe]=(0,q.useState)(!1),[G,se]=(0,q.useState)(!1),[K,ce]=(0,q.useState)(e.body),[le,ue]=(0,q.useState)(e.title),[de,fe]=(0,q.useState)(`idle`),[pe,me]=(0,q.useState)(null),[he,ge]=(0,q.useState)(null),[_e,ve]=(0,q.useState)(!1),[ye,be]=(0,q.useState)(!1),[xe,Se]=(0,q.useState)(!1),[Ce,we]=(0,q.useState)(!1),[Te,Ee]=(0,q.useState)(1),De=(0,q.useRef)(null),Oe=(0,q.useRef)({body:e.body,title:e.title,version:e.version}),[ke,Ae]=(0,q.useState)({body:e.body,title:e.title}),[je,Me]=(0,q.useState)(null),Ne=(0,q.useRef)(async()=>{}),[Pe,Fe]=(0,q.useState)(null),Ie=(0,q.useRef)(null),Le=(0,q.useRef)(null),Re=(0,q.useRef)(null),ze=(0,q.useRef)(50),[Be,Ve]=(0,q.useState)(()=>e4(50)),[He,Ue]=(0,q.useState)(!1),[We,Ge]=(0,q.useState)(()=>$2(Y2.zenMode,!1)),Ke=h??We;ze.current=Be;let qe=c===`source`||c===`split`,Je=c===`rendered`||c===`split`,Ye=qe&&Je,Xe=c===`rendered`,Ze=Xe&&Ke,Qe=(0,q.useCallback)(e=>{let t=typeof e==`function`?e(Ke):e;g?g(t):(Ge(t),cD(Y2.zenMode,String(t)))},[Ke,g]),$e=e.versions??[],[et,tt]=(0,q.useState)(e.version),[nt,rt]=(0,q.useState)(e.body),[it,at]=(0,q.useState)(e.title),ot=(0,q.useRef)(`${e.id}:${e.version}`);(0,q.useEffect)(()=>{let t=`${e.id}:${e.version}`;ot.current!==t&&(ot.current=t,Me(null),we(!1))},[e.id,e.version]);let st=(0,q.useRef)(e.version);(0,q.useEffect)(()=>{if(e.version===st.current)return;let t=st.current;st.current=e.version;let n=et===t,r=G&&(K!==Oe.current.body||le!==Oe.current.title);if(G&&r){ge(e.version);return}G&&!r&&(ce(e.body),ue(e.title),Oe.current={body:e.body,title:e.title,version:e.version},Ae({body:e.body,title:e.title}),Me(null),fe(`idle`),ge(null)),n&&tt(e.version)},[e.version,e.body,e.title,et,G,K,le]),(0,q.useEffect)(()=>{let t=!1;if(G&&et===e.version)return;if(et===e.version){rt(e.body),at(e.title);return}let n=$e.find(e=>e.version===et);if(n){rt(n.body),at(n.title);return}return fetch(`/api/plans/${e.id}/versions/${et}`).then(e=>e.ok?e.json():null).then(e=>{t||!e?.version||(rt(e.version.body),at(e.version.title))}).catch(()=>{}),()=>{t=!0}},[et,e.version,e.body,e.title,e.id,$e,G]),(0,q.useEffect)(()=>{P(null),I(0),k(null),M([])},[et]);let ct=et!==e.version,lt=!ct,ut=G&&lt?K:nt,dt=G&&lt?le:it,ft=G&&(K!==Oe.current.body||le!==Oe.current.title),pt=G&&(K!==ke.body||le!==ke.title||e.body!==ke.body||e.title!==ke.title),mt=G&&!!je&&(K!==je.body||le!==je.title||e.body!==je.body||e.title!==je.title),ht=!!je&&(je.body!==ke.body||je.title!==ke.title),gt=ht&&pt&&mt,_t=pt||mt,vt=(0,q.useMemo)(()=>$e.map(t=>({value:String(t.version),label:t.version===e.version?`v${t.version} (current)`:`v${t.version}`})),[$e,e.version]),yt=e=>{let t=e.target.closest(`a`);if(t){let n=t.getAttribute(`href`);n&&n.startsWith(`file:///`)&&(e.preventDefault(),R(n.replace(`file://`,``)))}},bt=LT[t]||LT[`rose-pine`],xt=(0,q.useMemo)(()=>k4(i,n,r),[i,n,r]),St=e.comments??[],Ct=ct?St.filter(e=>e.createdAtPlanVersion===et):St,wt=Ct.filter(e=>e.lineNumber>0),Tt=Ct.filter(e=>e.lineNumber===0),Et=Ct.filter(e=>e.status===`open`).length,Dt=St.length,Ot=(e,t)=>A2(ut,e??t,t),kt=(0,q.useCallback)(e=>{let t=E4(T4(e));A.current||=crypto.randomUUID(),k(t),P(rG(T4(t))),I(0)},[]),At=(0,q.useCallback)(()=>{k(null),P(null),I(0),A.current=null},[]),jt=(0,q.useMemo)(()=>{let e=ut.replace(/\r\n/g,`
3976
+ `).length:1,[e]),m=(0,q.useMemo)(()=>{let e=Math.max(1,p),t=``;for(let n=1;n<=e;n++)t+=n===e?String(n):`${n}\n`;return t},[p]),h=(0,q.useCallback)(()=>{let e=u.current;if(!e||!n)return;let t=b4(e.value,e.selectionStart??0);t!==f.current&&(f.current=t,n(t))},[n]),g=(0,q.useCallback)(()=>{let e=u.current,t=d.current;!e||!t||(t.scrollTop=e.scrollTop)},[]);(0,q.useEffect)(()=>{h()},[e,h]);let _=e=>{t(e.target.value),requestAnimationFrame(h)},v=n=>{if(n.key!==`Tab`||n.metaKey||n.ctrlKey||n.altKey)return;n.preventDefault();let r=n.currentTarget,i=r.selectionStart,a=r.selectionEnd;t(e.slice(0,i)+` `+e.slice(a)),requestAnimationFrame(()=>{if(!u.current)return;let e=i+1;u.current.selectionStart=e,u.current.selectionEnd=e,h()})},y=Math.round(r*1.7),b=Math.max(2.5,String(p).length+1.25);return(0,J.jsxs)(`div`,{className:[`plan-source-editor`,l].filter(Boolean).join(` `),style:{"--plan-editor-font-size":`${r}px`,"--plan-editor-font-family":i,"--plan-editor-line-height":`${y}px`,"--plan-editor-tab-size":String(a),"--plan-editor-gutter-ch":`${b}ch`},children:[s&&(0,J.jsx)(`div`,{ref:d,className:`plan-source-editor-gutter`,"aria-hidden":`true`,children:(0,J.jsx)(`pre`,{className:`plan-source-editor-gutter-text`,children:m})}),(0,J.jsx)(`textarea`,{ref:u,className:`plan-source-editor-textarea ${o?`is-wrap`:`is-scroll`}`,value:e,onChange:_,onKeyDown:v,onKeyUp:h,onClick:h,onSelect:h,onScroll:g,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-label":c,wrap:o?`soft`:`off`})]})}function k4({open:e,canDiscardRecent:t,canRollbackOriginal:n,onChoose:r,onCancel:i,busy:a=!1}){let o=t&&n,s=t&&!n,c=n&&!t;return(0,J.jsxs)(IH,{open:e,onClose:i,className:`confirm-dialog plan-discard-dialog`,ariaLabel:`Discard plan edits`,children:[(0,J.jsxs)(`div`,{className:`confirm-dialog-header`,children:[(0,J.jsx)(`span`,{className:`confirm-dialog-icon confirm-dialog-icon-danger`,"aria-hidden":`true`,children:(0,J.jsx)(BO,{size:18})}),(0,J.jsx)(`h2`,{className:`confirm-dialog-title`,children:o?`Discard which edits?`:c?`Roll back to original?`:`Discard edits?`})]}),o?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`confirm-dialog-desc`,children:`You have edits from this session, and earlier changes already saved on this version. Choose how far to roll back. This cannot be undone.`}),(0,J.jsxs)(`div`,{className:`plan-discard-choices`,role:`group`,"aria-label":`Discard options`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`plan-discard-choice`,disabled:a,onClick:()=>r(`recent`),autoFocus:!0,children:[(0,J.jsx)(`span`,{className:`plan-discard-choice-icon`,"aria-hidden":`true`,children:(0,J.jsx)(jO,{size:16})}),(0,J.jsxs)(`span`,{className:`plan-discard-choice-text`,children:[(0,J.jsx)(`span`,{className:`plan-discard-choice-title`,children:`Discard recent edits`}),(0,J.jsx)(`span`,{className:`plan-discard-choice-desc`,children:`Restore to when you started this edit session. Keeps earlier saved edits.`})]})]}),(0,J.jsxs)(`button`,{type:`button`,className:`plan-discard-choice plan-discard-choice-danger`,disabled:a,onClick:()=>r(`original`),children:[(0,J.jsx)(`span`,{className:`plan-discard-choice-icon`,"aria-hidden":`true`,children:(0,J.jsx)(nO,{size:16})}),(0,J.jsxs)(`span`,{className:`plan-discard-choice-text`,children:[(0,J.jsx)(`span`,{className:`plan-discard-choice-title`,children:`Roll back to original`}),(0,J.jsx)(`span`,{className:`plan-discard-choice-desc`,children:`Restore the plan to before you started editing this version at all.`})]})]})]})]}):c?(0,J.jsx)(`p`,{className:`confirm-dialog-desc`,children:`Earlier edits from a previous session were saved into this version. Roll back to the plan as it was before you started editing? This cannot be undone.`}):(0,J.jsx)(`p`,{className:`confirm-dialog-desc`,children:`Restore the plan body and title to when you started this edit session. This undoes unsaved changes and any autosaves from this session. This cannot be undone.`}),(0,J.jsxs)(`div`,{className:`confirm-dialog-footer plan-discard-footer`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`btn btn-sm confirm-dialog-cancel`,onClick:i,disabled:a,children:[(0,J.jsx)(WO,{size:13,"aria-hidden":`true`}),`Keep editing`]}),!o&&(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm confirm-dialog-confirm confirm-dialog-confirm-danger`,onClick:()=>r(c?`original`:`recent`),disabled:a||!s&&!c,autoFocus:!0,children:c?`Roll back to original`:`Discard all edits`})]})]})}var A4=700;function j4(e){return eG({side:`additions`,lineNumber:e.lineNumber,startLineNumber:e.startLineNumber})}function M4(e){let t=eG(e);return t.startLineNumber!=null&&t.startLineNumber!==t.lineNumber?{lineNumber:t.lineNumber,startLineNumber:t.startLineNumber}:{lineNumber:t.lineNumber}}var N4={pending:{label:`Pending review`,className:`plan-badge-pending`,icon:RD},approved:{label:`Approved`,className:`plan-badge-approved`,icon:wD},"changes-requested":{label:`Changes requested`,className:`plan-badge-changes`,icon:mO},rejected:{label:`Rejected`,className:`plan-badge-rejected`,icon:WO},"comment-only":{label:`Comment only`,className:`plan-badge-comment-only`,icon:hO}};function P4({plan:e,theme:t,fontSize:n,monoFontFamily:r,defaultTabSize:i,lineWrap:a,showLineNumbers:o,lineHoverHighlight:s,viewMode:c,onViewModeChange:l,editorIDE:u,tocOpen:d,onTocOpenChange:f,commentsRailOpen:p,onCommentsRailOpenChange:m,zenMode:h,onZenModeChange:g}){let{addPlanComment:_,editPlanComment:v,resolvePlanComment:y,unresolvePlanComment:b,removePlanComment:x,addPlanReply:S,editPlanReply:C,removePlanReply:w,updatePlan:T,submitPlanVersion:E,submittingPlanVersion:D}=OE(),[O,k]=(0,q.useState)(null),A=(0,q.useRef)(null),[j,M]=(0,q.useState)([]),[N,P]=(0,q.useState)(null),[F,I]=(0,q.useState)(0),[L,R]=(0,q.useState)(null),[z,B]=(0,q.useState)(null),[V,H]=(0,q.useState)(()=>a4(t4.tocOpen,!0)),[U,W]=(0,q.useState)(()=>a4(t4.commentsRail,i4())),ee=d??V,te=p??U,ne=u4(),re=(0,q.useCallback)(e=>{let t=typeof e==`function`?e(ee):e;f?f(t):(H(t),cD(t4.tocOpen,String(t)))},[ee,f]),ie=(0,q.useCallback)(e=>{let t=typeof e==`function`?e(te):e;m?m(t):(W(t),cD(t4.commentsRail,String(t)))},[te,m]),[ae,oe]=(0,q.useState)(!1),[G,se]=(0,q.useState)(!1),[K,ce]=(0,q.useState)(e.body),[le,ue]=(0,q.useState)(e.title),[de,fe]=(0,q.useState)(`idle`),[pe,me]=(0,q.useState)(null),[he,ge]=(0,q.useState)(null),[_e,ve]=(0,q.useState)(!1),[ye,be]=(0,q.useState)(!1),[xe,Se]=(0,q.useState)(!1),[Ce,we]=(0,q.useState)(!1),[Te,Ee]=(0,q.useState)(1),De=(0,q.useRef)(null),Oe=(0,q.useRef)({body:e.body,title:e.title,version:e.version}),[ke,Ae]=(0,q.useState)({body:e.body,title:e.title}),[je,Me]=(0,q.useState)(null),Ne=(0,q.useRef)(async()=>{}),[Pe,Fe]=(0,q.useState)(null),Ie=(0,q.useRef)(null),Le=(0,q.useRef)(null),Re=(0,q.useRef)(null),ze=(0,q.useRef)(50),[Be,Ve]=(0,q.useState)(()=>o4(50)),[He,Ue]=(0,q.useState)(!1),[We,Ge]=(0,q.useState)(()=>a4(t4.zenMode,!1)),Ke=h??We;ze.current=Be;let qe=c===`source`||c===`split`,Je=c===`rendered`||c===`split`,Ye=qe&&Je,Xe=c===`rendered`,Ze=Xe&&Ke,Qe=(0,q.useCallback)(e=>{let t=typeof e==`function`?e(Ke):e;g?g(t):(Ge(t),cD(t4.zenMode,String(t)))},[Ke,g]),$e=e.versions??[],[et,tt]=(0,q.useState)(e.version),[nt,rt]=(0,q.useState)(e.body),[it,at]=(0,q.useState)(e.title),ot=(0,q.useRef)(`${e.id}:${e.version}`);(0,q.useEffect)(()=>{let t=`${e.id}:${e.version}`;ot.current!==t&&(ot.current=t,Me(null),we(!1))},[e.id,e.version]);let st=(0,q.useRef)(e.version);(0,q.useEffect)(()=>{if(e.version===st.current)return;let t=st.current;st.current=e.version;let n=et===t,r=G&&(K!==Oe.current.body||le!==Oe.current.title);if(G&&r){ge(e.version);return}G&&!r&&(ce(e.body),ue(e.title),Oe.current={body:e.body,title:e.title,version:e.version},Ae({body:e.body,title:e.title}),Me(null),fe(`idle`),ge(null)),n&&tt(e.version)},[e.version,e.body,e.title,et,G,K,le]),(0,q.useEffect)(()=>{let t=!1;if(G&&et===e.version)return;if(et===e.version){rt(e.body),at(e.title);return}let n=$e.find(e=>e.version===et);if(n){rt(n.body),at(n.title);return}return fetch(`/api/plans/${e.id}/versions/${et}`).then(e=>e.ok?e.json():null).then(e=>{t||!e?.version||(rt(e.version.body),at(e.version.title))}).catch(()=>{}),()=>{t=!0}},[et,e.version,e.body,e.title,e.id,$e,G]),(0,q.useEffect)(()=>{P(null),I(0),k(null),M([])},[et]);let ct=et!==e.version,lt=!ct,ut=G&&lt?K:nt,dt=G&&lt?le:it,ft=G&&(K!==Oe.current.body||le!==Oe.current.title),pt=G&&(K!==ke.body||le!==ke.title||e.body!==ke.body||e.title!==ke.title),mt=G&&!!je&&(K!==je.body||le!==je.title||e.body!==je.body||e.title!==je.title),ht=!!je&&(je.body!==ke.body||je.title!==ke.title),gt=ht&&pt&&mt,_t=pt||mt,vt=(0,q.useMemo)(()=>$e.map(t=>({value:String(t.version),label:t.version===e.version?`v${t.version} (current)`:`v${t.version}`})),[$e,e.version]),yt=e=>{let t=e.target.closest(`a`);if(t){let n=t.getAttribute(`href`);n&&n.startsWith(`file:///`)&&(e.preventDefault(),R(n.replace(`file://`,``)))}},bt=LT[t]||LT[`rose-pine`],xt=(0,q.useMemo)(()=>F4(i,n,r),[i,n,r]),St=e.comments??[],Ct=ct?St.filter(e=>e.createdAtPlanVersion===et):St,wt=Ct.filter(e=>e.lineNumber>0),Tt=Ct.filter(e=>e.lineNumber===0),Et=Ct.filter(e=>e.status===`open`).length,Dt=St.length,Ot=(e,t)=>N2(ut,e??t,t),kt=(0,q.useCallback)(e=>{let t=M4(j4(e));A.current||=crypto.randomUUID(),k(t),P(aG(j4(t))),I(0)},[]),At=(0,q.useCallback)(()=>{k(null),P(null),I(0),A.current=null},[]),jt=(0,q.useMemo)(()=>{let e=ut.replace(/\r\n/g,`
3974
3977
  `).split(`
3975
- `).length;return{min:1,max:Math.max(1,e)}},[ut]),Mt=(t,n,r)=>{let i=t.startLineNumber??t.lineNumber,a=Ot(t.startLineNumber,t.lineNumber);_({planId:e.id,lineNumber:t.lineNumber,startLineNumber:t.startLineNumber,lineContent:a,sectionTitle:k2(ut,i),body:n,severity:r&&r!==`none`?r:void 0,createdAtPlanVersion:et}),At()},Nt=(0,q.useCallback)((e,t)=>{let n=A2(ut,e,t),r=ut.replace(/\r\n/g,`
3978
+ `).length;return{min:1,max:Math.max(1,e)}},[ut]),Mt=(t,n,r)=>{let i=t.startLineNumber??t.lineNumber,a=Ot(t.startLineNumber,t.lineNumber);_({planId:e.id,lineNumber:t.lineNumber,startLineNumber:t.startLineNumber,lineContent:a,sectionTitle:M2(ut,i),body:n,severity:r&&r!==`none`?r:void 0,createdAtPlanVersion:et}),At()},Nt=(0,q.useCallback)((e,t)=>{let n=N2(ut,e,t),r=ut.replace(/\r\n/g,`
3976
3979
  `).split(`
3977
3980
  `),i=Math.max(1,e-1),a=Math.min(r.length,t+1);if(i===e&&a===t)return n;let o=[];for(let n=i;n<=a;n++){let i=n>=e&&n<=t?`▶`:` `;o.push(`${i} L${n}| ${r[n-1]??``}`)}return o.join(`
3978
- `)},[ut]),Pt=(0,q.useCallback)((t,n,r)=>{let i=t.startLineNumber??t.lineNumber;_({planId:e.id,lineNumber:t.lineNumber,startLineNumber:t.startLineNumber,lineContent:t.sourceContext||t.exactLines,selectedQuote:t.selectedQuote.trim()||void 0,sectionTitle:t.sectionTitle??k2(ut,i),body:n,severity:r&&r!==`none`?r:void 0,createdAtPlanVersion:et})},[_,e.id,ut,et]),Ft=(0,q.useMemo)(()=>{let e=wt.map(e=>({lineNumber:e.lineNumber,metadata:e}));return O&&e.push({lineNumber:O.lineNumber,metadata:{_pending:!0}}),e},[wt,O]),It=t=>{let n=t.metadata;if(!n)return null;if(`_pending`in n){let t=O,n=T4(t),r=nG(n),i=A.current??`open`;return(0,J.jsx)(RW,{draftKey:`plan-new:${e.id}:${i}`,lineContent:Ot(t.startLineNumber,t.lineNumber),lineLabel:tG(n),showSeverity:!0,range:{start:r.start,end:r.end,sideLabel:`source`,canAdjustStart:e=>oG(n,e,jt),canAdjustEnd:e=>sG(n,e,jt)},onAdjustStart:e=>{let t=E4(iG(n,e,jt));k(t),P(rG(T4(t)))},onAdjustEnd:e=>{let t=E4(aG(n,e,jt));k(t),P(rG(T4(t)))},onSubmit:(e,n)=>Mt(t,e,n),onCancel:At})}let r=n;return(0,J.jsx)(`div`,{id:`plan-comment-${r.id}`,children:(0,J.jsx)(M2,{comment:r,onResolve:()=>y(e.id,r.id),onUnresolve:()=>b(e.id,r.id),onDelete:()=>x(e.id,r.id),onEdit:t=>v(e.id,r.id,t),onReply:t=>S(e.id,r.id,t),onEditReply:(t,n)=>C(e.id,r.id,t,n),onDeleteReply:t=>w(e.id,r.id,t)})})},Lt=D4[e.decision],Rt=Lt.icon,zt=(0,q.useMemo)(()=>e.sourcePath?e.sourcePath:e.source&&(e.source.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e.source))?e.source:null,[e.sourcePath,e.source]),Bt=(0,q.useMemo)(()=>{if(!zt)return null;let e=zt.replace(/\\/g,`/`).split(`/`);return e.length<=3?zt:`…/${e.slice(-3).join(`/`)}`},[zt]),Vt=(0,q.useMemo)(()=>z2(ut),[ut]),Ht=(0,q.useMemo)(()=>{let e=ut.trim();return e?e.split(/\s+/).length:0},[ut]),Ut=(0,q.useMemo)(()=>ut?ut.replace(/\r\n/g,`
3981
+ `)},[ut]),Pt=(0,q.useCallback)((t,n,r)=>{let i=t.startLineNumber??t.lineNumber;_({planId:e.id,lineNumber:t.lineNumber,startLineNumber:t.startLineNumber,lineContent:t.sourceContext||t.exactLines,selectedQuote:t.selectedQuote.trim()||void 0,sectionTitle:t.sectionTitle??M2(ut,i),body:n,severity:r&&r!==`none`?r:void 0,createdAtPlanVersion:et})},[_,e.id,ut,et]),Ft=(0,q.useMemo)(()=>{let e=wt.map(e=>({lineNumber:e.lineNumber,metadata:e}));return O&&e.push({lineNumber:O.lineNumber,metadata:{_pending:!0}}),e},[wt,O]),It=t=>{let n=t.metadata;if(!n)return null;if(`_pending`in n){let t=O,n=j4(t),r=iG(n),i=A.current??`open`;return(0,J.jsx)(RW,{draftKey:`plan-new:${e.id}:${i}`,lineContent:Ot(t.startLineNumber,t.lineNumber),lineLabel:rG(n),showSeverity:!0,range:{start:r.start,end:r.end,sideLabel:`source`,canAdjustStart:e=>cG(n,e,jt),canAdjustEnd:e=>lG(n,e,jt)},onAdjustStart:e=>{let t=M4(oG(n,e,jt));k(t),P(aG(j4(t)))},onAdjustEnd:e=>{let t=M4(sG(n,e,jt));k(t),P(aG(j4(t)))},onSubmit:(e,n)=>Mt(t,e,n),onCancel:At})}let r=n;return(0,J.jsx)(`div`,{id:`plan-comment-${r.id}`,children:(0,J.jsx)(F2,{comment:r,onResolve:()=>y(e.id,r.id),onUnresolve:()=>b(e.id,r.id),onDelete:()=>x(e.id,r.id),onEdit:t=>v(e.id,r.id,t),onReply:t=>S(e.id,r.id,t),onEditReply:(t,n)=>C(e.id,r.id,t,n),onDeleteReply:t=>w(e.id,r.id,t)})})},Lt=N4[e.decision],Rt=Lt.icon,zt=(0,q.useMemo)(()=>e.sourcePath?e.sourcePath:e.source&&(e.source.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e.source))?e.source:null,[e.sourcePath,e.source]),Bt=(0,q.useMemo)(()=>{if(!zt)return null;let e=zt.replace(/\\/g,`/`).split(`/`);return e.length<=3?zt:`…/${e.slice(-3).join(`/`)}`},[zt]),Vt=(0,q.useMemo)(()=>H2(ut),[ut]),Ht=(0,q.useMemo)(()=>{let e=ut.trim();return e?e.split(/\s+/).length:0},[ut]),Ut=(0,q.useMemo)(()=>ut?ut.replace(/\r\n/g,`
3979
3982
  `).split(`
3980
- `).length:0,[ut]),Wt=(0,q.useCallback)(()=>{if(et!==e.version)return;let t={body:e.body,title:e.title};ce(t.body),ue(t.title),Oe.current={body:t.body,title:t.title,version:e.version},Ae(t),Me(e=>e??t),fe(`idle`),me(null),ge(null),be(!1),we(!1),se(!0),k(null),P(null),M([]),Fe(null),Ke&&Qe(!1),c!==`split`&&l?.(`split`)},[et,e.version,e.body,e.title,Ke,Qe,c,l]),Gt=(0,q.useCallback)(async()=>{let t=K!==ke.body||le!==ke.title||e.body!==ke.body||e.title!==ke.title;De.current&&=(clearTimeout(De.current),null),await Ne.current(),rt(K),at(le.trim()||`Untitled plan`),se(!1),fe(`idle`),me(null),ge(null),be(!1),t&&we(!0)},[K,le,ke,e.body,e.title]),Kt=(0,q.useCallback)(()=>{ce(e.body),ue(e.title),Oe.current={body:e.body,title:e.title,version:e.version},Ae({body:e.body,title:e.title}),Me(null),ge(null),fe(`idle`),me(null),tt(e.version)},[e.body,e.title,e.version]),qt=(0,q.useCallback)(async t=>{if(G){De.current&&=(clearTimeout(De.current),null),Se(!0),me(null);try{if(ce(t.body),ue(t.title),e.body!==t.body||e.title!==t.title){fe(`saving`);let n=await T(e.id,{body:t.body,title:t.title});Oe.current={body:n.body,title:n.title,version:n.version},rt(n.body),at(n.title),Ae({body:n.body,title:n.title})}else Oe.current={body:t.body,title:t.title,version:e.version},rt(t.body),at(t.title),Ae({body:t.body,title:t.title});fe(`idle`),be(!1),we(!1)}catch(e){fe(`error`),me(e instanceof Error?e.message:`Failed to discard edits`)}finally{Se(!1)}}},[G,e.body,e.title,e.id,e.version,T]),Jt=(0,q.useCallback)(async e=>{if(e===`recent`){await qt(ke);return}je&&await qt(je)},[qt,ke,je]),Yt=(0,q.useCallback)(()=>{!G||!_t||xe||de===`saving`||be(!0)},[G,_t,xe,de]),Xt=(0,q.useCallback)(async()=>{if(!G)return;let t=K,n=le.trim()||`Untitled plan`;if(!t.trim()){fe(`error`),me(`Plan body cannot be empty`);return}if(t===Oe.current.body&&n===Oe.current.title){fe(e=>e===`dirty`?`saved`:e);return}fe(`saving`),me(null);try{let r=await T(e.id,{body:t,title:n});Oe.current={body:r.body,title:r.title,version:r.version},rt(r.body),at(r.title),fe(`saved`)}catch(e){fe(`error`),me(e instanceof Error?e.message:`Save failed`)}},[G,K,le,T,e.id]);Ne.current=Xt,(0,q.useEffect)(()=>{if(!G)return;let e=le.trim()||`Untitled plan`;if(K!==Oe.current.body||e!==Oe.current.title){if(!K.trim()){fe(`error`),me(`Plan body cannot be empty`);return}return fe(`dirty`),me(null),De.current&&clearTimeout(De.current),De.current=setTimeout(()=>{De.current=null,Xt()},w4),()=>{De.current&&=(clearTimeout(De.current),null)}}},[G,K,le,Xt]),(0,q.useEffect)(()=>{if(!G||!ft)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[G,ft]);let Zt=(0,q.useCallback)(async()=>{let t=K,n=le.trim()||`Untitled plan`;if(!t.trim()){fe(`error`),me(`Plan body cannot be empty`),ve(!1);return}ve(!1),fe(`saving`),me(null);try{let r=await E(e.id,{title:n,body:t,source:e.source,model:e.model}),i={body:r.body,title:r.title};Oe.current={body:i.body,title:i.title,version:r.version},Ae(i),Me(i),ot.current=`${e.id}:${r.version}`,ce(i.body),ue(i.title),rt(i.body),at(i.title),tt(r.version),ge(null),we(!1),fe(`saved`)}catch(e){fe(`error`),me(e instanceof Error?e.message:`Save as new version failed`)}},[K,le,E,e.id,e.source,e.model]);(0,q.useEffect)(()=>{if(!G||c!==`split`)return;let e=0;return e=requestAnimationFrame(()=>{e=0;let t=Ie.current;t&&x4(t,Te,{scrollContainer:t.closest(`.plan-rendered-layout`)??t.parentElement,onlyIfOutOfView:!0,behavior:`auto`})}),()=>{e&&cancelAnimationFrame(e)}},[G,c,Te]),(0,q.useEffect)(()=>{let e=e=>{let t=e.target,n=t?.tagName?.toLowerCase(),r=n===`input`||n===`textarea`||n===`select`||!!t?.isContentEditable;if((e.metaKey||e.ctrlKey)&&(e.key===`s`||e.key===`S`)){if(!G)return;e.preventDefault(),De.current&&=(clearTimeout(De.current),null),Xt();return}if(e.key===`e`||e.key===`E`){if(r||e.metaKey||e.ctrlKey||e.altKey)return;e.preventDefault(),G?Gt():lt&&Wt()}};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[G,lt,Wt,Gt,Xt]);let Qt=(0,q.useCallback)(e=>{B(e),window.setTimeout(()=>B(null),1600)},[]),$t=(0,q.useCallback)(async(e,t)=>{try{await navigator.clipboard.writeText(e),Qt(t)}catch{}},[Qt]),en=(0,q.useCallback)(async()=>{if(zt){oe(!0);try{await fetch(`/api/open-file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:zt,editor:u})})}catch{}finally{oe(!1)}}},[zt,u]),tn=(0,q.useCallback)((e,t=`start`)=>{e.scrollIntoView({behavior:`smooth`,block:t===`center`?`center`:`start`})},[]),nn=(0,q.useCallback)(e=>{if(!e||typeof document>`u`)return null;let t=Ie.current,n=t??document;try{let t=n.querySelector(`[data-plan-segment="${CSS.escape(e)}"]`);if(t)return t}catch{}return t?.querySelector(`#${CSS.escape(e)}`)??document.getElementById(e)},[]),rn=(0,q.useCallback)(e=>{let t=nn(e);if(t&&tn(t,`start`),typeof history<`u`&&typeof window<`u`){let t=`${window.location.pathname}${window.location.search}#${e}`;`${window.location.pathname}${window.location.search}${window.location.hash}`!==t&&history.replaceState(null,``,t)}},[nn,tn]);(0,q.useEffect)(()=>{if(!Je||G)return;let e=typeof window<`u`?window.location.hash.replace(/^#/,``):``;if(!e)return;let t=!1,n=()=>{if(t)return;let n=nn(decodeURIComponent(e));n&&tn(n,`start`)},r=window.requestAnimationFrame(()=>{window.requestAnimationFrame(n)}),i=()=>n();return window.addEventListener(`hashchange`,i),()=>{t=!0,window.cancelAnimationFrame(r),window.removeEventListener(`hashchange`,i)}},[Je,G,ut,c,nn,tn]);let an=(0,q.useCallback)((e,t)=>{let n=document.getElementById(`plan-comment-${e}`);if(n){tn(n,`center`),n.classList.add(`plan-comment-flash`),window.setTimeout(()=>n.classList.remove(`plan-comment-flash`),1400);return}let r=document.querySelector(`[data-plan-line="${t}"]`);r instanceof HTMLElement&&tn(r,`center`)},[tn]),on=(0,q.useCallback)((e,t)=>{an(e,t),ne&&ie(!1)},[an,ne,ie]);(0,q.useEffect)(()=>{if(!ne||!te)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),ie(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ne,te,ie]);let sn=(0,q.useCallback)((e=`sync`)=>{if(ct||G){e===`sync`&&Fe(null);return}let t=Ie.current,n=window.getSelection();if(!t||!n||n.isCollapsed||!n.rangeCount){e===`sync`&&Fe(null);return}if(!V2(n,t)){e===`sync`&&Fe(null);return}let r=H2(n,t)??n.getRangeAt(0),i=r.toString();if(!i.trim()){e===`sync`&&Fe(null);return}let a=W2(ut,i)??{text:i.replace(/\s+/g,` `).trim(),startLine:1,endLine:1},o=r.getClientRects(),s=null,c=null;for(let e=0;e<o.length;e++){let t=o[e];t.width===0&&t.height===0||(s||=t,c=t)}let l=s&&c?null:r.getBoundingClientRect(),u=s??l,d=c??l;if(!u||!d||u.width===0&&u.height===0){e===`sync`&&Fe(null);return}let f=window.innerHeight-d.bottom<54&&u.top>54?`above`:`below`,p=(d.left+d.right)/2;Fe({x:Math.min(Math.max(72,p),window.innerWidth-72),y:f===`below`?d.bottom+10:u.top-10,placement:f,startLine:a.startLine,endLine:a.endLine,text:a.text})},[ut,ct,G]);(0,q.useEffect)(()=>{if(ct||G||!Je)return;let e=0,t=t=>{e&&clearTimeout(e),e=setTimeout(()=>{requestAnimationFrame(()=>sn(t))},0)},n=e=>{e.target?.closest?.(`.plan-selection-popup, .plan-selection-comment, .plan-float-tray, .confirm-dialog`)||t(`sync`)},r=e=>{(e.key===`Shift`||e.key.startsWith(`Arrow`)||e.key===`End`||e.key===`Home`)&&t(`sync`)},i=()=>{t(`update`)};return document.addEventListener(`mouseup`,n,!0),document.addEventListener(`keyup`,r,!0),document.addEventListener(`selectionchange`,i),()=>{e&&clearTimeout(e),document.removeEventListener(`mouseup`,n,!0),document.removeEventListener(`keyup`,r,!0),document.removeEventListener(`selectionchange`,i)}},[ct,G,Je,sn]);let cn=(0,q.useCallback)(()=>{if(!Pe)return;let e=window.getSelection(),t=e&&e.rangeCount>0&&!e.isCollapsed?e.getRangeAt(0).cloneRange():null,n=t?u4(t):[],r=Pe.x-400/2,i=Pe.placement===`below`?Pe.y+8:Pe.y-420-8,a=j.length*28,o=l4(r+a,i+a,400,420),s=Pe.startLine,c=Pe.endLine,l=A2(ut,s,c),u={id:crypto.randomUUID(),lineNumber:c,startLineNumber:s===c?void 0:s,selectedQuote:Pe.text,exactLines:l,sourceContext:Nt(s,c),sectionTitle:k2(ut,s),panelPos:o,panelSize:{width:400,height:420},minimized:!1,highlightRects:n};M(e=>[...e,u]),I(Math.abs(c-s)+1),Fe(null)},[Pe,j.length,ut,Nt]);(0,q.useEffect)(()=>{let e=e=>{if(e.key===`Escape`&&!(ye||_e)){if(Pe){e.preventDefault(),Fe(null);return}if(G){if(_t&&!xe&&de!==`saving`){e.preventDefault(),e.stopPropagation(),be(!0);return}e.preventDefault(),e.stopPropagation(),Gt();return}Ze&&(e.preventDefault(),Qe(!1))}};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[Pe,Ze,Qe,G,_t,xe,de,ye,_e,Gt]),(0,q.useEffect)(()=>{if(!Pe)return;let e=()=>Fe(null);return window.addEventListener(`scroll`,e,{passive:!0,capture:!0}),()=>window.removeEventListener(`scroll`,e,!0)},[Pe]);let ln=typeof window<`u`?`${window.location.origin}${cE(window.location.pathname.startsWith(`/plan`)?window.location.pathname:`/plan/${e.id}`)}`:cE(`/plan/${e.id}`),un=(0,q.useCallback)(e=>{e.preventDefault();let t=Re.current;if(!t)return;let n=t.getBoundingClientRect();if(n.width<=0)return;Ue(!0),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let r=ze.current,i=0,a=e=>{r=t4(e),t.style.setProperty(`--plan-split-pct`,`${r}%`)},o=e=>{let t=(e.clientX-n.left)/n.width*100;i||=requestAnimationFrame(()=>{i=0,a(t)})},s=()=>{i&&cancelAnimationFrame(i),Ve(r),cD(Y2.splitRatio,String(r)),Ue(!1),document.body.style.cursor=``,document.body.style.userSelect=``,document.removeEventListener(`mousemove`,o),document.removeEventListener(`mouseup`,s)};a((e.clientX-n.left)/n.width*100),document.addEventListener(`mousemove`,o),document.addEventListener(`mouseup`,s)},[]),dn=G?(0,J.jsx)(`div`,{className:`plan-file plan-file-editing`,children:(0,J.jsx)(S4,{value:K,onChange:ce,onActiveLineChange:Ee,fontSize:n,monoFontFamily:r,defaultTabSize:i,lineWrap:a,showLineNumbers:o})}):(0,J.jsx)(`div`,{className:`plan-file`,children:(0,J.jsx)(Rm,{file:{name:e.sourcePath?.split(/[/\\]/).pop()||`PLAN.md`,contents:ut,lang:`markdown`},options:{disableFileHeader:!0,enableGutterUtility:!0,enableLineSelection:!0,overflow:a?`wrap`:`scroll`,disableLineNumbers:!o,lineHoverHighlight:s,onLineSelectionStart:()=>{I(0),k(null),P(null),A.current=null},onLineSelectionChange:e=>{I(e?Math.abs(e.end-e.start)+1:0)},onLineSelectionEnd:e=>{if(I(0),e){let t=$W(e);kt({lineNumber:t.lineNumber,startLineNumber:t.startLineNumber})}},onGutterUtilityClick:e=>{let t=$W(e);kt({lineNumber:t.lineNumber,startLineNumber:t.startLineNumber})},theme:{dark:bt.type===`dark`?bt.themeName:`rose-pine`,light:bt.type===`light`?bt.themeName:`github-light`},themeType:bt.type,unsafeCSS:xt},selectedLines:O?N:void 0,lineAnnotations:Ft,renderAnnotation:It})}),fn=(0,J.jsxs)(`div`,{className:[`plan-rendered-layout`,ee&&Vt.length>0&&!Ze?`has-toc`:``,Xe?`plan-rendered-layout-solo`:``,Ze?`plan-rendered-layout-zen`:``].filter(Boolean).join(` `),children:[ee&&Vt.length>0&&!Ze&&(0,J.jsxs)(`nav`,{className:`plan-toc`,"aria-label":`Plan outline`,children:[(0,J.jsxs)(`div`,{className:`plan-toc-head`,children:[(0,J.jsx)(sO,{size:12,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`Outline`})]}),(0,J.jsx)(`ul`,{className:`plan-toc-list`,children:Vt.map(e=>(0,J.jsx)(`li`,{className:`plan-toc-item plan-toc-level-${Math.min(e.level,4)}`,children:(0,J.jsx)(`a`,{href:`#${e.id}`,onClick:t=>{t.preventDefault(),rn(e.id)},children:e.text})},e.id))})]}),(0,J.jsx)(`div`,{ref:Ie,className:`markdown-body plan-rendered`,onClick:yt,children:(0,J.jsx)(I2,{body:ut,outline:Vt,comments:wt,onResolve:t=>y(e.id,t),onUnresolve:t=>b(e.id,t),onDelete:t=>x(e.id,t),onEdit:(t,n)=>v(e.id,t,n),onReply:(t,n)=>S(e.id,t,n),onEditReply:(t,n,r)=>C(e.id,t,n,r),onDeleteReply:(t,n)=>w(e.id,t,n)})})]}),pn=(0,q.useMemo)(()=>`${c}:${et}:${wt.map(e=>e.id).join(`,`)}:${j.map(e=>e.id).join(`,`)}`,[c,et,wt,j]),mn=Je&&!G&&j.length>0?(0,J.jsx)(p4,{planId:e.id,composers:j,onChange:M,onSubmit:Pt,planBody:ut,buildSourceContext:Nt,renderedRootRef:Ie,layoutEpoch:pn}):null,hn=de===`saving`?`Saving…`:de===`saved`?`Saved`:de===`dirty`?`Unsaved`:de===`error`?pe||`Save failed`:null,gn=!Ze&&te&&Ct.length>0,_n=gn&&!ne,vn=gn?(0,J.jsxs)(`aside`,{className:`plan-comments-rail ${ne?`plan-comments-sheet`:``}`,"aria-label":`Comments map`,...ne?{role:`dialog`,"aria-modal":!0}:{},children:[(0,J.jsxs)(`div`,{className:`plan-comments-rail-head`,children:[(0,J.jsx)(gO,{size:12,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`Comments`}),(0,J.jsx)(`span`,{className:`plan-comments-rail-count`,children:Et>0?`${Et} open`:`${Ct.length}`}),ne&&(0,J.jsx)(`button`,{type:`button`,className:`plan-comments-sheet-close`,onClick:()=>ie(!1),"aria-label":`Close comments map`,children:(0,J.jsx)(WO,{size:14,"aria-hidden":`true`})})]}),(0,J.jsx)(`ul`,{className:`plan-comments-rail-list`,children:[...Ct].sort((e,t)=>e.status===t.status?e.lineNumber-t.lineNumber:e.status===`open`?-1:1).map(e=>(0,J.jsx)(`li`,{children:(0,J.jsxs)(`button`,{type:`button`,className:`plan-comments-rail-item ${e.status===`resolved`?`is-resolved`:``}`,onClick:()=>on(e.id,e.lineNumber),title:e.body.slice(0,200),children:[(0,J.jsx)(`span`,{className:`plan-comments-rail-line`,children:P2(e)}),(0,J.jsxs)(`span`,{className:`plan-comments-rail-preview`,children:[e.sectionTitle?`${e.sectionTitle} · `:``,e.body.replace(/\s+/g,` `).slice(0,80),e.body.length>80?`…`:``]}),(0,J.jsx)(`span`,{className:`plan-comments-rail-status plan-comments-rail-status-${e.status}`,children:e.status})]})},e.id))})]}):null;return(0,J.jsxs)(`div`,{className:`plan-review ${Ze?`plan-review-zen`:``} ${Xe?`plan-review-read`:``} ${G?`plan-review-editing`:``}`,children:[(0,J.jsxs)(`header`,{className:`plan-review-head`,ref:Le,children:[(0,J.jsxs)(`div`,{className:`plan-review-head-main`,children:[(0,J.jsxs)(`div`,{className:`plan-review-title-row`,children:[G?(0,J.jsx)(`input`,{className:`plan-review-title-input`,value:le,onChange:e=>ue(e.target.value),"aria-label":`Plan title`,placeholder:`Untitled plan`}):(0,J.jsxs)(`h2`,{className:`plan-review-title`,title:dt,children:[dt,ct&&dt!==e.title&&(0,J.jsxs)(`span`,{className:`plan-review-title-historical`,title:`Currently submitted title: ${e.title}`,children:[` `,`· was “`,e.title,`”`]})]}),(0,J.jsxs)(`span`,{className:`plan-badge ${Lt.className}`,children:[(0,J.jsx)(Rt,{size:12,"aria-hidden":`true`}),Lt.label]}),G&&hn&&(0,J.jsxs)(`span`,{className:`plan-review-chip plan-review-save-status plan-review-save-status-${de}`,role:`status`,title:pe??void 0,children:[de===`saving`&&(0,J.jsx)(cO,{size:11,className:`spin`,"aria-hidden":`true`}),hn]})]}),(0,J.jsxs)(`div`,{className:`plan-review-meta`,children:[$e.length<=1?(0,J.jsxs)(`span`,{className:`plan-review-chip`,children:[`v`,et]}):(0,J.jsxs)(`div`,{className:`plan-review-version-switcher ${ct?`is-historical`:``}`,children:[(0,J.jsx)(nO,{size:12,"aria-hidden":`true`,className:`plan-review-version-switcher-icon`}),(0,J.jsx)(tW,{value:String(et),onValueChange:t=>{let n=Number(t);if(G&&n!==e.version){Gt().then(()=>tt(n));return}tt(n)},options:vt,ariaLabel:`Plan version`}),ct&&(0,J.jsxs)(`button`,{type:`button`,className:`plan-review-version-back`,onClick:()=>tt(e.version),title:`Back to current v${e.version}`,children:[(0,J.jsx)(bD,{size:11,"aria-hidden":`true`}),`Current`]})]}),e.model&&(0,J.jsxs)(`span`,{className:`plan-review-chip plan-review-chip-model`,title:e.model,children:[(0,J.jsx)(SD,{size:11,"aria-hidden":`true`}),e.model]}),(0,J.jsxs)(`span`,{className:`plan-review-meta-stat`,title:`${Ut} lines · ${Ht} words · updated ${FT(e.updatedAt)}`,children:[Ut,`L · `,Ht,`W`,Et>0&&(0,J.jsxs)(`span`,{className:`plan-review-meta-open`,children:[` · `,Et,` open`]}),Ct.length>0&&Et===0&&(0,J.jsxs)(`span`,{children:[` `,`· `,Ct.length,` comment`,Ct.length===1?``:`s`]}),ct&&Dt!==Ct.length&&(0,J.jsxs)(`span`,{className:`plan-review-chip-sub`,children:[` of `,Dt]})]}),(F>0||j.length>0)&&(0,J.jsx)(`span`,{className:`plan-review-chip plan-review-chip-selection`,"aria-live":`polite`,children:j.length>0?`${j.length} draft${j.length===1?``:`s`}`:`${F} selected`}),(zt||e.source)&&(0,J.jsxs)(`div`,{className:`plan-source-inline`,children:[(0,J.jsx)(JD,{size:12,className:`plan-source-icon`,"aria-hidden":`true`}),(0,J.jsx)(`code`,{className:`plan-source-path`,title:zt??e.source,children:Bt??e.source}),zt&&(0,J.jsx)(Qw,{content:`Copy absolute source path`,side:`top`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn`,onClick:()=>$t(zt,`Path copied`),"aria-label":`Copy plan source path`,children:(0,J.jsx)(VD,{size:12})})}),z&&(0,J.jsx)(`span`,{className:`plan-source-flash`,role:`status`,children:z})]})]})]}),(0,J.jsxs)(`div`,{className:`plan-review-head-actions`,role:`toolbar`,"aria-label":`Plan actions`,children:[(0,J.jsx)(Qw,{content:`Copy review link`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn`,onClick:()=>$t(ln,`Link copied`),"aria-label":`Copy review URL`,children:(0,J.jsx)(oO,{size:14})})}),(0,J.jsx)(Qw,{content:`Copy plan markdown`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn`,onClick:()=>$t(ut,`Markdown copied`),"aria-label":`Copy plan markdown`,children:(0,J.jsx)(qD,{size:14})})}),zt&&(0,J.jsx)(Qw,{content:`Open source in editor`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn`,onClick:en,disabled:ae,"aria-label":`Open plan source in editor`,children:ae?(0,J.jsx)(cO,{size:14,className:`spin`}):(0,J.jsx)(UD,{size:14})})}),lt&&(0,J.jsx)(Qw,{content:G?`Done editing (e) — autosave flushes on exit`:`Edit plan live (e)`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn ${G?`is-active`:``} ${ft?`is-dirty`:``}`,onClick:()=>{G?Gt():Wt()},"aria-pressed":G,"aria-label":G?`Done editing plan`:`Edit plan`,children:(0,J.jsx)(DO,{size:14})})}),G&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Qw,{content:`Save now (⌘S)`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn`,onClick:()=>{De.current&&=(clearTimeout(De.current),null),Xt()},disabled:de===`saving`||D||xe,"aria-label":`Save plan now`,children:(0,J.jsx)(MO,{size:14})})}),(0,J.jsx)(Qw,{content:`Save as new version — bumps version and reopens review`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn`,onClick:()=>ve(!0),disabled:de===`saving`||D||xe||!K.trim(),"aria-label":`Save as new version`,children:D?(0,J.jsx)(cO,{size:14,className:`spin`}):(0,J.jsx)(XD,{size:14})})}),(0,J.jsx)(Qw,{content:gt?`Discard edits (Esc) — recent session or roll back to original`:mt&&!pt?`Roll back to original (Esc) — before you started editing this version`:`Discard edits (Esc) — restore to start of this edit session`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn plan-icon-btn-danger`,onClick:Yt,disabled:!_t||xe||de===`saving`,"aria-label":`Discard edits`,title:`Esc`,children:xe?(0,J.jsx)(cO,{size:14,className:`spin`}):(0,J.jsx)(jO,{size:14})})})]}),(0,J.jsx)(`span`,{className:`plan-action-divider`,"aria-hidden":`true`}),Xe&&(0,J.jsx)(Qw,{content:Ze?`Exit zen reading (z / Esc)`:`Zen mode — full-width focus reading (z)`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn ${Ze?`is-active`:``}`,onClick:()=>Qe(e=>!e),"aria-pressed":Ze,"aria-label":Ze?`Exit zen reading`:`Enter zen reading mode`,children:Ze?(0,J.jsx)(_O,{size:14}):(0,J.jsx)(uO,{size:14})})}),Je&&Vt.length>0&&!Ze&&(0,J.jsx)(Qw,{content:ee?`Hide outline (o)`:`Show outline (o)`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn ${ee?`is-active`:``}`,onClick:()=>re(e=>!e),"aria-pressed":ee,"aria-label":ee?`Hide outline`:`Show outline`,children:(0,J.jsx)(sO,{size:14})})}),Ct.length>0&&!Ze&&(0,J.jsx)(Qw,{content:te?`Hide comments map (c)`:Et>0?`Show comments map (${Et} open) · c`:`Show comments map (c)`,side:`bottom`,children:(0,J.jsxs)(`button`,{type:`button`,className:`plan-icon-btn ${te?`is-active`:``}`,onClick:()=>ie(e=>!e),"aria-pressed":te,"aria-label":te?`Hide comments map`:Et>0?`Show comments map, ${Et} open`:`Show comments map`,children:[(0,J.jsx)(gO,{size:14}),Et>0&&(0,J.jsx)(`span`,{className:`plan-icon-btn-badge`,children:Et})]})})]})]}),Ze&&(0,J.jsxs)(`div`,{className:`plan-zen-bar`,role:`status`,children:[(0,J.jsx)(`span`,{className:`plan-zen-bar-label`,children:`Zen reading`}),(0,J.jsx)(`span`,{className:`plan-zen-bar-hint`,children:`Esc or button to exit`}),(0,J.jsxs)(`button`,{type:`button`,className:`plan-zen-bar-exit`,onClick:()=>Qe(!1),children:[(0,J.jsx)(_O,{size:13,"aria-hidden":`true`}),`Exit zen`]})]}),ct&&(0,J.jsxs)(`div`,{className:`plan-review-historical-banner`,role:`status`,children:[(0,J.jsx)(nO,{size:14,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[`Viewing `,(0,J.jsxs)(`strong`,{children:[`v`,et]}),` of this plan (current is`,` `,(0,J.jsxs)(`strong`,{children:[`v`,e.version]}),`). Comments and line anchors reflect v`,et,`.`]}),(0,J.jsxs)(`button`,{type:`button`,className:`plan-review-historical-banner-back`,onClick:()=>tt(e.version),children:[(0,J.jsx)(bD,{size:11,"aria-hidden":`true`}),`Back to current`]})]}),G&&(0,J.jsxs)(`div`,{className:`plan-review-edit-banner`,role:`status`,children:[(0,J.jsx)(DO,{size:14,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[`Editing live — changes autosave to the current version`,Dt>0?`. Line anchors on existing comments may shift if you insert or delete lines.`:`.`,` `,`New comments are disabled until you finish editing.`,ht?` Prior session edits are saved; Esc or Discard can roll back further.`:` Esc opens discard.`]}),_t&&(0,J.jsxs)(`button`,{type:`button`,className:`plan-review-edit-banner-discard`,onClick:Yt,disabled:xe||de===`saving`,children:[(0,J.jsx)(jO,{size:11,"aria-hidden":`true`}),mt&&!pt?`Roll back to original`:`Discard edits`,(0,J.jsx)(`kbd`,{className:`plan-review-edit-banner-kbd`,children:`Esc`})]}),G&&c===`rendered`&&(0,J.jsx)(`button`,{type:`button`,className:`plan-review-historical-banner-back`,onClick:()=>l?.(`split`),children:`Show source`})]}),!G&&Ce&&(0,J.jsxs)(`div`,{className:`plan-review-exit-saved-banner`,role:`status`,children:[(0,J.jsx)(MO,{size:14,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`strong`,{children:`Edits saved`}),` to this version. They are now the starting point the next time you press Edit. Use `,(0,J.jsx)(`strong`,{children:`Discard`}),` after re-entering edit to roll back to the plan as it was before you started editing this version.`]}),(0,J.jsx)(`button`,{type:`button`,className:`plan-review-exit-saved-banner-dismiss`,onClick:()=>we(!1),"aria-label":`Dismiss saved-edits notice`,children:(0,J.jsx)(WO,{size:14})})]}),he!=null&&(0,J.jsxs)(`div`,{className:`plan-review-conflict-banner`,role:`alert`,children:[(0,J.jsx)(mO,{size:14,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[`Agent submitted `,(0,J.jsxs)(`strong`,{children:[`v`,he]}),` while you have unsaved edits. Keep your draft, or discard and load the new version.`]}),(0,J.jsx)(`button`,{type:`button`,className:`plan-review-historical-banner-back`,onClick:()=>ge(null),children:`Keep editing`}),(0,J.jsx)(`button`,{type:`button`,className:`plan-review-historical-banner-back`,onClick:Kt,children:`Discard & load`})]}),e.decision!==`pending`&&e.decisionComment&&(0,J.jsxs)(`div`,{className:`plan-decision-banner ${Lt.className}`,children:[(0,J.jsx)(Rt,{size:15,"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`plan-decision-banner-text`,children:[(0,J.jsx)(`strong`,{children:Lt.label}),(0,J.jsx)(QV,{content:e.decisionComment,className:`plan-decision-banner-note markdown-body`})]})]}),Tt.length>0&&(0,J.jsxs)(`section`,{className:`plan-general-section`,"aria-label":`General comments`,children:[(0,J.jsxs)(`div`,{className:`plan-general-header`,children:[(0,J.jsx)(pO,{size:14,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`General comments`}),(0,J.jsx)(`span`,{className:`plan-general-count`,children:Tt.length})]}),(0,J.jsx)(`div`,{className:`plan-general-list`,children:Tt.map(t=>(0,J.jsx)(`div`,{id:`plan-comment-${t.id}`,children:(0,J.jsx)(M2,{comment:t,onResolve:()=>y(e.id,t.id),onUnresolve:()=>b(e.id,t.id),onDelete:()=>x(e.id,t.id),onEdit:n=>v(e.id,t.id,n),onReply:n=>S(e.id,t.id,n),onEditReply:(n,r)=>C(e.id,t.id,n,r),onDeleteReply:n=>w(e.id,t.id,n)})},t.id))})]}),(0,J.jsxs)(`div`,{className:`plan-review-body ${_n?`plan-review-body-with-rail`:``}`,children:[(0,J.jsxs)(`div`,{ref:Re,className:`plan-content ${Ye?`plan-content-split`:`plan-content-single`} ${He?`plan-content-split-dragging`:``} ${Xe?`plan-content-read`:``} ${Ze?`plan-content-zen`:``}`,style:Ye?{"--plan-split-pct":`${Be}%`}:void 0,children:[qe&&dn,Ye&&(0,J.jsx)(`div`,{className:`plan-split-resize-handle`,onMouseDown:un,onDoubleClick:()=>{Ve(50),cD(Y2.splitRatio,`50`),Re.current?.style.setProperty(`--plan-split-pct`,`50%`)},role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize source and rendered panes`,title:`Drag to resize · double-click to reset 50/50`,"aria-valuenow":Math.round(Be),"aria-valuemin":20,"aria-valuemax":80,tabIndex:0,onKeyDown:e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=t4(Be+(e.key===`ArrowLeft`?-2:2));Ve(t),cD(Y2.splitRatio,String(t)),Re.current?.style.setProperty(`--plan-split-pct`,`${t}%`)},children:(0,J.jsx)(`span`,{className:`plan-split-resize-grip`,"aria-hidden":`true`})}),Je&&fn]}),_n&&vn]}),gn&&ne&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`plan-comments-sheet-backdrop`,onClick:()=>ie(!1),"aria-hidden":`true`}),vn]}),Pe&&!G&&(0,J.jsxs)(`button`,{type:`button`,className:`plan-selection-popup plan-selection-popup-${Pe.placement}`,style:{left:Pe.x,top:Pe.y},onMouseDown:e=>e.preventDefault(),onClick:cn,children:[(0,J.jsx)(pO,{size:13,"aria-hidden":`true`}),`Add comment`,(0,J.jsxs)(`span`,{className:`plan-selection-popup-lines`,children:[`L`,Pe.startLine,Pe.endLine===Pe.startLine?``:`–${Pe.endLine}`]})]}),mn,(0,J.jsx)(L2,{isOpen:!!L,filePath:L,onClose:()=>R(null)}),(0,J.jsx)(LH,{open:_e,title:`Save as new version?`,description:`Creates v${e.version+1} from your current draft and reopens the plan for review (decision becomes pending). In-place autosave does not create a version.`,confirmLabel:`Save as new version`,cancelLabel:`Cancel`,variant:`primary`,onConfirm:()=>{Zt()},onCancel:()=>ve(!1)}),(0,J.jsx)(C4,{open:ye,canDiscardRecent:pt,canRollbackOriginal:mt&&ht,onChoose:e=>{Jt(e)},onCancel:()=>be(!1),busy:xe})]})}function k4(e,t,n){return`
3983
+ `).length:0,[ut]),Wt=(0,q.useCallback)(()=>{if(et!==e.version)return;let t={body:e.body,title:e.title};ce(t.body),ue(t.title),Oe.current={body:t.body,title:t.title,version:e.version},Ae(t),Me(e=>e??t),fe(`idle`),me(null),ge(null),be(!1),we(!1),se(!0),k(null),P(null),M([]),Fe(null),Ke&&Qe(!1),c!==`split`&&l?.(`split`)},[et,e.version,e.body,e.title,Ke,Qe,c,l]),Gt=(0,q.useCallback)(async()=>{let t=K!==ke.body||le!==ke.title||e.body!==ke.body||e.title!==ke.title;De.current&&=(clearTimeout(De.current),null),await Ne.current(),rt(K),at(le.trim()||`Untitled plan`),se(!1),fe(`idle`),me(null),ge(null),be(!1),t&&we(!0)},[K,le,ke,e.body,e.title]),Kt=(0,q.useCallback)(()=>{ce(e.body),ue(e.title),Oe.current={body:e.body,title:e.title,version:e.version},Ae({body:e.body,title:e.title}),Me(null),ge(null),fe(`idle`),me(null),tt(e.version)},[e.body,e.title,e.version]),qt=(0,q.useCallback)(async t=>{if(G){De.current&&=(clearTimeout(De.current),null),Se(!0),me(null);try{if(ce(t.body),ue(t.title),e.body!==t.body||e.title!==t.title){fe(`saving`);let n=await T(e.id,{body:t.body,title:t.title});Oe.current={body:n.body,title:n.title,version:n.version},rt(n.body),at(n.title),Ae({body:n.body,title:n.title})}else Oe.current={body:t.body,title:t.title,version:e.version},rt(t.body),at(t.title),Ae({body:t.body,title:t.title});fe(`idle`),be(!1),we(!1)}catch(e){fe(`error`),me(e instanceof Error?e.message:`Failed to discard edits`)}finally{Se(!1)}}},[G,e.body,e.title,e.id,e.version,T]),Jt=(0,q.useCallback)(async e=>{if(e===`recent`){await qt(ke);return}je&&await qt(je)},[qt,ke,je]),Yt=(0,q.useCallback)(()=>{!G||!_t||xe||de===`saving`||be(!0)},[G,_t,xe,de]),Xt=(0,q.useCallback)(async()=>{if(!G)return;let t=K,n=le.trim()||`Untitled plan`;if(!t.trim()){fe(`error`),me(`Plan body cannot be empty`);return}if(t===Oe.current.body&&n===Oe.current.title){fe(e=>e===`dirty`?`saved`:e);return}fe(`saving`),me(null);try{let r=await T(e.id,{body:t,title:n});Oe.current={body:r.body,title:r.title,version:r.version},rt(r.body),at(r.title),fe(`saved`)}catch(e){fe(`error`),me(e instanceof Error?e.message:`Save failed`)}},[G,K,le,T,e.id]);Ne.current=Xt,(0,q.useEffect)(()=>{if(!G)return;let e=le.trim()||`Untitled plan`;if(K!==Oe.current.body||e!==Oe.current.title){if(!K.trim()){fe(`error`),me(`Plan body cannot be empty`);return}return fe(`dirty`),me(null),De.current&&clearTimeout(De.current),De.current=setTimeout(()=>{De.current=null,Xt()},A4),()=>{De.current&&=(clearTimeout(De.current),null)}}},[G,K,le,Xt]),(0,q.useEffect)(()=>{if(!G||!ft)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[G,ft]);let Zt=(0,q.useCallback)(async()=>{let t=K,n=le.trim()||`Untitled plan`;if(!t.trim()){fe(`error`),me(`Plan body cannot be empty`),ve(!1);return}ve(!1),fe(`saving`),me(null);try{let r=await E(e.id,{title:n,body:t,source:e.source,model:e.model}),i={body:r.body,title:r.title};Oe.current={body:i.body,title:i.title,version:r.version},Ae(i),Me(i),ot.current=`${e.id}:${r.version}`,ce(i.body),ue(i.title),rt(i.body),at(i.title),tt(r.version),ge(null),we(!1),fe(`saved`)}catch(e){fe(`error`),me(e instanceof Error?e.message:`Save as new version failed`)}},[K,le,E,e.id,e.source,e.model]);(0,q.useEffect)(()=>{if(!G||c!==`split`)return;let e=0;return e=requestAnimationFrame(()=>{e=0;let t=Ie.current;t&&D4(t,Te,{scrollContainer:t.closest(`.plan-rendered-layout`)??t.parentElement,onlyIfOutOfView:!0,behavior:`auto`})}),()=>{e&&cancelAnimationFrame(e)}},[G,c,Te]),(0,q.useEffect)(()=>{let e=e=>{let t=e.target,n=t?.tagName?.toLowerCase(),r=n===`input`||n===`textarea`||n===`select`||!!t?.isContentEditable;if((e.metaKey||e.ctrlKey)&&(e.key===`s`||e.key===`S`)){if(!G)return;e.preventDefault(),De.current&&=(clearTimeout(De.current),null),Xt();return}if(e.key===`e`||e.key===`E`){if(r||e.metaKey||e.ctrlKey||e.altKey)return;e.preventDefault(),G?Gt():lt&&Wt()}};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[G,lt,Wt,Gt,Xt]);let Qt=(0,q.useCallback)(e=>{B(e),window.setTimeout(()=>B(null),1600)},[]),$t=(0,q.useCallback)(async(e,t)=>{try{await navigator.clipboard.writeText(e),Qt(t)}catch{}},[Qt]),en=(0,q.useCallback)(async()=>{if(zt){oe(!0);try{await fetch(`/api/open-file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:zt,editor:u})})}catch{}finally{oe(!1)}}},[zt,u]),tn=(0,q.useCallback)((e,t=`start`)=>{e.scrollIntoView({behavior:`smooth`,block:t===`center`?`center`:`start`})},[]),nn=(0,q.useCallback)(e=>{if(!e||typeof document>`u`)return null;let t=Ie.current,n=t??document;try{let t=n.querySelector(`[data-plan-segment="${CSS.escape(e)}"]`);if(t)return t}catch{}return t?.querySelector(`#${CSS.escape(e)}`)??document.getElementById(e)},[]),rn=(0,q.useCallback)(e=>{let t=nn(e);if(t&&tn(t,`start`),typeof history<`u`&&typeof window<`u`){let t=`${window.location.pathname}${window.location.search}#${e}`;`${window.location.pathname}${window.location.search}${window.location.hash}`!==t&&history.replaceState(null,``,t)}},[nn,tn]);(0,q.useEffect)(()=>{if(!Je||G)return;let e=typeof window<`u`?window.location.hash.replace(/^#/,``):``;if(!e)return;let t=!1,n=()=>{if(t)return;let n=nn(decodeURIComponent(e));n&&tn(n,`start`)},r=window.requestAnimationFrame(()=>{window.requestAnimationFrame(n)}),i=()=>n();return window.addEventListener(`hashchange`,i),()=>{t=!0,window.cancelAnimationFrame(r),window.removeEventListener(`hashchange`,i)}},[Je,G,ut,c,nn,tn]);let an=(0,q.useCallback)((e,t)=>{let n=document.getElementById(`plan-comment-${e}`);if(n){tn(n,`center`),n.classList.add(`plan-comment-flash`),window.setTimeout(()=>n.classList.remove(`plan-comment-flash`),1400);return}let r=document.querySelector(`[data-plan-line="${t}"]`);r instanceof HTMLElement&&tn(r,`center`)},[tn]),on=(0,q.useCallback)((e,t)=>{an(e,t),ne&&ie(!1)},[an,ne,ie]);(0,q.useEffect)(()=>{if(!ne||!te)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),ie(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ne,te,ie]);let sn=(0,q.useCallback)((e=`sync`)=>{if(ct||G){e===`sync`&&Fe(null);return}let t=Ie.current,n=window.getSelection();if(!t||!n||n.isCollapsed||!n.rangeCount){e===`sync`&&Fe(null);return}if(!W2(n,t)){e===`sync`&&Fe(null);return}let r=G2(n,t)??n.getRangeAt(0),i=r.toString();if(!i.trim()){e===`sync`&&Fe(null);return}let a=X2(ut,i,r)??{text:i.replace(/\s+/g,` `).trim(),startLine:1,endLine:1},o=r.getClientRects(),s=null,c=null;for(let e=0;e<o.length;e++){let t=o[e];t.width===0&&t.height===0||(s||=t,c=t)}let l=s&&c?null:r.getBoundingClientRect(),u=s??l,d=c??l;if(!u||!d||u.width===0&&u.height===0){e===`sync`&&Fe(null);return}let f=window.innerHeight-d.bottom<54&&u.top>54?`above`:`below`,p=(d.left+d.right)/2;Fe({x:Math.min(Math.max(72,p),window.innerWidth-72),y:f===`below`?d.bottom+10:u.top-10,placement:f,startLine:a.startLine,endLine:a.endLine,text:a.text})},[ut,ct,G]);(0,q.useEffect)(()=>{if(ct||G||!Je)return;let e=0,t=t=>{e&&clearTimeout(e),e=setTimeout(()=>{requestAnimationFrame(()=>sn(t))},0)},n=e=>{e.target?.closest?.(`.plan-selection-popup, .plan-selection-comment, .plan-float-tray, .confirm-dialog`)||t(`sync`)},r=e=>{(e.key===`Shift`||e.key.startsWith(`Arrow`)||e.key===`End`||e.key===`Home`)&&t(`sync`)},i=()=>{t(`update`)};return document.addEventListener(`mouseup`,n,!0),document.addEventListener(`keyup`,r,!0),document.addEventListener(`selectionchange`,i),()=>{e&&clearTimeout(e),document.removeEventListener(`mouseup`,n,!0),document.removeEventListener(`keyup`,r,!0),document.removeEventListener(`selectionchange`,i)}},[ct,G,Je,sn]);let cn=(0,q.useCallback)(()=>{if(!Pe)return;let e=window.getSelection(),t=e&&e.rangeCount>0&&!e.isCollapsed?e.getRangeAt(0).cloneRange():null,n=t?g4(t):[],r=Pe.x-400/2,i=Pe.placement===`below`?Pe.y+8:Pe.y-420-8,a=j.length*28,o=h4(r+a,i+a,400,420),s=Pe.startLine,c=Pe.endLine,l=N2(ut,s,c),u={id:crypto.randomUUID(),lineNumber:c,startLineNumber:s===c?void 0:s,selectedQuote:Pe.text,exactLines:l,sourceContext:Nt(s,c),sectionTitle:M2(ut,s),panelPos:o,panelSize:{width:400,height:420},minimized:!1,highlightRects:n};M(e=>[...e,u]),I(Math.abs(c-s)+1),Fe(null)},[Pe,j.length,ut,Nt]);(0,q.useEffect)(()=>{let e=e=>{if(e.key===`Escape`&&!(ye||_e)){if(Pe){e.preventDefault(),Fe(null);return}if(G){if(_t&&!xe&&de!==`saving`){e.preventDefault(),e.stopPropagation(),be(!0);return}e.preventDefault(),e.stopPropagation(),Gt();return}Ze&&(e.preventDefault(),Qe(!1))}};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[Pe,Ze,Qe,G,_t,xe,de,ye,_e,Gt]),(0,q.useEffect)(()=>{if(!Pe)return;let e=()=>Fe(null);return window.addEventListener(`scroll`,e,{passive:!0,capture:!0}),()=>window.removeEventListener(`scroll`,e,!0)},[Pe]);let ln=typeof window<`u`?`${window.location.origin}${cE(window.location.pathname.startsWith(`/plan`)?window.location.pathname:`/plan/${e.id}`)}`:cE(`/plan/${e.id}`),un=(0,q.useCallback)(e=>{e.preventDefault();let t=Re.current;if(!t)return;let n=t.getBoundingClientRect();if(n.width<=0)return;Ue(!0),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let r=ze.current,i=0,a=e=>{r=s4(e),t.style.setProperty(`--plan-split-pct`,`${r}%`)},o=e=>{let t=(e.clientX-n.left)/n.width*100;i||=requestAnimationFrame(()=>{i=0,a(t)})},s=()=>{i&&cancelAnimationFrame(i),Ve(r),cD(t4.splitRatio,String(r)),Ue(!1),document.body.style.cursor=``,document.body.style.userSelect=``,document.removeEventListener(`mousemove`,o),document.removeEventListener(`mouseup`,s)};a((e.clientX-n.left)/n.width*100),document.addEventListener(`mousemove`,o),document.addEventListener(`mouseup`,s)},[]),dn=G?(0,J.jsx)(`div`,{className:`plan-file plan-file-editing`,children:(0,J.jsx)(O4,{value:K,onChange:ce,onActiveLineChange:Ee,fontSize:n,monoFontFamily:r,defaultTabSize:i,lineWrap:a,showLineNumbers:o})}):(0,J.jsx)(`div`,{className:`plan-file`,children:(0,J.jsx)(Rm,{file:{name:e.sourcePath?.split(/[/\\]/).pop()||`PLAN.md`,contents:ut,lang:`markdown`},options:{disableFileHeader:!0,enableGutterUtility:!0,enableLineSelection:!0,overflow:a?`wrap`:`scroll`,disableLineNumbers:!o,lineHoverHighlight:s,onLineSelectionStart:()=>{I(0),k(null),P(null),A.current=null},onLineSelectionChange:e=>{I(e?Math.abs(e.end-e.start)+1:0)},onLineSelectionEnd:e=>{if(I(0),e){let t=tG(e);kt({lineNumber:t.lineNumber,startLineNumber:t.startLineNumber})}},onGutterUtilityClick:e=>{let t=tG(e);kt({lineNumber:t.lineNumber,startLineNumber:t.startLineNumber})},theme:{dark:bt.type===`dark`?bt.themeName:`rose-pine`,light:bt.type===`light`?bt.themeName:`github-light`},themeType:bt.type,unsafeCSS:xt},selectedLines:O?N:void 0,lineAnnotations:Ft,renderAnnotation:It})}),fn=(0,J.jsxs)(`div`,{className:[`plan-rendered-layout`,ee&&Vt.length>0&&!Ze?`has-toc`:``,Xe?`plan-rendered-layout-solo`:``,Ze?`plan-rendered-layout-zen`:``].filter(Boolean).join(` `),children:[ee&&Vt.length>0&&!Ze&&(0,J.jsxs)(`nav`,{className:`plan-toc`,"aria-label":`Plan outline`,children:[(0,J.jsxs)(`div`,{className:`plan-toc-head`,children:[(0,J.jsx)(sO,{size:12,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`Outline`})]}),(0,J.jsx)(`ul`,{className:`plan-toc-list`,children:Vt.map(e=>(0,J.jsx)(`li`,{className:`plan-toc-item plan-toc-level-${Math.min(e.level,4)}`,children:(0,J.jsx)(`a`,{href:`#${e.id}`,onClick:t=>{t.preventDefault(),rn(e.id)},children:e.text})},e.id))})]}),(0,J.jsx)(`div`,{ref:Ie,className:`markdown-body plan-rendered`,onClick:yt,children:(0,J.jsx)(z2,{body:ut,outline:Vt,comments:wt,onResolve:t=>y(e.id,t),onUnresolve:t=>b(e.id,t),onDelete:t=>x(e.id,t),onEdit:(t,n)=>v(e.id,t,n),onReply:(t,n)=>S(e.id,t,n),onEditReply:(t,n,r)=>C(e.id,t,n,r),onDeleteReply:(t,n)=>w(e.id,t,n)})})]}),pn=(0,q.useMemo)(()=>`${c}:${et}:${wt.map(e=>e.id).join(`,`)}:${j.map(e=>e.id).join(`,`)}`,[c,et,wt,j]),mn=Je&&!G&&j.length>0?(0,J.jsx)(y4,{planId:e.id,composers:j,onChange:M,onSubmit:Pt,planBody:ut,buildSourceContext:Nt,renderedRootRef:Ie,layoutEpoch:pn}):null,hn=de===`saving`?`Saving…`:de===`saved`?`Saved`:de===`dirty`?`Unsaved`:de===`error`?pe||`Save failed`:null,gn=!Ze&&te&&Ct.length>0,_n=gn&&!ne,vn=gn?(0,J.jsxs)(`aside`,{className:`plan-comments-rail ${ne?`plan-comments-sheet`:``}`,"aria-label":`Comments map`,...ne?{role:`dialog`,"aria-modal":!0}:{},children:[(0,J.jsxs)(`div`,{className:`plan-comments-rail-head`,children:[(0,J.jsx)(gO,{size:12,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`Comments`}),(0,J.jsx)(`span`,{className:`plan-comments-rail-count`,children:Et>0?`${Et} open`:`${Ct.length}`}),ne&&(0,J.jsx)(`button`,{type:`button`,className:`plan-comments-sheet-close`,onClick:()=>ie(!1),"aria-label":`Close comments map`,children:(0,J.jsx)(WO,{size:14,"aria-hidden":`true`})})]}),(0,J.jsx)(`ul`,{className:`plan-comments-rail-list`,children:[...Ct].sort((e,t)=>e.status===t.status?e.lineNumber-t.lineNumber:e.status===`open`?-1:1).map(e=>(0,J.jsx)(`li`,{children:(0,J.jsxs)(`button`,{type:`button`,className:`plan-comments-rail-item ${e.status===`resolved`?`is-resolved`:``}`,onClick:()=>on(e.id,e.lineNumber),title:e.body.slice(0,200),children:[(0,J.jsx)(`span`,{className:`plan-comments-rail-line`,children:L2(e)}),(0,J.jsxs)(`span`,{className:`plan-comments-rail-preview`,children:[e.sectionTitle?`${e.sectionTitle} · `:``,e.body.replace(/\s+/g,` `).slice(0,80),e.body.length>80?`…`:``]}),(0,J.jsx)(`span`,{className:`plan-comments-rail-status plan-comments-rail-status-${e.status}`,children:e.status})]})},e.id))})]}):null;return(0,J.jsxs)(`div`,{className:`plan-review ${Ze?`plan-review-zen`:``} ${Xe?`plan-review-read`:``} ${G?`plan-review-editing`:``}`,children:[(0,J.jsxs)(`header`,{className:`plan-review-head`,ref:Le,children:[(0,J.jsxs)(`div`,{className:`plan-review-head-main`,children:[(0,J.jsxs)(`div`,{className:`plan-review-title-row`,children:[G?(0,J.jsx)(`input`,{className:`plan-review-title-input`,value:le,onChange:e=>ue(e.target.value),"aria-label":`Plan title`,placeholder:`Untitled plan`}):(0,J.jsxs)(`h2`,{className:`plan-review-title`,title:dt,children:[dt,ct&&dt!==e.title&&(0,J.jsxs)(`span`,{className:`plan-review-title-historical`,title:`Currently submitted title: ${e.title}`,children:[` `,`· was “`,e.title,`”`]})]}),(0,J.jsxs)(`span`,{className:`plan-badge ${Lt.className}`,children:[(0,J.jsx)(Rt,{size:12,"aria-hidden":`true`}),Lt.label]}),G&&hn&&(0,J.jsxs)(`span`,{className:`plan-review-chip plan-review-save-status plan-review-save-status-${de}`,role:`status`,title:pe??void 0,children:[de===`saving`&&(0,J.jsx)(cO,{size:11,className:`spin`,"aria-hidden":`true`}),hn]})]}),(0,J.jsxs)(`div`,{className:`plan-review-meta`,children:[$e.length<=1?(0,J.jsxs)(`span`,{className:`plan-review-chip`,children:[`v`,et]}):(0,J.jsxs)(`div`,{className:`plan-review-version-switcher ${ct?`is-historical`:``}`,children:[(0,J.jsx)(nO,{size:12,"aria-hidden":`true`,className:`plan-review-version-switcher-icon`}),(0,J.jsx)(tW,{value:String(et),onValueChange:t=>{let n=Number(t);if(G&&n!==e.version){Gt().then(()=>tt(n));return}tt(n)},options:vt,ariaLabel:`Plan version`}),ct&&(0,J.jsxs)(`button`,{type:`button`,className:`plan-review-version-back`,onClick:()=>tt(e.version),title:`Back to current v${e.version}`,children:[(0,J.jsx)(bD,{size:11,"aria-hidden":`true`}),`Current`]})]}),e.model&&(0,J.jsxs)(`span`,{className:`plan-review-chip plan-review-chip-model`,title:e.model,children:[(0,J.jsx)(SD,{size:11,"aria-hidden":`true`}),e.model]}),(0,J.jsxs)(`span`,{className:`plan-review-meta-stat`,title:`${Ut} lines · ${Ht} words · updated ${FT(e.updatedAt)}`,children:[Ut,`L · `,Ht,`W`,Et>0&&(0,J.jsxs)(`span`,{className:`plan-review-meta-open`,children:[` · `,Et,` open`]}),Ct.length>0&&Et===0&&(0,J.jsxs)(`span`,{children:[` `,`· `,Ct.length,` comment`,Ct.length===1?``:`s`]}),ct&&Dt!==Ct.length&&(0,J.jsxs)(`span`,{className:`plan-review-chip-sub`,children:[` of `,Dt]})]}),(F>0||j.length>0)&&(0,J.jsx)(`span`,{className:`plan-review-chip plan-review-chip-selection`,"aria-live":`polite`,children:j.length>0?`${j.length} draft${j.length===1?``:`s`}`:`${F} selected`}),(zt||e.source)&&(0,J.jsxs)(`div`,{className:`plan-source-inline`,children:[(0,J.jsx)(JD,{size:12,className:`plan-source-icon`,"aria-hidden":`true`}),(0,J.jsx)(`code`,{className:`plan-source-path`,title:zt??e.source,children:Bt??e.source}),zt&&(0,J.jsx)(Qw,{content:`Copy absolute source path`,side:`top`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn`,onClick:()=>$t(zt,`Path copied`),"aria-label":`Copy plan source path`,children:(0,J.jsx)(VD,{size:12})})}),z&&(0,J.jsx)(`span`,{className:`plan-source-flash`,role:`status`,children:z})]})]})]}),(0,J.jsxs)(`div`,{className:`plan-review-head-actions`,role:`toolbar`,"aria-label":`Plan actions`,children:[(0,J.jsx)(Qw,{content:`Copy review link`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn`,onClick:()=>$t(ln,`Link copied`),"aria-label":`Copy review URL`,children:(0,J.jsx)(oO,{size:14})})}),(0,J.jsx)(Qw,{content:`Copy plan markdown`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn`,onClick:()=>$t(ut,`Markdown copied`),"aria-label":`Copy plan markdown`,children:(0,J.jsx)(qD,{size:14})})}),zt&&(0,J.jsx)(Qw,{content:`Open source in editor`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn`,onClick:en,disabled:ae,"aria-label":`Open plan source in editor`,children:ae?(0,J.jsx)(cO,{size:14,className:`spin`}):(0,J.jsx)(UD,{size:14})})}),lt&&(0,J.jsx)(Qw,{content:G?`Done editing (e) — autosave flushes on exit`:`Edit plan live (e)`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn ${G?`is-active`:``} ${ft?`is-dirty`:``}`,onClick:()=>{G?Gt():Wt()},"aria-pressed":G,"aria-label":G?`Done editing plan`:`Edit plan`,children:(0,J.jsx)(DO,{size:14})})}),G&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Qw,{content:`Save now (⌘S)`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn`,onClick:()=>{De.current&&=(clearTimeout(De.current),null),Xt()},disabled:de===`saving`||D||xe,"aria-label":`Save plan now`,children:(0,J.jsx)(MO,{size:14})})}),(0,J.jsx)(Qw,{content:`Save as new version — bumps version and reopens review`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn`,onClick:()=>ve(!0),disabled:de===`saving`||D||xe||!K.trim(),"aria-label":`Save as new version`,children:D?(0,J.jsx)(cO,{size:14,className:`spin`}):(0,J.jsx)(XD,{size:14})})}),(0,J.jsx)(Qw,{content:gt?`Discard edits (Esc) — recent session or roll back to original`:mt&&!pt?`Roll back to original (Esc) — before you started editing this version`:`Discard edits (Esc) — restore to start of this edit session`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn plan-icon-btn-danger`,onClick:Yt,disabled:!_t||xe||de===`saving`,"aria-label":`Discard edits`,title:`Esc`,children:xe?(0,J.jsx)(cO,{size:14,className:`spin`}):(0,J.jsx)(jO,{size:14})})})]}),(0,J.jsx)(`span`,{className:`plan-action-divider`,"aria-hidden":`true`}),Xe&&(0,J.jsx)(Qw,{content:Ze?`Exit zen reading (z / Esc)`:`Zen mode — full-width focus reading (z)`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn ${Ze?`is-active`:``}`,onClick:()=>Qe(e=>!e),"aria-pressed":Ze,"aria-label":Ze?`Exit zen reading`:`Enter zen reading mode`,children:Ze?(0,J.jsx)(_O,{size:14}):(0,J.jsx)(uO,{size:14})})}),Je&&Vt.length>0&&!Ze&&(0,J.jsx)(Qw,{content:ee?`Hide outline (o)`:`Show outline (o)`,side:`bottom`,children:(0,J.jsx)(`button`,{type:`button`,className:`plan-icon-btn ${ee?`is-active`:``}`,onClick:()=>re(e=>!e),"aria-pressed":ee,"aria-label":ee?`Hide outline`:`Show outline`,children:(0,J.jsx)(sO,{size:14})})}),Ct.length>0&&!Ze&&(0,J.jsx)(Qw,{content:te?`Hide comments map (c)`:Et>0?`Show comments map (${Et} open) · c`:`Show comments map (c)`,side:`bottom`,children:(0,J.jsxs)(`button`,{type:`button`,className:`plan-icon-btn ${te?`is-active`:``}`,onClick:()=>ie(e=>!e),"aria-pressed":te,"aria-label":te?`Hide comments map`:Et>0?`Show comments map, ${Et} open`:`Show comments map`,children:[(0,J.jsx)(gO,{size:14}),Et>0&&(0,J.jsx)(`span`,{className:`plan-icon-btn-badge`,children:Et})]})})]})]}),Ze&&(0,J.jsxs)(`div`,{className:`plan-zen-bar`,role:`status`,children:[(0,J.jsx)(`span`,{className:`plan-zen-bar-label`,children:`Zen reading`}),(0,J.jsx)(`span`,{className:`plan-zen-bar-hint`,children:`Esc or button to exit`}),(0,J.jsxs)(`button`,{type:`button`,className:`plan-zen-bar-exit`,onClick:()=>Qe(!1),children:[(0,J.jsx)(_O,{size:13,"aria-hidden":`true`}),`Exit zen`]})]}),ct&&(0,J.jsxs)(`div`,{className:`plan-review-historical-banner`,role:`status`,children:[(0,J.jsx)(nO,{size:14,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[`Viewing `,(0,J.jsxs)(`strong`,{children:[`v`,et]}),` of this plan (current is`,` `,(0,J.jsxs)(`strong`,{children:[`v`,e.version]}),`). Comments and line anchors reflect v`,et,`.`]}),(0,J.jsxs)(`button`,{type:`button`,className:`plan-review-historical-banner-back`,onClick:()=>tt(e.version),children:[(0,J.jsx)(bD,{size:11,"aria-hidden":`true`}),`Back to current`]})]}),G&&(0,J.jsxs)(`div`,{className:`plan-review-edit-banner`,role:`status`,children:[(0,J.jsx)(DO,{size:14,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[`Editing live — changes autosave to the current version`,Dt>0?`. Line anchors on existing comments may shift if you insert or delete lines.`:`.`,` `,`New comments are disabled until you finish editing.`,ht?` Prior session edits are saved; Esc or Discard can roll back further.`:` Esc opens discard.`]}),_t&&(0,J.jsxs)(`button`,{type:`button`,className:`plan-review-edit-banner-discard`,onClick:Yt,disabled:xe||de===`saving`,children:[(0,J.jsx)(jO,{size:11,"aria-hidden":`true`}),mt&&!pt?`Roll back to original`:`Discard edits`,(0,J.jsx)(`kbd`,{className:`plan-review-edit-banner-kbd`,children:`Esc`})]}),G&&c===`rendered`&&(0,J.jsx)(`button`,{type:`button`,className:`plan-review-historical-banner-back`,onClick:()=>l?.(`split`),children:`Show source`})]}),!G&&Ce&&(0,J.jsxs)(`div`,{className:`plan-review-exit-saved-banner`,role:`status`,children:[(0,J.jsx)(MO,{size:14,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`strong`,{children:`Edits saved`}),` to this version. They are now the starting point the next time you press Edit. Use `,(0,J.jsx)(`strong`,{children:`Discard`}),` after re-entering edit to roll back to the plan as it was before you started editing this version.`]}),(0,J.jsx)(`button`,{type:`button`,className:`plan-review-exit-saved-banner-dismiss`,onClick:()=>we(!1),"aria-label":`Dismiss saved-edits notice`,children:(0,J.jsx)(WO,{size:14})})]}),he!=null&&(0,J.jsxs)(`div`,{className:`plan-review-conflict-banner`,role:`alert`,children:[(0,J.jsx)(mO,{size:14,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[`Agent submitted `,(0,J.jsxs)(`strong`,{children:[`v`,he]}),` while you have unsaved edits. Keep your draft, or discard and load the new version.`]}),(0,J.jsx)(`button`,{type:`button`,className:`plan-review-historical-banner-back`,onClick:()=>ge(null),children:`Keep editing`}),(0,J.jsx)(`button`,{type:`button`,className:`plan-review-historical-banner-back`,onClick:Kt,children:`Discard & load`})]}),e.decision!==`pending`&&e.decisionComment&&(0,J.jsxs)(`div`,{className:`plan-decision-banner ${Lt.className}`,children:[(0,J.jsx)(Rt,{size:15,"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`plan-decision-banner-text`,children:[(0,J.jsx)(`strong`,{children:Lt.label}),(0,J.jsx)(QV,{content:e.decisionComment,className:`plan-decision-banner-note markdown-body`})]})]}),Tt.length>0&&(0,J.jsxs)(`section`,{className:`plan-general-section`,"aria-label":`General comments`,children:[(0,J.jsxs)(`div`,{className:`plan-general-header`,children:[(0,J.jsx)(pO,{size:14,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`General comments`}),(0,J.jsx)(`span`,{className:`plan-general-count`,children:Tt.length})]}),(0,J.jsx)(`div`,{className:`plan-general-list`,children:Tt.map(t=>(0,J.jsx)(`div`,{id:`plan-comment-${t.id}`,children:(0,J.jsx)(F2,{comment:t,onResolve:()=>y(e.id,t.id),onUnresolve:()=>b(e.id,t.id),onDelete:()=>x(e.id,t.id),onEdit:n=>v(e.id,t.id,n),onReply:n=>S(e.id,t.id,n),onEditReply:(n,r)=>C(e.id,t.id,n,r),onDeleteReply:n=>w(e.id,t.id,n)})},t.id))})]}),(0,J.jsxs)(`div`,{className:`plan-review-body ${_n?`plan-review-body-with-rail`:``}`,children:[(0,J.jsxs)(`div`,{ref:Re,className:`plan-content ${Ye?`plan-content-split`:`plan-content-single`} ${He?`plan-content-split-dragging`:``} ${Xe?`plan-content-read`:``} ${Ze?`plan-content-zen`:``}`,style:Ye?{"--plan-split-pct":`${Be}%`}:void 0,children:[qe&&dn,Ye&&(0,J.jsx)(`div`,{className:`plan-split-resize-handle`,onMouseDown:un,onDoubleClick:()=>{Ve(50),cD(t4.splitRatio,`50`),Re.current?.style.setProperty(`--plan-split-pct`,`50%`)},role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize source and rendered panes`,title:`Drag to resize · double-click to reset 50/50`,"aria-valuenow":Math.round(Be),"aria-valuemin":20,"aria-valuemax":80,tabIndex:0,onKeyDown:e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=s4(Be+(e.key===`ArrowLeft`?-2:2));Ve(t),cD(t4.splitRatio,String(t)),Re.current?.style.setProperty(`--plan-split-pct`,`${t}%`)},children:(0,J.jsx)(`span`,{className:`plan-split-resize-grip`,"aria-hidden":`true`})}),Je&&fn]}),_n&&vn]}),gn&&ne&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`plan-comments-sheet-backdrop`,onClick:()=>ie(!1),"aria-hidden":`true`}),vn]}),Pe&&!G&&(0,J.jsxs)(`button`,{type:`button`,className:`plan-selection-popup plan-selection-popup-${Pe.placement}`,style:{left:Pe.x,top:Pe.y},onMouseDown:e=>e.preventDefault(),onClick:cn,children:[(0,J.jsx)(pO,{size:13,"aria-hidden":`true`}),`Add comment`,(0,J.jsxs)(`span`,{className:`plan-selection-popup-lines`,children:[`L`,Pe.startLine,Pe.endLine===Pe.startLine?``:`–${Pe.endLine}`]})]}),mn,(0,J.jsx)(B2,{isOpen:!!L,filePath:L,onClose:()=>R(null)}),(0,J.jsx)(LH,{open:_e,title:`Save as new version?`,description:`Creates v${e.version+1} from your current draft and reopens the plan for review (decision becomes pending). In-place autosave does not create a version.`,confirmLabel:`Save as new version`,cancelLabel:`Cancel`,variant:`primary`,onConfirm:()=>{Zt()},onCancel:()=>ve(!1)}),(0,J.jsx)(k4,{open:ye,canDiscardRecent:pt,canRollbackOriginal:mt&&ht,onChoose:e=>{Jt(e)},onCancel:()=>be(!1),busy:xe})]})}function F4(e,t,n){return`
3981
3984
  :host {
3982
3985
  --diffs-tab-size: ${e} !important;
3983
3986
  --diffs-font-family: ${n} !important;
@@ -4018,4 +4021,4 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
4018
4021
  background-color: var(--gl-selected) !important;
4019
4022
  }
4020
4023
  ${SW}
4021
- `}var A4={pending:{icon:RD,className:`plan-badge-pending`,label:`Pending`},approved:{icon:wD,className:`plan-badge-approved`,label:`Approved`},"changes-requested":{icon:mO,className:`plan-badge-changes`,label:`Changes`},rejected:{icon:WO,className:`plan-badge-rejected`,label:`Rejected`},"comment-only":{icon:hO,className:`plan-badge-comment-only`,label:`Comment only`}},j4=[`all`,`pending`,`approved`,`changes-requested`,`rejected`,`comment-only`];function M4(){try{let e=iD(Y2.decisionFilter);if(e&&j4.includes(e))return e}catch{}return`all`}function N4({plans:e,activeId:t,onSelect:n,onDelete:r,collapsed:i,onToggleCollapse:a}){let[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(M4),[u,d]=(0,q.useState)(null),f=(0,q.useCallback)(e=>{l(e),cD(Y2.decisionFilter,e)},[]),p=(0,q.useMemo)(()=>[...e].sort((e,t)=>t.createdAt-e.createdAt),[e]),m=(0,q.useMemo)(()=>{let e=o.toLowerCase().trim();return p.filter(t=>c!==`all`&&t.decision!==c?!1:e?`${t.title} ${t.source??``} ${t.sourcePath??``} ${t.model??``} ${t.id}`.toLowerCase().includes(e):!0)},[p,o,c]),h=(0,q.useMemo)(()=>e.filter(e=>e.decision===`pending`).length,[e]);return i?(0,J.jsx)(`div`,{className:`plan-list plan-list-collapsed`,children:a&&(0,J.jsx)(Qw,{content:`Expand sidebar · b`,side:`right`,children:(0,J.jsx)(`button`,{className:`sidebar-toggle`,onClick:a,"aria-label":`Expand sidebar`,children:(0,J.jsx)(wO,{size:16})})})}):(0,J.jsxs)(`div`,{className:`plan-list`,children:[(0,J.jsxs)(`div`,{className:`plan-list-chrome`,children:[(0,J.jsxs)(`div`,{className:`plan-list-toolbar`,children:[a&&(0,J.jsx)(Qw,{content:`Collapse sidebar · b`,side:`right`,children:(0,J.jsx)(`button`,{className:`sidebar-toggle`,onClick:a,"aria-label":`Collapse sidebar`,children:(0,J.jsx)(CO,{size:16})})}),(0,J.jsxs)(`div`,{className:`plan-list-search`,children:[(0,J.jsx)(NO,{size:14,className:`plan-list-search-icon`,"aria-hidden":`true`}),(0,J.jsx)(`input`,{type:`text`,placeholder:`Search plans…`,value:o,onChange:e=>s(e.target.value),className:`plan-list-search-input`,"aria-label":`Search plans`})]})]}),(0,J.jsx)(`div`,{className:`plan-list-filters`,role:`group`,"aria-label":`Filter by decision`,children:[{id:`all`,label:`All`},{id:`pending`,label:h?`Pending ${h}`:`Pending`},{id:`approved`,label:`Approved`},{id:`changes-requested`,label:`Changes`},{id:`rejected`,label:`Rejected`}].map(e=>(0,J.jsx)(`button`,{type:`button`,className:`plan-list-filter ${c===e.id?`is-active`:``}`,"aria-pressed":c===e.id,onClick:()=>f(e.id),children:e.label},e.id))})]}),(0,J.jsxs)(`div`,{className:`plan-list-scroll`,children:[(0,J.jsx)(`div`,{className:`plan-list-header`,children:(0,J.jsx)(`span`,{children:m.length===e.length?`${e.length} plan${e.length===1?``:`s`}`:`${m.length} of ${e.length}`})}),m.length===0&&(0,J.jsx)(`div`,{className:`plan-list-empty`,children:o||c!==`all`?`No matching plans.`:`No plans yet.`}),(0,J.jsx)(`div`,{className:`plan-list-items`,children:m.map(e=>{let i=A4[e.decision],a=i.icon,o=(e.comments??[]).filter(e=>e.status===`open`).length,s=e.sourcePath||e.source,c=e.id===t;return(0,J.jsxs)(`div`,{className:`plan-list-item ${c?`plan-list-item-active`:``}`,onClick:()=>n(e.id),role:`button`,tabIndex:0,"aria-current":c?`true`:void 0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e.id))},children:[(0,J.jsxs)(`div`,{className:`plan-list-item-top`,children:[(0,J.jsx)(`span`,{className:`plan-badge plan-badge-dot ${i.className}`,title:i.label,children:(0,J.jsx)(a,{size:11,"aria-hidden":`true`})}),(0,J.jsx)(`span`,{className:`plan-list-item-title`,title:e.title,children:e.title}),s&&(0,J.jsx)(Qw,{content:`Copy source path`,children:(0,J.jsx)(`button`,{className:`plan-list-copy-path`,title:`Copy source path`,"aria-label":`Copy source path`,onClick:t=>{t.stopPropagation();let n=e.sourcePath||e.source||``;navigator.clipboard?.writeText(n).then(()=>{d(e.id),window.setTimeout(()=>d(null),1200)},()=>{})},children:u===e.id?(0,J.jsx)(wD,{size:12}):(0,J.jsx)(VD,{size:12})})}),(0,J.jsx)(`button`,{className:`plan-list-delete`,title:`Delete plan`,"aria-label":`Delete plan`,onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,J.jsx)(zO,{size:12,"aria-hidden":`true`})})]}),(0,J.jsxs)(`div`,{className:`plan-list-item-sub`,children:[(0,J.jsxs)(`span`,{className:`plan-list-item-version`,children:[`v`,e.version]}),o>0&&(0,J.jsxs)(`span`,{className:`plan-list-item-open`,children:[o,` open`]}),e.model&&(0,J.jsxs)(`span`,{className:`plan-list-item-model`,title:e.model,children:[(0,J.jsx)(SD,{size:10,"aria-hidden":`true`}),e.model]}),(0,J.jsx)(`span`,{className:`plan-list-item-time`,children:FT(e.createdAt)})]})]},e.id)})})]})]})}var P4=[{value:`approved`,label:`Approve`,description:`The plan looks good — the agent should proceed.`,icon:wD,className:`plan-verdict-approve`},{value:`changes-requested`,label:`Request changes`,description:`The agent should revise the plan and resubmit it.`,icon:mO,className:`plan-verdict-changes`},{value:`rejected`,label:`Reject`,description:`Don't proceed — the approach needs rethinking.`,icon:WO,className:`plan-verdict-reject`},{value:`comment-only`,label:`Comment only`,description:`Agent must NOT edit files — only reply to comments. General note goes to chat.`,icon:hO,className:`plan-verdict-comment-only`}];function F4({openCommentCount:e,onSubmit:t,submitting:n,agentWaiting:r,currentDecision:i}){let{haptic:a,sound:o}=xT(),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(``),{popoverStyle:p,activePreset:m,applyPreset:h,startResize:g,startLeftResize:_,startCornerResize:v,handleOpenChange:y,panelRef:b}=yH(),x=async()=>{l&&(a(`heavy`),o(`send`),await t(l,d,l===`comment-only`?`comment-only`:`standard`),f(``),u(null),c(!1))},S=i!==`pending`;return(0,J.jsx)(Pk,{open:s,onOpenChange:(e,t)=>y(e,t,c),ariaLabel:`Submit plan review`,className:`submit-plan-review-popover`,trigger:(0,J.jsxs)(`button`,{className:`btn btn-primary btn-sm send-review-btn`,disabled:n,title:r?`An agent is connected and waiting for your verdict`:`Submit your verdict on this plan`,style:{display:`inline-flex`,alignItems:`center`,gap:`6px`},children:[r&&(0,J.jsx)(`span`,{className:`agent-waiting-dot`,"aria-hidden":`true`}),S?(0,J.jsx)(kO,{size:14}):(0,J.jsx)(FD,{size:14}),(0,J.jsx)(`span`,{className:`btn-label`,children:n?`Submitting…`:S?`Update review`:`Submit review`})]}),children:(0,J.jsxs)(`div`,{className:`srp`,ref:b,style:p,children:[(0,J.jsx)(`div`,{className:`srp-resize-handle-left`,onPointerDown:_,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize submit panel width`,tabIndex:0}),(0,J.jsxs)(`div`,{className:`srp-head`,children:[S?(0,J.jsx)(kO,{size:15,"aria-hidden":`true`}):(0,J.jsx)(FD,{size:15,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`srp-title`,children:S?`Update plan review`:`Submit plan review`}),(0,J.jsx)(`div`,{className:`srp-size-presets`,role:`group`,"aria-label":`Panel size`,children:uH.map((e,t)=>(0,J.jsx)(`button`,{className:`srp-preset-btn`,role:`radio`,"aria-checked":m===t,"aria-pressed":m===t,onClick:()=>h(e),title:`${e.width}×${e.height}px`,children:e.label},e.label))}),e>0&&(0,J.jsxs)(`span`,{className:`srp-count`,children:[e,` open comment`,e===1?``:`s`]})]}),(0,J.jsxs)(`div`,{className:`srp-scroll`,children:[(0,J.jsx)(`div`,{className:`plan-verdict-options`,role:`radiogroup`,"aria-label":`Verdict`,children:P4.map(e=>{let t=e.icon,n=l===e.value;return(0,J.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,className:`plan-verdict-option ${e.className} ${n?`plan-verdict-option-selected`:``}`,onClick:()=>u(e.value),children:[(0,J.jsx)(`span`,{className:`plan-verdict-icon`,children:(0,J.jsx)(t,{size:15,"aria-hidden":`true`})}),(0,J.jsxs)(`span`,{className:`plan-verdict-text`,children:[(0,J.jsx)(`span`,{className:`plan-verdict-label`,children:e.label}),(0,J.jsx)(`span`,{className:`plan-verdict-desc`,children:e.description})]}),(0,J.jsx)(`span`,{className:`plan-verdict-radio`,"aria-hidden":`true`})]},e.value)})}),(0,J.jsxs)(`div`,{className:`srp-general`,children:[(0,J.jsxs)(`label`,{className:`srp-general-label`,htmlFor:`plan-decision-comment`,children:[`Overall comment `,(0,J.jsx)(`span`,{className:`srp-optional`,children:`(optional · Markdown)`})]}),(0,J.jsx)(sH,{id:`plan-decision-comment`,value:d,onChange:f,textareaClassName:`srp-general-input`,placeholder:`Add an overall note for the agent that applies to the whole plan…`,rows:3,ariaLabel:`Overall plan review comment`,onSubmitShortcut:x})]})]}),(0,J.jsxs)(`div`,{className:`srp-footer`,children:[(0,J.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>c(!1),disabled:n,children:`Cancel`}),(0,J.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:x,disabled:!l||n,children:n?`Submitting…`:`Submit review`})]}),(0,J.jsx)(`div`,{className:`srp-resize-handle`,onPointerDown:g,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize submit panel`,tabIndex:0}),(0,J.jsx)(`div`,{className:`srp-resize-handle-corner`,onPointerDown:v,role:`separator`,"aria-label":`Resize submit panel width and height`,tabIndex:0})]})})}var I4=[11,12,13,14,15,16].map(e=>({value:String(e),label:`${e}px`})),L4=[2,4,8].map(e=>({value:String(e),label:String(e)})),R4=[{value:`both`,label:`Both`},{value:`line`,label:`Line only`},{value:`number`,label:`Number only`},{value:`disabled`,label:`Disabled`}];function z4(){let e=Op(),{settings:t,loaded:n,updateSettings:r}=BE();VE(n,t.uiFont,t.monoFont);let{plans:i,getPlan:a,removePlan:o,agentActivity:s,clearAgentActivity:c,submitDecision:l,submitting:u,agentWaiting:d,isLoading:f}=OE(),p=FE(),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(!1);(0,q.useEffect)(()=>{let e=e=>{if(e.metaKey||e.ctrlKey){if(e.key===`,`||e.code===`Comma`){e.preventDefault(),_(e=>!e);return}(e.key===`?`||e.key===`/`&&e.shiftKey||e.code===`Slash`&&e.shiftKey)&&(e.preventDefault(),y(!0))}};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]);let[b,x]=(0,q.useState)(()=>{try{let e=iD(Y2.viewMode);if(e===`rendered`||e===`split`||e===`source`)return e}catch{}return`source`}),[S,C]=(0,q.useState)(()=>Z2(`rendered`)),w=(0,q.useCallback)(e=>{if(e===`source`||e===`rendered`){C(e);try{cD(Y2.lastSingleViewMode,e)}catch{}}else if(b===`source`||b===`rendered`){C(b);try{cD(Y2.lastSingleViewMode,b)}catch{}}x(e);try{cD(Y2.viewMode,e)}catch{}},[b]),T=r4(),E=(0,q.useMemo)(()=>X2(b,T,S),[b,T,S]),[D,O]=(0,q.useState)(()=>$2(Y2.zenMode,!1)),k=(0,q.useCallback)(e=>{O(e);try{cD(Y2.zenMode,String(e))}catch{}},[]),A=(0,q.useCallback)(()=>{b===`rendered`?k(!D):(w(`rendered`),k(!0))},[b,D,w,k]),[j,M]=(0,q.useState)(()=>{try{let e=iD(Y2.tocOpen);if(e===`false`)return!1;if(e===`true`)return!0}catch{}return!0}),[N,P]=(0,q.useState)(()=>{try{let e=iD(Y2.commentsRail);if(e===`false`)return!1;if(e===`true`)return!0}catch{}return Q2()}),F=(0,q.useCallback)(e=>{M(e),cD(Y2.tocOpen,String(e))},[]),I=(0,q.useCallback)(e=>{P(e),cD(Y2.commentsRail,String(e))},[]),L=(0,q.useCallback)(()=>{F(!j)},[j,F]),R=(0,q.useCallback)(()=>{I(!N)},[N,I]),z=(0,q.useMemo)(()=>{let e=/^\/plan\/([^/]+)/.exec(p);return e?decodeURIComponent(e[1]):null},[p]),B=(0,q.useMemo)(()=>z?a(z):i.length===0?null:[...i].reverse().find(e=>e.decision===`pending`)??i[i.length-1],[z,i,a]),V=(0,q.useMemo)(()=>LT[t.theme||`rose-pine`]||LT[`rose-pine`],[t.theme]);(0,q.useEffect)(()=>{let e=t.theme||`rose-pine`,n=document.documentElement;n.classList.add(`theme-switching`),n.setAttribute(`data-theme`,e);let r=requestAnimationFrame(()=>{requestAnimationFrame(()=>n.classList.remove(`theme-switching`))});return()=>cancelAnimationFrame(r)},[t.theme]),(0,q.useEffect)(()=>{e&&e.setRenderOptions({theme:{dark:V.type===`dark`?V.themeName:`rose-pine`,light:V.type===`light`?V.themeName:`github-light`}}).catch(e=>console.error(`Failed to set worker pool render options:`,e))},[e,V]),(0,q.useEffect)(()=>{let e=V.type===`dark`?V.themeName:`rose-pine`,t=V.type===`light`?V.themeName:`github-light`;Bd({themes:Array.from(new Set([e,t])),langs:[]}).catch(()=>{})},[V]);let[H,U]=(0,q.useState)(()=>{try{let e=iD(`diffing-sidebar-collapsed`);if(e!=null)return e===`true`}catch{}return typeof window<`u`&&window.innerWidth<=768}),[W,ee]=(0,q.useState)(()=>{try{let e=iD(`diffing-sidebar-width`);return e?Number(e):320}catch{return 320}});(0,q.useEffect)(()=>{try{cD(`diffing-sidebar-collapsed`,String(H))}catch{}},[H]);let te=(0,q.useRef)(W);te.current=W;let ne=(0,q.useRef)(null),re=(0,q.useRef)(null),ie=(0,q.useRef)(null),ae=(0,q.useRef)(null),oe=(0,q.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=te.current,r=ie.current,i=ae.current,a=r?r.getBoundingClientRect().left:0,o=n,s=0,c=()=>{s=0,i&&(i.style.transform=`translateX(${a+o}px)`)};i&&(i.style.transform=`translateX(${a+n}px)`,i.classList.add(`sidebar-resize-guide-active`));let l=e=>{let r=e.clientX-t;o=Math.max(240,Math.min(640,n+r)),s||=requestAnimationFrame(c)},u=()=>{s&&cancelAnimationFrame(s),i&&i.classList.remove(`sidebar-resize-guide-active`),ee(o);try{cD(`diffing-sidebar-width`,String(o))}catch{}document.removeEventListener(`mousemove`,l),document.removeEventListener(`mouseup`,u),document.body.style.cursor=``,document.body.style.userSelect=``};document.addEventListener(`mousemove`,l),document.addEventListener(`mouseup`,u),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]);(0,q.useEffect)(()=>{let e=ne.current,t=re.current;if(!e||!t)return;let n=()=>{let n=t.getBoundingClientRect().height;e.style.setProperty(`--plan-toolbar-offset`,`${n}px`)};if(n(),typeof ResizeObserver>`u`)return;let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[n,f]);let G=(0,q.useCallback)(()=>{U(e=>!e)},[]),se=(0,q.useCallback)(()=>{r({lineWrap:!t.lineWrap})},[t.lineWrap,r]),K=(0,q.useCallback)(()=>{r({showLineNumbers:!t.showLineNumbers})},[t.showLineNumbers,r]),ce=(0,q.useCallback)(()=>{let e=[`source`,`rendered`,`split`],t=e[(e.indexOf(b)+1)%e.length];w(t)},[b,w]),le=(0,q.useCallback)(()=>{let e=[2,4,8],n=t.defaultTabSize||4;r({defaultTabSize:e[(e.indexOf(n)+1)%e.length]})},[t.defaultTabSize,r]),ue=(0,q.useCallback)(e=>{if(i.length===0)return;let t=[...i].sort((e,t)=>t.createdAt-e.createdAt),n=0;if(B){let r=t.findIndex(e=>e.id===B.id);r!==-1&&(n=e===`next`?Math.min(r+1,t.length-1):Math.max(r-1,0))}let r=t[n];jE(`/plan/${r.id}`)},[i,B]),de=(0,q.useCallback)(e=>{jE(`/plan/${e}`),typeof window<`u`&&window.matchMedia(`(max-width: 768px)`).matches&&U(!0)},[]);O2((0,q.useMemo)(()=>({onNavigatePlan:ue,onToggleViewMode:ce,onToggleZenMode:A,onToggleCommentsRail:R,onToggleOutline:L,onCycleTabSize:le,onToggleSidebar:G,onToggleLineWrap:se,onToggleLineNumbers:K,onOpenTheme:()=>h(!0),onOpenShortcuts:()=>y(!0)}),[ue,ce,A,R,L,le,G,se,K]));let fe=(0,q.useMemo)(()=>B?(B.comments??[]).filter(e=>e.status===`open`).length:0,[B]);return f||!n?(0,J.jsxs)(`div`,{className:`app plan-app skeleton-app`,style:{"--sidebar-width":`${W}px`},children:[(0,J.jsxs)(`header`,{className:`skeleton-toolbar`,children:[(0,J.jsx)(`div`,{className:`skeleton-item skeleton-logo`}),(0,J.jsx)(`div`,{className:`skeleton-item skeleton-stats`}),(0,J.jsx)(`div`,{className:`skeleton-item skeleton-actions`})]}),(0,J.jsxs)(`div`,{className:`app-body`,children:[(0,J.jsx)(`aside`,{className:`sidebar plan-sidebar skeleton-sidebar ${H?`sidebar-collapsed`:``}`,children:!H&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`skeleton-search`}),(0,J.jsx)(`div`,{className:`skeleton-tree-nodes`,children:Array.from({length:4}).map((e,t)=>(0,J.jsxs)(`div`,{className:`skeleton-tree-node`,children:[(0,J.jsx)(`div`,{className:`skeleton-node-icon`}),(0,J.jsx)(`div`,{className:`skeleton-node-text`})]},t))})]})}),!H&&(0,J.jsx)(`div`,{className:`sidebar-resize-handle skeleton-resize-handle`}),(0,J.jsx)(`main`,{className:`main plan-main skeleton-main`,children:(0,J.jsxs)(`div`,{className:`file-diff-card skeleton-card`,children:[(0,J.jsxs)(`div`,{className:`skeleton-card-header`,children:[(0,J.jsx)(`div`,{className:`skeleton-card-title`}),(0,J.jsx)(`div`,{className:`skeleton-card-badge`})]}),(0,J.jsxs)(`div`,{className:`skeleton-card-body`,children:[(0,J.jsx)(`div`,{className:`skeleton-code-line`}),(0,J.jsx)(`div`,{className:`skeleton-code-line`}),(0,J.jsx)(`div`,{className:`skeleton-code-line`}),(0,J.jsx)(`div`,{className:`skeleton-code-line`}),(0,J.jsx)(`div`,{className:`skeleton-code-line`}),(0,J.jsx)(`div`,{className:`skeleton-code-line`})]})]})})]})]}):(0,J.jsx)(bT,{enabled:t.haptics??!0,soundsEnabled:t.sounds??!0,children:(0,J.jsxs)(`div`,{className:`app plan-app`,ref:ne,style:{"--sidebar-width":`${W}px`},children:[(0,J.jsx)(`div`,{className:`sidebar-resize-guide`,ref:ae,"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`toolbar plan-app-toolbar`,ref:re,children:[(0,J.jsxs)(`div`,{className:`toolbar-left`,children:[(0,J.jsx)(`button`,{className:`toolbar-mobile-toggle`,onClick:()=>U(!H),"aria-label":`Toggle sidebar`,title:H?`Open sidebar`:`Close sidebar`,children:(0,J.jsx)(dO,{size:18})}),(0,J.jsx)(Qw,{content:`Back to diff review`,side:`bottom`,children:(0,J.jsxs)(`button`,{className:`btn btn-sm plan-toolbar-back`,onClick:()=>jE(`/`),"aria-label":`Back to the diff review`,children:[(0,J.jsx)(bD,{size:14}),(0,J.jsx)(`span`,{className:`btn-label`,children:`Diff`})]})}),(0,J.jsxs)(`div`,{className:`plan-toolbar-brand`,children:[(0,J.jsx)(HH,{size:18,className:`plan-app-brand`}),(0,J.jsxs)(`div`,{className:`plan-toolbar-brand-text`,children:[(0,J.jsx)(`h1`,{className:`toolbar-title plan-app-title`,children:`Plans`}),B?(0,J.jsx)(`span`,{className:`plan-toolbar-active`,title:B.title,children:B.title}):(0,J.jsxs)(`span`,{className:`plan-toolbar-count`,children:[i.length,` plan`,i.length===1?``:`s`]})]})]})]}),(0,J.jsx)(`div`,{className:`plan-view-toggle`,role:`group`,"aria-label":`Plan view mode`,children:[{id:`source`,label:`Source`,icon:zD,tip:`Source — select lines to comment`},{id:`rendered`,label:`Read`,icon:qD,tip:`Read — rendered markdown (highlight to comment)`},{id:`split`,label:`Split`,icon:BD,tip:`Split — source + rendered (drag the divider to resize)`}].map(({id:e,label:t,icon:n,tip:r})=>{let i=E===e;return(0,J.jsx)(Qw,{content:`${r} · m to cycle${e===`split`&&T&&b===`split`?` — opens when the window is wider`:``}`,side:`bottom`,children:(0,J.jsxs)(`button`,{type:`button`,className:`plan-view-toggle-btn ${i?`is-active`:``}`,"aria-pressed":i,"aria-label":r,onClick:()=>w(e),children:[(0,J.jsx)(n,{size:13,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:t})]})},e)})}),(0,J.jsxs)(`div`,{className:`toolbar-right`,children:[(0,J.jsx)(Pk,{open:g,onOpenChange:_,ariaLabel:`Settings`,className:`settings-popover`,trigger:(0,J.jsxs)(`button`,{className:`btn btn-sm settings-btn ${g?`btn-active`:``}`,title:`Settings (⌘,)`,"aria-label":`Settings`,children:[(0,J.jsx)(PO,{size:14}),(0,J.jsx)(`span`,{className:`btn-label`,children:`Settings`})]}),children:(0,J.jsxs)(`div`,{className:`popover-scroll settings-panel`,children:[(0,J.jsx)(`div`,{className:`settings-section-label`,children:`Appearance`}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Theme`}),(0,J.jsxs)(`button`,{className:`btn btn-sm settings-btn`,onClick:()=>{_(!1),h(!0)},children:[(0,J.jsx)(SO,{size:14,className:`settings-item-icon`}),(0,J.jsx)(`span`,{children:`Switch Theme...`})]})]}),(0,J.jsx)(`div`,{className:`settings-section-label`,children:`Plan chrome`}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:j,onChange:e=>F(e.target.checked)}),`Show outline`]}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:N,onChange:e=>I(e.target.checked)}),`Show comments panel`]}),(0,J.jsx)(`div`,{className:`settings-section-label`,children:`Display`}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:t.lineWrap,onChange:e=>r({lineWrap:e.target.checked})}),`Wrap long lines`]}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:t.showLineNumbers,onChange:e=>r({showLineNumbers:e.target.checked})}),`Show line numbers`]}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:t.showStatusBar??!0,onChange:e=>r({showStatusBar:e.target.checked})}),`Show status bar`]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Hover highlight`}),(0,J.jsx)(tW,{value:t.lineHoverHighlight,onValueChange:e=>r({lineHoverHighlight:e}),options:R4,ariaLabel:`Hover highlight`})]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Font size`}),(0,J.jsx)(tW,{value:String(t.fontSize),onValueChange:e=>r({fontSize:Number(e)}),options:I4,ariaLabel:`Font size`})]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Default tab size`}),(0,J.jsx)(tW,{value:String(t.defaultTabSize),onValueChange:e=>r({defaultTabSize:Number(e)}),options:L4,ariaLabel:`Default tab size`})]})]})}),B&&(0,J.jsx)(F4,{openCommentCount:fe,onSubmit:(e,t)=>l(B.id,e,t),submitting:u,agentWaiting:d,currentDecision:B.decision})]})]}),!H&&(0,J.jsx)(`div`,{className:`sidebar-mobile-backdrop`,onClick:()=>U(!0),"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`app-body`,children:[(0,J.jsx)(`aside`,{ref:ie,className:`sidebar plan-sidebar ${H?`sidebar-collapsed`:``}`,children:(0,J.jsx)(`div`,{className:`plan-sidebar-content`,children:(0,J.jsx)(N4,{plans:i,activeId:B?.id??null,onSelect:de,onDelete:e=>{o(e),B?.id===e&&jE(`/plan`)},collapsed:H,onToggleCollapse:()=>U(!H)})})}),!H&&(0,J.jsx)(`div`,{className:`sidebar-resize-handle`,onMouseDown:oe,role:`separator`,"aria-label":`Resize sidebar`,"aria-orientation":`vertical`,tabIndex:0}),(0,J.jsx)(`main`,{className:`main plan-main`,children:B?(0,J.jsx)(O4,{plan:B,theme:t.theme||`rose-pine`,fontSize:t.fontSize,monoFontFamily:zE(t.monoFont),defaultTabSize:t.defaultTabSize,lineWrap:t.lineWrap,showLineNumbers:t.showLineNumbers,lineHoverHighlight:t.lineHoverHighlight,viewMode:E,onViewModeChange:w,editorIDE:t.editorIDE,tocOpen:j,onTocOpenChange:F,commentsRailOpen:N,onCommentsRailOpenChange:I,zenMode:D,onZenModeChange:k},B.id):(0,J.jsx)(B4,{hasPlans:i.length>0,notFound:!!z})})]}),(0,J.jsx)(m2,{open:m,activeTheme:t.theme||`rose-pine`,onThemeChange:e=>r({theme:e}),onClose:()=>h(!1)}),(0,J.jsx)(f2,{activity:s?{at:s.at,commentId:s.commentId,filePath:`plan · ${s.planId.slice(0,8)}`,model:s.model,body:s.body}:null,onDismiss:c,onJump:()=>{s&&(jE(`/plan/${s.planId}`),requestAnimationFrame(()=>{document.getElementById(`plan-comment-${s.commentId}`)?.scrollIntoView({behavior:`smooth`,block:`center`})}))}}),(0,J.jsx)(u2,{activeFile:B?B.title:null,onShowHelp:()=>y(!0),placeholder:`No active plan (J/K to jump)`,visible:t.showStatusBar??!0}),(0,J.jsx)(d2,{isOpen:v,onClose:()=>y(!1),mode:`plan`})]})})}function B4({hasPlans:e,notFound:t}){return(0,J.jsxs)(`div`,{className:`plan-empty-state`,children:[(0,J.jsx)(`div`,{className:`plan-empty-icon`,"aria-hidden":`true`,children:(0,J.jsx)(ID,{size:28})}),t?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h2`,{className:`plan-empty-title`,children:`Plan not found`}),(0,J.jsx)(`p`,{className:`plan-empty-body`,children:`It may have been deleted. Pick another from the list, or submit a new one.`})]}):e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h2`,{className:`plan-empty-title`,children:`Select a plan`}),(0,J.jsx)(`p`,{className:`plan-empty-body`,children:`Choose one from the sidebar to start reviewing.`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h2`,{className:`plan-empty-title`,children:`No plans yet`}),(0,J.jsx)(`p`,{className:`plan-empty-body`,children:`Agents submit a plan, you review it here, then they continue on approval.`}),(0,J.jsxs)(`div`,{className:`plan-empty-steps`,children:[(0,J.jsx)(`code`,{children:`diffing plan submit PLAN.md`}),(0,J.jsx)(`code`,{children:`diffing plan await`})]})]})]})}var V4=[`pr-session`];function H4(){let e=Re(),{data:t,isLoading:n,error:r}=$e({queryKey:V4,queryFn:async()=>{let e=await fetch(`/api/gh/session`);if(e.status===404)return null;if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();return t?.prMode===!1?null:t},retry:!1});return(0,q.useEffect)(()=>gE(`pr-session`,()=>{e.invalidateQueries({queryKey:V4})}),[e]),{session:t,loaded:!n,error:r}}function U4(e){let t=Re();(0,q.useEffect)(()=>{if(!e)return;let n=!1,r=!1,i=async()=>{if(!(n||r||document.visibilityState===`hidden`)){r=!0;try{(await fetch(`/api/gh/comments/sync`,{method:`POST`})).ok&&!n&&await t.invalidateQueries({queryKey:V4})}finally{r=!1}}},a=()=>{i()};i();let o=window.setInterval(i,3e4);return window.addEventListener(`focus`,a),()=>{n=!0,window.clearInterval(o),window.removeEventListener(`focus`,a)}},[e,t])}var W4=[`pr-comments`];function G4(e){let t=Re(),{data:n=[]}=$e({queryKey:W4,queryFn:async()=>{let e=await fetch(`/api/gh/pr-session/comments`);if(e.status===404)return[];if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()},enabled:e});(0,q.useEffect)(()=>gE(`pr-session`,()=>{t.invalidateQueries({queryKey:W4})}),[t]);let r=et({mutationFn:async e=>(await fetch(`/api/gh/pr-session/comments`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).json(),onSuccess:e=>{t.setQueryData(W4,(t=[])=>[...t,e])}}),i=et({mutationFn:async e=>(await fetch(`/api/gh/pr-session/comments/${e}`,{method:`DELETE`}),e),onSuccess:e=>{t.setQueryData(W4,(t=[])=>t.filter(t=>t.id!==e))}}),a=et({mutationFn:async({id:e,body:t,status:n})=>(await fetch(`/api/gh/pr-session/comments/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:t,status:n})})).json(),onSuccess:e=>{t.setQueryData(W4,(t=[])=>t.map(t=>t.id===e.id?e:t))}}),o=et({mutationFn:async({id:e,body:t})=>{let n=await fetch(`/api/gh/pr-session/comments/${e}/replies`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:t,role:`user`})}),r=await n.json().catch(()=>({}));if(!n.ok||!r.id)throw Error(r.error||`HTTP ${n.status}`);return r},onMutate:async({id:e,body:n})=>{await t.cancelQueries({queryKey:W4});let r=t.getQueryData(W4)??[],i=`pending-${crypto.randomUUID()}`;return t.setQueryData(W4,(t=[])=>t.map(t=>t.id===e?{...t,replies:[...t.replies??[],{id:i,body:n,createdAt:Date.now(),role:`user`}]}:t)),{previous:r}},onError:(e,n,r)=>{r?.previous&&t.setQueryData(W4,r.previous)},onSuccess:e=>{t.setQueryData(W4,(t=[])=>t.map(t=>t.id===e.id?e:t))}}),s=(0,q.useCallback)(e=>{a.mutate({id:e,status:`resolved`})},[a]),c=(0,q.useCallback)(e=>{a.mutate({id:e,status:`open`})},[a]),l=(0,q.useCallback)((e,t,n)=>{},[]),u=(0,q.useCallback)((e,t)=>{},[]);return{comments:n,addComment:r.mutate,removeComment:i.mutate,updateComment:a.mutate,addReply:o.mutateAsync,resolveComment:s,unresolveComment:c,editComment:(e,t)=>a.mutate({id:e,body:t}),editReply:l,removeReply:u}}function K4(){let e=Re();return et({mutationFn:async e=>{let t=new AbortController,n=window.setTimeout(()=>t.abort(),6e4);try{let n=await fetch(`/api/gh/submit`,{method:`POST`,headers:{"Content-Type":`application/json`},signal:t.signal,body:JSON.stringify({decision:e.decision,body:e.body,dryRun:e.dryRun})}),r=await n.json();if(!n.ok||!r.ok)throw Error(r.error||`HTTP ${n.status}`);return r}catch(e){throw t.signal.aborted?Error(`GitHub submission timed out. Check your connection and try again.`):e}finally{window.clearTimeout(n)}},onSuccess:()=>{e.setQueryData(W4,[]),e.invalidateQueries({queryKey:V4}),e.invalidateQueries({queryKey:W4})}})}function q4(){let e=Re();return et({mutationFn:async()=>{let e=await fetch(`/api/gh/pr/refresh`,{method:`POST`}),t=await e.json();if(!e.ok)throw Error(t.error||`HTTP ${e.status}`);return t},onSuccess:()=>{e.invalidateQueries({queryKey:V4}),e.invalidateQueries({queryKey:W4})}})}function J4({session:e,comments:t,onEditComment:n,onDeleteComment:r,onSubmitted:i}){let{haptic:a,sound:o}=xT(),s=K4(),[c,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)(null),[f,p]=(0,q.useState)(``),{popoverStyle:m,activePreset:h,applyPreset:g,startResize:_,startLeftResize:v,startCornerResize:y,handleOpenChange:b,panelRef:x}=yH(),S=t.length,C=(0,q.useMemo)(()=>[...t].sort((e,t)=>e.createdAt-t.createdAt),[t]),w=!!e.submittedAt,T=async()=>{if(u){a(`heavy`),o(`send`);try{let e=await s.mutateAsync({decision:u,body:f});i?.(e),p(``),d(null),l(!1)}catch{}}};return(0,J.jsx)(Pk,{open:c,onOpenChange:(e,t)=>b(e,t,l),ariaLabel:`Submit your review to GitHub`,className:`submit-to-github-popover`,trigger:(0,J.jsxs)(`button`,{className:`btn btn-primary btn-sm send-review-btn`,disabled:s.isPending,title:w?`Already submitted`:`Submit your review to the PR on GitHub`,style:{display:`inline-flex`,alignItems:`center`,gap:`6px`},children:[(0,J.jsx)(eO,{size:14}),(0,J.jsx)(`span`,{className:`btn-label`,children:s.isPending?`Submitting…`:w?`Submitted ✓`:S>0?`Submit to GitHub (${S})`:`Submit to GitHub`})]}),children:(0,J.jsxs)(`div`,{className:`srp`,ref:x,style:m,children:[(0,J.jsx)(`div`,{className:`srp-resize-handle-left`,onPointerDown:v,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize submit panel width`,tabIndex:0}),(0,J.jsxs)(`div`,{className:`srp-head`,children:[(0,J.jsx)(eO,{size:15,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`srp-title`,children:`Submit review to GitHub`}),(0,J.jsx)(`div`,{className:`srp-size-presets`,role:`group`,"aria-label":`Panel size`,children:uH.map((e,t)=>(0,J.jsx)(`button`,{className:`srp-preset-btn`,role:`radio`,"aria-checked":h===t,"aria-pressed":h===t,onClick:()=>g(e),title:`${e.width}×${e.height}px`,children:e.label},e.label))}),(0,J.jsxs)(`span`,{className:`srp-count`,children:[S,` comment`,S===1?``:`s`]})]}),(0,J.jsxs)(`div`,{className:`srp-scroll`,children:[w&&(0,J.jsxs)(`div`,{className:`srp-already-submitted`,children:[(0,J.jsx)(wD,{size:13}),(0,J.jsxs)(`span`,{children:[`Already submitted as`,` `,e.submittedReviewUrl?(0,J.jsxs)(`a`,{href:e.submittedReviewUrl,target:`_blank`,rel:`noreferrer`,children:[`review #`,e.submittedReviewId,` `,(0,J.jsx)(UD,{size:11})]}):`review #${e.submittedReviewId}`,`. Re-submitting will post a new review on the same PR.`]})]}),(0,J.jsx)(`div`,{className:`plan-verdict-options`,role:`radiogroup`,"aria-label":`Verdict`,children:Y4.map(e=>{let t=e.icon,n=u===e.value;return(0,J.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,className:`plan-verdict-option ${e.className} ${n?`plan-verdict-option-selected`:``}`,onClick:()=>d(e.value),children:[(0,J.jsx)(`span`,{className:`plan-verdict-icon`,children:(0,J.jsx)(t,{size:15,"aria-hidden":`true`})}),(0,J.jsxs)(`span`,{className:`plan-verdict-text`,children:[(0,J.jsx)(`span`,{className:`plan-verdict-label`,children:e.label}),(0,J.jsx)(`span`,{className:`plan-verdict-desc`,children:e.description})]}),(0,J.jsx)(`span`,{className:`plan-verdict-radio`,"aria-hidden":`true`})]},e.value)})}),S>0?(0,J.jsxs)(`section`,{className:`srp-comments-section`,"aria-labelledby":`srp-gh-comments-title`,children:[(0,J.jsxs)(`div`,{className:`srp-section-heading`,id:`srp-gh-comments-title`,children:[(0,J.jsx)(hO,{size:13,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`Inline comments to publish`}),(0,J.jsx)(`span`,{className:`srp-section-count`,children:S})]}),(0,J.jsx)(`ul`,{className:`srp-list`,"aria-label":`Comments to send`,children:C.map(e=>(0,J.jsx)(X4,{comment:e,onEdit:n,onDelete:r},e.id))})]}):(0,J.jsx)(`p`,{className:`srp-empty`,children:`No inline comments — your verdict and overall note will be sent on their own.`}),(0,J.jsxs)(`div`,{className:`srp-general`,children:[(0,J.jsxs)(`label`,{className:`srp-general-label`,htmlFor:`srp-gh-general-input`,children:[`Overall comment `,(0,J.jsx)(`span`,{className:`srp-optional`,children:`(optional · Markdown)`})]}),(0,J.jsx)(sH,{id:`srp-gh-general-input`,value:f,onChange:p,textareaClassName:`srp-general-input`,placeholder:`Add an overall note for the PR that applies to the whole review…`,rows:3,ariaLabel:`Overall PR review comment`,onSubmitShortcut:T})]}),s.isError&&(0,J.jsxs)(`div`,{className:`srp-error`,role:`alert`,children:[(0,J.jsx)(kD,{size:13}),(0,J.jsx)(`span`,{children:s.error?.message??`Submit failed`})]})]}),(0,J.jsxs)(`div`,{className:`srp-footer`,children:[(0,J.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>l(!1),disabled:s.isPending,children:`Cancel`}),(0,J.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:T,disabled:!u||s.isPending,children:s.isPending?`Submitting…`:u===`draft`?`Save draft review`:`Submit review`})]}),(0,J.jsx)(`div`,{className:`srp-resize-handle`,onPointerDown:_,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize submit panel`,tabIndex:0}),(0,J.jsx)(`div`,{className:`srp-resize-handle-corner`,onPointerDown:y,role:`separator`,"aria-label":`Resize submit panel width and height`,tabIndex:0})]})})}var Y4=[{value:`approve`,label:`Approve`,description:`The PR is good — submit an APPROVE review.`,icon:wD,className:`plan-verdict-approve`},{value:`comment`,label:`Comment`,description:`Leave neutral feedback (no approve / no request changes).`,icon:mO,className:`plan-verdict-changes`},{value:`request-changes`,label:`Request changes`,description:`The author must address the comments before merging.`,icon:WO,className:`plan-verdict-reject`},{value:`draft`,label:`Save as draft`,description:`Post a PENDING review on GitHub — finish it later in the PR UI.`,icon:KD,className:`plan-verdict-comment-only`}];function X4({comment:e,onEdit:t,onDelete:n}){let[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.body),s=(0,q.useRef)(null);(0,q.useEffect)(()=>{r&&(s.current?.focus(),s.current?.select())},[r]);let c=e.lineNumber>0?e.startLineNumber&&e.startLineNumber!==e.lineNumber?`:${e.startLineNumber}-${e.lineNumber}`:`:${e.lineNumber}`:` · file`,l=()=>{let n=a.trim();n&&n!==e.body&&t(e.id,n),i(!1)};return(0,J.jsxs)(`li`,{className:`srp-item`,children:[(0,J.jsxs)(`div`,{className:`srp-item-top`,children:[(0,J.jsxs)(`span`,{className:`srp-item-loc`,children:[(0,J.jsx)(`span`,{className:`srp-item-file`,children:IT(e.filePath)}),(0,J.jsx)(`span`,{className:`srp-item-line`,children:c})]}),e.status===`resolved`&&(0,J.jsx)(`span`,{className:`srp-item-resolved`,children:`resolved`}),(0,J.jsxs)(`span`,{className:`srp-item-actions`,children:[r?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{className:`srp-icon-btn`,onClick:l,title:`Save edit`,children:(0,J.jsx)(wD,{size:13,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{className:`srp-icon-btn`,onClick:()=>{o(e.body),i(!1)},title:`Cancel edit`,children:(0,J.jsx)(WO,{size:13,"aria-hidden":`true`})})]}):(0,J.jsx)(`button`,{className:`srp-icon-btn`,onClick:()=>i(!0),title:`Edit comment`,children:(0,J.jsx)(DO,{size:13,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{className:`srp-icon-btn srp-icon-btn-danger`,onClick:()=>n(e.id),title:`Remove from review`,children:(0,J.jsx)(zO,{size:13,"aria-hidden":`true`})})]})]}),e.lineContent?.trim()&&(0,J.jsx)(`code`,{className:`srp-item-code`,children:e.lineContent.trim().slice(0,160)}),r?(0,J.jsx)(`textarea`,{ref:s,className:`srp-item-edit`,value:a,rows:2,onChange:e=>o(e.target.value),onKeyDown:t=>{t.key===`Enter`&&(t.metaKey||t.ctrlKey)?(t.preventDefault(),l()):t.key===`Escape`&&(t.preventDefault(),o(e.body),i(!1))}}):(0,J.jsx)(`p`,{className:`srp-item-body`,children:e.body})]})}function Z4({session:e,comments:t,settingsProps:n,sidebarCollapsed:r,onToggleSidebar:i,onOpenSearch:a,onRefresh:o,refreshing:s,onEditComment:c,onDeleteComment:l,onSubmitted:u}){return(0,J.jsxs)(`header`,{className:`toolbar diff-app-toolbar pr-review-toolbar`,role:`banner`,children:[(0,J.jsxs)(`div`,{className:`toolbar-left`,children:[(0,J.jsx)(`button`,{className:`toolbar-mobile-toggle`,onClick:i,"aria-label":r?`Open file tree`:`Close file tree`,"aria-expanded":!r,title:r?`Open sidebar · b`:`Close sidebar · b`,children:(0,J.jsx)(dO,{size:18})}),(0,J.jsx)(`button`,{className:`pr-toolbar-back`,onClick:()=>jE(`/`),title:`Back to local review`,"aria-label":`Back to local review`,children:(0,J.jsx)(bD,{size:14})}),(0,J.jsxs)(`div`,{className:`toolbar-brand pr-toolbar-brand`,children:[(0,J.jsx)(HH,{size:20,className:`toolbar-brand-mark`}),(0,J.jsxs)(`div`,{className:`toolbar-brand-text`,children:[(0,J.jsxs)(`h1`,{className:`toolbar-title`,children:[e.owner,`/`,e.repo]}),(0,J.jsxs)(`span`,{className:`toolbar-branch-inline`,title:`Pull request #${e.pullNumber}`,children:[(0,J.jsx)(eO,{size:11}),` #`,e.pullNumber]}),e.headRefName&&e.baseRefName&&(0,J.jsxs)(`span`,{className:`toolbar-branch-flow`,title:`Comparing ${e.headRefName} into ${e.baseRefName}`,"aria-label":`Source branch ${e.headRefName} into target branch ${e.baseRefName}`,children:[(0,J.jsx)(`code`,{className:`toolbar-branch-head`,children:e.headRefName}),(0,J.jsx)(xD,{size:11,"aria-hidden":`true`}),(0,J.jsx)(`code`,{className:`toolbar-branch-base`,children:e.baseRefName})]})]})]})]}),(0,J.jsxs)(`div`,{className:`toolbar-right`,children:[(0,J.jsxs)(`button`,{className:`btn btn-sm toolbar-search-btn`,onClick:a,title:`Search files and changed lines (⌘K)`,"aria-label":`Search`,children:[(0,J.jsx)(NO,{size:14}),(0,J.jsx)(`span`,{className:`btn-label`,children:`Search`}),(0,J.jsx)(`kbd`,{className:`toolbar-search-kbd`,children:`⌘K`})]}),(0,J.jsxs)(`button`,{className:`btn btn-sm pr-header-copy`,onClick:()=>navigator.clipboard.writeText(SE(t)),disabled:t.length===0,title:`Copy draft comments as Markdown`,children:[(0,J.jsx)(VD,{size:13}),` `,(0,J.jsx)(`span`,{className:`btn-label`,children:`Copy`})]}),(0,J.jsxs)(`button`,{className:`btn btn-sm pr-header-refresh`,onClick:o,disabled:s,title:`Refresh PR from GitHub`,children:[(0,J.jsx)(kO,{size:13,className:s?`spinning`:``}),(0,J.jsx)(`span`,{className:`btn-label`,children:s?`Refreshing…`:`Refresh`})]}),(0,J.jsxs)(`a`,{className:`btn btn-sm pr-header-link`,href:e.url,target:`_blank`,rel:`noreferrer`,title:`Open pull request on GitHub`,children:[(0,J.jsx)(UD,{size:13}),` `,(0,J.jsx)(`span`,{className:`btn-label`,children:`GitHub`})]}),(0,J.jsx)(fW,{...n}),(0,J.jsx)(J4,{session:e,comments:t,onEditComment:c,onDeleteComment:l,onSubmitted:u})]})]})}var Q4={APPROVED:{label:`approved these changes`,short:`Approved`,icon:AD},CHANGES_REQUESTED:{label:`requested changes`,short:`Changes requested`,icon:PD},COMMENTED:{label:`left a review comment`,short:`Commented`,icon:fO},PENDING:{label:`started a pending review`,short:`Pending`,icon:LD},DISMISSED:{label:`had a review dismissed`,short:`Dismissed`,icon:PD}};function $4({reviews:e}){let[t,n]=(0,q.useState)(e[0]?.id??null),[r,i]=(0,q.useState)(null);if((0,q.useEffect)(()=>{n(e[0]?.id??null)},[e[0]?.id]),(0,q.useEffect)(()=>{i(null)},[t]),e.length===0)return null;let a=Math.max(0,e.findIndex(e=>e.id===t)),o=e[a]??e[0],s=Q4[o.state],c=s.icon,l=o.submittedAt?new Date(o.submittedAt).getTime():null;return(0,J.jsxs)(`section`,{className:`pr-review-activity`,"aria-label":`GitHub review activity`,children:[(0,J.jsxs)(`header`,{className:`pr-review-activity-head`,children:[(0,J.jsxs)(`div`,{className:`pr-review-activity-identity`,children:[o.author?.avatarUrl&&r!==o.author.avatarUrl?(0,J.jsx)(`img`,{src:`/api/gh/avatar?url=${encodeURIComponent(o.author.avatarUrl)}`,alt:``,className:`pr-review-activity-avatar`,referrerPolicy:`no-referrer`,onError:()=>i(o.author?.avatarUrl??null)}):(0,J.jsx)(`span`,{className:`pr-review-activity-avatar is-fallback`,"aria-hidden":`true`,children:(0,J.jsx)(c,{size:14})}),(0,J.jsx)(c,{className:`pr-review-activity-state-icon`,"data-state":o.state,size:16,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[(0,J.jsxs)(`strong`,{children:[`@`,o.author?.login??`unknown`]}),` `,s.label]}),l!=null&&(0,J.jsx)(`time`,{dateTime:o.submittedAt,title:new Date(l).toLocaleString(),children:FT(l)}),(0,J.jsx)(`span`,{className:`pr-review-activity-verdict`,"data-state":o.state,children:s.short})]}),(0,J.jsxs)(`nav`,{className:`pr-review-activity-nav`,"aria-label":`Walk GitHub reviews`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm commit-walk-btn`,disabled:a===0,onClick:()=>n(e[a-1]?.id??o.id),"aria-label":`Newer review`,title:`Newer review`,children:(0,J.jsx)(ED,{size:14})}),(0,J.jsxs)(`span`,{children:[a+1,` / `,e.length]}),(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm commit-walk-btn`,disabled:a>=e.length-1,onClick:()=>n(e[a+1]?.id??o.id),"aria-label":`Older review`,title:`Older review`,children:(0,J.jsx)(DD,{size:14})}),o.htmlUrl&&(0,J.jsxs)(`a`,{className:`pr-review-activity-link`,href:o.htmlUrl,target:`_blank`,rel:`noreferrer`,children:[`View on GitHub `,(0,J.jsx)(UD,{size:11})]})]})]}),o.body.trim()?(0,J.jsx)(QV,{content:o.body,className:`pr-review-activity-body markdown-body`}):(0,J.jsx)(`p`,{className:`pr-review-activity-empty`,children:`No overall comment was submitted with this review.`})]})}function e3(e){return e.some(e=>e.state===`pending`)?8e3:3e4}function t3(e){return e===`success`?{icon:AD,className:`is-success`,label:`Succeeded`}:e===`pending`?{icon:LD,className:`is-pending`,label:`In progress`}:e===`failure`||e===`error`||e===`timed_out`||e===`action_required`?{icon:PD,className:`is-failure`,label:e===`timed_out`?`Timed out`:`Failed`}:e===`skipped`||e===`cancelled`||e===`neutral`?{icon:MD,className:`is-neutral`,label:e===`cancelled`?`Cancelled`:e===`skipped`?`Skipped`:`Neutral`}:{icon:jD,className:`is-neutral`,label:`Unknown`}}function n3({headSha:e}){let t=$e({queryKey:[`pr-checks`,e],queryFn:async()=>{let e=await fetch(`/api/gh/checks`),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||`HTTP ${e.status}`);return t},refetchInterval:e=>e3(e.state.data?.checks??[]),refetchOnWindowFocus:!0,staleTime:5e3}),n=t.data?.checks??[],r=n.filter(e=>e.state===`success`).length,i=n.filter(e=>e.state===`pending`).length,a=n.filter(e=>[`failure`,`error`,`timed_out`,`action_required`].includes(e.state)).length,o=Math.max(0,n.length-r-i-a),s=a>0?`failure`:i>0?`pending`:n.length>0?`success`:`neutral`,c=s===`failure`?PD:s===`pending`?LD:s===`success`?AD:jD;return(0,J.jsx)(Pk,{ariaLabel:`GitHub checks`,className:`pr-checks-popover`,trigger:(0,J.jsxs)(`button`,{className:`toolbar-chip pr-checks-trigger is-${s}`,title:`Live GitHub checks and actions status`,type:`button`,children:[(0,J.jsx)(c,{size:12}),(0,J.jsx)(`span`,{children:t.isLoading?`Loading checks…`:n.length===0?`No checks`:a>0?`${a} failing`:i>0?`${i} running`:`${r}/${n.length} passed`})]}),children:(0,J.jsxs)(`div`,{className:`pr-checks-panel`,children:[(0,J.jsxs)(`div`,{className:`pr-checks-head`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`strong`,{children:`Checks and actions`}),(0,J.jsxs)(`span`,{children:[`Live status for `,e.slice(0,7)]})]}),(0,J.jsx)(`button`,{className:`file-diff-icon-btn`,onClick:()=>t.refetch(),disabled:t.isFetching,"aria-label":`Refresh checks`,children:(0,J.jsx)(kO,{size:13,className:t.isFetching?`spinning`:``})})]}),n.length>0&&(0,J.jsxs)(`div`,{className:`pr-checks-summary`,"aria-label":`Checks summary`,children:[(0,J.jsxs)(`span`,{className:`is-success`,children:[(0,J.jsx)(AD,{size:12}),` `,r,` passed`]}),(0,J.jsxs)(`span`,{className:`is-failure`,children:[(0,J.jsx)(PD,{size:12}),` `,a,` failed`]}),(0,J.jsxs)(`span`,{className:`is-pending`,children:[(0,J.jsx)(LD,{size:12}),` `,i,` running`]}),o>0&&(0,J.jsxs)(`span`,{className:`is-neutral`,children:[(0,J.jsx)(MD,{size:12}),` `,o,` other`]})]}),t.isError?(0,J.jsxs)(`div`,{className:`pr-checks-empty is-error`,children:[(0,J.jsx)(kD,{size:15}),` `,t.error.message]}):t.isLoading?(0,J.jsx)(`div`,{className:`pr-checks-empty`,children:`Loading the latest GitHub status…`}):n.length===0?(0,J.jsx)(`div`,{className:`pr-checks-empty`,children:`No checks are reported for this commit.`}):(0,J.jsx)(`ul`,{className:`pr-checks-list`,children:n.map((e,t)=>{let n=t3(e.state),r=n.icon;return(0,J.jsxs)(`li`,{className:n.className,children:[(0,J.jsx)(r,{size:14}),(0,J.jsx)(`span`,{className:`pr-checks-name`,children:e.name}),(0,J.jsx)(`span`,{className:`pr-checks-state`,children:n.label}),e.detailsUrl&&(0,J.jsx)(`a`,{href:e.detailsUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Open ${e.name} on GitHub`,children:(0,J.jsx)(UD,{size:12})})]},`${e.name}-${t}`)})}),(0,J.jsx)(`div`,{className:`pr-checks-foot`,children:`Updates every 8 seconds while work is running.`})]})})}function r3({session:e,draftCount:t}){return(0,J.jsx)(`section`,{className:`diff-overview-banner pr-overview-banner`,"aria-label":`Pull request #${e.pullNumber}: ${e.title}`,children:(0,J.jsxs)(`header`,{className:`diff-overview-banner-header`,children:[(0,J.jsxs)(`div`,{className:`diff-overview-banner-line`,children:[(0,J.jsx)(eO,{size:14,className:`diff-overview-banner-icon`,"aria-hidden":`true`}),(0,J.jsx)(`h2`,{className:`diff-overview-banner-headline`,children:e.title})]}),(0,J.jsxs)(`div`,{className:`diff-overview-banner-meta pr-overview-meta`,children:[(0,J.jsxs)(`span`,{className:`pr-overview-identity`,children:[`Pull request #`,e.pullNumber,e.author?.login?(0,J.jsxs)(J.Fragment,{children:[` by `,(0,J.jsxs)(`strong`,{children:[`@`,e.author.login]})]}):null]}),e.headRefName&&e.baseRefName&&(0,J.jsxs)(`span`,{className:`pr-overview-branches`,title:`Comparing ${e.headRefName} into ${e.baseRefName}`,children:[(0,J.jsx)(`code`,{className:`pr-overview-branch-head`,children:e.headRefName}),(0,J.jsx)(`span`,{className:`pr-overview-branch-arrow`,"aria-hidden":`true`,children:`→`}),(0,J.jsx)(`code`,{className:`pr-overview-branch-base`,children:e.baseRefName})]}),(0,J.jsxs)(`span`,{children:[e.changedFiles,` file`,e.changedFiles===1?``:`s`]}),(0,J.jsxs)(`span`,{className:`toolbar-chip-diff`,"aria-label":`${e.additions} additions and ${e.deletions} deletions`,children:[(0,J.jsxs)(`span`,{className:`stat-additions`,children:[`+`,e.additions]}),(0,J.jsxs)(`span`,{className:`stat-deletions`,children:[`−`,e.deletions]})]}),t>0&&(0,J.jsxs)(`span`,{className:`toolbar-chip toolbar-chip-comments`,children:[t,` draft`,t===1?``:`s`]}),(0,J.jsx)(n3,{headSha:e.headSha})]})]})})}function i3({result:e,onDismiss:t}){return(0,J.jsxs)(`div`,{className:`pr-submitted-toast`,role:`status`,children:[(0,J.jsx)(AD,{size:16,className:`pr-submitted-icon`}),(0,J.jsxs)(`div`,{className:`pr-submitted-text`,children:[(0,J.jsx)(`strong`,{children:`Review submitted to GitHub.`}),e.reviewUrl&&(0,J.jsxs)(J.Fragment,{children:[` `,(0,J.jsxs)(`a`,{href:e.reviewUrl,target:`_blank`,rel:`noreferrer`,children:[`Open review on GitHub `,(0,J.jsx)(UD,{size:11})]})]}),e.authSource&&e.authSource!==`none`&&(0,J.jsxs)(`span`,{className:`pr-submitted-auth`,children:[`via `,e.authSource]})]}),(0,J.jsx)(`button`,{className:`pr-submitted-dismiss`,onClick:t,title:`Dismiss`,"aria-label":`Dismiss`,children:`×`})]})}function a3(){let e=Op(),t=Re(),{settings:n,loaded:r,updateSettings:i}=BE(),[,a]=(0,q.useTransition)(),{session:o,loaded:s,error:c}=H4(),l=q4();U4(s&&!!o);let{comments:u,addComment:d,removeComment:f,updateComment:p,addReply:m,resolveComment:h,unresolveComment:g,editComment:_,editReply:v,removeReply:y}=G4(s&&!!o),{patch:b,loading:x,error:S}=bE({staged:!1,untracked:!1},s&&!!o),{viewedFiles:C,setViewed:w}=GE(),[T,E]=(0,q.useState)(null),[D,O]=(0,q.useState)(()=>{let e=iD(`diffing-sidebar-collapsed`);return e==null?typeof window<`u`&&window.innerWidth<=768:e===`true`}),[k,A]=(0,q.useState)(()=>Number(iD(`diffing-sidebar-width`))||320),[j,M]=(0,q.useState)(()=>Number(iD(`diffing-comment-panel-height`))||220),[N,P]=(0,q.useState)(()=>YE(iD(`diffing-pr-extension-filter`)??``)),[F,I]=(0,q.useState)(()=>{let e=iD(`diffing-pr-chip-filter`);return e===`unviewed`||e===`has-comments`?e:`all`}),[L,R]=(0,q.useState)({open:!1,scope:`files`,changedOnly:!1}),z=(0,q.useRef)(!0),[B,V]=(0,q.useState)(!1),[H,U]=(0,q.useState)(!1),[W,ee]=(0,q.useState)(!1),[te,ne]=(0,q.useState)(!1),[re,ie]=(0,q.useState)(null),ae=(0,q.useRef)(null),oe=(0,q.useRef)(null),G=(0,q.useRef)(null),se=(0,q.useRef)(k),K=(0,q.useRef)(j);se.current=k,K.current=j,VE(r,n.uiFont,n.monoFont);let ce=(0,q.useMemo)(()=>{if(!b)return[];try{let e=new Set;return Mh(b).flatMap(e=>e.files).filter(t=>e.has(t.name)?!1:(e.add(t.name),!0)).sort(yG)}catch{return[]}},[b]),le=(0,q.useMemo)(()=>{let e=new Map;for(let t of o?.existingComments??[]){let n=e.get(t.path)??[];n.push(t),e.set(t.path,n)}return e},[o]),ue=(0,q.useMemo)(()=>{let e={};for(let t of u)e[t.filePath]=(e[t.filePath]??0)+1;for(let t of o?.existingComments??[])e[t.path]=(e[t.path]??0)+1;return e},[u,o]),de=(0,q.useMemo)(()=>{let e=ce;return N.length>0&&(e=e.filter(e=>QE(e.name,N))),F===`unviewed`&&(e=e.filter(e=>!C.has(e.name))),F===`has-comments`&&(e=e.filter(e=>(ue[e.name]??0)>0)),e},[ce,N,F,C,ue]),fe=(0,q.useMemo)(()=>{let e=new Map;for(let t of u){let n=e.get(t.filePath)??[];n.push({side:t.side,lineNumber:t.lineNumber,metadata:t}),e.set(t.filePath,n)}return e},[u]),pe=uD(de),me=(0,q.useMemo)(()=>({diffFileSet:TT(de),changedKeys:ET(pe),customMode:!0,staged:!1}),[de,pe]),he=(0,q.useMemo)(()=>zE(n.monoFont),[n.monoFont]),ge=(0,q.useMemo)(()=>new Set,[]),_e=(0,q.useCallback)(e=>{E(e),document.getElementById(`file-${e}`)?.scrollIntoView({block:`start`})},[]),ve=(0,q.useCallback)(e=>{let t=de[de.findIndex(t=>t.name===e)+1];t&&requestAnimationFrame(()=>requestAnimationFrame(()=>{document.getElementById(`file-${t.name}`)?.scrollIntoView({block:`start`,behavior:`smooth`})}))},[de]),ye=(0,q.useCallback)((e,t)=>{w(e,t),t&&ve(e)},[w,ve]),be=(0,q.useCallback)(async(e,n)=>{let r=await fetch(`/api/gh/existing-comments/${e}/replies`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:n})}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.error||`HTTP ${r.status}`);await t.invalidateQueries({queryKey:[`pr-session`]})},[t]),xe=(0,q.useCallback)(async(e,n,r)=>{let i=await fetch(`/api/gh/existing-comments/${n}`,{method:e,headers:r==null?void 0:{"Content-Type":`application/json`},body:r==null?void 0:JSON.stringify({body:r})}),a=await i.json().catch(()=>({}));if(!i.ok)throw Error(a.error||`HTTP ${i.status}`);await t.invalidateQueries({queryKey:[`pr-session`]})},[t]),Se=(0,q.useCallback)(async(e,n)=>{let r=await fetch(`/api/gh/review-threads/${encodeURIComponent(e)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({resolved:n})}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.error||`HTTP ${r.status}`);await t.invalidateQueries({queryKey:[`pr-session`]})},[t]),Ce=(0,q.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=se.current,r=oe.current?.getBoundingClientRect().left??0,i=n,a=e=>{i=Math.max(240,Math.min(640,n+e.clientX-t)),G.current&&(G.current.style.transform=`translateX(${r+i}px)`)},o=()=>{G.current?.classList.remove(`sidebar-resize-guide-active`),A(i),cD(`diffing-sidebar-width`,String(i)),document.removeEventListener(`mousemove`,a),document.removeEventListener(`mouseup`,o),document.body.style.cursor=``,document.body.style.userSelect=``};G.current?.classList.add(`sidebar-resize-guide-active`),document.addEventListener(`mousemove`,a),document.addEventListener(`mouseup`,o),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]),we=(0,q.useCallback)(e=>{e.preventDefault();let t=e.clientY,n=K.current,r=n,i=e=>{r=Math.max(100,Math.min(600,n+t-e.clientY)),ae.current?.style.setProperty(`--comment-panel-height`,`${r}px`)},a=()=>{M(r),cD(`diffing-comment-panel-height`,String(r)),document.removeEventListener(`mousemove`,i),document.removeEventListener(`mouseup`,a),document.body.style.cursor=``,document.body.style.userSelect=``};document.addEventListener(`mousemove`,i),document.addEventListener(`mouseup`,a),document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`},[]);(0,q.useEffect)(()=>{cD(`diffing-sidebar-collapsed`,String(D))},[D]),(0,q.useEffect)(()=>cD(`diffing-pr-extension-filter`,N.join(`,`)),[N]),(0,q.useEffect)(()=>cD(`diffing-pr-chip-filter`,F),[F]),(0,q.useEffect)(()=>{let e=document.documentElement;e.classList.add(`theme-switching`),e.setAttribute(`data-theme`,n.theme||`rose-pine`),e.setAttribute(`data-density`,n.density||`comfortable`);let t=requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.remove(`theme-switching`)));return()=>cancelAnimationFrame(t)},[n.theme,n.density]);let Te=(0,q.useMemo)(()=>LT[n.theme||`rose-pine`]||LT[`rose-pine`],[n.theme]),Ee=(0,q.useMemo)(()=>Array.from(new Set(ce.flatMap(e=>[Kd(e.name),e.prevName?Kd(e.prevName):null]).filter(e=>e!=null&&e!==`text`))),[ce]);(0,q.useEffect)(()=>{e&&e.setRenderOptions({theme:{dark:Te.type===`dark`?Te.themeName:`rose-pine`,light:Te.type===`light`?Te.themeName:`github-light`}}).catch(()=>{})},[e,Te]),(0,q.useEffect)(()=>{let e=Te.type===`dark`?Te.themeName:`rose-pine`,t=Te.type===`light`?Te.themeName:`github-light`;Bd({themes:Array.from(new Set([e,t])),langs:Ee}).catch(()=>{})},[Te,Ee]),(0,q.useEffect)(()=>{if(o)return document.title=`${o.owner}/${o.repo}#${o.pullNumber} · diffing`,()=>{document.title=`diffing`}},[o]);let De=(0,q.useCallback)(e=>{if(de.length===0)return;let t=T?de.findIndex(e=>e.name===T):-1,n=e===`next`?Math.min(t+1,de.length-1):Math.max(t-1,0),r=de[Math.max(0,n)];r&&_e(r.name)},[T,de,_e]),Oe=(0,q.useCallback)(()=>{T&&ye(T,!C.has(T))},[T,ye,C]),{setSnapshot:ke,nextHit:Ae,prevHit:je,statusMessage:Me}=ZT(me,_e),Ne=(0,q.useCallback)(e=>{R({open:!0,scope:e,changedOnly:!0})},[]),Pe=(0,q.useCallback)(()=>{R(e=>e.open?{...e,open:!1}:{open:!0,scope:`all`,changedOnly:z.current})},[]),Fe=(0,q.useCallback)(e=>{z.current=e,R(t=>({...t,changedOnly:e}))},[]);if(ST((0,q.useMemo)(()=>({onNavigateFile:De,onToggleViewed:Oe,onToggleDiffStyle:()=>i({diffStyle:n.diffStyle===`split`?`unified`:`split`}),onCycleTabSize:()=>{let e=[2,4,8];i({defaultTabSize:e[(e.indexOf(n.defaultTabSize)+1)%e.length]})},onToggleSidebar:()=>O(e=>!e),onToggleLineWrap:()=>i({lineWrap:!n.lineWrap}),onToggleLineNumbers:()=>i({showLineNumbers:!n.showLineNumbers}),onCycleDiffIndicators:()=>{let e=[`classic`,`bars`,`none`];i({diffIndicators:e[(e.indexOf(n.diffIndicators)+1)%e.length]})},onCycleLineDiffType:()=>{let e=[`word`,`word-alt`,`char`,`none`];i({lineDiffType:e[(e.indexOf(n.lineDiffType)+1)%e.length]})},onOpenPalette:Ne,onTogglePalette:Pe,onNextSearchHit:Ae,onPrevSearchHit:je,onOpenTheme:()=>V(!0),onOpenShortcuts:()=>ne(!0)}),[De,n.defaultTabSize,n.diffIndicators,n.diffStyle,n.lineDiffType,n.lineWrap,n.showLineNumbers,Oe,i,Ne,Pe,Ae,je])),s&&!o)return(0,J.jsxs)(`div`,{className:`pr-app-empty`,children:[(0,J.jsx)(eO,{size:32}),(0,J.jsx)(`h2`,{children:`No active PR session`}),(0,J.jsxs)(`p`,{children:[`Start one with `,(0,J.jsx)(`code`,{children:`diffing "gh pr 1234"`}),` or `,(0,J.jsx)(`code`,{children:`diffing --gh-pr 1234`}),` from inside the repo.`]}),(0,J.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>jE(`/`),children:`Back to local review`})]});if(!o)return(0,J.jsx)(`div`,{className:`pr-app-empty`,children:(0,J.jsx)(`span`,{children:`Loading PR session…`})});let Ie=e=>a(()=>i(e)),Le={diffStyle:n.diffStyle,defaultTabSize:n.defaultTabSize,lineDiffType:n.lineDiffType,lineWrap:n.lineWrap,diffIndicators:n.diffIndicators,showLineNumbers:n.showLineNumbers,hunkSeparators:n.hunkSeparators,lineHoverHighlight:n.lineHoverHighlight,fontSize:n.fontSize,haptics:n.haptics,sounds:n.sounds,uiFont:n.uiFont,monoFont:n.monoFont,density:n.density,autoCollapseLineThreshold:n.autoCollapseLineThreshold,showStatusBar:n.showStatusBar,onDiffStyleChange:e=>Ie({diffStyle:e}),onDefaultTabSizeChange:e=>Ie({defaultTabSize:e}),onOpenThemeModal:()=>V(!0),onLineDiffTypeChange:e=>Ie({lineDiffType:e}),onLineWrapChange:e=>Ie({lineWrap:e}),onDiffIndicatorsChange:e=>Ie({diffIndicators:e}),onShowLineNumbersChange:e=>Ie({showLineNumbers:e}),onHunkSeparatorsChange:e=>Ie({hunkSeparators:e}),onLineHoverHighlightChange:e=>Ie({lineHoverHighlight:e}),onFontSizeChange:e=>Ie({fontSize:e}),onHapticsChange:e=>Ie({haptics:e}),onSoundsChange:e=>Ie({sounds:e}),onDensityChange:e=>Ie({density:e}),onAutoCollapseLineThresholdChange:e=>Ie({autoCollapseLineThreshold:e}),onShowStatusBarChange:e=>Ie({showStatusBar:e}),onOpenUiFontModal:()=>U(!0),onOpenMonoFontModal:()=>ee(!0),showSource:!1,showWhitespace:!1,showExternalTools:!1,showSendPolicy:!1};return(0,J.jsx)(bT,{enabled:n.haptics,soundsEnabled:n.sounds,children:(0,J.jsxs)(`div`,{ref:ae,className:`app pr-app`,"data-pr-mode":`true`,style:{"--sidebar-width":`${k}px`,"--comment-panel-height":`${j}px`},children:[(0,J.jsx)(`a`,{href:`#pr-diff-main`,className:`skip-to-main`,children:`Skip to diff`}),(0,J.jsx)(`div`,{className:`sidebar-resize-guide`,ref:G,"aria-hidden":`true`}),(0,J.jsx)(Z4,{session:o,comments:u,settingsProps:Le,sidebarCollapsed:D,onToggleSidebar:()=>O(e=>!e),onOpenSearch:()=>R({open:!0,scope:`all`}),onRefresh:()=>l.mutate(),refreshing:l.isPending,onEditComment:(e,t)=>p({id:e,body:t}),onDeleteComment:f,onSubmitted:ie}),!D&&(0,J.jsx)(`div`,{className:`sidebar-mobile-backdrop`,onClick:()=>O(!0),"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`app-body`,children:[(0,J.jsxs)(`aside`,{ref:oe,className:`sidebar ${D?`sidebar-collapsed`:``}`,children:[(0,J.jsx)(`div`,{className:`pr-sidebar-tree`,children:(0,J.jsx)(V0,{files:ce,activeFile:T,commentCounts:ue,viewedFiles:C,untrackedFiles:ge,onFileClick:_e,collapsed:D,onToggleCollapse:()=>O(e=>!e),appliedExtensions:N,onApplyExtensions:e=>P(XE(e)),chipFilter:F,onChipFilterChange:I})}),!D&&u.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`ct-resize-handle`,onMouseDown:we,role:`separator`,"aria-label":`Resize comments panel`,"aria-orientation":`horizontal`,tabIndex:0}),(0,J.jsx)(`div`,{className:`ct-wrapper pr-ct-wrapper`,children:(0,J.jsx)(G0,{comments:u,resolveComment:h,unresolveComment:g,removeComment:f,addReply:async(e,t)=>{await m({id:e,body:t})},editComment:_,editReply:v,removeReply:y})})]})]}),!D&&(0,J.jsx)(`div`,{className:`sidebar-resize-handle`,onMouseDown:Ce,role:`separator`,"aria-label":`Resize sidebar`,"aria-orientation":`vertical`,tabIndex:0}),(0,J.jsxs)(`main`,{className:`main pr-main`,id:`pr-diff-main`,tabIndex:-1,children:[(0,J.jsx)(r3,{session:o,draftCount:u.length}),(0,J.jsx)($4,{reviews:o.existingReviews??[]}),(o.existingComments?.length??0)>0&&(0,J.jsxs)(`div`,{className:`pr-existing-summary`,children:[(0,J.jsx)(fO,{size:13}),(0,J.jsxs)(`span`,{children:[o.existingComments.length,` existing GitHub conversation`,o.existingComments.length===1?``:`s`,` included in this review.`]})]}),(S||c)&&(0,J.jsxs)(`div`,{className:`pr-error`,children:[(0,J.jsx)(kD,{size:14}),` Failed to load the PR: `,S||c?.message]}),x&&!b?(0,J.jsx)(`div`,{className:`pr-app-loading`,children:`Loading PR diff…`}):de.length===0?(0,J.jsxs)(`div`,{className:`empty-state`,role:`status`,children:[(0,J.jsx)(`div`,{className:`empty-state-icon`,children:(0,J.jsx)(QD,{size:24})}),(0,J.jsx)(`p`,{className:`empty-state-title`,children:`No matching files`}),(0,J.jsx)(`p`,{className:`empty-state-hint`,children:`Clear the file-tree filters to see the full pull request.`})]}):(0,J.jsx)(o3,{files:de,fileAnnotations:fe,existingCommentsByFile:le,viewedFiles:C,settings:n,monoFontFamily:he,onAddComment:e=>d(e),onDeleteComment:f,onViewedChange:ye,onCardToggleCollapse:(e,t)=>{t&&ve(e)},onReplyExisting:be,onEditExisting:(e,t)=>xe(`PATCH`,e,t),onDeleteExisting:e=>xe(`DELETE`,e),onSetExistingResolved:Se})]})]}),(0,J.jsx)(n2,{isOpen:L.open,onClose:()=>R(e=>({...e,open:!1})),initialScope:L.scope,initialChangedOnly:L.changedOnly,onChangedOnlyPreference:Fe,onSessionSnapshot:ke,files:de,changedEntries:pe,customMode:!0,staged:!1,onNavigateFile:_e,theme:n.theme||`rose-pine`,fontSize:n.fontSize,monoFontFamily:he,defaultTabSize:n.defaultTabSize,lineWrap:n.lineWrap,showLineNumbers:n.showLineNumbers,lineHoverHighlight:n.lineHoverHighlight}),(0,J.jsx)(u2,{activeFile:T,onShowHelp:()=>ne(!0),visible:n.showStatusBar,statusMessage:Me,placeholder:`No active PR file (J/K to jump)`}),(0,J.jsx)(d2,{isOpen:te,onClose:()=>ne(!1),mode:`pr`}),(0,J.jsx)(m2,{open:B,activeTheme:n.theme||`rose-pine`,onThemeChange:e=>Ie({theme:e}),onClose:()=>V(!1)}),(0,J.jsx)(_2,{open:H,title:`Select UI Font`,defaultLabel:`Default (Geist Mono, from CDN)`,activeFont:n.uiFont,onFontChange:e=>Ie({uiFont:e}),onClose:()=>U(!1)}),(0,J.jsx)(_2,{open:W,title:`Select Code Font`,defaultLabel:`Default (JetBrains Mono, from CDN)`,activeFont:n.monoFont,onFontChange:e=>Ie({monoFont:e}),onClose:()=>ee(!1)}),re&&(0,J.jsx)(i3,{result:re,onDismiss:()=>ie(null)})]})})}function o3({files:e,fileAnnotations:t,existingCommentsByFile:n,viewedFiles:r,settings:i,monoFontFamily:a,onAddComment:o,onDeleteComment:s,onViewedChange:c,onCardToggleCollapse:l,onReplyExisting:u,onEditExisting:d,onDeleteExisting:f,onSetExistingResolved:p}){return(0,J.jsx)(`div`,{className:`pr-diff-surface`,children:e.map(e=>{let m=n.get(e.name)??[];return(0,J.jsx)(`div`,{className:`pr-file-block`,children:(0,J.jsx)(bG,{files:[e],diffStyle:i.diffStyle,tabSizeMap:{},defaultTabSize:i.defaultTabSize,viewedFiles:r,binaryFiles:new Map,theme:i.theme||`rose-pine`,lineDiffType:i.lineDiffType,lineWrap:i.lineWrap,diffIndicators:i.diffIndicators,showLineNumbers:i.showLineNumbers,hunkSeparators:i.hunkSeparators,lineHoverHighlight:i.lineHoverHighlight,fontSize:i.fontSize,monoFontFamily:a,expandContextByDefault:i.expandContextByDefault,collapsedContextThreshold:i.collapsedContextThreshold,expansionLineCount:i.expansionLineCount,autoCollapseLineThreshold:i.autoCollapseLineThreshold,onViewedChange:c,fileAnnotationsMap:new Map([[e.name,t.get(e.name)??[]]]),existingCommentsMap:new Map([[e.name,m]]),onAddComment:(e,t,n,r,i,a)=>o({filePath:e,side:t,lineNumber:n,lineContent:r,body:i,startLineNumber:a}),onDeleteComment:s,onReplyExisting:u,onEditExisting:d,onDeleteExisting:f,onSetExistingResolved:p,onCardToggleCollapse:l,allowLocalActions:!1})},e.name)})})}function s3(){let e=FE(),[t,n]=(0,q.useState)(!1),[r,i]=(0,q.useState)(()=>e===`/gh/pr`||e.startsWith(`/gh/pr/`)||e.startsWith(`/plan`));return(0,q.useEffect)(()=>{rD().then(()=>{n(!0)})},[]),(0,q.useEffect)(()=>{if(e===`/gh/pr`||e.startsWith(`/gh/pr/`)||e.startsWith(`/plan`)){i(!0);return}if(e!==`/`){i(!0);return}let t=!1;return fetch(`/api/gh/session`).then(async e=>{t||e.ok&&(await e.json().catch(()=>null))?.prMode===!0&&jE(`/gh/pr`,{replace:!0})}).catch(()=>{}).finally(()=>{t||i(!0)}),()=>{t=!0}},[e]),!t||!r?(0,J.jsxs)(`div`,{className:`boot-loader`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(HH,{size:40,className:`boot-loader-mark`}),(0,J.jsx)(`div`,{className:`boot-loader-spinner`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`boot-loader-label`,children:`Loading review session…`})]}):e===`/plan`||e.startsWith(`/plan/`)?(0,J.jsx)(z4,{}):e===`/gh/pr`||e.startsWith(`/gh/pr/`)?(0,J.jsx)(a3,{}):(0,J.jsx)(D2,{})}var c3=new Pe;lE(),(0,dt.createRoot)(document.getElementById(`root`)).render((0,J.jsx)(ze,{client:c3,children:(0,J.jsx)(rt,{children:(0,J.jsx)(Dp,{poolOptions:{workerFactory:()=>new Og,poolSize:Math.max(1,Math.min(4,navigator.hardwareConcurrency||2))},highlighterOptions:{theme:{dark:`rose-pine`,light:`github-light`},langs:[`vue`]},children:(0,J.jsx)(Zw,{children:(0,J.jsx)(s3,{})})})})}));export{l as a,s as i,X as n,o as r,xE as t};
4024
+ `}var I4={pending:{icon:RD,className:`plan-badge-pending`,label:`Pending`},approved:{icon:wD,className:`plan-badge-approved`,label:`Approved`},"changes-requested":{icon:mO,className:`plan-badge-changes`,label:`Changes`},rejected:{icon:WO,className:`plan-badge-rejected`,label:`Rejected`},"comment-only":{icon:hO,className:`plan-badge-comment-only`,label:`Comment only`}},L4=[`all`,`pending`,`approved`,`changes-requested`,`rejected`,`comment-only`];function R4(){try{let e=iD(t4.decisionFilter);if(e&&L4.includes(e))return e}catch{}return`all`}function z4({plans:e,activeId:t,onSelect:n,onDelete:r,collapsed:i,onToggleCollapse:a}){let[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(R4),[u,d]=(0,q.useState)(null),f=(0,q.useCallback)(e=>{l(e),cD(t4.decisionFilter,e)},[]),p=(0,q.useMemo)(()=>[...e].sort((e,t)=>t.createdAt-e.createdAt),[e]),m=(0,q.useMemo)(()=>{let e=o.toLowerCase().trim();return p.filter(t=>c!==`all`&&t.decision!==c?!1:e?`${t.title} ${t.source??``} ${t.sourcePath??``} ${t.model??``} ${t.id}`.toLowerCase().includes(e):!0)},[p,o,c]),h=(0,q.useMemo)(()=>e.filter(e=>e.decision===`pending`).length,[e]);return i?(0,J.jsx)(`div`,{className:`plan-list plan-list-collapsed`,children:a&&(0,J.jsx)(Qw,{content:`Expand sidebar · b`,side:`right`,children:(0,J.jsx)(`button`,{className:`sidebar-toggle`,onClick:a,"aria-label":`Expand sidebar`,children:(0,J.jsx)(wO,{size:16})})})}):(0,J.jsxs)(`div`,{className:`plan-list`,children:[(0,J.jsxs)(`div`,{className:`plan-list-chrome`,children:[(0,J.jsxs)(`div`,{className:`plan-list-toolbar`,children:[a&&(0,J.jsx)(Qw,{content:`Collapse sidebar · b`,side:`right`,children:(0,J.jsx)(`button`,{className:`sidebar-toggle`,onClick:a,"aria-label":`Collapse sidebar`,children:(0,J.jsx)(CO,{size:16})})}),(0,J.jsxs)(`div`,{className:`plan-list-search`,children:[(0,J.jsx)(NO,{size:14,className:`plan-list-search-icon`,"aria-hidden":`true`}),(0,J.jsx)(`input`,{type:`text`,placeholder:`Search plans…`,value:o,onChange:e=>s(e.target.value),className:`plan-list-search-input`,"aria-label":`Search plans`})]})]}),(0,J.jsx)(`div`,{className:`plan-list-filters`,role:`group`,"aria-label":`Filter by decision`,children:[{id:`all`,label:`All`},{id:`pending`,label:h?`Pending ${h}`:`Pending`},{id:`approved`,label:`Approved`},{id:`changes-requested`,label:`Changes`},{id:`rejected`,label:`Rejected`}].map(e=>(0,J.jsx)(`button`,{type:`button`,className:`plan-list-filter ${c===e.id?`is-active`:``}`,"aria-pressed":c===e.id,onClick:()=>f(e.id),children:e.label},e.id))})]}),(0,J.jsxs)(`div`,{className:`plan-list-scroll`,children:[(0,J.jsx)(`div`,{className:`plan-list-header`,children:(0,J.jsx)(`span`,{children:m.length===e.length?`${e.length} plan${e.length===1?``:`s`}`:`${m.length} of ${e.length}`})}),m.length===0&&(0,J.jsx)(`div`,{className:`plan-list-empty`,children:o||c!==`all`?`No matching plans.`:`No plans yet.`}),(0,J.jsx)(`div`,{className:`plan-list-items`,children:m.map(e=>{let i=I4[e.decision],a=i.icon,o=(e.comments??[]).filter(e=>e.status===`open`).length,s=e.sourcePath||e.source,c=e.id===t;return(0,J.jsxs)(`div`,{className:`plan-list-item ${c?`plan-list-item-active`:``}`,onClick:()=>n(e.id),role:`button`,tabIndex:0,"aria-current":c?`true`:void 0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e.id))},children:[(0,J.jsxs)(`div`,{className:`plan-list-item-top`,children:[(0,J.jsx)(`span`,{className:`plan-badge plan-badge-dot ${i.className}`,title:i.label,children:(0,J.jsx)(a,{size:11,"aria-hidden":`true`})}),(0,J.jsx)(`span`,{className:`plan-list-item-title`,title:e.title,children:e.title}),s&&(0,J.jsx)(Qw,{content:`Copy source path`,children:(0,J.jsx)(`button`,{className:`plan-list-copy-path`,title:`Copy source path`,"aria-label":`Copy source path`,onClick:t=>{t.stopPropagation();let n=e.sourcePath||e.source||``;navigator.clipboard?.writeText(n).then(()=>{d(e.id),window.setTimeout(()=>d(null),1200)},()=>{})},children:u===e.id?(0,J.jsx)(wD,{size:12}):(0,J.jsx)(VD,{size:12})})}),(0,J.jsx)(`button`,{className:`plan-list-delete`,title:`Delete plan`,"aria-label":`Delete plan`,onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,J.jsx)(zO,{size:12,"aria-hidden":`true`})})]}),(0,J.jsxs)(`div`,{className:`plan-list-item-sub`,children:[(0,J.jsxs)(`span`,{className:`plan-list-item-version`,children:[`v`,e.version]}),o>0&&(0,J.jsxs)(`span`,{className:`plan-list-item-open`,children:[o,` open`]}),e.model&&(0,J.jsxs)(`span`,{className:`plan-list-item-model`,title:e.model,children:[(0,J.jsx)(SD,{size:10,"aria-hidden":`true`}),e.model]}),(0,J.jsx)(`span`,{className:`plan-list-item-time`,children:FT(e.createdAt)})]})]},e.id)})})]})]})}var B4=[{value:`approved`,label:`Approve`,description:`The plan looks good — the agent should proceed.`,icon:wD,className:`plan-verdict-approve`},{value:`changes-requested`,label:`Request changes`,description:`The agent should revise the plan and resubmit it.`,icon:mO,className:`plan-verdict-changes`},{value:`rejected`,label:`Reject`,description:`Don't proceed — the approach needs rethinking.`,icon:WO,className:`plan-verdict-reject`},{value:`comment-only`,label:`Comment only`,description:`Agent must NOT edit files — only reply to comments. General note goes to chat.`,icon:hO,className:`plan-verdict-comment-only`}];function V4({openCommentCount:e,onSubmit:t,submitting:n,agentWaiting:r,currentDecision:i}){let{haptic:a,sound:o}=xT(),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(``),{popoverStyle:p,activePreset:m,applyPreset:h,startResize:g,startLeftResize:_,startCornerResize:v,handleOpenChange:y,panelRef:b}=yH(),x=async()=>{l&&(a(`heavy`),o(`send`),await t(l,d,l===`comment-only`?`comment-only`:`standard`),f(``),u(null),c(!1))},S=i!==`pending`;return(0,J.jsx)(Pk,{open:s,onOpenChange:(e,t)=>y(e,t,c),ariaLabel:`Submit plan review`,className:`submit-plan-review-popover`,trigger:(0,J.jsxs)(`button`,{className:`btn btn-primary btn-sm send-review-btn`,disabled:n,title:r?`An agent is connected and waiting for your verdict`:`Submit your verdict on this plan`,style:{display:`inline-flex`,alignItems:`center`,gap:`6px`},children:[r&&(0,J.jsx)(`span`,{className:`agent-waiting-dot`,"aria-hidden":`true`}),S?(0,J.jsx)(kO,{size:14}):(0,J.jsx)(FD,{size:14}),(0,J.jsx)(`span`,{className:`btn-label`,children:n?`Submitting…`:S?`Update review`:`Submit review`})]}),children:(0,J.jsxs)(`div`,{className:`srp`,ref:b,style:p,children:[(0,J.jsx)(`div`,{className:`srp-resize-handle-left`,onPointerDown:_,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize submit panel width`,tabIndex:0}),(0,J.jsxs)(`div`,{className:`srp-head`,children:[S?(0,J.jsx)(kO,{size:15,"aria-hidden":`true`}):(0,J.jsx)(FD,{size:15,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`srp-title`,children:S?`Update plan review`:`Submit plan review`}),(0,J.jsx)(`div`,{className:`srp-size-presets`,role:`group`,"aria-label":`Panel size`,children:uH.map((e,t)=>(0,J.jsx)(`button`,{className:`srp-preset-btn`,role:`radio`,"aria-checked":m===t,"aria-pressed":m===t,onClick:()=>h(e),title:`${e.width}×${e.height}px`,children:e.label},e.label))}),e>0&&(0,J.jsxs)(`span`,{className:`srp-count`,children:[e,` open comment`,e===1?``:`s`]})]}),(0,J.jsxs)(`div`,{className:`srp-scroll`,children:[(0,J.jsx)(`div`,{className:`plan-verdict-options`,role:`radiogroup`,"aria-label":`Verdict`,children:B4.map(e=>{let t=e.icon,n=l===e.value;return(0,J.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,className:`plan-verdict-option ${e.className} ${n?`plan-verdict-option-selected`:``}`,onClick:()=>u(e.value),children:[(0,J.jsx)(`span`,{className:`plan-verdict-icon`,children:(0,J.jsx)(t,{size:15,"aria-hidden":`true`})}),(0,J.jsxs)(`span`,{className:`plan-verdict-text`,children:[(0,J.jsx)(`span`,{className:`plan-verdict-label`,children:e.label}),(0,J.jsx)(`span`,{className:`plan-verdict-desc`,children:e.description})]}),(0,J.jsx)(`span`,{className:`plan-verdict-radio`,"aria-hidden":`true`})]},e.value)})}),(0,J.jsxs)(`div`,{className:`srp-general`,children:[(0,J.jsxs)(`label`,{className:`srp-general-label`,htmlFor:`plan-decision-comment`,children:[`Overall comment `,(0,J.jsx)(`span`,{className:`srp-optional`,children:`(optional · Markdown)`})]}),(0,J.jsx)(sH,{id:`plan-decision-comment`,value:d,onChange:f,textareaClassName:`srp-general-input`,placeholder:`Add an overall note for the agent that applies to the whole plan…`,rows:3,ariaLabel:`Overall plan review comment`,onSubmitShortcut:x})]})]}),(0,J.jsxs)(`div`,{className:`srp-footer`,children:[(0,J.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>c(!1),disabled:n,children:`Cancel`}),(0,J.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:x,disabled:!l||n,children:n?`Submitting…`:`Submit review`})]}),(0,J.jsx)(`div`,{className:`srp-resize-handle`,onPointerDown:g,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize submit panel`,tabIndex:0}),(0,J.jsx)(`div`,{className:`srp-resize-handle-corner`,onPointerDown:v,role:`separator`,"aria-label":`Resize submit panel width and height`,tabIndex:0})]})})}var H4=[11,12,13,14,15,16].map(e=>({value:String(e),label:`${e}px`})),U4=[2,4,8].map(e=>({value:String(e),label:String(e)})),W4=[{value:`both`,label:`Both`},{value:`line`,label:`Line only`},{value:`number`,label:`Number only`},{value:`disabled`,label:`Disabled`}];function G4(){let e=Op(),{settings:t,loaded:n,updateSettings:r}=BE();VE(n,t.uiFont,t.monoFont);let{plans:i,getPlan:a,removePlan:o,agentActivity:s,clearAgentActivity:c,submitDecision:l,submitting:u,agentWaiting:d,isLoading:f}=OE(),p=FE(),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(!1);(0,q.useEffect)(()=>{let e=e=>{if(e.metaKey||e.ctrlKey){if(e.key===`,`||e.code===`Comma`){e.preventDefault(),_(e=>!e);return}(e.key===`?`||e.key===`/`&&e.shiftKey||e.code===`Slash`&&e.shiftKey)&&(e.preventDefault(),y(!0))}};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]);let[b,x]=(0,q.useState)(()=>{try{let e=iD(t4.viewMode);if(e===`rendered`||e===`split`||e===`source`)return e}catch{}return`source`}),[S,C]=(0,q.useState)(()=>r4(`rendered`)),w=(0,q.useCallback)(e=>{if(e===`source`||e===`rendered`){C(e);try{cD(t4.lastSingleViewMode,e)}catch{}}else if(b===`source`||b===`rendered`){C(b);try{cD(t4.lastSingleViewMode,b)}catch{}}x(e);try{cD(t4.viewMode,e)}catch{}},[b]),T=l4(),E=(0,q.useMemo)(()=>n4(b,T,S),[b,T,S]),[D,O]=(0,q.useState)(()=>a4(t4.zenMode,!1)),k=(0,q.useCallback)(e=>{O(e);try{cD(t4.zenMode,String(e))}catch{}},[]),A=(0,q.useCallback)(()=>{b===`rendered`?k(!D):(w(`rendered`),k(!0))},[b,D,w,k]),[j,M]=(0,q.useState)(()=>{try{let e=iD(t4.tocOpen);if(e===`false`)return!1;if(e===`true`)return!0}catch{}return!0}),[N,P]=(0,q.useState)(()=>{try{let e=iD(t4.commentsRail);if(e===`false`)return!1;if(e===`true`)return!0}catch{}return i4()}),F=(0,q.useCallback)(e=>{M(e),cD(t4.tocOpen,String(e))},[]),I=(0,q.useCallback)(e=>{P(e),cD(t4.commentsRail,String(e))},[]),L=(0,q.useCallback)(()=>{F(!j)},[j,F]),R=(0,q.useCallback)(()=>{I(!N)},[N,I]),z=(0,q.useMemo)(()=>{let e=/^\/plan\/([^/]+)/.exec(p);return e?decodeURIComponent(e[1]):null},[p]),B=(0,q.useMemo)(()=>z?a(z):i.length===0?null:[...i].reverse().find(e=>e.decision===`pending`)??i[i.length-1],[z,i,a]),V=(0,q.useMemo)(()=>LT[t.theme||`rose-pine`]||LT[`rose-pine`],[t.theme]);(0,q.useEffect)(()=>{let e=t.theme||`rose-pine`,n=document.documentElement;n.classList.add(`theme-switching`),n.setAttribute(`data-theme`,e);let r=requestAnimationFrame(()=>{requestAnimationFrame(()=>n.classList.remove(`theme-switching`))});return()=>cancelAnimationFrame(r)},[t.theme]),(0,q.useEffect)(()=>{e&&e.setRenderOptions({theme:{dark:V.type===`dark`?V.themeName:`rose-pine`,light:V.type===`light`?V.themeName:`github-light`}}).catch(e=>console.error(`Failed to set worker pool render options:`,e))},[e,V]),(0,q.useEffect)(()=>{let e=V.type===`dark`?V.themeName:`rose-pine`,t=V.type===`light`?V.themeName:`github-light`;Bd({themes:Array.from(new Set([e,t])),langs:[]}).catch(()=>{})},[V]);let[H,U]=(0,q.useState)(()=>{try{let e=iD(`diffing-sidebar-collapsed`);if(e!=null)return e===`true`}catch{}return typeof window<`u`&&window.innerWidth<=768}),[W,ee]=(0,q.useState)(()=>{try{let e=iD(`diffing-sidebar-width`);return e?Number(e):320}catch{return 320}});(0,q.useEffect)(()=>{try{cD(`diffing-sidebar-collapsed`,String(H))}catch{}},[H]);let te=(0,q.useRef)(W);te.current=W;let ne=(0,q.useRef)(null),re=(0,q.useRef)(null),ie=(0,q.useRef)(null),ae=(0,q.useRef)(null),oe=(0,q.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=te.current,r=ie.current,i=ae.current,a=r?r.getBoundingClientRect().left:0,o=n,s=0,c=()=>{s=0,i&&(i.style.transform=`translateX(${a+o}px)`)};i&&(i.style.transform=`translateX(${a+n}px)`,i.classList.add(`sidebar-resize-guide-active`));let l=e=>{let r=e.clientX-t;o=Math.max(240,Math.min(640,n+r)),s||=requestAnimationFrame(c)},u=()=>{s&&cancelAnimationFrame(s),i&&i.classList.remove(`sidebar-resize-guide-active`),ee(o);try{cD(`diffing-sidebar-width`,String(o))}catch{}document.removeEventListener(`mousemove`,l),document.removeEventListener(`mouseup`,u),document.body.style.cursor=``,document.body.style.userSelect=``};document.addEventListener(`mousemove`,l),document.addEventListener(`mouseup`,u),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]);(0,q.useEffect)(()=>{let e=ne.current,t=re.current;if(!e||!t)return;let n=()=>{let n=t.getBoundingClientRect().height;e.style.setProperty(`--plan-toolbar-offset`,`${n}px`)};if(n(),typeof ResizeObserver>`u`)return;let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[n,f]);let G=(0,q.useCallback)(()=>{U(e=>!e)},[]),se=(0,q.useCallback)(()=>{r({lineWrap:!t.lineWrap})},[t.lineWrap,r]),K=(0,q.useCallback)(()=>{r({showLineNumbers:!t.showLineNumbers})},[t.showLineNumbers,r]),ce=(0,q.useCallback)(()=>{let e=[`source`,`rendered`,`split`],t=e[(e.indexOf(b)+1)%e.length];w(t)},[b,w]),le=(0,q.useCallback)(()=>{let e=[2,4,8],n=t.defaultTabSize||4;r({defaultTabSize:e[(e.indexOf(n)+1)%e.length]})},[t.defaultTabSize,r]),ue=(0,q.useCallback)(e=>{if(i.length===0)return;let t=[...i].sort((e,t)=>t.createdAt-e.createdAt),n=0;if(B){let r=t.findIndex(e=>e.id===B.id);r!==-1&&(n=e===`next`?Math.min(r+1,t.length-1):Math.max(r-1,0))}let r=t[n];jE(`/plan/${r.id}`)},[i,B]),de=(0,q.useCallback)(e=>{jE(`/plan/${e}`),typeof window<`u`&&window.matchMedia(`(max-width: 768px)`).matches&&U(!0)},[]);j2((0,q.useMemo)(()=>({onNavigatePlan:ue,onToggleViewMode:ce,onToggleZenMode:A,onToggleCommentsRail:R,onToggleOutline:L,onCycleTabSize:le,onToggleSidebar:G,onToggleLineWrap:se,onToggleLineNumbers:K,onOpenTheme:()=>h(!0),onOpenShortcuts:()=>y(!0)}),[ue,ce,A,R,L,le,G,se,K]));let fe=(0,q.useMemo)(()=>B?(B.comments??[]).filter(e=>e.status===`open`).length:0,[B]);return f||!n?(0,J.jsxs)(`div`,{className:`app plan-app skeleton-app`,style:{"--sidebar-width":`${W}px`},children:[(0,J.jsxs)(`header`,{className:`skeleton-toolbar`,children:[(0,J.jsx)(`div`,{className:`skeleton-item skeleton-logo`}),(0,J.jsx)(`div`,{className:`skeleton-item skeleton-stats`}),(0,J.jsx)(`div`,{className:`skeleton-item skeleton-actions`})]}),(0,J.jsxs)(`div`,{className:`app-body`,children:[(0,J.jsx)(`aside`,{className:`sidebar plan-sidebar skeleton-sidebar ${H?`sidebar-collapsed`:``}`,children:!H&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`skeleton-search`}),(0,J.jsx)(`div`,{className:`skeleton-tree-nodes`,children:Array.from({length:4}).map((e,t)=>(0,J.jsxs)(`div`,{className:`skeleton-tree-node`,children:[(0,J.jsx)(`div`,{className:`skeleton-node-icon`}),(0,J.jsx)(`div`,{className:`skeleton-node-text`})]},t))})]})}),!H&&(0,J.jsx)(`div`,{className:`sidebar-resize-handle skeleton-resize-handle`}),(0,J.jsx)(`main`,{className:`main plan-main skeleton-main`,children:(0,J.jsxs)(`div`,{className:`file-diff-card skeleton-card`,children:[(0,J.jsxs)(`div`,{className:`skeleton-card-header`,children:[(0,J.jsx)(`div`,{className:`skeleton-card-title`}),(0,J.jsx)(`div`,{className:`skeleton-card-badge`})]}),(0,J.jsxs)(`div`,{className:`skeleton-card-body`,children:[(0,J.jsx)(`div`,{className:`skeleton-code-line`}),(0,J.jsx)(`div`,{className:`skeleton-code-line`}),(0,J.jsx)(`div`,{className:`skeleton-code-line`}),(0,J.jsx)(`div`,{className:`skeleton-code-line`}),(0,J.jsx)(`div`,{className:`skeleton-code-line`}),(0,J.jsx)(`div`,{className:`skeleton-code-line`})]})]})})]})]}):(0,J.jsx)(bT,{enabled:t.haptics??!0,soundsEnabled:t.sounds??!0,children:(0,J.jsxs)(`div`,{className:`app plan-app`,ref:ne,style:{"--sidebar-width":`${W}px`},children:[(0,J.jsx)(`div`,{className:`sidebar-resize-guide`,ref:ae,"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`toolbar plan-app-toolbar`,ref:re,children:[(0,J.jsxs)(`div`,{className:`toolbar-left`,children:[(0,J.jsx)(`button`,{className:`toolbar-mobile-toggle`,onClick:()=>U(!H),"aria-label":`Toggle sidebar`,title:H?`Open sidebar`:`Close sidebar`,children:(0,J.jsx)(dO,{size:18})}),(0,J.jsx)(Qw,{content:`Back to diff review`,side:`bottom`,children:(0,J.jsxs)(`button`,{className:`btn btn-sm plan-toolbar-back`,onClick:()=>jE(`/`),"aria-label":`Back to the diff review`,children:[(0,J.jsx)(bD,{size:14}),(0,J.jsx)(`span`,{className:`btn-label`,children:`Diff`})]})}),(0,J.jsxs)(`div`,{className:`plan-toolbar-brand`,children:[(0,J.jsx)(HH,{size:18,className:`plan-app-brand`}),(0,J.jsxs)(`div`,{className:`plan-toolbar-brand-text`,children:[(0,J.jsx)(`h1`,{className:`toolbar-title plan-app-title`,children:`Plans`}),B?(0,J.jsx)(`span`,{className:`plan-toolbar-active`,title:B.title,children:B.title}):(0,J.jsxs)(`span`,{className:`plan-toolbar-count`,children:[i.length,` plan`,i.length===1?``:`s`]})]})]})]}),(0,J.jsx)(`div`,{className:`plan-view-toggle`,role:`group`,"aria-label":`Plan view mode`,children:[{id:`source`,label:`Source`,icon:zD,tip:`Source — select lines to comment`},{id:`rendered`,label:`Read`,icon:qD,tip:`Read — rendered markdown (highlight to comment)`},{id:`split`,label:`Split`,icon:BD,tip:`Split — source + rendered (drag the divider to resize)`}].map(({id:e,label:t,icon:n,tip:r})=>{let i=E===e;return(0,J.jsx)(Qw,{content:`${r} · m to cycle${e===`split`&&T&&b===`split`?` — opens when the window is wider`:``}`,side:`bottom`,children:(0,J.jsxs)(`button`,{type:`button`,className:`plan-view-toggle-btn ${i?`is-active`:``}`,"aria-pressed":i,"aria-label":r,onClick:()=>w(e),children:[(0,J.jsx)(n,{size:13,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:t})]})},e)})}),(0,J.jsxs)(`div`,{className:`toolbar-right`,children:[(0,J.jsx)(Pk,{open:g,onOpenChange:_,ariaLabel:`Settings`,className:`settings-popover`,trigger:(0,J.jsxs)(`button`,{className:`btn btn-sm settings-btn ${g?`btn-active`:``}`,title:`Settings (⌘,)`,"aria-label":`Settings`,children:[(0,J.jsx)(PO,{size:14}),(0,J.jsx)(`span`,{className:`btn-label`,children:`Settings`})]}),children:(0,J.jsxs)(`div`,{className:`popover-scroll settings-panel`,children:[(0,J.jsx)(`div`,{className:`settings-section-label`,children:`Appearance`}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Theme`}),(0,J.jsxs)(`button`,{className:`btn btn-sm settings-btn`,onClick:()=>{_(!1),h(!0)},children:[(0,J.jsx)(SO,{size:14,className:`settings-item-icon`}),(0,J.jsx)(`span`,{children:`Switch Theme...`})]})]}),(0,J.jsx)(`div`,{className:`settings-section-label`,children:`Plan chrome`}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:j,onChange:e=>F(e.target.checked)}),`Show outline`]}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:N,onChange:e=>I(e.target.checked)}),`Show comments panel`]}),(0,J.jsx)(`div`,{className:`settings-section-label`,children:`Display`}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:t.lineWrap,onChange:e=>r({lineWrap:e.target.checked})}),`Wrap long lines`]}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:t.showLineNumbers,onChange:e=>r({showLineNumbers:e.target.checked})}),`Show line numbers`]}),(0,J.jsxs)(`label`,{className:`settings-item`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:t.showStatusBar??!0,onChange:e=>r({showStatusBar:e.target.checked})}),`Show status bar`]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Hover highlight`}),(0,J.jsx)(tW,{value:t.lineHoverHighlight,onValueChange:e=>r({lineHoverHighlight:e}),options:W4,ariaLabel:`Hover highlight`})]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Font size`}),(0,J.jsx)(tW,{value:String(t.fontSize),onValueChange:e=>r({fontSize:Number(e)}),options:H4,ariaLabel:`Font size`})]}),(0,J.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,J.jsx)(`span`,{children:`Default tab size`}),(0,J.jsx)(tW,{value:String(t.defaultTabSize),onValueChange:e=>r({defaultTabSize:Number(e)}),options:U4,ariaLabel:`Default tab size`})]})]})}),B&&(0,J.jsx)(V4,{openCommentCount:fe,onSubmit:(e,t)=>l(B.id,e,t),submitting:u,agentWaiting:d,currentDecision:B.decision})]})]}),!H&&(0,J.jsx)(`div`,{className:`sidebar-mobile-backdrop`,onClick:()=>U(!0),"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`app-body`,children:[(0,J.jsx)(`aside`,{ref:ie,className:`sidebar plan-sidebar ${H?`sidebar-collapsed`:``}`,children:(0,J.jsx)(`div`,{className:`plan-sidebar-content`,children:(0,J.jsx)(z4,{plans:i,activeId:B?.id??null,onSelect:de,onDelete:e=>{o(e),B?.id===e&&jE(`/plan`)},collapsed:H,onToggleCollapse:()=>U(!H)})})}),!H&&(0,J.jsx)(`div`,{className:`sidebar-resize-handle`,onMouseDown:oe,role:`separator`,"aria-label":`Resize sidebar`,"aria-orientation":`vertical`,tabIndex:0}),(0,J.jsx)(`main`,{className:`main plan-main`,children:B?(0,J.jsx)(P4,{plan:B,theme:t.theme||`rose-pine`,fontSize:t.fontSize,monoFontFamily:zE(t.monoFont),defaultTabSize:t.defaultTabSize,lineWrap:t.lineWrap,showLineNumbers:t.showLineNumbers,lineHoverHighlight:t.lineHoverHighlight,viewMode:E,onViewModeChange:w,editorIDE:t.editorIDE,tocOpen:j,onTocOpenChange:F,commentsRailOpen:N,onCommentsRailOpenChange:I,zenMode:D,onZenModeChange:k},B.id):(0,J.jsx)(K4,{hasPlans:i.length>0,notFound:!!z})})]}),(0,J.jsx)(g2,{open:m,activeTheme:t.theme||`rose-pine`,onThemeChange:e=>r({theme:e}),onClose:()=>h(!1)}),(0,J.jsx)(m2,{activity:s?{at:s.at,commentId:s.commentId,filePath:`plan · ${s.planId.slice(0,8)}`,model:s.model,body:s.body}:null,onDismiss:c,onJump:()=>{s&&(jE(`/plan/${s.planId}`),requestAnimationFrame(()=>{document.getElementById(`plan-comment-${s.commentId}`)?.scrollIntoView({behavior:`smooth`,block:`center`})}))}}),(0,J.jsx)(f2,{activeFile:B?B.title:null,onShowHelp:()=>y(!0),placeholder:`No active plan (J/K to jump)`,visible:t.showStatusBar??!0}),(0,J.jsx)(p2,{isOpen:v,onClose:()=>y(!1),mode:`plan`})]})})}function K4({hasPlans:e,notFound:t}){return(0,J.jsxs)(`div`,{className:`plan-empty-state`,children:[(0,J.jsx)(`div`,{className:`plan-empty-icon`,"aria-hidden":`true`,children:(0,J.jsx)(ID,{size:28})}),t?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h2`,{className:`plan-empty-title`,children:`Plan not found`}),(0,J.jsx)(`p`,{className:`plan-empty-body`,children:`It may have been deleted. Pick another from the list, or submit a new one.`})]}):e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h2`,{className:`plan-empty-title`,children:`Select a plan`}),(0,J.jsx)(`p`,{className:`plan-empty-body`,children:`Choose one from the sidebar to start reviewing.`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h2`,{className:`plan-empty-title`,children:`No plans yet`}),(0,J.jsx)(`p`,{className:`plan-empty-body`,children:`Agents submit a plan, you review it here, then they continue on approval.`}),(0,J.jsxs)(`div`,{className:`plan-empty-steps`,children:[(0,J.jsx)(`code`,{children:`diffing plan submit PLAN.md`}),(0,J.jsx)(`code`,{children:`diffing plan await`})]})]})]})}var q4=[`pr-session`];function J4(){let e=Re(),{data:t,isLoading:n,error:r}=$e({queryKey:q4,queryFn:async()=>{let e=await fetch(`/api/gh/session`);if(e.status===404)return null;if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();return t?.prMode===!1?null:t},retry:!1});return(0,q.useEffect)(()=>gE(`pr-session`,()=>{e.invalidateQueries({queryKey:q4})}),[e]),{session:t,loaded:!n,error:r}}function Y4(e){let t=Re();(0,q.useEffect)(()=>{if(!e)return;let n=!1,r=!1,i=async()=>{if(!(n||r||document.visibilityState===`hidden`)){r=!0;try{(await fetch(`/api/gh/comments/sync`,{method:`POST`})).ok&&!n&&await t.invalidateQueries({queryKey:q4})}finally{r=!1}}},a=()=>{i()};i();let o=window.setInterval(i,3e4);return window.addEventListener(`focus`,a),()=>{n=!0,window.clearInterval(o),window.removeEventListener(`focus`,a)}},[e,t])}var X4=[`pr-comments`];function Z4(e){let t=Re(),{data:n=[]}=$e({queryKey:X4,queryFn:async()=>{let e=await fetch(`/api/gh/pr-session/comments`);if(e.status===404)return[];if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()},enabled:e});(0,q.useEffect)(()=>gE(`pr-session`,()=>{t.invalidateQueries({queryKey:X4})}),[t]);let r=et({mutationFn:async e=>(await fetch(`/api/gh/pr-session/comments`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).json(),onSuccess:e=>{t.setQueryData(X4,(t=[])=>[...t,e])}}),i=et({mutationFn:async e=>(await fetch(`/api/gh/pr-session/comments/${e}`,{method:`DELETE`}),e),onSuccess:e=>{t.setQueryData(X4,(t=[])=>t.filter(t=>t.id!==e))}}),a=et({mutationFn:async({id:e,body:t,status:n})=>(await fetch(`/api/gh/pr-session/comments/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:t,status:n})})).json(),onSuccess:e=>{t.setQueryData(X4,(t=[])=>t.map(t=>t.id===e.id?e:t))}}),o=et({mutationFn:async({id:e,body:t})=>{let n=await fetch(`/api/gh/pr-session/comments/${e}/replies`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:t,role:`user`})}),r=await n.json().catch(()=>({}));if(!n.ok||!r.id)throw Error(r.error||`HTTP ${n.status}`);return r},onMutate:async({id:e,body:n})=>{await t.cancelQueries({queryKey:X4});let r=t.getQueryData(X4)??[],i=`pending-${crypto.randomUUID()}`;return t.setQueryData(X4,(t=[])=>t.map(t=>t.id===e?{...t,replies:[...t.replies??[],{id:i,body:n,createdAt:Date.now(),role:`user`}]}:t)),{previous:r}},onError:(e,n,r)=>{r?.previous&&t.setQueryData(X4,r.previous)},onSuccess:e=>{t.setQueryData(X4,(t=[])=>t.map(t=>t.id===e.id?e:t))}}),s=(0,q.useCallback)(e=>{a.mutate({id:e,status:`resolved`})},[a]),c=(0,q.useCallback)(e=>{a.mutate({id:e,status:`open`})},[a]),l=(0,q.useCallback)((e,t,n)=>{},[]),u=(0,q.useCallback)((e,t)=>{},[]);return{comments:n,addComment:r.mutate,removeComment:i.mutate,updateComment:a.mutate,addReply:o.mutateAsync,resolveComment:s,unresolveComment:c,editComment:(e,t)=>a.mutate({id:e,body:t}),editReply:l,removeReply:u}}function Q4(){let e=Re();return et({mutationFn:async e=>{let t=new AbortController,n=window.setTimeout(()=>t.abort(),6e4);try{let n=await fetch(`/api/gh/submit`,{method:`POST`,headers:{"Content-Type":`application/json`},signal:t.signal,body:JSON.stringify({decision:e.decision,body:e.body,dryRun:e.dryRun})}),r=await n.json();if(!n.ok||!r.ok)throw Error(r.error||`HTTP ${n.status}`);return r}catch(e){throw t.signal.aborted?Error(`GitHub submission timed out. Check your connection and try again.`):e}finally{window.clearTimeout(n)}},onSuccess:()=>{e.setQueryData(X4,[]),e.invalidateQueries({queryKey:q4}),e.invalidateQueries({queryKey:X4})}})}function $4(){let e=Re();return et({mutationFn:async()=>{let e=await fetch(`/api/gh/pr/refresh`,{method:`POST`}),t=await e.json();if(!e.ok)throw Error(t.error||`HTTP ${e.status}`);return t},onSuccess:()=>{e.invalidateQueries({queryKey:q4}),e.invalidateQueries({queryKey:X4})}})}function e3({session:e,comments:t,onEditComment:n,onDeleteComment:r,onSubmitted:i}){let{haptic:a,sound:o}=xT(),s=Q4(),[c,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)(null),[f,p]=(0,q.useState)(``),{popoverStyle:m,activePreset:h,applyPreset:g,startResize:_,startLeftResize:v,startCornerResize:y,handleOpenChange:b,panelRef:x}=yH(),S=t.length,C=(0,q.useMemo)(()=>[...t].sort((e,t)=>e.createdAt-t.createdAt),[t]),w=!!e.submittedAt,T=async()=>{if(u){a(`heavy`),o(`send`);try{let e=await s.mutateAsync({decision:u,body:f});i?.(e),p(``),d(null),l(!1)}catch{}}};return(0,J.jsx)(Pk,{open:c,onOpenChange:(e,t)=>b(e,t,l),ariaLabel:`Submit your review to GitHub`,className:`submit-to-github-popover`,trigger:(0,J.jsxs)(`button`,{className:`btn btn-primary btn-sm send-review-btn`,disabled:s.isPending,title:w?`Already submitted`:`Submit your review to the PR on GitHub`,style:{display:`inline-flex`,alignItems:`center`,gap:`6px`},children:[(0,J.jsx)(eO,{size:14}),(0,J.jsx)(`span`,{className:`btn-label`,children:s.isPending?`Submitting…`:w?`Submitted ✓`:S>0?`Submit to GitHub (${S})`:`Submit to GitHub`})]}),children:(0,J.jsxs)(`div`,{className:`srp`,ref:x,style:m,children:[(0,J.jsx)(`div`,{className:`srp-resize-handle-left`,onPointerDown:v,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize submit panel width`,tabIndex:0}),(0,J.jsxs)(`div`,{className:`srp-head`,children:[(0,J.jsx)(eO,{size:15,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`srp-title`,children:`Submit review to GitHub`}),(0,J.jsx)(`div`,{className:`srp-size-presets`,role:`group`,"aria-label":`Panel size`,children:uH.map((e,t)=>(0,J.jsx)(`button`,{className:`srp-preset-btn`,role:`radio`,"aria-checked":h===t,"aria-pressed":h===t,onClick:()=>g(e),title:`${e.width}×${e.height}px`,children:e.label},e.label))}),(0,J.jsxs)(`span`,{className:`srp-count`,children:[S,` comment`,S===1?``:`s`]})]}),(0,J.jsxs)(`div`,{className:`srp-scroll`,children:[w&&(0,J.jsxs)(`div`,{className:`srp-already-submitted`,children:[(0,J.jsx)(wD,{size:13}),(0,J.jsxs)(`span`,{children:[`Already submitted as`,` `,e.submittedReviewUrl?(0,J.jsxs)(`a`,{href:e.submittedReviewUrl,target:`_blank`,rel:`noreferrer`,children:[`review #`,e.submittedReviewId,` `,(0,J.jsx)(UD,{size:11})]}):`review #${e.submittedReviewId}`,`. Re-submitting will post a new review on the same PR.`]})]}),(0,J.jsx)(`div`,{className:`plan-verdict-options`,role:`radiogroup`,"aria-label":`Verdict`,children:t3.map(e=>{let t=e.icon,n=u===e.value;return(0,J.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,className:`plan-verdict-option ${e.className} ${n?`plan-verdict-option-selected`:``}`,onClick:()=>d(e.value),children:[(0,J.jsx)(`span`,{className:`plan-verdict-icon`,children:(0,J.jsx)(t,{size:15,"aria-hidden":`true`})}),(0,J.jsxs)(`span`,{className:`plan-verdict-text`,children:[(0,J.jsx)(`span`,{className:`plan-verdict-label`,children:e.label}),(0,J.jsx)(`span`,{className:`plan-verdict-desc`,children:e.description})]}),(0,J.jsx)(`span`,{className:`plan-verdict-radio`,"aria-hidden":`true`})]},e.value)})}),S>0?(0,J.jsxs)(`section`,{className:`srp-comments-section`,"aria-labelledby":`srp-gh-comments-title`,children:[(0,J.jsxs)(`div`,{className:`srp-section-heading`,id:`srp-gh-comments-title`,children:[(0,J.jsx)(hO,{size:13,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`Inline comments to publish`}),(0,J.jsx)(`span`,{className:`srp-section-count`,children:S})]}),(0,J.jsx)(`ul`,{className:`srp-list`,"aria-label":`Comments to send`,children:C.map(e=>(0,J.jsx)(n3,{comment:e,onEdit:n,onDelete:r},e.id))})]}):(0,J.jsx)(`p`,{className:`srp-empty`,children:`No inline comments — your verdict and overall note will be sent on their own.`}),(0,J.jsxs)(`div`,{className:`srp-general`,children:[(0,J.jsxs)(`label`,{className:`srp-general-label`,htmlFor:`srp-gh-general-input`,children:[`Overall comment `,(0,J.jsx)(`span`,{className:`srp-optional`,children:`(optional · Markdown)`})]}),(0,J.jsx)(sH,{id:`srp-gh-general-input`,value:f,onChange:p,textareaClassName:`srp-general-input`,placeholder:`Add an overall note for the PR that applies to the whole review…`,rows:3,ariaLabel:`Overall PR review comment`,onSubmitShortcut:T})]}),s.isError&&(0,J.jsxs)(`div`,{className:`srp-error`,role:`alert`,children:[(0,J.jsx)(kD,{size:13}),(0,J.jsx)(`span`,{children:s.error?.message??`Submit failed`})]})]}),(0,J.jsxs)(`div`,{className:`srp-footer`,children:[(0,J.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>l(!1),disabled:s.isPending,children:`Cancel`}),(0,J.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:T,disabled:!u||s.isPending,children:s.isPending?`Submitting…`:u===`draft`?`Save draft review`:`Submit review`})]}),(0,J.jsx)(`div`,{className:`srp-resize-handle`,onPointerDown:_,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize submit panel`,tabIndex:0}),(0,J.jsx)(`div`,{className:`srp-resize-handle-corner`,onPointerDown:y,role:`separator`,"aria-label":`Resize submit panel width and height`,tabIndex:0})]})})}var t3=[{value:`approve`,label:`Approve`,description:`The PR is good — submit an APPROVE review.`,icon:wD,className:`plan-verdict-approve`},{value:`comment`,label:`Comment`,description:`Leave neutral feedback (no approve / no request changes).`,icon:mO,className:`plan-verdict-changes`},{value:`request-changes`,label:`Request changes`,description:`The author must address the comments before merging.`,icon:WO,className:`plan-verdict-reject`},{value:`draft`,label:`Save as draft`,description:`Post a PENDING review on GitHub — finish it later in the PR UI.`,icon:KD,className:`plan-verdict-comment-only`}];function n3({comment:e,onEdit:t,onDelete:n}){let[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.body),s=(0,q.useRef)(null);(0,q.useEffect)(()=>{r&&(s.current?.focus(),s.current?.select())},[r]);let c=e.lineNumber>0?e.startLineNumber&&e.startLineNumber!==e.lineNumber?`:${e.startLineNumber}-${e.lineNumber}`:`:${e.lineNumber}`:` · file`,l=()=>{let n=a.trim();n&&n!==e.body&&t(e.id,n),i(!1)};return(0,J.jsxs)(`li`,{className:`srp-item`,children:[(0,J.jsxs)(`div`,{className:`srp-item-top`,children:[(0,J.jsxs)(`span`,{className:`srp-item-loc`,children:[(0,J.jsx)(`span`,{className:`srp-item-file`,children:IT(e.filePath)}),(0,J.jsx)(`span`,{className:`srp-item-line`,children:c})]}),e.status===`resolved`&&(0,J.jsx)(`span`,{className:`srp-item-resolved`,children:`resolved`}),(0,J.jsxs)(`span`,{className:`srp-item-actions`,children:[r?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{className:`srp-icon-btn`,onClick:l,title:`Save edit`,children:(0,J.jsx)(wD,{size:13,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{className:`srp-icon-btn`,onClick:()=>{o(e.body),i(!1)},title:`Cancel edit`,children:(0,J.jsx)(WO,{size:13,"aria-hidden":`true`})})]}):(0,J.jsx)(`button`,{className:`srp-icon-btn`,onClick:()=>i(!0),title:`Edit comment`,children:(0,J.jsx)(DO,{size:13,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{className:`srp-icon-btn srp-icon-btn-danger`,onClick:()=>n(e.id),title:`Remove from review`,children:(0,J.jsx)(zO,{size:13,"aria-hidden":`true`})})]})]}),e.lineContent?.trim()&&(0,J.jsx)(`code`,{className:`srp-item-code`,children:e.lineContent.trim().slice(0,160)}),r?(0,J.jsx)(`textarea`,{ref:s,className:`srp-item-edit`,value:a,rows:2,onChange:e=>o(e.target.value),onKeyDown:t=>{t.key===`Enter`&&(t.metaKey||t.ctrlKey)?(t.preventDefault(),l()):t.key===`Escape`&&(t.preventDefault(),o(e.body),i(!1))}}):(0,J.jsx)(`p`,{className:`srp-item-body`,children:e.body})]})}function r3({session:e,comments:t,settingsProps:n,sidebarCollapsed:r,onToggleSidebar:i,onOpenSearch:a,onRefresh:o,refreshing:s,onEditComment:c,onDeleteComment:l,onSubmitted:u}){return(0,J.jsxs)(`header`,{className:`toolbar diff-app-toolbar pr-review-toolbar`,role:`banner`,children:[(0,J.jsxs)(`div`,{className:`toolbar-left`,children:[(0,J.jsx)(`button`,{className:`toolbar-mobile-toggle`,onClick:i,"aria-label":r?`Open file tree`:`Close file tree`,"aria-expanded":!r,title:r?`Open sidebar · b`:`Close sidebar · b`,children:(0,J.jsx)(dO,{size:18})}),(0,J.jsx)(`button`,{className:`pr-toolbar-back`,onClick:()=>jE(`/`),title:`Back to local review`,"aria-label":`Back to local review`,children:(0,J.jsx)(bD,{size:14})}),(0,J.jsxs)(`div`,{className:`toolbar-brand pr-toolbar-brand`,children:[(0,J.jsx)(HH,{size:20,className:`toolbar-brand-mark`}),(0,J.jsxs)(`div`,{className:`toolbar-brand-text`,children:[(0,J.jsxs)(`h1`,{className:`toolbar-title`,children:[e.owner,`/`,e.repo]}),(0,J.jsxs)(`span`,{className:`toolbar-branch-inline`,title:`Pull request #${e.pullNumber}`,children:[(0,J.jsx)(eO,{size:11}),` #`,e.pullNumber]}),e.headRefName&&e.baseRefName&&(0,J.jsxs)(`span`,{className:`toolbar-branch-flow`,title:`Comparing ${e.headRefName} into ${e.baseRefName}`,"aria-label":`Source branch ${e.headRefName} into target branch ${e.baseRefName}`,children:[(0,J.jsx)(`code`,{className:`toolbar-branch-head`,children:e.headRefName}),(0,J.jsx)(xD,{size:11,"aria-hidden":`true`}),(0,J.jsx)(`code`,{className:`toolbar-branch-base`,children:e.baseRefName})]})]})]})]}),(0,J.jsxs)(`div`,{className:`toolbar-right`,children:[(0,J.jsxs)(`button`,{className:`btn btn-sm toolbar-search-btn`,onClick:a,title:`Search files and changed lines (⌘K)`,"aria-label":`Search`,children:[(0,J.jsx)(NO,{size:14}),(0,J.jsx)(`span`,{className:`btn-label`,children:`Search`}),(0,J.jsx)(`kbd`,{className:`toolbar-search-kbd`,children:`⌘K`})]}),(0,J.jsxs)(`button`,{className:`btn btn-sm pr-header-copy`,onClick:()=>navigator.clipboard.writeText(SE(t)),disabled:t.length===0,title:`Copy draft comments as Markdown`,children:[(0,J.jsx)(VD,{size:13}),` `,(0,J.jsx)(`span`,{className:`btn-label`,children:`Copy`})]}),(0,J.jsxs)(`button`,{className:`btn btn-sm pr-header-refresh`,onClick:o,disabled:s,title:`Refresh PR from GitHub`,children:[(0,J.jsx)(kO,{size:13,className:s?`spinning`:``}),(0,J.jsx)(`span`,{className:`btn-label`,children:s?`Refreshing…`:`Refresh`})]}),(0,J.jsxs)(`a`,{className:`btn btn-sm pr-header-link`,href:e.url,target:`_blank`,rel:`noreferrer`,title:`Open pull request on GitHub`,children:[(0,J.jsx)(UD,{size:13}),` `,(0,J.jsx)(`span`,{className:`btn-label`,children:`GitHub`})]}),(0,J.jsx)(fW,{...n}),(0,J.jsx)(e3,{session:e,comments:t,onEditComment:c,onDeleteComment:l,onSubmitted:u})]})]})}var i3={APPROVED:{label:`approved these changes`,short:`Approved`,icon:AD},CHANGES_REQUESTED:{label:`requested changes`,short:`Changes requested`,icon:PD},COMMENTED:{label:`left a review comment`,short:`Commented`,icon:fO},PENDING:{label:`started a pending review`,short:`Pending`,icon:LD},DISMISSED:{label:`had a review dismissed`,short:`Dismissed`,icon:PD}};function a3({reviews:e}){let[t,n]=(0,q.useState)(e[0]?.id??null),[r,i]=(0,q.useState)(null);if((0,q.useEffect)(()=>{n(e[0]?.id??null)},[e[0]?.id]),(0,q.useEffect)(()=>{i(null)},[t]),e.length===0)return null;let a=Math.max(0,e.findIndex(e=>e.id===t)),o=e[a]??e[0],s=i3[o.state],c=s.icon,l=o.submittedAt?new Date(o.submittedAt).getTime():null;return(0,J.jsxs)(`section`,{className:`pr-review-activity`,"aria-label":`GitHub review activity`,children:[(0,J.jsxs)(`header`,{className:`pr-review-activity-head`,children:[(0,J.jsxs)(`div`,{className:`pr-review-activity-identity`,children:[o.author?.avatarUrl&&r!==o.author.avatarUrl?(0,J.jsx)(`img`,{src:`/api/gh/avatar?url=${encodeURIComponent(o.author.avatarUrl)}`,alt:``,className:`pr-review-activity-avatar`,referrerPolicy:`no-referrer`,onError:()=>i(o.author?.avatarUrl??null)}):(0,J.jsx)(`span`,{className:`pr-review-activity-avatar is-fallback`,"aria-hidden":`true`,children:(0,J.jsx)(c,{size:14})}),(0,J.jsx)(c,{className:`pr-review-activity-state-icon`,"data-state":o.state,size:16,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[(0,J.jsxs)(`strong`,{children:[`@`,o.author?.login??`unknown`]}),` `,s.label]}),l!=null&&(0,J.jsx)(`time`,{dateTime:o.submittedAt,title:new Date(l).toLocaleString(),children:FT(l)}),(0,J.jsx)(`span`,{className:`pr-review-activity-verdict`,"data-state":o.state,children:s.short})]}),(0,J.jsxs)(`nav`,{className:`pr-review-activity-nav`,"aria-label":`Walk GitHub reviews`,children:[(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm commit-walk-btn`,disabled:a===0,onClick:()=>n(e[a-1]?.id??o.id),"aria-label":`Newer review`,title:`Newer review`,children:(0,J.jsx)(ED,{size:14})}),(0,J.jsxs)(`span`,{children:[a+1,` / `,e.length]}),(0,J.jsx)(`button`,{type:`button`,className:`btn btn-sm commit-walk-btn`,disabled:a>=e.length-1,onClick:()=>n(e[a+1]?.id??o.id),"aria-label":`Older review`,title:`Older review`,children:(0,J.jsx)(DD,{size:14})}),o.htmlUrl&&(0,J.jsxs)(`a`,{className:`pr-review-activity-link`,href:o.htmlUrl,target:`_blank`,rel:`noreferrer`,children:[`View on GitHub `,(0,J.jsx)(UD,{size:11})]})]})]}),o.body.trim()?(0,J.jsx)(QV,{content:o.body,className:`pr-review-activity-body markdown-body`}):(0,J.jsx)(`p`,{className:`pr-review-activity-empty`,children:`No overall comment was submitted with this review.`})]})}function o3(e){return e.some(e=>e.state===`pending`)?8e3:3e4}function s3(e){return e===`success`?{icon:AD,className:`is-success`,label:`Succeeded`}:e===`pending`?{icon:LD,className:`is-pending`,label:`In progress`}:e===`failure`||e===`error`||e===`timed_out`||e===`action_required`?{icon:PD,className:`is-failure`,label:e===`timed_out`?`Timed out`:`Failed`}:e===`skipped`||e===`cancelled`||e===`neutral`?{icon:MD,className:`is-neutral`,label:e===`cancelled`?`Cancelled`:e===`skipped`?`Skipped`:`Neutral`}:{icon:jD,className:`is-neutral`,label:`Unknown`}}function c3({headSha:e}){let t=$e({queryKey:[`pr-checks`,e],queryFn:async()=>{let e=await fetch(`/api/gh/checks`),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||`HTTP ${e.status}`);return t},refetchInterval:e=>o3(e.state.data?.checks??[]),refetchOnWindowFocus:!0,staleTime:5e3}),n=t.data?.checks??[],r=n.filter(e=>e.state===`success`).length,i=n.filter(e=>e.state===`pending`).length,a=n.filter(e=>[`failure`,`error`,`timed_out`,`action_required`].includes(e.state)).length,o=Math.max(0,n.length-r-i-a),s=a>0?`failure`:i>0?`pending`:n.length>0?`success`:`neutral`,c=s===`failure`?PD:s===`pending`?LD:s===`success`?AD:jD;return(0,J.jsx)(Pk,{ariaLabel:`GitHub checks`,className:`pr-checks-popover`,trigger:(0,J.jsxs)(`button`,{className:`toolbar-chip pr-checks-trigger is-${s}`,title:`Live GitHub checks and actions status`,type:`button`,children:[(0,J.jsx)(c,{size:12}),(0,J.jsx)(`span`,{children:t.isLoading?`Loading checks…`:n.length===0?`No checks`:a>0?`${a} failing`:i>0?`${i} running`:`${r}/${n.length} passed`})]}),children:(0,J.jsxs)(`div`,{className:`pr-checks-panel`,children:[(0,J.jsxs)(`div`,{className:`pr-checks-head`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`strong`,{children:`Checks and actions`}),(0,J.jsxs)(`span`,{children:[`Live status for `,e.slice(0,7)]})]}),(0,J.jsx)(`button`,{className:`file-diff-icon-btn`,onClick:()=>t.refetch(),disabled:t.isFetching,"aria-label":`Refresh checks`,children:(0,J.jsx)(kO,{size:13,className:t.isFetching?`spinning`:``})})]}),n.length>0&&(0,J.jsxs)(`div`,{className:`pr-checks-summary`,"aria-label":`Checks summary`,children:[(0,J.jsxs)(`span`,{className:`is-success`,children:[(0,J.jsx)(AD,{size:12}),` `,r,` passed`]}),(0,J.jsxs)(`span`,{className:`is-failure`,children:[(0,J.jsx)(PD,{size:12}),` `,a,` failed`]}),(0,J.jsxs)(`span`,{className:`is-pending`,children:[(0,J.jsx)(LD,{size:12}),` `,i,` running`]}),o>0&&(0,J.jsxs)(`span`,{className:`is-neutral`,children:[(0,J.jsx)(MD,{size:12}),` `,o,` other`]})]}),t.isError?(0,J.jsxs)(`div`,{className:`pr-checks-empty is-error`,children:[(0,J.jsx)(kD,{size:15}),` `,t.error.message]}):t.isLoading?(0,J.jsx)(`div`,{className:`pr-checks-empty`,children:`Loading the latest GitHub status…`}):n.length===0?(0,J.jsx)(`div`,{className:`pr-checks-empty`,children:`No checks are reported for this commit.`}):(0,J.jsx)(`ul`,{className:`pr-checks-list`,children:n.map((e,t)=>{let n=s3(e.state),r=n.icon;return(0,J.jsxs)(`li`,{className:n.className,children:[(0,J.jsx)(r,{size:14}),(0,J.jsx)(`span`,{className:`pr-checks-name`,children:e.name}),(0,J.jsx)(`span`,{className:`pr-checks-state`,children:n.label}),e.detailsUrl&&(0,J.jsx)(`a`,{href:e.detailsUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Open ${e.name} on GitHub`,children:(0,J.jsx)(UD,{size:12})})]},`${e.name}-${t}`)})}),(0,J.jsx)(`div`,{className:`pr-checks-foot`,children:`Updates every 8 seconds while work is running.`})]})})}function l3({session:e,draftCount:t}){return(0,J.jsx)(`section`,{className:`diff-overview-banner pr-overview-banner`,"aria-label":`Pull request #${e.pullNumber}: ${e.title}`,children:(0,J.jsxs)(`header`,{className:`diff-overview-banner-header`,children:[(0,J.jsxs)(`div`,{className:`diff-overview-banner-line`,children:[(0,J.jsx)(eO,{size:14,className:`diff-overview-banner-icon`,"aria-hidden":`true`}),(0,J.jsx)(`h2`,{className:`diff-overview-banner-headline`,children:e.title})]}),(0,J.jsxs)(`div`,{className:`diff-overview-banner-meta pr-overview-meta`,children:[(0,J.jsxs)(`span`,{className:`pr-overview-identity`,children:[`Pull request #`,e.pullNumber,e.author?.login?(0,J.jsxs)(J.Fragment,{children:[` by `,(0,J.jsxs)(`strong`,{children:[`@`,e.author.login]})]}):null]}),e.headRefName&&e.baseRefName&&(0,J.jsxs)(`span`,{className:`pr-overview-branches`,title:`Comparing ${e.headRefName} into ${e.baseRefName}`,children:[(0,J.jsx)(`code`,{className:`pr-overview-branch-head`,children:e.headRefName}),(0,J.jsx)(`span`,{className:`pr-overview-branch-arrow`,"aria-hidden":`true`,children:`→`}),(0,J.jsx)(`code`,{className:`pr-overview-branch-base`,children:e.baseRefName})]}),(0,J.jsxs)(`span`,{children:[e.changedFiles,` file`,e.changedFiles===1?``:`s`]}),(0,J.jsxs)(`span`,{className:`toolbar-chip-diff`,"aria-label":`${e.additions} additions and ${e.deletions} deletions`,children:[(0,J.jsxs)(`span`,{className:`stat-additions`,children:[`+`,e.additions]}),(0,J.jsxs)(`span`,{className:`stat-deletions`,children:[`−`,e.deletions]})]}),t>0&&(0,J.jsxs)(`span`,{className:`toolbar-chip toolbar-chip-comments`,children:[t,` draft`,t===1?``:`s`]}),(0,J.jsx)(c3,{headSha:e.headSha})]})]})})}function u3({result:e,onDismiss:t}){return(0,J.jsxs)(`div`,{className:`pr-submitted-toast`,role:`status`,children:[(0,J.jsx)(AD,{size:16,className:`pr-submitted-icon`}),(0,J.jsxs)(`div`,{className:`pr-submitted-text`,children:[(0,J.jsx)(`strong`,{children:`Review submitted to GitHub.`}),e.reviewUrl&&(0,J.jsxs)(J.Fragment,{children:[` `,(0,J.jsxs)(`a`,{href:e.reviewUrl,target:`_blank`,rel:`noreferrer`,children:[`Open review on GitHub `,(0,J.jsx)(UD,{size:11})]})]}),e.authSource&&e.authSource!==`none`&&(0,J.jsxs)(`span`,{className:`pr-submitted-auth`,children:[`via `,e.authSource]})]}),(0,J.jsx)(`button`,{className:`pr-submitted-dismiss`,onClick:t,title:`Dismiss`,"aria-label":`Dismiss`,children:`×`})]})}function d3(){let e=Op(),t=Re(),{settings:n,loaded:r,updateSettings:i}=BE(),[,a]=(0,q.useTransition)(),{session:o,loaded:s,error:c}=J4(),l=$4();Y4(s&&!!o);let{comments:u,addComment:d,removeComment:f,updateComment:p,addReply:m,resolveComment:h,unresolveComment:g,editComment:_,editReply:v,removeReply:y}=Z4(s&&!!o),{patch:b,loading:x,error:S}=bE({staged:!1,untracked:!1},s&&!!o),{viewedFiles:C,setViewed:w}=GE(),[T,E]=(0,q.useState)(null),[D,O]=(0,q.useState)(()=>{let e=iD(`diffing-sidebar-collapsed`);return e==null?typeof window<`u`&&window.innerWidth<=768:e===`true`}),[k,A]=(0,q.useState)(()=>Number(iD(`diffing-sidebar-width`))||320),[j,M]=(0,q.useState)(()=>Number(iD(`diffing-comment-panel-height`))||220),[N,P]=(0,q.useState)(()=>YE(iD(`diffing-pr-extension-filter`)??``)),[F,I]=(0,q.useState)(()=>{let e=iD(`diffing-pr-chip-filter`);return e===`unviewed`||e===`has-comments`?e:`all`}),[L,R]=(0,q.useState)({open:!1,scope:`files`,changedOnly:!1}),z=(0,q.useRef)(!0),[B,V]=(0,q.useState)(!1),[H,U]=(0,q.useState)(!1),[W,ee]=(0,q.useState)(!1),[te,ne]=(0,q.useState)(!1),[re,ie]=(0,q.useState)(null),ae=(0,q.useRef)(null),oe=(0,q.useRef)(null),G=(0,q.useRef)(null),se=(0,q.useRef)(k),K=(0,q.useRef)(j);se.current=k,K.current=j,VE(r,n.uiFont,n.monoFont);let ce=(0,q.useMemo)(()=>{if(!b)return[];try{let e=new Set;return Mh(b).flatMap(e=>e.files).filter(t=>e.has(t.name)?!1:(e.add(t.name),!0)).sort(xG)}catch{return[]}},[b]),le=(0,q.useMemo)(()=>{let e=new Map;for(let t of o?.existingComments??[]){let n=e.get(t.path)??[];n.push(t),e.set(t.path,n)}return e},[o]),ue=(0,q.useMemo)(()=>{let e={};for(let t of u)e[t.filePath]=(e[t.filePath]??0)+1;for(let t of o?.existingComments??[])e[t.path]=(e[t.path]??0)+1;return e},[u,o]),de=(0,q.useMemo)(()=>{let e=ce;return N.length>0&&(e=e.filter(e=>QE(e.name,N))),F===`unviewed`&&(e=e.filter(e=>!C.has(e.name))),F===`has-comments`&&(e=e.filter(e=>(ue[e.name]??0)>0)),e},[ce,N,F,C,ue]),fe=(0,q.useMemo)(()=>{let e=new Map;for(let t of u){let n=e.get(t.filePath)??[];n.push({side:t.side,lineNumber:t.lineNumber,metadata:t}),e.set(t.filePath,n)}return e},[u]),pe=uD(de),me=(0,q.useMemo)(()=>({diffFileSet:TT(de),changedKeys:ET(pe),customMode:!0,staged:!1}),[de,pe]),he=(0,q.useMemo)(()=>zE(n.monoFont),[n.monoFont]),ge=(0,q.useMemo)(()=>new Set,[]),_e=(0,q.useCallback)(e=>{E(e),document.getElementById(`file-${e}`)?.scrollIntoView({block:`start`})},[]),ve=(0,q.useCallback)(e=>{let t=de[de.findIndex(t=>t.name===e)+1];t&&requestAnimationFrame(()=>requestAnimationFrame(()=>{document.getElementById(`file-${t.name}`)?.scrollIntoView({block:`start`,behavior:`smooth`})}))},[de]),ye=(0,q.useCallback)((e,t)=>{w(e,t),t&&ve(e)},[w,ve]),be=(0,q.useCallback)(async(e,n)=>{let r=await fetch(`/api/gh/existing-comments/${e}/replies`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:n})}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.error||`HTTP ${r.status}`);await t.invalidateQueries({queryKey:[`pr-session`]})},[t]),xe=(0,q.useCallback)(async(e,n,r)=>{let i=await fetch(`/api/gh/existing-comments/${n}`,{method:e,headers:r==null?void 0:{"Content-Type":`application/json`},body:r==null?void 0:JSON.stringify({body:r})}),a=await i.json().catch(()=>({}));if(!i.ok)throw Error(a.error||`HTTP ${i.status}`);await t.invalidateQueries({queryKey:[`pr-session`]})},[t]),Se=(0,q.useCallback)(async(e,n)=>{let r=await fetch(`/api/gh/review-threads/${encodeURIComponent(e)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({resolved:n})}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.error||`HTTP ${r.status}`);await t.invalidateQueries({queryKey:[`pr-session`]})},[t]),Ce=(0,q.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=se.current,r=oe.current?.getBoundingClientRect().left??0,i=n,a=e=>{i=Math.max(240,Math.min(640,n+e.clientX-t)),G.current&&(G.current.style.transform=`translateX(${r+i}px)`)},o=()=>{G.current?.classList.remove(`sidebar-resize-guide-active`),A(i),cD(`diffing-sidebar-width`,String(i)),document.removeEventListener(`mousemove`,a),document.removeEventListener(`mouseup`,o),document.body.style.cursor=``,document.body.style.userSelect=``};G.current?.classList.add(`sidebar-resize-guide-active`),document.addEventListener(`mousemove`,a),document.addEventListener(`mouseup`,o),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]),we=(0,q.useCallback)(e=>{e.preventDefault();let t=e.clientY,n=K.current,r=n,i=e=>{r=Math.max(100,Math.min(600,n+t-e.clientY)),ae.current?.style.setProperty(`--comment-panel-height`,`${r}px`)},a=()=>{M(r),cD(`diffing-comment-panel-height`,String(r)),document.removeEventListener(`mousemove`,i),document.removeEventListener(`mouseup`,a),document.body.style.cursor=``,document.body.style.userSelect=``};document.addEventListener(`mousemove`,i),document.addEventListener(`mouseup`,a),document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`},[]);(0,q.useEffect)(()=>{cD(`diffing-sidebar-collapsed`,String(D))},[D]),(0,q.useEffect)(()=>cD(`diffing-pr-extension-filter`,N.join(`,`)),[N]),(0,q.useEffect)(()=>cD(`diffing-pr-chip-filter`,F),[F]),(0,q.useEffect)(()=>{let e=document.documentElement;e.classList.add(`theme-switching`),e.setAttribute(`data-theme`,n.theme||`rose-pine`),e.setAttribute(`data-density`,n.density||`comfortable`);let t=requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.remove(`theme-switching`)));return()=>cancelAnimationFrame(t)},[n.theme,n.density]);let Te=(0,q.useMemo)(()=>LT[n.theme||`rose-pine`]||LT[`rose-pine`],[n.theme]),Ee=(0,q.useMemo)(()=>Array.from(new Set(ce.flatMap(e=>[Kd(e.name),e.prevName?Kd(e.prevName):null]).filter(e=>e!=null&&e!==`text`))),[ce]);(0,q.useEffect)(()=>{e&&e.setRenderOptions({theme:{dark:Te.type===`dark`?Te.themeName:`rose-pine`,light:Te.type===`light`?Te.themeName:`github-light`}}).catch(()=>{})},[e,Te]),(0,q.useEffect)(()=>{let e=Te.type===`dark`?Te.themeName:`rose-pine`,t=Te.type===`light`?Te.themeName:`github-light`;Bd({themes:Array.from(new Set([e,t])),langs:Ee}).catch(()=>{})},[Te,Ee]),(0,q.useEffect)(()=>{if(o)return document.title=`${o.owner}/${o.repo}#${o.pullNumber} · diffing`,()=>{document.title=`diffing`}},[o]);let De=(0,q.useCallback)(e=>{if(de.length===0)return;let t=T?de.findIndex(e=>e.name===T):-1,n=e===`next`?Math.min(t+1,de.length-1):Math.max(t-1,0),r=de[Math.max(0,n)];r&&_e(r.name)},[T,de,_e]),Oe=(0,q.useCallback)(()=>{T&&ye(T,!C.has(T))},[T,ye,C]),{setSnapshot:ke,nextHit:Ae,prevHit:je,statusMessage:Me}=ZT(me,_e),Ne=(0,q.useCallback)(e=>{R({open:!0,scope:e,changedOnly:!0})},[]),Pe=(0,q.useCallback)(()=>{R(e=>e.open?{...e,open:!1}:{open:!0,scope:`all`,changedOnly:z.current})},[]),Fe=(0,q.useCallback)(e=>{z.current=e,R(t=>({...t,changedOnly:e}))},[]);if(ST((0,q.useMemo)(()=>({onNavigateFile:De,onToggleViewed:Oe,onToggleDiffStyle:()=>i({diffStyle:n.diffStyle===`split`?`unified`:`split`}),onCycleTabSize:()=>{let e=[2,4,8];i({defaultTabSize:e[(e.indexOf(n.defaultTabSize)+1)%e.length]})},onToggleSidebar:()=>O(e=>!e),onToggleLineWrap:()=>i({lineWrap:!n.lineWrap}),onToggleLineNumbers:()=>i({showLineNumbers:!n.showLineNumbers}),onCycleDiffIndicators:()=>{let e=[`classic`,`bars`,`none`];i({diffIndicators:e[(e.indexOf(n.diffIndicators)+1)%e.length]})},onCycleLineDiffType:()=>{let e=[`word`,`word-alt`,`char`,`none`];i({lineDiffType:e[(e.indexOf(n.lineDiffType)+1)%e.length]})},onOpenPalette:Ne,onTogglePalette:Pe,onNextSearchHit:Ae,onPrevSearchHit:je,onOpenTheme:()=>V(!0),onOpenShortcuts:()=>ne(!0)}),[De,n.defaultTabSize,n.diffIndicators,n.diffStyle,n.lineDiffType,n.lineWrap,n.showLineNumbers,Oe,i,Ne,Pe,Ae,je])),s&&!o)return(0,J.jsxs)(`div`,{className:`pr-app-empty`,children:[(0,J.jsx)(eO,{size:32}),(0,J.jsx)(`h2`,{children:`No active PR session`}),(0,J.jsxs)(`p`,{children:[`Start one with `,(0,J.jsx)(`code`,{children:`diffing "gh pr 1234"`}),` or `,(0,J.jsx)(`code`,{children:`diffing --gh-pr 1234`}),` from inside the repo.`]}),(0,J.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>jE(`/`),children:`Back to local review`})]});if(!o)return(0,J.jsx)(`div`,{className:`pr-app-empty`,children:(0,J.jsx)(`span`,{children:`Loading PR session…`})});let Ie=e=>a(()=>i(e)),Le={diffStyle:n.diffStyle,defaultTabSize:n.defaultTabSize,lineDiffType:n.lineDiffType,lineWrap:n.lineWrap,diffIndicators:n.diffIndicators,showLineNumbers:n.showLineNumbers,hunkSeparators:n.hunkSeparators,lineHoverHighlight:n.lineHoverHighlight,fontSize:n.fontSize,haptics:n.haptics,sounds:n.sounds,uiFont:n.uiFont,monoFont:n.monoFont,density:n.density,autoCollapseLineThreshold:n.autoCollapseLineThreshold,showStatusBar:n.showStatusBar,onDiffStyleChange:e=>Ie({diffStyle:e}),onDefaultTabSizeChange:e=>Ie({defaultTabSize:e}),onOpenThemeModal:()=>V(!0),onLineDiffTypeChange:e=>Ie({lineDiffType:e}),onLineWrapChange:e=>Ie({lineWrap:e}),onDiffIndicatorsChange:e=>Ie({diffIndicators:e}),onShowLineNumbersChange:e=>Ie({showLineNumbers:e}),onHunkSeparatorsChange:e=>Ie({hunkSeparators:e}),onLineHoverHighlightChange:e=>Ie({lineHoverHighlight:e}),onFontSizeChange:e=>Ie({fontSize:e}),onHapticsChange:e=>Ie({haptics:e}),onSoundsChange:e=>Ie({sounds:e}),onDensityChange:e=>Ie({density:e}),onAutoCollapseLineThresholdChange:e=>Ie({autoCollapseLineThreshold:e}),onShowStatusBarChange:e=>Ie({showStatusBar:e}),onOpenUiFontModal:()=>U(!0),onOpenMonoFontModal:()=>ee(!0),showSource:!1,showWhitespace:!1,showExternalTools:!1,showSendPolicy:!1};return(0,J.jsx)(bT,{enabled:n.haptics,soundsEnabled:n.sounds,children:(0,J.jsxs)(`div`,{ref:ae,className:`app pr-app`,"data-pr-mode":`true`,style:{"--sidebar-width":`${k}px`,"--comment-panel-height":`${j}px`},children:[(0,J.jsx)(`a`,{href:`#pr-diff-main`,className:`skip-to-main`,children:`Skip to diff`}),(0,J.jsx)(`div`,{className:`sidebar-resize-guide`,ref:G,"aria-hidden":`true`}),(0,J.jsx)(r3,{session:o,comments:u,settingsProps:Le,sidebarCollapsed:D,onToggleSidebar:()=>O(e=>!e),onOpenSearch:()=>R({open:!0,scope:`all`}),onRefresh:()=>l.mutate(),refreshing:l.isPending,onEditComment:(e,t)=>p({id:e,body:t}),onDeleteComment:f,onSubmitted:ie}),!D&&(0,J.jsx)(`div`,{className:`sidebar-mobile-backdrop`,onClick:()=>O(!0),"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`app-body`,children:[(0,J.jsxs)(`aside`,{ref:oe,className:`sidebar ${D?`sidebar-collapsed`:``}`,children:[(0,J.jsx)(`div`,{className:`pr-sidebar-tree`,children:(0,J.jsx)(U0,{files:ce,activeFile:T,commentCounts:ue,viewedFiles:C,untrackedFiles:ge,onFileClick:_e,collapsed:D,onToggleCollapse:()=>O(e=>!e),appliedExtensions:N,onApplyExtensions:e=>P(XE(e)),chipFilter:F,onChipFilterChange:I})}),!D&&u.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`ct-resize-handle`,onMouseDown:we,role:`separator`,"aria-label":`Resize comments panel`,"aria-orientation":`horizontal`,tabIndex:0}),(0,J.jsx)(`div`,{className:`ct-wrapper pr-ct-wrapper`,children:(0,J.jsx)(q0,{comments:u,resolveComment:h,unresolveComment:g,removeComment:f,addReply:async(e,t)=>{await m({id:e,body:t})},editComment:_,editReply:v,removeReply:y})})]})]}),!D&&(0,J.jsx)(`div`,{className:`sidebar-resize-handle`,onMouseDown:Ce,role:`separator`,"aria-label":`Resize sidebar`,"aria-orientation":`vertical`,tabIndex:0}),(0,J.jsxs)(`main`,{className:`main pr-main`,id:`pr-diff-main`,tabIndex:-1,children:[(0,J.jsx)(l3,{session:o,draftCount:u.length}),(0,J.jsx)(a3,{reviews:o.existingReviews??[]}),(o.existingComments?.length??0)>0&&(0,J.jsxs)(`div`,{className:`pr-existing-summary`,children:[(0,J.jsx)(fO,{size:13}),(0,J.jsxs)(`span`,{children:[o.existingComments.length,` existing GitHub conversation`,o.existingComments.length===1?``:`s`,` included in this review.`]})]}),(S||c)&&(0,J.jsxs)(`div`,{className:`pr-error`,children:[(0,J.jsx)(kD,{size:14}),` Failed to load the PR: `,S||c?.message]}),x&&!b?(0,J.jsx)(`div`,{className:`pr-app-loading`,children:`Loading PR diff…`}):de.length===0?(0,J.jsxs)(`div`,{className:`empty-state`,role:`status`,children:[(0,J.jsx)(`div`,{className:`empty-state-icon`,children:(0,J.jsx)(QD,{size:24})}),(0,J.jsx)(`p`,{className:`empty-state-title`,children:`No matching files`}),(0,J.jsx)(`p`,{className:`empty-state-hint`,children:`Clear the file-tree filters to see the full pull request.`})]}):(0,J.jsx)(f3,{files:de,fileAnnotations:fe,existingCommentsByFile:le,viewedFiles:C,settings:n,monoFontFamily:he,onAddComment:e=>d(e),onDeleteComment:f,onViewedChange:ye,onCardToggleCollapse:(e,t)=>{t&&ve(e)},onReplyExisting:be,onEditExisting:(e,t)=>xe(`PATCH`,e,t),onDeleteExisting:e=>xe(`DELETE`,e),onSetExistingResolved:Se})]})]}),(0,J.jsx)(i2,{isOpen:L.open,onClose:()=>R(e=>({...e,open:!1})),initialScope:L.scope,initialChangedOnly:L.changedOnly,onChangedOnlyPreference:Fe,onSessionSnapshot:ke,files:de,changedEntries:pe,customMode:!0,staged:!1,onNavigateFile:_e,theme:n.theme||`rose-pine`,fontSize:n.fontSize,monoFontFamily:he,defaultTabSize:n.defaultTabSize,lineWrap:n.lineWrap,showLineNumbers:n.showLineNumbers,lineHoverHighlight:n.lineHoverHighlight}),(0,J.jsx)(f2,{activeFile:T,onShowHelp:()=>ne(!0),visible:n.showStatusBar,statusMessage:Me,placeholder:`No active PR file (J/K to jump)`}),(0,J.jsx)(p2,{isOpen:te,onClose:()=>ne(!1),mode:`pr`}),(0,J.jsx)(g2,{open:B,activeTheme:n.theme||`rose-pine`,onThemeChange:e=>Ie({theme:e}),onClose:()=>V(!1)}),(0,J.jsx)(y2,{open:H,title:`Select UI Font`,defaultLabel:`Default (Geist Mono, from CDN)`,activeFont:n.uiFont,onFontChange:e=>Ie({uiFont:e}),onClose:()=>U(!1)}),(0,J.jsx)(y2,{open:W,title:`Select Code Font`,defaultLabel:`Default (JetBrains Mono, from CDN)`,activeFont:n.monoFont,onFontChange:e=>Ie({monoFont:e}),onClose:()=>ee(!1)}),re&&(0,J.jsx)(u3,{result:re,onDismiss:()=>ie(null)})]})})}function f3({files:e,fileAnnotations:t,existingCommentsByFile:n,viewedFiles:r,settings:i,monoFontFamily:a,onAddComment:o,onDeleteComment:s,onViewedChange:c,onCardToggleCollapse:l,onReplyExisting:u,onEditExisting:d,onDeleteExisting:f,onSetExistingResolved:p}){return(0,J.jsx)(`div`,{className:`pr-diff-surface`,children:e.map(e=>{let m=n.get(e.name)??[];return(0,J.jsx)(`div`,{className:`pr-file-block`,children:(0,J.jsx)(SG,{files:[e],diffStyle:i.diffStyle,tabSizeMap:{},defaultTabSize:i.defaultTabSize,viewedFiles:r,binaryFiles:new Map,theme:i.theme||`rose-pine`,lineDiffType:i.lineDiffType,lineWrap:i.lineWrap,diffIndicators:i.diffIndicators,showLineNumbers:i.showLineNumbers,hunkSeparators:i.hunkSeparators,lineHoverHighlight:i.lineHoverHighlight,fontSize:i.fontSize,monoFontFamily:a,expandContextByDefault:i.expandContextByDefault,collapsedContextThreshold:i.collapsedContextThreshold,expansionLineCount:i.expansionLineCount,autoCollapseLineThreshold:i.autoCollapseLineThreshold,onViewedChange:c,fileAnnotationsMap:new Map([[e.name,t.get(e.name)??[]]]),existingCommentsMap:new Map([[e.name,m]]),onAddComment:(e,t,n,r,i,a)=>o({filePath:e,side:t,lineNumber:n,lineContent:r,body:i,startLineNumber:a}),onDeleteComment:s,onReplyExisting:u,onEditExisting:d,onDeleteExisting:f,onSetExistingResolved:p,onCardToggleCollapse:l,allowLocalActions:!1})},e.name)})})}function p3(){let e=FE(),[t,n]=(0,q.useState)(!1),[r,i]=(0,q.useState)(()=>e===`/gh/pr`||e.startsWith(`/gh/pr/`)||e.startsWith(`/plan`));return(0,q.useEffect)(()=>{rD().then(()=>{n(!0)})},[]),(0,q.useEffect)(()=>{if(e===`/gh/pr`||e.startsWith(`/gh/pr/`)||e.startsWith(`/plan`)){i(!0);return}if(e!==`/`){i(!0);return}let t=!1;return fetch(`/api/gh/session`).then(async e=>{t||e.ok&&(await e.json().catch(()=>null))?.prMode===!0&&jE(`/gh/pr`,{replace:!0})}).catch(()=>{}).finally(()=>{t||i(!0)}),()=>{t=!0}},[e]),!t||!r?(0,J.jsxs)(`div`,{className:`boot-loader`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(HH,{size:40,className:`boot-loader-mark`}),(0,J.jsx)(`div`,{className:`boot-loader-spinner`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`boot-loader-label`,children:`Loading review session…`})]}):e===`/plan`||e.startsWith(`/plan/`)?(0,J.jsx)(G4,{}):e===`/gh/pr`||e.startsWith(`/gh/pr/`)?(0,J.jsx)(d3,{}):(0,J.jsx)(A2,{})}var m3=new Pe;lE(),(0,dt.createRoot)(document.getElementById(`root`)).render((0,J.jsx)(ze,{client:m3,children:(0,J.jsx)(rt,{children:(0,J.jsx)(Dp,{poolOptions:{workerFactory:()=>new Og,poolSize:Math.max(1,Math.min(4,navigator.hardwareConcurrency||2))},highlighterOptions:{theme:{dark:`rose-pine`,light:`github-light`},langs:[`vue`]},children:(0,J.jsx)(Zw,{children:(0,J.jsx)(p3,{})})})})}));export{l as a,s as i,X as n,o as r,xE as t};