@pi-chamber/web 0.7.1 → 0.8.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 (190) hide show
  1. package/README.md +2 -1
  2. package/bin/cli.js +2 -2
  3. package/bin/cli.test.js +98 -1
  4. package/bin/lib/DOCUMENTATION.md +2 -1
  5. package/bin/lib/cli-args.js +8 -5
  6. package/bin/lib/cli-startup.js +10 -7
  7. package/bin/lib/cli-startup.test.js +28 -0
  8. package/bin/lib/commands-startup.js +152 -6
  9. package/dist/assets/{DiagramEditor-C7xe1Brl.js → DiagramEditor-YPSKccgo.js} +1 -1
  10. package/dist/assets/DiagramView-C-PbBHce.js +1 -0
  11. package/dist/assets/DiffView-DfltyfN2.js +18 -0
  12. package/dist/assets/FilesView-BEjbLiK2.js +6 -0
  13. package/dist/assets/GitView-B_zTaXX4.js +8 -0
  14. package/dist/assets/JsonTreeView-9p4txyB_.js +1 -0
  15. package/dist/assets/MarkdownRendererImpl-CbRPLK2x.js +12 -0
  16. package/dist/assets/PatchDiff-rKjeUBRl.js +1 -0
  17. package/dist/assets/SessionSwitcherContent-C_VxKFJy.js +1 -0
  18. package/dist/assets/SessionSwitcherDropdown-_k4P32o9.js +2 -0
  19. package/dist/assets/SessionUnreadDot-bT_0MixU.js +1 -0
  20. package/dist/assets/SettingsView-CqZ1ZAWG.js +2 -0
  21. package/dist/assets/SettingsWindow-C7vVE35-.js +1 -0
  22. package/dist/assets/ToolOutputDialog-GBbzATa6.js +8 -0
  23. package/dist/assets/ToolPartDiffPreview-Bdb9p5uS.js +1 -0
  24. package/dist/assets/{VirtualizedFileDiff-DFx8xsmh.js → VirtualizedFileDiff-CA8hQyz9.js} +4 -4
  25. package/dist/assets/{Virtualizer-BxW2CJGB.js → Virtualizer-BSHVMKgK.js} +1 -1
  26. package/dist/assets/{appThemeRegistry-BK0dHKa6.js → appThemeRegistry-gegrE2dq.js} +1 -1
  27. package/dist/assets/collapsible-uwSKBy-K.js +1 -0
  28. package/dist/assets/computeVirtualFileMetrics-9LNCLvAG.js +3 -0
  29. package/dist/assets/contextFileOpenGuard-CZSqdEHk.js +1 -0
  30. package/dist/assets/gitStatusPredicates-CRmbLl-x.js +134 -0
  31. package/dist/assets/index-BeJEipxi.js +1 -0
  32. package/dist/assets/index-CaP8oFLB.js +8 -0
  33. package/dist/assets/index-Dq8CnRYM.css +1 -0
  34. package/dist/assets/isDiffPlainText-YYyZNTdb.js +1 -0
  35. package/dist/assets/isFilePlainText-C70Z71bG.js +1 -0
  36. package/dist/assets/main-CsdVAKy_.js +135 -0
  37. package/dist/assets/main-GMQIZjuQ.js +2 -0
  38. package/dist/assets/{markdownCore-CzWR_p3k.js → markdownCore-BgVcDt0q.js} +2 -2
  39. package/dist/assets/miniChat-W6YsdiWR.js +2 -0
  40. package/dist/assets/mobile-BFR9CR5w.js +2 -0
  41. package/dist/assets/{permissionStore-BRcQ9Jgt.js → permissionStore-iKN1K2_x.js} +1 -1
  42. package/dist/assets/registerCustomTheme-DmolaWWZ.js +1 -0
  43. package/dist/assets/renderElectronMiniChatApp-B8ZiW-3E.js +2 -0
  44. package/dist/assets/renderMobileApp-C5CdsYP6.js +11 -0
  45. package/dist/assets/runtimeEndpointReset-D3AZYuoF.js +54 -0
  46. package/dist/assets/{runtimeSurface-OhCUGSKg.js → runtimeSurface-B818u-_c.js} +1 -1
  47. package/dist/assets/themeResolver-yJ9XpNMI.js +1 -0
  48. package/dist/assets/{WindowsWindowControls-DIqnZ2uU.js → useAppFontEffects-CYzYRbLp.js} +126 -499
  49. package/dist/assets/useFilesViewSearch-C--GWtn-.js +7 -0
  50. package/dist/assets/usePushVisibilityBeacon-D9lajdAc.js +10 -0
  51. package/dist/assets/useSwitcherItems-DOoi3x_8.js +1 -0
  52. package/dist/assets/vendor-base-ui-vkqQ2P9o.js +1 -0
  53. package/dist/assets/{vendor-beautiful-mermaid-r4GK_usS.js → vendor-beautiful-mermaid-DneUawHp.js} +1 -1
  54. package/dist/assets/{vendor-cmdk-BCEUzcHE.js → vendor-cmdk-zXx6sGnS.js} +1 -1
  55. package/dist/assets/{vendor-codemirror-autocomplete-BS2SpSAZ.js → vendor-codemirror-autocomplete-wd6iRebq.js} +1 -1
  56. package/dist/assets/{vendor-codemirror-commands-RrgJ8H_6.js → vendor-codemirror-commands-DYppkHEk.js} +1 -1
  57. package/dist/assets/{vendor-codemirror-lang-angular-ADhO_TUK.js → vendor-codemirror-lang-angular-DU_4KiiW.js} +1 -1
  58. package/dist/assets/{vendor-codemirror-lang-cpp-BGCWj7Om.js → vendor-codemirror-lang-cpp-CmIT9Z5_.js} +1 -1
  59. package/dist/assets/{vendor-codemirror-lang-css-Ba8JZ6fp.js → vendor-codemirror-lang-css-djiuoTi8.js} +1 -1
  60. package/dist/assets/{vendor-codemirror-lang-go-DyTiHXo4.js → vendor-codemirror-lang-go-COZSwZYW.js} +1 -1
  61. package/dist/assets/{vendor-codemirror-lang-html-DK27qQri.js → vendor-codemirror-lang-html-CKHqhW5R.js} +1 -1
  62. package/dist/assets/{vendor-codemirror-lang-java-CvFfnhPQ.js → vendor-codemirror-lang-java-CNMP5hyC.js} +1 -1
  63. package/dist/assets/{vendor-codemirror-lang-javascript-BUlYhQ3o.js → vendor-codemirror-lang-javascript-DuOEwJ3f.js} +1 -1
  64. package/dist/assets/{vendor-codemirror-lang-jinja-wBMtAEvT.js → vendor-codemirror-lang-jinja-DaKn_b1k.js} +1 -1
  65. package/dist/assets/{vendor-codemirror-lang-json-CqayksDf.js → vendor-codemirror-lang-json-CZ07HmNC.js} +1 -1
  66. package/dist/assets/{vendor-codemirror-lang-less-Ct3-H1PB.js → vendor-codemirror-lang-less-wJdQiDBf.js} +1 -1
  67. package/dist/assets/{vendor-codemirror-lang-liquid-XspREksq.js → vendor-codemirror-lang-liquid-0z48Roi8.js} +1 -1
  68. package/dist/assets/{vendor-codemirror-lang-markdown-CvO36Y1p.js → vendor-codemirror-lang-markdown-DtcZDGqe.js} +1 -1
  69. package/dist/assets/{vendor-codemirror-lang-php-BlUF9cCe.js → vendor-codemirror-lang-php-W8plS-JQ.js} +1 -1
  70. package/dist/assets/{vendor-codemirror-lang-python-_2bIYTiJ.js → vendor-codemirror-lang-python-DzzokVau.js} +1 -1
  71. package/dist/assets/{vendor-codemirror-lang-rust-BdTYih_U.js → vendor-codemirror-lang-rust-C4ulBVpf.js} +1 -1
  72. package/dist/assets/{vendor-codemirror-lang-sass-E6MhfOFk.js → vendor-codemirror-lang-sass-BkZJYEwS.js} +1 -1
  73. package/dist/assets/{vendor-codemirror-lang-sql-B1BRhQSF.js → vendor-codemirror-lang-sql-HpQWHJjv.js} +1 -1
  74. package/dist/assets/{vendor-codemirror-lang-vue-BYQJRa1Q.js → vendor-codemirror-lang-vue-DiBPljCc.js} +1 -1
  75. package/dist/assets/{vendor-codemirror-lang-wast-D706yuyC.js → vendor-codemirror-lang-wast-DoABsogh.js} +1 -1
  76. package/dist/assets/{vendor-codemirror-lang-xml--MfWU6Dj.js → vendor-codemirror-lang-xml-BhLJhOCH.js} +1 -1
  77. package/dist/assets/{vendor-codemirror-lang-yaml-CRUFIbRX.js → vendor-codemirror-lang-yaml-D95i1Y5R.js} +1 -1
  78. package/dist/assets/{vendor-codemirror-language-E2vgV9K3.js → vendor-codemirror-language-BByA_dGF.js} +2 -2
  79. package/dist/assets/{vendor-codemirror-language-data-Dv4zaHRN.js → vendor-codemirror-language-data-DS_4W5G4.js} +2 -2
  80. package/dist/assets/{vendor-codemirror-search-8kyQdB3f.js → vendor-codemirror-search-BV44140v.js} +1 -1
  81. package/dist/assets/{vendor-codemirror-view-DSzLbZiS.js → vendor-codemirror-view-Ct4T37Ue.js} +1 -1
  82. package/dist/assets/{vendor-dnd-kit-accessibility-Cv52zwWT.js → vendor-dnd-kit-accessibility-DZKKhs9S.js} +1 -1
  83. package/dist/assets/{vendor-dnd-kit-core-GipZW2tY.js → vendor-dnd-kit-core-CP8ck10N.js} +1 -1
  84. package/dist/assets/{vendor-dnd-kit-sortable-Ct2QxIHb.js → vendor-dnd-kit-sortable-B-Icjoj4.js} +1 -1
  85. package/dist/assets/{vendor-dnd-kit-utilities-CrOcp0Bp.js → vendor-dnd-kit-utilities-DTY1C6ST.js} +1 -1
  86. package/dist/assets/{vendor-elkjs-CRCLNXjf.js → vendor-elkjs-mzfkf0ML.js} +1 -1
  87. package/dist/assets/{vendor-floating-ui-dom-Bkw82kL9.js → vendor-floating-ui-dom-WyXykhNi.js} +1 -1
  88. package/dist/assets/{vendor-floating-ui-react-dom-sVFnuruh.js → vendor-floating-ui-react-dom-BZOGXAGe.js} +1 -1
  89. package/dist/assets/{vendor-framer-motion-DJASDzNt.js → vendor-framer-motion-BUygY0oN.js} +1 -1
  90. package/dist/assets/{vendor-heic2any-L8hyfc24.js → vendor-heic2any-BHsbokcA.js} +1 -1
  91. package/dist/assets/{vendor-lru_map-B-cPXHXW.js → vendor-lru_map-Cy8fTs3_.js} +1 -1
  92. package/dist/assets/{vendor-pierre-theming-C6Z4M5_u.js → vendor-pierre-theming-Dgp7B_O4.js} +1 -1
  93. package/dist/assets/{vendor-qrcode-COsmt6jn.js → vendor-qrcode-B0KNSajT.js} +1 -1
  94. package/dist/assets/{vendor-radix-ui-react-compose-refs-D1GnwnP9.js → vendor-radix-ui-react-compose-refs-8xy6TJML.js} +1 -1
  95. package/dist/assets/{vendor-radix-ui-react-context-CM4yFQ2I.js → vendor-radix-ui-react-context-CFsX-AUC.js} +1 -1
  96. package/dist/assets/{vendor-radix-ui-react-dialog-jX3Dld8c.js → vendor-radix-ui-react-dialog-D2yhEu2p.js} +1 -1
  97. package/dist/assets/{vendor-radix-ui-react-dismissable-layer-M7LsH3yL.js → vendor-radix-ui-react-dismissable-layer-DrorBNg9.js} +1 -1
  98. package/dist/assets/{vendor-radix-ui-react-focus-guards-D5MZ0nQs.js → vendor-radix-ui-react-focus-guards-BfdFmL7c.js} +1 -1
  99. package/dist/assets/{vendor-radix-ui-react-focus-scope-C2K7lNPv.js → vendor-radix-ui-react-focus-scope-D2BkImwt.js} +1 -1
  100. package/dist/assets/{vendor-radix-ui-react-id-BcxRjnbX.js → vendor-radix-ui-react-id-D2kS9K1j.js} +1 -1
  101. package/dist/assets/vendor-radix-ui-react-portal-YgCRIyi7.js +1 -0
  102. package/dist/assets/{vendor-radix-ui-react-presence-Btn-Dp7L.js → vendor-radix-ui-react-presence-D432pCMB.js} +1 -1
  103. package/dist/assets/{vendor-radix-ui-react-primitive-CfpW6_IT.js → vendor-radix-ui-react-primitive-DkH8dMOR.js} +1 -1
  104. package/dist/assets/{vendor-radix-ui-react-slot-BxUc3Pvz.js → vendor-radix-ui-react-slot-BIDFZX0-.js} +1 -1
  105. package/dist/assets/{vendor-radix-ui-react-use-callback-ref-UKEWHtoP.js → vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js} +1 -1
  106. package/dist/assets/{vendor-radix-ui-react-use-controllable-state-C_ecoh35.js → vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js} +1 -1
  107. package/dist/assets/vendor-radix-ui-react-use-effect-event-D94va83M.js +1 -0
  108. package/dist/assets/{vendor-radix-ui-react-use-escape-keydown-Co13lHGj.js → vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js} +1 -1
  109. package/dist/assets/vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js +1 -0
  110. package/dist/assets/{vendor-react-DYyjh7Q0.js → vendor-react-B5Z1Mdn3.js} +1 -1
  111. package/dist/assets/{vendor-react-drawio-Boqanm0j.js → vendor-react-drawio-BYDptOsj.js} +1 -1
  112. package/dist/assets/{vendor-react-remove-scroll-bar-C9YRs2nU.js → vendor-react-remove-scroll-bar-CSAHp1YF.js} +1 -1
  113. package/dist/assets/{vendor-react-remove-scroll-CfeMe0DL.js → vendor-react-remove-scroll-vR1dy1aP.js} +1 -1
  114. package/dist/assets/{vendor-react-style-singleton-B1H4bWSG.js → vendor-react-style-singleton-Ctw6HnYx.js} +1 -1
  115. package/dist/assets/{vendor-replit-codemirror-vim-BJY5fGLS.js → vendor-replit-codemirror-vim-CGHHNQxC.js} +1 -1
  116. package/dist/assets/{vendor-sonner-CW8w438f.js → vendor-sonner-BDtm25td.js} +1 -1
  117. package/dist/assets/{vendor-tanstack-react-virtual-IrbCBGJ4.js → vendor-tanstack-react-virtual-2skouoFw.js} +1 -1
  118. package/dist/assets/{vendor-use-callback-ref-CJB0R85I.js → vendor-use-callback-ref-CVVuCyLj.js} +1 -1
  119. package/dist/assets/{vendor-use-sidecar-C-AuTczP.js → vendor-use-sidecar-Vv4V8Nd1.js} +1 -1
  120. package/dist/assets/{vendor-use-sync-external-store-B7OScDIw.js → vendor-use-sync-external-store-D0AXkdQC.js} +1 -1
  121. package/dist/assets/{vendor-zustand-CnsBKjP5.js → vendor-zustand-GVb4H8HE.js} +1 -1
  122. package/dist/assets/{web-components-BOt08OHk.js → web-components-C2cMNPqE.js} +2 -2
  123. package/dist/index.html +6 -6
  124. package/dist/mini-chat.html +5 -5
  125. package/dist/mobile.html +5 -5
  126. package/package.json +1 -1
  127. package/server/lib/git/DOCUMENTATION.md +3 -2
  128. package/server/lib/git/routes.js +27 -0
  129. package/server/lib/git/routes.test.js +41 -0
  130. package/server/lib/git/service.js +7 -1
  131. package/server/lib/git/service.test.js +23 -0
  132. package/server/lib/package-manager.js +32 -1
  133. package/server/lib/package-manager.test.js +21 -0
  134. package/server/lib/pi/attachment-store.js +95 -22
  135. package/server/lib/pi/attachment-store.test.js +23 -0
  136. package/server/lib/pi/routes.js +383 -49
  137. package/server/lib/pi/routes.test.js +377 -3
  138. package/server/lib/pi/session-daemon/DOCUMENTATION.md +3 -3
  139. package/server/lib/pi/session-daemon/prompt-operations.test.js +318 -0
  140. package/server/lib/pi/session-daemon/session-daemon-extensions.test.js +2 -0
  141. package/server/lib/pi/session-daemon/session-daemon.js +316 -25
  142. package/server/lib/pi/session-daemon/session-daemon.test.js +137 -0
  143. package/server/lib/pi/session-daemon/supervisor.test.js +1 -1
  144. package/server/lib/pi/snippets-store.js +400 -0
  145. package/server/lib/pi/snippets-store.test.js +252 -0
  146. package/server/lib/relay/host-client.test.js +79 -15
  147. package/server/lib/server/cors.js +2 -0
  148. package/server/lib/server/cors.test.js +6 -5
  149. package/dist/assets/CommitSection-DuGkZ_bm.js +0 -1
  150. package/dist/assets/DiagramView-BTqROEWP.js +0 -1
  151. package/dist/assets/DiffView-hcqXTjEc.js +0 -18
  152. package/dist/assets/FilesView-GadyKxta.js +0 -14
  153. package/dist/assets/GitView-BKy-hYUN.js +0 -6
  154. package/dist/assets/JsonTreeView-CGc4eTGI.js +0 -1
  155. package/dist/assets/MarkdownRendererImpl-CqfEAhPM.js +0 -12
  156. package/dist/assets/PatchDiff-P17-Byb8.js +0 -1
  157. package/dist/assets/PierreDiffViewer-BbUCO4IF.js +0 -136
  158. package/dist/assets/SessionSwitcherContent-j6KFBSe0.js +0 -1
  159. package/dist/assets/SessionSwitcherDropdown-DSVeuuVL.js +0 -2
  160. package/dist/assets/SessionUnreadDot-BVBBEBTg.js +0 -1
  161. package/dist/assets/SettingsView-FnmtcWZc.js +0 -4
  162. package/dist/assets/SettingsWindow-Bascj0V3.js +0 -1
  163. package/dist/assets/ToolOutputDialog-CPMzJ27S.js +0 -15
  164. package/dist/assets/ToolPartDiffPreview-BZSRKHHM.js +0 -8
  165. package/dist/assets/collapsible-DlqZyxEY.js +0 -1
  166. package/dist/assets/computeVirtualFileMetrics-elCbdk6U.js +0 -3
  167. package/dist/assets/contextFileOpenGuard-BmQ7Zu-L.js +0 -1
  168. package/dist/assets/index-BerHSX92.js +0 -1
  169. package/dist/assets/index-ChFxkws4.js +0 -8
  170. package/dist/assets/index-DZ-f_hCQ.css +0 -1
  171. package/dist/assets/isDiffPlainText-CvfRfc7h.js +0 -1
  172. package/dist/assets/isFilePlainText-_vq9Ghu3.js +0 -1
  173. package/dist/assets/main-DTCOwPr3.js +0 -2
  174. package/dist/assets/main-DYs-nZO6.js +0 -133
  175. package/dist/assets/miniChat-C2XxEA3N.js +0 -2
  176. package/dist/assets/mobile-BQhAOqV7.js +0 -2
  177. package/dist/assets/registerCustomTheme-BBXUCRnG.js +0 -1
  178. package/dist/assets/renderElectronMiniChatApp-M2bY1WKA.js +0 -2
  179. package/dist/assets/renderMobileApp-BnpHUUhY.js +0 -14
  180. package/dist/assets/themeResolver-BmJyTmjJ.js +0 -1
  181. package/dist/assets/useInlineCommentController-DC0iNSYX.js +0 -2
  182. package/dist/assets/usePanelSlide-aeAIo1cp.js +0 -56
  183. package/dist/assets/usePushVisibilityBeacon-om5Qlrt6.js +0 -10
  184. package/dist/assets/useSwitcherItems-Bln2r_Q2.js +0 -1
  185. package/dist/assets/vendor-base-ui-DL8r2fgQ.js +0 -1
  186. package/dist/assets/vendor-radix-ui-react-portal-xlJWBfDg.js +0 -1
  187. package/dist/assets/vendor-radix-ui-react-use-effect-event-DkJl_Rn_.js +0 -1
  188. package/dist/assets/vendor-radix-ui-react-use-layout-effect-0fyGwS2_.js +0 -1
  189. package/dist/assets/vendor-remixicon-react-CzPq62YO.js +0 -1
  190. /package/dist/assets/{usePanelSlide-BV3KOtdA.css → runtimeEndpointReset-BV3KOtdA.css} +0 -0
@@ -1 +1 @@
1
- import{r as p}from"./registerCustomTheme-BBXUCRnG.js";import"./themeResolver-BmJyTmjJ.js";import"./vendor-pierre-theming-C6Z4M5_u.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-shikijs-core-CGM_jqPK.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-BgLrS_2D.js";import"./vendor-hast-util-to-html-BKBhbTDb.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-rJCbAzvX.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-comma-separated-tokens-D8TqSuIK.js";import"./vendor-space-separated-tokens-DD3iYX1K.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";const m=o=>/^#[0-9a-fA-F]{6}$/.test(o),f=o=>/^#[0-9a-fA-F]{8}$/.test(o),b=(o,e)=>/^[0-9a-fA-F]{2}$/.test(e)?m(o)?`${o}${e}`:f(o)?`${o.slice(0,7)}${e}`:o:o,a=(o,e)=>typeof o=="string"&&o.trim().length>0?o:e,k=o=>{const e=o.colors.syntax.base,t=o.colors.syntax.tokens??{},r=(i,n)=>a(t[i],n);return[{name:"plain",scope:["source","support.type.property-name.css"],settings:{foreground:e.foreground}},{name:"classes",scope:["entity.name.type.class"],settings:{foreground:r("className",r("class",e.function))}},{name:"interfaces",scope:["entity.name.type.interface","entity.name.type"],settings:{foreground:r("interface",e.type)}},{name:"structs",scope:["entity.name.type.struct"],settings:{foreground:r("struct",e.function)}},{name:"enums",scope:["entity.name.type.enum"],settings:{foreground:r("enum",e.function)}},{name:"keys",scope:["meta.object-literal.key","support.type.property-name"],settings:{foreground:r("key",e.function)}},{name:"methods",scope:["entity.name.function.method","meta.function.method"],settings:{foreground:r("method",o.colors.status.success)}},{name:"functions",scope:["entity.name.function","support.function","meta.function-call.generic"],settings:{foreground:e.function,fontStyle:"bold"}},{name:"variables",scope:["variable","meta.variable","variable.other.object.property"],settings:{foreground:e.variable}},{name:"variablesOther",scope:["variable.other.object","variable.other.readwrite.alias"],settings:{foreground:r("variableOther",r("method",o.colors.status.success))}},{name:"globalVariables",scope:["variable.other.global","variable.language.this"],settings:{foreground:r("variableGlobal",e.number)}},{name:"localVariables",scope:["variable.other.local"],settings:{foreground:r("variableLocal",o.colors.surface.elevated)}},{name:"parameters",scope:["variable.parameter","meta.parameter"],settings:{foreground:r("parameter",e.foreground)}},{name:"properties",scope:["variable.other.property","meta.property"],settings:{foreground:r("variableProperty",o.colors.status.info)}},{name:"strings",scope:["string","string.other.link","markup.inline.raw.string.markdown"],settings:{foreground:e.string}},{name:"stringEscapeSequences",scope:["constant.character.escape","constant.other.placeholder"],settings:{foreground:r("stringEscape",e.foreground)}},{name:"keywords",scope:["keyword"],settings:{foreground:e.keyword}},{name:"keywordsControl",scope:["keyword.control.import","keyword.control.from","keyword.import"],settings:{foreground:r("keywordImport",e.operator)}},{name:"storageModifiers",scope:["storage.modifier","keyword.modifier","storage.type"],settings:{foreground:r("storageModifier",e.keyword)}},{name:"comments",scope:["comment","punctuation.definition.comment"],settings:{foreground:e.comment}},{name:"docComments",scope:["comment.documentation","comment.line.documentation"],settings:{foreground:r("commentDoc",o.colors.surface.mutedForeground)}},{name:"numbers",scope:["constant.numeric"],settings:{foreground:e.number}},{name:"booleans",scope:["constant.language.boolean","constant.language.json"],settings:{foreground:r("boolean",e.type)}},{name:"operators",scope:["keyword.operator"],settings:{foreground:e.operator}},{name:"macros",scope:["entity.name.function.preprocessor","meta.preprocessor"],settings:{foreground:r("macro",e.keyword)}},{name:"preprocessor",scope:["meta.preprocessor"],settings:{foreground:r("preprocessor",r("label",e.number))}},{name:"urls",scope:["markup.underline.link"],settings:{foreground:r("url",o.colors.status.info)}},{name:"tags",scope:["entity.name.tag"],settings:{foreground:r("tag",e.keyword)}},{name:"jsxTags",scope:["support.class.component"],settings:{foreground:r("jsxTag",r("label",e.number))}},{name:"attributes",scope:["entity.other.attribute-name","meta.attribute"],settings:{foreground:r("tagAttribute",e.type)}},{name:"types",scope:["support.type"],settings:{foreground:e.type}},{name:"constants",scope:["variable.other.constant","variable.readonly"],settings:{foreground:r("constant",e.foreground)}},{name:"labels",scope:["entity.name.label","punctuation.definition.label"],settings:{foreground:r("label",r("variableGlobal",e.number))}},{name:"namespaces",scope:["entity.name.namespace","storage.modifier.namespace","markup.bold.markdown"],settings:{foreground:r("namespace",e.type)}},{name:"modules",scope:["entity.name.module","storage.modifier.module"],settings:{foreground:r("module",e.operator)}},{name:"typeParameters",scope:["variable.type.parameter","variable.parameter.type"],settings:{foreground:r("typeParameter",e.function)}},{name:"exceptions",scope:["keyword.control.exception","keyword.control.trycatch"],settings:{foreground:r("exception",r("label",e.number))}},{name:"decorators",scope:["meta.decorator","punctuation.decorator","entity.name.function.decorator"],settings:{foreground:r("decorator",e.type)}},{name:"calls",scope:["variable.function"],settings:{foreground:e.foreground}},{name:"punctuation",scope:["punctuation","punctuation.terminator","punctuation.definition.tag","punctuation.separator","punctuation.definition.string","punctuation.section.block"],settings:{foreground:r("punctuation",e.comment)}},{name:"yellow",scope:["storage.type.numeric.go","storage.type.byte.go","storage.type.boolean.go","storage.type.string.go","storage.type.uintptr.go","storage.type.error.go","storage.type.rune.go","constant.language.go","support.class.dart","keyword.other.documentation","storage.modifier.import.java","punctuation.definition.list.begin.markdown","punctuation.definition.quote.begin.markdown","meta.separator.markdown","entity.name.section.markdown"],settings:{foreground:e.type}},{name:"green",scope:[],settings:{foreground:r("method",o.colors.status.success)}},{name:"cyan",scope:["markup.italic.markdown","support.type.python","variable.legacy.builtin.python","support.constant.property-value.css","storage.modifier.attribute.swift"],settings:{foreground:e.string}},{name:"blue",scope:[],settings:{foreground:e.keyword}},{name:"purple",scope:["keyword.channel.go","keyword.other.platform.os.swift"],settings:{foreground:e.number}},{name:"magenta",scope:["punctuation.definition.heading.markdown"],settings:{foreground:r("label",r("variableGlobal",e.number))}},{name:"red",scope:[],settings:{foreground:e.operator}},{name:"orange",scope:[],settings:{foreground:e.function}}]},y=o=>{const e=o.colors.surface,t=o.colors.interactive,r=o.colors.status,i=o.colors.syntax.base,n=o.colors.syntax.highlights??{},s=a(n.diffAddedBackground,r.successBackground),l=a(n.diffRemovedBackground,r.errorBackground);return{"editor.background":e.background,"editor.foreground":e.foreground,"editor.hoverHighlightBackground":a(t.hover,e.subtle),"editor.lineHighlightBackground":e.muted,"editor.selectionBackground":t.selection,"editor.selectionHighlightBackground":t.selection,"editor.findMatchBackground":i.type,"editor.findMatchHighlightBackground":b(i.type,"cc"),"editor.findRangeHighlightBackground":e.muted,"editor.inactiveSelectionBackground":e.elevated,"editor.lineHighlightBorder":e.elevated,"editor.rangeHighlightBackground":a(t.active,t.borderHover),"notifications.background":e.elevated,"editorInlayHint.typeBackground":e.subtle,"editorInlayHint.typeForeground":e.foreground,"editorWhitespace.foreground":t.borderHover,"editorIndentGuide.background1":e.subtle,"editorHoverWidget.background":e.elevated,"editorLineNumber.activeForeground":a(n.lineNumberActive,e.foreground),"editorLineNumber.foreground":a(n.lineNumber,e.mutedForeground),"editorGutter.background":e.background,"editorGutter.modifiedBackground":r.info,"editorGutter.addedBackground":r.success,"editorGutter.deletedBackground":r.error,"editorBracketMatch.background":e.elevated,"editorBracketMatch.border":e.subtle,"editorError.foreground":r.error,"editorWarning.foreground":r.warning,"editorInfo.foreground":r.info,"diffEditor.insertedTextBackground":s,"diffEditor.removedTextBackground":l,"editorGroupHeader.tabsBackground":e.background,"editorGroup.border":t.border,"tab.activeBackground":e.background,"tab.inactiveBackground":e.muted,"tab.inactiveForeground":e.mutedForeground,"tab.activeForeground":e.foreground,"tab.hoverBackground":e.subtle,"tab.unfocusedHoverBackground":e.subtle,"tab.border":t.border,"tab.activeModifiedBorder":i.type,"tab.inactiveModifiedBorder":r.info,"tab.unfocusedActiveModifiedBorder":i.type,"tab.unfocusedInactiveModifiedBorder":r.info,"editorWidget.background":e.muted,"editorWidget.border":t.border,"editorSuggestWidget.background":e.background,"editorSuggestWidget.border":t.border,"editorSuggestWidget.foreground":e.foreground,"editorSuggestWidget.highlightForeground":e.mutedForeground,"editorSuggestWidget.selectedBackground":e.subtle,"peekView.border":t.border,"peekViewEditor.background":e.background,"peekViewEditor.matchHighlightBackground":e.subtle,"peekViewResult.background":e.muted,"peekViewResult.fileForeground":e.foreground,"peekViewResult.lineForeground":e.mutedForeground,"peekViewResult.matchHighlightBackground":e.subtle,"peekViewResult.selectionBackground":e.elevated,"peekViewResult.selectionForeground":e.mutedForeground,"peekViewTitle.background":e.subtle,"peekViewTitleDescription.foreground":e.mutedForeground,"peekViewTitleLabel.foreground":e.foreground,"merge.currentHeaderBackground":r.success,"merge.currentContentBackground":a(n.diffAdded,r.success),"merge.incomingHeaderBackground":r.info,"merge.incomingContentBackground":a(n.diffModified,r.info),"merge.border":t.border,"merge.commonContentBackground":e.subtle,"merge.commonHeaderBackground":e.muted,"panel.background":e.background,"panel.border":t.border,"panelTitle.activeBorder":t.borderHover,"panelTitle.activeForeground":e.foreground,"panelTitle.inactiveForeground":e.mutedForeground,"statusBar.background":e.background,"statusBar.foreground":e.foreground,"statusBar.border":t.border,"statusBar.debuggingBackground":r.error,"statusBar.debuggingForeground":r.errorForeground,"statusBar.noFolderBackground":e.subtle,"statusBar.noFolderForeground":e.mutedForeground,"titleBar.activeBackground":e.background,"titleBar.activeForeground":e.foreground,"titleBar.inactiveBackground":e.muted,"titleBar.inactiveForeground":e.mutedForeground,"titleBar.border":t.border,"menu.foreground":e.foreground,"menu.background":e.background,"menu.selectionForeground":e.foreground,"menu.selectionBackground":e.subtle,"menu.border":t.border,"editorInlayHint.foreground":e.mutedForeground,"editorInlayHint.background":e.subtle,"terminal.foreground":e.foreground,"terminal.background":e.background,"terminalCursor.foreground":e.foreground,"terminalCursor.background":e.background,"terminal.ansiRed":a(n.diffRemoved,r.error),"terminal.ansiGreen":a(n.diffAdded,r.success),"terminal.ansiYellow":r.warning,"terminal.ansiBlue":a(n.diffModified,r.info),"terminal.ansiMagenta":i.keyword,"terminal.ansiCyan":i.type,"activityBar.background":e.background,"activityBar.foreground":e.foreground,"activityBar.inactiveForeground":e.mutedForeground,"activityBar.activeBorder":e.foreground,"activityBar.border":t.border,"sideBar.background":e.background,"sideBar.foreground":e.foreground,"sideBar.border":t.border,"sideBarTitle.foreground":e.foreground,"sideBarSectionHeader.background":e.muted,"sideBarSectionHeader.foreground":e.foreground,"sideBarSectionHeader.border":t.border,"sideBar.activeBackground":e.subtle,"sideBar.activeForeground":e.foreground,"sideBar.hoverBackground":e.muted,"sideBar.hoverForeground":e.foreground,"list.warningForeground":r.warning,"list.errorForeground":r.error,"list.inactiveSelectionBackground":e.subtle,"list.activeSelectionBackground":e.elevated,"list.inactiveSelectionForeground":e.foreground,"list.activeSelectionForeground":e.foreground,"list.hoverForeground":e.foreground,"list.hoverBackground":e.muted,"input.background":e.muted,"input.foreground":e.foreground,"input.border":t.border,"input.placeholderForeground":e.mutedForeground,"inputOption.activeBorder":t.border,"inputOption.activeBackground":e.elevated,"inputOption.activeForeground":e.foreground,"inputValidation.infoBackground":r.infoBackground,"inputValidation.infoBorder":r.infoBorder,"inputValidation.warningBackground":r.warningBackground,"inputValidation.warningBorder":r.warningBorder,"inputValidation.errorBackground":r.errorBackground,"inputValidation.errorBorder":r.errorBorder,"dropdown.background":e.muted,"dropdown.foreground":e.foreground,"dropdown.border":t.border,"dropdown.listBackground":e.background,"badge.background":o.colors.primary.base,"activityBarBadge.background":o.colors.primary.base,"button.background":o.colors.primary.base,"button.foreground":a(o.colors.primary.foreground,e.background),"badge.foreground":a(o.colors.primary.foreground,e.background),"activityBarBadge.foreground":a(o.colors.primary.foreground,e.background)}};function B(o){return{name:o.metadata.name,type:o.metadata.variant,colors:y(o),tokenColors:k(o)}}const v=o=>/^#[0-9a-fA-F]{8}$/.test(o),u=o=>v(o)?o.slice(0,7):o;function w(o,e){return Object.defineProperty(o,"toString",{value:()=>e,enumerable:!1,configurable:!0}),Object.defineProperty(o,Symbol.toPrimitive,{value:()=>e,enumerable:!1,configurable:!0}),o}const h=40,d=new Map,g=new Map,c=o=>JSON.stringify(o),F=(o,e)=>{const t=o.colors?.["editor.background"],r=o.colors?.["editor.foreground"],i=t?u(t):void 0,n=r?u(r):void 0;if(!i||!n)throw new Error(`Theme "${e}" is missing editor.background/editor.foreground`);const s=o.tokenColors??[];return w({...o,name:e,fg:n,bg:i,settings:s},e)},H=o=>B(o),T=o=>{const e=c(o),t=d.get(e);if(t)return d.delete(e),d.set(e,t),t;const r=H(o),i=F(r,o.metadata.id);for(d.set(e,i);d.size>h;){const n=d.keys().next().value;if(n===void 0)break;d.delete(n)}return i},D=o=>{const e=o.metadata.id,t=c(o);if(g.get(e)===t)return;const r=T(o);p(e,async()=>r),g.set(e,t)};export{D as ensurePierreThemeRegistered,T as getResolvedShikiTheme,c as getThemeContentSignature};
1
+ import{r as p}from"./registerCustomTheme-DmolaWWZ.js";import"./themeResolver-yJ9XpNMI.js";import"./vendor-pierre-theming-Dgp7B_O4.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-shikijs-core-CGM_jqPK.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-BgLrS_2D.js";import"./vendor-hast-util-to-html-BKBhbTDb.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-rJCbAzvX.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-comma-separated-tokens-D8TqSuIK.js";import"./vendor-space-separated-tokens-DD3iYX1K.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";const m=o=>/^#[0-9a-fA-F]{6}$/.test(o),f=o=>/^#[0-9a-fA-F]{8}$/.test(o),b=(o,e)=>/^[0-9a-fA-F]{2}$/.test(e)?m(o)?`${o}${e}`:f(o)?`${o.slice(0,7)}${e}`:o:o,a=(o,e)=>typeof o=="string"&&o.trim().length>0?o:e,k=o=>{const e=o.colors.syntax.base,t=o.colors.syntax.tokens??{},r=(i,n)=>a(t[i],n);return[{name:"plain",scope:["source","support.type.property-name.css"],settings:{foreground:e.foreground}},{name:"classes",scope:["entity.name.type.class"],settings:{foreground:r("className",r("class",e.function))}},{name:"interfaces",scope:["entity.name.type.interface","entity.name.type"],settings:{foreground:r("interface",e.type)}},{name:"structs",scope:["entity.name.type.struct"],settings:{foreground:r("struct",e.function)}},{name:"enums",scope:["entity.name.type.enum"],settings:{foreground:r("enum",e.function)}},{name:"keys",scope:["meta.object-literal.key","support.type.property-name"],settings:{foreground:r("key",e.function)}},{name:"methods",scope:["entity.name.function.method","meta.function.method"],settings:{foreground:r("method",o.colors.status.success)}},{name:"functions",scope:["entity.name.function","support.function","meta.function-call.generic"],settings:{foreground:e.function,fontStyle:"bold"}},{name:"variables",scope:["variable","meta.variable","variable.other.object.property"],settings:{foreground:e.variable}},{name:"variablesOther",scope:["variable.other.object","variable.other.readwrite.alias"],settings:{foreground:r("variableOther",r("method",o.colors.status.success))}},{name:"globalVariables",scope:["variable.other.global","variable.language.this"],settings:{foreground:r("variableGlobal",e.number)}},{name:"localVariables",scope:["variable.other.local"],settings:{foreground:r("variableLocal",o.colors.surface.elevated)}},{name:"parameters",scope:["variable.parameter","meta.parameter"],settings:{foreground:r("parameter",e.foreground)}},{name:"properties",scope:["variable.other.property","meta.property"],settings:{foreground:r("variableProperty",o.colors.status.info)}},{name:"strings",scope:["string","string.other.link","markup.inline.raw.string.markdown"],settings:{foreground:e.string}},{name:"stringEscapeSequences",scope:["constant.character.escape","constant.other.placeholder"],settings:{foreground:r("stringEscape",e.foreground)}},{name:"keywords",scope:["keyword"],settings:{foreground:e.keyword}},{name:"keywordsControl",scope:["keyword.control.import","keyword.control.from","keyword.import"],settings:{foreground:r("keywordImport",e.operator)}},{name:"storageModifiers",scope:["storage.modifier","keyword.modifier","storage.type"],settings:{foreground:r("storageModifier",e.keyword)}},{name:"comments",scope:["comment","punctuation.definition.comment"],settings:{foreground:e.comment}},{name:"docComments",scope:["comment.documentation","comment.line.documentation"],settings:{foreground:r("commentDoc",o.colors.surface.mutedForeground)}},{name:"numbers",scope:["constant.numeric"],settings:{foreground:e.number}},{name:"booleans",scope:["constant.language.boolean","constant.language.json"],settings:{foreground:r("boolean",e.type)}},{name:"operators",scope:["keyword.operator"],settings:{foreground:e.operator}},{name:"macros",scope:["entity.name.function.preprocessor","meta.preprocessor"],settings:{foreground:r("macro",e.keyword)}},{name:"preprocessor",scope:["meta.preprocessor"],settings:{foreground:r("preprocessor",r("label",e.number))}},{name:"urls",scope:["markup.underline.link"],settings:{foreground:r("url",o.colors.status.info)}},{name:"tags",scope:["entity.name.tag"],settings:{foreground:r("tag",e.keyword)}},{name:"jsxTags",scope:["support.class.component"],settings:{foreground:r("jsxTag",r("label",e.number))}},{name:"attributes",scope:["entity.other.attribute-name","meta.attribute"],settings:{foreground:r("tagAttribute",e.type)}},{name:"types",scope:["support.type"],settings:{foreground:e.type}},{name:"constants",scope:["variable.other.constant","variable.readonly"],settings:{foreground:r("constant",e.foreground)}},{name:"labels",scope:["entity.name.label","punctuation.definition.label"],settings:{foreground:r("label",r("variableGlobal",e.number))}},{name:"namespaces",scope:["entity.name.namespace","storage.modifier.namespace","markup.bold.markdown"],settings:{foreground:r("namespace",e.type)}},{name:"modules",scope:["entity.name.module","storage.modifier.module"],settings:{foreground:r("module",e.operator)}},{name:"typeParameters",scope:["variable.type.parameter","variable.parameter.type"],settings:{foreground:r("typeParameter",e.function)}},{name:"exceptions",scope:["keyword.control.exception","keyword.control.trycatch"],settings:{foreground:r("exception",r("label",e.number))}},{name:"decorators",scope:["meta.decorator","punctuation.decorator","entity.name.function.decorator"],settings:{foreground:r("decorator",e.type)}},{name:"calls",scope:["variable.function"],settings:{foreground:e.foreground}},{name:"punctuation",scope:["punctuation","punctuation.terminator","punctuation.definition.tag","punctuation.separator","punctuation.definition.string","punctuation.section.block"],settings:{foreground:r("punctuation",e.comment)}},{name:"yellow",scope:["storage.type.numeric.go","storage.type.byte.go","storage.type.boolean.go","storage.type.string.go","storage.type.uintptr.go","storage.type.error.go","storage.type.rune.go","constant.language.go","support.class.dart","keyword.other.documentation","storage.modifier.import.java","punctuation.definition.list.begin.markdown","punctuation.definition.quote.begin.markdown","meta.separator.markdown","entity.name.section.markdown"],settings:{foreground:e.type}},{name:"green",scope:[],settings:{foreground:r("method",o.colors.status.success)}},{name:"cyan",scope:["markup.italic.markdown","support.type.python","variable.legacy.builtin.python","support.constant.property-value.css","storage.modifier.attribute.swift"],settings:{foreground:e.string}},{name:"blue",scope:[],settings:{foreground:e.keyword}},{name:"purple",scope:["keyword.channel.go","keyword.other.platform.os.swift"],settings:{foreground:e.number}},{name:"magenta",scope:["punctuation.definition.heading.markdown"],settings:{foreground:r("label",r("variableGlobal",e.number))}},{name:"red",scope:[],settings:{foreground:e.operator}},{name:"orange",scope:[],settings:{foreground:e.function}}]},y=o=>{const e=o.colors.surface,t=o.colors.interactive,r=o.colors.status,i=o.colors.syntax.base,n=o.colors.syntax.highlights??{},s=a(n.diffAddedBackground,r.successBackground),l=a(n.diffRemovedBackground,r.errorBackground);return{"editor.background":e.background,"editor.foreground":e.foreground,"editor.hoverHighlightBackground":a(t.hover,e.subtle),"editor.lineHighlightBackground":e.muted,"editor.selectionBackground":t.selection,"editor.selectionHighlightBackground":t.selection,"editor.findMatchBackground":i.type,"editor.findMatchHighlightBackground":b(i.type,"cc"),"editor.findRangeHighlightBackground":e.muted,"editor.inactiveSelectionBackground":e.elevated,"editor.lineHighlightBorder":e.elevated,"editor.rangeHighlightBackground":a(t.active,t.borderHover),"notifications.background":e.elevated,"editorInlayHint.typeBackground":e.subtle,"editorInlayHint.typeForeground":e.foreground,"editorWhitespace.foreground":t.borderHover,"editorIndentGuide.background1":e.subtle,"editorHoverWidget.background":e.elevated,"editorLineNumber.activeForeground":a(n.lineNumberActive,e.foreground),"editorLineNumber.foreground":a(n.lineNumber,e.mutedForeground),"editorGutter.background":e.background,"editorGutter.modifiedBackground":r.info,"editorGutter.addedBackground":r.success,"editorGutter.deletedBackground":r.error,"editorBracketMatch.background":e.elevated,"editorBracketMatch.border":e.subtle,"editorError.foreground":r.error,"editorWarning.foreground":r.warning,"editorInfo.foreground":r.info,"diffEditor.insertedTextBackground":s,"diffEditor.removedTextBackground":l,"editorGroupHeader.tabsBackground":e.background,"editorGroup.border":t.border,"tab.activeBackground":e.background,"tab.inactiveBackground":e.muted,"tab.inactiveForeground":e.mutedForeground,"tab.activeForeground":e.foreground,"tab.hoverBackground":e.subtle,"tab.unfocusedHoverBackground":e.subtle,"tab.border":t.border,"tab.activeModifiedBorder":i.type,"tab.inactiveModifiedBorder":r.info,"tab.unfocusedActiveModifiedBorder":i.type,"tab.unfocusedInactiveModifiedBorder":r.info,"editorWidget.background":e.muted,"editorWidget.border":t.border,"editorSuggestWidget.background":e.background,"editorSuggestWidget.border":t.border,"editorSuggestWidget.foreground":e.foreground,"editorSuggestWidget.highlightForeground":e.mutedForeground,"editorSuggestWidget.selectedBackground":e.subtle,"peekView.border":t.border,"peekViewEditor.background":e.background,"peekViewEditor.matchHighlightBackground":e.subtle,"peekViewResult.background":e.muted,"peekViewResult.fileForeground":e.foreground,"peekViewResult.lineForeground":e.mutedForeground,"peekViewResult.matchHighlightBackground":e.subtle,"peekViewResult.selectionBackground":e.elevated,"peekViewResult.selectionForeground":e.mutedForeground,"peekViewTitle.background":e.subtle,"peekViewTitleDescription.foreground":e.mutedForeground,"peekViewTitleLabel.foreground":e.foreground,"merge.currentHeaderBackground":r.success,"merge.currentContentBackground":a(n.diffAdded,r.success),"merge.incomingHeaderBackground":r.info,"merge.incomingContentBackground":a(n.diffModified,r.info),"merge.border":t.border,"merge.commonContentBackground":e.subtle,"merge.commonHeaderBackground":e.muted,"panel.background":e.background,"panel.border":t.border,"panelTitle.activeBorder":t.borderHover,"panelTitle.activeForeground":e.foreground,"panelTitle.inactiveForeground":e.mutedForeground,"statusBar.background":e.background,"statusBar.foreground":e.foreground,"statusBar.border":t.border,"statusBar.debuggingBackground":r.error,"statusBar.debuggingForeground":r.errorForeground,"statusBar.noFolderBackground":e.subtle,"statusBar.noFolderForeground":e.mutedForeground,"titleBar.activeBackground":e.background,"titleBar.activeForeground":e.foreground,"titleBar.inactiveBackground":e.muted,"titleBar.inactiveForeground":e.mutedForeground,"titleBar.border":t.border,"menu.foreground":e.foreground,"menu.background":e.background,"menu.selectionForeground":e.foreground,"menu.selectionBackground":e.subtle,"menu.border":t.border,"editorInlayHint.foreground":e.mutedForeground,"editorInlayHint.background":e.subtle,"terminal.foreground":e.foreground,"terminal.background":e.background,"terminalCursor.foreground":e.foreground,"terminalCursor.background":e.background,"terminal.ansiRed":a(n.diffRemoved,r.error),"terminal.ansiGreen":a(n.diffAdded,r.success),"terminal.ansiYellow":r.warning,"terminal.ansiBlue":a(n.diffModified,r.info),"terminal.ansiMagenta":i.keyword,"terminal.ansiCyan":i.type,"activityBar.background":e.background,"activityBar.foreground":e.foreground,"activityBar.inactiveForeground":e.mutedForeground,"activityBar.activeBorder":e.foreground,"activityBar.border":t.border,"sideBar.background":e.background,"sideBar.foreground":e.foreground,"sideBar.border":t.border,"sideBarTitle.foreground":e.foreground,"sideBarSectionHeader.background":e.muted,"sideBarSectionHeader.foreground":e.foreground,"sideBarSectionHeader.border":t.border,"sideBar.activeBackground":e.subtle,"sideBar.activeForeground":e.foreground,"sideBar.hoverBackground":e.muted,"sideBar.hoverForeground":e.foreground,"list.warningForeground":r.warning,"list.errorForeground":r.error,"list.inactiveSelectionBackground":e.subtle,"list.activeSelectionBackground":e.elevated,"list.inactiveSelectionForeground":e.foreground,"list.activeSelectionForeground":e.foreground,"list.hoverForeground":e.foreground,"list.hoverBackground":e.muted,"input.background":e.muted,"input.foreground":e.foreground,"input.border":t.border,"input.placeholderForeground":e.mutedForeground,"inputOption.activeBorder":t.border,"inputOption.activeBackground":e.elevated,"inputOption.activeForeground":e.foreground,"inputValidation.infoBackground":r.infoBackground,"inputValidation.infoBorder":r.infoBorder,"inputValidation.warningBackground":r.warningBackground,"inputValidation.warningBorder":r.warningBorder,"inputValidation.errorBackground":r.errorBackground,"inputValidation.errorBorder":r.errorBorder,"dropdown.background":e.muted,"dropdown.foreground":e.foreground,"dropdown.border":t.border,"dropdown.listBackground":e.background,"badge.background":o.colors.primary.base,"activityBarBadge.background":o.colors.primary.base,"button.background":o.colors.primary.base,"button.foreground":a(o.colors.primary.foreground,e.background),"badge.foreground":a(o.colors.primary.foreground,e.background),"activityBarBadge.foreground":a(o.colors.primary.foreground,e.background)}};function B(o){return{name:o.metadata.name,type:o.metadata.variant,colors:y(o),tokenColors:k(o)}}const v=o=>/^#[0-9a-fA-F]{8}$/.test(o),u=o=>v(o)?o.slice(0,7):o;function w(o,e){return Object.defineProperty(o,"toString",{value:()=>e,enumerable:!1,configurable:!0}),Object.defineProperty(o,Symbol.toPrimitive,{value:()=>e,enumerable:!1,configurable:!0}),o}const h=40,d=new Map,g=new Map,c=o=>JSON.stringify(o),F=(o,e)=>{const t=o.colors?.["editor.background"],r=o.colors?.["editor.foreground"],i=t?u(t):void 0,n=r?u(r):void 0;if(!i||!n)throw new Error(`Theme "${e}" is missing editor.background/editor.foreground`);const s=o.tokenColors??[];return w({...o,name:e,fg:n,bg:i,settings:s},e)},H=o=>B(o),T=o=>{const e=c(o),t=d.get(e);if(t)return d.delete(e),d.set(e,t),t;const r=H(o),i=F(r,o.metadata.id);for(d.set(e,i);d.size>h;){const n=d.keys().next().value;if(n===void 0)break;d.delete(n)}return i},D=o=>{const e=o.metadata.id,t=c(o);if(g.get(e)===t)return;const r=T(o);p(e,async()=>r),g.set(e,t)};export{D as ensurePierreThemeRegistered,T as getResolvedShikiTheme,c as getThemeContentSignature};
@@ -0,0 +1 @@
1
+ import{r as i,j as l}from"./vendor-react-B5Z1Mdn3.js";import{c as a}from"./index-CaP8oFLB.js";import{C as n,a as p,b}from"./vendor-base-ui-vkqQ2P9o.js";const u=n,d=({className:e,asChild:s,children:o,...t})=>{const r=s&&i.isValidElement(o)?{render:o}:{children:o};return l.jsx(p,{className:a("flex w-full items-center justify-between rounded-lg px-2 py-1.5 text-left text-foreground hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",e),...t,...r})},x=({className:e,...s})=>l.jsx(b,{className:a("overflow-hidden data-[closed]:animate-collapsible-up data-[open]:animate-collapsible-down",e),...s});export{u as C,d as a,x as b};
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-shiki-Bbf2GEcE.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-shikijs-core-CGM_jqPK.js","assets/vendor-shikijs-types-CPSbSeK6.js","assets/vendor-shikijs-vscode-textmate-BgLrS_2D.js","assets/vendor-hast-util-to-html-BKBhbTDb.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-property-information-rJCbAzvX.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-stringify-entities-CsH1VEn9.js","assets/vendor-character-entities-legacy-BpoLgcEt.js","assets/vendor-character-entities-html4-D7taRCQ7.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-comma-separated-tokens-D8TqSuIK.js","assets/vendor-space-separated-tokens-DD3iYX1K.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-shikijs-engine-oniguruma-DPWuIF1G.js"])))=>i.map(i=>d[i]);
2
+ import{_ as I}from"./vendor-vite-runtime-DD1OZmLC.js";import{b as j,c as O}from"./vendor-shiki-Bbf2GEcE.js";import{t as f}from"./themeResolver-yJ9XpNMI.js";import{s as M,p as F,n as v}from"./vendor-pierre-theming-Dgp7B_O4.js";import{c as N}from"./vendor-shikijs-engine-oniguruma-DPWuIF1G.js";import{c as z}from"./vendor-shikijs-engine-javascript-Cme4830A.js";import{y as L,aJ as G}from"./useAppFontEffects-CYzYRbLp.js";import{t as H}from"./vendor-shikijs-transformers-CZWsLLKm.js";function pe(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function ue(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function S(e){return{type:"text",value:e}}function m({tagName:e,children:t=[],properties:r={}}){return{type:"element",tagName:e,properties:r,children:t}}function fe({name:e,width:t=16,height:r=16,properties:n}){return m({tagName:"svg",properties:{width:t,height:r,viewBox:"0 0 16 16",...n},children:[m({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function V(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function de(e){return m({tagName:"div",properties:{"data-gutter":""},children:e})}function me(e,t,r,n={}){return m({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":r,...n},children:t!=null?[m({tagName:"span",properties:{"data-line-number-content":""},children:[S(`${t}`)]})]:void 0})}function he(e,t,r){return m({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":r,"data-line-type":t==="annotation"?void 0:e,style:t==="annotation"?`grid-row: span ${r};`:`grid-row: span ${r};min-height:calc(${r} * 1lh);`}})}const g=new Map,k=new Map,A=new Map,T=new Set;function E(e,t){e=Array.isArray(e)?e:[e];for(const r of e){if(T.has(r.name))continue;let n=g.get(r.name);n==null&&(n=r,g.set(r.name,n)),T.add(n.name),t.loadLanguageSync(n.data)}}function q(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function D(e){if(q())throw new Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);const t=k.get(e);if(t!=null)return t;try{let r=A.get(e);if(r==null&&Object.prototype.hasOwnProperty.call(j,e)&&(r=j[e]),r==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const n=r().then(({default:o})=>{const s={name:e,data:o};return g.has(e)||g.set(e,s),s});return k.set(e,n),await n}finally{k.delete(e)}}function W(e){return g.get(e)??D(e)}const $=new Set;function R(e,t){e=Array.isArray(e)?e:[e];for(let r of e){let n;if(typeof r=="string"){if(n=f.getResolvedTheme(r),n==null)throw new Error(`loadResolvedThemes: ${r} is not resolved, you must resolve it before calling loadResolvedThemes`)}else n=r,r=r.name,f.getResolvedTheme(r)==null&&f.seedResolvedTheme(r,n);$.has(r)||($.add(r),t.loadThemeSync(n))}}function P(e){if(q())throw new Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(f.hasRegisteredTheme(e))return;const t=M.getTheme(e);if(t!=null){f.registerThemeIfAbsent(t.name,t.load);return}throw new Error(`No valid theme loader registered for "${e}"`)}function U(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function K(e){P(e);const t=await f.resolveTheme(e);return U(e,t),t}function J(e){return f.getResolvedTheme(e)??K(e)}let c;async function ge({themes:e,langs:t,preferredHighlighter:r="shiki-js"}){c??=O({themes:[],langs:["text"],engine:r==="shiki-wasm"?N(I(()=>import("./vendor-shiki-Bbf2GEcE.js").then(a=>a.w),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))):z()});const n=X(c)?await c:c;c=n;const o=[];for(const a of t){if(a==="text"||a==="ansi")continue;const i=W(a);"then"in i?o.push(i):E(i,n)}const s=[];for(const a of e){const i=J(a);"then"in i?s.push(i):R(i,c)}return(o.length>0||s.length>0)&&await Promise.all([Promise.all(o).then(a=>{E(a,n)}),Promise.all(s).then(a=>{R(a,n)})]),n}function ye(){if(c!=null&&!("then"in c))return c}function X(e=c){return e!=null&&"then"in e}for(const e of F.getThemes())f.registerThemeIfAbsent(e.name,e.load);function be(e=L){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}const d=new Map;let B=0;const h={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function ve(e){if(d.has(e))return d.get(e)??"text";if(h[e]!=null)return h[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(d.has(t[1]))return d.get(t[1])??"text";if(h[t[1]]!=null)return h[t[1]]??"text"}const r=e.match(/\.([^.]+)$/)?.[1]??"";return d.has(r)?d.get(r)??"text":h[r]??"text"}function ke(){return B}function we(){return Object.fromEntries(d)}function Q(e,t,r){const n=typeof r.lineInfo=="function"?r.lineInfo(t):r.lineInfo[t-1];if(n==null){const o=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(o,{node:e,line:t,state:r}),new Error(o)}return e.tagName="div",e.properties["data-line"]=n.lineNumber,e.properties["data-alt-line"]=n.altLineNumber,e.properties["data-line-type"]=n.type,e.properties["data-line-index"]=n.lineIndex,e.children.length===0&&e.children.push(S(`
3
+ `)),e}const y=Symbol("no-token"),w=Symbol("multiple-tokens");function _(e){const t=Y(e);if(t!=null)return t;let r=y;const n=[];let o=[],s;const a=()=>{if(o.length===0||s==null){o=[],s=void 0;return}if(o.length===1){const l=o[0];if(l?.type==="element"){Z(l,s);for(const p of l.children)b(p)}else b(l);n.push(l),o=[],s=void 0;return}for(const l of o)b(l);n.push(m({tagName:"span",properties:{"data-char":s},children:o})),o=[],s=void 0},i=l=>{if(l!==y){if(l===w){r=w;return}if(r===y){r=l;return}r!==l&&(r=w)}};for(const l of e.children){const p=l.type==="element"?_(l):y;if(i(p),typeof p!="number"){a(),n.push(l);continue}s!=null&&s!==p&&a(),s??=p,o.push(l)}return a(),e.children=n,r}function Y(e){const t=e.properties["data-char"];if(typeof t=="number")return t}function b(e){if(e.type==="element"){e.properties["data-char"]=void 0;for(const t of e.children)b(t)}}function Z(e,t){e.properties["data-char"]=t}function xe(e=!1,t=!1){const r={lineInfo:[]},n=[{line(o){return delete o.properties.class,o},pre(o){const s=V(o),a=[];if(s!=null){let i=1;for(const l of s.children)l.type==="element"&&(e&&_(l),a.push(Q(l,i,r)),i++);s.children=a}return o},...e?{tokens(o){for(const s of o){let a=0;for(const i of s){const l=i;l.__lineChar??=a,a+=i.content.length}}},preprocess(o,s){s.mergeWhitespaces="never"},span(o,s,a,i,l){if(l?.offset!=null&&l.content!=null){const p=l.__lineChar;return p!=null&&(o.properties["data-char"]=p),o}return o}}:null}];return t&&n.push(ee,C),e&&n.push({line:o=>(o.type==="element"&&o.children.length===0&&o.children.push({type:"element",tagName:"br",properties:{},children:[]}),o)}),{state:r,transformers:n,toClass:C}}const C=H({classPrefix:"hl-"}),ee={name:"token-style-normalizer",tokens(e){for(const t of e)for(const r of t){if(r.htmlStyle!=null)continue;const n={};r.color!=null&&(n.color=r.color),r.bgColor!=null&&(n["background-color"]=r.bgColor),r.fontStyle!=null&&r.fontStyle!==0&&((r.fontStyle&1)!==0&&(n["font-style"]="italic"),(r.fontStyle&2)!==0&&(n["font-weight"]="bold"),(r.fontStyle&4)!==0&&(n["text-decoration"]="underline")),Object.keys(n).length>0&&(r.htmlStyle=n)}}};function u(e){return`--${e==="token"?"diffs-token":"diffs"}-`}function je({theme:e=L,highlighter:t,prefix:r}){let n="";if(typeof e=="string"){const o=t.getTheme(e),s=v(o);n+=`color:${s.fg};`,n+=`background-color:${s.bg};`,n+=`${u("global")}fg:${s.fg};`,n+=`${u("global")}bg:${s.bg};`,n+=x(o,r)}else{let o=t.getTheme(e.dark),s=v(o);n+=`${u("global")}dark:${s.fg};`,n+=`${u("global")}dark-bg:${s.bg};`,n+=x(o,"dark"),o=t.getTheme(e.light),s=v(o),n+=`${u("global")}light:${s.fg};`,n+=`${u("global")}light-bg:${s.bg};`,n+=x(o,"light")}return n}function x(e,t){t=t!=null?`${t}-`:"";let r="";const n=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];n!=null&&(r+=`${u("global")}${t}addition-color:${n};`);const o=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];o!=null&&(r+=`${u("global")}${t}deletion-color:${o};`);const s=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return s!=null&&(r+=`${u("global")}${t}modified-color:${s};`),r}function Te(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t.children;"children"in t?t=t.children[0]:t=null}throw console.error(e),new Error("getLineNodes: Unable to find children")}function Ee(e){return{...G,...e}}function $e(e,t){const r=te(e,t);return t?r:e.diffHeaderHeight+r}function te(e,t){return e.paddingTop??(t?e.spacing:0)}function Re(e){return e.paddingBottom??e.spacing}function Ce(e){switch(e){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}export{Ee as A,T as B,$ as C,g as R,pe as a,je as b,xe as c,Te as d,W as e,u as f,ve as g,be as h,R as i,ge as j,we as k,ue as l,ke as m,Ce as n,ye as o,P as p,he as q,D as r,me as s,m as t,de as u,U as v,$e as w,Re as x,S as y,fe as z};
@@ -0,0 +1 @@
1
+ import{r as a}from"./index-CaP8oFLB.js";import{n as l,o as c,p as u,q as d}from"./useAppFontEffects-CYzYRbLp.js";const o=5e3,f=(r,t)=>{if(!r)return 1;let e=1;for(let n=0;n<r.length;n+=1)if(r.charCodeAt(n)===10&&(e+=1,e>t))return e;return e},y=r=>{const e=(r instanceof Error?r.message:String(r??"")).toLowerCase();return e.includes("file not found")||e.includes("not found")||e.includes("enoent")||e.includes("no such file")||e.includes("does not exist")?"missing":"unreadable"},g=async(r,t,e)=>{if(r.readFile)return(await r.readFile(t,{optional:!0,directory:e?.directory})).content??"";const n=new URLSearchParams({path:t,optional:"true"});e?.directory&&n.set("directory",e.directory);const i=await a(`/api/fs/read?${n.toString()}`,{cache:"no-store",headers:e?.directory?{"x-pichamber-directory":e.directory}:void 0});if(!i.ok){const s=await i.json().catch(()=>({error:i.statusText}));throw new Error(s.error||"Failed to read file")}return i.text()},w=async(r,t,e)=>{if(l(t)||c(t)||u(t))return{ok:!0};try{const n=await g(r,t,e);return d(n)?{ok:!1,reason:"binary"}:f(n,o)>o?{ok:!1,reason:"too-large"}:{ok:!0}}catch(n){return{ok:!1,reason:y(n)}}},x=r=>r==="too-large"?`File is too large to open (>${o.toLocaleString("en-US")} lines)`:r==="missing"?"File not found":r==="binary"?"Cannot preview binary file":"Failed to open file";export{x as g,w as v};
@@ -0,0 +1,134 @@
1
+ import{r as p,R as X,j as D}from"./vendor-react-B5Z1Mdn3.js";import{a as ue}from"./web-components-C2cMNPqE.js";import{l as J}from"./computeVirtualFileMetrics-9LNCLvAG.js";import{V as fe,F as ge}from"./VirtualizedFileDiff-CA8hQyz9.js";import{i as pe,ao as me}from"./useAppFontEffects-CYzYRbLp.js";import{u as ve}from"./runtimeEndpointReset-D3AZYuoF.js";import{ensurePierreThemeRegistered as ee,getResolvedShikiTheme as te}from"./appThemeRegistry-gegrE2dq.js";import{g as ie,c as ne}from"./index-CaP8oFLB.js";const j=new Set;let Y=null;function S(n){j.add(n),Y??=requestAnimationFrame(ae)}function ae(n){const e=new Set(j);j.clear();for(const t of e)try{t(n)}catch(i){console.error(i)}j.size>0?Y=requestAnimationFrame(ae):Y=null}function re({scrollTop:n,scrollHeight:e,height:t,fitPerfectly:i=!1,fitPerfectlyOverscroll:r=0,overscrollSize:s}){const a=t+s*2,d=i?t+r*2:a;if(e=Math.max(e,d),a>=e||i){const f=Math.max(n-r,0),m=Math.min(n+d,e);return{top:f,bottom:Math.max(m,f)}}let o=n+t/2-a/2,h=o+a;return o<0&&(o=0),h>e&&(h=e),o=Math.floor(Math.max(o,0)),{top:o,bottom:Math.ceil(Math.max(Math.min(h,e),o))}}function be(n,e){return n==null||e==null?n===e:n.top===e.top&&n.bottom===e.bottom}const ce=1e3,ye=ce*4,we=[0,1e-6,.99999,1],Re={overscrollSize:ce,intersectionObserverMargin:ye,resizeDebugging:!1};let N=0,Se=-1;var Ee=class k{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++Se}`;config;type="simple";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...Re,...e}}setup(e,t){if(this.root==null){this.root=e,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:we,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),e instanceof Document?this.setupWindow():this.setupElement(t),window.__INSTANCE=this,window.__TOGGLE=()=>{k.__STOP?(k.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:k.__lastScrollPosition}),S(this.computeRenderRangeAndEmit)):(k.__lastScrollPosition=this.getScrollTop(),k.__STOP=!0)};for(const[i,r]of this.connectQueue.entries())this.connect(i,r);this.connectQueue.clear(),this.markDOMDirty(),S(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),S(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=re({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){const i=this.getScrollTop(),r=this.getHeight(),s=this.config.intersectionObserverMargin,a=i-s,d=i+r+s;return!(e<a-t||e>d)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(const i of e){const r=i.borderBoxSize[0].blockSize;this.root instanceof Document?r!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:r-N,newSize:r}),N=r)):i.target===this.root?r!==this.height&&(this.heightDirty=!0,t=!0):i.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:r-N,newSize:r}),N=r))}t&&S(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+q(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),S(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){const t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),S(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{k.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,S(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{k.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,S(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{k.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,S(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(k.__STOP)return;const e=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;let t=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const s=re({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!e&&be(this.windowSpecs,s)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=s}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const i=this.getScrollAnchor(this.height),r=new Set;for(const s of e?this.observers.values():this.visibleInstances.values())s.onRender(e)&&r.add(s);for(const s of this.instancesChanged)r.has(s)||s.onRender(e)&&r.add(s);this.scrollFix(i);for(const s of r)s.reconcileHeights();t||=this.instancesChanged.size>0,t&&this.markDOMDirty(),(t||e)&&S(this.computeRenderRangeAndEmit),r.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;const t=this.getScrollContainerElement(),{lineIndex:i,lineOffset:r,fileElement:s,fileOffset:a,fileTypeOffset:d}=e;if(i!=null&&r!=null){const h=s.shadowRoot?.querySelector(`[data-line][data-line-index="${i}"]`);if(h instanceof HTMLElement){const f=q(h,t);if(f!==r){const m=f-r;this.applyScrollFix(m)}return}}const o=q(s,t);if(d==="top")o!==a&&this.applyScrollFix(o-a);else{const h=o+s.getBoundingClientRect().height;h!==a&&this.applyScrollFix(h-a)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){const t=this.getScrollContainerElement();let i;for(const[r]of this.visibleInstances.entries()){const s=q(r,t),a=s+r.offsetHeight;let d,o;a<=0?(d=a,o="bottom"):(d=s,o="top");let h,f;if(a>0&&s<e)for(const x of r.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(x instanceof HTMLElement))continue;const z=x.dataset.lineIndex;if(z==null)continue;const M=q(x,t);if(!(M<0)){h=z,f=M;break}}if(i?.lineOffset!=null&&f==null)continue;let m=!1;(i==null||f!=null&&(i.lineOffset==null||f<i.lineOffset)||f==null&&i.lineOffset==null&&(d>=0&&(i.fileOffset<0||d<i.fileOffset)||d<0&&i.fileOffset<0&&d>i.fileOffset))&&(m=!0),m&&(i={fileElement:r,fileTypeOffset:o,fileOffset:d,lineIndex:h,lineOffset:f})}return i}handleIntersectionChange=e=>{this.scrollDirty=!0;for(const{target:t,isIntersecting:i}of e){if(!(t instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const r=this.observers.get(t);r!=null&&(i&&!this.visibleInstances.has(t)?(r.setVisibility(!0),this.visibleInstances.set(t,r),this.visibleInstancesDirty=!0):!i&&this.visibleInstances.has(t)&&(r.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&S(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function q(n,e){const t=n.getBoundingClientRect(),i=e?.getBoundingClientRect().top??0;return t.top-i}const se=5e5,ke=`
2
+ :host {
3
+ font-family: var(--font-mono);
4
+ font-size: var(--text-code);
5
+ }
6
+
7
+ pre, [data-code] {
8
+ font-family: var(--font-mono);
9
+ font-size: var(--text-code);
10
+ }
11
+
12
+ /* Mobile touch selection support */
13
+ [data-line-number] {
14
+ touch-action: manipulation;
15
+ -webkit-tap-highlight-color: transparent;
16
+ cursor: pointer;
17
+ }
18
+
19
+ /* Ensure interactive line numbers work on touch */
20
+ pre[data-interactive-line-numbers] [data-line-number] {
21
+ touch-action: manipulation;
22
+ }
23
+ `,xe=`
24
+ ${ke}
25
+
26
+ :host {
27
+ --diffs-bg-separator-override: var(--surface-elevated);
28
+ }
29
+
30
+ [data-diff-header],
31
+ [data-diff] {
32
+ [data-separator] {
33
+ height: 24px !important;
34
+ }
35
+ }
36
+
37
+ [data-separator="line-info-basic"] {
38
+ height: 24px !important;
39
+ background: var(--diffs-bg) !important;
40
+ position: relative;
41
+ }
42
+
43
+ [data-diff-type="single"] [data-gutter],
44
+ [data-diff-type="split"] [data-deletions] [data-gutter] {
45
+ [data-separator-wrapper] {
46
+ position: absolute;
47
+ left: 100%;
48
+ display: flex;
49
+ align-items: center;
50
+ gap: unset;
51
+ width: max-content;
52
+ background: transparent;
53
+ color: var(--diffs-fg-number);
54
+ font-family: var(--diffs-header-font-family, var(--font-sans));
55
+ font-size: 0.75rem;
56
+ line-height: 1;
57
+ margin-left: calc(-2ch - 2px);
58
+ }
59
+
60
+ [data-separator-wrapper][data-separator-multi-button] {
61
+ margin-left: calc(-3ch - 2px);
62
+ }
63
+
64
+ [data-expand-button],
65
+ [data-separator-content] {
66
+ display: block;
67
+ align-self: unset;
68
+ min-width: unset;
69
+ min-height: unset;
70
+ padding: 0;
71
+ flex-shrink: 0;
72
+ grid-column: unset;
73
+ border: none;
74
+ width: auto;
75
+ height: auto;
76
+ background-color: transparent;
77
+ color: inherit;
78
+ font: inherit;
79
+ }
80
+
81
+ [data-expand-button]:not([data-expand-all-button]) {
82
+ &[data-expand-down]::before {
83
+ content: '\\2191';
84
+ }
85
+
86
+ &[data-expand-up]::before {
87
+ content: '\\2193';
88
+ }
89
+
90
+ &[data-expand-both]::before {
91
+ content: '\\2195';
92
+ }
93
+
94
+ svg {
95
+ display: none;
96
+ }
97
+ }
98
+
99
+ [data-separator-content] {
100
+ background: transparent;
101
+ margin-left: calc(2px + 1ch);
102
+ }
103
+
104
+ [data-expand-all-button] {
105
+ position: relative;
106
+ margin-left: 14px;
107
+ text-transform: lowercase;
108
+ }
109
+
110
+ [data-expand-all-button]::before {
111
+ content: '';
112
+ display: block;
113
+ position: absolute;
114
+ top: 50%;
115
+ left: -8px;
116
+ margin-top: -1px;
117
+ width: 3px;
118
+ height: 3px;
119
+ border-radius: 2px;
120
+ background-color: var(--diffs-fg-number);
121
+ pointer-events: none;
122
+ }
123
+
124
+ [data-separator-content]:hover,
125
+ [data-expand-button]:hover,
126
+ [data-expand-all-button]:hover {
127
+ color: var(--diffs-fg);
128
+ }
129
+
130
+ [data-expand-all-button]:hover {
131
+ text-decoration: underline;
132
+ }
133
+ }
134
+ `;function Te(n){let e=2166136261;for(let t=0;t<n.length;t+=1)e^=n.charCodeAt(t),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16)}function oe(n){const e=n.length>400?`${n.slice(0,200)}${n.slice(-200)}`:n;return`${n.length}:${Te(e)}`}const Oe=n=>n==="auto"||n==="scroll"||n==="overlay",ze=n=>{let e=n?.parentElement??null;for(;e;){const t=window.getComputedStyle(e);if(Oe(t.overflowY))return e;e=e.parentElement}return null},Ce=(n,e)=>{if(!n||!e||typeof window>"u")return()=>{};const t=ze(n);if(!t)return()=>{};const i=e.getBoundingClientRect().height;if(!i)return()=>{};const r=n.getBoundingClientRect().top-t.getBoundingClientRect().top,s=e.style.minHeight;e.style.minHeight=`${Math.ceil(i)}px`;let a=!1;return()=>{if(a)return;a=!0,e.style.minHeight=s;const o=n.getBoundingClientRect().top-t.getBoundingClientRect().top-r;o&&(t.scrollTop+=o)}},De=(n,e)=>{if(typeof window>"u")return()=>{};let t=null,i=null,r=!1;const s=()=>{r||(i?.disconnect(),i=null,t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{r||e()})}))},a=()=>n.querySelector("diffs-container")?.shadowRoot??void 0,d=(o=a())=>!!o?.querySelector("[data-line]");return d()?s():typeof MutationObserver<"u"?(i=new MutationObserver(()=>{const o=a();if(o){if(d(o)){s();return}i?.disconnect(),i=new MutationObserver(()=>{d(o)&&s()}),i.observe(o,{childList:!0,subtree:!0})}}),i.observe(n,{childList:!0,subtree:!0})):t=window.requestAnimationFrame(s),()=>{r=!0,i?.disconnect(),t!==null&&window.cancelAnimationFrame(t)}},U=new WeakMap,Me={lineHeight:24,hunkSeparatorHeight:24,spacing:0};function Ie(n){const e=n.closest("[data-diff-virtual-root]");if(e instanceof HTMLElement){const t=e.querySelector("[data-diff-virtual-content]");return{key:e,root:e,content:t instanceof HTMLElement?t:void 0}}return{key:document,root:document,content:void 0}}function He(n){if(typeof document>"u")return null;const e=Ie(n);let t=U.get(e.key);if(!t){const r=new Ee;r.setup(e.root,e.content),t={virtualizer:r,refs:0},U.set(e.key,t)}t.refs+=1;let i=!1;return{virtualizer:t.virtualizer,root:e.root,release:()=>{if(i)return;i=!0;const r=U.get(e.key);r&&(r.refs-=1,!(r.refs>0)&&(r.virtualizer.cleanUp(),U.delete(e.key)))}}}const Pe=(n,e,t)=>{if(typeof window>"u")return()=>{};const i=[],r=()=>{try{n.rerender()}catch{}const s=e?.root;s instanceof HTMLElement?s.dispatchEvent(new Event("scroll",{bubbles:!1})):document.dispatchEvent(new Event("scroll",{bubbles:!1})),window.dispatchEvent(new Event("resize")),t()};return i.push(window.requestAnimationFrame(r)),i.push(window.requestAnimationFrame(()=>{i.push(window.requestAnimationFrame(r))})),()=>{for(const s of i)window.cancelAnimationFrame(s)}},Ne=({original:n,modified:e,fileDiff:t,language:i,fileName:r,renderSideBySide:s,wrapLines:a,layout:d="fill"})=>{const o=pe(),h=o?.currentTheme.metadata.variant==="dark",f=o?.availableThemes.find(c=>c.metadata.id===o.lightThemeId)??ie(!1),m=o?.availableThemes.find(c=>c.metadata.id===o.darkThemeId)??ie(!0);ee(f),ee(m);const x=`${f.metadata.id}:${m.metadata.id}:${h?"dark":"light"}`,z=p.useMemo(()=>{if(t){const c=t.deletionLines.reduce((g,u)=>g+u.length,0),l=t.additionLines.reduce((g,u)=>g+u.length,0);return Math.max(c,l)>se}return Math.max(n.length,e.length)>se},[t,e.length,n.length]),M=p.useRef(null),F=p.useRef(null),L=p.useRef(null),V=p.useRef(null),G=p.useRef(null),Q=p.useRef(null),K=p.useRef(void 0),W=p.useRef(void 0),$=p.useRef(void 0),B=p.useRef(void 0),[,Z]=X.useReducer(c=>c+1,0),A=ve(z?"unified":s?"split":"unified"),T=p.useMemo(()=>te(f),[f]),O=p.useMemo(()=>te(m),[m]);X.useLayoutEffect(()=>{const c=M.current;if(!c)return;const l=c.querySelector("diffs-container");if(!l)return;const g=h?O:T,u=(de,he)=>de.colors?.[he],w=u(T,"terminal.ansiGreen"),b=u(T,"terminal.ansiRed"),y=u(T,"terminal.ansiBlue"),H=u(O,"terminal.ansiGreen"),E=u(O,"terminal.ansiRed"),C=u(O,"terminal.ansiBlue");l.style.setProperty("--shiki-light",T.fg),l.style.setProperty("--shiki-light-bg",T.bg),w&&l.style.setProperty("--shiki-light-addition-color",w),b&&l.style.setProperty("--shiki-light-deletion-color",b),y&&l.style.setProperty("--shiki-light-modified-color",y),l.style.setProperty("--shiki-dark",O.fg),l.style.setProperty("--shiki-dark-bg",O.bg),H&&l.style.setProperty("--shiki-dark-addition-color",H),E&&l.style.setProperty("--shiki-dark-deletion-color",E),C&&l.style.setProperty("--shiki-dark-modified-color",C),l.style.setProperty("--diffs-bg",g.bg),l.style.setProperty("--diffs-fg",g.fg);const R=h?H:w,P=h?E:b,_=h?C:y;R&&l.style.setProperty("--diffs-addition-color-override",R),P&&l.style.setProperty("--diffs-deletion-color-override",P),_&&l.style.setProperty("--diffs-modified-color-override",_);const v=l.shadowRoot?.querySelector("pre");v&&(v.style.setProperty("--shiki-light",T.fg),v.style.setProperty("--shiki-light-bg",T.bg),w&&v.style.setProperty("--shiki-light-addition-color",w),b&&v.style.setProperty("--shiki-light-deletion-color",b),y&&v.style.setProperty("--shiki-light-modified-color",y),v.style.setProperty("--shiki-dark",O.fg),v.style.setProperty("--shiki-dark-bg",O.bg),H&&v.style.setProperty("--shiki-dark-addition-color",H),E&&v.style.setProperty("--shiki-dark-deletion-color",E),C&&v.style.setProperty("--shiki-dark-modified-color",C),v.style.setProperty("--diffs-bg",g.bg),v.style.setProperty("--diffs-fg",g.fg),R&&v.style.setProperty("--diffs-addition-color-override",R),P&&v.style.setProperty("--diffs-deletion-color-override",P),_&&v.style.setProperty("--diffs-modified-color-override",_))},[O,x,h,T]);const I=p.useMemo(()=>({theme:{dark:m.metadata.id,light:f.metadata.id},themeType:h?"dark":"light",diffStyle:s?"split":"unified",diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",maxLineDiffLength:z?0:1e3,maxLineLengthForHighlighting:z?1:1e3,tokenizeMaxLineLength:z?1:1e3,collapsedContextThreshold:0,expansionLineCount:20,overflow:a?"wrap":"scroll",disableFileHeader:!0,enableLineSelection:!1,enableHoverUtility:!1,unsafeCSS:xe}),[m.metadata.id,h,z,f.metadata.id,s,a]);return p.useEffect(()=>{const c=F.current;return()=>{L.current?.cleanUp(),L.current=null,V.current?.release(),V.current=null,G.current=null,Q.current=null,K.current=void 0,W.current=void 0,$.current=void 0,B.current=void 0,c&&(c.innerHTML="")}},[]),p.useEffect(()=>{if(typeof window>"u")return;const c=F.current,l=M.current;if(!c||!A)return;const g=Ce(l,c);let u=V.current;u||(u=He(c),V.current=u),V.current=u;const w=u?.virtualizer??null,b=t?void 0:{name:r||"",contents:n,lang:i,cacheKey:`old:${x}:${r}:${oe(n)}`},y=t?void 0:{name:r||"",contents:e,lang:i,cacheKey:`new:${x}:${r}:${oe(e)}`},H=t?W.current!==t:W.current!==void 0||!b||!y||!$.current||!B.current||!J($.current,b)||!J(B.current,y),E=L.current,C=!!(E&&(G.current!==w||Q.current!==A||w&&(K.current!==I.hunkSeparators||H)));C&&(E?.cleanUp(),L.current=null,c.innerHTML="");let R=L.current;const P=!C&&E?!ue(E.options,I):!1;if(R?R.setOptions(I):(R=u?new fe(I,u.virtualizer,Me,A):new ge(I,A),L.current=R),G.current=w,Q.current=A,K.current=w?I.hunkSeparators:void 0,W.current=t,$.current=b,B.current=y,t)R.render({fileDiff:t,forceRender:P,containerWrapper:c});else{if(!b||!y)return;R.render({oldFile:b,newFile:y,forceRender:P,containerWrapper:c})}const _=De(c,()=>{g(),Pe(R,u,Z)});return()=>{_(),g()}},[x,t,r,i,e,I,n,A]),p.useEffect(()=>{const c=F.current;if(!c)return;let l=null,g=null;const w=setTimeout(()=>{const b=c.querySelector("diffs-container");if(!(b instanceof HTMLElement))return;const y=b.shadowRoot;l=new MutationObserver(()=>{g&&cancelAnimationFrame(g),g=requestAnimationFrame(()=>{Z(),g=null})}),l.observe(b,{childList:!0,subtree:!0}),y&&l.observe(y,{childList:!0,subtree:!0})},100);return()=>{clearTimeout(w),g&&cancelAnimationFrame(g),l?.disconnect()}},[x,r]),typeof window>"u"?null:d==="fill"?D.jsx("div",{className:ne("flex flex-col relative","size-full"),"data-diff-virtual-root":!0,children:D.jsx("div",{className:"flex-1 relative min-h-0",children:D.jsx(me,{outerClassName:"pierre-diff-wrapper size-full",disableHorizontal:!1,fillContainer:!0,"data-diff-virtual-content":!0,children:D.jsx("div",{ref:M,className:"size-full relative",children:D.jsx("div",{ref:F,className:"size-full"})})})})}):D.jsx("div",{className:ne("relative","w-full"),children:D.jsx("div",{ref:M,className:"pierre-diff-wrapper w-full overflow-x-auto overflow-y-visible relative","data-no-drawer-swipe":"true",children:D.jsx("div",{ref:F,className:"w-full"})})})},le={"?":{code:"?",color:"var(--status-info)",description:"Untracked file"},A:{code:"A",color:"var(--status-success)",description:"New file"},D:{code:"D",color:"var(--status-error)",description:"Deleted file"},R:{code:"R",color:"var(--status-info)",description:"Renamed file"},C:{code:"C",color:"var(--status-info)",description:"Copied file"},M:{code:"M",color:"var(--status-warning)",description:"Modified file"}};function Ue(n){const e=n.index?.trim(),t=n.working_dir?.trim(),i=e&&e!=="?"?e.charAt(0):t?.charAt(0)||e?.charAt(0)||"M";return le[i]??le.M}function je(n){const e=n.index?.trim();return!!(e&&e!=="?")}function Ge(n){return!!n.working_dir?.trim()||n.index?.trim()==="?"}function Qe(n){const e=n.index?.trim(),t=n.working_dir?.trim();return e==="A"||t==="A"||e==="?"||t==="?"}export{Ne as P,Ge as a,Qe as b,Ue as d,je as i};
@@ -0,0 +1 @@
1
+ import{y as q}from"./useAppFontEffects-CYzYRbLp.js";import{R as x,e as L,r as D,p as W,v as A,h as v,a as M,i as P,j as R,k as V,l as _,m as Q,g as y}from"./computeVirtualFileMetrics-9LNCLvAG.js";import{h as w,i as C,a as k,r as N}from"./isFilePlainText-C70Z71bG.js";import{a as g,i as I,r as $,b as j}from"./isDiffPlainText-YYyZNTdb.js";import{t as K}from"./themeResolver-yJ9XpNMI.js";import{L as S}from"./vendor-lru_map-Cy8fTs3_.js";import"./vendor-zustand-GVb4H8HE.js";import"./vendor-react-B5Z1Mdn3.js";import"./vendor-scheduler-7OC5HNn7.js";import"./index-CaP8oFLB.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-base-ui-vkqQ2P9o.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-react-dom-BZOGXAGe.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-use-sync-external-store-D0AXkdQC.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-sonner-BDtm25td.js";import"./vendor-codemirror-view-Ct4T37Ue.js";import"./vendor-codemirror-state-CNWM3Q8V.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./runtimeSurface-B818u-_c.js";import"./vendor-dnd-kit-core-CP8ck10N.js";import"./vendor-dnd-kit-utilities-DTY1C6ST.js";import"./vendor-dnd-kit-accessibility-DZKKhs9S.js";import"./vendor-dnd-kit-sortable-B-Icjoj4.js";import"./vendor-cmdk-zXx6sGnS.js";import"./vendor-radix-ui-react-dialog-D2yhEu2p.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-8xy6TJML.js";import"./vendor-radix-ui-react-context-CFsX-AUC.js";import"./vendor-radix-ui-react-id-D2kS9K1j.js";import"./vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js";import"./vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js";import"./vendor-radix-ui-react-dismissable-layer-DrorBNg9.js";import"./vendor-radix-ui-react-primitive-DkH8dMOR.js";import"./vendor-radix-ui-react-slot-BIDFZX0-.js";import"./vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js";import"./vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js";import"./vendor-radix-ui-react-focus-scope-D2BkImwt.js";import"./vendor-radix-ui-react-portal-YgCRIyi7.js";import"./vendor-radix-ui-react-presence-D432pCMB.js";import"./vendor-radix-ui-react-focus-guards-BfdFmL7c.js";import"./vendor-react-remove-scroll-vR1dy1aP.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-CSAHp1YF.js";import"./vendor-react-style-singleton-Ctw6HnYx.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-Vv4V8Nd1.js";import"./vendor-use-callback-ref-CVVuCyLj.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-codemirror-language-BByA_dGF.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-lang-javascript-DuOEwJ3f.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-wd6iRebq.js";import"./vendor-codemirror-lang-json-CZ07HmNC.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-djiuoTi8.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-CKHqhW5R.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-DtcZDGqe.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-DS_4W5G4.js";import"./vendor-codemirror-lang-python-DzzokVau.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-codemirror-commands-DYppkHEk.js";import"./vendor-tanstack-react-virtual-2skouoFw.js";import"./vendor-tanstack-virtual-core-Dubg10g5.js";import"./vendor-framer-motion-BUygY0oN.js";import"./vendor-motion-dom-DJLgZh4Q.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-shiki-Bbf2GEcE.js";import"./vendor-shikijs-core-CGM_jqPK.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-BgLrS_2D.js";import"./vendor-hast-util-to-html-BKBhbTDb.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-rJCbAzvX.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-comma-separated-tokens-D8TqSuIK.js";import"./vendor-space-separated-tokens-DD3iYX1K.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-shikijs-engine-oniguruma-DPWuIF1G.js";import"./vendor-pierre-theming-Dgp7B_O4.js";import"./vendor-shikijs-engine-javascript-Cme4830A.js";import"./vendor-oniguruma-to-es-DLBnFDCE.js";import"./vendor-oniguruma-parser-C0D4_9rT.js";import"./vendor-regex-BBWcyTkg.js";import"./vendor-regex-utilities-2BQyy0xI.js";import"./vendor-regex-recursion-JU4mF-dD.js";import"./vendor-shikijs-transformers-CZWsLLKm.js";import"./vendor-diff-C3JhlQdm.js";function B(e){const t=[];for(const i of e){const s=x.get(i);if(s==null)throw new Error(`getResolvedLanguages: ${i} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(s)}return t}function O(e){for(const t of Array.isArray(e)?e:[e])if(!x.has(t))return!1;return!0}async function z(e){const t=[],i=[];for(const s of e){if(s==="text"||s==="ansi")continue;const r=L(s)??D(s);"then"in r?i.push(r):t.push(r)}return i.length>0&&await Promise.all(i).then(s=>{for(const r of s){if(r==null)throw new Error("resolvedLanguages: unable to resolve language");t.push(r)}}),t}function b(e){return K.getResolvedThemes(e)}async function E(e){for(const i of e)W(i);const t=await K.resolveThemes(e);for(let i=0;i<e.length;i++)A(e[i],t[i]);return t}const p=Symbol("IGNORE_RESPONSE");var T=class extends Error{constructor(){super("WorkerPoolManager: operation canceled because the pool terminated")}},G=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:i=q,useTokenTransformer:s=!1,lineDiffType:r="word-alt",maxLineDiffLength:n=1e3,tokenizeMaxLineLength:a=1e3,preferredHighlighter:o="shiki-js"}){this.options=e,this.preferredHighlighter=o,this.renderOptions={theme:i,useTokenTransformer:s,lineDiffType:r,maxLineDiffLength:n,tokenizeMaxLineLength:a},this.fileCache=new S.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new S.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed}getFileResultCache(e){return e.cacheKey!=null?this.fileCache.get(e.cacheKey):void 0}getDiffResultCache(e){return e.cacheKey!=null?this.diffCache.get(e.cacheKey):void 0}inspectCaches(){const{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??q,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:i=this.renderOptions.lineDiffType??"word-alt",maxLineDiffLength:s=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:r=this.renderOptions.tokenizeMaxLineLength??1e3}){const{lifecycleGeneration:n}=this,a=++this.renderOptionsRequestVersion,o=()=>this.isCurrentLifecycle(n)&&this.renderOptionsRequestVersion===a;try{const h={theme:e,useTokenTransformer:t,lineDiffType:i,maxLineDiffLength:s,tokenizeMaxLineLength:r};if(this.isInitialized()||await this.initialize(),!o()||g(h,this.renderOptions))return;const l=v(e);let u=[];if(M(h.theme,this.renderOptions.theme)||(w(l)?u=b(l):u=await E(l)),!o())return;if(this.highlighter!=null)P(u,this.highlighter);else{const m=await R({themes:l,langs:["text"],preferredHighlighter:this.preferredHighlighter});if(!o())return;this.highlighter=m}const H=this.setRenderOptionsOnWorkers(h,u);this.renderOptions=h,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(const m of this.themeSubscribers)m.onThemeChange();await H}catch(h){if(h instanceof T||!o())return;throw h}}getFileRenderOptions(){const{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:i}=this.renderOptions;return{theme:t,useTokenTransformer:i,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();const i=[];for(const s of this.workers){if(!s.initialized)throw console.log({managedWorker:s}),new Error("setRenderOptionsOnWorkers: Somehow we have an uninitialized worker");i.push(new Promise((r,n)=>{const a=this.generateRequestId(),o={type:"set-render-options",id:a,request:{type:"set-render-options",id:a,renderOptions:e,resolvedThemes:t},resolve:r,reject:n,requestStart:Date.now()};this.activeTaskById.set(a,o),s.pendingSetupRequestId=a,s.worker.postMessage(o.request)}))}await Promise.all(i)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast==null&&(this._queuedBroadcast=requestAnimationFrame(this._broadcastStateChanges))}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);const e=this.getStats();for(const t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);const t=this.activeRequestByInstance.get(e);if(t!=null){const i=this.activeTaskById.get(t);c(i)?(this.detachInstanceFromRenderTask(i,e),!i.primeCache&&i.instances.size===0&&this.removeActiveTask(i)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized!==!0)if(this.initialized===!1){const{lifecycleGeneration:t}=this;this.initialized=new Promise((i,s)=>{(async()=>{try{const r=v(this.renderOptions.theme);let n=[];if(w(r)?n=b(r):n=await E(r),!this.isCurrentLifecycle(t)){i();return}let a=[];if(O(e)?a=B(e):a=await z(e),!this.isCurrentLifecycle(t)){i();return}const[o]=await Promise.all([R({themes:r,langs:["text",...e],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(n,a)]);if(!this.isCurrentLifecycle(t)){this.terminateWorkers(),i();return}this.highlighter=o,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),i()}catch(r){if(r instanceof T||!this.isCurrentLifecycle(t)){i();return}this.initialized=!1,this.workersFailed=!0,this.queueBroadcastStateChanges(),s(r)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}async initializeWorkers(e,t){this.workersFailed=!1;const i=[],s=void 0;this.workers.length>0&&this.terminateWorkers();for(let r=0;r<(this.options.poolSize??8);r++){const n=this.options.workerFactory(),a={worker:n,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set(["text",...t.map(({name:o})=>o)]),customExtensionsVersion:0};n.addEventListener("message",o=>{this.handleWorkerMessage(a,o.data)}),n.addEventListener("error",o=>console.error("Worker error:",o,a)),this.workers.push(a),i.push(new Promise((o,h)=>{const l=this.generateRequestId(),u={type:"initialize",id:l,request:{type:"initialize",id:l,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:void 0,customExtensionMap:s},resolve(){a.initialized=!0,o()},reject:h,requestStart:Date.now()};this.activeTaskById.set(l,u),this.executeTask(a,u)}))}await Promise.all(i)}drainQueue=()=>{if(this._queuedDrain=void 0,!(this.initialized!==!0||this.queuedTasks.length===0)){for(let e=0;e<this.queuedTasks.length;){const t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}const i=F(t),s=this.getAvailableWorker(i);if(s==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,s),this.resolveLanguagesAndExecuteTask(s,t,i)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){const i=this.getFileResultCache(t);C(t)||i!=null&&k(i.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:"file",file:t})}primeFileHighlightCache(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`);return}const t=this.getFileResultCache(e),i=this.getFileHighlightKey(e);if(i==null||C(e)||t!=null&&k(t.options,this.getFileRenderOptions()))return;const s=this.getTaskByHighlightKey(i);s!=null?s.primeCache=!0:this.submitCacheTask({type:"file",file:e},i)}getPlainFileAST(e,t,i,s){if(this.highlighter==null){this.queueInitialization();return}return N(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:i,lines:s})}highlightDiffAST(e,t){const i=this.getDiffResultCache(t);I(t)||i!=null&&g(i.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:"diff",diff:t})}primeDiffHighlightCache(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`);return}const t=this.getDiffResultCache(e),i=this.getDiffHighlightKey(e);if(i==null||I(e)||t!=null&&g(t.options,this.getDiffRenderOptions()))return;const s=this.getTaskByHighlightKey(i);s!=null?s.primeCache=!0:this.submitCacheTask({type:"diff",diff:e},i)}getPlainDiffAST(e,t,i,s,r){return this.highlighter!=null?$(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:i,expandedHunks:s,collapsedContextThreshold:r}):void 0}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(t=>{console.error(t)})}cancelActiveWorkerTasks(){const e=new T;for(const t of this.activeTaskById.values())"reject"in t&&t.reject(e)}terminateWorkers(){for(const e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?"waiting":this.initialized!==!0?"initializing":"initialized",totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();const i=this.getHighlightKeyForRequest(t),s=i!=null?this.getTaskByHighlightKey(i):void 0;if(s!=null){this.detachInstanceFromQueuedTasks(e,s),this.addInstanceToTask(s,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);const r=this.generateRequestId(),n=Date.now(),{renderOptionsVersion:a}=this,o=(()=>{switch(t.type){case"file":return{type:"file",id:r,request:{...t,id:r},instances:new Set([e]),primeCache:!1,highlightKey:i,renderOptionsVersion:a,requestStart:n};case"diff":return{type:"diff",id:r,request:{...t,id:r},instances:new Set([e]),primeCache:!1,highlightKey:i,renderOptionsVersion:a,requestStart:n}}})();this.enqueueRenderTask(o,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();const i=this.generateRequestId(),s=Date.now(),{renderOptionsVersion:r}=this,n=(()=>{switch(e.type){case"file":return{type:"file",id:i,request:{...e,id:i},instances:new Set,primeCache:!0,highlightKey:t,renderOptionsVersion:r,requestStart:s};case"diff":return{type:"diff",id:i,request:{...e,id:i},instances:new Set,primeCache:!0,highlightKey:t,renderOptionsVersion:r,requestStart:s}}})();this.enqueueRenderTask(n)}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,i){try{const s=i.filter(r=>!e.langs.has(r));if(s.length>0&&(O(s)?t.request.resolvedLanguages=B(s):t.request.resolvedLanguages=await z(s)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch{this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){const i=this.activeTaskById.get(t.id);try{if(i==null)throw p;if(t.type==="error"){const s=new Error(t.error);if(t.stack&&(s.stack=t.stack),"reject"in i)i.reject(s);else if(c(i))this.notifyHighlightError(i,s);else throw new Error("handleWorkerMessage: unknown task type");throw s}else switch(t.requestType){case"initialize":if(i.type!=="initialize")throw new Error("handleWorkerMessage: task/response dont match");this.syncCustomExtensionVersion(e,i.request),i.resolve();break;case"set-render-options":if(i.type!=="set-render-options")throw new Error("handleWorkerMessage: task/response dont match");i.resolve();break;case"file":{if(i.type!=="file")throw new Error("handleWorkerMessage: task/response dont match");const{result:s,options:r}=t;if(!this.isCurrentRenderTask(i)||!k(r,this.getFileRenderOptions()))throw p;const{request:n}=i;this.syncCustomExtensionVersion(e,n),n.file.cacheKey!=null&&this.fileCache.set(n.file.cacheKey,{result:s,options:r}),this.notifyFileInstances(i,s,r);break}case"diff":{if(i.type!=="diff")throw new Error("handleWorkerMessage: task/response dont match");const{result:s,options:r}=t;if(!this.isCurrentRenderTask(i)||!g(r,this.getDiffRenderOptions()))throw p;const{request:n}=i;this.syncCustomExtensionVersion(e,n),n.diff.cacheKey!=null&&this.diffCache.set(n.diff.cacheKey,{result:s,options:r}),this.notifyDiffInstances(i,s,r);break}}}catch(s){s!==p&&console.error(s,i,t)}this.cleanWorkerAndTask(e,i,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain==null&&(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,c(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,i=t?.id){e.requestId===i&&(e.requestId=void 0),e.pendingSetupRequestId===i&&(e.pendingSetupRequestId=void 0),t!=null&&(c(t)&&(this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){U(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);for(const i of F(t))e.langs.add(i);try{e.worker.postMessage(t.request)}catch(i){console.error("Failed to post message to worker:",i),c(t)?this.notifyHighlightError(t,i):"reject"in t&&t.reject(i),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;const i=Q();e.customExtensionsVersion>=i||(t.customExtensionsVersion=i,t.customExtensionMap=V())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(const i of this.workers){if(i.requestId!=null||i.pendingSetupRequestId!=null||!i.initialized)continue;if(t=i,e.length===0)break;let s=!0;for(const r of e)if(!i.langs.has(r)){s=!1;break}if(s)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case"file":return this.getFileHighlightKey(e.file);case"diff":return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(const t of d(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){const i=this.queuedTaskByInstance.get(e);i==null||i===t||(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(i,e),!i.primeCache&&i.instances.size===0&&this.removeQueuedTask(i))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){const t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){const t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(const e of Array.from(this.activeTaskById.values()))c(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(const t of d(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(const t of d(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(const t of d(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,i){for(const s of e.instances)this.activeRequestByInstance.get(s)===e.id&&s.onHighlightSuccess(e.request.file,t,i)}notifyDiffInstances(e,t,i){for(const s of e.instances)this.activeRequestByInstance.get(s)===e.id&&s.onHighlightSuccess(e.request.diff,t,i)}notifyHighlightError(e,t){for(const i of d(e))this.activeRequestByInstance.get(i)===e.id&&i.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(const i of this.iterateRenderTasks())if(i.type==="file"&&this.isCurrentRenderTask(i)&&i.instances.has(e)&&_(t,i.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(const i of this.iterateRenderTasks())if(i.type==="diff"&&this.isCurrentRenderTask(i)&&i.instances.has(e)&&j(i.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){const t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(const e of this.queuedTasks)yield e;for(const e of this.activeTaskById.values())c(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function U(e){return e.type==="initialize"||e.type==="file"||e.type==="diff"}function F(e){const t=new Set;if(e.type==="initialize"||e.type==="set-render-options")return[];switch(e.type){case"file":t.add(e.request.file.lang??y(e.request.file.name));break;case"diff":t.add(e.request.diff.lang??y(e.request.diff.name)),t.add(e.request.diff.lang??y(e.request.diff.prevName??"-"));break}return t.delete("text"),Array.from(t)}function c(e){return e?.type==="file"||e?.type==="diff"}function d(e){return e.instances}let f;function Jt({poolOptions:e,highlighterOptions:t}){return f??=new G(e,t),f}function Xt(){f!=null&&(f.terminate(),f=void 0)}export{G as WorkerPoolManager,Jt as getOrCreateWorkerPoolSingleton,Xt as terminateWorkerPoolSingleton};