@openchamber/web 2.7.1 → 2.7.2-canary.20261112.18
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.
- package/dist/assets/{AboutDialog-Byc63m0u.js → AboutDialog-CD63uz39.js} +1 -1
- package/dist/assets/{AboutLogo-BwwjES_b.js → AboutLogo-2kHLExbm.js} +1 -1
- package/dist/assets/{ArchiveView-DIg8Bq5r.js → ArchiveView-D9AL3G55.js} +1 -1
- package/dist/assets/{ChangeRequestDiffUnavailable-DtCWp1bf.js → ChangeRequestDiffUnavailable-BFaXu17a.js} +1 -1
- package/dist/assets/{CommandPalette-D1G7W43z.js → CommandPalette-wJg29t3M.js} +1 -1
- package/dist/assets/{DataFileArtifact-BPwh4rIZ.js → DataFileArtifact-B8OGvXN-.js} +1 -1
- package/dist/assets/{DiffView-B9-zXR21.js → DiffView-CAhUZy1p.js} +1 -1
- package/dist/assets/{FilesView-CTKhKCjC.js → FilesView-Bad_K4vM.js} +3 -3
- package/dist/assets/{GitView-2p131yFW.js → GitView-ESiTCDSw.js} +1 -1
- package/dist/assets/{GuestPanelContent-BY7I-Y-o.js → GuestPanelContent-BHcsCOcI.js} +1 -1
- package/dist/assets/{HelpDialog-BfDxlsKj.js → HelpDialog-CLkDLRCv.js} +1 -1
- package/dist/assets/{IntegrationsCatalogView-DX9AlNKS.js → IntegrationsCatalogView-CreW2QU2.js} +1 -1
- package/dist/assets/{JsonTreeView-Ghbn2jaO.js → JsonTreeView-CuPCB2B8.js} +1 -1
- package/dist/assets/{MarkdownDiffPreview-CcER_eYB.js → MarkdownDiffPreview-rDAnCu-X.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-DjBAwXof.js → MarkdownRendererImpl-BQO-q7Gs.js} +4 -4
- package/dist/assets/{MemoryDebugPanel-MrH6vI6i.js → MemoryDebugPanel-BA6eNPT5.js} +1 -1
- package/dist/assets/{NoteEditor-DnaXw3v6.js → NoteEditor-H5Z5TEv5.js} +1 -1
- package/dist/assets/{OfficeArtifact-av3so80I.js → OfficeArtifact-Dp7UZZNN.js} +2 -2
- package/dist/assets/{OfficeDocumentDiff-C-XvqPYx.js → OfficeDocumentDiff-Cm9lGPXQ.js} +1 -1
- package/dist/assets/{OnboardingScreen-Dlbi5e0G.js → OnboardingScreen-IeS_KnCh.js} +1 -1
- package/dist/assets/{OpenCodeStatusDialog-BZzdMaVU.js → OpenCodeStatusDialog-CGFzdIrc.js} +1 -1
- package/dist/assets/{OverviewView-CQ82APO2.js → OverviewView-C6HXytWH.js} +1 -1
- package/dist/assets/{PatchDiff-EZ_WbikC.js → PatchDiff-DxkfAF18.js} +1 -1
- package/dist/assets/{PlanView-jUry4bXu.js → PlanView-D8IoHTf_.js} +1 -1
- package/dist/assets/{ProjectActionsDialog-Bt6OXdLD.js → ProjectActionsDialog-BWduOyXA.js} +1 -1
- package/dist/assets/{ReplyCommand-CLNJlG5f.js → ReplyCommand-BjRiG3jU.js} +1 -1
- package/dist/assets/{ReplyUiBlock-DthlzVWC.js → ReplyUiBlock-B_mKHYbN.js} +1 -1
- package/dist/assets/{ReviewCards-qePUMD-z.js → ReviewCards-BnpUajD4.js} +1 -1
- package/dist/assets/{RunOverview-CvD2Q7KM.js → RunOverview-BQY-GREp.js} +1 -1
- package/dist/assets/{ScheduledTasksDialog-Dtdb6owf.js → ScheduledTasksDialog-CtlWd_VV.js} +1 -1
- package/dist/assets/{SettingsView-JBCXhydZ.js → SettingsView-CgbOYmvV.js} +1 -1
- package/dist/assets/{SettingsWindow-RJIA1rl5.js → SettingsWindow-ByKOH90R.js} +1 -1
- package/dist/assets/{SidebarSectionsManager-4i4NcHs0.js → SidebarSectionsManager-DqrV_u__.js} +1 -1
- package/dist/assets/{SourceBoardView-BuYJw-Sp.js → SourceBoardView-B0aGQnwC.js} +1 -1
- package/dist/assets/{SpaceAccessDialog-B4-bPo9e.js → SpaceAccessDialog-DMsJ-sxh.js} +1 -1
- package/dist/assets/{SpaceApplyDialog-DjTQ5PZT.js → SpaceApplyDialog-3UONCZIV.js} +1 -1
- package/dist/assets/{SpaceRow-CYk17vzn.js → SpaceRow-BJuduShI.js} +1 -1
- package/dist/assets/{SpaceSetupOutput-DRDEgMzx.js → SpaceSetupOutput-ro_nF8gr.js} +1 -1
- package/dist/assets/{SpacesView-BSt0xE6N.js → SpacesView-BqoY_SpZ.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-CTwpN0TO.js → SubmoduleDiffSummary-NjPxpgMr.js} +1 -1
- package/dist/assets/{TableArtifact-BGTFUrHC.js → TableArtifact-oqOE37_Y.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DcQ4eDvb.js → ToolOutputDialog-Bqv2rByf.js} +1 -1
- package/dist/assets/{ToolPartDiffPreview-idv0MY3G.js → ToolPartDiffPreview-SklZNjf9.js} +1 -1
- package/dist/assets/{UiBlock-CVYWc3Px.js → UiBlock-D3PdhNSP.js} +2 -2
- package/dist/assets/{UsageStatsView-Cgo61IDa.js → UsageStatsView-DM3iZLEy.js} +1 -1
- package/dist/assets/{WalkthroughView-CYr8y2pi.js → WalkthroughView-2TaZc0MB.js} +1 -1
- package/dist/assets/{WorktreesView-Duwvqggr.js → WorktreesView-aba8lY_x.js} +1 -1
- package/dist/assets/{appThemeRegistry-DgyhfFpu.js → appThemeRegistry-BrFExrgv.js} +1 -1
- package/dist/assets/{ar-zwtOisVI.js → ar-DuOBHgr_.js} +1 -1
- package/dist/assets/{codeHighlight-DQ8KOMKI.js → codeHighlight-mEwmnZVN.js} +1 -1
- package/dist/assets/{columnWidthMemory-Ol4D51DU.js → columnWidthMemory-NVG-9uFM.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-P_6wH9ys.js → computeVirtualFileMetrics-DkXi0qX-.js} +2 -2
- package/dist/assets/{contextFileOpenGuard-9zXH1DLm.js → contextFileOpenGuard-DFp3E2Gd.js} +1 -1
- package/dist/assets/{date-time-CRucRasX.js → date-time-DRGzhBlp.js} +1 -1
- package/dist/assets/{de-5cm4El6N.js → de-DpOf_BMg.js} +1 -1
- package/dist/assets/{documentClient-BbTBnbCU.js → documentClient-UXIlVIAK.js} +2 -2
- package/dist/assets/{documentHost-Dxv6OV6h.js → documentHost-BWtn8iCI.js} +1 -1
- package/dist/assets/{editorCodeMetrics-BzYZ4PzQ.js → editorCodeMetrics-BaoTimWj.js} +1 -1
- package/dist/assets/{es-CYh9u5rf.js → es-BextOZlH.js} +1 -1
- package/dist/assets/{fileContentPoller-p6RiDNz7.js → fileContentPoller-BV7Knoib.js} +1 -1
- package/dist/assets/{flexokiTheme-BNUmLj3l.js → flexokiTheme-tyakPldH.js} +1 -1
- package/dist/assets/{fr-gZGCwYzk.js → fr-BJEccZsE.js} +1 -1
- package/dist/assets/{he-DWb3dvEl.js → he-9oI-aOhB.js} +1 -1
- package/dist/assets/{highlights-DWR6MS75.js → highlights-8Aapk9tv.js} +1 -1
- package/dist/assets/{index-BcEWRtz8.js → index-D0ue7E3H.js} +1 -1
- package/dist/assets/{initializeSharedPreferences-u4U22OVN.js → initializeSharedPreferences-DNUHFeIw.js} +1 -1
- package/dist/assets/{install-request-C0o_6GEa.js → install-request-DI6T7dQX.js} +1 -1
- package/dist/assets/{install-CkKsKExH.js → install-s_PIiJvM.js} +1 -1
- package/dist/assets/{isDiffPlainText-B70cjgtm.js → isDiffPlainText-BcgZ-0g8.js} +1 -1
- package/dist/assets/{isFilePlainText-DNNat5m3.js → isFilePlainText-DCv6hsjs.js} +1 -1
- package/dist/assets/{ja-CAeb9wyo.js → ja-Bf_2zWyq.js} +1 -1
- package/dist/assets/{katex.min-2cmqKX7p.js → katex.min-CAwHaRYk.js} +4 -4
- package/dist/assets/{ko-DuYqVIuP.js → ko-BAGf67hm.js} +1 -1
- package/dist/assets/{main-kUMMbMdC.js → main-CZBlb0Vm.js} +4 -4
- package/dist/assets/{main-D9Ri_lHo.js → main-g_cZWPOo.js} +2 -2
- package/dist/assets/{miniChat-HoE2mQuK.js → miniChat-jzqDFSB-.js} +2 -2
- package/dist/assets/{mobile-BFQ0eaJT.js → mobile-4zqwQ7Sj.js} +2 -2
- package/dist/assets/{moveWorkspacePath-BkzUq9fV.js → moveWorkspacePath-D4BOjl1P.js} +1 -1
- package/dist/assets/{nl-BPlUOQoY.js → nl-MVCsXAqA.js} +1 -1
- package/dist/assets/{officeDocument-C74tIqpD.js → officeDocument-CnopQpfD.js} +1 -1
- package/dist/assets/{parseDiffFromFile-COnIA377.js → parseDiffFromFile-CdzPmTcc.js} +1 -1
- package/dist/assets/{pierreDiffTint-9AmpxGGB.js → pierreDiffTint-CVXkDTiH.js} +1 -1
- package/dist/assets/{pl-DZRSuGdV.js → pl-zi2r4I2L.js} +1 -1
- package/dist/assets/{pt-BR-fU-ttTba.js → pt-BR-D-thkXCk.js} +1 -1
- package/dist/assets/{relocateRestoredSession-DawfZWX6.js → relocateRestoredSession-CL5sou6T.js} +2 -2
- package/dist/assets/{renderElectronMiniChatApp-q30Gq6wf.js → renderElectronMiniChatApp-ByeC9_X9.js} +2 -2
- package/dist/assets/{renderMarkdownForExport-0rL6OK8T.js → renderMarkdownForExport-B2BahH3V.js} +1 -1
- package/dist/assets/{renderMobileApp-B_PjVgBu.js → renderMobileApp-BHQf77yR.js} +3 -3
- package/dist/assets/{resolveLanguages-dF0QdGAX.js → resolveLanguages-D-TyRYRT.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-BsAAA4Nf.js → runtimeEndpointReset-DKWDEJh9.js} +5 -5
- package/dist/assets/{scheduledTasksApi-CB-Xtp2P.js → scheduledTasksApi-DIaiATcl.js} +1 -1
- package/dist/assets/{shiki-CVNu2J2E.js → shiki-CTynytaK.js} +1 -1
- package/dist/assets/{space-apply-BmOleF8W.js → space-apply-CYC8IOgP.js} +1 -1
- package/dist/assets/{space-close-DqG3RGoP.js → space-close-CDpywx5q.js} +1 -1
- package/dist/assets/{spaceNetwork-DUGLrihG.js → spaceNetwork-DYE6zemZ.js} +1 -1
- package/dist/assets/{stream-tokenizer-Bzos6Fhy.js → stream-tokenizer-DHz3vo2_.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-BRUbLAuj.js → textMateThemeFromAppTheme-ZHLiHrUo.js} +1 -1
- package/dist/assets/{tr-CD93vntx.js → tr-BeLCIXLh.js} +1 -1
- package/dist/assets/{uk-DTqcJvdn.js → uk-CWz0kaNm.js} +1 -1
- package/dist/assets/{useAppFontEffects-xaAfmUwn.js → useAppFontEffects-DEX5CMOn.js} +15 -15
- package/dist/assets/{useBranchPullRequestRequest-CIftwmmA.js → useBranchPullRequestRequest-CulIXVeT.js} +1 -1
- package/dist/assets/{useCallableModelProviders-DYpBJMqj.js → useCallableModelProviders-CV8ihNIz.js} +1 -1
- package/dist/assets/{useDiffFindSurface-CqxU53Ed.js → useDiffFindSurface-DcsqijBv.js} +1 -1
- package/dist/assets/{useGitCleanLine-CmVX9s9E.js → useGitCleanLine-DvEtGCIy.js} +1 -1
- package/dist/assets/{useInlineCommentController-C-V8vqSj.js → useInlineCommentController-BL4NrAAM.js} +1 -1
- package/dist/assets/{useMarkdownLocalAssets-BfOLz9Xm.js → useMarkdownLocalAssets-6zcqySrf.js} +1 -1
- package/dist/assets/{useRootScrollLock-Ciuj2iZ_.js → useRootScrollLock-BHTza82m.js} +1 -1
- package/dist/assets/{useWalkthroughReview-BdjnKO7o.js → useWalkthroughReview-C_afIgqu.js} +1 -1
- package/dist/assets/{useWholeFileComment-DkYtu1tm.js → useWholeFileComment-WwfwT0jq.js} +1 -1
- package/dist/assets/{useWorktreeArchiveActions-DGzuZU_x.js → useWorktreeArchiveActions-CORhov5Z.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-CSQf665k.js → vendor-codemirror-language-data--j1xV4at.js} +2 -2
- package/dist/assets/{zh-CN-BJ4oeBCY.js → zh-CN-D2e-OTjQ.js} +1 -1
- package/dist/assets/{zh-TW-BMW1G3F_.js → zh-TW-DCj_Doyh.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/mini-chat.html +2 -2
- package/dist/mobile.html +2 -2
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as Z,i as S,s as J,j as m,e as Y,k as p,W as k,l as ee,H as te,m as ie,n as R,o as re,p as se,q as ne}from"./computeVirtualFileMetrics-P_6wH9ys.js";import{t as Gr}from"./computeVirtualFileMetrics-P_6wH9ys.js";import{gT as x}from"./useAppFontEffects-xaAfmUwn.js";import{a as I,i as W,r as L}from"./isFilePlainText-DNNat5m3.js";import{a as A,b as K,g as b}from"./getFiletypeFromFileName-BgI9McTw.js";import{b as y,i as M,r as V,c as oe,a as ae}from"./isDiffPlainText-B70cjgtm.js";import{r as _}from"./resolveLanguages-dF0QdGAX.js";import{a as P}from"./themeResolver-Dybtoo13.js";import{L as j}from"./vendor-lru_map--CXJ39nE.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-pierre-theming-D_TRfu0q.js";import"./vendor-react--VO_rL_p.js";import"./vendor-scheduler-7OC5HNn7.js";import"./katex.min-2cmqKX7p.js";import"./vendor-zustand-C9tWdk0j.js";import"./vendor-zod-B_hXR7jf.js";import"./vendor-opencode-client-NJGkA1Ku.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-base-ui-CHqK1aDI.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import"./vendor-tanstack-virtual-core-B4TJYmIq.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data-CSQf665k.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-iLtL-MFj.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-diff-C3JhlQdm.js";function N(e){const t=[];for(const i of e){const r=Z.get(i);if(r==null)throw new Error(`getResolvedLanguages: ${i} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(r)}return t}function Q(e){for(const t of Array.isArray(e)?e:[e])if(!Z.has(t))return!1;return!0}function $(e,t=S()){return P(t).getResolvedThemes(e)}function G(e,t=S()){return P(t).hasResolvedThemes(e)}function U(e,t=S()){return P(t).resolveThemes(e)}const X=0,he=1,le=2,ce=4,ue=5,de=6,fe=[void 0,null,!0,!1];function O(e){if(Array.isArray(e))return e;const{ops:t,offsets:i,strings:r,text:n,extras:s}=e,o=new Array(i.length/2);let a=0,l=0;function c(h){const f=new Array(h);for(let u=0;u<h;u++){const g=t[a++];if(g!==X)if(g===he){const q=l+t[a++];f[u]={type:"text",value:n.slice(l,q)},l=q}else if(g===le){const q=r[t[a++]],E={};for(let z=t[a++];z>0;z--){const H=r[t[a++]],w=t[a++],D=w===ce?r[t[a++]]:w===ue?t[a++]:w===de?s[t[a++]]:fe[w];H==="__proto__"?Object.defineProperty(E,H,{value:D,enumerable:!0,configurable:!0,writable:!0}):E[H]=D}f[u]={type:"element",tagName:q,properties:E,children:c(t[a++])}}else f[u]=s[t[a++]]}return f}for(let h=0;h<o.length;h++)t[i[h*2]]!==X&&J(o,h,()=>(a=i[h*2],l=i[h*2+1],c(1)[0]),{retain:!1});return o}const v=Symbol("IGNORE_RESPONSE"),ge=1e4;var pe=class{options;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;terminated=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:i=x,useTokenTransformer:r=!1,lineDiffType:n="word-alt",maxLineDiffLength:s=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:a}){this.options=e,this.preferredHighlighter=S(a),this.renderOptions={theme:i,useTokenTransformer:r,lineDiffType:n,maxLineDiffLength:s,tokenizeMaxLineLength:o},this.fileCache=new j.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new j.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed&&!this.terminated}shouldHighlightOnMainThread(e){const{mainThreadMaxCharacters:t=-1}=this.options;return("contents"in e?e.contents.length:e.deletionCharacterCount+e.additionCharacterCount)<=t}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}setFileResultCache(e,{result:t,options:i}){return e==null||!I(i,this.getFileRenderOptions())?!1:(this.fileCache.set(e,{result:t,options:i}),this.queueBroadcastStateChanges(),!0)}setDiffResultCache(e,{result:t,options:i}){return e==null||!y(i,this.getDiffRenderOptions())?!1:(this.diffCache.set(e,{result:t,options:i}),this.queueBroadcastStateChanges(),!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??x,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:i=this.renderOptions.lineDiffType??"word-alt",maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:n=this.renderOptions.tokenizeMaxLineLength??1e3}){const{lifecycleGeneration:s}=this,o=++this.renderOptionsRequestVersion,a=()=>this.isCurrentLifecycle(s)&&this.renderOptionsRequestVersion===o;try{const l={theme:e,useTokenTransformer:t,lineDiffType:i,maxLineDiffLength:r,tokenizeMaxLineLength:n};if(!this.isInitialized())try{await this.initialize()}catch(u){if(!this.workersFailed)throw u}if(!a()||y(l,this.renderOptions))return;const c=m(e);let h=[];if(Y(l.theme,this.renderOptions.theme)||(h=G(c,this.preferredHighlighter)?$(c,this.preferredHighlighter):await U(c,this.preferredHighlighter)),!a()||p({theme:e})==null&&(await this.loadSharedHighlighter(c,["text"]),!a()))return;const f=this.setRenderOptionsOnWorkers(l,h);this.renderOptions=l,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(const u of this.themeSubscribers)u.onThemeChange();await f}catch(l){if(l instanceof k||!a())return;throw l}}getPreferredHighlighter(){return this.preferredHighlighter}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 r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),new Error("setRenderOptionsOnWorkers: Somehow we have an uninitialized worker");i.push(new Promise((n,s)=>{const o=this.generateRequestId(),a={type:"set-render-options",id:o,request:{type:"set-render-options",id:o,renderOptions:e,resolvedThemes:t},resolve:n,reject:s,requestStart:Date.now()};this.activeTaskById.set(o,a),r.pendingSetupRequestId=o,r.worker.postMessage(a.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);d(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){p({theme:this.renderOptions.theme})==null&&await this.loadSharedHighlighter(m(this.renderOptions.theme),["text",...e]);return}else if(this.initialized===!1){this.terminated=!1;const{lifecycleGeneration:t}=this,i=new Promise((r,n)=>{(async()=>{try{const s=m(this.renderOptions.theme),o=G(s,this.preferredHighlighter)?$(s,this.preferredHighlighter):await U(s,this.preferredHighlighter);if(!this.isCurrentLifecycle(t)){r();return}let a=[];if(this.preferredHighlighter!=="highlights"&&(a=Q(e)?N(e):await _(e)),!this.isCurrentLifecycle(t)){r();return}if(await Promise.all([this.loadSharedHighlighter(s,["text",...e]),this.initializeWorkers(o,a)]),!this.isCurrentLifecycle(t)){this.terminateWorkers(),r();return}this.initialized=!0,this.drainQueue(),this.queueBroadcastStateChanges(),r()}catch(s){if(s instanceof k||!this.isCurrentLifecycle(t)){r();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(const o of this.queuedTasks)this.rejectRenderTaskCallbacks(o,F(s));this.queueBroadcastStateChanges(),n(s)}})()});return this.initialized=i,this.queueBroadcastStateChanges(),i}else return this.initialized}async loadSharedHighlighter(e,t){try{await ee({themes:e,langs:t,preferredHighlighter:this.preferredHighlighter})}catch(i){if(!(i instanceof te))throw i}}async initializeWorkers(e,t){this.workersFailed=!1;const i=[],r=K(),n=r>0?A():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){const l=this.options.workerFactory(),c={worker:l,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set(["text",...t.map(({name:h})=>h)]),customExtensionsVersion:0};l.addEventListener("message",h=>{this.handleWorkerMessage(c,h.data)}),l.addEventListener("error",h=>this.handleWorkerError(c,h)),this.workers.push(c),i.push(new Promise((h,f)=>{const u=this.generateRequestId(),g={type:"initialize",id:u,request:{type:"initialize",resultFormat:"hast-ops-v1",id:u,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:n!=null?r:void 0,customExtensionMap:n},resolve(){c.initialized=!0,h()},reject:f,requestStart:Date.now()};c.pendingSetupRequestId=u,this.activeTaskById.set(u,g),this.executeTask(c,g)}))}const s=this.options.workerInitializationTimeout??ge;let o;try{await Promise.race([Promise.all(i),new Promise((a,l)=>{o=setTimeout(()=>{l(new Error(`WorkerPoolManager: worker initialization timed out after ${s}ms`))},s)})])}finally{o!=null&&clearTimeout(o)}}handleWorkerError(e,t){const{onWorkerError:i}=this.options;if(i!=null)try{i(t,e.worker)}catch(o){console.error("WorkerPoolManager: onWorkerError threw:",o)}else console.error("Worker error:",t,e);const{pendingSetupRequestId:r}=e;if(r==null)return;const n=this.activeTaskById.get(r);if(n?.type!=="initialize")return;const s=ke(t);i!=null&&ie(s),n.reject(s),this.cleanWorkerAndTask(e,n)}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=B(t.request),r=this.getAvailableWorker(i);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,i)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){const i=this.getFileResultCache(t);W(t)||i!=null&&I(i.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:"file",file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(new Error("WorkerPoolManager.primeFileHighlightCache: worker pool is not working"));if(!this.shouldPrimeFileHighlightCache(e))return Promise.resolve();if(this.shouldHighlightOnMainThread(e)){const i=this.getFileRenderOptions();return this.primeHighlightCacheOnMainThread(B({type:"file",file:e}),i.theme,r=>this.setFileResultCache(e.cacheKey,{result:L(e,r,i),options:i}))}const t=this.getOrCreateFileHighlightCacheTask(e);return t!=null?this.createRenderTaskCallbacks(t):Promise.resolve()}shouldPrimeFileHighlightCache(e){if(e.cacheKey==null)return console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`),!1;const t=this.getFileResultCache(e);return!W(e)&&(t==null||!I(t.options,this.getFileRenderOptions()))}getOrCreateFileHighlightCacheTask(e){const t=this.getFileHighlightKey(e);if(t==null)return;const i=this.getTaskByHighlightKey(t);if(i!=null){if(i.type!=="file")throw new Error("WorkerPoolManager.getOrCreateFileHighlightCacheTask: Invalid task type");return i.primeCache=!0,i}else{const r=this.submitCacheTask({type:"file",file:e},t);if(r.type!=="file")throw new Error("WorkerPoolManager.getOrCreateFileHighlightCacheTask: Invalid task created");return r}}getPlainFileAST(e,t,i,r){const n=p({theme:this.renderOptions.theme});if(n==null){this.queueInitialization();return}return L(e,n,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:i,lines:r})}highlightDiffAST(e,t){const i=this.getDiffResultCache(t);M(t)||i!=null&&y(i.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:"diff",diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(new Error("WorkerPoolManager.primeDiffHighlightCache: worker pool is not working"));if(!this.shouldPrimeDiffHighlightCache(e))return Promise.resolve();if(this.shouldHighlightOnMainThread(e)){const i=this.getDiffRenderOptions();return this.primeHighlightCacheOnMainThread(B({type:"diff",diff:e}),i.theme,r=>this.setDiffResultCache(e.cacheKey,{result:V(e,r,i),options:i}))}const t=this.getOrCreateDiffHighlightCacheTask(e);return t!=null?this.createRenderTaskCallbacks(t):Promise.resolve()}shouldPrimeDiffHighlightCache(e){if(e.cacheKey==null)return console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`),!1;const t=this.getDiffResultCache(e);return!M(e)&&(t==null||!y(t.options,this.getDiffRenderOptions()))}primeHighlightCacheOnMainThread(e,t,i){function r(){const s=p({theme:t,langs:e});return s!=null&&i(s)}if(r())return Promise.resolve();const{lifecycleGeneration:n}=this;return this.loadSharedHighlighter(m(t),["text",...e]).then(()=>{if(!this.isCurrentLifecycle(n))throw new k;if(!r())throw new R})}getOrCreateDiffHighlightCacheTask(e){const t=this.getDiffHighlightKey(e);if(t==null)return;const i=this.getTaskByHighlightKey(t);if(i!=null){if(i.type!=="diff")throw new Error("WorkerPoolManager.getOrCreateDiffHighlightCacheTask: Invalid task type");return i.primeCache=!0,i}else{const r=this.submitCacheTask({type:"diff",diff:e},t);if(r.type!=="diff")throw new Error("WorkerPoolManager.getOrCreateDiffHighlightCacheTask: Invalid task created");return r}}getPlainDiffAST(e,t,i,r,n){const s=p({theme:this.renderOptions.theme});if(s==null){this.queueInitialization();return}return V(e,s,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:i,expandedHunks:r,collapsedContextThreshold:n})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();const e=new k;for(const t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.initialized=!1,this.workersFailed=!1,this.terminated=!0,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(t=>{re(t)||console.error(t)})}cancelActiveWorkerTasks(){const e=new k;for(const t of this.activeTaskById.values())"reject"in t?t.reject(e):d(t)&&this.rejectRenderTaskCallbacks(t,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),r=i!=null?this.getTaskByHighlightKey(i):void 0;if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);const n=this.generateRequestId(),s=Date.now(),{renderOptionsVersion:o}=this,a=(()=>{switch(t.type){case"file":return{type:"file",id:n,request:{...t,id:n},instances:new Set([e]),primeCache:!1,highlightKey:i,callbacks:new Set,renderOptionsVersion:o,requestStart:s};case"diff":return{type:"diff",id:n,request:{...t,id:n},instances:new Set([e]),primeCache:!1,highlightKey:i,callbacks:new Set,renderOptionsVersion:o,requestStart:s}}})();this.enqueueRenderTask(a,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();const i=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:n}=this,s=(()=>{switch(e.type){case"file":return{type:"file",id:i,request:{...e,id:i},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:n,requestStart:r};case"diff":return{type:"diff",id:i,request:{...e,id:i},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:n,requestStart:r}}})();return this.enqueueRenderTask(s),s}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 r=p(),n=i.filter(o=>r==null||!se(o,r));n.length>0&&this.loadSharedHighlighter(m(this.renderOptions.theme),["text",...n]).catch(o=>{console.error(o)});const s=this.preferredHighlighter==="highlights"?[]:i.filter(o=>!e.langs.has(o));if(s.length>0&&(Q(s)?t.request.resolvedLanguages=N(s):t.request.resolvedLanguages=await _(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(r){this.rejectRenderTaskCallbacks(t,F(r)),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 v;if(t.type==="error"){const r=new Error(t.error);if(t.stack&&(r.stack=t.stack),"reject"in i)i.reject(r);else if(d(i))this.notifyHighlightError(i,r),this.rejectRenderTaskCallbacks(i,r);else throw new Error("handleWorkerMessage: unknown task type");throw r}else{if(d(i))for(const{name:r}of i.request.resolvedLanguages??[])e.langs.add(r);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{options:r}=t;if(!this.isCurrentRenderTask(i)||!I(r,this.getFileRenderOptions()))throw v;const{request:n}=i,s={...t.result,code:O(t.result.code)};this.syncCustomExtensionVersion(e,n),i.cacheKeyAtDispatch!=null&&this.fileCache.set(i.cacheKeyAtDispatch,{result:s,options:r}),this.resolveRenderTaskCallbacks(i),this.notifyFileInstances(i,s,r);break}case"diff":{if(i.type!=="diff")throw new Error("handleWorkerMessage: task/response dont match");const{options:r}=t;if(!this.isCurrentRenderTask(i)||!y(r,this.getDiffRenderOptions()))throw v;const{request:n}=i,s={...t.result,code:{deletionLines:O(t.result.code.deletionLines),additionLines:O(t.result.code.additionLines)}};this.syncCustomExtensionVersion(e,n),i.cacheKeyAtDispatch!=null&&this.diffCache.set(i.cacheKeyAtDispatch,{result:s,options:r}),this.resolveRenderTaskCallbacks(i),this.notifyDiffInstances(i,s,r);break}}}}catch(r){r!==v&&console.error(r,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,d(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&&(d(t)&&(this.rejectRenderTaskCallbacks(t,new R),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){me(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);try{t.type==="file"?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type==="diff"&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(i){console.error("Failed to post message to worker:",i),d(t)?(this.notifyHighlightError(t,i),this.rejectRenderTaskCallbacks(t,F(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=K();e.customExtensionsVersion>=i||(t.customExtensionsVersion=i,t.customExtensionMap=A())}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 r=!0;for(const n of e)if(!i.langs.has(n)){r=!1;break}if(r)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 T(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.rejectRenderTaskCallbacks(e,new R),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new R),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,i)=>{e.callbacks.add({resolve:t,reject:i})})}resolveRenderTaskCallbacks(e){for(const t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(const i of e.callbacks)i.reject(t);e.callbacks.clear()}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()))d(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(const t of T(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 T(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(const t of T(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,i){for(const r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,i)}notifyDiffInstances(e,t,i){for(const r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,i)}notifyHighlightError(e,t){for(const i of T(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)&&oe(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)&&ae(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())d(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function me(e){return e.type==="initialize"||e.type==="file"||e.type==="diff"}function B(e){const t=new Set;switch(e.type){case"file":t.add(e.file.lang??b(e.file.name));break;case"diff":t.add(e.diff.lang??b(e.diff.name)),t.add(e.diff.lang??b(e.diff.prevName??"-"))}return t.delete("text"),Array.from(t)}function d(e){return e?.type==="file"||e?.type==="diff"}function T(e){return e.instances}function F(e){if(e instanceof Error)return e;if(e!=null&&typeof e=="object"){if("error"in e&&e.error instanceof Error)return e.error;if("message"in e&&typeof e.message=="string")return new Error(e.message)}return new Error(String(e))}function ke(e){const t="error"in e?e.error:void 0,i="message"in e&&typeof e.message=="string"&&e.message!==""?e.message:t instanceof Error?t.message:"the worker script failed to load (the error event carries no message)";return new ne(`WorkerPoolManager: worker failed: ${i}`,t instanceof Error?{cause:t}:void 0)}let C;function jr({poolOptions:e,highlighterOptions:t}){return C??=new pe(e,t),C}function Nr(){C!=null&&(C.terminate(),C=void 0)}export{pe as WorkerPoolManager,R as WorkerPoolTaskCanceledError,k as WorkerPoolTerminatedError,ne as WorkerPoolWorkerError,jr as getOrCreateWorkerPoolSingleton,re as isHandledWorkerPoolError,Gr as isWorkerPoolCancellation,Nr as terminateWorkerPoolSingleton};
|
|
1
|
+
import{b as Z,i as S,s as J,j as m,e as Y,k as p,W as k,l as ee,H as te,m as ie,n as R,o as re,p as se,q as ne}from"./computeVirtualFileMetrics-DkXi0qX-.js";import{t as Gr}from"./computeVirtualFileMetrics-DkXi0qX-.js";import{gT as x}from"./useAppFontEffects-DEX5CMOn.js";import{a as I,i as W,r as L}from"./isFilePlainText-DCv6hsjs.js";import{a as A,b as K,g as b}from"./getFiletypeFromFileName-BgI9McTw.js";import{b as y,i as M,r as V,c as oe,a as ae}from"./isDiffPlainText-BcgZ-0g8.js";import{r as _}from"./resolveLanguages-D-TyRYRT.js";import{a as P}from"./themeResolver-Dybtoo13.js";import{L as j}from"./vendor-lru_map--CXJ39nE.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-pierre-theming-D_TRfu0q.js";import"./vendor-react--VO_rL_p.js";import"./vendor-scheduler-7OC5HNn7.js";import"./katex.min-CAwHaRYk.js";import"./vendor-zustand-C9tWdk0j.js";import"./vendor-zod-B_hXR7jf.js";import"./vendor-opencode-client-NJGkA1Ku.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-base-ui-CHqK1aDI.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import"./vendor-tanstack-virtual-core-B4TJYmIq.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data--j1xV4at.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-iLtL-MFj.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-diff-C3JhlQdm.js";function N(e){const t=[];for(const i of e){const r=Z.get(i);if(r==null)throw new Error(`getResolvedLanguages: ${i} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(r)}return t}function Q(e){for(const t of Array.isArray(e)?e:[e])if(!Z.has(t))return!1;return!0}function $(e,t=S()){return P(t).getResolvedThemes(e)}function G(e,t=S()){return P(t).hasResolvedThemes(e)}function U(e,t=S()){return P(t).resolveThemes(e)}const X=0,he=1,le=2,ce=4,ue=5,de=6,fe=[void 0,null,!0,!1];function O(e){if(Array.isArray(e))return e;const{ops:t,offsets:i,strings:r,text:n,extras:s}=e,o=new Array(i.length/2);let a=0,l=0;function c(h){const f=new Array(h);for(let u=0;u<h;u++){const g=t[a++];if(g!==X)if(g===he){const q=l+t[a++];f[u]={type:"text",value:n.slice(l,q)},l=q}else if(g===le){const q=r[t[a++]],E={};for(let z=t[a++];z>0;z--){const H=r[t[a++]],w=t[a++],D=w===ce?r[t[a++]]:w===ue?t[a++]:w===de?s[t[a++]]:fe[w];H==="__proto__"?Object.defineProperty(E,H,{value:D,enumerable:!0,configurable:!0,writable:!0}):E[H]=D}f[u]={type:"element",tagName:q,properties:E,children:c(t[a++])}}else f[u]=s[t[a++]]}return f}for(let h=0;h<o.length;h++)t[i[h*2]]!==X&&J(o,h,()=>(a=i[h*2],l=i[h*2+1],c(1)[0]),{retain:!1});return o}const v=Symbol("IGNORE_RESPONSE"),ge=1e4;var pe=class{options;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;terminated=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:i=x,useTokenTransformer:r=!1,lineDiffType:n="word-alt",maxLineDiffLength:s=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:a}){this.options=e,this.preferredHighlighter=S(a),this.renderOptions={theme:i,useTokenTransformer:r,lineDiffType:n,maxLineDiffLength:s,tokenizeMaxLineLength:o},this.fileCache=new j.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new j.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed&&!this.terminated}shouldHighlightOnMainThread(e){const{mainThreadMaxCharacters:t=-1}=this.options;return("contents"in e?e.contents.length:e.deletionCharacterCount+e.additionCharacterCount)<=t}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}setFileResultCache(e,{result:t,options:i}){return e==null||!I(i,this.getFileRenderOptions())?!1:(this.fileCache.set(e,{result:t,options:i}),this.queueBroadcastStateChanges(),!0)}setDiffResultCache(e,{result:t,options:i}){return e==null||!y(i,this.getDiffRenderOptions())?!1:(this.diffCache.set(e,{result:t,options:i}),this.queueBroadcastStateChanges(),!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??x,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:i=this.renderOptions.lineDiffType??"word-alt",maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:n=this.renderOptions.tokenizeMaxLineLength??1e3}){const{lifecycleGeneration:s}=this,o=++this.renderOptionsRequestVersion,a=()=>this.isCurrentLifecycle(s)&&this.renderOptionsRequestVersion===o;try{const l={theme:e,useTokenTransformer:t,lineDiffType:i,maxLineDiffLength:r,tokenizeMaxLineLength:n};if(!this.isInitialized())try{await this.initialize()}catch(u){if(!this.workersFailed)throw u}if(!a()||y(l,this.renderOptions))return;const c=m(e);let h=[];if(Y(l.theme,this.renderOptions.theme)||(h=G(c,this.preferredHighlighter)?$(c,this.preferredHighlighter):await U(c,this.preferredHighlighter)),!a()||p({theme:e})==null&&(await this.loadSharedHighlighter(c,["text"]),!a()))return;const f=this.setRenderOptionsOnWorkers(l,h);this.renderOptions=l,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(const u of this.themeSubscribers)u.onThemeChange();await f}catch(l){if(l instanceof k||!a())return;throw l}}getPreferredHighlighter(){return this.preferredHighlighter}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 r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),new Error("setRenderOptionsOnWorkers: Somehow we have an uninitialized worker");i.push(new Promise((n,s)=>{const o=this.generateRequestId(),a={type:"set-render-options",id:o,request:{type:"set-render-options",id:o,renderOptions:e,resolvedThemes:t},resolve:n,reject:s,requestStart:Date.now()};this.activeTaskById.set(o,a),r.pendingSetupRequestId=o,r.worker.postMessage(a.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);d(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){p({theme:this.renderOptions.theme})==null&&await this.loadSharedHighlighter(m(this.renderOptions.theme),["text",...e]);return}else if(this.initialized===!1){this.terminated=!1;const{lifecycleGeneration:t}=this,i=new Promise((r,n)=>{(async()=>{try{const s=m(this.renderOptions.theme),o=G(s,this.preferredHighlighter)?$(s,this.preferredHighlighter):await U(s,this.preferredHighlighter);if(!this.isCurrentLifecycle(t)){r();return}let a=[];if(this.preferredHighlighter!=="highlights"&&(a=Q(e)?N(e):await _(e)),!this.isCurrentLifecycle(t)){r();return}if(await Promise.all([this.loadSharedHighlighter(s,["text",...e]),this.initializeWorkers(o,a)]),!this.isCurrentLifecycle(t)){this.terminateWorkers(),r();return}this.initialized=!0,this.drainQueue(),this.queueBroadcastStateChanges(),r()}catch(s){if(s instanceof k||!this.isCurrentLifecycle(t)){r();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(const o of this.queuedTasks)this.rejectRenderTaskCallbacks(o,F(s));this.queueBroadcastStateChanges(),n(s)}})()});return this.initialized=i,this.queueBroadcastStateChanges(),i}else return this.initialized}async loadSharedHighlighter(e,t){try{await ee({themes:e,langs:t,preferredHighlighter:this.preferredHighlighter})}catch(i){if(!(i instanceof te))throw i}}async initializeWorkers(e,t){this.workersFailed=!1;const i=[],r=K(),n=r>0?A():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){const l=this.options.workerFactory(),c={worker:l,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set(["text",...t.map(({name:h})=>h)]),customExtensionsVersion:0};l.addEventListener("message",h=>{this.handleWorkerMessage(c,h.data)}),l.addEventListener("error",h=>this.handleWorkerError(c,h)),this.workers.push(c),i.push(new Promise((h,f)=>{const u=this.generateRequestId(),g={type:"initialize",id:u,request:{type:"initialize",resultFormat:"hast-ops-v1",id:u,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:n!=null?r:void 0,customExtensionMap:n},resolve(){c.initialized=!0,h()},reject:f,requestStart:Date.now()};c.pendingSetupRequestId=u,this.activeTaskById.set(u,g),this.executeTask(c,g)}))}const s=this.options.workerInitializationTimeout??ge;let o;try{await Promise.race([Promise.all(i),new Promise((a,l)=>{o=setTimeout(()=>{l(new Error(`WorkerPoolManager: worker initialization timed out after ${s}ms`))},s)})])}finally{o!=null&&clearTimeout(o)}}handleWorkerError(e,t){const{onWorkerError:i}=this.options;if(i!=null)try{i(t,e.worker)}catch(o){console.error("WorkerPoolManager: onWorkerError threw:",o)}else console.error("Worker error:",t,e);const{pendingSetupRequestId:r}=e;if(r==null)return;const n=this.activeTaskById.get(r);if(n?.type!=="initialize")return;const s=ke(t);i!=null&&ie(s),n.reject(s),this.cleanWorkerAndTask(e,n)}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=B(t.request),r=this.getAvailableWorker(i);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,i)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){const i=this.getFileResultCache(t);W(t)||i!=null&&I(i.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:"file",file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(new Error("WorkerPoolManager.primeFileHighlightCache: worker pool is not working"));if(!this.shouldPrimeFileHighlightCache(e))return Promise.resolve();if(this.shouldHighlightOnMainThread(e)){const i=this.getFileRenderOptions();return this.primeHighlightCacheOnMainThread(B({type:"file",file:e}),i.theme,r=>this.setFileResultCache(e.cacheKey,{result:L(e,r,i),options:i}))}const t=this.getOrCreateFileHighlightCacheTask(e);return t!=null?this.createRenderTaskCallbacks(t):Promise.resolve()}shouldPrimeFileHighlightCache(e){if(e.cacheKey==null)return console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`),!1;const t=this.getFileResultCache(e);return!W(e)&&(t==null||!I(t.options,this.getFileRenderOptions()))}getOrCreateFileHighlightCacheTask(e){const t=this.getFileHighlightKey(e);if(t==null)return;const i=this.getTaskByHighlightKey(t);if(i!=null){if(i.type!=="file")throw new Error("WorkerPoolManager.getOrCreateFileHighlightCacheTask: Invalid task type");return i.primeCache=!0,i}else{const r=this.submitCacheTask({type:"file",file:e},t);if(r.type!=="file")throw new Error("WorkerPoolManager.getOrCreateFileHighlightCacheTask: Invalid task created");return r}}getPlainFileAST(e,t,i,r){const n=p({theme:this.renderOptions.theme});if(n==null){this.queueInitialization();return}return L(e,n,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:i,lines:r})}highlightDiffAST(e,t){const i=this.getDiffResultCache(t);M(t)||i!=null&&y(i.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:"diff",diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(new Error("WorkerPoolManager.primeDiffHighlightCache: worker pool is not working"));if(!this.shouldPrimeDiffHighlightCache(e))return Promise.resolve();if(this.shouldHighlightOnMainThread(e)){const i=this.getDiffRenderOptions();return this.primeHighlightCacheOnMainThread(B({type:"diff",diff:e}),i.theme,r=>this.setDiffResultCache(e.cacheKey,{result:V(e,r,i),options:i}))}const t=this.getOrCreateDiffHighlightCacheTask(e);return t!=null?this.createRenderTaskCallbacks(t):Promise.resolve()}shouldPrimeDiffHighlightCache(e){if(e.cacheKey==null)return console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`),!1;const t=this.getDiffResultCache(e);return!M(e)&&(t==null||!y(t.options,this.getDiffRenderOptions()))}primeHighlightCacheOnMainThread(e,t,i){function r(){const s=p({theme:t,langs:e});return s!=null&&i(s)}if(r())return Promise.resolve();const{lifecycleGeneration:n}=this;return this.loadSharedHighlighter(m(t),["text",...e]).then(()=>{if(!this.isCurrentLifecycle(n))throw new k;if(!r())throw new R})}getOrCreateDiffHighlightCacheTask(e){const t=this.getDiffHighlightKey(e);if(t==null)return;const i=this.getTaskByHighlightKey(t);if(i!=null){if(i.type!=="diff")throw new Error("WorkerPoolManager.getOrCreateDiffHighlightCacheTask: Invalid task type");return i.primeCache=!0,i}else{const r=this.submitCacheTask({type:"diff",diff:e},t);if(r.type!=="diff")throw new Error("WorkerPoolManager.getOrCreateDiffHighlightCacheTask: Invalid task created");return r}}getPlainDiffAST(e,t,i,r,n){const s=p({theme:this.renderOptions.theme});if(s==null){this.queueInitialization();return}return V(e,s,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:i,expandedHunks:r,collapsedContextThreshold:n})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();const e=new k;for(const t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.initialized=!1,this.workersFailed=!1,this.terminated=!0,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(t=>{re(t)||console.error(t)})}cancelActiveWorkerTasks(){const e=new k;for(const t of this.activeTaskById.values())"reject"in t?t.reject(e):d(t)&&this.rejectRenderTaskCallbacks(t,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),r=i!=null?this.getTaskByHighlightKey(i):void 0;if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);const n=this.generateRequestId(),s=Date.now(),{renderOptionsVersion:o}=this,a=(()=>{switch(t.type){case"file":return{type:"file",id:n,request:{...t,id:n},instances:new Set([e]),primeCache:!1,highlightKey:i,callbacks:new Set,renderOptionsVersion:o,requestStart:s};case"diff":return{type:"diff",id:n,request:{...t,id:n},instances:new Set([e]),primeCache:!1,highlightKey:i,callbacks:new Set,renderOptionsVersion:o,requestStart:s}}})();this.enqueueRenderTask(a,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();const i=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:n}=this,s=(()=>{switch(e.type){case"file":return{type:"file",id:i,request:{...e,id:i},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:n,requestStart:r};case"diff":return{type:"diff",id:i,request:{...e,id:i},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:n,requestStart:r}}})();return this.enqueueRenderTask(s),s}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 r=p(),n=i.filter(o=>r==null||!se(o,r));n.length>0&&this.loadSharedHighlighter(m(this.renderOptions.theme),["text",...n]).catch(o=>{console.error(o)});const s=this.preferredHighlighter==="highlights"?[]:i.filter(o=>!e.langs.has(o));if(s.length>0&&(Q(s)?t.request.resolvedLanguages=N(s):t.request.resolvedLanguages=await _(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(r){this.rejectRenderTaskCallbacks(t,F(r)),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 v;if(t.type==="error"){const r=new Error(t.error);if(t.stack&&(r.stack=t.stack),"reject"in i)i.reject(r);else if(d(i))this.notifyHighlightError(i,r),this.rejectRenderTaskCallbacks(i,r);else throw new Error("handleWorkerMessage: unknown task type");throw r}else{if(d(i))for(const{name:r}of i.request.resolvedLanguages??[])e.langs.add(r);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{options:r}=t;if(!this.isCurrentRenderTask(i)||!I(r,this.getFileRenderOptions()))throw v;const{request:n}=i,s={...t.result,code:O(t.result.code)};this.syncCustomExtensionVersion(e,n),i.cacheKeyAtDispatch!=null&&this.fileCache.set(i.cacheKeyAtDispatch,{result:s,options:r}),this.resolveRenderTaskCallbacks(i),this.notifyFileInstances(i,s,r);break}case"diff":{if(i.type!=="diff")throw new Error("handleWorkerMessage: task/response dont match");const{options:r}=t;if(!this.isCurrentRenderTask(i)||!y(r,this.getDiffRenderOptions()))throw v;const{request:n}=i,s={...t.result,code:{deletionLines:O(t.result.code.deletionLines),additionLines:O(t.result.code.additionLines)}};this.syncCustomExtensionVersion(e,n),i.cacheKeyAtDispatch!=null&&this.diffCache.set(i.cacheKeyAtDispatch,{result:s,options:r}),this.resolveRenderTaskCallbacks(i),this.notifyDiffInstances(i,s,r);break}}}}catch(r){r!==v&&console.error(r,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,d(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&&(d(t)&&(this.rejectRenderTaskCallbacks(t,new R),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){me(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);try{t.type==="file"?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type==="diff"&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(i){console.error("Failed to post message to worker:",i),d(t)?(this.notifyHighlightError(t,i),this.rejectRenderTaskCallbacks(t,F(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=K();e.customExtensionsVersion>=i||(t.customExtensionsVersion=i,t.customExtensionMap=A())}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 r=!0;for(const n of e)if(!i.langs.has(n)){r=!1;break}if(r)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 T(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.rejectRenderTaskCallbacks(e,new R),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new R),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,i)=>{e.callbacks.add({resolve:t,reject:i})})}resolveRenderTaskCallbacks(e){for(const t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(const i of e.callbacks)i.reject(t);e.callbacks.clear()}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()))d(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(const t of T(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 T(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(const t of T(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,i){for(const r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,i)}notifyDiffInstances(e,t,i){for(const r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,i)}notifyHighlightError(e,t){for(const i of T(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)&&oe(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)&&ae(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())d(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function me(e){return e.type==="initialize"||e.type==="file"||e.type==="diff"}function B(e){const t=new Set;switch(e.type){case"file":t.add(e.file.lang??b(e.file.name));break;case"diff":t.add(e.diff.lang??b(e.diff.name)),t.add(e.diff.lang??b(e.diff.prevName??"-"))}return t.delete("text"),Array.from(t)}function d(e){return e?.type==="file"||e?.type==="diff"}function T(e){return e.instances}function F(e){if(e instanceof Error)return e;if(e!=null&&typeof e=="object"){if("error"in e&&e.error instanceof Error)return e.error;if("message"in e&&typeof e.message=="string")return new Error(e.message)}return new Error(String(e))}function ke(e){const t="error"in e?e.error:void 0,i="message"in e&&typeof e.message=="string"&&e.message!==""?e.message:t instanceof Error?t.message:"the worker script failed to load (the error event carries no message)";return new ne(`WorkerPoolManager: worker failed: ${i}`,t instanceof Error?{cause:t}:void 0)}let C;function jr({poolOptions:e,highlighterOptions:t}){return C??=new pe(e,t),C}function Nr(){C!=null&&(C.terminate(),C=void 0)}export{pe as WorkerPoolManager,R as WorkerPoolTaskCanceledError,k as WorkerPoolTerminatedError,ne as WorkerPoolWorkerError,jr as getOrCreateWorkerPoolSingleton,re as isHandledWorkerPoolError,Gr as isWorkerPoolCancellation,Nr as terminateWorkerPoolSingleton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i,s as t,b as s,c as o}from"./useAppFontEffects-
|
|
1
|
+
import{a as i,s as t,b as s,c as o}from"./useAppFontEffects-DEX5CMOn.js";import"./vendor-react--VO_rL_p.js";import{i as n,a as c,s as p}from"./katex.min-CAwHaRYk.js";const h=({logLabel:a,onAppearanceSettled:r})=>{n(),c().then(()=>{Promise.all([p(),i()]).catch(e=>{console.error(`${a} settings init failed:`,e)}),t(),s(),o()}).catch(e=>{console.error(`${a} appearance init failed:`,e)}).finally(()=>{r?.()})};export{h as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as r,u}from"./katex.min-
|
|
1
|
+
import{k as r,u}from"./katex.min-CAwHaRYk.js";import{c as n}from"./vendor-zustand-C9tWdk0j.js";const o=n((s,e)=>({request:null,take:()=>{const{request:t}=e();return t?(s({request:null}),t.isCurrent()?{source:t.source,confirmed:t.confirmed}:null):null}})),l=s=>{o.setState({request:{...s,isCurrent:r()}});const e=u.getState();e.setSettingsPage("extensions"),e.setSettingsDialogOpen(!0)};export{l as r,o as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s,b3 as l}from"./katex.min-
|
|
1
|
+
import{j as s,b3 as l}from"./katex.min-CAwHaRYk.js";import{bl as u,bm as p,bn as f}from"./useAppFontEffects-DEX5CMOn.js";import{o as h,s as n,_ as m}from"./vendor-zod-B_hXR7jf.js";const g=t=>t.toLowerCase().replace(/[^a-z0-9_-]/g,"-"),C=t=>g(t.trim()).replace(/^[-_]+|[-_]+$/g,""),i={oauthEnabled:!0,oauthClientId:"",oauthClientSecret:"",oauthScope:"",oauthRedirectUri:"",oauthCallbackPort:""},I=t=>t===!1?{...i,oauthEnabled:!1}:t?{oauthEnabled:!0,oauthClientId:t.client_id??"",oauthClientSecret:t.client_secret??"",oauthScope:t.scope??"",oauthRedirectUri:t.redirect_uri??"",oauthCallbackPort:t.callback_port===void 0?"":String(t.callback_port)}:i,y=h({error:m(["invalid-path","invalid-url","not-found","invalid-manifest","id-taken","already-installed","missing-build","invalid-opencode-plugin","host-too-old","bundled","reserved-id","clone-failed","clone-auth-failed","extract-failed","too-large","enterprise-mode"]),required:n().trim().min(1).max(64).optional(),id:n().trim().min(1).max(128).optional(),reason:n().trim().min(1).max(1e3).optional()}),k=t=>{const e=t.trim();if(!e)return{ok:!1,code:"invalid-path"};if(e.slice(0,8).toLowerCase()==="https://")return{ok:!0,request:{url:e}};if(e.slice(0,6).toLowerCase()==="ssh://"||/^(?:[A-Za-z0-9_][A-Za-z0-9_.-]*@)?[A-Za-z0-9][A-Za-z0-9.-]*\.[A-Za-z0-9.-]+:[^\s]+$/.test(e))return{ok:!0,request:{url:e}};const a=/^[a-zA-Z]:[\\/]/.test(e);return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!a?{ok:!1,code:"invalid-url"}:e.startsWith("/")||a||e.startsWith("\\\\")?{ok:!0,request:{path:e}}:{ok:!1,code:"invalid-path"}},d=async t=>{try{const e=y.safeParse(JSON.parse(await t.text()));return e.success?e.data.error==="host-too-old"&&e.data.required&&e.data.id?{code:"host-too-old",required:e.data.required,id:e.data.id}:e.data.error==="host-too-old"&&e.data.required?{code:"host-too-old",required:e.data.required}:e.data.id?{code:e.data.error,id:e.data.id}:e.data.error==="invalid-manifest"&&e.data.reason?{code:"invalid-manifest",reason:e.data.reason}:{code:e.data.error}:{code:"failed"}}catch{return{code:"failed"}}},c=async(t,e)=>{if(!t.ok)return{ok:!1,...await d(t),diagnostic:{method:"POST",path:e,kind:"http",status:t.status}};const a=await t.text().catch(()=>null),r=a===null?null:f(a);return r==="unreadable"?{ok:!1,code:"unreadable"}:r?{ok:!0,guest:r,replaced:t.status===200}:{ok:!1,code:"failed",diagnostic:{method:"POST",path:e,kind:"invalid-response",status:t.status}}},T=async(t,e={})=>{const a=k(t);if(!a.ok)return a;const r={...a.request};e.replace&&(r.replace=!0),"url"in r&&e.gitIdentityId&&(r.gitIdentityId=e.gitIdentityId);try{const o=await s("/api/guests",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});return await c(o,"/api/guests")}catch{return{ok:!1,code:"failed",diagnostic:{method:"POST",path:"/api/guests",kind:"network"}}}},_=async(t,e={})=>{try{const a=await s("/api/guests/upload",{method:"POST",query:{replace:e.replace?"true":void 0,name:t.name||void 0},headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:t});return await c(a,"/api/guests/upload")}catch{return{ok:!1,code:"failed",diagnostic:{method:"POST",path:"/api/guests/upload",kind:"network"}}}},P=async t=>{const e=u.getState(),a=l(),r=e.runtimeKey===a?e.guests.find(o=>o.id===t)?.storageId:void 0;try{const o=await s(`/api/guests/${t}`,{method:"DELETE"});return o.status===204?(r&&globalThis.indexedDB&&await p({runtimeKey:a,guestId:t,storageId:r}).catch(()=>{console.warn("Could not clear local extension preferences.")}),{ok:!0}):{ok:!1,code:(await d(o)).code}}catch{return{ok:!1,code:"failed"}}},q=async(t,e)=>{try{return(await s(`/api/guests/${t}/enabled`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:e})})).ok}catch{return!1}},A=async(t,e)=>{try{return(await s(`/api/guests/${t}/capabilities`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({granted:e})})).ok}catch{return!1}};export{i as M,g as a,_ as b,A as c,T as i,C as n,I as r,q as s,P as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as X,u as Q,g as Y,s as Z,h as y,r as nn,f as en}from"./computeVirtualFileMetrics-P_6wH9ys.js";import{g as K}from"./getFiletypeFromFileName-BgI9McTw.js";import{gU as P,gV as V,gW as q}from"./useAppFontEffects-xaAfmUwn.js";import{d as tn,a as on}from"./vendor-diff-C3JhlQdm.js";function xn(n,e){return n?.cacheKey!=null||e?.cacheKey!=null?n?.cacheKey===e?.cacheKey:n===e}function En(n,e){return n?.cacheKey===e?.cacheKey&&n?.contents===e?.contents&&n?.name===e?.name&&n?.lang===e?.lang}function wn(n,e){return X(n.theme,e.theme)&&n.useTokenTransformer===e.useTokenTransformer&&n.tokenizeMaxLineLength===e.tokenizeMaxLineLength&&n.lineDiffType===e.lineDiffType&&n.maxLineDiffLength===e.maxLineDiffLength}function B({line:n,spanStart:e,spanLength:r}){return{start:{line:n,character:e},end:{line:n,character:e+r},properties:{"data-diff-span":""},alwaysWrap:!0}}function A({item:n,arr:e,enableJoin:r,isNeutral:a=!1,isLastItem:h=!1}){const t=e[e.length-1];if(t==null||h||!r){e.push([a?0:1,n.value]);return}const l=t[0]===0;if(a===l||a&&n.value.length===1&&!l){t[1]+=n.value;return}e.push([a?0:1,n.value])}function _(n){return[V(n.additionStart,n.additionCount)+1,P(n.additionStart,n.additionCount)+1]}function $({isPartial:n,rangeSize:e,expandedHunks:r,hunkIndex:a,collapsedContextThreshold:h}){const t=Math.max(e,0);if(t===0||n)return{fromStart:0,fromEnd:0,rangeSize:t,collapsedLines:t,renderAll:!1};if(r===!0||t<=h)return{fromStart:t,fromEnd:0,rangeSize:t,collapsedLines:0,renderAll:!0};const l=r?.get(a),u=Math.min(Math.max(l?.fromStart??0,0),t),i=Math.min(Math.max(l?.fromEnd??0,0),t),s=u+i,o=s>=t;return{fromStart:o?t:u,fromEnd:o?0:i,rangeSize:t,collapsedLines:Math.max(t-s,0),renderAll:o}}function Rn(n){const e=n.hunks[n.hunks.length-1];if(e==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return!1;const r=n.additionLines.length-P(e.additionStart,e.additionCount),a=n.deletionLines.length-P(e.deletionStart,e.deletionCount);return r<=0&&a<=0?!1:r!==a}function rn({fileDiff:n,errorPrefix:e}){const r=n.hunks[n.hunks.length-1];if(r==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return 0;const a=n.additionLines.length-P(r.additionStart,r.additionCount),h=n.deletionLines.length-P(r.deletionStart,r.deletionCount);if(a<=0&&h<=0)return 0;if(a!==h)throw new Error(`${e}: trailing context mismatch (additions=${a}, deletions=${h}) for ${n.name}`);return Math.min(a,h)}function U({fileDiff:n,hunkIndex:e,expandedHunks:r,collapsedContextThreshold:a,errorPrefix:h}){if(e!==n.hunks.length-1)return;const t=rn({fileDiff:n,errorPrefix:h});if(t<=0)return;if(r===!0||t<=a)return{fromStart:t,fromEnd:0,rangeSize:t,collapsedLines:0,renderAll:!0};const l=r?.get(n.hunks.length),u=Math.min(Math.max(l?.fromStart??0,0),t);return{fromStart:u,fromEnd:0,rangeSize:t,collapsedLines:t-u,renderAll:u>=t}}function bn({fileDiff:n,lineNumber:e,expandedHunks:r,collapsedContextThreshold:a}){if(r===!0||n.isPartial)return!0;for(const[u,i]of n.hunks.entries()){const[s,o]=_(i);if(e<s){const d=$({isPartial:n.isPartial,rangeSize:i.collapsedBefore,expandedHunks:r,hunkIndex:u,collapsedContextThreshold:a}),c=s-d.rangeSize;return d.renderAll||e<c+d.fromStart||e>=s-d.fromEnd}if(e<o)return!0}const h=U({fileDiff:n,hunkIndex:n.hunks.length-1,expandedHunks:r,collapsedContextThreshold:a,errorPrefix:"isAdditionLineRenderable"});if(h==null||h.renderAll)return!0;const t=n.hunks[n.hunks.length-1],[,l]=_(t);return e<l+h.fromStart||e>=l+h.rangeSize}function On({fileDiff:n,lineNumber:e,direction:r,expandedHunks:a,collapsedContextThreshold:h}){if(a===!0||n.isPartial)return e;const t=[];let l=1;for(const[i,s]of n.hunks.entries()){const[o,d]=_(s),c=$({isPartial:n.isPartial,rangeSize:s.collapsedBefore,expandedHunks:a,hunkIndex:i,collapsedContextThreshold:h}),f=o-c.rangeSize;c.renderAll?t.push([f,o]):(c.fromStart>0&&t.push([f,f+c.fromStart]),c.fromEnd>0&&t.push([o-c.fromEnd,o])),t.push([o,d]),l=d}const u=U({fileDiff:n,hunkIndex:n.hunks.length-1,expandedHunks:a,collapsedContextThreshold:h,errorPrefix:"getNearestRenderableAdditionLine"});if(u!=null){const i=l;l=i+u.rangeSize,u.renderAll?t.push([i,l]):u.fromStart>0&&t.push([i,i+u.fromStart])}if(e>=l)return e;if(r==="down"){for(const[i,s]of t)if(s>e)return Math.max(i,e);return}for(let i=t.length-1;i>=0;i--){const[s,o]=t[i];if(s<=e)return Math.min(o-1,e)}}function G({type:n,metrics:e}){return e.hunkSeparatorHeight??Q(n)}function J({type:n,metrics:e}){return n==="simple"||n==="metadata"||n==="line-info-basic"?0:e.spacing}function sn({type:n,hunkIndex:e,hunkSpecs:r}){switch(n){case"simple":return e>0;case"metadata":return r!=null;case"line-info":case"line-info-basic":case"custom":return!0}}function an(n){return n!=="simple"&&n!=="metadata"}function Fn({type:n,metrics:e,hunkIndex:r,hunkSpecs:a}){if(!sn({type:n,hunkIndex:r,hunkSpecs:a}))return;const h=G({type:n,metrics:e}),t=J({type:n,metrics:e}),l=r>0?t:0,u=t;return{height:h,gapBefore:l,gapAfter:u,totalHeight:l+h+u}}function Hn({type:n,metrics:e}){if(!an(n))return;const r=G({type:n,metrics:e}),a=J({type:n,metrics:e});return{height:r,gapBefore:a,gapAfter:0,totalHeight:a+r}}function ln({diff:n,diffStyle:e,startingLine:r=0,totalLines:a=1/0,expandedHunks:h,collapsedContextThreshold:t=1,callback:l}){const u=un({diff:n,diffStyle:e,startingLine:r,expandedHunks:h,collapsedContextThreshold:t}),i={viewportStart:r,viewportEnd:r+a,isWindowedHighlight:r>0||a<1/0,splitCount:u.splitCount,unifiedCount:u.unifiedCount,finalHunkIndex:n.hunks.length-1,shouldBreak(){if(!i.isWindowedHighlight)return!1;const s=i.unifiedCount>=r+a,o=i.splitCount>=r+a;return e==="unified"?s:(e==="split"||s)&&o},shouldSkip(s,o){if(!i.isWindowedHighlight)return!1;const d=s>0&&i.unifiedCount+s<=r,c=o>0&&i.splitCount+o<=r;return e==="unified"?d:(e==="split"||d)&&c},incrementCounts(s,o){(e==="unified"||e==="both")&&(i.unifiedCount+=s),(e==="split"||e==="both")&&(i.splitCount+=o)},isInWindow(s,o){if(!i.isWindowedHighlight)return!0;const d=i.isInUnifiedWindow(s),c=i.isInSplitWindow(o);return e==="unified"?d:e==="split"?c:d||c},isInUnifiedWindow(s){return!i.isWindowedHighlight||i.unifiedCount>=r-s&&i.unifiedCount<r+a},isInSplitWindow(s){return!i.isWindowedHighlight||i.splitCount>=r-s&&i.splitCount<r+a},emit(s,o=!1){return o||(e==="unified"?i.incrementCounts(1,0):e==="split"?i.incrementCounts(0,1):i.incrementCounts(1,1)),l(s)??!1}};n:for(let s=u.hunkIndex;s<n.hunks.length;s++){let N=function(g,S){return F==null||F.collapsedLines<=0||F.fromStart+F.fromEnd>0?0:e==="unified"?g===o.unifiedLineStart+o.unifiedLineCount-1?F.collapsedLines:0:S===o.splitLineStart+o.splitLineCount-1?F.collapsedLines:0},I=function(){return z?0:(z=!0,p.collapsedLines)};const o=n.hunks[s];if(o==null)throw new Error("iterateOverDiff: invalid hunk index");if(i.shouldBreak())break;const d=V(o.deletionStart,o.deletionCount),c=V(o.additionStart,o.additionCount),f=!n.isPartial&&o.deletionCount===0?d:o.deletionLineIndex,m=!n.isPartial&&o.additionCount===0?c:o.additionLineIndex,p=$({isPartial:n.isPartial,rangeSize:o.collapsedBefore,expandedHunks:h,hunkIndex:s,collapsedContextThreshold:t}),F=s===i.finalHunkIndex?U({fileDiff:n,hunkIndex:s,expandedHunks:h,collapsedContextThreshold:t,errorPrefix:"iterateOverDiff"}):void 0,H=p.fromStart+p.fromEnd;let z=p.collapsedLines===0;if(i.shouldSkip(H,H))i.incrementCounts(H,H),I();else{let g=o.unifiedLineStart-p.rangeSize,S=o.splitLineStart-p.rangeSize,R=f-p.rangeSize,O=m-p.rangeSize,x=d+1-p.rangeSize,M=c+1-p.rangeSize;if(D(i,p.fromStart,e,w=>i.emit({hunkIndex:s,hunk:o,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:x+w,lineIndex:R+w,noEOFCR:!1,unifiedLineIndex:g+w,splitLineIndex:S+w},additionLine:{unifiedLineIndex:g+w,splitLineIndex:S+w,lineIndex:O+w,lineNumber:M+w,noEOFCR:!1}}))||(g=o.unifiedLineStart-p.fromEnd,S=o.splitLineStart-p.fromEnd,R=f-p.fromEnd,O=m-p.fromEnd,x=d+1-p.fromEnd,M=c+1-p.fromEnd,D(i,p.fromEnd,e,w=>i.emit({hunkIndex:s,hunk:o,collapsedBefore:I(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:x+w,lineIndex:R+w,noEOFCR:!1,unifiedLineIndex:g+w,splitLineIndex:S+w},additionLine:{unifiedLineIndex:g+w,splitLineIndex:S+w,lineIndex:O+w,lineNumber:M+w,noEOFCR:!1}}),()=>{I()})))break n}let C=o.unifiedLineStart,k=o.splitLineStart,v=f,L=m,E=d+1,b=c+1;const T=o.hunkContent.at(-1);for(const g of o.hunkContent){if(i.shouldBreak())break n;const S=g===T;if(g.type==="context"){if(i.shouldSkip(g.lines,g.lines))i.incrementCounts(g.lines,g.lines),I();else if(D(i,g.lines,e,R=>{const O=S&&R===g.lines-1,x=C+R,M=k+R;return i.emit({hunkIndex:s,hunk:o,collapsedBefore:I(),collapsedAfter:N(x,M),type:"context",deletionLine:{lineNumber:E+R,lineIndex:v+R,noEOFCR:O&&o.noEOFCRDeletions,unifiedLineIndex:x,splitLineIndex:M},additionLine:{unifiedLineIndex:x,splitLineIndex:M,lineIndex:L+R,lineNumber:b+R,noEOFCR:O&&o.noEOFCRAdditions}})},()=>{I()}))break n;C+=g.lines,k+=g.lines,v+=g.lines,L+=g.lines,E+=g.lines,b+=g.lines}else{const R=Math.max(g.deletions,g.additions),O=g.deletions+g.additions;if(!i.shouldSkip(O,R)){const x=hn(i,g,e);(x[0]?.[0]??0)>0&&I();for(const[M,w]of x)for(let W=M;W<w;W++){const j=N(C+W,e==="unified"?k+(W<g.deletions?W:W-g.deletions):k+W);if(i.emit(gn({hunkIndex:s,hunk:o,collapsedBefore:I(),collapsedAfter:j,diffStyle:e,index:W,unifiedLineIndex:C,splitLineIndex:k,additionLineIndex:L,deletionLineIndex:v,additionLineNumber:b,deletionLineNumber:E,content:g,isLastContent:S,unifiedCount:O,splitCount:R}),!0))break n}}I(),i.incrementCounts(O,R),C+=O,k+=R,v+=g.deletions,L+=g.additions,E+=g.deletions,b+=g.additions}}if(F!=null){const{collapsedLines:g,fromStart:S,fromEnd:R}=F,O=S+R;if(D(i,O,e,x=>{const M=x===O-1;return i.emit({hunkIndex:n.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:M?g:0,type:"context-expanded",deletionLine:{lineNumber:E+x,lineIndex:v+x,noEOFCR:!1,unifiedLineIndex:C+x,splitLineIndex:k+x},additionLine:{unifiedLineIndex:C+x,splitLineIndex:k+x,lineIndex:L+x,lineNumber:b+x,noEOFCR:!1}})},void 0,()=>i.shouldBreak()))break n}}}function un({diff:n,diffStyle:e,startingLine:r,expandedHunks:a,collapsedContextThreshold:h}){if(r<=0||e==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};const t=dn({diff:n,expandedHunks:a,collapsedContextThreshold:h});let l=0,u=n.hunks.length-1,i=n.hunks.length;for(;l<=u;){const o=l+u>>1,d=t[o+1];if(d==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(e==="unified"?d.unifiedCount:d.splitCount)>r?(i=o,u=o-1):l=o+1}if(i>=n.hunks.length){const o=t[n.hunks.length];if(o==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:n.hunks.length,splitCount:o.splitCount,unifiedCount:o.unifiedCount}}const s=t[i];if(s==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:i,splitCount:s.splitCount,unifiedCount:s.unifiedCount}}function dn({diff:n,expandedHunks:e,collapsedContextThreshold:r}){let a=0,h=0;const t=n.hunks.length-1,l=[{splitCount:0,unifiedCount:0}];for(let u=0;u<n.hunks.length;u++){const i=n.hunks[u];if(i==null)throw new Error("iterateOverDiff: invalid hunk summary index");const s=$({isPartial:n.isPartial,rangeSize:i.collapsedBefore,expandedHunks:e,hunkIndex:u,collapsedContextThreshold:r}),o=s.fromStart+s.fromEnd;a+=o+i.splitLineCount,h+=o+i.unifiedLineCount;const d=u===t?U({fileDiff:n,hunkIndex:u,expandedHunks:e,collapsedContextThreshold:r,errorPrefix:"iterateOverDiff"}):void 0;if(d!=null){const c=d.fromStart+d.fromEnd;a+=c,h+=c}l.push({splitCount:a,unifiedCount:h})}return l}function cn(n,e,r){if(!n.isWindowedHighlight||e<=0)return[0,e];const a=[];function h(u){const i=Math.max(0,n.viewportStart-u),s=Math.min(e,n.viewportEnd-u);s>i&&a.push([i,s])}if(r!=="split"&&h(n.unifiedCount),r!=="unified"&&h(n.splitCount),a.length===0)return[0,0];let t=a[0][0],l=a[0][1];for(let u=1;u<a.length;u++){const i=a[u];t=Math.min(t,i[0]),l=Math.max(l,i[1])}return[t,l]}function D(n,e,r,a,h,t){const[l,u]=cn(n,e,r);l>0&&(n.incrementCounts(l,l),h?.());let i=l;for(;i<e;){if(t?.()===!0)return!0;if(i>=u){n.incrementCounts(e-i,e-i);break}if(n.isInWindow(0,0)){if(a(i)===!0)return!0}else n.incrementCounts(1,1);i++}return!1}function hn(n,e,r){if(!n.isWindowedHighlight)return[[0,r==="unified"?e.deletions+e.additions:Math.max(e.deletions,e.additions)]];const a=r!=="split",h=r!=="unified",t=r==="unified"?"unified":"split",l=[];function u(d,c){if(d+c<=n.viewportStart||d>=n.viewportEnd)return;const f=Math.max(0,n.viewportStart-d),m=Math.min(c,n.viewportEnd-d);return m>f?[f,m]:void 0}function i(d,c){return t==="split"?d:c==="additions"?[d[0]+e.deletions,d[1]+e.deletions]:d}function s(d,c){if(d==null)return;const[f,m]=i(d,c);m>f&&l.push([f,m])}if(a&&(s(u(n.unifiedCount,e.deletions),"deletions"),s(u(n.unifiedCount+e.deletions,e.additions),"additions")),h&&(s(u(n.splitCount,e.deletions),"deletions"),s(u(n.splitCount,e.additions),"additions")),l.length===0)return l;l.sort((d,c)=>d[0]-c[0]);const o=[l[0]];for(const[d,c]of l.slice(1)){const f=o[o.length-1];d<=f[1]?f[1]=Math.max(f[1],c):o.push([d,c])}return o}function gn({hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,diffStyle:h,index:t,unifiedLineIndex:l,splitLineIndex:u,additionLineIndex:i,deletionLineIndex:s,additionLineNumber:o,deletionLineNumber:d,content:c,isLastContent:f,unifiedCount:m,splitCount:p}){const F=t<c.deletions?l+t:void 0,H=h==="unified"?t>=c.deletions?l+t:void 0:t<c.additions?l+c.deletions+t:void 0,N=h==="unified"?u+(t<c.deletions?t:t-c.deletions):u+t,z=t<c.deletions?s+t:void 0,I=t<c.deletions?d+t:void 0,C=h==="unified"?t>=c.deletions?i+(t-c.deletions):void 0:t<c.additions?i+t:void 0,k=h==="unified"?t>=c.deletions?o+(t-c.deletions):void 0:t<c.additions?o+t:void 0,v=h==="unified"?f&&t===c.deletions-1&&e.noEOFCRDeletions:f&&t===p-1&&e.noEOFCRDeletions,L=h==="unified"?f&&t===m-1&&e.noEOFCRAdditions:f&&t===p-1&&e.noEOFCRAdditions,E=z!=null&&I!=null&&F!=null?{lineNumber:I,lineIndex:z,noEOFCR:v,unifiedLineIndex:F,splitLineIndex:N}:void 0,b=C!=null&&k!=null&&H!=null?{unifiedLineIndex:H,splitLineIndex:N,lineIndex:C,lineNumber:k,noEOFCR:L}:void 0;if(E==null&&b!=null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,deletionLine:void 0,additionLine:b};if(E!=null&&b==null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,deletionLine:E,additionLine:void 0};if(E==null||b==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,deletionLine:E,additionLine:b}}const fn={forcePlainText:!1};function Mn(n,e,r,{forcePlainText:a,lazyLineAST:h=!1,startingLine:t,totalLines:l,expandedHunks:u,collapsedContextThreshold:i=1}=fn){a?(t??=0,l??=1/0):(t=0,l=1/0);const s=t>0||l<1/0;h&&=!a&&!r.useTokenTransformer;const o=typeof r.theme=="string"?e.getTheme(r.theme).type:void 0,d=Y({theme:r.theme,highlighter:e}),c=a&&!s&&(n.unifiedLineCount>1e3||n.splitLineCount>1e3)?"none":r.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:m}=r,p=!a&&!n.isPartial,F=a?u:void 0,H=new Map;function N(I){const C=p?0:I,k=H.get(C)??In();return H.set(C,k),k}function z(I,C,k,v){if(s){let L=k.at(-1);(L==null||L.targetIndex+L.count!==C)&&(L={targetIndex:C,originalOffset:v.length,count:0},k.push(L)),L.count++}v.push(I)}ln({diff:n,diffStyle:"both",startingLine:t,totalLines:l,expandedHunks:s?F:!0,collapsedContextThreshold:i,callback:({hunkIndex:I,additionLine:C,deletionLine:k,type:v})=>{const L=N(I),E=C!=null?C.splitLineIndex:k.splitLineIndex;v==="change"&&C!=null&&k!=null&&pn({additionLine:n.additionLines[C.lineIndex],deletionLine:n.deletionLines[k.lineIndex],deletionLineIndex:L.deletionContent.length,additionLineIndex:L.additionContent.length,deletionDecorations:L.deletionDecorations,additionDecorations:L.additionDecorations,lineDiffType:c,maxLineDiffLength:m}),k!=null&&(z(n.deletionLines[k.lineIndex],k.lineIndex,L.deletionSegments,L.deletionContent),L.deletionInfo.push({type:v==="change"?"change-deletion":v,lineNumber:k.lineNumber,altLineNumber:v==="change"?void 0:C.lineNumber??void 0,lineIndex:`${k.unifiedLineIndex},${E}`})),C!=null&&(z(n.additionLines[C.lineIndex],C.lineIndex,L.additionSegments,L.additionContent),L.additionInfo.push({type:v==="change"?"change-addition":v,lineNumber:C.lineNumber,altLineNumber:v==="change"?void 0:k.lineNumber??void 0,lineIndex:`${C.unifiedLineIndex},${E}`}))}});for(const I of H.values()){if(I.deletionContent.length===0&&I.additionContent.length===0)continue;const C={name:n.prevName??n.name,contents:I.deletionContent.value},k={name:n.name,contents:I.additionContent.value},{deletionLines:v,additionLines:L}=Cn({deletionFile:C,deletionInfo:I.deletionInfo,deletionDecorations:I.deletionDecorations,additionFile:k,additionInfo:I.additionInfo,additionDecorations:I.additionDecorations,highlighter:e,options:r,languageOverride:a?"text":n.lang,lazyLineAST:h});if(p){f.deletionLines=v,f.additionLines=L;continue}for(const[E,b,T]of[[f.deletionLines,v,I.deletionSegments],[f.additionLines,L,I.additionSegments]])if(T.length>0)for(const g of T)for(let S=0;S<g.count;S++)E[g.targetIndex+S]=b[g.originalOffset+S];else if(h){const g=E.length;for(let S=0;S<b.length;S++)Z(E,g+S,()=>b[S])}else y(E,b)}return{code:f,themeStyles:d,baseThemeType:o}}function mn(n,{deletionLineIndex:e,additionLineIndex:r,deletionDecorations:a,additionDecorations:h}){let t=0,l=0,u=-1,i=0,s=-1,o=0;for(const{value:d,added:c,removed:f}of n)f?(u===-1&&(u=t),t+=d.length,i=t):c?(s===-1&&(s=l),l+=d.length,o=l):(t+=d.length,l+=d.length);u!==-1&&a.push(B({line:e,spanStart:u,spanLength:i-u})),s!==-1&&h.push(B({line:r,spanStart:s,spanLength:o-s}))}function pn({deletionLine:n,additionLine:e,deletionLineIndex:r,additionLineIndex:a,deletionDecorations:h,additionDecorations:t,lineDiffType:l,maxLineDiffLength:u}){if(n==null||e==null||l==="none"||(n=q(n),e=q(e),n.length>u||e.length>u))return;const i=l==="char"?tn(n,e):on(n,e);if(l==="word-line"){mn(i,{deletionLineIndex:r,additionLineIndex:a,deletionDecorations:h,additionDecorations:t});return}const s=[],o=[],d=l==="word-alt",c=i.at(-1);for(const m of i){const p=m===c;!m.added&&!m.removed?(A({item:m,arr:s,enableJoin:d,isNeutral:!0,isLastItem:p}),A({item:m,arr:o,enableJoin:d,isNeutral:!0,isLastItem:p})):m.removed?A({item:m,arr:s,enableJoin:d,isLastItem:p}):A({item:m,arr:o,enableJoin:d,isLastItem:p})}let f=0;for(const m of s)m[0]===1&&h.push(B({line:r,spanStart:f,spanLength:m[1].length})),f+=m[1].length;f=0;for(const m of o)m[0]===1&&t.push(B({line:a,spanStart:f,spanLength:m[1].length})),f+=m[1].length}function In(){return{deletionContent:{push(n){this.value+=n,this.length++},value:"",length:0},additionContent:{push(n){this.value+=n,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Cn({lazyLineAST:n,deletionFile:e,additionFile:r,deletionInfo:a,additionInfo:h,highlighter:t,deletionDecorations:l,additionDecorations:u,languageOverride:i,options:{theme:s,useTokenTransformer:o,tokenizeMaxLineLength:d}}){const c=(f,m,p)=>f.contents===""?[]:nn(t.codeToTokens(q(f.contents),en(i??K(f.name),s,d)).tokens,{state:{lineInfo:m},useTokenTransformer:o,decorations:p,lazyLineAST:n,cacheHtmlStyles:t.name==="highlights"});return{deletionLines:c(e,a,l),additionLines:c(r,h,u)}}function zn(n){const e=n.lang??K(n.name),r=n.lang??(n.prevName!=null?K(n.prevName):"text");return e==="text"&&r==="text"}export{xn as a,wn as b,En as c,U as d,ln as e,rn as f,$ as g,Rn as h,zn as i,bn as j,On as k,_ as l,Fn as m,Hn as n,Mn as r};
|
|
1
|
+
import{e as X,u as Q,g as Y,s as Z,h as y,r as nn,f as en}from"./computeVirtualFileMetrics-DkXi0qX-.js";import{g as K}from"./getFiletypeFromFileName-BgI9McTw.js";import{gU as P,gV as V,gW as q}from"./useAppFontEffects-DEX5CMOn.js";import{d as tn,a as on}from"./vendor-diff-C3JhlQdm.js";function xn(n,e){return n?.cacheKey!=null||e?.cacheKey!=null?n?.cacheKey===e?.cacheKey:n===e}function En(n,e){return n?.cacheKey===e?.cacheKey&&n?.contents===e?.contents&&n?.name===e?.name&&n?.lang===e?.lang}function wn(n,e){return X(n.theme,e.theme)&&n.useTokenTransformer===e.useTokenTransformer&&n.tokenizeMaxLineLength===e.tokenizeMaxLineLength&&n.lineDiffType===e.lineDiffType&&n.maxLineDiffLength===e.maxLineDiffLength}function B({line:n,spanStart:e,spanLength:r}){return{start:{line:n,character:e},end:{line:n,character:e+r},properties:{"data-diff-span":""},alwaysWrap:!0}}function A({item:n,arr:e,enableJoin:r,isNeutral:a=!1,isLastItem:h=!1}){const t=e[e.length-1];if(t==null||h||!r){e.push([a?0:1,n.value]);return}const l=t[0]===0;if(a===l||a&&n.value.length===1&&!l){t[1]+=n.value;return}e.push([a?0:1,n.value])}function _(n){return[V(n.additionStart,n.additionCount)+1,P(n.additionStart,n.additionCount)+1]}function $({isPartial:n,rangeSize:e,expandedHunks:r,hunkIndex:a,collapsedContextThreshold:h}){const t=Math.max(e,0);if(t===0||n)return{fromStart:0,fromEnd:0,rangeSize:t,collapsedLines:t,renderAll:!1};if(r===!0||t<=h)return{fromStart:t,fromEnd:0,rangeSize:t,collapsedLines:0,renderAll:!0};const l=r?.get(a),u=Math.min(Math.max(l?.fromStart??0,0),t),i=Math.min(Math.max(l?.fromEnd??0,0),t),s=u+i,o=s>=t;return{fromStart:o?t:u,fromEnd:o?0:i,rangeSize:t,collapsedLines:Math.max(t-s,0),renderAll:o}}function Rn(n){const e=n.hunks[n.hunks.length-1];if(e==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return!1;const r=n.additionLines.length-P(e.additionStart,e.additionCount),a=n.deletionLines.length-P(e.deletionStart,e.deletionCount);return r<=0&&a<=0?!1:r!==a}function rn({fileDiff:n,errorPrefix:e}){const r=n.hunks[n.hunks.length-1];if(r==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return 0;const a=n.additionLines.length-P(r.additionStart,r.additionCount),h=n.deletionLines.length-P(r.deletionStart,r.deletionCount);if(a<=0&&h<=0)return 0;if(a!==h)throw new Error(`${e}: trailing context mismatch (additions=${a}, deletions=${h}) for ${n.name}`);return Math.min(a,h)}function U({fileDiff:n,hunkIndex:e,expandedHunks:r,collapsedContextThreshold:a,errorPrefix:h}){if(e!==n.hunks.length-1)return;const t=rn({fileDiff:n,errorPrefix:h});if(t<=0)return;if(r===!0||t<=a)return{fromStart:t,fromEnd:0,rangeSize:t,collapsedLines:0,renderAll:!0};const l=r?.get(n.hunks.length),u=Math.min(Math.max(l?.fromStart??0,0),t);return{fromStart:u,fromEnd:0,rangeSize:t,collapsedLines:t-u,renderAll:u>=t}}function bn({fileDiff:n,lineNumber:e,expandedHunks:r,collapsedContextThreshold:a}){if(r===!0||n.isPartial)return!0;for(const[u,i]of n.hunks.entries()){const[s,o]=_(i);if(e<s){const d=$({isPartial:n.isPartial,rangeSize:i.collapsedBefore,expandedHunks:r,hunkIndex:u,collapsedContextThreshold:a}),c=s-d.rangeSize;return d.renderAll||e<c+d.fromStart||e>=s-d.fromEnd}if(e<o)return!0}const h=U({fileDiff:n,hunkIndex:n.hunks.length-1,expandedHunks:r,collapsedContextThreshold:a,errorPrefix:"isAdditionLineRenderable"});if(h==null||h.renderAll)return!0;const t=n.hunks[n.hunks.length-1],[,l]=_(t);return e<l+h.fromStart||e>=l+h.rangeSize}function On({fileDiff:n,lineNumber:e,direction:r,expandedHunks:a,collapsedContextThreshold:h}){if(a===!0||n.isPartial)return e;const t=[];let l=1;for(const[i,s]of n.hunks.entries()){const[o,d]=_(s),c=$({isPartial:n.isPartial,rangeSize:s.collapsedBefore,expandedHunks:a,hunkIndex:i,collapsedContextThreshold:h}),f=o-c.rangeSize;c.renderAll?t.push([f,o]):(c.fromStart>0&&t.push([f,f+c.fromStart]),c.fromEnd>0&&t.push([o-c.fromEnd,o])),t.push([o,d]),l=d}const u=U({fileDiff:n,hunkIndex:n.hunks.length-1,expandedHunks:a,collapsedContextThreshold:h,errorPrefix:"getNearestRenderableAdditionLine"});if(u!=null){const i=l;l=i+u.rangeSize,u.renderAll?t.push([i,l]):u.fromStart>0&&t.push([i,i+u.fromStart])}if(e>=l)return e;if(r==="down"){for(const[i,s]of t)if(s>e)return Math.max(i,e);return}for(let i=t.length-1;i>=0;i--){const[s,o]=t[i];if(s<=e)return Math.min(o-1,e)}}function G({type:n,metrics:e}){return e.hunkSeparatorHeight??Q(n)}function J({type:n,metrics:e}){return n==="simple"||n==="metadata"||n==="line-info-basic"?0:e.spacing}function sn({type:n,hunkIndex:e,hunkSpecs:r}){switch(n){case"simple":return e>0;case"metadata":return r!=null;case"line-info":case"line-info-basic":case"custom":return!0}}function an(n){return n!=="simple"&&n!=="metadata"}function Fn({type:n,metrics:e,hunkIndex:r,hunkSpecs:a}){if(!sn({type:n,hunkIndex:r,hunkSpecs:a}))return;const h=G({type:n,metrics:e}),t=J({type:n,metrics:e}),l=r>0?t:0,u=t;return{height:h,gapBefore:l,gapAfter:u,totalHeight:l+h+u}}function Hn({type:n,metrics:e}){if(!an(n))return;const r=G({type:n,metrics:e}),a=J({type:n,metrics:e});return{height:r,gapBefore:a,gapAfter:0,totalHeight:a+r}}function ln({diff:n,diffStyle:e,startingLine:r=0,totalLines:a=1/0,expandedHunks:h,collapsedContextThreshold:t=1,callback:l}){const u=un({diff:n,diffStyle:e,startingLine:r,expandedHunks:h,collapsedContextThreshold:t}),i={viewportStart:r,viewportEnd:r+a,isWindowedHighlight:r>0||a<1/0,splitCount:u.splitCount,unifiedCount:u.unifiedCount,finalHunkIndex:n.hunks.length-1,shouldBreak(){if(!i.isWindowedHighlight)return!1;const s=i.unifiedCount>=r+a,o=i.splitCount>=r+a;return e==="unified"?s:(e==="split"||s)&&o},shouldSkip(s,o){if(!i.isWindowedHighlight)return!1;const d=s>0&&i.unifiedCount+s<=r,c=o>0&&i.splitCount+o<=r;return e==="unified"?d:(e==="split"||d)&&c},incrementCounts(s,o){(e==="unified"||e==="both")&&(i.unifiedCount+=s),(e==="split"||e==="both")&&(i.splitCount+=o)},isInWindow(s,o){if(!i.isWindowedHighlight)return!0;const d=i.isInUnifiedWindow(s),c=i.isInSplitWindow(o);return e==="unified"?d:e==="split"?c:d||c},isInUnifiedWindow(s){return!i.isWindowedHighlight||i.unifiedCount>=r-s&&i.unifiedCount<r+a},isInSplitWindow(s){return!i.isWindowedHighlight||i.splitCount>=r-s&&i.splitCount<r+a},emit(s,o=!1){return o||(e==="unified"?i.incrementCounts(1,0):e==="split"?i.incrementCounts(0,1):i.incrementCounts(1,1)),l(s)??!1}};n:for(let s=u.hunkIndex;s<n.hunks.length;s++){let N=function(g,S){return F==null||F.collapsedLines<=0||F.fromStart+F.fromEnd>0?0:e==="unified"?g===o.unifiedLineStart+o.unifiedLineCount-1?F.collapsedLines:0:S===o.splitLineStart+o.splitLineCount-1?F.collapsedLines:0},I=function(){return z?0:(z=!0,p.collapsedLines)};const o=n.hunks[s];if(o==null)throw new Error("iterateOverDiff: invalid hunk index");if(i.shouldBreak())break;const d=V(o.deletionStart,o.deletionCount),c=V(o.additionStart,o.additionCount),f=!n.isPartial&&o.deletionCount===0?d:o.deletionLineIndex,m=!n.isPartial&&o.additionCount===0?c:o.additionLineIndex,p=$({isPartial:n.isPartial,rangeSize:o.collapsedBefore,expandedHunks:h,hunkIndex:s,collapsedContextThreshold:t}),F=s===i.finalHunkIndex?U({fileDiff:n,hunkIndex:s,expandedHunks:h,collapsedContextThreshold:t,errorPrefix:"iterateOverDiff"}):void 0,H=p.fromStart+p.fromEnd;let z=p.collapsedLines===0;if(i.shouldSkip(H,H))i.incrementCounts(H,H),I();else{let g=o.unifiedLineStart-p.rangeSize,S=o.splitLineStart-p.rangeSize,R=f-p.rangeSize,O=m-p.rangeSize,x=d+1-p.rangeSize,M=c+1-p.rangeSize;if(D(i,p.fromStart,e,w=>i.emit({hunkIndex:s,hunk:o,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:x+w,lineIndex:R+w,noEOFCR:!1,unifiedLineIndex:g+w,splitLineIndex:S+w},additionLine:{unifiedLineIndex:g+w,splitLineIndex:S+w,lineIndex:O+w,lineNumber:M+w,noEOFCR:!1}}))||(g=o.unifiedLineStart-p.fromEnd,S=o.splitLineStart-p.fromEnd,R=f-p.fromEnd,O=m-p.fromEnd,x=d+1-p.fromEnd,M=c+1-p.fromEnd,D(i,p.fromEnd,e,w=>i.emit({hunkIndex:s,hunk:o,collapsedBefore:I(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:x+w,lineIndex:R+w,noEOFCR:!1,unifiedLineIndex:g+w,splitLineIndex:S+w},additionLine:{unifiedLineIndex:g+w,splitLineIndex:S+w,lineIndex:O+w,lineNumber:M+w,noEOFCR:!1}}),()=>{I()})))break n}let C=o.unifiedLineStart,k=o.splitLineStart,v=f,L=m,E=d+1,b=c+1;const T=o.hunkContent.at(-1);for(const g of o.hunkContent){if(i.shouldBreak())break n;const S=g===T;if(g.type==="context"){if(i.shouldSkip(g.lines,g.lines))i.incrementCounts(g.lines,g.lines),I();else if(D(i,g.lines,e,R=>{const O=S&&R===g.lines-1,x=C+R,M=k+R;return i.emit({hunkIndex:s,hunk:o,collapsedBefore:I(),collapsedAfter:N(x,M),type:"context",deletionLine:{lineNumber:E+R,lineIndex:v+R,noEOFCR:O&&o.noEOFCRDeletions,unifiedLineIndex:x,splitLineIndex:M},additionLine:{unifiedLineIndex:x,splitLineIndex:M,lineIndex:L+R,lineNumber:b+R,noEOFCR:O&&o.noEOFCRAdditions}})},()=>{I()}))break n;C+=g.lines,k+=g.lines,v+=g.lines,L+=g.lines,E+=g.lines,b+=g.lines}else{const R=Math.max(g.deletions,g.additions),O=g.deletions+g.additions;if(!i.shouldSkip(O,R)){const x=hn(i,g,e);(x[0]?.[0]??0)>0&&I();for(const[M,w]of x)for(let W=M;W<w;W++){const j=N(C+W,e==="unified"?k+(W<g.deletions?W:W-g.deletions):k+W);if(i.emit(gn({hunkIndex:s,hunk:o,collapsedBefore:I(),collapsedAfter:j,diffStyle:e,index:W,unifiedLineIndex:C,splitLineIndex:k,additionLineIndex:L,deletionLineIndex:v,additionLineNumber:b,deletionLineNumber:E,content:g,isLastContent:S,unifiedCount:O,splitCount:R}),!0))break n}}I(),i.incrementCounts(O,R),C+=O,k+=R,v+=g.deletions,L+=g.additions,E+=g.deletions,b+=g.additions}}if(F!=null){const{collapsedLines:g,fromStart:S,fromEnd:R}=F,O=S+R;if(D(i,O,e,x=>{const M=x===O-1;return i.emit({hunkIndex:n.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:M?g:0,type:"context-expanded",deletionLine:{lineNumber:E+x,lineIndex:v+x,noEOFCR:!1,unifiedLineIndex:C+x,splitLineIndex:k+x},additionLine:{unifiedLineIndex:C+x,splitLineIndex:k+x,lineIndex:L+x,lineNumber:b+x,noEOFCR:!1}})},void 0,()=>i.shouldBreak()))break n}}}function un({diff:n,diffStyle:e,startingLine:r,expandedHunks:a,collapsedContextThreshold:h}){if(r<=0||e==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};const t=dn({diff:n,expandedHunks:a,collapsedContextThreshold:h});let l=0,u=n.hunks.length-1,i=n.hunks.length;for(;l<=u;){const o=l+u>>1,d=t[o+1];if(d==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(e==="unified"?d.unifiedCount:d.splitCount)>r?(i=o,u=o-1):l=o+1}if(i>=n.hunks.length){const o=t[n.hunks.length];if(o==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:n.hunks.length,splitCount:o.splitCount,unifiedCount:o.unifiedCount}}const s=t[i];if(s==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:i,splitCount:s.splitCount,unifiedCount:s.unifiedCount}}function dn({diff:n,expandedHunks:e,collapsedContextThreshold:r}){let a=0,h=0;const t=n.hunks.length-1,l=[{splitCount:0,unifiedCount:0}];for(let u=0;u<n.hunks.length;u++){const i=n.hunks[u];if(i==null)throw new Error("iterateOverDiff: invalid hunk summary index");const s=$({isPartial:n.isPartial,rangeSize:i.collapsedBefore,expandedHunks:e,hunkIndex:u,collapsedContextThreshold:r}),o=s.fromStart+s.fromEnd;a+=o+i.splitLineCount,h+=o+i.unifiedLineCount;const d=u===t?U({fileDiff:n,hunkIndex:u,expandedHunks:e,collapsedContextThreshold:r,errorPrefix:"iterateOverDiff"}):void 0;if(d!=null){const c=d.fromStart+d.fromEnd;a+=c,h+=c}l.push({splitCount:a,unifiedCount:h})}return l}function cn(n,e,r){if(!n.isWindowedHighlight||e<=0)return[0,e];const a=[];function h(u){const i=Math.max(0,n.viewportStart-u),s=Math.min(e,n.viewportEnd-u);s>i&&a.push([i,s])}if(r!=="split"&&h(n.unifiedCount),r!=="unified"&&h(n.splitCount),a.length===0)return[0,0];let t=a[0][0],l=a[0][1];for(let u=1;u<a.length;u++){const i=a[u];t=Math.min(t,i[0]),l=Math.max(l,i[1])}return[t,l]}function D(n,e,r,a,h,t){const[l,u]=cn(n,e,r);l>0&&(n.incrementCounts(l,l),h?.());let i=l;for(;i<e;){if(t?.()===!0)return!0;if(i>=u){n.incrementCounts(e-i,e-i);break}if(n.isInWindow(0,0)){if(a(i)===!0)return!0}else n.incrementCounts(1,1);i++}return!1}function hn(n,e,r){if(!n.isWindowedHighlight)return[[0,r==="unified"?e.deletions+e.additions:Math.max(e.deletions,e.additions)]];const a=r!=="split",h=r!=="unified",t=r==="unified"?"unified":"split",l=[];function u(d,c){if(d+c<=n.viewportStart||d>=n.viewportEnd)return;const f=Math.max(0,n.viewportStart-d),m=Math.min(c,n.viewportEnd-d);return m>f?[f,m]:void 0}function i(d,c){return t==="split"?d:c==="additions"?[d[0]+e.deletions,d[1]+e.deletions]:d}function s(d,c){if(d==null)return;const[f,m]=i(d,c);m>f&&l.push([f,m])}if(a&&(s(u(n.unifiedCount,e.deletions),"deletions"),s(u(n.unifiedCount+e.deletions,e.additions),"additions")),h&&(s(u(n.splitCount,e.deletions),"deletions"),s(u(n.splitCount,e.additions),"additions")),l.length===0)return l;l.sort((d,c)=>d[0]-c[0]);const o=[l[0]];for(const[d,c]of l.slice(1)){const f=o[o.length-1];d<=f[1]?f[1]=Math.max(f[1],c):o.push([d,c])}return o}function gn({hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,diffStyle:h,index:t,unifiedLineIndex:l,splitLineIndex:u,additionLineIndex:i,deletionLineIndex:s,additionLineNumber:o,deletionLineNumber:d,content:c,isLastContent:f,unifiedCount:m,splitCount:p}){const F=t<c.deletions?l+t:void 0,H=h==="unified"?t>=c.deletions?l+t:void 0:t<c.additions?l+c.deletions+t:void 0,N=h==="unified"?u+(t<c.deletions?t:t-c.deletions):u+t,z=t<c.deletions?s+t:void 0,I=t<c.deletions?d+t:void 0,C=h==="unified"?t>=c.deletions?i+(t-c.deletions):void 0:t<c.additions?i+t:void 0,k=h==="unified"?t>=c.deletions?o+(t-c.deletions):void 0:t<c.additions?o+t:void 0,v=h==="unified"?f&&t===c.deletions-1&&e.noEOFCRDeletions:f&&t===p-1&&e.noEOFCRDeletions,L=h==="unified"?f&&t===m-1&&e.noEOFCRAdditions:f&&t===p-1&&e.noEOFCRAdditions,E=z!=null&&I!=null&&F!=null?{lineNumber:I,lineIndex:z,noEOFCR:v,unifiedLineIndex:F,splitLineIndex:N}:void 0,b=C!=null&&k!=null&&H!=null?{unifiedLineIndex:H,splitLineIndex:N,lineIndex:C,lineNumber:k,noEOFCR:L}:void 0;if(E==null&&b!=null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,deletionLine:void 0,additionLine:b};if(E!=null&&b==null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,deletionLine:E,additionLine:void 0};if(E==null||b==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,deletionLine:E,additionLine:b}}const fn={forcePlainText:!1};function Mn(n,e,r,{forcePlainText:a,lazyLineAST:h=!1,startingLine:t,totalLines:l,expandedHunks:u,collapsedContextThreshold:i=1}=fn){a?(t??=0,l??=1/0):(t=0,l=1/0);const s=t>0||l<1/0;h&&=!a&&!r.useTokenTransformer;const o=typeof r.theme=="string"?e.getTheme(r.theme).type:void 0,d=Y({theme:r.theme,highlighter:e}),c=a&&!s&&(n.unifiedLineCount>1e3||n.splitLineCount>1e3)?"none":r.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:m}=r,p=!a&&!n.isPartial,F=a?u:void 0,H=new Map;function N(I){const C=p?0:I,k=H.get(C)??In();return H.set(C,k),k}function z(I,C,k,v){if(s){let L=k.at(-1);(L==null||L.targetIndex+L.count!==C)&&(L={targetIndex:C,originalOffset:v.length,count:0},k.push(L)),L.count++}v.push(I)}ln({diff:n,diffStyle:"both",startingLine:t,totalLines:l,expandedHunks:s?F:!0,collapsedContextThreshold:i,callback:({hunkIndex:I,additionLine:C,deletionLine:k,type:v})=>{const L=N(I),E=C!=null?C.splitLineIndex:k.splitLineIndex;v==="change"&&C!=null&&k!=null&&pn({additionLine:n.additionLines[C.lineIndex],deletionLine:n.deletionLines[k.lineIndex],deletionLineIndex:L.deletionContent.length,additionLineIndex:L.additionContent.length,deletionDecorations:L.deletionDecorations,additionDecorations:L.additionDecorations,lineDiffType:c,maxLineDiffLength:m}),k!=null&&(z(n.deletionLines[k.lineIndex],k.lineIndex,L.deletionSegments,L.deletionContent),L.deletionInfo.push({type:v==="change"?"change-deletion":v,lineNumber:k.lineNumber,altLineNumber:v==="change"?void 0:C.lineNumber??void 0,lineIndex:`${k.unifiedLineIndex},${E}`})),C!=null&&(z(n.additionLines[C.lineIndex],C.lineIndex,L.additionSegments,L.additionContent),L.additionInfo.push({type:v==="change"?"change-addition":v,lineNumber:C.lineNumber,altLineNumber:v==="change"?void 0:k.lineNumber??void 0,lineIndex:`${C.unifiedLineIndex},${E}`}))}});for(const I of H.values()){if(I.deletionContent.length===0&&I.additionContent.length===0)continue;const C={name:n.prevName??n.name,contents:I.deletionContent.value},k={name:n.name,contents:I.additionContent.value},{deletionLines:v,additionLines:L}=Cn({deletionFile:C,deletionInfo:I.deletionInfo,deletionDecorations:I.deletionDecorations,additionFile:k,additionInfo:I.additionInfo,additionDecorations:I.additionDecorations,highlighter:e,options:r,languageOverride:a?"text":n.lang,lazyLineAST:h});if(p){f.deletionLines=v,f.additionLines=L;continue}for(const[E,b,T]of[[f.deletionLines,v,I.deletionSegments],[f.additionLines,L,I.additionSegments]])if(T.length>0)for(const g of T)for(let S=0;S<g.count;S++)E[g.targetIndex+S]=b[g.originalOffset+S];else if(h){const g=E.length;for(let S=0;S<b.length;S++)Z(E,g+S,()=>b[S])}else y(E,b)}return{code:f,themeStyles:d,baseThemeType:o}}function mn(n,{deletionLineIndex:e,additionLineIndex:r,deletionDecorations:a,additionDecorations:h}){let t=0,l=0,u=-1,i=0,s=-1,o=0;for(const{value:d,added:c,removed:f}of n)f?(u===-1&&(u=t),t+=d.length,i=t):c?(s===-1&&(s=l),l+=d.length,o=l):(t+=d.length,l+=d.length);u!==-1&&a.push(B({line:e,spanStart:u,spanLength:i-u})),s!==-1&&h.push(B({line:r,spanStart:s,spanLength:o-s}))}function pn({deletionLine:n,additionLine:e,deletionLineIndex:r,additionLineIndex:a,deletionDecorations:h,additionDecorations:t,lineDiffType:l,maxLineDiffLength:u}){if(n==null||e==null||l==="none"||(n=q(n),e=q(e),n.length>u||e.length>u))return;const i=l==="char"?tn(n,e):on(n,e);if(l==="word-line"){mn(i,{deletionLineIndex:r,additionLineIndex:a,deletionDecorations:h,additionDecorations:t});return}const s=[],o=[],d=l==="word-alt",c=i.at(-1);for(const m of i){const p=m===c;!m.added&&!m.removed?(A({item:m,arr:s,enableJoin:d,isNeutral:!0,isLastItem:p}),A({item:m,arr:o,enableJoin:d,isNeutral:!0,isLastItem:p})):m.removed?A({item:m,arr:s,enableJoin:d,isLastItem:p}):A({item:m,arr:o,enableJoin:d,isLastItem:p})}let f=0;for(const m of s)m[0]===1&&h.push(B({line:r,spanStart:f,spanLength:m[1].length})),f+=m[1].length;f=0;for(const m of o)m[0]===1&&t.push(B({line:a,spanStart:f,spanLength:m[1].length})),f+=m[1].length}function In(){return{deletionContent:{push(n){this.value+=n,this.length++},value:"",length:0},additionContent:{push(n){this.value+=n,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Cn({lazyLineAST:n,deletionFile:e,additionFile:r,deletionInfo:a,additionInfo:h,highlighter:t,deletionDecorations:l,additionDecorations:u,languageOverride:i,options:{theme:s,useTokenTransformer:o,tokenizeMaxLineLength:d}}){const c=(f,m,p)=>f.contents===""?[]:nn(t.codeToTokens(q(f.contents),en(i??K(f.name),s,d)).tokens,{state:{lineInfo:m},useTokenTransformer:o,decorations:p,lazyLineAST:n,cacheHtmlStyles:t.name==="highlights"});return{deletionLines:c(e,a,l),additionLines:c(r,h,u)}}function zn(n){const e=n.lang??K(n.name),r=n.lang??(n.prevName!=null?K(n.prevName):"text");return e==="text"&&r==="text"}export{xn as a,wn as b,En as c,U as d,ln as e,rn as f,$ as g,Rn as h,zn as i,bn as j,On as k,_ as l,Fn as m,Hn as n,Mn as r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as O,g as _,r as p,f as F,h as A}from"./computeVirtualFileMetrics-
|
|
1
|
+
import{e as O,g as _,r as p,f as F,h as A}from"./computeVirtualFileMetrics-DkXi0qX-.js";import{g as E}from"./getFiletypeFromFileName-BgI9McTw.js";function D(e,n){return O(e.theme,n.theme)&&e.useTokenTransformer===n.useTokenTransformer&&e.tokenizeMaxLineLength===n.tokenizeMaxLineLength}const g=10,m=13,N=4,S=40;function k(e){const n=[0];let t=e.indexOf("\r"),r=e.indexOf(`
|
|
2
2
|
`),f=0,l=0;for(;t!==-1||r!==-1;){let o;if(t!==-1&&(r===-1||t<r)?r===t+1?(o=r+1,t=e.indexOf("\r",o),r=e.indexOf(`
|
|
3
3
|
`,o)):(o=t+1,t=e.indexOf("\r",o)):(o=r+1,r=e.indexOf(`
|
|
4
4
|
`,o)),n.push(o),++l===N){if(o-f<=S){for(let i=o;i<e.length;i++){const s=e.charCodeAt(i);(s===g||s===m)&&(s===m&&i+1<e.length&&e.charCodeAt(i+1)===g&&i++,n.push(i+1))}return n}f=o,l=0}}return n}function R(e){const n=k(e);return Array.from({length:n.length},(t,r)=>{const f=n[r],l=n[r+1]??e.length;return e.slice(f,l)})}const C={forcePlainText:!1};function K(e,n,{theme:t,tokenizeMaxLineLength:r,useTokenTransformer:f},{forcePlainText:l,lazyLineAST:o=!1,startingLine:i,totalLines:s,lines:T}=C){l?(i??=0,s??=1/0):(i=0,s=1/0);const a=i>0||s<1/0,c={lineInfo:[]},x=l?"text":e.lang??E(e.name),y=typeof t=="string"?n.getTheme(t).type:void 0,I=_({theme:t,highlighter:n});c.lineInfo=u=>({type:"context",lineIndex:u-1+i,lineNumber:u+i});const h=p(n.codeToTokens(L(a?H(T??R(e.contents),i,s):e.contents),F(x,t,r)).tokens,{state:c,useTokenTransformer:f,lazyLineAST:o&&!l&&!f,cacheHtmlStyles:n.name==="highlights"}),d=a?new Array(i):h;return a&&A(d,h),{code:d,themeStyles:I,baseThemeType:y}}function L(e){return e.replace(/\r(?!\n)/g,`
|