diffing 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/{cli-agent-Dk0yRtrA.mjs → cli-agent-qNwkSjxK.mjs} +22 -7
  2. package/dist/cli.mjs +3 -3
  3. package/dist/client/assets/{angular-html-JZN5kc0L.js → angular-html-ByeJB0rh.js} +1 -1
  4. package/dist/client/assets/{angular-ts-CJtfwtPm.js → angular-ts-CiwZGajG.js} +1 -1
  5. package/dist/client/assets/{apl-BW-LdBEV.js → apl-C8k5a5fk.js} +1 -1
  6. package/dist/client/assets/{arc-CxBp7uj_.js → arc-B8VMoqVr.js} +1 -1
  7. package/dist/client/assets/{architectureDiagram-3BPJPVTR-DWRcM6V_.js → architectureDiagram-3BPJPVTR-C-ng2xNL.js} +1 -1
  8. package/dist/client/assets/{astro-gYWZxO_0.js → astro-BE-h-qpp.js} +1 -1
  9. package/dist/client/assets/{blade-Dhwn6-nM.js → blade-D-0BV1wW.js} +1 -1
  10. package/dist/client/assets/{blockDiagram-GPEHLZMM-C5RclE5o.js → blockDiagram-GPEHLZMM-DyAQuONU.js} +1 -1
  11. package/dist/client/assets/{c-DStVJ8gV.js → c-Dg_Gx29H.js} +1 -1
  12. package/dist/client/assets/{c4Diagram-AAUBKEIU-BGUA_e0K.js → c4Diagram-AAUBKEIU-k5uKTHvm.js} +1 -1
  13. package/dist/client/assets/channel-DsuXeLi4.js +1 -0
  14. package/dist/client/assets/{chunk-2J33WTMH-B7n4bw-R.js → chunk-2J33WTMH-Dod_VwYj.js} +1 -1
  15. package/dist/client/assets/{chunk-3OPIFGDE-w01g5zoV.js → chunk-3OPIFGDE-B8HMjry-.js} +1 -1
  16. package/dist/client/assets/{chunk-4BX2VUAB-DxqZfswb.js → chunk-4BX2VUAB-TvkJVIZw.js} +1 -1
  17. package/dist/client/assets/{chunk-55IACEB6-CbDClk6A.js → chunk-55IACEB6-BsXuKAKc.js} +1 -1
  18. package/dist/client/assets/{chunk-5ZQYHXKU-CnsO6rSw.js → chunk-5ZQYHXKU-BI1cj2cZ.js} +1 -1
  19. package/dist/client/assets/{chunk-727SXJPM-BtcRYmEV.js → chunk-727SXJPM-yWQ27Wk0.js} +1 -1
  20. package/dist/client/assets/{chunk-AQP2D5EJ-CGhb3Sth.js → chunk-AQP2D5EJ-B2BBCtTr.js} +1 -1
  21. package/dist/client/assets/{chunk-BSJP7CBP-DeuRDOb1.js → chunk-BSJP7CBP-CXXvPXhK.js} +1 -1
  22. package/dist/client/assets/{chunk-CSCIHK7Q-B9E4vQNj.js → chunk-CSCIHK7Q-jYiloqyi.js} +1 -1
  23. package/dist/client/assets/{chunk-FMBD7UC4-Bq9LG2aQ.js → chunk-FMBD7UC4-DZzqIT32.js} +1 -1
  24. package/dist/client/assets/{chunk-KSCS5N6A-BVlK-NC4.js → chunk-KSCS5N6A-krdCf8iG.js} +1 -1
  25. package/dist/client/assets/{chunk-L5ZTLDWV-DcdQquQQ.js → chunk-L5ZTLDWV-0uuTmeZV.js} +1 -1
  26. package/dist/client/assets/{chunk-LZXEDZCA-D3hLMWf5.js → chunk-LZXEDZCA-BBfUgD06.js} +2 -2
  27. package/dist/client/assets/{chunk-ND2GUHAM-0nxCj3q_.js → chunk-ND2GUHAM-jkir4ZKE.js} +1 -1
  28. package/dist/client/assets/{chunk-NZK2D7GU-C_Wkgas6.js → chunk-NZK2D7GU-DMWZNibJ.js} +1 -1
  29. package/dist/client/assets/{chunk-O5CBEL6O-BjWUWCBx.js → chunk-O5CBEL6O-B1e1HGaX.js} +1 -1
  30. package/dist/client/assets/chunk-QZHKN3VN-D5b3mBJ2.js +1 -0
  31. package/dist/client/assets/chunk-WU5MYG2G-C1Pa4Y04.js +1 -0
  32. package/dist/client/assets/{chunk-XPW4576I-BoIL-UAf.js → chunk-XPW4576I-AvbCAUav.js} +1 -1
  33. package/dist/client/assets/classDiagram-4FO5ZUOK-DCnVfYt-.js +1 -0
  34. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-BPa1Jkt-.js +1 -0
  35. package/dist/client/assets/{cobol-BhFBbthm.js → cobol-DQnGB_GV.js} +1 -1
  36. package/dist/client/assets/{coffee-CIJ9uq8T.js → coffee-CDV5a89x.js} +1 -1
  37. package/dist/client/assets/{cose-bilkent-S5V4N54A-CbiOjhru.js → cose-bilkent-S5V4N54A-t-mDNRF2.js} +1 -1
  38. package/dist/client/assets/{cpp-DtSSrq00.js → cpp-8G6b-siI.js} +1 -1
  39. package/dist/client/assets/{crystal-CukkuPMH.js → crystal-CGYCC6FM.js} +1 -1
  40. package/dist/client/assets/{css-B1khiVXh.js → css-nez4R8_Z.js} +1 -1
  41. package/dist/client/assets/{dagre-BM42HDAG-DV-L1RXR.js → dagre-BM42HDAG--azesYIg.js} +1 -1
  42. package/dist/client/assets/{diagram-2AECGRRQ-BIS3Tcy4.js → diagram-2AECGRRQ-4WJ7nKhA.js} +1 -1
  43. package/dist/client/assets/{diagram-5GNKFQAL-BT7ScWHB.js → diagram-5GNKFQAL-C7ZGhLXn.js} +1 -1
  44. package/dist/client/assets/{diagram-KO2AKTUF-DhEvzqhQ.js → diagram-KO2AKTUF-BobK_rbl.js} +1 -1
  45. package/dist/client/assets/{diagram-LMA3HP47-DIh9QR2k.js → diagram-LMA3HP47-BOc-OkIS.js} +1 -1
  46. package/dist/client/assets/{diagram-OG6HWLK6-V6xtTYuU.js → diagram-OG6HWLK6-BEtLgm86.js} +1 -1
  47. package/dist/client/assets/{dist--CAI-jgr.js → dist-DPuBwToc.js} +1 -1
  48. package/dist/client/assets/{edge-CuCj0fvA.js → edge-Z5RMbJQv.js} +1 -1
  49. package/dist/client/assets/{edit-BMeAI0Sj.js → edit-CFxbgVPV.js} +1 -1
  50. package/dist/client/assets/{elixir-CakheKmu.js → elixir-d3C79FQc.js} +1 -1
  51. package/dist/client/assets/{elm-C1NdUKtL.js → elm-CDAf6Uyn.js} +1 -1
  52. package/dist/client/assets/{erDiagram-TEJ5UH35-DLJ0CCH3.js → erDiagram-TEJ5UH35-D-pR2GY9.js} +1 -1
  53. package/dist/client/assets/{erb-CetH6rlA.js → erb-CTJk9FKH.js} +1 -1
  54. package/dist/client/assets/{flowDiagram-I6XJVG4X-aIYTauNq.js → flowDiagram-I6XJVG4X-BwMCy2QV.js} +1 -1
  55. package/dist/client/assets/{ganttDiagram-6RSMTGT7-DRQE_4dV.js → ganttDiagram-6RSMTGT7-BI1WLJDi.js} +1 -1
  56. package/dist/client/assets/{git-rebase-sKnthHnf.js → git-rebase-Dr0-MVoW.js} +1 -1
  57. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-DbSrYZsG.js → gitGraphDiagram-PVQCEYII-CUfW0k1f.js} +1 -1
  58. package/dist/client/assets/{glimmer-js-Bt7nvyGa.js → glimmer-js-CXhLhyW-.js} +1 -1
  59. package/dist/client/assets/{glimmer-ts-YO9zmz82.js → glimmer-ts-BFAFT-VD.js} +1 -1
  60. package/dist/client/assets/{glsl-DsvRozYb.js → glsl-D7yanhgY.js} +1 -1
  61. package/dist/client/assets/{graphql-sXzHf_gb.js → graphql-CpoDxrok.js} +1 -1
  62. package/dist/client/assets/{hack-C3UDBYU5.js → hack-BL5fmC4q.js} +1 -1
  63. package/dist/client/assets/{haml-Bfx2v9ts.js → haml-ClAE6RVM.js} +1 -1
  64. package/dist/client/assets/{handlebars-D7y9m08n.js → handlebars-nHw91uOv.js} +1 -1
  65. package/dist/client/assets/{html-LJt8Nrzd.js → html-BIiOKqgG.js} +1 -1
  66. package/dist/client/assets/{html-derivative-GRYtRNx6.js → html-derivative-D1nPnuOK.js} +1 -1
  67. package/dist/client/assets/{http-CFcGSNWA.js → http-B_QcRZjt.js} +1 -1
  68. package/dist/client/assets/{hurl-EaOExxlv.js → hurl-CZE0DsD3.js} +1 -1
  69. package/dist/client/assets/{index-DIOUI027.js → index-Erqhm7rW.js} +7 -7
  70. package/dist/client/assets/{infoDiagram-5YYISTIA-CT2k1ZKR.js → infoDiagram-5YYISTIA-w2M_OHua.js} +1 -1
  71. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-D9ZWerXw.js → ishikawaDiagram-YF4QCWOH-CW_l9PGx.js} +1 -1
  72. package/dist/client/assets/{java-QdNEgqNn.js → java-CXTqX09w.js} +1 -1
  73. package/dist/client/assets/{javascript-C0TUIalv.js → javascript-9z9ABBep.js} +1 -1
  74. package/dist/client/assets/{jinja-CHXCs943.js → jinja-Cluf_5Bk.js} +1 -1
  75. package/dist/client/assets/{jison-Cu1JVrPL.js → jison-CqCEUtc4.js} +1 -1
  76. package/dist/client/assets/{journeyDiagram-JHISSGLW-CS0prGm3.js → journeyDiagram-JHISSGLW-D-YwusBa.js} +1 -1
  77. package/dist/client/assets/{json-DbuC832p.js → json-BMq_bPP8.js} +1 -1
  78. package/dist/client/assets/{jsx-D2ojEfVP.js → jsx-Djij59b9.js} +1 -1
  79. package/dist/client/assets/{julia-DBG4gf9M.js → julia-DybzCMnh.js} +1 -1
  80. package/dist/client/assets/{just-cnG6iJYR.js → just-4ChcAr9-.js} +1 -1
  81. package/dist/client/assets/{kanban-definition-UN3LZRKU-B5_nyCCN.js → kanban-definition-UN3LZRKU-Brvoukmm.js} +1 -1
  82. package/dist/client/assets/{latex-C-t8YHXx.js → latex-CS2TtFXG.js} +1 -1
  83. package/dist/client/assets/{line-PhY2p9yO.js → line-CqxM-stA.js} +1 -1
  84. package/dist/client/assets/{linear-DZfj4bbh.js → linear-C7T82059.js} +1 -1
  85. package/dist/client/assets/{liquid-BXKFGxIR.js → liquid-84AtYenm.js} +1 -1
  86. package/dist/client/assets/{lua-BNuqYfRm.js → lua-DJzFx3Cf.js} +1 -1
  87. package/dist/client/assets/{marko-DSC8kwzM.js → marko-BLw9BV9E.js} +1 -1
  88. package/dist/client/assets/{mdc-BwB9Dj6D.js → mdc-BjZejN3b.js} +1 -1
  89. package/dist/client/assets/{mermaid-parser.core-BrVg46EN.js → mermaid-parser.core-BdiEBAsd.js} +1 -1
  90. package/dist/client/assets/{mermaid.core-Bnf5T6PT.js → mermaid.core-BsnKhnrM.js} +3 -3
  91. package/dist/client/assets/{mindmap-definition-RKZ34NQL-CAomoDK8.js → mindmap-definition-RKZ34NQL-CBaIFnbc.js} +1 -1
  92. package/dist/client/assets/{nginx-BrQvZxpD.js → nginx-DuamCwvX.js} +1 -1
  93. package/dist/client/assets/{nim-tVYcrqi1.js → nim-Bt8c9-ge.js} +1 -1
  94. package/dist/client/assets/{perl-B-60oGLc.js → perl-D52AfmwC.js} +1 -1
  95. package/dist/client/assets/{php-DJJABwVz.js → php-BBMlJg0_.js} +1 -1
  96. package/dist/client/assets/{pieDiagram-4H26LBE5-BOtZhQH4.js → pieDiagram-4H26LBE5-BlmPajcA.js} +1 -1
  97. package/dist/client/assets/{pug-KJGvmNqp.js → pug-DFHmDqEE.js} +1 -1
  98. package/dist/client/assets/{qml-6M7QCkVi.js → qml-C0333o-g.js} +1 -1
  99. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-Pcpz6-BU.js → quadrantDiagram-W4KKPZXB-Bqlm_zZk.js} +1 -1
  100. package/dist/client/assets/{r-CJX_7SfZ.js → r-DZFmvIgR.js} +1 -1
  101. package/dist/client/assets/{razor-DYZH4-tY.js → razor-BIGLkWzR.js} +1 -1
  102. package/dist/client/assets/{regexp-DWtQcg88.js → regexp-BW6jpgf9.js} +1 -1
  103. package/dist/client/assets/{requirementDiagram-4Y6WPE33-Cruba0r2.js → requirementDiagram-4Y6WPE33-B1PrtUeD.js} +1 -1
  104. package/dist/client/assets/{review-export-DUMpiyN2.js → review-export-BlgD3bdw.js} +1 -1
  105. package/dist/client/assets/{rst-idvXY1TW.js → rst-Cj51ZJaa.js} +1 -1
  106. package/dist/client/assets/{ruby-CBUdU1Jx.js → ruby-lMhGjwpf.js} +1 -1
  107. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-DpLjNHX_.js → sankeyDiagram-5OEKKPKP-D2HtUNVF.js} +1 -1
  108. package/dist/client/assets/{sas-CD7-yPwf.js → sas-BWSQku7l.js} +1 -1
  109. package/dist/client/assets/{scss-CcmN3LNf.js → scss-CdRPuhLN.js} +1 -1
  110. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-Dxvk3OQI.js → sequenceDiagram-3UESZ5HK-D9SQy0XI.js} +1 -1
  111. package/dist/client/assets/{shellscript-BxkDFxdN.js → shellscript-DOfOBXcj.js} +1 -1
  112. package/dist/client/assets/{shellsession-Bz5EKpQO.js → shellsession-7XAOCVni.js} +1 -1
  113. package/dist/client/assets/{soy-DMVQQ2W2.js → soy-DDnzVRIw.js} +1 -1
  114. package/dist/client/assets/{sql-B-oK6O9W.js → sql-Ba34agKe.js} +1 -1
  115. package/dist/client/assets/{src-BNoZKBH3.js → src-BO-qT_v_.js} +1 -1
  116. package/dist/client/assets/{stata-CUZrRD4_.js → stata-BQlYGHQU.js} +1 -1
  117. package/dist/client/assets/{stateDiagram-AJRCARHV-DcGkjwzF.js → stateDiagram-AJRCARHV-7IEYjFRo.js} +1 -1
  118. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-DP6swlL9.js +1 -0
  119. package/dist/client/assets/{surrealql-TyxgDynf.js → surrealql-BET1l7SW.js} +1 -1
  120. package/dist/client/assets/{svelte-nYNHcaCO.js → svelte-Bd7ZOeQI.js} +1 -1
  121. package/dist/client/assets/{templ-DfKxw_Rl.js → templ-BYvRQdOw.js} +1 -1
  122. package/dist/client/assets/{tex-CNwID2CI.js → tex-CT8DpKxX.js} +1 -1
  123. package/dist/client/assets/{timeline-definition-PNZ67QCA-CluiloeV.js → timeline-definition-PNZ67QCA-CurQYWmi.js} +1 -1
  124. package/dist/client/assets/{ts-tags-DgUARkAi.js → ts-tags-D4iPPwau.js} +1 -1
  125. package/dist/client/assets/{tsx-2yb3iicd.js → tsx-Dgk_Aw-B.js} +1 -1
  126. package/dist/client/assets/{twig-l1ft8ReI.js → twig-abRNWeh3.js} +1 -1
  127. package/dist/client/assets/{typescript-BZqXFlL1.js → typescript-BgR1JqdC.js} +1 -1
  128. package/dist/client/assets/{vennDiagram-CIIHVFJN-DHRoQg07.js → vennDiagram-CIIHVFJN-DbrRBL5S.js} +1 -1
  129. package/dist/client/assets/{vue-BgXkMZZj.js → vue-DSkhKq4Q.js} +1 -1
  130. package/dist/client/assets/{vue-html-Byxl7Gyw.js → vue-html-J0jWoD9X.js} +1 -1
  131. package/dist/client/assets/{vue-vine-Bzpp44S9.js → vue-vine-BgX5MC8-.js} +1 -1
  132. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-DQ_ujF1q.js → wardleyDiagram-YWT4CUSO-DIFXQsoP.js} +1 -1
  133. package/dist/client/assets/{xml-CpwLtzxK.js → xml-Ca53xGLB.js} +1 -1
  134. package/dist/client/assets/{xsl-VlCQyM4_.js → xsl-CNnXclYV.js} +1 -1
  135. package/dist/client/assets/{xychartDiagram-2RQKCTM6-DjG2u0Gz.js → xychartDiagram-2RQKCTM6-CmfInPqa.js} +1 -1
  136. package/dist/client/assets/{yaml-BypQObHK.js → yaml-CjjyUhfg.js} +1 -1
  137. package/dist/client/index.html +1 -1
  138. package/dist/{mcp-C9HpAFs0.mjs → mcp-DhynPewa.mjs} +35 -19
  139. package/dist/native/tui-darwin-arm64/diffing-tui +0 -0
  140. package/dist/native/tui-darwin-x64/diffing-tui +0 -0
  141. package/dist/native/tui-linux-arm64-gnu/diffing-tui +0 -0
  142. package/dist/native/tui-linux-arm64-musl/diffing-tui +0 -0
  143. package/dist/native/tui-linux-x64-gnu/diffing-tui +0 -0
  144. package/dist/native/tui-linux-x64-musl/diffing-tui +0 -0
  145. package/dist/native/tui-win32-x64-msvc/diffing-tui.exe +0 -0
  146. package/dist/{server-BmQqrWy4.mjs → server-CEbp7K-k.mjs} +289 -29
  147. package/extensions/pi/index.ts +283 -86
  148. package/extensions/pi/pi-modules.d.ts +70 -0
  149. package/extensions/pi/tsconfig.json +14 -0
  150. package/package.json +2 -1
  151. package/dist/client/assets/channel-BqKSU-HY.js +0 -1
  152. package/dist/client/assets/chunk-QZHKN3VN-BE1tL2Nx.js +0 -1
  153. package/dist/client/assets/chunk-WU5MYG2G-DP73Gify.js +0 -1
  154. package/dist/client/assets/classDiagram-4FO5ZUOK--5lgckcu.js +0 -1
  155. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-CCQu7EQ7.js +0 -1
  156. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-DVv3yrP9.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-JZN5kc0L.js","assets/html-LJt8Nrzd.js","assets/css-B1khiVXh.js","assets/javascript-C0TUIalv.js","assets/angular-ts-CJtfwtPm.js","assets/scss-CcmN3LNf.js","assets/apl-BW-LdBEV.js","assets/json-DbuC832p.js","assets/xml-CpwLtzxK.js","assets/java-QdNEgqNn.js","assets/astro-gYWZxO_0.js","assets/postcss-Nnu-lNQ3.js","assets/tsx-2yb3iicd.js","assets/typescript-BZqXFlL1.js","assets/blade-Dhwn6-nM.js","assets/html-derivative-GRYtRNx6.js","assets/sql-B-oK6O9W.js","assets/bsl-CNzWaPUO.js","assets/sdbl-OSK-5luq.js","assets/cairo-DeN51fb8.js","assets/python-BM22ZOLA.js","assets/cobol-BhFBbthm.js","assets/coffee-CIJ9uq8T.js","assets/cpp-DtSSrq00.js","assets/glsl-DsvRozYb.js","assets/c-DStVJ8gV.js","assets/regexp-DWtQcg88.js","assets/crystal-CukkuPMH.js","assets/shellscript-BxkDFxdN.js","assets/edge-CuCj0fvA.js","assets/elixir-CakheKmu.js","assets/elm-C1NdUKtL.js","assets/erb-CetH6rlA.js","assets/ruby-CBUdU1Jx.js","assets/graphql-sXzHf_gb.js","assets/jsx-D2ojEfVP.js","assets/haml-Bfx2v9ts.js","assets/lua-BNuqYfRm.js","assets/yaml-BypQObHK.js","assets/erlang-CyYoaxLR.js","assets/markdown-h2a5XRAL.js","assets/fortran-fixed-form-CU1NM1Ca.js","assets/fortran-free-form-DJlrt_Va.js","assets/fsharp-BCcE_A8b.js","assets/gdresource-B4zvYYkN.js","assets/gdscript-C-KM_e-o.js","assets/gdshader-B5KAq9U-.js","assets/git-commit-DFJq_3Fo.js","assets/diff-CUbdp-_8.js","assets/git-rebase-sKnthHnf.js","assets/glimmer-js-Bt7nvyGa.js","assets/glimmer-ts-YO9zmz82.js","assets/hack-C3UDBYU5.js","assets/handlebars-D7y9m08n.js","assets/http-CFcGSNWA.js","assets/hurl-EaOExxlv.js","assets/csv-JHfwQxu2.js","assets/hxml-jrLeckcs.js","assets/haxe-D2IO3jfA.js","assets/jinja-CHXCs943.js","assets/jison-Cu1JVrPL.js","assets/julia-DBG4gf9M.js","assets/r-CJX_7SfZ.js","assets/just-cnG6iJYR.js","assets/perl-B-60oGLc.js","assets/latex-C-t8YHXx.js","assets/tex-CNwID2CI.js","assets/liquid-BXKFGxIR.js","assets/marko-DSC8kwzM.js","assets/less-BHMNlKwo.js","assets/mdc-BwB9Dj6D.js","assets/nextflow-DIxDAddB.js","assets/nextflow-groovy-De9GdmGw.js","assets/nginx-BrQvZxpD.js","assets/nim-tVYcrqi1.js","assets/php-DJJABwVz.js","assets/pug-KJGvmNqp.js","assets/qml-6M7QCkVi.js","assets/razor-DYZH4-tY.js","assets/csharp-D2NkPFJ-.js","assets/rst-idvXY1TW.js","assets/cmake-CUpRt8Bg.js","assets/sas-CD7-yPwf.js","assets/shaderlab-ChwEEuJS.js","assets/hlsl-B-BU3OYV.js","assets/shellsession-Bz5EKpQO.js","assets/soy-DMVQQ2W2.js","assets/sparql-C9c0CFPV.js","assets/turtle-CTtYRf8T.js","assets/stata-CUZrRD4_.js","assets/surrealql-TyxgDynf.js","assets/svelte-nYNHcaCO.js","assets/templ-DfKxw_Rl.js","assets/go-ClykLgTr.js","assets/ts-tags-DgUARkAi.js","assets/twig-l1ft8ReI.js","assets/vue-BgXkMZZj.js","assets/vue-html-Byxl7Gyw.js","assets/vue-vine-Bzpp44S9.js","assets/stylus-Be_2nKLA.js","assets/xsl-VlCQyM4_.js","assets/mermaid.core-Bnf5T6PT.js","assets/chunk-O5CBEL6O-BjWUWCBx.js","assets/src-BNoZKBH3.js","assets/chunk-5ZQYHXKU-CnsO6rSw.js","assets/dist--CAI-jgr.js","assets/chunk-CSCIHK7Q-B9E4vQNj.js","assets/chunk-3OPIFGDE-w01g5zoV.js","assets/chunk-L5ZTLDWV-DcdQquQQ.js","assets/chunk-NZK2D7GU-C_Wkgas6.js","assets/rough.esm-CfLNTxPb.js","assets/chunk-BSJP7CBP-DeuRDOb1.js","assets/chunk-KSCS5N6A-BVlK-NC4.js","assets/line-PhY2p9yO.js","assets/path-C4mrXsW7.js","assets/array-JCb05fOg.js","assets/chunk-LZXEDZCA-D3hLMWf5.js","assets/chunk-WU5MYG2G-DP73Gify.js","assets/chunk-XPW4576I-BoIL-UAf.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-ByeJB0rh.js","assets/html-BIiOKqgG.js","assets/css-nez4R8_Z.js","assets/javascript-9z9ABBep.js","assets/angular-ts-CiwZGajG.js","assets/scss-CdRPuhLN.js","assets/apl-C8k5a5fk.js","assets/json-BMq_bPP8.js","assets/xml-Ca53xGLB.js","assets/java-CXTqX09w.js","assets/astro-BE-h-qpp.js","assets/postcss-Nnu-lNQ3.js","assets/tsx-Dgk_Aw-B.js","assets/typescript-BgR1JqdC.js","assets/blade-D-0BV1wW.js","assets/html-derivative-D1nPnuOK.js","assets/sql-Ba34agKe.js","assets/bsl-CNzWaPUO.js","assets/sdbl-OSK-5luq.js","assets/cairo-DeN51fb8.js","assets/python-BM22ZOLA.js","assets/cobol-DQnGB_GV.js","assets/coffee-CDV5a89x.js","assets/cpp-8G6b-siI.js","assets/glsl-D7yanhgY.js","assets/c-Dg_Gx29H.js","assets/regexp-BW6jpgf9.js","assets/crystal-CGYCC6FM.js","assets/shellscript-DOfOBXcj.js","assets/edge-Z5RMbJQv.js","assets/elixir-d3C79FQc.js","assets/elm-CDAf6Uyn.js","assets/erb-CTJk9FKH.js","assets/ruby-lMhGjwpf.js","assets/graphql-CpoDxrok.js","assets/jsx-Djij59b9.js","assets/haml-ClAE6RVM.js","assets/lua-DJzFx3Cf.js","assets/yaml-CjjyUhfg.js","assets/erlang-CyYoaxLR.js","assets/markdown-h2a5XRAL.js","assets/fortran-fixed-form-CU1NM1Ca.js","assets/fortran-free-form-DJlrt_Va.js","assets/fsharp-BCcE_A8b.js","assets/gdresource-B4zvYYkN.js","assets/gdscript-C-KM_e-o.js","assets/gdshader-B5KAq9U-.js","assets/git-commit-DFJq_3Fo.js","assets/diff-CUbdp-_8.js","assets/git-rebase-Dr0-MVoW.js","assets/glimmer-js-CXhLhyW-.js","assets/glimmer-ts-BFAFT-VD.js","assets/hack-BL5fmC4q.js","assets/handlebars-nHw91uOv.js","assets/http-B_QcRZjt.js","assets/hurl-CZE0DsD3.js","assets/csv-JHfwQxu2.js","assets/hxml-jrLeckcs.js","assets/haxe-D2IO3jfA.js","assets/jinja-Cluf_5Bk.js","assets/jison-CqCEUtc4.js","assets/julia-DybzCMnh.js","assets/r-DZFmvIgR.js","assets/just-4ChcAr9-.js","assets/perl-D52AfmwC.js","assets/latex-CS2TtFXG.js","assets/tex-CT8DpKxX.js","assets/liquid-84AtYenm.js","assets/marko-BLw9BV9E.js","assets/less-BHMNlKwo.js","assets/mdc-BjZejN3b.js","assets/nextflow-DIxDAddB.js","assets/nextflow-groovy-De9GdmGw.js","assets/nginx-DuamCwvX.js","assets/nim-Bt8c9-ge.js","assets/php-BBMlJg0_.js","assets/pug-DFHmDqEE.js","assets/qml-C0333o-g.js","assets/razor-BIGLkWzR.js","assets/csharp-D2NkPFJ-.js","assets/rst-Cj51ZJaa.js","assets/cmake-CUpRt8Bg.js","assets/sas-BWSQku7l.js","assets/shaderlab-ChwEEuJS.js","assets/hlsl-B-BU3OYV.js","assets/shellsession-7XAOCVni.js","assets/soy-DDnzVRIw.js","assets/sparql-C9c0CFPV.js","assets/turtle-CTtYRf8T.js","assets/stata-BQlYGHQU.js","assets/surrealql-BET1l7SW.js","assets/svelte-Bd7ZOeQI.js","assets/templ-BYvRQdOw.js","assets/go-ClykLgTr.js","assets/ts-tags-D4iPPwau.js","assets/twig-abRNWeh3.js","assets/vue-DSkhKq4Q.js","assets/vue-html-J0jWoD9X.js","assets/vue-vine-BgX5MC8-.js","assets/stylus-Be_2nKLA.js","assets/xsl-CNnXclYV.js","assets/mermaid.core-BsnKhnrM.js","assets/chunk-O5CBEL6O-B1e1HGaX.js","assets/src-BO-qT_v_.js","assets/chunk-5ZQYHXKU-BI1cj2cZ.js","assets/dist-DPuBwToc.js","assets/chunk-CSCIHK7Q-jYiloqyi.js","assets/chunk-3OPIFGDE-B8HMjry-.js","assets/chunk-L5ZTLDWV-0uuTmeZV.js","assets/chunk-NZK2D7GU-DMWZNibJ.js","assets/rough.esm-CfLNTxPb.js","assets/chunk-BSJP7CBP-CXXvPXhK.js","assets/chunk-KSCS5N6A-krdCf8iG.js","assets/line-CqxM-stA.js","assets/path-C4mrXsW7.js","assets/array-JCb05fOg.js","assets/chunk-LZXEDZCA-BBfUgD06.js","assets/chunk-WU5MYG2G-C1Pa4Y04.js","assets/chunk-XPW4576I-AvbCAUav.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)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Wd(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=Wd(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),ep._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(`
@@ -20,7 +20,7 @@ Error generating stack: `+e.message+`
20
20
  \f\r "&'<=>\``.split(``)],[`\0
21
21
  \f\r "&'<=>\``.split(``),`\0
22
22
  \f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function lo(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=Qi);let l=uo(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!no(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||!Ba(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function uo(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=fo(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 fo(e,t,n){let r=Ji(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=Sa(r.attribute,Object.assign({},e.settings.characterReferences,{subset:co.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?ka:Aa)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=Sa(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:co.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&Oa(n,o)>Oa(n,e.alternative)&&(o=e.alternative),s=o+Sa(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?co.single:co.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var po=[`<`,`&`];function mo(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:Sa(e.value,Object.assign({},r.settings.characterReferences,{subset:po}))}function ho(e,t,n,r){return r.settings.allowDangerousHtml?e.value:mo(e,t,n,r)}function go(e,t,n,r){return r.all(e)}var _o=ea(`type`,{invalid:vo,unknown:yo,handlers:{comment:Ea,doctype:Da,element:lo,raw:ho,root:go,text:mo}});function vo(e){throw Error("Expected node, not `"+e+"`")}function yo(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var bo={},xo={},So=[];function Co(e,t){let n=t||bo,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:wo,all:To,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||vi,characterReferences:n.characterReferences||xo,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Qi:Zi,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function wo(e,t,n){return _o(e,t,n,this)}function To(e){let t=[],n=e&&e.children||So,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}function Eo(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 Do(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Oo(e){return Array.isArray(e)?e:[e]}async function ko(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function Ao(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function jo(e){return e===`ansi`||Ao(e)}function Mo(e){return e===`none`}function No(e){return Mo(e)}function Po(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 Fo(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 Io(e){let t=Fo(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 Lo(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 Ro=`light-dark()`,zo=[`color`,`background-color`];function Bo(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 Vo(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?Bo(e,t):e})):e}function Ho(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>Uo(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&&zo.includes(a))if(r===Ro&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new Pn('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 Uo(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&tr.Italic&&(t[`font-style`]=`italic`),e.fontStyle&tr.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&tr.Underline&&n.push(`underline`),e.fontStyle&tr.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function Wo(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}var Go=new WeakMap;function Ko(e,t){Go.set(e,t)}function qo(e){return Go.get(e)}var Jo=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(Oo(n).map(e=>[e,_i])),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 Yo(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Yo(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 Xo(e,t){if(!(e instanceof Jo))throw new Pn(`Invalid grammar state`);return e.getInternalStack(t)}function Zo(){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 Pn(`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 Pn(`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 Pn(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:r.posToIndex(e.line,n)}}},r=Io(t.source),i=(t.options.decorations||[]).map(e=>({...e,start:n(e.start),end:n(e.end)}));Qo(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 Vo(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 Pn(`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+=$o(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new Pn(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new Pn(`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&&Po(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 Qo(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new Pn(`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 Pn(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function $o(e){return e.type===`text`?e.value:e.type===`element`?e.children.map($o).join(``):``}var es=[Zo()];function ts(e){let t=ns(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...es]}function ns(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 rs=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],is={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function as(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 os(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 ss(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)is[r]&&t.push({type:`setDecoration`,value:is[r]});else if(r<=29){let e=is[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:rs[r-30]}});else if(r===38){let n=os(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:rs[r-40]}});else if(r===48){let n=os(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:rs[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:rs[r-100+8]}})}return t}function cs(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=as(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=ss(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 ls={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 us(e=ls){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<rs.length;e++)r.push(t(rs[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 ds={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 fs(e,t,n){let r=Eo(e,n),i=Fo(t),a=us(Object.fromEntries(rs.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||ds[t]]}))),o=cs();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=Do(i,r),o=Do(o,r),n.decorations.has(`dim`)&&(i=ps(i));let s=tr.None;return n.decorations.has(`bold`)&&(s|=tr.Bold),n.decorations.has(`italic`)&&(s|=tr.Italic),n.decorations.has(`underline`)&&(s|=tr.Underline),n.decorations.has(`strikethrough`)&&(s|=tr.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function ps(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 ms(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n,i=e.resolveLangAlias(n.lang||`text`);if(Ao(i)||Mo(r))return Fo(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:a,colorMap:o}=e.setTheme(r);if(i===`ansi`)return fs(a,t,n);let s=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==s.name)throw new Pn(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${s.name}"`);if(!n.grammarState.themes.includes(a.name))throw new Pn(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${a.name}"`)}return gs(t,s,a,o,n)}function hs(...e){if(e.length===2)return qo(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(Ao(i)||Mo(a))throw new Pn(`Plain language does not have grammar state`);if(i===`ansi`)throw new Pn(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new Jo(_s(n,c,o,s,r).stateStack,c.name,o.name)}function gs(e,t,n,r,i){let a=_s(e,t,n,r,i),o=new Jo(a.stateStack,t.name,n.name);return Ko(a.tokens,o),a.tokens}function _s(e,t,n,r,i){let a=Eo(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500}=i,c=Fo(e),l=i.grammarState?Xo(i.grammarState,n.name)??_i:i.grammarContextCode==null?_i:_s(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=Do(r[sr.getForeground(s)],a),l=sr.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`?vs(t.scopes):ys(e,t.scopes)}),g+=1}}u.push(d)}d.push(u),u=[],l=_.ruleStack}return{tokens:d,stateStack:l}}function vs(e){return e.map(e=>({scopeName:e}))}function ys(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:Ss(e,i,t.slice(0,r))}}return n}function bs(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function xs(e,t,n){if(!bs(e[e.length-1],t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)bs(e[r],n[i])&&--r,--i;return r===-1}function Ss(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(xs(e,t,n)){r.push(a);break}return r}function Cs(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=ms(e,t,{...n,theme:r.theme});return{tokens:i,state:qo(i),theme:typeof r.theme==`string`?r.theme:r.theme.name}}),a=ws(...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 Jo(Object.fromEntries(i.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),i[0].state.lang):void 0;return s&&Ko(o,s),o}function ws(...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 Ts(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 Pn("`themes` option must not be empty");let p=Cs(e,t,n);if(c=qo(p),l&&Ro!==l&&!f.find(e=>e.color===l))throw new Pn(`\`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=>Ho(e,h,u,l,d))),c&&Ko(a,c);let g=f.map(e=>Eo(e.theme,n));i=Es(f,m,g,u,l,`fg`,d),r=Es(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=Eo(n.theme,n);a=ms(e,t,n);let l=e.getTheme(n.theme);r=Do(l.bg,s),i=Do(l.fg,s),o=l.name,c=qo(a)}else throw new Pn("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function Es(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=Do(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===Ro&&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 Pn('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Do(t[r][a],n[r])||`inherit`}, ${Do(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}function Ds(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>Ds(e,t,n),codeToTokens:(t,n)=>Ts(e,t,n)}){let i=t;for(let e of ts(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=Ts(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=ks(a):d===`never`&&(a=As(a)),f&&(a=js(a));let p={...r,get source(){return i}};for(let e of ts(n))a=e.tokens?.call(p,a)||a;return Os(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function Os(e,t,n,r=qo(e)){let i=ts(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:Po,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:`
23
- `}));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=Wo(a.htmlStyle||Uo(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&&Ko(m,r),m}function ks(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&tr.Underline||i.fontStyle&tr.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 As(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 js(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=Wo(e.htmlStyle||Uo(e)),i=Wo(n.htmlStyle||Uo(n)),a=e.fontStyle&&(e.fontStyle&tr.Underline||e.fontStyle&tr.Strikethrough),o=n.fontStyle&&(n.fontStyle&tr.Underline||n.fontStyle&tr.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var Ms=Co;function Ns(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Ds(e,t,n),codeToTokens:(t,n)=>Ts(e,t,n)},i=Ms(Ds(e,t,n,r));for(let e of ts(n))i=e.postprocess?.call(r,i,n)||i;return i}var Ps={light:`#333333`,dark:`#bbbbbb`},Fs={light:`#fffffe`,dark:`#1e1e1e`},Is=`__shiki_resolved`;function Ls(e){if(e?.[Is])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`?Ps.light:Ps.dark,n||=t.type===`light`?Fs.light:Fs.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,Is,{enumerable:!1,writable:!1,value:!0}),t}async function Rs(e){return Array.from(new Set((await Promise.all(e.filter(e=>!jo(e)).map(async e=>await ko(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function zs(e){return(await Promise.all(e.map(async e=>No(e)?null:Ls(await ko(e))))).filter(e=>!!e)}var Bs=3,Vs=!1;function Hs(e,t=3){if(Bs&&!(typeof Bs==`number`&&t>Bs)){if(Vs)throw Error(`[SHIKI DEPRECATE]: ${e}`);console.trace(`[SHIKI DEPRECATE]: ${e}`)}}var Us=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Ws(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 Us(`Circular alias \`${Array.from(n).join(` -> `)} -> ${e}\``);n.add(e)}}return e}var Gs=class extends gi{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=Ls(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=Jn.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Ws(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 Us(`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))}},Ks=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}},qs=0;function Js(e){qs+=1,e.warnings!==!1&&qs>=10&&qs%10==0&&console.warn(`[Shiki] ${qs} 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 Us("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Ls),i=new Gs(new Ks(e.engine,n),r,n,e.langAlias),a;function o(t){return Ws(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new Us(`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 Us(`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 Rs(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await zs(e))}function g(){if(t)throw new Us(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--qs)}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 Ys(e){e.engine||Hs("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([zs(e.themes||[]),Rs(e.langs||[]),e.engine]);return Js({...e,themes:t,langs:n,engine:r})}async function Xs(e){let t=await Ys(e);return{getLastGrammarState:(...e)=>hs(t,...e),codeToTokensBase:(e,n)=>ms(t,e,n),codeToTokensWithThemes:(e,n)=>Cs(t,e,n),codeToTokens:(e,n)=>Ts(t,e,n),codeToHast:(e,n)=>Ds(t,e,n),codeToHtml:(e,n)=>Ns(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function Zs(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,jo(n))return[];let r=t[n];if(!r)throw new Pn(`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(No(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new Pn(`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 Xs({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 Qs(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 $s(e,t){let n=Qs(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 ec=l(h()),tc=`modulepreload`,nc=function(e){return`/`+e},rc={},Z=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=nc(t,n),t in rc)return;rc[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`:tc,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)})},ic=[{id:`abap`,name:`ABAP`,import:(()=>Z(()=>import(`./abap-vey6FMUr.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,import:(()=>Z(()=>import(`./actionscript-3-my8xn3-B.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>Z(()=>import(`./ada-ZTrh2YXI.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>Z(()=>import(`./angular-html-JZN5kc0L.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>Z(()=>import(`./angular-ts-CJtfwtPm.js`),__vite__mapDeps([4,0,1,2,3,5])))},{id:`apache`,name:`Apache Conf`,import:(()=>Z(()=>import(`./apache-DRxy-z5z.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>Z(()=>import(`./apex-dYa_qg4y.js`),[]))},{id:`apl`,name:`APL`,import:(()=>Z(()=>import(`./apl-BW-LdBEV.js`),__vite__mapDeps([6,2,1,3,7,8,9])))},{id:`applescript`,name:`AppleScript`,import:(()=>Z(()=>import(`./applescript-DFO6YSHI.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>Z(()=>import(`./ara-izJ2hroH.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>Z(()=>import(`./asciidoc-BEIHtPMJ.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>Z(()=>import(`./asm-B_7A3hVM.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>Z(()=>import(`./astro-gYWZxO_0.js`),__vite__mapDeps([10,2,3,7,11,12,13])))},{id:`awk`,name:`AWK`,import:(()=>Z(()=>import(`./awk-DolF6Tr1.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>Z(()=>import(`./ballerina-fBGtp9ZO.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`],import:(()=>Z(()=>import(`./bat-a27F4u0a.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>Z(()=>import(`./beancount-DoAic3vC.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>Z(()=>import(`./berry-wRZBip4S.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>Z(()=>import(`./bibtex-C6tL9gJb.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>Z(()=>import(`./bicep-FAGekWcZ.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>Z(()=>import(`./bird2-D47vUAud.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>Z(()=>import(`./blade-Dhwn6-nM.js`),__vite__mapDeps([14,2,15,1,3,7,16,8,9])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>Z(()=>import(`./bsl-CNzWaPUO.js`),__vite__mapDeps([17,18])))},{id:`c`,name:`C`,import:(()=>Z(()=>import(`./c-DStVJ8gV.js`).then(e=>e.n),[]))},{id:`c3`,name:`C3`,import:(()=>Z(()=>import(`./c3-9Ln86NZ6.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>Z(()=>import(`./cadence-vteWs_Q-.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>Z(()=>import(`./cairo-DeN51fb8.js`),__vite__mapDeps([19,20])))},{id:`clarity`,name:`Clarity`,import:(()=>Z(()=>import(`./clarity-Db5au7bW.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>Z(()=>import(`./clojure-DlXg2HmZ.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>Z(()=>import(`./cmake-CUpRt8Bg.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>Z(()=>import(`./cobol-BhFBbthm.js`),__vite__mapDeps([21,1,2,3,9])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>Z(()=>import(`./codeowners-gFMN20nn.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>Z(()=>import(`./codeql-zhKE1bQw.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>Z(()=>import(`./coffee-CIJ9uq8T.js`),__vite__mapDeps([22,3])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>Z(()=>import(`./common-lisp-BpXWYlpx.js`),[]))},{id:`coq`,name:`Coq`,import:(()=>Z(()=>import(`./coq-Brnzrk62.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>Z(()=>import(`./cpp-DtSSrq00.js`).then(e=>e.n),__vite__mapDeps([23,24,25,26,16])))},{id:`crystal`,name:`Crystal`,import:(()=>Z(()=>import(`./crystal-CukkuPMH.js`),__vite__mapDeps([27,25,2,1,3,28,16])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>Z(()=>import(`./csharp-D2NkPFJ-.js`),[]))},{id:`css`,name:`CSS`,import:(()=>Z(()=>import(`./css-B1khiVXh.js`).then(e=>e.n),[]))},{id:`csv`,name:`CSV`,import:(()=>Z(()=>import(`./csv-JHfwQxu2.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>Z(()=>import(`./cue-DfRd-AMP.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>Z(()=>import(`./cypher-CU79q-JJ.js`),[]))},{id:`d`,name:`D`,import:(()=>Z(()=>import(`./d-Bb_5rtK0.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>Z(()=>import(`./dart-DCM4wyEW.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>Z(()=>import(`./dax-C8RqKH5h.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>Z(()=>import(`./desktop-C4YoEmhs.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>Z(()=>import(`./diff-CUbdp-_8.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>Z(()=>import(`./docker-BYHJWJjt.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>Z(()=>import(`./dotenv-BKFUR1iV.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>Z(()=>import(`./dream-maker-D_STdqP4.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>Z(()=>import(`./edge-CuCj0fvA.js`),__vite__mapDeps([29,15,1,2,3,13])))},{id:`elixir`,name:`Elixir`,import:(()=>Z(()=>import(`./elixir-CakheKmu.js`),__vite__mapDeps([30,1,2,3])))},{id:`elm`,name:`Elm`,import:(()=>Z(()=>import(`./elm-C1NdUKtL.js`),__vite__mapDeps([31,24,25])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>Z(()=>import(`./emacs-lisp-CBaydq9s.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>Z(()=>import(`./erb-CetH6rlA.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:(()=>Z(()=>import(`./erlang-CyYoaxLR.js`),__vite__mapDeps([39,40])))},{id:`fennel`,name:`Fennel`,import:(()=>Z(()=>import(`./fennel-C_EMPuDd.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>Z(()=>import(`./fish-Bj00gCwr.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>Z(()=>import(`./fluent-DUG6ecx0.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>Z(()=>import(`./fortran-fixed-form-CU1NM1Ca.js`),__vite__mapDeps([41,42])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>Z(()=>import(`./fortran-free-form-DJlrt_Va.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>Z(()=>import(`./fsharp-BCcE_A8b.js`),__vite__mapDeps([43,40])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>Z(()=>import(`./gdresource-B4zvYYkN.js`),__vite__mapDeps([44,45,46])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>Z(()=>import(`./gdscript-C-KM_e-o.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>Z(()=>import(`./gdshader-B5KAq9U-.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>Z(()=>import(`./genie-kvovXJpW.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>Z(()=>import(`./gherkin-gaZwMa5o.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>Z(()=>import(`./git-commit-DFJq_3Fo.js`),__vite__mapDeps([47,48])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>Z(()=>import(`./git-rebase-sKnthHnf.js`),__vite__mapDeps([49,28])))},{id:`gleam`,name:`Gleam`,import:(()=>Z(()=>import(`./gleam-DDfmtWEq.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>Z(()=>import(`./glimmer-js-Bt7nvyGa.js`),__vite__mapDeps([50,2,1,3,13])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>Z(()=>import(`./glimmer-ts-YO9zmz82.js`),__vite__mapDeps([51,2,1,3,13])))},{id:`glsl`,name:`GLSL`,import:(()=>Z(()=>import(`./glsl-DsvRozYb.js`).then(e=>e.n),__vite__mapDeps([24,25])))},{id:`gn`,name:`GN`,import:(()=>Z(()=>import(`./gn-lRhe7knx.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>Z(()=>import(`./gnuplot-Dsvl7CSU.js`),[]))},{id:`go`,name:`Go`,import:(()=>Z(()=>import(`./go-ClykLgTr.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>Z(()=>import(`./graphql-sXzHf_gb.js`).then(e=>e.n),__vite__mapDeps([34,3,35,12,13])))},{id:`groovy`,name:`Groovy`,import:(()=>Z(()=>import(`./groovy-epR4RNba.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>Z(()=>import(`./hack-C3UDBYU5.js`),__vite__mapDeps([52,1,2,3,16])))},{id:`haml`,name:`Ruby Haml`,import:(()=>Z(()=>import(`./haml-Bfx2v9ts.js`).then(e=>e.n),__vite__mapDeps([36,2,3])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>Z(()=>import(`./handlebars-D7y9m08n.js`),__vite__mapDeps([53,2,1,3,38])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>Z(()=>import(`./haskell-CkI6ofLi.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>Z(()=>import(`./haxe-D2IO3jfA.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>Z(()=>import(`./hcl-C2LzlY8J.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>Z(()=>import(`./hjson-D56Gqm-A.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>Z(()=>import(`./hlsl-B-BU3OYV.js`),[]))},{id:`html`,name:`HTML`,import:(()=>Z(()=>import(`./html-LJt8Nrzd.js`).then(e=>e.n),__vite__mapDeps([1,2,3])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>Z(()=>import(`./html-derivative-GRYtRNx6.js`),__vite__mapDeps([15,1,2,3])))},{id:`http`,name:`HTTP`,import:(()=>Z(()=>import(`./http-CFcGSNWA.js`),__vite__mapDeps([54,34,3,35,12,13,7,28,8,9])))},{id:`hurl`,name:`Hurl`,import:(()=>Z(()=>import(`./hurl-EaOExxlv.js`),__vite__mapDeps([55,56,34,3,35,12,13,8,9])))},{id:`hxml`,name:`HXML`,import:(()=>Z(()=>import(`./hxml-jrLeckcs.js`),__vite__mapDeps([57,58])))},{id:`hy`,name:`Hy`,import:(()=>Z(()=>import(`./hy-w2Jzz9m_.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>Z(()=>import(`./imba-DPbBdr6e.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>Z(()=>import(`./ini-IKH7SH19.js`),[]))},{id:`java`,name:`Java`,import:(()=>Z(()=>import(`./java-QdNEgqNn.js`).then(e=>e.n),[]))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>Z(()=>import(`./javascript-C0TUIalv.js`).then(e=>e.n),[]))},{id:`jinja`,name:`Jinja`,import:(()=>Z(()=>import(`./jinja-CHXCs943.js`),__vite__mapDeps([59,1,2,3])))},{id:`jison`,name:`Jison`,import:(()=>Z(()=>import(`./jison-Cu1JVrPL.js`),__vite__mapDeps([60,3])))},{id:`json`,name:`JSON`,import:(()=>Z(()=>import(`./json-DbuC832p.js`).then(e=>e.n),[]))},{id:`json5`,name:`JSON5`,import:(()=>Z(()=>import(`./json5-BocpWhvz.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>Z(()=>import(`./jsonc-NK67I9hJ.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>Z(()=>import(`./jsonl-Cb0uXk6R.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>Z(()=>import(`./jsonnet-CpK_1aUl.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>Z(()=>import(`./jssm-CrL4dqHX.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>Z(()=>import(`./jsx-D2ojEfVP.js`).then(e=>e.n),[]))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>Z(()=>import(`./julia-DBG4gf9M.js`),__vite__mapDeps([61,23,24,25,26,16,3,20,62])))},{id:`just`,name:`Just`,import:(()=>Z(()=>import(`./just-cnG6iJYR.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:(()=>Z(()=>import(`./kdl-T7f1MobK.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>Z(()=>import(`./kotlin-DO-VvyWi.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>Z(()=>import(`./kusto-CngRjJvY.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>Z(()=>import(`./latex-C-t8YHXx.js`),__vite__mapDeps([65,66,62])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>Z(()=>import(`./lean-BvZrUnoV.js`),[]))},{id:`less`,name:`Less`,import:(()=>Z(()=>import(`./less-BHMNlKwo.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>Z(()=>import(`./liquid-BXKFGxIR.js`),__vite__mapDeps([67,2,1,3,7])))},{id:`llvm`,name:`LLVM IR`,import:(()=>Z(()=>import(`./llvm-BGG7pW3S.js`),[]))},{id:`log`,name:`Log file`,import:(()=>Z(()=>import(`./log-epZwUMJs.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>Z(()=>import(`./logo-Bi5ZxfEs.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>Z(()=>import(`./lua-BNuqYfRm.js`).then(e=>e.n),__vite__mapDeps([37,25])))},{id:`luau`,name:`Luau`,import:(()=>Z(()=>import(`./luau-Q3oZEzh4.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>Z(()=>import(`./make-D7Rpg3XJ.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>Z(()=>import(`./markdown-h2a5XRAL.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>Z(()=>import(`./marko-DSC8kwzM.js`),__vite__mapDeps([68,2,69,5,13])))},{id:`matlab`,name:`MATLAB`,import:(()=>Z(()=>import(`./matlab-D0w6VRbU.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>Z(()=>import(`./mdc-BwB9Dj6D.js`),__vite__mapDeps([70,15,1,2,3,40,38])))},{id:`mdx`,name:`MDX`,import:(()=>Z(()=>import(`./mdx-hyTZaJXs.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>Z(()=>import(`./mermaid-1Zr1MxpD.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>Z(()=>import(`./mipsasm-CO_Vmqe9.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>Z(()=>import(`./mojo-BEKlpmL9.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>Z(()=>import(`./moonbit-DJGG1uzT.js`),[]))},{id:`move`,name:`Move`,import:(()=>Z(()=>import(`./move-BHMiRKa7.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>Z(()=>import(`./narrat-BKaN0mLL.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>Z(()=>import(`./nextflow-DIxDAddB.js`),__vite__mapDeps([71,72])))},{id:`nextflow-groovy`,name:`nextflow-groovy`,import:(()=>Z(()=>import(`./nextflow-groovy-De9GdmGw.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>Z(()=>import(`./nginx-BrQvZxpD.js`),__vite__mapDeps([73,37,25])))},{id:`nim`,name:`Nim`,import:(()=>Z(()=>import(`./nim-tVYcrqi1.js`),__vite__mapDeps([74,25,2,24,1,3,40,8,9])))},{id:`nix`,name:`Nix`,import:(()=>Z(()=>import(`./nix-CAu-Epnf.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>Z(()=>import(`./nushell-BwuEMOPF.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>Z(()=>import(`./objective-c-DNQk03nL.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>Z(()=>import(`./objective-cpp-AnicUCPq.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>Z(()=>import(`./ocaml-BBI2LBdX.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>Z(()=>import(`./odin-BJIKbElf.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>Z(()=>import(`./openscad-Cb2s5BCi.js`),[]))},{id:`pascal`,name:`Pascal`,import:(()=>Z(()=>import(`./pascal-B1ez31ad.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>Z(()=>import(`./perl-B-60oGLc.js`),__vite__mapDeps([64,2,1,3,16,8,9])))},{id:`php`,name:`PHP`,import:(()=>Z(()=>import(`./php-DJJABwVz.js`),__vite__mapDeps([75,2,1,3,7,16,8,9])))},{id:`pkl`,name:`Pkl`,import:(()=>Z(()=>import(`./pkl-DmC1-FXa.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>Z(()=>import(`./plsql-DyPUGhhH.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>Z(()=>import(`./po-AeWiHfKa.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>Z(()=>import(`./polar-Bht-ciCi.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>Z(()=>import(`./postcss-Nnu-lNQ3.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>Z(()=>import(`./powerquery-GomboZMg.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`],import:(()=>Z(()=>import(`./powershell-ZgpTdYrb.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>Z(()=>import(`./prisma-DmHLUH7Z.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>Z(()=>import(`./prolog-D4BN-J5S.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>Z(()=>import(`./proto-BziI4vEA.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>Z(()=>import(`./pug-KJGvmNqp.js`),__vite__mapDeps([76,2,1,3])))},{id:`puppet`,name:`Puppet`,import:(()=>Z(()=>import(`./puppet-DZLzAalY.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>Z(()=>import(`./purescript-ByVmdUua.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>Z(()=>import(`./python-BM22ZOLA.js`),[]))},{id:`qml`,name:`QML`,import:(()=>Z(()=>import(`./qml-6M7QCkVi.js`),__vite__mapDeps([77,3])))},{id:`qmldir`,name:`QML Directory`,import:(()=>Z(()=>import(`./qmldir-C-dHdEsy.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>Z(()=>import(`./qss-Cm6TuuqD.js`),[]))},{id:`r`,name:`R`,import:(()=>Z(()=>import(`./r-CJX_7SfZ.js`).then(e=>e.n),[]))},{id:`racket`,name:`Racket`,import:(()=>Z(()=>import(`./racket-Dkf2VwPO.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>Z(()=>import(`./raku-DrOL7bjF.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>Z(()=>import(`./razor-DYZH4-tY.js`),__vite__mapDeps([78,79,1,2,3])))},{id:`reg`,name:`Windows Registry Script`,import:(()=>Z(()=>import(`./reg-BPKh5ogl.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>Z(()=>import(`./regexp-DWtQcg88.js`).then(e=>e.n),[]))},{id:`rel`,name:`Rel`,import:(()=>Z(()=>import(`./rel-zDwkKiX1.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>Z(()=>import(`./riscv-C0qb7d6i.js`),[]))},{id:`ron`,name:`RON`,import:(()=>Z(()=>import(`./ron-CxdzFhOl.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>Z(()=>import(`./rosmsg-_885Hvdk.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>Z(()=>import(`./rst-idvXY1TW.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:(()=>Z(()=>import(`./ruby-CBUdU1Jx.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:(()=>Z(()=>import(`./rust-TVzC0_ro.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>Z(()=>import(`./sas-CD7-yPwf.js`),__vite__mapDeps([82,16])))},{id:`sass`,name:`Sass`,import:(()=>Z(()=>import(`./sass-DmVLXOtD.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>Z(()=>import(`./scala-5pfDDKQK.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>Z(()=>import(`./scheme-BQLovk51.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>Z(()=>import(`./scss-CcmN3LNf.js`).then(e=>e.n),__vite__mapDeps([5,2])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>Z(()=>import(`./sdbl-OSK-5luq.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>Z(()=>import(`./shaderlab-ChwEEuJS.js`),__vite__mapDeps([83,84])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>Z(()=>import(`./shellscript-BxkDFxdN.js`).then(e=>e.n),[]))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>Z(()=>import(`./shellsession-Bz5EKpQO.js`),__vite__mapDeps([85,28])))},{id:`smalltalk`,name:`Smalltalk`,import:(()=>Z(()=>import(`./smalltalk-L3BbkSys.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>Z(()=>import(`./solidity-CLGumYJy.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>Z(()=>import(`./soy-DMVQQ2W2.js`),__vite__mapDeps([86,1,2,3])))},{id:`sparql`,name:`SPARQL`,import:(()=>Z(()=>import(`./sparql-C9c0CFPV.js`),__vite__mapDeps([87,88])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>Z(()=>import(`./splunk-CyEPDxNz.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>Z(()=>import(`./sql-B-oK6O9W.js`).then(e=>e.n),[]))},{id:`ssh-config`,name:`SSH Config`,import:(()=>Z(()=>import(`./ssh-config-CVvZZwRx.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>Z(()=>import(`./stata-CUZrRD4_.js`),__vite__mapDeps([89,16])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>Z(()=>import(`./stylus-Be_2nKLA.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>Z(()=>import(`./surrealql-TyxgDynf.js`),__vite__mapDeps([90,3])))},{id:`svelte`,name:`Svelte`,import:(()=>Z(()=>import(`./svelte-nYNHcaCO.js`),__vite__mapDeps([91,2,3,11,13])))},{id:`swift`,name:`Swift`,import:(()=>Z(()=>import(`./swift-D6N4iA16.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>Z(()=>import(`./system-verilog-iQh8ktbe.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>Z(()=>import(`./systemd-DytnOpVA.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>Z(()=>import(`./talonscript-BDLqGQX7.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>Z(()=>import(`./tasl-B73cKR59.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>Z(()=>import(`./tcl-DOjJ63Ed.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>Z(()=>import(`./templ-DfKxw_Rl.js`),__vite__mapDeps([92,2,93,3])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>Z(()=>import(`./terraform-4HveOXOO.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>Z(()=>import(`./tex-CNwID2CI.js`),__vite__mapDeps([66,62])))},{id:`toml`,name:`TOML`,import:(()=>Z(()=>import(`./toml-BtN-zV3i.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>Z(()=>import(`./ts-tags-DgUARkAi.js`),__vite__mapDeps([94,2,24,25,1,3,16,13,8,9])))},{id:`tsv`,name:`TSV`,import:(()=>Z(()=>import(`./tsv-CMdCss8w.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>Z(()=>import(`./tsx-2yb3iicd.js`).then(e=>e.n),[]))},{id:`turtle`,name:`Turtle`,import:(()=>Z(()=>import(`./turtle-CTtYRf8T.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>Z(()=>import(`./twig-l1ft8ReI.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:(()=>Z(()=>import(`./typescript-BZqXFlL1.js`).then(e=>e.n),[]))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>Z(()=>import(`./typespec-DEFH1eCC.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>Z(()=>import(`./typst-CyQejCPd.js`),[]))},{id:`v`,name:`V`,import:(()=>Z(()=>import(`./v-BXaHfHlN.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>Z(()=>import(`./vala-CZBBKCzO.js`),[]))},{id:`vb`,name:`Visual Basic`,aliases:[`cmd`],import:(()=>Z(()=>import(`./vb-XkEubmqa.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>Z(()=>import(`./verilog-xOqseBog.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>Z(()=>import(`./vhdl-CMMVBCME.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>Z(()=>import(`./viml-D0rP4VTs.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>Z(()=>import(`./vue-BgXkMZZj.js`),__vite__mapDeps([96,2,15,1,3,7,13])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>Z(()=>import(`./vue-html-Byxl7Gyw.js`),__vite__mapDeps([97,3])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>Z(()=>import(`./vue-vine-Bzpp44S9.js`),__vite__mapDeps([98,2,3,69,11,5,99])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>Z(()=>import(`./vyper-BNu5BXMx.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>Z(()=>import(`./wasm-Cyd-t8sb.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>Z(()=>import(`./wenyan-BAVVk9E4.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>Z(()=>import(`./wgsl-DSDardKJ.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>Z(()=>import(`./wikitext-DpoujGid.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>Z(()=>import(`./wit-efh27Wno.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>Z(()=>import(`./wolfram-DVAg8L4l.js`),[]))},{id:`xml`,name:`XML`,import:(()=>Z(()=>import(`./xml-CpwLtzxK.js`).then(e=>e.n),__vite__mapDeps([8,9])))},{id:`xsl`,name:`XSL`,import:(()=>Z(()=>import(`./xsl-VlCQyM4_.js`),__vite__mapDeps([100,8,9])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>Z(()=>import(`./yaml-BypQObHK.js`).then(e=>e.n),[]))},{id:`zenscript`,name:`ZenScript`,import:(()=>Z(()=>import(`./zenscript-BhDkIsWD.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>Z(()=>import(`./zig-DYS1KFNL.js`),[]))}],ac=Object.fromEntries(ic.map(e=>[e.id,e.import])),oc=Object.fromEntries(ic.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),sc={...ac,...oc},cc=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>Z(()=>import(`./andromeeda-CneIsnZz.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>Z(()=>import(`./aurora-x-Bc4rKs7r.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>Z(()=>import(`./ayu-dark-DKZmpFRB.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>Z(()=>import(`./ayu-light-Cpvesbhh.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>Z(()=>import(`./ayu-mirage-DC2LB4Dr.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>Z(()=>import(`./catppuccin-frappe-D5mJxQRe.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>Z(()=>import(`./catppuccin-latte-DmTgxxPG.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>Z(()=>import(`./catppuccin-macchiato-DzwtIliU.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>Z(()=>import(`./catppuccin-mocha-DFdjXNU1.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>Z(()=>import(`./dark-plus-Vx1q1FnL.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>Z(()=>import(`./dracula-Fwyt6QVU.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>Z(()=>import(`./dracula-soft-WVoP9zcY.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>Z(()=>import(`./everforest-dark-Dy1ID6LQ.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>Z(()=>import(`./everforest-light-DCq3_A9C.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>Z(()=>import(`./github-dark-DT409rZJ.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>Z(()=>import(`./github-dark-default-CpUaksTJ.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>Z(()=>import(`./github-dark-dimmed-CwpwNIJ3.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>Z(()=>import(`./github-dark-high-contrast-DqKHRKzY.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>Z(()=>import(`./github-light-CjDDPH0V.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>Z(()=>import(`./github-light-default-Bqn2FMJx.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>Z(()=>import(`./github-light-high-contrast-DJSqnrdB.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>Z(()=>import(`./gruvbox-dark-hard-JU0kGeLU.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>Z(()=>import(`./gruvbox-dark-medium-BXYu8VXB.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>Z(()=>import(`./gruvbox-dark-soft-CAFUIeaG.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>Z(()=>import(`./gruvbox-light-hard-68yp_JaY.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>Z(()=>import(`./gruvbox-light-medium-BfZIAUTN.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>Z(()=>import(`./gruvbox-light-soft-Bct3ikgS.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>Z(()=>import(`./horizon-D_7125Q1.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`dark`,import:(()=>Z(()=>import(`./horizon-bright-Ca8HuoFF.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>Z(()=>import(`./houston-JAv2TEQ1.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>Z(()=>import(`./kanagawa-dragon-Cjq94PqN.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>Z(()=>import(`./kanagawa-lotus-C7qryZ57.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>Z(()=>import(`./kanagawa-wave-DImnYG7O.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>Z(()=>import(`./laserwave-CN-xxJxn.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>Z(()=>import(`./light-plus-DWzqIF7F.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>Z(()=>import(`./material-theme-DWWfrqZ-.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>Z(()=>import(`./material-theme-darker-wgpDhYQC.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>Z(()=>import(`./material-theme-lighter-C5OsHZ4H.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>Z(()=>import(`./material-theme-ocean-CvMZFbQ9.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>Z(()=>import(`./material-theme-palenight-COZXb0oL.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>Z(()=>import(`./min-dark-CqCBi6M4.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>Z(()=>import(`./min-light-BBoxwOhR.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>Z(()=>import(`./monokai-BB88t5ne.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>Z(()=>import(`./night-owl-DmUU-_lq.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>Z(()=>import(`./night-owl-light-DMovtpwj.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>Z(()=>import(`./nord-Cq5Den5w.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>Z(()=>import(`./one-dark-pro-DvHC48R_.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>Z(()=>import(`./one-light-DqhWsBuX.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>Z(()=>import(`./plastic-D9ELbINl.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>Z(()=>import(`./poimandres-BbzxxHPn.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>Z(()=>import(`./red-DMKoyNTl.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>Z(()=>import(`./rose-pine-CERl25PP.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>Z(()=>import(`./rose-pine-dawn-9oXTxZFr.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>Z(()=>import(`./rose-pine-moon-Zy2VTZyw.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>Z(()=>import(`./slack-dark-DydfDgCL.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>Z(()=>import(`./slack-ochin-CzQtVspP.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>Z(()=>import(`./snazzy-light-CN4AGa9X.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>Z(()=>import(`./solarized-dark-BfOjRT5R.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>Z(()=>import(`./solarized-light-BScPjljz.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>Z(()=>import(`./synthwave-84-CnA0AANO.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>Z(()=>import(`./tokyo-night-BPIHNMsP.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>Z(()=>import(`./vesper-BvHUewHc.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>Z(()=>import(`./vitesse-black-DMW95Ad4.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>Z(()=>import(`./vitesse-dark-Dsw1zB7a.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>Z(()=>import(`./vitesse-light-CfxzxK7D.js`),[]))}].map(e=>[e.id,e.import])),lc=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function uc(){return 2147483648}function dc(){return typeof performance<`u`?performance.now():Date.now()}var fc=(e,t)=>e+(t-e%t)%t;async function pc(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=uc();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,fc(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:dc,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 mc=Object.defineProperty,hc=(e,t,n)=>t in e?mc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gc=(e,t,n)=>hc(e,typeof t==`symbol`?t:t+``,n),_c=null;function vc(e){throw new lc(e.UTF8ToString(e.getLastOnigError()))}var yc=class e{constructor(t){gc(this,`utf16Length`),gc(this,`utf8Length`),gc(this,`utf16Value`),gc(this,`utf8Value`),gc(this,`utf16OffsetToUtf8`),gc(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}},bc=class e{constructor(t){if(gc(this,`id`,++e.LAST_ID),gc(this,`_onigBinding`),gc(this,`content`),gc(this,`utf16Length`),gc(this,`utf8Length`),gc(this,`utf16OffsetToUtf8`),gc(this,`utf8OffsetToUtf16`),gc(this,`ptr`),!_c)throw new lc(`Must invoke loadWasm first.`);this._onigBinding=_c,this.content=t;let n=new yc(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=_c.omalloc(1e4),e._sharedPtrInUse=!0,_c.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(_c)}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)}};gc(bc,`LAST_ID`,0),gc(bc,`_sharedPtr`,0),gc(bc,`_sharedPtrInUse`,!1);var xc=bc,Sc=class{constructor(e){if(gc(this,`_onigBinding`),gc(this,`_ptr`),!_c)throw new lc(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new yc(e[r]);t[r]=i.createString(_c),n[r]=i.utf8Length}let r=_c.omalloc(4*e.length);_c.HEAPU32.set(t,r/4);let i=_c.omalloc(4*e.length);_c.HEAPU32.set(n,i/4);let a=_c.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)_c.ofree(t[n]);_c.ofree(i),_c.ofree(r),a===0&&vc(_c),this._onigBinding=_c,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 xc(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 Cc(e){return typeof e.instantiator==`function`}function wc(e){return typeof e.default==`function`}function Tc(e){return e.data!==void 0}function Ec(e){return typeof Response<`u`&&e instanceof Response}function Dc(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 Oc;function kc(e){if(Oc)return Oc;async function t(){_c=await pc(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Cc(n)?n=await n.instantiator(t):wc(n)?n=await n.default(t):(Tc(n)&&(n=n.data),Ec(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await jc(n)(t):await Mc(n)(t):Dc(n)||n instanceof WebAssembly.Module?n=await Ac(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Ac(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Oc=t(),Oc}function Ac(e){return t=>WebAssembly.instantiate(e,t)}function jc(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Mc(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function Nc(e){return e&&await kc(e),{createScanner(e){return new Sc(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new xc(e)}}}var Pc=Zs({langs:sc,themes:cc,engine:()=>Nc(Z(()=>import(`./wasm-C5V1GnFc.js`),[]))}),{codeToHtml:Fc,codeToHast:Ic,codeToTokens:Lc,codeToTokensBase:Rc,codeToTokensWithThemes:zc,getSingletonHighlighter:Bc,getLastGrammarState:Vc}=$s(Pc,{guessEmbeddedLanguages:Lo});function Hc(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function Uc(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var Wc=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),Gc=String.raw;function Kc(e,t){if(e==null)throw Error(t??`Value expected`);return e}var qc=Gc`\[\^?`,Jc=`c.? | C(?:-.?)?|${Gc`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Gc`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Gc`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Gc`o\{[^\}]*\}?`}|${Gc`\d{1,3}`}`,Yc=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Xc=new RegExp(Gc`
23
+ `}));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=Wo(a.htmlStyle||Uo(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&&Ko(m,r),m}function ks(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&tr.Underline||i.fontStyle&tr.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 As(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 js(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=Wo(e.htmlStyle||Uo(e)),i=Wo(n.htmlStyle||Uo(n)),a=e.fontStyle&&(e.fontStyle&tr.Underline||e.fontStyle&tr.Strikethrough),o=n.fontStyle&&(n.fontStyle&tr.Underline||n.fontStyle&tr.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var Ms=Co;function Ns(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Ds(e,t,n),codeToTokens:(t,n)=>Ts(e,t,n)},i=Ms(Ds(e,t,n,r));for(let e of ts(n))i=e.postprocess?.call(r,i,n)||i;return i}var Ps={light:`#333333`,dark:`#bbbbbb`},Fs={light:`#fffffe`,dark:`#1e1e1e`},Is=`__shiki_resolved`;function Ls(e){if(e?.[Is])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`?Ps.light:Ps.dark,n||=t.type===`light`?Fs.light:Fs.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,Is,{enumerable:!1,writable:!1,value:!0}),t}async function Rs(e){return Array.from(new Set((await Promise.all(e.filter(e=>!jo(e)).map(async e=>await ko(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function zs(e){return(await Promise.all(e.map(async e=>No(e)?null:Ls(await ko(e))))).filter(e=>!!e)}var Bs=3,Vs=!1;function Hs(e,t=3){if(Bs&&!(typeof Bs==`number`&&t>Bs)){if(Vs)throw Error(`[SHIKI DEPRECATE]: ${e}`);console.trace(`[SHIKI DEPRECATE]: ${e}`)}}var Us=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Ws(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 Us(`Circular alias \`${Array.from(n).join(` -> `)} -> ${e}\``);n.add(e)}}return e}var Gs=class extends gi{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=Ls(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=Jn.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Ws(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 Us(`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))}},Ks=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}},qs=0;function Js(e){qs+=1,e.warnings!==!1&&qs>=10&&qs%10==0&&console.warn(`[Shiki] ${qs} 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 Us("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Ls),i=new Gs(new Ks(e.engine,n),r,n,e.langAlias),a;function o(t){return Ws(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new Us(`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 Us(`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 Rs(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await zs(e))}function g(){if(t)throw new Us(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--qs)}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 Ys(e){e.engine||Hs("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([zs(e.themes||[]),Rs(e.langs||[]),e.engine]);return Js({...e,themes:t,langs:n,engine:r})}async function Xs(e){let t=await Ys(e);return{getLastGrammarState:(...e)=>hs(t,...e),codeToTokensBase:(e,n)=>ms(t,e,n),codeToTokensWithThemes:(e,n)=>Cs(t,e,n),codeToTokens:(e,n)=>Ts(t,e,n),codeToHast:(e,n)=>Ds(t,e,n),codeToHtml:(e,n)=>Ns(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function Zs(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,jo(n))return[];let r=t[n];if(!r)throw new Pn(`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(No(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new Pn(`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 Xs({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 Qs(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 $s(e,t){let n=Qs(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 ec=l(h()),tc=`modulepreload`,nc=function(e){return`/`+e},rc={},Z=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=nc(t,n),t in rc)return;rc[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`:tc,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)})},ic=[{id:`abap`,name:`ABAP`,import:(()=>Z(()=>import(`./abap-vey6FMUr.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,import:(()=>Z(()=>import(`./actionscript-3-my8xn3-B.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>Z(()=>import(`./ada-ZTrh2YXI.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>Z(()=>import(`./angular-html-ByeJB0rh.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>Z(()=>import(`./angular-ts-CiwZGajG.js`),__vite__mapDeps([4,0,1,2,3,5])))},{id:`apache`,name:`Apache Conf`,import:(()=>Z(()=>import(`./apache-DRxy-z5z.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>Z(()=>import(`./apex-dYa_qg4y.js`),[]))},{id:`apl`,name:`APL`,import:(()=>Z(()=>import(`./apl-C8k5a5fk.js`),__vite__mapDeps([6,2,1,3,7,8,9])))},{id:`applescript`,name:`AppleScript`,import:(()=>Z(()=>import(`./applescript-DFO6YSHI.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>Z(()=>import(`./ara-izJ2hroH.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>Z(()=>import(`./asciidoc-BEIHtPMJ.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>Z(()=>import(`./asm-B_7A3hVM.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>Z(()=>import(`./astro-BE-h-qpp.js`),__vite__mapDeps([10,2,3,7,11,12,13])))},{id:`awk`,name:`AWK`,import:(()=>Z(()=>import(`./awk-DolF6Tr1.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>Z(()=>import(`./ballerina-fBGtp9ZO.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`],import:(()=>Z(()=>import(`./bat-a27F4u0a.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>Z(()=>import(`./beancount-DoAic3vC.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>Z(()=>import(`./berry-wRZBip4S.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>Z(()=>import(`./bibtex-C6tL9gJb.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>Z(()=>import(`./bicep-FAGekWcZ.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>Z(()=>import(`./bird2-D47vUAud.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>Z(()=>import(`./blade-D-0BV1wW.js`),__vite__mapDeps([14,2,15,1,3,7,16,8,9])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>Z(()=>import(`./bsl-CNzWaPUO.js`),__vite__mapDeps([17,18])))},{id:`c`,name:`C`,import:(()=>Z(()=>import(`./c-Dg_Gx29H.js`).then(e=>e.n),[]))},{id:`c3`,name:`C3`,import:(()=>Z(()=>import(`./c3-9Ln86NZ6.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>Z(()=>import(`./cadence-vteWs_Q-.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>Z(()=>import(`./cairo-DeN51fb8.js`),__vite__mapDeps([19,20])))},{id:`clarity`,name:`Clarity`,import:(()=>Z(()=>import(`./clarity-Db5au7bW.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>Z(()=>import(`./clojure-DlXg2HmZ.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>Z(()=>import(`./cmake-CUpRt8Bg.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>Z(()=>import(`./cobol-DQnGB_GV.js`),__vite__mapDeps([21,1,2,3,9])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>Z(()=>import(`./codeowners-gFMN20nn.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>Z(()=>import(`./codeql-zhKE1bQw.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>Z(()=>import(`./coffee-CDV5a89x.js`),__vite__mapDeps([22,3])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>Z(()=>import(`./common-lisp-BpXWYlpx.js`),[]))},{id:`coq`,name:`Coq`,import:(()=>Z(()=>import(`./coq-Brnzrk62.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>Z(()=>import(`./cpp-8G6b-siI.js`).then(e=>e.n),__vite__mapDeps([23,24,25,26,16])))},{id:`crystal`,name:`Crystal`,import:(()=>Z(()=>import(`./crystal-CGYCC6FM.js`),__vite__mapDeps([27,25,2,1,3,28,16])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>Z(()=>import(`./csharp-D2NkPFJ-.js`),[]))},{id:`css`,name:`CSS`,import:(()=>Z(()=>import(`./css-nez4R8_Z.js`).then(e=>e.n),[]))},{id:`csv`,name:`CSV`,import:(()=>Z(()=>import(`./csv-JHfwQxu2.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>Z(()=>import(`./cue-DfRd-AMP.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>Z(()=>import(`./cypher-CU79q-JJ.js`),[]))},{id:`d`,name:`D`,import:(()=>Z(()=>import(`./d-Bb_5rtK0.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>Z(()=>import(`./dart-DCM4wyEW.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>Z(()=>import(`./dax-C8RqKH5h.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>Z(()=>import(`./desktop-C4YoEmhs.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>Z(()=>import(`./diff-CUbdp-_8.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>Z(()=>import(`./docker-BYHJWJjt.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>Z(()=>import(`./dotenv-BKFUR1iV.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>Z(()=>import(`./dream-maker-D_STdqP4.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>Z(()=>import(`./edge-Z5RMbJQv.js`),__vite__mapDeps([29,15,1,2,3,13])))},{id:`elixir`,name:`Elixir`,import:(()=>Z(()=>import(`./elixir-d3C79FQc.js`),__vite__mapDeps([30,1,2,3])))},{id:`elm`,name:`Elm`,import:(()=>Z(()=>import(`./elm-CDAf6Uyn.js`),__vite__mapDeps([31,24,25])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>Z(()=>import(`./emacs-lisp-CBaydq9s.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>Z(()=>import(`./erb-CTJk9FKH.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:(()=>Z(()=>import(`./erlang-CyYoaxLR.js`),__vite__mapDeps([39,40])))},{id:`fennel`,name:`Fennel`,import:(()=>Z(()=>import(`./fennel-C_EMPuDd.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>Z(()=>import(`./fish-Bj00gCwr.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>Z(()=>import(`./fluent-DUG6ecx0.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>Z(()=>import(`./fortran-fixed-form-CU1NM1Ca.js`),__vite__mapDeps([41,42])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>Z(()=>import(`./fortran-free-form-DJlrt_Va.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>Z(()=>import(`./fsharp-BCcE_A8b.js`),__vite__mapDeps([43,40])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>Z(()=>import(`./gdresource-B4zvYYkN.js`),__vite__mapDeps([44,45,46])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>Z(()=>import(`./gdscript-C-KM_e-o.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>Z(()=>import(`./gdshader-B5KAq9U-.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>Z(()=>import(`./genie-kvovXJpW.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>Z(()=>import(`./gherkin-gaZwMa5o.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>Z(()=>import(`./git-commit-DFJq_3Fo.js`),__vite__mapDeps([47,48])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>Z(()=>import(`./git-rebase-Dr0-MVoW.js`),__vite__mapDeps([49,28])))},{id:`gleam`,name:`Gleam`,import:(()=>Z(()=>import(`./gleam-DDfmtWEq.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>Z(()=>import(`./glimmer-js-CXhLhyW-.js`),__vite__mapDeps([50,2,1,3,13])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>Z(()=>import(`./glimmer-ts-BFAFT-VD.js`),__vite__mapDeps([51,2,1,3,13])))},{id:`glsl`,name:`GLSL`,import:(()=>Z(()=>import(`./glsl-D7yanhgY.js`).then(e=>e.n),__vite__mapDeps([24,25])))},{id:`gn`,name:`GN`,import:(()=>Z(()=>import(`./gn-lRhe7knx.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>Z(()=>import(`./gnuplot-Dsvl7CSU.js`),[]))},{id:`go`,name:`Go`,import:(()=>Z(()=>import(`./go-ClykLgTr.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>Z(()=>import(`./graphql-CpoDxrok.js`).then(e=>e.n),__vite__mapDeps([34,3,35,12,13])))},{id:`groovy`,name:`Groovy`,import:(()=>Z(()=>import(`./groovy-epR4RNba.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>Z(()=>import(`./hack-BL5fmC4q.js`),__vite__mapDeps([52,1,2,3,16])))},{id:`haml`,name:`Ruby Haml`,import:(()=>Z(()=>import(`./haml-ClAE6RVM.js`).then(e=>e.n),__vite__mapDeps([36,2,3])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>Z(()=>import(`./handlebars-nHw91uOv.js`),__vite__mapDeps([53,2,1,3,38])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>Z(()=>import(`./haskell-CkI6ofLi.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>Z(()=>import(`./haxe-D2IO3jfA.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>Z(()=>import(`./hcl-C2LzlY8J.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>Z(()=>import(`./hjson-D56Gqm-A.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>Z(()=>import(`./hlsl-B-BU3OYV.js`),[]))},{id:`html`,name:`HTML`,import:(()=>Z(()=>import(`./html-BIiOKqgG.js`).then(e=>e.n),__vite__mapDeps([1,2,3])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>Z(()=>import(`./html-derivative-D1nPnuOK.js`),__vite__mapDeps([15,1,2,3])))},{id:`http`,name:`HTTP`,import:(()=>Z(()=>import(`./http-B_QcRZjt.js`),__vite__mapDeps([54,34,3,35,12,13,7,28,8,9])))},{id:`hurl`,name:`Hurl`,import:(()=>Z(()=>import(`./hurl-CZE0DsD3.js`),__vite__mapDeps([55,56,34,3,35,12,13,8,9])))},{id:`hxml`,name:`HXML`,import:(()=>Z(()=>import(`./hxml-jrLeckcs.js`),__vite__mapDeps([57,58])))},{id:`hy`,name:`Hy`,import:(()=>Z(()=>import(`./hy-w2Jzz9m_.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>Z(()=>import(`./imba-DPbBdr6e.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>Z(()=>import(`./ini-IKH7SH19.js`),[]))},{id:`java`,name:`Java`,import:(()=>Z(()=>import(`./java-CXTqX09w.js`).then(e=>e.n),[]))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>Z(()=>import(`./javascript-9z9ABBep.js`).then(e=>e.n),[]))},{id:`jinja`,name:`Jinja`,import:(()=>Z(()=>import(`./jinja-Cluf_5Bk.js`),__vite__mapDeps([59,1,2,3])))},{id:`jison`,name:`Jison`,import:(()=>Z(()=>import(`./jison-CqCEUtc4.js`),__vite__mapDeps([60,3])))},{id:`json`,name:`JSON`,import:(()=>Z(()=>import(`./json-BMq_bPP8.js`).then(e=>e.n),[]))},{id:`json5`,name:`JSON5`,import:(()=>Z(()=>import(`./json5-BocpWhvz.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>Z(()=>import(`./jsonc-NK67I9hJ.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>Z(()=>import(`./jsonl-Cb0uXk6R.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>Z(()=>import(`./jsonnet-CpK_1aUl.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>Z(()=>import(`./jssm-CrL4dqHX.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>Z(()=>import(`./jsx-Djij59b9.js`).then(e=>e.n),[]))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>Z(()=>import(`./julia-DybzCMnh.js`),__vite__mapDeps([61,23,24,25,26,16,3,20,62])))},{id:`just`,name:`Just`,import:(()=>Z(()=>import(`./just-4ChcAr9-.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:(()=>Z(()=>import(`./kdl-T7f1MobK.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>Z(()=>import(`./kotlin-DO-VvyWi.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>Z(()=>import(`./kusto-CngRjJvY.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>Z(()=>import(`./latex-CS2TtFXG.js`),__vite__mapDeps([65,66,62])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>Z(()=>import(`./lean-BvZrUnoV.js`),[]))},{id:`less`,name:`Less`,import:(()=>Z(()=>import(`./less-BHMNlKwo.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>Z(()=>import(`./liquid-84AtYenm.js`),__vite__mapDeps([67,2,1,3,7])))},{id:`llvm`,name:`LLVM IR`,import:(()=>Z(()=>import(`./llvm-BGG7pW3S.js`),[]))},{id:`log`,name:`Log file`,import:(()=>Z(()=>import(`./log-epZwUMJs.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>Z(()=>import(`./logo-Bi5ZxfEs.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>Z(()=>import(`./lua-DJzFx3Cf.js`).then(e=>e.n),__vite__mapDeps([37,25])))},{id:`luau`,name:`Luau`,import:(()=>Z(()=>import(`./luau-Q3oZEzh4.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>Z(()=>import(`./make-D7Rpg3XJ.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>Z(()=>import(`./markdown-h2a5XRAL.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>Z(()=>import(`./marko-BLw9BV9E.js`),__vite__mapDeps([68,2,69,5,13])))},{id:`matlab`,name:`MATLAB`,import:(()=>Z(()=>import(`./matlab-D0w6VRbU.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>Z(()=>import(`./mdc-BjZejN3b.js`),__vite__mapDeps([70,15,1,2,3,40,38])))},{id:`mdx`,name:`MDX`,import:(()=>Z(()=>import(`./mdx-hyTZaJXs.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>Z(()=>import(`./mermaid-1Zr1MxpD.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>Z(()=>import(`./mipsasm-CO_Vmqe9.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>Z(()=>import(`./mojo-BEKlpmL9.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>Z(()=>import(`./moonbit-DJGG1uzT.js`),[]))},{id:`move`,name:`Move`,import:(()=>Z(()=>import(`./move-BHMiRKa7.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>Z(()=>import(`./narrat-BKaN0mLL.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>Z(()=>import(`./nextflow-DIxDAddB.js`),__vite__mapDeps([71,72])))},{id:`nextflow-groovy`,name:`nextflow-groovy`,import:(()=>Z(()=>import(`./nextflow-groovy-De9GdmGw.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>Z(()=>import(`./nginx-DuamCwvX.js`),__vite__mapDeps([73,37,25])))},{id:`nim`,name:`Nim`,import:(()=>Z(()=>import(`./nim-Bt8c9-ge.js`),__vite__mapDeps([74,25,2,24,1,3,40,8,9])))},{id:`nix`,name:`Nix`,import:(()=>Z(()=>import(`./nix-CAu-Epnf.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>Z(()=>import(`./nushell-BwuEMOPF.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>Z(()=>import(`./objective-c-DNQk03nL.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>Z(()=>import(`./objective-cpp-AnicUCPq.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>Z(()=>import(`./ocaml-BBI2LBdX.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>Z(()=>import(`./odin-BJIKbElf.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>Z(()=>import(`./openscad-Cb2s5BCi.js`),[]))},{id:`pascal`,name:`Pascal`,import:(()=>Z(()=>import(`./pascal-B1ez31ad.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>Z(()=>import(`./perl-D52AfmwC.js`),__vite__mapDeps([64,2,1,3,16,8,9])))},{id:`php`,name:`PHP`,import:(()=>Z(()=>import(`./php-BBMlJg0_.js`),__vite__mapDeps([75,2,1,3,7,16,8,9])))},{id:`pkl`,name:`Pkl`,import:(()=>Z(()=>import(`./pkl-DmC1-FXa.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>Z(()=>import(`./plsql-DyPUGhhH.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>Z(()=>import(`./po-AeWiHfKa.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>Z(()=>import(`./polar-Bht-ciCi.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>Z(()=>import(`./postcss-Nnu-lNQ3.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>Z(()=>import(`./powerquery-GomboZMg.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`],import:(()=>Z(()=>import(`./powershell-ZgpTdYrb.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>Z(()=>import(`./prisma-DmHLUH7Z.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>Z(()=>import(`./prolog-D4BN-J5S.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>Z(()=>import(`./proto-BziI4vEA.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>Z(()=>import(`./pug-DFHmDqEE.js`),__vite__mapDeps([76,2,1,3])))},{id:`puppet`,name:`Puppet`,import:(()=>Z(()=>import(`./puppet-DZLzAalY.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>Z(()=>import(`./purescript-ByVmdUua.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>Z(()=>import(`./python-BM22ZOLA.js`),[]))},{id:`qml`,name:`QML`,import:(()=>Z(()=>import(`./qml-C0333o-g.js`),__vite__mapDeps([77,3])))},{id:`qmldir`,name:`QML Directory`,import:(()=>Z(()=>import(`./qmldir-C-dHdEsy.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>Z(()=>import(`./qss-Cm6TuuqD.js`),[]))},{id:`r`,name:`R`,import:(()=>Z(()=>import(`./r-DZFmvIgR.js`).then(e=>e.n),[]))},{id:`racket`,name:`Racket`,import:(()=>Z(()=>import(`./racket-Dkf2VwPO.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>Z(()=>import(`./raku-DrOL7bjF.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>Z(()=>import(`./razor-BIGLkWzR.js`),__vite__mapDeps([78,79,1,2,3])))},{id:`reg`,name:`Windows Registry Script`,import:(()=>Z(()=>import(`./reg-BPKh5ogl.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>Z(()=>import(`./regexp-BW6jpgf9.js`).then(e=>e.n),[]))},{id:`rel`,name:`Rel`,import:(()=>Z(()=>import(`./rel-zDwkKiX1.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>Z(()=>import(`./riscv-C0qb7d6i.js`),[]))},{id:`ron`,name:`RON`,import:(()=>Z(()=>import(`./ron-CxdzFhOl.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>Z(()=>import(`./rosmsg-_885Hvdk.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>Z(()=>import(`./rst-Cj51ZJaa.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:(()=>Z(()=>import(`./ruby-lMhGjwpf.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:(()=>Z(()=>import(`./rust-TVzC0_ro.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>Z(()=>import(`./sas-BWSQku7l.js`),__vite__mapDeps([82,16])))},{id:`sass`,name:`Sass`,import:(()=>Z(()=>import(`./sass-DmVLXOtD.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>Z(()=>import(`./scala-5pfDDKQK.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>Z(()=>import(`./scheme-BQLovk51.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>Z(()=>import(`./scss-CdRPuhLN.js`).then(e=>e.n),__vite__mapDeps([5,2])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>Z(()=>import(`./sdbl-OSK-5luq.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>Z(()=>import(`./shaderlab-ChwEEuJS.js`),__vite__mapDeps([83,84])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>Z(()=>import(`./shellscript-DOfOBXcj.js`).then(e=>e.n),[]))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>Z(()=>import(`./shellsession-7XAOCVni.js`),__vite__mapDeps([85,28])))},{id:`smalltalk`,name:`Smalltalk`,import:(()=>Z(()=>import(`./smalltalk-L3BbkSys.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>Z(()=>import(`./solidity-CLGumYJy.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>Z(()=>import(`./soy-DDnzVRIw.js`),__vite__mapDeps([86,1,2,3])))},{id:`sparql`,name:`SPARQL`,import:(()=>Z(()=>import(`./sparql-C9c0CFPV.js`),__vite__mapDeps([87,88])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>Z(()=>import(`./splunk-CyEPDxNz.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>Z(()=>import(`./sql-Ba34agKe.js`).then(e=>e.n),[]))},{id:`ssh-config`,name:`SSH Config`,import:(()=>Z(()=>import(`./ssh-config-CVvZZwRx.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>Z(()=>import(`./stata-BQlYGHQU.js`),__vite__mapDeps([89,16])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>Z(()=>import(`./stylus-Be_2nKLA.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>Z(()=>import(`./surrealql-BET1l7SW.js`),__vite__mapDeps([90,3])))},{id:`svelte`,name:`Svelte`,import:(()=>Z(()=>import(`./svelte-Bd7ZOeQI.js`),__vite__mapDeps([91,2,3,11,13])))},{id:`swift`,name:`Swift`,import:(()=>Z(()=>import(`./swift-D6N4iA16.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>Z(()=>import(`./system-verilog-iQh8ktbe.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>Z(()=>import(`./systemd-DytnOpVA.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>Z(()=>import(`./talonscript-BDLqGQX7.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>Z(()=>import(`./tasl-B73cKR59.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>Z(()=>import(`./tcl-DOjJ63Ed.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>Z(()=>import(`./templ-BYvRQdOw.js`),__vite__mapDeps([92,2,93,3])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>Z(()=>import(`./terraform-4HveOXOO.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>Z(()=>import(`./tex-CT8DpKxX.js`),__vite__mapDeps([66,62])))},{id:`toml`,name:`TOML`,import:(()=>Z(()=>import(`./toml-BtN-zV3i.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>Z(()=>import(`./ts-tags-D4iPPwau.js`),__vite__mapDeps([94,2,24,25,1,3,16,13,8,9])))},{id:`tsv`,name:`TSV`,import:(()=>Z(()=>import(`./tsv-CMdCss8w.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>Z(()=>import(`./tsx-Dgk_Aw-B.js`).then(e=>e.n),[]))},{id:`turtle`,name:`Turtle`,import:(()=>Z(()=>import(`./turtle-CTtYRf8T.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>Z(()=>import(`./twig-abRNWeh3.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:(()=>Z(()=>import(`./typescript-BgR1JqdC.js`).then(e=>e.n),[]))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>Z(()=>import(`./typespec-DEFH1eCC.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>Z(()=>import(`./typst-CyQejCPd.js`),[]))},{id:`v`,name:`V`,import:(()=>Z(()=>import(`./v-BXaHfHlN.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>Z(()=>import(`./vala-CZBBKCzO.js`),[]))},{id:`vb`,name:`Visual Basic`,aliases:[`cmd`],import:(()=>Z(()=>import(`./vb-XkEubmqa.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>Z(()=>import(`./verilog-xOqseBog.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>Z(()=>import(`./vhdl-CMMVBCME.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>Z(()=>import(`./viml-D0rP4VTs.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>Z(()=>import(`./vue-DSkhKq4Q.js`),__vite__mapDeps([96,2,15,1,3,7,13])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>Z(()=>import(`./vue-html-J0jWoD9X.js`),__vite__mapDeps([97,3])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>Z(()=>import(`./vue-vine-BgX5MC8-.js`),__vite__mapDeps([98,2,3,69,11,5,99])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>Z(()=>import(`./vyper-BNu5BXMx.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>Z(()=>import(`./wasm-Cyd-t8sb.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>Z(()=>import(`./wenyan-BAVVk9E4.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>Z(()=>import(`./wgsl-DSDardKJ.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>Z(()=>import(`./wikitext-DpoujGid.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>Z(()=>import(`./wit-efh27Wno.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>Z(()=>import(`./wolfram-DVAg8L4l.js`),[]))},{id:`xml`,name:`XML`,import:(()=>Z(()=>import(`./xml-Ca53xGLB.js`).then(e=>e.n),__vite__mapDeps([8,9])))},{id:`xsl`,name:`XSL`,import:(()=>Z(()=>import(`./xsl-CNnXclYV.js`),__vite__mapDeps([100,8,9])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>Z(()=>import(`./yaml-CjjyUhfg.js`).then(e=>e.n),[]))},{id:`zenscript`,name:`ZenScript`,import:(()=>Z(()=>import(`./zenscript-BhDkIsWD.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>Z(()=>import(`./zig-DYS1KFNL.js`),[]))}],ac=Object.fromEntries(ic.map(e=>[e.id,e.import])),oc=Object.fromEntries(ic.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),sc={...ac,...oc},cc=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>Z(()=>import(`./andromeeda-CneIsnZz.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>Z(()=>import(`./aurora-x-Bc4rKs7r.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>Z(()=>import(`./ayu-dark-DKZmpFRB.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>Z(()=>import(`./ayu-light-Cpvesbhh.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>Z(()=>import(`./ayu-mirage-DC2LB4Dr.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>Z(()=>import(`./catppuccin-frappe-D5mJxQRe.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>Z(()=>import(`./catppuccin-latte-DmTgxxPG.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>Z(()=>import(`./catppuccin-macchiato-DzwtIliU.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>Z(()=>import(`./catppuccin-mocha-DFdjXNU1.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>Z(()=>import(`./dark-plus-Vx1q1FnL.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>Z(()=>import(`./dracula-Fwyt6QVU.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>Z(()=>import(`./dracula-soft-WVoP9zcY.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>Z(()=>import(`./everforest-dark-Dy1ID6LQ.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>Z(()=>import(`./everforest-light-DCq3_A9C.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>Z(()=>import(`./github-dark-DT409rZJ.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>Z(()=>import(`./github-dark-default-CpUaksTJ.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>Z(()=>import(`./github-dark-dimmed-CwpwNIJ3.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>Z(()=>import(`./github-dark-high-contrast-DqKHRKzY.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>Z(()=>import(`./github-light-CjDDPH0V.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>Z(()=>import(`./github-light-default-Bqn2FMJx.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>Z(()=>import(`./github-light-high-contrast-DJSqnrdB.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>Z(()=>import(`./gruvbox-dark-hard-JU0kGeLU.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>Z(()=>import(`./gruvbox-dark-medium-BXYu8VXB.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>Z(()=>import(`./gruvbox-dark-soft-CAFUIeaG.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>Z(()=>import(`./gruvbox-light-hard-68yp_JaY.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>Z(()=>import(`./gruvbox-light-medium-BfZIAUTN.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>Z(()=>import(`./gruvbox-light-soft-Bct3ikgS.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>Z(()=>import(`./horizon-D_7125Q1.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`dark`,import:(()=>Z(()=>import(`./horizon-bright-Ca8HuoFF.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>Z(()=>import(`./houston-JAv2TEQ1.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>Z(()=>import(`./kanagawa-dragon-Cjq94PqN.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>Z(()=>import(`./kanagawa-lotus-C7qryZ57.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>Z(()=>import(`./kanagawa-wave-DImnYG7O.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>Z(()=>import(`./laserwave-CN-xxJxn.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>Z(()=>import(`./light-plus-DWzqIF7F.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>Z(()=>import(`./material-theme-DWWfrqZ-.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>Z(()=>import(`./material-theme-darker-wgpDhYQC.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>Z(()=>import(`./material-theme-lighter-C5OsHZ4H.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>Z(()=>import(`./material-theme-ocean-CvMZFbQ9.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>Z(()=>import(`./material-theme-palenight-COZXb0oL.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>Z(()=>import(`./min-dark-CqCBi6M4.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>Z(()=>import(`./min-light-BBoxwOhR.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>Z(()=>import(`./monokai-BB88t5ne.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>Z(()=>import(`./night-owl-DmUU-_lq.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>Z(()=>import(`./night-owl-light-DMovtpwj.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>Z(()=>import(`./nord-Cq5Den5w.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>Z(()=>import(`./one-dark-pro-DvHC48R_.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>Z(()=>import(`./one-light-DqhWsBuX.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>Z(()=>import(`./plastic-D9ELbINl.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>Z(()=>import(`./poimandres-BbzxxHPn.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>Z(()=>import(`./red-DMKoyNTl.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>Z(()=>import(`./rose-pine-CERl25PP.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>Z(()=>import(`./rose-pine-dawn-9oXTxZFr.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>Z(()=>import(`./rose-pine-moon-Zy2VTZyw.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>Z(()=>import(`./slack-dark-DydfDgCL.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>Z(()=>import(`./slack-ochin-CzQtVspP.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>Z(()=>import(`./snazzy-light-CN4AGa9X.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>Z(()=>import(`./solarized-dark-BfOjRT5R.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>Z(()=>import(`./solarized-light-BScPjljz.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>Z(()=>import(`./synthwave-84-CnA0AANO.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>Z(()=>import(`./tokyo-night-BPIHNMsP.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>Z(()=>import(`./vesper-BvHUewHc.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>Z(()=>import(`./vitesse-black-DMW95Ad4.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>Z(()=>import(`./vitesse-dark-Dsw1zB7a.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>Z(()=>import(`./vitesse-light-CfxzxK7D.js`),[]))}].map(e=>[e.id,e.import])),lc=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function uc(){return 2147483648}function dc(){return typeof performance<`u`?performance.now():Date.now()}var fc=(e,t)=>e+(t-e%t)%t;async function pc(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=uc();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,fc(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:dc,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 mc=Object.defineProperty,hc=(e,t,n)=>t in e?mc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gc=(e,t,n)=>hc(e,typeof t==`symbol`?t:t+``,n),_c=null;function vc(e){throw new lc(e.UTF8ToString(e.getLastOnigError()))}var yc=class e{constructor(t){gc(this,`utf16Length`),gc(this,`utf8Length`),gc(this,`utf16Value`),gc(this,`utf8Value`),gc(this,`utf16OffsetToUtf8`),gc(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}},bc=class e{constructor(t){if(gc(this,`id`,++e.LAST_ID),gc(this,`_onigBinding`),gc(this,`content`),gc(this,`utf16Length`),gc(this,`utf8Length`),gc(this,`utf16OffsetToUtf8`),gc(this,`utf8OffsetToUtf16`),gc(this,`ptr`),!_c)throw new lc(`Must invoke loadWasm first.`);this._onigBinding=_c,this.content=t;let n=new yc(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=_c.omalloc(1e4),e._sharedPtrInUse=!0,_c.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(_c)}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)}};gc(bc,`LAST_ID`,0),gc(bc,`_sharedPtr`,0),gc(bc,`_sharedPtrInUse`,!1);var xc=bc,Sc=class{constructor(e){if(gc(this,`_onigBinding`),gc(this,`_ptr`),!_c)throw new lc(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new yc(e[r]);t[r]=i.createString(_c),n[r]=i.utf8Length}let r=_c.omalloc(4*e.length);_c.HEAPU32.set(t,r/4);let i=_c.omalloc(4*e.length);_c.HEAPU32.set(n,i/4);let a=_c.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)_c.ofree(t[n]);_c.ofree(i),_c.ofree(r),a===0&&vc(_c),this._onigBinding=_c,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 xc(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 Cc(e){return typeof e.instantiator==`function`}function wc(e){return typeof e.default==`function`}function Tc(e){return e.data!==void 0}function Ec(e){return typeof Response<`u`&&e instanceof Response}function Dc(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 Oc;function kc(e){if(Oc)return Oc;async function t(){_c=await pc(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Cc(n)?n=await n.instantiator(t):wc(n)?n=await n.default(t):(Tc(n)&&(n=n.data),Ec(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await jc(n)(t):await Mc(n)(t):Dc(n)||n instanceof WebAssembly.Module?n=await Ac(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Ac(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Oc=t(),Oc}function Ac(e){return t=>WebAssembly.instantiate(e,t)}function jc(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Mc(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function Nc(e){return e&&await kc(e),{createScanner(e){return new Sc(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new xc(e)}}}var Pc=Zs({langs:sc,themes:cc,engine:()=>Nc(Z(()=>import(`./wasm-C5V1GnFc.js`),[]))}),{codeToHtml:Fc,codeToHast:Ic,codeToTokens:Lc,codeToTokensBase:Rc,codeToTokensWithThemes:zc,getSingletonHighlighter:Bc,getLastGrammarState:Vc}=$s(Pc,{guessEmbeddedLanguages:Lo});function Hc(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function Uc(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var Wc=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),Gc=String.raw;function Kc(e,t){if(e==null)throw Error(t??`Value expected`);return e}var qc=Gc`\[\^?`,Jc=`c.? | C(?:-.?)?|${Gc`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Gc`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Gc`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Gc`o\{[^\}]*\}?`}|${Gc`\d{1,3}`}`,Yc=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Xc=new RegExp(Gc`
24
24
  \\ (?:
25
25
  ${Jc}
26
26
  | [gk]<[^>]*>?
@@ -1539,14 +1539,14 @@ diff --git`)}function Dg(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
1539
1539
  `;if(t.endsWith(`
1540
1540
  `))return`
1541
1541
  `;if(t.endsWith(`\r`))return`\r`}return`
1542
- `}function eb(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function tb(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function nb(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function rb(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function ib(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Gv(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function ab(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}var ob=-1,sb=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++ob}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;pendingFiles;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:Dt},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new nv,this.scrollSyncManager=new Ay,this.interactionManager=new I_(`diff`,L_(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return ib(e)}createHunksRenderer(e){return new zy(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{let n=this.fileDiffCache;if(n==null)return;let r=n.hunks.at(-1),i,a;hunkIterator:for(let o of n.hunks){let n=t===`deletions`?o.deletionStart:o.additionStart,s=t===`deletions`?o.deletionCount:o.additionCount,c=zt(n,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(e<c){let t=c-e;i=Math.max(u-t,0),a=Math.max(l-t,0);break hunkIterator}if(e>=c+s){if(o===r){let t=e-(c+s);i=u+o.unifiedLineCount+t,a=l+o.splitLineCount+t;break hunkIterator}continue}for(let n of o.hunkContent)if(n.type===`context`)if(e<c+n.lines){let t=e-c;a=l+t,i=u+t;break hunkIterator}else c+=n.lines,l+=n.lines,u+=n.lines;else{let r=t===`deletions`?n.deletions:n.additions;if(e<c+r){let r=e-c;i=u+(t===`additions`?n.deletions:0)+r,a=l+r;break hunkIterator}else c+=r,l+=Math.max(n.deletions,n.additions),u+=n.deletions+n.additions}break hunkIterator}if(!(i==null||a==null))return[i,a]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(L_(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!pn(this.appliedThemeCSS.theme,this.options.theme??Dt)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`?!0:e===`scroll`&&(this.lineAnnotations.length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){Uh(this.handleEditSessionRender),this.emitPostRender(!0),this.editor?.cleanUp(e),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.pendingFiles=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=vy(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t),db(this.pre,lb({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||fb(this.headerElement,ub({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),ny(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?Pg(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;e==null||t==null||!ab(e)||this.pendingFiles?.fileDiff===e||(this.pendingFiles={fileDiff:e,promise:this.loadFilesForDiff(e,t)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}finally{this.pendingFiles?.fileDiff===e&&(this.pendingFiles=void 0)}}async handleFilesLoaded(e,t){this.fileDiff!==e||!e.isPartial||(xy(`merge`,e,t),this.setHydratedState(t),await my(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender())}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){let l=vy(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);e!=null&&e.cacheKey===void 0&&(e.cacheKey=e.prevName==null?e.name:e.prevName+`:`+e.name),this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!cb(u,this.deletionFile)||!cb(d,this.additionFile)),y=e!=null&&e!==this.fileDiff,b=i!=null&&(i.length>0||this.lineAnnotations.length>0)?i!==this.lineAnnotations:!1;if(!f&&uv(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&e===this.fileDiff||e==null&&!v))return this.applyCachedThemeState(p);let x;e==null&&_&&(v||this.fileDiff==null)&&(x=Pg(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;if(this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e==null?x!=null&&(y=!0,this.fileDiff=x):this.fileDiff=e,y&&(this.cachedHeaderHTML=void 0),i!=null&&this.setLineAnnotations(i),this.fileDiff==null)return!1;this.fileDiff.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(f_(this.fileDiff,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:C=!1,disableFileHeader:w=!1}=this.options;if(w&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,It);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g)&&this.applyPartialRender({previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}get fileDiffCache(){return this.hunksRenderer.diffCache??this.fileDiff}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.fileDiffCache,r=this.lineAnnotations,i=this.computeEditorRenderRange(this.renderRange);e!=null&&t!=null&&n!=null&&!n.isPartial&&this.hunksRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.fileDiffCache!==n||e.__syncRenderView(a,t,n,r,i)})}computeEditorRenderRange(e){let t=this.fileDiffCache;if(e==null||t==null||jy(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return Cm({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.attachEditor: cannot attach an editor to a "${this.type}" diff`);return this.editor?.cleanUp(),this.editor=e,this.hunksRenderer.beginEditSession(),this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary(),this.hunksRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),e=>{this.editor=void 0,e!==!0&&this.finishEditSession()}}finishEditSession(){this.hunksRenderer.endEditSession(),this.completeEditSession()}completeEditSession(){let e=this.fileDiffCache;if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=u_(e,this.hunksRenderer.getExpandedHunksMap(),t);return f_(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(d_(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){this.hunksRenderer.applyDocumentChange(e);let n=this.hunksRenderer.diffCache;if(n!=null){let e=this.fileDiff?.cacheKey;e!=null&&n.cacheKey==null&&(n.cacheKey=e),this.fileDiff=n}t!==void 0&&t!==this.lineAnnotations&&(this.setLineAnnotations(t),this.hunksRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations()),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let{shouldRefreshDiffsView:r,lineCountChangeInFlight:i}=n;if(this.hunksRenderer.updateRenderCache(e,t,i)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}r===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}isLineRenderable(e){let t=this.fileDiffCache;if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return hm({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.fileDiffCache;if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return gm({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.fileDiffCache,{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=um(o);if(e<s){let c=dm({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=mm({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=um(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){Hh(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||rm(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!rb(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${Lt(r)}`,a=this.annotationCache.get(i);if(a==null||!nb(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:Mv(Lt(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Nv();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:O_(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):O_(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=Dv;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??Co(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:a,renderHeaderFilenameSuffix:o,renderHeaderMetadata:s}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Et,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let c=a?.(n)??void 0,l=o?.(n)??void 0,u=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Ct,c),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,wt,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Tt,u),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===t&&this.appliedUnsafeCSS===e||(this.unsafeCSSStyle??=Pv(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Vv(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??Dt,s=typeof o==`string`?o:{...o},c=Iv(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Yv({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Hv(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=Uv(this.themeCSSStyle.textContent??``,Iv(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&ey()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Jv(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=pb(t[0]),a=pb(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=Co(i),r.content.innerHTML=Co(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=qv({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=qv({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=qv({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){if(this.options.diffStyle!==`split`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(t))return;let n=(t,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(t,e),i=pb(r?.[0]),a=pb(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};n(`deletions`,t[0]),n(`additions`,t[1])}refreshUnifiedDiffView(){if(this.options.diffStyle!==`unified`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(t==null||Array.isArray(t))return;let n=this.hunksRenderer.renderCodeAST(`unified`,e),r=pb(n?.[0]),i=pb(n?.[1]),a=()=>{for(let[e,n]of[[t.gutter,r],[t.content,i]])n!=null&&(e.innerHTML=Co(n));e.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,t,e.rowCount),this.lastRowCount=e.rowCount)};this.shouldGuardRebuildScroll()?Jv(this.pre,a):a(),this.renderSeparators(e.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=pb(t[0]),i=pb(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}else throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l===`unified`?!1:t!=null&&n!=null,totalLines:r,customProperties:i};kv(u,this.appliedPreAttributes)||(ry(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function cb(e,t){return e==null||t==null?e==null&&t==null:mn(e,t)}function lb({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function ub({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function db(e,t,n=!1){return!n&&e==null&&t}function fb(e,t,n=!1){return e==null&&t&&!n}function pb(e){if(!(e==null||e.type!==`element`))return e.children??[]}var mb=3e3,hb=-1,gb=class extends sb{__id=`little-virtualized-file-diff:${++hb}`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;currentExpandUnchanged;pendingHydratedDiff;pendingExpansions;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=am(n)}setMetrics(e,t=!1){let n=am(e);!t&&Lh(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e===t?!1:(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return e==null||!A_(this.lineAnnotations)?!1:this.lineAnnotations.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type===`deleted`?t.side===`deletions`:!0:!1)}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!Rh(t,e),r=n&&wb(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Tb(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal!==0&&(this.cache.measuredHeightDeltaTotal=0),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}reconcileHeights(){let e=!1,{overflow:t=`scroll`}=this.options;if(this.fileContainer==null||this.fileDiff==null)return this.height!==0&&(e=!0),this.height=0,e;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled())return e;let n=this.getDiffStyle(),r=n===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],i=this.hasFileAnnotations(this.fileDiff);if(this.renderRange!=null&&i&&M_(this.renderRange)){let t=_b(r)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else !i&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of r){if(t==null)continue;let r=t.children[1];if(r instanceof HTMLElement)for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let i=kb(r,n),a=t.getBoundingClientRect().height,o=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(o=!0),a+=t.nextElementSibling.getBoundingClientRect().height);let s=this.getEstimatedLineHeight(o),c=this.cache.heightDeltas.get(i)??0,l=a-s;l!==c&&(e=!0,this.cache.measuredHeightDeltaTotal+=l-c,l===0?this.cache.heightDeltas.delete(i):this.cache.heightDeltas.set(i,l))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}prepareCodeViewItem(e,t,n,r){let i=!tm(this.fileDiff,e),a=this.syncLineAnnotations(r),o=n?.resetDiffLayoutCache===!0||i||a,s=i||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights;n?.metrics!=null&&(this.metrics=am(n.metrics),o=!0,s=!0);let{collapsed:c=!1,expandUnchanged:l=!1}=this.options;return this.currentCollapsed!==c&&(this.currentCollapsed=c,o=!0),this.currentExpandUnchanged!==l&&(this.currentExpandUnchanged=l,o=!0,s=!0),o&&this.resetLayoutCache({includeEstimatedHeights:s}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t=`additions`){if(this.fileDiff==null||e<1)return;let n=this.getLineIndex(e,t);if(n==null)return;let{disableFileHeader:r=!1,expandUnchanged:i=!1,collapsed:a=!1,collapsedContextThreshold:o=1}=this.options,s=this.getDiffStyle(),c=this.getHunkSeparatorType(),l=s===`split`?n[1]:n[0];this.approximateLayoutCheckpoints();let u=om(this.metrics,r),d=this.getLayoutCheckpointBeforeLineIndex(l),f=d?.top??u+this.cache.fileAnnotationHeight;if(a)return{top:u,height:0};let p;return Cm({diff:this.fileDiff,diffStyle:s,startingLine:d?.renderedLineIndex??0,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=s===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=xm({type:c,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(f+=r.gapBefore,l>=o-n&&l<o)return p={top:f,height:r.height},!0;f+=r.height+r.gapAfter}}let u=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===l)return p={top:f,height:u},!0;if(f+=u,r>0){let e=Sm({type:c,metrics:this.metrics});if(e!=null){if(l>o&&l<=o+r)return p={top:f+e.gapBefore,height:e.height},!0;f+=e.totalHeight}}return!1}}),p}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){if(this.fileDiff==null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:r=!1,collapsedContextThreshold:i=1}=this.options;if(r)return;let a=this.getDiffStyle(),o=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();let s=this.getLayoutCheckpointBeforeTop(e),c=s?.top??om(this.metrics,t)+this.cache.fileAnnotationHeight,l;return Cm({diff:this.fileDiff,diffStyle:a,startingLine:s?.renderedLineIndex??0,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:s,additionLine:u})=>{let d=a===`split`?u?.splitLineIndex??s?.splitLineIndex:u?.unifiedLineIndex??s?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=xm({type:o,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(c+=e.totalHeight)}if(c>=e&&(s==null?u!=null&&(l={lineNumber:u.lineNumber,side:`additions`,top:c}):l={lineNumber:s.lineNumber,side:`deletions`,top:c},l!=null))return!0;let f=this.getLineHeight(d,(u?.noEOFCR??!1)||(s?.noEOFCR??!1));if(c+=f,i>0){let e=Sm({type:o,metrics:this.metrics});e!=null&&(c+=e.totalHeight)}return!1}}),l}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.fileDiff==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.fileDiff,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.isSetup=!1,super.cleanUp(e)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(this.isAdvancedMode()){let n=xy(`clone`,e,t);if(await my(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(xy(`merge`,e,t),this.setHydratedState(t),await my(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e)return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}consumeCodeViewLayoutChanges(e){let t=!1,n,{pendingExpansions:r,pendingHydratedDiff:i}=this;if(r!=null){this.pendingExpansions=void 0;for(let e of r)this.hunksRenderer.expandHunk(e.hunkIndex,e.direction,e.expansionLineCountOverride),t=!0}return i!=null&&(this.pendingHydratedDiff=void 0,i.expectedDiff===e&&(this.setHydratedState(i.files),n=i.nextDiff)),n==null?t&&(this.forceRenderOverride=!0,this.invalidateDerivedLayoutCache(!0)):(this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0})),n}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.fileDiffCache;if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return hm({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.fileDiff==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;if(this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!==void 0&&this.fileDiff!==void 0){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(this.fileDiff,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.fileDiff){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=om(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getActiveEstimatedHeight(e=this.fileDiff){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.fileDiff){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=hy({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Eb(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.fileDiff){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=vy(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!Ob(s,this.deletionFile)||!Ob(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=Pg(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=this.syncLineAnnotations(r);p&&this.resetLayoutCache({includeEstimatedHeights:!1});let m=t!=null&&t!==this.fileDiff,h=u!=null&&!tm(this.fileDiff,u),g=m||l;if(h&&this.resetLayoutCache({includeEstimatedHeights:!0}),e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;if(f)this.top??=this.getVirtualizedTop(),h&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,u));else{this.computeApproximateSize(!1,u);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!g||!f))return this.fileDiff=u,a!=null&&(this.deletionFile=s,this.additionFile=c),h&&(this.cachedHeaderHTML=void 0),this.renderPlaceholder(this.height);let _=this.virtualizer.getWindowSpecs(),v=this.top??0,y=this.computeRenderRangeFromWindow(u,v,_),b=super.render({fileDiff:u,fileContainer:e,renderRange:y,lineAnnotations:r,forceRender:(d??n)||p||h,...a,...i});return this.isSimpleMode()&&b&&this.getSimpleVirtualizer()?.requestHeightReconcile(this),b}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return Db(this.options.hunkSeparators)}approximateLayoutCheckpoints(e=this.fileDiff){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e==null||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=Eb(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=vb(this.cache.heightDeltas),u=om(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=xb(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+Sb(i,e)*this.metrics.lineHeight+yb(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=mb}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+yb(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=dm({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?xm({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?mm({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?Sm({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:Cb({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=dm({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=mm({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=Eb(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=om(this.metrics,i),h=e.hunks.length>0?cm(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=(n+r)/2,O=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),k=t+(O?.top??_),A=O?.renderedLineIndex??0,j,M,N;if(Cm({diff:e,diffStyle:l,startingLine:O?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?xm({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;k+=y;let b=A%s===0,x=Math.floor(A/s);if(b&&(E[x]=k-(t+_+y),N!=null)){if(N<=0)return!0;N--}let S=this.getLineHeight(l===`split`?m:h,g);if(k>n-S&&k<r&&(j??=x),M==null&&k+S>D&&(M=x),N==null&&k>=r&&b&&(N=T),A++,k+=S,c>0||v&&d){let e=Sm({type:u,metrics:this.metrics});e!=null&&(k<r&&k+e.totalHeight>n&&(j??=x),M==null&&k+e.totalHeight>D&&(M=x),k+=e.totalHeight)}return!1}}),j==null)if(x)j=0,M=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};M??=j;let P=Math.round(M-w/2),F=Math.max(0,Math.ceil(p/s)-w),I=Math.max(0,Math.min(P,F)),L=I*s,R=P<0?C+P*s:C,z=E[I]??0,B=L===0?0:g+z,V=I+R/s,H=V<E.length?v-E[V]:v-(k-t-_);return{startingLine:L,totalLines:R,bufferBefore:B,bufferAfter:Math.max(0,H)}}};function _b(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===k_&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function vb(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function yb({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=bb(e,n);return(t[bb(e,r)]??0)-(t[i]??0)}function bb(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function xb(e){return Math.ceil(e/mb)*mb}function Sb(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Cb({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function wb(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Tb(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Eb(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Db(e){return typeof e==`function`?`custom`:e??`line-info`}function Ob(e,t){return e==null||t==null?e==null&&t==null:mn(e,t)}function kb(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function Ab(e,t){return typeof window>`u`&&t!=null?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,Y.jsx)(Y.Fragment,{children:e})}var jb=(0,J.createContext)(void 0);function Mb(){return(0,J.useContext)(jb)}var Nb=typeof window>`u`?J.useEffect:J.useLayoutEffect;function Pb({file:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=Mb(),f=i!==void 0,p=(0,J.useContext)(Nh),m=ut(),h=(0,J.useRef)(null),g=st(n=>{if(n!=null){if(h.current!=null)throw Error(`File: An instance should not already exist when a node is created`);d==null?h.current=new oy(Fb({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new fy(Fb({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({file:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`File: A File instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return Nb(()=>{if(h.current==null)return;let n=Fb({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),a=n!==void 0&&!Rh(h.current.options,n);h.current.setOptions(n),h.current.render({file:e,lineAnnotations:r,forceRender:a}),i!==void 0&&h.current.setSelectedLines(i)}),Nb(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`File: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`File: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,J.useCallback)(()=>h.current?.getHoveredLine(),[])}}function Fb({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?pt:e?.renderCustomHeader,renderGutterUtility:r?pt:e?.renderGutterUtility}:e}function Ib({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,metrics:a,className:o,style:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,prerenderedHTML:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=Pb({file:e,options:r,editorOptions:i,metrics:a,lineAnnotations:t,selectedLines:n,prerenderedHTML:p,hasGutterRenderUtility:m!=null,hasCustomHeader:l!=null,disableWorkerPool:h,edit:g});return(0,Y.jsx)(ht,{ref:_,className:o,style:s,children:Ab(fn({file:e,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,renderGutterUtility:m,lineAnnotations:t,getHoveredLine:v}),p)})}var Lb=typeof window>`u`?J.useEffect:J.useLayoutEffect;function Rb({fileDiff:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=Mb(),f=i!==void 0,p=(0,J.useContext)(Nh),m=ut(),h=(0,J.useRef)(null),g=st(n=>{if(n!=null){if(h.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);d==null?h.current=new sb(zb({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new gb(zb({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({fileDiff:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return Lb(()=>{let{current:n}=h;if(n==null)return;let a=zb({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),o=a!==void 0&&!Rh(n.options,a);n.setOptions(a),n.render({forceRender:o,fileDiff:e,lineAnnotations:r}),i!==void 0&&n.setSelectedLines(i)}),Lb(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`FileDiff: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`FileDiff: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,J.useCallback)(()=>h.current?.getHoveredLine(),[])}}function zb({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?pt:e?.renderCustomHeader,renderGutterUtility:r?pt:e?.renderGutterUtility}:e}function Bb({fileDiff:e,options:t,editorOptions:n,metrics:r,lineAnnotations:i,selectedLines:a,className:o,style:s,prerenderedHTML:c,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=Rb({fileDiff:e,options:t,editorOptions:n,metrics:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:c,hasGutterRenderUtility:m!=null,hasCustomHeader:u!=null,disableWorkerPool:h,edit:g});return(0,Y.jsx)(ht,{ref:_,className:o,style:s,children:Ab(un({fileDiff:e,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderAnnotation:l,renderGutterUtility:m,lineAnnotations:i,getHoveredLine:v}),c)})}function Vb({oldFile:e,newFile:t,options:n,editorOptions:r,metrics:i,lineAnnotations:a,selectedLines:o,className:s,style:c,prerenderedHTML:l,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1}){let v=(0,J.useMemo)(()=>Pg(e,t,n?.parseDiffOptions),[e,t,n?.parseDiffOptions]),{ref:y,getHoveredLine:b}=Rb({fileDiff:v,options:n,editorOptions:r,metrics:i,lineAnnotations:a,selectedLines:o,prerenderedHTML:l,hasGutterRenderUtility:h!=null,hasCustomHeader:d!=null,disableWorkerPool:g,edit:_});return(0,Y.jsx)(ht,{ref:y,className:s,style:c,children:Ab(un({fileDiff:v,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderAnnotation:u,lineAnnotations:a,renderGutterUtility:h,getHoveredLine:b}),l)})}var Hb=class extends zy{pendingConflictActions=[];pendingMarkerRows=[];injectedRows=new Map;options;constructor(e={theme:Dt},t,n){super(void 0,t,n),this.options=e}setConflictState(e,t,n){this.pendingConflictActions=e,this.pendingMarkerRows=t,this.syncInjectedRows(e,t,n)}syncInjectedRows(e,t,n){this.injectedRows.clear();for(let t of e){let e=t==null?void 0:Vt(t,n);if(t==null||e==null)continue;let r={type:`actions`,hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:t.conflictIndex};this.addInjectedRow(r)}for(let e of t)this.addInjectedRow(e)}addInjectedRow(e){let t=`${e.hunkIndex}:${e.lineIndex}`,n=this.injectedRows.get(t);n==null?this.injectedRows.set(t,[e]):n.push(e)}renderDiff(e,t=Ft){return e!=null&&this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.renderDiff(e,t)}async asyncRender(e,t=Ft){return this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.asyncRender(e,t)}createPreElement(e,t){return super.createPreElement(e,t,{"data-has-merge-conflict":``})}getUnifiedLineDecoration({type:e,lineType:t}){let n=e===`change`?t===`change-deletion`?`current`:`incoming`:void 0;return{gutterLineType:e===`change`?`context`:t,gutterProperties:Ub(n),contentProperties:Wb(e,n)}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`current`:`incoming`:void 0;return{gutterLineType:t===`change`?`context`:t,gutterProperties:Ub(n),contentProperties:Wb(t,n)}}getUnifiedInjectedRowsForLine=e=>{let t=this.injectedRows.get(`${e.hunkIndex}:${e.lineIndex}`);if(t==null||t.length===0)return;let{mergeConflictActionsType:n}=this.getOptionsWithDefaults(),r=[],i=[];for(let e of t){if(e.type===`actions`){r.push({content:Kb({row:e,includeDefaultActions:n===`default`,includeSlot:!0}),gutter:Gb(`action`)});continue}(e.type===`marker-end`?i:r).push({content:qb(e),gutter:Gb(`marker`,e.type)})}return{before:r.length>0?r:void 0,after:i.length>0?i:void 0}};getOptionsWithDefaults(){let e=super.getOptionsWithDefaults();return e.diffStyle=`unified`,e.lineDiffType=`none`,e.mergeConflictActionsType=this.options.mergeConflictActionsType??`default`,e}};function Ub(e){return e==null?void 0:{"data-merge-conflict":e}}function Wb(e,t){if(t!=null){if(e===`change`)return t===`current`||t===`incoming`?{"data-line-type":`context`,"data-merge-conflict":t}:void 0;if(t===`marker-start`||t===`marker-base`||t===`marker-separator`||t===`marker-end`)return{"data-merge-conflict":t}}}function Gb(e,t){let n=gp(void 0,`annotation`,1);return n.properties[`data-gutter-buffer`]=e===`action`?`merge-conflict-action`:`merge-conflict-${t??`marker`}`,n}function Kb({row:e,includeDefaultActions:t,includeSlot:n}){let r=t?Jb(e.conflictIndex):[];return n&&r.push(dp({tagName:`slot`,properties:{name:Rt({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:e.conflictIndex}),"data-merge-conflict-action-slot":``}})),dp({tagName:`div`,properties:{"data-merge-conflict-actions":``},children:[dp({tagName:`div`,properties:{"data-merge-conflict-actions-content":``},children:r})]})}function qb(e){return dp({tagName:`div`,properties:{"data-merge-conflict":e.type,"data-merge-conflict-marker-row":``},children:[up(e.lineText.replace(/(?:\r\n|\n|\r)$/,``))]})}function Jb(e){return[Yb({resolution:`current`,label:`Accept current change`,conflictIndex:e}),Xb(),Yb({resolution:`incoming`,label:`Accept incoming change`,conflictIndex:e}),Xb(),Yb({resolution:`both`,label:`Accept both`,conflictIndex:e})]}function Yb({resolution:e,label:t,conflictIndex:n}){return dp({tagName:`button`,properties:{type:`button`,"data-merge-conflict-action":e,"data-merge-conflict-conflict-index":`${n}`},children:[up(t)]})}function Xb(){return dp({tagName:`span`,properties:{"data-merge-conflict-action-separator":``},children:[up(`|`)]})}function Zb(e,t){return e.hunkIndex===t.hunkIndex&&e.startContentIndex===t.startContentIndex&&e.endContentIndex===t.endContentIndex&&e.currentContentIndex===t.currentContentIndex&&e.baseContentIndex===t.baseContentIndex&&e.incomingContentIndex===t.incomingContentIndex&&e.endMarkerContentIndex===t.endMarkerContentIndex&&e.conflictIndex===t.conflictIndex&&Qb(e.conflict,t.conflict)}function Qb(e,t){return e.conflictIndex===t.conflictIndex&&e.startLineIndex===t.startLineIndex&&e.startLineNumber===t.startLineNumber&&e.separatorLineIndex===t.separatorLineIndex&&e.separatorLineNumber===t.separatorLineNumber&&e.endLineIndex===t.endLineIndex&&e.endLineNumber===t.endLineNumber&&e.baseMarkerLineIndex===t.baseMarkerLineIndex&&e.baseMarkerLineNumber===t.baseMarkerLineNumber}function $b(e){let t=typeof e==`string`?e:e.type;return t===`accept`||t===`incoming`?`additions`:t===`reject`||t===`current`?`deletions`:`both`}function ex(e,t){let{resolution:n,hunkIndex:r,startContentIndex:i,endContentIndex:a,indexesToDelete:o=new Set}=t,s=e.hunks[r];if(s==null)throw console.error({diff:e,hunkIndex:r}),Error(`resolveRegion: Invalid hunk index: ${r}`);if(i<0||a>=s.hunkContent.length||i>a)throw Error(`resolveRegion: Invalid content range, ${i}, ${a}`);let{hunks:c,additionLines:l,deletionLines:u}=e,d={...e,hunks:[],deletionLines:[],additionLines:[],splitLineCount:0,unifiedLineCount:0,cacheKey:e.cacheKey==null?void 0:`${e.cacheKey}:${n[0]}-${r}:${i}-${a}`},f={nextAdditionLineIndex:0,nextDeletionLineIndex:0,nextAdditionStart:1,nextDeletionStart:1,splitLineCount:0,unifiedLineCount:0},p=r===c.length-1&&a===s.hunkContent.length-1,m=!e.isPartial;for(let[t,s]of c.entries()){nx(e,d,f,zt(s.deletionStart,s.deletionCount)-s.collapsedBefore,zt(s.additionStart,s.additionCount)-s.collapsedBefore,s.collapsedBefore,m);let c={...s,hunkContent:[],additionStart:f.nextAdditionStart,deletionStart:f.nextDeletionStart,additionLineIndex:f.nextAdditionLineIndex,deletionLineIndex:f.nextDeletionLineIndex,additionCount:0,deletionCount:0,deletionLines:0,additionLines:0,splitLineStart:f.splitLineCount,unifiedLineStart:f.unifiedLineCount,splitLineCount:0,unifiedLineCount:0};for(let[e,p]of s.hunkContent.entries())if(t!==r||e<i||e>a){rx(p,d,u,l);let e={...p,additionLineIndex:f.nextAdditionLineIndex,deletionLineIndex:f.nextDeletionLineIndex};c.hunkContent.push(e),ax(e,f,c)}else if(o.has(e))c.hunkContent.push({type:`context`,lines:0,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex});else if(p.type===`context`){rx(p,d,u,l);let e={...p,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex};c.hunkContent.push(e),ax(e,f,c)}else{ix(n,p,d,u,l);let e={type:`context`,lines:n===`deletions`?p.deletions:n===`additions`?p.additions:p.deletions+p.additions,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex};c.hunkContent.push(e),ax(e,f,c)}if(t===r&&p){let e=n===`deletions`?s.noEOFCRDeletions:s.noEOFCRAdditions;c.noEOFCRAdditions=e,c.noEOFCRDeletions=e}c.additionCount===0&&(c.additionStart--,e.isPartial||c.additionLineIndex--),c.deletionCount===0&&(c.deletionStart--,e.isPartial||c.deletionLineIndex--),d.hunks.push(c)}let h=c.at(-1);if(h!=null&&!e.isPartial){let e=Bt(h.deletionStart,h.deletionCount),t=Bt(h.additionStart,h.additionCount),n=Math.min(u.length-e,l.length-t);tx(d,u,l,e,t,n),f.splitLineCount+=n,f.unifiedLineCount+=n}return d.splitLineCount=f.splitLineCount,d.unifiedLineCount=f.unifiedLineCount,d}function tx(e,t,n,r,i,a){for(let o=0;o<a;o++){let a=t[r+o],s=n[i+o];if(a==null||s==null)throw Error(`pushCollapsedContextLines: missing collapsed context line`);e.deletionLines.push(a),e.additionLines.push(s)}}function nx(e,t,n,r,i,a,o){a<=0||(o&&(tx(t,e.deletionLines,e.additionLines,r,i,a),n.nextAdditionLineIndex+=a,n.nextDeletionLineIndex+=a),n.nextAdditionStart+=a,n.nextDeletionStart+=a,n.splitLineCount+=a,n.unifiedLineCount+=a)}function rx(e,t,n,r){if(e.type===`context`)for(let n=0;n<e.lines;n++){let i=r[e.additionLineIndex+n];if(i==null)throw console.error({additionLines:r,content:e,i:n}),Error(`pushContentLinesToDiff: Context line does not exist`);t.deletionLines.push(i),t.additionLines.push(i)}else{let i=Math.max(e.deletions,e.additions);for(let a=0;a<i;a++){if(a<e.deletions){let r=n[e.deletionLineIndex+a];if(r==null)throw console.error({deletionLines:n,content:e,i:a}),Error(`pushContentLinesToDiff: Deletion line does not exist`);t.deletionLines.push(r)}if(a<e.additions){let n=r[e.additionLineIndex+a];if(n==null)throw console.error({additionLines:r,content:e,i:a}),Error(`pushContentLinesToDiff: Addition line does not exist`);t.additionLines.push(n)}}}}function ix(e,t,n,r,i){if(e===`deletions`||e===`both`)for(let e=0;e<t.deletions;e++){let i=r[t.deletionLineIndex+e];if(i==null)throw console.error({deletionLines:r,content:t,i:e}),Error(`pushResolveLinesToDiff: Deletion line does not exist`);n.deletionLines.push(i),n.additionLines.push(i)}if(e===`additions`||e===`both`)for(let e=0;e<t.additions;e++){let r=i[t.additionLineIndex+e];if(r==null)throw console.error({additionLines:i,content:t,i:e}),Error(`pushResolveLinesToDiff: Addition line does not exist`);n.deletionLines.push(r),n.additionLines.push(r)}}function ax(e,t,n){e.type===`context`?(t.nextAdditionLineIndex+=e.lines,t.nextDeletionLineIndex+=e.lines,t.nextAdditionStart+=e.lines,t.nextDeletionStart+=e.lines,t.splitLineCount+=e.lines,t.unifiedLineCount+=e.lines,n.additionCount+=e.lines,n.deletionCount+=e.lines,n.splitLineCount+=e.lines,n.unifiedLineCount+=e.lines):(t.nextAdditionLineIndex+=e.additions,t.nextDeletionLineIndex+=e.deletions,t.nextAdditionStart+=e.additions,t.nextDeletionStart+=e.deletions,t.splitLineCount+=Math.max(e.deletions,e.additions),t.unifiedLineCount+=e.deletions+e.additions,n.deletionCount+=e.deletions,n.deletionLines+=e.deletions,n.additionCount+=e.additions,n.additionLines+=e.additions,n.splitLineCount+=Math.max(e.deletions,e.additions),n.unifiedLineCount+=e.deletions+e.additions)}function ox(e,t,n){return ex(e,{resolution:$b(n),hunkIndex:t.hunkIndex,startContentIndex:t.startContentIndex,endContentIndex:t.endContentIndex,indexesToDelete:sx(t)})}function sx(e){let t=new Set;return e.baseContentIndex!=null&&t.add(e.baseContentIndex),e.endMarkerContentIndex!==e.endContentIndex&&t.add(e.endMarkerContentIndex),t}var cx=-1,lx=class extends sb{options;__id=`unresolved-file:${++cx}`;type=`unresolved-file`;computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0};conflictActions=[];markerRows=[];conflictActionCache=new Map;constructor(e={theme:Dt},t,n=!1){super(void 0,t,n),this.options=e,this.setOptions(e)}setOptions(e){if(e!=null){if(e.onMergeConflictAction!=null&&e.onMergeConflictResolve!=null)throw Error(`UnresolvedFile: onMergeConflictAction and onMergeConflictResolve are mutually exclusive. Use only one callback.`);this.options=e,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions()}}syncInteractionOptions(){this.interactionManager.setOptions(L_(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex,this.handleMergeConflictActionClick))}createHunksRenderer(e){return new Hb(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getHunksRendererOptions(e){return vx(e,this.options)}applyPreNodeAttributes(e,t){super.applyPreNodeAttributes(e,t,{"data-has-merge-conflict":``})}cleanUp(){this.emitPostRender(!0),this.clearMergeConflictActionCache(),this.computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0},this.conflictActions=[],super.cleanUp()}getOrComputeDiff({file:e,fileDiff:t,actions:n,markerRows:r}){let{maxContextLines:i,onMergeConflictAction:a}=this.options;wrapper:if(a!=null){let a=t!=null;if(a!==(n!=null)||a!==(r!=null))throw Error(`UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows must be passed together`);if(t!=null&&n!=null&&r!=null){this.computedCache={file:e??this.computedCache.file,fileDiff:t,actions:n,markerRows:r};break wrapper}else if(e!=null||this.computedCache.file!=null){if(e!=null&&this.computedCache.file!=null&&!mn(e,this.computedCache.file)&&this.computedCache.fileDiff!=null&&this.computedCache.actions!=null)throw Error(`UnresolvedFile.getOrComputeDiff: file can only be used to initialize unresolved state once. Pass fileDiff and actions for subsequent updates.`);if(e??=this.computedCache.file,e==null)throw Error(`UnresolvedFile.getOrComputeDiff: file is null, should be impossible`);if(!mn(e,this.computedCache.file)||this.computedCache.fileDiff==null||this.computedCache.actions==null){let t=Ht(e,i);this.computedCache={file:e,fileDiff:t.fileDiff,actions:t.actions,markerRows:t.markerRows}}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}else{t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}}else{if(t!=null||n!=null||r!=null)throw Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows are only usable in controlled mode, you must pass in `onMergeConflictAction`");if(e!=null&&this.computedCache.file!=null&&!mn(e,this.computedCache.file))throw Error(`UnresolvedFile.getOrComputeDiff: uncontrolled unresolved files parse the file only once. Later updates must come from the cached diff state.`);if(this.computedCache.file??=e,this.computedCache.fileDiff==null&&this.computedCache.file!=null){let e=Ht(this.computedCache.file,i);this.computedCache.fileDiff=e.fileDiff,this.computedCache.actions=e.actions,this.computedCache.markerRows=e.markerRows}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}if(!(t==null||n==null||r==null))return{fileDiff:t,actions:n,markerRows:r}}hydrate(e){let{file:t,fileDiff:n,actions:r,markerRows:i,lineAnnotations:a,fileContainer:o,prerenderedHTML:s,preventEmit:c=!1}=e,l=this.getOrComputeDiff({file:t,fileDiff:n,actions:r,markerRows:i});l!=null&&(this.hydrateElements(o,s),this.setActiveMergeConflictState(l.actions,l.markerRows),gx(this.pre,l.fileDiff,this.options.collapsed)||_x(this.headerElement,l.fileDiff,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):(this.hydrationSetup({fileDiff:l.fileDiff,lineAnnotations:a}),this.pre!=null&&this.renderMergeConflictActionSlots()),c||this.emitPostRender())}rerender(){!this.enabled||this.fileDiff==null||this.render({forceRender:!0,renderRange:this.renderRange})}render(e={}){let{file:t,fileDiff:n,actions:r,markerRows:i,lineAnnotations:a,preventEmit:o=!1,...s}=e,c=this.getOrComputeDiff({file:t,fileDiff:n,actions:r,markerRows:i});if(c==null)return!1;this.setActiveMergeConflictState(c.actions,c.markerRows);let l=super.render({...s,fileDiff:c.fileDiff,lineAnnotations:a,preventEmit:!0});return l&&(this.renderMergeConflictActionSlots(),o||this.emitPostRender()),l}resolveConflict(e,t,n=this.computedCache.fileDiff){let r=this.conflictActions[e];if(n==null||r==null)return;if(r.conflictIndex!==e)throw console.error({conflictIndex:e,action:r}),Error(`UnresolvedFile.resolveConflict: conflictIndex and conflictAction don't match`);let i=ox(n,r,t),a=this.computedCache.file,{file:o,actions:s,markerRows:c}=ux({fileDiff:i,previousActions:this.conflictActions,resolvedConflictIndex:e,previousFile:a,resolution:t});return{file:o,fileDiff:i,actions:s,markerRows:c}}resolveConflictAndRender(e,t){let n=this.conflictActions[e];if(n==null)return;if(n.conflictIndex!==e)throw console.error({conflictIndex:e,action:n}),Error(`UnresolvedFile.resolveConflictAndRender: conflictIndex and conflictAction don't match`);let r={resolution:t,conflict:n.conflict},{file:i,fileDiff:a,actions:o,markerRows:s}=this.resolveConflict(e,t)??{};i==null||a==null||o==null||s==null||(this.computedCache={file:i,fileDiff:a,actions:o,markerRows:s},this.setActiveMergeConflictState(o,s),this.workerManager==null?this.render({forceRender:!0}):this.hunksRenderer.renderDiff(a),this.options.onMergeConflictResolve?.(i,r))}setActiveMergeConflictState(e=this.conflictActions,t=this.markerRows){this.conflictActions=e,this.markerRows=t,this.computedCache.fileDiff!=null&&this.hunksRenderer instanceof Hb&&this.hunksRenderer.setConflictState(this.options.mergeConflictActionsType===`none`?[]:e,t,this.computedCache.fileDiff)}handleMergeConflictActionClick=e=>{let t=this.conflictActions[e.conflictIndex];if(t==null)return;if(t.conflictIndex!==e.conflictIndex)throw console.error({conflictIndex:e.conflictIndex,action:t}),Error(`UnresolvedFile.handleMergeConflictActionClick: conflictIndex and conflictAction don't match`);let n={resolution:e.resolution,conflict:t.conflict};if(this.options.onMergeConflictAction!=null){this.options.onMergeConflictAction(n,this);return}this.resolveConflictAndRender(e.conflictIndex,e.resolution)};renderMergeConflictActionSlots(){let{fileDiff:e}=this.computedCache;if(this.isContainerManaged||this.fileContainer==null||typeof this.options.mergeConflictActionsType!=`function`||this.conflictActions.length===0||e==null){this.clearMergeConflictActionCache();return}let t=new Map(this.conflictActionCache);for(let n=0;n<this.conflictActions.length;n++){let r=this.conflictActions[n];if(r==null)continue;if(r.conflictIndex!==n)throw console.error({conflictIndex:n,action:r}),Error(`UnresolvedFile.renderMergeConflictActionSlots: conflictIndex and conflictAction don't match`);let i=Vt(r,e);if(i==null)continue;let a=r.conflictIndex,o=Rt({hunkIndex:i.hunkIndex,lineIndex:i.lineIndex,conflictIndex:a}),s=`${n}-${o}`,c=this.conflictActionCache.get(s);if(c==null||!Zb(c.action,r)){c?.element.remove();let e=this.renderMergeConflictAction(r);if(e==null)continue;let t=Mv(o);t.appendChild(e),this.fileContainer.appendChild(t),c={element:t,action:r},this.conflictActionCache.set(s,c)}t.delete(s)}for(let[e,{element:n}]of t.entries())this.conflictActionCache.delete(e),n.remove()}renderMergeConflictAction(e){if(typeof this.options.mergeConflictActionsType!=`function`)return;let t=this.options.mergeConflictActionsType(e,this);if(t!=null){if(t instanceof HTMLElement)return t;if(typeof DocumentFragment<`u`&&t instanceof DocumentFragment){let e=document.createElement(`div`);return e.style.display=`contents`,e.appendChild(t),e}}}clearMergeConflictActionCache(){for(let{element:e}of this.conflictActionCache.values())e.remove();this.conflictActionCache.clear()}};function ux({fileDiff:e,previousActions:t,resolvedConflictIndex:n,previousFile:r,resolution:i}){let a=t[n];if(a==null)throw Error(`rebuildFileAndActions: missing resolved action for unresolved file rebuild`);let o=px(t,n,a,i),s=sn(e,o);return{file:dx({fileDiff:e,resolvedAction:a,resolvedConflictIndex:n,previousFile:r,resolution:i}),actions:o,markerRows:s}}function dx({resolvedAction:e,resolvedConflictIndex:t,previousFile:n,fileDiff:r,resolution:i}){let a=by(n?.contents??``),{conflict:o}=e,s=fx(a,o,i),c=[...a.slice(0,o.startLineIndex),...s,...a.slice(o.endLineIndex+1)].join(``);return{name:n?.name??r.name,contents:c,cacheKey:n?.cacheKey==null?void 0:`${n.cacheKey}:mc-${t}-${i}`}}function fx(e,t,n){let r=e.slice(t.startLineIndex+1,t.baseMarkerLineIndex??t.separatorLineIndex),i=e.slice(t.separatorLineIndex+1,t.endLineIndex);return n===`current`?r:n===`incoming`?i:[...r,...i]}function px(e,t,n,r){let i=mx(n.conflict,r);return e.map((e,r)=>{if(r!==t&&e!=null)return e.conflict.startLineIndex>n.conflict.endLineIndex?{...e,conflict:hx(e.conflict,i)}:e})}function mx(e,t){let n=(e.baseMarkerLineIndex??e.separatorLineIndex)-e.startLineIndex-1,r=e.endLineIndex-e.separatorLineIndex-1;return(t===`current`?n:t===`incoming`?r:n+r)-(e.endLineIndex-e.startLineIndex+1)}function hx(e,t){return{...e,startLineIndex:e.startLineIndex+t,startLineNumber:e.startLineNumber+t,separatorLineIndex:e.separatorLineIndex+t,separatorLineNumber:e.separatorLineNumber+t,endLineIndex:e.endLineIndex+t,endLineNumber:e.endLineNumber+t,baseMarkerLineIndex:e.baseMarkerLineIndex==null?void 0:e.baseMarkerLineIndex+t,baseMarkerLineNumber:e.baseMarkerLineNumber==null?void 0:e.baseMarkerLineNumber+t}}function gx(e,t,n=!1){return!n&&e==null&&t!=null}function _x(e,t,n=!1){return e==null&&t!=null&&!n}function vx(e,t){let n={...t,...e};return{...n,useTokenTransformer:Gv(n),hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,mergeConflictActionsType:typeof e?.mergeConflictActionsType==`function`?`custom`:e?.mergeConflictActionsType}}var yx=typeof window>`u`?J.useEffect:J.useLayoutEffect;function bx({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,hasConflictUtility:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c}){let[{fileDiff:l,actions:u,markerRows:d},f]=(0,J.useState)(()=>{let{fileDiff:n,actions:r,markerRows:i}=Ht(e,t?.maxContextLines);return{fileDiff:n,actions:r,markerRows:i}}),p=st((e,t)=>{f(n=>{let{fileDiff:r,actions:i,markerRows:a}=t.resolveConflict(e.conflict.conflictIndex,e.resolution,n.fileDiff)??{};return r==null||i==null||a==null?n:{fileDiff:r,actions:i,markerRows:a}})}),m=r!==void 0,h=(0,J.useContext)(Nh),g=(0,J.useRef)(null),_=st(e=>{if(e!=null){if(g.current!=null)throw Error(`useUnresolvedFileInstance: An instance should not already exist when a node is created`);g.current=new lx(xx({controlledSelection:m,hasConflictUtility:a,hasCustomHeader:s,hasGutterRenderUtility:o,onMergeConflictAction:p,options:t}),c?void 0:h,!0),g.current.hydrate({fileDiff:l,actions:u,markerRows:d,fileContainer:e,lineAnnotations:n,prerenderedHTML:i})}else{if(g.current==null)throw Error(`useUnresolvedFileInstance: A UnresolvedFile instance should exist when unmounting`);g.current.cleanUp(),g.current=null}});return yx(()=>{if(g.current==null)return;let e=g.current,i=xx({controlledSelection:m,hasConflictUtility:a,hasCustomHeader:s,hasGutterRenderUtility:o,onMergeConflictAction:p,options:t}),c=i!==void 0&&!Rh(e.options,i);e.setOptions(i),e.render({fileDiff:l,actions:u,markerRows:d,lineAnnotations:n,forceRender:c}),r!==void 0&&e.setSelectedLines(r)}),{ref:_,getHoveredLine:(0,J.useCallback)(()=>g.current?.getHoveredLine(),[]),fileDiff:l,actions:u,markerRows:d,getInstance:(0,J.useCallback)(()=>g.current??void 0,[])}}function xx({options:e,controlledSelection:t,onMergeConflictAction:n,hasConflictUtility:r,hasCustomHeader:i,hasGutterRenderUtility:a}){return{...e,controlledSelection:t,onMergeConflictAction:n,hunkSeparators:e?.hunkSeparators===`custom`?pt:e?.hunkSeparators,mergeConflictActionsType:r||e?.mergeConflictActionsType===`custom`?pt:e?.mergeConflictActionsType,renderCustomHeader:i?pt:void 0,renderGutterUtility:a?pt:void 0}}function Sx({file:e,options:t,lineAnnotations:n,selectedLines:r,className:i,style:a,prerenderedHTML:o,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderFilenameSuffix:u,renderHeaderMetadata:d,renderGutterUtility:f,renderMergeConflictUtility:p,disableWorkerPool:m=!1}){let{ref:h,getHoveredLine:g,fileDiff:_,actions:v,getInstance:y}=bx({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:o,hasConflictUtility:p!=null,hasGutterRenderUtility:f!=null,hasCustomHeader:c!=null,disableWorkerPool:m});return(0,Y.jsx)(ht,{ref:h,className:i,style:a,children:Ab(un({fileDiff:_,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderFilenameSuffix:u,renderHeaderMetadata:d,renderAnnotation:s,renderGutterUtility:f,lineAnnotations:n,getHoveredLine:g,actions:v,renderMergeConflictUtility:p,getInstance:y}),o)})}function Cx(e){return new Worker(`/assets/worker-BJu97yub.js`,{name:e?.name})}var wx=typeof document<`u`?J.useLayoutEffect:()=>{};function Tx(e,...t){let n=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var Ex=J.createContext(void 0);function Dx(e){let t=J.useContext(Ex);if(t===void 0&&!e)throw Error(Tx(72));return t}var Ox={};function kx(e,t){let n=J.useRef(Ox);return n.current===Ox&&(n.current=e(t)),n}var Ax=[];function jx(e){J.useEffect(e,Ax)}var Mx=0,Nx=class e{static create(){return new e}currentId=Mx;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Mx,t()},e)}isStarted(){return this.currentId!==Mx}clear=()=>{this.currentId!==Mx&&(clearTimeout(this.currentId),this.currentId=Mx)};disposeEffect=()=>this.clear};function Px(){let e=kx(Nx.create).current;return jx(e.disposeEffect),e}function Fx(){return typeof window<`u`}function Ix(e){return zx(e)?(e.nodeName||``).toLowerCase():`#document`}function Lx(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rx(e){return((zx(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function zx(e){return Fx()?e instanceof Node||e instanceof Lx(e).Node:!1}function Bx(e){return Fx()?e instanceof Element||e instanceof Lx(e).Element:!1}function Vx(e){return Fx()?e instanceof HTMLElement||e instanceof Lx(e).HTMLElement:!1}function Hx(e){return!Fx()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Lx(e).ShadowRoot}function Ux(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=eS(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Wx(e){return/^(table|td|th)$/.test(Ix(e))}function Gx(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Kx=/transform|translate|scale|rotate|perspective|filter/,qx=/paint|layout|strict|content/,Jx=e=>!!e&&e!==`none`,Yx;function Xx(e){let t=Bx(e)?eS(e):e;return Jx(t.transform)||Jx(t.translate)||Jx(t.scale)||Jx(t.rotate)||Jx(t.perspective)||!Qx()&&(Jx(t.backdropFilter)||Jx(t.filter))||Kx.test(t.willChange||``)||qx.test(t.contain||``)}function Zx(e){let t=nS(e);for(;Vx(t)&&!$x(t);){if(Xx(t))return t;if(Gx(t))return null;t=nS(t)}return null}function Qx(){return Yx??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Yx}function $x(e){return/^(html|body|#document)$/.test(Ix(e))}function eS(e){return Lx(e).getComputedStyle(e)}function tS(e){return Bx(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function nS(e){if(Ix(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Hx(e)&&e.host||Rx(e);return Hx(t)?t.host:t}function rS(e){let t=nS(e);return $x(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vx(t)&&Ux(t)?t:rS(t)}function iS(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=rS(e),i=r===e.ownerDocument?.body,a=Lx(r);if(i){let e=aS(a);return t.concat(a,a.visualViewport||[],Ux(r)?r:[],e&&n?iS(e):[])}else return t.concat(r,iS(r,[],n))}function aS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function oS(e){let t=kx(sS,e).current;return t.next=e,wx(t.effect),t}function sS(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var cS=J[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],lS=cS&&cS!==J.useLayoutEffect?cS:e=>e();function uS(e){let t=kx(dS).current;return t.next=e,lS(t.effect),t.trampoline}function dS(){let e={next:void 0,callback:fS,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function fS(){}var pS=typeof navigator<`u`,mS=CS(),hS=TS(),gS=wS(),_S=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),vS=mS.platform===`MacIntel`&&mS.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(mS.platform);pS&&/firefox/i.test(gS);var yS=pS&&/apple/i.test(navigator.vendor);pS&&/Edg/i.test(gS);var bS=pS&&/android/i.test(hS)||/android/i.test(gS),xS=pS&&hS.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,SS=gS.includes(`jsdom/`);function CS(){if(!pS)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function wS(){if(!pS)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function TS(){if(!pS)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}var ES=`data-base-ui-focusable`,DS=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,OS=`ArrowLeft`,kS=`ArrowRight`,AS=`ArrowUp`,jS=`ArrowDown`;function MS(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function NS(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Hx(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function PS(e){return`composedPath`in e?e.composedPath()[0]:e.target}function FS(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function IS(e){return e.matches(`html,body`)}function LS(e){return e?.ownerDocument||document}function RS(e){return Vx(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function zS(e){return e?e.getAttribute(`role`)===`combobox`&&RS(e):!1}function BS(e){if(!e||SS)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function VS(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function HS(e,t,n=!0){return e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...HS(e,t.id,n)])}function US(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function WS(e){e.preventDefault(),e.stopPropagation()}function GS(e){return`nativeEvent`in e}function KS(e){return e.mozInputSource===0&&e.isTrusted?!0:bS&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function qS(e){return SS?!1:!bS&&e.width===0&&e.height===0||bS&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function JS(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function YS(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var XS=[`top`,`right`,`bottom`,`left`],ZS=Math.min,QS=Math.max,$S=Math.round,eC=Math.floor,tC=e=>({x:e,y:e}),nC={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function rC(e,t,n){return QS(e,ZS(t,n))}function iC(e,t){return typeof e==`function`?e(t):e}function aC(e){return e.split(`-`)[0]}function oC(e){return e.split(`-`)[1]}function sC(e){return e===`x`?`y`:`x`}function cC(e){return e===`y`?`height`:`width`}function lC(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function uC(e){return sC(lC(e))}function dC(e,t,n){n===void 0&&(n=!1);let r=oC(e),i=uC(e),a=cC(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=bC(o)),[o,bC(o)]}function fC(e){let t=bC(e);return[pC(e),t,pC(t)]}function pC(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var mC=[`left`,`right`],hC=[`right`,`left`],gC=[`top`,`bottom`],_C=[`bottom`,`top`];function vC(e,t,n){switch(e){case`top`:case`bottom`:return n?t?hC:mC:t?mC:hC;case`left`:case`right`:return t?gC:_C;default:return[]}}function yC(e,t,n,r){let i=oC(e),a=vC(aC(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(pC)))),a}function bC(e){let t=aC(e);return nC[t]+e.slice(t.length)}function xC(e){return{top:0,right:0,bottom:0,left:0,...e}}function SC(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:xC(e)}function CC(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function wC(e,t,n){return Math.floor(e/t)!==n}function TC(e,t){return t<0||t>=e.current.length}function EC(e,t){return OC(e,{disabledIndices:t})}function DC(e,t){return OC(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function OC(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.current.length-1&&NC(e,a,r));return a}function kC(e,{event:t,orientation:n,loopFocus:r,rtl:i,cols:a,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:l,stopEvent:u=!1}){let d=l,f=[],p={},m=!1;{let t=null,n=-1;e.current.forEach((e,r)=>{if(e==null)return;let i=e.closest(`[role="row"]`);i&&(m=!0),(i!==t||n===-1)&&(t=i,n+=1,f[n]=[]),f[n].push(r),p[r]=n})}let h=m&&f.length>0&&f.some(e=>e.length!==a);function g(t){if(!h||l===-1)return;let n=p[l];if(n==null)return;let i=f[n].indexOf(l),a=t===`up`?n-1:n+1;r&&(a<0?a=f.length-1:a>=f.length&&(a=0));let s=new Set;for(;a>=0&&a<f.length&&!s.has(a);){s.add(a);let n=f[a];if(n.length===0){a=t===`up`?a-1:a+1;continue}let c=Math.min(i,n.length-1);for(let t=c;t>=0;--t){let r=n[t];if(!NC(e,r,o))return r}a=t===`up`?a-1:a+1,r&&(a<0?a=f.length-1:a>=f.length&&(a=0))}}if(t.key===`ArrowUp`){let n=g(`up`);if(n!==void 0)u&&WS(t),d=n;else{if(u&&WS(t),l===-1)d=c;else if(d=OC(e,{startingIndex:d,amount:a,decrement:!0,disabledIndices:o}),r&&(l-a<s||d<0)){let e=l%a,t=c%a,n=c-(t-e);d=t===e?c:t>e?n:n-a}TC(e,d)&&(d=l)}}if(t.key===`ArrowDown`){let n=g(`down`);n===void 0?(u&&WS(t),l===-1?d=s:(d=OC(e,{startingIndex:l,amount:a,disabledIndices:o}),r&&l+a>c&&(d=OC(e,{startingIndex:l%a-a,amount:a,disabledIndices:o}))),TC(e,d)&&(d=l)):(u&&WS(t),d=n)}if(n===`both`){let n=eC(l/a);t.key===(i?`ArrowLeft`:`ArrowRight`)&&(u&&WS(t),l%a===a-1?r&&(d=OC(e,{startingIndex:l-l%a-1,disabledIndices:o})):(d=OC(e,{startingIndex:l,disabledIndices:o}),r&&wC(d,a,n)&&(d=OC(e,{startingIndex:l-l%a-1,disabledIndices:o}))),wC(d,a,n)&&(d=l)),t.key===(i?`ArrowRight`:`ArrowLeft`)&&(u&&WS(t),l%a===0?r&&(d=OC(e,{startingIndex:l+(a-l%a),decrement:!0,disabledIndices:o})):(d=OC(e,{startingIndex:l,decrement:!0,disabledIndices:o}),r&&wC(d,a,n)&&(d=OC(e,{startingIndex:l+(a-l%a),decrement:!0,disabledIndices:o}))),wC(d,a,n)&&(d=l));let s=eC(c/a)===n;TC(e,d)&&(d=r&&s?t.key===(i?`ArrowRight`:`ArrowLeft`)?c:OC(e,{startingIndex:l-l%a-1,disabledIndices:o}):l)}return d}function AC(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function jC(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function MC(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function NC(e,t,n){if(typeof n==`function`)return n(t);if(n)return n.includes(t);let r=e.current[t];return r?r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`:!1}var PC=[`input:not([inert]):not([inert] *)`,`select:not([inert]):not([inert] *)`,`textarea:not([inert]):not([inert] *)`,`a[href]:not([inert]):not([inert] *)`,`button:not([inert]):not([inert] *)`,`[tabindex]:not(slot):not([inert]):not([inert] *)`,`audio[controls]:not([inert]):not([inert] *)`,`video[controls]:not([inert]):not([inert] *)`,`[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)`,`details>summary:first-of-type:not([inert]):not([inert] *)`,`details:not([inert]):not([inert] *)`].join(`,`),FC=typeof Element>`u`,IC=FC?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,LC=!FC&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},RC=function(e,t){t===void 0&&(t=!0);var n=e?.getAttribute?.call(e,`inert`);return n===``||n===`true`||t&&e&&(typeof e.closest==`function`?e.closest(`[inert]`):RC(e.parentNode))},zC=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},BC=function(e,t,n){if(RC(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(PC));return t&&IC.call(e,PC)&&r.unshift(e),r=r.filter(n),r},VC=function(e,t,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!RC(a,!1))if(a.tagName===`SLOT`){var o=a.assignedElements(),s=VC(o.length?o:a.children,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:a,candidates:s})}else{IC.call(a,PC)&&n.filter(a)&&(t||!e.includes(a))&&r.push(a);var c=a.shadowRoot||typeof n.getShadowRoot==`function`&&n.getShadowRoot(a),l=!RC(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(c&&l){var u=VC(c===!0?a.children:c.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return r},HC=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},UC=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||zC(e))&&!HC(e)?0:e.tabIndex},WC=function(e,t){var n=UC(e);return n<0&&t&&!HC(e)?0:n},GC=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},KC=function(e){return e.tagName===`INPUT`},qC=function(e){return KC(e)&&e.type===`hidden`},JC=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},YC=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},XC=function(e){if(!e.name)return!0;var t=e.form||LC(e),n=function(e){return t.querySelectorAll(`input[type="radio"][name="`+e+`"]`)},r;if(typeof window<`u`&&window.CSS!==void 0&&typeof window.CSS.escape==`function`)r=n(window.CSS.escape(e.name));else try{r=n(e.name)}catch(e){return console.error(`Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s`,e.message),!1}var i=YC(r,e.form);return!i||i===e},ZC=function(e){return KC(e)&&e.type===`radio`},QC=function(e){return ZC(e)&&!XC(e)},$C=function(e){var t=e&&LC(e),n=t?.host,r=!1;if(t&&t!==e){var i,a,o;for(r=!!((i=n)!=null&&(a=i.ownerDocument)!=null&&a.contains(n)||e!=null&&(o=e.ownerDocument)!=null&&o.contains(e));!r&&n;){var s,c;t=LC(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},ew=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},tw=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(n===`full-native`&&`checkVisibility`in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if(getComputedStyle(e).visibility===`hidden`)return!0;var i=IC.call(e,`details>summary:first-of-type`)?e.parentElement:e;if(IC.call(i,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`full-native`||n===`legacy-full`){if(typeof r==`function`){for(var a=e;e;){var o=e.parentElement,s=LC(e);if(o&&!o.shadowRoot&&r(o)===!0)return ew(e);e=e.assignedSlot?e.assignedSlot:!o&&s!==e.ownerDocument?s.host:o}e=a}if($C(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return ew(e);return!1},nw=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName===`FIELDSET`&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if(r.tagName===`LEGEND`)return IC.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},rw=function(e,t){return!(t.disabled||qC(t)||tw(t,e)||JC(t)||nw(t))},iw=function(e,t){return!(QC(t)||UC(t)<0||!rw(e,t))},aw=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},ow=function(e){var t=[],n=[];return e.forEach(function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,o=WC(a,i),s=i?ow(e.candidates):a;o===0?i?t.push.apply(t,s):t.push(a):n.push({documentOrder:r,tabIndex:o,item:e,isScope:i,content:s})}),n.sort(GC).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},sw=function(e,t){return t||={},ow(t.getShadowRoot?VC([e],t.includeContainer,{filter:iw.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:aw}):BC(e,t.includeContainer,iw.bind(null,t)))},cw=function(e,t){return t||={},t.getShadowRoot?VC([e],t.includeContainer,{filter:rw.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):BC(e,t.includeContainer,rw.bind(null,t))},lw=function(e,t){if(t||={},!e)throw Error(`No node provided`);return IC.call(e,PC)===!1?!1:iw(t,e)},uw=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`});function dw(e,t){let n=sw(e,uw()),r=n.length;if(r===0)return;let i=MS(LS(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function fw(e){return dw(LS(e).body,1)||e}function pw(e){return dw(LS(e).body,-1)||e}function mw(e,t){if(!e)return null;let n=sw(LS(e).body,uw()),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function hw(e){return mw(e,1)}function gw(e){return mw(e,-1)}function _w(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!NS(n,r)}function vw(e){sw(e,uw()).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function yw(e){e.querySelectorAll(`[data-tabindex]`).forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var bw={...J},xw=0;function Sw(e,t=`mui`){let[n,r]=J.useState(e),i=e||n;return J.useEffect(()=>{n??(xw+=1,r(`${t}-${xw}`))},[n,t]),i}var Cw=bw.useId;function ww(e,t){if(Cw!==void 0){let n=Cw();return e??(t?`${t}-${n}`:n)}return Sw(e,t)}function Tw(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var Ew=class{nodesRef={current:[]};events=Tw();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},Dw=J.createContext(null),Ow=J.createContext(null),kw=()=>J.useContext(Dw)?.id||null,Aw=e=>{let t=J.useContext(Ow);return e??t};function jw(e){let t=ww(),n=Aw(e),r=kw();return wx(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Mw(e){let{children:t,id:n}=e,r=kw();return(0,Y.jsx)(Dw.Provider,{value:J.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Nw(e){let{children:t,externalTree:n}=e,r=kx(()=>n??new Ew).current;return(0,Y.jsx)(Ow.Provider,{value:r,children:t})}function Pw(){}var Fw=Object.freeze([]),Iw=Object.freeze({}),Lw={style:{transition:`none`}},Rw=`data-base-ui-click-trigger`,zw={fallbackAxisSide:`none`},Bw={fallbackAxisSide:`end`},Vw={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},Hw=`none`,Uw=`trigger-press`,Ww=`trigger-hover`,Gw=`trigger-focus`,Kw=`outside-press`,qw=`item-press`,Jw=`focus-out`,Yw=`escape-key`,Xw=`list-navigation`,Zw=`cancel-open`,Qw=`disabled`,$w=`imperative-action`,eT=`window-resize`;function tT(e,t,n,r){let i=!1,a=!1,o=r??Iw;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function nT(e){return`data-base-ui-${e}`}nT(`safe-polygon`),`${DS}`;function rT(e,t,n){if(n&&!JS(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}var iT=J.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Nx,currentIdRef:{current:null},currentContextRef:{current:null}});function aT(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=J.useRef(n),a=J.useRef(n),o=J.useRef(null),s=J.useRef(null),c=Px();return(0,Y.jsx)(iT.Provider,{value:J.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function oT(e,t={open:!1}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`floatingId`),{enabled:i=!0,open:a}=t,{currentIdRef:o,delayRef:s,timeoutMs:c,initialDelayRef:l,currentContextRef:u,hasProvider:d,timeout:f}=J.useContext(iT),[p,m]=J.useState(!1);return wx(()=>{function e(){m(!1),u.current?.setIsInstantPhase(!1),o.current=null,u.current=null,s.current=l.current}if(i&&o.current&&!a&&o.current===r){if(m(!1),c)return f.start(c,e),()=>{f.clear()};e()}},[i,a,r,o,s,c,l,u,f]),wx(()=>{if(!i||!a)return;let e=u.current,t=o.current;u.current={onOpenChange:n.setOpen,setIsInstantPhase:m},o.current=r,s.current={open:0,close:rT(l.current,`close`)},t!==null&&t!==r?(f.clear(),m(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,tT(Hw))):(m(!1),e?.setIsInstantPhase(!1))},[i,a,r,n,o,s,c,l,u,f]),wx(()=>()=>{u.current=null},[u]),J.useMemo(()=>({hasProvider:d,delayRef:s,isInstantPhase:p}),[d,s,p])}function sT(e,t,n,r){let i=kx(lT).current;return uT(i,e,t,n,r)&&fT(i,[e,t,n,r]),i.callback}function cT(e){let t=kx(lT).current;return dT(t,e)&&fT(t,e),t.callback}function lT(){return{callback:null,cleanup:null,refs:[]}}function uT(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function dT(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function fT(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var pT={clip:`rect(0 0 0 0)`,overflow:`hidden`,whiteSpace:`nowrap`,position:`fixed`,top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1},mT=null;globalThis.requestAnimationFrame;var hT=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},gT=class e{static create(){return new e}static request(e){return hT.request(e)}static cancel(e){return hT.cancel(e)}currentId=mT;request(e){this.cancel(),this.currentId=hT.request(()=>{this.currentId=mT,e()})}cancel=()=>{this.currentId!==mT&&(hT.cancel(this.currentId),this.currentId=mT)};disposeEffect=()=>this.cancel};function _T(){let e=kx(gT.create).current;return jx(e.disposeEffect),e}function vT(e){return e?.ownerDocument||document}var yT=J.forwardRef(function(e,t){let[n,r]=J.useState();wx(()=>{yS&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,Y.jsx)(`span`,{...e,ref:t,style:pT,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),bT=0;function xT(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(bT);let a=()=>e?.focus({preventScroll:n});i?a():bT=requestAnimationFrame(a)}var ST={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function CT(e){return e===`inert`?ST.inert:e===`aria-hidden`?ST[`aria-hidden`]:ST.none}var wT=new WeakSet,TT={},ET=0,DT=e=>e&&(e.host||DT(e.parentNode)),OT=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=DT(t);return e.contains(n)?n:null}).filter(e=>e!=null);function kT(e,t,n,r){let i=`data-base-ui-inert`,a=r?`inert`:n?`aria-hidden`:null,o=OT(t,e),s=new Set,c=new Set(o),l=[];TT[i]||(TT[i]=new WeakMap);let u=TT[i];o.forEach(d),f(t),s.clear();function d(e){!e||s.has(e)||(s.add(e),e.parentNode&&d(e.parentNode))}function f(e){!e||c.has(e)||[].forEach.call(e.children,e=>{if(Ix(e)!==`script`)if(s.has(e))f(e);else{let t=a?e.getAttribute(a):null,n=t!==null&&t!==`false`,r=CT(a),o=(r.get(e)||0)+1,s=(u.get(e)||0)+1;r.set(e,o),u.set(e,s),l.push(e),o===1&&n&&wT.add(e),s===1&&e.setAttribute(i,``),!n&&a&&e.setAttribute(a,a===`inert`?``:`true`)}})}return ET+=1,()=>{l.forEach(e=>{let t=CT(a),n=(t.get(e)||0)-1,r=(u.get(e)||0)-1;t.set(e,n),u.set(e,r),n||(!wT.has(e)&&a&&e.removeAttribute(a),wT.delete(e)),r||e.removeAttribute(i)}),--ET,ET||(ST.inert=new WeakMap,ST[`aria-hidden`]=new WeakMap,ST.none=new WeakMap,wT=new WeakSet,TT={})}}function AT(e,t=!1,n=!1){let r=LS(e[0]).body;return kT(e.concat(Array.from(r.querySelectorAll(`[aria-live]`))),r,t,n)}var jT=19;function MT(e){return jT>=e}function NT(e){if(!J.isValidElement(e))return null;let t=e,n=t.props;return(MT(19)?n?.ref:t.ref)??null}function PT(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function FT(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function IT(e,t){return typeof e==`function`?e(t):e}function LT(e,t){return typeof e==`function`?e(t):e}var RT={};function zT(e,t,n,r,i){let a={...GT(e,RT)};return t&&(a=VT(a,t)),n&&(a=VT(a,n)),r&&(a=VT(a,r)),i&&(a=VT(a,i)),a}function BT(e){if(e.length===0)return RT;if(e.length===1)return GT(e[0],RT);let t={...GT(e[0],RT)};for(let n=1;n<e.length;n+=1)t=VT(t,e[n]);return t}function VT(e,t){return WT(t)?t(e):HT(e,t)}function HT(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=PT(e.style,r);break;case`className`:e[n]=JT(e.className,r);break;default:UT(n,r)?e[n]=KT(e[n],r):e[n]=r}}return e}function UT(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function WT(e){return typeof e==`function`}function GT(e,t){return WT(e)?e(t):e??RT}function KT(e,t){return t?e?n=>{if(YT(n)){let r=n;qT(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function qT(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function JT(e,t){return t?e?t+` `+e:t:e}function YT(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function XT(e,t,n={}){let r=t.render,i=ZT(t,n);return n.enabled===!1?null:QT(e,r,i,n.state??Iw)}function ZT(e,t={}){let{className:n,style:r,render:i}=e,{state:a=Iw,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?IT(n,a):void 0,d=l?LT(r,a):void 0,f=l?FT(a,c):Iw,p=l?PT(f,Array.isArray(s)?BT(s):s)??Iw:Iw;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=cT([p.ref,NT(i),...o]):p.ref=sT(p.ref,NT(i),o):sT(null,null)),l?(u!==void 0&&(p.className=JT(p.className,u)),d!==void 0&&(p.style=PT(p.style,d)),p):Iw}function QT(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=zT(n,t.props);return e.ref=n.ref,J.cloneElement(t,e)}if(e&&typeof e==`string`)return $T(e,n);throw Error(Tx(8))}function $T(e,t){return e===`button`?(0,J.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,J.createElement)(`img`,{alt:``,...t,key:t.key}):J.createElement(e,t)}var eE=J.createContext(null),tE=()=>J.useContext(eE),nE=nT(`portal`);function rE(e={}){let{ref:t,container:n,componentProps:r=Iw,elementProps:i,elementState:a}=e,o=ww(),s=tE()?.portalNode,[c,l]=J.useState(null),[u,d]=J.useState(null),f=J.useRef(null);wx(()=>{if(n===null){f.current&&(f.current=null,d(null),l(null));return}if(o==null)return;let e=(n&&(zx(n)?n:n.current))??s??document.body;if(e==null){f.current&&(f.current=null,d(null),l(null));return}f.current!==e&&(f.current=e,d(null),l(e))},[n,s,o]);let p=XT(`div`,r,{ref:[t,d],state:a,props:[{id:o,[nE]:``},i]});return{portalNode:u,portalSubtree:c&&p?ec.createPortal(p,c):null}}var iE=J.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,...s}=e,{portalNode:c,portalSubtree:l}=rE({container:r,ref:t,componentProps:e,elementProps:s}),u=J.useRef(null),d=J.useRef(null),f=J.useRef(null),p=J.useRef(null),[m,h]=J.useState(null),g=m?.modal,_=m?.open,v=typeof o==`boolean`?o:!!m&&!m.modal&&m.open&&!!c;J.useEffect(()=>{if(!c||g)return;function e(e){c&&_w(e)&&(e.type===`focusin`?yw:vw)(c)}return c.addEventListener(`focusin`,e,!0),c.addEventListener(`focusout`,e,!0),()=>{c.removeEventListener(`focusin`,e,!0),c.removeEventListener(`focusout`,e,!0)}},[c,g]),J.useEffect(()=>{!c||_||yw(c)},[_,c]);let y=J.useMemo(()=>({beforeOutsideRef:u,afterOutsideRef:d,beforeInsideRef:f,afterInsideRef:p,portalNode:c,setFocusManagerState:h}),[c]);return(0,Y.jsxs)(J.Fragment,{children:[l,(0,Y.jsxs)(eE.Provider,{value:y,children:[v&&c&&(0,Y.jsx)(yT,{"data-type":`outside`,ref:u,onFocus:e=>{_w(e,c)?f.current?.focus():pw(m?m.domReference:null)?.focus()}}),v&&c&&(0,Y.jsx)(`span`,{"aria-owns":c.id,style:Vw}),c&&ec.createPortal(n,c),v&&c&&(0,Y.jsx)(yT,{"data-type":`outside`,ref:d,onFocus:e=>{_w(e,c)?p.current?.focus():(fw(m?m.domReference:null)?.focus(),m?.closeOnFocusOut&&m?.onOpenChange(!1,tT(`focus-out`,e.nativeEvent)))}})]})]})});function aE(e){return e==null?e:`current`in e?e.current:e}function oE(e,t){let n=Lx(e.target);return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var sE=20,cE=[];function lE(){cE=cE.filter(e=>e.isConnected)}function uE(e){lE(),e&&Ix(e)!==`body`&&(cE.push(e),cE.length>sE&&(cE=cE.slice(-sE)))}function dE(){return lE(),cE[cE.length-1]}function fE(e){if(!e)return null;let t=uw();return lw(e,t)?e:sw(e,t)[0]||e}function pE(e){return!e||!e.isConnected?!1:typeof e.checkVisibility==`function`?e.checkVisibility():eS(e).display!==`none`}function mE(e,t){if(!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=uw(),r=cw(e,n).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return lw(e,n)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),i=e.getAttribute(`tabindex`);t.current.includes(`floating`)||r.length===0?i!==`0`&&e.setAttribute(`tabindex`,`0`):(i!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function hE(e){let{context:t,children:n,disabled:r=!1,order:i=[`content`],initialFocus:a=!0,returnFocus:o=!0,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,getInsideElements:d=()=>[],nextFocusableElement:f,previousFocusableElement:p,beforeContentFocusGuardRef:m,externalTree:h}=e,g=`rootStore`in t?t.rootStore:t,_=g.useState(`open`),v=g.useState(`domReferenceElement`),y=g.useState(`floatingElement`),{events:b,dataRef:x}=g.context,S=uS(()=>x.current.floatingContext?.nodeId),C=uS(d),w=a===!1,T=zS(v)&&w,E=oS(i),D=oS(a),O=oS(o),k=oS(u),A=Aw(h),j=tE(),M=J.useRef(null),N=J.useRef(null),P=J.useRef(!1),F=J.useRef(!1),I=J.useRef(!1),L=J.useRef(-1),R=J.useRef(``),z=J.useRef(``),B=Px(),V=Px(),H=_T(),U=j!=null,W=VS(y),ee=uS((e=W)=>e?sw(e,uw()):[]),te=uS(e=>{let t=ee(e);return E.current.map(()=>t).filter(Boolean).flat()});J.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&NS(W,MS(LS(W)))&&ee().length===0&&!T&&WS(e)}let t=LS(W);return t.addEventListener(`keydown`,e),()=>{t.removeEventListener(`keydown`,e)}},[r,v,W,c,E,T,ee,te]),J.useEffect(()=>{if(r||!y)return;function e(e){let t=PS(e),n=ee().indexOf(t);n!==-1&&(L.current=n)}return y.addEventListener(`focusin`,e),()=>{y.removeEventListener(`focusin`,e)}},[r,y,ee]),J.useEffect(()=>{if(r||!_)return;let e=LS(W);function t(){I.current=!1}function n(e){let t=PS(e);I.current=!(NS(y,t)||NS(v,t)||NS(j?.portalNode,t)),z.current=e.pointerType||`keyboard`}function i(){z.current=`keyboard`}return e.addEventListener(`pointerdown`,n,!0),e.addEventListener(`pointerup`,t,!0),e.addEventListener(`pointercancel`,t,!0),e.addEventListener(`keydown`,i,!0),()=>{e.removeEventListener(`pointerdown`,n,!0),e.removeEventListener(`pointerup`,t,!0),e.removeEventListener(`pointercancel`,t,!0),e.removeEventListener(`keydown`,i,!0)}},[r,y,v,W,_,j]),J.useEffect(()=>{if(r||!l)return;function e(){F.current=!0,V.start(0,()=>{F.current=!1})}function t(e){let t=e.relatedTarget,n=e.currentTarget,r=PS(e);queueMicrotask(()=>{let i=S(),a=g.context.triggerElements,o=!(NS(v,t)||NS(y,t)||NS(t,y)||NS(j?.portalNode,t)||t!=null&&a.hasElement(t)||a.hasMatchingElement(e=>NS(e,t))||t?.hasAttribute(nT(`focus-guard`))||A&&(HS(A.nodesRef.current,i).find(e=>NS(e.context?.elements.floating,t)||NS(e.context?.elements.domReference,t))||US(A.nodesRef.current,i).find(e=>[e.context?.elements.floating,VS(e.context?.elements.floating)].includes(t)||e.context?.elements.domReference===t)));if(n===v&&W&&mE(W,E),s&&n!==v&&!pE(r)&&MS(LS(W))===LS(W).body){if(Vx(W)&&(W.focus(),s===`popup`)){H.request(()=>{W.focus()});return}let e=L.current,t=ee(),n=t[e]||t[t.length-1]||W;Vx(n)&&n.focus()}if(x.current.insideReactTree){x.current.insideReactTree=!1;return}(T||!c)&&t&&o&&!F.current&&(T||t!==dE())&&(P.current=!0,g.setOpen(!1,tT(Jw,e)))})}function n(){I.current||(x.current.insideReactTree=!0,B.start(0,()=>{x.current.insideReactTree=!1}))}let i=Vx(v)?v:null,a=[];if(!(!y&&!i))return i&&(i.addEventListener(`focusout`,t),i.addEventListener(`pointerdown`,e),a.push(()=>{i.removeEventListener(`focusout`,t),i.removeEventListener(`pointerdown`,e)})),y&&(y.addEventListener(`focusout`,t),j&&(y.addEventListener(`focusout`,n,!0),a.push(()=>{y.removeEventListener(`focusout`,n,!0)})),a.push(()=>{y.removeEventListener(`focusout`,t)})),()=>{a.forEach(e=>{e()})}},[r,v,y,W,c,A,j,g,l,s,ee,T,S,E,x,B,V,H]);let ne=J.useRef(null),re=J.useRef(null),ie=sT(ne,m,j?.beforeInsideRef),ae=sT(re,j?.afterInsideRef);J.useEffect(()=>{if(r||!y||!_)return;let e=Array.from(j?.portalNode?.querySelectorAll(`[${nT(`portal`)}]`)||[]),t=AT([y,(A?US(A.nodesRef.current,S()):[]).find(e=>zS(e.context?.elements.domReference||null))?.context?.elements.domReference,...e,...C(),M.current,N.current,ne.current,re.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,aE(p),aE(f),T?v:null].filter(e=>e!=null),c||T);return()=>{t()}},[_,r,v,y,c,E,j,T,A,S,C,f,p]),wx(()=>{if(!_||r||!Vx(W))return;let e=MS(LS(W));queueMicrotask(()=>{let t=te(W),n=D.current,r=typeof n==`function`?n(k.current||``):n;if(r===void 0||r===!1)return;let i;i=r===!0||r===null?t[0]||W:aE(r),i=i||t[0]||W,!NS(W,e)&&xT(i,{preventScroll:i===W})})},[r,_,W,w,te,D,k]),wx(()=>{if(r||!W)return;let e=LS(W);uE(MS(e));function t(e){if(e.open||(R.current=oE(e.nativeEvent,z.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(P.current=!0),e.reason===`outside-press`)if(e.nested)P.current=!1;else if(KS(e.nativeEvent)||qS(e.nativeEvent))P.current=!1;else{let e=!1;document.createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?P.current=!1:P.current=!0}}b.on(`openchange`,t);let n=e.createElement(`span`);n.setAttribute(`tabindex`,`-1`),n.setAttribute(`aria-hidden`,`true`),Object.assign(n.style,pT),U&&v&&v.insertAdjacentElement(`afterend`,n);function i(){let e=O.current,t=typeof e==`function`?e(R.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=v||dE();return e&&e.isConnected?e:n}let r=v||dE()||n;return aE(t)||r}return()=>{b.off(`openchange`,t);let r=MS(e),a=NS(y,r)||A&&HS(A.nodesRef.current,S(),!1).some(e=>NS(e.context?.elements.floating,r)),o=i();queueMicrotask(()=>{let t=fE(o),i=typeof O.current!=`boolean`;O.current&&!P.current&&Vx(t)&&(!(!i&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),n.remove()})}},[r,y,W,O,x,b,A,U,v,S]),J.useEffect(()=>{queueMicrotask(()=>{P.current=!1})},[r]),J.useEffect(()=>{if(r||!_)return;function e(e){PS(e)?.closest(`[data-base-ui-click-trigger]`)&&(F.current=!0)}let t=LS(W);return t.addEventListener(`pointerdown`,e,!0),()=>{t.removeEventListener(`pointerdown`,e,!0)}},[r,_,W]),wx(()=>{if(!r&&j)return j.setFocusManagerState({modal:c,closeOnFocusOut:l,open:_,onOpenChange:g.setOpen,domReference:v}),()=>{j.setFocusManagerState(null)}},[r,j,c,_,g,l,v]),wx(()=>{if(!(r||!W))return mE(W,E),()=>{queueMicrotask(lE)}},[r,W,E]);let oe=!r&&(c?!T:!0)&&(U||c);return(0,Y.jsxs)(J.Fragment,{children:[oe&&(0,Y.jsx)(yT,{"data-type":`inside`,ref:ie,onFocus:e=>{if(c){let e=te();xT(e[e.length-1])}else j?.portalNode&&(P.current=!1,_w(e,j.portalNode)?fw(v)?.focus():aE(p??j.beforeOutsideRef)?.focus())}}),n,oe&&(0,Y.jsx)(yT,{"data-type":`inside`,ref:ae,onFocus:e=>{c?xT(te()[0]):j?.portalNode&&(l&&(P.current=!0),_w(e,j.portalNode)?pw(v)?.focus():aE(f??j.afterOutsideRef)?.focus())}})]})}function gE(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0}=t,u=J.useRef(void 0),d=_T(),f=Px(),p=J.useMemo(()=>({onPointerDown(e){u.current=e.pointerType},onMouseDown(e){let t=u.current,i=e.nativeEvent,p=n.select(`open`);if(e.button!==0||a===`click`||JS(t,!0)&&s)return;let m=r.current.openEvent,h=m?.type,g=n.select(`domReferenceElement`)!==e.currentTarget,_=p&&g||!(p&&o&&(!(m&&c)||h===`click`||h===`mousedown`));if(RS(i.target)){let e=tT(Uw,i,i.target);_&&t===`touch`&&l>0?f.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(_,e);return}let v=e.currentTarget;d.request(()=>{let e=tT(Uw,i,v);_&&t===`touch`&&l>0?f.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(_,e)})},onClick(e){if(a===`mousedown-only`)return;let t=u.current;if(a===`mousedown`&&t){u.current=void 0;return}if(JS(t,!0)&&s)return;let i=n.select(`open`),d=r.current.openEvent,p=n.select(`domReferenceElement`)!==e.currentTarget,m=i&&p||!(i&&o&&(!(d&&c)||YS(d))),h=tT(Uw,e.nativeEvent,e.currentTarget);m&&t===`touch`&&l>0?f.start(l,()=>{n.setOpen(!0,h)}):n.setOpen(m,h)},onKeyDown(){u.current=void 0}}),[r,a,s,n,c,o,d,f,l]);return J.useMemo(()=>i?{reference:p}:Iw,[i,p])}function _E(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function vE(e){return e!=null&&e.clientX!=null}function yE(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{enabled:s=!0,axis:c=`both`,x:l=null,y:u=null}=t,d=J.useRef(!1),f=J.useRef(null),[p,m]=J.useState(),[h,g]=J.useState([]),_=uS((e,t)=>{d.current||o.current.openEvent&&!vE(o.current.openEvent)||n.set(`positionReference`,_E(a,{x:e,y:t,axis:c,dataRef:o,pointerType:p}))}),v=uS(e=>{l!=null||u!=null||(r?f.current||g([]):_(e.clientX,e.clientY))}),y=JS(p)?i:r,b=J.useCallback(()=>{if(!y||!s||l!=null||u!=null)return;let e=Lx(i);function t(n){NS(i,PS(n))?(e.removeEventListener(`mousemove`,t),f.current=null):_(n.clientX,n.clientY)}if(!o.current.openEvent||vE(o.current.openEvent)){e.addEventListener(`mousemove`,t);let n=()=>{e.removeEventListener(`mousemove`,t),f.current=null};return f.current=n,n}n.set(`positionReference`,a)},[y,s,l,u,i,o,a,n,_]);J.useEffect(()=>b(),[b,h]),J.useEffect(()=>{s&&!i&&(d.current=!1)},[s,i]),J.useEffect(()=>{!s&&r&&(d.current=!0)},[s,r]),wx(()=>{s&&(l!=null||u!=null)&&(d.current=!1,_(l,u))},[s,l,u,_]);let x=J.useMemo(()=>{function e(e){m(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:v,onMouseEnter:v}},[v]);return J.useMemo(()=>s?{reference:x}:{},[s,x])}function bE(e,t,n){let{reference:r,floating:i}=e,a=lC(t),o=uC(t),s=cC(o),c=aC(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(oC(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function xE(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=iC(t,e),p=SC(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=CC(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=CC(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var SE=50,CE=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:xE},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=bE(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<SE&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=bE(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},wE=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=iC(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=aC(r),_=lC(o),v=aC(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[bC(o)]:fC(o)),x=p!==`none`;!d&&x&&b.push(...yC(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=dC(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==lC(t))||T.every(e=>lC(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=lC(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function TE(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function EE(e){return XS.some(t=>e[t]>=0)}var DE=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=iC(e,t);switch(i){case`referenceHidden`:{let e=TE(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:EE(e)}}}case`escaped`:{let e=TE(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:EE(e)}}}default:return{}}}}},OE=new Set([`left`,`top`]);async function kE(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=aC(n),s=oC(n),c=lC(n)===`y`,l=OE.has(o)?-1:1,u=a&&c?-1:1,d=iC(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var AE=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await kE(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},jE=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=iC(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=lC(aC(i)),p=sC(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=rC(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=rC(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},ME=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=iC(e,t),u={x:n,y:r},d=lC(i),f=sC(d),p=u[f],m=u[d],h=iC(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=OE.has(aC(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},NE=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=iC(e,t),u=await o.detectOverflow(t,l),d=aC(i),f=oC(i),p=lC(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=ZS(h-u[g],v),x=ZS(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=QS(u.left,0),t=QS(u.right,0),n=QS(u.top,0),r=QS(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:QS(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:QS(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function PE(e){let t=eS(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Vx(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=$S(n)!==a||$S(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function FE(e){return Bx(e)?e:e.contextElement}function IE(e){let t=FE(e);if(!Vx(t))return tC(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=PE(t),o=(a?$S(n.width):n.width)/r,s=(a?$S(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var LE=tC(0);function RE(e){let t=Lx(e);return!Qx()||!t.visualViewport?LE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Lx(e)?!1:t}function BE(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=FE(e),o=tC(1);t&&(r?Bx(r)&&(o=IE(r)):o=IE(e));let s=zE(a,n,r)?RE(a):tC(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Lx(a),t=r&&Bx(r)?Lx(r):r,n=e,i=aS(n);for(;i&&r&&t!==n;){let e=IE(i),t=i.getBoundingClientRect(),r=eS(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Lx(i),i=aS(n)}}return CC({width:u,height:d,x:c,y:l})}function VE(e,t){let n=tS(e).scrollLeft;return t?t.left+n:BE(Rx(e)).left+n}function HE(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-VE(e,n),y:n.top+t.scrollTop}}function UE(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Rx(r),s=t?Gx(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=tC(1),u=tC(0),d=Vx(r);if((d||!d&&!a)&&((Ix(r)!==`body`||Ux(o))&&(c=tS(r)),d)){let e=BE(r);l=IE(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?HE(o,c):tC(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function WE(e){return Array.from(e.getClientRects())}function GE(e){let t=Rx(e),n=tS(e),r=e.ownerDocument.body,i=QS(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=QS(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+VE(e),s=-n.scrollTop;return eS(r).direction===`rtl`&&(o+=QS(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var KE=25;function qE(e,t){let n=Lx(e),r=Rx(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Qx();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=VE(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=KE&&(a-=o)}else l<=KE&&(a+=l);return{width:a,height:o,x:s,y:c}}function JE(e,t){let n=BE(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Vx(e)?IE(e):tC(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function YE(e,t,n){let r;if(t===`viewport`)r=qE(e,n);else if(t===`document`)r=GE(Rx(e));else if(Bx(t))r=JE(t,n);else{let n=RE(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return CC(r)}function XE(e,t){let n=nS(e);return n===t||!Bx(n)||$x(n)?!1:eS(n).position===`fixed`||XE(n,t)}function ZE(e,t){let n=t.get(e);if(n)return n;let r=iS(e,[],!1).filter(e=>Bx(e)&&Ix(e)!==`body`),i=null,a=eS(e).position===`fixed`,o=a?nS(e):e;for(;Bx(o)&&!$x(o);){let t=eS(o),n=Xx(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Ux(o)&&!n&&XE(e,o))?r=r.filter(e=>e!==o):i=t,o=nS(o)}return t.set(e,r),r}function QE(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Gx(t)?[]:ZE(t,this._c):[].concat(n),r],o=YE(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=YE(t,a[e],i);s=QS(n.top,s),c=ZS(n.right,c),l=ZS(n.bottom,l),u=QS(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function $E(e){let{width:t,height:n}=PE(e);return{width:t,height:n}}function eD(e,t,n){let r=Vx(t),i=Rx(t),a=n===`fixed`,o=BE(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=tC(0);function l(){c.x=VE(i)}if(r||!r&&!a)if((Ix(t)!==`body`||Ux(i))&&(s=tS(t)),r){let e=BE(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?HE(i,s):tC(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function tD(e){return eS(e).position===`static`}function nD(e,t){if(!Vx(e)||eS(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Rx(e)===n&&(n=n.ownerDocument.body),n}function rD(e,t){let n=Lx(e);if(Gx(e))return n;if(!Vx(e)){let t=nS(e);for(;t&&!$x(t);){if(Bx(t)&&!tD(t))return t;t=nS(t)}return n}let r=nD(e,t);for(;r&&Wx(r)&&tD(r);)r=nD(r,t);return r&&$x(r)&&tD(r)&&!Xx(r)?n:r||Zx(e)||n}var iD=async function(e){let t=this.getOffsetParent||rD,n=this.getDimensions,r=await n(e.floating);return{reference:eD(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function aD(e){return eS(e).direction===`rtl`}var oD={convertOffsetParentRelativeRectToViewportRelativeRect:UE,getDocumentElement:Rx,getClippingRect:QE,getOffsetParent:rD,getElementRects:iD,getClientRects:WE,getDimensions:$E,getScale:IE,isElement:Bx,isRTL:aD};function sD(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function cD(e,t){let n=null,r,i=Rx(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=eC(d),h=eC(i.clientWidth-(u+f)),g=eC(i.clientHeight-(d+p)),_=eC(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:QS(0,ZS(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!sD(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function lD(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=FE(e),u=i||a?[...l?iS(l):[],...t?iS(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?cD(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?BE(e):null;c&&g();function g(){let t=BE(e);h&&!sD(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var uD=AE,dD=jE,fD=wE,pD=NE,mD=DE,hD=ME,gD=(e,t,n)=>{let r=new Map,i={platform:oD,...n},a={...i.platform,_c:r};return CE(e,t,{...i,platform:a})},_D=typeof document<`u`?J.useLayoutEffect:function(){};function vD(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!vD(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!vD(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function yD(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function bD(e,t){let n=yD(e);return Math.round(t*n)/n}function xD(e){let t=J.useRef(e);return _D(()=>{t.current=e}),t}function SD(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=J.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=J.useState(r);vD(f,r)||p(r);let[m,h]=J.useState(null),[g,_]=J.useState(null),v=J.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=J.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=J.useRef(null),C=J.useRef(null),w=J.useRef(u),T=c!=null,E=xD(c),D=xD(i),O=xD(l),k=J.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),gD(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!vD(w.current,t)&&(w.current=t,ec.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);_D(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=J.useRef(!1);_D(()=>(A.current=!0,()=>{A.current=!1}),[]),_D(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=J.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=J.useMemo(()=>({reference:b,floating:x}),[b,x]),N=J.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=bD(M.floating,u.x),r=bD(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...yD(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return J.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var CD=(e,t)=>{let n=uD(e);return{name:n.name,fn:n.fn,options:[e,t]}},wD=(e,t)=>{let n=dD(e);return{name:n.name,fn:n.fn,options:[e,t]}},TD=(e,t)=>({fn:hD(e).fn,options:[e,t]}),ED=(e,t)=>{let n=fD(e);return{name:n.name,fn:n.fn,options:[e,t]}},DD=(e,t)=>{let n=pD(e);return{name:n.name,fn:n.fn,options:[e,t]}},OD=(e,t)=>{let n=mD(e);return{name:n.name,fn:n.fn,options:[e,t]}},kD={intentional:`onClick`,sloppy:`onPointerDown`};function AD(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function jD(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`referenceElement`),o=n.useState(`domReferenceElement`),{onOpenChange:s,dataRef:c}=n.context,{enabled:l=!0,escapeKey:u=!0,outsidePress:d=!0,outsidePressEvent:f=`sloppy`,referencePress:p=!1,referencePressEvent:m=`sloppy`,ancestorScroll:h=!1,bubbles:g,externalTree:_}=t,v=Aw(_),y=uS(typeof d==`function`?d:()=>!1),b=typeof d==`function`?y:d,x=J.useRef(!1),{escapeKey:S,outsidePress:C}=AD(g),w=J.useRef(null),T=Px(),E=Px(),D=uS(()=>{E.clear(),c.current.insideReactTree=!1}),O=J.useRef(!1),k=J.useRef(``),A=uS(e=>{k.current=e.pointerType}),j=uS(()=>{let e=k.current,t=e===`pen`||!e?`mouse`:e,n=typeof f==`function`?f():f;return typeof n==`string`?n:n[t]}),M=uS(e=>{if(!r||!l||!u||e.key!==`Escape`||O.current)return;let t=c.current.floatingContext?.nodeId,i=v?HS(v.nodesRef.current,t):[];if(!S&&i.length>0){let e=!0;if(i.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let a=tT(Yw,GS(e)?e.nativeEvent:e);n.setOpen(!1,a),!S&&!a.isPropagationAllowed&&e.stopPropagation()}),N=uS(e=>{let t=j();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}),P=uS(()=>{c.current.insideReactTree=!0,E.start(0,D)}),F=uS((e,t=!1)=>{if(N(e)){D();return}if(c.current.insideReactTree){D();return}if(j()===`intentional`&&t||typeof b==`function`&&!b(e))return;let r=PS(e),i=`[${nT(`inert`)}]`,a=LS(n.select(`floatingElement`)).querySelectorAll(i),o=n.context.triggerElements;if(r&&(o.hasElement(r)||o.hasMatchingElement(e=>NS(e,r))))return;let s=Bx(r)?r:null;for(;s&&!$x(s);){let e=nS(s);if($x(e)||!Bx(e))break;s=e}if(a.length&&Bx(r)&&!IS(r)&&!NS(r,n.select(`floatingElement`))&&Array.from(a).every(e=>!NS(s,e)))return;if(Vx(r)&&!(`touches`in e)){let t=$x(r),n=eS(r),i=/auto|scroll/,a=t||i.test(n.overflowX),o=t||i.test(n.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=r.offsetWidth-r.clientWidth:e.offsetX>r.clientWidth),d=s&&e.offsetY>r.clientHeight;if(u||d)return}let l=c.current.floatingContext?.nodeId,u=v&&HS(v.nodesRef.current,l).some(t=>FS(e,t.context?.elements.floating));if(FS(e,n.select(`floatingElement`))||FS(e,n.select(`domReferenceElement`))||u)return;let d=v?HS(v.nodesRef.current,l):[];if(d.length>0){let e=!0;if(d.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}n.setOpen(!1,tT(Kw,e)),D()}),I=uS(e=>{j()!==`sloppy`||e.pointerType===`touch`||!n.select(`open`)||!l||FS(e,n.select(`floatingElement`))||FS(e,n.select(`domReferenceElement`))||F(e)}),L=uS(e=>{if(j()!==`sloppy`||!n.select(`open`)||!l||FS(e,n.select(`floatingElement`))||FS(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(w.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},T.start(1e3,()=>{w.current&&(w.current.dismissOnTouchEnd=!1,w.current.dismissOnMouseDown=!1)}))}),R=uS(e=>{let t=PS(e);function n(){L(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)}),z=uS(e=>{let t=x.current;if(x.current=!1,T.clear(),e.type===`mousedown`&&w.current&&!w.current.dismissOnMouseDown)return;let n=PS(e);function r(){e.type===`pointerdown`?I(e):F(e,t),n?.removeEventListener(e.type,r)}n?.addEventListener(e.type,r)}),B=uS(e=>{if(j()!==`sloppy`||!w.current||FS(e,n.select(`floatingElement`))||FS(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-w.current.startX),i=Math.abs(t.clientY-w.current.startY),a=Math.sqrt(r*r+i*i);a>5&&(w.current.dismissOnTouchEnd=!0),a>10&&(F(e),T.clear(),w.current=null)}),V=uS(e=>{let t=PS(e);function n(){B(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)}),H=uS(e=>{j()!==`sloppy`||!w.current||FS(e,n.select(`floatingElement`))||FS(e,n.select(`domReferenceElement`))||(w.current.dismissOnTouchEnd&&F(e),T.clear(),w.current=null)}),U=uS(e=>{let t=PS(e);function n(){H(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)});J.useEffect(()=>{if(!r||!l)return;c.current.__escapeKeyBubbles=S,c.current.__outsidePressBubbles=C;let e=new Nx;function t(e){n.setOpen(!1,tT(Hw,e))}function s(){e.clear(),O.current=!0}function d(){e.start(Qx()?5:0,()=>{O.current=!1})}let f=LS(i);f.addEventListener(`pointerdown`,A,!0),u&&(f.addEventListener(`keydown`,M),f.addEventListener(`compositionstart`,s),f.addEventListener(`compositionend`,d)),b&&(f.addEventListener(`click`,z,!0),f.addEventListener(`pointerdown`,z,!0),f.addEventListener(`touchstart`,R,!0),f.addEventListener(`touchmove`,V,!0),f.addEventListener(`touchend`,U,!0),f.addEventListener(`mousedown`,z,!0));let p=[];return h&&(Bx(o)&&(p=iS(o)),Bx(i)&&(p=p.concat(iS(i))),!Bx(a)&&a&&a.contextElement&&(p=p.concat(iS(a.contextElement)))),p=p.filter(e=>e!==f.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t,{passive:!0})}),()=>{f.removeEventListener(`pointerdown`,A,!0),u&&(f.removeEventListener(`keydown`,M),f.removeEventListener(`compositionstart`,s),f.removeEventListener(`compositionend`,d)),b&&(f.removeEventListener(`click`,z,!0),f.removeEventListener(`pointerdown`,z,!0),f.removeEventListener(`touchstart`,R,!0),f.removeEventListener(`touchmove`,V,!0),f.removeEventListener(`touchend`,U,!0),f.removeEventListener(`mousedown`,z,!0)),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),e.clear()}},[c,i,a,o,u,b,r,s,h,l,S,C,M,F,z,I,R,V,U,A,n]),J.useEffect(D,[b,D]);let W=J.useMemo(()=>({onKeyDown:M,...p&&{[kD[m]]:e=>{n.setOpen(!1,tT(`trigger-press`,e.nativeEvent))},...m!==`intentional`&&{onClick(e){n.setOpen(!1,tT(`trigger-press`,e.nativeEvent))}}}}),[M,n,p,m]),ee=uS(e=>{let t=PS(e.nativeEvent);!NS(n.select(`floatingElement`),t)||e.button!==0||(x.current=!0)}),te=J.useMemo(()=>({onKeyDown:M,onPointerDown:ee,onMouseDown:ee,onMouseUp:ee,onClickCapture:P,onMouseDownCapture:P,onPointerDownCapture:P,onMouseUpCapture:P,onTouchEndCapture:P,onTouchMoveCapture:P}),[M,ee,P]);return J.useMemo(()=>l?{reference:W,floating:te,trigger:W}:{},[l,W,te])}var MD=Symbol(`NOT_FOUND`);function ND(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function PD(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var FD=e=>Array.isArray(e)?e:[e];function ID(e){let t=Array.isArray(e[0])?e[0]:e;return PD(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function LD(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function RD(e){let t;return{get(n){return t&&e(t.key,n)?t.value:MD},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function zD(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return MD}function i(t,i){r(t)===MD&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var BD=(e,t)=>e===t;function VD(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function HD(e,t){let{equalityCheck:n=BD,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=VD(n),o=0,s=r<=1?RD(a):zD(r,a);function c(){let t=s.get(arguments);if(t===MD){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var UD=class{constructor(e){this.value=e}deref(){return this.value}},WD=typeof WeakRef>`u`?UD:WeakRef,GD=0,KD=1;function qD(){return{s:GD,v:void 0,o:null,p:null}}function JD(e){return e instanceof WD?e.deref():e}function YD(e,t={}){let n=qD(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=qD(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=qD(),e.set(n,t)):t=r}}let s=t,c;if(t.s===KD)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=JD(i);e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new WD(c):c}return s.s=KD,s.v=c,c}return o.clearCache=()=>{n=qD(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function XD(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),ND(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=YD,argsMemoizeOptions:u=[]}={...n,...a},d=FD(c),f=FD(u),p=ID(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=LD(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}XD({memoize:HD,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});var Q=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(Tx(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},ZD=it(),QD=ot(),$D=MT(19)?tO:nO;function eO(e,t,n,r,i){return $D(e,t,n,r,i)}function tO(e,t,n,r,i){let a=J.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,ZD.useSyncExternalStore)(e.subscribe,a,a)}function nO(e,t,n,r,i){return(0,QD.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var rO=class e{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(t){for(let n in t)if(!Object.is(this.state[n],t[n])){e.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||e.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){let t={...this.state};e.prototype.setState.call(this,t)}},iO=class extends rO{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}controlledValues=new Map;useSyncedValue(e,t){J.useDebugValue(e),wx(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){wx(()=>(this.state[e]!==t&&this.set(e,t),()=>{this.set(e,void 0)}),[e,t])}useSyncedValues(e){wx(()=>{this.update(e)},Object.values(e))}useControlledProp(e,t,n){J.useDebugValue(e);let r=t!==void 0;this.controlledValues.has(e)||(this.controlledValues.set(e,r),!r&&!Object.is(this.state[e],n)&&super.setState({...this.state,[e]:n})),wx(()=>{r&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n,r])}set(e,t){this.controlledValues.get(e)!==!0&&super.set(e,t)}update(e){let t={...e};for(let e in t)if(Object.hasOwn(t,e)&&this.controlledValues.get(e)===!0){delete t[e];continue}super.update(t)}setState(e){let t={...e};for(let e in t)if(Object.hasOwn(t,e)&&this.controlledValues.get(e)===!0){delete t[e];continue}super.setState({...this.state,...t})}select=(e,t,n,r)=>{let i=this.selectors[e];return i(this.state,t,n,r)};useState=(e,t,n,r)=>{J.useDebugValue(e);let i=this.selectors[e];return eO(this,i,t,n,r)};useContextCallback(e,t){J.useDebugValue(e);let n=uS(t??Pw);this.context[e]=n}useStateSetter(e){let t=J.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},aO={open:Q(e=>e.open),domReferenceElement:Q(e=>e.domReferenceElement),referenceElement:Q(e=>e.positionReference??e.referenceElement),floatingElement:Q(e=>e.floatingElement),floatingId:Q(e=>e.floatingId)},oO=class extends iO{constructor(e){let{nested:t,noEmit:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Tw(),nested:t,noEmit:n,triggerElements:i},aO)}setOpen=(e,t)=>{if((!e||!this.state.open||YS(t.event))&&(this.context.dataRef.current.openEvent=e?t.event:void 0),!this.context.noEmit){let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)}this.context.onOpenChange?.(e,t)}};function sO(e,t=!1,n=!1){let[r,i]=J.useState(e&&t?`idle`:void 0),[a,o]=J.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),wx(()=>{if(!e&&a&&r!==`ending`&&n){let e=gT.request(()=>{i(`ending`)});return()=>{gT.cancel(e)}}},[e,a,r,n]),wx(()=>{if(!e||t)return;let n=gT.request(()=>{ec.flushSync(()=>{i(void 0)})});return()=>{gT.cancel(n)}},[t,e]),wx(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=gT.request(()=>{i(`idle`)});return()=>{gT.cancel(n)}},[t,e,a,i,r]),J.useMemo(()=>({mounted:a,setMounted:o,transitionStatus:r}),[a,r])}function cO(e,t=!1,n=!0){let r=_T();return uS((i,a=null)=>{r.cancel();let o=aE(e);o!=null&&(typeof o.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED?i():r.request(()=>{function e(){o&&Promise.all(o.getAnimations().map(e=>e.finished)).then(()=>{a!=null&&a.aborted||ec.flushSync(i)}).catch(()=>{if(n){if(a!=null&&a.aborted)return;ec.flushSync(i)}else o.getAnimations().length>0&&o.getAnimations().some(e=>e.pending||e.playState!==`finished`)&&e()})}t?r.request(e):e()}))})}function lO(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=oS(n),o=uS(i),s=cO(r,n);J.useEffect(()=>{t&&s(()=>{n===a.current&&o()})},[t,n,o,s,a])}function uO(e,t){let n=J.useRef(null);return J.useCallback(r=>{if(e!==void 0&&(n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null),r!==null))return n.current=e,t.context.triggerElements.add(e,r),()=>{n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null)}},[t,e])}function dO(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=uO(e,n),o=uS(t=>{let i=a(t);return t!==null&&n.select(`open`)&&n.select(`activeTriggerId`)==null&&n.update({activeTriggerId:e,activeTriggerElement:t,...r}),i});return wx(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function fO(e){let t=e.useState(`open`);wx(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function pO(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=sO(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=uS(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return lO({enabled:!t.useState(`preventUnmountingOnClose`),open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}var mO=class{constructor(){this.elements=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elements.delete(n),this.elements.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elements.delete(t),this.idMap.delete(e))}hasElement(e){return this.elements.has(e)}hasMatchingElement(e){for(let t of this.elements)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}};function hO(){return new oO({open:!1,floatingElement:null,referenceElement:null,triggerElements:new mO,floatingId:``,nested:!1,noEmit:!1,onOpenChange:void 0})}function gO(){return{open:!1,mounted:!1,transitionStatus:`idle`,floatingRootContext:hO(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:Iw,inactiveTriggerProps:Iw,popupProps:Iw}}var _O={open:Q(e=>e.open),mounted:Q(e=>e.mounted),transitionStatus:Q(e=>e.transitionStatus),floatingRootContext:Q(e=>e.floatingRootContext),preventUnmountingOnClose:Q(e=>e.preventUnmountingOnClose),payload:Q(e=>e.payload),activeTriggerId:Q(e=>e.activeTriggerId),activeTriggerElement:Q(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:Q((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:Q((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:Q((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:Q((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:Q(e=>e.popupProps),popupElement:Q(e=>e.popupElement),positionerElement:Q(e=>e.positionerElement)};function vO(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=ww(),a=kw()!=null,o=kx(()=>new oO({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new mO,floatingId:i,nested:a,noEmit:e.noEmit||!1})).current;return wx(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=Bx(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o.context.noEmit=e.noEmit||!1,o}function yO(e={}){let{nodeId:t,externalTree:n}=e,r=vO(e),i=e.rootContext||r,a={reference:i.useState(`referenceElement`),floating:i.useState(`floatingElement`),domReference:i.useState(`domReferenceElement`)},[o,s]=J.useState(null),c=J.useRef(null),l=Aw(n);wx(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);let u=SD({...e,elements:{...a,...o&&{reference:o}}}),d=J.useCallback(e=>{let t=Bx(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;s(t),u.refs.setReference(t)},[u.refs]),[f,p]=J.useState(null),[m,h]=J.useState(null);i.useSyncedValue(`referenceElement`,f),i.useSyncedValue(`domReferenceElement`,Bx(f)?f:null),i.useSyncedValue(`floatingElement`,m);let g=J.useCallback(e=>{(Bx(e)||e===null)&&(c.current=e,p(e)),(Bx(u.refs.reference.current)||u.refs.reference.current===null||e!==null&&!Bx(e))&&u.refs.setReference(e)},[u.refs,p]),_=J.useCallback(e=>{h(e),u.refs.setFloating(e)},[u.refs]),v=J.useMemo(()=>({...u.refs,setReference:g,setFloating:_,setPositionReference:d,domReference:c}),[u.refs,g,_,d]),y=J.useMemo(()=>({...u.elements,domReference:a.domReference}),[u.elements,a.domReference]),b=i.useState(`open`),x=i.useState(`floatingId`),S=J.useMemo(()=>({...u,dataRef:i.context.dataRef,open:b,onOpenChange:i.setOpen,events:i.context.events,floatingId:x,refs:v,elements:y,nodeId:t,rootStore:i}),[u,v,y,t,i,b,x]);return wx(()=>{i.context.dataRef.current.floatingContext=S;let e=l?.nodesRef.current.find(e=>e.id===t);e&&(e.context=S)}),J.useMemo(()=>({...u,context:S,refs:v,elements:y,rootStore:i}),[u,v,y,S,i])}function bO(e){let{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:i}=e,a=ww(),o=kw()!=null,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(r?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=kx(()=>new oO({open:s,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:i,floatingId:a,nested:o,noEmit:n})).current;return wx(()=>{let e={open:s,floatingId:a,referenceElement:c,floatingElement:l};Bx(c)&&(e.domReferenceElement=c),d.update(e)},[s,a,c,l,d]),d.context.onOpenChange=i,d.context.nested=o,d.context.noEmit=n,d}var xO=xS&&yS;function SO(e,t={}){let n=`rootStore`in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,visibleOnly:o=!0}=t,s=J.useRef(!1),c=Px(),l=J.useRef(!0);J.useEffect(()=>{let e=n.select(`domReferenceElement`);if(!a)return;let t=Lx(e);function r(){!n.select(`open`)&&Vx(e)&&e===MS(LS(e))&&(s.current=!0)}function i(){l.current=!0}function o(){l.current=!1}return t.addEventListener(`blur`,r),xO&&(t.addEventListener(`keydown`,i,!0),t.addEventListener(`pointerdown`,o,!0)),()=>{t.removeEventListener(`blur`,r),xO&&(t.removeEventListener(`keydown`,i,!0),t.removeEventListener(`pointerdown`,o,!0))}},[n,a]),J.useEffect(()=>{if(!a)return;function e(e){(e.reason===`trigger-press`||e.reason===`escape-key`)&&(s.current=!0)}return r.on(`openchange`,e),()=>{r.off(`openchange`,e)}},[r,a]);let u=J.useMemo(()=>({onMouseLeave(){s.current=!1},onFocus(e){if(s.current)return;let t=PS(e.nativeEvent);if(o&&Bx(t)){if(xO&&!e.relatedTarget){if(!l.current&&!RS(t))return}else if(!BS(t))return}n.setOpen(!0,tT(Gw,e.nativeEvent,e.currentTarget))},onBlur(e){s.current=!1;let t=e.relatedTarget,r=e.nativeEvent,a=Bx(t)&&t.hasAttribute(nT(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;c.start(0,()=>{let o=n.select(`domReferenceElement`),s=MS(o?o.ownerDocument:document);!t&&s===o||NS(i.current.floatingContext?.refs.floating.current,s)||NS(o,s)||a||n.context.triggerElements.hasElement(e.relatedTarget)||n.setOpen(!1,tT(Gw,r))})}}),[i,n,o,c]);return J.useMemo(()=>a?{reference:u,trigger:u}:{},[a,u])}var CO=nT(`safe-polygon`),wO=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${DS}`;function TO(e){return e?!!e.closest(wO):!1}function EO(e){let t=J.useRef(void 0),n=J.useRef(!1),r=J.useRef(void 0),i=J.useRef(!0),a=J.useRef(!1),o=J.useRef(()=>{}),s=J.useRef(!1),c=Px(),l=Px(),u=J.useRef(void 0);return J.useMemo(()=>{let d=e.context.dataRef.current;return d.hoverInteractionState||={pointerTypeRef:t,interactedInsideRef:n,handlerRef:r,blockMouseMoveRef:i,performedPointerEventsMutationRef:a,unbindMouseMoveRef:o,restTimeoutPendingRef:s,openChangeTimeout:c,restTimeout:l,handleCloseOptionsRef:u},d.hoverInteractionState},[e,t,n,r,i,a,o,s,c,l,u])}var DO=new Set([`click`,`mousedown`]);function OO(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:c=0,externalTree:l}=t,{pointerTypeRef:u,interactedInsideRef:d,handlerRef:f,performedPointerEventsMutationRef:p,unbindMouseMoveRef:m,restTimeoutPendingRef:h,openChangeTimeout:g,handleCloseOptionsRef:_}=EO(n),v=Aw(l),y=kw(),b=uS(()=>d.current?!0:o.current.openEvent?DO.has(o.current.openEvent.type):!1),x=uS(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),S=J.useCallback((e,t=!0)=>{let r=kO(c,u.current);r&&!f.current?g.start(r,()=>n.setOpen(!1,tT(Ww,e))):t&&(g.clear(),n.setOpen(!1,tT(Ww,e)))},[c,f,n,u,g]),C=uS(()=>{m.current(),f.current=void 0}),w=uS(()=>{if(p.current){let e=LS(i).body;e.style.pointerEvents=``,e.removeAttribute(CO),p.current=!1}}),T=uS(e=>{if(!TO(PS(e))){d.current=!1;return}d.current=!0});wx(()=>{r||(u.current=void 0,h.current=!1,d.current=!1,C(),w())},[r,u,h,d,C,w]),J.useEffect(()=>()=>{C()},[C]),J.useEffect(()=>w,[w]),wx(()=>{if(s&&r&&_.current?.blockPointerEvents&&x()&&Bx(a)&&i){p.current=!0;let e=LS(i).body;e.setAttribute(CO,``);let t=a,n=i,r=v?.nodesRef.current.find(e=>e.id===y)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),e.style.pointerEvents=`none`,t.style.pointerEvents=`auto`,n.style.pointerEvents=`auto`,()=>{e.style.pointerEvents=``,t.style.pointerEvents=``,n.style.pointerEvents=``}}},[s,r,a,i,_,x,v,y,p]),J.useEffect(()=>{if(!s)return;function e(e){if(b()||!o.current.floatingContext)return;let t=n.context.triggerElements;e.relatedTarget&&t.hasElement(e.relatedTarget)||(w(),C(),b()||S(e))}function t(e){g.clear(),w(),f.current?.(e),C()}function r(e){b()||S(e,!1)}let a=i;return a&&(a.addEventListener(`mouseleave`,e),a.addEventListener(`mouseenter`,t),a.addEventListener(`mouseleave`,r),a.addEventListener(`pointerdown`,T,!0)),()=>{a&&(a.removeEventListener(`mouseleave`,e),a.removeEventListener(`mouseenter`,t),a.removeEventListener(`mouseleave`,r),a.removeEventListener(`pointerdown`,T,!0))}})}function kO(e,t){return t&&!JS(t)?0:typeof e==`function`?e():e}function AO(e){return typeof e==`function`?e():e}var jO={current:null};function MO(e,t={}){let n=`rootStore`in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:c=!1,restMs:l=0,move:u=!0,triggerElementRef:d=jO,externalTree:f,isActiveTrigger:p=!0}=t,m=Aw(f),{pointerTypeRef:h,interactedInsideRef:g,handlerRef:_,blockMouseMoveRef:v,performedPointerEventsMutationRef:y,unbindMouseMoveRef:b,restTimeoutPendingRef:x,openChangeTimeout:S,restTimeout:C,handleCloseOptionsRef:w}=EO(n),T=oS(s),E=oS(o),D=oS(l);p&&(w.current=T.current?.__options);let O=uS(()=>g.current?!0:r.current.openEvent?[`click`,`mousedown`].includes(r.current.openEvent.type):!1),k=J.useCallback((e,t=!0)=>{let r=rT(E.current,`close`,h.current);r&&!_.current?S.start(r,()=>n.setOpen(!1,tT(Ww,e))):t&&(S.clear(),n.setOpen(!1,tT(Ww,e)))},[E,_,n,h,S]),A=uS(()=>{b.current(),_.current=void 0}),j=uS(()=>{if(y.current){let e=LS(n.select(`domReferenceElement`)).body;e.style.pointerEvents=``,e.removeAttribute(CO),y.current=!1}});J.useEffect(()=>{if(!a)return;function e(e){e.open||(S.clear(),C.clear(),v.current=!0,x.current=!1)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[a,i,S,C,v,x]);let M=uS(e=>{if(O()||!r.current.floatingContext)return;let t=n.context.triggerElements;e.relatedTarget&&t.hasElement(e.relatedTarget)||T.current?.({...r.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){j(),A(),O()||k(e)}})(e)});return J.useEffect(()=>{if(!a)return;let e=d.current??(p?n.select(`domReferenceElement`):null);if(!Bx(e))return;function t(e){if(S.clear(),v.current=!1,c&&!JS(h.current)||AO(D.current)>0&&!rT(E.current,`open`))return;let t=rT(E.current,`open`,h.current),r=n.select(`domReferenceElement`),i=n.context.triggerElements,a=(i.hasElement(e.target)||i.hasMatchingElement(t=>NS(t,e.target)))&&(!r||!NS(r,e.target)),o=e.currentTarget??null;t?S.start(t,()=>{n.select(`open`)||n.setOpen(!0,tT(Ww,e,o))}):(!n.select(`open`)||a)&&n.setOpen(!0,tT(Ww,e,o))}function i(e){if(O()){j();return}b.current();let t=LS(n.select(`domReferenceElement`));C.clear(),x.current=!1;let i=n.context.triggerElements;if(!(e.relatedTarget&&i.hasElement(e.relatedTarget))){if(T.current&&r.current.floatingContext){n.select(`open`)||S.clear(),_.current=T.current({...r.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){j(),A(),O()||k(e,!0)}});let i=_.current;i(e),t.addEventListener(`mousemove`,i),b.current=()=>{t.removeEventListener(`mousemove`,i)};return}(h.current!==`touch`||!NS(n.select(`floatingElement`),e.relatedTarget))&&k(e)}}function o(e){M(e)}return n.select(`open`)&&e.addEventListener(`mouseleave`,o),u&&e.addEventListener(`mousemove`,t,{once:!0}),e.addEventListener(`mouseenter`,t),e.addEventListener(`mouseleave`,i),()=>{e.removeEventListener(`mouseleave`,o),u&&e.removeEventListener(`mousemove`,t),e.removeEventListener(`mouseenter`,t),e.removeEventListener(`mouseleave`,i)}},[A,j,v,r,E,k,n,a,T,M,p,O,c,u,h,D,C,x,S,d,m,b,_]),J.useMemo(()=>{function e(e){h.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`),a=n.context.triggerElements,o=n.select(`open`),s=(a.hasElement(e.target)||a.hasMatchingElement(t=>NS(t,e.target)))&&(!i||!NS(i,e.target));if(c&&!JS(h.current)||o&&!s||AO(D.current)===0||!s&&x.current&&e.movementX**2+e.movementY**2<2)return;C.clear();function l(){!v.current&&(!o||s)&&n.setOpen(!0,tT(Ww,t,r))}h.current===`touch`?ec.flushSync(()=>{l()}):s&&o?l():(x.current=!0,C.start(AO(D.current),l))}}},[v,c,n,h,D,C,x])}function NO(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=J.useCallback(t=>PO(t,e,`reference`),t),o=J.useCallback(t=>PO(t,e,`floating`),n),s=J.useCallback(t=>PO(t,e,`item`),r),c=J.useCallback(t=>PO(t,e,`trigger`),i);return J.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function PO(e,t,n){let r=new Map,i=n===`item`,a={};n===`floating`&&(a.tabIndex=-1,a[ES]=``);for(let t in e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&FO(a,s,i,r)}return FO(a,e,i,r),a}function FO(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var IO=`Escape`;function LO(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function RO(e,t){return LO(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function zO(e,t,n){return LO(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function BO(e,t,n){return LO(t,n?e===OS:e===kS,e===jS)}function VO(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===IO:LO(t,n?e===kS:e===OS,e===AS)}function HO(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{listRef:s,activeIndex:c,onNavigate:l=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:h=!1,virtual:g=!1,focusItemOnOpen:_=`auto`,focusItemOnHover:v=!0,openOnArrowKeyDown:y=!0,disabledIndices:b=void 0,orientation:x=`vertical`,parentOrientation:S,cols:C=1,scrollItemIntoView:w=!0,itemSizes:T,dense:E=!1,id:D,resetOnPointerLeave:O=!0,externalTree:k}=t,A=oS(VS(i)),j=kw(),M=Aw(k);wx(()=>{o.current.orientation=x},[o,x]);let N=zS(a),P=J.useRef(_),F=J.useRef(d??-1),I=J.useRef(null),L=J.useRef(!0),R=uS(e=>{l(F.current===-1?null:F.current,e)}),z=J.useRef(R),B=J.useRef(!!i),V=J.useRef(r),H=J.useRef(!1),U=J.useRef(!1),W=oS(b),ee=oS(r),te=oS(w),ne=oS(d),re=oS(O),ie=uS(()=>{function e(e){g?M?.events.emit(`virtualfocus`,e):xT(e,{sync:H.current,preventScroll:!0})}let t=s.current[F.current],n=U.current;t&&e(t),(H.current?e=>e():requestAnimationFrame)(()=>{let r=s.current[F.current]||t;if(!r)return;t||e(r);let i=te.current;i&&oe&&(n||!L.current)&&r.scrollIntoView?.(typeof i==`boolean`?{block:`nearest`,inline:`nearest`}:i)})});wx(()=>{u&&(r&&i?(F.current=d??-1,P.current&&d!=null&&(U.current=!0,R())):B.current&&(F.current=-1,z.current()))},[u,r,i,d,R]),wx(()=>{if(u){if(!r){H.current=!1;return}if(i)if(c==null){if(H.current=!1,ne.current!=null)return;if(B.current&&(F.current=-1,ie()),(!V.current||!B.current)&&P.current&&(I.current!=null||P.current===!0&&I.current==null)){let e=0,t=()=>{s.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(F.current=I.current==null||zO(I.current,x,h)||m?EC(s):DC(s),I.current=null,R())};t()}}else TC(s,c)||(F.current=c,ie(),U.current=!1)}},[u,r,i,c,ne,m,s,x,h,R,ie,W]),wx(()=>{if(!u||i||!M||g||!B.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=MS(LS(i)),r=e.some(e=>e.context&&NS(e.context.elements.floating,n));t&&!r&&L.current&&t.focus({preventScroll:!0})},[u,i,M,j,g]),wx(()=>{z.current=R,V.current=r,B.current=!!i}),wx(()=>{r||(I.current=null,P.current=_)},[r,_]);let ae=c!=null,oe=J.useMemo(()=>{function e(e){if(!ee.current)return;let t=s.current.indexOf(e.currentTarget);t!==-1&&F.current!==t&&(F.current=t,R(e))}return{onFocus(t){H.current=!0,e(t)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(t){H.current=!0,U.current=!1,v&&e(t)},onPointerLeave(e){if(!ee.current||!L.current||e.pointerType===`touch`)return;H.current=!0;let t=e.relatedTarget;!v||s.current.includes(t)||re.current&&(F.current=-1,R(e),g||A.current?.focus({preventScroll:!0}))}}},[ee,A,v,s,R,re,g]),G=J.useCallback(()=>S??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation,[j,M,S]),se=uS(e=>{if(L.current=!1,H.current=!0,e.which===229||!ee.current&&e.currentTarget===A.current)return;if(m&&VO(e.key,x,h,C)){RO(e.key,G())||WS(e),n.setOpen(!1,tT(Xw,e.nativeEvent)),Vx(a)&&(g?M?.events.emit(`virtualfocus`,a):a.focus());return}let t=F.current,i=EC(s,b),o=DC(s,b);if(N||(e.key===`Home`&&(WS(e),F.current=i,R(e)),e.key===`End`&&(WS(e),F.current=o,R(e))),C>1){let t=T||Array.from({length:s.current.length},()=>({width:1,height:1})),n=AC(t,C,E),r=n.findIndex(e=>e!=null&&!NC(s,e,b)),a=n.reduce((e,t,n)=>t!=null&&!NC(s,t,b)?n:e,-1),c=n[kC({current:n.map(e=>e==null?null:s.current[e])},{event:e,orientation:x,loopFocus:p,rtl:h,cols:C,disabledIndices:MC([...(typeof b==`function`?null:b)||s.current.map((e,t)=>NC(s,t,b)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:jC(F.current>o?i:F.current,t,n,C,e.key===`ArrowDown`?`bl`:e.key===(h?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(F.current=c,R(e)),x===`both`)return}if(RO(e.key,x)){if(WS(e),r&&!g&&MS(e.currentTarget.ownerDocument)===e.currentTarget){F.current=zO(e.key,x,h)?i:o,R(e);return}zO(e.key,x,h)?p?t>=o?f&&t!==s.current.length?F.current=-1:(H.current=!1,F.current=i):F.current=OC(s,{startingIndex:t,disabledIndices:b}):F.current=Math.min(o,OC(s,{startingIndex:t,disabledIndices:b})):p?t<=i?f&&t!==-1?F.current=s.current.length:(H.current=!1,F.current=o):F.current=OC(s,{startingIndex:t,decrement:!0,disabledIndices:b}):F.current=Math.max(i,OC(s,{startingIndex:t,decrement:!0,disabledIndices:b})),TC(s,F.current)&&(F.current=-1),R(e)}}),K=J.useMemo(()=>g&&r&&ae&&{"aria-activedescendant":`${D}-${c}`},[g,r,ae,D,c]),ce=J.useMemo(()=>({"aria-orientation":x===`both`?void 0:x,...N?{}:K,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!g){let t=PS(e.nativeEvent);if(t&&!NS(A.current,t))return;WS(e),n.setOpen(!1,tT(Jw,e.nativeEvent)),Vx(a)&&a.focus();return}se(e)},onPointerMove(){L.current=!0}}),[K,se,A,x,N,n,r,g,a]),le=J.useMemo(()=>{function e(e){_===`auto`&&KS(e.nativeEvent)&&(P.current=!g)}function t(e){P.current=_,_===`auto`&&qS(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(e){let t=n.select(`open`);L.current=!1;let r=e.key.startsWith(`Arrow`),i=BO(e.key,G(),h),a=RO(e.key,x),o=(m?i:a)||e.key===`Enter`||e.key.trim()===``;if(g&&t)return se(e);if(!(!t&&!y&&r)){if(o){let t=RO(e.key,G());I.current=m&&t?null:e.key}if(m){i&&(WS(e),t?(F.current=EC(s,W.current),R(e)):n.setOpen(!0,tT(Xw,e.nativeEvent,e.currentTarget)));return}a&&(ne.current!=null&&(F.current=ne.current),WS(e),!t&&y?n.setOpen(!0,tT(Xw,e.nativeEvent,e.currentTarget)):se(e),t&&R(e))}},onFocus(e){n.select(`open`)&&!g&&(F.current=-1,R(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[se,W,_,s,m,R,n,y,x,G,h,ne,g]),ue=J.useMemo(()=>({...K,...le}),[K,le]);return J.useMemo(()=>u?{reference:ue,floating:ce,item:oe,trigger:le}:{},[u,ue,ce,le,oe])}var UO=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function WO(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{enabled:s=!0,role:c=`dialog`}=t,l=ww(),u=a?.id||l,d=J.useMemo(()=>VS(o)?.id||i,[o,i]),f=UO.get(c)??c,p=kw()!=null,m=J.useMemo(()=>f===`tooltip`||c===`label`?Iw:{"aria-haspopup":f===`alertdialog`?`dialog`:f,"aria-expanded":`false`,...f===`listbox`&&{role:`combobox`},...f===`menu`&&p&&{role:`menuitem`},...c===`select`&&{"aria-autocomplete":`none`},...c===`combobox`&&{"aria-autocomplete":`list`}},[f,p,c]),h=J.useMemo(()=>f===`tooltip`||c===`label`?{[`aria-${c===`label`?`labelledby`:`describedby`}`]:r?d:void 0}:{...m,"aria-expanded":r?`true`:`false`,"aria-controls":r?d:void 0,...f===`menu`&&{id:u}},[f,d,r,u,c,m]),g=J.useMemo(()=>{let e={id:d,...f&&{role:f}};return f===`tooltip`||c===`label`?e:{...e,...f===`menu`&&{"aria-labelledby":u}}},[f,d,u,c]),_=J.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${d}-fui-option`}};switch(c){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[d,c]);return J.useMemo(()=>s?{reference:h,floating:g,item:_,trigger:m}:{},[s,h,g,m,_])}function GO(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.context.dataRef,{listRef:a,activeIndex:o,onMatch:s,onTypingChange:c,enabled:l=!0,findMatch:u=null,resetMs:d=750,ignoreKeys:f=Fw,selectedIndex:p=null}=t,m=Px(),h=J.useRef(``),g=J.useRef(p??o??-1),_=J.useRef(null);wx(()=>{r&&(m.clear(),_.current=null,h.current=``)},[r,m]),wx(()=>{r&&h.current===``&&(g.current=p??o??-1)},[r,p,o]);let v=uS(e=>{e?i.current.typing||(i.current.typing=e,c?.(e)):i.current.typing&&(i.current.typing=e,c?.(e))}),y=uS(e=>{function t(e,t,n){let r=u?u(t,n):t.find(e=>e?.toLocaleLowerCase().indexOf(n.toLocaleLowerCase())===0);return r?e.indexOf(r):-1}let n=a.current;if(h.current.length>0&&h.current[0]!==` `&&(t(n,n,h.current)===-1?v(!1):e.key===` `&&WS(e)),n==null||f.includes(e.key)||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;r&&e.key!==` `&&(WS(e),v(!0)),n.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&h.current===e.key&&(h.current=``,g.current=_.current),h.current+=e.key,m.start(d,()=>{h.current=``,g.current=_.current,v(!1)});let i=g.current,o=t(n,[...n.slice((i||0)+1),...n.slice(0,(i||0)+1)],h.current);o===-1?e.key!==` `&&(h.current=``,v(!1)):(s?.(o),_.current=o)}),b=J.useMemo(()=>({onKeyDown:y}),[y]),x=J.useMemo(()=>({onKeyDown:y,onKeyUp(e){e.key===` `&&v(!1)}}),[y,v]);return J.useMemo(()=>l?{reference:b,floating:x}:{},[l,b,x])}function KO(e,t){let[n,r]=e,i=!1,a=t.length;for(let e=0,o=a-1;e<a;o=e++){let[a,s]=t[e]||[0,0],[c,l]=t[o]||[0,0];s>=r!=l>=r&&n<=(c-a)*(r-s)/(l-s)+a&&(i=!i)}return i}function qO(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function JO(e={}){let{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,i=new Nx,a=!1,o=null,s=null,c=typeof performance<`u`?performance.now():0;function l(e,t){let n=performance.now(),r=n-c;if(o===null||s===null||r===0)return o=e,s=t,c=n,null;let i=e-o,a=t-s,l=Math.sqrt(i*i+a*a)/r;return o=e,s=t,c=n,l}let u=({x:e,y:n,placement:o,elements:s,onClose:c,nodeId:u,tree:d})=>function(f){function p(){i.clear(),c()}if(i.clear(),!s.domReference||!s.floating||o==null||e==null||n==null)return;let{clientX:m,clientY:h}=f,g=[m,h],_=PS(f),v=f.type===`mouseleave`,y=NS(s.floating,_),b=NS(s.domReference,_),x=s.domReference.getBoundingClientRect(),S=s.floating.getBoundingClientRect(),C=o.split(`-`)[0],w=e>S.right-S.width/2,T=n>S.bottom-S.height/2,E=qO(g,x),D=S.width>x.width,O=S.height>x.height,k=(D?x:S).left,A=(D?x:S).right,j=(O?x:S).top,M=(O?x:S).bottom;if(y&&(a=!0,!v))return;if(b&&(a=!1),b&&!v){a=!0;return}if(v&&Bx(f.relatedTarget)&&NS(s.floating,f.relatedTarget)||d&&HS(d.nodesRef.current,u).some(({context:e})=>e?.open))return;if(C===`top`&&n>=x.bottom-1||C===`bottom`&&n<=x.top+1||C===`left`&&e>=x.right-1||C===`right`&&e<=x.left+1)return p();let N=[];switch(C){case`top`:N=[[k,x.top+1],[k,S.bottom-1],[A,S.bottom-1],[A,x.top+1]];break;case`bottom`:N=[[k,S.top+1],[k,x.bottom-1],[A,x.bottom-1],[A,S.top+1]];break;case`left`:N=[[S.right-1,M],[S.right-1,j],[x.left+1,j],[x.left+1,M]];break;case`right`:N=[[x.right-1,M],[x.right-1,j],[S.left+1,j],[S.left+1,M]];break;default:}function P([e,n]){switch(C){case`top`:return[[D?e+t/2:w?e+t*4:e-t*4,n+t+1],[D?e-t/2:w?e+t*4:e-t*4,n+t+1],...[[S.left,w||D?S.bottom-t:S.top],[S.right,w?D?S.bottom-t:S.top:S.bottom-t]]];case`bottom`:return[[D?e+t/2:w?e+t*4:e-t*4,n-t],[D?e-t/2:w?e+t*4:e-t*4,n-t],...[[S.left,w||D?S.top+t:S.bottom],[S.right,w?D?S.top+t:S.bottom:S.top+t]]];case`left`:{let r=[e+t+1,O?n+t/2:T?n+t*4:n-t*4],i=[e+t+1,O?n-t/2:T?n+t*4:n-t*4];return[...[[T||O?S.right-t:S.left,S.top],[T?O?S.right-t:S.left:S.right-t,S.bottom]],r,i]}case`right`:return[[e-t,O?n+t/2:T?n+t*4:n-t*4],[e-t,O?n-t/2:T?n+t*4:n-t*4],...[[T||O?S.left+t:S.right,S.top],[T?O?S.left+t:S.right:S.left+t,S.bottom]]];default:return[]}}if(!KO([m,h],N)){if(a&&!E)return p();if(!v&&r){let e=l(f.clientX,f.clientY);if(e!==null&&e<.1)return p()}KO([m,h],P([e,n]))?!a&&r&&i.start(40,p):p()}};return u.__options={blockPointerEvents:n},u}var YO={..._O,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),isInstantPhase:Q(e=>e.isInstantPhase),trackCursorAxis:Q(e=>e.trackCursorAxis),disableHoverablePopup:Q(e=>e.disableHoverablePopup),lastOpenChangeReason:Q(e=>e.openChangeReason),closeDelay:Q(e=>e.closeDelay)},XO=class e extends iO{constructor(e){super({...ZO(),...e},{popupRef:J.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new mO},YO)}setOpen=(e,t)=>{let n=t.reason,r=n===Ww,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0);let o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};r?ec.flushSync(o):o()};static useStore(t,n){let r=kx(()=>t??new e(n)).current,i=bO({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=i,r}};function ZO(){return{...gO(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeDelay:0}}function QO(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=XO.useStore(l?.store,{open:r??n,activeTriggerId:u===void 0?d:u});p.useControlledProp(`open`,r,n),p.useControlledProp(`activeTriggerId`,u,d),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=p.useState(`activeTriggerId`),g=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i});let _=!t&&m;wx(()=>{m&&t&&p.setOpen(!1,tT(Qw))},[m,t,p]),p.useSyncedValue(`disabled`,t),fO(p);let{forceUnmount:v,transitionStatus:y}=pO(_,p),b=p.useState(`isInstantPhase`),x=p.useState(`instantType`),S=p.useState(`lastOpenChangeReason`),C=J.useRef(null);wx(()=>{y===`ending`&&S===`none`||y!==`ending`&&b?(x!==`delay`&&(C.current=x),p.set(`instantType`,`delay`)):C.current!==null&&(p.set(`instantType`,C.current),C.current=null)},[y,b,S,x,p]),wx(()=>{_&&(h??p.set(`payload`,void 0))},[p,h,_]);let w=J.useCallback(()=>{p.setOpen(!1,$O(p,$w))},[p]);J.useImperativeHandle(o,()=>({unmount:v,close:w}),[v,w]);let T=p.useState(`floatingRootContext`),{getReferenceProps:E,getFloatingProps:D,getTriggerProps:O}=NO([SO(T,{enabled:!t}),jD(T,{enabled:!t,referencePress:!0}),yE(T,{enabled:!t&&a!==`none`,axis:a===`none`?void 0:a})]),k=J.useMemo(()=>E(),[E]),A=J.useMemo(()=>O(),[O]),j=J.useMemo(()=>D(),[D]);return p.useSyncedValues({floatingRootContext:T,activeTriggerProps:k,inactiveTriggerProps:A,popupProps:j}),(0,Y.jsx)(Ex.Provider,{value:p,children:typeof f==`function`?f({payload:g}):f})}function $O(e,t){let n=tT(t);return n.preventUnmountOnClose=()=>{e.set(`preventUnmountingOnClose`,!0)},n}var ek=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),tk={[ek.startingStyle]:``},nk={[ek.endingStyle]:``},rk={transitionStatus(e){return e===`starting`?tk:e===`ending`?nk:null}},ik=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=ek.startingStyle]=`startingStyle`,e[e.endingStyle=ek.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e}({}),ak=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),ok={[ak.popupOpen]:``},sk={[ak.popupOpen]:``,[ak.pressed]:``},ck={[ik.open]:``},lk={[ik.closed]:``},uk={[ik.anchorHidden]:``},dk={open(e){return e?ok:null}},fk={open(e){return e?sk:null}},pk={open(e){return e?ck:lk},anchorHidden(e){return e?uk:null}};function mk(e){return ww(e,`base-ui`)}var hk=J.createContext(void 0);function gk(){return J.useContext(hk)}var _k=J.forwardRef(function(e,t){let{className:n,render:r,handle:i,payload:a,disabled:o,delay:s,closeDelay:c,id:l,...u}=e,d=Dx(!0),f=i?.store??d;if(!f)throw Error(Tx(82));let p=mk(l),m=f.useState(`isTriggerActive`,p),h=f.useState(`floatingRootContext`),g=f.useState(`isOpenedByTrigger`,p),_=J.useRef(null),v=s??600,y=c??0,{registerTrigger:b,isMountedByThisTrigger:x}=dO(p,_,f,{payload:a,closeDelay:y}),S=gk(),{delayRef:C,isInstantPhase:w,hasProvider:T}=oT(h,{open:g});f.useSyncedValue(`isInstantPhase`,w);let E=f.useState(`disabled`),D=o??E,O=f.useState(`trackCursorAxis`),k=f.useState(`disableHoverablePopup`),A=MO(h,{enabled:!D,mouseOnly:!0,move:!1,handleClose:!k&&O!==`both`?JO():null,restMs(){let e=S?.delay,t=typeof C.current==`object`?C.current.open:void 0,n=v;return T&&(n=t===0?0:s??e??v),n},delay(){let e=typeof C.current==`object`?C.current.close:void 0,t=y;return c==null&&T&&(t=e),{close:t}},triggerElementRef:_,isActiveTrigger:m}),j=J.useMemo(()=>({open:g}),[g]),M=f.useState(`triggerProps`,x);return XT(`button`,e,{state:j,ref:[t,b,_],props:[A,M,{id:p},u],stateAttributesMapping:dk})}),vk=J.createContext(void 0);function yk(){let e=J.useContext(vk);if(e===void 0)throw Error(Tx(70));return e}var bk=J.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,...o}=e,{portalNode:s,portalSubtree:c}=rE({container:r,ref:t,componentProps:e,elementProps:o});return!c&&!s?null:(0,Y.jsxs)(J.Fragment,{children:[c,s&&ec.createPortal(n,s)]})}),xk=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Dx().useState(`mounted`)||n?(0,Y.jsx)(vk.Provider,{value:n,children:(0,Y.jsx)(bk,{ref:t,...r})}):null}),Sk=J.createContext(void 0);function Ck(){let e=J.useContext(Sk);if(e===void 0)throw Error(Tx(71));return e}var wk=J.createContext(void 0);function Tk(){return J.useContext(wk)?.direction??`ltr`}var Ek=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=iC(e,t)||{};if(l==null)return{};let f=SC(u),p={x:n,y:r},m=uC(i),h=cC(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=rC(k,j,A),N=!c.arrow&&oC(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),Dk=(e,t)=>({...Ek(e),options:[e,t]}),Ok={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await OD().fn(e)).data?.referenceHidden||a}}}},kk={sideX:`left`,sideY:`top`},Ak={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=Lx(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:kk};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=vT(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=aC(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:kk.sideX,g=f===`top`?`bottom`:kk.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function jk(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function Mk(e,t,n){let{rects:r,placement:i}=e;return{side:jk(t,aC(i),n),align:oC(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Nk(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:p,mounted:m,collisionAvoidance:h,shiftCrossAxis:g=!1,nodeId:_,adaptiveOrigin:v,lazyFlip:y=!1,externalTree:b}=e,[x,S]=J.useState(null);!m&&x!==null&&S(null);let C=h.side||`flip`,w=h.align||`flip`,T=h.fallbackAxisSide||`end`,E=typeof t==`function`?t:void 0,D=uS(E),O=E?D:t,k=oS(t),A=Tk()===`rtl`,j=x||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":A?`left`:`right`,"inline-start":A?`right`:`left`}[r],M=a===`center`?j:`${j}-${a}`,N=c,P=r===`bottom`?1:0,F=r===`top`?1:0,I=r===`right`?1:0,L=r===`left`?1:0;typeof N==`number`?N={top:N+P,right:N+L,bottom:N+F,left:N+I}:N&&={top:(N.top||0)+P,right:(N.right||0)+L,bottom:(N.bottom||0)+F,left:(N.left||0)+I};let R={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:N},z=J.useRef(null),B=oS(i),V=oS(o),H=[CD(e=>{let t=Mk(e,r,A),n=typeof B.current==`function`?B.current(t):B.current,i=typeof V.current==`function`?V.current(t):V.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,A,r])],U=w===`none`&&C!==`shift`,W=!U&&(l||g||C===`shift`),ee=C===`none`?null:ED({...R,padding:{top:N.top+1,right:N.right+1,bottom:N.bottom+1,left:N.left+1},mainAxis:!g&&C===`flip`,crossAxis:w===`flip`?`alignment`:!1,fallbackAxisSideDirection:T}),te=U?null:wD(e=>{let t=vT(e.elements.floating).documentElement;return{...R,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:w!==`none`,crossAxis:W,limiter:l||g?void 0:TD(e=>{if(!z.current)return{};let{width:t,height:n}=z.current.getBoundingClientRect(),r=lC(aC(e.placement)),i=r===`y`?t:n,a=r===`y`?N.left+N.right:N.top+N.bottom;return{offset:i/2+a/2}})}},[R,l,g,N,w]);C===`shift`||w===`shift`||a===`center`?H.push(te,ee):H.push(ee,te),H.push(DD({...R,apply({elements:{floating:e},rects:{reference:t},availableWidth:n,availableHeight:r}){Object.entries({"--available-width":`${n}px`,"--available-height":`${r}px`,"--anchor-width":`${t.width}px`,"--anchor-height":`${t.height}px`}).forEach(([t,n])=>{e.style.setProperty(t,n)})}}),Dk(()=>({element:z.current||document.createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=aC(a),l=lC(c),u=z.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(Mk(e,r,A)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,W&&l===`y`&&b?S:x),{}}},Ok,v),wx(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[m,p]);let ne=J.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:re,elements:ie,x:ae,y:oe,middlewareData:G,update:se,placement:K,context:ce,isPositioned:le,floatingStyles:ue}=yO({rootContext:p,placement:M,middleware:H,strategy:n,whileElementsMounted:f?void 0:(...e)=>lD(...e,ne),nodeId:_,externalTree:b}),{sideX:de,sideY:fe}=G.adaptiveOrigin||kk,pe=le?n:`fixed`,q=J.useMemo(()=>v?{position:pe,[de]:ae,[fe]:oe}:{position:pe,...ue},[v,pe,de,ae,fe,oe,ue]),me=J.useRef(null);wx(()=>{if(!m)return;let e=k.current,t=typeof e==`function`?e():e,n=(Pk(t)?t.current:t)||null;n!==me.current&&(re.setPositionReference(n),me.current=n)},[m,re,O,k]),J.useEffect(()=>{if(!m)return;let e=k.current;typeof e!=`function`&&Pk(e)&&e.current!==me.current&&(re.setPositionReference(e.current),me.current=e.current)},[m,re,O,k]),J.useEffect(()=>{if(f&&m&&ie.domReference&&ie.floating)return lD(ie.domReference,ie.floating,se,ne)},[f,m,ie,se,ne]);let he=aC(K),ge=jk(r,he,A),_e=oC(K)||`center`,ve=!!G.hide?.referenceHidden;wx(()=>{y&&m&&le&&S(he)},[y,m,le,he]);let ye=J.useMemo(()=>({position:`absolute`,top:G.arrow?.y,left:G.arrow?.x}),[G.arrow]),be=G.arrow?.centerOffset!==0;return J.useMemo(()=>({positionerStyles:q,arrowStyles:ye,arrowRef:z,arrowUncentered:be,side:ge,align:_e,physicalSide:he,anchorHidden:ve,refs:re,context:ce,isPositioned:le,update:se}),[q,ye,z,be,ge,_e,he,ve,re,ce,le,se])}function Pk(e){return e!=null&&`current`in e}function Fk(e){return e===`starting`?Lw:Iw}var Ik=J.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Bw,...g}=e,_=Dx(),v=yk(),y=_.useState(`open`),b=_.useState(`mounted`),x=_.useState(`trackCursorAxis`),S=_.useState(`disableHoverablePopup`),C=_.useState(`floatingRootContext`),w=_.useState(`instantType`),T=_.useState(`transitionStatus`),E=Nk({anchor:i,positionMethod:a,floatingRootContext:C,mounted:b,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:v,collisionAvoidance:h,adaptiveOrigin:Ak}),D=J.useMemo(()=>{let e={};return(!y||x===`both`||S)&&(e.pointerEvents=`none`),{role:`presentation`,hidden:!b,style:{...E.positionerStyles,...e}}},[y,x,S,b,E.positionerStyles]),O=J.useMemo(()=>({open:y,side:E.side,align:E.align,anchorHidden:E.anchorHidden,instant:x===`none`?w:`tracking-cursor`}),[y,E.side,E.align,E.anchorHidden,x,w]),k=J.useMemo(()=>({...O,arrowRef:E.arrowRef,arrowStyles:E.arrowStyles,arrowUncentered:E.arrowUncentered}),[O,E.arrowRef,E.arrowStyles,E.arrowUncentered]),A=XT(`div`,e,{state:O,props:[D,Fk(T),g],ref:[t,_.useStateSetter(`positionerElement`)],stateAttributesMapping:pk});return(0,Y.jsx)(Sk.Provider,{value:k,children:A})});function Lk(e){let t=eS(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Vx(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return($S(n)!==a||$S(r)!==o)&&(n=a,r=o),{width:n,height:r}}var Rk=typeof ResizeObserver<`u`,zk=()=>!0;function Bk(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,enabled:a=zk,onMeasureLayout:o,onMeasureLayoutComplete:s,side:c,direction:l}=e,u=J.useRef(!0),d=cO(t,!0,!1),f=_T(),p=J.useRef(null),m=uS(o),h=uS(s),g=J.useMemo(()=>{let e=c===`top`,t=c===`left`;return l===`rtl`?(e||=c===`inline-end`,t||=c===`inline-end`):(e||=c===`inline-start`,t||=c===`inline-start`),e?{position:`absolute`,[c===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:Iw},[c,l]);wx(()=>{if(!i||!a()||!Rk){u.current=!0,p.current=null;return}if(!t||!n)return;Object.entries(g).forEach(([e,n])=>{t.style.setProperty(e,n)});let e=new ResizeObserver(e=>{let t=e[0];t&&(p.current===null?p.current={width:Math.ceil(t.borderBoxSize[0].inlineSize),height:Math.ceil(t.borderBoxSize[0].blockSize)}:(p.current.width=Math.ceil(t.borderBoxSize[0].inlineSize),p.current.height=Math.ceil(t.borderBoxSize[0].blockSize)))});e.observe(t),t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`);let r=Vk(t,`position`,`static`),o=Vk(t,`transform`,`none`),s=Vk(t,`scale`,`1`),c=Vk(n,`--available-width`,`max-content`),l=Vk(n,`--available-height`,`max-content`);if(m?.(),u.current||p.current===null){n.style.setProperty(`--positioner-width`,`max-content`),n.style.setProperty(`--positioner-height`,`max-content`);let i=Lk(t);return n.style.setProperty(`--positioner-width`,`${i.width}px`),n.style.setProperty(`--positioner-height`,`${i.height}px`),r(),o(),s(),c(),l(),h?.(null,i),u.current=!1,()=>{e.disconnect()}}t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`),n.style.setProperty(`--positioner-width`,`max-content`),n.style.setProperty(`--positioner-height`,`max-content`);let _=Lk(t);t.style.setProperty(`--popup-width`,`${p.current.width}px`),t.style.setProperty(`--popup-height`,`${p.current.height}px`),r(),o(),c(),l(),h?.(p.current,_),n.style.setProperty(`--positioner-width`,`${_.width}px`),n.style.setProperty(`--positioner-height`,`${_.height}px`);let v=new AbortController;return f.request(()=>{t.style.setProperty(`--popup-width`,`${_.width}px`),t.style.setProperty(`--popup-height`,`${_.height}px`),d(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},v.signal)}),()=>{e.disconnect(),v.abort(),f.cancel()}},[r,t,n,d,f,a,i,m,h,g])}function Vk(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}var Hk={...pk,...rk},Uk=J.forwardRef(function(e,t){let{className:n,render:r,...i}=e,a=Dx(),{side:o,align:s}=Ck(),c=a.useState(`open`),l=a.useState(`mounted`),u=a.useState(`instantType`),d=a.useState(`transitionStatus`),f=a.useState(`popupProps`),p=a.useState(`payload`),m=a.useState(`popupElement`),h=a.useState(`positionerElement`),g=a.useState(`floatingRootContext`),_=Tk();lO({open:c,ref:a.context.popupRef,onComplete(){c&&a.context.onOpenChangeComplete?.(!0)}});function v(){g.context.events.emit(`measure-layout`)}function y(e,t){g.context.events.emit(`measure-layout-complete`,{previousDimensions:e,nextDimensions:t})}Bk({popupElement:m,positionerElement:h,mounted:l,content:p,enabled:()=>a.context.triggerElements.size>1,onMeasureLayout:v,onMeasureLayoutComplete:y,side:o,direction:_});let b=a.useState(`disabled`),x=a.useState(`closeDelay`);return OO(g,{enabled:!b,closeDelay:x}),XT(`div`,e,{state:J.useMemo(()=>({open:c,side:o,align:s,instant:u,transitionStatus:d}),[c,o,s,u,d]),ref:[t,a.context.popupRef,a.useStateSetter(`popupElement`)],props:[f,Fk(d),i],stateAttributesMapping:Hk})}),Wk=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=J.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=J.useMemo(()=>({open:t,close:n}),[t,n]);return(0,Y.jsx)(hk.Provider,{value:i,children:(0,Y.jsx)(aT,{delay:a,timeoutMs:r,children:e.children})})};function Gk(e){return MT(19)?e:e?`true`:void 0}var Kk=Wk;function qk({children:e,content:t,side:n=`bottom`}){return(0,Y.jsxs)(QO,{children:[(0,Y.jsx)(_k,{render:e}),(0,Y.jsx)(xk,{children:(0,Y.jsx)(Ik,{className:`ui-tooltip-positioner`,side:n,sideOffset:6,children:(0,Y.jsx)(Uk,{className:`ui-tooltip`,children:t})})})]})}var Jk=null,Yk=null;function Xk(){return Jk||=Z(()=>import(`./edit-BMeAI0Sj.js`).then(e=>(Yk=e.Editor,e)),[]).catch(e=>{throw Jk=null,Yk=null,e}),Jk}async function Zk(){await Xk()}function Qk(){return Yk}function $k(e,t){let n=t;for(;n>0&&!/[ \t]/.test(e[n-1]);)n--;return n}var eA=`warning`,tA=`error`,nA=`info`,rA=`hint`;function iA(e,t){let n=[],r=e.split(`
1542
+ `}function eb(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function tb(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function nb(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function rb(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function ib(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Gv(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function ab(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}var ob=-1,sb=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++ob}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;pendingFiles;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:Dt},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new nv,this.scrollSyncManager=new Ay,this.interactionManager=new I_(`diff`,L_(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return ib(e)}createHunksRenderer(e){return new zy(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{let n=this.fileDiffCache;if(n==null)return;let r=n.hunks.at(-1),i,a;hunkIterator:for(let o of n.hunks){let n=t===`deletions`?o.deletionStart:o.additionStart,s=t===`deletions`?o.deletionCount:o.additionCount,c=zt(n,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(e<c){let t=c-e;i=Math.max(u-t,0),a=Math.max(l-t,0);break hunkIterator}if(e>=c+s){if(o===r){let t=e-(c+s);i=u+o.unifiedLineCount+t,a=l+o.splitLineCount+t;break hunkIterator}continue}for(let n of o.hunkContent)if(n.type===`context`)if(e<c+n.lines){let t=e-c;a=l+t,i=u+t;break hunkIterator}else c+=n.lines,l+=n.lines,u+=n.lines;else{let r=t===`deletions`?n.deletions:n.additions;if(e<c+r){let r=e-c;i=u+(t===`additions`?n.deletions:0)+r,a=l+r;break hunkIterator}else c+=r,l+=Math.max(n.deletions,n.additions),u+=n.deletions+n.additions}break hunkIterator}if(!(i==null||a==null))return[i,a]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(L_(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!pn(this.appliedThemeCSS.theme,this.options.theme??Dt)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`?!0:e===`scroll`&&(this.lineAnnotations.length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){Uh(this.handleEditSessionRender),this.emitPostRender(!0),this.editor?.cleanUp(e),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.pendingFiles=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=vy(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t),db(this.pre,lb({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||fb(this.headerElement,ub({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),ny(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?Pg(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;e==null||t==null||!ab(e)||this.pendingFiles?.fileDiff===e||(this.pendingFiles={fileDiff:e,promise:this.loadFilesForDiff(e,t)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}finally{this.pendingFiles?.fileDiff===e&&(this.pendingFiles=void 0)}}async handleFilesLoaded(e,t){this.fileDiff!==e||!e.isPartial||(xy(`merge`,e,t),this.setHydratedState(t),await my(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender())}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){let l=vy(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);e!=null&&e.cacheKey===void 0&&(e.cacheKey=e.prevName==null?e.name:e.prevName+`:`+e.name),this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!cb(u,this.deletionFile)||!cb(d,this.additionFile)),y=e!=null&&e!==this.fileDiff,b=i!=null&&(i.length>0||this.lineAnnotations.length>0)?i!==this.lineAnnotations:!1;if(!f&&uv(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&e===this.fileDiff||e==null&&!v))return this.applyCachedThemeState(p);let x;e==null&&_&&(v||this.fileDiff==null)&&(x=Pg(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;if(this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e==null?x!=null&&(y=!0,this.fileDiff=x):this.fileDiff=e,y&&(this.cachedHeaderHTML=void 0),i!=null&&this.setLineAnnotations(i),this.fileDiff==null)return!1;this.fileDiff.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(f_(this.fileDiff,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:C=!1,disableFileHeader:w=!1}=this.options;if(w&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,It);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g)&&this.applyPartialRender({previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}get fileDiffCache(){return this.hunksRenderer.diffCache??this.fileDiff}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.fileDiffCache,r=this.lineAnnotations,i=this.computeEditorRenderRange(this.renderRange);e!=null&&t!=null&&n!=null&&!n.isPartial&&this.hunksRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.fileDiffCache!==n||e.__syncRenderView(a,t,n,r,i)})}computeEditorRenderRange(e){let t=this.fileDiffCache;if(e==null||t==null||jy(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return Cm({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.attachEditor: cannot attach an editor to a "${this.type}" diff`);return this.editor?.cleanUp(),this.editor=e,this.hunksRenderer.beginEditSession(),this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary(),this.hunksRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),e=>{this.editor=void 0,e!==!0&&this.finishEditSession()}}finishEditSession(){this.hunksRenderer.endEditSession(),this.completeEditSession()}completeEditSession(){let e=this.fileDiffCache;if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=u_(e,this.hunksRenderer.getExpandedHunksMap(),t);return f_(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(d_(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){this.hunksRenderer.applyDocumentChange(e);let n=this.hunksRenderer.diffCache;if(n!=null){let e=this.fileDiff?.cacheKey;e!=null&&n.cacheKey==null&&(n.cacheKey=e),this.fileDiff=n}t!==void 0&&t!==this.lineAnnotations&&(this.setLineAnnotations(t),this.hunksRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations()),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let{shouldRefreshDiffsView:r,lineCountChangeInFlight:i}=n;if(this.hunksRenderer.updateRenderCache(e,t,i)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}r===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}isLineRenderable(e){let t=this.fileDiffCache;if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return hm({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.fileDiffCache;if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return gm({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.fileDiffCache,{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=um(o);if(e<s){let c=dm({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=mm({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=um(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){Hh(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||rm(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!rb(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${Lt(r)}`,a=this.annotationCache.get(i);if(a==null||!nb(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:Mv(Lt(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Nv();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:O_(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):O_(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=Dv;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??Co(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:a,renderHeaderFilenameSuffix:o,renderHeaderMetadata:s}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Et,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let c=a?.(n)??void 0,l=o?.(n)??void 0,u=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Ct,c),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,wt,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Tt,u),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===t&&this.appliedUnsafeCSS===e||(this.unsafeCSSStyle??=Pv(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Vv(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??Dt,s=typeof o==`string`?o:{...o},c=Iv(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Yv({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Hv(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=Uv(this.themeCSSStyle.textContent??``,Iv(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&ey()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Jv(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=pb(t[0]),a=pb(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=Co(i),r.content.innerHTML=Co(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=qv({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=qv({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=qv({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){if(this.options.diffStyle!==`split`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(t))return;let n=(t,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(t,e),i=pb(r?.[0]),a=pb(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};n(`deletions`,t[0]),n(`additions`,t[1])}refreshUnifiedDiffView(){if(this.options.diffStyle!==`unified`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(t==null||Array.isArray(t))return;let n=this.hunksRenderer.renderCodeAST(`unified`,e),r=pb(n?.[0]),i=pb(n?.[1]),a=()=>{for(let[e,n]of[[t.gutter,r],[t.content,i]])n!=null&&(e.innerHTML=Co(n));e.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,t,e.rowCount),this.lastRowCount=e.rowCount)};this.shouldGuardRebuildScroll()?Jv(this.pre,a):a(),this.renderSeparators(e.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=pb(t[0]),i=pb(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}else throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l===`unified`?!1:t!=null&&n!=null,totalLines:r,customProperties:i};kv(u,this.appliedPreAttributes)||(ry(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function cb(e,t){return e==null||t==null?e==null&&t==null:mn(e,t)}function lb({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function ub({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function db(e,t,n=!1){return!n&&e==null&&t}function fb(e,t,n=!1){return e==null&&t&&!n}function pb(e){if(!(e==null||e.type!==`element`))return e.children??[]}var mb=3e3,hb=-1,gb=class extends sb{__id=`little-virtualized-file-diff:${++hb}`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;currentExpandUnchanged;pendingHydratedDiff;pendingExpansions;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=am(n)}setMetrics(e,t=!1){let n=am(e);!t&&Lh(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e===t?!1:(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return e==null||!A_(this.lineAnnotations)?!1:this.lineAnnotations.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type===`deleted`?t.side===`deletions`:!0:!1)}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!Rh(t,e),r=n&&wb(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Tb(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal!==0&&(this.cache.measuredHeightDeltaTotal=0),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}reconcileHeights(){let e=!1,{overflow:t=`scroll`}=this.options;if(this.fileContainer==null||this.fileDiff==null)return this.height!==0&&(e=!0),this.height=0,e;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled())return e;let n=this.getDiffStyle(),r=n===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],i=this.hasFileAnnotations(this.fileDiff);if(this.renderRange!=null&&i&&M_(this.renderRange)){let t=_b(r)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else !i&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of r){if(t==null)continue;let r=t.children[1];if(r instanceof HTMLElement)for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let i=kb(r,n),a=t.getBoundingClientRect().height,o=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(o=!0),a+=t.nextElementSibling.getBoundingClientRect().height);let s=this.getEstimatedLineHeight(o),c=this.cache.heightDeltas.get(i)??0,l=a-s;l!==c&&(e=!0,this.cache.measuredHeightDeltaTotal+=l-c,l===0?this.cache.heightDeltas.delete(i):this.cache.heightDeltas.set(i,l))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}prepareCodeViewItem(e,t,n,r){let i=!tm(this.fileDiff,e),a=this.syncLineAnnotations(r),o=n?.resetDiffLayoutCache===!0||i||a,s=i||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights;n?.metrics!=null&&(this.metrics=am(n.metrics),o=!0,s=!0);let{collapsed:c=!1,expandUnchanged:l=!1}=this.options;return this.currentCollapsed!==c&&(this.currentCollapsed=c,o=!0),this.currentExpandUnchanged!==l&&(this.currentExpandUnchanged=l,o=!0,s=!0),o&&this.resetLayoutCache({includeEstimatedHeights:s}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t=`additions`){if(this.fileDiff==null||e<1)return;let n=this.getLineIndex(e,t);if(n==null)return;let{disableFileHeader:r=!1,expandUnchanged:i=!1,collapsed:a=!1,collapsedContextThreshold:o=1}=this.options,s=this.getDiffStyle(),c=this.getHunkSeparatorType(),l=s===`split`?n[1]:n[0];this.approximateLayoutCheckpoints();let u=om(this.metrics,r),d=this.getLayoutCheckpointBeforeLineIndex(l),f=d?.top??u+this.cache.fileAnnotationHeight;if(a)return{top:u,height:0};let p;return Cm({diff:this.fileDiff,diffStyle:s,startingLine:d?.renderedLineIndex??0,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=s===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=xm({type:c,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(f+=r.gapBefore,l>=o-n&&l<o)return p={top:f,height:r.height},!0;f+=r.height+r.gapAfter}}let u=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===l)return p={top:f,height:u},!0;if(f+=u,r>0){let e=Sm({type:c,metrics:this.metrics});if(e!=null){if(l>o&&l<=o+r)return p={top:f+e.gapBefore,height:e.height},!0;f+=e.totalHeight}}return!1}}),p}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){if(this.fileDiff==null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:r=!1,collapsedContextThreshold:i=1}=this.options;if(r)return;let a=this.getDiffStyle(),o=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();let s=this.getLayoutCheckpointBeforeTop(e),c=s?.top??om(this.metrics,t)+this.cache.fileAnnotationHeight,l;return Cm({diff:this.fileDiff,diffStyle:a,startingLine:s?.renderedLineIndex??0,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:s,additionLine:u})=>{let d=a===`split`?u?.splitLineIndex??s?.splitLineIndex:u?.unifiedLineIndex??s?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=xm({type:o,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(c+=e.totalHeight)}if(c>=e&&(s==null?u!=null&&(l={lineNumber:u.lineNumber,side:`additions`,top:c}):l={lineNumber:s.lineNumber,side:`deletions`,top:c},l!=null))return!0;let f=this.getLineHeight(d,(u?.noEOFCR??!1)||(s?.noEOFCR??!1));if(c+=f,i>0){let e=Sm({type:o,metrics:this.metrics});e!=null&&(c+=e.totalHeight)}return!1}}),l}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.fileDiff==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.fileDiff,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.isSetup=!1,super.cleanUp(e)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(this.isAdvancedMode()){let n=xy(`clone`,e,t);if(await my(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(xy(`merge`,e,t),this.setHydratedState(t),await my(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e)return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}consumeCodeViewLayoutChanges(e){let t=!1,n,{pendingExpansions:r,pendingHydratedDiff:i}=this;if(r!=null){this.pendingExpansions=void 0;for(let e of r)this.hunksRenderer.expandHunk(e.hunkIndex,e.direction,e.expansionLineCountOverride),t=!0}return i!=null&&(this.pendingHydratedDiff=void 0,i.expectedDiff===e&&(this.setHydratedState(i.files),n=i.nextDiff)),n==null?t&&(this.forceRenderOverride=!0,this.invalidateDerivedLayoutCache(!0)):(this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0})),n}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.fileDiffCache;if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return hm({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.fileDiff==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;if(this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!==void 0&&this.fileDiff!==void 0){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(this.fileDiff,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.fileDiff){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=om(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getActiveEstimatedHeight(e=this.fileDiff){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.fileDiff){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=hy({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Eb(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.fileDiff){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=vy(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!Ob(s,this.deletionFile)||!Ob(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=Pg(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=this.syncLineAnnotations(r);p&&this.resetLayoutCache({includeEstimatedHeights:!1});let m=t!=null&&t!==this.fileDiff,h=u!=null&&!tm(this.fileDiff,u),g=m||l;if(h&&this.resetLayoutCache({includeEstimatedHeights:!0}),e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;if(f)this.top??=this.getVirtualizedTop(),h&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,u));else{this.computeApproximateSize(!1,u);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!g||!f))return this.fileDiff=u,a!=null&&(this.deletionFile=s,this.additionFile=c),h&&(this.cachedHeaderHTML=void 0),this.renderPlaceholder(this.height);let _=this.virtualizer.getWindowSpecs(),v=this.top??0,y=this.computeRenderRangeFromWindow(u,v,_),b=super.render({fileDiff:u,fileContainer:e,renderRange:y,lineAnnotations:r,forceRender:(d??n)||p||h,...a,...i});return this.isSimpleMode()&&b&&this.getSimpleVirtualizer()?.requestHeightReconcile(this),b}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return Db(this.options.hunkSeparators)}approximateLayoutCheckpoints(e=this.fileDiff){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e==null||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=Eb(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=vb(this.cache.heightDeltas),u=om(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=xb(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+Sb(i,e)*this.metrics.lineHeight+yb(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=mb}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+yb(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=dm({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?xm({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?mm({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?Sm({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:Cb({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=dm({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=mm({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=Eb(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=om(this.metrics,i),h=e.hunks.length>0?cm(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=(n+r)/2,O=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),k=t+(O?.top??_),A=O?.renderedLineIndex??0,j,M,N;if(Cm({diff:e,diffStyle:l,startingLine:O?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?xm({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;k+=y;let b=A%s===0,x=Math.floor(A/s);if(b&&(E[x]=k-(t+_+y),N!=null)){if(N<=0)return!0;N--}let S=this.getLineHeight(l===`split`?m:h,g);if(k>n-S&&k<r&&(j??=x),M==null&&k+S>D&&(M=x),N==null&&k>=r&&b&&(N=T),A++,k+=S,c>0||v&&d){let e=Sm({type:u,metrics:this.metrics});e!=null&&(k<r&&k+e.totalHeight>n&&(j??=x),M==null&&k+e.totalHeight>D&&(M=x),k+=e.totalHeight)}return!1}}),j==null)if(x)j=0,M=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};M??=j;let P=Math.round(M-w/2),F=Math.max(0,Math.ceil(p/s)-w),I=Math.max(0,Math.min(P,F)),L=I*s,R=P<0?C+P*s:C,z=E[I]??0,B=L===0?0:g+z,V=I+R/s,H=V<E.length?v-E[V]:v-(k-t-_);return{startingLine:L,totalLines:R,bufferBefore:B,bufferAfter:Math.max(0,H)}}};function _b(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===k_&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function vb(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function yb({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=bb(e,n);return(t[bb(e,r)]??0)-(t[i]??0)}function bb(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function xb(e){return Math.ceil(e/mb)*mb}function Sb(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Cb({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function wb(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Tb(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Eb(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Db(e){return typeof e==`function`?`custom`:e??`line-info`}function Ob(e,t){return e==null||t==null?e==null&&t==null:mn(e,t)}function kb(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function Ab(e,t){return typeof window>`u`&&t!=null?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,Y.jsx)(Y.Fragment,{children:e})}var jb=(0,J.createContext)(void 0);function Mb(){return(0,J.useContext)(jb)}var Nb=typeof window>`u`?J.useEffect:J.useLayoutEffect;function Pb({file:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=Mb(),f=i!==void 0,p=(0,J.useContext)(Nh),m=ut(),h=(0,J.useRef)(null),g=st(n=>{if(n!=null){if(h.current!=null)throw Error(`File: An instance should not already exist when a node is created`);d==null?h.current=new oy(Fb({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new fy(Fb({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({file:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`File: A File instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return Nb(()=>{if(h.current==null)return;let n=Fb({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),a=n!==void 0&&!Rh(h.current.options,n);h.current.setOptions(n),h.current.render({file:e,lineAnnotations:r,forceRender:a}),i!==void 0&&h.current.setSelectedLines(i)}),Nb(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`File: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`File: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,J.useCallback)(()=>h.current?.getHoveredLine(),[])}}function Fb({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?pt:e?.renderCustomHeader,renderGutterUtility:r?pt:e?.renderGutterUtility}:e}function Ib({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,metrics:a,className:o,style:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,prerenderedHTML:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=Pb({file:e,options:r,editorOptions:i,metrics:a,lineAnnotations:t,selectedLines:n,prerenderedHTML:p,hasGutterRenderUtility:m!=null,hasCustomHeader:l!=null,disableWorkerPool:h,edit:g});return(0,Y.jsx)(ht,{ref:_,className:o,style:s,children:Ab(fn({file:e,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,renderGutterUtility:m,lineAnnotations:t,getHoveredLine:v}),p)})}var Lb=typeof window>`u`?J.useEffect:J.useLayoutEffect;function Rb({fileDiff:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=Mb(),f=i!==void 0,p=(0,J.useContext)(Nh),m=ut(),h=(0,J.useRef)(null),g=st(n=>{if(n!=null){if(h.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);d==null?h.current=new sb(zb({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new gb(zb({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({fileDiff:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return Lb(()=>{let{current:n}=h;if(n==null)return;let a=zb({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),o=a!==void 0&&!Rh(n.options,a);n.setOptions(a),n.render({forceRender:o,fileDiff:e,lineAnnotations:r}),i!==void 0&&n.setSelectedLines(i)}),Lb(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`FileDiff: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`FileDiff: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,J.useCallback)(()=>h.current?.getHoveredLine(),[])}}function zb({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?pt:e?.renderCustomHeader,renderGutterUtility:r?pt:e?.renderGutterUtility}:e}function Bb({fileDiff:e,options:t,editorOptions:n,metrics:r,lineAnnotations:i,selectedLines:a,className:o,style:s,prerenderedHTML:c,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=Rb({fileDiff:e,options:t,editorOptions:n,metrics:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:c,hasGutterRenderUtility:m!=null,hasCustomHeader:u!=null,disableWorkerPool:h,edit:g});return(0,Y.jsx)(ht,{ref:_,className:o,style:s,children:Ab(un({fileDiff:e,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderAnnotation:l,renderGutterUtility:m,lineAnnotations:i,getHoveredLine:v}),c)})}function Vb({oldFile:e,newFile:t,options:n,editorOptions:r,metrics:i,lineAnnotations:a,selectedLines:o,className:s,style:c,prerenderedHTML:l,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1}){let v=(0,J.useMemo)(()=>Pg(e,t,n?.parseDiffOptions),[e,t,n?.parseDiffOptions]),{ref:y,getHoveredLine:b}=Rb({fileDiff:v,options:n,editorOptions:r,metrics:i,lineAnnotations:a,selectedLines:o,prerenderedHTML:l,hasGutterRenderUtility:h!=null,hasCustomHeader:d!=null,disableWorkerPool:g,edit:_});return(0,Y.jsx)(ht,{ref:y,className:s,style:c,children:Ab(un({fileDiff:v,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderAnnotation:u,lineAnnotations:a,renderGutterUtility:h,getHoveredLine:b}),l)})}var Hb=class extends zy{pendingConflictActions=[];pendingMarkerRows=[];injectedRows=new Map;options;constructor(e={theme:Dt},t,n){super(void 0,t,n),this.options=e}setConflictState(e,t,n){this.pendingConflictActions=e,this.pendingMarkerRows=t,this.syncInjectedRows(e,t,n)}syncInjectedRows(e,t,n){this.injectedRows.clear();for(let t of e){let e=t==null?void 0:Vt(t,n);if(t==null||e==null)continue;let r={type:`actions`,hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:t.conflictIndex};this.addInjectedRow(r)}for(let e of t)this.addInjectedRow(e)}addInjectedRow(e){let t=`${e.hunkIndex}:${e.lineIndex}`,n=this.injectedRows.get(t);n==null?this.injectedRows.set(t,[e]):n.push(e)}renderDiff(e,t=Ft){return e!=null&&this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.renderDiff(e,t)}async asyncRender(e,t=Ft){return this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.asyncRender(e,t)}createPreElement(e,t){return super.createPreElement(e,t,{"data-has-merge-conflict":``})}getUnifiedLineDecoration({type:e,lineType:t}){let n=e===`change`?t===`change-deletion`?`current`:`incoming`:void 0;return{gutterLineType:e===`change`?`context`:t,gutterProperties:Ub(n),contentProperties:Wb(e,n)}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`current`:`incoming`:void 0;return{gutterLineType:t===`change`?`context`:t,gutterProperties:Ub(n),contentProperties:Wb(t,n)}}getUnifiedInjectedRowsForLine=e=>{let t=this.injectedRows.get(`${e.hunkIndex}:${e.lineIndex}`);if(t==null||t.length===0)return;let{mergeConflictActionsType:n}=this.getOptionsWithDefaults(),r=[],i=[];for(let e of t){if(e.type===`actions`){r.push({content:Kb({row:e,includeDefaultActions:n===`default`,includeSlot:!0}),gutter:Gb(`action`)});continue}(e.type===`marker-end`?i:r).push({content:qb(e),gutter:Gb(`marker`,e.type)})}return{before:r.length>0?r:void 0,after:i.length>0?i:void 0}};getOptionsWithDefaults(){let e=super.getOptionsWithDefaults();return e.diffStyle=`unified`,e.lineDiffType=`none`,e.mergeConflictActionsType=this.options.mergeConflictActionsType??`default`,e}};function Ub(e){return e==null?void 0:{"data-merge-conflict":e}}function Wb(e,t){if(t!=null){if(e===`change`)return t===`current`||t===`incoming`?{"data-line-type":`context`,"data-merge-conflict":t}:void 0;if(t===`marker-start`||t===`marker-base`||t===`marker-separator`||t===`marker-end`)return{"data-merge-conflict":t}}}function Gb(e,t){let n=gp(void 0,`annotation`,1);return n.properties[`data-gutter-buffer`]=e===`action`?`merge-conflict-action`:`merge-conflict-${t??`marker`}`,n}function Kb({row:e,includeDefaultActions:t,includeSlot:n}){let r=t?Jb(e.conflictIndex):[];return n&&r.push(dp({tagName:`slot`,properties:{name:Rt({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:e.conflictIndex}),"data-merge-conflict-action-slot":``}})),dp({tagName:`div`,properties:{"data-merge-conflict-actions":``},children:[dp({tagName:`div`,properties:{"data-merge-conflict-actions-content":``},children:r})]})}function qb(e){return dp({tagName:`div`,properties:{"data-merge-conflict":e.type,"data-merge-conflict-marker-row":``},children:[up(e.lineText.replace(/(?:\r\n|\n|\r)$/,``))]})}function Jb(e){return[Yb({resolution:`current`,label:`Accept current change`,conflictIndex:e}),Xb(),Yb({resolution:`incoming`,label:`Accept incoming change`,conflictIndex:e}),Xb(),Yb({resolution:`both`,label:`Accept both`,conflictIndex:e})]}function Yb({resolution:e,label:t,conflictIndex:n}){return dp({tagName:`button`,properties:{type:`button`,"data-merge-conflict-action":e,"data-merge-conflict-conflict-index":`${n}`},children:[up(t)]})}function Xb(){return dp({tagName:`span`,properties:{"data-merge-conflict-action-separator":``},children:[up(`|`)]})}function Zb(e,t){return e.hunkIndex===t.hunkIndex&&e.startContentIndex===t.startContentIndex&&e.endContentIndex===t.endContentIndex&&e.currentContentIndex===t.currentContentIndex&&e.baseContentIndex===t.baseContentIndex&&e.incomingContentIndex===t.incomingContentIndex&&e.endMarkerContentIndex===t.endMarkerContentIndex&&e.conflictIndex===t.conflictIndex&&Qb(e.conflict,t.conflict)}function Qb(e,t){return e.conflictIndex===t.conflictIndex&&e.startLineIndex===t.startLineIndex&&e.startLineNumber===t.startLineNumber&&e.separatorLineIndex===t.separatorLineIndex&&e.separatorLineNumber===t.separatorLineNumber&&e.endLineIndex===t.endLineIndex&&e.endLineNumber===t.endLineNumber&&e.baseMarkerLineIndex===t.baseMarkerLineIndex&&e.baseMarkerLineNumber===t.baseMarkerLineNumber}function $b(e){let t=typeof e==`string`?e:e.type;return t===`accept`||t===`incoming`?`additions`:t===`reject`||t===`current`?`deletions`:`both`}function ex(e,t){let{resolution:n,hunkIndex:r,startContentIndex:i,endContentIndex:a,indexesToDelete:o=new Set}=t,s=e.hunks[r];if(s==null)throw console.error({diff:e,hunkIndex:r}),Error(`resolveRegion: Invalid hunk index: ${r}`);if(i<0||a>=s.hunkContent.length||i>a)throw Error(`resolveRegion: Invalid content range, ${i}, ${a}`);let{hunks:c,additionLines:l,deletionLines:u}=e,d={...e,hunks:[],deletionLines:[],additionLines:[],splitLineCount:0,unifiedLineCount:0,cacheKey:e.cacheKey==null?void 0:`${e.cacheKey}:${n[0]}-${r}:${i}-${a}`},f={nextAdditionLineIndex:0,nextDeletionLineIndex:0,nextAdditionStart:1,nextDeletionStart:1,splitLineCount:0,unifiedLineCount:0},p=r===c.length-1&&a===s.hunkContent.length-1,m=!e.isPartial;for(let[t,s]of c.entries()){nx(e,d,f,zt(s.deletionStart,s.deletionCount)-s.collapsedBefore,zt(s.additionStart,s.additionCount)-s.collapsedBefore,s.collapsedBefore,m);let c={...s,hunkContent:[],additionStart:f.nextAdditionStart,deletionStart:f.nextDeletionStart,additionLineIndex:f.nextAdditionLineIndex,deletionLineIndex:f.nextDeletionLineIndex,additionCount:0,deletionCount:0,deletionLines:0,additionLines:0,splitLineStart:f.splitLineCount,unifiedLineStart:f.unifiedLineCount,splitLineCount:0,unifiedLineCount:0};for(let[e,p]of s.hunkContent.entries())if(t!==r||e<i||e>a){rx(p,d,u,l);let e={...p,additionLineIndex:f.nextAdditionLineIndex,deletionLineIndex:f.nextDeletionLineIndex};c.hunkContent.push(e),ax(e,f,c)}else if(o.has(e))c.hunkContent.push({type:`context`,lines:0,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex});else if(p.type===`context`){rx(p,d,u,l);let e={...p,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex};c.hunkContent.push(e),ax(e,f,c)}else{ix(n,p,d,u,l);let e={type:`context`,lines:n===`deletions`?p.deletions:n===`additions`?p.additions:p.deletions+p.additions,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex};c.hunkContent.push(e),ax(e,f,c)}if(t===r&&p){let e=n===`deletions`?s.noEOFCRDeletions:s.noEOFCRAdditions;c.noEOFCRAdditions=e,c.noEOFCRDeletions=e}c.additionCount===0&&(c.additionStart--,e.isPartial||c.additionLineIndex--),c.deletionCount===0&&(c.deletionStart--,e.isPartial||c.deletionLineIndex--),d.hunks.push(c)}let h=c.at(-1);if(h!=null&&!e.isPartial){let e=Bt(h.deletionStart,h.deletionCount),t=Bt(h.additionStart,h.additionCount),n=Math.min(u.length-e,l.length-t);tx(d,u,l,e,t,n),f.splitLineCount+=n,f.unifiedLineCount+=n}return d.splitLineCount=f.splitLineCount,d.unifiedLineCount=f.unifiedLineCount,d}function tx(e,t,n,r,i,a){for(let o=0;o<a;o++){let a=t[r+o],s=n[i+o];if(a==null||s==null)throw Error(`pushCollapsedContextLines: missing collapsed context line`);e.deletionLines.push(a),e.additionLines.push(s)}}function nx(e,t,n,r,i,a,o){a<=0||(o&&(tx(t,e.deletionLines,e.additionLines,r,i,a),n.nextAdditionLineIndex+=a,n.nextDeletionLineIndex+=a),n.nextAdditionStart+=a,n.nextDeletionStart+=a,n.splitLineCount+=a,n.unifiedLineCount+=a)}function rx(e,t,n,r){if(e.type===`context`)for(let n=0;n<e.lines;n++){let i=r[e.additionLineIndex+n];if(i==null)throw console.error({additionLines:r,content:e,i:n}),Error(`pushContentLinesToDiff: Context line does not exist`);t.deletionLines.push(i),t.additionLines.push(i)}else{let i=Math.max(e.deletions,e.additions);for(let a=0;a<i;a++){if(a<e.deletions){let r=n[e.deletionLineIndex+a];if(r==null)throw console.error({deletionLines:n,content:e,i:a}),Error(`pushContentLinesToDiff: Deletion line does not exist`);t.deletionLines.push(r)}if(a<e.additions){let n=r[e.additionLineIndex+a];if(n==null)throw console.error({additionLines:r,content:e,i:a}),Error(`pushContentLinesToDiff: Addition line does not exist`);t.additionLines.push(n)}}}}function ix(e,t,n,r,i){if(e===`deletions`||e===`both`)for(let e=0;e<t.deletions;e++){let i=r[t.deletionLineIndex+e];if(i==null)throw console.error({deletionLines:r,content:t,i:e}),Error(`pushResolveLinesToDiff: Deletion line does not exist`);n.deletionLines.push(i),n.additionLines.push(i)}if(e===`additions`||e===`both`)for(let e=0;e<t.additions;e++){let r=i[t.additionLineIndex+e];if(r==null)throw console.error({additionLines:i,content:t,i:e}),Error(`pushResolveLinesToDiff: Addition line does not exist`);n.deletionLines.push(r),n.additionLines.push(r)}}function ax(e,t,n){e.type===`context`?(t.nextAdditionLineIndex+=e.lines,t.nextDeletionLineIndex+=e.lines,t.nextAdditionStart+=e.lines,t.nextDeletionStart+=e.lines,t.splitLineCount+=e.lines,t.unifiedLineCount+=e.lines,n.additionCount+=e.lines,n.deletionCount+=e.lines,n.splitLineCount+=e.lines,n.unifiedLineCount+=e.lines):(t.nextAdditionLineIndex+=e.additions,t.nextDeletionLineIndex+=e.deletions,t.nextAdditionStart+=e.additions,t.nextDeletionStart+=e.deletions,t.splitLineCount+=Math.max(e.deletions,e.additions),t.unifiedLineCount+=e.deletions+e.additions,n.deletionCount+=e.deletions,n.deletionLines+=e.deletions,n.additionCount+=e.additions,n.additionLines+=e.additions,n.splitLineCount+=Math.max(e.deletions,e.additions),n.unifiedLineCount+=e.deletions+e.additions)}function ox(e,t,n){return ex(e,{resolution:$b(n),hunkIndex:t.hunkIndex,startContentIndex:t.startContentIndex,endContentIndex:t.endContentIndex,indexesToDelete:sx(t)})}function sx(e){let t=new Set;return e.baseContentIndex!=null&&t.add(e.baseContentIndex),e.endMarkerContentIndex!==e.endContentIndex&&t.add(e.endMarkerContentIndex),t}var cx=-1,lx=class extends sb{options;__id=`unresolved-file:${++cx}`;type=`unresolved-file`;computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0};conflictActions=[];markerRows=[];conflictActionCache=new Map;constructor(e={theme:Dt},t,n=!1){super(void 0,t,n),this.options=e,this.setOptions(e)}setOptions(e){if(e!=null){if(e.onMergeConflictAction!=null&&e.onMergeConflictResolve!=null)throw Error(`UnresolvedFile: onMergeConflictAction and onMergeConflictResolve are mutually exclusive. Use only one callback.`);this.options=e,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions()}}syncInteractionOptions(){this.interactionManager.setOptions(L_(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex,this.handleMergeConflictActionClick))}createHunksRenderer(e){return new Hb(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getHunksRendererOptions(e){return vx(e,this.options)}applyPreNodeAttributes(e,t){super.applyPreNodeAttributes(e,t,{"data-has-merge-conflict":``})}cleanUp(){this.emitPostRender(!0),this.clearMergeConflictActionCache(),this.computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0},this.conflictActions=[],super.cleanUp()}getOrComputeDiff({file:e,fileDiff:t,actions:n,markerRows:r}){let{maxContextLines:i,onMergeConflictAction:a}=this.options;wrapper:if(a!=null){let a=t!=null;if(a!==(n!=null)||a!==(r!=null))throw Error(`UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows must be passed together`);if(t!=null&&n!=null&&r!=null){this.computedCache={file:e??this.computedCache.file,fileDiff:t,actions:n,markerRows:r};break wrapper}else if(e!=null||this.computedCache.file!=null){if(e!=null&&this.computedCache.file!=null&&!mn(e,this.computedCache.file)&&this.computedCache.fileDiff!=null&&this.computedCache.actions!=null)throw Error(`UnresolvedFile.getOrComputeDiff: file can only be used to initialize unresolved state once. Pass fileDiff and actions for subsequent updates.`);if(e??=this.computedCache.file,e==null)throw Error(`UnresolvedFile.getOrComputeDiff: file is null, should be impossible`);if(!mn(e,this.computedCache.file)||this.computedCache.fileDiff==null||this.computedCache.actions==null){let t=Ht(e,i);this.computedCache={file:e,fileDiff:t.fileDiff,actions:t.actions,markerRows:t.markerRows}}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}else{t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}}else{if(t!=null||n!=null||r!=null)throw Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows are only usable in controlled mode, you must pass in `onMergeConflictAction`");if(e!=null&&this.computedCache.file!=null&&!mn(e,this.computedCache.file))throw Error(`UnresolvedFile.getOrComputeDiff: uncontrolled unresolved files parse the file only once. Later updates must come from the cached diff state.`);if(this.computedCache.file??=e,this.computedCache.fileDiff==null&&this.computedCache.file!=null){let e=Ht(this.computedCache.file,i);this.computedCache.fileDiff=e.fileDiff,this.computedCache.actions=e.actions,this.computedCache.markerRows=e.markerRows}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}if(!(t==null||n==null||r==null))return{fileDiff:t,actions:n,markerRows:r}}hydrate(e){let{file:t,fileDiff:n,actions:r,markerRows:i,lineAnnotations:a,fileContainer:o,prerenderedHTML:s,preventEmit:c=!1}=e,l=this.getOrComputeDiff({file:t,fileDiff:n,actions:r,markerRows:i});l!=null&&(this.hydrateElements(o,s),this.setActiveMergeConflictState(l.actions,l.markerRows),gx(this.pre,l.fileDiff,this.options.collapsed)||_x(this.headerElement,l.fileDiff,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):(this.hydrationSetup({fileDiff:l.fileDiff,lineAnnotations:a}),this.pre!=null&&this.renderMergeConflictActionSlots()),c||this.emitPostRender())}rerender(){!this.enabled||this.fileDiff==null||this.render({forceRender:!0,renderRange:this.renderRange})}render(e={}){let{file:t,fileDiff:n,actions:r,markerRows:i,lineAnnotations:a,preventEmit:o=!1,...s}=e,c=this.getOrComputeDiff({file:t,fileDiff:n,actions:r,markerRows:i});if(c==null)return!1;this.setActiveMergeConflictState(c.actions,c.markerRows);let l=super.render({...s,fileDiff:c.fileDiff,lineAnnotations:a,preventEmit:!0});return l&&(this.renderMergeConflictActionSlots(),o||this.emitPostRender()),l}resolveConflict(e,t,n=this.computedCache.fileDiff){let r=this.conflictActions[e];if(n==null||r==null)return;if(r.conflictIndex!==e)throw console.error({conflictIndex:e,action:r}),Error(`UnresolvedFile.resolveConflict: conflictIndex and conflictAction don't match`);let i=ox(n,r,t),a=this.computedCache.file,{file:o,actions:s,markerRows:c}=ux({fileDiff:i,previousActions:this.conflictActions,resolvedConflictIndex:e,previousFile:a,resolution:t});return{file:o,fileDiff:i,actions:s,markerRows:c}}resolveConflictAndRender(e,t){let n=this.conflictActions[e];if(n==null)return;if(n.conflictIndex!==e)throw console.error({conflictIndex:e,action:n}),Error(`UnresolvedFile.resolveConflictAndRender: conflictIndex and conflictAction don't match`);let r={resolution:t,conflict:n.conflict},{file:i,fileDiff:a,actions:o,markerRows:s}=this.resolveConflict(e,t)??{};i==null||a==null||o==null||s==null||(this.computedCache={file:i,fileDiff:a,actions:o,markerRows:s},this.setActiveMergeConflictState(o,s),this.workerManager==null?this.render({forceRender:!0}):this.hunksRenderer.renderDiff(a),this.options.onMergeConflictResolve?.(i,r))}setActiveMergeConflictState(e=this.conflictActions,t=this.markerRows){this.conflictActions=e,this.markerRows=t,this.computedCache.fileDiff!=null&&this.hunksRenderer instanceof Hb&&this.hunksRenderer.setConflictState(this.options.mergeConflictActionsType===`none`?[]:e,t,this.computedCache.fileDiff)}handleMergeConflictActionClick=e=>{let t=this.conflictActions[e.conflictIndex];if(t==null)return;if(t.conflictIndex!==e.conflictIndex)throw console.error({conflictIndex:e.conflictIndex,action:t}),Error(`UnresolvedFile.handleMergeConflictActionClick: conflictIndex and conflictAction don't match`);let n={resolution:e.resolution,conflict:t.conflict};if(this.options.onMergeConflictAction!=null){this.options.onMergeConflictAction(n,this);return}this.resolveConflictAndRender(e.conflictIndex,e.resolution)};renderMergeConflictActionSlots(){let{fileDiff:e}=this.computedCache;if(this.isContainerManaged||this.fileContainer==null||typeof this.options.mergeConflictActionsType!=`function`||this.conflictActions.length===0||e==null){this.clearMergeConflictActionCache();return}let t=new Map(this.conflictActionCache);for(let n=0;n<this.conflictActions.length;n++){let r=this.conflictActions[n];if(r==null)continue;if(r.conflictIndex!==n)throw console.error({conflictIndex:n,action:r}),Error(`UnresolvedFile.renderMergeConflictActionSlots: conflictIndex and conflictAction don't match`);let i=Vt(r,e);if(i==null)continue;let a=r.conflictIndex,o=Rt({hunkIndex:i.hunkIndex,lineIndex:i.lineIndex,conflictIndex:a}),s=`${n}-${o}`,c=this.conflictActionCache.get(s);if(c==null||!Zb(c.action,r)){c?.element.remove();let e=this.renderMergeConflictAction(r);if(e==null)continue;let t=Mv(o);t.appendChild(e),this.fileContainer.appendChild(t),c={element:t,action:r},this.conflictActionCache.set(s,c)}t.delete(s)}for(let[e,{element:n}]of t.entries())this.conflictActionCache.delete(e),n.remove()}renderMergeConflictAction(e){if(typeof this.options.mergeConflictActionsType!=`function`)return;let t=this.options.mergeConflictActionsType(e,this);if(t!=null){if(t instanceof HTMLElement)return t;if(typeof DocumentFragment<`u`&&t instanceof DocumentFragment){let e=document.createElement(`div`);return e.style.display=`contents`,e.appendChild(t),e}}}clearMergeConflictActionCache(){for(let{element:e}of this.conflictActionCache.values())e.remove();this.conflictActionCache.clear()}};function ux({fileDiff:e,previousActions:t,resolvedConflictIndex:n,previousFile:r,resolution:i}){let a=t[n];if(a==null)throw Error(`rebuildFileAndActions: missing resolved action for unresolved file rebuild`);let o=px(t,n,a,i),s=sn(e,o);return{file:dx({fileDiff:e,resolvedAction:a,resolvedConflictIndex:n,previousFile:r,resolution:i}),actions:o,markerRows:s}}function dx({resolvedAction:e,resolvedConflictIndex:t,previousFile:n,fileDiff:r,resolution:i}){let a=by(n?.contents??``),{conflict:o}=e,s=fx(a,o,i),c=[...a.slice(0,o.startLineIndex),...s,...a.slice(o.endLineIndex+1)].join(``);return{name:n?.name??r.name,contents:c,cacheKey:n?.cacheKey==null?void 0:`${n.cacheKey}:mc-${t}-${i}`}}function fx(e,t,n){let r=e.slice(t.startLineIndex+1,t.baseMarkerLineIndex??t.separatorLineIndex),i=e.slice(t.separatorLineIndex+1,t.endLineIndex);return n===`current`?r:n===`incoming`?i:[...r,...i]}function px(e,t,n,r){let i=mx(n.conflict,r);return e.map((e,r)=>{if(r!==t&&e!=null)return e.conflict.startLineIndex>n.conflict.endLineIndex?{...e,conflict:hx(e.conflict,i)}:e})}function mx(e,t){let n=(e.baseMarkerLineIndex??e.separatorLineIndex)-e.startLineIndex-1,r=e.endLineIndex-e.separatorLineIndex-1;return(t===`current`?n:t===`incoming`?r:n+r)-(e.endLineIndex-e.startLineIndex+1)}function hx(e,t){return{...e,startLineIndex:e.startLineIndex+t,startLineNumber:e.startLineNumber+t,separatorLineIndex:e.separatorLineIndex+t,separatorLineNumber:e.separatorLineNumber+t,endLineIndex:e.endLineIndex+t,endLineNumber:e.endLineNumber+t,baseMarkerLineIndex:e.baseMarkerLineIndex==null?void 0:e.baseMarkerLineIndex+t,baseMarkerLineNumber:e.baseMarkerLineNumber==null?void 0:e.baseMarkerLineNumber+t}}function gx(e,t,n=!1){return!n&&e==null&&t!=null}function _x(e,t,n=!1){return e==null&&t!=null&&!n}function vx(e,t){let n={...t,...e};return{...n,useTokenTransformer:Gv(n),hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,mergeConflictActionsType:typeof e?.mergeConflictActionsType==`function`?`custom`:e?.mergeConflictActionsType}}var yx=typeof window>`u`?J.useEffect:J.useLayoutEffect;function bx({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,hasConflictUtility:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c}){let[{fileDiff:l,actions:u,markerRows:d},f]=(0,J.useState)(()=>{let{fileDiff:n,actions:r,markerRows:i}=Ht(e,t?.maxContextLines);return{fileDiff:n,actions:r,markerRows:i}}),p=st((e,t)=>{f(n=>{let{fileDiff:r,actions:i,markerRows:a}=t.resolveConflict(e.conflict.conflictIndex,e.resolution,n.fileDiff)??{};return r==null||i==null||a==null?n:{fileDiff:r,actions:i,markerRows:a}})}),m=r!==void 0,h=(0,J.useContext)(Nh),g=(0,J.useRef)(null),_=st(e=>{if(e!=null){if(g.current!=null)throw Error(`useUnresolvedFileInstance: An instance should not already exist when a node is created`);g.current=new lx(xx({controlledSelection:m,hasConflictUtility:a,hasCustomHeader:s,hasGutterRenderUtility:o,onMergeConflictAction:p,options:t}),c?void 0:h,!0),g.current.hydrate({fileDiff:l,actions:u,markerRows:d,fileContainer:e,lineAnnotations:n,prerenderedHTML:i})}else{if(g.current==null)throw Error(`useUnresolvedFileInstance: A UnresolvedFile instance should exist when unmounting`);g.current.cleanUp(),g.current=null}});return yx(()=>{if(g.current==null)return;let e=g.current,i=xx({controlledSelection:m,hasConflictUtility:a,hasCustomHeader:s,hasGutterRenderUtility:o,onMergeConflictAction:p,options:t}),c=i!==void 0&&!Rh(e.options,i);e.setOptions(i),e.render({fileDiff:l,actions:u,markerRows:d,lineAnnotations:n,forceRender:c}),r!==void 0&&e.setSelectedLines(r)}),{ref:_,getHoveredLine:(0,J.useCallback)(()=>g.current?.getHoveredLine(),[]),fileDiff:l,actions:u,markerRows:d,getInstance:(0,J.useCallback)(()=>g.current??void 0,[])}}function xx({options:e,controlledSelection:t,onMergeConflictAction:n,hasConflictUtility:r,hasCustomHeader:i,hasGutterRenderUtility:a}){return{...e,controlledSelection:t,onMergeConflictAction:n,hunkSeparators:e?.hunkSeparators===`custom`?pt:e?.hunkSeparators,mergeConflictActionsType:r||e?.mergeConflictActionsType===`custom`?pt:e?.mergeConflictActionsType,renderCustomHeader:i?pt:void 0,renderGutterUtility:a?pt:void 0}}function Sx({file:e,options:t,lineAnnotations:n,selectedLines:r,className:i,style:a,prerenderedHTML:o,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderFilenameSuffix:u,renderHeaderMetadata:d,renderGutterUtility:f,renderMergeConflictUtility:p,disableWorkerPool:m=!1}){let{ref:h,getHoveredLine:g,fileDiff:_,actions:v,getInstance:y}=bx({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:o,hasConflictUtility:p!=null,hasGutterRenderUtility:f!=null,hasCustomHeader:c!=null,disableWorkerPool:m});return(0,Y.jsx)(ht,{ref:h,className:i,style:a,children:Ab(un({fileDiff:_,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderFilenameSuffix:u,renderHeaderMetadata:d,renderAnnotation:s,renderGutterUtility:f,lineAnnotations:n,getHoveredLine:g,actions:v,renderMergeConflictUtility:p,getInstance:y}),o)})}function Cx(e){return new Worker(`/assets/worker-BJu97yub.js`,{name:e?.name})}var wx=typeof document<`u`?J.useLayoutEffect:()=>{};function Tx(e,...t){let n=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var Ex=J.createContext(void 0);function Dx(e){let t=J.useContext(Ex);if(t===void 0&&!e)throw Error(Tx(72));return t}var Ox={};function kx(e,t){let n=J.useRef(Ox);return n.current===Ox&&(n.current=e(t)),n}var Ax=[];function jx(e){J.useEffect(e,Ax)}var Mx=0,Nx=class e{static create(){return new e}currentId=Mx;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Mx,t()},e)}isStarted(){return this.currentId!==Mx}clear=()=>{this.currentId!==Mx&&(clearTimeout(this.currentId),this.currentId=Mx)};disposeEffect=()=>this.clear};function Px(){let e=kx(Nx.create).current;return jx(e.disposeEffect),e}function Fx(){return typeof window<`u`}function Ix(e){return zx(e)?(e.nodeName||``).toLowerCase():`#document`}function Lx(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rx(e){return((zx(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function zx(e){return Fx()?e instanceof Node||e instanceof Lx(e).Node:!1}function Bx(e){return Fx()?e instanceof Element||e instanceof Lx(e).Element:!1}function Vx(e){return Fx()?e instanceof HTMLElement||e instanceof Lx(e).HTMLElement:!1}function Hx(e){return!Fx()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Lx(e).ShadowRoot}function Ux(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=eS(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Wx(e){return/^(table|td|th)$/.test(Ix(e))}function Gx(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Kx=/transform|translate|scale|rotate|perspective|filter/,qx=/paint|layout|strict|content/,Jx=e=>!!e&&e!==`none`,Yx;function Xx(e){let t=Bx(e)?eS(e):e;return Jx(t.transform)||Jx(t.translate)||Jx(t.scale)||Jx(t.rotate)||Jx(t.perspective)||!Qx()&&(Jx(t.backdropFilter)||Jx(t.filter))||Kx.test(t.willChange||``)||qx.test(t.contain||``)}function Zx(e){let t=nS(e);for(;Vx(t)&&!$x(t);){if(Xx(t))return t;if(Gx(t))return null;t=nS(t)}return null}function Qx(){return Yx??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Yx}function $x(e){return/^(html|body|#document)$/.test(Ix(e))}function eS(e){return Lx(e).getComputedStyle(e)}function tS(e){return Bx(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function nS(e){if(Ix(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Hx(e)&&e.host||Rx(e);return Hx(t)?t.host:t}function rS(e){let t=nS(e);return $x(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vx(t)&&Ux(t)?t:rS(t)}function iS(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=rS(e),i=r===e.ownerDocument?.body,a=Lx(r);if(i){let e=aS(a);return t.concat(a,a.visualViewport||[],Ux(r)?r:[],e&&n?iS(e):[])}else return t.concat(r,iS(r,[],n))}function aS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function oS(e){let t=kx(sS,e).current;return t.next=e,wx(t.effect),t}function sS(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var cS=J[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],lS=cS&&cS!==J.useLayoutEffect?cS:e=>e();function uS(e){let t=kx(dS).current;return t.next=e,lS(t.effect),t.trampoline}function dS(){let e={next:void 0,callback:fS,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function fS(){}var pS=typeof navigator<`u`,mS=CS(),hS=TS(),gS=wS(),_S=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),vS=mS.platform===`MacIntel`&&mS.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(mS.platform);pS&&/firefox/i.test(gS);var yS=pS&&/apple/i.test(navigator.vendor);pS&&/Edg/i.test(gS);var bS=pS&&/android/i.test(hS)||/android/i.test(gS),xS=pS&&hS.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,SS=gS.includes(`jsdom/`);function CS(){if(!pS)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function wS(){if(!pS)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function TS(){if(!pS)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}var ES=`data-base-ui-focusable`,DS=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,OS=`ArrowLeft`,kS=`ArrowRight`,AS=`ArrowUp`,jS=`ArrowDown`;function MS(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function NS(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Hx(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function PS(e){return`composedPath`in e?e.composedPath()[0]:e.target}function FS(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function IS(e){return e.matches(`html,body`)}function LS(e){return e?.ownerDocument||document}function RS(e){return Vx(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function zS(e){return e?e.getAttribute(`role`)===`combobox`&&RS(e):!1}function BS(e){if(!e||SS)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function VS(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function HS(e,t,n=!0){return e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...HS(e,t.id,n)])}function US(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function WS(e){e.preventDefault(),e.stopPropagation()}function GS(e){return`nativeEvent`in e}function KS(e){return e.mozInputSource===0&&e.isTrusted?!0:bS&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function qS(e){return SS?!1:!bS&&e.width===0&&e.height===0||bS&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function JS(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function YS(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var XS=[`top`,`right`,`bottom`,`left`],ZS=Math.min,QS=Math.max,$S=Math.round,eC=Math.floor,tC=e=>({x:e,y:e}),nC={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function rC(e,t,n){return QS(e,ZS(t,n))}function iC(e,t){return typeof e==`function`?e(t):e}function aC(e){return e.split(`-`)[0]}function oC(e){return e.split(`-`)[1]}function sC(e){return e===`x`?`y`:`x`}function cC(e){return e===`y`?`height`:`width`}function lC(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function uC(e){return sC(lC(e))}function dC(e,t,n){n===void 0&&(n=!1);let r=oC(e),i=uC(e),a=cC(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=bC(o)),[o,bC(o)]}function fC(e){let t=bC(e);return[pC(e),t,pC(t)]}function pC(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var mC=[`left`,`right`],hC=[`right`,`left`],gC=[`top`,`bottom`],_C=[`bottom`,`top`];function vC(e,t,n){switch(e){case`top`:case`bottom`:return n?t?hC:mC:t?mC:hC;case`left`:case`right`:return t?gC:_C;default:return[]}}function yC(e,t,n,r){let i=oC(e),a=vC(aC(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(pC)))),a}function bC(e){let t=aC(e);return nC[t]+e.slice(t.length)}function xC(e){return{top:0,right:0,bottom:0,left:0,...e}}function SC(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:xC(e)}function CC(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function wC(e,t,n){return Math.floor(e/t)!==n}function TC(e,t){return t<0||t>=e.current.length}function EC(e,t){return OC(e,{disabledIndices:t})}function DC(e,t){return OC(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function OC(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.current.length-1&&NC(e,a,r));return a}function kC(e,{event:t,orientation:n,loopFocus:r,rtl:i,cols:a,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:l,stopEvent:u=!1}){let d=l,f=[],p={},m=!1;{let t=null,n=-1;e.current.forEach((e,r)=>{if(e==null)return;let i=e.closest(`[role="row"]`);i&&(m=!0),(i!==t||n===-1)&&(t=i,n+=1,f[n]=[]),f[n].push(r),p[r]=n})}let h=m&&f.length>0&&f.some(e=>e.length!==a);function g(t){if(!h||l===-1)return;let n=p[l];if(n==null)return;let i=f[n].indexOf(l),a=t===`up`?n-1:n+1;r&&(a<0?a=f.length-1:a>=f.length&&(a=0));let s=new Set;for(;a>=0&&a<f.length&&!s.has(a);){s.add(a);let n=f[a];if(n.length===0){a=t===`up`?a-1:a+1;continue}let c=Math.min(i,n.length-1);for(let t=c;t>=0;--t){let r=n[t];if(!NC(e,r,o))return r}a=t===`up`?a-1:a+1,r&&(a<0?a=f.length-1:a>=f.length&&(a=0))}}if(t.key===`ArrowUp`){let n=g(`up`);if(n!==void 0)u&&WS(t),d=n;else{if(u&&WS(t),l===-1)d=c;else if(d=OC(e,{startingIndex:d,amount:a,decrement:!0,disabledIndices:o}),r&&(l-a<s||d<0)){let e=l%a,t=c%a,n=c-(t-e);d=t===e?c:t>e?n:n-a}TC(e,d)&&(d=l)}}if(t.key===`ArrowDown`){let n=g(`down`);n===void 0?(u&&WS(t),l===-1?d=s:(d=OC(e,{startingIndex:l,amount:a,disabledIndices:o}),r&&l+a>c&&(d=OC(e,{startingIndex:l%a-a,amount:a,disabledIndices:o}))),TC(e,d)&&(d=l)):(u&&WS(t),d=n)}if(n===`both`){let n=eC(l/a);t.key===(i?`ArrowLeft`:`ArrowRight`)&&(u&&WS(t),l%a===a-1?r&&(d=OC(e,{startingIndex:l-l%a-1,disabledIndices:o})):(d=OC(e,{startingIndex:l,disabledIndices:o}),r&&wC(d,a,n)&&(d=OC(e,{startingIndex:l-l%a-1,disabledIndices:o}))),wC(d,a,n)&&(d=l)),t.key===(i?`ArrowRight`:`ArrowLeft`)&&(u&&WS(t),l%a===0?r&&(d=OC(e,{startingIndex:l+(a-l%a),decrement:!0,disabledIndices:o})):(d=OC(e,{startingIndex:l,decrement:!0,disabledIndices:o}),r&&wC(d,a,n)&&(d=OC(e,{startingIndex:l+(a-l%a),decrement:!0,disabledIndices:o}))),wC(d,a,n)&&(d=l));let s=eC(c/a)===n;TC(e,d)&&(d=r&&s?t.key===(i?`ArrowRight`:`ArrowLeft`)?c:OC(e,{startingIndex:l-l%a-1,disabledIndices:o}):l)}return d}function AC(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function jC(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function MC(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function NC(e,t,n){if(typeof n==`function`)return n(t);if(n)return n.includes(t);let r=e.current[t];return r?r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`:!1}var PC=[`input:not([inert]):not([inert] *)`,`select:not([inert]):not([inert] *)`,`textarea:not([inert]):not([inert] *)`,`a[href]:not([inert]):not([inert] *)`,`button:not([inert]):not([inert] *)`,`[tabindex]:not(slot):not([inert]):not([inert] *)`,`audio[controls]:not([inert]):not([inert] *)`,`video[controls]:not([inert]):not([inert] *)`,`[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)`,`details>summary:first-of-type:not([inert]):not([inert] *)`,`details:not([inert]):not([inert] *)`].join(`,`),FC=typeof Element>`u`,IC=FC?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,LC=!FC&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},RC=function(e,t){t===void 0&&(t=!0);var n=e?.getAttribute?.call(e,`inert`);return n===``||n===`true`||t&&e&&(typeof e.closest==`function`?e.closest(`[inert]`):RC(e.parentNode))},zC=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},BC=function(e,t,n){if(RC(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(PC));return t&&IC.call(e,PC)&&r.unshift(e),r=r.filter(n),r},VC=function(e,t,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!RC(a,!1))if(a.tagName===`SLOT`){var o=a.assignedElements(),s=VC(o.length?o:a.children,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:a,candidates:s})}else{IC.call(a,PC)&&n.filter(a)&&(t||!e.includes(a))&&r.push(a);var c=a.shadowRoot||typeof n.getShadowRoot==`function`&&n.getShadowRoot(a),l=!RC(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(c&&l){var u=VC(c===!0?a.children:c.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return r},HC=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},UC=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||zC(e))&&!HC(e)?0:e.tabIndex},WC=function(e,t){var n=UC(e);return n<0&&t&&!HC(e)?0:n},GC=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},KC=function(e){return e.tagName===`INPUT`},qC=function(e){return KC(e)&&e.type===`hidden`},JC=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},YC=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},XC=function(e){if(!e.name)return!0;var t=e.form||LC(e),n=function(e){return t.querySelectorAll(`input[type="radio"][name="`+e+`"]`)},r;if(typeof window<`u`&&window.CSS!==void 0&&typeof window.CSS.escape==`function`)r=n(window.CSS.escape(e.name));else try{r=n(e.name)}catch(e){return console.error(`Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s`,e.message),!1}var i=YC(r,e.form);return!i||i===e},ZC=function(e){return KC(e)&&e.type===`radio`},QC=function(e){return ZC(e)&&!XC(e)},$C=function(e){var t=e&&LC(e),n=t?.host,r=!1;if(t&&t!==e){var i,a,o;for(r=!!((i=n)!=null&&(a=i.ownerDocument)!=null&&a.contains(n)||e!=null&&(o=e.ownerDocument)!=null&&o.contains(e));!r&&n;){var s,c;t=LC(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},ew=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},tw=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(n===`full-native`&&`checkVisibility`in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if(getComputedStyle(e).visibility===`hidden`)return!0;var i=IC.call(e,`details>summary:first-of-type`)?e.parentElement:e;if(IC.call(i,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`full-native`||n===`legacy-full`){if(typeof r==`function`){for(var a=e;e;){var o=e.parentElement,s=LC(e);if(o&&!o.shadowRoot&&r(o)===!0)return ew(e);e=e.assignedSlot?e.assignedSlot:!o&&s!==e.ownerDocument?s.host:o}e=a}if($C(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return ew(e);return!1},nw=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName===`FIELDSET`&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if(r.tagName===`LEGEND`)return IC.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},rw=function(e,t){return!(t.disabled||qC(t)||tw(t,e)||JC(t)||nw(t))},iw=function(e,t){return!(QC(t)||UC(t)<0||!rw(e,t))},aw=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},ow=function(e){var t=[],n=[];return e.forEach(function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,o=WC(a,i),s=i?ow(e.candidates):a;o===0?i?t.push.apply(t,s):t.push(a):n.push({documentOrder:r,tabIndex:o,item:e,isScope:i,content:s})}),n.sort(GC).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},sw=function(e,t){return t||={},ow(t.getShadowRoot?VC([e],t.includeContainer,{filter:iw.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:aw}):BC(e,t.includeContainer,iw.bind(null,t)))},cw=function(e,t){return t||={},t.getShadowRoot?VC([e],t.includeContainer,{filter:rw.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):BC(e,t.includeContainer,rw.bind(null,t))},lw=function(e,t){if(t||={},!e)throw Error(`No node provided`);return IC.call(e,PC)===!1?!1:iw(t,e)},uw=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`});function dw(e,t){let n=sw(e,uw()),r=n.length;if(r===0)return;let i=MS(LS(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function fw(e){return dw(LS(e).body,1)||e}function pw(e){return dw(LS(e).body,-1)||e}function mw(e,t){if(!e)return null;let n=sw(LS(e).body,uw()),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function hw(e){return mw(e,1)}function gw(e){return mw(e,-1)}function _w(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!NS(n,r)}function vw(e){sw(e,uw()).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function yw(e){e.querySelectorAll(`[data-tabindex]`).forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var bw={...J},xw=0;function Sw(e,t=`mui`){let[n,r]=J.useState(e),i=e||n;return J.useEffect(()=>{n??(xw+=1,r(`${t}-${xw}`))},[n,t]),i}var Cw=bw.useId;function ww(e,t){if(Cw!==void 0){let n=Cw();return e??(t?`${t}-${n}`:n)}return Sw(e,t)}function Tw(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var Ew=class{nodesRef={current:[]};events=Tw();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},Dw=J.createContext(null),Ow=J.createContext(null),kw=()=>J.useContext(Dw)?.id||null,Aw=e=>{let t=J.useContext(Ow);return e??t};function jw(e){let t=ww(),n=Aw(e),r=kw();return wx(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Mw(e){let{children:t,id:n}=e,r=kw();return(0,Y.jsx)(Dw.Provider,{value:J.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Nw(e){let{children:t,externalTree:n}=e,r=kx(()=>n??new Ew).current;return(0,Y.jsx)(Ow.Provider,{value:r,children:t})}function Pw(){}var Fw=Object.freeze([]),Iw=Object.freeze({}),Lw={style:{transition:`none`}},Rw=`data-base-ui-click-trigger`,zw={fallbackAxisSide:`none`},Bw={fallbackAxisSide:`end`},Vw={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},Hw=`none`,Uw=`trigger-press`,Ww=`trigger-hover`,Gw=`trigger-focus`,Kw=`outside-press`,qw=`item-press`,Jw=`focus-out`,Yw=`escape-key`,Xw=`list-navigation`,Zw=`cancel-open`,Qw=`disabled`,$w=`imperative-action`,eT=`window-resize`;function tT(e,t,n,r){let i=!1,a=!1,o=r??Iw;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function nT(e){return`data-base-ui-${e}`}nT(`safe-polygon`),`${DS}`;function rT(e,t,n){if(n&&!JS(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}var iT=J.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Nx,currentIdRef:{current:null},currentContextRef:{current:null}});function aT(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=J.useRef(n),a=J.useRef(n),o=J.useRef(null),s=J.useRef(null),c=Px();return(0,Y.jsx)(iT.Provider,{value:J.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function oT(e,t={open:!1}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`floatingId`),{enabled:i=!0,open:a}=t,{currentIdRef:o,delayRef:s,timeoutMs:c,initialDelayRef:l,currentContextRef:u,hasProvider:d,timeout:f}=J.useContext(iT),[p,m]=J.useState(!1);return wx(()=>{function e(){m(!1),u.current?.setIsInstantPhase(!1),o.current=null,u.current=null,s.current=l.current}if(i&&o.current&&!a&&o.current===r){if(m(!1),c)return f.start(c,e),()=>{f.clear()};e()}},[i,a,r,o,s,c,l,u,f]),wx(()=>{if(!i||!a)return;let e=u.current,t=o.current;u.current={onOpenChange:n.setOpen,setIsInstantPhase:m},o.current=r,s.current={open:0,close:rT(l.current,`close`)},t!==null&&t!==r?(f.clear(),m(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,tT(Hw))):(m(!1),e?.setIsInstantPhase(!1))},[i,a,r,n,o,s,c,l,u,f]),wx(()=>()=>{u.current=null},[u]),J.useMemo(()=>({hasProvider:d,delayRef:s,isInstantPhase:p}),[d,s,p])}function sT(e,t,n,r){let i=kx(lT).current;return uT(i,e,t,n,r)&&fT(i,[e,t,n,r]),i.callback}function cT(e){let t=kx(lT).current;return dT(t,e)&&fT(t,e),t.callback}function lT(){return{callback:null,cleanup:null,refs:[]}}function uT(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function dT(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function fT(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var pT={clip:`rect(0 0 0 0)`,overflow:`hidden`,whiteSpace:`nowrap`,position:`fixed`,top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1},mT=null;globalThis.requestAnimationFrame;var hT=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},gT=class e{static create(){return new e}static request(e){return hT.request(e)}static cancel(e){return hT.cancel(e)}currentId=mT;request(e){this.cancel(),this.currentId=hT.request(()=>{this.currentId=mT,e()})}cancel=()=>{this.currentId!==mT&&(hT.cancel(this.currentId),this.currentId=mT)};disposeEffect=()=>this.cancel};function _T(){let e=kx(gT.create).current;return jx(e.disposeEffect),e}function vT(e){return e?.ownerDocument||document}var yT=J.forwardRef(function(e,t){let[n,r]=J.useState();wx(()=>{yS&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,Y.jsx)(`span`,{...e,ref:t,style:pT,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),bT=0;function xT(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(bT);let a=()=>e?.focus({preventScroll:n});i?a():bT=requestAnimationFrame(a)}var ST={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function CT(e){return e===`inert`?ST.inert:e===`aria-hidden`?ST[`aria-hidden`]:ST.none}var wT=new WeakSet,TT={},ET=0,DT=e=>e&&(e.host||DT(e.parentNode)),OT=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=DT(t);return e.contains(n)?n:null}).filter(e=>e!=null);function kT(e,t,n,r){let i=`data-base-ui-inert`,a=r?`inert`:n?`aria-hidden`:null,o=OT(t,e),s=new Set,c=new Set(o),l=[];TT[i]||(TT[i]=new WeakMap);let u=TT[i];o.forEach(d),f(t),s.clear();function d(e){!e||s.has(e)||(s.add(e),e.parentNode&&d(e.parentNode))}function f(e){!e||c.has(e)||[].forEach.call(e.children,e=>{if(Ix(e)!==`script`)if(s.has(e))f(e);else{let t=a?e.getAttribute(a):null,n=t!==null&&t!==`false`,r=CT(a),o=(r.get(e)||0)+1,s=(u.get(e)||0)+1;r.set(e,o),u.set(e,s),l.push(e),o===1&&n&&wT.add(e),s===1&&e.setAttribute(i,``),!n&&a&&e.setAttribute(a,a===`inert`?``:`true`)}})}return ET+=1,()=>{l.forEach(e=>{let t=CT(a),n=(t.get(e)||0)-1,r=(u.get(e)||0)-1;t.set(e,n),u.set(e,r),n||(!wT.has(e)&&a&&e.removeAttribute(a),wT.delete(e)),r||e.removeAttribute(i)}),--ET,ET||(ST.inert=new WeakMap,ST[`aria-hidden`]=new WeakMap,ST.none=new WeakMap,wT=new WeakSet,TT={})}}function AT(e,t=!1,n=!1){let r=LS(e[0]).body;return kT(e.concat(Array.from(r.querySelectorAll(`[aria-live]`))),r,t,n)}var jT=19;function MT(e){return jT>=e}function NT(e){if(!J.isValidElement(e))return null;let t=e,n=t.props;return(MT(19)?n?.ref:t.ref)??null}function PT(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function FT(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function IT(e,t){return typeof e==`function`?e(t):e}function LT(e,t){return typeof e==`function`?e(t):e}var RT={};function zT(e,t,n,r,i){let a={...GT(e,RT)};return t&&(a=VT(a,t)),n&&(a=VT(a,n)),r&&(a=VT(a,r)),i&&(a=VT(a,i)),a}function BT(e){if(e.length===0)return RT;if(e.length===1)return GT(e[0],RT);let t={...GT(e[0],RT)};for(let n=1;n<e.length;n+=1)t=VT(t,e[n]);return t}function VT(e,t){return WT(t)?t(e):HT(e,t)}function HT(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=PT(e.style,r);break;case`className`:e[n]=JT(e.className,r);break;default:UT(n,r)?e[n]=KT(e[n],r):e[n]=r}}return e}function UT(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function WT(e){return typeof e==`function`}function GT(e,t){return WT(e)?e(t):e??RT}function KT(e,t){return t?e?n=>{if(YT(n)){let r=n;qT(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function qT(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function JT(e,t){return t?e?t+` `+e:t:e}function YT(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function XT(e,t,n={}){let r=t.render,i=ZT(t,n);return n.enabled===!1?null:QT(e,r,i,n.state??Iw)}function ZT(e,t={}){let{className:n,style:r,render:i}=e,{state:a=Iw,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?IT(n,a):void 0,d=l?LT(r,a):void 0,f=l?FT(a,c):Iw,p=l?PT(f,Array.isArray(s)?BT(s):s)??Iw:Iw;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=cT([p.ref,NT(i),...o]):p.ref=sT(p.ref,NT(i),o):sT(null,null)),l?(u!==void 0&&(p.className=JT(p.className,u)),d!==void 0&&(p.style=PT(p.style,d)),p):Iw}function QT(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=zT(n,t.props);return e.ref=n.ref,J.cloneElement(t,e)}if(e&&typeof e==`string`)return $T(e,n);throw Error(Tx(8))}function $T(e,t){return e===`button`?(0,J.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,J.createElement)(`img`,{alt:``,...t,key:t.key}):J.createElement(e,t)}var eE=J.createContext(null),tE=()=>J.useContext(eE),nE=nT(`portal`);function rE(e={}){let{ref:t,container:n,componentProps:r=Iw,elementProps:i,elementState:a}=e,o=ww(),s=tE()?.portalNode,[c,l]=J.useState(null),[u,d]=J.useState(null),f=J.useRef(null);wx(()=>{if(n===null){f.current&&(f.current=null,d(null),l(null));return}if(o==null)return;let e=(n&&(zx(n)?n:n.current))??s??document.body;if(e==null){f.current&&(f.current=null,d(null),l(null));return}f.current!==e&&(f.current=e,d(null),l(e))},[n,s,o]);let p=XT(`div`,r,{ref:[t,d],state:a,props:[{id:o,[nE]:``},i]});return{portalNode:u,portalSubtree:c&&p?ec.createPortal(p,c):null}}var iE=J.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,...s}=e,{portalNode:c,portalSubtree:l}=rE({container:r,ref:t,componentProps:e,elementProps:s}),u=J.useRef(null),d=J.useRef(null),f=J.useRef(null),p=J.useRef(null),[m,h]=J.useState(null),g=m?.modal,_=m?.open,v=typeof o==`boolean`?o:!!m&&!m.modal&&m.open&&!!c;J.useEffect(()=>{if(!c||g)return;function e(e){c&&_w(e)&&(e.type===`focusin`?yw:vw)(c)}return c.addEventListener(`focusin`,e,!0),c.addEventListener(`focusout`,e,!0),()=>{c.removeEventListener(`focusin`,e,!0),c.removeEventListener(`focusout`,e,!0)}},[c,g]),J.useEffect(()=>{!c||_||yw(c)},[_,c]);let y=J.useMemo(()=>({beforeOutsideRef:u,afterOutsideRef:d,beforeInsideRef:f,afterInsideRef:p,portalNode:c,setFocusManagerState:h}),[c]);return(0,Y.jsxs)(J.Fragment,{children:[l,(0,Y.jsxs)(eE.Provider,{value:y,children:[v&&c&&(0,Y.jsx)(yT,{"data-type":`outside`,ref:u,onFocus:e=>{_w(e,c)?f.current?.focus():pw(m?m.domReference:null)?.focus()}}),v&&c&&(0,Y.jsx)(`span`,{"aria-owns":c.id,style:Vw}),c&&ec.createPortal(n,c),v&&c&&(0,Y.jsx)(yT,{"data-type":`outside`,ref:d,onFocus:e=>{_w(e,c)?p.current?.focus():(fw(m?m.domReference:null)?.focus(),m?.closeOnFocusOut&&m?.onOpenChange(!1,tT(`focus-out`,e.nativeEvent)))}})]})]})});function aE(e){return e==null?e:`current`in e?e.current:e}function oE(e,t){let n=Lx(e.target);return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var sE=20,cE=[];function lE(){cE=cE.filter(e=>e.isConnected)}function uE(e){lE(),e&&Ix(e)!==`body`&&(cE.push(e),cE.length>sE&&(cE=cE.slice(-sE)))}function dE(){return lE(),cE[cE.length-1]}function fE(e){if(!e)return null;let t=uw();return lw(e,t)?e:sw(e,t)[0]||e}function pE(e){return!e||!e.isConnected?!1:typeof e.checkVisibility==`function`?e.checkVisibility():eS(e).display!==`none`}function mE(e,t){if(!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=uw(),r=cw(e,n).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return lw(e,n)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),i=e.getAttribute(`tabindex`);t.current.includes(`floating`)||r.length===0?i!==`0`&&e.setAttribute(`tabindex`,`0`):(i!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function hE(e){let{context:t,children:n,disabled:r=!1,order:i=[`content`],initialFocus:a=!0,returnFocus:o=!0,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,getInsideElements:d=()=>[],nextFocusableElement:f,previousFocusableElement:p,beforeContentFocusGuardRef:m,externalTree:h}=e,g=`rootStore`in t?t.rootStore:t,_=g.useState(`open`),v=g.useState(`domReferenceElement`),y=g.useState(`floatingElement`),{events:b,dataRef:x}=g.context,S=uS(()=>x.current.floatingContext?.nodeId),C=uS(d),w=a===!1,T=zS(v)&&w,E=oS(i),D=oS(a),O=oS(o),k=oS(u),A=Aw(h),j=tE(),M=J.useRef(null),N=J.useRef(null),P=J.useRef(!1),F=J.useRef(!1),I=J.useRef(!1),L=J.useRef(-1),R=J.useRef(``),z=J.useRef(``),B=Px(),V=Px(),H=_T(),U=j!=null,W=VS(y),ee=uS((e=W)=>e?sw(e,uw()):[]),te=uS(e=>{let t=ee(e);return E.current.map(()=>t).filter(Boolean).flat()});J.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&NS(W,MS(LS(W)))&&ee().length===0&&!T&&WS(e)}let t=LS(W);return t.addEventListener(`keydown`,e),()=>{t.removeEventListener(`keydown`,e)}},[r,v,W,c,E,T,ee,te]),J.useEffect(()=>{if(r||!y)return;function e(e){let t=PS(e),n=ee().indexOf(t);n!==-1&&(L.current=n)}return y.addEventListener(`focusin`,e),()=>{y.removeEventListener(`focusin`,e)}},[r,y,ee]),J.useEffect(()=>{if(r||!_)return;let e=LS(W);function t(){I.current=!1}function n(e){let t=PS(e);I.current=!(NS(y,t)||NS(v,t)||NS(j?.portalNode,t)),z.current=e.pointerType||`keyboard`}function i(){z.current=`keyboard`}return e.addEventListener(`pointerdown`,n,!0),e.addEventListener(`pointerup`,t,!0),e.addEventListener(`pointercancel`,t,!0),e.addEventListener(`keydown`,i,!0),()=>{e.removeEventListener(`pointerdown`,n,!0),e.removeEventListener(`pointerup`,t,!0),e.removeEventListener(`pointercancel`,t,!0),e.removeEventListener(`keydown`,i,!0)}},[r,y,v,W,_,j]),J.useEffect(()=>{if(r||!l)return;function e(){F.current=!0,V.start(0,()=>{F.current=!1})}function t(e){let t=e.relatedTarget,n=e.currentTarget,r=PS(e);queueMicrotask(()=>{let i=S(),a=g.context.triggerElements,o=!(NS(v,t)||NS(y,t)||NS(t,y)||NS(j?.portalNode,t)||t!=null&&a.hasElement(t)||a.hasMatchingElement(e=>NS(e,t))||t?.hasAttribute(nT(`focus-guard`))||A&&(HS(A.nodesRef.current,i).find(e=>NS(e.context?.elements.floating,t)||NS(e.context?.elements.domReference,t))||US(A.nodesRef.current,i).find(e=>[e.context?.elements.floating,VS(e.context?.elements.floating)].includes(t)||e.context?.elements.domReference===t)));if(n===v&&W&&mE(W,E),s&&n!==v&&!pE(r)&&MS(LS(W))===LS(W).body){if(Vx(W)&&(W.focus(),s===`popup`)){H.request(()=>{W.focus()});return}let e=L.current,t=ee(),n=t[e]||t[t.length-1]||W;Vx(n)&&n.focus()}if(x.current.insideReactTree){x.current.insideReactTree=!1;return}(T||!c)&&t&&o&&!F.current&&(T||t!==dE())&&(P.current=!0,g.setOpen(!1,tT(Jw,e)))})}function n(){I.current||(x.current.insideReactTree=!0,B.start(0,()=>{x.current.insideReactTree=!1}))}let i=Vx(v)?v:null,a=[];if(!(!y&&!i))return i&&(i.addEventListener(`focusout`,t),i.addEventListener(`pointerdown`,e),a.push(()=>{i.removeEventListener(`focusout`,t),i.removeEventListener(`pointerdown`,e)})),y&&(y.addEventListener(`focusout`,t),j&&(y.addEventListener(`focusout`,n,!0),a.push(()=>{y.removeEventListener(`focusout`,n,!0)})),a.push(()=>{y.removeEventListener(`focusout`,t)})),()=>{a.forEach(e=>{e()})}},[r,v,y,W,c,A,j,g,l,s,ee,T,S,E,x,B,V,H]);let ne=J.useRef(null),re=J.useRef(null),ie=sT(ne,m,j?.beforeInsideRef),ae=sT(re,j?.afterInsideRef);J.useEffect(()=>{if(r||!y||!_)return;let e=Array.from(j?.portalNode?.querySelectorAll(`[${nT(`portal`)}]`)||[]),t=AT([y,(A?US(A.nodesRef.current,S()):[]).find(e=>zS(e.context?.elements.domReference||null))?.context?.elements.domReference,...e,...C(),M.current,N.current,ne.current,re.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,aE(p),aE(f),T?v:null].filter(e=>e!=null),c||T);return()=>{t()}},[_,r,v,y,c,E,j,T,A,S,C,f,p]),wx(()=>{if(!_||r||!Vx(W))return;let e=MS(LS(W));queueMicrotask(()=>{let t=te(W),n=D.current,r=typeof n==`function`?n(k.current||``):n;if(r===void 0||r===!1)return;let i;i=r===!0||r===null?t[0]||W:aE(r),i=i||t[0]||W,!NS(W,e)&&xT(i,{preventScroll:i===W})})},[r,_,W,w,te,D,k]),wx(()=>{if(r||!W)return;let e=LS(W);uE(MS(e));function t(e){if(e.open||(R.current=oE(e.nativeEvent,z.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(P.current=!0),e.reason===`outside-press`)if(e.nested)P.current=!1;else if(KS(e.nativeEvent)||qS(e.nativeEvent))P.current=!1;else{let e=!1;document.createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?P.current=!1:P.current=!0}}b.on(`openchange`,t);let n=e.createElement(`span`);n.setAttribute(`tabindex`,`-1`),n.setAttribute(`aria-hidden`,`true`),Object.assign(n.style,pT),U&&v&&v.insertAdjacentElement(`afterend`,n);function i(){let e=O.current,t=typeof e==`function`?e(R.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=v||dE();return e&&e.isConnected?e:n}let r=v||dE()||n;return aE(t)||r}return()=>{b.off(`openchange`,t);let r=MS(e),a=NS(y,r)||A&&HS(A.nodesRef.current,S(),!1).some(e=>NS(e.context?.elements.floating,r)),o=i();queueMicrotask(()=>{let t=fE(o),i=typeof O.current!=`boolean`;O.current&&!P.current&&Vx(t)&&(!(!i&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),n.remove()})}},[r,y,W,O,x,b,A,U,v,S]),J.useEffect(()=>{queueMicrotask(()=>{P.current=!1})},[r]),J.useEffect(()=>{if(r||!_)return;function e(e){PS(e)?.closest(`[data-base-ui-click-trigger]`)&&(F.current=!0)}let t=LS(W);return t.addEventListener(`pointerdown`,e,!0),()=>{t.removeEventListener(`pointerdown`,e,!0)}},[r,_,W]),wx(()=>{if(!r&&j)return j.setFocusManagerState({modal:c,closeOnFocusOut:l,open:_,onOpenChange:g.setOpen,domReference:v}),()=>{j.setFocusManagerState(null)}},[r,j,c,_,g,l,v]),wx(()=>{if(!(r||!W))return mE(W,E),()=>{queueMicrotask(lE)}},[r,W,E]);let oe=!r&&(c?!T:!0)&&(U||c);return(0,Y.jsxs)(J.Fragment,{children:[oe&&(0,Y.jsx)(yT,{"data-type":`inside`,ref:ie,onFocus:e=>{if(c){let e=te();xT(e[e.length-1])}else j?.portalNode&&(P.current=!1,_w(e,j.portalNode)?fw(v)?.focus():aE(p??j.beforeOutsideRef)?.focus())}}),n,oe&&(0,Y.jsx)(yT,{"data-type":`inside`,ref:ae,onFocus:e=>{c?xT(te()[0]):j?.portalNode&&(l&&(P.current=!0),_w(e,j.portalNode)?pw(v)?.focus():aE(f??j.afterOutsideRef)?.focus())}})]})}function gE(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0}=t,u=J.useRef(void 0),d=_T(),f=Px(),p=J.useMemo(()=>({onPointerDown(e){u.current=e.pointerType},onMouseDown(e){let t=u.current,i=e.nativeEvent,p=n.select(`open`);if(e.button!==0||a===`click`||JS(t,!0)&&s)return;let m=r.current.openEvent,h=m?.type,g=n.select(`domReferenceElement`)!==e.currentTarget,_=p&&g||!(p&&o&&(!(m&&c)||h===`click`||h===`mousedown`));if(RS(i.target)){let e=tT(Uw,i,i.target);_&&t===`touch`&&l>0?f.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(_,e);return}let v=e.currentTarget;d.request(()=>{let e=tT(Uw,i,v);_&&t===`touch`&&l>0?f.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(_,e)})},onClick(e){if(a===`mousedown-only`)return;let t=u.current;if(a===`mousedown`&&t){u.current=void 0;return}if(JS(t,!0)&&s)return;let i=n.select(`open`),d=r.current.openEvent,p=n.select(`domReferenceElement`)!==e.currentTarget,m=i&&p||!(i&&o&&(!(d&&c)||YS(d))),h=tT(Uw,e.nativeEvent,e.currentTarget);m&&t===`touch`&&l>0?f.start(l,()=>{n.setOpen(!0,h)}):n.setOpen(m,h)},onKeyDown(){u.current=void 0}}),[r,a,s,n,c,o,d,f,l]);return J.useMemo(()=>i?{reference:p}:Iw,[i,p])}function _E(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function vE(e){return e!=null&&e.clientX!=null}function yE(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{enabled:s=!0,axis:c=`both`,x:l=null,y:u=null}=t,d=J.useRef(!1),f=J.useRef(null),[p,m]=J.useState(),[h,g]=J.useState([]),_=uS((e,t)=>{d.current||o.current.openEvent&&!vE(o.current.openEvent)||n.set(`positionReference`,_E(a,{x:e,y:t,axis:c,dataRef:o,pointerType:p}))}),v=uS(e=>{l!=null||u!=null||(r?f.current||g([]):_(e.clientX,e.clientY))}),y=JS(p)?i:r,b=J.useCallback(()=>{if(!y||!s||l!=null||u!=null)return;let e=Lx(i);function t(n){NS(i,PS(n))?(e.removeEventListener(`mousemove`,t),f.current=null):_(n.clientX,n.clientY)}if(!o.current.openEvent||vE(o.current.openEvent)){e.addEventListener(`mousemove`,t);let n=()=>{e.removeEventListener(`mousemove`,t),f.current=null};return f.current=n,n}n.set(`positionReference`,a)},[y,s,l,u,i,o,a,n,_]);J.useEffect(()=>b(),[b,h]),J.useEffect(()=>{s&&!i&&(d.current=!1)},[s,i]),J.useEffect(()=>{!s&&r&&(d.current=!0)},[s,r]),wx(()=>{s&&(l!=null||u!=null)&&(d.current=!1,_(l,u))},[s,l,u,_]);let x=J.useMemo(()=>{function e(e){m(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:v,onMouseEnter:v}},[v]);return J.useMemo(()=>s?{reference:x}:{},[s,x])}function bE(e,t,n){let{reference:r,floating:i}=e,a=lC(t),o=uC(t),s=cC(o),c=aC(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(oC(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function xE(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=iC(t,e),p=SC(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=CC(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=CC(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var SE=50,CE=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:xE},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=bE(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<SE&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=bE(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},wE=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=iC(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=aC(r),_=lC(o),v=aC(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[bC(o)]:fC(o)),x=p!==`none`;!d&&x&&b.push(...yC(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=dC(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==lC(t))||T.every(e=>lC(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=lC(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function TE(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function EE(e){return XS.some(t=>e[t]>=0)}var DE=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=iC(e,t);switch(i){case`referenceHidden`:{let e=TE(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:EE(e)}}}case`escaped`:{let e=TE(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:EE(e)}}}default:return{}}}}},OE=new Set([`left`,`top`]);async function kE(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=aC(n),s=oC(n),c=lC(n)===`y`,l=OE.has(o)?-1:1,u=a&&c?-1:1,d=iC(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var AE=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await kE(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},jE=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=iC(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=lC(aC(i)),p=sC(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=rC(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=rC(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},ME=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=iC(e,t),u={x:n,y:r},d=lC(i),f=sC(d),p=u[f],m=u[d],h=iC(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=OE.has(aC(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},NE=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=iC(e,t),u=await o.detectOverflow(t,l),d=aC(i),f=oC(i),p=lC(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=ZS(h-u[g],v),x=ZS(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=QS(u.left,0),t=QS(u.right,0),n=QS(u.top,0),r=QS(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:QS(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:QS(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function PE(e){let t=eS(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Vx(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=$S(n)!==a||$S(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function FE(e){return Bx(e)?e:e.contextElement}function IE(e){let t=FE(e);if(!Vx(t))return tC(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=PE(t),o=(a?$S(n.width):n.width)/r,s=(a?$S(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var LE=tC(0);function RE(e){let t=Lx(e);return!Qx()||!t.visualViewport?LE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Lx(e)?!1:t}function BE(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=FE(e),o=tC(1);t&&(r?Bx(r)&&(o=IE(r)):o=IE(e));let s=zE(a,n,r)?RE(a):tC(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Lx(a),t=r&&Bx(r)?Lx(r):r,n=e,i=aS(n);for(;i&&r&&t!==n;){let e=IE(i),t=i.getBoundingClientRect(),r=eS(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Lx(i),i=aS(n)}}return CC({width:u,height:d,x:c,y:l})}function VE(e,t){let n=tS(e).scrollLeft;return t?t.left+n:BE(Rx(e)).left+n}function HE(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-VE(e,n),y:n.top+t.scrollTop}}function UE(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Rx(r),s=t?Gx(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=tC(1),u=tC(0),d=Vx(r);if((d||!d&&!a)&&((Ix(r)!==`body`||Ux(o))&&(c=tS(r)),d)){let e=BE(r);l=IE(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?HE(o,c):tC(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function WE(e){return Array.from(e.getClientRects())}function GE(e){let t=Rx(e),n=tS(e),r=e.ownerDocument.body,i=QS(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=QS(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+VE(e),s=-n.scrollTop;return eS(r).direction===`rtl`&&(o+=QS(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var KE=25;function qE(e,t){let n=Lx(e),r=Rx(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Qx();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=VE(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=KE&&(a-=o)}else l<=KE&&(a+=l);return{width:a,height:o,x:s,y:c}}function JE(e,t){let n=BE(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Vx(e)?IE(e):tC(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function YE(e,t,n){let r;if(t===`viewport`)r=qE(e,n);else if(t===`document`)r=GE(Rx(e));else if(Bx(t))r=JE(t,n);else{let n=RE(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return CC(r)}function XE(e,t){let n=nS(e);return n===t||!Bx(n)||$x(n)?!1:eS(n).position===`fixed`||XE(n,t)}function ZE(e,t){let n=t.get(e);if(n)return n;let r=iS(e,[],!1).filter(e=>Bx(e)&&Ix(e)!==`body`),i=null,a=eS(e).position===`fixed`,o=a?nS(e):e;for(;Bx(o)&&!$x(o);){let t=eS(o),n=Xx(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Ux(o)&&!n&&XE(e,o))?r=r.filter(e=>e!==o):i=t,o=nS(o)}return t.set(e,r),r}function QE(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Gx(t)?[]:ZE(t,this._c):[].concat(n),r],o=YE(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=YE(t,a[e],i);s=QS(n.top,s),c=ZS(n.right,c),l=ZS(n.bottom,l),u=QS(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function $E(e){let{width:t,height:n}=PE(e);return{width:t,height:n}}function eD(e,t,n){let r=Vx(t),i=Rx(t),a=n===`fixed`,o=BE(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=tC(0);function l(){c.x=VE(i)}if(r||!r&&!a)if((Ix(t)!==`body`||Ux(i))&&(s=tS(t)),r){let e=BE(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?HE(i,s):tC(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function tD(e){return eS(e).position===`static`}function nD(e,t){if(!Vx(e)||eS(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Rx(e)===n&&(n=n.ownerDocument.body),n}function rD(e,t){let n=Lx(e);if(Gx(e))return n;if(!Vx(e)){let t=nS(e);for(;t&&!$x(t);){if(Bx(t)&&!tD(t))return t;t=nS(t)}return n}let r=nD(e,t);for(;r&&Wx(r)&&tD(r);)r=nD(r,t);return r&&$x(r)&&tD(r)&&!Xx(r)?n:r||Zx(e)||n}var iD=async function(e){let t=this.getOffsetParent||rD,n=this.getDimensions,r=await n(e.floating);return{reference:eD(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function aD(e){return eS(e).direction===`rtl`}var oD={convertOffsetParentRelativeRectToViewportRelativeRect:UE,getDocumentElement:Rx,getClippingRect:QE,getOffsetParent:rD,getElementRects:iD,getClientRects:WE,getDimensions:$E,getScale:IE,isElement:Bx,isRTL:aD};function sD(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function cD(e,t){let n=null,r,i=Rx(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=eC(d),h=eC(i.clientWidth-(u+f)),g=eC(i.clientHeight-(d+p)),_=eC(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:QS(0,ZS(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!sD(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function lD(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=FE(e),u=i||a?[...l?iS(l):[],...t?iS(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?cD(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?BE(e):null;c&&g();function g(){let t=BE(e);h&&!sD(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var uD=AE,dD=jE,fD=wE,pD=NE,mD=DE,hD=ME,gD=(e,t,n)=>{let r=new Map,i={platform:oD,...n},a={...i.platform,_c:r};return CE(e,t,{...i,platform:a})},_D=typeof document<`u`?J.useLayoutEffect:function(){};function vD(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!vD(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!vD(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function yD(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function bD(e,t){let n=yD(e);return Math.round(t*n)/n}function xD(e){let t=J.useRef(e);return _D(()=>{t.current=e}),t}function SD(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=J.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=J.useState(r);vD(f,r)||p(r);let[m,h]=J.useState(null),[g,_]=J.useState(null),v=J.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=J.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=J.useRef(null),C=J.useRef(null),w=J.useRef(u),T=c!=null,E=xD(c),D=xD(i),O=xD(l),k=J.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),gD(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!vD(w.current,t)&&(w.current=t,ec.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);_D(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=J.useRef(!1);_D(()=>(A.current=!0,()=>{A.current=!1}),[]),_D(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=J.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=J.useMemo(()=>({reference:b,floating:x}),[b,x]),N=J.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=bD(M.floating,u.x),r=bD(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...yD(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return J.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var CD=(e,t)=>{let n=uD(e);return{name:n.name,fn:n.fn,options:[e,t]}},wD=(e,t)=>{let n=dD(e);return{name:n.name,fn:n.fn,options:[e,t]}},TD=(e,t)=>({fn:hD(e).fn,options:[e,t]}),ED=(e,t)=>{let n=fD(e);return{name:n.name,fn:n.fn,options:[e,t]}},DD=(e,t)=>{let n=pD(e);return{name:n.name,fn:n.fn,options:[e,t]}},OD=(e,t)=>{let n=mD(e);return{name:n.name,fn:n.fn,options:[e,t]}},kD={intentional:`onClick`,sloppy:`onPointerDown`};function AD(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function jD(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`referenceElement`),o=n.useState(`domReferenceElement`),{onOpenChange:s,dataRef:c}=n.context,{enabled:l=!0,escapeKey:u=!0,outsidePress:d=!0,outsidePressEvent:f=`sloppy`,referencePress:p=!1,referencePressEvent:m=`sloppy`,ancestorScroll:h=!1,bubbles:g,externalTree:_}=t,v=Aw(_),y=uS(typeof d==`function`?d:()=>!1),b=typeof d==`function`?y:d,x=J.useRef(!1),{escapeKey:S,outsidePress:C}=AD(g),w=J.useRef(null),T=Px(),E=Px(),D=uS(()=>{E.clear(),c.current.insideReactTree=!1}),O=J.useRef(!1),k=J.useRef(``),A=uS(e=>{k.current=e.pointerType}),j=uS(()=>{let e=k.current,t=e===`pen`||!e?`mouse`:e,n=typeof f==`function`?f():f;return typeof n==`string`?n:n[t]}),M=uS(e=>{if(!r||!l||!u||e.key!==`Escape`||O.current)return;let t=c.current.floatingContext?.nodeId,i=v?HS(v.nodesRef.current,t):[];if(!S&&i.length>0){let e=!0;if(i.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let a=tT(Yw,GS(e)?e.nativeEvent:e);n.setOpen(!1,a),!S&&!a.isPropagationAllowed&&e.stopPropagation()}),N=uS(e=>{let t=j();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}),P=uS(()=>{c.current.insideReactTree=!0,E.start(0,D)}),F=uS((e,t=!1)=>{if(N(e)){D();return}if(c.current.insideReactTree){D();return}if(j()===`intentional`&&t||typeof b==`function`&&!b(e))return;let r=PS(e),i=`[${nT(`inert`)}]`,a=LS(n.select(`floatingElement`)).querySelectorAll(i),o=n.context.triggerElements;if(r&&(o.hasElement(r)||o.hasMatchingElement(e=>NS(e,r))))return;let s=Bx(r)?r:null;for(;s&&!$x(s);){let e=nS(s);if($x(e)||!Bx(e))break;s=e}if(a.length&&Bx(r)&&!IS(r)&&!NS(r,n.select(`floatingElement`))&&Array.from(a).every(e=>!NS(s,e)))return;if(Vx(r)&&!(`touches`in e)){let t=$x(r),n=eS(r),i=/auto|scroll/,a=t||i.test(n.overflowX),o=t||i.test(n.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=r.offsetWidth-r.clientWidth:e.offsetX>r.clientWidth),d=s&&e.offsetY>r.clientHeight;if(u||d)return}let l=c.current.floatingContext?.nodeId,u=v&&HS(v.nodesRef.current,l).some(t=>FS(e,t.context?.elements.floating));if(FS(e,n.select(`floatingElement`))||FS(e,n.select(`domReferenceElement`))||u)return;let d=v?HS(v.nodesRef.current,l):[];if(d.length>0){let e=!0;if(d.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}n.setOpen(!1,tT(Kw,e)),D()}),I=uS(e=>{j()!==`sloppy`||e.pointerType===`touch`||!n.select(`open`)||!l||FS(e,n.select(`floatingElement`))||FS(e,n.select(`domReferenceElement`))||F(e)}),L=uS(e=>{if(j()!==`sloppy`||!n.select(`open`)||!l||FS(e,n.select(`floatingElement`))||FS(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(w.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},T.start(1e3,()=>{w.current&&(w.current.dismissOnTouchEnd=!1,w.current.dismissOnMouseDown=!1)}))}),R=uS(e=>{let t=PS(e);function n(){L(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)}),z=uS(e=>{let t=x.current;if(x.current=!1,T.clear(),e.type===`mousedown`&&w.current&&!w.current.dismissOnMouseDown)return;let n=PS(e);function r(){e.type===`pointerdown`?I(e):F(e,t),n?.removeEventListener(e.type,r)}n?.addEventListener(e.type,r)}),B=uS(e=>{if(j()!==`sloppy`||!w.current||FS(e,n.select(`floatingElement`))||FS(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-w.current.startX),i=Math.abs(t.clientY-w.current.startY),a=Math.sqrt(r*r+i*i);a>5&&(w.current.dismissOnTouchEnd=!0),a>10&&(F(e),T.clear(),w.current=null)}),V=uS(e=>{let t=PS(e);function n(){B(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)}),H=uS(e=>{j()!==`sloppy`||!w.current||FS(e,n.select(`floatingElement`))||FS(e,n.select(`domReferenceElement`))||(w.current.dismissOnTouchEnd&&F(e),T.clear(),w.current=null)}),U=uS(e=>{let t=PS(e);function n(){H(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)});J.useEffect(()=>{if(!r||!l)return;c.current.__escapeKeyBubbles=S,c.current.__outsidePressBubbles=C;let e=new Nx;function t(e){n.setOpen(!1,tT(Hw,e))}function s(){e.clear(),O.current=!0}function d(){e.start(Qx()?5:0,()=>{O.current=!1})}let f=LS(i);f.addEventListener(`pointerdown`,A,!0),u&&(f.addEventListener(`keydown`,M),f.addEventListener(`compositionstart`,s),f.addEventListener(`compositionend`,d)),b&&(f.addEventListener(`click`,z,!0),f.addEventListener(`pointerdown`,z,!0),f.addEventListener(`touchstart`,R,!0),f.addEventListener(`touchmove`,V,!0),f.addEventListener(`touchend`,U,!0),f.addEventListener(`mousedown`,z,!0));let p=[];return h&&(Bx(o)&&(p=iS(o)),Bx(i)&&(p=p.concat(iS(i))),!Bx(a)&&a&&a.contextElement&&(p=p.concat(iS(a.contextElement)))),p=p.filter(e=>e!==f.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t,{passive:!0})}),()=>{f.removeEventListener(`pointerdown`,A,!0),u&&(f.removeEventListener(`keydown`,M),f.removeEventListener(`compositionstart`,s),f.removeEventListener(`compositionend`,d)),b&&(f.removeEventListener(`click`,z,!0),f.removeEventListener(`pointerdown`,z,!0),f.removeEventListener(`touchstart`,R,!0),f.removeEventListener(`touchmove`,V,!0),f.removeEventListener(`touchend`,U,!0),f.removeEventListener(`mousedown`,z,!0)),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),e.clear()}},[c,i,a,o,u,b,r,s,h,l,S,C,M,F,z,I,R,V,U,A,n]),J.useEffect(D,[b,D]);let W=J.useMemo(()=>({onKeyDown:M,...p&&{[kD[m]]:e=>{n.setOpen(!1,tT(`trigger-press`,e.nativeEvent))},...m!==`intentional`&&{onClick(e){n.setOpen(!1,tT(`trigger-press`,e.nativeEvent))}}}}),[M,n,p,m]),ee=uS(e=>{let t=PS(e.nativeEvent);!NS(n.select(`floatingElement`),t)||e.button!==0||(x.current=!0)}),te=J.useMemo(()=>({onKeyDown:M,onPointerDown:ee,onMouseDown:ee,onMouseUp:ee,onClickCapture:P,onMouseDownCapture:P,onPointerDownCapture:P,onMouseUpCapture:P,onTouchEndCapture:P,onTouchMoveCapture:P}),[M,ee,P]);return J.useMemo(()=>l?{reference:W,floating:te,trigger:W}:{},[l,W,te])}var MD=Symbol(`NOT_FOUND`);function ND(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function PD(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var FD=e=>Array.isArray(e)?e:[e];function ID(e){let t=Array.isArray(e[0])?e[0]:e;return PD(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function LD(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function RD(e){let t;return{get(n){return t&&e(t.key,n)?t.value:MD},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function zD(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return MD}function i(t,i){r(t)===MD&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var BD=(e,t)=>e===t;function VD(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function HD(e,t){let{equalityCheck:n=BD,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=VD(n),o=0,s=r<=1?RD(a):zD(r,a);function c(){let t=s.get(arguments);if(t===MD){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var UD=class{constructor(e){this.value=e}deref(){return this.value}},WD=typeof WeakRef>`u`?UD:WeakRef,GD=0,KD=1;function qD(){return{s:GD,v:void 0,o:null,p:null}}function JD(e){return e instanceof WD?e.deref():e}function YD(e,t={}){let n=qD(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=qD(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=qD(),e.set(n,t)):t=r}}let s=t,c;if(t.s===KD)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=JD(i);e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new WD(c):c}return s.s=KD,s.v=c,c}return o.clearCache=()=>{n=qD(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function XD(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),ND(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=YD,argsMemoizeOptions:u=[]}={...n,...a},d=FD(c),f=FD(u),p=ID(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=LD(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}XD({memoize:HD,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});var Q=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(Tx(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},ZD=it(),QD=ot(),$D=MT(19)?tO:nO;function eO(e,t,n,r,i){return $D(e,t,n,r,i)}function tO(e,t,n,r,i){let a=J.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,ZD.useSyncExternalStore)(e.subscribe,a,a)}function nO(e,t,n,r,i){return(0,QD.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var rO=class e{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(t){for(let n in t)if(!Object.is(this.state[n],t[n])){e.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||e.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){let t={...this.state};e.prototype.setState.call(this,t)}},iO=class extends rO{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}controlledValues=new Map;useSyncedValue(e,t){J.useDebugValue(e),wx(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){wx(()=>(this.state[e]!==t&&this.set(e,t),()=>{this.set(e,void 0)}),[e,t])}useSyncedValues(e){wx(()=>{this.update(e)},Object.values(e))}useControlledProp(e,t,n){J.useDebugValue(e);let r=t!==void 0;this.controlledValues.has(e)||(this.controlledValues.set(e,r),!r&&!Object.is(this.state[e],n)&&super.setState({...this.state,[e]:n})),wx(()=>{r&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n,r])}set(e,t){this.controlledValues.get(e)!==!0&&super.set(e,t)}update(e){let t={...e};for(let e in t)if(Object.hasOwn(t,e)&&this.controlledValues.get(e)===!0){delete t[e];continue}super.update(t)}setState(e){let t={...e};for(let e in t)if(Object.hasOwn(t,e)&&this.controlledValues.get(e)===!0){delete t[e];continue}super.setState({...this.state,...t})}select=(e,t,n,r)=>{let i=this.selectors[e];return i(this.state,t,n,r)};useState=(e,t,n,r)=>{J.useDebugValue(e);let i=this.selectors[e];return eO(this,i,t,n,r)};useContextCallback(e,t){J.useDebugValue(e);let n=uS(t??Pw);this.context[e]=n}useStateSetter(e){let t=J.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},aO={open:Q(e=>e.open),domReferenceElement:Q(e=>e.domReferenceElement),referenceElement:Q(e=>e.positionReference??e.referenceElement),floatingElement:Q(e=>e.floatingElement),floatingId:Q(e=>e.floatingId)},oO=class extends iO{constructor(e){let{nested:t,noEmit:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Tw(),nested:t,noEmit:n,triggerElements:i},aO)}setOpen=(e,t)=>{if((!e||!this.state.open||YS(t.event))&&(this.context.dataRef.current.openEvent=e?t.event:void 0),!this.context.noEmit){let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)}this.context.onOpenChange?.(e,t)}};function sO(e,t=!1,n=!1){let[r,i]=J.useState(e&&t?`idle`:void 0),[a,o]=J.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),wx(()=>{if(!e&&a&&r!==`ending`&&n){let e=gT.request(()=>{i(`ending`)});return()=>{gT.cancel(e)}}},[e,a,r,n]),wx(()=>{if(!e||t)return;let n=gT.request(()=>{ec.flushSync(()=>{i(void 0)})});return()=>{gT.cancel(n)}},[t,e]),wx(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=gT.request(()=>{i(`idle`)});return()=>{gT.cancel(n)}},[t,e,a,i,r]),J.useMemo(()=>({mounted:a,setMounted:o,transitionStatus:r}),[a,r])}function cO(e,t=!1,n=!0){let r=_T();return uS((i,a=null)=>{r.cancel();let o=aE(e);o!=null&&(typeof o.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED?i():r.request(()=>{function e(){o&&Promise.all(o.getAnimations().map(e=>e.finished)).then(()=>{a!=null&&a.aborted||ec.flushSync(i)}).catch(()=>{if(n){if(a!=null&&a.aborted)return;ec.flushSync(i)}else o.getAnimations().length>0&&o.getAnimations().some(e=>e.pending||e.playState!==`finished`)&&e()})}t?r.request(e):e()}))})}function lO(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=oS(n),o=uS(i),s=cO(r,n);J.useEffect(()=>{t&&s(()=>{n===a.current&&o()})},[t,n,o,s,a])}function uO(e,t){let n=J.useRef(null);return J.useCallback(r=>{if(e!==void 0&&(n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null),r!==null))return n.current=e,t.context.triggerElements.add(e,r),()=>{n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null)}},[t,e])}function dO(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=uO(e,n),o=uS(t=>{let i=a(t);return t!==null&&n.select(`open`)&&n.select(`activeTriggerId`)==null&&n.update({activeTriggerId:e,activeTriggerElement:t,...r}),i});return wx(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function fO(e){let t=e.useState(`open`);wx(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function pO(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=sO(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=uS(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return lO({enabled:!t.useState(`preventUnmountingOnClose`),open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}var mO=class{constructor(){this.elements=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elements.delete(n),this.elements.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elements.delete(t),this.idMap.delete(e))}hasElement(e){return this.elements.has(e)}hasMatchingElement(e){for(let t of this.elements)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}};function hO(){return new oO({open:!1,floatingElement:null,referenceElement:null,triggerElements:new mO,floatingId:``,nested:!1,noEmit:!1,onOpenChange:void 0})}function gO(){return{open:!1,mounted:!1,transitionStatus:`idle`,floatingRootContext:hO(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:Iw,inactiveTriggerProps:Iw,popupProps:Iw}}var _O={open:Q(e=>e.open),mounted:Q(e=>e.mounted),transitionStatus:Q(e=>e.transitionStatus),floatingRootContext:Q(e=>e.floatingRootContext),preventUnmountingOnClose:Q(e=>e.preventUnmountingOnClose),payload:Q(e=>e.payload),activeTriggerId:Q(e=>e.activeTriggerId),activeTriggerElement:Q(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:Q((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:Q((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:Q((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:Q((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:Q(e=>e.popupProps),popupElement:Q(e=>e.popupElement),positionerElement:Q(e=>e.positionerElement)};function vO(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=ww(),a=kw()!=null,o=kx(()=>new oO({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new mO,floatingId:i,nested:a,noEmit:e.noEmit||!1})).current;return wx(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=Bx(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o.context.noEmit=e.noEmit||!1,o}function yO(e={}){let{nodeId:t,externalTree:n}=e,r=vO(e),i=e.rootContext||r,a={reference:i.useState(`referenceElement`),floating:i.useState(`floatingElement`),domReference:i.useState(`domReferenceElement`)},[o,s]=J.useState(null),c=J.useRef(null),l=Aw(n);wx(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);let u=SD({...e,elements:{...a,...o&&{reference:o}}}),d=J.useCallback(e=>{let t=Bx(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;s(t),u.refs.setReference(t)},[u.refs]),[f,p]=J.useState(null),[m,h]=J.useState(null);i.useSyncedValue(`referenceElement`,f),i.useSyncedValue(`domReferenceElement`,Bx(f)?f:null),i.useSyncedValue(`floatingElement`,m);let g=J.useCallback(e=>{(Bx(e)||e===null)&&(c.current=e,p(e)),(Bx(u.refs.reference.current)||u.refs.reference.current===null||e!==null&&!Bx(e))&&u.refs.setReference(e)},[u.refs,p]),_=J.useCallback(e=>{h(e),u.refs.setFloating(e)},[u.refs]),v=J.useMemo(()=>({...u.refs,setReference:g,setFloating:_,setPositionReference:d,domReference:c}),[u.refs,g,_,d]),y=J.useMemo(()=>({...u.elements,domReference:a.domReference}),[u.elements,a.domReference]),b=i.useState(`open`),x=i.useState(`floatingId`),S=J.useMemo(()=>({...u,dataRef:i.context.dataRef,open:b,onOpenChange:i.setOpen,events:i.context.events,floatingId:x,refs:v,elements:y,nodeId:t,rootStore:i}),[u,v,y,t,i,b,x]);return wx(()=>{i.context.dataRef.current.floatingContext=S;let e=l?.nodesRef.current.find(e=>e.id===t);e&&(e.context=S)}),J.useMemo(()=>({...u,context:S,refs:v,elements:y,rootStore:i}),[u,v,y,S,i])}function bO(e){let{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:i}=e,a=ww(),o=kw()!=null,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(r?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=kx(()=>new oO({open:s,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:i,floatingId:a,nested:o,noEmit:n})).current;return wx(()=>{let e={open:s,floatingId:a,referenceElement:c,floatingElement:l};Bx(c)&&(e.domReferenceElement=c),d.update(e)},[s,a,c,l,d]),d.context.onOpenChange=i,d.context.nested=o,d.context.noEmit=n,d}var xO=xS&&yS;function SO(e,t={}){let n=`rootStore`in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,visibleOnly:o=!0}=t,s=J.useRef(!1),c=Px(),l=J.useRef(!0);J.useEffect(()=>{let e=n.select(`domReferenceElement`);if(!a)return;let t=Lx(e);function r(){!n.select(`open`)&&Vx(e)&&e===MS(LS(e))&&(s.current=!0)}function i(){l.current=!0}function o(){l.current=!1}return t.addEventListener(`blur`,r),xO&&(t.addEventListener(`keydown`,i,!0),t.addEventListener(`pointerdown`,o,!0)),()=>{t.removeEventListener(`blur`,r),xO&&(t.removeEventListener(`keydown`,i,!0),t.removeEventListener(`pointerdown`,o,!0))}},[n,a]),J.useEffect(()=>{if(!a)return;function e(e){(e.reason===`trigger-press`||e.reason===`escape-key`)&&(s.current=!0)}return r.on(`openchange`,e),()=>{r.off(`openchange`,e)}},[r,a]);let u=J.useMemo(()=>({onMouseLeave(){s.current=!1},onFocus(e){if(s.current)return;let t=PS(e.nativeEvent);if(o&&Bx(t)){if(xO&&!e.relatedTarget){if(!l.current&&!RS(t))return}else if(!BS(t))return}n.setOpen(!0,tT(Gw,e.nativeEvent,e.currentTarget))},onBlur(e){s.current=!1;let t=e.relatedTarget,r=e.nativeEvent,a=Bx(t)&&t.hasAttribute(nT(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;c.start(0,()=>{let o=n.select(`domReferenceElement`),s=MS(o?o.ownerDocument:document);!t&&s===o||NS(i.current.floatingContext?.refs.floating.current,s)||NS(o,s)||a||n.context.triggerElements.hasElement(e.relatedTarget)||n.setOpen(!1,tT(Gw,r))})}}),[i,n,o,c]);return J.useMemo(()=>a?{reference:u,trigger:u}:{},[a,u])}var CO=nT(`safe-polygon`),wO=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${DS}`;function TO(e){return e?!!e.closest(wO):!1}function EO(e){let t=J.useRef(void 0),n=J.useRef(!1),r=J.useRef(void 0),i=J.useRef(!0),a=J.useRef(!1),o=J.useRef(()=>{}),s=J.useRef(!1),c=Px(),l=Px(),u=J.useRef(void 0);return J.useMemo(()=>{let d=e.context.dataRef.current;return d.hoverInteractionState||={pointerTypeRef:t,interactedInsideRef:n,handlerRef:r,blockMouseMoveRef:i,performedPointerEventsMutationRef:a,unbindMouseMoveRef:o,restTimeoutPendingRef:s,openChangeTimeout:c,restTimeout:l,handleCloseOptionsRef:u},d.hoverInteractionState},[e,t,n,r,i,a,o,s,c,l,u])}var DO=new Set([`click`,`mousedown`]);function OO(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:c=0,externalTree:l}=t,{pointerTypeRef:u,interactedInsideRef:d,handlerRef:f,performedPointerEventsMutationRef:p,unbindMouseMoveRef:m,restTimeoutPendingRef:h,openChangeTimeout:g,handleCloseOptionsRef:_}=EO(n),v=Aw(l),y=kw(),b=uS(()=>d.current?!0:o.current.openEvent?DO.has(o.current.openEvent.type):!1),x=uS(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),S=J.useCallback((e,t=!0)=>{let r=kO(c,u.current);r&&!f.current?g.start(r,()=>n.setOpen(!1,tT(Ww,e))):t&&(g.clear(),n.setOpen(!1,tT(Ww,e)))},[c,f,n,u,g]),C=uS(()=>{m.current(),f.current=void 0}),w=uS(()=>{if(p.current){let e=LS(i).body;e.style.pointerEvents=``,e.removeAttribute(CO),p.current=!1}}),T=uS(e=>{if(!TO(PS(e))){d.current=!1;return}d.current=!0});wx(()=>{r||(u.current=void 0,h.current=!1,d.current=!1,C(),w())},[r,u,h,d,C,w]),J.useEffect(()=>()=>{C()},[C]),J.useEffect(()=>w,[w]),wx(()=>{if(s&&r&&_.current?.blockPointerEvents&&x()&&Bx(a)&&i){p.current=!0;let e=LS(i).body;e.setAttribute(CO,``);let t=a,n=i,r=v?.nodesRef.current.find(e=>e.id===y)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),e.style.pointerEvents=`none`,t.style.pointerEvents=`auto`,n.style.pointerEvents=`auto`,()=>{e.style.pointerEvents=``,t.style.pointerEvents=``,n.style.pointerEvents=``}}},[s,r,a,i,_,x,v,y,p]),J.useEffect(()=>{if(!s)return;function e(e){if(b()||!o.current.floatingContext)return;let t=n.context.triggerElements;e.relatedTarget&&t.hasElement(e.relatedTarget)||(w(),C(),b()||S(e))}function t(e){g.clear(),w(),f.current?.(e),C()}function r(e){b()||S(e,!1)}let a=i;return a&&(a.addEventListener(`mouseleave`,e),a.addEventListener(`mouseenter`,t),a.addEventListener(`mouseleave`,r),a.addEventListener(`pointerdown`,T,!0)),()=>{a&&(a.removeEventListener(`mouseleave`,e),a.removeEventListener(`mouseenter`,t),a.removeEventListener(`mouseleave`,r),a.removeEventListener(`pointerdown`,T,!0))}})}function kO(e,t){return t&&!JS(t)?0:typeof e==`function`?e():e}function AO(e){return typeof e==`function`?e():e}var jO={current:null};function MO(e,t={}){let n=`rootStore`in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:c=!1,restMs:l=0,move:u=!0,triggerElementRef:d=jO,externalTree:f,isActiveTrigger:p=!0}=t,m=Aw(f),{pointerTypeRef:h,interactedInsideRef:g,handlerRef:_,blockMouseMoveRef:v,performedPointerEventsMutationRef:y,unbindMouseMoveRef:b,restTimeoutPendingRef:x,openChangeTimeout:S,restTimeout:C,handleCloseOptionsRef:w}=EO(n),T=oS(s),E=oS(o),D=oS(l);p&&(w.current=T.current?.__options);let O=uS(()=>g.current?!0:r.current.openEvent?[`click`,`mousedown`].includes(r.current.openEvent.type):!1),k=J.useCallback((e,t=!0)=>{let r=rT(E.current,`close`,h.current);r&&!_.current?S.start(r,()=>n.setOpen(!1,tT(Ww,e))):t&&(S.clear(),n.setOpen(!1,tT(Ww,e)))},[E,_,n,h,S]),A=uS(()=>{b.current(),_.current=void 0}),j=uS(()=>{if(y.current){let e=LS(n.select(`domReferenceElement`)).body;e.style.pointerEvents=``,e.removeAttribute(CO),y.current=!1}});J.useEffect(()=>{if(!a)return;function e(e){e.open||(S.clear(),C.clear(),v.current=!0,x.current=!1)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[a,i,S,C,v,x]);let M=uS(e=>{if(O()||!r.current.floatingContext)return;let t=n.context.triggerElements;e.relatedTarget&&t.hasElement(e.relatedTarget)||T.current?.({...r.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){j(),A(),O()||k(e)}})(e)});return J.useEffect(()=>{if(!a)return;let e=d.current??(p?n.select(`domReferenceElement`):null);if(!Bx(e))return;function t(e){if(S.clear(),v.current=!1,c&&!JS(h.current)||AO(D.current)>0&&!rT(E.current,`open`))return;let t=rT(E.current,`open`,h.current),r=n.select(`domReferenceElement`),i=n.context.triggerElements,a=(i.hasElement(e.target)||i.hasMatchingElement(t=>NS(t,e.target)))&&(!r||!NS(r,e.target)),o=e.currentTarget??null;t?S.start(t,()=>{n.select(`open`)||n.setOpen(!0,tT(Ww,e,o))}):(!n.select(`open`)||a)&&n.setOpen(!0,tT(Ww,e,o))}function i(e){if(O()){j();return}b.current();let t=LS(n.select(`domReferenceElement`));C.clear(),x.current=!1;let i=n.context.triggerElements;if(!(e.relatedTarget&&i.hasElement(e.relatedTarget))){if(T.current&&r.current.floatingContext){n.select(`open`)||S.clear(),_.current=T.current({...r.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){j(),A(),O()||k(e,!0)}});let i=_.current;i(e),t.addEventListener(`mousemove`,i),b.current=()=>{t.removeEventListener(`mousemove`,i)};return}(h.current!==`touch`||!NS(n.select(`floatingElement`),e.relatedTarget))&&k(e)}}function o(e){M(e)}return n.select(`open`)&&e.addEventListener(`mouseleave`,o),u&&e.addEventListener(`mousemove`,t,{once:!0}),e.addEventListener(`mouseenter`,t),e.addEventListener(`mouseleave`,i),()=>{e.removeEventListener(`mouseleave`,o),u&&e.removeEventListener(`mousemove`,t),e.removeEventListener(`mouseenter`,t),e.removeEventListener(`mouseleave`,i)}},[A,j,v,r,E,k,n,a,T,M,p,O,c,u,h,D,C,x,S,d,m,b,_]),J.useMemo(()=>{function e(e){h.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`),a=n.context.triggerElements,o=n.select(`open`),s=(a.hasElement(e.target)||a.hasMatchingElement(t=>NS(t,e.target)))&&(!i||!NS(i,e.target));if(c&&!JS(h.current)||o&&!s||AO(D.current)===0||!s&&x.current&&e.movementX**2+e.movementY**2<2)return;C.clear();function l(){!v.current&&(!o||s)&&n.setOpen(!0,tT(Ww,t,r))}h.current===`touch`?ec.flushSync(()=>{l()}):s&&o?l():(x.current=!0,C.start(AO(D.current),l))}}},[v,c,n,h,D,C,x])}function NO(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=J.useCallback(t=>PO(t,e,`reference`),t),o=J.useCallback(t=>PO(t,e,`floating`),n),s=J.useCallback(t=>PO(t,e,`item`),r),c=J.useCallback(t=>PO(t,e,`trigger`),i);return J.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function PO(e,t,n){let r=new Map,i=n===`item`,a={};n===`floating`&&(a.tabIndex=-1,a[ES]=``);for(let t in e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&FO(a,s,i,r)}return FO(a,e,i,r),a}function FO(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var IO=`Escape`;function LO(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function RO(e,t){return LO(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function zO(e,t,n){return LO(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function BO(e,t,n){return LO(t,n?e===OS:e===kS,e===jS)}function VO(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===IO:LO(t,n?e===kS:e===OS,e===AS)}function HO(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{listRef:s,activeIndex:c,onNavigate:l=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:h=!1,virtual:g=!1,focusItemOnOpen:_=`auto`,focusItemOnHover:v=!0,openOnArrowKeyDown:y=!0,disabledIndices:b=void 0,orientation:x=`vertical`,parentOrientation:S,cols:C=1,scrollItemIntoView:w=!0,itemSizes:T,dense:E=!1,id:D,resetOnPointerLeave:O=!0,externalTree:k}=t,A=oS(VS(i)),j=kw(),M=Aw(k);wx(()=>{o.current.orientation=x},[o,x]);let N=zS(a),P=J.useRef(_),F=J.useRef(d??-1),I=J.useRef(null),L=J.useRef(!0),R=uS(e=>{l(F.current===-1?null:F.current,e)}),z=J.useRef(R),B=J.useRef(!!i),V=J.useRef(r),H=J.useRef(!1),U=J.useRef(!1),W=oS(b),ee=oS(r),te=oS(w),ne=oS(d),re=oS(O),ie=uS(()=>{function e(e){g?M?.events.emit(`virtualfocus`,e):xT(e,{sync:H.current,preventScroll:!0})}let t=s.current[F.current],n=U.current;t&&e(t),(H.current?e=>e():requestAnimationFrame)(()=>{let r=s.current[F.current]||t;if(!r)return;t||e(r);let i=te.current;i&&oe&&(n||!L.current)&&r.scrollIntoView?.(typeof i==`boolean`?{block:`nearest`,inline:`nearest`}:i)})});wx(()=>{u&&(r&&i?(F.current=d??-1,P.current&&d!=null&&(U.current=!0,R())):B.current&&(F.current=-1,z.current()))},[u,r,i,d,R]),wx(()=>{if(u){if(!r){H.current=!1;return}if(i)if(c==null){if(H.current=!1,ne.current!=null)return;if(B.current&&(F.current=-1,ie()),(!V.current||!B.current)&&P.current&&(I.current!=null||P.current===!0&&I.current==null)){let e=0,t=()=>{s.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(F.current=I.current==null||zO(I.current,x,h)||m?EC(s):DC(s),I.current=null,R())};t()}}else TC(s,c)||(F.current=c,ie(),U.current=!1)}},[u,r,i,c,ne,m,s,x,h,R,ie,W]),wx(()=>{if(!u||i||!M||g||!B.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=MS(LS(i)),r=e.some(e=>e.context&&NS(e.context.elements.floating,n));t&&!r&&L.current&&t.focus({preventScroll:!0})},[u,i,M,j,g]),wx(()=>{z.current=R,V.current=r,B.current=!!i}),wx(()=>{r||(I.current=null,P.current=_)},[r,_]);let ae=c!=null,oe=J.useMemo(()=>{function e(e){if(!ee.current)return;let t=s.current.indexOf(e.currentTarget);t!==-1&&F.current!==t&&(F.current=t,R(e))}return{onFocus(t){H.current=!0,e(t)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(t){H.current=!0,U.current=!1,v&&e(t)},onPointerLeave(e){if(!ee.current||!L.current||e.pointerType===`touch`)return;H.current=!0;let t=e.relatedTarget;!v||s.current.includes(t)||re.current&&(F.current=-1,R(e),g||A.current?.focus({preventScroll:!0}))}}},[ee,A,v,s,R,re,g]),G=J.useCallback(()=>S??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation,[j,M,S]),se=uS(e=>{if(L.current=!1,H.current=!0,e.which===229||!ee.current&&e.currentTarget===A.current)return;if(m&&VO(e.key,x,h,C)){RO(e.key,G())||WS(e),n.setOpen(!1,tT(Xw,e.nativeEvent)),Vx(a)&&(g?M?.events.emit(`virtualfocus`,a):a.focus());return}let t=F.current,i=EC(s,b),o=DC(s,b);if(N||(e.key===`Home`&&(WS(e),F.current=i,R(e)),e.key===`End`&&(WS(e),F.current=o,R(e))),C>1){let t=T||Array.from({length:s.current.length},()=>({width:1,height:1})),n=AC(t,C,E),r=n.findIndex(e=>e!=null&&!NC(s,e,b)),a=n.reduce((e,t,n)=>t!=null&&!NC(s,t,b)?n:e,-1),c=n[kC({current:n.map(e=>e==null?null:s.current[e])},{event:e,orientation:x,loopFocus:p,rtl:h,cols:C,disabledIndices:MC([...(typeof b==`function`?null:b)||s.current.map((e,t)=>NC(s,t,b)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:jC(F.current>o?i:F.current,t,n,C,e.key===`ArrowDown`?`bl`:e.key===(h?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(F.current=c,R(e)),x===`both`)return}if(RO(e.key,x)){if(WS(e),r&&!g&&MS(e.currentTarget.ownerDocument)===e.currentTarget){F.current=zO(e.key,x,h)?i:o,R(e);return}zO(e.key,x,h)?p?t>=o?f&&t!==s.current.length?F.current=-1:(H.current=!1,F.current=i):F.current=OC(s,{startingIndex:t,disabledIndices:b}):F.current=Math.min(o,OC(s,{startingIndex:t,disabledIndices:b})):p?t<=i?f&&t!==-1?F.current=s.current.length:(H.current=!1,F.current=o):F.current=OC(s,{startingIndex:t,decrement:!0,disabledIndices:b}):F.current=Math.max(i,OC(s,{startingIndex:t,decrement:!0,disabledIndices:b})),TC(s,F.current)&&(F.current=-1),R(e)}}),K=J.useMemo(()=>g&&r&&ae&&{"aria-activedescendant":`${D}-${c}`},[g,r,ae,D,c]),ce=J.useMemo(()=>({"aria-orientation":x===`both`?void 0:x,...N?{}:K,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!g){let t=PS(e.nativeEvent);if(t&&!NS(A.current,t))return;WS(e),n.setOpen(!1,tT(Jw,e.nativeEvent)),Vx(a)&&a.focus();return}se(e)},onPointerMove(){L.current=!0}}),[K,se,A,x,N,n,r,g,a]),le=J.useMemo(()=>{function e(e){_===`auto`&&KS(e.nativeEvent)&&(P.current=!g)}function t(e){P.current=_,_===`auto`&&qS(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(e){let t=n.select(`open`);L.current=!1;let r=e.key.startsWith(`Arrow`),i=BO(e.key,G(),h),a=RO(e.key,x),o=(m?i:a)||e.key===`Enter`||e.key.trim()===``;if(g&&t)return se(e);if(!(!t&&!y&&r)){if(o){let t=RO(e.key,G());I.current=m&&t?null:e.key}if(m){i&&(WS(e),t?(F.current=EC(s,W.current),R(e)):n.setOpen(!0,tT(Xw,e.nativeEvent,e.currentTarget)));return}a&&(ne.current!=null&&(F.current=ne.current),WS(e),!t&&y?n.setOpen(!0,tT(Xw,e.nativeEvent,e.currentTarget)):se(e),t&&R(e))}},onFocus(e){n.select(`open`)&&!g&&(F.current=-1,R(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[se,W,_,s,m,R,n,y,x,G,h,ne,g]),ue=J.useMemo(()=>({...K,...le}),[K,le]);return J.useMemo(()=>u?{reference:ue,floating:ce,item:oe,trigger:le}:{},[u,ue,ce,le,oe])}var UO=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function WO(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{enabled:s=!0,role:c=`dialog`}=t,l=ww(),u=a?.id||l,d=J.useMemo(()=>VS(o)?.id||i,[o,i]),f=UO.get(c)??c,p=kw()!=null,m=J.useMemo(()=>f===`tooltip`||c===`label`?Iw:{"aria-haspopup":f===`alertdialog`?`dialog`:f,"aria-expanded":`false`,...f===`listbox`&&{role:`combobox`},...f===`menu`&&p&&{role:`menuitem`},...c===`select`&&{"aria-autocomplete":`none`},...c===`combobox`&&{"aria-autocomplete":`list`}},[f,p,c]),h=J.useMemo(()=>f===`tooltip`||c===`label`?{[`aria-${c===`label`?`labelledby`:`describedby`}`]:r?d:void 0}:{...m,"aria-expanded":r?`true`:`false`,"aria-controls":r?d:void 0,...f===`menu`&&{id:u}},[f,d,r,u,c,m]),g=J.useMemo(()=>{let e={id:d,...f&&{role:f}};return f===`tooltip`||c===`label`?e:{...e,...f===`menu`&&{"aria-labelledby":u}}},[f,d,u,c]),_=J.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${d}-fui-option`}};switch(c){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[d,c]);return J.useMemo(()=>s?{reference:h,floating:g,item:_,trigger:m}:{},[s,h,g,m,_])}function GO(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.context.dataRef,{listRef:a,activeIndex:o,onMatch:s,onTypingChange:c,enabled:l=!0,findMatch:u=null,resetMs:d=750,ignoreKeys:f=Fw,selectedIndex:p=null}=t,m=Px(),h=J.useRef(``),g=J.useRef(p??o??-1),_=J.useRef(null);wx(()=>{r&&(m.clear(),_.current=null,h.current=``)},[r,m]),wx(()=>{r&&h.current===``&&(g.current=p??o??-1)},[r,p,o]);let v=uS(e=>{e?i.current.typing||(i.current.typing=e,c?.(e)):i.current.typing&&(i.current.typing=e,c?.(e))}),y=uS(e=>{function t(e,t,n){let r=u?u(t,n):t.find(e=>e?.toLocaleLowerCase().indexOf(n.toLocaleLowerCase())===0);return r?e.indexOf(r):-1}let n=a.current;if(h.current.length>0&&h.current[0]!==` `&&(t(n,n,h.current)===-1?v(!1):e.key===` `&&WS(e)),n==null||f.includes(e.key)||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;r&&e.key!==` `&&(WS(e),v(!0)),n.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&h.current===e.key&&(h.current=``,g.current=_.current),h.current+=e.key,m.start(d,()=>{h.current=``,g.current=_.current,v(!1)});let i=g.current,o=t(n,[...n.slice((i||0)+1),...n.slice(0,(i||0)+1)],h.current);o===-1?e.key!==` `&&(h.current=``,v(!1)):(s?.(o),_.current=o)}),b=J.useMemo(()=>({onKeyDown:y}),[y]),x=J.useMemo(()=>({onKeyDown:y,onKeyUp(e){e.key===` `&&v(!1)}}),[y,v]);return J.useMemo(()=>l?{reference:b,floating:x}:{},[l,b,x])}function KO(e,t){let[n,r]=e,i=!1,a=t.length;for(let e=0,o=a-1;e<a;o=e++){let[a,s]=t[e]||[0,0],[c,l]=t[o]||[0,0];s>=r!=l>=r&&n<=(c-a)*(r-s)/(l-s)+a&&(i=!i)}return i}function qO(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function JO(e={}){let{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,i=new Nx,a=!1,o=null,s=null,c=typeof performance<`u`?performance.now():0;function l(e,t){let n=performance.now(),r=n-c;if(o===null||s===null||r===0)return o=e,s=t,c=n,null;let i=e-o,a=t-s,l=Math.sqrt(i*i+a*a)/r;return o=e,s=t,c=n,l}let u=({x:e,y:n,placement:o,elements:s,onClose:c,nodeId:u,tree:d})=>function(f){function p(){i.clear(),c()}if(i.clear(),!s.domReference||!s.floating||o==null||e==null||n==null)return;let{clientX:m,clientY:h}=f,g=[m,h],_=PS(f),v=f.type===`mouseleave`,y=NS(s.floating,_),b=NS(s.domReference,_),x=s.domReference.getBoundingClientRect(),S=s.floating.getBoundingClientRect(),C=o.split(`-`)[0],w=e>S.right-S.width/2,T=n>S.bottom-S.height/2,E=qO(g,x),D=S.width>x.width,O=S.height>x.height,k=(D?x:S).left,A=(D?x:S).right,j=(O?x:S).top,M=(O?x:S).bottom;if(y&&(a=!0,!v))return;if(b&&(a=!1),b&&!v){a=!0;return}if(v&&Bx(f.relatedTarget)&&NS(s.floating,f.relatedTarget)||d&&HS(d.nodesRef.current,u).some(({context:e})=>e?.open))return;if(C===`top`&&n>=x.bottom-1||C===`bottom`&&n<=x.top+1||C===`left`&&e>=x.right-1||C===`right`&&e<=x.left+1)return p();let N=[];switch(C){case`top`:N=[[k,x.top+1],[k,S.bottom-1],[A,S.bottom-1],[A,x.top+1]];break;case`bottom`:N=[[k,S.top+1],[k,x.bottom-1],[A,x.bottom-1],[A,S.top+1]];break;case`left`:N=[[S.right-1,M],[S.right-1,j],[x.left+1,j],[x.left+1,M]];break;case`right`:N=[[x.right-1,M],[x.right-1,j],[S.left+1,j],[S.left+1,M]];break;default:}function P([e,n]){switch(C){case`top`:return[[D?e+t/2:w?e+t*4:e-t*4,n+t+1],[D?e-t/2:w?e+t*4:e-t*4,n+t+1],...[[S.left,w||D?S.bottom-t:S.top],[S.right,w?D?S.bottom-t:S.top:S.bottom-t]]];case`bottom`:return[[D?e+t/2:w?e+t*4:e-t*4,n-t],[D?e-t/2:w?e+t*4:e-t*4,n-t],...[[S.left,w||D?S.top+t:S.bottom],[S.right,w?D?S.top+t:S.bottom:S.top+t]]];case`left`:{let r=[e+t+1,O?n+t/2:T?n+t*4:n-t*4],i=[e+t+1,O?n-t/2:T?n+t*4:n-t*4];return[...[[T||O?S.right-t:S.left,S.top],[T?O?S.right-t:S.left:S.right-t,S.bottom]],r,i]}case`right`:return[[e-t,O?n+t/2:T?n+t*4:n-t*4],[e-t,O?n-t/2:T?n+t*4:n-t*4],...[[T||O?S.left+t:S.right,S.top],[T?O?S.left+t:S.right:S.left+t,S.bottom]]];default:return[]}}if(!KO([m,h],N)){if(a&&!E)return p();if(!v&&r){let e=l(f.clientX,f.clientY);if(e!==null&&e<.1)return p()}KO([m,h],P([e,n]))?!a&&r&&i.start(40,p):p()}};return u.__options={blockPointerEvents:n},u}var YO={..._O,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),isInstantPhase:Q(e=>e.isInstantPhase),trackCursorAxis:Q(e=>e.trackCursorAxis),disableHoverablePopup:Q(e=>e.disableHoverablePopup),lastOpenChangeReason:Q(e=>e.openChangeReason),closeDelay:Q(e=>e.closeDelay)},XO=class e extends iO{constructor(e){super({...ZO(),...e},{popupRef:J.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new mO},YO)}setOpen=(e,t)=>{let n=t.reason,r=n===Ww,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0);let o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};r?ec.flushSync(o):o()};static useStore(t,n){let r=kx(()=>t??new e(n)).current,i=bO({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=i,r}};function ZO(){return{...gO(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeDelay:0}}function QO(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=XO.useStore(l?.store,{open:r??n,activeTriggerId:u===void 0?d:u});p.useControlledProp(`open`,r,n),p.useControlledProp(`activeTriggerId`,u,d),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=p.useState(`activeTriggerId`),g=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i});let _=!t&&m;wx(()=>{m&&t&&p.setOpen(!1,tT(Qw))},[m,t,p]),p.useSyncedValue(`disabled`,t),fO(p);let{forceUnmount:v,transitionStatus:y}=pO(_,p),b=p.useState(`isInstantPhase`),x=p.useState(`instantType`),S=p.useState(`lastOpenChangeReason`),C=J.useRef(null);wx(()=>{y===`ending`&&S===`none`||y!==`ending`&&b?(x!==`delay`&&(C.current=x),p.set(`instantType`,`delay`)):C.current!==null&&(p.set(`instantType`,C.current),C.current=null)},[y,b,S,x,p]),wx(()=>{_&&(h??p.set(`payload`,void 0))},[p,h,_]);let w=J.useCallback(()=>{p.setOpen(!1,$O(p,$w))},[p]);J.useImperativeHandle(o,()=>({unmount:v,close:w}),[v,w]);let T=p.useState(`floatingRootContext`),{getReferenceProps:E,getFloatingProps:D,getTriggerProps:O}=NO([SO(T,{enabled:!t}),jD(T,{enabled:!t,referencePress:!0}),yE(T,{enabled:!t&&a!==`none`,axis:a===`none`?void 0:a})]),k=J.useMemo(()=>E(),[E]),A=J.useMemo(()=>O(),[O]),j=J.useMemo(()=>D(),[D]);return p.useSyncedValues({floatingRootContext:T,activeTriggerProps:k,inactiveTriggerProps:A,popupProps:j}),(0,Y.jsx)(Ex.Provider,{value:p,children:typeof f==`function`?f({payload:g}):f})}function $O(e,t){let n=tT(t);return n.preventUnmountOnClose=()=>{e.set(`preventUnmountingOnClose`,!0)},n}var ek=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),tk={[ek.startingStyle]:``},nk={[ek.endingStyle]:``},rk={transitionStatus(e){return e===`starting`?tk:e===`ending`?nk:null}},ik=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=ek.startingStyle]=`startingStyle`,e[e.endingStyle=ek.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e}({}),ak=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),ok={[ak.popupOpen]:``},sk={[ak.popupOpen]:``,[ak.pressed]:``},ck={[ik.open]:``},lk={[ik.closed]:``},uk={[ik.anchorHidden]:``},dk={open(e){return e?ok:null}},fk={open(e){return e?sk:null}},pk={open(e){return e?ck:lk},anchorHidden(e){return e?uk:null}};function mk(e){return ww(e,`base-ui`)}var hk=J.createContext(void 0);function gk(){return J.useContext(hk)}var _k=J.forwardRef(function(e,t){let{className:n,render:r,handle:i,payload:a,disabled:o,delay:s,closeDelay:c,id:l,...u}=e,d=Dx(!0),f=i?.store??d;if(!f)throw Error(Tx(82));let p=mk(l),m=f.useState(`isTriggerActive`,p),h=f.useState(`floatingRootContext`),g=f.useState(`isOpenedByTrigger`,p),_=J.useRef(null),v=s??600,y=c??0,{registerTrigger:b,isMountedByThisTrigger:x}=dO(p,_,f,{payload:a,closeDelay:y}),S=gk(),{delayRef:C,isInstantPhase:w,hasProvider:T}=oT(h,{open:g});f.useSyncedValue(`isInstantPhase`,w);let E=f.useState(`disabled`),D=o??E,O=f.useState(`trackCursorAxis`),k=f.useState(`disableHoverablePopup`),A=MO(h,{enabled:!D,mouseOnly:!0,move:!1,handleClose:!k&&O!==`both`?JO():null,restMs(){let e=S?.delay,t=typeof C.current==`object`?C.current.open:void 0,n=v;return T&&(n=t===0?0:s??e??v),n},delay(){let e=typeof C.current==`object`?C.current.close:void 0,t=y;return c==null&&T&&(t=e),{close:t}},triggerElementRef:_,isActiveTrigger:m}),j=J.useMemo(()=>({open:g}),[g]),M=f.useState(`triggerProps`,x);return XT(`button`,e,{state:j,ref:[t,b,_],props:[A,M,{id:p},u],stateAttributesMapping:dk})}),vk=J.createContext(void 0);function yk(){let e=J.useContext(vk);if(e===void 0)throw Error(Tx(70));return e}var bk=J.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,...o}=e,{portalNode:s,portalSubtree:c}=rE({container:r,ref:t,componentProps:e,elementProps:o});return!c&&!s?null:(0,Y.jsxs)(J.Fragment,{children:[c,s&&ec.createPortal(n,s)]})}),xk=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Dx().useState(`mounted`)||n?(0,Y.jsx)(vk.Provider,{value:n,children:(0,Y.jsx)(bk,{ref:t,...r})}):null}),Sk=J.createContext(void 0);function Ck(){let e=J.useContext(Sk);if(e===void 0)throw Error(Tx(71));return e}var wk=J.createContext(void 0);function Tk(){return J.useContext(wk)?.direction??`ltr`}var Ek=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=iC(e,t)||{};if(l==null)return{};let f=SC(u),p={x:n,y:r},m=uC(i),h=cC(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=rC(k,j,A),N=!c.arrow&&oC(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),Dk=(e,t)=>({...Ek(e),options:[e,t]}),Ok={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await OD().fn(e)).data?.referenceHidden||a}}}},kk={sideX:`left`,sideY:`top`},Ak={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=Lx(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:kk};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=vT(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=aC(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:kk.sideX,g=f===`top`?`bottom`:kk.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function jk(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function Mk(e,t,n){let{rects:r,placement:i}=e;return{side:jk(t,aC(i),n),align:oC(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Nk(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:p,mounted:m,collisionAvoidance:h,shiftCrossAxis:g=!1,nodeId:_,adaptiveOrigin:v,lazyFlip:y=!1,externalTree:b}=e,[x,S]=J.useState(null);!m&&x!==null&&S(null);let C=h.side||`flip`,w=h.align||`flip`,T=h.fallbackAxisSide||`end`,E=typeof t==`function`?t:void 0,D=uS(E),O=E?D:t,k=oS(t),A=Tk()===`rtl`,j=x||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":A?`left`:`right`,"inline-start":A?`right`:`left`}[r],M=a===`center`?j:`${j}-${a}`,N=c,P=r===`bottom`?1:0,F=r===`top`?1:0,I=r===`right`?1:0,L=r===`left`?1:0;typeof N==`number`?N={top:N+P,right:N+L,bottom:N+F,left:N+I}:N&&={top:(N.top||0)+P,right:(N.right||0)+L,bottom:(N.bottom||0)+F,left:(N.left||0)+I};let R={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:N},z=J.useRef(null),B=oS(i),V=oS(o),H=[CD(e=>{let t=Mk(e,r,A),n=typeof B.current==`function`?B.current(t):B.current,i=typeof V.current==`function`?V.current(t):V.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,A,r])],U=w===`none`&&C!==`shift`,W=!U&&(l||g||C===`shift`),ee=C===`none`?null:ED({...R,padding:{top:N.top+1,right:N.right+1,bottom:N.bottom+1,left:N.left+1},mainAxis:!g&&C===`flip`,crossAxis:w===`flip`?`alignment`:!1,fallbackAxisSideDirection:T}),te=U?null:wD(e=>{let t=vT(e.elements.floating).documentElement;return{...R,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:w!==`none`,crossAxis:W,limiter:l||g?void 0:TD(e=>{if(!z.current)return{};let{width:t,height:n}=z.current.getBoundingClientRect(),r=lC(aC(e.placement)),i=r===`y`?t:n,a=r===`y`?N.left+N.right:N.top+N.bottom;return{offset:i/2+a/2}})}},[R,l,g,N,w]);C===`shift`||w===`shift`||a===`center`?H.push(te,ee):H.push(ee,te),H.push(DD({...R,apply({elements:{floating:e},rects:{reference:t},availableWidth:n,availableHeight:r}){Object.entries({"--available-width":`${n}px`,"--available-height":`${r}px`,"--anchor-width":`${t.width}px`,"--anchor-height":`${t.height}px`}).forEach(([t,n])=>{e.style.setProperty(t,n)})}}),Dk(()=>({element:z.current||document.createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=aC(a),l=lC(c),u=z.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(Mk(e,r,A)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,W&&l===`y`&&b?S:x),{}}},Ok,v),wx(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[m,p]);let ne=J.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:re,elements:ie,x:ae,y:oe,middlewareData:G,update:se,placement:K,context:ce,isPositioned:le,floatingStyles:ue}=yO({rootContext:p,placement:M,middleware:H,strategy:n,whileElementsMounted:f?void 0:(...e)=>lD(...e,ne),nodeId:_,externalTree:b}),{sideX:de,sideY:fe}=G.adaptiveOrigin||kk,pe=le?n:`fixed`,q=J.useMemo(()=>v?{position:pe,[de]:ae,[fe]:oe}:{position:pe,...ue},[v,pe,de,ae,fe,oe,ue]),me=J.useRef(null);wx(()=>{if(!m)return;let e=k.current,t=typeof e==`function`?e():e,n=(Pk(t)?t.current:t)||null;n!==me.current&&(re.setPositionReference(n),me.current=n)},[m,re,O,k]),J.useEffect(()=>{if(!m)return;let e=k.current;typeof e!=`function`&&Pk(e)&&e.current!==me.current&&(re.setPositionReference(e.current),me.current=e.current)},[m,re,O,k]),J.useEffect(()=>{if(f&&m&&ie.domReference&&ie.floating)return lD(ie.domReference,ie.floating,se,ne)},[f,m,ie,se,ne]);let he=aC(K),ge=jk(r,he,A),_e=oC(K)||`center`,ve=!!G.hide?.referenceHidden;wx(()=>{y&&m&&le&&S(he)},[y,m,le,he]);let ye=J.useMemo(()=>({position:`absolute`,top:G.arrow?.y,left:G.arrow?.x}),[G.arrow]),be=G.arrow?.centerOffset!==0;return J.useMemo(()=>({positionerStyles:q,arrowStyles:ye,arrowRef:z,arrowUncentered:be,side:ge,align:_e,physicalSide:he,anchorHidden:ve,refs:re,context:ce,isPositioned:le,update:se}),[q,ye,z,be,ge,_e,he,ve,re,ce,le,se])}function Pk(e){return e!=null&&`current`in e}function Fk(e){return e===`starting`?Lw:Iw}var Ik=J.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Bw,...g}=e,_=Dx(),v=yk(),y=_.useState(`open`),b=_.useState(`mounted`),x=_.useState(`trackCursorAxis`),S=_.useState(`disableHoverablePopup`),C=_.useState(`floatingRootContext`),w=_.useState(`instantType`),T=_.useState(`transitionStatus`),E=Nk({anchor:i,positionMethod:a,floatingRootContext:C,mounted:b,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:v,collisionAvoidance:h,adaptiveOrigin:Ak}),D=J.useMemo(()=>{let e={};return(!y||x===`both`||S)&&(e.pointerEvents=`none`),{role:`presentation`,hidden:!b,style:{...E.positionerStyles,...e}}},[y,x,S,b,E.positionerStyles]),O=J.useMemo(()=>({open:y,side:E.side,align:E.align,anchorHidden:E.anchorHidden,instant:x===`none`?w:`tracking-cursor`}),[y,E.side,E.align,E.anchorHidden,x,w]),k=J.useMemo(()=>({...O,arrowRef:E.arrowRef,arrowStyles:E.arrowStyles,arrowUncentered:E.arrowUncentered}),[O,E.arrowRef,E.arrowStyles,E.arrowUncentered]),A=XT(`div`,e,{state:O,props:[D,Fk(T),g],ref:[t,_.useStateSetter(`positionerElement`)],stateAttributesMapping:pk});return(0,Y.jsx)(Sk.Provider,{value:k,children:A})});function Lk(e){let t=eS(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Vx(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return($S(n)!==a||$S(r)!==o)&&(n=a,r=o),{width:n,height:r}}var Rk=typeof ResizeObserver<`u`,zk=()=>!0;function Bk(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,enabled:a=zk,onMeasureLayout:o,onMeasureLayoutComplete:s,side:c,direction:l}=e,u=J.useRef(!0),d=cO(t,!0,!1),f=_T(),p=J.useRef(null),m=uS(o),h=uS(s),g=J.useMemo(()=>{let e=c===`top`,t=c===`left`;return l===`rtl`?(e||=c===`inline-end`,t||=c===`inline-end`):(e||=c===`inline-start`,t||=c===`inline-start`),e?{position:`absolute`,[c===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:Iw},[c,l]);wx(()=>{if(!i||!a()||!Rk){u.current=!0,p.current=null;return}if(!t||!n)return;Object.entries(g).forEach(([e,n])=>{t.style.setProperty(e,n)});let e=new ResizeObserver(e=>{let t=e[0];t&&(p.current===null?p.current={width:Math.ceil(t.borderBoxSize[0].inlineSize),height:Math.ceil(t.borderBoxSize[0].blockSize)}:(p.current.width=Math.ceil(t.borderBoxSize[0].inlineSize),p.current.height=Math.ceil(t.borderBoxSize[0].blockSize)))});e.observe(t),t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`);let r=Vk(t,`position`,`static`),o=Vk(t,`transform`,`none`),s=Vk(t,`scale`,`1`),c=Vk(n,`--available-width`,`max-content`),l=Vk(n,`--available-height`,`max-content`);if(m?.(),u.current||p.current===null){n.style.setProperty(`--positioner-width`,`max-content`),n.style.setProperty(`--positioner-height`,`max-content`);let i=Lk(t);return n.style.setProperty(`--positioner-width`,`${i.width}px`),n.style.setProperty(`--positioner-height`,`${i.height}px`),r(),o(),s(),c(),l(),h?.(null,i),u.current=!1,()=>{e.disconnect()}}t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`),n.style.setProperty(`--positioner-width`,`max-content`),n.style.setProperty(`--positioner-height`,`max-content`);let _=Lk(t);t.style.setProperty(`--popup-width`,`${p.current.width}px`),t.style.setProperty(`--popup-height`,`${p.current.height}px`),r(),o(),c(),l(),h?.(p.current,_),n.style.setProperty(`--positioner-width`,`${_.width}px`),n.style.setProperty(`--positioner-height`,`${_.height}px`);let v=new AbortController;return f.request(()=>{t.style.setProperty(`--popup-width`,`${_.width}px`),t.style.setProperty(`--popup-height`,`${_.height}px`),d(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},v.signal)}),()=>{e.disconnect(),v.abort(),f.cancel()}},[r,t,n,d,f,a,i,m,h,g])}function Vk(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}var Hk={...pk,...rk},Uk=J.forwardRef(function(e,t){let{className:n,render:r,...i}=e,a=Dx(),{side:o,align:s}=Ck(),c=a.useState(`open`),l=a.useState(`mounted`),u=a.useState(`instantType`),d=a.useState(`transitionStatus`),f=a.useState(`popupProps`),p=a.useState(`payload`),m=a.useState(`popupElement`),h=a.useState(`positionerElement`),g=a.useState(`floatingRootContext`),_=Tk();lO({open:c,ref:a.context.popupRef,onComplete(){c&&a.context.onOpenChangeComplete?.(!0)}});function v(){g.context.events.emit(`measure-layout`)}function y(e,t){g.context.events.emit(`measure-layout-complete`,{previousDimensions:e,nextDimensions:t})}Bk({popupElement:m,positionerElement:h,mounted:l,content:p,enabled:()=>a.context.triggerElements.size>1,onMeasureLayout:v,onMeasureLayoutComplete:y,side:o,direction:_});let b=a.useState(`disabled`),x=a.useState(`closeDelay`);return OO(g,{enabled:!b,closeDelay:x}),XT(`div`,e,{state:J.useMemo(()=>({open:c,side:o,align:s,instant:u,transitionStatus:d}),[c,o,s,u,d]),ref:[t,a.context.popupRef,a.useStateSetter(`popupElement`)],props:[f,Fk(d),i],stateAttributesMapping:Hk})}),Wk=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=J.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=J.useMemo(()=>({open:t,close:n}),[t,n]);return(0,Y.jsx)(hk.Provider,{value:i,children:(0,Y.jsx)(aT,{delay:a,timeoutMs:r,children:e.children})})};function Gk(e){return MT(19)?e:e?`true`:void 0}var Kk=Wk;function qk({children:e,content:t,side:n=`bottom`}){return(0,Y.jsxs)(QO,{children:[(0,Y.jsx)(_k,{render:e}),(0,Y.jsx)(xk,{children:(0,Y.jsx)(Ik,{className:`ui-tooltip-positioner`,side:n,sideOffset:6,children:(0,Y.jsx)(Uk,{className:`ui-tooltip`,children:t})})})]})}var Jk=null,Yk=null;function Xk(){return Jk||=Z(()=>import(`./edit-CFxbgVPV.js`).then(e=>(Yk=e.Editor,e)),[]).catch(e=>{throw Jk=null,Yk=null,e}),Jk}async function Zk(){await Xk()}function Qk(){return Yk}function $k(e,t){let n=t;for(;n>0&&!/[ \t]/.test(e[n-1]);)n--;return n}var eA=`warning`,tA=`error`,nA=`info`,rA=`hint`;function iA(e,t){let n=[],r=e.split(`
1543
1543
  `),i=e.endsWith(`
1544
1544
  `);for(let e=0;e<r.length;e++){let t=r[e];if(t.endsWith(`\r`)){let r=t.slice(0,-1);n.push({severity:nA,message:`CRLF line ending (the saved file will keep what the editor writes)`,source:`diffing`,start:{line:e,character:$k(r,r.length)},end:{line:e,character:Math.max(1,r.length)}})}let i=t.match(/[ \t]+$/);i&&n.push({severity:eA,message:`Trailing whitespace`,source:`diffing`,start:{line:e,character:$k(t,i.index??0)},end:{line:e,character:t.length}}),/^\t/.test(t)&&n.push({severity:rA,message:`Tab character used for indentation`,source:`diffing`,start:{line:e,character:0},end:{line:e,character:Math.min(1,t.length)}})}if(!i&&r.length>0&&e.length>0){let e=r.length-1,t=r[e]?.length??0;n.push({severity:tA,message:`File does not end with a newline`,source:`diffing`,start:{line:e,character:$k(r[e]??``,t)},end:{line:e,character:Math.max(1,t)}})}return n}var aA=e=>e.replace(/\r\n/g,`
1545
1545
  `);function oA(e){return!e||e.length===0?!0:`side`in e[0]}function sA({diagnosticsEnabled:e}){let[t,n]=(0,J.useState)(new Map),r=(0,J.useRef)(new Map),i=(0,J.useRef)(new Map),a=(0,J.useRef)(new Map),o=(0,J.useRef)(e);o.current=e,(0,J.useEffect)(()=>{r.current=t},[t]);let s=[...t.values()].filter(e=>e.dirty).length,c=(0,J.useCallback)(e=>{let t=i.current.get(e),n=r.current.get(e);if(!(!t||!n)){if(!o.current){t.setMarkers([]);return}t.setMarkers(iA(n.draft,e))}},[]),l=(0,J.useCallback)(e=>{let t=a.current.get(e);t&&clearTimeout(t),a.current.set(e,setTimeout(()=>{a.current.delete(e),c(e)},300))},[c]),u=(0,J.useCallback)(async e=>{if(r.current.has(e))return;await Zk();let t=await fetch(`/api/file-text?path=${encodeURIComponent(e)}&version=new`);if(!t.ok){let n=await t.json().catch(()=>null);throw Error(n?.error??`HTTP ${t.status} loading ${e}`)}let i=await t.json();if(i.missing)throw Error(`File not found on disk`);if(i.error)throw Error(i.error);let a=i.content??``,o={seedContent:a,draft:a,dirty:!1,saving:!1,error:null,annotations:null,annotationsVersion:0,sessionKey:0,baseHash:i.hash??``};n(t=>new Map(t).set(e,o))},[]),d=(0,J.useCallback)((e,t,i)=>{let a=r.current.get(e);if(!a)return;let o=t.contents,s=aA(o)!==aA(a.seedContent),c=oA(i)?i:void 0;c&&c!==a.annotations?(0,ec.flushSync)(()=>{n(t=>{let n=t.get(e);return n?new Map(t).set(e,{...n,draft:o,dirty:s,annotations:c,annotationsVersion:n.annotationsVersion+1}):t})}):n(t=>{let n=t.get(e);return n?new Map(t).set(e,{...n,draft:o,dirty:s}):t}),l(e)},[l]),f=(0,J.useCallback)((e,t)=>{i.current.set(e,t);try{t.focus({lineNumber:`first-visible`,preventScroll:!0})}catch{}setTimeout(()=>c(e),0)},[c]);(0,J.useEffect)(()=>{for(let e of i.current.keys())c(e)},[e,c]);let p=(0,J.useCallback)(async e=>{let t=r.current.get(e);if(!(!t||t.saving)){n(t=>{let n=t.get(e);return n?new Map(t).set(e,{...n,saving:!0,error:null}):t});try{let r=(t.annotations??[]).filter(e=>e.lineNumber>0&&!(`_pending`in e.metadata)&&!(`_existingPr`in e.metadata)).map(e=>({id:e.metadata.id,side:e.side,lineNumber:e.lineNumber,startLineNumber:void 0})),i=await fetch(`/api/edit-save`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:e,content:t.draft,baseHash:t.baseHash,anchorUpdates:r})}),a=await i.json().catch(()=>({}));if(!i.ok){let t=a.conflict===!0?`The file changed on disk since this edit session started. Reload or discard.`:a.error??`HTTP ${i.status}`;n(n=>{let r=n.get(e);return r?new Map(n).set(e,{...r,saving:!1,error:t}):n});return}n(t=>{let n=t.get(e);return n?new Map(t).set(e,{...n,seedContent:n.draft,baseHash:a.hash??n.baseHash,saving:!1,dirty:!1,error:null}):t})}catch(t){n(n=>{let r=n.get(e);return r?new Map(n).set(e,{...r,saving:!1,error:t.message}):n})}}},[]);return{sessions:t,dirtyCount:s,enterEdit:u,handleEditChange:d,handleEditAttach:f,saveEdit:p,saveAllDirty:(0,J.useCallback)(async()=>{let e=[...r.current.entries()].filter(([,e])=>e.dirty).map(([e])=>e);await Promise.all(e.map(e=>p(e)))},[p]),discardEdit:(0,J.useCallback)(e=>{n(t=>{let n=t.get(e);return n?new Map(t).set(e,{...n,seedContent:n.seedContent,draft:n.seedContent,dirty:!1,saving:!1,error:null,annotations:null,annotationsVersion:n.annotationsVersion+1,sessionKey:n.sessionKey+1}):t}),i.current.delete(e)},[]),exitEdit:(0,J.useCallback)(e=>{if(!r.current.get(e))return;i.current.delete(e);let t=a.current.get(e);t&&clearTimeout(t),a.current.delete(e),n(t=>{let n=new Map(t);return n.delete(e),n})},[]),createEditor:(0,J.useCallback)(e=>{let t=Qk();if(!t)throw Error(`Edit module not loaded yet`);return new t(e)},[])}}var cA={success:{pattern:[{duration:30,intensity:.5},{delay:60,duration:40,intensity:1}]},warning:{pattern:[{duration:40,intensity:.8},{delay:100,duration:40,intensity:.6}]},error:{pattern:[{duration:40,intensity:.9},{delay:40,duration:40,intensity:.9},{delay:40,duration:40,intensity:.9}]},light:{pattern:[{duration:15,intensity:.4}]},medium:{pattern:[{duration:25,intensity:.7}]},heavy:{pattern:[{duration:35,intensity:1}]},soft:{pattern:[{duration:40,intensity:.5}]},rigid:{pattern:[{duration:10,intensity:1}]},selection:{pattern:[{duration:8,intensity:.3}]},nudge:{pattern:[{duration:80,intensity:.8},{delay:80,duration:50,intensity:.3}]},buzz:{pattern:[{duration:1e3,intensity:1}]}},lA=16,uA=184,dA=1e3,fA=20;function pA(e){if(typeof e==`number`)return{vibrations:[{duration:e}]};if(typeof e==`string`){let t=cA[e];return t?{vibrations:t.pattern.map(e=>({...e}))}:(console.warn(`[web-haptics] Unknown preset: "${e}"`),null)}if(Array.isArray(e)){if(e.length===0)return{vibrations:[]};if(typeof e[0]==`number`){let t=e,n=[];for(let e=0;e<t.length;e+=2){let r=e>0?t[e-1]:0;n.push({...r>0&&{delay:r},duration:t[e]})}return{vibrations:n}}return{vibrations:e.map(e=>({...e}))}}return{vibrations:e.pattern.map(e=>({...e}))}}function mA(e,t){if(t>=1)return[e];if(t<=0)return[];let n=Math.max(1,Math.round(fA*t)),r=fA-n,i=[],a=e;for(;a>=fA;)i.push(n),i.push(r),a-=fA;if(a>0){let e=Math.max(1,Math.round(a*t));i.push(e);let n=a-e;n>0&&i.push(n)}return i}function hA(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=Math.max(0,Math.min(1,i.intensity??t)),o=i.delay??0;o>0&&(n.length>0&&n.length%2==0?n[n.length-1]+=o:(n.length===0&&n.push(0),n.push(o)));let s=mA(i.duration,a);if(s.length===0){n.length>0&&n.length%2==0?n[n.length-1]+=i.duration:i.duration>0&&(n.push(0),n.push(i.duration));continue}for(let e of s)n.push(e)}return n}var gA=0,_A=class e{hapticLabel=null;domInitialized=!1;instanceId;debug;showSwitch;rafId=null;patternResolve=null;audioCtx=null;audioFilter=null;audioGain=null;audioBuffer=null;constructor(e){this.instanceId=++gA,this.debug=e?.debug??!1,this.showSwitch=e?.showSwitch??!1}static isSupported=typeof navigator<`u`&&typeof navigator.vibrate==`function`;async trigger(t=[{duration:25,intensity:.7}],n){let r=pA(t);if(!r)return;let{vibrations:i}=r;if(i.length===0)return;let a=Math.max(0,Math.min(1,n?.intensity??.5));for(let e of i)if(e.duration>dA&&(e.duration=dA),!Number.isFinite(e.duration)||e.duration<0||e.delay!==void 0&&(!Number.isFinite(e.delay)||e.delay<0)){console.warn(`[web-haptics] Invalid vibration values. Durations and delays must be finite non-negative numbers.`);return}if(e.isSupported&&navigator.vibrate(hA(i,a)),!e.isSupported||this.debug){if(this.ensureDOM(),!this.hapticLabel)return;this.debug&&await this.ensureAudio(),this.stopPattern();let e=(i[0]?.delay??0)===0;if(e&&(this.hapticLabel.click(),this.debug&&this.audioCtx)){let e=Math.max(0,Math.min(1,i[0].intensity??a));this.playClick(e)}await this.runPattern(i,a,e)}}cancel(){this.stopPattern(),e.isSupported&&navigator.vibrate(0)}destroy(){this.stopPattern(),this.hapticLabel&&(this.hapticLabel.remove(),this.hapticLabel=null,this.domInitialized=!1),this.audioCtx&&(this.audioCtx.close(),this.audioCtx=null,this.audioFilter=null,this.audioGain=null,this.audioBuffer=null)}setDebug(e){this.debug=e,!e&&this.audioCtx&&(this.audioCtx.close(),this.audioCtx=null,this.audioFilter=null,this.audioGain=null,this.audioBuffer=null)}setShowSwitch(e){if(this.showSwitch=e,this.hapticLabel){let t=this.hapticLabel.querySelector(`input`);this.hapticLabel.style.display=e?``:`none`,t&&(t.style.display=e?``:`none`)}}stopPattern(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.patternResolve?.(),this.patternResolve=null}runPattern(e,t,n){return new Promise(r=>{this.patternResolve=r;let i=[],a=0;for(let n of e){let e=Math.max(0,Math.min(1,n.intensity??t)),r=n.delay??0;r>0&&(a+=r,i.push({end:a,isOn:!1,intensity:0})),a+=n.duration,i.push({end:a,isOn:!0,intensity:e})}let o=a,s=0,c=-1,l=e=>{s===0&&(s=e);let t=e-s;if(t>=o){this.rafId=null,this.patternResolve=null,r();return}let a=i[0];for(let e of i)if(t<e.end){a=e;break}if(a.isOn){let t=lA+(1-a.intensity)*uA;c===-1?(c=e,n||=(this.hapticLabel?.click(),this.debug&&this.audioCtx&&this.playClick(a.intensity),!0)):e-c>=t&&(this.hapticLabel?.click(),this.debug&&this.audioCtx&&this.playClick(a.intensity),c=e)}this.rafId=requestAnimationFrame(l)};this.rafId=requestAnimationFrame(l)})}playClick(e){if(!this.audioCtx||!this.audioFilter||!this.audioGain||!this.audioBuffer)return;let t=this.audioBuffer.getChannelData(0);for(let e=0;e<t.length;e++)t[e]=(Math.random()*2-1)*Math.exp(-e/25);this.audioGain.gain.value=.5*e;let n=2e3+e*2e3,r=1+(Math.random()-.5)*.3;this.audioFilter.frequency.value=n*r;let i=this.audioCtx.createBufferSource();i.buffer=this.audioBuffer,i.connect(this.audioFilter),i.onended=()=>i.disconnect(),i.start()}async ensureAudio(){if(!this.audioCtx&&typeof AudioContext<`u`){this.audioCtx=new AudioContext,this.audioFilter=this.audioCtx.createBiquadFilter(),this.audioFilter.type=`bandpass`,this.audioFilter.frequency.value=4e3,this.audioFilter.Q.value=8,this.audioGain=this.audioCtx.createGain(),this.audioFilter.connect(this.audioGain),this.audioGain.connect(this.audioCtx.destination),this.audioBuffer=this.audioCtx.createBuffer(1,this.audioCtx.sampleRate*.004,this.audioCtx.sampleRate);let e=this.audioBuffer.getChannelData(0);for(let t=0;t<e.length;t++)e[t]=(Math.random()*2-1)*Math.exp(-t/25)}this.audioCtx?.state===`suspended`&&await this.audioCtx.resume()}ensureDOM(){if(this.domInitialized||typeof document>`u`)return;let e=`web-haptics-${this.instanceId}`,t=document.createElement(`label`);t.setAttribute(`for`,e),t.textContent=`Haptic feedback`,t.style.position=`fixed`,t.style.bottom=`10px`,t.style.left=`10px`,t.style.padding=`5px 10px`,t.style.backgroundColor=`rgba(0, 0, 0, 0.7)`,t.style.color=`white`,t.style.fontFamily=`sans-serif`,t.style.fontSize=`14px`,t.style.borderRadius=`4px`,t.style.zIndex=`9999`,t.style.userSelect=`none`,this.hapticLabel=t;let n=document.createElement(`input`);n.type=`checkbox`,n.setAttribute(`switch`,``),n.id=e,n.style.all=`initial`,n.style.appearance=`auto`,this.showSwitch||(t.style.display=`none`,n.style.display=`none`),t.appendChild(n),document.body.appendChild(t),this.domInitialized=!0}};function vA(e){let t=(0,J.useRef)(null);return(0,J.useEffect)(()=>(t.current=new _A(e),()=>{t.current?.destroy(),t.current=null}),[]),(0,J.useEffect)(()=>{t.current?.setDebug(e?.debug??!1)},[e?.debug]),(0,J.useEffect)(()=>{t.current?.setShowSwitch(e?.showSwitch??!1)},[e?.showSwitch]),{trigger:(0,J.useCallback)((e,n)=>t.current?.trigger(e,n),[]),cancel:(0,J.useCallback)(()=>t.current?.cancel(),[]),isSupported:_A.isSupported}}var yA=(0,J.createContext)({hapticsEnabled:!1,soundsEnabled:!1,haptic:()=>{},sound:()=>{}}),bA=null;function xA(){if(typeof window>`u`)return null;if(bA)return bA;try{bA=new(window.AudioContext||window.webkitAudioContext)}catch{bA=null}return bA}function SA(e,t){let n=e.currentTime,r=e.destination,i=(t,i,a,o,s,c)=>{let l=e.createOscillator(),u=e.createGain();l.connect(u),u.connect(r),l.type=i,l.frequency.setValueAtTime(t,n+o),c!==void 0&&l.frequency.exponentialRampToValueAtTime(c,n+o+s),u.gain.setValueAtTime(a,n+o),u.gain.exponentialRampToValueAtTime(.001,n+o+s),l.start(n+o),l.stop(n+o+s)};switch(t){case`click`:i(700,`sine`,.16,0,.03,350);break;case`toggle`:i(460,`square`,.06,0,.04,230);break;case`navigate`:i(520,`sine`,.07,0,.02);break;case`open`:i(210,`sine`,.12,0,.13,560);break;case`close`:i(560,`sine`,.1,0,.11,210);break;case`success`:i(523,`sine`,.17,0,.1),i(784,`sine`,.17,.09,.13);break;case`resolve`:i(659,`sine`,.15,0,.1),i(988,`sine`,.15,.09,.13);break;case`send`:i(523,`sine`,.15,0,.1),i(659,`sine`,.15,.07,.1),i(784,`sine`,.15,.14,.14);break;case`error`:i(280,`sawtooth`,.16,0,.15,80);break;case`warning`:i(330,`sine`,.13,0,.09),i(330,`sine`,.09,.12,.09);break;case`remove`:i(380,`sine`,.13,0,.08,140);break}}var CA={current:!1},wA={current:!1},TA=null;function EA(e=`click`){if(!CA.current)return;let t=xA();t&&(t.state===`suspended`?t.resume():Promise.resolve()).then(()=>{try{SA(t,e)}catch{}}).catch(()=>{})}function DA(e=`selection`){if(!(!wA.current||!TA))try{TA(e)}catch{}}function OA(e=`selection`,t=`click`){DA(e),EA(t)}function kA({enabled:e,soundsEnabled:t,children:n}){let{trigger:r,isSupported:i}=vA({showSwitch:!1}),a=(0,J.useRef)(e);a.current=e;let o=(0,J.useRef)(t);o.current=t;let s=(0,J.useRef)(r);s.current=r,(0,J.useEffect)(()=>{wA.current=e&&i,TA=r}),(0,J.useEffect)(()=>{CA.current=t});let c=(0,J.useMemo)(()=>(e=`selection`)=>{if(a.current)try{s.current(e)}catch{}},[]),l=(0,J.useMemo)(()=>(e=`click`)=>{if(!o.current)return;let t=xA();t&&(t.state===`suspended`?t.resume():Promise.resolve()).then(()=>{try{SA(t,e)}catch{}}).catch(()=>{})},[]);(0,J.useEffect)(()=>{if(!e&&!t)return;let n=e=>{let t=e.target?.closest(`button, a[href], [role="button"], input[type="checkbox"], [role="option"]`);if(!t||t.disabled)return;let n=t.tagName===`INPUT`&&t.type===`checkbox`;if(a.current)try{s.current(`selection`)}catch{}if(o.current){let e=xA();e&&(e.state===`suspended`?e.resume():Promise.resolve()).then(()=>{try{SA(e,n?`toggle`:`click`)}catch{}}).catch(()=>{})}};return document.addEventListener(`click`,n,!0),()=>document.removeEventListener(`click`,n,!0)},[e,t]);let u=(0,J.useMemo)(()=>({hapticsEnabled:e&&i,soundsEnabled:t,haptic:c,sound:l}),[e,i,t,c,l]);return(0,Y.jsx)(yA.Provider,{value:u,children:n})}function AA(){let{haptic:e,sound:t}=(0,J.useContext)(yA);return{haptic:e,sound:t}}function jA(e){let t=Math.floor((Date.now()-e)/1e3);if(t<5)return`just now`;if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function MA(e){let t=e.split(`/`);return t[t.length-1]}var NA={nord:{themeName:`nord`,type:`dark`},"github-dark":{themeName:`github-dark`,type:`dark`},"github-dark-dimmed":{themeName:`github-dark-dimmed`,type:`dark`},"github-dark-high-contrast":{themeName:`github-dark-high-contrast`,type:`dark`},"github-light":{themeName:`github-light`,type:`light`},"github-light-high-contrast":{themeName:`github-light-high-contrast`,type:`light`},dracula:{themeName:`dracula`,type:`dark`},"one-dark":{themeName:`one-dark-pro`,type:`dark`},"synthwave-84":{themeName:`synthwave-84`,type:`dark`},"tokyo-night":{themeName:`tokyo-night`,type:`dark`},"catppuccin-mocha":{themeName:`catppuccin-mocha`,type:`dark`},"catppuccin-frappe":{themeName:`catppuccin-frappe`,type:`dark`},"catppuccin-macchiato":{themeName:`catppuccin-macchiato`,type:`dark`},"catppuccin-latte":{themeName:`catppuccin-latte`,type:`light`},"solarized-dark":{themeName:`solarized-dark`,type:`dark`},"solarized-light":{themeName:`solarized-light`,type:`light`},monokai:{themeName:`monokai`,type:`dark`},"ayu-dark":{themeName:`ayu-dark`,type:`dark`},"ayu-light":{themeName:`ayu-light`,type:`light`},andromeeda:{themeName:`andromeeda`,type:`dark`},"aurora-x":{themeName:`aurora-x`,type:`dark`},"dark-plus":{themeName:`dark-plus`,type:`dark`},"light-plus":{themeName:`light-plus`,type:`light`},houston:{themeName:`houston`,type:`dark`},laserwave:{themeName:`laserwave`,type:`dark`},"material-theme":{themeName:`material-theme`,type:`dark`},"material-theme-darker":{themeName:`material-theme-darker`,type:`dark`},"material-theme-lighter":{themeName:`material-theme-lighter`,type:`light`},"material-theme-ocean":{themeName:`material-theme-ocean`,type:`dark`},"material-theme-palenight":{themeName:`material-theme-palenight`,type:`dark`},"min-dark":{themeName:`min-dark`,type:`dark`},"min-light":{themeName:`min-light`,type:`light`},"night-owl":{themeName:`night-owl`,type:`dark`},"one-light":{themeName:`one-light`,type:`light`},plastic:{themeName:`plastic`,type:`dark`},poimandres:{themeName:`poimandres`,type:`dark`},"rose-pine":{themeName:`rose-pine`,type:`dark`},"rose-pine-moon":{themeName:`rose-pine-moon`,type:`dark`},"rose-pine-dawn":{themeName:`rose-pine-dawn`,type:`light`},"slack-dark":{themeName:`slack-dark`,type:`dark`},"slack-ochre":{themeName:`slack-ochre`,type:`dark`},vesper:{themeName:`vesper`,type:`dark`},"vitesse-black":{themeName:`vitesse-black`,type:`dark`},"vitesse-dark":{themeName:`vitesse-dark`,type:`dark`},"vitesse-light":{themeName:`vitesse-light`,type:`light`},nightfox:{themeName:`nightfox`,type:`dark`},nordfox:{themeName:`nordfox`,type:`dark`},duskfox:{themeName:`duskfox`,type:`dark`},terafox:{themeName:`terafox`,type:`dark`},carbonfox:{themeName:`carbonfox`,type:`dark`},dayfox:{themeName:`dayfox`,type:`light`},dawnfox:{themeName:`dawnfox`,type:`light`}};function PA(e,t){let n=[];return e.querySelectorAll(t).forEach(e=>n.push(e)),e.querySelectorAll(`*`).forEach(e=>{e.shadowRoot&&n.push(...PA(e.shadowRoot,t))}),n}function FA(){let e=document.activeElement;for(;e;){let t=e.tagName.toLowerCase();if(t===`input`||t===`textarea`||e.hasAttribute(`contenteditable`))return!0;let n=e.shadowRoot?.activeElement??null;if(n&&n!==e){e=n;continue}e=e.parentElement}return!1}function IA(e,t){let n=e;if(t&&t.trim()){let r=t.trim(),i=e.querySelectorAll(`span, code, pre`);for(let e of i)if(e.textContent?.trim()===r){n=e;break}if(n===e){for(let e of i)if(e.textContent?.trim().includes(r)){n=e;break}}}let r=n.style.borderRadius,i=n.style.padding;n.style.setProperty(`transition`,`none`,`important`),n.style.setProperty(`background-color`,`rgba(235, 186, 0, 0.55)`,`important`),n.style.setProperty(`box-shadow`,`0 0 0 2.5px rgba(235, 186, 0, 0.85)`,`important`),n.style.setProperty(`border-radius`,`4px`,`important`),n!==e&&n.style.setProperty(`padding`,`1px 5px`,`important`),n.offsetHeight,setTimeout(()=>{n.style.setProperty(`transition`,`background-color 2.5s ease-out, box-shadow 2.5s ease-out`,`important`),n.style.removeProperty(`background-color`),n.style.removeProperty(`box-shadow`),setTimeout(()=>{n.style.removeProperty(`transition`),r||n.style.removeProperty(`border-radius`),i||n.style.removeProperty(`padding`)},2500)},2e3)}function LA(e,t,n){let r=i=>{let a=PA(e,`[data-line]`),o=null;for(let e of a){let n=e.getAttribute(`data-line`);if(n&&parseInt(n,10)===t){o=e;break}}o?(o.scrollIntoView({block:`center`,behavior:`auto`}),IA(o,n)):i>0&&setTimeout(()=>r(i-1),50)};r(20)}function RA(e,t,n,r){let i=document.getElementById(`file-${e}`);if(!i)return;let a=i.querySelector(`input[type="checkbox"]`);a&&a.checked&&a.click(),i.scrollIntoView({block:`start`,behavior:`auto`});let o=n===`additions`||n===`addition`?`addition`:`deletion`,s=e=>{let n=PA(i,`[data-line]`),a=null;for(let e of n){let n=e.getAttribute(`data-line`),r=e.getAttribute(`data-line-type`);if(n&&parseInt(n,10)===t&&r===o){a=e;break}}if(!a)for(let e of n){let n=e.getAttribute(`data-line`);if(n&&parseInt(n,10)===t){a=e;break}}a?(a.scrollIntoView({block:`center`,behavior:`auto`}),IA(a,r)):e>0&&setTimeout(()=>s(e-1),50)};s(12);let c=i.querySelector(`.file-diff-card-header, .file-diff-placeholder-header`);c&&(c.classList.add(`symbol-flash`),setTimeout(()=>c.classList.remove(`symbol-flash`),1200))}function zA(e){(0,J.useEffect)(()=>{let t=``,n,r=0,i=()=>{t=``,clearTimeout(n)},a=a=>{if((a.metaKey||a.ctrlKey)&&a.key.toLowerCase()===`k`){a.preventDefault(),e.onTogglePalette?e.onTogglePalette():e.onOpenPalette(`all`),i();return}if((a.metaKey||a.ctrlKey)&&a.key.toLowerCase()===`f`&&e.onOpenFileSearch){a.preventDefault(),e.onOpenFileSearch(),i();return}if((a.metaKey||a.ctrlKey)&&a.key.toLowerCase()===`s`&&e.onSaveAll){a.preventDefault(),e.onSaveAll(),i();return}if(FA())return;if((a.metaKey||a.ctrlKey)&&(a.key===`?`||a.key===`/`&&a.shiftKey||a.code===`Slash`&&a.shiftKey)){a.preventDefault(),e.onOpenShortcuts(),OA(`medium`,`open`),i();return}if((a.metaKey||a.ctrlKey)&&a.key===`Enter`&&e.onOpenSendReview){a.preventDefault(),e.onOpenSendReview(),OA(`medium`,`open`),i();return}if(a.key===`Escape`){if(e.onCloseFileSearch){a.preventDefault(),e.onCloseFileSearch(),i();return}if(e.onExitZen){a.preventDefault(),e.onExitZen(),i();return}}if(a.ctrlKey){(a.key===`d`||a.key===`u`)&&(a.preventDefault(),window.scrollBy({top:a.key===`d`?window.innerHeight/2:-window.innerHeight/2,behavior:`auto`}),OA(`selection`,`navigate`),i());return}let o=a.key;if(o.length>1&&o!==`Escape`&&o!==`Enter`)return;clearTimeout(n),t+=o,n=setTimeout(()=>{t=``},800);let s=(e,t=`toggle`)=>{a.preventDefault(),e(),OA(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&&(EA(`navigate`),r=e),i()}else t===`gg`?s(()=>window.scrollTo({top:0,behavior:`auto`}),`navigate`):t===`G`?s(()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:`auto`}),`navigate`):t===`J`?s(()=>e.onNavigateFile(`next`),`navigate`):t===`K`?s(()=>e.onNavigateFile(`prev`),`navigate`):t===`]`&&e.onNavigateCommit?s(()=>e.onNavigateCommit?.(`next`),`navigate`):t===`[`&&e.onNavigateCommit?s(()=>e.onNavigateCommit?.(`prev`),`navigate`):t===`v`?s(e.onToggleViewed):t===`e`&&e.onToggleEdit?s(e.onToggleEdit):t===`m`?s(e.onToggleDiffStyle):t===`t`?s(e.onCycleTabSize):t===`b`?s(e.onToggleSidebar):t===`w`?s(e.onToggleLineWrap):t===`gn`||t===`#`?s(()=>e.onToggleLineNumbers?.()):t===`n`?s(()=>e.onNextSearchHit?.(),`navigate`):t===`N`?s(()=>e.onPrevSearchHit?.(),`navigate`):t===`F`?s(()=>e.onOpenFileSearch?.(),`open`):t===`i`?s(e.onCycleDiffIndicators):t===`I`?s(e.onCycleLineDiffType):t===`/`?s(()=>e.onOpenPalette(`all`),`open`):t===`f`?s(()=>e.onOpenPalette(`files`),`open`):t===`s`||t===`gs`?s(()=>e.onOpenPalette(`symbols`),`open`):t===`gf`?s(()=>e.onOpenPalette(`all`),`open`):t===`gv`?s(()=>e.onOpenPalette(`files`),`open`):t===`gt`?s(e.onOpenTheme,`open`):t===`z`&&e.onToggleZen?s(e.onToggleZen):t===`?`?s(e.onOpenShortcuts,`open`):t.length>=2&&i()};return window.addEventListener(`keydown`,a),()=>{window.removeEventListener(`keydown`,a),clearTimeout(n)}},[e])}var BA=[{pattern:/^\s*(?:(?:export|declare)\s+)*(?:default\s+)?(?:async\s+)?function\s+(\w[\w$]*)\s*[<(]/i,kind:`function`,nameGroup:1},{pattern:/^\s*(?:export\s+)?(?:const|let|var)\s+(\w[\w$]*)\s*=\s*(?:async\s*)?(?:\([^)]*\)|\w[\w$]*)\s*=>/i,kind:`function`,nameGroup:1},{pattern:/^\s*(?:export\s+)?(?:const|let|var)\s+(\w[\w$]*)\s*=\s*(?:async\s+)?function/i,kind:`function`,nameGroup:1},{pattern:/^\s*(?:(?:export|declare)\s+)*(?:default\s+)?(?:abstract\s+)?class\s+(\w[\w$]*)/i,kind:`class`,nameGroup:1},{pattern:/^\s*(?:(?:export|declare)\s+)*interface\s+(\w[\w$]*)/i,kind:`interface`,nameGroup:1},{pattern:/^\s*(?:(?:export|declare)\s+)*type\s+(\w[\w$]*)\s*=/i,kind:`type`,nameGroup:1},{pattern:/^\s*(?:(?:export|declare)\s+)*(?:const\s+)?enum\s+(\w[\w$]*)/i,kind:`enum`,nameGroup:1},{pattern:/^\s*namespace\s+((?:\w[\w$]*(?:\\\w[\w$]*)*)+)\s*;/i,kind:`namespace`,nameGroup:1},{pattern:/^\s*(?:(?:export|declare)\s+)*namespace\s+(\w[\w$]*)/i,kind:`namespace`,nameGroup:1},{pattern:/^\s*(?:export\s+)?(?:const|let|var)\s+(\w[\w$]*)\s*=/i,kind:`variable`,nameGroup:1},{pattern:/^\s*(?:(?:public|private|protected|static|abstract|final)\s+)+function\s+(\w[\w$]*)\s*\(/i,kind:`function`,nameGroup:1},{pattern:/^\s*(?:(?:abstract|final|readonly)\s+)+class\s+(\w[\w$]*)/i,kind:`class`,nameGroup:1},{pattern:/^\s*(?!(?:if|for|while|switch|catch)\b)(?:(?:public|private|protected|static|async|abstract|readonly|override|get|set)\s+)*(\w[\w$]*)\s*(?:<[^>]+>)?\s*\([^)]*\)\s*(?:\{|:[^={]+[;{])/i,kind:`method`,nameGroup:1},{pattern:/^\s*(?:async\s+)?def\s+(\w[\w$]*)\s*\(/i,kind:`function`,nameGroup:1},{pattern:/^\s*class\s+(\w[\w$]*)\s*(?:\(|:)/i,kind:`class`,nameGroup:1},{pattern:/^\s*(?:pub(?:\s*\([^)]*\))?\s+)?(?:(?:async|const|unsafe)\s+|extern(?:\s+"[^"]+")?\s+)*fn\s+(\w[\w$]*)\s*[<(]/i,kind:`function`,nameGroup:1},{pattern:/^\s*(?:pub(?:\s*\([^)]*\))?\s+)?struct\s+(\w[\w$]*)/i,kind:`struct`,nameGroup:1},{pattern:/^\s*(?:pub(?:\s*\([^)]*\))?\s+)?enum\s+(\w[\w$]*)/i,kind:`enum`,nameGroup:1},{pattern:/^\s*(?:pub(?:\s*\([^)]*\))?\s+)?trait\s+(\w[\w$]*)/i,kind:`trait`,nameGroup:1},{pattern:/^\s*(?:pub(?:\s*\([^)]*\))?\s+)?(?:type|mod)\s+(\w[\w$]*)/i,kind:`type`,nameGroup:1},{pattern:/^\s*(?:pub(?:\s*\([^)]*\))?\s+)?impl(?:<[^>]+>)?\s+[^\s]+\s+for\s+(\w[\w$]*)/i,kind:`impl`,nameGroup:1},{pattern:/^\s*(?:pub(?:\s*\([^)]*\))?\s+)?impl(?:<[^>]+>)?\s+(\w[\w$]*)/i,kind:`impl`,nameGroup:1},{pattern:/^\s*(?:pub(?:\s*\([^)]*\))?\s+)?(?:const|static)\s+(\w[\w$]*)\s*[:=]/i,kind:`variable`,nameGroup:1},{pattern:/^\s*func\s+\([^)]*\)\s+(\w[\w$]*)\s*\(/i,kind:`method`,nameGroup:1},{pattern:/^\s*func\s+(\w[\w$]*)\s*\(/i,kind:`function`,nameGroup:1},{pattern:/^\s*type\s+(\w[\w$]*)\s+(?:struct|interface|=)/i,kind:`type`,nameGroup:1},{pattern:/^\s*(?:var|const)\s+(\w[\w$]*)\b/i,kind:`variable`,nameGroup:1}];function VA(e){for(let{pattern:t,kind:n,nameGroup:r}of BA){let i=t.exec(e);if(i){let e=i[r];if(e)return{name:e,kind:n}}}return null}function HA(e){return new Set(e.map(e=>e.name))}function UA(e){let t=new Set;for(let n of e)n.side===`additions`&&t.add(`${n.filePath}:${n.lineNumber}`);return t}function WA(e,t){return e.kind===`file`?t.diffFileSet.has(e.path)?{type:`scrollFile`,path:e.path}:{type:`preview`,path:e.path}:t.diffFileSet.has(e.path)?{type:`scrollLine`,path:e.path,line:e.line,side:`additions`,match:e.match}:{type:`preview`,path:e.path,line:e.line,match:e.match}}function GA(e,t){if(!t||t.length===0)return null;let n=!0;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127){n=!1;break}let r=n?e.length:qA(e),i=null;if(!n){i=Array(r+1).fill(-1);let t=0;for(let n=0;n<e.length;){i[t]=n;let r=e.codePointAt(n);n+=r>65535?2:1,t+=KA(r)}i[r]=e.length}let a=[];for(let e of t){let[t,o]=e;if(!(t==null||o==null||o<=t||t<0||o>r))if(n)a.push([t,o]);else{let e=i[t],n=i[o];e>=0&&n>=0&&a.push([e,n])}}return a.length?a:null}function KA(e){return e<=127?1:e<=2047?2:e<=65535?3:4}function qA(e){let t=0;for(let n=0;n<e.length;){let r=e.codePointAt(n);t+=KA(r),n+=r>65535?2:1}return t}function JA(e,t,n){let r=((t?GA(e,t):null)??YA(e,n)).map(([t,n])=>[Math.max(0,t),Math.min(e.length,n)]).filter(([e,t])=>t>e).sort((e,t)=>e[0]-t[0]),i=[];for(let[e,t]of r){let n=i[i.length-1];n&&e<=n[1]?n[1]=Math.max(n[1],t):i.push([e,t])}return i}function YA(e,t){let n=t.trim();if(!n)return[];let r=[],i=e.toLowerCase(),a=n.toLowerCase(),o=0;for(;r.length<50;){let e=i.indexOf(a,o);if(e===-1)break;r.push([e,e+a.length]),o=e+a.length}return r}function XA(e,t){let n=e.toLowerCase(),r=t.toLowerCase();if(!r)return 0;let i=0,a=0,o=-1;for(let e=0;e<n.length&&i<r.length;e++)n[e]===r[i]&&(a+=o>=0&&e-o===1?5:1,o=e,i++);return i===r.length?a-e.length*.01:null}function ZA(e){let t=[],n=new Set;for(let r of e){if(r.side!==`additions`)continue;let e=VA(r.content);if(e){let i=`${r.filePath}:${r.lineNumber}:${e.name}`;if(n.has(i))continue;n.add(i);let a=r.content.indexOf(e.name),o=a>=0?[[a,a+e.name.length]]:[];t.push({name:e.name,kind:e.kind,path:r.filePath,fileName:r.filePath.split(`/`).pop()||``,line:r.lineNumber,content:r.content,matchRanges:o,gitStatus:``})}}return t}function QA(e,t){let[n,r]=(0,J.useState)(e);return(0,J.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function $A(e){return e===`symbols`?2:e===`text`?1:0}function ej({scope:e,query:t,regex:n,changedOnly:r,changedPaths:i,open:a}){let o=QA(t,130).trim(),s=a&&o.length>=$A(e);return{...Qe({queryKey:[`search`,e,o,e===`text`?n:!1,r,r?i:null],enabled:s,placeholderData:U,staleTime:5e3,queryFn:async({signal:t})=>{let a=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},signal:t,body:JSON.stringify({scope:e,query:o,regex:e===`text`?n:!1,changedPaths:r?i:void 0})});if(!a.ok)throw Error(`Search request failed (${a.status})`);return await a.json()}}),enabled:s,pending:t.trim()!==o,minLength:$A(e)}}function tj(e,t){fetch(`/api/search/track`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({query:e,path:t})}).catch(()=>{})}function nj(e){return!0}function rj(e,t){let n=t.trim();return e.map(e=>{if(e.kind===`file`)return{kind:`file`,path:e.hit.path};let t=e.hit.line,r=e.kind===`symbol`?e.hit.name:n;return{kind:e.kind,path:e.hit.path,line:t,match:r}})}function ij(e,t,n){if(e.kind===`file`)return WA({kind:`file`,path:e.path},t).type===`scrollFile`?(n(e.path),`navigated`):`preview-only`;let r=e.line;if(r==null)return`preview-only`;let i=WA({kind:`line`,path:e.path,line:r,match:e.match},t);return i.type===`scrollLine`?(RA(i.path,i.line,i.side,i.match),`navigated`):`preview-only`}function aj(e,t,n){return n<=0?0:(e+t+n*16)%n}function oj(e,t,n,r){let i=e.hits[t];return i?(e.query&&tj(e.query,i.path),ij(i,n,r)):`preview-only`}function sj(e,t){let[n,r]=(0,J.useState)(null),i=(0,J.useRef)(n),[a,o]=(0,J.useState)(null),s=(0,J.useRef)(null);(0,J.useEffect)(()=>{i.current=n},[n]);let c=(0,J.useCallback)(e=>{o(e),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>o(null),2500)},[]),l=(0,J.useCallback)(e=>{e.hits.length!==0&&r({hits:e.hits,index:Math.min(e.index,e.hits.length-1),query:e.query})},[]),u=(0,J.useCallback)(n=>{let a=i.current;if(!a||a.hits.length===0){c(`no active search results`);return}let o=aj(a.index,n,a.hits.length),s=oj(a,o,e,t);r({...a,index:o}),s===`preview-only`&&c(`Preview only — ${a.hits[o].path}`)},[c,e,t]);return{session:n,statusMessage:a,setSnapshot:l,nextHit:(0,J.useCallback)(()=>u(1),[u]),prevHit:(0,J.useCallback)(()=>u(-1),[u])}}var cj=`x-diffing-token`,lj=`token`,uj=`diffing-session-token`,dj=null,fj=!1;function pj(){if(typeof window>`u`)return null;try{return sessionStorage.getItem(uj)}catch{return null}}function mj(){return(typeof window<`u`?window.__DIFFING_SESSION_TOKEN__??null:null)??pj()}function hj(e){dj=e;try{sessionStorage.setItem(uj,e)}catch{}}function gj(){if(typeof window>`u`)return;let e=new URL(window.location.href),t=e.searchParams.get(lj);if(!t)return;hj(t),e.searchParams.delete(lj);let n=e.searchParams.toString(),r=`${e.pathname}${n?`?${n}`:``}${e.hash}`;window.history.replaceState(null,``,r)}function _j(e){try{let t=new URL(e,window.location.origin);t.searchParams.delete(lj);let n=t.searchParams.toString();return`${t.pathname}${n?`?${n}`:``}${t.hash}`}catch{return e}}function vj(e){return _j(e)}function yj(){if(fj||typeof window>`u`)return;fj=!0,gj();let e=mj();if(e&&hj(e),!dj)return;let t=window.fetch.bind(window);window.fetch=(e,n)=>{let r=new Headers(n?.headers);return(typeof e==`string`?e:e instanceof URL?e.toString():e.url).includes(`/api/`)&&r.set(cj,dj),t(e,{...n,headers:r})}}function bj(){let e=mj();return e?`/api/live?${lj}=${encodeURIComponent(e)}`:`/api/live`}var xj=new Map,Sj=null;function Cj(){if(!(Sj||typeof EventSource>`u`)){Sj=new EventSource(bj());for(let e of xj.keys())wj(e)}}function wj(e){Sj?.addEventListener(e,t=>{let n=t.data;for(let t of xj.get(e)??[])try{t(n)}catch(t){console.error(`live channel handler for "${e}" threw:`,t)}})}function Tj(){[...xj.values()].every(e=>e.size===0)&&Sj&&(Sj.close(),Sj=null)}function Ej(e,t){let n=xj.get(e);return n||(n=new Set,xj.set(e,n),Sj&&wj(e)),n.add(t),Cj(),()=>{n.delete(t),Tj()}}var Dj=[],Oj={},kj=[];function Aj(e,t=!0){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(!0),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(0),f=(0,J.useRef)(!1);return(0,J.useEffect)(()=>{if(!t)return;let n=!1;return f.current?s(!0):a(!0),l(null),fetch(`/api/diff?staged=${e.staged}&untracked=${e.untracked}`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{n||(f.current=!0,r(e))}).catch(e=>{n||l(e.message)}).finally(()=>{n||(a(!1),s(!1))}),()=>{n=!0}},[e.staged,e.untracked,t,u]),(0,J.useEffect)(()=>{if(!t)return;let e=null,n=()=>{e&&clearTimeout(e),e=setTimeout(()=>d(e=>e+1),150)},r=Ej(`change`,n),i=Ej(`pr-session`,n);return()=>{e&&clearTimeout(e),r(),i()}},[t]),{patch:n?.patch??null,repoName:n?.repoName??``,branch:n?.branch??``,customMode:n?.customMode??!1,showMode:n?.showMode??!1,commits:n?.commits??kj,truncated:n?.truncated??0,binaryFiles:n?.binaryFiles??Dj,tabSizeMap:n?.tabSizeMap??Oj,untrackedFiles:n?.untrackedFiles??Dj,overview:n?.overview,loading:i,refreshing:o,error:c}}function jj(e){switch(e){case`approved`:return`The reviewer APPROVED these changes. Address any open comments below, then proceed — the overall direction is good.`;case`changes-requested`:return`The reviewer REQUESTED EDITS. Address every open comment below and apply the requested changes before considering this review done.`;case`rejected`:return`The reviewer REJECTED these changes. Do NOT keep building on this approach; reconsider it in light of the comments below before continuing.`;case`comment-only`:return`The reviewer chose COMMENT-ONLY mode. You MUST NOT edit any files. Only reply to the comments below — answer questions, provide clarification, or discuss. The general comment (if any) is your prompt for the chat.`}}function Mj(e,t,n,r){let i=t?.trim();if(e.length===0&&!n&&!i)return``;let a=new Map;for(let t of e){let e=a.get(t.filePath)??[];e.push(t),a.set(t.filePath,e)}let o=[...a.keys()].sort((e,t)=>e.localeCompare(t)),s=r&&r!==`standard`?` mode="${r}"`:``,c=[];c.push(n?`<code-review-comments decision="${n}"${s}>`:`<code-review-comments${s}>`),c.push(` <instructions>`),c.push(` You are an AI coding assistant. You are receiving a structured list of code review comments to address in the repository.`),r===`comment-only`?c.push(` ⚠️ COMMENT-ONLY MODE: You MUST NOT edit any files. Your only task is to reply to the comments below — answer questions, provide clarification, or discuss. The general comment (if present) is your prompt for this chat.`):c.push(` For each file, review the inline comments and apply the changes requested.`),n&&(c.push(` - The "decision" attribute on the root element is the reviewer's headline verdict: "approved", "changes-requested", "rejected", or "comment-only".`),c.push(` - <decision-summary> tells you, in plain language, what to do next based on that verdict.`)),r&&c.push(` - The "mode" attribute on the root element controls your behavior: "standard" (apply edits) or "comment-only" (reply only, no edits).`),c.push(` - Target lines are specified by the "line" attribute (e.g. line="10" or line="10-15").`),c.push(` - When line="A-B", the range is INCLUSIVE on that side (both A and B and every line between). Address the whole span, not only the last line.`),c.push(` - "side" indicates whether the comment is on "additions" (added/modified lines) or "deletions" (deleted/old lines).`),c.push(` - "status" indicates whether the comment is "open" or "resolved". Only address comments with status="open".`),c.push(` - Optional severity="blocking|nit|question|praise":`),c.push(` blocking = must fix before considering the review done;`),c.push(` nit = optional polish; question = needs an answer; praise = positive (no change required).`),c.push(` Omit severity (or severity="none") means untriaged — treat as a normal request.`),c.push(` - The <code> block contains the specific code context at the reviewed lines, prefixed with "+" or "-".`),c.push(` - The <body> tag contains the review feedback or request.`),c.push(` - If developers have replied to the comment, their discussion is captured under the <replies> element.`),c.push(` - The comment "id" attribute can be used to reference or update the comment via API if available.`),c.push(``),c.push(` HOW TO REPLY OR ASK FOR CLARIFICATION:`),c.push(` If you need to ask for clarification, explain what you did, or reply to any comment:`),c.push(``),c.push(` Option A: Via the diffing CLI or MCP (Preferred — port-agnostic, no copy-paste)`),c.push(` diffing reply <comment-id> --body "Your response" --model "<your-model-name>"`),c.push(` diffing resolve <comment-id>`),c.push(` (Or the equivalent MCP tools: reply_to_comment, resolve_comment.)`),c.push(``),c.push(` Option B: Via the local HTTP API (if you know the running port)`),c.push(` POST http://localhost:<port>/api/comments/<comment-id>/replies`),c.push(` Payload: { "body": "Your response or clarification request here", "model": "<your-model-name>" }`),c.push(` PUT http://localhost:<port>/api/comments/<comment-id> Payload: { "status": "resolved" }`),c.push(``),c.push(` Option C: Via Text Response (Offline / Chat Copy-Paste)`),c.push(` If you do not have local API access, output your comments/replies inside a structured XML block at the end of your response:`),c.push(` <comment-replies>`),c.push(` <reply to="<comment-id>" model="<your-model-name>"><![CDATA[Your reply or clarification request here]]></reply>`),c.push(` </comment-replies>`),c.push(` </instructions>`),n&&c.push(` <decision-summary><![CDATA[${jj(n)}]]></decision-summary>`),i&&(c.push(` <general-comment>`),c.push(` <![CDATA[${i}]]>`),c.push(` </general-comment>`));for(let e of o){let t=a.get(e);c.push(` <file path="${e}">`);for(let e of t){let t=e.lineNumber===0?`file`:e.startLineNumber&&e.startLineNumber!==e.lineNumber?`${e.startLineNumber}-${e.lineNumber}`:`${e.lineNumber}`,n=new Date(e.createdAt).toISOString(),r=e.severity&&e.severity!==`none`?` severity="${e.severity}"`:``;if(c.push(` <comment id="${e.id}" line="${t}" side="${e.side}" status="${e.status}"${r} created-at="${n}">`),e.lineNumber!==0){let t=e.side===`additions`?`+`:`-`,n=e.lineContent&&e.lineContent.includes(`
1546
1546
  `),r=``;r=n?`\n${e.lineContent.split(`
1547
1547
  `).map(e=>`${t} ${e}`).join(`
1548
1548
  `)}\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(`
1549
- `)}var Nj=[`comments`];async function Pj(){let e=await fetch(`/api/comments`);if(!e.ok)return[];let t=await e.json();return Array.isArray(t)?t:[]}function Fj(){let e=Le(),{data:t=[],isLoading:n}=Qe({queryKey:Nj,queryFn:Pj});(0,J.useEffect)(()=>Ej(`comments`,()=>{e.invalidateQueries({queryKey:Nj})}),[e]);let[r,i]=(0,J.useState)({round:0,waiters:0,lastSentAt:null,lastDecision:void 0,lastOpenCount:void 0});(0,J.useEffect)(()=>{let e=!1;fetch(`/api/review/status`).then(e=>e.json()).then(t=>{e||i(t)}).catch(()=>{});let t=Ej(`agent-status`,e=>{try{i(JSON.parse(e))}catch{}});return()=>{e=!0,t()}},[]);let a=(0,J.useRef)(null),[o,s]=(0,J.useState)(null);(0,J.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=$e({mutationFn:async e=>(await fetch(`/api/comments`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).json(),onSuccess:t=>{e.setQueryData(Nj,(e=[])=>[...e,t])}}),l=$e({mutationFn:async e=>(await fetch(`/api/comments/${e}`,{method:`DELETE`}),e),onSuccess:t=>{e.setQueryData(Nj,(e=[])=>e.filter(e=>e.id!==t))}}),u=$e({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(Nj,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),d=$e({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(Nj,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),f=$e({mutationFn:async({commentId:e,replyId:t})=>(await fetch(`/api/comments/${e}/replies/${t}`,{method:`DELETE`})).json(),onSuccess:t=>{e.setQueryData(Nj,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),p=$e({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(Nj,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),m=$e({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=$e({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:Nj})}}),g=(0,J.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,J.useCallback)(e=>{l.mutate(e)},[l.mutate]),v=(0,J.useCallback)((e,t)=>{u.mutate({id:e,body:t})},[u.mutate]),y=(0,J.useCallback)(e=>{u.mutate({id:e,status:`resolved`})},[u.mutate]),b=(0,J.useCallback)(e=>{u.mutate({id:e,status:`open`})},[u.mutate]),x=(0,J.useCallback)((e,t)=>{d.mutate({id:e,body:t})},[d.mutate]),S=(0,J.useCallback)((e,t)=>{f.mutate({commentId:e,replyId:t})},[f.mutate]),C=(0,J.useCallback)((e,t,n)=>{p.mutate({commentId:e,replyId:t,body:n})},[p.mutate]),w=(0,J.useCallback)(async e=>{await h.mutateAsync(e)},[h.mutateAsync]),T=(0,J.useCallback)(()=>Mj(t),[t]),E=(0,J.useCallback)(e=>t.filter(t=>t.filePath===e).map(e=>({side:e.side,lineNumber:e.lineNumber,metadata:e})),[t]),D=(0,J.useCallback)(async()=>{let e=T();await navigator.clipboard.writeText(e)},[T]),O=(0,J.useCallback)(async()=>{let{formatCommentsMarkdown:e}=await Z(async()=>{let{formatCommentsMarkdown:e}=await import(`./review-export-DUMpiyN2.js`);return{formatCommentsMarkdown:e}},[]),n=e(t);n&&await navigator.clipboard.writeText(n)},[t]),k=(0,J.useCallback)((e,t,n,r)=>m.mutateAsync({decision:e,generalComment:t,mode:n,force:r}),[m.mutateAsync]),A=$e({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:Nj})}}),j=(0,J.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,J.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 Ij=[`plans`];async function Lj(){let e=await fetch(`/api/plans`);if(!e.ok)return[];let t=await e.json();return Array.isArray(t)?t:[]}function Rj(){let e=Le(),{data:t=[],isLoading:n}=Qe({queryKey:Ij,queryFn:Lj});(0,J.useEffect)(()=>Ej(`plans`,()=>{e.invalidateQueries({queryKey:Ij})}),[e]);let[r,i]=(0,J.useState)({round:0,waiters:0,lastDecidedAt:null});(0,J.useEffect)(()=>{let e=!1;fetch(`/api/plan-review/status`).then(e=>e.json()).then(t=>{e||i(t)}).catch(()=>{});let t=Ej(`plan-review-status`,e=>{try{i(JSON.parse(e))}catch{}});return()=>{e=!0,t()}},[]);let a=(0,J.useRef)(null),[o,s]=(0,J.useState)(null);(0,J.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,J.useCallback)(t=>{e.setQueryData(Ij,(e=[])=>e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[...e,t])},[e]),l=$e({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=$e({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=$e({mutationFn:async({planId:e,commentId:t})=>(await fetch(`/api/plans/${e}/comments/${t}`,{method:`DELETE`})).json(),onSuccess:c}),f=$e({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=$e({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=$e({mutationFn:async({planId:e,commentId:t,replyId:n})=>(await fetch(`/api/plans/${e}/comments/${t}/replies/${n}`,{method:`DELETE`})).json(),onSuccess:c}),h=$e({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:Ij})}),g=$e({mutationFn:async e=>(await fetch(`/api/plans/${e}`,{method:`DELETE`}),e),onSuccess:t=>{e.setQueryData(Ij,(e=[])=>e.filter(e=>e.id!==t))}}),_=$e({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=$e({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,J.useCallback)(e=>t.find(t=>t.id===e)??null,[t]),addPlanComment:(0,J.useCallback)(e=>l.mutate(e),[l.mutate]),editPlanComment:(0,J.useCallback)((e,t,n)=>u.mutate({planId:e,commentId:t,body:n}),[u.mutate]),resolvePlanComment:(0,J.useCallback)((e,t)=>u.mutate({planId:e,commentId:t,status:`resolved`}),[u.mutate]),unresolvePlanComment:(0,J.useCallback)((e,t)=>u.mutate({planId:e,commentId:t,status:`open`}),[u.mutate]),removePlanComment:(0,J.useCallback)((e,t)=>d.mutate({planId:e,commentId:t}),[d.mutate]),addPlanReply:(0,J.useCallback)((e,t,n)=>f.mutate({planId:e,commentId:t,body:n}),[f.mutate]),editPlanReply:(0,J.useCallback)((e,t,n,r)=>p.mutate({planId:e,commentId:t,replyId:n,body:r}),[p.mutate]),removePlanReply:(0,J.useCallback)((e,t,n)=>m.mutate({planId:e,commentId:t,replyId:n}),[m.mutate]),removePlan:(0,J.useCallback)(e=>g.mutate(e),[g.mutate]),updatePlan:(0,J.useCallback)((e,t)=>_.mutateAsync({planId:e,...t}),[_.mutateAsync]),submitPlanVersion:(0,J.useCallback)((e,t)=>v.mutateAsync({planId:e,...t}),[v.mutateAsync]),updatingPlan:_.isPending,submittingPlanVersion:v.isPending,submitDecision:(0,J.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,J.useCallback)(()=>s(null),[]),isLoading:n}}var zj=new Set;function Bj(){for(let e of zj)e()}function Vj(e,t={}){let n=vj(e);n!==window.location.pathname+window.location.search&&(t.replace?window.history.replaceState(null,``,n):window.history.pushState(null,``,n),Bj())}function Hj(e){return zj.add(e),window.addEventListener(`popstate`,e),()=>{zj.delete(e),window.removeEventListener(`popstate`,e)}}function Uj(){return window.location.pathname}function Wj(){return`/`}function Gj(){return(0,J.useSyncExternalStore)(Hj,Uj,Wj)}function Kj(e){let[t,n]=(0,J.useState)({inMerge:!1,conflicts:[]}),r=(0,J.useCallback)(()=>{fetch(`/api/merge-status`).then(e=>e.ok?e.json():{inMerge:!1,conflicts:[]}).then(n).catch(()=>n({inMerge:!1,conflicts:[]}))},[]);return(0,J.useEffect)(()=>{r()},[r,e]),{status:t,refresh:r}}var qj={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,editDiagnostics:!1},Jj=`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;function Yj(e){return e?`"${e}", ${Jj}`:`"JetBrains Mono", ${Jj}`}function Xj(){let[e,t]=(0,J.useState)(qj),[n,r]=(0,J.useState)(!1),i=(0,J.useRef)(!0);return(0,J.useEffect)(()=>{fetch(`/api/settings`).then(e=>e.json()).then(e=>{i.current=!0,t({...qj,...e}),r(!0)}).catch(()=>r(!0))},[]),(0,J.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,J.useCallback)(e=>{t(t=>({...t,...e}))},[])}}function Zj(e,t,n){(0,J.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=`
1549
+ `)}var Nj=[`comments`];async function Pj(){let e=await fetch(`/api/comments`);if(!e.ok)return[];let t=await e.json();return Array.isArray(t)?t:[]}function Fj(){let e=Le(),{data:t=[],isLoading:n}=Qe({queryKey:Nj,queryFn:Pj});(0,J.useEffect)(()=>Ej(`comments`,()=>{e.invalidateQueries({queryKey:Nj})}),[e]);let[r,i]=(0,J.useState)({round:0,waiters:0,lastSentAt:null,lastDecision:void 0,lastOpenCount:void 0});(0,J.useEffect)(()=>{let e=!1;fetch(`/api/review/status`).then(e=>e.json()).then(t=>{e||i(t)}).catch(()=>{});let t=Ej(`agent-status`,e=>{try{i(JSON.parse(e))}catch{}});return()=>{e=!0,t()}},[]);let a=(0,J.useRef)(null),[o,s]=(0,J.useState)(null);(0,J.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=$e({mutationFn:async e=>(await fetch(`/api/comments`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).json(),onSuccess:t=>{e.setQueryData(Nj,(e=[])=>[...e,t])}}),l=$e({mutationFn:async e=>(await fetch(`/api/comments/${e}`,{method:`DELETE`}),e),onSuccess:t=>{e.setQueryData(Nj,(e=[])=>e.filter(e=>e.id!==t))}}),u=$e({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(Nj,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),d=$e({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(Nj,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),f=$e({mutationFn:async({commentId:e,replyId:t})=>(await fetch(`/api/comments/${e}/replies/${t}`,{method:`DELETE`})).json(),onSuccess:t=>{e.setQueryData(Nj,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),p=$e({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(Nj,(e=[])=>e.map(e=>e.id===t.id?t:e))}}),m=$e({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=$e({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:Nj})}}),g=(0,J.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,J.useCallback)(e=>{l.mutate(e)},[l.mutate]),v=(0,J.useCallback)((e,t)=>{u.mutate({id:e,body:t})},[u.mutate]),y=(0,J.useCallback)(e=>{u.mutate({id:e,status:`resolved`})},[u.mutate]),b=(0,J.useCallback)(e=>{u.mutate({id:e,status:`open`})},[u.mutate]),x=(0,J.useCallback)((e,t)=>{d.mutate({id:e,body:t})},[d.mutate]),S=(0,J.useCallback)((e,t)=>{f.mutate({commentId:e,replyId:t})},[f.mutate]),C=(0,J.useCallback)((e,t,n)=>{p.mutate({commentId:e,replyId:t,body:n})},[p.mutate]),w=(0,J.useCallback)(async e=>{await h.mutateAsync(e)},[h.mutateAsync]),T=(0,J.useCallback)(()=>Mj(t),[t]),E=(0,J.useCallback)(e=>t.filter(t=>t.filePath===e).map(e=>({side:e.side,lineNumber:e.lineNumber,metadata:e})),[t]),D=(0,J.useCallback)(async()=>{let e=T();await navigator.clipboard.writeText(e)},[T]),O=(0,J.useCallback)(async()=>{let{formatCommentsMarkdown:e}=await Z(async()=>{let{formatCommentsMarkdown:e}=await import(`./review-export-BlgD3bdw.js`);return{formatCommentsMarkdown:e}},[]),n=e(t);n&&await navigator.clipboard.writeText(n)},[t]),k=(0,J.useCallback)((e,t,n,r)=>m.mutateAsync({decision:e,generalComment:t,mode:n,force:r}),[m.mutateAsync]),A=$e({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:Nj})}}),j=(0,J.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,J.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 Ij=[`plans`];async function Lj(){let e=await fetch(`/api/plans`);if(!e.ok)return[];let t=await e.json();return Array.isArray(t)?t:[]}function Rj(){let e=Le(),{data:t=[],isLoading:n}=Qe({queryKey:Ij,queryFn:Lj});(0,J.useEffect)(()=>Ej(`plans`,()=>{e.invalidateQueries({queryKey:Ij})}),[e]);let[r,i]=(0,J.useState)({round:0,waiters:0,lastDecidedAt:null});(0,J.useEffect)(()=>{let e=!1;fetch(`/api/plan-review/status`).then(e=>e.json()).then(t=>{e||i(t)}).catch(()=>{});let t=Ej(`plan-review-status`,e=>{try{i(JSON.parse(e))}catch{}});return()=>{e=!0,t()}},[]);let a=(0,J.useRef)(null),[o,s]=(0,J.useState)(null);(0,J.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,J.useCallback)(t=>{e.setQueryData(Ij,(e=[])=>e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[...e,t])},[e]),l=$e({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=$e({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=$e({mutationFn:async({planId:e,commentId:t})=>(await fetch(`/api/plans/${e}/comments/${t}`,{method:`DELETE`})).json(),onSuccess:c}),f=$e({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=$e({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=$e({mutationFn:async({planId:e,commentId:t,replyId:n})=>(await fetch(`/api/plans/${e}/comments/${t}/replies/${n}`,{method:`DELETE`})).json(),onSuccess:c}),h=$e({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:Ij})}),g=$e({mutationFn:async e=>(await fetch(`/api/plans/${e}`,{method:`DELETE`}),e),onSuccess:t=>{e.setQueryData(Ij,(e=[])=>e.filter(e=>e.id!==t))}}),_=$e({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=$e({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,J.useCallback)(e=>t.find(t=>t.id===e)??null,[t]),addPlanComment:(0,J.useCallback)(e=>l.mutate(e),[l.mutate]),editPlanComment:(0,J.useCallback)((e,t,n)=>u.mutate({planId:e,commentId:t,body:n}),[u.mutate]),resolvePlanComment:(0,J.useCallback)((e,t)=>u.mutate({planId:e,commentId:t,status:`resolved`}),[u.mutate]),unresolvePlanComment:(0,J.useCallback)((e,t)=>u.mutate({planId:e,commentId:t,status:`open`}),[u.mutate]),removePlanComment:(0,J.useCallback)((e,t)=>d.mutate({planId:e,commentId:t}),[d.mutate]),addPlanReply:(0,J.useCallback)((e,t,n)=>f.mutate({planId:e,commentId:t,body:n}),[f.mutate]),editPlanReply:(0,J.useCallback)((e,t,n,r)=>p.mutate({planId:e,commentId:t,replyId:n,body:r}),[p.mutate]),removePlanReply:(0,J.useCallback)((e,t,n)=>m.mutate({planId:e,commentId:t,replyId:n}),[m.mutate]),removePlan:(0,J.useCallback)(e=>g.mutate(e),[g.mutate]),updatePlan:(0,J.useCallback)((e,t)=>_.mutateAsync({planId:e,...t}),[_.mutateAsync]),submitPlanVersion:(0,J.useCallback)((e,t)=>v.mutateAsync({planId:e,...t}),[v.mutateAsync]),updatingPlan:_.isPending,submittingPlanVersion:v.isPending,submitDecision:(0,J.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,J.useCallback)(()=>s(null),[]),isLoading:n}}var zj=new Set;function Bj(){for(let e of zj)e()}function Vj(e,t={}){let n=vj(e);n!==window.location.pathname+window.location.search&&(t.replace?window.history.replaceState(null,``,n):window.history.pushState(null,``,n),Bj())}function Hj(e){return zj.add(e),window.addEventListener(`popstate`,e),()=>{zj.delete(e),window.removeEventListener(`popstate`,e)}}function Uj(){return window.location.pathname}function Wj(){return`/`}function Gj(){return(0,J.useSyncExternalStore)(Hj,Uj,Wj)}function Kj(e){let[t,n]=(0,J.useState)({inMerge:!1,conflicts:[]}),r=(0,J.useCallback)(()=>{fetch(`/api/merge-status`).then(e=>e.ok?e.json():{inMerge:!1,conflicts:[]}).then(n).catch(()=>n({inMerge:!1,conflicts:[]}))},[]);return(0,J.useEffect)(()=>{r()},[r,e]),{status:t,refresh:r}}var qj={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,editDiagnostics:!1},Jj=`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;function Yj(e){return e?`"${e}", ${Jj}`:`"JetBrains Mono", ${Jj}`}function Xj(){let[e,t]=(0,J.useState)(qj),[n,r]=(0,J.useState)(!1),i=(0,J.useRef)(!0);return(0,J.useEffect)(()=>{fetch(`/api/settings`).then(e=>e.json()).then(e=>{i.current=!0,t({...qj,...e}),r(!0)}).catch(()=>r(!0))},[]),(0,J.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,J.useCallback)(e=>{t(t=>({...t,...e}))},[])}}function Zj(e,t,n){(0,J.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=`
1550
1550
  :root {
1551
1551
  --font-sans: ${g}${r} !important;
1552
1552
  --font-mono: ${_}${r} !important;
@@ -1596,8 +1596,8 @@ diff --git`)}function Dg(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
1596
1596
  `},l]}}var jG=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_-]*/}}),MG=`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(`.`),NG=`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(`.`),PG=[...MG,...NG],FG=`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(),IG=`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(),LG=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),RG=`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(),zG=IG.concat(LG).sort().reverse();function BG(e){let t=jG(e),n=zG,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:FG.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(`+RG.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(`+PG.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:`:(`+IG.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+LG.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 VG(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 HG(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 UG(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 WG(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 GG(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 KG(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=`[
1597
1597
  ]`,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 qG(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 JG(e){return{name:`Plain text`,aliases:[`text`,`txt`],disableAutodetect:!0}}function YG(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 XG(e){return{aliases:[`pycon`],contains:[{className:`meta.prompt`,starts:{end:/ |$/,starts:{end:`$`,subLanguage:`python`}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function ZG(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 QG(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 $G(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 eK=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_-]*/}}),tK=`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(`.`),nK=`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(`.`),rK=[...tK,...nK],iK=`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(),aK=`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(),oK=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),sK=`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 cK(e){let t=eK(e),n=oK,r=aK,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(`+rK.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(`+sK.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:iK.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 lK(e){return{name:`Shell Session`,aliases:[`console`,`shellsession`],contains:[{className:`meta.prompt`,begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:`bash`}}]}}function uK(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 dK(e){return e?typeof e==`string`?e:e.source:null}function fK(e){return pK(`(?=`,e,`)`)}function pK(...e){return e.map(e=>dK(e)).join(``)}function mK(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function hK(...e){return`(`+(mK(e).capture?``:`?:`)+e.map(e=>dK(e)).join(`|`)+`)`}var gK=e=>pK(/\b/,e,/\w$/.test(e)?/\b/:/\B/),_K=[`Protocol`,`Type`].map(gK),vK=[`init`,`self`].map(gK),yK=[`Any`,`Self`],bK=[`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`],xK=[`false`,`nil`,`true`],SK=[`assignment`,`associativity`,`higherThan`,`left`,`lowerThan`,`none`,`right`],CK=[`#colorLiteral`,`#column`,`#dsohandle`,`#else`,`#elseif`,`#endif`,`#error`,`#file`,`#fileID`,`#fileLiteral`,`#filePath`,`#function`,`#if`,`#imageLiteral`,`#keyPath`,`#line`,`#selector`,`#sourceLocation`,`#warning`],wK=`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(`.`),TK=hK(/[/=\-+!*%<>&|^~?]/,/[\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]/),EK=hK(TK,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),DK=pK(TK,EK,`*`),OK=hK(/[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]/),kK=hK(OK,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),AK=pK(OK,kK,`*`),jK=pK(/[A-Z]/,kK,`*`),MK=[`attached`,`autoclosure`,pK(/convention\(/,hK(`swift`,`block`,`c`),/\)/),`discardableResult`,`dynamicCallable`,`dynamicMemberLookup`,`escaping`,`freestanding`,`frozen`,`GKInspectable`,`IBAction`,`IBDesignable`,`IBInspectable`,`IBOutlet`,`IBSegueAction`,`inlinable`,`main`,`nonobjc`,`NSApplicationMain`,`NSCopying`,`NSManaged`,pK(/objc\(/,AK,/\)/),`objc`,`objcMembers`,`propertyWrapper`,`requires_stored_property_inits`,`resultBuilder`,`Sendable`,`testable`,`UIApplicationMain`,`unchecked`,`unknown`,`usableFromInline`,`warn_unqualified_access`],NK=[`iOS`,`iOSApplicationExtension`,`macOS`,`macOSApplicationExtension`,`macCatalyst`,`macCatalystApplicationExtension`,`watchOS`,`watchOSApplicationExtension`,`tvOS`,`tvOSApplicationExtension`,`swift`];function PK(e){let t={match:/\s+/,relevance:0},n=e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,hK(..._K,...vK)],className:{2:`keyword`}},a={match:pK(/\./,hK(...bK)),relevance:0},o=bK.filter(e=>typeof e==`string`).concat([`_|0`]),s={variants:[{className:`keyword`,match:hK(...bK.filter(e=>typeof e!=`string`).concat(yK).map(gK),...vK)}]},c={$pattern:hK(/\b\w+/,/#\w+/),keyword:o.concat(CK),literal:xK},l=[i,a,s],u=[{match:pK(/\./,hK(...wK)),relevance:0},{className:`built_in`,match:pK(/\b/,hK(...wK),/(?=\()/)}],d={match:/->/,relevance:0},f=[d,{className:`operator`,relevance:0,variants:[{match:DK},{match:`\\.(\\.|${EK})+`}]}],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:pK(/\\/,e,/[0\\tnr"']/)},{match:pK(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(e=``)=>({className:`subst`,match:pK(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),v=(e=``)=>({className:`subst`,label:`interpol`,begin:pK(/\\/,e,/\(/),end:/\)/}),y=(e=``)=>({begin:pK(e,/"""/),end:pK(/"""/,e),contains:[g(e),_(e),v(e)]}),b=(e=``)=>({begin:pK(e,/"/),end:pK(/"/,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=pK(e,/\//),n=pK(/\//,e);return{begin:t,end:n,contains:[...S,{scope:`comment`,begin:`#(?!.*${n})`,end:/$/}]}},T={scope:`regexp`,variants:[w(`###`),w(`##`),w(`#`),C]},E={match:pK(/`/,AK,/`/)},D=[E,{className:`variable`,match:/\$\d+/},{className:`variable`,match:`\\$${kK}+`}],O=[{match:/(@|#(un)?)available/,scope:`keyword`,starts:{contains:[{begin:/\(/,end:/\)/,keywords:NK,contains:[...f,h,x]}]}},{scope:`keyword`,match:pK(/@/,hK(...MK),fK(hK(/\(/,/\s+/)))},{scope:`meta`,match:pK(/@/,AK)}],k={match:fK(/\b[A-Z]/),relevance:0,contains:[{className:`type`,match:pK(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,kK,`+`)},{className:`type`,match:jK,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:pK(/\s+&\s+/,fK(jK)),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:pK(AK,/\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:hK(fK(pK(AK,/\s*:/)),fK(pK(AK,/\s+/,AK,/\s*:/))),end:/:/,relevance:0,contains:[{className:`keyword`,match:/\b_\b/},{className:`params`,match:AK}]},...r,...l,...f,h,x,...O,k,j],endsParent:!0,illegal:/["']/},P={match:[/(func|macro)/,/\s+/,hK(E.match,AK,DK)],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+/,DK],className:{1:`keyword`,3:`title`}},L={begin:[/precedencegroup/,/\s+/,jK],className:{1:`keyword`,3:`title`},contains:[k],keywords:[...SK,...xK],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+/,AK,/\s*/],beginScope:{1:`keyword`,3:`title.class`},keywords:c,contains:[M,...l,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:`title.class.inherited`,match:jK},...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 FK=`[A-Za-z$_][0-9A-Za-z$_]*`,IK=`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(`.`),LK=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],RK=`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(`.`),zK=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],BK=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],VK=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],HK=[].concat(BK,RK,zK);function UK(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=FK,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:FK,keyword:IK,literal:LK,built_in:HK,"variable.language":VK},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:{_:[...RK,...zK]}},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([...BK,`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 WK(e){let t=e.regex,n=UK(e),r=FK,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:FK,keyword:IK.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:LK,built_in:HK.concat(i),"variable.language":VK},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 GK(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 KK(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 qK(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 JK(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 YK={arduino:KW,bash:qW,c:JW,cpp:YW,csharp:XW,css:aG,diff:oG,go:sG,graphql:cG,ini:lG,java:hG,javascript:wG,json:TG,kotlin:AG,less:BG,lua:VG,makefile:HG,markdown:UG,objectivec:WG,perl:GG,php:KG,"php-template":qG,plaintext:JG,python:YG,"python-repl":XG,r:ZG,ruby:QG,rust:$G,scss:cK,shell:lK,sql:uK,swift:PK,typescript:WK,vbnet:GK,wasm:KK,xml:qK,yaml:JK},XK=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={},q=e=>{console.error(e)},me=(e,...t)=>{console.log(`WARN: ${e}`,...t)},he=(e,t)=>{pe[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),pe[`${e}/${t}`]=!0)},ge=Error();function _e(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 ve(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw q(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),ge;if(typeof e.beginScope!=`object`||e.beginScope===null)throw q(`beginScope must be object`),ge;_e(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function ye(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw q(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),ge;if(typeof e.endScope!=`object`||e.endScope===null)throw q(`endScope must be object`),ge;_e(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function be(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function xe(e){be(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),ve(e),ye(e)}function Se(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,xe,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 we(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 Ce(e){return e?e.endsWithParent||Ce(e.starts):!1}function we(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Ce(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var Te=`11.11.1`,Ee=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},De=i,Oe=a,ke=Symbol(`nomatch`),Ae=7,je=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||(me(s.replace(`{}`,n[1])),me(`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):(he(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),he(`10.7.0`,`Please use highlight(code, options) instead.
1598
1598
  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]<=Ae&&(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 ke;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!==ke)return e}if(r.type===`illegal`&&a===``)return P+=`
1599
- `,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 q(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let O=Se(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:De(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:De(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:A};throw t}}function b(e){let t={value:De(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 Ee(`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=Oe(l,e)}let E=()=>{k(),he(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function D(){k(),he(`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(q(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)q(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 he(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),he(`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:Oe,addPlugin:L,removePlugin:R}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=Te,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},Me=je({});Me.newInstance=()=>je({}),t.exports=Me,Me.HighlightJS=Me,Me.default=Me}))()).default,ZK={},QK=`hljs-`;function $K(e){let t=XK.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||ZK,a=typeof i.prefix==`string`?i.prefix:QK;if(!t.getLanguage(e))throw Error("Unknown language: `"+e+"` is not registered");t.configure({__emitter:eq,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||ZK).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 eq=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``}},tq={};function nq(e){let t=e||tq,n=t.aliases,r=t.detect||!1,i=t.languages||YK,a=t.plainText,o=t.prefix,s=t.subset,c=`hljs`,l=$K(i);if(n&&l.registerAlias(n),o){let e=o.indexOf(`-`);c=e===-1?o:o.slice(0,e)}return function(e,t){hB(e,`element`,function(e,n,i){if(e.tagName!==`code`||!i||i.type!==`element`||i.tagName!==`pre`)return;let u=rq(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=FW(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 rq(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 iq=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],aq={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...iq,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...iq],h2:[[`className`,`sr-only`]],img:[...iq,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...iq,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...iq],table:[...iq],ul:[...iq,[`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(`.`)},oq={}.hasOwnProperty;function sq(e,t){let n={type:`root`,children:[]},r=cq({schema:t?{...aq,...t}:aq,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function cq(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return lq(e,n);case`doctype`:return uq(e,n);case`element`:return dq(e,n);case`root`:return fq(e,n);case`text`:return pq(e,n);default:}}}function lq(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 bq(r,t),r}}function uq(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return bq(e,t),e}}function dq(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=mq(e,t.children),i=hq(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&&oq.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 bq(o,t),o}function fq(e,t){let n={type:`root`,children:mq(e,t.children)};return bq(n,t),n}function pq(e,t){let n={type:`text`,value:typeof t.value==`string`?t.value:``};return bq(n,t),n}function mq(e,t){let n=[];if(Array.isArray(t)){let r=t,i=-1;for(;++i<r.length;){let t=cq(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function hq(e,t){let n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,a=r&&oq.call(r,n)?r[n]:void 0,o=r&&oq.call(r,`*`)?r[`*`]:void 0,s=t&&typeof t==`object`?t:{},c={},l;for(l in s)if(oq.call(s,l)){let t=s[l],n=gq(e,xq(a,l),l,t);n??=gq(e,xq(o,l),l,t),n!=null&&(c[l]=n)}if(i&&oq.call(i,n)){let e=i[n];for(l in e)oq.call(e,l)&&!oq.call(c,l)&&(c[l]=e[l])}return c}function gq(e,t,n,r){return t?Array.isArray(r)?_q(e,t,n,r):vq(e,t,n,r):void 0}function _q(e,t,n,r){let i=-1,a=[];for(;++i<r.length;){let o=vq(e,t,n,r[i]);(typeof o==`number`||typeof o==`string`)&&a.push(o)}return a}function vq(e,t,n,r){if(!(typeof r!=`boolean`&&typeof r!=`number`&&typeof r!=`string`)&&yq(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 yq(e,t,n){let r=e.schema.protocols&&oq.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 bq(e,t){let n=OF(t);t.data&&(e.data=eB(t.data)),n&&(e.position=n)}function xq(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 Sq(e){return function(t){return sq(t,e)}}function Cq(){return typeof document>`u`?`dark`:(NA[document.documentElement.getAttribute(`data-theme`)||`rose-pine`]?.type??`dark`)===`light`?`default`:`dark`}var wq=(0,J.memo)(function({chart:e}){let t=(0,J.useRef)(null),n=`mermaid-${(0,J.useId)().replace(/[^a-zA-Z0-9]/g,``)}`,[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null);return(0,J.useEffect)(()=>{let r=!1;return(async()=>{try{let a=(await Z(async()=>{let{default:e}=await import(`./mermaid.core-Bnf5T6PT.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:Cq()});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,Y.jsxs)(`div`,{className:`mermaid-error`,children:[(0,Y.jsxs)(`div`,{className:`mermaid-error-note`,children:[`Failed to render diagram: `,r]}),(0,Y.jsx)(`pre`,{children:(0,Y.jsx)(`code`,{children:e})})]}):(0,Y.jsx)(`div`,{className:`mermaid`,ref:t,role:`img`,"aria-label":`Mermaid diagram`,dangerouslySetInnerHTML:a?{__html:a}:void 0})}),Tq=[gW,yW],Eq=[[Sq,{...aq,protocols:{...aq.protocols,href:[...aq.protocols?.href??[],`file`,`file-mention`]},attributes:{...aq.attributes,h1:[...aq.attributes?.h1??[],`id`],h2:[...aq.attributes?.h2??[],`id`],h3:[...aq.attributes?.h3??[],`id`],h4:[...aq.attributes?.h4??[],`id`],h5:[...aq.attributes?.h5??[],`id`],h6:[...aq.attributes?.h6??[],`id`]}}],[nq,{ignoreMissing:!0,plainText:[`mermaid`,`suggestion`]}]];function Dq(e){return e.startsWith(`file://`)||e.startsWith(`file-mention://`)?e:_V(e)}function Oq(e){return e==null||e===!1||e===!0?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(Oq).join(``):(0,J.isValidElement)(e)?Oq(e.props.children):``}function kq(e){return typeof e==`string`?/language-([\w-]+)/.exec(e)?.[1]??null:null}function Aq(e){return e.toLowerCase().trim().replace(/[`*_~[\]()#.!?,:'"]/g,``).replace(/[^\w\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``).slice(0,80)||`section`}function jq({language:e,codeText:t,children:n}){let[r,i]=(0,J.useState)(!1),a=(0,J.useCallback)(()=>{typeof navigator>`u`||!navigator.clipboard||navigator.clipboard.writeText(t).then(()=>{i(!0),window.setTimeout(()=>i(!1),1400)},()=>{})},[t]);return(0,Y.jsxs)(`div`,{className:`md-code-block`,children:[(0,Y.jsxs)(`div`,{className:`md-code-toolbar`,children:[(0,Y.jsx)(`span`,{className:`md-code-lang`,children:e||`code`}),(0,Y.jsx)(`button`,{type:`button`,className:`md-code-copy`,onClick:a,"aria-label":`Copy code`,children:r?`Copied`:`Copy`})]}),(0,Y.jsx)(`pre`,{children:n})]})}function Mq(e){return{pre({children:e}){let t=kq((0,J.isValidElement)(e)?e.props.className:void 0);return t===`mermaid`?(0,Y.jsx)(wq,{chart:Oq(e).replace(/\n$/,``)}):t===`suggestion`?null:(0,Y.jsx)(jq,{language:t,codeText:Oq(e).replace(/\n$/,``),children:e})},a({href:e,children:t}){return typeof e==`string`&&e.startsWith(`file-mention://`)?(0,Y.jsx)(`span`,{className:`mention-file`,title:e.slice(15),children:t}):(0,Y.jsx)(`a`,{href:e,...typeof e==`string`&&/^https?:\/\//.test(e)?{target:`_blank`,rel:`noopener noreferrer`}:{},children:t})},h1:Nq(`h1`,e),h2:Nq(`h2`,e),h3:Nq(`h3`,e),h4:Nq(`h4`,e),h5:Nq(`h5`,e),h6:Nq(`h6`,e)}}function Nq(e,t){return function({children:n,...r}){let i=Oq(n),a=Aq(i),o=t.get(a)??0;return t.set(a,o+1),o>0&&(a=`${a}-${o+1}`),(0,Y.jsxs)(e,{id:a,className:`md-heading`,...r,children:[(0,Y.jsx)(`a`,{href:`#${a}`,className:`md-heading-anchor`,"aria-label":`Link to ${i}`,children:`#`}),n]})}}function Pq({content:e,className:t}){return(0,Y.jsx)(`div`,{className:t,children:(0,Y.jsx)(pV,{remarkPlugins:Tq,rehypePlugins:Eq,urlTransform:Dq,components:(0,J.useMemo)(()=>Mq(new Map),[e]),children:e})})}function Fq(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===`
1600
- `)return null}return null}function Iq(e,t){let n=(0,J.useRef)(null),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(0),[l,u]=(0,J.useState)(0),d=(0,J.useRef)(0),f=(0,J.useRef)(e);(0,J.useEffect)(()=>{f.current=e},[e]);let p=(0,J.useCallback)(e=>{n.current=e,i(e)},[]),m=(0,J.useCallback)(()=>{let e=n.current;if(!e)return;let t=e.selectionStart;d.current=t;let r=f.current,i=Fq(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,J.useEffect)(()=>{m()},[e,m]),(0,J.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=Qe({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,J.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,J.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,J.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 Lq(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 Rq({text:e,ranges:t}){if(!t.length)return(0,Y.jsx)(Y.Fragment,{children:e});let n=[],r=0;return t.forEach(([t,i],a)=>{t>r&&n.push(e.slice(r,t)),n.push((0,Y.jsx)(`mark`,{className:`mention-highlight`,children:e.slice(t,i)},a)),r=i}),r<e.length&&n.push(e.slice(r)),(0,Y.jsx)(Y.Fragment,{children:n})}var zq=e=>{let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t+1)},Bq=e=>{let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)};function Vq({results:e,focusedIndex:t,query:n,cursorTop:r,onSelect:i,onHover:a}){let o=(0,J.useRef)(null);return(0,J.useEffect)(()=>{(o.current?.querySelector(`[data-focused="true"]`))?.scrollIntoView({block:`nearest`})},[t]),e.length===0?null:(0,Y.jsx)(`div`,{className:`mention-dropdown`,ref:o,role:`listbox`,"aria-label":`File suggestions`,style:{top:r},children:e.map((e,r)=>{let o=Bq(e.path),s=Lq(o,n),c=r===t;return(0,Y.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,Y.jsx)(`span`,{className:`mention-icon`,children:(0,Y.jsx)(_N,{size:13})}),(0,Y.jsxs)(`div`,{className:`mention-info`,children:[(0,Y.jsx)(`span`,{className:`mention-name`,children:(0,Y.jsx)(Rq,{text:o,ranges:s})}),(0,Y.jsx)(`span`,{className:`mention-dir`,children:zq(e.path)||`./`})]})]},e.path)})})}function Hq(e){return e.replace(/@([^\s@]+)/g,(e,t)=>`[${t.split(`/`).pop()||t}](file-mention://${t})`)}function Uq({id:e,value:t,onChange:n,placeholder:r,rows:i=3,ariaLabel:a,textareaClassName:o,onSubmitShortcut:s}){let[c,l]=(0,J.useState)(`write`),u=(0,J.useRef)(null),d=(0,J.useRef)(null),f=Iq(t,n),p=(0,J.useRef)(t);(0,J.useEffect)(()=>{p.current=t},[t]),(0,J.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,Y.jsxs)(`div`,{className:`md-field`,children:[(0,Y.jsxs)(`div`,{className:`comment-form-tabs`,role:`tablist`,"aria-label":`Markdown editor mode`,children:[(0,Y.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,Y.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,Y.jsxs)(`div`,{style:{position:`relative`},children:[(0,Y.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,Y.jsx)(Vq,{results:f.results,focusedIndex:f.focusedIndex,query:f.query,cursorTop:f.cursorTop,onSelect:f.onSelect,onHover:f.setFocusedIndex})]}):(0,Y.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,Y.jsx)(Pq,{content:Hq(t)}):(0,Y.jsx)(`span`,{className:`md-field-empty`,children:`Nothing to preview`})})]})}var Wq=J.createContext(void 0);function Gq(e){let t=J.useContext(Wq);if(e===!1&&t===void 0)throw Error(Tx(27));return t}var Kq={...pk,...rk},qq=J.forwardRef(function(e,t){let{render:n,className:r,forceRender:i=!1,...a}=e,{store:o}=Gq(),s=o.useState(`open`),c=o.useState(`nested`),l=o.useState(`mounted`),u=o.useState(`transitionStatus`);return XT(`div`,e,{state:J.useMemo(()=>({open:s,transitionStatus:u}),[s,u]),ref:[o.context.backdropRef,t],stateAttributesMapping:Kq,props:[{role:`presentation`,hidden:!l,style:{userSelect:`none`,WebkitUserSelect:`none`}},a],enabled:i||!c})}),Jq=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),Yq=function(e){return e[e.open=ik.open]=`open`,e[e.closed=ik.closed]=`closed`,e[e.startingStyle=ik.startingStyle]=`startingStyle`,e[e.endingStyle=ik.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),Xq=J.createContext(void 0);function Zq(){let e=J.useContext(Xq);if(e===void 0)throw Error(Tx(26));return e}var Qq={...pk,...rk,nestedDialogOpen(e){return e?{[Yq.nestedDialogOpen]:``}:null}},$q=J.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,...o}=e,{store:s}=Gq(),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`);Zq(),lO({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=XT(`div`,e,{state:J.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){$P.has(e.key)&&e.stopPropagation()},style:{[Jq.nestedDialogs]:h}},o],ref:[t,s.context.popupRef,s.useStateSetter(`popupElement`)],stateAttributesMapping:Qq});return(0,Y.jsx)(hE,{context:u,openInteractionType:_,disabled:!p,closeOnFocusOut:!l,initialFocus:S,returnFocus:r,modal:f!==!1,restoreFocus:`popup`,children:w})}),eJ=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Gq(),a=i.useState(`mounted`),o=i.useState(`modal`);return a||n?(0,Y.jsx)(Xq.Provider,{value:n,children:(0,Y.jsxs)(iE,{ref:t,...r,children:[a&&o===!0&&(0,Y.jsx)(UP,{ref:i.context.internalBackdropRef,inert:Gk(!open)}),e.children]})}):null});function tJ(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}=kP(i);fO(t);let{forceUnmount:d}=pO(i,t,()=>{u()}),f=uS(e=>{let n=tT(e);return n.preventUnmountOnClose=()=>{t.set(`preventUnmountingOnClose`,!0)},n}),p=J.useCallback(()=>{t.setOpen(!1,f($w))},[t,f]);J.useImperativeHandle(r,()=>({unmount:d,close:p}),[d,p]);let m=bO({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[h,g]=J.useState(0),_=h===0,v=WO(m),y=jD(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=PS(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||NS(e,s)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:_});SP(i&&o===!0,s);let{getReferenceProps:b,getFloatingProps:x,getTriggerProps:S}=NO([v,y]);t.useContextCallback(`onNestedDialogOpen`,e=>{g(e+1)}),t.useContextCallback(`onNestedDialogClose`,()=>{g(0)}),J.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(h),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[i,n,h]);let C=J.useMemo(()=>b(l),[b,l]),w=J.useMemo(()=>S(l),[S,l]),T=J.useMemo(()=>x(),[x]);t.useSyncedValues({openMethod:c,activeTriggerProps:C,inactiveTriggerProps:w,popupProps:T,floatingRootContext:m,nestedOpenDialogCount:h})}var nJ={..._O,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)},rJ=class extends iO{constructor(e){super(iJ(e),{popupRef:J.createRef(),backdropRef:J.createRef(),internalBackdropRef:J.createRef(),triggerElements:new mO,onOpenChange:void 0,onOpenChangeComplete:void 0},nJ)}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 iJ(e={}){return{...gO(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:`dialog`,...e}}function aJ(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=Gq(!0),p=!!f,m=kx(()=>l?.store??new rJ({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`);tJ({store:m,actionsRef:c,parentContext:f?.store.context,onOpenChange:i,triggerIdProp:u});let g=J.useMemo(()=>({store:m}),[m]);return(0,Y.jsx)(Wq.Provider,{value:g,children:typeof t==`function`?t({payload:h}):t})}function oJ({open:e,onClose:t,className:n,ariaLabel:r,initialFocus:i,onKeyDown:a,role:o=`dialog`,ariaBusy:s,children:c}){return(0,Y.jsx)(aJ,{open:e,onOpenChange:e=>{e||t()},children:(0,Y.jsxs)(eJ,{children:[(0,Y.jsx)(qq,{className:`ui-modal-backdrop`}),(0,Y.jsx)($q,{className:`ui-modal-popup ${n??``}`,"aria-label":r,initialFocus:i,onKeyDown:a,role:o,"aria-busy":s||void 0,children:c})]})})}function sJ({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,J.useRef)(null);return(0,Y.jsxs)(oJ,{open:e,onClose:()=>{l||f()},className:`confirm-dialog`,ariaLabel:t,initialFocus:p,role:`alertdialog`,ariaBusy:l,children:[(0,Y.jsxs)(`div`,{className:`confirm-dialog-header`,children:[(0,Y.jsx)(`span`,{className:`confirm-dialog-icon confirm-dialog-icon-${s}`,"aria-hidden":`true`,children:c??(0,Y.jsx)(uP,{size:18})}),(0,Y.jsx)(`h2`,{className:`confirm-dialog-title`,children:t})]}),n&&(0,Y.jsx)(`p`,{className:`confirm-dialog-desc`,children:n}),r?.trim()&&(0,Y.jsx)(`blockquote`,{className:`confirm-dialog-detail`,title:r,children:r.trim()}),u&&(0,Y.jsx)(`p`,{className:`confirm-dialog-error`,role:`alert`,children:u}),(0,Y.jsxs)(`div`,{className:`confirm-dialog-footer`,children:[(0,Y.jsx)(`button`,{ref:p,type:`button`,className:`btn btn-sm confirm-dialog-cancel`,onClick:f,disabled:l,children:a}),(0,Y.jsxs)(`button`,{type:`button`,className:`btn btn-sm confirm-dialog-confirm confirm-dialog-confirm-${s}`,onClick:()=>void d(),disabled:l,children:[l&&(0,Y.jsx)(MN,{size:13,className:`spin`,"aria-hidden":`true`}),l?o:i]})]})]})}var cJ=[{value:`approved`,label:`Approve`,description:`The changes look good — the agent can proceed.`,icon:qM,className:`plan-verdict-approve`},{value:`changes-requested`,label:`Request edits`,description:`The agent should address the comments and apply edits.`,icon:RN,className:`plan-verdict-changes`},{value:`rejected`,label:`Reject`,description:`Don't keep building on this — the approach needs rethinking.`,icon:mP,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:zN,className:`plan-verdict-comment-only`}];function lJ({comments:e,totalFileCount:t,viewedFileCount:n,requireViewAllBeforeSend:r,onEditComment:i,onDeleteComment:a,onSend:o,sending:s,agentWaiting:c,waitingAgents:l=[],onCopyComments:u,onCopyMarkdown:d,onCancel:f,showLeftResize:p=!0,initialFocusRef:m}){let{haptic:h,sound:g}=AA(),[_,v]=(0,J.useState)(``),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(!1),[C,w]=(0,J.useState)(null),[T,E]=(0,J.useState)(!1),[D,O]=(0,J.useState)(!1),[k,A]=(0,J.useState)(null),{popoverStyle:j,activePreset:M,applyPreset:N,startResize:P,startLeftResize:F,startCornerResize:I,panelRef:L}=gF(),R=async()=>{u&&(await u(),S(!0),setTimeout(()=>S(!1),2e3))},z=e.length,B=(0,J.useMemo)(()=>[...e].sort((e,t)=>e.createdAt-t.createdAt),[e]),V=Math.max(0,t-n),H=async e=>{if(!y)return`blocked`;A(null),h(`heavy`),g(`send`);let t=y===`comment-only`?`comment-only`:`standard`;try{return await o(y,_,t,e),v(``),b(null),f(),w(null),E(!1),`sent`}catch(e){return e?.kind===`secrets`?(w(e.findings),E(!1),`blocked`):(A(e?.message??`The review could not be sent. Please try again.`),`error`)}},U=async()=>{if(y){if(r&&V>0&&!T){h(`medium`),A(null),O(!0);return}await H(T)}};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`srp`,ref:L,style:j,children:[p&&(0,Y.jsx)(`div`,{className:`srp-resize-handle-left`,onPointerDown:F,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize submit panel width`,tabIndex:0}),(0,Y.jsxs)(`div`,{className:`srp-head`,children:[(0,Y.jsx)(GM,{size:15,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`srp-title`,children:`Submit review`}),(0,Y.jsx)(`div`,{className:`srp-size-presets`,role:`group`,"aria-label":`Panel size`,children:sF.map((e,t)=>(0,Y.jsx)(`button`,{className:`srp-preset-btn`,role:`radio`,"aria-checked":M===t,"aria-pressed":M===t,onClick:()=>N(e),title:`${e.width}×${e.height}px`,children:e.label},e.label))}),z>0&&(0,Y.jsxs)(`span`,{className:`srp-count`,children:[z,` comment`,z===1?``:`s`]})]}),l.length>0&&(0,Y.jsxs)(`div`,{className:`srp-agents`,"aria-label":`Waiting agents`,children:[(0,Y.jsx)(`span`,{className:`srp-agents-label`,children:l.length===1?`Agent waiting`:`${l.length} agents waiting`}),(0,Y.jsx)(`ul`,{className:`srp-agents-list`,children:l.map(e=>(0,Y.jsxs)(`li`,{className:`srp-agent-chip`,title:e.id,children:[(0,Y.jsx)(`span`,{className:`agent-waiting-dot`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`srp-agent-name`,children:e.label||e.model||e.id.slice(0,8)}),e.model&&e.label&&(0,Y.jsx)(`span`,{className:`srp-agent-model`,children:e.model})]},e.id))})]}),(0,Y.jsxs)(`div`,{className:`srp-scroll`,children:[(0,Y.jsx)(`div`,{className:`plan-verdict-options`,role:`radiogroup`,"aria-label":`Verdict`,children:cJ.map((e,t)=>{let n=e.icon,r=y===e.value;return(0,Y.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,ref:t===0?m:void 0,className:`plan-verdict-option ${e.className} ${r?`plan-verdict-option-selected`:``}`,onClick:()=>b(e.value),children:[(0,Y.jsx)(`span`,{className:`plan-verdict-icon`,children:(0,Y.jsx)(n,{size:15,"aria-hidden":`true`})}),(0,Y.jsxs)(`span`,{className:`plan-verdict-text`,children:[(0,Y.jsx)(`span`,{className:`plan-verdict-label`,children:e.label}),(0,Y.jsx)(`span`,{className:`plan-verdict-desc`,children:e.description})]}),(0,Y.jsx)(`span`,{className:`plan-verdict-radio`,"aria-hidden":`true`})]},e.value)})}),z>0?(0,Y.jsx)(`ul`,{className:`srp-list`,"aria-label":`Comments to send`,children:B.map(e=>(0,Y.jsx)(uJ,{comment:e,onEdit:i,onDelete:a},e.id))}):(0,Y.jsx)(`p`,{className:`srp-empty`,children:`No inline comments — your verdict and overall note will be sent on their own.`}),V>0&&(0,Y.jsx)(`div`,{className:`srp-warning`,role:`note`,"data-tone":`muted`,children:(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:V}),` of `,(0,Y.jsx)(`strong`,{children:t}),` file`,t===1?``:`s`,` still unviewed.`,r&&(0,Y.jsx)(Y.Fragment,{children:` Sending will require an extra confirmation.`})]})}),C&&(0,Y.jsxs)(`div`,{className:`srp-warning srp-warning-danger`,role:`alert`,"data-tone":`danger`,children:[(0,Y.jsxs)(`div`,{className:`srp-warning-head`,children:[(0,Y.jsx)(aP,{size:14,"aria-hidden":`true`}),(0,Y.jsxs)(`strong`,{children:[C.length,` possible secret`,C.length===1?``:`s`,` detected`]})]}),(0,Y.jsx)(`ul`,{className:`srp-warning-list`,children:C.map((e,t)=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`code`,{children:e.rule}),`: `,(0,Y.jsx)(`code`,{children:e.snippet}),` `,(0,Y.jsxs)(`span`,{className:`srp-warning-source`,children:[`in `,e.source]})]},t))}),(0,Y.jsxs)(`div`,{className:`srp-warning-actions`,children:[(0,Y.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>w(null),disabled:s,children:`Cancel & edit`}),(0,Y.jsx)(`button`,{className:`btn btn-sm btn-danger`,onClick:()=>{E(!0),w(null),H(!0)},disabled:s,children:`Send anyway`})]})]}),k&&(0,Y.jsxs)(`div`,{className:`srp-warning srp-warning-danger`,role:`alert`,"data-tone":`danger`,children:[(0,Y.jsx)(aP,{size:14,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:k})]}),(0,Y.jsxs)(`div`,{className:`srp-general`,children:[(0,Y.jsxs)(`label`,{className:`srp-general-label`,htmlFor:`srp-general-input`,children:[`Overall comment `,(0,Y.jsx)(`span`,{className:`srp-optional`,children:`(optional · Markdown)`})]}),(0,Y.jsx)(Uq,{id:`srp-general-input`,value:_,onChange:v,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,Y.jsxs)(`div`,{className:`srp-footer`,children:[u&&(0,Y.jsxs)(`div`,{style:{marginRight:`auto`,display:`flex`,gap:6},children:[(0,Y.jsx)(`button`,{className:`btn btn-sm`,onClick:R,disabled:z===0,children:x?`Copied!`:`Copy XML`}),d&&(0,Y.jsx)(`button`,{className:`btn btn-sm`,onClick:async()=>{try{await d(),S(!0),setTimeout(()=>S(!1),1500)}catch{}},disabled:z===0,title:`Copy review as Markdown`,children:`Copy MD`})]}),(0,Y.jsx)(`button`,{className:`btn btn-sm`,onClick:f,disabled:s,children:`Cancel`}),(0,Y.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:U,disabled:!y||s,children:s?`Sending…`:`Send review`})]}),(0,Y.jsx)(`div`,{className:`srp-resize-handle`,onPointerDown:P,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize submit panel`,tabIndex:0}),(0,Y.jsx)(`div`,{className:`srp-resize-handle-corner`,onPointerDown:I,role:`separator`,"aria-label":`Resize submit panel width and height`,tabIndex:0})]}),(0,Y.jsx)(sJ,{open:D,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:k,onConfirm:async()=>{E(!0),await H(!0)!==`error`&&O(!1)},onCancel:()=>{O(!1),E(!1),A(null)}})]})}function uJ({comment:e,onEdit:t,onDelete:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.body),s=(0,J.useRef)(null);(0,J.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,Y.jsxs)(`li`,{className:`srp-item`,children:[(0,Y.jsxs)(`div`,{className:`srp-item-top`,children:[(0,Y.jsxs)(`span`,{className:`srp-item-loc`,children:[(0,Y.jsx)(`span`,{className:`srp-item-file`,children:MA(e.filePath)}),(0,Y.jsx)(`span`,{className:`srp-item-line`,children:c})]}),e.status===`resolved`&&(0,Y.jsx)(`span`,{className:`srp-item-resolved`,children:`resolved`}),(0,Y.jsxs)(`span`,{className:`srp-item-actions`,children:[r?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{className:`srp-icon-btn`,onClick:l,title:`Save edit`,children:(0,Y.jsx)(qM,{size:13,"aria-hidden":`true`})}),(0,Y.jsx)(`button`,{className:`srp-icon-btn`,onClick:()=>{o(e.body),i(!1)},title:`Cancel edit`,children:(0,Y.jsx)(mP,{size:13,"aria-hidden":`true`})})]}):(0,Y.jsx)(`button`,{className:`srp-icon-btn`,onClick:()=>i(!0),title:`Edit comment`,children:(0,Y.jsx)(ZN,{size:13,"aria-hidden":`true`})}),(0,Y.jsx)(`button`,{className:`srp-icon-btn srp-icon-btn-danger`,onClick:()=>n(e.id),title:`Remove from review`,children:(0,Y.jsx)(lP,{size:13,"aria-hidden":`true`})})]})]}),e.lineContent?.trim()&&(0,Y.jsx)(`code`,{className:`srp-item-code`,children:e.lineContent.trim().slice(0,160)}),r?(0,Y.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,Y.jsx)(`p`,{className:`srp-item-body`,children:e.body})]})}function dJ({comments:e,totalFileCount:t,viewedFileCount:n,requireViewAllBeforeSend:r,onEditComment:i,onDeleteComment:a,onSend:o,sending:s,agentWaiting:c,waitingAgents:l=[],onCopyComments:u,onCopyMarkdown:d,open:f,onOpenChange:p}){let[m,h]=(0,J.useState)(!1),g=f??m,_=e=>{h(e),p?.(e)},{handleOpenChange:v}=gF(),y=e.length,b=(0,J.useRef)(null);return(0,Y.jsx)(iF,{open:g,onOpenChange:(e,t)=>v(e,t,_),ariaLabel:`Submit your review to the agent`,className:`send-review-popover`,initialFocus:b,trigger:(0,Y.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`:y>0?`Send review with ${y} comment${y===1?``:`s`}`:`Send review to agent`,children:[c&&(0,Y.jsx)(`span`,{className:`agent-waiting-dot`,"aria-hidden":`true`}),(0,Y.jsx)(GM,{size:14,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`btn-label`,children:s?`Sending…`:l.length>1?`Send (${l.length})`:y>0?`Send (${y})`:`Send review`})]}),children:(0,Y.jsx)(lJ,{comments:e,totalFileCount:t,viewedFileCount:n,requireViewAllBeforeSend:r,onEditComment:i,onDeleteComment:a,onSend:o,sending:s,agentWaiting:c,waitingAgents:l,onCopyComments:u,onCopyMarkdown:d,onCancel:()=>_(!1),initialFocusRef:b})})}function fJ({lastRound:e}){let{data:t=[],isFetching:n,refetch:r}=Qe({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,Y.jsxs)(iF,{side:`bottom`,align:`start`,ariaLabel:`Review history`,className:`review-history-popup`,onOpenChange:e=>{e&&r()},trigger:(0,Y.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,Y.jsx)(EN,{size:12,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`toolbar-last-send-dot`,"aria-hidden":`true`}),`Round `,e]}),children:[(0,Y.jsxs)(`div`,{className:`review-history-header`,children:[(0,Y.jsx)(EN,{size:14}),(0,Y.jsx)(`strong`,{children:`Review history`}),n&&(0,Y.jsx)(`span`,{className:`review-history-loading`,children:`Loading…`})]}),t.length===0?(0,Y.jsx)(`p`,{className:`review-history-empty`,children:`No handoffs recorded yet (history is in-memory).`}):(0,Y.jsx)(`ul`,{className:`review-history-list`,children:t.map(e=>(0,Y.jsxs)(`li`,{className:`review-history-item`,children:[(0,Y.jsxs)(`div`,{className:`review-history-item-top`,children:[(0,Y.jsxs)(`span`,{className:`review-history-round`,children:[`Round `,e.round]}),e.decision&&(0,Y.jsx)(`span`,{className:`review-history-decision`,"data-decision":e.decision,children:e.decision}),e.mode&&e.mode!==`standard`&&(0,Y.jsx)(`span`,{className:`review-history-mode`,children:e.mode}),(0,Y.jsx)(`span`,{className:`review-history-time`,title:new Date(e.sentAt).toLocaleString(),children:jA(e.sentAt)})]}),(0,Y.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,Y.jsxs)(`div`,{className:`review-history-files`,children:[e.filePaths.slice(0,6).map(e=>(0,Y.jsxs)(`span`,{className:`review-history-file`,title:e,children:[(0,Y.jsx)(hN,{size:10}),e.split(`/`).pop()]},e)),e.filePaths.length>6&&(0,Y.jsxs)(`span`,{className:`review-history-file-more`,children:[`+`,e.filePaths.length-6]})]})]},e.round))})]})}var pJ=(0,J.memo)(function({size:e=22,className:t,decorative:n=!0}){return(0,Y.jsx)(`img`,{className:t??`brand-mark`,src:`/favicon.svg`,alt:n?``:`diffing`,width:e,height:e,draggable:!1})});function mJ(e){let t=J.useRef(!0);t.current&&(t.current=!1,e())}function hJ({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=J.useRef(e!==void 0),[a,o]=J.useState(t);return[i?e:a,J.useCallback(e=>{i||o(e)},[])]}var gJ=J.createContext(null),_J=J.createContext(null);function vJ(){let e=J.useContext(gJ);if(e===null)throw Error(Tx(60));return e}function yJ(){let e=J.useContext(_J);if(e===null)throw Error(Tx(61));return e}var bJ=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}({}),xJ={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},SJ={valid(e){return e===null?null:e?{[bJ.valid]:``}:{[bJ.invalid]:``}}},CJ=J.createContext({invalid:void 0,name:void 0,validityData:{state:xJ,errors:[],error:``,value:``,initialValue:null},setValidityData:Pw,disabled:void 0,touched:!1,setTouched:Pw,dirty:!1,setDirty:Pw,filled:!1,setFilled:Pw,focused:!1,setFocused:Pw,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=Iw)=>e,getInputValidationProps:(e=Iw)=>e,inputRef:{current:null},commit:async()=>{}}});function wJ(e=!0){let t=J.useContext(CJ);if(t.setValidityData===Pw&&!e)throw Error(Tx(28));return t}var TJ=J.createContext({controlId:void 0,setControlId:Pw,labelId:void 0,setLabelId:Pw,messageIds:[],setMessageIds:Pw,getDescriptionProps:e=>e});function EJ(){return J.useContext(TJ)}function DJ(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,setControlId:a}=EJ(),o=mk(t);return wx(()=>{if(!(!n&&!t||a===Pw)){if(n){let e=r?.current;Bx(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 OJ=(e,t)=>Object.is(e,t);function kJ(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function AJ(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:kJ(e,t,n))}function jJ(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:kJ(e,t,n))}function MJ(e,t,n){return e.filter(e=>!kJ(e,t,n))}function NJ(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function PJ(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function FJ(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 NJ(e)}function IJ(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?NJ(e.value):NJ(e)}function LJ(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]??FJ(e,n);if(Array.isArray(t)){let r=PJ(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:FJ(e,n)}if(typeof e!=`object`){let t=r.find(t=>t&&t.value===e);return t&&t.label!=null?t.label:FJ(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 FJ(e,n)}function RJ(e,t){return!Array.isArray(e)||e.length===0?``:e.map(e=>FJ(e,t)).join(`, `)}var zJ={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=>kJ(e,n,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:kJ(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?``:IJ(n,r)})},BJ=J.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Pw,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function VJ(){return J.useContext(BJ)}function HJ(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function UJ(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=VJ(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=wJ(),f=uS(e.getValue);wx(()=>{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]),wx(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:HJ(u,c),validate(){let e=n;e===void 0&&(e=f()),l.current=!0,ec.flushSync(()=>o(e))}})},[o,a,t,s,f,r,c,l,i,u,n]),wx(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}function WJ(e,t){let n=J.useRef(e),r=uS(t);wx(()=>{n.current!==e&&r(n.current)},[e,r]),wx(()=>{n.current=e},[e])}function GJ(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=OJ,highlightItemOnHover:x=!0,children:S}=e,{clearErrors:C}=VJ(),{setDirty:w,shouldValidateOnChange:T,validityData:E,setFilled:D,name:O,disabled:k,validation:A}=wJ(),{controlId:j}=EJ(),M=DJ({id:t}),N=k||l,P=O??c,[F,I]=hJ({controlled:n,default:_?r??Fw:r,name:`Select`,state:`value`}),[L,R]=hJ({controlled:a,default:o,name:`Select`,state:`open`}),z=J.useRef([]),B=J.useRef([]),V=J.useRef(null),H=J.useRef(null),U=J.useRef(0),W=J.useRef(null),ee=J.useRef([]),te=J.useRef(!1),ne=J.useRef(!1),re=J.useRef(null),ie=J.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ae=J.useRef(!1),{mounted:oe,setMounted:G,transitionStatus:se}=sO(L),K=kx(()=>new rO({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=eO(K,zJ.activeIndex),le=eO(K,zJ.selectedIndex),ue=eO(K,zJ.triggerElement),de=eO(K,zJ.positionerElement),fe=J.useMemo(()=>_&&Array.isArray(F)&&F.length===0?``:IJ(F,y),[_,F,y]),pe=oS(K.state.triggerElement);UJ({id:M,commit:A.commit,value:F,controlRef:pe,name:P,getValue:()=>F});let q=J.useRef(F);wx(()=>{F!==q.current&&K.set(`forceMount`,!0)},[K,F]),wx(()=>{D(F!==null)},[F,D]),wx(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=jJ(e,n,b);K.set(`selectedIndex`,r===-1?null:r);return}let t=jJ(e,F,b);K.set(`selectedIndex`,t===-1?null:t)},[_,L,F,ee,b,K]),WJ(F,()=>{C(P),w(F!==E.initialValue),T()?A.commit(F):A.commit(F,!0)});let me=uS((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`)})}}),he=uS(()=>{G(!1),K.set(`activeIndex`,null),h?.(!1)});lO({enabled:!p,open:L,ref:V,onComplete(){L||he()}}),J.useImperativeHandle(p,()=>({unmount:he}),[he]);let ge=uS((e,t)=>{i?.(e,t),!t.isCanceled&&I(e)}),_e=uS(()=>{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)}),ve=vO({open:L,onOpenChange:me,elements:{reference:ue,floating:de}}),{getReferenceProps:ye,getFloatingProps:be,getItemProps:xe}=NO([gE(ve,{enabled:!u&&!N,event:`mousedown`}),jD(ve,{bubbles:!1}),HO(ve,{enabled:!u&&!N,listRef:z,activeIndex:ce,selectedIndex:le,disabledIndices:Fw,onNavigate(e){e===null&&!L||K.set(`activeIndex`,e)},focusItemOnHover:!1}),GO(ve,{enabled:!u&&!N&&(L||!_),listRef:B,activeIndex:ce,selectedIndex:le,onMatch(e){L?K.set(`activeIndex`,e):ge(ee.current[e],tT(`none`))},onTypingChange(e){te.current=e}})]);mJ(()=>{K.update({popupProps:be(),triggerProps:ye()})}),wx(()=>{K.update({id:M,modal:f,multiple:_,value:F,open:L,mounted:oe,transitionStatus:se,popupProps:be(),triggerProps:ye(),items:g,itemToStringLabel:v,itemToStringValue:y,isItemEqualToValue:b})},[K,M,f,_,F,L,oe,se,be,ye,g,v,y,b]);let Se=J.useMemo(()=>({store:K,name:P,required:d,disabled:N,readOnly:u,multiple:_,itemToStringLabel:v,itemToStringValue:y,highlightItemOnHover:x,setValue:ge,setOpen:me,listRef:z,popupRef:V,scrollHandlerRef:H,handleScrollArrowVisibility:_e,scrollArrowsMountedCountRef:U,getItemProps:xe,events:ve.context.events,valueRef:W,valuesRef:ee,labelsRef:B,typingRef:te,selectionRef:ie,selectedItemTextRef:re,validation:A,onOpenChangeComplete:h,keyboardActiveRef:ne,alignItemWithTriggerActiveRef:ae,initialValueRef:q}),[K,P,d,N,u,_,v,y,x,ge,me,xe,ve.context.events,A,h,_e]),Ce=sT(m,A.inputRef),we=_&&Array.isArray(F)&&F.length>0,Te=J.useMemo(()=>!_||!Array.isArray(F)||!P?null:F.map(e=>{let t=IJ(e,y);return(0,Y.jsx)(`input`,{type:`hidden`,name:P,value:t},t)}),[_,F,P,y]);return(0,Y.jsx)(gJ.Provider,{value:Se,children:(0,Y.jsxs)(_J.Provider,{value:ve,children:[S,(0,Y.jsx)(`input`,{...A.getInputValidationProps({onFocus(){K.state.triggerElement?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.value,n=tT(Hw,e.nativeEvent);function r(){if(_)return;let e=ee.current.find(e=>IJ(e,y).toLowerCase()===t.toLowerCase());e!=null&&(w(e!==E.initialValue),ge(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&&!we,readOnly:u,ref:Ce,style:pT,tabIndex:-1,"aria-hidden":!0}),Te]})})}function KJ(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 qJ=2,JJ={...fk,...SJ,value:()=>null},YJ=J.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}=wJ(),{labelId:f}=EJ(),{store:p,setOpen:m,selectionRef:h,validation:g,readOnly:_,alignItemWithTriggerActiveRef:v,disabled:y,keyboardActiveRef:b}=vJ(),x=d||y||i,S=eO(p,zJ.open),C=eO(p,zJ.value),w=eO(p,zJ.triggerProps),T=eO(p,zJ.positionerElement),E=eO(p,zJ.listElement),D=eO(p,zJ.serializedValue),O=oS(T),k=J.useRef(null),A=Px(),j=Px(),{getButtonProps:M,buttonRef:N}=FP({disabled:x,native:a}),P=sT(t,k,N,uS(e=>{p.set(`triggerElement`,e)})),F=Px(),I=Px();J.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=J.useMemo(()=>E?.id??VS(T)?.id,[E,T]),R=zT(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,tT(Jw,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=vT(e.currentTarget);function n(e){if(!k.current)return;let t=e.target;if(NS(k.current,t)||NS(O.current,t)||t===k.current)return;let n=KJ(k.current);e.clientX>=n.left-qJ&&e.clientX<=n.right+qJ&&e.clientY>=n.top-qJ&&e.clientY<=n.bottom+qJ||m(!1,tT(Zw,e))}j.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},g.getValidationProps,o,M);R.role=`combobox`;let z=J.useMemo(()=>({...u,open:S,disabled:x,value:C,readOnly:_,placeholder:!D}),[u,S,x,C,_,D]);return XT(`button`,e,{ref:[t,k],state:z,stateAttributesMapping:JJ,props:R})}),XJ={value:()=>null},ZJ=J.forwardRef(function(e,t){let{className:n,render:r,children:i,...a}=e,{store:o,valueRef:s}=vJ(),c=eO(o,zJ.value),l=eO(o,zJ.items),u=eO(o,zJ.itemToStringLabel),d=eO(o,zJ.serializedValue),f=J.useMemo(()=>({value:c,placeholder:!d}),[c,d]),p=typeof i==`function`?i(c):i??(Array.isArray(c)?RJ(c,u):LJ(c,l,u));return XT(`span`,e,{state:f,ref:[t,s],props:[{children:p},a],stateAttributesMapping:XJ})}),QJ=J.forwardRef(function(e,t){let{className:n,render:r,...i}=e,{store:a}=vJ(),o=eO(a,zJ.open);return XT(`span`,e,{state:J.useMemo(()=>({open:o}),[o]),ref:t,props:[{"aria-hidden":!0,children:`▼`},i],stateAttributesMapping:dk})}),$J=J.createContext(void 0),eY=J.forwardRef(function(e,t){let{store:n}=vJ(),r=eO(n,zJ.mounted),i=eO(n,zJ.forceMount);return r||i?(0,Y.jsx)($J.Provider,{value:!0,children:(0,Y.jsx)(iE,{ref:t,...e})}):null}),tY=J.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function nY(){return J.useContext(tY)}function rY(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=uS(i),o=J.useRef(0),s=kx(aY).current,c=kx(iY).current,[l,u]=J.useState(0),d=J.useRef(l),f=uS((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=uS(e=>{c.delete(e),d.current+=1,u(d.current)}),m=J.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(oY).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);wx(()=>{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]),wx(()=>{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]),wx(()=>()=>{n.current=[]},[n]),wx(()=>()=>{r&&(r.current=[])},[r]);let h=uS(e=>(s.add(e),()=>{s.delete(e)}));wx(()=>{s.forEach(e=>e(m))},[s,m]);let g=J.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,Y.jsx)(tY.Provider,{value:g,children:t})}function iY(){return new Map}function aY(){return new Set}function oY(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 sY=J.createContext(void 0);function cY(){let e=J.useContext(sY);if(!e)throw Error(Tx(59));return e}function lY(e,t){e&&Object.assign(e.style,t)}var uY={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},dY={position:`fixed`},fY=J.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=zw,..._}=e,{store:v,listRef:y,labelsRef:b,alignItemWithTriggerActiveRef:x,selectedItemTextRef:S,valuesRef:C,initialValueRef:w,popupRef:T,setValue:E}=vJ(),D=yJ(),O=eO(v,zJ.open),k=eO(v,zJ.mounted),A=eO(v,zJ.modal),j=eO(v,zJ.value),M=eO(v,zJ.touchModality),N=eO(v,zJ.positionerElement),P=eO(v,zJ.triggerElement),F=eO(v,zJ.isItemEqualToValue),I=J.useRef(null),L=J.useRef(null),[R,z]=J.useState(h),B=k&&R&&!M;!k&&R!==h&&z(h),wx(()=>{k||(zJ.scrollUpArrowVisible(v.state)&&v.set(`scrollUpArrowVisible`,!1),zJ.scrollDownArrowVisible(v.state)&&v.set(`scrollDownArrowVisible`,!1))},[v,k]),J.useImperativeHandle(x,()=>B),SP((B||A)&&O&&!M,P);let V=Nk({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?dY:V.positionerStyles,W=J.useMemo(()=>{let e={};return O||(e.pointerEvents=`none`),{role:`presentation`,hidden:!k,style:{...U,...e}}},[O,k,U]),ee=J.useMemo(()=>({open:O,side:H,align:V.align,anchorHidden:V.anchorHidden}),[O,H,V.align,V.anchorHidden]),te=XT(`div`,e,{ref:[t,uS(e=>{v.set(`positionerElement`,e)})],state:ee,stateAttributesMapping:pk,props:[W,_]}),ne=J.useRef(0),re=uS(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=tT(Hw);if(t!==0&&!v.state.multiple&&j!==null&&jJ(C.current,j,F)===-1){let e=w.current,t=e!=null&&AJ(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=>AJ(C.current,e,F));(e.length!==j.length||e.some(e=>!AJ(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:``};lY(N,e),lY(T.current,e)}}),ie=J.useMemo(()=>({...V,side:H,alignItemWithTriggerActive:B,setControlledAlignItemWithTrigger:z,scrollUpArrowRef:I,scrollDownArrowRef:L}),[V,H,B,z]);return(0,Y.jsx)(rY,{elementsRef:y,labelsRef:b,onMapChange:re,children:(0,Y.jsxs)(sY.Provider,{value:ie,children:[k&&A&&(0,Y.jsx)(UP,{inert:Gk(!O),cutout:P}),te]})})});function pY(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 mY=`base-ui-disable-scrollbar`,hY={className:mY,element:(0,Y.jsx)(`style`,{href:mY,precedence:`base-ui:low`,children:`.${mY}{scrollbar-width:none}.${mY}::-webkit-scrollbar{display:none}`})},gY={...pk,...rk},_Y=J.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}=vJ(),{side:h,align:g,alignItemWithTriggerActive:_,setControlledAlignItemWithTrigger:v,scrollDownArrowRef:y,scrollUpArrowRef:b}=cY(),x=tF(!0)!=null,S=yJ(),C=Px(),w=eO(a,zJ.id),T=eO(a,zJ.open),E=eO(a,zJ.mounted),D=eO(a,zJ.popupProps),O=eO(a,zJ.transitionStatus),k=eO(a,zJ.triggerElement),A=eO(a,zJ.positionerElement),j=eO(a,zJ.listElement),M=J.useRef(0),N=J.useRef(!1),P=J.useRef(0),F=J.useRef(!1),I=J.useRef({}),L=_T(),R=uS(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=vT(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()});J.useImperativeHandle(m,()=>R,[R]),lO({open:T,ref:o,onComplete(){T&&s?.(!0)}});let z=J.useMemo(()=>({open:T,transitionStatus:O,side:h,align:g}),[T,O,h,g]);wx(()=>{!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]),wx(()=>{E||_||(F.current=!1,N.current=!1,M.current=0,P.current=0,lY(A,I.current))},[E,_,A,o]),wx(()=>{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=vT(k),i=Lx(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&&_S;if(H||U){F.current=!0,lY(A,I.current),ec.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]),J.useEffect(()=>{if(!_||!A||!E)return;let e=Lx(A);function t(e){c(!1,tT(eT,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&&$P.has(e.key)&&e.stopPropagation()},onMouseMove(){d.current=!1},onPointerLeave(e){if(pY(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%`}:uY}},V=XT(`div`,e,{ref:[t,o],state:z,stateAttributesMapping:gY,props:[D,B,Fk(O),{className:!j&&_?hY.className:void 0},i]});return(0,Y.jsxs)(J.Fragment,{children:[hY.element,(0,Y.jsx)(hE,{context:S,modal:!1,disabled:!E,restoreFocus:!0,children:V})]})}),vY=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function yY(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}=nY(),f=J.useRef(-1),[p,m]=J.useState(a??(i===vY.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=J.useRef(null),g=J.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 wx(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),wx(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),J.useMemo(()=>({ref:g,index:p}),[p,g])}var bY=J.createContext(void 0);function xY(){let e=J.useContext(bY);if(!e)throw Error(Tx(57));return e}var SY=J.memo(J.forwardRef(function(e,t){let{render:n,className:r,value:i=null,label:a,disabled:o=!1,nativeButton:s=!1,...c}=e,l=J.useRef(null),u=yY({label:a,textRef:l,indexGuessBehavior:vY.GuessFromOrder}),{store:d,getItemProps:f,setOpen:p,setValue:m,selectionRef:h,typingRef:g,valuesRef:_,keyboardActiveRef:v,multiple:y,highlightItemOnHover:b}=vJ(),x=Px(),S=eO(d,zJ.isActive,u.index),C=eO(d,zJ.isSelected,u.index,i),w=eO(d,zJ.isSelectedByFocus,u.index),T=eO(d,zJ.isItemEqualToValue),E=u.index,D=E!==-1,O=J.useRef(null),k=oS(E);wx(()=>{if(!D)return;let e=_.current;return e[E]=i,()=>{delete e[E]}},[D,E,i,_]),wx(()=>{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&&kJ(t,i,T)&&d.set(`selectedIndex`,E)},[D,E,y,T,d,i]);let A=J.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=J.useRef(null),N=J.useRef(`mouse`),P=J.useRef(!1),{getButtonProps:F,buttonRef:I}=FP({disabled:o,focusableWhenDisabled:!0,native:s});function L(e){let t=d.state.value;if(y){let n=Array.isArray(t)?t:[];m(C?MJ(n,i,T):[...n,i],tT(qw,e))}else m(i,tT(qw,e)),p(!1,tT(qw,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||pY(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=XT(`div`,e,{ref:[I,t,u.ref,O],state:A,props:[j,R,c,F]}),B=J.useMemo(()=>({selected:C,indexRef:k,textRef:l,selectedByFocus:w,hasRegistered:D}),[C,k,l,w,D]);return(0,Y.jsx)(bY.Provider,{value:B,children:z})})),CY=J.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=xY();return n||r?(0,Y.jsx)(wY,{...e,ref:t}):null}),wY=J.memo(J.forwardRef((e,t)=>{let{render:n,className:r,keepMounted:i,...a}=e,{selected:o}=xY(),s=J.useRef(null),{transitionStatus:c,setMounted:l}=sO(o),u=J.useMemo(()=>({selected:o,transitionStatus:c}),[o,c]),d=XT(`span`,e,{ref:[t,s],state:u,props:[{"aria-hidden":!0,children:`✔️`},a],stateAttributesMapping:rk});return lO({open:o,ref:s,onComplete(){o||l(!1)}}),d})),TY=J.memo(J.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=xY(),{selectedItemTextRef:o}=vJ(),{className:s,render:c,...l}=e;return XT(`div`,e,{ref:[J.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 EY({value:e,onValueChange:t,options:n,ariaLabel:r,className:i}){return(0,Y.jsxs)(GJ,{value:e,onValueChange:e=>t(e),modal:!1,children:[(0,Y.jsxs)(YJ,{className:`ui-select-trigger ${i??``}`,"aria-label":r,children:[(0,Y.jsx)(ZJ,{children:e=>n.find(t=>t.value===e)?.label??e}),(0,Y.jsx)(QJ,{className:`ui-select-icon`,children:(0,Y.jsx)(QM,{size:12})})]}),(0,Y.jsx)(eY,{children:(0,Y.jsx)(fY,{className:`ui-select-positioner`,sideOffset:4,align:`end`,side:`bottom`,alignItemWithTrigger:!1,children:(0,Y.jsx)(_Y,{className:`ui-select-popup`,children:n.map(e=>(0,Y.jsxs)(SY,{value:e.value,className:`ui-select-item`,children:[(0,Y.jsx)(TY,{children:e.label}),(0,Y.jsx)(CY,{className:`ui-select-indicator`,children:(0,Y.jsx)(qM,{size:13})})]},e.value))})})})]})}var DY=[{value:`word`,label:`Word`},{value:`word-alt`,label:`Word (alt)`},{value:`char`,label:`Character`},{value:`none`,label:`None`}],OY=[{value:`classic`,label:`Classic (+/−)`},{value:`bars`,label:`Bars`},{value:`none`,label:`None`}],kY=[{value:`line-info`,label:`Line info + context`},{value:`line-info-basic`,label:`Line info`},{value:`metadata`,label:`Metadata only`},{value:`simple`,label:`Simple`}],AY=[{value:`both`,label:`Both`},{value:`line`,label:`Line only`},{value:`number`,label:`Number only`},{value:`disabled`,label:`Disabled`}],jY=[11,12,13,14,15,16].map(e=>({value:String(e),label:`${e}px`})),MY=[2,4,8].map(e=>({value:String(e),label:String(e)})),NY=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`}],PY=[{value:`0`,label:`Disabled`},{value:`100`,label:`100 lines`},{value:`200`,label:`200 lines`},{value:`400`,label:`400 lines`},{value:`800`,label:`800 lines`}],FY=[{value:``,label:`Default`},{value:`chrome`,label:`Chrome`},{value:`firefox`,label:`Firefox`},{value:`edge`,label:`Edge`},{value:`brave`,label:`Brave`}],IY=[{value:`default`,label:`Default / System`},{value:`vscode`,label:`VS Code`},{value:`zed`,label:`Zed`},{value:`vim`,label:`Vim`},{value:`neovim`,label:`Neovim`}];function LY({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,editDiagnostics:x=!1,ignoreAllSpace:S=!1,onDiffStyleChange:C,onDiffOptionsChange:w,onDefaultTabSizeChange:T,onBrowserChange:E,onOpenThemeModal:D,onEditorIDEChange:O,onLineDiffTypeChange:k,onLineWrapChange:A,onDiffIndicatorsChange:j,onShowLineNumbersChange:M,onHunkSeparatorsChange:N,onLineHoverHighlightChange:P,onFontSizeChange:F,onHapticsChange:I,onSoundsChange:L,onDensityChange:R,onAutoCollapseLineThresholdChange:z,onRequireViewAllBeforeSendChange:B,onShowStatusBarChange:V,onIgnoreSpaceChange:H,onIgnoreAllSpaceChange:U,onEditDiagnosticsChange:W,onOpenUiFontModal:ee,onOpenMonoFontModal:te,showSource:ne=!0,showWhitespace:re=!0,showExternalTools:ie=!0,showSendPolicy:ae=!0}){let[oe,G]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&(e.key===`,`||e.code===`Comma`)&&(e.preventDefault(),G(e=>!e))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]),(0,Y.jsx)(iF,{open:oe,onOpenChange:G,ariaLabel:`Settings`,className:`settings-popover`,trigger:(0,Y.jsxs)(`button`,{className:`btn btn-sm settings-btn ${oe?`btn-active`:``}`,title:`Settings (⌘,)`,"aria-label":`Settings`,children:[(0,Y.jsx)(iP,{size:14}),(0,Y.jsx)(`span`,{className:`btn-label`,children:`Settings`})]}),children:(0,Y.jsxs)(`div`,{className:`popover-scroll settings-panel`,children:[ne&&t&&w&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`Source`}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:t.staged,onChange:e=>w({...t,staged:e.target.checked})}),`Show staged`]}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:t.untracked,onChange:e=>w({...t,untracked:e.target.checked})}),`Show untracked`]})]}),(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`Display`}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Inline diff`}),(0,Y.jsx)(EY,{value:a,onValueChange:e=>k(e),options:DY,ariaLabel:`Inline diff style`})]}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>A(e.target.checked)}),`Wrap long lines`]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Diff indicators`}),(0,Y.jsx)(EY,{value:s,onValueChange:e=>j(e),options:OY,ariaLabel:`Diff indicators`})]}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>M(e.target.checked)}),`Show line numbers`]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Hunk separator`}),(0,Y.jsx)(EY,{value:l,onValueChange:e=>N(e),options:kY,ariaLabel:`Hunk separator style`})]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Hover highlight`}),(0,Y.jsx)(EY,{value:u,onValueChange:e=>P(e),options:AY,ariaLabel:`Hover highlight`})]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Font size`}),(0,Y.jsx)(EY,{value:String(d),onValueChange:e=>F(Number(e)),options:jY,ariaLabel:`Font size`})]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Default tab size`}),(0,Y.jsx)(EY,{value:String(n),onValueChange:e=>T(Number(e)),options:MY,ariaLabel:`Default tab size`})]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`UI font`}),(0,Y.jsxs)(`button`,{className:`btn btn-sm settings-btn`,onClick:()=>{G(!1),ee()},title:m??`Default (Geist Mono)`,children:[(0,Y.jsx)(dP,{size:13}),(0,Y.jsx)(`span`,{className:`settings-value-label`,children:m??`Default…`})]})]}),(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`Comfort`}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Density`}),(0,Y.jsx)(EY,{value:g,onValueChange:e=>R(e),options:NY,ariaLabel:`UI density`})]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Auto-collapse huge files`}),(0,Y.jsx)(EY,{value:String(_),onValueChange:e=>z(Number(e)),options:PY,ariaLabel:`Auto-collapse line threshold`})]}),ae&&B&&(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:v,onChange:e=>B(e.target.checked)}),(0,Y.jsxs)(`span`,{className:`settings-icon-label`,children:[(0,Y.jsx)(oP,{size:12}),` Warn before sending if files are unviewed`]})]}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>V(e.target.checked)}),(0,Y.jsxs)(`span`,{className:`settings-icon-label`,children:[(0,Y.jsx)(kN,{size:12}),` Show status bar`]})]}),re&&H&&U&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`Whitespace`}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>H(e.target.checked)}),`Ignore space-change (-b)`]}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:S,onChange:e=>U(e.target.checked)}),`Ignore all space (-w)`]})]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Code font`}),(0,Y.jsxs)(`button`,{className:`btn btn-sm settings-btn`,onClick:()=>{G(!1),te()},title:h??`Default (JetBrains Mono)`,children:[(0,Y.jsx)(dP,{size:13}),(0,Y.jsx)(`span`,{className:`settings-value-label`,children:h??`Default…`})]})]}),ie&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`External tools`}),E&&(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Browser`}),(0,Y.jsx)(EY,{value:r||``,onValueChange:E,options:FY,ariaLabel:`Browser`})]}),O&&(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Preferred IDE`}),(0,Y.jsx)(EY,{value:i||`default`,onValueChange:O,options:IY,ariaLabel:`Preferred IDE`})]})]}),(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`Appearance`}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Diff style`}),(0,Y.jsx)(EY,{value:e,onValueChange:e=>C(e),options:[{value:`split`,label:`Split`},{value:`unified`,label:`Unified`}],ariaLabel:`Diff style`})]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Theme`}),(0,Y.jsxs)(`button`,{className:`btn btn-sm settings-btn`,onClick:()=>{G(!1),D()},children:[(0,Y.jsx)(KN,{size:14}),` Switch Theme…`]})]}),(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`Feedback`}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>I(e.target.checked)}),`Haptic feedback`]}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>L(e.target.checked)}),`Sound effects`]}),(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`Editing`}),(0,Y.jsxs)(`label`,{className:`settings-item`,title:`Inline diagnostics (whitespace, missing final newline, tabs) while editing a file in place. Off by default for a noise-free review.`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>W(e.target.checked)}),`Edit diagnostics`]})]})})}function RY({commentCount:e,onResolveAllOpen:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.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,Y.jsx)(KM,{size:14}),(0,Y.jsx)(`span`,{className:`btn-label`,children:`Resolve all`})]}),(0,Y.jsx)(sJ,{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,Y.jsx)(KM,{size:18}),busy:i,error:o,onConfirm:l,onCancel:c})]})}var zY=(0,J.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,editDiagnostics:L,onDiffStyleChange:R,onDiffOptionsChange:z,onDefaultTabSizeChange:B,onBrowserChange:V,onOpenThemeModal:H,onEditorIDEChange:U,onLineDiffTypeChange:W,onLineWrapChange:ee,onDiffIndicatorsChange:te,onShowLineNumbersChange:ne,onHunkSeparatorsChange:re,onLineHoverHighlightChange:ie,onFontSizeChange:ae,onHapticsChange:oe,onSoundsChange:G,onDensityChange:se,onAutoCollapseLineThresholdChange:K,onRequireViewAllBeforeSendChange:ce,onShowStatusBarChange:le,onIgnoreSpaceChange:ue,onIgnoreAllSpaceChange:de,onEditDiagnosticsChange:fe,onResolveAllOpen:pe,onOpenUiFontModal:q,onOpenMonoFontModal:me,onOpenSearch:he,onCopyComments:ge,onCopyMarkdown:_e,onSendToAgent:ve,agentWaiting:ye,waitingAgents:be=[],sending:xe,comments:Se,viewedFileCount:Ce,onEditComment:we,onDeleteComment:Te,sidebarCollapsed:Ee,onToggleSidebar:De,zenMode:Oe,onToggleZen:ke,sendReviewOpen:Ae,onSendReviewOpenChange:je}){let Me=v?`${y} commit${y===1?``:`s`}`:n===r?`${n} file${n===1?``:`s`}`:`${n}/${r} files`;return(0,Y.jsxs)(`header`,{className:`toolbar diff-app-toolbar`,role:`banner`,children:[(0,Y.jsxs)(`div`,{className:`toolbar-left`,children:[De&&(0,Y.jsx)(`button`,{className:`toolbar-mobile-toggle`,onClick:De,"aria-label":Ee?`Open file tree`:`Close file tree`,"aria-expanded":!Ee,title:Ee?`Open sidebar · b`:`Close sidebar · b`,children:(0,Y.jsx)(FN,{size:18})}),(0,Y.jsxs)(`div`,{className:`toolbar-brand`,children:[(0,Y.jsx)(pJ,{size:20,className:`toolbar-brand-mark`}),(0,Y.jsxs)(`div`,{className:`toolbar-brand-text`,children:[(0,Y.jsx)(`h1`,{className:`toolbar-title`,children:e||`diffing`}),t&&(0,Y.jsxs)(`span`,{className:`toolbar-branch-inline`,title:t,children:[(0,Y.jsx)(bN,{size:11,"aria-hidden":`true`}),t]})]})]}),(0,Y.jsxs)(`div`,{className:`toolbar-meta`,"aria-label":`Diff summary`,children:[(0,Y.jsx)(`span`,{className:`toolbar-chip`,children:Me}),(i>0||a>0)&&(0,Y.jsxs)(`span`,{className:`toolbar-chip toolbar-chip-diff`,children:[i>0&&(0,Y.jsxs)(`span`,{className:`stat-additions`,children:[`+`,i]}),a>0&&(0,Y.jsxs)(`span`,{className:`stat-deletions`,children:[`−`,a]})]}),o>0&&(0,Y.jsxs)(`span`,{className:`toolbar-chip toolbar-chip-comments`,children:[o,` open`]}),l&&l.round>0&&(0,Y.jsx)(fJ,{lastRound:l.round})]})]}),(0,Y.jsxs)(`div`,{className:`toolbar-right`,children:[ke&&(0,Y.jsxs)(`button`,{className:`btn btn-sm toolbar-zen-btn ${Oe?`is-active`:``}`,onClick:ke,"aria-pressed":Oe===!0,title:`Zen mode — diffs only, no sidebar or toolbar (z)`,"aria-label":Oe?`Exit zen mode`:`Enter zen mode`,children:[Oe?(0,Y.jsx)(VN,{size:14}):(0,Y.jsx)(PN,{size:14}),(0,Y.jsx)(`span`,{className:`btn-label`,children:Oe?`Exit zen`:`Zen`})]}),(0,Y.jsxs)(`button`,{className:`btn btn-sm toolbar-search-btn`,onClick:he,title:`Search files, text, symbols (⌘K)`,"aria-label":`Search`,children:[(0,Y.jsx)(rP,{size:14}),(0,Y.jsx)(`span`,{className:`btn-label`,children:`Search`}),(0,Y.jsx)(`kbd`,{className:`toolbar-search-kbd`,children:`⌘K`})]}),s>0&&(0,Y.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,Y.jsx)(`span`,{className:`agent-waiting-dot`,"aria-hidden":`true`}),(0,Y.jsx)(oN,{size:14}),(0,Y.jsx)(`span`,{className:`btn-label`,children:`Plans`}),c>0&&(0,Y.jsx)(`span`,{className:`toolbar-plans-badge`,children:c})]}),(0,Y.jsx)(RY,{commentCount:o,onResolveAllOpen:pe}),(0,Y.jsx)(LY,{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,editDiagnostics:L,onDiffStyleChange:R,onDiffOptionsChange:z,onDefaultTabSizeChange:B,onBrowserChange:V,onOpenThemeModal:H,onEditorIDEChange:U,onLineDiffTypeChange:W,onLineWrapChange:ee,onDiffIndicatorsChange:te,onShowLineNumbersChange:ne,onHunkSeparatorsChange:re,onLineHoverHighlightChange:ie,onFontSizeChange:ae,onHapticsChange:oe,onSoundsChange:G,onDensityChange:se,onAutoCollapseLineThresholdChange:K,onRequireViewAllBeforeSendChange:ce,onShowStatusBarChange:le,onIgnoreSpaceChange:ue,onIgnoreAllSpaceChange:de,onEditDiagnosticsChange:fe,onOpenUiFontModal:q,onOpenMonoFontModal:me,showSource:!_}),(0,Y.jsx)(dJ,{comments:Se,totalFileCount:r,viewedFileCount:Ce,requireViewAllBeforeSend:N,onEditComment:we,onDeleteComment:Te,onSend:ve,sending:xe,agentWaiting:ye,waitingAgents:be,onCopyComments:ge,onCopyMarkdown:_e,open:Ae,onOpenChange:je})]})]})}),BY=(0,J.memo)(function({repoName:e,branch:t,fileCount:n,totalFileCount:r,additions:i,deletions:a,showMode:o,showCommitCount:s,onExit:c}){let l=o?`${s} commit${s===1?``:`s`}`:n===r?`${n} file${n===1?``:`s`}`:`${n}/${r} files`;return(0,Y.jsxs)(`header`,{className:`zen-bar`,role:`banner`,children:[(0,Y.jsxs)(`span`,{className:`zen-bar-branch`,title:t||e,children:[(0,Y.jsx)(bN,{size:13,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`zen-bar-branch-text`,children:t||e||`diffing`})]}),(0,Y.jsx)(`span`,{className:`zen-bar-count`,"aria-label":`Diff summary`,children:l}),(i>0||a>0)&&(0,Y.jsxs)(`span`,{className:`zen-bar-count zen-bar-count-diff`,"aria-hidden":`true`,children:[i>0&&(0,Y.jsxs)(`span`,{className:`stat-additions`,children:[`+`,i]}),a>0&&(0,Y.jsxs)(`span`,{className:`stat-deletions`,children:[`−`,a]})]}),(0,Y.jsx)(`span`,{className:`zen-bar-hint`,children:`z or Esc to exit`}),(0,Y.jsxs)(`button`,{type:`button`,className:`zen-bar-exit`,onClick:c,title:`Exit zen mode (z)`,"aria-label":`Exit zen mode`,children:[(0,Y.jsx)(VN,{size:13,"aria-hidden":`true`}),`Exit zen`]})]})});function VY({open:e,onClose:t,...n}){let r=(0,J.useRef)(null);return(0,Y.jsx)(oJ,{open:e,onClose:t,className:`send-review-modal`,ariaLabel:`Submit your review to the agent`,initialFocus:r,children:(0,Y.jsx)(lJ,{...n,onCancel:t,showLeftResize:!1,initialFocusRef:r})})}function HY({overview:e,commits:t}){let[n,r]=(0,J.useState)(!1),i=e.commitSubjects.length>0,a=e.truncated>0,o=!!e.subtitle||a||i;return(0,Y.jsxs)(`section`,{className:`diff-overview-banner`,"data-kind":e.kind,"aria-label":`Diff overview: ${e.headline}`,children:[(0,Y.jsxs)(`header`,{className:`diff-overview-banner-header`,children:[(0,Y.jsxs)(`div`,{className:`diff-overview-banner-line`,children:[(0,Y.jsx)(KY,{kind:e.kind}),(0,Y.jsx)(`h2`,{className:`diff-overview-banner-headline`,children:e.headline})]}),o&&(0,Y.jsxs)(`div`,{className:`diff-overview-banner-meta`,children:[e.subtitle&&(0,Y.jsx)(`span`,{className:`diff-overview-banner-subtitle`,children:e.subtitle}),a&&(0,Y.jsxs)(`span`,{className:`diff-overview-banner-truncated-badge`,title:`${e.truncated} additional ${e.truncated===1?`commit`:`commits`} not shown`,children:[`+`,e.truncated]}),i&&(0,Y.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,Y.jsx)(JM,{size:14}):(0,Y.jsx)(XM,{size:14}),(0,Y.jsx)(_N,{size:13,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{children:[n?`Hide`:`Show`,` `,e.commitSubjects.length,` `,`commit`,e.commitSubjects.length===1?``:`s`]})]})]})]}),i&&n&&(0,Y.jsx)(UY,{overview:e,commits:t,id:`diff-overview-banner-details`})]})}function UY({overview:e,commits:t,id:n}){return t&&t.length>0?(0,Y.jsxs)(`ul`,{id:n,className:`diff-overview-banner-subjects`,children:[t.map((e,n)=>(0,Y.jsx)(WY,{commit:e,index:n,total:t.length},e.sha)),e.truncated>0&&(0,Y.jsxs)(`li`,{className:`diff-overview-banner-truncated`,role:`status`,children:[`+ `,e.truncated,` more commit`,e.truncated===1?``:`s`,` not shown`]})]}):(0,Y.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,Y.jsxs)(`li`,{className:`diff-overview-banner-subject-row`,children:[(0,Y.jsx)(xN,{size:12,className:`diff-overview-banner-subject-icon`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`diff-overview-banner-subject-text`,children:t}),r&&e.fromDate&&e.toDate&&(0,Y.jsx)(`span`,{className:`diff-overview-banner-subject-dates`,children:n===0?e.fromDate:e.toDate})]},`${n}-${t}`)})})}function WY({commit:e,index:t,total:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.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,Y.jsxs)(`li`,{className:`diff-overview-banner-commit-row`,"aria-label":u,children:[(0,Y.jsxs)(`div`,{className:`diff-overview-banner-commit-line`,children:[(0,Y.jsx)(xN,{size:12,className:`diff-overview-banner-subject-icon`,"aria-hidden":`true`}),(0,Y.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,Y.jsx)(`span`,{children:e.shortSha}),r?(0,Y.jsx)(qM,{size:12,"aria-hidden":`true`}):(0,Y.jsx)(dN,{size:12,"aria-hidden":`true`})]}),l&&(0,Y.jsx)(`span`,{className:`diff-overview-banner-merge-badge`,title:`Merge commit with ${e.parents.length} parents`,children:`merge`}),(0,Y.jsx)(`span`,{className:`diff-overview-banner-commit-subject`,children:e.subject})]}),(0,Y.jsxs)(`div`,{className:`diff-overview-banner-commit-meta`,children:[(0,Y.jsxs)(`span`,{className:`diff-overview-banner-commit-author`,children:[(0,Y.jsx)(`span`,{className:`diff-overview-banner-commit-author-name`,children:e.authorName}),(0,Y.jsxs)(`span`,{className:`diff-overview-banner-commit-author-email`,children:[`<`,e.authorEmail,`>`]})]}),(0,Y.jsx)(`span`,{className:`diff-overview-banner-commit-date`,title:e.authorDate,children:GY(e.authorDate)}),e.committerName!==e.authorName||e.committerEmail!==e.authorEmail?(0,Y.jsxs)(`span`,{className:`diff-overview-banner-commit-committer`,title:`Committed by ${e.committerName} <${e.committerEmail}> at ${e.committerDate}`,children:[(0,Y.jsx)(`span`,{className:`diff-overview-banner-commit-committer-label`,children:`committed by`}),` `,(0,Y.jsx)(`span`,{children:e.committerName})]}):null]}),c&&(0,Y.jsxs)(`div`,{className:`diff-overview-banner-commit-body`,children:[(0,Y.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,Y.jsx)(JM,{size:14}):(0,Y.jsx)(XM,{size:14}),(0,Y.jsx)(_N,{size:13,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:a?`Hide message`:`Show message`})]}),a&&(0,Y.jsx)(`pre`,{id:`diff-overview-commit-body-${e.shortSha}`,className:`diff-overview-banner-commit-body-pre`,children:e.body})]})]})}function GY(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 KY({kind:e}){let t={size:14,className:`diff-overview-banner-icon`,"aria-hidden":!0};switch(e){case`working-tree`:case`staged-only`:return(0,Y.jsx)(ON,{...t});case`range`:return(0,Y.jsx)(bN,{...t});case`commit-single`:case`commit-series`:return(0,Y.jsx)(xN,{...t});case`pr`:return(0,Y.jsx)(wN,{...t})}}function qY(e,t){return JSON.stringify(e.overview)===JSON.stringify(t.overview)&&JSON.stringify(e.commits)===JSON.stringify(t.commits)}var JY=(0,J.memo)(HY,qY);function YY({query:e,hits:t,index:n,focusNonce:r,onQueryChange:i,onNext:a,onPrev:o,onClose:s}){let c=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=c.current;e&&(e.focus({preventScroll:!0}),e.select(),e.scrollIntoView({block:`nearest`,behavior:`auto`}))},[r]);let l=e=>{e.key===`Enter`?(e.preventDefault(),e.shiftKey?o():a()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),s())},u=e=>{i(e.target.value),c.current?.scrollIntoView({block:`nearest`,behavior:`auto`})},d=t.length,f=d===0?0:n+1;return(0,Y.jsxs)(`div`,{className:`file-search-bar`,onClick:e=>e.stopPropagation(),onKeyDown:l,role:`search`,"aria-label":`Find in file`,children:[(0,Y.jsx)(rP,{size:13,className:`file-search-bar-icon`,"aria-hidden":`true`}),(0,Y.jsx)(`input`,{ref:c,className:`file-search-bar-input`,type:`text`,value:e,onChange:u,placeholder:`Find in file…`,"aria-label":`Find in file`,spellCheck:!1,autoComplete:`off`}),(0,Y.jsx)(`span`,{className:`file-search-bar-count`,"aria-live":`polite`,children:e.trim()?`${f}/${d}`:`${d} match${d===1?``:`es`}`}),(0,Y.jsxs)(`div`,{className:`file-search-bar-actions`,children:[(0,Y.jsx)(`button`,{className:`file-search-bar-btn`,onClick:o,disabled:d===0,title:`Previous match (Shift+Enter)`,"aria-label":`Previous match`,children:(0,Y.jsx)(ZM,{size:13})}),(0,Y.jsx)(`button`,{className:`file-search-bar-btn`,onClick:a,disabled:d===0,title:`Next match (Enter)`,"aria-label":`Next match`,children:(0,Y.jsx)(JM,{size:13})}),(0,Y.jsx)(`button`,{className:`file-search-bar-btn`,onClick:s,title:`Close (Esc)`,"aria-label":`Close search`,children:(0,Y.jsx)(mP,{size:13})})]})]})}var XY=`
1599
+ `,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 q(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let O=Se(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:De(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:De(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:A};throw t}}function b(e){let t={value:De(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 Ee(`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=Oe(l,e)}let E=()=>{k(),he(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function D(){k(),he(`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(q(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)q(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 he(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),he(`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:Oe,addPlugin:L,removePlugin:R}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=Te,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},Me=je({});Me.newInstance=()=>je({}),t.exports=Me,Me.HighlightJS=Me,Me.default=Me}))()).default,ZK={},QK=`hljs-`;function $K(e){let t=XK.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||ZK,a=typeof i.prefix==`string`?i.prefix:QK;if(!t.getLanguage(e))throw Error("Unknown language: `"+e+"` is not registered");t.configure({__emitter:eq,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||ZK).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 eq=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``}},tq={};function nq(e){let t=e||tq,n=t.aliases,r=t.detect||!1,i=t.languages||YK,a=t.plainText,o=t.prefix,s=t.subset,c=`hljs`,l=$K(i);if(n&&l.registerAlias(n),o){let e=o.indexOf(`-`);c=e===-1?o:o.slice(0,e)}return function(e,t){hB(e,`element`,function(e,n,i){if(e.tagName!==`code`||!i||i.type!==`element`||i.tagName!==`pre`)return;let u=rq(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=FW(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 rq(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 iq=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],aq={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...iq,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...iq],h2:[[`className`,`sr-only`]],img:[...iq,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...iq,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...iq],table:[...iq],ul:[...iq,[`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(`.`)},oq={}.hasOwnProperty;function sq(e,t){let n={type:`root`,children:[]},r=cq({schema:t?{...aq,...t}:aq,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function cq(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return lq(e,n);case`doctype`:return uq(e,n);case`element`:return dq(e,n);case`root`:return fq(e,n);case`text`:return pq(e,n);default:}}}function lq(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 bq(r,t),r}}function uq(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return bq(e,t),e}}function dq(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=mq(e,t.children),i=hq(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&&oq.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 bq(o,t),o}function fq(e,t){let n={type:`root`,children:mq(e,t.children)};return bq(n,t),n}function pq(e,t){let n={type:`text`,value:typeof t.value==`string`?t.value:``};return bq(n,t),n}function mq(e,t){let n=[];if(Array.isArray(t)){let r=t,i=-1;for(;++i<r.length;){let t=cq(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function hq(e,t){let n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,a=r&&oq.call(r,n)?r[n]:void 0,o=r&&oq.call(r,`*`)?r[`*`]:void 0,s=t&&typeof t==`object`?t:{},c={},l;for(l in s)if(oq.call(s,l)){let t=s[l],n=gq(e,xq(a,l),l,t);n??=gq(e,xq(o,l),l,t),n!=null&&(c[l]=n)}if(i&&oq.call(i,n)){let e=i[n];for(l in e)oq.call(e,l)&&!oq.call(c,l)&&(c[l]=e[l])}return c}function gq(e,t,n,r){return t?Array.isArray(r)?_q(e,t,n,r):vq(e,t,n,r):void 0}function _q(e,t,n,r){let i=-1,a=[];for(;++i<r.length;){let o=vq(e,t,n,r[i]);(typeof o==`number`||typeof o==`string`)&&a.push(o)}return a}function vq(e,t,n,r){if(!(typeof r!=`boolean`&&typeof r!=`number`&&typeof r!=`string`)&&yq(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 yq(e,t,n){let r=e.schema.protocols&&oq.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 bq(e,t){let n=OF(t);t.data&&(e.data=eB(t.data)),n&&(e.position=n)}function xq(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 Sq(e){return function(t){return sq(t,e)}}function Cq(){return typeof document>`u`?`dark`:(NA[document.documentElement.getAttribute(`data-theme`)||`rose-pine`]?.type??`dark`)===`light`?`default`:`dark`}var wq=(0,J.memo)(function({chart:e}){let t=(0,J.useRef)(null),n=`mermaid-${(0,J.useId)().replace(/[^a-zA-Z0-9]/g,``)}`,[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null);return(0,J.useEffect)(()=>{let r=!1;return(async()=>{try{let a=(await Z(async()=>{let{default:e}=await import(`./mermaid.core-BsnKhnrM.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:Cq()});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,Y.jsxs)(`div`,{className:`mermaid-error`,children:[(0,Y.jsxs)(`div`,{className:`mermaid-error-note`,children:[`Failed to render diagram: `,r]}),(0,Y.jsx)(`pre`,{children:(0,Y.jsx)(`code`,{children:e})})]}):(0,Y.jsx)(`div`,{className:`mermaid`,ref:t,role:`img`,"aria-label":`Mermaid diagram`,dangerouslySetInnerHTML:a?{__html:a}:void 0})}),Tq=[gW,yW],Eq=[[Sq,{...aq,protocols:{...aq.protocols,href:[...aq.protocols?.href??[],`file`,`file-mention`]},attributes:{...aq.attributes,h1:[...aq.attributes?.h1??[],`id`],h2:[...aq.attributes?.h2??[],`id`],h3:[...aq.attributes?.h3??[],`id`],h4:[...aq.attributes?.h4??[],`id`],h5:[...aq.attributes?.h5??[],`id`],h6:[...aq.attributes?.h6??[],`id`]}}],[nq,{ignoreMissing:!0,plainText:[`mermaid`,`suggestion`]}]];function Dq(e){return e.startsWith(`file://`)||e.startsWith(`file-mention://`)?e:_V(e)}function Oq(e){return e==null||e===!1||e===!0?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(Oq).join(``):(0,J.isValidElement)(e)?Oq(e.props.children):``}function kq(e){return typeof e==`string`?/language-([\w-]+)/.exec(e)?.[1]??null:null}function Aq(e){return e.toLowerCase().trim().replace(/[`*_~[\]()#.!?,:'"]/g,``).replace(/[^\w\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``).slice(0,80)||`section`}function jq({language:e,codeText:t,children:n}){let[r,i]=(0,J.useState)(!1),a=(0,J.useCallback)(()=>{typeof navigator>`u`||!navigator.clipboard||navigator.clipboard.writeText(t).then(()=>{i(!0),window.setTimeout(()=>i(!1),1400)},()=>{})},[t]);return(0,Y.jsxs)(`div`,{className:`md-code-block`,children:[(0,Y.jsxs)(`div`,{className:`md-code-toolbar`,children:[(0,Y.jsx)(`span`,{className:`md-code-lang`,children:e||`code`}),(0,Y.jsx)(`button`,{type:`button`,className:`md-code-copy`,onClick:a,"aria-label":`Copy code`,children:r?`Copied`:`Copy`})]}),(0,Y.jsx)(`pre`,{children:n})]})}function Mq(e){return{pre({children:e}){let t=kq((0,J.isValidElement)(e)?e.props.className:void 0);return t===`mermaid`?(0,Y.jsx)(wq,{chart:Oq(e).replace(/\n$/,``)}):t===`suggestion`?null:(0,Y.jsx)(jq,{language:t,codeText:Oq(e).replace(/\n$/,``),children:e})},a({href:e,children:t}){return typeof e==`string`&&e.startsWith(`file-mention://`)?(0,Y.jsx)(`span`,{className:`mention-file`,title:e.slice(15),children:t}):(0,Y.jsx)(`a`,{href:e,...typeof e==`string`&&/^https?:\/\//.test(e)?{target:`_blank`,rel:`noopener noreferrer`}:{},children:t})},h1:Nq(`h1`,e),h2:Nq(`h2`,e),h3:Nq(`h3`,e),h4:Nq(`h4`,e),h5:Nq(`h5`,e),h6:Nq(`h6`,e)}}function Nq(e,t){return function({children:n,...r}){let i=Oq(n),a=Aq(i),o=t.get(a)??0;return t.set(a,o+1),o>0&&(a=`${a}-${o+1}`),(0,Y.jsxs)(e,{id:a,className:`md-heading`,...r,children:[(0,Y.jsx)(`a`,{href:`#${a}`,className:`md-heading-anchor`,"aria-label":`Link to ${i}`,children:`#`}),n]})}}function Pq({content:e,className:t}){return(0,Y.jsx)(`div`,{className:t,children:(0,Y.jsx)(pV,{remarkPlugins:Tq,rehypePlugins:Eq,urlTransform:Dq,components:(0,J.useMemo)(()=>Mq(new Map),[e]),children:e})})}function Fq(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===`
1600
+ `)return null}return null}function Iq(e,t){let n=(0,J.useRef)(null),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(0),[l,u]=(0,J.useState)(0),d=(0,J.useRef)(0),f=(0,J.useRef)(e);(0,J.useEffect)(()=>{f.current=e},[e]);let p=(0,J.useCallback)(e=>{n.current=e,i(e)},[]),m=(0,J.useCallback)(()=>{let e=n.current;if(!e)return;let t=e.selectionStart;d.current=t;let r=f.current,i=Fq(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,J.useEffect)(()=>{m()},[e,m]),(0,J.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=Qe({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,J.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,J.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,J.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 Lq(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 Rq({text:e,ranges:t}){if(!t.length)return(0,Y.jsx)(Y.Fragment,{children:e});let n=[],r=0;return t.forEach(([t,i],a)=>{t>r&&n.push(e.slice(r,t)),n.push((0,Y.jsx)(`mark`,{className:`mention-highlight`,children:e.slice(t,i)},a)),r=i}),r<e.length&&n.push(e.slice(r)),(0,Y.jsx)(Y.Fragment,{children:n})}var zq=e=>{let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t+1)},Bq=e=>{let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)};function Vq({results:e,focusedIndex:t,query:n,cursorTop:r,onSelect:i,onHover:a}){let o=(0,J.useRef)(null);return(0,J.useEffect)(()=>{(o.current?.querySelector(`[data-focused="true"]`))?.scrollIntoView({block:`nearest`})},[t]),e.length===0?null:(0,Y.jsx)(`div`,{className:`mention-dropdown`,ref:o,role:`listbox`,"aria-label":`File suggestions`,style:{top:r},children:e.map((e,r)=>{let o=Bq(e.path),s=Lq(o,n),c=r===t;return(0,Y.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,Y.jsx)(`span`,{className:`mention-icon`,children:(0,Y.jsx)(_N,{size:13})}),(0,Y.jsxs)(`div`,{className:`mention-info`,children:[(0,Y.jsx)(`span`,{className:`mention-name`,children:(0,Y.jsx)(Rq,{text:o,ranges:s})}),(0,Y.jsx)(`span`,{className:`mention-dir`,children:zq(e.path)||`./`})]})]},e.path)})})}function Hq(e){return e.replace(/@([^\s@]+)/g,(e,t)=>`[${t.split(`/`).pop()||t}](file-mention://${t})`)}function Uq({id:e,value:t,onChange:n,placeholder:r,rows:i=3,ariaLabel:a,textareaClassName:o,onSubmitShortcut:s}){let[c,l]=(0,J.useState)(`write`),u=(0,J.useRef)(null),d=(0,J.useRef)(null),f=Iq(t,n),p=(0,J.useRef)(t);(0,J.useEffect)(()=>{p.current=t},[t]),(0,J.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,Y.jsxs)(`div`,{className:`md-field`,children:[(0,Y.jsxs)(`div`,{className:`comment-form-tabs`,role:`tablist`,"aria-label":`Markdown editor mode`,children:[(0,Y.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,Y.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,Y.jsxs)(`div`,{style:{position:`relative`},children:[(0,Y.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,Y.jsx)(Vq,{results:f.results,focusedIndex:f.focusedIndex,query:f.query,cursorTop:f.cursorTop,onSelect:f.onSelect,onHover:f.setFocusedIndex})]}):(0,Y.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,Y.jsx)(Pq,{content:Hq(t)}):(0,Y.jsx)(`span`,{className:`md-field-empty`,children:`Nothing to preview`})})]})}var Wq=J.createContext(void 0);function Gq(e){let t=J.useContext(Wq);if(e===!1&&t===void 0)throw Error(Tx(27));return t}var Kq={...pk,...rk},qq=J.forwardRef(function(e,t){let{render:n,className:r,forceRender:i=!1,...a}=e,{store:o}=Gq(),s=o.useState(`open`),c=o.useState(`nested`),l=o.useState(`mounted`),u=o.useState(`transitionStatus`);return XT(`div`,e,{state:J.useMemo(()=>({open:s,transitionStatus:u}),[s,u]),ref:[o.context.backdropRef,t],stateAttributesMapping:Kq,props:[{role:`presentation`,hidden:!l,style:{userSelect:`none`,WebkitUserSelect:`none`}},a],enabled:i||!c})}),Jq=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),Yq=function(e){return e[e.open=ik.open]=`open`,e[e.closed=ik.closed]=`closed`,e[e.startingStyle=ik.startingStyle]=`startingStyle`,e[e.endingStyle=ik.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),Xq=J.createContext(void 0);function Zq(){let e=J.useContext(Xq);if(e===void 0)throw Error(Tx(26));return e}var Qq={...pk,...rk,nestedDialogOpen(e){return e?{[Yq.nestedDialogOpen]:``}:null}},$q=J.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,...o}=e,{store:s}=Gq(),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`);Zq(),lO({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=XT(`div`,e,{state:J.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){$P.has(e.key)&&e.stopPropagation()},style:{[Jq.nestedDialogs]:h}},o],ref:[t,s.context.popupRef,s.useStateSetter(`popupElement`)],stateAttributesMapping:Qq});return(0,Y.jsx)(hE,{context:u,openInteractionType:_,disabled:!p,closeOnFocusOut:!l,initialFocus:S,returnFocus:r,modal:f!==!1,restoreFocus:`popup`,children:w})}),eJ=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Gq(),a=i.useState(`mounted`),o=i.useState(`modal`);return a||n?(0,Y.jsx)(Xq.Provider,{value:n,children:(0,Y.jsxs)(iE,{ref:t,...r,children:[a&&o===!0&&(0,Y.jsx)(UP,{ref:i.context.internalBackdropRef,inert:Gk(!open)}),e.children]})}):null});function tJ(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}=kP(i);fO(t);let{forceUnmount:d}=pO(i,t,()=>{u()}),f=uS(e=>{let n=tT(e);return n.preventUnmountOnClose=()=>{t.set(`preventUnmountingOnClose`,!0)},n}),p=J.useCallback(()=>{t.setOpen(!1,f($w))},[t,f]);J.useImperativeHandle(r,()=>({unmount:d,close:p}),[d,p]);let m=bO({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[h,g]=J.useState(0),_=h===0,v=WO(m),y=jD(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=PS(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||NS(e,s)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:_});SP(i&&o===!0,s);let{getReferenceProps:b,getFloatingProps:x,getTriggerProps:S}=NO([v,y]);t.useContextCallback(`onNestedDialogOpen`,e=>{g(e+1)}),t.useContextCallback(`onNestedDialogClose`,()=>{g(0)}),J.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(h),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[i,n,h]);let C=J.useMemo(()=>b(l),[b,l]),w=J.useMemo(()=>S(l),[S,l]),T=J.useMemo(()=>x(),[x]);t.useSyncedValues({openMethod:c,activeTriggerProps:C,inactiveTriggerProps:w,popupProps:T,floatingRootContext:m,nestedOpenDialogCount:h})}var nJ={..._O,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)},rJ=class extends iO{constructor(e){super(iJ(e),{popupRef:J.createRef(),backdropRef:J.createRef(),internalBackdropRef:J.createRef(),triggerElements:new mO,onOpenChange:void 0,onOpenChangeComplete:void 0},nJ)}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 iJ(e={}){return{...gO(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:`dialog`,...e}}function aJ(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=Gq(!0),p=!!f,m=kx(()=>l?.store??new rJ({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`);tJ({store:m,actionsRef:c,parentContext:f?.store.context,onOpenChange:i,triggerIdProp:u});let g=J.useMemo(()=>({store:m}),[m]);return(0,Y.jsx)(Wq.Provider,{value:g,children:typeof t==`function`?t({payload:h}):t})}function oJ({open:e,onClose:t,className:n,ariaLabel:r,initialFocus:i,onKeyDown:a,role:o=`dialog`,ariaBusy:s,children:c}){return(0,Y.jsx)(aJ,{open:e,onOpenChange:e=>{e||t()},children:(0,Y.jsxs)(eJ,{children:[(0,Y.jsx)(qq,{className:`ui-modal-backdrop`}),(0,Y.jsx)($q,{className:`ui-modal-popup ${n??``}`,"aria-label":r,initialFocus:i,onKeyDown:a,role:o,"aria-busy":s||void 0,children:c})]})})}function sJ({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,J.useRef)(null);return(0,Y.jsxs)(oJ,{open:e,onClose:()=>{l||f()},className:`confirm-dialog`,ariaLabel:t,initialFocus:p,role:`alertdialog`,ariaBusy:l,children:[(0,Y.jsxs)(`div`,{className:`confirm-dialog-header`,children:[(0,Y.jsx)(`span`,{className:`confirm-dialog-icon confirm-dialog-icon-${s}`,"aria-hidden":`true`,children:c??(0,Y.jsx)(uP,{size:18})}),(0,Y.jsx)(`h2`,{className:`confirm-dialog-title`,children:t})]}),n&&(0,Y.jsx)(`p`,{className:`confirm-dialog-desc`,children:n}),r?.trim()&&(0,Y.jsx)(`blockquote`,{className:`confirm-dialog-detail`,title:r,children:r.trim()}),u&&(0,Y.jsx)(`p`,{className:`confirm-dialog-error`,role:`alert`,children:u}),(0,Y.jsxs)(`div`,{className:`confirm-dialog-footer`,children:[(0,Y.jsx)(`button`,{ref:p,type:`button`,className:`btn btn-sm confirm-dialog-cancel`,onClick:f,disabled:l,children:a}),(0,Y.jsxs)(`button`,{type:`button`,className:`btn btn-sm confirm-dialog-confirm confirm-dialog-confirm-${s}`,onClick:()=>void d(),disabled:l,children:[l&&(0,Y.jsx)(MN,{size:13,className:`spin`,"aria-hidden":`true`}),l?o:i]})]})]})}var cJ=[{value:`approved`,label:`Approve`,description:`The changes look good — the agent can proceed.`,icon:qM,className:`plan-verdict-approve`},{value:`changes-requested`,label:`Request edits`,description:`The agent should address the comments and apply edits.`,icon:RN,className:`plan-verdict-changes`},{value:`rejected`,label:`Reject`,description:`Don't keep building on this — the approach needs rethinking.`,icon:mP,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:zN,className:`plan-verdict-comment-only`}];function lJ({comments:e,totalFileCount:t,viewedFileCount:n,requireViewAllBeforeSend:r,onEditComment:i,onDeleteComment:a,onSend:o,sending:s,agentWaiting:c,waitingAgents:l=[],onCopyComments:u,onCopyMarkdown:d,onCancel:f,showLeftResize:p=!0,initialFocusRef:m}){let{haptic:h,sound:g}=AA(),[_,v]=(0,J.useState)(``),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(!1),[C,w]=(0,J.useState)(null),[T,E]=(0,J.useState)(!1),[D,O]=(0,J.useState)(!1),[k,A]=(0,J.useState)(null),{popoverStyle:j,activePreset:M,applyPreset:N,startResize:P,startLeftResize:F,startCornerResize:I,panelRef:L}=gF(),R=async()=>{u&&(await u(),S(!0),setTimeout(()=>S(!1),2e3))},z=e.length,B=(0,J.useMemo)(()=>[...e].sort((e,t)=>e.createdAt-t.createdAt),[e]),V=Math.max(0,t-n),H=async e=>{if(!y)return`blocked`;A(null),h(`heavy`),g(`send`);let t=y===`comment-only`?`comment-only`:`standard`;try{return await o(y,_,t,e),v(``),b(null),f(),w(null),E(!1),`sent`}catch(e){return e?.kind===`secrets`?(w(e.findings),E(!1),`blocked`):(A(e?.message??`The review could not be sent. Please try again.`),`error`)}},U=async()=>{if(y){if(r&&V>0&&!T){h(`medium`),A(null),O(!0);return}await H(T)}};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`srp`,ref:L,style:j,children:[p&&(0,Y.jsx)(`div`,{className:`srp-resize-handle-left`,onPointerDown:F,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize submit panel width`,tabIndex:0}),(0,Y.jsxs)(`div`,{className:`srp-head`,children:[(0,Y.jsx)(GM,{size:15,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`srp-title`,children:`Submit review`}),(0,Y.jsx)(`div`,{className:`srp-size-presets`,role:`group`,"aria-label":`Panel size`,children:sF.map((e,t)=>(0,Y.jsx)(`button`,{className:`srp-preset-btn`,role:`radio`,"aria-checked":M===t,"aria-pressed":M===t,onClick:()=>N(e),title:`${e.width}×${e.height}px`,children:e.label},e.label))}),z>0&&(0,Y.jsxs)(`span`,{className:`srp-count`,children:[z,` comment`,z===1?``:`s`]})]}),l.length>0&&(0,Y.jsxs)(`div`,{className:`srp-agents`,"aria-label":`Waiting agents`,children:[(0,Y.jsx)(`span`,{className:`srp-agents-label`,children:l.length===1?`Agent waiting`:`${l.length} agents waiting`}),(0,Y.jsx)(`ul`,{className:`srp-agents-list`,children:l.map(e=>(0,Y.jsxs)(`li`,{className:`srp-agent-chip`,title:e.id,children:[(0,Y.jsx)(`span`,{className:`agent-waiting-dot`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`srp-agent-name`,children:e.label||e.model||e.id.slice(0,8)}),e.model&&e.label&&(0,Y.jsx)(`span`,{className:`srp-agent-model`,children:e.model})]},e.id))})]}),(0,Y.jsxs)(`div`,{className:`srp-scroll`,children:[(0,Y.jsx)(`div`,{className:`plan-verdict-options`,role:`radiogroup`,"aria-label":`Verdict`,children:cJ.map((e,t)=>{let n=e.icon,r=y===e.value;return(0,Y.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,ref:t===0?m:void 0,className:`plan-verdict-option ${e.className} ${r?`plan-verdict-option-selected`:``}`,onClick:()=>b(e.value),children:[(0,Y.jsx)(`span`,{className:`plan-verdict-icon`,children:(0,Y.jsx)(n,{size:15,"aria-hidden":`true`})}),(0,Y.jsxs)(`span`,{className:`plan-verdict-text`,children:[(0,Y.jsx)(`span`,{className:`plan-verdict-label`,children:e.label}),(0,Y.jsx)(`span`,{className:`plan-verdict-desc`,children:e.description})]}),(0,Y.jsx)(`span`,{className:`plan-verdict-radio`,"aria-hidden":`true`})]},e.value)})}),z>0?(0,Y.jsx)(`ul`,{className:`srp-list`,"aria-label":`Comments to send`,children:B.map(e=>(0,Y.jsx)(uJ,{comment:e,onEdit:i,onDelete:a},e.id))}):(0,Y.jsx)(`p`,{className:`srp-empty`,children:`No inline comments — your verdict and overall note will be sent on their own.`}),V>0&&(0,Y.jsx)(`div`,{className:`srp-warning`,role:`note`,"data-tone":`muted`,children:(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:V}),` of `,(0,Y.jsx)(`strong`,{children:t}),` file`,t===1?``:`s`,` still unviewed.`,r&&(0,Y.jsx)(Y.Fragment,{children:` Sending will require an extra confirmation.`})]})}),C&&(0,Y.jsxs)(`div`,{className:`srp-warning srp-warning-danger`,role:`alert`,"data-tone":`danger`,children:[(0,Y.jsxs)(`div`,{className:`srp-warning-head`,children:[(0,Y.jsx)(aP,{size:14,"aria-hidden":`true`}),(0,Y.jsxs)(`strong`,{children:[C.length,` possible secret`,C.length===1?``:`s`,` detected`]})]}),(0,Y.jsx)(`ul`,{className:`srp-warning-list`,children:C.map((e,t)=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`code`,{children:e.rule}),`: `,(0,Y.jsx)(`code`,{children:e.snippet}),` `,(0,Y.jsxs)(`span`,{className:`srp-warning-source`,children:[`in `,e.source]})]},t))}),(0,Y.jsxs)(`div`,{className:`srp-warning-actions`,children:[(0,Y.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>w(null),disabled:s,children:`Cancel & edit`}),(0,Y.jsx)(`button`,{className:`btn btn-sm btn-danger`,onClick:()=>{E(!0),w(null),H(!0)},disabled:s,children:`Send anyway`})]})]}),k&&(0,Y.jsxs)(`div`,{className:`srp-warning srp-warning-danger`,role:`alert`,"data-tone":`danger`,children:[(0,Y.jsx)(aP,{size:14,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:k})]}),(0,Y.jsxs)(`div`,{className:`srp-general`,children:[(0,Y.jsxs)(`label`,{className:`srp-general-label`,htmlFor:`srp-general-input`,children:[`Overall comment `,(0,Y.jsx)(`span`,{className:`srp-optional`,children:`(optional · Markdown)`})]}),(0,Y.jsx)(Uq,{id:`srp-general-input`,value:_,onChange:v,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,Y.jsxs)(`div`,{className:`srp-footer`,children:[u&&(0,Y.jsxs)(`div`,{style:{marginRight:`auto`,display:`flex`,gap:6},children:[(0,Y.jsx)(`button`,{className:`btn btn-sm`,onClick:R,disabled:z===0,children:x?`Copied!`:`Copy XML`}),d&&(0,Y.jsx)(`button`,{className:`btn btn-sm`,onClick:async()=>{try{await d(),S(!0),setTimeout(()=>S(!1),1500)}catch{}},disabled:z===0,title:`Copy review as Markdown`,children:`Copy MD`})]}),(0,Y.jsx)(`button`,{className:`btn btn-sm`,onClick:f,disabled:s,children:`Cancel`}),(0,Y.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:U,disabled:!y||s,children:s?`Sending…`:`Send review`})]}),(0,Y.jsx)(`div`,{className:`srp-resize-handle`,onPointerDown:P,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize submit panel`,tabIndex:0}),(0,Y.jsx)(`div`,{className:`srp-resize-handle-corner`,onPointerDown:I,role:`separator`,"aria-label":`Resize submit panel width and height`,tabIndex:0})]}),(0,Y.jsx)(sJ,{open:D,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:k,onConfirm:async()=>{E(!0),await H(!0)!==`error`&&O(!1)},onCancel:()=>{O(!1),E(!1),A(null)}})]})}function uJ({comment:e,onEdit:t,onDelete:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.body),s=(0,J.useRef)(null);(0,J.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,Y.jsxs)(`li`,{className:`srp-item`,children:[(0,Y.jsxs)(`div`,{className:`srp-item-top`,children:[(0,Y.jsxs)(`span`,{className:`srp-item-loc`,children:[(0,Y.jsx)(`span`,{className:`srp-item-file`,children:MA(e.filePath)}),(0,Y.jsx)(`span`,{className:`srp-item-line`,children:c})]}),e.status===`resolved`&&(0,Y.jsx)(`span`,{className:`srp-item-resolved`,children:`resolved`}),(0,Y.jsxs)(`span`,{className:`srp-item-actions`,children:[r?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{className:`srp-icon-btn`,onClick:l,title:`Save edit`,children:(0,Y.jsx)(qM,{size:13,"aria-hidden":`true`})}),(0,Y.jsx)(`button`,{className:`srp-icon-btn`,onClick:()=>{o(e.body),i(!1)},title:`Cancel edit`,children:(0,Y.jsx)(mP,{size:13,"aria-hidden":`true`})})]}):(0,Y.jsx)(`button`,{className:`srp-icon-btn`,onClick:()=>i(!0),title:`Edit comment`,children:(0,Y.jsx)(ZN,{size:13,"aria-hidden":`true`})}),(0,Y.jsx)(`button`,{className:`srp-icon-btn srp-icon-btn-danger`,onClick:()=>n(e.id),title:`Remove from review`,children:(0,Y.jsx)(lP,{size:13,"aria-hidden":`true`})})]})]}),e.lineContent?.trim()&&(0,Y.jsx)(`code`,{className:`srp-item-code`,children:e.lineContent.trim().slice(0,160)}),r?(0,Y.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,Y.jsx)(`p`,{className:`srp-item-body`,children:e.body})]})}function dJ({comments:e,totalFileCount:t,viewedFileCount:n,requireViewAllBeforeSend:r,onEditComment:i,onDeleteComment:a,onSend:o,sending:s,agentWaiting:c,waitingAgents:l=[],onCopyComments:u,onCopyMarkdown:d,open:f,onOpenChange:p}){let[m,h]=(0,J.useState)(!1),g=f??m,_=e=>{h(e),p?.(e)},{handleOpenChange:v}=gF(),y=e.length,b=(0,J.useRef)(null);return(0,Y.jsx)(iF,{open:g,onOpenChange:(e,t)=>v(e,t,_),ariaLabel:`Submit your review to the agent`,className:`send-review-popover`,initialFocus:b,trigger:(0,Y.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`:y>0?`Send review with ${y} comment${y===1?``:`s`}`:`Send review to agent`,children:[c&&(0,Y.jsx)(`span`,{className:`agent-waiting-dot`,"aria-hidden":`true`}),(0,Y.jsx)(GM,{size:14,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`btn-label`,children:s?`Sending…`:l.length>1?`Send (${l.length})`:y>0?`Send (${y})`:`Send review`})]}),children:(0,Y.jsx)(lJ,{comments:e,totalFileCount:t,viewedFileCount:n,requireViewAllBeforeSend:r,onEditComment:i,onDeleteComment:a,onSend:o,sending:s,agentWaiting:c,waitingAgents:l,onCopyComments:u,onCopyMarkdown:d,onCancel:()=>_(!1),initialFocusRef:b})})}function fJ({lastRound:e}){let{data:t=[],isFetching:n,refetch:r}=Qe({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,Y.jsxs)(iF,{side:`bottom`,align:`start`,ariaLabel:`Review history`,className:`review-history-popup`,onOpenChange:e=>{e&&r()},trigger:(0,Y.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,Y.jsx)(EN,{size:12,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`toolbar-last-send-dot`,"aria-hidden":`true`}),`Round `,e]}),children:[(0,Y.jsxs)(`div`,{className:`review-history-header`,children:[(0,Y.jsx)(EN,{size:14}),(0,Y.jsx)(`strong`,{children:`Review history`}),n&&(0,Y.jsx)(`span`,{className:`review-history-loading`,children:`Loading…`})]}),t.length===0?(0,Y.jsx)(`p`,{className:`review-history-empty`,children:`No handoffs recorded yet (history is in-memory).`}):(0,Y.jsx)(`ul`,{className:`review-history-list`,children:t.map(e=>(0,Y.jsxs)(`li`,{className:`review-history-item`,children:[(0,Y.jsxs)(`div`,{className:`review-history-item-top`,children:[(0,Y.jsxs)(`span`,{className:`review-history-round`,children:[`Round `,e.round]}),e.decision&&(0,Y.jsx)(`span`,{className:`review-history-decision`,"data-decision":e.decision,children:e.decision}),e.mode&&e.mode!==`standard`&&(0,Y.jsx)(`span`,{className:`review-history-mode`,children:e.mode}),(0,Y.jsx)(`span`,{className:`review-history-time`,title:new Date(e.sentAt).toLocaleString(),children:jA(e.sentAt)})]}),(0,Y.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,Y.jsxs)(`div`,{className:`review-history-files`,children:[e.filePaths.slice(0,6).map(e=>(0,Y.jsxs)(`span`,{className:`review-history-file`,title:e,children:[(0,Y.jsx)(hN,{size:10}),e.split(`/`).pop()]},e)),e.filePaths.length>6&&(0,Y.jsxs)(`span`,{className:`review-history-file-more`,children:[`+`,e.filePaths.length-6]})]})]},e.round))})]})}var pJ=(0,J.memo)(function({size:e=22,className:t,decorative:n=!0}){return(0,Y.jsx)(`img`,{className:t??`brand-mark`,src:`/favicon.svg`,alt:n?``:`diffing`,width:e,height:e,draggable:!1})});function mJ(e){let t=J.useRef(!0);t.current&&(t.current=!1,e())}function hJ({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=J.useRef(e!==void 0),[a,o]=J.useState(t);return[i?e:a,J.useCallback(e=>{i||o(e)},[])]}var gJ=J.createContext(null),_J=J.createContext(null);function vJ(){let e=J.useContext(gJ);if(e===null)throw Error(Tx(60));return e}function yJ(){let e=J.useContext(_J);if(e===null)throw Error(Tx(61));return e}var bJ=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}({}),xJ={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},SJ={valid(e){return e===null?null:e?{[bJ.valid]:``}:{[bJ.invalid]:``}}},CJ=J.createContext({invalid:void 0,name:void 0,validityData:{state:xJ,errors:[],error:``,value:``,initialValue:null},setValidityData:Pw,disabled:void 0,touched:!1,setTouched:Pw,dirty:!1,setDirty:Pw,filled:!1,setFilled:Pw,focused:!1,setFocused:Pw,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=Iw)=>e,getInputValidationProps:(e=Iw)=>e,inputRef:{current:null},commit:async()=>{}}});function wJ(e=!0){let t=J.useContext(CJ);if(t.setValidityData===Pw&&!e)throw Error(Tx(28));return t}var TJ=J.createContext({controlId:void 0,setControlId:Pw,labelId:void 0,setLabelId:Pw,messageIds:[],setMessageIds:Pw,getDescriptionProps:e=>e});function EJ(){return J.useContext(TJ)}function DJ(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,setControlId:a}=EJ(),o=mk(t);return wx(()=>{if(!(!n&&!t||a===Pw)){if(n){let e=r?.current;Bx(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 OJ=(e,t)=>Object.is(e,t);function kJ(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function AJ(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:kJ(e,t,n))}function jJ(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:kJ(e,t,n))}function MJ(e,t,n){return e.filter(e=>!kJ(e,t,n))}function NJ(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function PJ(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function FJ(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 NJ(e)}function IJ(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?NJ(e.value):NJ(e)}function LJ(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]??FJ(e,n);if(Array.isArray(t)){let r=PJ(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:FJ(e,n)}if(typeof e!=`object`){let t=r.find(t=>t&&t.value===e);return t&&t.label!=null?t.label:FJ(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 FJ(e,n)}function RJ(e,t){return!Array.isArray(e)||e.length===0?``:e.map(e=>FJ(e,t)).join(`, `)}var zJ={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=>kJ(e,n,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:kJ(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?``:IJ(n,r)})},BJ=J.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Pw,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function VJ(){return J.useContext(BJ)}function HJ(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function UJ(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=VJ(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=wJ(),f=uS(e.getValue);wx(()=>{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]),wx(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:HJ(u,c),validate(){let e=n;e===void 0&&(e=f()),l.current=!0,ec.flushSync(()=>o(e))}})},[o,a,t,s,f,r,c,l,i,u,n]),wx(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}function WJ(e,t){let n=J.useRef(e),r=uS(t);wx(()=>{n.current!==e&&r(n.current)},[e,r]),wx(()=>{n.current=e},[e])}function GJ(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=OJ,highlightItemOnHover:x=!0,children:S}=e,{clearErrors:C}=VJ(),{setDirty:w,shouldValidateOnChange:T,validityData:E,setFilled:D,name:O,disabled:k,validation:A}=wJ(),{controlId:j}=EJ(),M=DJ({id:t}),N=k||l,P=O??c,[F,I]=hJ({controlled:n,default:_?r??Fw:r,name:`Select`,state:`value`}),[L,R]=hJ({controlled:a,default:o,name:`Select`,state:`open`}),z=J.useRef([]),B=J.useRef([]),V=J.useRef(null),H=J.useRef(null),U=J.useRef(0),W=J.useRef(null),ee=J.useRef([]),te=J.useRef(!1),ne=J.useRef(!1),re=J.useRef(null),ie=J.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ae=J.useRef(!1),{mounted:oe,setMounted:G,transitionStatus:se}=sO(L),K=kx(()=>new rO({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=eO(K,zJ.activeIndex),le=eO(K,zJ.selectedIndex),ue=eO(K,zJ.triggerElement),de=eO(K,zJ.positionerElement),fe=J.useMemo(()=>_&&Array.isArray(F)&&F.length===0?``:IJ(F,y),[_,F,y]),pe=oS(K.state.triggerElement);UJ({id:M,commit:A.commit,value:F,controlRef:pe,name:P,getValue:()=>F});let q=J.useRef(F);wx(()=>{F!==q.current&&K.set(`forceMount`,!0)},[K,F]),wx(()=>{D(F!==null)},[F,D]),wx(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=jJ(e,n,b);K.set(`selectedIndex`,r===-1?null:r);return}let t=jJ(e,F,b);K.set(`selectedIndex`,t===-1?null:t)},[_,L,F,ee,b,K]),WJ(F,()=>{C(P),w(F!==E.initialValue),T()?A.commit(F):A.commit(F,!0)});let me=uS((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`)})}}),he=uS(()=>{G(!1),K.set(`activeIndex`,null),h?.(!1)});lO({enabled:!p,open:L,ref:V,onComplete(){L||he()}}),J.useImperativeHandle(p,()=>({unmount:he}),[he]);let ge=uS((e,t)=>{i?.(e,t),!t.isCanceled&&I(e)}),_e=uS(()=>{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)}),ve=vO({open:L,onOpenChange:me,elements:{reference:ue,floating:de}}),{getReferenceProps:ye,getFloatingProps:be,getItemProps:xe}=NO([gE(ve,{enabled:!u&&!N,event:`mousedown`}),jD(ve,{bubbles:!1}),HO(ve,{enabled:!u&&!N,listRef:z,activeIndex:ce,selectedIndex:le,disabledIndices:Fw,onNavigate(e){e===null&&!L||K.set(`activeIndex`,e)},focusItemOnHover:!1}),GO(ve,{enabled:!u&&!N&&(L||!_),listRef:B,activeIndex:ce,selectedIndex:le,onMatch(e){L?K.set(`activeIndex`,e):ge(ee.current[e],tT(`none`))},onTypingChange(e){te.current=e}})]);mJ(()=>{K.update({popupProps:be(),triggerProps:ye()})}),wx(()=>{K.update({id:M,modal:f,multiple:_,value:F,open:L,mounted:oe,transitionStatus:se,popupProps:be(),triggerProps:ye(),items:g,itemToStringLabel:v,itemToStringValue:y,isItemEqualToValue:b})},[K,M,f,_,F,L,oe,se,be,ye,g,v,y,b]);let Se=J.useMemo(()=>({store:K,name:P,required:d,disabled:N,readOnly:u,multiple:_,itemToStringLabel:v,itemToStringValue:y,highlightItemOnHover:x,setValue:ge,setOpen:me,listRef:z,popupRef:V,scrollHandlerRef:H,handleScrollArrowVisibility:_e,scrollArrowsMountedCountRef:U,getItemProps:xe,events:ve.context.events,valueRef:W,valuesRef:ee,labelsRef:B,typingRef:te,selectionRef:ie,selectedItemTextRef:re,validation:A,onOpenChangeComplete:h,keyboardActiveRef:ne,alignItemWithTriggerActiveRef:ae,initialValueRef:q}),[K,P,d,N,u,_,v,y,x,ge,me,xe,ve.context.events,A,h,_e]),Ce=sT(m,A.inputRef),we=_&&Array.isArray(F)&&F.length>0,Te=J.useMemo(()=>!_||!Array.isArray(F)||!P?null:F.map(e=>{let t=IJ(e,y);return(0,Y.jsx)(`input`,{type:`hidden`,name:P,value:t},t)}),[_,F,P,y]);return(0,Y.jsx)(gJ.Provider,{value:Se,children:(0,Y.jsxs)(_J.Provider,{value:ve,children:[S,(0,Y.jsx)(`input`,{...A.getInputValidationProps({onFocus(){K.state.triggerElement?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.value,n=tT(Hw,e.nativeEvent);function r(){if(_)return;let e=ee.current.find(e=>IJ(e,y).toLowerCase()===t.toLowerCase());e!=null&&(w(e!==E.initialValue),ge(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&&!we,readOnly:u,ref:Ce,style:pT,tabIndex:-1,"aria-hidden":!0}),Te]})})}function KJ(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 qJ=2,JJ={...fk,...SJ,value:()=>null},YJ=J.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}=wJ(),{labelId:f}=EJ(),{store:p,setOpen:m,selectionRef:h,validation:g,readOnly:_,alignItemWithTriggerActiveRef:v,disabled:y,keyboardActiveRef:b}=vJ(),x=d||y||i,S=eO(p,zJ.open),C=eO(p,zJ.value),w=eO(p,zJ.triggerProps),T=eO(p,zJ.positionerElement),E=eO(p,zJ.listElement),D=eO(p,zJ.serializedValue),O=oS(T),k=J.useRef(null),A=Px(),j=Px(),{getButtonProps:M,buttonRef:N}=FP({disabled:x,native:a}),P=sT(t,k,N,uS(e=>{p.set(`triggerElement`,e)})),F=Px(),I=Px();J.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=J.useMemo(()=>E?.id??VS(T)?.id,[E,T]),R=zT(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,tT(Jw,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=vT(e.currentTarget);function n(e){if(!k.current)return;let t=e.target;if(NS(k.current,t)||NS(O.current,t)||t===k.current)return;let n=KJ(k.current);e.clientX>=n.left-qJ&&e.clientX<=n.right+qJ&&e.clientY>=n.top-qJ&&e.clientY<=n.bottom+qJ||m(!1,tT(Zw,e))}j.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},g.getValidationProps,o,M);R.role=`combobox`;let z=J.useMemo(()=>({...u,open:S,disabled:x,value:C,readOnly:_,placeholder:!D}),[u,S,x,C,_,D]);return XT(`button`,e,{ref:[t,k],state:z,stateAttributesMapping:JJ,props:R})}),XJ={value:()=>null},ZJ=J.forwardRef(function(e,t){let{className:n,render:r,children:i,...a}=e,{store:o,valueRef:s}=vJ(),c=eO(o,zJ.value),l=eO(o,zJ.items),u=eO(o,zJ.itemToStringLabel),d=eO(o,zJ.serializedValue),f=J.useMemo(()=>({value:c,placeholder:!d}),[c,d]),p=typeof i==`function`?i(c):i??(Array.isArray(c)?RJ(c,u):LJ(c,l,u));return XT(`span`,e,{state:f,ref:[t,s],props:[{children:p},a],stateAttributesMapping:XJ})}),QJ=J.forwardRef(function(e,t){let{className:n,render:r,...i}=e,{store:a}=vJ(),o=eO(a,zJ.open);return XT(`span`,e,{state:J.useMemo(()=>({open:o}),[o]),ref:t,props:[{"aria-hidden":!0,children:`▼`},i],stateAttributesMapping:dk})}),$J=J.createContext(void 0),eY=J.forwardRef(function(e,t){let{store:n}=vJ(),r=eO(n,zJ.mounted),i=eO(n,zJ.forceMount);return r||i?(0,Y.jsx)($J.Provider,{value:!0,children:(0,Y.jsx)(iE,{ref:t,...e})}):null}),tY=J.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function nY(){return J.useContext(tY)}function rY(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=uS(i),o=J.useRef(0),s=kx(aY).current,c=kx(iY).current,[l,u]=J.useState(0),d=J.useRef(l),f=uS((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=uS(e=>{c.delete(e),d.current+=1,u(d.current)}),m=J.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(oY).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);wx(()=>{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]),wx(()=>{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]),wx(()=>()=>{n.current=[]},[n]),wx(()=>()=>{r&&(r.current=[])},[r]);let h=uS(e=>(s.add(e),()=>{s.delete(e)}));wx(()=>{s.forEach(e=>e(m))},[s,m]);let g=J.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,Y.jsx)(tY.Provider,{value:g,children:t})}function iY(){return new Map}function aY(){return new Set}function oY(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 sY=J.createContext(void 0);function cY(){let e=J.useContext(sY);if(!e)throw Error(Tx(59));return e}function lY(e,t){e&&Object.assign(e.style,t)}var uY={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},dY={position:`fixed`},fY=J.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=zw,..._}=e,{store:v,listRef:y,labelsRef:b,alignItemWithTriggerActiveRef:x,selectedItemTextRef:S,valuesRef:C,initialValueRef:w,popupRef:T,setValue:E}=vJ(),D=yJ(),O=eO(v,zJ.open),k=eO(v,zJ.mounted),A=eO(v,zJ.modal),j=eO(v,zJ.value),M=eO(v,zJ.touchModality),N=eO(v,zJ.positionerElement),P=eO(v,zJ.triggerElement),F=eO(v,zJ.isItemEqualToValue),I=J.useRef(null),L=J.useRef(null),[R,z]=J.useState(h),B=k&&R&&!M;!k&&R!==h&&z(h),wx(()=>{k||(zJ.scrollUpArrowVisible(v.state)&&v.set(`scrollUpArrowVisible`,!1),zJ.scrollDownArrowVisible(v.state)&&v.set(`scrollDownArrowVisible`,!1))},[v,k]),J.useImperativeHandle(x,()=>B),SP((B||A)&&O&&!M,P);let V=Nk({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?dY:V.positionerStyles,W=J.useMemo(()=>{let e={};return O||(e.pointerEvents=`none`),{role:`presentation`,hidden:!k,style:{...U,...e}}},[O,k,U]),ee=J.useMemo(()=>({open:O,side:H,align:V.align,anchorHidden:V.anchorHidden}),[O,H,V.align,V.anchorHidden]),te=XT(`div`,e,{ref:[t,uS(e=>{v.set(`positionerElement`,e)})],state:ee,stateAttributesMapping:pk,props:[W,_]}),ne=J.useRef(0),re=uS(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=tT(Hw);if(t!==0&&!v.state.multiple&&j!==null&&jJ(C.current,j,F)===-1){let e=w.current,t=e!=null&&AJ(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=>AJ(C.current,e,F));(e.length!==j.length||e.some(e=>!AJ(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:``};lY(N,e),lY(T.current,e)}}),ie=J.useMemo(()=>({...V,side:H,alignItemWithTriggerActive:B,setControlledAlignItemWithTrigger:z,scrollUpArrowRef:I,scrollDownArrowRef:L}),[V,H,B,z]);return(0,Y.jsx)(rY,{elementsRef:y,labelsRef:b,onMapChange:re,children:(0,Y.jsxs)(sY.Provider,{value:ie,children:[k&&A&&(0,Y.jsx)(UP,{inert:Gk(!O),cutout:P}),te]})})});function pY(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 mY=`base-ui-disable-scrollbar`,hY={className:mY,element:(0,Y.jsx)(`style`,{href:mY,precedence:`base-ui:low`,children:`.${mY}{scrollbar-width:none}.${mY}::-webkit-scrollbar{display:none}`})},gY={...pk,...rk},_Y=J.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}=vJ(),{side:h,align:g,alignItemWithTriggerActive:_,setControlledAlignItemWithTrigger:v,scrollDownArrowRef:y,scrollUpArrowRef:b}=cY(),x=tF(!0)!=null,S=yJ(),C=Px(),w=eO(a,zJ.id),T=eO(a,zJ.open),E=eO(a,zJ.mounted),D=eO(a,zJ.popupProps),O=eO(a,zJ.transitionStatus),k=eO(a,zJ.triggerElement),A=eO(a,zJ.positionerElement),j=eO(a,zJ.listElement),M=J.useRef(0),N=J.useRef(!1),P=J.useRef(0),F=J.useRef(!1),I=J.useRef({}),L=_T(),R=uS(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=vT(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()});J.useImperativeHandle(m,()=>R,[R]),lO({open:T,ref:o,onComplete(){T&&s?.(!0)}});let z=J.useMemo(()=>({open:T,transitionStatus:O,side:h,align:g}),[T,O,h,g]);wx(()=>{!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]),wx(()=>{E||_||(F.current=!1,N.current=!1,M.current=0,P.current=0,lY(A,I.current))},[E,_,A,o]),wx(()=>{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=vT(k),i=Lx(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&&_S;if(H||U){F.current=!0,lY(A,I.current),ec.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]),J.useEffect(()=>{if(!_||!A||!E)return;let e=Lx(A);function t(e){c(!1,tT(eT,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&&$P.has(e.key)&&e.stopPropagation()},onMouseMove(){d.current=!1},onPointerLeave(e){if(pY(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%`}:uY}},V=XT(`div`,e,{ref:[t,o],state:z,stateAttributesMapping:gY,props:[D,B,Fk(O),{className:!j&&_?hY.className:void 0},i]});return(0,Y.jsxs)(J.Fragment,{children:[hY.element,(0,Y.jsx)(hE,{context:S,modal:!1,disabled:!E,restoreFocus:!0,children:V})]})}),vY=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function yY(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}=nY(),f=J.useRef(-1),[p,m]=J.useState(a??(i===vY.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=J.useRef(null),g=J.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 wx(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),wx(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),J.useMemo(()=>({ref:g,index:p}),[p,g])}var bY=J.createContext(void 0);function xY(){let e=J.useContext(bY);if(!e)throw Error(Tx(57));return e}var SY=J.memo(J.forwardRef(function(e,t){let{render:n,className:r,value:i=null,label:a,disabled:o=!1,nativeButton:s=!1,...c}=e,l=J.useRef(null),u=yY({label:a,textRef:l,indexGuessBehavior:vY.GuessFromOrder}),{store:d,getItemProps:f,setOpen:p,setValue:m,selectionRef:h,typingRef:g,valuesRef:_,keyboardActiveRef:v,multiple:y,highlightItemOnHover:b}=vJ(),x=Px(),S=eO(d,zJ.isActive,u.index),C=eO(d,zJ.isSelected,u.index,i),w=eO(d,zJ.isSelectedByFocus,u.index),T=eO(d,zJ.isItemEqualToValue),E=u.index,D=E!==-1,O=J.useRef(null),k=oS(E);wx(()=>{if(!D)return;let e=_.current;return e[E]=i,()=>{delete e[E]}},[D,E,i,_]),wx(()=>{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&&kJ(t,i,T)&&d.set(`selectedIndex`,E)},[D,E,y,T,d,i]);let A=J.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=J.useRef(null),N=J.useRef(`mouse`),P=J.useRef(!1),{getButtonProps:F,buttonRef:I}=FP({disabled:o,focusableWhenDisabled:!0,native:s});function L(e){let t=d.state.value;if(y){let n=Array.isArray(t)?t:[];m(C?MJ(n,i,T):[...n,i],tT(qw,e))}else m(i,tT(qw,e)),p(!1,tT(qw,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||pY(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=XT(`div`,e,{ref:[I,t,u.ref,O],state:A,props:[j,R,c,F]}),B=J.useMemo(()=>({selected:C,indexRef:k,textRef:l,selectedByFocus:w,hasRegistered:D}),[C,k,l,w,D]);return(0,Y.jsx)(bY.Provider,{value:B,children:z})})),CY=J.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=xY();return n||r?(0,Y.jsx)(wY,{...e,ref:t}):null}),wY=J.memo(J.forwardRef((e,t)=>{let{render:n,className:r,keepMounted:i,...a}=e,{selected:o}=xY(),s=J.useRef(null),{transitionStatus:c,setMounted:l}=sO(o),u=J.useMemo(()=>({selected:o,transitionStatus:c}),[o,c]),d=XT(`span`,e,{ref:[t,s],state:u,props:[{"aria-hidden":!0,children:`✔️`},a],stateAttributesMapping:rk});return lO({open:o,ref:s,onComplete(){o||l(!1)}}),d})),TY=J.memo(J.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=xY(),{selectedItemTextRef:o}=vJ(),{className:s,render:c,...l}=e;return XT(`div`,e,{ref:[J.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 EY({value:e,onValueChange:t,options:n,ariaLabel:r,className:i}){return(0,Y.jsxs)(GJ,{value:e,onValueChange:e=>t(e),modal:!1,children:[(0,Y.jsxs)(YJ,{className:`ui-select-trigger ${i??``}`,"aria-label":r,children:[(0,Y.jsx)(ZJ,{children:e=>n.find(t=>t.value===e)?.label??e}),(0,Y.jsx)(QJ,{className:`ui-select-icon`,children:(0,Y.jsx)(QM,{size:12})})]}),(0,Y.jsx)(eY,{children:(0,Y.jsx)(fY,{className:`ui-select-positioner`,sideOffset:4,align:`end`,side:`bottom`,alignItemWithTrigger:!1,children:(0,Y.jsx)(_Y,{className:`ui-select-popup`,children:n.map(e=>(0,Y.jsxs)(SY,{value:e.value,className:`ui-select-item`,children:[(0,Y.jsx)(TY,{children:e.label}),(0,Y.jsx)(CY,{className:`ui-select-indicator`,children:(0,Y.jsx)(qM,{size:13})})]},e.value))})})})]})}var DY=[{value:`word`,label:`Word`},{value:`word-alt`,label:`Word (alt)`},{value:`char`,label:`Character`},{value:`none`,label:`None`}],OY=[{value:`classic`,label:`Classic (+/−)`},{value:`bars`,label:`Bars`},{value:`none`,label:`None`}],kY=[{value:`line-info`,label:`Line info + context`},{value:`line-info-basic`,label:`Line info`},{value:`metadata`,label:`Metadata only`},{value:`simple`,label:`Simple`}],AY=[{value:`both`,label:`Both`},{value:`line`,label:`Line only`},{value:`number`,label:`Number only`},{value:`disabled`,label:`Disabled`}],jY=[11,12,13,14,15,16].map(e=>({value:String(e),label:`${e}px`})),MY=[2,4,8].map(e=>({value:String(e),label:String(e)})),NY=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`}],PY=[{value:`0`,label:`Disabled`},{value:`100`,label:`100 lines`},{value:`200`,label:`200 lines`},{value:`400`,label:`400 lines`},{value:`800`,label:`800 lines`}],FY=[{value:``,label:`Default`},{value:`chrome`,label:`Chrome`},{value:`firefox`,label:`Firefox`},{value:`edge`,label:`Edge`},{value:`brave`,label:`Brave`}],IY=[{value:`default`,label:`Default / System`},{value:`vscode`,label:`VS Code`},{value:`zed`,label:`Zed`},{value:`vim`,label:`Vim`},{value:`neovim`,label:`Neovim`},{value:`ghostty`,label:`Neovim (Ghostty)`}];function LY({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,editDiagnostics:x=!1,ignoreAllSpace:S=!1,onDiffStyleChange:C,onDiffOptionsChange:w,onDefaultTabSizeChange:T,onBrowserChange:E,onOpenThemeModal:D,onEditorIDEChange:O,onLineDiffTypeChange:k,onLineWrapChange:A,onDiffIndicatorsChange:j,onShowLineNumbersChange:M,onHunkSeparatorsChange:N,onLineHoverHighlightChange:P,onFontSizeChange:F,onHapticsChange:I,onSoundsChange:L,onDensityChange:R,onAutoCollapseLineThresholdChange:z,onRequireViewAllBeforeSendChange:B,onShowStatusBarChange:V,onIgnoreSpaceChange:H,onIgnoreAllSpaceChange:U,onEditDiagnosticsChange:W,onOpenUiFontModal:ee,onOpenMonoFontModal:te,showSource:ne=!0,showWhitespace:re=!0,showExternalTools:ie=!0,showSendPolicy:ae=!0}){let[oe,G]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&(e.key===`,`||e.code===`Comma`)&&(e.preventDefault(),G(e=>!e))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]),(0,Y.jsx)(iF,{open:oe,onOpenChange:G,ariaLabel:`Settings`,className:`settings-popover`,trigger:(0,Y.jsxs)(`button`,{className:`btn btn-sm settings-btn ${oe?`btn-active`:``}`,title:`Settings (⌘,)`,"aria-label":`Settings`,children:[(0,Y.jsx)(iP,{size:14}),(0,Y.jsx)(`span`,{className:`btn-label`,children:`Settings`})]}),children:(0,Y.jsxs)(`div`,{className:`popover-scroll settings-panel`,children:[ne&&t&&w&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`Source`}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:t.staged,onChange:e=>w({...t,staged:e.target.checked})}),`Show staged`]}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:t.untracked,onChange:e=>w({...t,untracked:e.target.checked})}),`Show untracked`]})]}),(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`Display`}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Inline diff`}),(0,Y.jsx)(EY,{value:a,onValueChange:e=>k(e),options:DY,ariaLabel:`Inline diff style`})]}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>A(e.target.checked)}),`Wrap long lines`]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Diff indicators`}),(0,Y.jsx)(EY,{value:s,onValueChange:e=>j(e),options:OY,ariaLabel:`Diff indicators`})]}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>M(e.target.checked)}),`Show line numbers`]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Hunk separator`}),(0,Y.jsx)(EY,{value:l,onValueChange:e=>N(e),options:kY,ariaLabel:`Hunk separator style`})]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Hover highlight`}),(0,Y.jsx)(EY,{value:u,onValueChange:e=>P(e),options:AY,ariaLabel:`Hover highlight`})]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Font size`}),(0,Y.jsx)(EY,{value:String(d),onValueChange:e=>F(Number(e)),options:jY,ariaLabel:`Font size`})]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Default tab size`}),(0,Y.jsx)(EY,{value:String(n),onValueChange:e=>T(Number(e)),options:MY,ariaLabel:`Default tab size`})]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`UI font`}),(0,Y.jsxs)(`button`,{className:`btn btn-sm settings-btn`,onClick:()=>{G(!1),ee()},title:m??`Default (Geist Mono)`,children:[(0,Y.jsx)(dP,{size:13}),(0,Y.jsx)(`span`,{className:`settings-value-label`,children:m??`Default…`})]})]}),(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`Comfort`}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Density`}),(0,Y.jsx)(EY,{value:g,onValueChange:e=>R(e),options:NY,ariaLabel:`UI density`})]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Auto-collapse huge files`}),(0,Y.jsx)(EY,{value:String(_),onValueChange:e=>z(Number(e)),options:PY,ariaLabel:`Auto-collapse line threshold`})]}),ae&&B&&(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:v,onChange:e=>B(e.target.checked)}),(0,Y.jsxs)(`span`,{className:`settings-icon-label`,children:[(0,Y.jsx)(oP,{size:12}),` Warn before sending if files are unviewed`]})]}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>V(e.target.checked)}),(0,Y.jsxs)(`span`,{className:`settings-icon-label`,children:[(0,Y.jsx)(kN,{size:12}),` Show status bar`]})]}),re&&H&&U&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`Whitespace`}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>H(e.target.checked)}),`Ignore space-change (-b)`]}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:S,onChange:e=>U(e.target.checked)}),`Ignore all space (-w)`]})]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Code font`}),(0,Y.jsxs)(`button`,{className:`btn btn-sm settings-btn`,onClick:()=>{G(!1),te()},title:h??`Default (JetBrains Mono)`,children:[(0,Y.jsx)(dP,{size:13}),(0,Y.jsx)(`span`,{className:`settings-value-label`,children:h??`Default…`})]})]}),ie&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`External tools`}),E&&(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Browser`}),(0,Y.jsx)(EY,{value:r||``,onValueChange:E,options:FY,ariaLabel:`Browser`})]}),O&&(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Preferred IDE`}),(0,Y.jsx)(EY,{value:i||`default`,onValueChange:O,options:IY,ariaLabel:`Preferred IDE`})]})]}),(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`Appearance`}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Diff style`}),(0,Y.jsx)(EY,{value:e,onValueChange:e=>C(e),options:[{value:`split`,label:`Split`},{value:`unified`,label:`Unified`}],ariaLabel:`Diff style`})]}),(0,Y.jsxs)(`div`,{className:`settings-item settings-item-spaced`,children:[(0,Y.jsx)(`span`,{children:`Theme`}),(0,Y.jsxs)(`button`,{className:`btn btn-sm settings-btn`,onClick:()=>{G(!1),D()},children:[(0,Y.jsx)(KN,{size:14}),` Switch Theme…`]})]}),(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`Feedback`}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>I(e.target.checked)}),`Haptic feedback`]}),(0,Y.jsxs)(`label`,{className:`settings-item`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>L(e.target.checked)}),`Sound effects`]}),(0,Y.jsx)(`div`,{className:`settings-section-label`,children:`Editing`}),(0,Y.jsxs)(`label`,{className:`settings-item`,title:`Inline diagnostics (whitespace, missing final newline, tabs) while editing a file in place. Off by default for a noise-free review.`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>W(e.target.checked)}),`Edit diagnostics`]})]})})}function RY({commentCount:e,onResolveAllOpen:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.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,Y.jsx)(KM,{size:14}),(0,Y.jsx)(`span`,{className:`btn-label`,children:`Resolve all`})]}),(0,Y.jsx)(sJ,{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,Y.jsx)(KM,{size:18}),busy:i,error:o,onConfirm:l,onCancel:c})]})}var zY=(0,J.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,editDiagnostics:L,onDiffStyleChange:R,onDiffOptionsChange:z,onDefaultTabSizeChange:B,onBrowserChange:V,onOpenThemeModal:H,onEditorIDEChange:U,onLineDiffTypeChange:W,onLineWrapChange:ee,onDiffIndicatorsChange:te,onShowLineNumbersChange:ne,onHunkSeparatorsChange:re,onLineHoverHighlightChange:ie,onFontSizeChange:ae,onHapticsChange:oe,onSoundsChange:G,onDensityChange:se,onAutoCollapseLineThresholdChange:K,onRequireViewAllBeforeSendChange:ce,onShowStatusBarChange:le,onIgnoreSpaceChange:ue,onIgnoreAllSpaceChange:de,onEditDiagnosticsChange:fe,onResolveAllOpen:pe,onOpenUiFontModal:q,onOpenMonoFontModal:me,onOpenSearch:he,onCopyComments:ge,onCopyMarkdown:_e,onSendToAgent:ve,agentWaiting:ye,waitingAgents:be=[],sending:xe,comments:Se,viewedFileCount:Ce,onEditComment:we,onDeleteComment:Te,sidebarCollapsed:Ee,onToggleSidebar:De,zenMode:Oe,onToggleZen:ke,sendReviewOpen:Ae,onSendReviewOpenChange:je}){let Me=v?`${y} commit${y===1?``:`s`}`:n===r?`${n} file${n===1?``:`s`}`:`${n}/${r} files`;return(0,Y.jsxs)(`header`,{className:`toolbar diff-app-toolbar`,role:`banner`,children:[(0,Y.jsxs)(`div`,{className:`toolbar-left`,children:[De&&(0,Y.jsx)(`button`,{className:`toolbar-mobile-toggle`,onClick:De,"aria-label":Ee?`Open file tree`:`Close file tree`,"aria-expanded":!Ee,title:Ee?`Open sidebar · b`:`Close sidebar · b`,children:(0,Y.jsx)(FN,{size:18})}),(0,Y.jsxs)(`div`,{className:`toolbar-brand`,children:[(0,Y.jsx)(pJ,{size:20,className:`toolbar-brand-mark`}),(0,Y.jsxs)(`div`,{className:`toolbar-brand-text`,children:[(0,Y.jsx)(`h1`,{className:`toolbar-title`,children:e||`diffing`}),t&&(0,Y.jsxs)(`span`,{className:`toolbar-branch-inline`,title:t,children:[(0,Y.jsx)(bN,{size:11,"aria-hidden":`true`}),t]})]})]}),(0,Y.jsxs)(`div`,{className:`toolbar-meta`,"aria-label":`Diff summary`,children:[(0,Y.jsx)(`span`,{className:`toolbar-chip`,children:Me}),(i>0||a>0)&&(0,Y.jsxs)(`span`,{className:`toolbar-chip toolbar-chip-diff`,children:[i>0&&(0,Y.jsxs)(`span`,{className:`stat-additions`,children:[`+`,i]}),a>0&&(0,Y.jsxs)(`span`,{className:`stat-deletions`,children:[`−`,a]})]}),o>0&&(0,Y.jsxs)(`span`,{className:`toolbar-chip toolbar-chip-comments`,children:[o,` open`]}),l&&l.round>0&&(0,Y.jsx)(fJ,{lastRound:l.round})]})]}),(0,Y.jsxs)(`div`,{className:`toolbar-right`,children:[ke&&(0,Y.jsxs)(`button`,{className:`btn btn-sm toolbar-zen-btn ${Oe?`is-active`:``}`,onClick:ke,"aria-pressed":Oe===!0,title:`Zen mode — diffs only, no sidebar or toolbar (z)`,"aria-label":Oe?`Exit zen mode`:`Enter zen mode`,children:[Oe?(0,Y.jsx)(VN,{size:14}):(0,Y.jsx)(PN,{size:14}),(0,Y.jsx)(`span`,{className:`btn-label`,children:Oe?`Exit zen`:`Zen`})]}),(0,Y.jsxs)(`button`,{className:`btn btn-sm toolbar-search-btn`,onClick:he,title:`Search files, text, symbols (⌘K)`,"aria-label":`Search`,children:[(0,Y.jsx)(rP,{size:14}),(0,Y.jsx)(`span`,{className:`btn-label`,children:`Search`}),(0,Y.jsx)(`kbd`,{className:`toolbar-search-kbd`,children:`⌘K`})]}),s>0&&(0,Y.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,Y.jsx)(`span`,{className:`agent-waiting-dot`,"aria-hidden":`true`}),(0,Y.jsx)(oN,{size:14}),(0,Y.jsx)(`span`,{className:`btn-label`,children:`Plans`}),c>0&&(0,Y.jsx)(`span`,{className:`toolbar-plans-badge`,children:c})]}),(0,Y.jsx)(RY,{commentCount:o,onResolveAllOpen:pe}),(0,Y.jsx)(LY,{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,editDiagnostics:L,onDiffStyleChange:R,onDiffOptionsChange:z,onDefaultTabSizeChange:B,onBrowserChange:V,onOpenThemeModal:H,onEditorIDEChange:U,onLineDiffTypeChange:W,onLineWrapChange:ee,onDiffIndicatorsChange:te,onShowLineNumbersChange:ne,onHunkSeparatorsChange:re,onLineHoverHighlightChange:ie,onFontSizeChange:ae,onHapticsChange:oe,onSoundsChange:G,onDensityChange:se,onAutoCollapseLineThresholdChange:K,onRequireViewAllBeforeSendChange:ce,onShowStatusBarChange:le,onIgnoreSpaceChange:ue,onIgnoreAllSpaceChange:de,onEditDiagnosticsChange:fe,onOpenUiFontModal:q,onOpenMonoFontModal:me,showSource:!_}),(0,Y.jsx)(dJ,{comments:Se,totalFileCount:r,viewedFileCount:Ce,requireViewAllBeforeSend:N,onEditComment:we,onDeleteComment:Te,onSend:ve,sending:xe,agentWaiting:ye,waitingAgents:be,onCopyComments:ge,onCopyMarkdown:_e,open:Ae,onOpenChange:je})]})]})}),BY=(0,J.memo)(function({repoName:e,branch:t,fileCount:n,totalFileCount:r,additions:i,deletions:a,showMode:o,showCommitCount:s,onExit:c}){let l=o?`${s} commit${s===1?``:`s`}`:n===r?`${n} file${n===1?``:`s`}`:`${n}/${r} files`;return(0,Y.jsxs)(`header`,{className:`zen-bar`,role:`banner`,children:[(0,Y.jsxs)(`span`,{className:`zen-bar-branch`,title:t||e,children:[(0,Y.jsx)(bN,{size:13,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`zen-bar-branch-text`,children:t||e||`diffing`})]}),(0,Y.jsx)(`span`,{className:`zen-bar-count`,"aria-label":`Diff summary`,children:l}),(i>0||a>0)&&(0,Y.jsxs)(`span`,{className:`zen-bar-count zen-bar-count-diff`,"aria-hidden":`true`,children:[i>0&&(0,Y.jsxs)(`span`,{className:`stat-additions`,children:[`+`,i]}),a>0&&(0,Y.jsxs)(`span`,{className:`stat-deletions`,children:[`−`,a]})]}),(0,Y.jsx)(`span`,{className:`zen-bar-hint`,children:`z or Esc to exit`}),(0,Y.jsxs)(`button`,{type:`button`,className:`zen-bar-exit`,onClick:c,title:`Exit zen mode (z)`,"aria-label":`Exit zen mode`,children:[(0,Y.jsx)(VN,{size:13,"aria-hidden":`true`}),`Exit zen`]})]})});function VY({open:e,onClose:t,...n}){let r=(0,J.useRef)(null);return(0,Y.jsx)(oJ,{open:e,onClose:t,className:`send-review-modal`,ariaLabel:`Submit your review to the agent`,initialFocus:r,children:(0,Y.jsx)(lJ,{...n,onCancel:t,showLeftResize:!1,initialFocusRef:r})})}function HY({overview:e,commits:t}){let[n,r]=(0,J.useState)(!1),i=e.commitSubjects.length>0,a=e.truncated>0,o=!!e.subtitle||a||i;return(0,Y.jsxs)(`section`,{className:`diff-overview-banner`,"data-kind":e.kind,"aria-label":`Diff overview: ${e.headline}`,children:[(0,Y.jsxs)(`header`,{className:`diff-overview-banner-header`,children:[(0,Y.jsxs)(`div`,{className:`diff-overview-banner-line`,children:[(0,Y.jsx)(KY,{kind:e.kind}),(0,Y.jsx)(`h2`,{className:`diff-overview-banner-headline`,children:e.headline})]}),o&&(0,Y.jsxs)(`div`,{className:`diff-overview-banner-meta`,children:[e.subtitle&&(0,Y.jsx)(`span`,{className:`diff-overview-banner-subtitle`,children:e.subtitle}),a&&(0,Y.jsxs)(`span`,{className:`diff-overview-banner-truncated-badge`,title:`${e.truncated} additional ${e.truncated===1?`commit`:`commits`} not shown`,children:[`+`,e.truncated]}),i&&(0,Y.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,Y.jsx)(JM,{size:14}):(0,Y.jsx)(XM,{size:14}),(0,Y.jsx)(_N,{size:13,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{children:[n?`Hide`:`Show`,` `,e.commitSubjects.length,` `,`commit`,e.commitSubjects.length===1?``:`s`]})]})]})]}),i&&n&&(0,Y.jsx)(UY,{overview:e,commits:t,id:`diff-overview-banner-details`})]})}function UY({overview:e,commits:t,id:n}){return t&&t.length>0?(0,Y.jsxs)(`ul`,{id:n,className:`diff-overview-banner-subjects`,children:[t.map((e,n)=>(0,Y.jsx)(WY,{commit:e,index:n,total:t.length},e.sha)),e.truncated>0&&(0,Y.jsxs)(`li`,{className:`diff-overview-banner-truncated`,role:`status`,children:[`+ `,e.truncated,` more commit`,e.truncated===1?``:`s`,` not shown`]})]}):(0,Y.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,Y.jsxs)(`li`,{className:`diff-overview-banner-subject-row`,children:[(0,Y.jsx)(xN,{size:12,className:`diff-overview-banner-subject-icon`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`diff-overview-banner-subject-text`,children:t}),r&&e.fromDate&&e.toDate&&(0,Y.jsx)(`span`,{className:`diff-overview-banner-subject-dates`,children:n===0?e.fromDate:e.toDate})]},`${n}-${t}`)})})}function WY({commit:e,index:t,total:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.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,Y.jsxs)(`li`,{className:`diff-overview-banner-commit-row`,"aria-label":u,children:[(0,Y.jsxs)(`div`,{className:`diff-overview-banner-commit-line`,children:[(0,Y.jsx)(xN,{size:12,className:`diff-overview-banner-subject-icon`,"aria-hidden":`true`}),(0,Y.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,Y.jsx)(`span`,{children:e.shortSha}),r?(0,Y.jsx)(qM,{size:12,"aria-hidden":`true`}):(0,Y.jsx)(dN,{size:12,"aria-hidden":`true`})]}),l&&(0,Y.jsx)(`span`,{className:`diff-overview-banner-merge-badge`,title:`Merge commit with ${e.parents.length} parents`,children:`merge`}),(0,Y.jsx)(`span`,{className:`diff-overview-banner-commit-subject`,children:e.subject})]}),(0,Y.jsxs)(`div`,{className:`diff-overview-banner-commit-meta`,children:[(0,Y.jsxs)(`span`,{className:`diff-overview-banner-commit-author`,children:[(0,Y.jsx)(`span`,{className:`diff-overview-banner-commit-author-name`,children:e.authorName}),(0,Y.jsxs)(`span`,{className:`diff-overview-banner-commit-author-email`,children:[`<`,e.authorEmail,`>`]})]}),(0,Y.jsx)(`span`,{className:`diff-overview-banner-commit-date`,title:e.authorDate,children:GY(e.authorDate)}),e.committerName!==e.authorName||e.committerEmail!==e.authorEmail?(0,Y.jsxs)(`span`,{className:`diff-overview-banner-commit-committer`,title:`Committed by ${e.committerName} <${e.committerEmail}> at ${e.committerDate}`,children:[(0,Y.jsx)(`span`,{className:`diff-overview-banner-commit-committer-label`,children:`committed by`}),` `,(0,Y.jsx)(`span`,{children:e.committerName})]}):null]}),c&&(0,Y.jsxs)(`div`,{className:`diff-overview-banner-commit-body`,children:[(0,Y.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,Y.jsx)(JM,{size:14}):(0,Y.jsx)(XM,{size:14}),(0,Y.jsx)(_N,{size:13,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:a?`Hide message`:`Show message`})]}),a&&(0,Y.jsx)(`pre`,{id:`diff-overview-commit-body-${e.shortSha}`,className:`diff-overview-banner-commit-body-pre`,children:e.body})]})]})}function GY(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 KY({kind:e}){let t={size:14,className:`diff-overview-banner-icon`,"aria-hidden":!0};switch(e){case`working-tree`:case`staged-only`:return(0,Y.jsx)(ON,{...t});case`range`:return(0,Y.jsx)(bN,{...t});case`commit-single`:case`commit-series`:return(0,Y.jsx)(xN,{...t});case`pr`:return(0,Y.jsx)(wN,{...t})}}function qY(e,t){return JSON.stringify(e.overview)===JSON.stringify(t.overview)&&JSON.stringify(e.commits)===JSON.stringify(t.commits)}var JY=(0,J.memo)(HY,qY);function YY({query:e,hits:t,index:n,focusNonce:r,onQueryChange:i,onNext:a,onPrev:o,onClose:s}){let c=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=c.current;e&&(e.focus({preventScroll:!0}),e.select(),e.scrollIntoView({block:`nearest`,behavior:`auto`}))},[r]);let l=e=>{e.key===`Enter`?(e.preventDefault(),e.shiftKey?o():a()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),s())},u=e=>{i(e.target.value),c.current?.scrollIntoView({block:`nearest`,behavior:`auto`})},d=t.length,f=d===0?0:n+1;return(0,Y.jsxs)(`div`,{className:`file-search-bar`,onClick:e=>e.stopPropagation(),onKeyDown:l,role:`search`,"aria-label":`Find in file`,children:[(0,Y.jsx)(rP,{size:13,className:`file-search-bar-icon`,"aria-hidden":`true`}),(0,Y.jsx)(`input`,{ref:c,className:`file-search-bar-input`,type:`text`,value:e,onChange:u,placeholder:`Find in file…`,"aria-label":`Find in file`,spellCheck:!1,autoComplete:`off`}),(0,Y.jsx)(`span`,{className:`file-search-bar-count`,"aria-live":`polite`,children:e.trim()?`${f}/${d}`:`${d} match${d===1?``:`es`}`}),(0,Y.jsxs)(`div`,{className:`file-search-bar-actions`,children:[(0,Y.jsx)(`button`,{className:`file-search-bar-btn`,onClick:o,disabled:d===0,title:`Previous match (Shift+Enter)`,"aria-label":`Previous match`,children:(0,Y.jsx)(ZM,{size:13})}),(0,Y.jsx)(`button`,{className:`file-search-bar-btn`,onClick:a,disabled:d===0,title:`Next match (Enter)`,"aria-label":`Next match`,children:(0,Y.jsx)(JM,{size:13})}),(0,Y.jsx)(`button`,{className:`file-search-bar-btn`,onClick:s,title:`Close (Esc)`,"aria-label":`Close search`,children:(0,Y.jsx)(mP,{size:13})})]})]})}var XY=`
1601
1601
  .comment-bubble-canvas {
1602
1602
  width: min(720px, calc(100% - 40px), calc(100vw - 80px)) !important;
1603
1603
  max-width: calc(100vw - 80px) !important;
@@ -3644,7 +3644,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
3644
3644
  `),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(`
3645
3645
  `)}function a7(e,t){if(e.lineNumber===0)return!1;let n=r7(e.lineContent??``);if(!n||t==null||t===``)return!1;let r=n.replace(/\r\n/g,`
3646
3646
  `);return!t.replace(/\r\n/g,`
3647
- `).includes(r)}function o7(e,t){return e.map(e=>{let n=t.get(e.filePath);if(n===void 0)return e;let r=a7(e,n);return e.outdated===r?e:{...e,outdated:r}})}function s7(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 c7(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 l7({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(c7(t,r,`prev`)),c=()=>n(c7(t,r,`next`));return(0,Y.jsxs)(`div`,{className:`commit-walk-bar`,role:`navigation`,"aria-label":`Walk commits`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`btn btn-sm commit-walk-btn`,onClick:s,"aria-label":`Previous commit`,title:`Previous commit ([)`,children:(0,Y.jsx)(YM,{size:14})}),(0,Y.jsxs)(`div`,{className:`commit-walk-center`,children:[(0,Y.jsx)(xN,{size:14,"aria-hidden":`true`}),i?(0,Y.jsxs)(`span`,{className:`commit-walk-label`,children:[`All `,r,` commits`]}):(0,Y.jsxs)(`span`,{className:`commit-walk-label`,title:o?.subject,children:[(0,Y.jsxs)(`span`,{className:`commit-walk-count`,children:[a+1,` / `,r]}),(0,Y.jsx)(`code`,{className:`commit-walk-sha`,children:o?.shortSha??o?.sha.slice(0,7)}),(0,Y.jsx)(`span`,{className:`commit-walk-subject`,children:o?.subject})]})]}),(0,Y.jsxs)(`div`,{className:`commit-walk-trailing`,children:[(0,Y.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,Y.jsx)(`button`,{type:`button`,className:`btn btn-sm commit-walk-btn`,onClick:c,"aria-label":`Next commit`,title:`Next commit (])`,children:(0,Y.jsx)(XM,{size:14})})]})]})}function u7(){let[e,t]=(0,J.useState)(null);return(0,J.useEffect)(()=>Ej(`agent-progress`,e=>{try{t(JSON.parse(e))}catch{}}),[]),(0,J.useEffect)(()=>{if(!e)return;let n=setTimeout(()=>t(null),1e4);return()=>clearTimeout(n)},[e]),e?(0,Y.jsxs)(`div`,{className:`agent-progress-toast`,role:`status`,"aria-live":`polite`,children:[(0,Y.jsx)(`div`,{className:`agent-progress-toast-icon`,children:(0,Y.jsx)(GM,{size:16})}),(0,Y.jsxs)(`div`,{className:`agent-progress-toast-body`,children:[(0,Y.jsxs)(`div`,{className:`agent-progress-toast-title`,children:[e.model||e.agentId||`Agent`,e.pct!=null&&(0,Y.jsxs)(`span`,{className:`agent-progress-toast-pct`,children:[Math.round(e.pct),`%`]})]}),(0,Y.jsx)(`div`,{className:`agent-progress-toast-msg`,children:e.message}),e.pct!=null&&(0,Y.jsx)(`div`,{className:`agent-progress-bar`,"aria-hidden":`true`,children:(0,Y.jsx)(`div`,{className:`agent-progress-bar-fill`,style:{width:`${e.pct}%`}})})]}),(0,Y.jsx)(`button`,{type:`button`,className:`agent-progress-toast-close`,onClick:()=>t(null),"aria-label":`Dismiss`,children:(0,Y.jsx)(mP,{size:14})})]}):null}var d7=[`review-since-last`];function f7(e=!0){let t=Le(),n=Qe({queryKey:d7,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,J.useEffect)(()=>{if(!e)return;let n=()=>{t.invalidateQueries({queryKey:d7})},r=Ej(`change`,n),i=Ej(`agent-status`,n);return()=>{r(),i()}},[e,t]);let r=n.data,i=(0,J.useMemo)(()=>new Set(r?.reviewFiles??[]),[r?.reviewFiles]);return{sinceLast:r??null,reviewSet:i,hasBaseline:!!r?.hasBaseline,loading:n.isLoading,refetch:n.refetch}}function p7(){let e=Ih(),{settings:t,loaded:n,updateSettings:r}=Xj(),[,i]=(0,J.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}=Aj({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}=Fj(),{sessions:R,dirtyCount:z,enterEdit:B,handleEditChange:V,handleEditAttach:H,saveEdit:U,saveAllDirty:W,discardEdit:ee,exitEdit:te,createEditor:ne}=sA({diagnosticsEnabled:t.editDiagnostics===!0}),re=!c&&!l&&!t.staged,[ie,ae]=(0,J.useState)(null),[oe,G]=(0,J.useState)(null);(0,J.useEffect)(()=>{if(!oe)return;let e=setTimeout(()=>G(null),6e3);return()=>clearTimeout(e)},[oe]);let se=(0,J.useCallback)(e=>{R.get(e)?.dirty?ae({kind:`exit`,path:e}):te(e)},[R,te]),K=(0,J.useCallback)(e=>{R.get(e)?.dirty?ae({kind:`discard`,path:e}):ee(e)},[R,ee]),ce=(0,J.useCallback)(()=>{ie&&(ie.kind===`exit`?te(ie.path):ee(ie.path),ae(null))},[ie,te,ee]),le=(0,J.useCallback)(e=>{R.has(e)?se(e):B(e).catch(e=>{console.error(`Failed to enter edit mode:`,e),G(`Failed to enter edit mode: ${e.message}`)})},[R,se,B]);(0,J.useEffect)(()=>{if(z===0)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[z]);let ue=(0,J.useMemo)(()=>{if(!a)return y;let e=new Map;for(let t of y){if(e.has(t.filePath))continue;let n=i7(a,t.filePath);n!==void 0&&e.set(t.filePath,n)}return o7(y,e)},[y,a]),{plans:de}=Rj(),fe=(0,J.useMemo)(()=>de.filter(e=>e.decision===`pending`).length,[de]),{status:pe,refresh:q}=Kj(a),[me,he]=(0,J.useState)(null),ge=(0,J.useRef)(0),[_e,ve]=(0,J.useState)(()=>{try{let e=hM(`diffing-sidebar-collapsed`);if(e!=null)return e===`true`}catch{}return typeof window<`u`&&window.innerWidth<=768}),[ye,be]=(0,J.useState)(()=>{try{let e=hM(`diffing-sidebar-width`);return e?Number(e):320}catch{return 320}}),[xe,Se]=(0,J.useState)(()=>kM());(0,J.useEffect)(()=>{try{yM(OM.zenMode,String(xe))}catch{}},[xe]);let[Ce,we]=(0,J.useState)(()=>{try{return oM(hM(`diffing-extension-filter`)??``)}catch{return[]}});(0,J.useEffect)(()=>{yM(`diffing-extension-filter`,Ce.join(`,`))},[Ce]);let[Te,Ee]=(0,J.useState)(()=>{try{let e=hM(`diffing-chip-filter`);if(e===`unviewed`||e===`has-comments`||e===`all`||e===`since-last`)return e}catch{}return`all`});(0,J.useEffect)(()=>{yM(`diffing-chip-filter`,Te)},[Te]);let{reviewSet:De,hasBaseline:Oe}=f7(!0);(0,J.useEffect)(()=>{!Oe&&Te===`since-last`&&Ee(`all`)},[Oe,Te]);let[ke,Ae]=(0,J.useState)(null);(0,J.useEffect)(()=>{Ae(null)},[u]);let je=(0,J.useRef)(ye);je.current=ye;let Me=(0,J.useRef)(null),Ne=(0,J.useRef)(null),Pe=(0,J.useRef)(null),Fe=(0,J.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=je.current,r=Ne.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`),be(o);try{yM(`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`},[]),[Ie,Le]=(0,J.useState)({open:!1,scope:`files`,changedOnly:!1}),Re=(0,J.useRef)(!0),ze=(0,J.useCallback)(e=>{Le({open:!0,scope:e,changedOnly:!0})},[]),Be=(0,J.useCallback)(()=>{Le(e=>e.open?{...e,open:!1}:{open:!0,scope:`all`,changedOnly:Re.current})},[]),Ve=(0,J.useCallback)(()=>Le(e=>({...e,open:!1})),[]),He=(0,J.useCallback)(e=>{Re.current=e,Le(t=>({...t,changedOnly:e}))},[]),[Ue,We]=(0,J.useState)(!1),[Ge,Ke]=(0,J.useState)(!1),[qe,Je]=(0,J.useState)(!1),[Ye,Xe]=(0,J.useState)(!1),[Ze,Qe]=(0,J.useState)(!1),$e=Ie.open||Ue||Ge||qe||Ye||ie!==null||Ze,[et,tt]=(0,J.useState)(()=>{try{let e=hM(`diffing-comment-panel-height`);return e?Number(e):220}catch{return 220}}),nt=(0,J.useRef)(et);nt.current=et;let rt=(0,J.useCallback)(e=>{e.preventDefault();let t=e.clientY,n=nt.current,r=Me.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),tt(i);try{yM(`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,J.useEffect)(()=>{try{yM(`diffing-comment-panel-height`,String(et))}catch{}},[et]);let{viewedFiles:it,setViewed:at}=tM(),ot=(0,J.useRef)(null);(0,J.useEffect)(()=>{try{yM(`diffing-sidebar-collapsed`,String(_e))}catch{}},[_e]);let st=(0,J.useMemo)(()=>new Set(m),[m]),ct=(0,J.useRef)([]),ut=(0,J.useMemo)(()=>l&&ke!=null&&u[ke]?.patch?u[ke].patch:a,[l,ke,u,a]),dt=(0,J.useMemo)(()=>{if(!ut)return[];try{let e=dg(ut).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=ct.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 ct.current=r,r}catch{return[]}},[ut,f]),ft=(0,J.useMemo)(()=>{let e={};for(let t of ue)e[t.filePath]=(e[t.filePath]??0)+1;return e},[ue]),pt=(0,J.useMemo)(()=>[...dt].sort(iZ),[dt]),mt=(0,J.useMemo)(()=>{let e=dt;return Ce.length>0&&(e=e.filter(e=>lM(e.name,Ce))),Te===`unviewed`?e=e.filter(e=>!it.has(e.name)):Te===`has-comments`?e=e.filter(e=>(ft[e.name]??0)>0):Te===`since-last`&&(e=e.filter(e=>De.has(e.name))),e},[dt,Ce,Te,it,ft,De]),ht=(0,J.useMemo)(()=>[...mt].sort(iZ),[mt]);aM(ht,me,he,ge);let gt=(0,J.useRef)(!1);(0,J.useEffect)(()=>{if(gt.current||g||ht.length===0||typeof window>`u`)return;let e=s7(window.location.search);!e.file&&!e.comment||(gt.current=!0,e.file&&(ge.current=Date.now(),he(e.file),e.line!=null&&requestAnimationFrame(()=>{RA(e.file,e.line,e.side??`additions`)})),e.comment&&requestAnimationFrame(()=>{document.getElementById(`comment-${e.comment}`)?.scrollIntoView({behavior:`smooth`,block:`center`})}))},[g,ht.length]);let _t=iM(ht),vt=MM(ht),yt=NM((0,J.useMemo)(()=>jM(ht),[ht])),bt=(0,J.useCallback)(e=>{yt.open(e)},[yt]),xt=(0,J.useMemo)(()=>({diffFileSet:HA(mt),changedKeys:UA(vt),customMode:c,staged:t.staged}),[mt,vt,c,t.staged]),St=(0,J.useMemo)(()=>{let e=0,t=0;for(let n of mt)e+=n.additionLines.length,t+=n.deletionLines.length;return{additions:e,deletions:t}},[mt]),Ct=(0,J.useMemo)(()=>{let e=new Map;for(let t of f)e.set(t.path,t);return e},[f]),wt=(0,J.useRef)(new Map),Tt=(0,J.useMemo)(()=>{let e=new Map,t=new Map;for(let e of ue){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=wt.current.get(n);i&&JSON.stringify(i)===JSON.stringify(t)?e.set(n,i):e.set(n,t)}return wt.current=e,e},[ue]),Et=(0,J.useCallback)(e=>{ge.current=Date.now(),he(e);let t=document.getElementById(`file-${e}`);t&&t.scrollIntoView({block:`start`})},[]),Dt=(0,J.useCallback)(e=>{i(()=>{we(sM(e))})},[]),Ot=(0,J.useCallback)((e,t)=>{at(e,t),t&&(ge.current=Date.now(),_t(e))},[at,_t]),kt=(0,J.useCallback)(e=>{i(()=>{r({diffStyle:e})})},[r]),At=(0,J.useCallback)(e=>{i(()=>{r(e)})},[r]),jt=(0,J.useCallback)(e=>{i(()=>{r({defaultTabSize:e})})},[r]),Mt=(0,J.useCallback)(e=>{i(()=>{r({browser:e})})},[r]),Nt=(0,J.useCallback)(e=>{i(()=>{r({theme:e})})},[r]),Pt=(0,J.useCallback)(e=>{i(()=>{r({editorIDE:e})})},[r]),Ft=(0,J.useCallback)(e=>{i(()=>{r({lineDiffType:e})})},[r]),It=(0,J.useCallback)(e=>{i(()=>{r({lineWrap:e})})},[r]),Lt=(0,J.useCallback)(e=>{i(()=>{r({diffIndicators:e})})},[r]),Rt=(0,J.useCallback)(e=>{i(()=>{r({showLineNumbers:e})})},[r]),zt=(0,J.useCallback)(e=>{i(()=>{r({hunkSeparators:e})})},[r]),Bt=(0,J.useCallback)(e=>{i(()=>{r({lineHoverHighlight:e})})},[r]),Vt=(0,J.useCallback)(e=>{i(()=>{r({fontSize:e})})},[r]),Ht=(0,J.useCallback)(e=>{r({haptics:e})},[r]),Ut=(0,J.useCallback)(e=>{r({sounds:e})},[r]),Wt=(0,J.useCallback)(e=>{r({uiFont:e})},[r]),Gt=(0,J.useCallback)(e=>{r({monoFont:e})},[r]),Kt=(0,J.useCallback)(e=>{r({density:e})},[r]),qt=(0,J.useCallback)(e=>{r({autoCollapseLineThreshold:e})},[r]),Jt=(0,J.useCallback)(e=>{r({requireViewAllBeforeSend:e})},[r]),Yt=(0,J.useCallback)(e=>{r({showStatusBar:e})},[r]),Xt=(0,J.useCallback)(e=>{r({ignoreSpaceChange:e})},[r]),Zt=(0,J.useCallback)(e=>{r({ignoreAllSpace:e})},[r]);(0,J.useCallback)(e=>{r({showVimStatusBar:e})},[r]);let Qt=(0,J.useCallback)(async()=>{let e=await I();OA(`selection`,`toggle`),e.resolved},[I,OA]),$t=(0,J.useCallback)(()=>{i(()=>{r({showLineNumbers:!t.showLineNumbers})})},[r,t.showLineNumbers]),en=(0,J.useCallback)(()=>{It(!t.lineWrap)},[t.lineWrap,It]),tn=(0,J.useCallback)(()=>{let e=[`classic`,`bars`,`none`],n=t.diffIndicators||`classic`,r=e[(e.indexOf(n)+1)%e.length];Lt(r)},[t.diffIndicators,Lt]),nn=(0,J.useCallback)(()=>{let e=[`word`,`word-alt`,`char`,`none`],n=t.lineDiffType||`word`,r=e[(e.indexOf(n)+1)%e.length];Ft(r)},[t.lineDiffType,Ft]),rn=(0,J.useCallback)(()=>{ve(e=>!e)},[]),an=(0,J.useCallback)(e=>{if(ht.length===0)return;let t=me?ht.findIndex(e=>e.name===me):-1,n=e===`next`?Math.min(t+1,ht.length-1):Math.max(t-1,0),r=ht[Math.max(0,n)]?.name;if(!r)return;ge.current=Date.now(),he(r);let i=document.getElementById(`file-${r}`);i&&i.scrollIntoView({block:`start`})},[ht,me,he]),on=(0,J.useCallback)(e=>{!l||u.length<2||Ae(t=>c7(t,u.length,e))},[l,u.length]),sn=(0,J.useCallback)(()=>{if(!me)return;ge.current=Date.now();let e=it.has(me);at(me,!e),e||_t(me)},[me,it,at,_t]),cn=(0,J.useCallback)((e,t)=>{t&&(ge.current=Date.now(),_t(e))},[_t]),ln=(0,J.useCallback)(()=>{kt(t.diffStyle===`split`?`unified`:`split`)},[t.diffStyle,kt]),un=(0,J.useCallback)(()=>{let e=[2,4,8],n=t.defaultTabSize||4;jt(e[(e.indexOf(n)+1)%e.length])},[t.defaultTabSize,jt]),dn=(0,J.useCallback)(()=>{rn()},[rn]),fn=(0,J.useCallback)(()=>{Se(e=>!e),Qe(!1)},[]),{setSnapshot:pn,nextHit:mn,prevHit:hn,statusMessage:gn}=sj(xt,Et);zA((0,J.useMemo)(()=>({onNavigateFile:an,onNavigateCommit:l&&u.length>1?on:void 0,onToggleViewed:sn,onToggleDiffStyle:ln,onCycleTabSize:un,onToggleSidebar:dn,onToggleLineWrap:en,onToggleLineNumbers:$t,onCycleDiffIndicators:tn,onCycleLineDiffType:nn,onOpenPalette:ze,onTogglePalette:Be,onOpenFileSearch:me?()=>bt(me):void 0,onCloseFileSearch:!$e&&yt.filePath?yt.close:void 0,onNextSearchHit:mn,onPrevSearchHit:hn,onOpenTheme:()=>Ke(!0),onOpenShortcuts:()=>We(!0),onToggleEdit:re&&me?()=>le(me):void 0,onSaveAll:z>0?W:void 0,onToggleZen:fn,onExitZen:xe&&!$e?()=>Se(!1):void 0,onOpenSendReview:$e?void 0:()=>Qe(!0)}),[an,l,u.length,on,sn,ln,un,dn,en,$t,tn,nn,ze,Be,bt,yt.filePath,me,mn,hn,re,me,le,z,W,fn,xe,$e]));let _n=(0,J.useMemo)(()=>({staged:t.staged,untracked:t.untracked}),[t.staged,t.untracked]);(0,J.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]),Zj(n,t.uiFont,t.monoFont);let vn=(0,J.useMemo)(()=>Yj(t.monoFont),[t.monoFont]),yn=(0,J.useMemo)(()=>NA[t.theme||`rose-pine`]||NA[`rose-pine`],[t.theme]);return(0,J.useEffect)(()=>{e&&e.setRenderOptions({theme:{dark:yn.type===`dark`?yn.themeName:`rose-pine`,light:yn.type===`light`?yn.themeName:`github-light`}}).catch(e=>{console.error(`Failed to set worker pool render options:`,e)})},[e,yn]),(0,J.useEffect)(()=>{let e=yn.type===`dark`?yn.themeName:`rose-pine`,t=yn.type===`light`?yn.themeName:`github-light`;Kf({themes:Array.from(new Set([e,t])),langs:[]}).catch(()=>{})},[yn]),(0,J.useEffect)(()=>{let e=[o,s].filter(Boolean);return document.title=e.length>0?`${e.join(` · `)} · diffing`:`diffing`,()=>{document.title=`diffing`}},[o,s]),g?(0,Y.jsxs)(`div`,{className:`app skeleton-app`,style:{"--sidebar-width":`${ye}px`,"--comment-panel-height":`${et}px`},children:[xe?(0,Y.jsx)(`div`,{className:`zen-bar zen-bar-skeleton`,"aria-hidden":`true`}):(0,Y.jsxs)(`header`,{className:`skeleton-toolbar`,children:[(0,Y.jsx)(`div`,{className:`skeleton-item skeleton-logo`}),(0,Y.jsx)(`div`,{className:`skeleton-item skeleton-stats`}),(0,Y.jsx)(`div`,{className:`skeleton-item skeleton-actions`})]}),(0,Y.jsxs)(`div`,{className:`app-body`,children:[!xe&&(0,Y.jsx)(`aside`,{className:`sidebar skeleton-sidebar ${_e?`sidebar-collapsed`:``}`,children:!_e&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`skeleton-search`}),(0,Y.jsx)(`div`,{className:`skeleton-tree-nodes`,children:Array.from({length:8}).map((e,t)=>(0,Y.jsxs)(`div`,{className:`skeleton-tree-node`,style:{paddingLeft:`${t%3*16+16}px`},children:[(0,Y.jsx)(`div`,{className:`skeleton-node-icon`}),(0,Y.jsx)(`div`,{className:`skeleton-node-text`,style:{width:`${60+t*12%60}px`}})]},t))})]})}),!xe&&!_e&&(0,Y.jsx)(`div`,{className:`sidebar-resize-handle`,style:{cursor:`default`}}),(0,Y.jsx)(`main`,{className:`main skeleton-main`,children:(0,Y.jsx)(`div`,{className:`diff-viewer`,children:Array.from({length:3}).map((e,t)=>(0,Y.jsxs)(`div`,{className:`file-diff-card skeleton-card`,children:[(0,Y.jsxs)(`div`,{className:`skeleton-card-header`,children:[(0,Y.jsx)(`div`,{className:`skeleton-card-title`,style:{width:`${120+t*45%150}px`}}),(0,Y.jsx)(`div`,{className:`skeleton-card-badge`})]}),(0,Y.jsx)(`div`,{className:`skeleton-card-body`,children:Array.from({length:5}).map((e,t)=>(0,Y.jsx)(`div`,{className:`skeleton-code-line`,style:{width:`${50+t*15%45}%`}},t))})]},t))})})]})]}):v?(0,Y.jsxs)(`div`,{className:`error empty-state`,role:`alert`,children:[(0,Y.jsx)(`div`,{className:`empty-state-icon empty-state-icon-danger`,"aria-hidden":`true`,children:(0,Y.jsx)(uP,{size:24,strokeWidth:1.75})}),(0,Y.jsx)(`p`,{className:`empty-state-title`,children:`Couldn't load the diff`}),(0,Y.jsx)(`p`,{className:`empty-state-hint`,children:v})]}):(0,Y.jsx)(lt,{createEditor:ne,children:(0,Y.jsx)(kA,{enabled:t.haptics??!0,soundsEnabled:t.sounds??!0,children:(0,Y.jsxs)(`div`,{className:`app ${xe?`app-zen`:``}`,ref:Me,style:{"--sidebar-width":`${ye}px`,"--comment-panel-height":`${et}px`},children:[(0,Y.jsx)(`a`,{href:`#diff-main`,className:`skip-to-main`,children:`Skip to diff`}),_&&(0,Y.jsx)(`div`,{className:`refresh-bar`,role:`status`,"aria-live":`polite`,"aria-label":`Refreshing diff`}),oe&&(0,Y.jsxs)(`div`,{className:`edit-entry-notice`,role:`alert`,children:[(0,Y.jsx)(uP,{size:12}),oe,(0,Y.jsx)(`button`,{type:`button`,className:`edit-entry-notice-close`,onClick:()=>G(null),"aria-label":`Dismiss`,children:(0,Y.jsx)(mP,{size:12})})]}),(0,Y.jsx)(`div`,{className:`sidebar-resize-guide`,ref:Pe,"aria-hidden":`true`}),xe?(0,Y.jsx)(BY,{repoName:o,branch:s,fileCount:mt.length,totalFileCount:dt.length,additions:St.additions,deletions:St.deletions,showMode:l,showCommitCount:u.length,onExit:()=>Se(!1)}):(0,Y.jsx)(zY,{repoName:o,branch:s,fileCount:mt.length,totalFileCount:dt.length,additions:St.additions,deletions:St.deletions,commentCount:ue.length,planCount:de.length,pendingPlanCount:fe,lastSend:L,onOpenPlans:()=>Vj(`/plan`),diffStyle:t.diffStyle,diffOptions:_n,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:_e,onToggleSidebar:rn,onDiffStyleChange:kt,onDiffOptionsChange:At,onDefaultTabSizeChange:jt,onBrowserChange:Mt,onOpenThemeModal:()=>Ke(!0),onEditorIDEChange:Pt,onLineDiffTypeChange:Ft,onLineWrapChange:It,onDiffIndicatorsChange:Lt,onShowLineNumbersChange:Rt,onHunkSeparatorsChange:zt,onLineHoverHighlightChange:Bt,onFontSizeChange:Vt,onHapticsChange:Ht,onSoundsChange:Ut,density:t.density,autoCollapseLineThreshold:t.autoCollapseLineThreshold,requireViewAllBeforeSend:t.requireViewAllBeforeSend,showStatusBar:t.showStatusBar??!0,ignoreSpaceChange:t.ignoreSpaceChange??!1,ignoreAllSpace:t.ignoreAllSpace??!1,editDiagnostics:t.editDiagnostics===!0,onDensityChange:Kt,onAutoCollapseLineThresholdChange:qt,onRequireViewAllBeforeSendChange:Jt,onShowStatusBarChange:Yt,onIgnoreSpaceChange:Xt,onIgnoreAllSpaceChange:Zt,onEditDiagnosticsChange:e=>r({editDiagnostics:e}),onResolveAllOpen:Qt,onOpenUiFontModal:()=>Je(!0),onOpenMonoFontModal:()=>Xe(!0),onOpenSearch:()=>ze(`all`),onCopyComments:O,onCopyMarkdown:k,onSendToAgent:M,agentWaiting:P,waitingAgents:F,sending:N,comments:ue,viewedFileCount:it.size,onEditComment:T,onDeleteComment:x,zenMode:xe,onToggleZen:fn,sendReviewOpen:Ze,onSendReviewOpenChange:Qe}),!xe&&!_e&&(0,Y.jsx)(`div`,{className:`sidebar-mobile-backdrop`,onClick:rn,"aria-hidden":`true`}),(0,Y.jsxs)(`div`,{className:`app-body`,children:[!xe&&(0,Y.jsxs)(`aside`,{ref:Ne,className:`sidebar ${_e?`sidebar-collapsed`:``}`,children:[(0,Y.jsx)(`div`,{style:{flex:1,minHeight:0,overflow:`hidden`},children:(0,Y.jsx)(E5,{files:pt,activeFile:me,commentCounts:ft,viewedFiles:it,untrackedFiles:st,onFileClick:Et,collapsed:_e,onToggleCollapse:rn,appliedExtensions:Ce,onApplyExtensions:Dt,chipFilter:Te,onChipFilterChange:Ee,sinceLastFiles:De,sinceLastAvailable:Oe})}),!_e&&ue.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`ct-resize-handle`,onMouseDown:rt,role:`separator`,"aria-label":`Resize comments panel`,"aria-orientation":`horizontal`,tabIndex:0}),(0,Y.jsx)(`div`,{className:`ct-wrapper`,style:{flexShrink:0},children:(0,Y.jsx)(A5,{comments:ue,resolveComment:S,unresolveComment:C,removeComment:x,addReply:w,editComment:T,editReply:E,removeReply:D})})]})]}),!xe&&!_e&&(0,Y.jsx)(`div`,{className:`sidebar-resize-handle`,onMouseDown:Fe,role:`separator`,"aria-label":`Resize sidebar`,"aria-orientation":`vertical`,tabIndex:0}),(0,Y.jsxs)(`main`,{className:`main`,ref:ot,id:`diff-main`,tabIndex:-1,children:[h&&(0,Y.jsx)(JY,{overview:h,commits:l?u:void 0}),l&&u.length>1&&(0,Y.jsx)(l7,{commits:u,activeIndex:ke,onChange:Ae}),pe.inMerge&&pe.conflicts.length>0&&(0,Y.jsxs)(`div`,{className:`merge-conflict-banner`,children:[(0,Y.jsx)(`strong`,{children:`Merge in progress`}),(0,Y.jsxs)(`span`,{children:[pe.conflicts.length,` unresolved file`,pe.conflicts.length===1?``:`s`,` below. Use the inline buttons to accept current/incoming/both, then "Save & stage".`]})]}),pe.conflicts.map(e=>(0,Y.jsx)(sZ,{filePath:e,theme:t.theme||`rose-pine`,fontSize:t.fontSize,monoFontFamily:vn,tabSize:p[e]??t.defaultTabSize,onSaved:()=>{q()}},e)),(0,Y.jsx)(aZ,{files:ht,diffStyle:t.diffStyle,tabSizeMap:p,defaultTabSize:t.defaultTabSize,viewedFiles:it,binaryFiles:Ct,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:vn,expandContextByDefault:t.expandContextByDefault,collapsedContextThreshold:t.collapsedContextThreshold,expansionLineCount:t.expansionLineCount,autoCollapseLineThreshold:t.autoCollapseLineThreshold,onViewedChange:Ot,fileAnnotationsMap:Tt,onAddComment:b,onDeleteComment:x,onCardToggleCollapse:cn,canEdit:re,editSessions:R,onRequestEdit:B,onEditChange:V,onEditAttach:H,onEditSave:U,onEditDiscard:K,onEditExit:se,fileSearch:yt,onOpenFileSearch:bt})]})]}),(0,Y.jsx)(V5,{isOpen:Ie.open,onClose:Ve,initialScope:Ie.scope,initialChangedOnly:Ie.changedOnly,onChangedOnlyPreference:He,onSessionSnapshot:pn,files:mt,changedEntries:vt,customMode:c,staged:t.staged,onNavigateFile:Et,theme:t.theme||`rose-pine`,fontSize:t.fontSize,monoFontFamily:vn,defaultTabSize:t.defaultTabSize,lineWrap:t.lineWrap,showLineNumbers:t.showLineNumbers,lineHoverHighlight:t.lineHoverHighlight}),!xe&&(0,Y.jsx)(Y5,{activeFile:me,onShowHelp:()=>We(!0),visible:t.showStatusBar??!0,statusMessage:gn,placeholder:l&&u.length>1?`No active file (J/K files · [ / ] commits)`:void 0,editDirtyCount:z,editSaveEnabled:re,onSaveAllEdits:W}),(0,Y.jsx)(X5,{isOpen:Ue,onClose:()=>We(!1)}),xe&&Ze&&(0,Y.jsx)(VY,{open:Ze,onClose:()=>Qe(!1),comments:ue,totalFileCount:dt.length,viewedFileCount:it.size,requireViewAllBeforeSend:t.requireViewAllBeforeSend,onEditComment:T,onDeleteComment:x,onSend:M,sending:N,agentWaiting:P,waitingAgents:F,onCopyComments:O,onCopyMarkdown:k}),(0,Y.jsx)($5,{open:Ge,activeTheme:t.theme||`rose-pine`,onThemeChange:Nt,onClose:()=>Ke(!1)}),(0,Y.jsx)(n7,{open:qe,title:`Select UI Font`,defaultLabel:`Default (Geist Mono, from CDN)`,activeFont:t.uiFont,onFontChange:Wt,onClose:()=>Je(!1)}),(0,Y.jsx)(n7,{open:Ye,title:`Select Code Font`,defaultLabel:`Default (JetBrains Mono, from CDN)`,activeFont:t.monoFont,onFontChange:Gt,onClose:()=>Xe(!1)}),(0,Y.jsx)(Z5,{activity:A,onDismiss:j,onJump:Et}),(0,Y.jsx)(u7,{}),(0,Y.jsx)(sJ,{open:ie!==null,title:ie?.kind===`exit`?`Exit edit mode?`:`Discard edits?`,description:ie?.kind===`exit`?`This file has unsaved changes. Discard them and exit edit mode?`:`Discard all changes to this file since the last save?`,confirmLabel:`Discard`,variant:`danger`,onConfirm:ce,onCancel:()=>ae(null)})]})})})}function m7(e){(0,J.useEffect)(()=>{let t=``,n,r=0,i=()=>{t=``,clearTimeout(n)},a=a=>{if(FA()||a.metaKey||a.altKey)return;clearTimeout(n);let o=a.key;if(a.ctrlKey){(o===`d`||o===`u`)&&(a.preventDefault(),window.scrollBy({top:o===`d`?window.innerHeight/2:-window.innerHeight/2,behavior:`auto`}),OA(`selection`,`navigate`),i());return}if(o.length>1&&o!==`Escape`&&o!==`Enter`)return;t+=o,n=setTimeout(()=>{t=``},800);let s=(e,t=`toggle`)=>{a.preventDefault(),e(),OA(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&&(EA(`navigate`),r=e),i()}else t===`gg`?s(()=>window.scrollTo({top:0,behavior:`auto`}),`navigate`):t===`G`?s(()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:`auto`}),`navigate`):t===`J`?s(()=>e.onNavigatePlan(`next`),`navigate`):t===`K`?s(()=>e.onNavigatePlan(`prev`),`navigate`):t===`m`?s(e.onToggleViewMode):t===`z`?s(e.onToggleZenMode):t===`c`?s(e.onToggleCommentsRail):t===`o`?s(e.onToggleOutline):t===`t`?s(e.onCycleTabSize):t===`b`?s(e.onToggleSidebar):t===`w`?s(e.onToggleLineWrap):t===`n`?s(e.onToggleLineNumbers):t===`gt`?s(e.onOpenTheme,`open`):t===`?`?s(e.onOpenShortcuts,`open`):t.length>=2&&i()};return window.addEventListener(`keydown`,a),()=>{window.removeEventListener(`keydown`,a),clearTimeout(n)}},[e])}function h7(e,t){if(t<1)return;let n=e.split(`
3647
+ `).includes(r)}function o7(e,t){return e.map(e=>{let n=t.get(e.filePath);if(n===void 0)return e;let r=a7(e,n);return e.outdated===r?e:{...e,outdated:r}})}function s7(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 c7(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 l7({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(c7(t,r,`prev`)),c=()=>n(c7(t,r,`next`));return(0,Y.jsxs)(`div`,{className:`commit-walk-bar`,role:`navigation`,"aria-label":`Walk commits`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`btn btn-sm commit-walk-btn`,onClick:s,"aria-label":`Previous commit`,title:`Previous commit ([)`,children:(0,Y.jsx)(YM,{size:14})}),(0,Y.jsxs)(`div`,{className:`commit-walk-center`,children:[(0,Y.jsx)(xN,{size:14,"aria-hidden":`true`}),i?(0,Y.jsxs)(`span`,{className:`commit-walk-label`,children:[`All `,r,` commits`]}):(0,Y.jsxs)(`span`,{className:`commit-walk-label`,title:o?.subject,children:[(0,Y.jsxs)(`span`,{className:`commit-walk-count`,children:[a+1,` / `,r]}),(0,Y.jsx)(`code`,{className:`commit-walk-sha`,children:o?.shortSha??o?.sha.slice(0,7)}),(0,Y.jsx)(`span`,{className:`commit-walk-subject`,children:o?.subject})]})]}),(0,Y.jsxs)(`div`,{className:`commit-walk-trailing`,children:[(0,Y.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,Y.jsx)(`button`,{type:`button`,className:`btn btn-sm commit-walk-btn`,onClick:c,"aria-label":`Next commit`,title:`Next commit (])`,children:(0,Y.jsx)(XM,{size:14})})]})]})}function u7(){let[e,t]=(0,J.useState)(null);return(0,J.useEffect)(()=>Ej(`agent-progress`,e=>{try{t(JSON.parse(e))}catch{}}),[]),(0,J.useEffect)(()=>{if(!e)return;let n=setTimeout(()=>t(null),1e4);return()=>clearTimeout(n)},[e]),e?(0,Y.jsxs)(`div`,{className:`agent-progress-toast`,role:`status`,"aria-live":`polite`,children:[(0,Y.jsx)(`div`,{className:`agent-progress-toast-icon`,children:(0,Y.jsx)(GM,{size:16})}),(0,Y.jsxs)(`div`,{className:`agent-progress-toast-body`,children:[(0,Y.jsxs)(`div`,{className:`agent-progress-toast-title`,children:[e.model||e.agentId||`Agent`,e.pct!=null&&(0,Y.jsxs)(`span`,{className:`agent-progress-toast-pct`,children:[Math.round(e.pct),`%`]})]}),(0,Y.jsx)(`div`,{className:`agent-progress-toast-msg`,children:e.message}),e.pct!=null&&(0,Y.jsx)(`div`,{className:`agent-progress-bar`,"aria-hidden":`true`,children:(0,Y.jsx)(`div`,{className:`agent-progress-bar-fill`,style:{width:`${e.pct}%`}})})]}),(0,Y.jsx)(`button`,{type:`button`,className:`agent-progress-toast-close`,onClick:()=>t(null),"aria-label":`Dismiss`,children:(0,Y.jsx)(mP,{size:14})})]}):null}var d7=[`review-since-last`];function f7(e=!0){let t=Le(),n=Qe({queryKey:d7,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,J.useEffect)(()=>{if(!e)return;let n=()=>{t.invalidateQueries({queryKey:d7})},r=Ej(`change`,n),i=Ej(`agent-status`,n);return()=>{r(),i()}},[e,t]);let r=n.data,i=(0,J.useMemo)(()=>new Set(r?.reviewFiles??[]),[r?.reviewFiles]);return{sinceLast:r??null,reviewSet:i,hasBaseline:!!r?.hasBaseline,loading:n.isLoading,refetch:n.refetch}}function p7(){let e=Ih(),{settings:t,loaded:n,updateSettings:r}=Xj(),[,i]=(0,J.useTransition)(),{patch:a,repoName:o,branch:s,customMode:c,showMode:l,commits:u,binaryFiles:d,tabSizeMap:f,untrackedFiles:p,overview:m,loading:h,refreshing:g,error:_}=Aj({staged:t.staged,untracked:t.untracked},!0),{comments:v,addComment:y,removeComment:b,resolveComment:x,unresolveComment:S,addReply:C,editComment:w,editReply:T,removeReply:E,copyAllComments:D,copyAllCommentsMarkdown:O,agentActivity:k,clearAgentActivity:A,sendToAgent:j,sending:M,agentWaiting:N,waitingAgents:P,resolveAllOpen:F,lastSend:I}=Fj(),{sessions:L,dirtyCount:R,enterEdit:z,handleEditChange:B,handleEditAttach:V,saveEdit:H,saveAllDirty:U,discardEdit:W,exitEdit:ee,createEditor:te}=sA({diagnosticsEnabled:t.editDiagnostics===!0}),ne=!c&&!l&&!t.staged,[re,ie]=(0,J.useState)(null),[ae,oe]=(0,J.useState)(null);(0,J.useEffect)(()=>{if(!ae)return;let e=setTimeout(()=>oe(null),6e3);return()=>clearTimeout(e)},[ae]);let G=(0,J.useCallback)(e=>{L.get(e)?.dirty?ie({kind:`exit`,path:e}):ee(e)},[L,ee]),se=(0,J.useCallback)(e=>{L.get(e)?.dirty?ie({kind:`discard`,path:e}):W(e)},[L,W]),K=(0,J.useCallback)(()=>{re&&(re.kind===`exit`?ee(re.path):W(re.path),ie(null))},[re,ee,W]),ce=(0,J.useCallback)(e=>{L.has(e)?G(e):z(e).catch(e=>{console.error(`Failed to enter edit mode:`,e),oe(`Failed to enter edit mode: ${e.message}`)})},[L,G,z]);(0,J.useEffect)(()=>{if(R===0)return;let e=e=>{e.preventDefault()};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[R]);let le=(0,J.useMemo)(()=>{if(!a)return v;let e=new Map;for(let t of v){if(e.has(t.filePath))continue;let n=i7(a,t.filePath);n!==void 0&&e.set(t.filePath,n)}return o7(v,e)},[v,a]),{plans:ue}=Rj(),de=(0,J.useMemo)(()=>ue.filter(e=>e.decision===`pending`).length,[ue]),{status:fe,refresh:pe}=Kj(a),[q,me]=(0,J.useState)(null),he=(0,J.useRef)(0),[ge,_e]=(0,J.useState)(()=>{try{let e=hM(`diffing-sidebar-collapsed`);if(e!=null)return e===`true`}catch{}return typeof window<`u`&&window.innerWidth<=768}),[ve,ye]=(0,J.useState)(()=>{try{let e=hM(`diffing-sidebar-width`);return e?Number(e):320}catch{return 320}}),[be,xe]=(0,J.useState)(()=>kM());(0,J.useEffect)(()=>{try{yM(OM.zenMode,String(be))}catch{}},[be]);let[Se,Ce]=(0,J.useState)(()=>{try{return oM(hM(`diffing-extension-filter`)??``)}catch{return[]}});(0,J.useEffect)(()=>{yM(`diffing-extension-filter`,Se.join(`,`))},[Se]);let[we,Te]=(0,J.useState)(()=>{try{let e=hM(`diffing-chip-filter`);if(e===`unviewed`||e===`has-comments`||e===`all`||e===`since-last`)return e}catch{}return`all`});(0,J.useEffect)(()=>{yM(`diffing-chip-filter`,we)},[we]);let{reviewSet:Ee,hasBaseline:De}=f7(!0);(0,J.useEffect)(()=>{!De&&we===`since-last`&&Te(`all`)},[De,we]);let[Oe,ke]=(0,J.useState)(null);(0,J.useEffect)(()=>{ke(null)},[u]);let Ae=(0,J.useRef)(ve);Ae.current=ve;let je=(0,J.useRef)(null),Me=(0,J.useRef)(null),Ne=(0,J.useRef)(null),Pe=(0,J.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=Ae.current,r=Me.current,i=Ne.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`),ye(o);try{yM(`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`},[]),[Fe,Ie]=(0,J.useState)({open:!1,scope:`files`,changedOnly:!1}),Le=(0,J.useRef)(!0),Re=(0,J.useCallback)(e=>{Ie({open:!0,scope:e,changedOnly:!0})},[]),ze=(0,J.useCallback)(()=>{Ie(e=>e.open?{...e,open:!1}:{open:!0,scope:`all`,changedOnly:Le.current})},[]),Be=(0,J.useCallback)(()=>Ie(e=>({...e,open:!1})),[]),Ve=(0,J.useCallback)(e=>{Le.current=e,Ie(t=>({...t,changedOnly:e}))},[]),[He,Ue]=(0,J.useState)(!1),[We,Ge]=(0,J.useState)(!1),[Ke,qe]=(0,J.useState)(!1),[Je,Ye]=(0,J.useState)(!1),[Xe,Ze]=(0,J.useState)(!1),Qe=Fe.open||He||We||Ke||Je||re!==null||Xe,[$e,et]=(0,J.useState)(()=>{try{let e=hM(`diffing-comment-panel-height`);return e?Number(e):220}catch{return 220}}),tt=(0,J.useRef)($e);tt.current=$e;let nt=(0,J.useCallback)(e=>{e.preventDefault();let t=e.clientY,n=tt.current,r=je.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),et(i);try{yM(`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,J.useEffect)(()=>{try{yM(`diffing-comment-panel-height`,String($e))}catch{}},[$e]);let{viewedFiles:rt,setViewed:it}=tM(),at=(0,J.useRef)(null);(0,J.useEffect)(()=>{try{yM(`diffing-sidebar-collapsed`,String(ge))}catch{}},[ge]);let ot=(0,J.useMemo)(()=>new Set(p),[p]),st=(0,J.useRef)([]),ct=(0,J.useMemo)(()=>l&&Oe!=null&&u[Oe]?.patch?u[Oe].patch:a,[l,Oe,u,a]),ut=(0,J.useMemo)(()=>{if(!ct)return[];try{let e=dg(ct).flatMap(e=>e.files),t=new Set(e.map(e=>e.name));for(let n of d)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=st.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 st.current=r,r}catch{return[]}},[ct,d]),dt=(0,J.useMemo)(()=>{let e={};for(let t of le)e[t.filePath]=(e[t.filePath]??0)+1;return e},[le]),ft=(0,J.useMemo)(()=>[...ut].sort(iZ),[ut]),pt=(0,J.useMemo)(()=>{let e=ut;return Se.length>0&&(e=e.filter(e=>lM(e.name,Se))),we===`unviewed`?e=e.filter(e=>!rt.has(e.name)):we===`has-comments`?e=e.filter(e=>(dt[e.name]??0)>0):we===`since-last`&&(e=e.filter(e=>Ee.has(e.name))),e},[ut,Se,we,rt,dt,Ee]),mt=(0,J.useMemo)(()=>[...pt].sort(iZ),[pt]);aM(mt,q,me,he);let ht=(0,J.useRef)(!1);(0,J.useEffect)(()=>{if(ht.current||h||mt.length===0||typeof window>`u`)return;let e=s7(window.location.search);!e.file&&!e.comment||(ht.current=!0,e.file&&(he.current=Date.now(),me(e.file),e.line!=null&&requestAnimationFrame(()=>{RA(e.file,e.line,e.side??`additions`)})),e.comment&&requestAnimationFrame(()=>{document.getElementById(`comment-${e.comment}`)?.scrollIntoView({behavior:`smooth`,block:`center`})}))},[h,mt.length]);let gt=iM(mt),_t=MM(mt),vt=NM((0,J.useMemo)(()=>jM(mt),[mt])),yt=(0,J.useCallback)(e=>{vt.open(e)},[vt]),bt=(0,J.useMemo)(()=>({diffFileSet:HA(pt),changedKeys:UA(_t),customMode:c,staged:t.staged}),[pt,_t,c,t.staged]),xt=(0,J.useMemo)(()=>{let e=0,t=0;for(let n of pt)e+=n.additionLines.length,t+=n.deletionLines.length;return{additions:e,deletions:t}},[pt]),St=(0,J.useMemo)(()=>{let e=new Map;for(let t of d)e.set(t.path,t);return e},[d]),Ct=(0,J.useRef)(new Map),wt=(0,J.useMemo)(()=>{let e=new Map,t=new Map;for(let e of le){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=Ct.current.get(n);i&&JSON.stringify(i)===JSON.stringify(t)?e.set(n,i):e.set(n,t)}return Ct.current=e,e},[le]),Tt=(0,J.useCallback)(e=>{he.current=Date.now(),me(e);let t=document.getElementById(`file-${e}`);t&&t.scrollIntoView({block:`start`})},[]),Et=(0,J.useCallback)(e=>{i(()=>{Ce(sM(e))})},[]),Dt=(0,J.useCallback)((e,t)=>{it(e,t),t&&(he.current=Date.now(),gt(e))},[it,gt]),Ot=(0,J.useCallback)(e=>{i(()=>{r({diffStyle:e})})},[r]),kt=(0,J.useCallback)(e=>{i(()=>{r(e)})},[r]),At=(0,J.useCallback)(e=>{i(()=>{r({defaultTabSize:e})})},[r]),jt=(0,J.useCallback)(e=>{i(()=>{r({browser:e})})},[r]),Mt=(0,J.useCallback)(e=>{i(()=>{r({theme:e})})},[r]),Nt=(0,J.useCallback)(e=>{i(()=>{r({editorIDE:e})})},[r]),Pt=(0,J.useCallback)(e=>{i(()=>{r({lineDiffType:e})})},[r]),Ft=(0,J.useCallback)(e=>{i(()=>{r({lineWrap:e})})},[r]),It=(0,J.useCallback)(e=>{i(()=>{r({diffIndicators:e})})},[r]),Lt=(0,J.useCallback)(e=>{i(()=>{r({showLineNumbers:e})})},[r]),Rt=(0,J.useCallback)(e=>{i(()=>{r({hunkSeparators:e})})},[r]),zt=(0,J.useCallback)(e=>{i(()=>{r({lineHoverHighlight:e})})},[r]),Bt=(0,J.useCallback)(e=>{i(()=>{r({fontSize:e})})},[r]),Vt=(0,J.useCallback)(e=>{r({haptics:e})},[r]),Ht=(0,J.useCallback)(e=>{r({sounds:e})},[r]),Ut=(0,J.useCallback)(e=>{r({uiFont:e})},[r]),Wt=(0,J.useCallback)(e=>{r({monoFont:e})},[r]),Gt=(0,J.useCallback)(e=>{r({density:e})},[r]),Kt=(0,J.useCallback)(e=>{r({autoCollapseLineThreshold:e})},[r]),qt=(0,J.useCallback)(e=>{r({requireViewAllBeforeSend:e})},[r]),Jt=(0,J.useCallback)(e=>{r({showStatusBar:e})},[r]),Yt=(0,J.useCallback)(e=>{r({ignoreSpaceChange:e})},[r]),Xt=(0,J.useCallback)(e=>{r({ignoreAllSpace:e})},[r]),Zt=(0,J.useCallback)(async()=>{let e=await F();OA(`selection`,`toggle`),e.resolved},[F,OA]),Qt=(0,J.useCallback)(()=>{i(()=>{r({showLineNumbers:!t.showLineNumbers})})},[r,t.showLineNumbers]),$t=(0,J.useCallback)(()=>{Ft(!t.lineWrap)},[t.lineWrap,Ft]),en=(0,J.useCallback)(()=>{let e=[`classic`,`bars`,`none`],n=t.diffIndicators||`classic`,r=e[(e.indexOf(n)+1)%e.length];It(r)},[t.diffIndicators,It]),tn=(0,J.useCallback)(()=>{let e=[`word`,`word-alt`,`char`,`none`],n=t.lineDiffType||`word`,r=e[(e.indexOf(n)+1)%e.length];Pt(r)},[t.lineDiffType,Pt]),nn=(0,J.useCallback)(()=>{_e(e=>!e)},[]),rn=(0,J.useCallback)(e=>{if(mt.length===0)return;let t=q?mt.findIndex(e=>e.name===q):-1,n=e===`next`?Math.min(t+1,mt.length-1):Math.max(t-1,0),r=mt[Math.max(0,n)]?.name;if(!r)return;he.current=Date.now(),me(r);let i=document.getElementById(`file-${r}`);i&&i.scrollIntoView({block:`start`})},[mt,q,me]),an=(0,J.useCallback)(e=>{!l||u.length<2||ke(t=>c7(t,u.length,e))},[l,u.length]),on=(0,J.useCallback)(()=>{if(!q)return;he.current=Date.now();let e=rt.has(q);it(q,!e),e||gt(q)},[q,rt,it,gt]),sn=(0,J.useCallback)((e,t)=>{t&&(he.current=Date.now(),gt(e))},[gt]),cn=(0,J.useCallback)(()=>{Ot(t.diffStyle===`split`?`unified`:`split`)},[t.diffStyle,Ot]),ln=(0,J.useCallback)(()=>{let e=[2,4,8],n=t.defaultTabSize||4;At(e[(e.indexOf(n)+1)%e.length])},[t.defaultTabSize,At]),un=(0,J.useCallback)(()=>{nn()},[nn]),dn=(0,J.useCallback)(()=>{xe(e=>!e),Ze(!1)},[]),{setSnapshot:fn,nextHit:pn,prevHit:mn,statusMessage:hn}=sj(bt,Tt);zA((0,J.useMemo)(()=>({onNavigateFile:rn,onNavigateCommit:l&&u.length>1?an:void 0,onToggleViewed:on,onToggleDiffStyle:cn,onCycleTabSize:ln,onToggleSidebar:un,onToggleLineWrap:$t,onToggleLineNumbers:Qt,onCycleDiffIndicators:en,onCycleLineDiffType:tn,onOpenPalette:Re,onTogglePalette:ze,onOpenFileSearch:q?()=>yt(q):void 0,onCloseFileSearch:!Qe&&vt.filePath?vt.close:void 0,onNextSearchHit:pn,onPrevSearchHit:mn,onOpenTheme:()=>Ge(!0),onOpenShortcuts:()=>Ue(!0),onToggleEdit:ne&&q?()=>ce(q):void 0,onSaveAll:R>0?U:void 0,onToggleZen:dn,onExitZen:be&&!Qe?()=>xe(!1):void 0,onOpenSendReview:Qe?void 0:()=>Ze(!0)}),[rn,l,u.length,an,on,cn,ln,un,$t,Qt,en,tn,Re,ze,yt,vt.filePath,q,pn,mn,ne,q,ce,R,U,dn,be,Qe]));let gn=(0,J.useMemo)(()=>({staged:t.staged,untracked:t.untracked}),[t.staged,t.untracked]);(0,J.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]),Zj(n,t.uiFont,t.monoFont);let _n=(0,J.useMemo)(()=>Yj(t.monoFont),[t.monoFont]),vn=(0,J.useMemo)(()=>NA[t.theme||`rose-pine`]||NA[`rose-pine`],[t.theme]);return(0,J.useEffect)(()=>{e&&e.setRenderOptions({theme:{dark:vn.type===`dark`?vn.themeName:`rose-pine`,light:vn.type===`light`?vn.themeName:`github-light`}}).catch(e=>{console.error(`Failed to set worker pool render options:`,e)})},[e,vn]),(0,J.useEffect)(()=>{let e=vn.type===`dark`?vn.themeName:`rose-pine`,t=vn.type===`light`?vn.themeName:`github-light`;Kf({themes:Array.from(new Set([e,t])),langs:[]}).catch(()=>{})},[vn]),(0,J.useEffect)(()=>{let e=[o,s].filter(Boolean);return document.title=e.length>0?`${e.join(` · `)} · diffing`:`diffing`,()=>{document.title=`diffing`}},[o,s]),h?(0,Y.jsxs)(`div`,{className:`app skeleton-app`,style:{"--sidebar-width":`${ve}px`,"--comment-panel-height":`${$e}px`},children:[be?(0,Y.jsx)(`div`,{className:`zen-bar zen-bar-skeleton`,"aria-hidden":`true`}):(0,Y.jsxs)(`header`,{className:`skeleton-toolbar`,children:[(0,Y.jsx)(`div`,{className:`skeleton-item skeleton-logo`}),(0,Y.jsx)(`div`,{className:`skeleton-item skeleton-stats`}),(0,Y.jsx)(`div`,{className:`skeleton-item skeleton-actions`})]}),(0,Y.jsxs)(`div`,{className:`app-body`,children:[!be&&(0,Y.jsx)(`aside`,{className:`sidebar skeleton-sidebar ${ge?`sidebar-collapsed`:``}`,children:!ge&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`skeleton-search`}),(0,Y.jsx)(`div`,{className:`skeleton-tree-nodes`,children:Array.from({length:8}).map((e,t)=>(0,Y.jsxs)(`div`,{className:`skeleton-tree-node`,style:{paddingLeft:`${t%3*16+16}px`},children:[(0,Y.jsx)(`div`,{className:`skeleton-node-icon`}),(0,Y.jsx)(`div`,{className:`skeleton-node-text`,style:{width:`${60+t*12%60}px`}})]},t))})]})}),!be&&!ge&&(0,Y.jsx)(`div`,{className:`sidebar-resize-handle`,style:{cursor:`default`}}),(0,Y.jsx)(`main`,{className:`main skeleton-main`,children:(0,Y.jsx)(`div`,{className:`diff-viewer`,children:Array.from({length:3}).map((e,t)=>(0,Y.jsxs)(`div`,{className:`file-diff-card skeleton-card`,children:[(0,Y.jsxs)(`div`,{className:`skeleton-card-header`,children:[(0,Y.jsx)(`div`,{className:`skeleton-card-title`,style:{width:`${120+t*45%150}px`}}),(0,Y.jsx)(`div`,{className:`skeleton-card-badge`})]}),(0,Y.jsx)(`div`,{className:`skeleton-card-body`,children:Array.from({length:5}).map((e,t)=>(0,Y.jsx)(`div`,{className:`skeleton-code-line`,style:{width:`${50+t*15%45}%`}},t))})]},t))})})]})]}):_?(0,Y.jsxs)(`div`,{className:`error empty-state`,role:`alert`,children:[(0,Y.jsx)(`div`,{className:`empty-state-icon empty-state-icon-danger`,"aria-hidden":`true`,children:(0,Y.jsx)(uP,{size:24,strokeWidth:1.75})}),(0,Y.jsx)(`p`,{className:`empty-state-title`,children:`Couldn't load the diff`}),(0,Y.jsx)(`p`,{className:`empty-state-hint`,children:_})]}):(0,Y.jsx)(lt,{createEditor:te,children:(0,Y.jsx)(kA,{enabled:t.haptics??!0,soundsEnabled:t.sounds??!0,children:(0,Y.jsxs)(`div`,{className:`app ${be?`app-zen`:``}`,ref:je,style:{"--sidebar-width":`${ve}px`,"--comment-panel-height":`${$e}px`},children:[(0,Y.jsx)(`a`,{href:`#diff-main`,className:`skip-to-main`,children:`Skip to diff`}),g&&(0,Y.jsx)(`div`,{className:`refresh-bar`,role:`status`,"aria-live":`polite`,"aria-label":`Refreshing diff`}),ae&&(0,Y.jsxs)(`div`,{className:`edit-entry-notice`,role:`alert`,children:[(0,Y.jsx)(uP,{size:12}),ae,(0,Y.jsx)(`button`,{type:`button`,className:`edit-entry-notice-close`,onClick:()=>oe(null),"aria-label":`Dismiss`,children:(0,Y.jsx)(mP,{size:12})})]}),(0,Y.jsx)(`div`,{className:`sidebar-resize-guide`,ref:Ne,"aria-hidden":`true`}),be?(0,Y.jsx)(BY,{repoName:o,branch:s,fileCount:pt.length,totalFileCount:ut.length,additions:xt.additions,deletions:xt.deletions,showMode:l,showCommitCount:u.length,onExit:()=>xe(!1)}):(0,Y.jsx)(zY,{repoName:o,branch:s,fileCount:pt.length,totalFileCount:ut.length,additions:xt.additions,deletions:xt.deletions,commentCount:le.length,planCount:ue.length,pendingPlanCount:de,lastSend:I,onOpenPlans:()=>Vj(`/plan`),diffStyle:t.diffStyle,diffOptions:gn,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:ge,onToggleSidebar:nn,onDiffStyleChange:Ot,onDiffOptionsChange:kt,onDefaultTabSizeChange:At,onBrowserChange:jt,onOpenThemeModal:()=>Ge(!0),onEditorIDEChange:Nt,onLineDiffTypeChange:Pt,onLineWrapChange:Ft,onDiffIndicatorsChange:It,onShowLineNumbersChange:Lt,onHunkSeparatorsChange:Rt,onLineHoverHighlightChange:zt,onFontSizeChange:Bt,onHapticsChange:Vt,onSoundsChange:Ht,density:t.density,autoCollapseLineThreshold:t.autoCollapseLineThreshold,requireViewAllBeforeSend:t.requireViewAllBeforeSend,showStatusBar:t.showStatusBar??!0,ignoreSpaceChange:t.ignoreSpaceChange??!1,ignoreAllSpace:t.ignoreAllSpace??!1,editDiagnostics:t.editDiagnostics===!0,onDensityChange:Gt,onAutoCollapseLineThresholdChange:Kt,onRequireViewAllBeforeSendChange:qt,onShowStatusBarChange:Jt,onIgnoreSpaceChange:Yt,onIgnoreAllSpaceChange:Xt,onEditDiagnosticsChange:e=>r({editDiagnostics:e}),onResolveAllOpen:Zt,onOpenUiFontModal:()=>qe(!0),onOpenMonoFontModal:()=>Ye(!0),onOpenSearch:()=>Re(`all`),onCopyComments:D,onCopyMarkdown:O,onSendToAgent:j,agentWaiting:N,waitingAgents:P,sending:M,comments:le,viewedFileCount:rt.size,onEditComment:w,onDeleteComment:b,zenMode:be,onToggleZen:dn,sendReviewOpen:Xe,onSendReviewOpenChange:Ze}),!be&&!ge&&(0,Y.jsx)(`div`,{className:`sidebar-mobile-backdrop`,onClick:nn,"aria-hidden":`true`}),(0,Y.jsxs)(`div`,{className:`app-body`,children:[!be&&(0,Y.jsxs)(`aside`,{ref:Me,className:`sidebar ${ge?`sidebar-collapsed`:``}`,children:[(0,Y.jsx)(`div`,{style:{flex:1,minHeight:0,overflow:`hidden`},children:(0,Y.jsx)(E5,{files:ft,activeFile:q,commentCounts:dt,viewedFiles:rt,untrackedFiles:ot,onFileClick:Tt,collapsed:ge,onToggleCollapse:nn,appliedExtensions:Se,onApplyExtensions:Et,chipFilter:we,onChipFilterChange:Te,sinceLastFiles:Ee,sinceLastAvailable:De})}),!ge&&le.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`ct-resize-handle`,onMouseDown:nt,role:`separator`,"aria-label":`Resize comments panel`,"aria-orientation":`horizontal`,tabIndex:0}),(0,Y.jsx)(`div`,{className:`ct-wrapper`,style:{flexShrink:0},children:(0,Y.jsx)(A5,{comments:le,resolveComment:x,unresolveComment:S,removeComment:b,addReply:C,editComment:w,editReply:T,removeReply:E})})]})]}),!be&&!ge&&(0,Y.jsx)(`div`,{className:`sidebar-resize-handle`,onMouseDown:Pe,role:`separator`,"aria-label":`Resize sidebar`,"aria-orientation":`vertical`,tabIndex:0}),(0,Y.jsxs)(`main`,{className:`main`,ref:at,id:`diff-main`,tabIndex:-1,children:[m&&(0,Y.jsx)(JY,{overview:m,commits:l?u:void 0}),l&&u.length>1&&(0,Y.jsx)(l7,{commits:u,activeIndex:Oe,onChange:ke}),fe.inMerge&&fe.conflicts.length>0&&(0,Y.jsxs)(`div`,{className:`merge-conflict-banner`,children:[(0,Y.jsx)(`strong`,{children:`Merge in progress`}),(0,Y.jsxs)(`span`,{children:[fe.conflicts.length,` unresolved file`,fe.conflicts.length===1?``:`s`,` below. Use the inline buttons to accept current/incoming/both, then "Save & stage".`]})]}),fe.conflicts.map(e=>(0,Y.jsx)(sZ,{filePath:e,theme:t.theme||`rose-pine`,fontSize:t.fontSize,monoFontFamily:_n,tabSize:f[e]??t.defaultTabSize,onSaved:()=>{pe()}},e)),(0,Y.jsx)(aZ,{files:mt,diffStyle:t.diffStyle,tabSizeMap:f,defaultTabSize:t.defaultTabSize,viewedFiles:rt,binaryFiles:St,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:_n,expandContextByDefault:t.expandContextByDefault,collapsedContextThreshold:t.collapsedContextThreshold,expansionLineCount:t.expansionLineCount,autoCollapseLineThreshold:t.autoCollapseLineThreshold,onViewedChange:Dt,fileAnnotationsMap:wt,onAddComment:y,onDeleteComment:b,onCardToggleCollapse:sn,canEdit:ne,editSessions:L,onRequestEdit:z,onEditChange:B,onEditAttach:V,onEditSave:H,onEditDiscard:se,onEditExit:G,fileSearch:vt,onOpenFileSearch:yt})]})]}),(0,Y.jsx)(V5,{isOpen:Fe.open,onClose:Be,initialScope:Fe.scope,initialChangedOnly:Fe.changedOnly,onChangedOnlyPreference:Ve,onSessionSnapshot:fn,files:pt,changedEntries:_t,customMode:c,staged:t.staged,onNavigateFile:Tt,theme:t.theme||`rose-pine`,fontSize:t.fontSize,monoFontFamily:_n,defaultTabSize:t.defaultTabSize,lineWrap:t.lineWrap,showLineNumbers:t.showLineNumbers,lineHoverHighlight:t.lineHoverHighlight}),!be&&(0,Y.jsx)(Y5,{activeFile:q,onShowHelp:()=>Ue(!0),visible:t.showStatusBar??!0,statusMessage:hn,placeholder:l&&u.length>1?`No active file (J/K files · [ / ] commits)`:void 0,editDirtyCount:R,editSaveEnabled:ne,onSaveAllEdits:U}),(0,Y.jsx)(X5,{isOpen:He,onClose:()=>Ue(!1)}),be&&Xe&&(0,Y.jsx)(VY,{open:Xe,onClose:()=>Ze(!1),comments:le,totalFileCount:ut.length,viewedFileCount:rt.size,requireViewAllBeforeSend:t.requireViewAllBeforeSend,onEditComment:w,onDeleteComment:b,onSend:j,sending:M,agentWaiting:N,waitingAgents:P,onCopyComments:D,onCopyMarkdown:O}),(0,Y.jsx)($5,{open:We,activeTheme:t.theme||`rose-pine`,onThemeChange:Mt,onClose:()=>Ge(!1)}),(0,Y.jsx)(n7,{open:Ke,title:`Select UI Font`,defaultLabel:`Default (Geist Mono, from CDN)`,activeFont:t.uiFont,onFontChange:Ut,onClose:()=>qe(!1)}),(0,Y.jsx)(n7,{open:Je,title:`Select Code Font`,defaultLabel:`Default (JetBrains Mono, from CDN)`,activeFont:t.monoFont,onFontChange:Wt,onClose:()=>Ye(!1)}),(0,Y.jsx)(Z5,{activity:k,onDismiss:A,onJump:Tt}),(0,Y.jsx)(u7,{}),(0,Y.jsx)(sJ,{open:re!==null,title:re?.kind===`exit`?`Exit edit mode?`:`Discard edits?`,description:re?.kind===`exit`?`This file has unsaved changes. Discard them and exit edit mode?`:`Discard all changes to this file since the last save?`,confirmLabel:`Discard`,variant:`danger`,onConfirm:K,onCancel:()=>ie(null)})]})})})}function m7(e){(0,J.useEffect)(()=>{let t=``,n,r=0,i=()=>{t=``,clearTimeout(n)},a=a=>{if(FA()||a.metaKey||a.altKey)return;clearTimeout(n);let o=a.key;if(a.ctrlKey){(o===`d`||o===`u`)&&(a.preventDefault(),window.scrollBy({top:o===`d`?window.innerHeight/2:-window.innerHeight/2,behavior:`auto`}),OA(`selection`,`navigate`),i());return}if(o.length>1&&o!==`Escape`&&o!==`Enter`)return;t+=o,n=setTimeout(()=>{t=``},800);let s=(e,t=`toggle`)=>{a.preventDefault(),e(),OA(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&&(EA(`navigate`),r=e),i()}else t===`gg`?s(()=>window.scrollTo({top:0,behavior:`auto`}),`navigate`):t===`G`?s(()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:`auto`}),`navigate`):t===`J`?s(()=>e.onNavigatePlan(`next`),`navigate`):t===`K`?s(()=>e.onNavigatePlan(`prev`),`navigate`):t===`m`?s(e.onToggleViewMode):t===`z`?s(e.onToggleZenMode):t===`c`?s(e.onToggleCommentsRail):t===`o`?s(e.onToggleOutline):t===`t`?s(e.onCycleTabSize):t===`b`?s(e.onToggleSidebar):t===`w`?s(e.onToggleLineWrap):t===`n`?s(e.onToggleLineNumbers):t===`gt`?s(e.onOpenTheme,`open`):t===`?`?s(e.onOpenShortcuts,`open`):t.length>=2&&i()};return window.addEventListener(`keydown`,a),()=>{window.removeEventListener(`keydown`,a),clearTimeout(n)}},[e])}function h7(e,t){if(t<1)return;let n=e.split(`
3648
3648
  `),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 g7(e,t,n){if(t<1)return``;let r=e.split(`
3649
3649
  `),i=Math.max(1,t),a=Math.min(n,r.length);return a<i?``:r.slice(i-1,a).join(`
3650
3650
  `)}function _7({role:e,size:t=16}){return e===`agent`?(0,Y.jsx)(`div`,{className:`comment-avatar-circle comment-avatar-agent comment-avatar-size-${t}`,children:(0,Y.jsx)(GM,{size:t,"aria-hidden":`true`})}):(0,Y.jsx)(`div`,{className:`comment-avatar-circle comment-avatar-user comment-avatar-size-${t}`,children:(0,Y.jsx)(pP,{size:t,"aria-hidden":`true`})})}function v7({comment:e,onResolve:t,onUnresolve:n,onDelete:r,onEdit:i,onReply:a,onEditReply:o,onDeleteReply:s}){let[,c]=(0,J.useState)(0),l=e.status===`resolved`,[u,d]=(0,J.useState)(l),[f,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(!1),[v,y]=(0,J.useState)(null),[b,x]=(0,J.useState)(null),S=(0,Y.jsxs)(`div`,{className:`comment-delete-confirm`,children:[(0,Y.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,Y.jsx)(uP,{size:11}),`Delete?`]}),(0,Y.jsx)(`button`,{type:`button`,className:`comment-node-btn comment-delete-confirm-cancel`,onClick:()=>_(!1),title:`Cancel delete`,"aria-label":`Cancel delete`,children:`Cancel`})]});(0,J.useEffect)(()=>{e.status===`resolved`&&d(!0)},[e.status]),(0,J.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(`