@quixomatic/rpf 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -0
- package/README.md +13 -5
- package/assets/dev-host/THIRD_PARTY_NOTICES.txt +2937 -0
- package/assets/dev-host/boot.js +250 -0
- package/assets/dev-host/boot.js.LEGAL.txt +48 -0
- package/assets/dev-host/chunks/accordion-O6VUPQ32.js +2 -0
- package/assets/dev-host/chunks/alert-PRAGKG5L.js +2 -0
- package/assets/dev-host/chunks/alert-dialog-SCBXM23J.js +2 -0
- package/assets/dev-host/chunks/avatar-WXPKQ3Z5.js +2 -0
- package/assets/dev-host/chunks/badge-KCMWGERA.js +2 -0
- package/assets/dev-host/chunks/breadcrumb-IJQJQ5JV.js +2 -0
- package/assets/dev-host/chunks/button-4JMBKYN4.js +2 -0
- package/assets/dev-host/chunks/calendar-XXLCAUPG.js +2 -0
- package/assets/dev-host/chunks/card-EY3LK2GB.js +2 -0
- package/assets/dev-host/chunks/chart-2PHC6UIE.js +2 -0
- package/assets/dev-host/chunks/chart-blocks-PZPCWCNT.js +2 -0
- package/assets/dev-host/chunks/chart-frame-MNUFXAPU.js +3 -0
- package/assets/dev-host/chunks/charts-SKK6UTYU.js +85 -0
- package/assets/dev-host/chunks/charts-SKK6UTYU.js.LEGAL.txt +48 -0
- package/assets/dev-host/chunks/chat-TTESCYES.js +2 -0
- package/assets/dev-host/chunks/checkbox-Y2UGSRR4.js +2 -0
- package/assets/dev-host/chunks/chunk-2IZ44WWI.js +2 -0
- package/assets/dev-host/chunks/chunk-2L7NK6SJ.js +2 -0
- package/assets/dev-host/chunks/chunk-33RMFA4P.js +2 -0
- package/assets/dev-host/chunks/chunk-3H6F4X7R.js +2 -0
- package/assets/dev-host/chunks/chunk-3UDEYJRG.js +2 -0
- package/assets/dev-host/chunks/chunk-4E74H7FZ.js +2 -0
- package/assets/dev-host/chunks/chunk-4UUMO65R.js +2 -0
- package/assets/dev-host/chunks/chunk-57M36GYM.js +2 -0
- package/assets/dev-host/chunks/chunk-5EK7QOB6.js +2 -0
- package/assets/dev-host/chunks/chunk-5YMOXSSM.js +2 -0
- package/assets/dev-host/chunks/chunk-5ZMYWE5S.js +2 -0
- package/assets/dev-host/chunks/chunk-6ARM5VDH.js +2 -0
- package/assets/dev-host/chunks/chunk-7OCTAHT6.js +2 -0
- package/assets/dev-host/chunks/chunk-7TG23VIV.js +2 -0
- package/assets/dev-host/chunks/chunk-AAL6V4Y3.js +2 -0
- package/assets/dev-host/chunks/chunk-APP2HKWR.js +8 -0
- package/assets/dev-host/chunks/chunk-AVSRGCSF.js +2 -0
- package/assets/dev-host/chunks/chunk-AZWODE64.js +2 -0
- package/assets/dev-host/chunks/chunk-B4MRCKT4.js +2 -0
- package/assets/dev-host/chunks/chunk-BB4IX5QA.js +2 -0
- package/assets/dev-host/chunks/chunk-BH6FGVDP.js +2 -0
- package/assets/dev-host/chunks/chunk-BJZOPTWR.js +2 -0
- package/assets/dev-host/chunks/chunk-CCXMDKVL.js +2 -0
- package/assets/dev-host/chunks/chunk-CJ5CECQT.js +1 -0
- package/assets/dev-host/chunks/chunk-CLVPTZ4G.js +2 -0
- package/assets/dev-host/chunks/chunk-CT4EH2K2.js +8 -0
- package/assets/dev-host/chunks/chunk-CT4EH2K2.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-CWDPAB6V.js +2 -0
- package/assets/dev-host/chunks/chunk-D7BPK3AE.js +1 -0
- package/assets/dev-host/chunks/chunk-DG6LRRQT.js +2 -0
- package/assets/dev-host/chunks/chunk-DR47HKIK.js +2 -0
- package/assets/dev-host/chunks/chunk-E75HEEMN.js +2 -0
- package/assets/dev-host/chunks/chunk-EDEL6XSO.js +2 -0
- package/assets/dev-host/chunks/chunk-EGZKG2B2.js +2 -0
- package/assets/dev-host/chunks/chunk-F353PAEY.js +2 -0
- package/assets/dev-host/chunks/chunk-F5MKIWPQ.js +2 -0
- package/assets/dev-host/chunks/chunk-FJRWQRLM.js +2 -0
- package/assets/dev-host/chunks/chunk-FROPNHO5.js +2 -0
- package/assets/dev-host/chunks/chunk-FTWKUXER.js +2 -0
- package/assets/dev-host/chunks/chunk-FZPMZMFU.js +2 -0
- package/assets/dev-host/chunks/chunk-GN3SYBEC.js +2 -0
- package/assets/dev-host/chunks/chunk-GQYRJYJV.js +2 -0
- package/assets/dev-host/chunks/chunk-GWDGPUGM.js +2 -0
- package/assets/dev-host/chunks/chunk-GX72R347.js +2 -0
- package/assets/dev-host/chunks/chunk-GZJCEDUU.js +4 -0
- package/assets/dev-host/chunks/chunk-H6TI5TWN.js +2 -0
- package/assets/dev-host/chunks/chunk-HFUDOYIP.js +16 -0
- package/assets/dev-host/chunks/chunk-IAEAQCYR.js +2 -0
- package/assets/dev-host/chunks/chunk-IJQ26FTX.js +15 -0
- package/assets/dev-host/chunks/chunk-IJQ26FTX.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-IQ2XSDFU.js +3 -0
- package/assets/dev-host/chunks/chunk-IQ2XSDFU.js.LEGAL.txt +146 -0
- package/assets/dev-host/chunks/chunk-IWEJRU22.js +2 -0
- package/assets/dev-host/chunks/chunk-JIAVZ3V7.js +3 -0
- package/assets/dev-host/chunks/chunk-K7LVVFGH.js +1 -0
- package/assets/dev-host/chunks/chunk-KAZVAX35.js +2 -0
- package/assets/dev-host/chunks/chunk-KCTKD6GV.js +2 -0
- package/assets/dev-host/chunks/chunk-KNOE7TZW.js +2 -0
- package/assets/dev-host/chunks/chunk-KOQLDUOI.js +2 -0
- package/assets/dev-host/chunks/chunk-KPP4HYUV.js +2 -0
- package/assets/dev-host/chunks/chunk-KSVOOYUA.js +2 -0
- package/assets/dev-host/chunks/chunk-KVMUXFPB.js +2 -0
- package/assets/dev-host/chunks/chunk-LTVKSGLG.js +2 -0
- package/assets/dev-host/chunks/chunk-LYT7LQS3.js +2 -0
- package/assets/dev-host/chunks/chunk-M7A47ZSM.js +2 -0
- package/assets/dev-host/chunks/chunk-MGLBTOXD.js +6 -0
- package/assets/dev-host/chunks/chunk-ML6HCGK5.js +2 -0
- package/assets/dev-host/chunks/chunk-MQ67DRDE.js +2 -0
- package/assets/dev-host/chunks/chunk-MTHCFDUE.js +2 -0
- package/assets/dev-host/chunks/chunk-NI6ZJ6DH.js +2 -0
- package/assets/dev-host/chunks/chunk-NJX7QY3Z.js +2 -0
- package/assets/dev-host/chunks/chunk-NZ73KS2Y.js +2 -0
- package/assets/dev-host/chunks/chunk-OW6AVFQA.js +2 -0
- package/assets/dev-host/chunks/chunk-OXJ6LWKI.js +3 -0
- package/assets/dev-host/chunks/chunk-OXJ6LWKI.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-PHK25MY7.js +2 -0
- package/assets/dev-host/chunks/chunk-PQMY72VV.js +2 -0
- package/assets/dev-host/chunks/chunk-PWFHIE6D.js +2 -0
- package/assets/dev-host/chunks/chunk-PYWKHILP.js +2 -0
- package/assets/dev-host/chunks/chunk-QFN6XL4O.js +2 -0
- package/assets/dev-host/chunks/chunk-R5KQ2GRA.js +2 -0
- package/assets/dev-host/chunks/chunk-RCNX6LVJ.js +3 -0
- package/assets/dev-host/chunks/chunk-RCNX6LVJ.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-SFI7YWVR.js +2 -0
- package/assets/dev-host/chunks/chunk-SLZI4G3N.js +2 -0
- package/assets/dev-host/chunks/chunk-SVQCDOZ3.js +2 -0
- package/assets/dev-host/chunks/chunk-T4Y5HG5P.js +4 -0
- package/assets/dev-host/chunks/chunk-T7JFBQSG.js +2 -0
- package/assets/dev-host/chunks/chunk-TIJLEKZ2.js +2 -0
- package/assets/dev-host/chunks/chunk-TNLYU77Y.js +2 -0
- package/assets/dev-host/chunks/chunk-TQPXDAVH.js +2 -0
- package/assets/dev-host/chunks/chunk-UH726PMV.js +7 -0
- package/assets/dev-host/chunks/chunk-UH726PMV.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-URJZKT45.js +2 -0
- package/assets/dev-host/chunks/chunk-URWVHIIJ.js +2 -0
- package/assets/dev-host/chunks/chunk-UUJ5X322.js +2 -0
- package/assets/dev-host/chunks/chunk-UWANBOC6.js +2 -0
- package/assets/dev-host/chunks/chunk-UXUS6DNI.js +2 -0
- package/assets/dev-host/chunks/chunk-VKXVJGG5.js +6 -0
- package/assets/dev-host/chunks/chunk-VSM3ZOBU.js +2 -0
- package/assets/dev-host/chunks/chunk-WLBNJ4K3.js +2 -0
- package/assets/dev-host/chunks/chunk-WRHZYADJ.js +2 -0
- package/assets/dev-host/chunks/chunk-WT34MBTN.js +2 -0
- package/assets/dev-host/chunks/chunk-X34AFUS2.js +2 -0
- package/assets/dev-host/chunks/chunk-XE5RQ73V.js +2 -0
- package/assets/dev-host/chunks/chunk-XGLVZEGD.js +2 -0
- package/assets/dev-host/chunks/chunk-XIXCIQKJ.js +2 -0
- package/assets/dev-host/chunks/chunk-Z76KXEPD.js +2 -0
- package/assets/dev-host/chunks/code-block-H2ETQV3M.js +2 -0
- package/assets/dev-host/chunks/code-editor-2JYERJLS.js +2 -0
- package/assets/dev-host/chunks/collapsible-4ZOFMWLB.js +2 -0
- package/assets/dev-host/chunks/color-UDQWYS2D.js +2 -0
- package/assets/dev-host/chunks/color-picker-RRCCLR54.js +2 -0
- package/assets/dev-host/chunks/combobox-U4455OMJ.js +2 -0
- package/assets/dev-host/chunks/contrast-badge-KDF65X7J.js +2 -0
- package/assets/dev-host/chunks/core.esm-WYAV6XZS.js +2 -0
- package/assets/dev-host/chunks/date-range-picker-WJYHAHRM.js +2 -0
- package/assets/dev-host/chunks/dialog-I6AGHWB3.js +2 -0
- package/assets/dev-host/chunks/dist-T43K2TRF.js +2 -0
- package/assets/dev-host/chunks/dropdown-menu-LSOMXDWG.js +2 -0
- package/assets/dev-host/chunks/empty-NLQODUSK.js +2 -0
- package/assets/dev-host/chunks/esm-L33CRTOD.js +5 -0
- package/assets/dev-host/chunks/font-picker-3TLYYZJH.js +2 -0
- package/assets/dev-host/chunks/frame-HA7UIYZF.js +2 -0
- package/assets/dev-host/chunks/heading-7M24WKK6.js +2 -0
- package/assets/dev-host/chunks/hover-card-HSHOQPOI.js +2 -0
- package/assets/dev-host/chunks/icon-NZIMARLZ.js +2 -0
- package/assets/dev-host/chunks/image-R7XGYKVH.js +2 -0
- package/assets/dev-host/chunks/index-fn-BUQBI34R.js +5 -0
- package/assets/dev-host/chunks/index.esm-SPI7ZXRT.js +6 -0
- package/assets/dev-host/chunks/index.esm-SPI7ZXRT.js.LEGAL.txt +25 -0
- package/assets/dev-host/chunks/input-YECXNM53.js +2 -0
- package/assets/dev-host/chunks/input-group-GFKXSZM7.js +2 -0
- package/assets/dev-host/chunks/kbd-V25ZMVCM.js +2 -0
- package/assets/dev-host/chunks/label-LJT4V2CT.js +2 -0
- package/assets/dev-host/chunks/label-value-6Z6ATP55.js +2 -0
- package/assets/dev-host/chunks/legacy-4ICQWPOE.js +2 -0
- package/assets/dev-host/chunks/logo-AAMBHX2W.js +2 -0
- package/assets/dev-host/chunks/number-field-6TCQAVTR.js +2 -0
- package/assets/dev-host/chunks/pill-7L57ZNRJ.js +2 -0
- package/assets/dev-host/chunks/popover-3P6YNKH3.js +2 -0
- package/assets/dev-host/chunks/portal-code-Z5G6AEMM.js +25 -0
- package/assets/dev-host/chunks/portal-rte-7B6VXIZO.js +163 -0
- package/assets/dev-host/chunks/progress-RBCJRVM7.js +2 -0
- package/assets/dev-host/chunks/radio-group-NJWXZCX3.js +2 -0
- package/assets/dev-host/chunks/resizable-XF4P6OKR.js +2 -0
- package/assets/dev-host/chunks/rich-text-7OMYZ564.js +2 -0
- package/assets/dev-host/chunks/rich-text-editor-T6KWD4P3.js +2 -0
- package/assets/dev-host/chunks/scroll-row-LMI7JCFR.js +2 -0
- package/assets/dev-host/chunks/select-F3MZWTTS.js +2 -0
- package/assets/dev-host/chunks/separator-JRJYKM4Z.js +2 -0
- package/assets/dev-host/chunks/sheet-EXRT4MFB.js +2 -0
- package/assets/dev-host/chunks/side-panel-IBHLEANN.js +2 -0
- package/assets/dev-host/chunks/sidebar-VKQMQMF2.js +2 -0
- package/assets/dev-host/chunks/skeleton-KIRVQ4EO.js +2 -0
- package/assets/dev-host/chunks/slider-XKYDL5MR.js +2 -0
- package/assets/dev-host/chunks/sortable.esm-3VPY5PX7.js +2 -0
- package/assets/dev-host/chunks/split-button-WP6LALDS.js +2 -0
- package/assets/dev-host/chunks/stepper-KR6PXZHW.js +2 -0
- package/assets/dev-host/chunks/switch-P6NJELJJ.js +2 -0
- package/assets/dev-host/chunks/tabs-PFPRJNVZ.js +2 -0
- package/assets/dev-host/chunks/textarea-2JXA5XWS.js +2 -0
- package/assets/dev-host/chunks/toggle-group-PS7JN2JM.js +2 -0
- package/assets/dev-host/chunks/tooltip-S4RBC3O4.js +2 -0
- package/assets/dev-host/chunks/tree-NQF6ZJLH.js +2 -0
- package/assets/dev-host/chunks/utilities.esm-YYZNDLV4.js +2 -0
- package/assets/dev-host/css/shadcn-tailwind.css +637 -0
- package/assets/dev-host/css/tw-animate.css +1 -0
- package/assets/dev-host/kit-candidates.json +1 -0
- package/assets/dev-host/kit-manifest.json +435 -0
- package/assets/forge-app/THIRD_PARTY_NOTICES.txt +5283 -0
- package/assets/forge-app/app/assets/_forge-shiki-langs-BtmKnsX8.js +2 -0
- package/assets/forge-app/app/assets/andromeeda-CWX9QkEw.js +1 -0
- package/assets/forge-app/app/assets/appendItems-D8y87kIw.js +10 -0
- package/assets/forge-app/app/assets/aurora-x-C7LW0A0Z.js +1 -0
- package/assets/forge-app/app/assets/ayu-dark-UyEq0fEv.js +1 -0
- package/assets/forge-app/app/assets/ayu-light-BGLrZRfL.js +1 -0
- package/assets/forge-app/app/assets/ayu-mirage-DU2uuvme.js +1 -0
- package/assets/forge-app/app/assets/catppuccin-frappe-Ba2J56Xe.js +1 -0
- package/assets/forge-app/app/assets/catppuccin-latte-Du_f_kXm.js +1 -0
- package/assets/forge-app/app/assets/catppuccin-macchiato-DAr1oMDX.js +1 -0
- package/assets/forge-app/app/assets/catppuccin-mocha-F6YLrtz0.js +1 -0
- package/assets/forge-app/app/assets/core-pm_tYnN8.js +12 -0
- package/assets/forge-app/app/assets/css-C8fQr_0Q.js +1 -0
- package/assets/forge-app/app/assets/dark-plus-2IOGu4uA.js +1 -0
- package/assets/forge-app/app/assets/diff-view-KCzB8C4U.js +28 -0
- package/assets/forge-app/app/assets/diff-woXpYk--.js +1 -0
- package/assets/forge-app/app/assets/dracula-DZjgIiCY.js +1 -0
- package/assets/forge-app/app/assets/dracula-soft-Buj7Kmgw.js +1 -0
- package/assets/forge-app/app/assets/engine-javascript-C4Jk_eU2.js +141 -0
- package/assets/forge-app/app/assets/engine-oniguruma-D--T0LcV.js +1 -0
- package/assets/forge-app/app/assets/everforest-dark-Lvcw1Pr0.js +1 -0
- package/assets/forge-app/app/assets/everforest-light-YrYDdHjZ.js +1 -0
- package/assets/forge-app/app/assets/file-panel-BKKQ3JJL.js +1199 -0
- package/assets/forge-app/app/assets/formatCSSVariablePrefix-KRh9vnZf.js +1 -0
- package/assets/forge-app/app/assets/github-dark-CdJXf8Kw.js +1 -0
- package/assets/forge-app/app/assets/github-dark-default-BqPxBNAT.js +1 -0
- package/assets/forge-app/app/assets/github-dark-dimmed-DyY5b2F0.js +1 -0
- package/assets/forge-app/app/assets/github-dark-high-contrast-xd2ezW53.js +1 -0
- package/assets/forge-app/app/assets/github-light-CX58plA4.js +1 -0
- package/assets/forge-app/app/assets/github-light-default-DKbnGXTT.js +1 -0
- package/assets/forge-app/app/assets/github-light-high-contrast-uBB_OJ7x.js +1 -0
- package/assets/forge-app/app/assets/gruvbox-dark-hard-4xwr00-8.js +1 -0
- package/assets/forge-app/app/assets/gruvbox-dark-medium-CpS6Oukh.js +1 -0
- package/assets/forge-app/app/assets/gruvbox-dark-soft-CgQlpZ36.js +1 -0
- package/assets/forge-app/app/assets/gruvbox-light-hard-o8ZwY_jI.js +1 -0
- package/assets/forge-app/app/assets/gruvbox-light-medium-BOAI5TwH.js +1 -0
- package/assets/forge-app/app/assets/gruvbox-light-soft-DYjh34qH.js +1 -0
- package/assets/forge-app/app/assets/highlights-dvwIMyOh.js +7 -0
- package/assets/forge-app/app/assets/horizon-BJ3G7U7Q.js +1 -0
- package/assets/forge-app/app/assets/horizon-bright-onknclPd.js +1 -0
- package/assets/forge-app/app/assets/houston-CzdgljLR.js +1 -0
- package/assets/forge-app/app/assets/html-wSbaAAK3.js +1 -0
- package/assets/forge-app/app/assets/index-BwYJlfwT.css +1 -0
- package/assets/forge-app/app/assets/index-DgB2FK2g.js +291 -0
- package/assets/forge-app/app/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/assets/forge-app/app/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/assets/forge-app/app/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/assets/forge-app/app/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/assets/forge-app/app/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/assets/forge-app/app/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/assets/forge-app/app/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/assets/forge-app/app/assets/javascript-BgS3c2Ky.js +1 -0
- package/assets/forge-app/app/assets/json-qhed-kSA.js +1 -0
- package/assets/forge-app/app/assets/jsonc-CYpm1nAK.js +1 -0
- package/assets/forge-app/app/assets/jsx-Bz0zcwM4.js +1 -0
- package/assets/forge-app/app/assets/kanagawa-dragon-BQVheBBo.js +1 -0
- package/assets/forge-app/app/assets/kanagawa-lotus-CPemrbqC.js +1 -0
- package/assets/forge-app/app/assets/kanagawa-wave-CoCEno9V.js +1 -0
- package/assets/forge-app/app/assets/laserwave-B5bEuTwe.js +1 -0
- package/assets/forge-app/app/assets/lib-BOh9Tw1y.js +1 -0
- package/assets/forge-app/app/assets/light-plus-BZZlmvcU.js +1 -0
- package/assets/forge-app/app/assets/loader-DUZOP7q_.js +1 -0
- package/assets/forge-app/app/assets/markdown-BYOwaDjH.js +1 -0
- package/assets/forge-app/app/assets/material-theme-aeHmkUm6.js +1 -0
- package/assets/forge-app/app/assets/material-theme-darker-0axHxn5k.js +1 -0
- package/assets/forge-app/app/assets/material-theme-lighter-BsSyB7lm.js +1 -0
- package/assets/forge-app/app/assets/material-theme-ocean-BVrhCaVf.js +1 -0
- package/assets/forge-app/app/assets/material-theme-palenight-C7ZR4CGM.js +1 -0
- package/assets/forge-app/app/assets/min-dark-BKaXaz6D.js +1 -0
- package/assets/forge-app/app/assets/min-light-CF3GufC7.js +1 -0
- package/assets/forge-app/app/assets/monokai-CkP2YA7x.js +1 -0
- package/assets/forge-app/app/assets/night-owl-BWMbd2rn.js +1 -0
- package/assets/forge-app/app/assets/night-owl-light-C_TsrL-a.js +1 -0
- package/assets/forge-app/app/assets/nord-62p94tpv.js +1 -0
- package/assets/forge-app/app/assets/one-dark-pro-DUBUnUMB.js +1 -0
- package/assets/forge-app/app/assets/one-light-CqcpbeDc.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-CFuQzxDG.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-DMS-zpcK.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-protanopia-deuteranopia-BSiWRjoV.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-protanopia-deuteranopia-Ddq4E1VN.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-soft-BMbLOt5W.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-soft-BUesjllf.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-tritanopia-BGSLfXJy.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-tritanopia-CX9_YYVl.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-vibrant-Dlj8tZff.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-vibrant-bYj7HUnF.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-BHq6aQNU.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-DGR1TxHn.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-protanopia-deuteranopia-ChtB5hGy.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-protanopia-deuteranopia-xNu39ZI5.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-soft-BmBpKxVJ.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-soft-DTxn6Rur.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-tritanopia-DF_s91q9.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-tritanopia-DyKDz8Fz.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-vibrant-BEba13rj.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-vibrant-DsCzsubQ.js +1 -0
- package/assets/forge-app/app/assets/plastic-baAbzXTu.js +1 -0
- package/assets/forge-app/app/assets/poimandres-64TexMzA.js +1 -0
- package/assets/forge-app/app/assets/red-cnNTP7m6.js +1 -0
- package/assets/forge-app/app/assets/rose-pine-Dcg36Rqi.js +1 -0
- package/assets/forge-app/app/assets/rose-pine-dawn-Sx7X9we0.js +1 -0
- package/assets/forge-app/app/assets/rose-pine-moon-CoglSunF.js +1 -0
- package/assets/forge-app/app/assets/shellscript-CLZ0U2zV.js +1 -0
- package/assets/forge-app/app/assets/shiki-BghTRNDM.js +2 -0
- package/assets/forge-app/app/assets/slack-dark-C86YGzJx.js +1 -0
- package/assets/forge-app/app/assets/slack-ochin-DPmXYTYk.js +1 -0
- package/assets/forge-app/app/assets/snazzy-light-BD8dOedc.js +1 -0
- package/assets/forge-app/app/assets/solarized-dark-Bs7TdbJI.js +1 -0
- package/assets/forge-app/app/assets/solarized-light-DXYdl5LH.js +1 -0
- package/assets/forge-app/app/assets/stream-tokenizer-BzA0VElt.js +4 -0
- package/assets/forge-app/app/assets/synthwave-84-JFh1mrS8.js +1 -0
- package/assets/forge-app/app/assets/terminal-view-BdvNEDWd.js +16 -0
- package/assets/forge-app/app/assets/terminal-view-BrP-ENHg.css +1 -0
- package/assets/forge-app/app/assets/themes-D3CUotbU.js +2 -0
- package/assets/forge-app/app/assets/tokyo-night-BLjaCl8e.js +1 -0
- package/assets/forge-app/app/assets/tsx-udAQXfEw.js +1 -0
- package/assets/forge-app/app/assets/typescript-bsJCZSQ-.js +1 -0
- package/assets/forge-app/app/assets/useNextRenderData-BaDffqa5.js +149 -0
- package/assets/forge-app/app/assets/utils-C9Glzetk.js +2 -0
- package/assets/forge-app/app/assets/vesper-DZzlHXr_.js +1 -0
- package/assets/forge-app/app/assets/vitesse-black-BRf870Fc.js +1 -0
- package/assets/forge-app/app/assets/vitesse-dark-B9ZPQf4u.js +1 -0
- package/assets/forge-app/app/assets/vitesse-light-1s3aLQn3.js +1 -0
- package/assets/forge-app/app/assets/wasm-4KdTHw0F.js +1 -0
- package/assets/forge-app/app/assets/yaml-rwi0_p6S.js +1 -0
- package/assets/forge-app/app/favicon.svg +1 -0
- package/assets/forge-app/app/index.html +23 -0
- package/assets/forge-app/server.mjs +86999 -0
- package/dist/cli.mjs +7724 -3293
- package/package.json +9 -3
- package/skills/react-portal/SKILL.md +3 -2
|
@@ -0,0 +1,1199 @@
|
|
|
1
|
+
import{$t as e,A as t,At as n,B as r,Bt as i,Ct as a,Dt as o,E as s,Et as c,Ft as l,G as u,Gt as d,Ht as f,I as p,It as m,J as h,Jt as g,Kt as _,Lt as v,Mt as y,N as b,Nt as x,Ot as S,P as C,Pt as w,Qt as T,Rt as E,St as D,T as ee,Tt as O,U as k,Ut as te,Vt as A,W as j,Wt as ne,Xt as M,Yt as N,Zt as re,_ as ie,_t as ae,a as oe,an as se,at as ce,b as le,bt as ue,c as de,cn as fe,ct as pe,d as me,dn as he,dt as ge,en as _e,f as ve,ft as ye,g as be,gt as xe,h as Se,ht as Ce,i as we,in as Te,it as Ee,jt as De,kt as Oe,l as ke,ln as P,lt as Ae,m as je,mt as Me,n as Ne,nn as Pe,o as Fe,on as Ie,ot as Le,p as Re,pn as ze,pt as Be,qt as Ve,r as He,rn as Ue,rt as We,sn as Ge,st as Ke,t as qe,tn as Je,u as Ye,un as Xe,ut as Ze,v as Qe,vt as $e,wt as et,xt as tt,y as nt,yt as rt,z as it,zt as at}from"./index-DgB2FK2g.js";import{$ as ot,$t as st,A as ct,At as lt,B as ut,Bt as dt,C as ft,Ct as pt,D as F,Dt as I,E as mt,Et as ht,F as gt,Ft as _t,G as vt,Gt as yt,H as bt,Ht as xt,I as St,It as L,J as Ct,Jt as wt,K as Tt,Kt as Et,L as Dt,Lt as Ot,M as kt,Mt as At,N as jt,Nt as Mt,O as Nt,Ot as Pt,P as Ft,Pt as It,Q as Lt,Qt as Rt,R as zt,Rt as Bt,S as Vt,St as Ht,T as Ut,Tt as Wt,U as Gt,Ut as Kt,V as R,Vt as qt,W as Jt,Wt as Yt,X as Xt,Xt as Zt,Y as Qt,Yt as $t,Z as en,Zt as tn,_ as nn,_t as rn,a as an,at as on,b as sn,bt as cn,c as ln,ct as un,d as dn,dt as fn,en as pn,et as mn,f as hn,ft as gn,g as _n,gt as vn,h as yn,ht as bn,i as xn,j as Sn,k as Cn,kt as wn,lt as Tn,mt as En,n as Dn,nt as On,o as kn,ot as An,p as jn,pt as Mn,q as Nn,qt as Pn,r as Fn,rt as In,s as Ln,st as Rn,t as zn,tn as Bn,tt as Vn,u as Hn,ut as Un,v as Wn,vt as Gn,w as Kn,wt as qn,x as Jn,xt as Yn,y as Xn,yt as Zn,z as Qn,zt as $n}from"./useNextRenderData-BaDffqa5.js";import{a as er,c as tr,d as nr,l as z,n as rr,o as ir,r as ar,s as or,t as B,u as sr}from"./utils-C9Glzetk.js";import{f as cr,l as lr,n as ur,p as dr,t as fr,u as pr}from"./appendItems-D8y87kIw.js";function mr(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var hr=class extends Ue{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,Pe.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!Ie(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(mr(e,n).forEach(e=>{e.destroy()}),mr(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=se(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Je(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&Pe.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},V=ze(Xe(),1);function gr({queries:t,...n},r){let i=Ge(r),a=_e(),o=e(),s=n.subscribed!==!1,c=V.useMemo(()=>t.map(e=>{let t=i.defaultQueryOptions(e);return t._optimisticResults=a?`isRestoring`:s?`optimistic`:void 0,t}),[t,i,a,s]);c.forEach(e=>{Ve(e);let t=i.getQueryCache().get(e.queryHash);M(e,o,t)}),T(o);let[l]=V.useState(()=>new hr(i,c,n)),[u,d,f]=l.getOptimisticResult(c,n.combine);V.useEffect(()=>{l.setQueries(c,n)},[c,n,l]);let p=!a&&s;V.useSyncExternalStore(V.useCallback(e=>p?l.subscribe(Pe.batchCalls(e)):Te,[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult());let m=u.some((e,t)=>N(c[t],e))?u.flatMap((e,t)=>{let n=c[t];if(n&&N(n,e)){let e=new Je(i,n);return g(n,e,o)}return[]}):[];if(m.length>0)throw Promise.all(m);let h=u.find((e,t)=>{let n=c[t];return n&&re({result:e,errorResetBoundary:o,throwOnError:n.throwOnError,query:i.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(h)throw h.error;return d(f())}var _r={name:`chevrons-down-up`,size:24,node:[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]};_r.node;var vr=at(_r),yr={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};yr.node;var br=at(yr),xr=`file-tree-container`,Sr=`data-file-tree-style`,Cr=`data-file-tree-unsafe-css`,wr=`data-file-tree-scrollbar-measure`,Tr=`data-file-tree-scrollbar-gutter-measured`,Er=`--trees-scrollbar-gutter-measured`,Dr=`header`,Or=`context-menu`,kr=`context-menu-trigger`,Ar={compositeOverBg:Pn,contrastRatio:wt,deriveMutedFg:$t,hoverWouldEraseText:Zt,isDarkSurface:tn,isFullyTransparent:Rt,pickReadableForeground:st,relativeLuminance:pn,surfacesMatch:Bn},jr=Object.freeze({searchPlaceholder:`Search…`,contextMenuTrigger:`Options`,renameItem:e=>`Rename ${e}`,gitStatusTitles:Object.freeze({added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`}),containsGitStatusTitle:`Contains git status items`});function Mr(e){if(e==null)return jr;let t=jr,n=e.gitStatusTitles;return{searchPlaceholder:e.searchPlaceholder??t.searchPlaceholder,contextMenuTrigger:e.contextMenuTrigger??t.contextMenuTrigger,renameItem:e.renameItem??t.renameItem,gitStatusTitles:n==null?t.gitStatusTitles:{added:n.added??t.gitStatusTitles.added,deleted:n.deleted??t.gitStatusTitles.deleted,ignored:n.ignored??t.gitStatusTitles.ignored,modified:n.modified??t.gitStatusTitles.modified,renamed:n.renamed??t.gitStatusTitles.renamed,untracked:n.untracked??t.gitStatusTitles.untracked},containsGitStatusTitle:e.containsGitStatusTitle??t.containsGitStatusTitle}}var Nr=5,Pr=32,Fr=128;function Ir(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Lr(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Rr(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function zr(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function Br(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function Vr(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function Hr(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,Kr(e,t)}function Ur(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=zr(e).get(t);if(i===void 0)return;let a=i>>Nr;e.childVisibleChunkSums[a]+=r}function Wr(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=qr(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=Pr}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function Gr(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>Nr;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<Nr}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function Kr(e,t){if(t.childIds.length<Fr){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/Pr),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>Nr]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function qr(e,t,n,r){let i=Math.min(t.childIds.length,n+Pr),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var Jr=7,Yr=3,Xr=8,Zr=4;function Qr(e,t,n=0){return e<<Zr|n<<Yr|t}function $r(e){return e.depthAndFlags>>>Zr}function ei(e){return(e.depthAndFlags&Xr)>>Yr}function H(e){return(e.depthAndFlags&Xr)!==0}function ti(e){return e.depthAndFlags&Jr}function ni(e,t){return(ti(e)&t)!==0}function ri(e,t){e.depthAndFlags|=t}function ii(e,t){e.depthAndFlags=Qr(t,ti(e),ei(e))}var ai=Symbol(`benchmarkInstrumentation`);function oi(e,t){return t==null||Object.defineProperty(e,ai,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function si(e){return e==null?null:e[ai]??null}function U(e,t,n){return e==null?n():e.measurePhase(t,n)}function ci(e,t,n){Number.isFinite(n)&&e!=null&&e.setCounter(t,n)}function li(e){return e>=48&&e<=57}function ui(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!li(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&li(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function di(e){let t=e.toLowerCase();return{lowerValue:t,tokens:ui(t)}}function fi(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function pi(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=fi(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function mi(e,t,n){let r=pi(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function hi(e,t){return mi(e,t,di)}function gi(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function _i(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=gi(e,r);return a===gi(t,r)?hi(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function vi(e,t){return _i(e,t)}function yi(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=di(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=gi(e,n);return o===gi(t,n)?mi(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function bi(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=di(e.valueById[t]);return e.sortKeyById[t]=r,r}function xi(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Si(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function Ci(e){let{hasTrailingSlash:t,segments:n}=Si(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function wi(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Si(e);return{requiresDirectory:t,segments:n}}function Ti(){let e=new Map;return e.set(``,0),{idByValue:e,valueById:[``],sortKeyById:[di(``)]}}function Ei(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function Di(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var Oi=Symbol(`pathStorePreparedInputKind`);function ki(e,t){return e[Oi]=t,e}function Ai(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function ji(e,t,n){return n==="default"?vi(e,t):n(Ai(e),Ai(t))}function Mi(){return{depthAndFlags:Qr(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function Ni(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function Pi(e){return e.isDirectory?e.segments.length:e.segments.length-1}function Fi(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function Ii(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function Li(e,t={}){return Ui(e,t).map(e=>e.path)}function Ri(e,t={}){let n=Ui(e,t);return ki({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function zi(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return ki({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function Bi(e){let t=e,n=t.preparedPaths;if(t[Oi]===`prepared`&&n!=null)return n;if(!Fi(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function Vi(e){let t=e;return t[Oi]===`presorted`&&t.presortedPaths!=null||Ii(t.presortedPaths)?t.presortedPaths:null}function Hi(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function Ui(e,t={}){let n=xi(t),r=si(t);ci(r,`workload.inputFiles`,e.length);let i=U(r,`store.preparePathEntries.parse`,()=>e.map(e=>Ci(e)));return U(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>ji(e,t,n.sort))),i}var Wi=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[Mi()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=Ti();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=si(e),this.options=xi(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,Ir())}appendPaths(e){return U(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>Ci(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,U(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return U(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null){if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:Qr(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:Qr(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d,m=a+1}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:Qr(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=Ci(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null){if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:Qr(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:Qr(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=Ci(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(U(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||U(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?yi(this.lastPreparedPath,e,this.segmentSortKeyCache):ji(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=Pi(e),i=n==null?0:Pi(n),a=n==null?0:Ni(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=Ei(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:Qr($r(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),Br(i,s),s}createFileChildUnchecked(e,t){let n=Ei(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Qr($r(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Br(r,a),a}getOrCreateDirectoryChild(e,t){let n=Ei(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!H(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Qr($r(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Br(r,a),this.directories.set(a,Ir()),a}createDirectoryChild(e,t){let n=Ei(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Qr($r(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Br(r,a),this.directories.set(a,Ir()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!H(n))throw Error(`Path is not a directory: "${t}"`);if(ni(n,1))throw Error(`Duplicate path: "${t}"`);ri(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,Lr());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(H(a)){let t=Lr();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;H(n)&&this.directories.set(t,Ir());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),Br(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!H(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return Hr(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function Gi(e,t=`closed`,n=null){let r=qi(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function Ki(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function qi(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function Ji(e,t){return ni(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion!==`closed`&&$r(t)<=e.defaultExpansion}function Yi(e,t,n=e.snapshot.nodes[t]){return n==null||!H(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:Ji(e,n)}function Xi(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!H(r))return;let i=Ji(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t)}else i?(e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0):e.expandedDirectoryIds.delete(t)}function Zi(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function Qi(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function $i(e,t){let n=Zi(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function ea(e,t){let n=Zi(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function ta(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function na(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function ra(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function ia(e,t){e.directoryLoadInfoById.delete(t)}function aa(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function oa(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function sa(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function ca(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function la(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function ua(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function da(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function fa(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function pa(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function ma(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function ha(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function ga(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function _a(e,t,n){return{...n,visibleCountDelta:Oa(e)-t}}function va(e,t){let n=Oa(e),r=Ki();e.transactionStack.push(r);try{t()}catch(t){throw xa(e,r,!1),t}xa(e,r,!0,Oa(e)-n)}function ya(e,t){let n=e.instrumentation;n==null?ba(e,t):U(n,`store.events.record`,()=>ba(e,t))}function ba(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;n==null?Ea(e,t):(n.events.push(t),Ta(n,t))}function xa(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?wa(i,t):U(n,`store.events.batch.merge`,()=>wa(i,t));return}let a=Sa(t,r),o=e.instrumentation;o==null?Ea(e,a):U(o,`store.events.batch.commit`,()=>Ea(e,a))}function Sa(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function Ca(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function wa(e,t){for(let n of t.events)e.events.push(n);Ca(e,t)}function Ta(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function Ea(e,t){let n=e.instrumentation;n==null?Da(e,t):U(n,`store.events.emit`,()=>Da(e,t))}function Da(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function Oa(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function ka(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!H(n)||ni(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!H(a)?null:i}function Aa(e,t){let n=t;for(;;){let t=ka(e,n);if(t==null)return n;n=t}}function ja(e,t){let n=[t],r=t;for(;;){let t=ka(e,r);if(t==null)return n;n.push(t),r=t}}function Ma(e,t){let n=t==null?e.snapshot.rootId:Va(e,t);return n==null?[]:Ua(e,n)}function Na(e,t){let n=Ci(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=io(e,ro(e,r)),{createdNodeIds:a,directoryId:o}=Wa(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=K(e,o);if(ni(n,1))throw Error(`Path already exists: "${t}"`);ri(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=Ka(e,o,n.basename),s.add(c);Ra(e,o);let l=io(e,o);return oa({affectedAncestorIds:Ba(e,c),affectedNodeIds:[...s],path:t,projectionChanged:ao(i,l)})}function Pa(e,t,n){let r=Va(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=K(e,r);if(ni(i,2))throw Error(`The root node cannot be removed`);if(H(i)&&G(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=io(e,a),s=to(e,r);Ya(e,a,r,i.nameId),no(e,a),Ra(e,a);let c=io(e,a);return sa({affectedAncestorIds:Ba(e,a),affectedNodeIds:s,path:t,projectionChanged:ao(o,c),recursive:n.recursive===!0})}function Fa(e,t,n,r){let i=Va(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=K(e,i);if(ni(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=$a(e,i,n),c=io(e,a.parentId),l=io(e,s.parentId),u=Di(e.snapshot.segmentTable,a.nameId),d=Ei(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(H(a)&&lo(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=Rr(e.snapshot.nodes,G(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&eo(e,p,o,ei(a))===`skip`)return null;let m=a.parentId;Ya(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),co(e,i),Ja(e,s.parentId,i),no(e,m),e.pathCacheVersion++,Ra(e,m),s.parentId!==m&&Ra(e,s.parentId);let h=io(e,m),g=io(e,s.parentId);return ca({affectedAncestorIds:[...new Set([...Ba(e,m),...Ba(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:oo([c,l],[h,g]),to:W(e,i)})}function Ia(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function La(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function W(e,t){let n=K(e,t),r=Ia(e,t);if(r!=null)return r;if(ni(n,2))return La(e,t,``);let i=W(e,n.parentId),a=Di(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return La(e,t,H(n)?`${o}/`:o)}function Ra(e,t){let n=e.instrumentation;n==null?fo(e,t):U(n,`store.recomputeCountsUpwardFrom`,()=>fo(e,t))}function za(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!H(o)){uo(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){uo(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function Ba(e,t){let n=[],r=t;for(;r!=null;){let t=K(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function Va(e,t){if(t.length===0)return e.snapshot.rootId;let n=wi(t);return Ha(e,n.segments,n.requiresDirectory)}function Ha(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=G(e,r),a=Rr(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=K(e,r);return n&&!H(i)?null:r}function G(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function K(e,t){let n=e.snapshot.nodes[t];if(n===void 0||ni(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function Ua(e,t){let n=e.snapshot.nodes[t];if(n===void 0||ni(n,4))return[];if(!H(n))return[W(e,t)];if(G(e,t).childIds.length===0)return ni(n,1)&&!ni(n,2)?[W(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||ni(n,4)){i.pop();continue}if(!H(n)){r.push(W(e,t.nodeId)),i.pop();continue}let a=G(e,t.nodeId);if(a.childIds.length===0){ni(n,1)&&!ni(n,2)&&r.push(W(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];o==null?i.pop():(t.childIndex++,i.push({childIndex:0,nodeId:o}))}return r}function Wa(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=Ei(e.snapshot.segmentTable,i),a=G(e,r),o=Rr(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!H(K(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o}else r=Ga(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function Ga(e,t,n){let r=K(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Qr($r(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,Ir()),Ja(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function Ka(e,t,n){let r=Ei(e.snapshot.segmentTable,n),i=G(e,t);if(Rr(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${mo(e,t,n)}"`);let a=K(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Qr($r(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),Ja(e,t,o),e.activeNodeCount++,o}function qa(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];o==null||Xa(e,n,o)<0?i=a:r=a+1}return r}function Ja(e,t,n){let r=G(e,t),i=K(e,n);Rr(e.snapshot.nodes,r).set(i.nameId,n),Ur(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=qa(e,r,n);r.childIds.splice(a,0,n),Vr(r,a),Kr(e.snapshot.nodes,r)}function Ya(e,t,n,r){let i=G(e,t),a=zr(i),o=a.get(n)??-1;Rr(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Ur(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),Vr(i,o),Kr(e.snapshot.nodes,i))}function Xa(e,t,n){let r=e.snapshot.options.sort;return r==="default"?Za(e,t,n):r(Qa(e,t),Qa(e,n))}function Za(e,t,n){let r=K(e,t),i=K(e,n),a=H(r);if(a!==H(i))return a?-1:1;let o=pi(bi(e.snapshot.segmentTable,r.nameId),bi(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=Di(e.snapshot.segmentTable,r.nameId),c=Di(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function Qa(e,t){let n=K(e,t),r=W(e,t),i=H(n),a=i?r.slice(0,-1):r;return{basename:Di(e.snapshot.segmentTable,n.nameId),depth:$r(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function $a(e,t,n){let r=K(e,t),i=Va(e,n);if(i!=null){let t=K(e,i);if(H(t))return{basename:Di(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=wi(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=wi(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:Ha(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function eo(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${W(e,t)}"`);let i=K(e,t);if(ei(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(H(i)&&G(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return to(e,t),Ya(e,a,t,o),no(e,a),Ra(e,a),`handled`}function to(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=K(e,t.nodeId);if(t.visitedChildren||!H(i)){H(i)&&e.snapshot.directories.delete(t.nodeId),ri(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),ia(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=G(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function no(e,t){let n=t;for(;n!=null;){let t=K(e,n);if(!H(t)||ni(t,2)||G(e,n).childIds.length>0)return;ri(t,1),n=t.parentId===n?null:t.parentId}}function ro(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=Rr(e.snapshot.nodes,G(e,n)).get(t);if(i==null||!H(K(e,i)))break;n=i}return n}function io(e,t){let n=so(e,t);if(n==null)return null;let r=Aa(e,n),i=K(e,r),a=n===r?null:ja(e,n).map(t=>W(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:G(e,r).childIds.length>0,path:W(e,r),terminalKind:ei(i)})}function ao(e,t){return oo([e],[t])}function oo(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function so(e,t){let n=t;for(;n!=null;){let t=K(e,n);if(!H(t)||ni(t,2))return null;if(!Yi(e,n,t))return n;n=t.parentId}return null}function co(e,t){let n=K(e,t);if(ii(n,(t===e.snapshot.rootId?-1:$r(K(e,n.parentId)))+1),!H(n))return;let r=G(e,t);for(let t of r.childIds)co(e,t)}function lo(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=K(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function uo(e,t,n=K(e,t),r=!1){let i=e.instrumentation;i==null?po(e,t,n,r):U(i,`store.recomputeNodeCounts`,()=>po(e,t,n,r))}function fo(e,t){let n=t;for(;n!=null;){let t=K(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(uo(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Ur(G(e,s),n,a,o),n=s}}function po(e,t,n,r){if(!H(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=G(e,t);if(r){let t=e.instrumentation;t==null?Hr(e.snapshot.nodes,i):U(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>Hr(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;n.subtreeNodeCount=a,n.visibleSubtreeCount=ni(n,2)?o:ka(e,t)==null?Yi(e,t,n)?1+o:1:o}function mo(e,t,n){let r=W(e,t);return r.length===0?n:`${r}${n}`}function ho(e){return e!=null&&!ni(e,4)}function go(e,t){let n=e.snapshot.nodes[t];return!ho(n)||!H(n)||ni(n,2)?null:n}function _o(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&ho(e.snapshot.nodes[n])&&(t+=1);return t}function vo(e){return Math.max(0,e.valueById.length-1)}function yo(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:_o(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:vo(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function bo(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function xo(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)go(e,n)!=null&&t.push(W(e,n));for(let t of e.expandedDirectoryIds)go(e,t)!=null&&n.push(W(e,t));return{collapsedPaths:t,expandedPaths:n}}function So(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)go(e,n)!=null&&Qi(e,n)!==`loaded`&&t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:W(e,n)});return t}function Co(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=Va(e,n);t!=null&&Xi(e,t,!0,K(e,t))}for(let n of t.collapsedPaths){let t=Va(e,n);t!=null&&Xi(e,t,!1,K(e,t))}}function wo(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=Va(e,n.path);t!=null&&go(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function To(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function Eo(e){let t=e.snapshot.segmentTable,n=Ti();for(let r of e.snapshot.nodes)ho(r)&&(r.nameId=ni(r,2)?0:Ei(n,Di(t,r.nameId)));e.snapshot.segmentTable=n}function Do(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!ho(r)||!H(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return ho(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[K(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),Hr(e.snapshot.nodes,n)}}function Oo(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId&&!ho(e.snapshot.nodes[t]);)--t;e.snapshot.nodes.length=t+1}function ko(e){let t=xo(e),n=So(e);U(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>To(e)),U(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>Eo(e)),U(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>Do(e)),U(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>Oo(e)),U(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>Co(e,t)),U(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>wo(e,n)),U(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>za(e,e.snapshot.rootId))}function Ao(e){let t=xo(e),n=So(e),r=U(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>Ma(e)),i=oi({...e.snapshot.options},e.instrumentation),a=U(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new Wi(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,U(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>Co(e,t)),U(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>wo(e,n)),U(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>za(e,e.snapshot.rootId))}function jo(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function Mo(e,t){let n=yo(e);t===`stable`?U(e.instrumentation,`store.cleanup.stable`,()=>ko(e)):U(e.instrumentation,`store.cleanup.aggressive`,()=>Ao(e));let r=yo(e);return bo(t,t===`stable`,n,r)}var No=64;function Po(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function Fo(e){return K(e,e.snapshot.rootId).visibleSubtreeCount}function Io(e,t,n,r){let i=K(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function Lo(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:ns(e,t.cursor),setSize:t.setSize,subtreeEndIndex:Io(e,t.cursor,t.index,n)}}function Ro(e,t,n,r,i,a){let o=G(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=Wr(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return zo(e,u,l,r+c,i+1,s,o.childIds.length,a)}function zo(e,t,n,r,i,a,o,s){if(!H(K(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=Xo(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=K(e,c.terminalNodeId);if(!H(l)||!Yi(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Ro(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function Bo(e,t){let n=Fo(e);if(t<0||t>=n)return null;let r=Ro(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>W(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=Lo(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:ns(e,r.cursor),setSize:r.setSize,subtreeEndIndex:Io(e,r.cursor,r.index,n)}}function Vo(e,t,n){let r=e.instrumentation,i=Fo(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return ts(e,o+1);let t=[],n=qo(e,a);for(let r=a;r<=o&&n!=null;r++){let r=ns(e,n);t.push(r),n=Qo(e,n)}return t}let s=[],c=0,l=0,u=U(r,`store.getVisibleSlice.selectFirstRow`,()=>qo(e,a));for(let t=a;t<=o&&u!=null;t++){let t=U(r,`store.getVisibleSlice.materializeRow`,()=>ns(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=U(r,`store.getVisibleSlice.advanceCursor`,()=>Qo(e,u))}return ci(r,`workload.visibleRowsRead`,s.length),ci(r,`workload.flattenedRowsRead`,c),ci(r,`workload.flattenedSegmentsRead`,l),s}function Ho(e,t=Fo(e)){let n=e.instrumentation;return n==null?es(e,t):U(n,`store.getVisibleTreeProjection`,()=>es(e,t))}function Uo(e){return $o(Ho(e))}function Wo(e,t){let n=Va(e,t);if(n==null||n===e.snapshot.rootId||H(K(e,n))&&Aa(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=K(e,i).parentId,n=G(e,t),s=zr(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=Gr(a,n,s),t!==o){let n=K(e,t),a=ka(e,t);if(!Yi(e,t,n)&&a!==i)return null;Aa(e,t)===t&&(r+=1)}i=t}return r}function Go(e,t){let n=Va(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=K(e,n);if(!H(r))throw Error(`Path is not a directory: "${t}"`);return Yi(e,n,r)?null:(Xi(e,n,!0,r),Ra(e,n),la({affectedAncestorIds:Ba(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function Ko(e,t){let n=Va(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=K(e,n);if(!H(r))throw Error(`Path is not a directory: "${t}"`);return Yi(e,n,r)?(Xi(e,n,!1,r),Ra(e,n),ua({affectedAncestorIds:Ba(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function qo(e,t){return t<0||t>=Fo(e)?null:Jo(e,e.snapshot.rootId,t,-1)}function Jo(e,t,n,r){let i=G(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?Wr(e.snapshot.nodes,i,n):U(a,`store.getVisibleSlice.selectChildIndex`,()=>Wr(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return Yo(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function Yo(e,t,n,r){if(!H(K(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=Xo(e,t,r);if(n===0)return i;let a=K(e,i.terminalNodeId);if(!H(a)||!Yi(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Jo(e,i.terminalNodeId,n-1,i.visibleDepth)}function Xo(e,t,n){return H(K(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:Aa(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:U(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>Aa(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Zo(e,t){let n=K(e,t);if(!H(n))return!0;let r=n.parentId;return r===e.snapshot.rootId||ka(e,r)!==t}function Qo(e,t){let n=K(e,t.terminalNodeId);if(H(n)){let r=G(e,t.terminalNodeId);if(Yi(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:Yo(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=K(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=G(e,n),o=zr(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return Yo(e,s,0,i);Zo(e,r)&&i--,r=n}}function $o(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function es(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(No);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=Po(o,y);let x,S=_;if(H(v))S=f?Aa(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:W(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}let C=o[y];r[s]=C,n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let w=c[S];w!=null&&H(w)&&Yi(e,S,w)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function ts(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!H(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:W(e,f)};continue}let h=l?Aa(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=ns(e,g);let _=i[h];_!=null&&H(_)&&Yi(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function ns(e,t){let n=K(e,t.terminalNodeId),r=H(n)?rs(e,t):null,i=W(e,t.terminalNodeId),a=Di(e.snapshot.segmentTable,n.nameId),o=H(n)&&G(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?ja(e,t.headNodeId).map(n=>{let r=K(e,n);return{isTerminal:n===t.terminalNodeId,name:Di(e.snapshot.segmentTable,r.nameId),nodeId:n,path:W(e,n)}}):U(c,`store.getVisibleSlice.flatten.collectSegments`,()=>ja(e,t.headNodeId).map(n=>{let r=K(e,n);return{isTerminal:n===t.terminalNodeId,name:Di(e.snapshot.segmentTable,r.nameId),nodeId:n,path:W(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:H(n)&&Yi(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:H(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function rs(e,t){if(t.headNodeId===t.terminalNodeId)return Qi(e,t.terminalNodeId);let n=ja(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=Qi(e,t);if(n===`loading`)return`loading`;n===`error`?i=!0:n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}var is=8;function as(e){let{nodes:t,directories:n,rootId:r,options:i}=e,a=t.length,o=new Int32Array(a),s=new Int32Array(a),c=new Int32Array(a),l=new Int32Array(a),u=new Int32Array(a),d=new Int32Array(a),f=new Int32Array(a);for(let e=0;e<a;e+=1){let n=t[e];n!=null&&(o[e]=n.parentId,s[e]=n.nameId,c[e]=n.depthAndFlags,l[e]=n.subtreeNodeCount,u[e]=n.visibleSubtreeCount)}let p=0;for(let e of n.values())p+=e.childIds.length;let m=new Int32Array(p),h=0;for(let[e,t]of n){let n=t.childIds;d[e]=h,f[e]=n.length;for(let e=0;e<n.length;e+=1)m[h]=n[e],h+=1}return{nodeCount:a,rootId:r,flattenEmptyDirectories:i.flattenEmptyDirectories===!0,parentId:o,nameId:s,depthAndFlags:c,subtreeNodeCount:l,visibleSubtreeCount:u,childStart:d,childCount:f,childIdsFlat:m}}function os(e){let{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:i,subtreeNodeCount:a,visibleSubtreeCount:o,childStart:s,childCount:c,childIdsFlat:l}=e;for(let e=t-1;e>=1;--e){if((i[e]&is)===0)continue;let t=s[e],n=c[e],u=0,d=0;for(let e=0;e<n;e+=1){let n=l[t+e];u+=a[n],d+=o[n]}a[e]=1+u;let f;f=r&&n===1?(i[l[t]]&is)===0?1+d:d:1+d,o[e]=f}let u=s[n],d=c[n],f=0,p=0;for(let e=0;e<d;e+=1){let t=l[u+e];f+=a[t],p+=o[t]}a[n]=1+f,o[n]=p}function ss(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!H(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&Kr(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&H(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,Kr(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function cs(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,i=as(e.snapshot);os(i);let a=i.subtreeNodeCount,o=i.visibleSubtreeCount;for(let e=0;e<n.length;e+=1){let t=n[e];t!=null&&(t.subtreeNodeCount=a[e],t.visibleSubtreeCount=o[e])}for(let[e,i]of t){let t=i.childIds,a=t.length,o=0,s=0;for(let e=0;e<a;e++){let r=t[e];if(r==null)continue;let i=n[r];o+=i.subtreeNodeCount,s+=i.visibleSubtreeCount}i.totalChildSubtreeNodeCount=o,i.totalChildVisibleSubtreeCount=s,(e===r||a>=128)&&Kr(n,i)}}function ls(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var us=class e{#e;constructor(e={}){let t=si(e),n=U(t,`store.builder.create`,()=>new Wi(e));if(e.preparedInput!=null){let t=Vi(e.preparedInput);t==null?n.appendPreparedPaths(Bi(e.preparedInput),!1):n.appendPresortedPaths(t,Hi(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(U(t,`store.preparePathEntries`,()=>Ui(r,e)))}let r=U(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=U(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=U(t,`store.state.create`,()=>Gi(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:U(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||ls(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&U(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?e.useSoaCountSweep===!0?U(t,`store.state.initializeOpenVisibleCountsViaSoa`,()=>cs(this.#e)):U(t,`store.state.initializeOpenVisibleCounts`,()=>ss(this.#e)):U(t,`store.state.recomputeCounts`,()=>za(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return Li(e,t)}static prepareInput(e,t={}){return Ri(e,t)}static preparePresortedInput(e){return zi(e)}list(e){return U(this.#e.instrumentation,`store.list`,()=>Ma(this.#e,e))}add(e){U(this.#e.instrumentation,`store.add`,()=>{let t=Fo(this.#e);ya(this.#e,_a(this.#e,t,Na(this.#e,e)))})}remove(e,t={}){U(this.#e.instrumentation,`store.remove`,()=>{let n=Fo(this.#e);ya(this.#e,_a(this.#e,n,Pa(this.#e,e,t)))})}move(e,t,n={}){U(this.#e.instrumentation,`store.move`,()=>{let r=Fo(this.#e),i=Fa(this.#e,e,t,n);i!=null&&ya(this.#e,_a(this.#e,r,i))})}batch(e){va(this.#e,()=>{if(typeof e==`function`)e(this);else for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision})}})}getVisibleCount(){return U(this.#e.instrumentation,`store.getVisibleCount`,()=>Fo(this.#e))}getVisibleSlice(e,t){return U(this.#e.instrumentation,`store.getVisibleSlice`,()=>Vo(this.#e,e,t))}getVisibleRowContext(e){return U(this.#e.instrumentation,`store.getVisibleRowContext`,()=>Bo(this.#e,e))}getVisibleTreeProjection(){return Uo(this.#e)}getVisibleTreeProjectionData(e){return Ho(this.#e,e)}getVisibleIndex(e){return U(this.#e.instrumentation,`store.getVisibleIndex`,()=>Wo(this.#e,e))}getPathInfo(e){return U(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=Va(this.#e,e);if(t==null)return null;let n=K(this.#e,t);return{depth:$r(n),kind:H(n)?`directory`:`file`,path:W(this.#e,t)}})}isExpanded(e){return U(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=K(this.#e,t);return Yi(this.#e,t,n)})}expand(e){U(this.#e.instrumentation,`store.expand`,()=>{let t=Fo(this.#e),n=Go(this.#e,e);n!=null&&ya(this.#e,_a(this.#e,t,n))})}collapse(e){U(this.#e.instrumentation,`store.collapse`,()=>{let t=Fo(this.#e),n=Ko(this.#e,e);n!=null&&ya(this.#e,_a(this.#e,t,n))})}on(e,t){return aa(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return Qi(this.#e,t)}markDirectoryUnloaded(e){U(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(G(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=Fo(this.#e);ea(this.#e,t),ya(this.#e,_a(this.#e,n,da({affectedAncestorIds:Ba(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return U(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=Fo(this.#e),r=$i(this.#e,t);return ya(this.#e,_a(this.#e,n,fa({affectedAncestorIds:Ba(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return U(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||Qi(this.#e,n)!==`loading`||!na(this.#e,n,e.attemptId))return!1;let r=W(this.#e,n);this.validateChildPatch(r,t);let i=Fo(this.#e),a=[];for(let e of t.operations){ds(r,e);let t=Fo(this.#e);switch(e.type){case`add`:a.push(_a(this.#e,t,Na(this.#e,e.path)));break;case`remove`:a.push(_a(this.#e,t,Pa(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=Fa(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(_a(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return ya(this.#e,_a(this.#e,i,pa({affectedAncestorIds:Ba(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:W(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return U(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=Fo(this.#e),r=ta(this.#e,t,e.attemptId);return ya(this.#e,_a(this.#e,n,ma({affectedAncestorIds:Ba(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:W(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return U(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=Fo(this.#e),i=ra(this.#e,n,e.attemptId,t);return ya(this.#e,_a(this.#e,r,ha({affectedAncestorIds:Ba(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:W(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return U(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(jo(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=Fo(this.#e),n=Mo(this.#e,e.mode??`stable`);return ya(this.#e,_a(this.#e,t,ga({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=G(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??di(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=pi(bi(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0||!H(K(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h)a=null,i=0,n.length=0,r.length=0;else for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=K(this.#e,n);Yi(this.#e,n,i)||(Xi(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=K(this.#e,e);if(!Yi(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=Va(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!H(K(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!H(K(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=K(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=K(this.#e,e),r=ka(this.#e,e);if(!Yi(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function ds(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`)}}var fs={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function ps(e,t){if(typeof e==`number`)return{itemHeight:t??fs.default.itemHeight,factor:e};let n=fs[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var ms=fs.default.itemHeight,hs=`@layer base {
|
|
2
|
+
:host {
|
|
3
|
+
--trees-accent: var(--trees-accent-override, #009fff);
|
|
4
|
+
--trees-fg: var(--trees-fg-override, var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1)));
|
|
5
|
+
--trees-fg-muted: var(--trees-fg-muted-override, var(--trees-theme-sidebar-header-fg, #84848a));
|
|
6
|
+
--trees-bg: var(--trees-bg-override, var(--trees-theme-sidebar-bg, light-dark(#f8f8f8, #141415)));
|
|
7
|
+
--trees-bg-muted: var(--trees-bg-muted-override, var(--trees-theme-list-hover-bg, light-dark(color-mix(in lab,
|
|
8
|
+
var(--trees-accent) var(--trees-bg-alpha-light, 8%),
|
|
9
|
+
var(--trees-bg)), color-mix(in lab,
|
|
10
|
+
var(--trees-accent) var(--trees-bg-alpha-dark, 10%),
|
|
11
|
+
var(--trees-bg)))));
|
|
12
|
+
--trees-input-bg: var(--trees-input-bg-override, light-dark(#f8f8f8, #070707));
|
|
13
|
+
--trees-added-light: #16a994;
|
|
14
|
+
--trees-added-dark: #00cab1;
|
|
15
|
+
--trees-ignored-light: #adadb1;
|
|
16
|
+
--trees-ignored-dark: #4a4a4e;
|
|
17
|
+
--trees-modified-light: #1ca1c7;
|
|
18
|
+
--trees-modified-dark: #08c0ef;
|
|
19
|
+
--trees-renamed-light: #d5a910;
|
|
20
|
+
--trees-renamed-dark: #ffd452;
|
|
21
|
+
--trees-untracked-light: #16a994;
|
|
22
|
+
--trees-untracked-dark: #00cab1;
|
|
23
|
+
--trees-deleted-light: #ff2e3f;
|
|
24
|
+
--trees-deleted-dark: #ff6762;
|
|
25
|
+
--trees-border-color: var(--trees-border-color-override, var(--trees-theme-sidebar-border, light-dark(#eeeeef, #070707)));
|
|
26
|
+
--trees-indent-guide-bg: var(--trees-indent-guide-bg-override, color-mix(in lab, var(--trees-fg-muted) 25%, transparent));
|
|
27
|
+
--trees-density: var(--trees-density-override, 1);
|
|
28
|
+
--trees-border-radius: var(--trees-border-radius-override, calc(6px * var(--trees-density)));
|
|
29
|
+
--trees-font-family: var(--trees-font-family-override, system-ui);
|
|
30
|
+
--trees-font-size: var(--trees-font-size-override, 13px);
|
|
31
|
+
--trees-font-weight-regular: var(--trees-font-weight-regular-override, 400);
|
|
32
|
+
--trees-font-weight-semibold: var(--trees-font-weight-semibold-override, 600);
|
|
33
|
+
--trees-focus-ring-color: var(--trees-focus-ring-color-override, var(--trees-theme-focus-ring, var(--trees-accent)));
|
|
34
|
+
--trees-focus-ring-width: var(--trees-focus-ring-width-override, 1px);
|
|
35
|
+
--trees-focus-ring-offset: var(--trees-focus-ring-offset-override, -1px);
|
|
36
|
+
--trees-search-fg: var(--trees-search-fg-override, var(--trees-theme-input-fg, var(--trees-fg)));
|
|
37
|
+
--trees-search-font-weight: var(--trees-search-font-weight-override, 600);
|
|
38
|
+
--trees-search-bg: var(--trees-search-bg-override, var(--trees-theme-input-bg, var(--trees-input-bg)));
|
|
39
|
+
--trees-scrollbar-thumb: var(--trees-scrollbar-thumb-override, var(--trees-theme-scrollbar-thumb, color-mix(in lab, var(--trees-fg) 25%, var(--trees-bg))));
|
|
40
|
+
--trees-selected-fg: var(--trees-selected-fg-override, var(--trees-theme-list-active-selection-fg, var(--trees-fg)));
|
|
41
|
+
--trees-selected-bg: var(--trees-selected-bg-override, var(--trees-theme-list-active-selection-bg, light-dark(color-mix(in lab, var(--trees-accent) 12%, var(--trees-bg)), color-mix(in lab, var(--trees-accent) 15%, var(--trees-bg)))));
|
|
42
|
+
--trees-selected-focused-border-color: var(--trees-selected-focused-border-color-override, var(--trees-theme-focus-ring, var(--trees-accent)));
|
|
43
|
+
--trees-status-added: var(--trees-status-added-override, var(--trees-theme-git-added-fg, light-dark(var(--trees-added-light), var(--trees-added-dark))));
|
|
44
|
+
--trees-status-ignored: var(--trees-status-ignored-override, var(--trees-theme-git-ignored-fg, light-dark(var(--trees-ignored-light), var(--trees-ignored-dark))));
|
|
45
|
+
--trees-status-modified: var(--trees-status-modified-override, var(--trees-theme-git-modified-fg, light-dark(var(--trees-modified-light), var(--trees-modified-dark))));
|
|
46
|
+
--trees-status-renamed: var(--trees-status-renamed-override, var(--trees-theme-git-renamed-fg, light-dark(var(--trees-renamed-light), var(--trees-renamed-dark))));
|
|
47
|
+
--trees-status-untracked: var(--trees-status-untracked-override, var(--trees-theme-git-untracked-fg, light-dark(var(--trees-untracked-light), var(--trees-untracked-dark))));
|
|
48
|
+
--trees-status-deleted: var(--trees-status-deleted-override, var(--trees-theme-git-deleted-fg, light-dark(var(--trees-deleted-light), var(--trees-deleted-dark))));
|
|
49
|
+
--trees-git-modified-color: var(--trees-git-modified-color-override, var(--trees-status-modified));
|
|
50
|
+
--trees-git-added-color: var(--trees-git-added-color-override, var(--trees-status-added));
|
|
51
|
+
--trees-git-ignored-color: var(--trees-git-ignored-color-override, var(--trees-status-ignored));
|
|
52
|
+
--trees-git-deleted-color: var(--trees-git-deleted-color-override, var(--trees-status-deleted));
|
|
53
|
+
--trees-git-renamed-color: var(--trees-git-renamed-color-override, var(--trees-status-renamed));
|
|
54
|
+
--trees-git-untracked-color: var(--trees-git-untracked-color-override, var(--trees-status-untracked));
|
|
55
|
+
--trees-icon-gray: light-dark(#84848a, #adadb1);
|
|
56
|
+
--trees-icon-red: light-dark(#d52c36, #ff6762);
|
|
57
|
+
--trees-icon-vermilion: light-dark(#ff8c5b, #d5512f);
|
|
58
|
+
--trees-icon-orange: light-dark(#d47628, #ffa359);
|
|
59
|
+
--trees-icon-yellow: light-dark(#d5a910, #ffd452);
|
|
60
|
+
--trees-icon-green: light-dark(#199f43, #5ecc71);
|
|
61
|
+
--trees-icon-teal: light-dark(#17a5af, #64d1db);
|
|
62
|
+
--trees-icon-cyan: light-dark(#1ca1c7, #68cdf2);
|
|
63
|
+
--trees-icon-blue: light-dark(#1a85d4, #69b1ff);
|
|
64
|
+
--trees-icon-indigo: light-dark(#693acf, #9d6afb);
|
|
65
|
+
--trees-icon-purple: light-dark(#a631be, #d568ea);
|
|
66
|
+
--trees-icon-pink: light-dark(#d32a61, #ff678d);
|
|
67
|
+
--trees-icon-mauve: light-dark(#594c5b, #79697b);
|
|
68
|
+
--trees-file-icon-color-default: var(--trees-file-icon-color, var(--trees-icon-gray));
|
|
69
|
+
--trees-file-icon-color-astro: var(--trees-file-icon-color, var(--trees-icon-purple));
|
|
70
|
+
--trees-file-icon-color-babel: var(--trees-file-icon-color, var(--trees-icon-yellow));
|
|
71
|
+
--trees-file-icon-color-bash: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
72
|
+
--trees-file-icon-color-biome: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
73
|
+
--trees-file-icon-color-bootstrap: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
74
|
+
--trees-file-icon-color-browserslist: var(--trees-file-icon-color, var(--trees-icon-yellow));
|
|
75
|
+
--trees-file-icon-color-bun: var(--trees-file-icon-color, var(--trees-icon-mauve));
|
|
76
|
+
--trees-file-icon-color-c: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
77
|
+
--trees-file-icon-color-cpp: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
78
|
+
--trees-file-icon-color-claude: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
79
|
+
--trees-file-icon-color-css: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
80
|
+
--trees-file-icon-color-database: var(--trees-file-icon-color, var(--trees-icon-purple));
|
|
81
|
+
--trees-file-icon-color-docker: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
82
|
+
--trees-file-icon-color-eslint: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
83
|
+
--trees-file-icon-color-git: var(--trees-file-icon-vermilion, var(--trees-icon-vermilion));
|
|
84
|
+
--trees-file-icon-color-go: var(--trees-file-icon-color, var(--trees-icon-cyan));
|
|
85
|
+
--trees-file-icon-color-graphql: var(--trees-file-icon-color, var(--trees-icon-pink));
|
|
86
|
+
--trees-file-icon-color-html: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
87
|
+
--trees-file-icon-color-image: var(--trees-file-icon-color, var(--trees-icon-pink));
|
|
88
|
+
--trees-file-icon-color-javascript: var(--trees-file-icon-color, var(--trees-icon-yellow));
|
|
89
|
+
--trees-file-icon-color-json: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
90
|
+
--trees-file-icon-color-markdown: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
91
|
+
--trees-file-icon-color-mcp: var(--trees-file-icon-color, var(--trees-icon-teal));
|
|
92
|
+
--trees-file-icon-color-npm: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
93
|
+
--trees-file-icon-color-oxc: var(--trees-file-icon-cyan, var(--trees-icon-cyan));
|
|
94
|
+
--trees-file-icon-color-postcss: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
95
|
+
--trees-file-icon-color-prettier: var(--trees-file-icon-color, var(--trees-icon-teal));
|
|
96
|
+
--trees-file-icon-color-python: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
97
|
+
--trees-file-icon-color-react: var(--trees-file-icon-color, var(--trees-icon-cyan));
|
|
98
|
+
--trees-file-icon-color-ruby: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
99
|
+
--trees-file-icon-color-rust: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
100
|
+
--trees-file-icon-color-sass: var(--trees-file-icon-color, var(--trees-icon-pink));
|
|
101
|
+
--trees-file-icon-color-svg: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
102
|
+
--trees-file-icon-color-svelte: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
103
|
+
--trees-file-icon-color-svgo: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
104
|
+
--trees-file-icon-color-swift: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
105
|
+
--trees-file-icon-color-table: var(--trees-file-icon-color, var(--trees-icon-teal));
|
|
106
|
+
--trees-file-icon-color-text: var(--trees-file-icon-color, var(--trees-icon-gray));
|
|
107
|
+
--trees-file-icon-color-tailwind: var(--trees-file-icon-color, var(--trees-icon-cyan));
|
|
108
|
+
--trees-file-icon-color-terraform: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
109
|
+
--trees-file-icon-color-typescript: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
110
|
+
--trees-file-icon-color-vite: var(--trees-file-icon-color, var(--trees-icon-purple));
|
|
111
|
+
--trees-file-icon-color-vscode: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
112
|
+
--trees-file-icon-color-vue: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
113
|
+
--trees-file-icon-color-wasm: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
114
|
+
--trees-file-icon-color-webpack: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
115
|
+
--trees-file-icon-color-yml: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
116
|
+
--trees-file-icon-color-zig: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
117
|
+
--trees-file-icon-color-zip: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
118
|
+
--trees-level-gap: var(--trees-level-gap-override, calc(8px * var(--trees-density)));
|
|
119
|
+
--trees-item-padding-x: var(--trees-item-padding-x-override, calc(8px * var(--trees-density)));
|
|
120
|
+
--trees-item-margin-x: var(--trees-item-margin-x-override, calc(2px * var(--trees-density)));
|
|
121
|
+
--trees-item-row-gap: var(--trees-item-row-gap-override, calc(6px * var(--trees-density)));
|
|
122
|
+
--trees-icon-width: var(--trees-icon-width-override, 16px);
|
|
123
|
+
--trees-icon-nudge: var(--trees-icon-nudge-override, calc(1px * var(--trees-density)));
|
|
124
|
+
--trees-row-height: var(--trees-item-height, 30px);
|
|
125
|
+
--trees-git-lane-width: var(--trees-git-lane-width-override, 12px);
|
|
126
|
+
--trees-action-lane-width: var(--trees-action-lane-width-override, calc(var(--trees-icon-width) + 2px));
|
|
127
|
+
--trees-context-menu-trigger-inline-offset: calc(var(--trees-padding-inline) + var(--trees-item-padding-x) -
|
|
128
|
+
var(--trees-focus-ring-width));
|
|
129
|
+
--trees-scrollbar-gutter: var(--trees-scrollbar-gutter-override, 6px);
|
|
130
|
+
--trees-padding-inline: var(--trees-padding-inline-override, 16px);
|
|
131
|
+
color-scheme: light dark;
|
|
132
|
+
font-size: var(--trees-font-size);
|
|
133
|
+
color: var(--trees-fg);
|
|
134
|
+
background-color: var(--trees-bg);
|
|
135
|
+
--truncate-marker-background-color: var(--trees-bg);
|
|
136
|
+
--truncate-marker-background-overlay-color: transparent;
|
|
137
|
+
font-family: var(--trees-font-family);
|
|
138
|
+
font-weight: var(--trees-font-weight-regular);
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
display: flex;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
:host([data-file-tree-virtualized="true"]) {
|
|
144
|
+
height: 100%;
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
[data-file-tree-virtualized-wrapper="true"], [data-file-tree-virtualized-root="true"] {
|
|
149
|
+
flex-direction: column;
|
|
150
|
+
height: 100%;
|
|
151
|
+
display: flex;
|
|
152
|
+
overflow: hidden;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
[data-file-tree-virtualized-scroll="true"], [data-file-tree-scrollbar-measure="true"] {
|
|
156
|
+
--trees-scrollbar-thumb-current: transparent;
|
|
157
|
+
scrollbar-gutter: stable;
|
|
158
|
+
overflow-y: auto;
|
|
159
|
+
|
|
160
|
+
&:hover {
|
|
161
|
+
--trees-scrollbar-thumb-current: var(--trees-scrollbar-thumb);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&::-webkit-scrollbar {
|
|
165
|
+
width: var(--trees-scrollbar-gutter);
|
|
166
|
+
height: var(--trees-scrollbar-gutter);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&::-webkit-scrollbar-track {
|
|
170
|
+
background: none;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
&::-webkit-scrollbar-thumb {
|
|
174
|
+
background-color: var(--trees-scrollbar-thumb-current);
|
|
175
|
+
border-radius: calc(var(--trees-scrollbar-gutter) / 2);
|
|
176
|
+
background-clip: content-box;
|
|
177
|
+
border: 1px solid #0000;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&::-webkit-scrollbar-corner {
|
|
181
|
+
background-color: #0000;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
[data-file-tree-scrollbar-measure="true"] {
|
|
186
|
+
visibility: hidden;
|
|
187
|
+
pointer-events: none;
|
|
188
|
+
width: 100px;
|
|
189
|
+
height: 100px;
|
|
190
|
+
position: absolute;
|
|
191
|
+
top: 0;
|
|
192
|
+
left: 0;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
@supports ((-moz-appearance: none)) {
|
|
196
|
+
[data-file-tree-virtualized-scroll="true"], [data-file-tree-scrollbar-measure="true"] {
|
|
197
|
+
scrollbar-width: thin;
|
|
198
|
+
scrollbar-color: var(--trees-scrollbar-thumb-current) transparent;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
[data-file-tree-virtualized-scroll="true"] {
|
|
203
|
+
min-height: 0;
|
|
204
|
+
padding-inline: max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
|
|
205
|
+
0px)
|
|
206
|
+
/* NOTE(amadeus): We can assume that all Webkit based browser gutters
|
|
207
|
+
* will align to the value of '--trees-scrollbar-gutter', however if not, then
|
|
208
|
+
* \`--trees-scrollbar-gutter-measured\` should correct it. Mostly we are
|
|
209
|
+
* hoping to avoid SSR alignment jumps if possible. In non-SSR'd environments
|
|
210
|
+
* \`--trees-scrollbar-gutter-measured\` should always be immediately available.
|
|
211
|
+
*/
|
|
212
|
+
max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x) -
|
|
213
|
+
var(--trees-scrollbar-gutter-measured, var(--trees-scrollbar-gutter))),
|
|
214
|
+
0px);
|
|
215
|
+
flex: 1 1 0;
|
|
216
|
+
position: relative;
|
|
217
|
+
overflow-y: auto;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
@supports ((-moz-appearance: none)) {
|
|
221
|
+
[data-file-tree-virtualized-scroll="true"] {
|
|
222
|
+
padding-inline: max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
|
|
223
|
+
0px)
|
|
224
|
+
/* NOTE(amadeus): However on Firefox it can vary a little bit, but most
|
|
225
|
+
* likely the majority of cases will default to a 0px width scrollbar lets
|
|
226
|
+
* inherit that first to avoid SSR jumps. In non-SSR'd environments
|
|
227
|
+
* \`--trees-scrollbar-gutter-measured\` should always be immediately available.
|
|
228
|
+
*/
|
|
229
|
+
max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x) -
|
|
230
|
+
var(--trees-scrollbar-gutter-measured, 0px)),
|
|
231
|
+
0px);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
[data-file-tree-sticky-overlay="true"] {
|
|
236
|
+
z-index: 4;
|
|
237
|
+
pointer-events: none;
|
|
238
|
+
height: 0;
|
|
239
|
+
position: sticky;
|
|
240
|
+
top: 0;
|
|
241
|
+
overflow: visible;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
[data-file-tree-virtualized-root="true"][data-scroll-at-top="true"]:not([data-overlay-reveal]) [data-file-tree-sticky-overlay="true"] {
|
|
245
|
+
visibility: hidden;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
[data-file-tree-sticky-overlay-content="true"] {
|
|
249
|
+
background-color: var(--trees-bg);
|
|
250
|
+
pointer-events: none;
|
|
251
|
+
position: relative;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
[data-file-tree-virtualized-list="true"] {
|
|
255
|
+
background-color: var(--trees-bg);
|
|
256
|
+
overflow-anchor: none;
|
|
257
|
+
width: 100%;
|
|
258
|
+
min-height: 100%;
|
|
259
|
+
position: relative;
|
|
260
|
+
|
|
261
|
+
&[data-is-scrolling] {
|
|
262
|
+
pointer-events: none;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
[data-file-tree-virtualized-sticky-offset="true"] {
|
|
267
|
+
contain: layout size;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
[data-file-tree-virtualized-sticky="true"] {
|
|
271
|
+
isolation: isolate;
|
|
272
|
+
will-change: transform;
|
|
273
|
+
flex-direction: column;
|
|
274
|
+
width: 100%;
|
|
275
|
+
display: flex;
|
|
276
|
+
position: sticky;
|
|
277
|
+
top: 0;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
[data-file-tree-search-container] {
|
|
281
|
+
padding: 0;
|
|
282
|
+
padding-inline: var(--trees-padding-inline);
|
|
283
|
+
margin-bottom: var(--trees-item-row-gap);
|
|
284
|
+
display: flex;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
[data-file-tree-search-input] {
|
|
288
|
+
--trees-focus-ring-width: 2px;
|
|
289
|
+
font-family: var(--trees-font-family);
|
|
290
|
+
font-size: var(--trees-font-size);
|
|
291
|
+
height: var(--trees-row-height);
|
|
292
|
+
padding-inline: var(--trees-item-padding-x);
|
|
293
|
+
line-height: var(--trees-row-height);
|
|
294
|
+
color: var(--trees-search-fg);
|
|
295
|
+
background-color: var(--trees-search-bg);
|
|
296
|
+
border: 1px solid var(--trees-border-color);
|
|
297
|
+
border-radius: var(--trees-border-radius);
|
|
298
|
+
outline: none;
|
|
299
|
+
flex: 1;
|
|
300
|
+
margin-block: 1px;
|
|
301
|
+
|
|
302
|
+
&::placeholder {
|
|
303
|
+
color: color-mix(in lab,
|
|
304
|
+
var(--trees-search-fg) 65%,
|
|
305
|
+
var(--trees-search-bg));
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
&:focus-visible, &[data-file-tree-search-input-fake-focus="true"] {
|
|
309
|
+
outline: var(--trees-focus-ring-width) solid var(--trees-focus-ring-color);
|
|
310
|
+
outline-offset: var(--trees-focus-ring-offset);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
[role="tree"] {
|
|
315
|
+
gap: var(--trees-gap-override, 0);
|
|
316
|
+
flex-direction: column;
|
|
317
|
+
display: flex;
|
|
318
|
+
position: relative;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
[data-type="item"] {
|
|
322
|
+
color: inherit;
|
|
323
|
+
font-family: var(--trees-font-family);
|
|
324
|
+
font-size: var(--trees-font-size);
|
|
325
|
+
text-align: start;
|
|
326
|
+
background-color: var(--trees-bg);
|
|
327
|
+
padding: 0 var(--trees-item-padding-x);
|
|
328
|
+
margin: 0 var(--trees-item-margin-x);
|
|
329
|
+
cursor: pointer;
|
|
330
|
+
user-select: none;
|
|
331
|
+
-webkit-touch-callout: none;
|
|
332
|
+
touch-action: manipulation;
|
|
333
|
+
flex: 0 0 var(--trees-row-height);
|
|
334
|
+
height: var(--trees-row-height);
|
|
335
|
+
line-height: var(--trees-row-height);
|
|
336
|
+
align-items: center;
|
|
337
|
+
gap: var(--trees-item-row-gap);
|
|
338
|
+
border-radius: var(--trees-border-radius);
|
|
339
|
+
--truncate-marker-background-color: var(--trees-bg);
|
|
340
|
+
--truncate-marker-background-overlay-color: transparent;
|
|
341
|
+
--truncate-marker-block-inset: 0px;
|
|
342
|
+
border: none;
|
|
343
|
+
outline: none;
|
|
344
|
+
display: flex;
|
|
345
|
+
position: relative;
|
|
346
|
+
|
|
347
|
+
&:hover, &[data-item-context-hover="true"] {
|
|
348
|
+
background-color: var(--trees-bg-muted);
|
|
349
|
+
--truncate-marker-background-overlay-color: var(--trees-bg-muted);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
&[data-item-focused="true"], &:focus-visible {
|
|
353
|
+
z-index: 2;
|
|
354
|
+
|
|
355
|
+
& [data-item-flattened-subitems] {
|
|
356
|
+
--truncate-marker-block-inset: var(--trees-focus-ring-width);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
&:before {
|
|
360
|
+
content: "";
|
|
361
|
+
border-radius: var(--trees-border-radius);
|
|
362
|
+
outline: var(--trees-focus-ring-width) solid
|
|
363
|
+
var(--trees-focus-ring-color);
|
|
364
|
+
outline-offset: var(--trees-focus-ring-offset);
|
|
365
|
+
pointer-events: none;
|
|
366
|
+
display: block;
|
|
367
|
+
position: absolute;
|
|
368
|
+
inset: 0;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
&[data-item-selected="true"]:before {
|
|
372
|
+
outline-color: var(--trees-selected-focused-border-color);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
&[data-item-selected="true"] {
|
|
377
|
+
color: var(--trees-selected-fg);
|
|
378
|
+
background-color: var(--trees-selected-bg);
|
|
379
|
+
--truncate-marker-background-overlay-color: var(--trees-selected-bg);
|
|
380
|
+
z-index: 3;
|
|
381
|
+
|
|
382
|
+
& [data-item-section="icon"] {
|
|
383
|
+
color: var(--trees-selected-fg);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
&[data-item-search-match="true"] {
|
|
388
|
+
font-weight: var(--trees-search-font-weight);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
[data-type="item"][data-file-tree-sticky-row="true"] {
|
|
393
|
+
pointer-events: auto;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
[data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"] {
|
|
397
|
+
pointer-events: none;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
[data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"]:hover:not([data-item-selected="true"]), [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"][data-item-context-hover="true"]:not([data-item-selected="true"]) {
|
|
401
|
+
background-color: var(--trees-bg);
|
|
402
|
+
--truncate-marker-background-overlay-color: transparent;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
[data-item-selected="true"]:has( + [data-item-selected="true"]) {
|
|
406
|
+
border-bottom-right-radius: 0;
|
|
407
|
+
border-bottom-left-radius: 0;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
[data-item-selected="true"] + [data-item-selected="true"] {
|
|
411
|
+
border-top-left-radius: 0;
|
|
412
|
+
border-top-right-radius: 0;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
[data-item-flattened-subitems] {
|
|
416
|
+
align-items: center;
|
|
417
|
+
gap: 2px;
|
|
418
|
+
display: inline-flex;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
[data-item-flattened-subitem]:hover, [data-item-flattened-subitem-drag-target="true"] {
|
|
422
|
+
text-decoration: underline;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
[data-item-section="icon"] {
|
|
426
|
+
color: var(--trees-fg-muted);
|
|
427
|
+
fill: currentColor;
|
|
428
|
+
width: var(--trees-icon-width);
|
|
429
|
+
flex-shrink: 0;
|
|
430
|
+
justify-content: center;
|
|
431
|
+
align-items: center;
|
|
432
|
+
display: flex;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
:where([data-item-section="icon"] > [data-icon-token]) {
|
|
436
|
+
color: var(--trees-fg-muted);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
[data-file-tree-colored-icons="true"] {
|
|
440
|
+
& [data-icon-token="astro"] {
|
|
441
|
+
color: var(--trees-file-icon-color-astro);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
& [data-icon-token="babel"] {
|
|
445
|
+
color: var(--trees-file-icon-color-babel);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
& [data-icon-token="bash"] {
|
|
449
|
+
color: var(--trees-file-icon-color-bash);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
& [data-icon-token="biome"] {
|
|
453
|
+
color: var(--trees-file-icon-color-biome);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
& [data-icon-token="bootstrap"] {
|
|
457
|
+
color: var(--trees-file-icon-color-bootstrap);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
& [data-icon-token="browserslist"] {
|
|
461
|
+
color: var(--trees-file-icon-color-browserslist);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
& [data-icon-token="bun"] {
|
|
465
|
+
color: var(--trees-file-icon-color-bun);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
& [data-icon-token="c"] {
|
|
469
|
+
color: var(--trees-file-icon-color-c);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
& [data-icon-token="cpp"] {
|
|
473
|
+
color: var(--trees-file-icon-color-cpp);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
& [data-icon-token="claude"] {
|
|
477
|
+
color: var(--trees-file-icon-color-claude);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
& [data-icon-token="css"] {
|
|
481
|
+
color: var(--trees-file-icon-color-css);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
& [data-icon-token="database"] {
|
|
485
|
+
color: var(--trees-file-icon-color-database);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
& [data-icon-token="default"] {
|
|
489
|
+
color: var(--trees-file-icon-color-default);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
& [data-icon-token="docker"] {
|
|
493
|
+
color: var(--trees-file-icon-color-docker);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
& [data-icon-token="eslint"] {
|
|
497
|
+
color: var(--trees-file-icon-color-eslint);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
& [data-icon-token="git"] {
|
|
501
|
+
color: var(--trees-file-icon-color-git);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
& [data-icon-token="go"] {
|
|
505
|
+
color: var(--trees-file-icon-color-go);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
& [data-icon-token="graphql"] {
|
|
509
|
+
color: var(--trees-file-icon-color-graphql);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
& [data-icon-token="html"] {
|
|
513
|
+
color: var(--trees-file-icon-color-html);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
& [data-icon-token="image"] {
|
|
517
|
+
color: var(--trees-file-icon-color-image);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
& [data-icon-token="javascript"] {
|
|
521
|
+
color: var(--trees-file-icon-color-javascript);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
& [data-icon-token="json"] {
|
|
525
|
+
color: var(--trees-file-icon-color-json);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
& [data-icon-token="markdown"] {
|
|
529
|
+
color: var(--trees-file-icon-color-markdown);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
& [data-icon-token="mcp"] {
|
|
533
|
+
color: var(--trees-file-icon-color-mcp);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
& [data-icon-token="npm"] {
|
|
537
|
+
color: var(--trees-file-icon-color-npm);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
& [data-icon-token="oxc"] {
|
|
541
|
+
color: var(--trees-file-icon-color-oxc);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
& [data-icon-token="postcss"] {
|
|
545
|
+
color: var(--trees-file-icon-color-postcss);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
& [data-icon-token="prettier"] {
|
|
549
|
+
color: var(--trees-file-icon-color-prettier);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
& [data-icon-token="python"] {
|
|
553
|
+
color: var(--trees-file-icon-color-python);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
& [data-icon-token="react"] {
|
|
557
|
+
color: var(--trees-file-icon-color-react);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
& [data-icon-token="ruby"] {
|
|
561
|
+
color: var(--trees-file-icon-color-ruby);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
& [data-icon-token="rust"] {
|
|
565
|
+
color: var(--trees-file-icon-color-rust);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
& [data-icon-token="sass"] {
|
|
569
|
+
color: var(--trees-file-icon-color-sass);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
& [data-icon-token="svg"] {
|
|
573
|
+
color: var(--trees-file-icon-color-svg);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
& [data-icon-token="svelte"] {
|
|
577
|
+
color: var(--trees-file-icon-color-svelte);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
& [data-icon-token="svgo"] {
|
|
581
|
+
color: var(--trees-file-icon-color-svgo);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
& [data-icon-token="swift"] {
|
|
585
|
+
color: var(--trees-file-icon-color-swift);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
& [data-icon-token="table"] {
|
|
589
|
+
color: var(--trees-file-icon-color-table);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
& [data-icon-token="text"] {
|
|
593
|
+
color: var(--trees-file-icon-color-text);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
& [data-icon-token="tailwind"] {
|
|
597
|
+
color: var(--trees-file-icon-color-tailwind);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
& [data-icon-token="terraform"] {
|
|
601
|
+
color: var(--trees-file-icon-color-terraform);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
& [data-icon-token="typescript"] {
|
|
605
|
+
color: var(--trees-file-icon-color-typescript);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
& [data-icon-token="vite"] {
|
|
609
|
+
color: var(--trees-file-icon-color-vite);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
& [data-icon-token="vscode"] {
|
|
613
|
+
color: var(--trees-file-icon-color-vscode);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
& [data-icon-token="vue"] {
|
|
617
|
+
color: var(--trees-file-icon-color-vue);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
& [data-icon-token="wasm"] {
|
|
621
|
+
color: var(--trees-file-icon-color-wasm);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
& [data-icon-token="webpack"] {
|
|
625
|
+
color: var(--trees-file-icon-color-webpack);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
& [data-icon-token="yml"] {
|
|
629
|
+
color: var(--trees-file-icon-color-yml);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
& [data-icon-token="zig"] {
|
|
633
|
+
color: var(--trees-file-icon-color-zig);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
& [data-icon-token="zip"] {
|
|
637
|
+
color: var(--trees-file-icon-color-zip);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
[data-icon-name="file-tree-icon-chevron"] {
|
|
642
|
+
&[data-align-capitals="false"] {
|
|
643
|
+
transform: translate(0, var(--trees-icon-nudge));
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
&[data-align-capitals="true"] {
|
|
647
|
+
transform: translate(0);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
[data-item-section="content"] {
|
|
652
|
+
text-align: start;
|
|
653
|
+
text-overflow: ellipsis;
|
|
654
|
+
flex: 0 auto;
|
|
655
|
+
min-width: 0;
|
|
656
|
+
max-width: 100%;
|
|
657
|
+
overflow: hidden;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
[data-item-section="decoration"] {
|
|
661
|
+
text-align: end;
|
|
662
|
+
min-width: 0;
|
|
663
|
+
color: var(--trees-fg-muted);
|
|
664
|
+
flex: 1 1 0;
|
|
665
|
+
justify-content: flex-end;
|
|
666
|
+
display: flex;
|
|
667
|
+
overflow: hidden;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
[data-item-section="decoration"] > span {
|
|
671
|
+
text-overflow: ellipsis;
|
|
672
|
+
white-space: nowrap;
|
|
673
|
+
justify-content: flex-end;
|
|
674
|
+
align-items: center;
|
|
675
|
+
min-width: 0;
|
|
676
|
+
max-width: 100%;
|
|
677
|
+
display: inline-flex;
|
|
678
|
+
overflow: hidden;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
[data-item-section="git"], [data-item-section="action"] {
|
|
682
|
+
flex: none;
|
|
683
|
+
justify-content: center;
|
|
684
|
+
align-items: center;
|
|
685
|
+
display: flex;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
[data-item-section="git"] {
|
|
689
|
+
width: var(--trees-git-lane-width);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
[data-item-section="action"] {
|
|
693
|
+
width: var(--trees-action-lane-width);
|
|
694
|
+
color: var(--trees-fg-muted);
|
|
695
|
+
fill: currentColor;
|
|
696
|
+
pointer-events: none;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
[data-item-section="git"] > span, [data-item-section="action"] > span {
|
|
700
|
+
justify-content: center;
|
|
701
|
+
align-items: center;
|
|
702
|
+
width: 100%;
|
|
703
|
+
display: inline-flex;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
[data-item-action-affordance="decorative"] {
|
|
707
|
+
opacity: .85;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
[data-item-rename-input] {
|
|
711
|
+
appearance: none;
|
|
712
|
+
width: 100%;
|
|
713
|
+
min-width: 0;
|
|
714
|
+
height: calc(var(--trees-row-height) - 4px);
|
|
715
|
+
font-family: inherit;
|
|
716
|
+
font-size: inherit;
|
|
717
|
+
color: inherit;
|
|
718
|
+
box-sizing: border-box;
|
|
719
|
+
background-color: #0000;
|
|
720
|
+
border: 0;
|
|
721
|
+
outline: none;
|
|
722
|
+
padding-inline: 6px;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
[data-item-section="content"]:has([data-item-rename-input]) ~ [data-item-section="action"], [data-item-section="content"]:has([data-item-rename-input]) ~ [data-item-section="decoration"] {
|
|
726
|
+
display: none;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
[aria-expanded="false"][data-item-type="folder"] > [data-item-section="icon"] > [data-icon-name="file-tree-icon-chevron"] {
|
|
730
|
+
&[data-align-capitals="true"] {
|
|
731
|
+
transform: rotate(-90deg)
|
|
732
|
+
translate(calc(var(--trees-icon-nudge) / 2),
|
|
733
|
+
calc(var(--trees-icon-nudge) / 2));
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
&[data-align-capitals="false"] {
|
|
737
|
+
transform: rotate(-90deg)
|
|
738
|
+
translate(calc(var(--trees-icon-nudge) / 2 * -1),
|
|
739
|
+
calc(var(--trees-icon-nudge) / 2));
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
[data-item-section="spacing"] {
|
|
744
|
+
height: var(--trees-row-height);
|
|
745
|
+
padding-left: calc(calc(var(--trees-icon-width) / 2) - .5px);
|
|
746
|
+
flex-direction: row;
|
|
747
|
+
justify-content: center;
|
|
748
|
+
align-items: center;
|
|
749
|
+
display: flex;
|
|
750
|
+
|
|
751
|
+
&:empty {
|
|
752
|
+
padding-left: 0;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
[data-item-section="spacing-item"] {
|
|
757
|
+
border-left: 1px solid var(--trees-indent-guide-bg);
|
|
758
|
+
height: 100%;
|
|
759
|
+
margin-right: calc(var(--trees-level-gap) - 1px);
|
|
760
|
+
opacity: 0;
|
|
761
|
+
transition: opacity .15s;
|
|
762
|
+
display: inline-block;
|
|
763
|
+
transform: translateX(-.25px);
|
|
764
|
+
|
|
765
|
+
& + & {
|
|
766
|
+
margin-left: calc(var(--trees-item-row-gap) + calc(var(--trees-icon-width) / 2) - .5px);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
:host(:hover) [data-item-section="spacing-item"] {
|
|
771
|
+
opacity: .75;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
[data-item-contains-git-change="true"] > [data-item-section="git"] {
|
|
775
|
+
color: var(--trees-git-modified-color);
|
|
776
|
+
opacity: .5;
|
|
777
|
+
fill: currentColor;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
[data-item-git-status] {
|
|
781
|
+
& > :where([data-item-section="icon"]) > :where(:not([data-icon-name="file-tree-icon-chevron"])), & > [data-item-section="content"] {
|
|
782
|
+
color: var(--trees-item-git-status-color);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
& > [data-item-section="git"] {
|
|
786
|
+
color: var(--trees-item-git-status-color);
|
|
787
|
+
font-weight: var(--trees-font-weight-semibold);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
[data-item-git-status="added"] {
|
|
792
|
+
--trees-item-git-status-color: var(--trees-git-added-color);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
[data-item-git-status="deleted"] {
|
|
796
|
+
--trees-item-git-status-color: var(--trees-git-deleted-color);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
[data-item-git-status="ignored"] {
|
|
800
|
+
--trees-item-git-status-color: var(--trees-git-ignored-color);
|
|
801
|
+
|
|
802
|
+
& > [data-item-section="icon"] {
|
|
803
|
+
opacity: .5;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
[data-item-section="git"] [data-icon-name="file-tree-icon-dot"] {
|
|
808
|
+
transform: translateY(calc(.65ex - 50%));
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
[data-item-git-status="modified"] {
|
|
812
|
+
--trees-item-git-status-color: var(--trees-git-modified-color);
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
[data-item-git-status="renamed"] {
|
|
816
|
+
--trees-item-git-status-color: var(--trees-git-renamed-color);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
[data-item-git-status="untracked"] {
|
|
820
|
+
--trees-item-git-status-color: var(--trees-git-untracked-color);
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
[data-item-drag-target="true"] {
|
|
824
|
+
background-color: var(--trees-selected-bg);
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
[data-item-dragging="true"] {
|
|
828
|
+
opacity: .5;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
[data-item-section="lock"] {
|
|
832
|
+
color: var(--trees-fg-muted);
|
|
833
|
+
flex: none;
|
|
834
|
+
align-items: center;
|
|
835
|
+
margin-left: auto;
|
|
836
|
+
display: flex;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
[data-item-section="lock"] svg {
|
|
840
|
+
display: block;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
[data-type="header-slot"] {
|
|
844
|
+
flex: none;
|
|
845
|
+
display: block;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
[data-type="context-menu-wash"] {
|
|
849
|
+
z-index: 3;
|
|
850
|
+
touch-action: none;
|
|
851
|
+
background-color: #0000;
|
|
852
|
+
position: absolute;
|
|
853
|
+
inset: 0;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
[data-type="context-menu-anchor"] {
|
|
857
|
+
top: 0;
|
|
858
|
+
right: var(--trees-context-menu-trigger-inline-offset);
|
|
859
|
+
z-index: 4;
|
|
860
|
+
align-items: center;
|
|
861
|
+
display: none;
|
|
862
|
+
position: absolute;
|
|
863
|
+
|
|
864
|
+
&[data-visible="true"] {
|
|
865
|
+
display: flex;
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
[data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="context-menu-anchor"] {
|
|
870
|
+
display: none;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
[data-type="context-menu-anchor"] > slot[name="context-menu"] {
|
|
874
|
+
flex: 0 0 0;
|
|
875
|
+
width: 0;
|
|
876
|
+
min-width: 0;
|
|
877
|
+
display: block;
|
|
878
|
+
overflow: visible;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
[data-type="context-menu-trigger"] {
|
|
882
|
+
all: unset;
|
|
883
|
+
width: var(--trees-action-lane-width);
|
|
884
|
+
color: var(--trees-fg-muted);
|
|
885
|
+
fill: currentColor;
|
|
886
|
+
cursor: pointer;
|
|
887
|
+
font-family: var(--trees-font-family);
|
|
888
|
+
font-size: var(--trees-font-size);
|
|
889
|
+
border-top-right-radius: var(--trees-border-radius);
|
|
890
|
+
border-bottom-right-radius: var(--trees-border-radius);
|
|
891
|
+
margin: var(--trees-focus-ring-width);
|
|
892
|
+
height: calc(var(--trees-row-height) - var(--trees-focus-ring-width) * 2);
|
|
893
|
+
border-width: 0;
|
|
894
|
+
justify-content: center;
|
|
895
|
+
align-items: center;
|
|
896
|
+
transition: color .12s;
|
|
897
|
+
display: flex;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
[data-type="context-menu-trigger"]:hover, [data-type="context-menu-trigger"][aria-expanded="true"] {
|
|
901
|
+
color: var(--trees-fg);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
[data-truncate-container] {
|
|
905
|
+
--truncate-internal-marker-fade-width: var(--truncate-marker-fade-width, 2px);
|
|
906
|
+
--truncate-internal-marker-gap: var(--truncate-marker-gap, 0px);
|
|
907
|
+
--truncate-internal-marker-opacity: var(--truncate-marker-opacity, 50%);
|
|
908
|
+
--truncate-internal-middle-marker-opacity: var(--truncate-middle-marker-opacity, 80%);
|
|
909
|
+
--truncate-internal-marker-background-color: var(--truncate-marker-background-color, light-dark(#fff, #000));
|
|
910
|
+
--truncate-internal-marker-background-overlay-color: var(--truncate-marker-background-overlay-color, transparent);
|
|
911
|
+
--truncate-internal-marker-block-inset: var(--truncate-marker-block-inset, 0px);
|
|
912
|
+
--truncate-internal-marker-fade-out-duration: var(--truncate-marker-fade-out-duration, 0s);
|
|
913
|
+
--truncate-internal-marker-fade-in-duration: var(--truncate-marker-fade-in-duration, .1s);
|
|
914
|
+
--truncate-internal-fade-marker-color: var(--truncate-fade-marker-color, #000);
|
|
915
|
+
--truncate-internal-fade-marker-width: var(--truncate-fade-marker-width, .2lh);
|
|
916
|
+
--truncate-internal-single-line-height: 1lh;
|
|
917
|
+
height: var(--truncate-internal-single-line-height);
|
|
918
|
+
min-width: 0;
|
|
919
|
+
margin-top: -1px;
|
|
920
|
+
margin-bottom: -1px;
|
|
921
|
+
overflow: hidden;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
[data-truncate-marker] {
|
|
925
|
+
height: var(--truncate-internal-single-line-height);
|
|
926
|
+
padding-block: var(--truncate-internal-marker-block-inset);
|
|
927
|
+
box-sizing: border-box;
|
|
928
|
+
z-index: 2;
|
|
929
|
+
color: color-mix(in srgb,
|
|
930
|
+
currentColor var(--truncate-internal-marker-opacity),
|
|
931
|
+
transparent);
|
|
932
|
+
opacity: 0;
|
|
933
|
+
transition: opacity var(--truncate-internal-marker-fade-out-duration)
|
|
934
|
+
ease-in-out;
|
|
935
|
+
background-clip: content-box;
|
|
936
|
+
align-items: center;
|
|
937
|
+
display: flex;
|
|
938
|
+
position: absolute;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
@container measure (height > 1lh) {
|
|
942
|
+
[data-truncate-marker] {
|
|
943
|
+
opacity: 1;
|
|
944
|
+
transition: opacity var(--truncate-internal-marker-fade-in-duration)
|
|
945
|
+
ease-in-out;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
[data-truncate-grid] {
|
|
950
|
+
display: grid;
|
|
951
|
+
position: relative;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
[data-truncate-content="visible"] {
|
|
955
|
+
white-space: nowrap;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
[data-truncate-content="overflow"] {
|
|
959
|
+
opacity: 0;
|
|
960
|
+
pointer-events: none;
|
|
961
|
+
user-select: none;
|
|
962
|
+
word-break: break-all;
|
|
963
|
+
margin-top: calc(-1 * var(--truncate-internal-single-line-height));
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
[data-truncate-marker-cell] {
|
|
967
|
+
user-select: none;
|
|
968
|
+
pointer-events: none;
|
|
969
|
+
overflow: visible;
|
|
970
|
+
container: measure / size;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
[data-truncate-container="truncate"] {
|
|
974
|
+
& [data-truncate-grid] {
|
|
975
|
+
grid-template-columns: minmax(0, max-content) 0;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
& [data-truncate-marker] {
|
|
979
|
+
right: 0;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
& [data-truncate-fade] {
|
|
983
|
+
margin-right: calc(-2 * var(--truncate-internal-fade-marker-width));
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
[data-truncate-container="fruncate"] {
|
|
988
|
+
& [data-truncate-grid] {
|
|
989
|
+
grid-template-columns: 0 minmax(0, max-content) auto;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
& [data-truncate-content] {
|
|
993
|
+
direction: rtl;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
& [data-truncate-content] > span {
|
|
997
|
+
unicode-bidi: plaintext;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
& [data-truncate-fade] {
|
|
1001
|
+
margin-left: calc(-2 * var(--truncate-internal-fade-marker-width));
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
[data-truncate-variant="default"] {
|
|
1006
|
+
& [data-truncate-marker] {
|
|
1007
|
+
background-color: var(--truncate-internal-marker-background-color);
|
|
1008
|
+
background-image: linear-gradient(var(--truncate-internal-marker-background-overlay-color),
|
|
1009
|
+
var(--truncate-internal-marker-background-overlay-color));
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
& [data-truncate-marker]:after, & [data-truncate-marker]:before {
|
|
1013
|
+
content: "";
|
|
1014
|
+
width: calc(var(--truncate-internal-marker-fade-width) +
|
|
1015
|
+
var(--truncate-internal-marker-gap));
|
|
1016
|
+
height: max(0px,
|
|
1017
|
+
calc(var(--truncate-internal-single-line-height) -
|
|
1018
|
+
var(--truncate-internal-marker-block-inset) * 2));
|
|
1019
|
+
background-color: var(--truncate-internal-marker-background-color);
|
|
1020
|
+
background-image: linear-gradient(var(--truncate-internal-marker-background-overlay-color),
|
|
1021
|
+
var(--truncate-internal-marker-background-overlay-color));
|
|
1022
|
+
-webkit-mask-image: linear-gradient(var(--truncate-internal-fade-dir),
|
|
1023
|
+
#000 0%,
|
|
1024
|
+
#000 var(--truncate-internal-marker-gap),
|
|
1025
|
+
transparent 100%);
|
|
1026
|
+
mask-image: linear-gradient(var(--truncate-internal-fade-dir),
|
|
1027
|
+
#000 0%,
|
|
1028
|
+
#000 var(--truncate-internal-marker-gap),
|
|
1029
|
+
transparent 100%);
|
|
1030
|
+
position: absolute;
|
|
1031
|
+
inset-block-start: var(--truncate-internal-marker-block-inset);
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
& [data-truncate-marker]:after {
|
|
1035
|
+
--truncate-internal-fade-dir: to right;
|
|
1036
|
+
right: calc(-1 *
|
|
1037
|
+
(
|
|
1038
|
+
var(--truncate-internal-marker-fade-width) +
|
|
1039
|
+
var(--truncate-internal-marker-gap)
|
|
1040
|
+
));
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
& [data-truncate-marker]:before {
|
|
1044
|
+
--truncate-internal-fade-dir: to left;
|
|
1045
|
+
left: calc(-1 *
|
|
1046
|
+
(
|
|
1047
|
+
var(--truncate-internal-marker-fade-width) +
|
|
1048
|
+
var(--truncate-internal-marker-gap)
|
|
1049
|
+
));
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
[data-truncate-variant="fade"] {
|
|
1054
|
+
& [data-truncate-marker] {
|
|
1055
|
+
background: none;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
[data-truncate-fade] {
|
|
1060
|
+
box-shadow: 0 0 calc(var(--truncate-internal-fade-marker-width) / 2)
|
|
1061
|
+
var(--truncate-internal-fade-marker-color),
|
|
1062
|
+
0 0 var(--truncate-internal-fade-marker-width)
|
|
1063
|
+
var(--truncate-internal-fade-marker-color);
|
|
1064
|
+
width: calc(var(--truncate-internal-fade-marker-width) * 2);
|
|
1065
|
+
height: calc(var(--truncate-internal-single-line-height) -
|
|
1066
|
+
(var(--truncate-internal-fade-marker-width) * 2));
|
|
1067
|
+
margin: var(--truncate-internal-fade-marker-width) 0;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
[data-truncate-group-container="middle"] {
|
|
1071
|
+
& [data-truncate-container] {
|
|
1072
|
+
--truncate-marker-opacity: var(--truncate-internal-middle-marker-opacity);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
min-width: 0;
|
|
1076
|
+
display: flex;
|
|
1077
|
+
|
|
1078
|
+
& > div {
|
|
1079
|
+
min-width: 0;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
& > div[data-truncate-segment-priority="1"] {
|
|
1083
|
+
flex: 0 1 max-content;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
& > div[data-truncate-segment-priority="2"] {
|
|
1087
|
+
flex: 0 999999 max-content;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
@layer theme, unsafe;
|
|
1093
|
+
`,gs=`@layer base, unsafe;`;function _s(e){return`${gs}
|
|
1094
|
+
@layer base {
|
|
1095
|
+
${e}
|
|
1096
|
+
}`}function vs(e){return`${gs}
|
|
1097
|
+
@layer unsafe {
|
|
1098
|
+
${e}
|
|
1099
|
+
}`}var ys=new WeakMap;function bs(e){let t=ys.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(wr,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),ys.set(e,i),i}function xs(e,t){if(!e.isConnected)return;let n=bs(t);if(n==null)return;let r=t.querySelector(`style[${Tr}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(Tr,``),t.appendChild(i)),i.textContent=`:host { ${Er}: ${n}px; }`}var Ss;function Cs(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){Ss??(Ss=new CSSStyleSheet,Ss.replaceSync(_s(hs)));let t=!1;try{e.adoptedStyleSheets=[Ss],t=!0}catch{}if(t){e.querySelector(`style[${Sr}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(Sr,``),t.textContent=_s(hs),e.prepend(t)}}function ws(e,t){Ts(e,t),Cs(t),xs(e,t)}function Ts(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});ws(this,e)}}if(customElements.define(xr,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(xr)))e instanceof HTMLElement&&ws(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Es=e=>e.startsWith(`f::`)?e.slice(3):e;function Ds(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function Os(e,t){return e===``?t:`${e}/${t}`}function ks({files:e,path:t,isFolder:n,nextBasename:r}){let i=Es(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=Ds(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=Os(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function As(e){return e.endsWith(`/`)}function js(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function Ms(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function Ns(e,t){return t.includes(e)?Ms(t):[e]}function Ps(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function Fs(e,t){return{draggedPaths:e,target:t}}function Is(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(As(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function Ls(e,t){return t.kind===`root`||t.directoryPath==null?js(e):t.directoryPath}function Rs(e,t){let n=e.map(e=>{let n=Ls(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function zs(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Bs(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!zs(us.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function Vs(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function Hs(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function Us(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Ws(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return Us(e,t.path)?n?e:null:e;case`move`:return Hs(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Ws(r,e,n),r==null)return null;return r}}}function Gs(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Ks(e){switch(e.operation){case`add`:return{...Gs(e),operation:`add`,path:e.path};case`remove`:return{...Gs(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...Gs(e),from:e.from,operation:`move`,to:e.to}}}function qs(e){return{...Gs(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>Ks(e)),operation:`batch`}}function Js(e){switch(e.operation){case`add`:case`remove`:case`move`:return Ks(e);case`batch`:return qs(e);default:return null}}function Ys(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function Xs(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Zs(e){return Xs(e).at(-1)??null}function Qs(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function $s(e){return e.endsWith(`/`)}var ec=e=>e.toLowerCase();function tc(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function nc(e){return e.endsWith(`/`)?e.slice(0,-1):e}function rc(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var ic=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},ac=Symbol(`FILE_TREE_RENAME_VIEW`),oc=512,sc=512;function cc(e){return e===`top`||e===`center`?e:`nearest`}function lc(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=Xs(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function uc(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:lc(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var dc=class e{static{Object.defineProperty(e.prototype,ac,{configurable:!0,value(){return{cancel:()=>{this.#J()},commit:()=>{this.#Y()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#X(e)}}},writable:!0})}#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=new Set;#A=[];#j;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=null;#z=0;#B=null;#V=new Set;#H=0;#U;#W=0;#G=!1;#K=0;#q;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=Bs({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#j=n??`hide-non-matches`,this.#U=this.#ue(u.paths,u.preparedInput);let d=i?.map(e=>this.#Pe(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#V=new Set(d),this.#B=f,this.#H=1),this.#Me(f,!1),r!=null&&this.#Ee(r,!1),this.#q=this.#Ve()}destroy(){this.#q?.(),this.#q=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#ge()}focusFirstItem(){this.#xe().length>0&&this.#Ie(0)}focusLastItem(){this.#K<=0||(this.#Le(),this.#Ie(this.#K-1))}focusNextItem(){this.#je(1)}focusParentItem(){if(this.#c==null)return;let e=Zs(this.#c);if(e==null)return;let t=this.#Q(e);t>=0&&this.#Ie(t)}focusPath(e){let t=this.#U.getPathInfo(e)?.path??null;if(t==null)return;this.#Le();let n=this.#Q(t);n>=0&&this.#Ie(n)}scrollToPath(e,t){let n=this.#U.getPathInfo(e)?.path??null;if(n==null)return;this.#Le();let r=this.#Se(n);r<0||this.#Ne(r)!=null&&(t?.focus!==!1&&this.#Ie(r,!1),this.#R={id:this.#z+=1,offset:cc(t?.offset),visibleIndex:r},this.#Oe())}focusMountedPathFromInput(e){let t=this.#U.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Q(t);n>=0&&this.#Ie(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Q(t);return n>=0?(this.#Ie(n),this.#xe()[n]??t):null}focusPreviousItem(){this.#je(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#$(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#R}clearScrollRequest(e){this.#R?.id===e&&(this.#R=null)}resolveNearestVisiblePath(e){let t=this.#xe();if(this.#K===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#U.getPathInfo(e)?.path??e,r=this.#Q(n);return r>=0?t[r]??n:this.#Z(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#V]}getSelectionVersion(){return this.#H}getVisibleCount(){return this.#K}getVisibleRows(e,t){if(t<e||this.#K===0)return[];let n=Math.max(0,e),r=Math.min(this.#K-1,t);if(r<n)return[];let i=r-n+1;if(this.#I==null&&!this.#l&&r>=this.#b.length&&i<=sc){let e=[];for(let t=n;t<=r;t+=1){let n=this.#U.getVisibleRowContext(t);if(n==null)break;e.push(this.#te(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Le(),this.#I!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Ce(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];r!=null&&r===a+1?a=r:(i>=0&&this.#U.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null?(i=-1,a=-1):(i=r,a=r))}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Ce(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#ee(o,i,a,{ancestorPaths:this.#ie(a),path:s})})}return this.#U.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#ee(e,r,r,{ancestorPaths:this.#ie(r),path:i})})}getStickyRowCandidates(e,t){if(this.#I!=null)return null;if(this.#K===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#K;r+=1){let i=e+r*t,a=Math.min(this.#K-1,Math.floor(i/t)),o=this.#ne(a,r)??(a>0?this.#ne(a-1,r):void 0);if(o==null)break;n.push({row:this.#te(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#U.getPathInfo(e);return t==null?null:this.#$(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#U.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&(this.#N!=null&&this.#N.length>0&&(this.#O.has(t)?this.#O.delete(t):this.#U.isExpanded(t)&&this.#O.add(t)),this.#He(t))}selectAllVisiblePaths(){this.#Le();let e=[...this.#xe()];this.#oe(e,this.#c??this.#B)}selectOnlyPath(e){let t=this.#Pe(e);t!=null&&this.#oe([t],t)}selectOnlyMountedPathFromInput(e){this.#oe([e],e)}selectPath(e){let t=this.#Pe(e);t==null||this.#V.has(t)||this.#oe([...this.#V,t])}deselectPath(e){let t=this.#Pe(e);t!=null&&this.#V.has(t)&&this.#oe([...this.#V].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Pe(e);t!=null&&(this.#V.has(t)?this.deselectPath(t):this.selectPath(t))}togglePathSelectionFromInput(e){let t=this.#Pe(e);t!=null&&(this.#V.has(t)?this.#oe([...this.#V].filter(e=>e!==t),t):this.#oe([...this.#V,t],t))}selectPathRange(e,t){let n=this.#Pe(e);if(n==null)return;this.#Le();let r=this.#B,i=r==null?-1:this.#we(r),a=this.#we(n);if(i===-1||a===-1){let e=t?[...this.#V,n]:[n];this.#oe(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#xe().slice(o,s+1),l=t?[...this.#V,...c]:c;this.#oe(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#K-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Le();let r=this.#xe(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#V);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#oe([...o],this.#B??i,!1),this.#Ie(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Pe(e);if(t==null||this.#N!=null&&this.#N.length>0)return!1;let n=this.getSelectedPaths(),r=Ns(t,n);return this.#r.canDrag?.(r)!==!1&&(n.includes(t)||this.#oe([t],t,!1),this.#Fe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#Oe(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=Fs(t.draggedPaths,n);(Is(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Ps(t.target,n)||(this.#i={...t,target:n},this.#Oe())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#Oe())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#Oe(),!1;let n=Fs(e.draggedPaths,t);if(Is(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#Oe(),!1;let r=Rs(e.draggedPaths,t);if(r==null)return this.#Oe(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#U.move(e.from,e.to,{collision:e.collision})}else this.#le(r.operations),this.#U.batch(r.operations)}catch(e){return this.#Oe(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#U.add(e)}remove(e,t={}){this.#U.remove(e,t)}move(e,t,n={}){this.#U.move(e,t,n)}batch(e){this.#U.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Ee(e,!0)}openSearch(e=``){this.#Ee(e,!0)}closeSearch(){this.#Ee(null,!0)}isSearchOpen(){return this.#N!==null}getSearchValue(){return this.#N??``}getSearchMatchingPaths(){return this.#A}focusNextSearchMatch(){this.#Te(1)}focusPreviousSearchMatch(){this.#Te(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#U.getPathInfo(e);if(n==null)return!1;let r=n.path,i=$s(r),a=nc(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of Xs(r))this.#U.isExpanded(e)||this.#U.expand(e);return this.#oe([r],r,!1),this.#N!=null&&(this.#Ee(null,!1),this.#y?.(this.#N)),this.#Fe(r),this.#T=r,this.#E=tc(r),this.#D=t.removeIfCanceled??!1,this.#Oe(),!0}#J(){if(this.#T==null)return;let e=this.#T,t=this.#D;this.#T=null,this.#E=``,this.#D=!1,t?this.remove(e,$s(e)?{recursive:!0}:void 0):(this.#Fe(e),this.#Oe())}#Y(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,$s(e)?{recursive:!0}:void 0);return}let t=$s(e),n=ks({files:this.#U.list(),isFolder:t,nextBasename:this.#E,path:nc(e)});this.#T=null,this.#E=``,this.#D=!1,`error`in n?(this.#Fe(e),this.#v?.(n.error),this.#Oe()):n.sourcePath===n.destinationPath?(this.#Fe(e),this.#Oe()):(this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(rc(n.sourcePath,t),rc(n.destinationPath,t)))}#X(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#Oe())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#U.list().length,o=this.#K,s=Bs({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#ue(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#B;this.#q?.(),this.#U=c,this.#d.clear(),this.#ge();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!Ys(this.#V,p);this.#V=new Set(p),m&&(this.#H+=1),this.#B=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#Me(l,l!=null||p.length>0||this.#B!=null),this.#q=this.#Ve(),this.#Oe(),this.#ke({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#K-o})}#Z(e){this.#Le();let t=Zs(e),n=Qs(e,t),r=null,i=null;for(let e of this.#xe()){if(Zs(e)!==t)continue;let a=Qs(e,t);if(a<n)r=e;else if(a>n){i=e;break}}return r??i}#Q(e){let t=this.#we(e);if(t!==-1)return t;let n=Xs(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#we(t);if(r!==-1)return r}return this.#xe().length>0?0:-1}#$(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#U.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#se(r.path):this.#ce(r.path);return this.#d.set(r.path,i),i}#ee(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#V.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#te(e){return this.#ee(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#ne(e,t){let n=this.#U.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#re(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#re(n),n];return this.#a.set(e,r),r}#ie(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#re(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ae(e){this.#U.collapse(e)}#oe(e,t=this.#B,n=!0){let r=[...new Set(e)],i=!Ys(this.#V,r),a=this.#B!==t;(i||a)&&(this.#V=new Set(r),this.#B=t,i&&(this.#H+=1),n&&this.#Oe())}#se(e){return{collapse:()=>{this.#ae(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#Ae(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#U.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#V.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#He(e)}}}#ce(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#V.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#le(e){let t=this.#U.list();this.#ue(t).batch(e)}#ue(e,t,n){return new us({...this.#e,paths:e,preparedInput:t,...n===void 0?{}:{initialExpandedPaths:n}})}#de(){return this.#h??=this.#U.list(),this.#h}#fe(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#de()){e.add(t);for(let n of Xs(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#pe(){return this.#g??=this.#de().map(ec),this.#g}#me(){return this.#f??=this.#fe().filter(e=>e.endsWith(`/`)),this.#f}#he(){return this.#p??=this.#me().map(ec),this.#p}#ge(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#_e(){return this.#me().filter(e=>this.#U.isExpanded(e))}#ve(e){let t=new Set(this.#M??[]);if(e)for(let e of this.#V)for(let n of Xs(e))t.add(n);this.#ye(t)}#ye(e){this.#G=!0;try{for(let t of this.#me()){let n=e.has(t),r=this.#U.isExpanded(t);n&&!r?this.#U.expand(t):!n&&r&&this.#U.collapse(t)}}finally{this.#G=!1}}#be(){if(this.#N==null||this.#N.length===0){this.#I=null,this.#L=null,this.#F=null,this.#K=this.#W;return}let e=this.#b;if(this.#j!==`hide-non-matches`||this.#k.size===0){this.#I=null,this.#L=null,this.#F=null,this.#K=this.#W;return}let t=[],n=[],r=new Map,i=this.#P;for(let[a,o]of e.entries())i?.has(o)===!0&&(r.set(o,n.length),t.push(a),n.push(o));this.#I=t,this.#L=n,this.#F=r,this.#K=n.length}#xe(){return this.#L??this.#b}#Se(e){return this.#L==null?this.#U.getVisibleIndex(e)??-1:this.#F?.get(e)??-1}#Ce(e){return this.#I?.[e]??e}#we(e){return this.#F?.get(e)??this.#U.getVisibleIndex(e)??-1}#Te(e){let t=this.#A;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Ee(e,t){let n=e==null?null:ic(e),r=this.#N;if(r!==n){if(r==null&&n!=null&&(this.#M=this.#_e()),this.#N=n,n==null)this.#O.clear(),this.#ve(!0),this.#M=null,this.#k.clear(),this.#A=[],this.#P=null,this.#Me(this.#c,!0);else if(n.length===0)this.#O.clear(),this.#ve(!1),this.#k.clear(),this.#A=[],this.#P=null,this.#Me(this.#c,!0);else{let e=this.#De();this.#Me(e,!0)}t&&(this.#y?.(this.#N),this.#Oe())}}#De(){if(this.#N==null||this.#N.length===0)return this.#k.clear(),this.#A=[],this.#c;this.#Re();let e=this.#N,t=this.#de(),n=this.#pe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#me(),s=this.#he();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#k=i,this.#A=r;let c=this.#j===`hide-non-matches`&&r.length>0?new Set:null;this.#P=c;let l=this.#j===`expand-matches`?new Set(this.#M??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of Xs(e))l.add(t),c?.add(t)}for(let e of this.#O)if(l.delete(e),c!=null){c.add(e);for(let t of Xs(e))c.add(t)}return this.#ye(l),a??this.#c}#Oe(){for(let e of this.#t)e()}#ke(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#Ae(e){for(let t of Xs(e))this.#U.isExpanded(t)||this.#U.expand(t);this.#U.isExpanded(e)||this.#U.expand(e)}#je(e){let t=this.#K;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#I==null&&r>=this.#b.length&&this.#Le(),this.#Ie(r))}#Me(e,t=!0){let n=this.#U.getVisibleCount();this.#W=n;let r=uc(this.#U.getVisibleTreeProjectionData(t?void 0:Math.min(n,oc)),e,t?e=>this.#U.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#be(),this.#s=e==null?this.#xe().length>0?0:-1:this.#Q(e),this.#c=this.#s<0?null:this.#Ne(this.#s)}#Ne(e){return this.#xe()[e]??(this.#I==null?this.#U.getVisibleRowContext(e)?.row.path??null:null)}#Pe(e){return this.#U.getPathInfo(e)?.path??null}#Fe(e){if(e==null)return;let t=this.#Q(e);t>=0&&this.#Ie(t,!1)}#Ie(e,t=!0){let n=this.#Ne(e);n!=null&&(this.#s!==e||this.#c!==n)&&(this.#s=e,this.#c=n,t&&this.#Oe())}#Le(){this.#l||this.#Me(this.#c,!0)}#Re(){if(this.#O.size!==0)for(let e of[...this.#O])this.resolveMountedDirectoryPathFromInput(e)!==e&&this.#O.delete(e)}#ze(e){if(this.#O.size===0)return;let t=new Set;for(let n of this.#O){let r=Ws(n,e);if(r==null)continue;let i=this.#U.getPathInfo(r)?.path??null;i!=null&&i.endsWith(`/`)&&t.add(i)}this.#O=t}#Be(e){this.#ze(e);let t=Ws(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Ws(this.#c,e,!0),r=[...this.#V].map(t=>Ws(t,e)).filter(e=>e!=null).map(e=>this.#U.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Ws(this.#B,e),a=i==null?null:this.#U.getPathInfo(i)?.path??null,o=[...new Set(r)];return Ys(this.#V,o)||(this.#V=new Set(o),this.#H+=1),this.#B=a,n}#Ve(){return this.#U.on(`*`,e=>{if(this.#G)return;e.canonicalChanged&&(this.#d.clear(),this.#ge()),this.#i!=null&&Vs(e)&&(this.#i=null);let t=Vs(e)?this.#Be(e):this.#c,n;if(this.#N!=null&&this.#N.length>0){let e=this.#De();n=this.#c!=null&&this.#P?.has(this.#c)===!0?this.#c:e}else n=this.#N===``?this.#c:t;let r=this.#N!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#Me(n,r),this.#Oe();let i=Js(e);i!=null&&this.#ke(i)})}#He(e){this.#U.isExpanded(e)?this.#ae(e):this.#Ae(e)}},fc=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function pc(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1)e[t]!==`/`&&t!==e.length?r===-1&&(r=t):r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1);return n===``?null:{isDirectory:t,path:n}}function mc(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function hc(e,t){return t?`${e}/`:e}function gc(e,t=null){let n=fc(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set,o=new Map;for(let t of e??[]){let e=vc(t);e!=null&&xc({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function _c(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=yc(e);t!=null&&(c=bc({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=vc(e);t!=null&&(c=xc({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:wc(i),statusByPath:i}:e}function vc(e){return yc(e.path)}function yc(e){let t=pc(e);if(t!=null)return{canonicalPath:hc(t.path,t.isDirectory),isDirectory:t.isDirectory}}function bc({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),Cc(t,n,e),!0)}function xc({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??Sc(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function Sc(e,t,n){for(let r of mc(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function Cc(e,t,n){for(let r of mc(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function wc(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var q,Tc,Ec,Dc,Oc,kc,Ac,jc,Mc,Nc,Pc={},Fc=[],Ic=Array.isArray,Lc=Fc.slice,Rc=Object.assign;function zc(e){e&&e.parentNode&&e.remove()}function Bc(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?Lc.call(arguments,2):n),Vc(e,o,r,i,null)}function Vc(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Tc,__i:-1,__u:0};return i==null&&q.vnode!=null&&q.vnode(a),a}function Hc(e){return e.children}function Uc(e,t){this.props=e,this.context=t,this.__g=0}function Wc(e,t){if(t==null)return e.__?Wc(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?Wc(e):null}function Gc(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return Gc(e)}}function Kc(e){(8&e.__g||!(e.__g|=8)||!Ec.push(e)||Oc++)&&Dc==q.debounceRendering||((Dc=q.debounceRendering)||queueMicrotask)(qc)}function qc(){for(var e,t,n,r,i,a,o,s,c=1;Ec.length;)Ec.length>c&&Ec.sort(kc),e=Ec.shift(),c=Ec.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=Rc({},r)).__v=r.__v+1,q.vnode&&q.vnode(n),tl(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??Wc(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,rl(a,n,o),n.__e!=i&&Gc(n)));Oc=0}function Jc(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||Fc,b=t.length;for(c=Yc(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?Pc:y[m.__i]||Pc,m.__i=f,_=tl(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&ol(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=Xc(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function Yc(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?Vc(null,o,null,null,null):Ic(o)?Vc(Hc,{children:o},null,null,null):o.constructor==null&&o.__b>0?Vc(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=Zc(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=Wc(s)),sl(s,s));return r}function Xc(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=Xc(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Wc(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Zc(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function Qc(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function $c(e,t,n,r,i){var a;e:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||Qc(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||Qc(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(Ac,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=jc,e.addEventListener(t,a?Nc:Mc,a)):e.removeEventListener(t,a?Nc:Mc,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break e}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function el(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=jc++;else if(t.u<n.l)return;return n(q.event?q.event(t):t)}}}function tl(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,ee,O,k,te,A=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=q.__b)&&d(t);e:if(typeof A==`function`)try{if(v=t.props,y=`prototype`in A&&A.prototype.render,b=(d=A.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new A(v,x):(t.__c=f=new Uc(v,x),f.constructor=A,f.render=cl),b&&b.sub(f),f.props=v,f.state||(f.state={}),f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&A.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Rc({},f.__s)),Rc(f.__s,A.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&A.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&A.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=q.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=Rc({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===Hc&&d.key==null&&(E=il(d.props.children)),s=Jc(e,Ic(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null){if(e.then){for(D=0,ee=!1,t.__u|=c?160:128,t.__c.__z=[],O=0;O<a.length;O++)(k=a[O])==null||ee||(k.nodeType==8&&k.data==`$s`?(D>0&&t.__c.__z.push(k),D++,a[O]=null):k.nodeType==8&&k.data==`/$s`?(--D>0&&t.__c.__z.push(k),ee=D===0,s=a[O],a[O]=null):D>0&&(t.__c.__z.push(k),a[O]=null));if(!ee){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(te=a.length;te--;)zc(a[te]);nl(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||nl(t);q.__e(e,t,n)}else s=t.__e=al(n.__e,t,n,r,i,a,o,c,l,u);return(d=q.diffed)&&d(t),128&t.__u?void 0:s}function nl(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(nl)}function rl(e,t,n){for(var r=0;r<n.length;r++)ol(n[r],n[++r],n[++r]);q.__c&&q.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){q.__e(e,t.__v)}})}function il(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:Ic(e)?e.map(il):Rc({},e)}function al(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(q.__m&&q.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=Lc.call(e.childNodes),v=n.props||Pc,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;$c(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||$c(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),Jc(b==`template`?e.content:e,Ic(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&Wc(n,0),s,c,l),a!=null)for(u=a.length;u--;)zc(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||$c(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&$c(e,u,g,v[u],i))}return e}function ol(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){q.__e(e,n)}}function sl(e,t,n){var r,i;if(q.unmount&&q.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ol(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){q.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&sl(r[i],t,n||typeof e.type!=`function`);n||zc(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function cl(e,t,n){return this.constructor(e,n)}function ll(e,t){var n,r,i,a;t==document&&(t=document.documentElement),q.__&&q.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=Bc(Hc,null,[e]),i=[],a=[],tl(t,e,r||Pc,Pc,t.namespaceURI,r?null:t.firstChild?Lc.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),rl(i,e,a)}function ul(e,t){e.__u|=32,ll(e,t)}q={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw Oc=0,e}},Tc=0,Uc.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Rc({},this.state);typeof e==`function`&&(e=e(Rc({},n),this.props)),e&&Rc(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Kc(this))},Uc.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),Kc(this))},Uc.prototype.render=Hc,Ec=[],Oc=0,kc=function(e,t){return e.__v.__b-t.__v.__b},Ac=/(PointerCapture)$|Capture$/i,jc=0,Mc=el(!1),Nc=el(!0);var dl=0;Array.isArray;function J(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--dl,__i:-1,__u:0,__source:i,__self:a};return q.vnode&&q.vnode(l),l}var fl=16,pl=16,ml={};function hl({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=ml[e]??{width:fl,height:pl},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return J(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:J(`use`,{href:c})})}var gl=e=>e!==void 0&&/\s/.test(e),_l=(e,t)=>{let n=t=>gl(e[t-1])||gl(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},vl=e=>_l(e,Math.ceil(e.length/2)),yl=e=>{if(e.length<2)return[e,``];let t=vl(e);return[e.slice(0,t),e.slice(t)]},bl=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:vl(e);return[e.slice(0,r),e.slice(r)]},xl=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},Sl=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},Cl=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},wl=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function Tl({children:e,marker:t,variant:n=`default`}){"use no memo";return J(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:J(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?J(`span`,{"data-truncate-fade":!0}):t})})}function El(e){"use no memo";let{mode:t,children:n}=e;return J(`div`,{children:[J(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?J(`span`,{children:n}):n}),J(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?J(`span`,{children:n}):n})]})}function Dl({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=J(El,{mode:t,children:e},`content`),o=J(Tl,{marker:n,mode:t,variant:r},`marker`),s=J(`div`,{"data-truncate-fill":!0},`fill`);return J(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:J(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function Ol({children:e,...t}){"use no memo";return J(Dl,{mode:`truncate`,...t,children:e})}function kl({children:e,...t}){"use no memo";return J(Dl,{mode:`fruncate`,...t,children:e})}function Al({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=J(Ol,{...s,children:t[0]}),l=J(kl,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return J(`div`,{className:a,style:o});if(e.length<i)return J(n===`end`?kl:Ol,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=yl:r===`extension`?t=bl:r===`leaf-path`&&(t=xl);else if(typeof r==`number`)t=Sl,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=Cl:e===`first`&&(t=wl)}else typeof r==`function`&&(t=r);t??=yl;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=J(Ol,{...s,..._,children:f}),l=J(kl,{...s,...v,children:p})}return J(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[J(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),J(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var jl={endIndex:-1,startIndex:-1};function Ml(e,t,n){return Math.min(Math.max(e,t),n)}function Nl(e,t){return e<0||t<e?jl:{endIndex:t,startIndex:e}}function Pl(e){return e.startIndex<0||e.endIndex<e.startIndex}function Fl(e,t){return Pl(e)?0:(e.endIndex-e.startIndex+1)*t}function Il(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function Ll(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function Rl(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);i==null?t.set(r,[n]):i.push(n)}),t}function zl(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;o<=t?(i=a,n=a+1):r=a-1}return i}function Bl(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function Vl(e,t,n){if(e.length===0||t<=0)return[];let r=Bl(e),i=Rl(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=zl(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function Hl(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=Ml(t.scrollTop,0,o),c=t.stickyRows??Vl(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=Il(s,n,t.itemHeight),m=Il(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?jl:Nl(m,Ll(u+d,n,t.itemHeight)),y=g+1,b=Pl(v)?jl:Nl(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=Fl(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:Pl(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var Ul={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`};function Wl(e){return e.current?!0:(e.current=!0,!1)}function Gl(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function Kl(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return Gl({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function ql(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function Jl(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function Yl(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function Xl(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function Zl(e,t){return e!=null&&e>0?e:t}function Ql(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function $l(e,t,n,r,i=0){let a=Gl({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function eu(e,t,n,r,i,a,o=0){let s=Kl({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function tu(e,t,n,r,i,a){let o=ql({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function nu(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function ru(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function iu({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return J(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function au(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function ou(e){let{event:t,mode:n,isDirectory:r}=e,i=t.ctrlKey||t.metaKey,a=t.shiftKey||i,o=t.shiftKey?{additive:i,kind:`range`}:i?{kind:`toggle`}:{kind:`single`};return{closeSearch:!1,revealCanonical:n===`sticky`,selection:o,toggleDirectory:!a&&r}}var su,cu,lu,uu,du=Object.is,fu=0,pu=[],mu=q,hu=mu.__b,gu=mu.__r,_u=mu.diffed,vu=mu.__c,yu=mu.unmount,bu=mu.__;function xu(e,t){mu.__h&&mu.__h(cu,e,fu||t),fu=0;var n=cu.__H||(cu.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Su(e){return fu=1,Cu(Pu,e)}function Cu(e,t,n){var r=xu(su++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Pu(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);du(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=cu,!cu.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,du(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};cu.__f=!0;var a=cu.shouldComponentUpdate,o=cu.componentWillUpdate;cu.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},cu.shouldComponentUpdate=i}return r.__N||r.__}function wu(e,t){var n=xu(su++,3);!mu.__s&&Nu(n.__H,t)&&(n.__=e,n.u=t,cu.__H.__h.push(n))}function Tu(e,t){var n=xu(su++,4);!mu.__s&&Nu(n.__H,t)&&(n.__=e,n.u=t,cu.__h.push(n))}function Y(e){return fu=5,Eu(function(){return{current:e}},[])}function Eu(e,t){var n=xu(su++,7);return Nu(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Du(e,t){return fu=8,Eu(function(){return e},t)}function Ou(){for(var e;e=pu.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ju),e.__H.__h.forEach(Mu),e.__H.__h=[]}catch(t){e.__H.__h=[],mu.__e(t,e.__v)}}mu.__b=function(e){cu=null,hu&&hu(e)},mu.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),bu&&bu(e,t)},mu.__r=function(e){gu&&gu(e),su=0;var t=(cu=e.__c).__H;t&&(lu===cu?(t.__h=[],cu.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(ju),t.__h.forEach(Mu),t.__h=[],su=0)),lu=cu},mu.diffed=function(e){_u&&_u(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(pu.push(t)!==1&&uu===mu.requestAnimationFrame||((uu=mu.requestAnimationFrame)||Au)(Ou)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),lu=cu=null},mu.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ju),e.__h=e.__h.filter(function(e){return!e.__||Mu(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],mu.__e(n,e.__v)}}),vu&&vu(e,t)},mu.unmount=function(e){yu&&yu(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ju(e)}catch(e){t=e}}),n.__H=void 0,t&&mu.__e(t,n.__v))};var ku=typeof requestAnimationFrame==`function`;function Au(e){var t,n=function(){clearTimeout(r),ku&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ku&&(t=requestAnimationFrame(n))}function ju(e){var t=cu,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),cu=t}function Mu(e){var t=cu;e.__c=e.__(),cu=t}function Nu(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!du(t,e[n])})}function Pu(e,t){return typeof t==`function`?t(e):t}function Fu(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:J(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return J(Hc,{children:[J(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:J(Ol,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function Iu(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function Lu(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function Ru(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function zu({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=Hl(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:Ru(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?Ru(u,1,t,o):i&&r<=0&&c.length>0?Vl(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var Bu=400,Vu=40,Hu=18;function Uu(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?Wu(e,t,n):a instanceof HTMLElement?a:null}function Wu(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function Gu(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function Ku(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function qu(){return navigator.vendor!==`Apple Computer, Inc.`}function Ju(e,t){let n=e-t.top;if(n<Vu)return-Math.ceil((Vu-Math.max(0,n))/Vu*Hu);let r=t.bottom-e;return r<Vu?Math.ceil((Vu-Math.max(0,r))/Vu*Hu):0}function Yu(e,t,n){if(e!=null){let t=Ul[e];return t==null?null:{text:t,title:n.gitStatusTitles[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:n.containsGitStatusTitle}:null}function Xu(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function Zu(e){return e!=null&&`toggle`in e}function Qu(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function $u(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function ed(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function td(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function nd(e,t){return t&&td(e)||(e.ctrlKey||e.metaKey)&&Qu(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var rd=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function id(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function ad(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function od(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function sd(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function cd(e,t,n){n==null?e.delete(t):e.set(t,n)}function ld(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function ud(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function dd(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function fd(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=dd(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function pd(e,t){return{kind:e.kind,name:Lu(e),path:t}}function md(e){return e==null?void 0:`${e}__tree`}function hd(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function gd(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function _d(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?J(`span`,{title:e.title,children:e.text}):J(`span`,{title:e.title,children:e.parts.map((e,t)=>J(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?gd(e.icon)?t(e.icon):{name:e.icon}:gd(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return J(`span`,{title:e.title,children:J(hl,{...n})})}function vd(e){e!=null&&Jl(e.querySelector(`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)??e)}function yd(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=Iu(e);return J(Hc,{children:[e.depth>0?J(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>J(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,J(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?J(hl,{...t(`file-tree-icon-chevron`)}):J(hl,{...t(`file-tree-icon-file`,u)})}),J(`div`,{"data-item-section":`content`,children:e.isFlattened?Fu(e,c,a):c??J(Al,{minimumLength:5,split:`extension`,children:e.name})}),i?J(`div`,{"data-item-section":`decoration`,children:r==null?null:_d(r,t)}):null,s?J(`div`,{"data-item-section":`git`,children:_d(o,t)}):null,n?J(`div`,{"data-item-section":`action`,children:l?J(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:J(hl,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function bd(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,labels:S,contextMenuEnabled:C,contextMenuTriggerMode:w,contextMenuButtonTriggerEnabled:T,contextMenuButtonVisibility:E,contextMenuRightClickEnabled:D,registerRenameInput:ee,registerButton:O,resolveIcon:k,renderDecorationForRow:te,openContextMenuForRow:A,onRowClick:j,onKeyDown:ne}=e,M=Iu(t),{isParked:N=!1,mode:re=`flow`,style:ie}=r,ae=re===`sticky`,oe=_?.get(M)??null??Xu(t.ancestorPaths,v,y),se=t.kind===`directory`&&(b?.has(M)??!1),ce=te(t,M),le=Yu(oe,se,S),ue=C&&T,de=ce!=null||x||ue,fe=ue&&E===`always`,pe=a.getPath()===M,me=pe?a.getValue():``,he=ae||!pe?null:J(iu,{ref:ee,ariaLabel:S.renameItem(Lu(t)),isFlattened:t.isFlattened,value:me,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ge=yd(t,k,{actionLaneEnabled:ue,customDecoration:ce,decorationLaneEnabled:de,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:le,gitLaneActive:x,renameInput:he,showDecorativeActionAffordance:fe}),_e={...au({ariaLabel:Lu(t),domId:t.isFocused?hd(h,M,N):void 0,extraStyle:ie,features:{actionLaneEnabled:ue,contextMenuButtonVisibility:ue?E:null,contextMenuEnabled:C,contextMenuTriggerMode:C?w:null,gitLaneActive:x},isParked:N,itemHeight:g,mode:re,row:t,state:{containsGitChange:se,effectiveGitStatus:oe,isContextHovered:s===M,isDragTarget:l?.kind===`directory`&&l.directoryPath===M,isDragging:c?.has(M)===!0,isFocusRinged:t.isFocused&&o===M},targetPath:M}),key:n,onContextMenu:C||u?e=>{d()?e.preventDefault():C&&(e.preventDefault(),D&&(i.focusMountedPathFromInput(M),A(t,M,{anchorRect:od(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:ae?void 0:()=>{i.focusMountedPathFromInput(M)},onKeyDown:ae?void 0:ne,ref:e=>{O(M,e)}};return!ae&&pe?J(`div`,{..._e,children:ge}):J(`button`,{..._e,type:`button`,draggable:u&&!N,onDragEnd:u&&!N?p:void 0,onDragStart:u&&!N?e=>{f(e,t,M)}:void 0,onMouseDown:e=>{(ae||i.isSearchOpen())&&e.preventDefault()},onTouchStart:u&&!N?e=>{m(e,t,M)}:void 0,onClick:e=>{j(e,t,M,re)},children:ge})}function xd(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(Iu(e))).map((n,r)=>bd(e,n,t.start+r))}function Sd({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=ms,labels:c=jr,overscan:l=10,renamingEnabled:u=!1,renderRowDecoration:d,searchBlurBehavior:f=`close`,searchEnabled:p=!1,searchFakeFocus:m=!1,slotHost:h,stickyFolders:g=!1,initialViewportHeight:_=420}){"use no memo";let v=Y(null),y=Y(null),b=Y(!1),x=Y(null),S=Y(null),C=Y(null),w=Y(null),T=Y(null),E=Y(new Map),D=Y(new Map),ee=Y(()=>{}),O=Y(null),k=Y(0),te=Y(!1),A=Y(null);A.current!==t&&(te.current=!1,A.current=t);let j=Y(!1),ne=Y(null),M=Y(null),N=Y(!1),re=Y(null),ie=Y(null),ae=Y(null),oe=Y(null),se=Y(null),ce=Y(null),le=Y(null),ue=Y(null),de=Y(!1),fe=Y(null),pe=Y(null),me=Y(null),he=Y(null),_e=Eu(()=>new Map,[]),[,ve]=Su(0),ye=Y(!1),[be,xe]=Su(null),[Se,Ce]=Su(null),[we,Te]=Su(null),[Ee,De]=Su(null),[Oe,ke]=Su(0),[P,Ae]=Su(null),je=Y(P);je.current=P;let Me=Y(0),Ne=Du((e,t)=>{let n=je.current;return n!=null&&n.path===e&&n.source===t?n.token:(Me.current+=1,Me.current)},[]),Pe=Y(null),Fe=Y(null),Ie=Y(null),Le=Y(null),Re=Y(null),ze=Y(!1),Be=()=>{Fe.current=null,Ie.current=null,Le.current=null},Ve=(e,t)=>{Fe.current=e,Ie.current=null,Le.current=t==null?null:{path:e,scrollTop:t}},He=(e,t)=>{Fe.current=null,Ie.current={path:e,viewportOffset:t},Le.current=null},Ue=Y(f===`retain`&&t.isSearchOpen()),[We,Ge]=Su(m);wu(()=>{m||Ge(!1)},[m]);let Ke=Y(!1),qe=Du(()=>{Ke.current=!0,Ge(e=>e&&!1)},[]),[Je,Ye]=Su(()=>zu({controller:t,itemHeight:s,overscan:l,scrollTop:0,stickyFolders:g,viewportHeight:_})),[Xe,Ze]=Su(!1);wu(()=>{Ze(!0)},[]);let Qe=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,$e=e?.contextMenu?.triggerMode??(Qe?`right-click`:`both`),et=$e===`both`||$e===`button`,tt=e?.contextMenu?.buttonVisibility??`when-needed`,nt=$e===`both`||$e===`right-click`;Tu(()=>{let e=C.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Re.current=t,Ce(t),De(t==null?null:`pointer`)},n=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail;ze.current=t?.disabled===!0};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let rt=Du((e,t)=>{cd(E.current,e,t)},[]),it=Du((e,t)=>{cd(D.current,e,t)},[]),at=Du(e=>{S.current=e},[]),ot=Du(e=>ld(e,D.current,E.current),[]),st=n!=null||r!=null||i!=null,{resolveIcon:ct}=Eu(()=>ge(a),[a]),lt=t[ac](),ut=lt.getPath(),dt=ut!=null,ft=t.isSearchOpen(),pt=t.getSearchValue(),F=t.getFocusedPath(),I=t.getFocusedIndex(),mt=t.getScrollRequest(),ht=t.isDragAndDropEnabled(),gt=t.getDragSession(),_t=Eu(()=>gt==null?null:new Set(gt.draggedPaths),[gt]),vt=gt?.target??null,yt=gt?.primaryPath??null,bt=md(o),{overlayHeight:xt,overlayRows:St,snapshot:L,visibleRows:Ct}=Je,wt=L.physical.viewportHeight,Tt=Eu(()=>({end:L.window.endIndex,start:L.window.startIndex}),[L.window.endIndex,L.window.startIndex]),Et=St,Dt=L.sticky.rows,Ot=L.physical.totalHeight,kt=L.sticky.height,At=Eu(()=>new Set(Dt.map(e=>Iu(e.row))),[Dt]),jt=I>=0&&I>=Tt.start&&I<=Tt.end,Mt=Du((e,t)=>d?.({item:pd(e,t),row:e})??null,[d]),Nt=Du(e=>Jl(e==null?null:E.current.get(e)??null)?!0:Jl(C.current),[]),Pt=Du(e=>{let n=t.focusNearestPath(e);Nt(n)},[t,Nt]),Ft=Y(Pt);Ft.current=Pt;let It=Y(!0),Lt=Y(()=>{}),Rt=Du((t=!0,n)=>{let r=je.current;r!=null&&(n==null||n===r.token)&&(It.current=It.current&&t,Ae(null),e?.contextMenu?.onClose?.(),It.current&&Pt(r.path))},[e?.contextMenu,Pt]);Lt.current=Rt;let zt=Du(e=>{let t=e==null?null:sd(C.current,e);Te(e=>e===t?e:t)},[]),Bt=Du((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=ot(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=w.current;Ve(n,e?.scrollTop??null),j.current=!0,xe(e=>e===n?e:n)}i.focus(),zt(a),It.current=!0;let o=r?.source??`keyboard`;Ae({anchorRect:r?.anchorRect??null,item:pd(e,n),path:n,source:o,token:Ne(n,o)})},[t,ot,Ne,zt]),Vt=Du(e=>{if(u){if(t.isSearchOpen()){let e=w.current,t=Xl(e,wt);re.current=I<0||e==null?null:Math.max(0,Math.min(I*s-e.scrollTop,Math.max(0,t-s))),N.current=!0}t.startRenaming(e)!==!1&&(De(`focus`),ve(e=>e+1))}},[t,I,s,u,wt]),Ht=Du((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=w.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let c=Xl(i,wt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:zu({controller:t,itemHeight:s,overscan:l,scrollTop:i.scrollTop,stickyFolders:g,viewportHeight:c}).snapshot.sticky.height;return j.current=!0,tu(i,a,s,c,u,d),ee.current(),Pe.current=n?e:null,!0},[t,s,l,wt,g]),Ut=()=>b.current===!0||he.current!=null||de.current===!0,Wt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Gt=e=>{e!=null&&(typeof window.cancelAnimationFrame==`function`?window.cancelAnimationFrame(e):window.clearTimeout(e))},Kt=()=>{oe.current!=null&&(clearTimeout(oe.current),oe.current=null),ae.current=null},R=()=>{ce.current?.remove(),ce.current=null},qt=()=>{Gt(ie.current),ie.current=null,se.current=null},Jt=e=>{let t=C.current?.getRootNode();t instanceof ShadowRoot?t.append(e):document.body.append(e)},Yt=()=>{ue.current?.(),ue.current=null,he.current!=null&&(clearTimeout(he.current),he.current=null),de.current=!1,fe.current=null,me.current=null,pe.current!=null&&(pe.current.setAttribute(`draggable`,`true`),pe.current.style.removeProperty(`touch-action`),pe.current=null),R(),Kt(),qt(),le.current=null},Xt=(e,n)=>{let r=C.current?.getRootNode(),i=Gu(Uu(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Zt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Kt();return}let r=t.getItem(e.directoryPath),i=Zu(r)?r:null;if(i==null||i.isExpanded()){Kt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;ae.current!==a&&(Kt(),ae.current=a,oe.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Qt=()=>{ie.current=null;let e=se.current,n=w.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=Ju(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,ee.current());let s=Xt(e.clientX,e.clientY);Zt(s),ie.current=Wt(Qt)},$t=(e,t)=>{se.current={clientX:e,clientY:t},ie.current??=Wt(Qt)},en=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Yt(),R(),Kt(),qt(),t.startDrag(r)===!1)e.preventDefault();else if(le.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),qu())){let t=Ku(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Jt(t),ce.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},tn=()=>{R(),Kt(),qt(),le.current=null,t.cancelDrag()},nn=(e,n,r)=>{if(he.current!=null||de.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;me.current={clientX:i.clientX,clientY:i.clientY},pe.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!de.current;he.current!=null&&(clearTimeout(he.current),he.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),ue.current===o&&(ue.current=null),t&&(a.setAttribute(`draggable`,`true`),pe.current===a&&(pe.current=null),me.current=null)},s=e=>{let t=e.touches[0],n=me.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),ue.current=o,he.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),pe.current===a&&(pe.current=null),me.current=null;return}de.current=!0,pe.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),le.current=n;let e=a.getBoundingClientRect(),s=Ku(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Jt(s),ce.current=s,fe.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=fe.current;n!=null&&ce.current!=null&&(ce.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`);let r=Xt(t.clientX,t.clientY);Zt(r),$t(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Xt(n.clientX,n.clientY),t.completeDrag(),Yt()},u=()=>{t.cancelDrag(),Yt()};ue.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},Bu)},rn=e=>{if(P!=null){if(e.key===`Escape`){Rt(),e.preventDefault(),e.stopPropagation();return}rd.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(lt.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)lt.cancel();else if(e.key===`Enter`)lt.commit();else return;De(`focus`),ve(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(u&&e.key===`F2`){Vt(F??void 0),e.preventDefault(),e.stopPropagation();return}if(ft){if(e.key===`Escape`)N.current=!1,re.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e)}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;De(`focus`),ve(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(p&&$u(e)){t.openSearch(e.key),ve(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Qe&&td(e),r=nd(e,Qe),i=r&&C.current!=null?Yl(C.current):null,a=r?new Set(ud(C.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==F&&a.has(o)){let e=w.current;Ve(o,e?.scrollTop??null),t.focusPath(o)}let l=t.getFocusedPath(),d=t.getFocusedIndex(),f=t.getFocusedItem();if(f==null)return;let m=Zu(f)?f:null,h=l!=null&&(At.has(l)||c&&o===l&&a.has(l)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=w.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&l!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=ld(l,D.current,E.current);e==null||n==null?y=!1:Bt(e,l)}else if((e.ctrlKey||e.metaKey)&&Qu(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;De(`focus`);let b=t.getFocusedPath(),x=b!=null&&(At.has(b)||a.has(b)),S=g&&b!==l,T=n&&c&&o===l&&b===l;if((h||T)&&b!=null&&(S&&x||T))Ve(b,v?.scrollTop??null),j.current=!0,xe(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==l;b!=null&&(t||_&&b===l)?(He(b,fd(C.current,v,i,l,s,kt,wt)),j.current=!0,xe(e=>e===b?e:b)):Be()}ve(e=>e+1),e.preventDefault(),e.stopPropagation()};Tu(()=>{p&&ft&&(Ue.current?Ue.current=!1:Jl(T.current))},[ft,p]),Tu(()=>{let e=S.current;switch(ru({hasRenderedInput:e!=null,previousRenamingPath:M.current,renamingPath:ut})){case`reset`:M.current=null;return;case`reveal-canonical`:ut!=null&&Ht(ut,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Pe.current=null,M.current=ut,Jl(e),e.select());return}},[Tt.end,Tt.start,ut,Ht,At]),Tu(()=>{let e=C.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=Yl(e)?.dataset.itemPath??null;xe(e=>e===t?e:t)},i=()=>{n(),j.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{t=null,Yl(e)==null?(j.current=!1,xe(null)):r()},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),j.current=!1,xe(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;xe(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),Tu(()=>{let e=C.current;e!=null&&(L.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[L.physical.scrollTop]),Tu(()=>{let e=null,n=w.current,r=x.current,i=C.current;if(n==null)return;O.current=Xl(n,_);let a=()=>{let e=t.getVisibleCount(),r=Zl(O.current,_),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ye(zu({controller:t,itemHeight:s,overscan:l,scrollTop:Math.min(n.scrollTop,i),stickyFolders:g,viewportHeight:r}))};if(!te.current){te.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=Zl(O.current,_),i=t.getVisibleRows(e,e)[0]??null;$l(n,e,s,r,g&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}ee.current=a;let o=t.subscribe(()=>{Wl(ye)&&ve(e=>e+1),a()}),c=()=>{ze.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),b.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,b.current=!1,ke(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&ze.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{a(),n.scrollTop>0&&d(),je.current!=null&&b.current&&Lt.current(),ze.current===!0?b.current=!1:(Ce(e=>e==null?e:null),c())},m=()=>{c(),f()},h=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{h.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let y=typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0]==null?null:Ql(e[0]);O.current=t??Xl(n,_),a()}):null;return y?.observe(n),()=>{ee.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),b.current=!1,O.current=null,y?.disconnect()}},[t,_,s,l,g]),Tu(()=>{Qe||P==null||Rt(!1)},[Rt,Qe,P]);let an=Eu(()=>P==null?null:`${P.path}::${P.source}`,[P]);Tu(()=>{if(an==null){h?.clearSlotContent(Or);return}let t=je.current;if(t==null)return;let n=y.current??v.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??ad(n.getBoundingClientRect()),close:e=>{Lt.current(e?.restoreFocus??!0,t.token)},restoreFocus:()=>{It.current&&Ft.current(je.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return h?.setSlotContent(Or,i),e?.contextMenu?.onOpen?.(t.item,r),vd(i),queueMicrotask(()=>{i!=null&&i.isConnected&&document.activeElement===i&&vd(i)}),()=>{h?.clearSlotContent(Or)}},[an,e?.contextMenu,h]),Tu(()=>{P!=null&&t.getItem(P.path)==null&&Rt()},[Rt,P,t]),Tu(()=>{if(P==null)return;let e=C.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:C.current,n=e=>{let n=e.target;n instanceof Node&&(id(e)||v.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Rt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Rt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Rt,P]),Tu(()=>{let e=w.current,n=C.current;if(e==null||n==null){ne.current=F;return}let r=F==null?null:E.current.get(F)??null,i=Yl(n),a=i?.dataset.itemPath??null,o=dt&&S.current===i,c=p&&T.current===i,l=N.current&&!ft,u=re.current??0,d=Pe.current,f=Fe.current,m=Ie.current,h=Le.current,_=i!=null,v=j.current||_,y=ne.current!==F,b=f!=null&&f===F&&F!=null,x=!1,D=!1;if(mt!=null&&mt.id!==k.current){k.current=mt.id;let n=mt.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=g?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,wt-s))):kt;x=!0,D=eu(e,n,s,wt,Ot,mt.offset,t)}t.clearScrollRequest(mt.id)}let O=!x&&l&&tu(e,I,s,wt,Ot,u),te=!x&&d!=null&&d===F&&tu(e,I,s,wt,Ot,kt),A=!x&&m!=null&&m.path===F&&tu(e,I,s,wt,Ot,m.viewportOffset),M=!x&&h!=null&&h.path===F&&e.scrollTop!==h.scrollTop;M&&(e.scrollTop=h.scrollTop),(M||D||te||A||O||v&&y&&d!==F&&!b&&$l(e,I,s,wt,kt))&&ee.current(),x?ne.current=F:v?o||c&&!l?ne.current=F:r==null?(l&&I>=0&&(tu(e,I,s,wt,Ot,u),ee.current()),ne.current=F):((y||l||d===F||f===F||m?.path===F||h?.path===F||a==null||a!==F)&&(Jl(r),d===F&&(Pe.current=null),f===F&&(Fe.current=null),m?.path===F&&(Ie.current=null),h?.path===F&&(Le.current=null),N.current=!1,re.current=null),ne.current=F):ne.current=F},[t,I,F,jt,s,dt,ft,Tt,wt,p,mt,g,kt,Ot,Ct]);let on=I>=0&&I>=L.visible.startIndex&&I<=L.visible.endIndex,sn=F!=null&&Et.some(e=>Iu(e.row)===F),cn=on||sn,ln=et&&j.current===!0&&cn?F:null,un=Ee===`pointer`?Se:null,dn=P?.path??Re.current??un??ln??Se,fn=P?.source===`right-click`;Tu(()=>{b.current&&P==null||zt(ot(dn))},[P,ot,Tt,wt,Oe,Et,dn,zt,Ct]);let pn=Du(e=>{if(b.current||id(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&De(e=>e===`pointer`?e:`pointer`),Ce(e=>e===i?e:i)},[]),mn=Du(()=>{Ce(null)},[]);Tu(()=>{if(!ht)return;let e=()=>{Yt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Yt(),t.cancelDrag()}},[t,ht]);let hn=e=>{if(!ht||t.getDragSession()==null||de.current)return;let n=Gu(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n);let r=t.getDragSession()?.target??null;Zt(r),$t(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},gn=e=>{if(!ht||t.getDragSession()==null||de.current)return;let n=e.relatedTarget;n instanceof Node&&C.current?.contains(n)===!0||(Kt(),qt(),t.setDragTarget(null))},_n=e=>{ht&&t.getDragSession()!=null&&!de.current&&(e.preventDefault(),Xt(e.clientX,e.clientY),t.completeDrag(),R(),Kt(),qt(),le.current=null)},vn=L.window.height,yn=L.window.offsetTop,bn=Math.min(0,wt-vn),xn=Math.min(0,wt-vn-kt),Sn=be===F||N.current,Cn=F!=null&&Sn&&!jt&&I>=0?Ct[I]??t.getVisibleRows(I,I)[0]??null:null,wn=Cn==null?null:nu(I,s,Tt,vn),Tn=le.current,En=yt!=null&&Tn!=null&&Tn.path===yt&&Tn.index>=Tt.start&&Tn.index<=Tt.end,Dn=yt!=null&&Tn!=null&&Tn.path===yt&&!En&&Tn.path!==Cn?.path?Tn:null,On=Dn==null?null:nu(Dn.index,s,Tt,vn),kn=ed((I>=0?Ct[I]??t.getVisibleRows(I,I)[0]??null:null)?.ancestorPaths.at(-1)??null),An=ft&&F!=null?hd(o,F,!jt):void 0,jn=P?.path??(ft?F:be),Mn=P?.path??Se,Nn=ot(dn),Pn=Qe&&et&&!fn&&!dt&&Nn!=null&&we!=null&&dn!=null,Fn=Qe&&(Pn||P!=null),In=P?.anchorRect,Ln=In==null&&Nn!=null&&we!=null&&(P!=null||Pn)?we:null,Rn=In==null?Ln==null?void 0:{top:`${Ln}px`}:{left:`${In.left}px`,position:`fixed`,right:`auto`,top:`${In.top}px`},zn=fn?{opacity:`0`}:void 0,Bn=Du((e,n,r,i)=>{let a=ou({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:ft,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=L.visible.startIndex&&n.index<=L.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(j.current=!0,xe(e=>e===c?e:c),De(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Ht(c,{targetOffset:`sticky-parents`})},[t,ft,L.visible.endIndex,L.visible.startIndex,Ht]),Vn=()=>{if(b.current||!et||dn==null||Nn==null)return;let e=t.getItem(dn);if(e==null)return;zt(Nn),It.current=!0;let n=e.getPath();Ae({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:Nn.getAttribute(`aria-label`)??dn,path:n},path:n,source:`button`,token:Ne(n,`button`)})},Hn={contextHoverPath:Mn,contextMenuButtonTriggerEnabled:et,contextMenuButtonVisibility:tt,contextMenuEnabled:Qe,contextMenuRightClickEnabled:nt,contextMenuTriggerMode:$e,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:ht,draggedPathSet:_t,dragTarget:vt,gitLaneActive:st,gitStatusByPath:n,handleRowDragEnd:tn,handleRowDragStart:en,handleRowTouchStart:nn,ignoredGitDirectories:r,ignoredInheritanceCache:_e,instanceId:o,itemHeight:s,labels:c,onKeyDown:rn,onRowClick:Bn,openContextMenuForRow:Bt,registerButton:rt,registerRenameInput:at,renameView:lt,renderDecorationForRow:Mt,resolveIcon:ct,shouldSuppressContextMenu:Ut,visualFocusPath:jn},Un={...Hn,registerButton:it};return J(`div`,{ref:C,id:bt,"data-file-tree-context-menu-button-visibility":Qe&&et?tt:void 0,"data-file-tree-context-menu-trigger-mode":Qe?$e:void 0,"data-file-tree-has-context-menu-action-lane":Qe&&et?`true`:void 0,"data-file-tree-has-git-lane":st?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:ht?gn:void 0,onDragOver:ht?hn:void 0,onDrop:ht?_n:void 0,onKeyDown:rn,onPointerLeave:Qe?mn:void 0,onPointerOver:Qe?pn:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[J(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:kn}}),J(`slot`,{name:Dr,"data-type":`header-slot`}),p?J(`div`,{"data-file-tree-search-container":!0,"data-open":ft?`true`:`false`,children:J(`input`,{ref:T,"aria-activedescendant":An,"aria-controls":bt,placeholder:c.searchPlaceholder,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":We?`true`:void 0,value:pt,onBlur:()=>{(f!==`retain`||Ke.current)&&t.closeSearch()},onFocus:qe,onPointerDown:qe,onInput:e=>{qe();let n=e.currentTarget;t.setSearch(n.value)}})}):null,J(`div`,{ref:w,"data-file-tree-virtualized-scroll":`true`,children:[g&&Xe&&Et.length>0?J(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:J(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${xt}px`},children:Et.map((e,t)=>bd(Un,e.row,`sticky:${Iu(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${Et.length-t}`}}))})}):null,J(`div`,{ref:x,"data-file-tree-virtualized-list":`true`,style:{height:`${Ot}px`},children:[J(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${yn}px`}}),J(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${vn}px`,top:`${bn}px`,bottom:`${xn}px`},children:[xd(Hn,Tt,At),Cn!=null&&wn!=null?bd(Hn,Cn,`parked:${Cn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:yt===Cn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${wn}px`}}):null,Dn!=null&&On!=null?bd(Hn,Dn,`parked-drag:${Dn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${On}px`}}):null]})]})]}),Qe?J(`div`,{ref:v,"data-type":`context-menu-anchor`,"data-visible":Fn?`true`:`false`,style:Rn,children:[J(`button`,{ref:y,type:`button`,"data-type":kr,"aria-label":c.contextMenuTrigger,"aria-haspopup":`menu`,"aria-expanded":P==null?`false`:`true`,"data-visible":Pn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{e.preventDefault(),e.stopPropagation(),P==null?Vn():Rt()},tabIndex:-1,style:zn,children:J(hl,{...ct(`file-tree-icon-ellipsis`)})}),P==null?null:J(`slot`,{name:Or})]}):null,P==null?null:J(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Rt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Rt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var Cd={hydrateRoot:(e,t)=>{ul(Bc(Sd,t),e)},renderRoot:(e,t)=>{ll(Bc(Sd,t),e)},unmountRoot:e=>{ll(null,e)}};function wd(e,t){Cd.renderRoot(e,t)}function Td(e,t){Cd.hydrateRoot(e,t)}function Ed(e){Cd.unmountRoot(e)}var Dd=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);n===t?t!=null&&(this.#e.set(e,t),this.#r(e,t)):(n?.remove(),t==null?this.#e.delete(e):(this.#e.set(e,t),this.#r(e,t)))}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}};Array.isArray;var Od=0;function kd(e){return e!=null&&e.length>0?e:(Od+=1,`pst_ft_${Od}`)}function Ad({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??ms)}function jd(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function Md(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function Nd(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var Pd=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new Dd;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b=null;#x;#S=!1;#C=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,labels:l,onSearchChange:u,onSelectionChange:d,overscan:f,renderRowDecoration:p,renaming:m,search:h,searchBlurBehavior:g,searchFakeFocus:_,stickyFolders:v,unsafeCSS:y,initialVisibleRowCount:b,...x}=e;this.#e=t,this.#n=kd(a),this.#p=gc(i),this.#m=s,this.#h=Mr(l),this.#g=y,this.#r=d,this.#i=p,this.#a=m!=null&&m!==!1,this.#o=g,this.#s=h===!0,this.#c=_===!0,this.#u=ps(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:f,stickyFolders:v,initialVisibleRowCount:b},this.#t=new dc({...x,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:u,renaming:m}),this.#y=this.#t.getSelectionVersion(),this.#b=this.#r==null?null:this.subscribe(()=>{this.#O()})}unmount(){this.#x!=null&&(Ed(this.#x),delete this.#x.dataset.fileTreeVirtualizedWrapper,this.#x=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#L(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#b?.(),this.#b=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{t?e():t=!0})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=_c(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#E();n!=null&&wd(n.wrapper,this.#T())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#E();t!=null&&(this.#k(),wd(t.wrapper,this.#T()))}setGitStatus(e){let t=gc(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#E();n!=null&&wd(n.wrapper,this.#T())}setIcons(e){this.#m=e;let t=this.#E();t!=null&&(this.#D(t.host,t.wrapper),wd(t.wrapper,this.#T()))}setLabels(e){this.#h=Mr(e);let t=this.#E();t!=null&&wd(t.wrapper,this.#T())}hydrate({fileTreeContainer:e}){let t=this.#F(e),n=this.#P(t);this.#k(),Td(n,this.#T())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#F(t??this.#f,e),r=this.#P(n);this.#k(),wd(r,this.#T())}#w(){return{initialViewportHeight:Ad({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#T(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,labels:this.#h,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#w()}}#E(){let e=this.#f,t=this.#x;return e==null||t==null?null:{host:e,wrapper:t}}#D(e,t){let n=e.shadowRoot;n!=null&&(this.#A(n),this.#j(n)),this.#M(t)}#O(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#y&&(this.#y=t,e(this.#t.getSelectedPaths()))}#k(){let e=this.#e?.header?.render;e==null?this.#l.setSlotHtml(Dr,this.#e?.header?.html??null):this.#l.setSlotContent(Dr,e())}#A(e){let t=Nd(e).find(e=>Md(e)),n=jd(Be(ye(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#j(e){let t=Nd(e),n=t.find(e=>Md(e)),r=t.filter(e=>e!==n),i=ye(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=jd(i);if(a==null)for(let e of r)e.remove();else if(r.length!==1||r[0].outerHTML!==a.outerHTML){for(let e of r)e.remove();e.appendChild(a)}}#M(e){let t=ye(this.#m);t.colored&&Me(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#N(e){let t=e.querySelector(`style[${Cr}]`);this.#_==null&&t instanceof HTMLStyleElement&&(this.#_=t),this.#g==null||this.#g===``?(this.#_?.remove(),this.#_=void 0,this.#v=void 0):(this.#_?.parentNode!==e||this.#v!==this.#g)&&(this.#_??=document.createElement(`style`),this.#_.setAttribute(Cr,``),this.#_.parentNode!==e&&e.appendChild(this.#_),this.#_.textContent=vs(this.#g),this.#v=this.#g)}#P(e){if(this.#x!=null)return this.#x;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#x=r??document.createElement(`div`),this.#x.dataset.fileTreeId=this.#n,this.#x.dataset.fileTreeVirtualizedWrapper=`true`,this.#D(e,this.#x),this.#x.parentNode!==t&&t.appendChild(this.#x),this.#x}#F(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return ws(n,r),this.#N(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#I(n),this.#l.setHost(n),this.#f=n,n}#I(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#S=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#C=!0)}#L(e){this.#S&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#C&&=(e.style.removeProperty(`--trees-density-override`),!1)}};function Fd(e,t){return e.model===t.model&&e.rows===t.rows&&e.annotations===t.annotations&&e.annotationSlotName===t.annotationSlotName&&Mn(e.renderRange,t.renderRange)}var Id=class{lineCuts;#e=new un;#t;#n;constructor(e){this.lineCuts=e}markLines(e){let t=this.#n??=new Set;for(let n of e)t.add(n)}layout(e){let t=this.#n;this.#n=void 0;let n=this.#t;if(t!=null&&n!=null&&Fd(n.input,e))return this.#r(n,t,e);let{model:r,renderRange:i,annotations:a}=e,o=Tn(),s=new Map,c=0;this.lineCuts.startLayout();let l=t=>t.map(t=>e.annotationSlotName(t)),u=(e,t)=>{this.#e.fixedRow(o,`ann:${e}`,`context|${t.hunkIndex},${t.lineIndex}|${t.annotations.join(`,`)}`,()=>({gutter:pr(`context`,`annotation`,1),content:fn(gn(t))})),c++},d=Rn(i)?on(a):void 0;d!=null&&u(`file`,{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:l(d)});let f=r.lineCount,p=Math.min(i.startingLine+i.totalLines,f);for(let t=i.startingLine;t<p;t++){let n=t+1,i=`a${r.lineId(t)}`;s.set(i,o.specs.length),Un(o,this.#i(e,t,i)),c++;let d=a[n];d!=null&&d.length>0&&u(i,{type:`annotation`,hunkIndex:0,lineIndex:n,annotations:l(d)})}let m={column:o.specs,patched:void 0,rowCount:c,totalLines:f};return this.#t={input:e,result:m,positions:s},m}#r(e,t,n){let{model:r}=n,i=e.result.column.slice(),a=[];for(let o of t){if(o<0||o>=r.lineCount)continue;let t=`a${r.lineId(o)}`,s=e.positions.get(t);if(s==null)continue;let c=this.#i(n,o,t);i[s]=c,a.push(c)}let o={...e.result,column:i,patched:a};return this.#t={input:n,result:o,positions:e.positions},o}#i({model:e,rows:t},n,r){let i=n+1,a=`${n}`,o=t.additionRow(e,n),s=this.#e.line(this.lineCuts.additionRow(o,e,n,i),{"data-line-type":`context`},i,void 0,a);return{key:r,gutter:this.#e.gutter(r,`context`,i,a),content:s}}forgetLines(e){this.#e.forgetLines(e)}invalidateLines(){this.#t=void 0,this.#n=void 0}},Ld=class e{file;static fromFile(t){return new e(t,In(t.contents),void 0)}static startEditSession(t,n){let r=n??t,i=Wt(r.contents),a={name:r.name,lang:r.lang,contents:i},o=In(i);return new e(a,o,new Lt(o.length))}#e;#t;constructor(e,t,n){this.file=e,this.#e=t,this.#t=n}get live(){return this.#t!=null}get lineCount(){return this.#e.length}get lines(){return this.#e}lineText(e){return this.#e[e]??``}lineId(e){return this.#t?.idAt(e)??e}lineOf(e){return this.#t?.lineOf(e)??(e<this.#e.length?e:void 0)}lineIds(){return this.#t?.ids()??this.#e.map((e,t)=>t)}applyChange(e,t){let n=this.#t;if(n==null)throw Error(`FileModel.applyChange: the model is not live`);let r=n.applyChange(e),i=[];if(e.lineDelta===0)for(let[n,r]of mn(t,e))this.#e[n]!==r&&(this.#e[n]=r,i.push(n));else{this.#e=ot(t).lines;for(let t=e.startLine;t<=e.endLine;t++)i.push(t)}return this.file.contents=this.#e.join(``),{changedLines:i,removedLineIds:r,lineDelta:e.lineDelta}}};function Rd(e,t){return I(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}var zd={forcePlainText:!1};function Bd(e,t,{theme:n,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,lazyLineAST:o=!1,startingLine:s,totalLines:c,lines:l}=zd){a?(s??=0,c??=1/0):(s=0,c=1/0);let u=s>0||c<1/0,d=u?l??In(e.contents):void 0,f={lineInfo:[]},p=a?`text`:e.lang??Nn(e.name),m=typeof n==`string`?t.getTheme(n).type:void 0,h=Bt({theme:n,highlighter:t});if(d!=null&&Math.min(s+c,d.length)<=s)return{code:Array(s),themeStyles:h,baseThemeType:m};f.lineInfo=e=>({type:`context`,lineIndex:e-1+s,lineNumber:e+s});let g=ur(t.codeToTokens(Vd(d==null?e.contents:Hd(d,s,c)),Gt(p,n,r)).tokens,{state:f,useTokenTransformer:i,lazyLineAST:o&&!a&&!i,cacheHtmlStyles:t.name===`highlights`}),_=u?Array(s):g;return u&&fr(_,g),{code:_,themeStyles:h,baseThemeType:m}}function Vd(e){return e.replace(/\r(?!\n)/g,`
|
|
1100
|
+
`)}function Hd(e,t,n){if(e.length===0)return``;let r=Math.min(t+n,e.length),i=e.slice(t,r).join(``);return r<e.length?en(i):i}function Ud(e){return(e.lang??Nn(e.name))===`text`}var Wd=-1,Gd=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`file-renderer:${++Wd}`;file;renderCache;pendingHighlightResult;computedLang=`text`;annotationList=[];lineAnnotations={};lineCuts=new _t;editSessionActive=!1;model;rowSource;layout;get fileCache(){return this.renderCache?.file}constructor(e={theme:C},t=vt,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r}expandLine(e){this.lineCuts.expand(e),this.layout?.invalidateLines()}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){let{annotationList:t}=this;if(!(e===t||e.length===0&&t.length===0)){this.annotationList=e,this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}}cleanUp(){this.endEditSession(),this.recycle(),this.lineCuts.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.file=void 0,this.editSessionActive?(this.workerManager?.cancelLocalThemeRender(this),this.renderCache!=null&&(this.renderCache.renderRange=void 0),this.pendingHighlightResult=void 0):this.clearRenderCache(),this.workerManager?.cleanUpTasks(this)}startEditSession(e,t){let n=Ld.startEditSession(e,t),{rowSource:r,model:i}=this,a=this.promoteReadyResult(e)??this.renderCache;this.editSessionActive=!0,this.model=n,this.file=n.file,this.pendingHighlightResult=void 0;let{options:o}=this.getRenderOptions(n.file);if(!(i!=null&&i.live&&a?.file===i.file)&&a?.result!=null&&a.highlighted&&a.file.contents===n.file.contents&&R(a.file,e)&&Rd(a.options,o)){let{result:e}=a,t={ids:n.lineIds(),texts:n.lines.slice()};this.renderCache={file:n.file,options:o,highlighted:!0,result:e,renderRange:a.renderRange,lines:t},r!=null&&r.result===e?(r.source.setHighlightRows({deletionRows:[],additionRows:e.code,additionLines:t.texts,lineIds:t.ids}),this.layout?.invalidateLines(),r.model=n):this.rowSource=void 0}else a!=null&&a.options.useTokenTransformer!==!0&&zt(n.file.name),this.renderCache=void 0,this.rowSource=void 0;return n.file}promoteReadyResult(e){let{options:t}=this.getRenderOptions(e),n=this.getReadyRenderResult(e,t);return n==null?void 0:{...n,file:e,renderRange:void 0}}applyChange(e,t,n){let r=this.requireSession(),i=r.applyChange(e,t);return i.removedLineIds.length>0&&(this.editSessionRows(r).source.forgetLines(i.removedLineIds),this.layout?.forgetLines(i.removedLineIds)),i.lineDelta!==0||i.removedLineIds.length>0?this.layout?.invalidateLines():this.layout?.markLines(i.changedLines),n!=null&&this.setTokens(n),i}setTokens(e){let t=this.requireSession(),n=this.editSessionRows(t).source,r=[];for(let[i,a]of e)n.setTokens(t.lineId(i),a)&&r.push(i);return this.layout?.markLines(r),r}lineKey(e){let t=this.requireSession();return e>=0&&e<t.lineCount?`a${t.lineId(e)}`:void 0}lineOfKey(e){let t=this.requireSession();return e.startsWith(`a`)?t.lineOf(Number(e.slice(1))):void 0}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.file??this.clearRenderCache()}requireSession(){let{model:e}=this;if(!this.editSessionActive||e==null||!e.live)throw Error(`FileRenderer: no edit session is active`);return e}editSessionRows(e){let{rowSource:t}=this;if(t!=null&&t.model===e)return t;let n=new Xt({deletionRows:[],additionRows:[],additionLines:[],lineIds:[]});return this.rowSource={result:{code:[],themeStyles:``,baseThemeType:void 0},source:n,model:e}}editorRenderReady(){let{renderCache:e,rowSource:t}=this;return e?.options.useTokenTransformer===!0&&e.highlighted&&e.result!=null&&t?.result===e.result}waitForLocalTheme(e){let{workerManager:t,onRenderUpdate:n}=this;return n!=null&&t?.renderWhenLocalThemeLoads(this,n,e)===!0}clearRenderCache(){this.workerManager?.cancelLocalThemeRender(this),this.renderCache=void 0,this.pendingHighlightResult=void 0,this.layout=void 0,this.editSessionActive?this.rowSource?.source.forgetTokens():(this.rowSource=void 0,this.model=void 0)}hydrate(e){this.file=e;let{options:t}=this.getRenderOptions(e),n=Kd(this.getLineCount(e),this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!Rd(t,r.options)&&(r=void 0),this.renderCache??={file:e,hydrated:!0,options:t,highlighted:!n&&!Ud(e),result:n?void 0:r?.result,renderRange:void 0};let i=this.getHighlightWorkerManager(e);i==null?this.options.deferHydrationHighlight!==!0&&Qe({theme:this.getLocalHighlightTheme()})==null&&(this.computedLang=e.lang??Nn(e.name),this.initializeHighlighter().catch(e=>{e instanceof s||this.onHighlightError(e)})):this.renderCache.result==null&&!n&&i.highlightFileAST(this,e)}awaitsPoolHighlight(e){let t=this.getHighlightWorkerManager(e);if(t==null||e.cacheKey==null||t.didHighlightFail(e))return!1;let n=t.getFileRenderOptions();return n.useTokenTransformer===!0&&e.contents.length>0&&!Ud(e)&&!Kd(this.getLineCount(e),this.getTokenizeMaxLength())&&!this.hasHighlightedRenderCache(e,n)&&this.getReadyRenderResult(e,n)==null}getHighlightWorkerManager(e){let{editSessionActive:t,workerManager:n}=this;return!t&&n?.isWorkingPool()===!0&&!n.shouldHighlightOnMainThread(e)?n:void 0}cacheHighlightResult(e,t){let{editSessionActive:n,workerManager:r}=this;!n&&r?.isWorkingPool()===!0&&r.setFileResultCache(e.cacheKey,t)}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??C}getLineCutLength(e=this.options){if(this.editSessionActive)return 1/0;let{tokenizeMaxLineLength:t=1e3}=this.getEffectiveCodeOptions(e);return t>0?t:1/0}getEffectiveCodeOptions(e=this.options){let t=this.workerManager?.getFileRenderOptions();return{theme:t?.theme??this.options.theme??C,tokenizeMaxLineLength:t?.tokenizeMaxLineLength??e.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager!=null){let e=this.workerManager.getFileRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{tokenizeMaxLineLength:e=1e3}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:e}})(),{renderCache:n}=this;return n?.result==null||!R(e,n.file)||!Rd(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getFileForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null)return e;let{renderCache:n}=this;if(n==null)return e;if(R(n.file,e))return n.file;let r=e.contents.length===0||Ud(e)||Kd(this.getLineCount(e),this.getTokenizeMaxLength());return this.canRenderFile(e,t,r)?e:n.file}canRenderFile(e,t,n){let{renderCache:r}=this;return r==null||R(r.file,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0&&!this.workerManager.shouldHighlightOnMainThread(e)||Qe({theme:t.theme})!=null:r.result==null&&r.hydrated!==!0?!0:this.getHighlightWorkerManager(e)==null?Qe({theme:t.theme})!=null:!r.highlighted}getLineCount(e){let{model:t}=this;return t!=null&&t.file===e?t.lineCount:this.editSessionActive?On(e.contents)+1:this.modelFor(e).lineCount}modelFor(e){let{model:t}=this;if(t!=null&&t.file===e)return t;if(this.editSessionActive)throw Error(`FileRenderer: only the session file renders during an edit session`);return this.model=Ld.fromFile(e)}renderCollapsed(e){this.workerManager?.cancelLocalThemeRender(this),this.file=e;let{renderCache:t}=this;t!=null&&(!R(t.file,e)||t.hydrated===!0&&t.result==null)&&this.clearRenderCache();let n=this.getLocalHighlightTheme(),r=Qe({theme:n});if(r==null){this.initializeHighlighter(`text`).then(()=>this.onRenderUpdate?.()).catch(e=>{e instanceof s||this.onHighlightError(e)});return}let{disableFileHeader:i=!1}=this.options;return{headerAST:i?void 0:this.renderHeader(e),themeStyles:Bt({theme:n,highlighter:r}),baseThemeType:typeof n==`string`?r.getTheme(n).type:void 0}}renderFile(e=this.file,t=b){if(this.file=e,e==null){this.pendingHighlightResult=void 0;return}let{options:n,forceHighlight:r}=this.getRenderOptions(e),i=this.getReadyRenderResult(e,n);this.pendingHighlightResult=void 0,i!=null&&(this.renderCache={...i,file:e,renderRange:void 0,lines:this.lineSnapshot(this.modelFor(e))},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=!R(e,this.renderCache.file),o=a?e:this.renderCache.file,c=this.modelFor(o),l=e.contents.length>0,u=!l||Ud(e)||Kd(c.lineCount,this.getTokenizeMaxLength()),d=this.canRenderFile(e,n,u),f=!Mn(this.renderCache.renderRange,t),p=this.getHighlightWorkerManager(e);if(p!=null){let i=this.renderCache.result==null&&this.renderCache.highlighted&&!u&&!a&&Jt(t);if(d&&!i&&(u||this.renderCache.result==null||!this.renderCache.highlighted&&(a||f))){if(this.renderCache.file=o,this.renderCache.options=n,this.renderCache.highlighted=!1,this.renderCache.result==null||a||f||r){let n=p.getPlainFileAST(e,t.startingLine,t.totalLines,c.lines);n??this.waitForLocalTheme();let{result:i}=this.renderCache,o=n;i!=null&&n!=null&&!a&&!r&&(ut(i.code,n.code),o=i),o!==i&&(this.renderCache.lines=this.lineSnapshot(c)),this.renderCache.result=o}this.renderCache.renderRange=t}!u&&l&&(!this.renderCache.highlighted||r)&&p.highlightFileAST(this,e)}else{this.computedLang=e.lang??Nn(e.name);let i=Qe(),a=i!=null&&le(n.theme,i),l=i!=null&&En(this.computedLang,i),f=!u&&l,p=Number.isFinite(t.totalLines);if(d&&i!=null&&a&&(r||!this.renderCache.highlighted&&f||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,i,u||!l,p);this.renderCache={file:o,options:n,highlighted:f,result:t,renderRange:void 0,lines:this.lineSnapshot(c)},f&&this.cacheHighlightResult(e,{result:t,options:n})}if(!a||!u&&!l){if(this.renderCache.result==null&&!this.renderCache.highlighted&&!this.editSessionActive&&this.waitForLocalTheme(u||l?[]:[this.computedLang]))return;this.asyncHighlight(e,p).then(({result:t,options:n})=>{u||this.cacheHighlightResult(e,{result:t,options:n}),this.applyHighlightResult(e,t,n,!u)}).catch(e=>{e instanceof s||this.onHighlightError(e)})}}if(this.renderCache.result!=null)return this.workerManager?.cancelLocalThemeRender(this),this.layoutResult(this.renderCache.file,t,this.renderCache.result,this.renderCache.lines);if(!this.editSessionActive)return;let{result:m}=this.editSessionRows(this.requireSession());return this.layoutResult(this.renderCache.file,t,m,{ids:[],texts:[]})}async asyncRender(e,t=b){this.file=e;let{result:n}=await this.asyncHighlight(e,Number.isFinite(t.totalLines));return this.layoutResult(e,t,n,this.lineSnapshot(this.modelFor(e)))}async asyncHighlight(e,t=!1){let n=Kd(this.getLineCount(e),this.getTokenizeMaxLength());this.computedLang=n?`text`:e.lang??Nn(e.name);let r=Qe(),i=r!=null&&le(this.getLocalHighlightTheme(),r),a=n||r!=null&&En(this.computedLang,r);return r!=null&&i&&a||(r=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,r,n,t)}renderFileWithHighlighter(e,t,n=!1,r=!1){let{options:i}=this.getRenderOptions(e);return{result:Bd(e,t,i,{forcePlainText:n,lazyLineAST:r}),options:i}}lineSnapshot(e){return e.live&&e===this.model?{ids:e.lineIds(),texts:e.lines.slice()}:void 0}getRowSource(e,t,n){let{rowSource:r}=this;if(r!=null&&r.result===e)return r.source;if(t.live&&n==null)throw Error(`FileRenderer: a highlight result for an edited file has no line snapshot`);let i={deletionRows:[],additionRows:e.code,additionLines:n?.texts??t.lines,lineIds:n?.ids};if(r!=null&&t.live&&r.model===t)return r.source.setHighlightRows(i),this.layout?.invalidateLines(),r.result=e,r.source;let a=new Xt(i);return this.rowSource={result:e,source:a,model:t},a}layoutInput(e,t,n){return this.lineCuts.setLimit(this.getLineCutLength()),{model:e,rows:t,renderRange:n,annotations:this.lineAnnotations,annotationSlotName:this.annotationSlotName}}layoutResult(e,t,n,r){let{themeStyles:i,baseThemeType:a}=n,{disableFileHeader:o=!1}=this.options,s=this.layout??=new Id(this.lineCuts),c=this.modelFor(e),l=this.rowSource?.result,u=this.getRowSource(n,c,r),{column:d,patched:f,rowCount:p,totalLines:m}=s.layout(this.layoutInput(c,u,t));return{file:e,column:d,allRowsChanged:l!==n,patched:f,preAST:this.createPreElement(m),headerAST:o?void 0:this.renderHeader(e),totalLines:m,rowCount:p,themeStyles:i,baseThemeType:a,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return Qt({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return lr(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(dr({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=Zn(e.column),n=cr();return n.children=t.gutter,n.properties.style=`grid-row: span ${e.rowCount}`,[n,Qn(t.content,e.rowCount)]}initializeHighlighter(e=this.computedLang){return nt(Tt(e,{theme:this.getLocalHighlightTheme(),preferredHighlighter:bt(this.workerManager,this.options)}))}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{file:i,renderCache:a}=this;i!=null&&a!=null&&R(e,i)&&Rd(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&Rd(a.options,n)&&R(a.file,i)||(this.pendingHighlightResult={file:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getFileResultCache(e);if(n!=null&&Rd(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&R(n.file,e)&&Rd(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{file:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&R(e,n.file)&&Rd(t,n.options)}onHighlightError(e){console.error(e)}onLocalFallback(){this.onRenderUpdate?.()}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return Ct({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function Kd(e,t){return e>t}function qd(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function Jd(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,deferHydrationHighlight:e?.deferHydrationHighlight,useCSSClasses:e?.useCSSClasses,useTokenTransformer:ft(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}var Yd=-1,Xd=class{options;workerManager;requestOwnerRender;static LoadedCustomComponent=!0;__id=`file:${++Yd}`;type=`file`;fileContainer;spriteSVG;pre;codeColumns=new Ht;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;columnReconcilers=new WeakMap;changedRowKeys=[];mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;get lineAnnotations(){return this.renderedData?.lineAnnotations??r}managersDirty=!1;appliedManagerSetup;file;editSession;renderedData;pendingData;pendingAttach;forceRenderOverride;renderRange;enabled=!0;editor;constructor(e={theme:C},t,n){this.options=e,this.workerManager=t,this.requestOwnerRender=n,this.fileRenderer=new Gd(e,this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager),this.resizeManager=new bn,this.interactionManager=new vn(`file`,rn(e,this.expandLine))}subscribeToChanges(){this.workerManager?.subscribeToThemeChanges(this),L.subscribe(this)}getAnnotationSlotName=e=>Ut(this.editSession?.annotations,e,vt);handleHighlightRender=()=>{this.rerender()};expandLine=e=>{this.fileRenderer.expandLine(e),this.rerender()};rerender(){let e=this.getInputFile();this.enabled&&e!=null&&(this.requestRender()||this.render({file:e,forceRender:!0,renderRange:this.renderRange}))}requestRender(){let{requestOwnerRender:e}=this;return this.editSession!=null||e==null?!1:(this.forceRenderOverride=!0,e(),!0)}get isComponentManaged(){return this.requestOwnerRender!=null}getTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??C}getInputFile(){return this.file}getWorkingFile(e=this.file){return this.editSession?.file??e}getRenderedFile(){return this.renderedData?.file}__getNextRenderData({file:e,lineAnnotations:t}){let n=this.editSession?.annotations;if(n!=null)return{file:e,lineAnnotations:t!=null&&this.isNewAnnotations(t)?t:n.provided};let r=this.getWorkingFile(e)??e,i=this.getFileForNextRender(r);return{file:i,lineAnnotations:t!=null&&R(i,r)?t:this.getAnnotationsForFile(i)}}getFileForNextRender(e){let{collapsed:t=!1}=this.options;return t?e:this.fileRenderer.getFileForNextRender(e)}getLatestAnnotations(){return this.pendingData?.lineAnnotations??this.editSession?.annotations?.current??this.lineAnnotations}getAnnotationsForFile(e){let{pendingData:t}=this;return t!=null&&R(e,t.file)?t.lineAnnotations:this.lineAnnotations}adoptRenderData(e){let{pendingData:t}=this,n=t!=null&&R(e,t.file);this.renderedData={file:e,lineAnnotations:n?t.lineAnnotations:this.lineAnnotations},n&&(this.pendingData=void 0)}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.getLatestAnnotations()?!1:t==null||e!==t.provided&&e!==t.current}updateInputFile(e,t){if(R(this.getInputFile(),e))return!1;this.editor?.__assertOutsideChangeCallback(`File.render`),this.fileRenderer.lineCuts.clear();let n=this.getLatestAnnotations();this.file=e;let{editSession:r}=this;return r?.annotations!=null&&t!=null&&(r.annotations=Kn(t,vt,r.annotations)),r!=null&&this.replaceEditSession(e,r.annotations?.current??t??n),this.pendingData={file:this.editSession?.file??e,lineAnnotations:this.editSession?.annotations?.current??t??n},!0}replaceEditSession(e,t){let{editor:n,editSession:r}=this;this.installEditSession(e),n!=null&&r!=null&&n.__replaceDocument(e,!1,t)}installEditSession(e,t){let n=this.fileRenderer.startEditSession(e,t),r=this.editSession?.annotations??Kn(this.getLatestAnnotations(),vt);this.editSession={file:n,inputFile:e,annotations:r},this.pendingData={file:n,lineAnnotations:r.current}}onMessagesChange(){this.rerender()}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(e.unsafeCSS!==this.options.unsafeCSS&&this.editor?.__setSearchPanelUnsafeCSS(e.unsafeCSS),this.options=e,this.fileRenderer.setOptions(Jd(e)),this.cachedHeaderHTML=void 0,this.syncInteractionOptions(),this.managersDirty=!0)}syncInteractionOptions(){this.interactionManager.setOptions(rn(this.options,this.expandLine))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.editSession==null?this.applyCachedThemeState(e):this.onThemeChange())}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!I(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){let t=this.editSession?.annotations;if(t!=null){if(!this.isNewAnnotations(e))return;mt(t,e,vt)}let n=this.getWorkingFile();n!=null&&(this.pendingData={file:n,lineAnnotations:e})}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.renderedData!=null&&(this.renderedData.lineAnnotations=e),this.pendingData=void 0,this.fileRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}get code(){return this.codeColumns.get(`code`)}set code(e){this.codeColumns.set(`code`,e)}getCodeScrollLeft(){return this.codeColumns.scrollLeft}setCodeScrollLeft(e){this.codeColumns.setScrollLeft(e)}applyChange(e,t,n={}){if(this.editSession==null)throw Error(`File.applyChange: requires an active edit session`);let{tokens:r,lineAnnotations:i}=n,{lineDelta:a,removedLineIds:o}=this.fileRenderer.applyChange(t,e,r);i!=null&&this.syncEditSessionAnnotationsFromEditor(i);let s=a!==0||o.length>0;return this.renderChange(s),this.fileContainer==null||this.editSession==null?{rebuiltLines:[]}:(s&&this.interactionManager.setSelectionDirty(),{rebuiltLines:this.takeRebuiltLines()})}renderChange(e){this.fileContainer!=null&&this.rerender()}applyTokens(e){this.editSession!=null&&this.fileRenderer.setTokens(e).some(e=>this.lineElement(e)!=null)&&this.rerender()}recordRowsWritten({changed:e,attributesReset:t,gutterRewritten:n}){for(let t of e)this.changedRowKeys.push(t),cn(t)||(this.managersDirty=!0);t&&this.interactionManager.setSelectionDirty(),(t||n)&&(this.managersDirty=!0)}lineElement(e){let{code:t}=this;if(t==null||this.editSession==null)return;let n=this.fileRenderer.lineKey(e);return n==null?void 0:this.columnReconcilers.get(t)?.elementFor(n)?.content}takeRebuiltLines(){let{changedRowKeys:e}=this;this.changedRowKeys=[];let t=[];for(let n of e){let e=this.fileRenderer.lineOfKey(n);e!=null&&t.push(e)}return t}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions(),themeType:this.options.themeType}}flushManagers(){if(this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options,t={overflow:e,disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`};(this.managersDirty||!Ot(t,this.appliedManagerSetup))&&(this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t.disableAnnotations,columnVariables:t.columnVariables}),this.appliedManagerSetup=t,this.managersDirty=!1)}shouldApplyColumnVariables(e){return e===`scroll`&&this.lineAnnotations.length>0}cleanUp(e=!1){let t=this.editor;Kt(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),L.unsubscribe(this),this.renderRange=void 0,this.isComponentManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.renderedData=void 0,this.pendingData=void 0,this.pendingAttach=void 0),this.clearAuxiliaryNodes(),this.pre?.remove(),this.pre=void 0,this.codeColumns.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement?.remove(),this.headerElement=void 0,this.clearHeaderSlots(),this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0,this.editSession=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n);let o=this.editor!=null;o||Zd(this.pre,i,this.options.collapsed)||Qd(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,forceRender:o||e.forceRender,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),jt(e,t);for(let t of Array.from(e.shadowRoot?.children??[]))t instanceof SVGElement?this.spriteSVG=Nt(t):t instanceof HTMLElement&&(t instanceof HTMLPreElement?(this.pre=t,this.appliedPreAttributes=void 0):t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)?this.themeCSSStyle=t:t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)?(this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent):`diffsHeader`in t.dataset&&(this.headerElement=t,this.lastRenderedHeaderHTML=void 0));this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer??this.subscribeToChanges(),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.renderedData={file:e,lineAnnotations:t??this.getLatestAnnotations()},this.pendingData=void 0,this.file=e,this.fileRenderer.setOptions(Jd(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}syncRenderViewToEditor(){let{editor:e,fileContainer:t,renderRange:n}=this,r=this.getLatestAnnotations(),i=this.getWorkingFile();if(e==null||t==null||i==null)return;let a=a=>{this.enabled&&this.editor===e&&this.fileContainer===t&&this.getWorkingFile()===i&&e.__syncRenderView({highlighter:a,fileContainer:t,columns:this.editorColumns(),file:i,lineAnnotations:r,renderRange:n,domCurrent:this.fileRenderer.editorRenderReady()})},o=this.getTheme(),c=i.lang??Nn(i.name),l=Qe({theme:o,lang:c});l==null?nt({themes:ee(o),langs:Array.from(new Set([`text`,c])),preferredHighlighter:bt(this.workerManager,this.options)}).then(a).catch(e=>{e instanceof s||console.error(e)}):a(l)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(){}isReadyToEdit(){let e=this.getInputFile();return e!=null&&!this.fileRenderer.awaitsPoolHighlight(e)}async prepareForEditing(){if(this.isReadyToEdit())return;let e=this.__prepareForEditing();if(e==null)throw Error(`File.prepareForEditing: a file is required before editing`);if(await e,!this.isReadyToEdit())throw Error(`File.prepareForEditing: the file is not ready to edit`)}__prepareForEditing(){let e=this.getInputFile();if(e==null||this.isReadyToEdit())return;let{pendingAttach:t}=this;if(t?.file===e)return t.promise;let n={file:e,promise:this.awaitPoolHighlight(e)};return this.pendingAttach=n,n.promise=n.promise.finally(()=>{this.pendingAttach===n&&(this.pendingAttach=void 0)}),n.promise}async awaitPoolHighlight(e){await this.primeHighlightCache(e),this.enabled&&this.getInputFile()===e&&!this.fileRenderer.awaitsPoolHighlight(e)&&this.rerender()}__attachEditor(e){if(this.editor!=null)throw Error(`File.__attachEditor: an editor is already attached`);if(!this.isReadyToEdit())throw Error(`File.__attachEditor: the component is not ready to edit; await prepareForEditing() first`);this.editor=e;let t=()=>{this.editor=void 0,this.fileRenderer.endEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`File.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){if(this.editSession==null){let t=this.getInputFile();if(t==null)throw Error(`File.__attachEditor: a file is required before editing`);this.installEditSession(t,e.__getDocumentContents(t))}let t=this.editSession?.file;this.fileRenderer.editorRenderReady()?(t!=null&&this.fileRenderer.fileCache===t&&this.adoptRenderData(t),this.canAdoptEditorRows()?this.syncRenderViewToEditor():this.rerender()):this.rerender()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n}=this;if(n==null)return;let{file:r,inputFile:i,annotations:a}=n,o=a?.provided??this.lineAnnotations;if(this.editor!=null)throw Error(`File.__completeEditSession: detach the editor before completing the session`);let s=a?.current,c,l=!1,u;if(t==null)throw Error(`File.__completeEditSession: editor is required for completion`);let d={...r},f={file:d,editor:t,originalFile:i,lineAnnotations:s,originalLineAnnotations:o};Object.freeze(f);try{if(t.__emitEditComplete(f),this.options.onEditComplete?.(f)===`accept`){if(d.cacheKey!=null&&d.cacheKey===i.cacheKey)throw Error(`File.__completeEditSession: an accepted file must not reuse the replaced file cacheKey`);c=d}}catch(e){l=!0,u=e}let p=e&&c!=null?c:i,m=e&&c!=null?s??o:o;if(e&&c!=null&&this.fileRenderer.lineCuts.clear(),this.editSession=void 0,this.file=p,this.pendingData={file:p,lineAnnotations:m},R(this.getRenderedFile(),p)&&this.adoptRenderData(p),this.fileContainer!=null&&(e?this.rerender():Yt(this.handleEditSessionRender)),l)throw u}handleEditSessionRender=()=>{this.rerender()};render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);n=this.forceRenderOverride??n,this.forceRenderOverride=void 0,this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.hasThemeChanged(),f=o!=null&&(o.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(o),p=!R(this.getInputFile(),e);p&&this.updateInputFile(e,o);let m=this.getWorkingFile(e)??e;if(!c&&!n&&Mn(u,this.renderRange)&&!p&&!f&&!d){let e=this.applyCachedThemeState(l);return e&&this.finalizeRender(),e}this.renderRange=u,p&&(this.cachedHeaderHTML=void 0),this.fileRenderer.setOptions(Jd(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),f&&(this.managersDirty=!0);let h=this.getFileForNextRender(m);this.fileRenderer.setLineAnnotations(this.getAnnotationsForFile(h));let{disableErrorHandling:g=!1,disableFileHeader:_=!1}=this.options;if(_&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.ensureSpriteSVG(t),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.fileRenderer.renderCollapsed(m);e!=null&&this.applyThemeState(t,e.themeStyles,l,e.baseThemeType),e?.headerAST!=null&&this.applyHeaderToDOM(e.headerAST,t,m),this.adoptRenderData(m),this.injectUnsafeCSS()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return this.finalizeRender(),r||this.emitPostRender(),!0}let v=this.editor?.__prepareRender(u);v!=null&&this.fileRenderer.setTokens(v);try{let e=this.getOrCreatePreNode(t),n=this.fileRenderer.renderFile(m,u);if(n==null)return!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t,n.file),this.applyRowsToDOM(n,e),this.applyBuffers(e,u),this.injectUnsafeCSS(),this.adoptRenderData(n.file),this.renderAnnotations(),this.renderGutterUtility(),a||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.codeColumns.cleanUp(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.editor?.__captureFocusForDOMReplacement(),this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder!=null&&(this.placeHolder.style.setProperty(`height`,`${e}px`),!0)}async primeHighlightCache(e=this.getInputFile()){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||Ud(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getLineCount(e)>n||await t.primeFileHighlightCache(e).catch(e=>{sn(e)||console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeColumns.cleanUp(),this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isComponentManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,{renderedData:n}=this;if(t!=null&&n!=null){let{file:r,lineAnnotations:i}=n;for(let[n,a]of i.entries()){let i=this.getAnnotationSlotName(a),o=`${n}-${i}`,s=this.annotationCache.get(o);if(s==null||s.file!==r||!qd(a,s.annotation)){s?.element.remove();let e=t(a,r);if(e==null)continue;s={element:St(i),annotation:a,file:r},s.element.appendChild(e),this.fileContainer.appendChild(s.element),this.annotationCache.set(o,s)}e.delete(o)}}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=gt();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options;this.pre?.toggleAttribute(`data-custom-styles`,!!e);let t=this.fileContainer?.shadowRoot;t!=null&&(e==null||e===``?(this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0):(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=Pt(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=qt(e),this.appliedUnsafeCSS=e))}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=xt(i);this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c?this.appliedThemeCSS.theme=s:this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i?(this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}):(this.themeCSSStyle=Jn({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:dt(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c})}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=$n(this.themeCSSStyle.textContent??``,xt(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Sn()}applyRowsToDOM(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e),this.changedRowKeys=[];let n=this.code=Ft({code:this.code});this.editor?.__captureFocusForDOMReplacement();let r=()=>{this.writeColumn(n,e),t.contains(n)||(t.replaceChildren(n),this.managersDirty=!0)};this.shouldGuardRebuildScroll()?Vt(t,r):r(),this.lastRowCount=e.rowCount}writeColumn(e,{column:t,patched:n,rowCount:r,allRowsChanged:i}){let a=this.getColumnPair(e);a==null?(a=this.createColumns(e,r),this.managersDirty=!0):r!==this.lastRowCount&&(a.gutter.style.setProperty(`grid-row`,`span ${r}`),a.content.style.setProperty(`grid-row`,`span ${r}`));let o=this.columnReconcilers.get(e);if(o??(o=new Yn(a.gutter,a.content),this.columnReconcilers.set(e,o),!i&&a.content.childElementCount>0&&o.adopt(t)),i){o.replaceAll(t);for(let e of t)this.changedRowKeys.push(e.key);this.interactionManager.setSelectionDirty(),this.managersDirty=!0}else this.recordRowsWritten(o.reconcile(t,n))}canAdoptEditorRows(){let{code:e,columnReconcilers:t,fileRenderer:n}=this;return e==null||t.has(e)&&!n.lineCuts.hasCutRows}createColumns(e,t){let n=cr();n.properties.style=`grid-row: span ${t}`,e.innerHTML=lr([n,Qn([],t)]);let r=this.getColumnPair(e);if(r==null)throw Error(`File.createColumns: the columns did not parse`);return r}editorColumns(){let e=this.codeColumns.get(`code`),t=e==null?void 0:this.getColumnPair(e);if(e!=null&&t!=null)return{code:e,gutter:t.gutter,content:t.content,deletions:void 0}}getColumnPair(e){let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}applyBuffers(e,t){t==null||this.shouldDisableVirtualizationBuffers()?(this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)):(t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0))}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,n,r){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let i=this.cachedHeaderHTML??lr(e);if(this.cachedHeaderHTML=i,i!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=i;let t=e.firstElementChild;if(!(t instanceof HTMLElement))return;this.headerElement==null?n.shadowRoot?.prepend(t):n.shadowRoot?.replaceChild(t,this.headerElement),this.headerElement=t,this.lastRenderedHeaderHTML=i}if(this.isComponentManaged)return;let{renderHeaderPrefix:a,renderHeaderFilenameSuffix:o,renderCustomHeader:s,renderHeaderMetadata:c}=this.options;if(s!=null){let e=s(r)??void 0;this.headerCustom=this.upsertHeaderSlotElement(n,this.headerCustom,t,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=a?.(r)??void 0,t=o?.(r)??void 0,i=c?.(r)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(n,this.headerPrefix,u,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(n,this.headerFilenameSuffix,k,t),this.headerMetadata=this.upsertHeaderSlotElement(n,this.headerMetadata,j,i),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),n??this.subscribeToChanges(),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:Cn(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Cn(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});this.spriteSVG??=F(),this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeColumns.cleanUp(),t.appendChild(this.pre),this.managersDirty=!0):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0,this.managersDirty=!0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.codeColumns.cleanUp();for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};Dt(i,this.appliedPreAttributes)||(kt(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Zd(e,t,n=!1){return!n&&e==null&&t!=null}function Qd(e,t,n=!1){return e==null&&t!=null&&!n}var $d=5e3,ef=new Map,tf=-1;function nf(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS}var rf=class extends Xd{virtualizer;metrics;__id=`virtualized-file:${++tf}`;renderType=`virtualized`;top;height=0;unmeasured=!1;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0,ghostTextRows:ef};pendingRender;isVisible=!1;isSetup=!1;layoutDirty=!0;currentCollapsed;constructor(e,t,n=p,r,i){super(e,r,i),this.virtualizer=t,this.metrics=n}getLineCutsForSearch(){let{fileRenderer:e,options:t}=this;return{cutLength:e.getLineCutLength(t),expandedLines:e.lineCuts.expandedLines}}setMetrics(e,t=!1){let n=lt(e);(t||!Ot(this.metrics,n))&&(this.metrics=n,this.resetMeasurements(),this.invalidateLayout())}setLineAnnotations(e){this.syncLineAnnotations(e)&&(this.forceRenderOverride=!0)}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),this.managersDirty=!0,!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.forceRenderOverride=!0,!0):!1}hasLineAnnotations(){return this.getLayoutAnnotations().some(e=>e.lineNumber>0)}hasUniformLineHeights(){let{overflow:e=`scroll`}=this.options;return e===`scroll`&&!this.hasLineAnnotations()&&this.cache.heights.size===0&&this.cache.ghostTextRows.size===0}currentGhostTextRows(){return this.editor?.__getGhostTextRows()??ef}getLineHeight(e,t=!1){let{cache:n}=this,r=n.heights.get(e);if(n.ghostTextRows.size===0)return r??this.metrics.lineHeight*(t?2:1);let{lineHeight:i}=this.metrics;return(r??i*(t?2:1))+(n.ghostTextRows.get(e)??0)*i}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!ht(t,e),r=nf(t,e);super.setOptions(e),r&&(this.resetMeasurements(),this.invalidateLayout({forceSimpleRecompute:!0})),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetMeasurements(){this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.ghostTextRows=ef}invalidateLayout({forceSimpleRecompute:e=!1,resetRenderRange:t=!0}={}){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.renderRange!=null&&t&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1;if(this.unmeasured=!1,this.fileContainer==null||this.getLayoutFile()==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;this.top=this.getVirtualizedTop();let n=this.currentGhostTextRows();pt(n,this.cache.ghostTextRows)||(e=!0),this.cache.ghostTextRows=n;let r=t!==`scroll`||this.lineAnnotations.length>0||typeof process<`u`&&!1;if(this.placeHolder!=null||!r&&this.cache.heights.size===0&&this.cache.fileAnnotationHeight===0)return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let{lineHeight:i}=this.metrics;if(this.code==null)return e;let a=this.code.children[1];if(!(a instanceof HTMLElement))return e;for(let t of a.children){if(!(t instanceof HTMLElement))continue;let n=t.dataset.lineIndex;if(n==null)continue;let a=Number(n),o=this.cache.heights.get(a);if(!r&&o==null)continue;let s=t.getBoundingClientRect().height;if(s===0){this.unmeasured=!0;break}let c=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(c=!0),s+=t.nextElementSibling.getBoundingClientRect().height);let l=o??i*(c?2:1);s!==l&&(e=!0,s===this.metrics.lineHeight*(c?2:1)?this.cache.heights.delete(a):this.cache.heights.set(a,s))}if(!this.unmeasured&&this.renderRange!=null&&Rn(this.renderRange)){let t=af(a)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}return e&&this.computeApproximateSize(!0),e}onRender=e=>{let t=this.getInputFile();return this.fileContainer==null||t==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:t}))};updateCodeViewLayout(e,t,n,r){let i=!R(this.getInputFile(),e);i&&this.updateInputFile(e,r);let{pendingRenderFile:a,layoutFileChanged:o,renderedFileChanged:s,annotationsChanged:c}=this.updatePendingRender(e,r),l=n?.resetFileLayoutCache===!0||o;n?.metrics!=null&&(this.metrics=n.metrics,l=!0);let{collapsed:u=!1}=this.options;return this.currentCollapsed!==u&&(this.currentCollapsed=u,l=!0),l&&(this.resetMeasurements(),this.invalidateLayout()),i&&(this.layoutDirty=!0),!this.forceRenderOverride&&(i||s||c)&&(this.forceRenderOverride=!0),this.top=t,this.computeApproximateSize(!1,a),this.height}getLayoutFile(){return this.pendingRender?.file??this.getRenderedFile()}getLayoutAnnotations(){let{pendingRender:e}=this;return e==null?this.lineAnnotations:this.getAnnotationsForFile(e.file)}getLinePosition(e){let t=this.getLayoutFile();if(t==null||e<1)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options,i=this.fileRenderer.getLineCount(t)-1;if(r)return{top:At(this.metrics,n),height:0};let a=Mt(this.metrics,n);if(i<0)return{top:a,height:0};let o=Math.min(Math.max(e-1,0),i),{lineHeight:s}=this.metrics;if(a+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())return{top:a+o*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(o);a=c?.top??a;for(let e=c?.lineIndex??0;e<o;e++)a+=this.getLineHeight(e,!1);return{top:a,height:this.getLineHeight(o,!1)}}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}scrollToLine(e,t,n){let{virtualizer:r}=this;r.type===`advanced`?r.scrollToInstanceLine(this,e,t,n):r.scrollSpanIntoView({align:t,onDone:n,resolveSpan:()=>{let t=this.getLinePosition(e);return t==null?void 0:{top:this.getVirtualizedTop()+t.top,height:t.height}}})}cancelScroll(e){this.virtualizer.cancelScroll(e)}getRenderedBounds(){let e=this.renderRange;if(!(!this.enabled||e==null||e.totalLines<=0))return{top:Mt(this.metrics,this.options.disableFileHeader??!1)+(e.startingLine===0?this.cache.fileAnnotationHeight:e.bufferBefore),bottom:this.height-It(this.metrics)-e.bufferAfter}}getNumericScrollAnchor(e){let t=this.getLayoutFile();if(t==null||this.renderRange==null)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options;if(r||this.renderRange.totalLines<=0)return;let i=this.fileRenderer.getLineCount(t)-1;if(i<0)return;let a=Mt(this.metrics,n),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(this.hasUniformLineHeights()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutFile();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!R(this.getRenderedFile(),this.getWorkingFile()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetMeasurements(),this.invalidateLayout()),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutFile()){if(!e&&!this.layoutDirty)return;if(this.height,this.height=0,this.cache.checkpoints=[],t==null){this.layoutDirty=!1;return}this.cache.ghostTextRows=this.currentGhostTextRows();let{disableFileHeader:n=!1,collapsed:r=!1}=this.options,{lineHeight:i}=this.metrics,a=this.fileRenderer.getLineCount(t);if(r){this.height+=At(this.metrics,n),this.layoutDirty=!1;return}let o=Mt(this.metrics,n),s=It(this.metrics);if(this.height+=o,this.height+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())this.height+=a*i;else for(let e=0;e<a;e++)this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1);a>0&&(this.height+=s),this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.getInputFile()==null)return;let e=this.getWorkingFile(),t=e==null?void 0:this.getFileForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.isSimpleMode()&&this.requestRender()||this.virtualizer.instanceChanged(this,!R(this.getRenderedFile(),t))}get isComponentManaged(){return this.getAdvancedVirtualizer()?.isComponentManaged??super.isComponentManaged}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}renderChange(e){e?(this.getSimpleVirtualizer()?.markDOMDirty(),this.invalidateLayout({forceSimpleRecompute:this.isSimpleMode(),resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)):this.rerender()}applyChange(e,t,n){return nn(t)&&this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyChange(e,t,n)}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let a=!R(this.getInputFile(),t);a&&(this.updateInputFile(t,r),this.cachedHeaderHTML=void 0);let{pendingRenderFile:o,layoutFileChanged:s,renderedFileChanged:c,annotationsChanged:l}=this.pendingRender!=null&&this.pendingRender.workingFile===(this.getWorkingFile(t)??t)?{pendingRenderFile:this.pendingRender.file,layoutFileChanged:!1,renderedFileChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(t,r),{forceRenderOverride:u,isSetup:d}=this;if(this.forceRenderOverride=void 0,s&&(this.resetMeasurements(),this.invalidateLayout()),e=this.getOrCreateFileContainerNode(e),d)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,o));else{this.computeApproximateSize(!1,o);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFile.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!a||!d))return this.renderPlaceholder(this.height);let f=this.virtualizer.getWindowSpecs(),p=this.top??0,m=this.computeRenderRangeFromWindow(o,p,f);return super.render({file:t,fileContainer:e,renderRange:m,lineAnnotations:r,forceRender:(u??n)||l||c||a,...i})}finalizeRender(){if(this.getRenderedFile()!==this.pendingRender?.file)throw Error(`VirtualizedFile.render: rendered a different file than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getWorkingFile(e)??e,r=this.getRenderedFile(),i=this.pendingRender?.file??r,a=this.getFileForNextRender(n);return this.pendingRender={workingFile:n,file:a},{pendingRenderFile:a,annotationsChanged:this.syncLineAnnotations(t),layoutFileChanged:!R(i,a),renderedFileChanged:!R(r,a)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}addLayoutCheckpoint(e,t){e%$d===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1}=this.options,{hunkLineCount:a,lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(e),c=this.height,l=Mt(this.metrics,i),u=s>0?It(this.metrics):0,{fileAnnotationHeight:d}=this.cache,f=l+d,p=Math.max(0,c-l-d-u),m=An(this.getLayoutAnnotations()),h=t+l,g=d>0&&m&&h<r&&h+d>n;if(t<n-c||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};if(s<=a)return{startingLine:0,totalLines:a,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(r-n,0)/o),v=Math.ceil(_/a)*a+a,y=v/a,b=(n+r)/2;if(this.hasUniformLineHeights()){let e=t+f,i=e+p;if(!g&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};let m=g&&b<e?0:(b-e)/(o*a),h=Math.round(m-y/2),_=Math.ceil(s/a),x=Math.max(0,Math.min(h,_))*a,S=h<0?v+h*a:v,C=x===0?0:d+x*o,w=Math.min(S,s-x);return{startingLine:x,totalLines:S,bufferBefore:C,bufferAfter:Math.max(0,(s-x-w)*o)}}let x=y,S=[],C=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-v*o*2),a),w=t+(C?.top??f),T=C?.lineIndex??0,E,D,ee=C?.lineIndex??0;for(let e=ee;e<s;e++){let i=T%a===0,o=Math.floor(T/a);if(i&&(S[o]=w-(t+f),D!=null)){if(D<=0)break;D--}let s=this.getLineHeight(e,!1);w>n-s&&w<r&&(E??=o),D==null&&w>=r&&i&&(D=x),T++,w+=s}if(E==null){if(g)E=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u}}let O=Math.max(0,Math.ceil(s/a)-y),k=Math.min(E,O),te=k*a,A=S[k]??0,j=te===0?0:d+A,ne=k+y,M=ne<S.length?p-S[ne]:p-(w-t-f);return{startingLine:te,totalLines:v,bufferBefore:j,bufferAfter:Math.max(0,M)}}};function af(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===`-1,-1`&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function of(e,t){let n=sf(e);if(n.length===0)return;let r=[],i=!1;for(let a of t){if(`side`in a&&a.side===`deletions`||a.lineNumber<=0){r.push(a);continue}let t=a.lineNumber-1,o=e.previousLineCount,s=!1;for(let e of n){let n=Math.max(1,o+e.lineDelta),r=cf(t,e,n);if(r===void 0){s=!0,t=void 0;break}(r!==t||uf(t,e))&&(s=!0),t=r,o=n}if(t===void 0){i=!0;continue}let c=t+1;if(s){if(c===a.lineNumber)r.push(a);else{let e={...a,lineNumber:c};Et(e,yt(a)),r.push(e)}i=!0}else r.push(a)}return i?r:void 0}function sf(e){if(e.changedLineChanges!==void 0)return e.changedLineChanges.flatMap(([e,t,n,r=0,i=0,a=!1])=>{if(n===0)return[];let o=Math.max(0,t-e);return[{startLine:e,startCharacter:r,endLine:e+Math.max(0,o-n),deletesEndLine:n<0&&a,insertedLineBreaks:o,lineDelta:n}]});if(e.lineDelta===0)return e.changedLineRanges.flatMap(([e,t])=>{let n=t-e;return n<=0?[]:[{startLine:e,startCharacter:0,endLine:e,deletesEndLine:!1,insertedLineBreaks:n,lineDelta:n}]});let t=Math.max(0,-e.lineDelta),n=e.endedAtDocumentEnd&&e.startLine+t===e.previousLineCount-1;return[{startLine:e.startLine,startCharacter:e.startCharacter,endLine:e.startLine+t,deletesEndLine:n,insertedLineBreaks:Math.max(0,e.lineDelta),lineDelta:e.lineDelta}]}function cf(e,t,n){if(e<t.startLine)return e;if(e>t.endLine||t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)return e+t.lineDelta;if(t.startLine===t.endLine)return t.startCharacter===0?e+t.insertedLineBreaks:e;if(lf(e,t))return;let r=Math.min(Math.max(0,e-t.startLine),t.insertedLineBreaks);return df(t.startLine+r,n)}function lf(e,t){return!(t.lineDelta>=0||e<t.startLine||e>t.endLine||e===t.startLine&&t.startCharacter>0||e===t.endLine&&!t.deletesEndLine)}function uf(e,t){return t.lineDelta===0||e<t.startLine||e>t.endLine?!1:!(t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)}function df(e,t){return Math.max(0,Math.min(e,Math.max(0,t-1)))}var ff=new Map([[`'`,`'`],[`"`,`"`],["`","`"],[`{`,`}`],[`[`,`]`],[`<`,`>`],[`(`,`)`]]),pf=new Set([`'`,`"`,"`"]),mf=new Set([`{`,`[`,`(`,`<`]);function hf(e,t=0){let n=xp(e.startContainer,e.startOffset),r=xp(e.endContainer,e.endOffset);if(n!==null&&r!==null)return{start:n,end:r,direction:t}}function gf(e,t,n,r){if(e===void 0)return[[],t];let{start:i,end:a}=t,o=[],s={...t},c=i.line!==a.line,l=a.line;i.line<a.line&&a.character===0&&l--;for(let t=i.line;t<=l;t++){let l=e.getLineText(t);if(l===void 0||c&&l.trim().length===0)continue;let u=l.startsWith(` `)?` `:` `.repeat(n),d=0,f=u;if(r){if(l.startsWith(` `))d=1;else if(l.startsWith(` `)){let e=l.length-l.trimStart().length;d=Math.min(u.length,e)}if(d===0)continue;f=``}o.push({range:{start:{line:t,character:0},end:{line:t,character:d}},newText:f});let p=f.length-d;t===i.line&&(s={...s,start:{...i,character:Math.max(0,i.character+p)}}),t===a.line&&(s={...s,end:{...a,character:Math.max(0,a.character+p)}})}return[o,s]}function _f(e,t,n,r={}){let i=e.lineCount;return t.map(t=>{let{line:a,character:o}=n===`up`||n===`left`||n===`wordLeft`?t.start:t.end;if(n===`textStart`||n===`start`||n===`end`){let i=Z(t);a=i.line,o=i.character;let s=bf(e,a,o,r);if(n===`textStart`){let t=e.getLineText(a).slice(s.start,s.end),n=s.start+vp(t);o=o===n?s.start:n}else o=n===`start`?s.start:s.end}else if(n===`up`){let t=vf(e,a,o,-1,r);t===void 0?a>0?a=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`)??a:o=0:(a=t.line,o=t.character)}else if(n===`down`){let t=vf(e,a,o,1,r);if(t!==void 0)a=t.line,o=t.character;else{let t=Math.max(i-1,0);a<t?a=r.resolveRenderableLine==null?a+1:Math.min(r.resolveRenderableLine(a+1,`down`)??a,t):o=e.getLineLength(a)}}else if(X(t)){let t=e.getLineLength(a);if(o=Math.min(o,t),n===`left`||n===`wordLeft`){if(o>0)o=n===`left`?mp(e,a,o,!1):dp(e.getLineText(a),o,!1);else if(a>0){let t=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`);t!==void 0&&(a=t,o=e.getLineLength(a))}}else if(o<t)o=n===`right`?mp(e,a,o,!0):dp(e.getLineText(a),o,!0);else if(a<i-1){let e=r.resolveRenderableLine==null?a+1:r.resolveRenderableLine(a+1,`down`);e!==void 0&&(a=Math.min(e,i-1),o=0)}}let s={line:a,character:o};return{start:s,end:s,direction:0}})}function vf(e,t,n,r,i){if(i.getSoftLineOffsets===void 0)return;let a=bf(e,t,n,i),o=a.index+r,s=t,c;if(o>=0&&o<a.count)c=Sf(e,s,o,i);else{let a=t+r;if(a<0||a>=e.lineCount)return{line:t,character:a<0?0:e.getLineLength(t)};let o=i.resolveRenderableLine==null?a:i.resolveRenderableLine(a,r<0?`up`:`down`);if(o===void 0)return{line:t,character:n};s=Math.min(o,e.lineCount-1);let l=xf(s,i);c=Sf(e,s,r<0?l-1:0,i)}let l=Math.max(0,n-a.start),u=c.start+l,d=c.index===c.count-1?u:Math.min(u,c.end),f=e.getLineText(s);return{line:s,character:d>f.length?d:yf(f,d)}}function yf(e,t){if(t<=0||t>=e.length)return t;let n=or();if(n!==void 0){for(let r of n.segment(e)){if(t<=r.index)return t;let e=r.index+r.segment.length;if(t<e)return e}return t}let r=0;for(let n of e){if(t<=r)return t;let e=r+n.length;if(t<e)return e;r=e}return t}function bf(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};for(let i=0;i+1<a.length;i++){let a=Sf(e,t,i,r);if(n>=a.start&&n<=a.end)return a}return Sf(e,t,n<(a[0]??0)?0:a.length-2,r)}function xf(e,t){let n=t.getSoftLineOffsets?.(e);return n===void 0||n.length<2?1:n.length-1}function Sf(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};let o=a.length-1,s=Math.max(0,Math.min(n,o-1)),c=Math.max(0,Math.min(i,a[s]??0));return{start:c,end:Math.max(c,Math.min(i,a[s+1]??i)),index:s,count:o}}function Cf(e,t,n,r={}){return t.map(t=>{let i=t.direction===-1?t.start:t.end,[a]=_f(e,[{start:i,end:i,direction:0}],n,r);return Vf(t,a)})}function wf(e,t,n,r,i=2,a=!1){let o={...n,text:e.normalizeEol(n.text)};if(t[t.length-1]===void 0)return{nextSelections:[]};let s=[];for(let e of t)s.push(e.start,e.end);let c=s.map(t=>e.offsetAt(t)),l=c[(t.length-1)*2],u=c[(t.length-1)*2+1],d=[],f=!0;for(let e=0;e<t.length;e++){let t={index:e,start:c[e*2],end:c[e*2+1]},n=d[d.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(f=!1),d.push(t)}f||d.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let p=bp(e,o,i),m=[],h=Array.from({length:t.length}),g=0,_,v=()=>{if(_===void 0)return;let t=bp(e,{start:_.start,end:_.end,text:p.text},i),n=_p(e,t.text,t.start);m.push({start:t.start,end:t.end,text:n});let r=[_.start+g+n.length,_.start+g+n.length];for(let e of _.indices)h[e]=r;g+=n.length-(t.end-t.start),_=void 0};for(let e of d){let t=Math.max(0,e.start+(p.start-l)),n=Math.max(t,e.end+(p.end-u));_!==void 0&&t<_.end?(_.end=Math.max(_.end,n),_.indices.push(e.index)):(v(),_={start:t,end:n,indices:[e.index]})}v();let y=e.applyResolvedEdits(m,!0,t,void 0,a),b=yp(e,h.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(b),y!==void 0&&r!==void 0){let t=of(y,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:b,change:y}}function Tf(e,t){if(t.length!==e.length+2)return;let n=ff.get(t[0]);if(n!==void 0&&t[t.length-1]===n&&t.slice(1,-1)===e)return 1}function Ef(e,t,n,r){let i=t.start+n,a=i+r.length;if(t.end-t.start>0){let n=e.getTextSlice(t.start,t.end),a=Tf(n,r)??r.indexOf(n);if(a!==-1&&a+n.length<=r.length){let e=i+a;return[e,e+n.length]}}return[a,a]}function Df(e,t,n,r,i=!1,a=`selection`){if(t.length!==n.length)throw Error(`Selection text replacements must match the selection count`);let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=[],l=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=c[c.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(l=!1),c.push(t)}l||c.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let u=n.every(e=>e===``),d,f=Array.from({length:t.length});if(u){d=[];let e=!1;for(let t of c){if(f[t.index]=[t.end,t.end],t.start>=t.end)continue;e=!0;let n=d[d.length-1];n!==void 0&&t.start<n.end?d[d.length-1]={start:n.start,end:Math.max(n.end,t.end),text:``}:d.push({start:t.start,end:t.end,text:``})}if(!e)return{nextSelections:t};for(let e of c){let t=e.end,n=0,r=t;for(let e of d){if(t<=e.start)break;if(t>=e.end)n-=e.end-e.start;else{r=e.start+n;break}}r===t&&(r+=n),f[e.index]=[r,r]}}else{d=[];let t=0,r=-1;for(let i=0;i<c.length;i++){let o=c[i];if(o.start<r)throw Error(`Overlapping multi-selection edits are not supported`);r=o.end;let s=_p(e,n[a===`document`?i:o.index],o.start);d.push({start:o.start,end:o.end,text:s}),f[o.index]=Ef(e,o,t,s),t+=s.length-(o.end-o.start)}}let p=e.applyResolvedEdits(d,!0,t,void 0,i),m=yp(e,f.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(m),p!==void 0&&r!==void 0){let t=of(p,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:m,change:p}}function Of(e,t){return e===`never`?!1:e===`brackets`?mf.has(t):e!==`quotes`||pf.has(t)}function kf(e,t,n,r){if(n.length!==1||t.length===0)return;let i=ff.get(n);if(i===void 0||!Of(r,n))return;let a=[];for(let r of t){if(X(r))return;a.push(n+e.getTextSlice(e.offsetAt(r.start),e.offsetAt(r.end))+i)}return a}function Af(e,t,n){let r=[],i=[];for(let n of t){let[t,a]=hp(e,n);if(!X(n)){i.push([t,a]);continue}let{line:o,character:s}=n.start,c=t,l=e.getLineText(o),u=l.length,d=c-s,f=pp(l),p;if(s>0&&s<u){let e=fp(l,s,!1,f),t=fp(l,s,!0,f);p={start:d+e,end:d+t,text:l.slice(s,t)+l.slice(e,s)},i.push([d+t,d+t])}else if(s===u&&f.length>=2){let e=f[f.length-1],t=f[f.length-2];p={start:d+t,end:c,text:l.slice(e,u)+l.slice(t,e)},i.push([c,c])}else if(s===0&&o>0&&u>0){let t=o-1,n=e.getLineText(t),r=n.length,a=e.offsetAt({line:t,character:r}),s=r>0?fp(n,r,!1,pp(n)):r,u=fp(l,0,!0,f),d=a-(r-s),m=l.slice(0,u)+e.getTextSlice(a,c)+n.slice(s,r);p={start:d,end:c+u,text:m};let h=d+m.length;i.push([h,h])}else{i.push([t,a]);continue}r.push(p)}if(r.length===0)return{nextSelections:t};r.sort((e,t)=>e.start-t.start);for(let e=1;e<r.length;e++)if(r[e].start<r[e-1].end)throw Error(`Overlapping multi-selection edits are not supported`);let a=e.applyResolvedEdits(r,!0,t),o=yp(e,i);if(e.setLastUndoSelectionsAfter(o),a!==void 0&&n!==void 0){let t=of(a,n);t!==void 0&&e.setLastUndoLineAnnotations(n,t)}return{nextSelections:o,change:a}}function jf(e,t,n){let r=t.map(t=>{let n=gp(e,t);return{start:n.start,end:n.end,direction:0}});return Df(e,r,r.map(()=>``),n)}function Mf(e,t,n,r){let i=t.map(t=>{if(!X(t))return{start:t.start,end:t.end,direction:0};let r=Z(t),{line:i,character:a}=r,o=n?.(i,a)??0;if(a>o)return{start:{line:i,character:o},end:{line:i,character:a},direction:0};if(i===0)return{start:r,end:r,direction:0};let s=e.getLineLength(i-1);return{start:{line:i-1,character:s},end:{line:i,character:0},direction:0}});return Df(e,i,i.map(()=>``),r)}function Nf(e,t,n){let r=t.map(t=>{let[n,r]=lp(e,t);return{start:n,end:r,direction:0}});return Df(e,r,r.map(()=>``),n)}function Pf(e,t,n){if(!X(t))return[t.start,t.end];let r=Z(t),{line:i,character:a}=r,o=e.getLineLength(i),s=e.lineCount;if(a=Math.min(a,o),n)return a<o?[{line:i,character:a},{line:i,character:mp(e,i,a,!0)}]:i<s-1?[{line:i,character:o},{line:i+1,character:0}]:[r,r];if(a>0)return[{line:i,character:mp(e,i,a,!1)},{line:i,character:a}];if(i>0){let t=e.getLineLength(i-1);return[{line:i-1,character:t},{line:i,character:0}]}return[r,r]}function Ff(e,t,n,r,i=2){let a=t.map(t=>{let[r,a]=Pf(e,t,n);if(!n&&X(t)){let t=bp(e,{start:e.offsetAt(r),end:e.offsetAt(a),text:``},i);r=e.positionAt(t.start),a=e.positionAt(t.end)}return{start:r,end:a,direction:0}});return Df(e,a,a.map(()=>``),r)}function X(e){return e.start.line===e.end.line&&e.start.character===e.end.character}function Z(e){let{start:t,end:n,direction:r}=e;return r===-1?t:n}function If(e){return e===`context`||e===`context-expanded`||e===`change-addition`}function Lf(e,t){let n=X(e),r=X(t);return n&&r?Q(e.start,t.start)===0:n?Q(t.start,e.start)<=0&&Q(e.start,t.end)<=0:r?Q(e.start,t.start)<=0&&Q(t.start,e.end)<=0:Q(e.start,t.end)<0&&Q(t.start,e.end)<0}function Q(e,t){return e.line===t.line?e.character-t.character:e.line-t.line}function Rf(e,t,n){let r=t===n?0:t<n?1:-1,i=Math.min(t,n),a=Math.max(t,n);return{start:e.positionAt(i),end:e.positionAt(a),direction:r}}function zf(e,t){let n=0;for(let r of t){if(e<r.start)break;if(e>=r.end)n+=r.text.length-(r.end-r.start);else return r.start+n+r.text.length}return e+n}function Bf(e,t,n,r){return t.map((t,i)=>{let[a,o]=n[i],s=zf(a,r),c=zf(o,r);return Rf(e,t.direction===-1?c:s,t.direction===-1?s:c)})}function Vf(e,t){let n=e.direction===-1?e.end:e.start,r=Q(n,t.start),i=Q(n,t.end),a=t.end;a=r<=0?t.end:i>=0?t.start:r===0?t.end:t.start;let o=Q(n,a);return{start:o<=0?n:a,end:o<=0?a:n,direction:o===0?0:o<0?1:-1}}function Hf(e,t){let n=Q(t.start,e.start)<0,r=Q(t.end,e.end)>0;return n&&!r?{start:t.start,end:e.end,direction:-1}:r&&!n?{start:e.start,end:t.end,direction:1}:e.direction===-1?{start:t.start,end:e.end,direction:Q(t.start,e.end)===0?0:-1}:{start:e.start,end:t.end,direction:Q(e.start,t.end)===0?0:1}}function Uf(e,t){return Wf(e.map(e=>Hf(e,t)))}function Wf(e){if(e.length<=1)return e;let t=e.map((e,t)=>({index:t,selection:e})).sort((e,t)=>{let n=Q(e.selection.start,t.selection.start);if(n!==0)return n;let r=Q(e.selection.end,t.selection.end);return r===0?e.index-t.index:r}),n=[],r=t[0];for(let e of t.slice(1))if(Lf(r.selection,e.selection)){let t=e.index>r.index?e:r,n=Q(e.selection.start,r.selection.start)<0?e.selection.start:r.selection.start,i=Q(e.selection.end,r.selection.end)>0?e.selection.end:r.selection.end,a=t.selection.direction;a===0&&Q(n,i)!==0&&(a=Q(t.selection.start,n)===0?-1:1),r={index:t.index,selection:{direction:a,end:i,start:n}}}else n.push(r),r=e;return n.push(r),n.sort((e,t)=>e.index-t.index).map(({selection:e})=>e)}function Gf(e){let t=e.map(e=>{let t=e.end.line;return e.end.character===0&&Q(e.start,e.end)!==0&&t--,{startLine:e.start.line,endLine:Math.max(e.start.line,t)}}).sort((e,t)=>{let n=e.startLine-t.startLine;return n===0?e.endLine-t.endLine:n}),n=[];for(let e of t){let t=n.at(-1);t!==void 0&&e.startLine<=t.endLine+1?t.endLine=Math.max(t.endLine,e.endLine):n.push({...e})}return n}function Kf(e,t,n,r){let i=e=>{let i=e.line+t;if(i>=n){let e=Math.max(0,n-1);return{line:e,character:r(e)}}return i<0?{line:0,character:0}:{line:i,character:e.character}};return{start:i(e.start),end:i(e.end),direction:e.direction}}function qf(e,t){if(t.length===0)return;let n=t.map(t=>X(t)?sp(e,t):t),r=n.map(t=>e.getTextSlice(e.offsetAt(t.start),e.offsetAt(t.end))),i=r[0];if(i.length===0||r.some(e=>e!==i))return;let a=n.map(t=>[e.offsetAt(t.start),e.offsetAt(t.end)]),o=e.findNextNonOverlappingSubstring(i,a);if(o===void 0)return n.some((e,n)=>{let r=t[n];return Q(e.start,r.start)!==0||Q(e.end,r.end)!==0||e.direction!==r.direction})?n:void 0;let s=Rf(e,o,o+i.length);return[...n,s]}function Jf(e){let t=e.lineCount-1;return{start:{line:0,character:0},end:{line:t,character:e.getLineLength(t)},direction:1}}function Yf(e,t,n){let r=0;if(t){let t=e.lineCount-1;r=n===!0&&t>0&&e.getLineLength(t)===0?t-1:t}let i=t?e.getLineLength(r):0,a={line:r,character:i};return{start:a,end:a,direction:1}}function Xf(e,t){if(X(t)){let n=t.start.line;return{start:e.offsetAt({line:n,character:0}),end:n<e.lineCount-1?e.offsetAt({line:n+1,character:0}):e.offsetAt({line:n,character:e.getLineLength(n)})}}let n=e.offsetAt(t.start),r=e.offsetAt(t.end);return n<=r?{start:n,end:r}:{start:r,end:n}}function Zf(e,t){return t.map(t=>Xf(e,t)).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n})}function Qf(e,t){return Zf(e,t).map(({start:t,end:n})=>Mp(e,t,n))}function $f(e,t){let n=Zf(e,t),r=e.eol,i=``,a=-1;for(let t of n)t.end<=t.start||(t.start<=a?t.end>a&&(i+=Mp(e,a,t.end),a=t.end):(i.length>0&&!er(i)&&(i+=r),i+=Mp(e,t.start,t.end),a=t.end));return i}function ep(e,t){if(X(t))return tp(e,t);let[n,r]=Q(t.start,t.end)<=0?[t.start,t.end]:[t.end,t.start];return{start:e.offsetAt(n),end:e.offsetAt(r),text:``}}function tp(e,t){let n=t.start.line,r=e.offsetAt({line:n,character:0}),i=e.offsetAt({line:n,character:e.getLineLength(n)});return n<e.lineCount-1?{start:r,end:e.offsetAt({line:n+1,character:0}),text:``}:n>0?{start:e.offsetAt({line:n-1,character:e.getLineLength(n-1)}),end:i,text:``}:{start:r,end:i,text:``}}function np(e){let t=[];for(let{edit:n}of e){if(n.start>=n.end)continue;let e=t.at(-1);e!==void 0&&n.start<=e.end?t[t.length-1]={start:e.start,end:Math.max(e.end,n.end),text:``}:t.push(n)}return t}function rp(e,t){let n=Array.from({length:e.length}),r=0,i=0;for(let a of e){for(;r<t.length&&a.edit.start>t[r].end;){let e=t[r];i-=e.end-e.start,r++}let e=t[r];e!==void 0&&a.edit.start>=e.start&&a.edit.start<=e.end?n[a.index]=e.start+i:n[a.index]=a.edit.start+i}return n}function ip(e,t){let n=[...t.map((t,n)=>({index:n,edit:ep(e,t)}))].sort((e,t)=>{let n=e.edit.start-t.edit.start;if(n!==0)return n;let r=e.edit.end-t.edit.end;return r===0?e.index-t.index:r}),r=np(n);return{text:$f(e,t),edits:r,nextSelectionOffsets:rp(n,r)}}function ap(e,t){let n=Math.max(0,t),r=Sp(e),i=null;for(let e of r){i=e;let t=Ap(e);if(n<=t+(e.textContent?.length??0)){let r=Cp(e,n<t?0:n-t);if(r!==null)return r}}if(i!==null){let e=Cp(i,i.textContent?.length??0);return e===null?[i,0]:e}let a=0,o=null;for(let t of e.childNodes){if(t.nodeType===1&&t.tagName===`BR`)return[t,0];if(t.nodeType!==3)continue;o=t;let e=jp(o.textContent,o.textContent?.length??0);if(n<=a+e)return[o,jp(o.textContent,n-a)];a+=e}return o===null?[e,0]:[o,jp(o.textContent,o.textContent?.length??0)]}function op(e,t){if(t==null)return``;let n=X(t)?sp(e,t):t,r=e.getText(n);return r.includes(`
|
|
1101
|
+
`)?``:r}function sp(e,t){let{line:n,character:r}=t.start,i=e.getLineText(n),a=cp(i,Math.max(0,Math.min(r,i.length)));return a===void 0?t:{start:{line:n,character:a.start},end:{line:n,character:a.end},direction:1}}function cp(e,t){let n=ar({granularity:`word`});if(n!==void 0){for(let r of n.segment(e)){if(r.isWordLike!==!0)continue;let e=r.index,n=e+r.segment.length;if(t>=e&&t<=n)return{start:e,end:n}}return}let r=/[\p{Alphabetic}\p{Number}_]+/gu,i;for(;(i=r.exec(e))!==null;){let e=i.index,n=e+i[0].length;if(t>=e&&t<=n)return{start:e,end:n}}}function lp(e,t){if(!X(t))return[t.start,t.end];let n=Z(t),{line:r,character:i}=n;if(i===0){if(r===0)return[n,n];let t=e.getLineLength(r-1);return[{line:r-1,character:t},{line:r,character:0}]}let a=e.getLineText(r),o=pp(a),s=i,c;for(;s>0;){let e=fp(a,s,!1,o),t=up(a.slice(e,s));if(c!==void 0&&t!==c)break;(t!==0||s!==i)&&(c=t),s=e}return[{line:r,character:s},{line:r,character:i}]}function up(e){return/\S/.test(e)?/\p{Alphabetic}|\p{Number}|_/u.test(e)?1:2:0}function dp(e,t,n){let r=or()?.segment(e),i=t,a=0;for(;n?i<e.length:i>0;){let t,o,s=r?.containing(n?i:i-1);if(s!==void 0)t=s.segment,o=n?s.index+t.length:s.index;else{let r=n?i:(e.codePointAt(i-2)??0)>65535?i-2:i-1;t=String.fromCodePoint(e.codePointAt(r)??0),o=n?i+t.length:r}let c=up(t);if(a!==0&&c!==a)break;a=c,i=o}return i}function fp(e,t,n,r){if(n){for(let e of r)if(e>t)return e;return e.length}for(let e=r.length-1;e>=0;e--){let n=r[e];if(n<t)return n}return 0}function pp(e){let t=[0],n=or();if(n!==void 0){for(let r of n.segment(e))r.index>0&&t.push(r.index);return t}let r=0;for(let n of e)r>0&&t.push(r),r+=n.length;return t}function mp(e,t,n,r){let i=e.getLineLength(t);if(r){if(n>=i)return i;let r=e.offsetAt({line:t,character:0}),a=e.getTextSlice(r+n,r+i),o=or();if(o!==void 0){for(let e of o.segment(a))return n+e.segment.length;return i}for(let e of a)return n+e.length;return i}if(n<=0)return 0;let a=e.offsetAt({line:t,character:0}),o=e.getTextSlice(a,a+n),s=0,c=or();if(c!==void 0){for(let e of c.segment(o))s=e.index;return s}let l=0;for(let e of o)s=l,l+=e.length;return s}function hp(e,t){let n=t.direction===-1;return[e.offsetAt(n?t.end:t.start),e.offsetAt(Z(t))]}function gp(e,t){if(!X(t))return{start:t.start,end:t.end};let{line:n,character:r}=t.start,i=e.getLineText(n).length;return r<i?{start:{line:n,character:r},end:{line:n,character:i}}:n<e.lineCount-1?{start:{line:n,character:r},end:{line:n+1,character:0}}:{start:{line:n,character:r},end:{line:n,character:r}}}function _p(e,t,n){if(t!==`
|
|
1102
|
+
`&&t!==`\r`&&t!==`\r
|
|
1103
|
+
`)return t;let r=e.positionAt(n).line,i=e.getLineText(r),a=vp(i);return a===0?t:t+i.slice(0,a)}function vp(e){let t=0;for(;t<e.length;t++){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}return t}function yp(e,t){let n=[];for(let[e,r]of t)n.push(Math.min(e,r),Math.max(e,r));let r=e.positionsAt(n);return t.map(([e,t],n)=>{let i=e===t?0:e<t?1:-1;return{start:r[n*2],end:r[n*2+1],direction:i}})}function bp(e,t,n){if(t.text!==``||t.start!==t.end-1)return t;let r=e.positionAt(t.end);if(r.character===0)return t;let i=e.getLineText(r.line),a=i.slice(0,r.character);if(/[^ \t]/.test(a)||i[r.character-1]===` `)return t;let o=Math.max(0,r.character-n),s=i.slice(o,r.character);return s.length===n&&/^ +$/.test(s)?{...t,start:t.end-s.length}:t}function xp(e,t){let n=e.nodeType===1?e:e.parentElement;for(;n!==null&&kp(n)===void 0;)n=n.parentElement;if(n===null)return null;let r=kp(n);if(r===void 0)return null;if(e.nodeType===3)return e.parentElement===null?null:Dp(e.parentElement)===null?{line:r,character:Ep(n,e)+jp(e.textContent,t)}:{line:r,character:Op(e,t)};if(e.nodeType===1){let i=e;if(i.tagName===`DIV`){let e=0;for(let n=0;n<t;n++)e=Op(i.childNodes[n]);return{line:r,character:e}}if(i.tagName===`BR`)return{line:r,character:0};if(i.tagName===`SPAN`){if(t<i.childNodes.length){let e=i.childNodes[t];if(e?.nodeType===1){let t=Ap(e);if(t!==void 0)return{line:r,character:t};let n=Dp(e),i=n===null?void 0:Ap(n);if(i!==void 0)return{line:r,character:i}}}return{line:r,character:t>0?Op(i.childNodes[t-1]):Ep(n,i)}}return{line:r,character:Ep(n,i)}}return null}function Sp(e){let t=[];for(let n of e.childNodes){if(n.nodeType!==1)continue;let e=n;if(e.tagName===`SPAN`){if(Ap(e)!==void 0)t.push(e);else for(let n of e.childNodes)n.nodeType===1&&Ap(n)!==void 0&&t.push(n)}}return t}function Cp(e,t){let n=Math.max(0,t),r=[{container:e,index:0}];for(;r.length>0;){let e=r[r.length-1];if(e.index>=e.container.childNodes.length){r.pop();continue}let t=e.container.childNodes[e.index];if(e.index++,t.nodeType===3){let e=jp(t.textContent,t.textContent?.length??0);if(n<=e)return[t,n];n-=e}else t.nodeType===1&&r.push({container:t,index:0})}return null}function wp(e,t){let n=0,r=[{container:e,index:0}];for(;r.length>0;){let e=r[r.length-1];if(e.index>=e.container.childNodes.length){r.pop();continue}let i=e.container.childNodes[e.index];if(i===t)return n;e.index++,i.nodeType===3?n+=jp(i.textContent,i.textContent?.length??0):i.nodeType===1&&r.push({container:i,index:0})}return n}function Tp(e,t){let n=t;for(;n!==null;){if(n===e)return!0;n=n.parentElement}return!1}function Ep(e,t){if(t.parentElement===e){let n=0,r=Array.prototype.indexOf.call(e.childNodes,t);for(let t=0;t<r;t++)n=Op(e.childNodes[t]);return n}for(let n of Sp(e))if(Tp(n,t))return Ap(n)+(t.nodeType===3?wp(n,t):0);let n=0,r=t.nodeType===1?t:t.parentElement;for(;r!==null&&r.parentElement!==null&&kp(r.parentElement)===void 0;){let e=r.parentElement,t=Array.prototype.indexOf.call(e.childNodes,r);for(let r=0;r<t;r++)n=Op(e.childNodes[r]);r=e}return n}function Dp(e){let t=e;for(;t!==null;){if(kp(t)!==void 0)return null;if(Ap(t)!==void 0)return t;t=t.parentElement}return null}function Op(e,t){if(e===void 0)return 0;if(e.nodeType===3){let n=e.parentElement;if(n===null)return 0;let r=Dp(n);if(r===null)return 0;let i=Ap(r);if(i===void 0)return 0;let a=t===void 0?jp(e.textContent,e.textContent?.length??0):jp(e.textContent,t);return i+wp(r,e)+a}if(e.nodeType!==1)return 0;let n=e;if(n.tagName!==`SPAN`&&n.tagName!==`BR`)return 0;let r=Ap(n);if(r!==void 0)return r+(n.textContent?.length??0);let i=0;for(let e of n.childNodes)i=Math.max(i,Op(e));return i}function kp(e){let{line:t,lineType:n}=e.dataset;if(t!==void 0&&n!==`change-deletion`){let e=parseInt(t,10);if(!Number.isNaN(e))return e-1}}function Ap(e){let{char:t}=e.dataset;if(t!==void 0){let e=parseInt(t,10);if(!Number.isNaN(e))return e}}function jp(e,t){let n=e??``,r=n.search(/[\r\n]/);return Math.min(t,r===-1?n.length:r)}function Mp(e,t,n){return e.getText({start:e.positionAt(t),end:e.positionAt(n)})}function Np({metaKey:e,ctrlKey:t},n=ct()){return n?e&&!t:t&&!e}function Pp(e){let t=ct();if(t&&e.ctrlKey&&!e.altKey&&!e.metaKey)switch(e.key){case`a`:return`start`;case`e`:return`end`;case`p`:return`up`;case`n`:return`down`;case`f`:return`right`;case`b`:return`left`}if(!e.altKey&&!e.ctrlKey&&!e.metaKey){if(e.key===`ArrowUp`)return`up`;if(e.key===`ArrowDown`)return`down`;if(e.key===`ArrowLeft`)return`left`;if(e.key===`ArrowRight`)return`right`;if(e.key===`Home`)return`start`;if(e.key===`End`)return`end`}if(!e.altKey&&Np(e,t)){if(e.key===`ArrowLeft`)return t?`textStart`:`wordLeft`;if(e.key===`ArrowRight`)return t?`end`:`wordRight`}}var Fp=new WeakMap,Ip=Rp([{bindings:{Tab:`indent`,"shift+Tab":`outdent`,"cmdOrCtrl+[":`indentLess`,"cmdOrCtrl+]":`indentMore`,"cmdOrCtrl+z":`undo`,"cmdOrCtrl+shift+z":`redo`,"cmdOrCtrl+a":`selectAll`,"cmdOrCtrl+d":`findNextMatch`,"cmdOrCtrl+f":`openSearchPanel`,"cmdOrCtrl+alt+f":`openSearchReplacePanel`,"alt+ArrowUp":`moveLineUp`,"alt+ArrowDown":`moveLineDown`,"shift+alt+ArrowUp":`copyLineUp`,"shift+alt+ArrowDown":`copyLineDown`,Escape:`simplifySelection`,"cmdOrCtrl+Enter":`insertBlankLine`,"cmdOrCtrl+/":`toggleComment`,"shift+alt+a":`toggleBlockComment`,"cmdOrCtrl+Home":`moveCursorToDocStart`,"cmdOrCtrl+End":`moveCursorToDocEnd`,"cmdOrCtrl+shift+Home":`expandSelectionDocStart`,"cmdOrCtrl+shift+End":`expandSelectionDocEnd`}},{platform:`mac`,bindings:{"ctrl+k":`deleteHardLineForward`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`,"cmd+ArrowUp":`moveCursorToDocStart`,"cmd+ArrowDown":`moveCursorToDocEnd`,"cmd+shift+ArrowUp":`expandSelectionDocStart`,"cmd+shift+ArrowDown":`expandSelectionDocEnd`}},{platform:`windows`,bindings:{"ctrl+y":`redo`}},{platform:`linux`,bindings:{"ctrl+y":`redo`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`}}]),Lp={Backquote:"`",Minus:`-`,Equal:`=`,Comma:`,`,Period:`.`,Slash:`/`,Semicolon:`;`,Quote:`'`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Space:`Space`};function Rp(e){let t=Fp.get(e);if(t===void 0){t={mac:new Map,windows:new Map,linux:new Map};for(let n of e)for(let e of Object.keys(n.bindings)){let r=n.bindings[e];if(r===void 0)continue;let i=e.split(`+`),a=i.pop();for(let e of[`mac`,`windows`,`linux`]){if(n.platform!==void 0&&n.platform!==e)continue;let o=0;for(let t of i)t===`alt`?o|=1:t===`ctrl`?o|=2:t===`cmd`?o|=4:t===`shift`?o|=8:t===`cmdOrCtrl`&&(o|=e===`mac`?4:2);let s=t[e].get(o);s===void 0&&(s=new Map,t[e].set(o,s)),s.set(a,r)}}Fp.set(e,t)}return t}function zp(e,t,n=ct()){let r=e.key===` `?`Space`:e.key.length===1?e.key.toLowerCase():e.key,i=e.code??``,a=i.startsWith(`Key`)&&i.length===4?i.slice(3).toLowerCase():i.startsWith(`Digit`)&&i.length===6?i.slice(5):Lp[i],o=n?`mac`:globalThis.navigator?.platform.includes(`Linux`)===!0?`linux`:`windows`,s=+!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0);if(t!==void 0){let e=Rp(t)[o].get(s),n=e?.get(r)??(a===void 0?void 0:e?.get(a));if(n!==void 0)return n}let c=Ip[o].get(s);return c?.get(r)??(a===void 0?void 0:c?.get(a))}function Bp(e,t=ct()){if(!Np(e,t))return;let n=e.key.length===1?e.key.toLowerCase():e.key;return!e.shiftKey&&(n===`f`||e.code===`KeyF`)?e.altKey?`replace`:`find`:Vp(e,t)}function Vp(e,t=ct()){if(!e.altKey&&Np(e,t)&&((e.key.length===1?e.key.toLowerCase():e.key)===`g`||e.code===`KeyG`))return e.shiftKey?`previous`:`next`}var Hp;function Up(e,t){if(Hp==null)try{e.getComposedRanges({shadowRoots:[t]}),Hp=!0}catch{Hp=!1}return Hp?e.getComposedRanges({shadowRoots:[t]})?.[0]:e.getComposedRanges(t)?.[0]}function Wp(e){let t=e.getSelection?.();if(t==null||t.rangeCount===0)return;let n=t.getRangeAt(0);return{collapsed:n.collapsed,startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}}function Gp(e){let t=document.getSelection();if(t!=null)return typeof t.getComposedRanges==`function`?Up(t,e):Wp(e)}function Kp(e){let t=e.startContainer.parentElement?.closest(`[data-code]`);if(t==null||t.clientWidth===0)return!1;if(t.scrollWidth<=t.clientWidth)return!0;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=t.querySelector(`:scope > [data-gutter]`),a=Math.max(r.left+t.clientLeft,i?.getBoundingClientRect().right??r.left),o=r.left+t.clientLeft+t.clientWidth,s=n.left<a||n.width>o-a?n.left-a:Math.max(0,n.right-o);return t.scrollTo({left:t.scrollLeft+s,behavior:`instant`}),!0}function qp(e,t,n,r){let i=e.findIndex(e=>e.row===t);if(i<0)return;let a=e.length;for(;i<a;){let o=Math.floor((i+a)/2),s=e[o];if(s.row!==t){a=o;continue}let c=s.range.getClientRects();if(c.length===0)return;let l=c[0],u=c[c.length-1];if(r>=u.bottom||r>=u.top&&n>=u.right)i=o+1;else if(r<l.top||r<l.bottom&&n<l.left)a=o;else{for(let e of c)if(n>=e.left&&n<e.right&&r>=e.top&&r<e.bottom)return s;return}}}var Jp=new WeakMap;function Yp(e){return`highlightsFromPoint`in e}function Xp(e){return e instanceof Error&&e.name===`InvalidModificationError`}var Zp=class e{highlights;static create(t){let n=t.defaultView;if(n?.CSS?.highlights==null||typeof n.Highlight!=`function`||typeof n.CSS.registerProperty!=`function`)return;let r=Jp.get(t);if(r==null){for(let e of[`--diffs-search-match-color`,`--diffs-search-current-color`,`--diffs-search-text-color`])try{n.CSS.registerProperty({name:e,syntax:`<color>`,inherits:!0,initialValue:`transparent`})}catch(e){if(!Xp(e))throw e}r={match:new n.Highlight,current:new n.Highlight},r.current.priority=1,n.CSS.highlights.set(`diffs-search-match`,r.match),n.CSS.highlights.set(`diffs-search-current`,r.current),Jp.set(t,r)}return new e(r)}static getLineNumber(e){return Number(e.dataset.line)}static getLineSide(e){return e.dataset.lineType===`change-deletion`||e.closest(`[data-deletions]`)!=null?`deletions`:`additions`}ranges=[];markedButtons=[];currentRange;constructor(e){this.highlights=e}clear(){let{ranges:e,markedButtons:t}=this;for(let e of t)e.removeAttribute(`data-search-match`);t.length=0;for(let{range:t,highlight:n}of e)n.delete(t);e.length=0,this.currentRange=void 0}get currentMatchRange(){return this.currentRange}getMatchStartAtPoint(e,t,n){let{ranges:r,highlights:i}=this,a=e.ownerDocument.defaultView?.CSS.highlights;if(a==null||!Yp(a))return qp(r,e,t,n)?.startCharacter;let o=e.getRootNode(),s=a.highlightsFromPoint(t,n,{shadowRoots:o instanceof ShadowRoot?[o]:[]});for(let{highlight:t,ranges:n}of s)if(t===i.match||t===i.current)for(let t of n){let n=r.find(n=>n.range===t&&n.row===e);if(n!=null)return n.startCharacter}}paint(t,n){for(let r of t.querySelectorAll(`[data-line][data-line-type]`)){let t=n(e.getLineNumber(r),e.getLineSide(r));t!=null&&this.paintLine(r,t)}}paintLine(e,t){let{highlights:n,ranges:r}=this,i=e.ownerDocument,a=i.createTreeWalker(e,NodeFilter.SHOW_TEXT),o=0,s=0,c,l;for(;(l=a.nextNode())!=null&&s<t.length;){let a=o+(l.textContent?.length??0);for(;s<t.length;){let u=t[s];if(u.startCharacter>=a||(c??(c=i.createRange(),c.setStart(l,u.startCharacter-o)),u.endCharacter>a))break;c.setEnd(l,u.endCharacter-o);let d=u.current?n.current:n.match;d.add(c),r.push({range:c,highlight:d,row:e,startCharacter:u.startCharacter}),u.current&&(this.currentRange??=c),c=void 0,s++}o=a}if(s<t.length){let n=e.querySelector(`[data-expand-line]`);if(n==null)return;let{current:r}=t[s];if(n.setAttribute(`data-search-match`,r?`current`:``),this.markedButtons.push(n),r){let e=i.createRange();e.selectNode(n),this.currentRange??=e}}}},Qp=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1104
|
+
<symbol id="diffs-editor-icon-close" viewBox="0 0 16 16">
|
|
1105
|
+
<path fill="currentColor" d="M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z"></path>
|
|
1106
|
+
</symbol>
|
|
1107
|
+
<symbol id="diffs-editor-icon-loader" viewBox="0 0 16 16">
|
|
1108
|
+
<path d="M7.25 4V1a.75.75 0 0 1 1.5 0v3a.75.75 0 0 1-1.5 0"/><path d="M4.641 5.702 2.521 3.58A.75.75 0 1 1 3.58 2.52l2.121 2.121a.75.75 0 0 1-1.06 1.06" opacity=".8"/><path d="M1 7.25h3a.75.75 0 0 1 0 1.5H1a.75.75 0 0 1 0-1.5" opacity=".6"/><path d="m2.52 12.42 2.121-2.122a.75.75 0 1 1 1.061 1.06L3.581 13.48a.75.75 0 0 1-1.061-1.06" opacity=".5"/><path d="M7.25 15v-3a.75.75 0 0 1 1.5 0v3a.75.75 0 0 1-1.5 0" opacity=".4"/><path d="m12.42 13.48-2.122-2.121a.75.75 0 0 1 1.06-1.061l2.122 2.121a.75.75 0 1 1-1.06 1.061" opacity=".3"/><path d="M12 7.25h3a.75.75 0 0 1 0 1.5h-3a.75.75 0 0 1 0-1.5" opacity=".2"/><path d="M10.298 4.641 12.42 2.52a.75.75 0 1 1 1.061 1.06l-2.121 2.122a.75.75 0 1 1-1.06-1.06" opacity=".1"/>
|
|
1109
|
+
</symbol>
|
|
1110
|
+
<symbol id="diffs-editor-icon-arrow-up" viewBox="0 0 16 16">
|
|
1111
|
+
<path fill="currentColor" transform="rotate(-90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
|
|
1112
|
+
</symbol>
|
|
1113
|
+
<symbol id="diffs-editor-icon-arrow-down" viewBox="0 0 16 16">
|
|
1114
|
+
<path fill="currentColor" transform="rotate(90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
|
|
1115
|
+
</symbol>
|
|
1116
|
+
<symbol id="diffs-editor-icon-case" viewBox="0 0 16 16">
|
|
1117
|
+
<path fill="currentColor" d="M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z"></path>
|
|
1118
|
+
<path fill="currentColor" d="M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z"></path>
|
|
1119
|
+
</symbol>
|
|
1120
|
+
<symbol id="diffs-editor-icon-chevron" viewBox="0 0 16 16">
|
|
1121
|
+
<path fill="currentColor" d="M1.46967 4.46967C1.76256 4.17678 2.23744 4.17678 2.53033 4.46967L8 9.93934L13.4697 4.46967C13.7626 4.17678 14.2374 4.17678 14.5303 4.46967C14.8232 4.76256 14.8232 5.23744 14.5303 5.53033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L1.46967 5.53033C1.17678 5.23744 1.17678 4.76256 1.46967 4.46967Z"></path>
|
|
1122
|
+
</symbol>
|
|
1123
|
+
<symbol id="diffs-editor-icon-whole-word" viewBox="0 0 16 16">
|
|
1124
|
+
<path fill="currentColor" d="M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z"></path>
|
|
1125
|
+
<path fill="currentColor" d="M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z"></path>
|
|
1126
|
+
<path fill="currentColor" d="M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z"></path>
|
|
1127
|
+
</symbol>
|
|
1128
|
+
<symbol id="diffs-editor-icon-regex" viewBox="0 0 16 16">
|
|
1129
|
+
<path fill="currentColor" d="M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z"></path>
|
|
1130
|
+
<path fill="currentColor" d="M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z"></path>
|
|
1131
|
+
</symbol>
|
|
1132
|
+
<symbol id="diffs-editor-icon-replace" viewBox="0 0 16 16">
|
|
1133
|
+
<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M5.28033 5.71967C5.57322 6.01256 5.57322 6.48744 5.28033 6.78033L3.56066 8.5H11.75C12.7165 8.5 13.5 7.7165 13.5 6.75V2.75C13.5 2.33579 13.8358 2 14.25 2C14.6642 2 15 2.33579 15 2.75V6.75C15 8.54493 13.5449 10 11.75 10H3.56066L5.28033 11.7197C5.57322 12.0126 5.57322 12.4874 5.28033 12.7803C4.98744 13.0732 4.51256 13.0732 4.21967 12.7803L1.21967 9.78033C0.926777 9.48744 0.926777 9.01256 1.21967 8.71967L4.21967 5.71967C4.51256 5.42678 4.98744 5.42678 5.28033 5.71967Z"></path>
|
|
1134
|
+
</symbol>
|
|
1135
|
+
<symbol id="diffs-editor-icon-replace-all" viewBox="0 0 16 16">
|
|
1136
|
+
<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967L14.7803 3.21967C15.0732 3.51256 15.0732 3.98744 14.7803 4.28033L11.7803 7.28033C11.4874 7.57322 11.0126 7.57322 10.7197 7.28033C10.4268 6.98744 10.4268 6.51256 10.7197 6.21967L12.4393 4.5H4.25C3.2835 4.5 2.5 5.2835 2.5 6.25V6.875C2.5 7.28921 2.16421 7.625 1.75 7.625C1.33579 7.625 1 7.28921 1 6.875V6.25C1 4.45507 2.45508 3 4.25 3H12.4393L10.7197 1.28033C10.4268 0.987437 10.4268 0.512563 10.7197 0.21967ZM5.28033 8.71967C5.57322 9.01256 5.57322 9.48744 5.28033 9.78033L3.56066 11.5H11.75C12.7165 11.5 13.5 10.7165 13.5 9.75V9.125C13.5 8.71079 13.8358 8.375 14.25 8.375C14.6642 8.375 15 8.71079 15 9.125V9.75C15 11.5449 13.5449 13 11.75 13H3.56066L5.28033 14.7197C5.57322 15.0126 5.57322 15.4874 5.28033 15.7803C4.98744 16.0732 4.51256 16.0732 4.21967 15.7803L1.21967 12.7803C0.926777 12.4874 0.926777 12.0126 1.21967 11.7197L4.21967 8.71967C4.51256 8.42678 4.98744 8.42678 5.28033 8.71967Z"></path>
|
|
1137
|
+
</symbol>
|
|
1138
|
+
</svg>`,$p=()=>{let e=document.createElement(`div`);e.innerHTML=Qp;let t=e.firstElementChild;if(t===null||!(t instanceof SVGSVGElement))throw Error(`Failed to create sprite element`);return t},em=(e,t=16)=>`<svg width="${t}" height="${t}" aria-hidden="true" focusable="false">
|
|
1139
|
+
<use href="#diffs-editor-icon-${e}"></use>
|
|
1140
|
+
</svg>`,tm=`@layer base,theme,rendered,unsafe;@layer base{:host{--diffs-search-panel-fg:var(--diffs-fg,light-dark(var(--diffs-light,#000),var(--diffs-dark,#fff)));--diffs-search-panel-bg:var(--diffs-bg,light-dark(var(--diffs-light-bg,#fff),var(--diffs-dark-bg,#000)));--diffs-search-panel-modified:var(--diffs-modified-base,var(--diffs-modified-color-override,light-dark(var(--diffs-light-modified-color,var(--diffs-modified-color,var(--diffs-modified-light,#009fff))),var(--diffs-dark-modified-color,var(--diffs-modified-color,var(--diffs-modified-dark,#69b1ff))))));top:var(--diffs-search-panel-inset-top,16px);right:var(--diffs-search-panel-inset-right,16px);z-index:100;box-sizing:border-box;contain:layout size style;justify-content:flex-end;width:100%;height:0;display:flex;position:sticky}:host([data-search-panel-overlay]){--diffs-fg:initial;--diffs-bg:initial;--diffs-modified-base:initial;--diffs-modified-color:initial;--diffs-light-modified-color:initial;--diffs-dark-modified-color:initial;color-scheme:light dark;pointer-events:none}[data-search-panel]{flex-direction:column;justify-content:flex-end;width:100%;height:fit-content;display:flex;container:search-panel/inline-size}[data-editor-widget]{--diffs-widget-fg:var(--diffs-search-panel-fg);--diffs-widget-bg:color-mix(in lab, var(--diffs-search-panel-fg) 4%, var(--diffs-search-panel-bg));--diffs-widget-border:color-mix(in lab, var(--diffs-search-panel-fg) 20%, transparent);--diffs-widget-shadow:inset 0 0 0 1px var(--diffs-search-panel-bg), 0 4px 8px #00000013, 0 6px 18px #00000013;--diffs-search-panel-padding:4px;z-index:100;width:fit-content;padding:var(--diffs-search-panel-padding);min-width:260px;max-width:100%;margin-inline:auto var(--diffs-search-panel-inset-right,16px);border:1px solid var(--diffs-widget-border);background-color:var(--diffs-widget-bg);box-shadow:var(--diffs-widget-shadow);font-family:var(--diffs-header-font-fallback,system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);background-clip:padding-box;border-radius:9px;flex-shrink:0;align-items:stretch;gap:8px;font-size:14px;display:flex;position:relative}:host([data-search-panel-overlay]) [data-editor-widget]{pointer-events:auto}svg{fill:currentColor;width:12px;height:12px;display:block}[data-search-grid]{--diffs-search-panel-column-gap:6px;align-items:center;gap:4px var(--diffs-search-panel-column-gap);grid-template-columns:auto auto auto;grid-template-areas:"find toggles nav";width:100%;display:grid}[data-search-grid][data-can-replace]{grid-template-columns:auto auto auto auto;grid-template-areas:"toggle find toggles nav"}[data-search-grid][data-mode=replace]{grid-template-areas:"toggle find toggles nav"".replace actions."}[data-input-box][data-find]{box-sizing:border-box;color:var(--diffs-search-panel-fg);background-color:var(--diffs-search-panel-bg);border:1px solid color-mix(in lab, var(--diffs-search-panel-fg) 12%, var(--diffs-search-panel-bg));border-radius:6px;grid-area:find}[data-search-nav]{grid-area:nav}[data-input-box][data-replace]{grid-area:replace}[data-replace-actions]{grid-area:actions}[data-search-grid][data-mode=find] [data-replace-cell]{display:none}@container search-panel (width<400px){[data-editor-widget]{--diffs-search-panel-padding:10px}[data-search-grid]{grid-template-columns:auto 1fr auto;grid-template-areas:"find find find""nav toggles toggles"}[data-search-grid][data-can-replace]{grid-template-columns:auto auto 1fr auto;grid-template-areas:"toggle find find find"".nav toggles toggles"}[data-search-grid][data-mode=replace]{grid-template-areas:"toggle find find find"".replace replace replace"".nav toggles actions"}[data-replace-actions]{justify-self:end}[data-search-grid] [data-input-box]{width:auto}}[data-input-box]{align-items:center;width:200px;display:flex;position:relative}[data-input-box] input{box-sizing:border-box;width:100%;min-width:0;color:var(--diffs-search-panel-fg);background-color:var(--diffs-search-panel-bg);border:1px solid color-mix(in lab, var(--diffs-search-panel-fg) 12%, var(--diffs-search-panel-bg));border-radius:6px;outline:none;flex-grow:1;padding-block:4px;padding-inline:6px;font-size:13px;line-height:16px}[data-input-box] input:focus-visible{outline:1px solid var(--diffs-search-panel-modified);outline-offset:-1px}[data-input-box][data-find] input{background:0 0;border:0}[data-input-box] [data-search-icon]{--diffs-search-icon-size:20px}[data-input-box][data-find]:focus-within{outline:1px solid var(--diffs-search-panel-modified);outline-offset:-1px}[data-input-box][data-find] input:focus-visible{outline:none}[data-search-toggles]{grid-area:toggles;justify-content:flex-end;align-items:center;gap:1px;display:flex;position:relative}[data-search-toggles]:after{content:"";background-color:var(--diffs-widget-border);flex-shrink:0;width:1px;height:16px;margin-inline-start:4px;display:block}[data-matches]{contain:layout paint style;font-variant-numeric:tabular-nums;white-space:nowrap;color:color-mix(in lab, var(--diffs-search-panel-fg) 50%, var(--diffs-search-panel-bg));flex-shrink:0;padding-inline-end:6px;font-size:12px;font-weight:500;line-height:20px}[data-matches][data-no-matches]{color:color-mix(in lab, var(--diffs-search-panel-fg) 30%, var(--diffs-search-panel-bg))}[data-matches][data-searching]{align-items:center;display:flex}[data-matches][data-searching]>svg{--spokes:8;transform-origin:50%;width:16px;height:16px;animation:search-spinner-turn .96s steps(var(--spokes), end) infinite;display:inline-block}@keyframes search-spinner-turn{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){[data-matches][data-searching]>svg{animation:none}}[data-replace-actions],[data-search-nav]{align-items:center;display:flex}[data-search-icon]{appearance:none;width:var(--diffs-search-icon-size,24px);height:var(--diffs-search-icon-size,24px);color:color-mix(in lab, var(--diffs-search-panel-fg) 65%, var(--diffs-search-panel-bg));border-radius:var(--diffs-search-icon-radius,4px);cursor:pointer;background:0 0;border:0;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;display:flex}[data-search-icon]>svg{pointer-events:none}[data-search-icon]:disabled{opacity:.25;cursor:default}[data-search-icon]:not(:disabled,[aria-pressed=true]):hover{color:var(--diffs-search-panel-fg)}[data-search-icon]:focus-visible{outline:1px solid var(--diffs-search-panel-modified)}[data-search-icon][aria-pressed=true]{color:var(--diffs-search-panel-modified)}[data-replace-toggle][hidden]{display:none}[data-replace-toggle]{--diffs-search-icon-size:16px;height:auto;grid-area:toggle;align-self:stretch;margin-inline-end:calc(var(--diffs-search-panel-padding) - var(--diffs-search-panel-column-gap));&[aria-expanded=false] svg{transform:rotate(-90deg)}}[data-search-close]{--diffs-search-icon-size:20px;--diffs-search-icon-radius:50%;color:var(--diffs-widget-bg);background-color:color-mix(in lab, var(--diffs-widget-fg) 50%, var(--diffs-search-panel-bg));position:absolute;top:0;right:0;transform:translate(50%,-50%);box-shadow:0 1px 3px #00000040}[data-search-close]:not(:disabled):hover{opacity:1;color:var(--diffs-widget-bg);background-color:var(--diffs-widget-fg)}}@layer theme,rendered,unsafe;
|
|
1141
|
+
`,nm=class{#e;#t;#n;#r;#i;#a;#o;#s;#c=!1;#l;#u;#d;#f;#p;#m;#h;constructor(e){let{containerElement:t,themeCSS:n,unsafeCSS:r,defaultQuery:i,defaults:a,mode:o=`find`,search:s,scrollToMatch:c,currentMatchNeedsReveal:l,replace:u,onQueryChange:d,onUpdate:f,onStateChange:p,onBeforeNavigate:m,onClose:g}=e,_=u,v=o,y=e=>_==null?`find`:e,b={text:i,replaceText:``,caseSensitive:a?.caseSensitive===!0,wholeWord:a?.wholeWord===!0,regex:a?.regex===!0},x={all:[],currentIndex:void 0},S=()=>({...b}),C=()=>{p==null||this.#c||p({...S(),mode:y(v),canReplace:_!=null,matchCount:x.all.length,searching:w,currentMatchIndex:x.currentIndex})},w=i!==``,T=z(`div`,{dataset:{matches:``}}),E,D=()=>{E=void 0,delete T.dataset.searching,T.removeAttribute(`aria-label`)},ee=()=>{if(w){if(E===L.version)return;E??(T.dataset.searching=``,T.innerHTML=em(`loader`,16));let e=L.t(`searching`);T.ariaLabel!==e&&(T.ariaLabel=e),E=L.version}else D(),T.textContent=L.t(`noSearchResults`);T.toggleAttribute(`data-no-matches`,!w)};ee();let O=e=>{D(),T.textContent=e==null?L.t(`searchResultCount`,{count:x.all.length}):L.t(`searchResultPosition`,{index:e+1,count:x.all.length}),x.currentIndex=e},k=!1,te=e=>{k=!0;let t=b.text===``?{matches:[]}:s(S());x.all=t.matches,w=t.searching===!0,_e.disabled=w,ve.disabled=w;let n=x.all.length===0;de.disabled=n,fe.disabled=n,n?(ee(),x.currentIndex=void 0,f(t,e)):(delete T.dataset.noMatches,O(f(t,e))),C()};this.#l=te;let A=(e,t)=>{b[e]!==t&&d?.(),b[e]=t,te()},j=(e=!1,t=!1)=>{if(m?.(),this.#c)return;let{all:n,currentIndex:r}=x;if(n.length>0){let i;i=r==null?e?n.length-1:0:l?.()===!0?r:(r+(e?-1:1)+n.length)%n.length,O(i),c(n[i],t)}else x.currentIndex=void 0;C()};this.#f=e=>j(e,!0);let ne=()=>{let e=_;if(w||e===void 0||b.text===``||x.all.length===0)return;let t=x.currentIndex??0;x.currentIndex??j(!1,!0);let n=x.all[t],r=e.replaceMatch(n,S());r!==void 0&&c(r,!0),x.currentIndex=void 0,te()},M=()=>{let e=_;w||e===void 0||b.text===``||x.all.length===0||(e.replaceAll(x.all.slice(),S()),x.currentIndex=void 0,te())},N=()=>{g(),this.cleanup()};this.#h=N;let re=new Map,ie=e=>{let t=z(`button`,{type:`button`,dataset:{searchIcon:``,...e.dataset},innerHTML:em(e.icon,e.size??16),onclick:e.onClick});return re.set(t,e.label),t},ae=(e,t,n)=>{let r=ie({icon:e,label:t,size:14,onClick:()=>{let e=!b[n];r.ariaPressed=String(e),A(n,e)}});return r.ariaPressed=String(b[n]),r},oe=ae(`case`,`matchCase`,`caseSensitive`),se=ae(`whole-word`,`wholeWord`,`wholeWord`),ce=ae(`regex`,`regularExpression`,`regex`);this.#n=z(`input`,{type:`text`,dataset:`search`,value:i,oninput:e=>{x.currentIndex=void 0,A(`text`,e.target.value)},onkeydown:e=>{if(e.isComposing||e.keyCode===229)return;let t=Bp(e);e.key===`Escape`?(e.preventDefault(),N()):e.key===`Enter`?(e.preventDefault(),j(e.shiftKey,!0)):t===`next`||t===`previous`?(e.preventDefault(),j(t===`previous`,!0)):t!=null&&(e.preventDefault(),Ce(t))}}),this.#p=e=>{this.#n.value!==e&&(this.#n.value=e,x.currentIndex=void 0,A(`text`,e))};let le=z(`div`,{dataset:`searchToggles`,children:[oe,se,ce]}),ue=z(`div`,{dataset:{inputBox:``,find:``},children:[this.#n,T]}),de=ie({icon:`arrow-up`,label:`previousMatch`,onClick:()=>{j(!0)}}),fe=ie({icon:`arrow-down`,label:`nextMatch`,onClick:()=>{j()}});de.disabled=!0,fe.disabled=!0;let pe=z(`div`,{dataset:`searchNav`,children:[de,fe]}),me=ie({icon:`close`,label:`closeSearch`,onClick:N,dataset:{searchClose:``}}),he=z(`input`,{type:`text`,dataset:`replace`,value:``,oninput:e=>{b.replaceText=e.target.value,C()},onkeydown:e=>{if(e.isComposing||e.keyCode===229)return;let t=Vp(e);e.key===`Escape`?(e.preventDefault(),N()):e.key===`Enter`?(e.preventDefault(),ne()):t!==void 0&&(e.preventDefault(),j(t===`previous`,!0))}}),ge=z(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[he]}),_e=ie({icon:`replace`,label:`replaceMatch`,onClick:ne}),ve=ie({icon:`replace-all`,label:`replaceAllMatches`,onClick:M}),ye=z(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[_e,ve]}),be=ie({icon:`chevron`,label:`toggleReplace`,dataset:{replaceToggle:``},onClick:()=>{xe.dataset.mode===`replace`?Ce(`find`):(Ce(`replace`),he.focus())}}),xe=z(`div`,{dataset:{searchGrid:``,mode:y(o)},children:[be,ue,ge,ye,le,pe,me]}),Se=()=>{let e=_!=null,t=y(v);xe.dataset.mode=t,xe.toggleAttribute(`data-can-replace`,e),be.hidden=!e,be.ariaExpanded=String(t===`replace`)};Se(),this.#m=()=>_!=null,this.#d=e=>{_=e,Se(),C()};let Ce=e=>{v=e,Se(),this.#n.focus(),this.#n.select(),C()};this.#u=Ce,this.#e=z(`div`,{dataset:`searchPanel`});let we=this.#e.attachShadow({mode:`open`}),Te=document.createElement(`div`);Te.innerHTML=Qp;let Ee=Te.firstElementChild;Ee instanceof SVGElement&&we.appendChild(Ee),z(`style`,{textContent:tm},we),this.#r=z(`style`,{textContent:n??``},we),this.#r.setAttribute(h,``),this.setUnsafeCSS(r),this.#t=z(`div`,{dataset:`editorWidget`,children:[xe]}),z(`div`,{dataset:`searchPanel`,children:[this.#t]},we),this.#a=()=>{k||this.#c||te()};let De=()=>{this.#n.placeholder=L.t(`searchPlaceholder`),he.placeholder=L.t(`replacePlaceholder`);for(let[e,t]of re)e.title=L.t(t),e.ariaLabel=e.title;x.all.length>0?O(x.currentIndex):ee()};this.#o=()=>{this.#c||(De(),this.#s??=L.subscribe({onMessagesChange:De}),t.before(this.#e),this.#n.select(),C(),Yt(this.#a))}}mount(){this.#o?.()}getHostElement(){return this.#e}getBounds(){return this.#t.getBoundingClientRect()}setThemeCSS(e){let t=e??``;this.#r.textContent!==t&&(this.#r.textContent=t)}setUnsafeCSS(e){e?(this.#i??(this.#i=Pt(),this.#r.after(this.#i)),this.#i.textContent=qt(e)):(this.#i?.remove(),this.#i=void 0)}hasQuery(){return this.#n.value!==``}hasReplaceHandlers(){return this.#m?.()===!0}focus(){this.#n.focus()}navigate(e){this.#a(),this.#c||this.#f?.(e)}setQuery(e){this.#p?.(e)}updateMatches(e){this.#l?.(e)}setMode(e){this.#u?.(e)}setReplaceHandlers(e){this.#d?.(e)}close(){this.#h?.()}cleanup(){this.#c=!0,this.#s?.(),Kt(this.#a),this.#e.remove()}};function rm(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var $=fe();function im({file:e,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,lineAnnotations:s,renderGutterUtility:c,getHoveredLine:l,getAnnotationSlotName:u=vt}){let d=n?.(e),f=r?.(e),p=i?.(e),m=a?.(e);return(0,$.jsxs)($.Fragment,{children:[d==null?(0,$.jsxs)($.Fragment,{children:[f!=null&&(0,$.jsx)(`div`,{slot:`header-prefix`,children:f}),p!=null&&(0,$.jsx)(`div`,{slot:`header-filename-suffix`,children:p}),m!=null&&(0,$.jsx)(`div`,{slot:`header-metadata`,children:m})]}):(0,$.jsx)(`div`,{slot:t,children:d}),o!=null&&s?.map((t,n)=>(0,$.jsx)(`div`,{slot:u(t),children:o(t,e)},n)),c!=null&&(0,$.jsx)(`div`,{slot:`gutter-utility-slot`,style:ln,children:c(l)})]})}var am=he(((e,t,n)=>{var r;(function(n,i){typeof e==`object`&&t!==void 0?i(e):typeof r==`function`&&r.amd?r([`exports`],i):i((n||=self).lru_map=n.lru_map||{})})(n,function(e){let t=Symbol(`newer`),n=Symbol(`older`);class r{constructor(e,t){typeof e!=`number`&&(t=e,e=0),this.size=0,this.limit=e,this.oldest=this.newest=void 0,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[t]&&(e===this.oldest&&(this.oldest=e[t]),e[t][n]=e[n]),e[n]&&(e[n][t]=e[t]),e[t]=void 0,e[n]=this.newest,this.newest&&(this.newest[t]=e),this.newest=e)}assign(e){let r,a=this.limit||Number.MAX_VALUE;this._keymap.clear();let o=e[Symbol.iterator]();for(let e=o.next();!e.done;e=o.next()){let o=new i(e.value[0],e.value[1]);if(this._keymap.set(o.key,o),r?(r[t]=o,o[n]=r):this.oldest=o,r=o,a--==0)throw Error(`overflow`)}this.newest=r,this.size=this._keymap.size}get(e){var t=this._keymap.get(e);return t?(this._markEntryAsUsed(t),t.value):void 0}set(e,r){var a=this._keymap.get(e);return a?(a.value=r,this._markEntryAsUsed(a),this):(this._keymap.set(e,a=new i(e,r)),this.newest?(this.newest[t]=a,a[n]=this.newest):this.oldest=a,this.newest=a,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var e=this.oldest;if(e)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[n]=void 0):(this.oldest=void 0,this.newest=void 0),e[t]=e[n]=void 0,this._keymap.delete(e.key),--this.size,[e.key,e.value]}find(e){let t=this._keymap.get(e);return t?t.value:void 0}has(e){return this._keymap.has(e)}delete(e){var r=this._keymap.get(e);return r?(this._keymap.delete(r.key),r[t]&&r[n]?(r[n][t]=r[t],r[t][n]=r[n]):r[t]?(r[t][n]=void 0,this.oldest=r[t]):r[n]?(r[n][t]=void 0,this.newest=r[n]):this.oldest=this.newest=void 0,this.size--,r.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new o(this.oldest)}values(){return new s(this.oldest)}entries(){return this}[Symbol.iterator](){return new a(this.oldest)}forEach(e,n){typeof n!=`object`&&(n=this);let r=this.oldest;for(;r;)e.call(n,r.value,r.key,this),r=r[t]}toJSON(){for(var e=Array(this.size),n=0,r=this.oldest;r;)e[n++]={key:r.key,value:r.value},r=r[t];return e}toString(){for(var e=``,n=this.oldest;n;)e+=String(n.key)+`:`+n.value,n=n[t],n&&(e+=` < `);return e}}e.LRUMap=r;function i(e,r){this.key=e,this.value=r,this[t]=void 0,this[n]=void 0}function a(e){this.entry=e}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}};function o(e){this.entry=e}o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.key}):{done:!0,value:void 0}};function s(e){this.entry=e}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.value}):{done:!0,value:void 0}}})})),om=typeof window>`u`?V.useEffect:V.useLayoutEffect;function sm({file:e,options:t,editorOptions:n,editStateKey:i,lineAnnotations:a,selectedLines:o,prerenderedHTML:s,metrics:c,hasGutterRenderUtility:l,hasCustomHeader:u,disableWorkerPool:d,edit:f,onEditChange:p,onEditComplete:m}){let h=an(),g=o!==void 0,_=(0,V.useContext)(Ln),v=hn(),y=jn(e=>p?.(e)),b=p==null?void 0:y,x=(0,V.useRef)(null),S=jn(e=>{let t=m?.(e)??`reject`;return t===`accept`&&(x.current={file:{installed:e.file,stale:e.originalFile},annotations:{installed:e.lineAnnotations,stale:e.originalLineAnnotations}}),t}),C=m==null?void 0:S,w=(0,V.useRef)(null),T=Dn(),E=cm(x,e,a),D=zn(w,E)??{file:e,lineAnnotations:a??r},ee=Fn(),O=jn(()=>{if(v==null)throw Error(`File: EditContext is not attached`);return v(`file`,n??{},i)}),k=jn(n=>{if(n!=null){if(w.current!=null)throw Error(`File: An instance should not already exist when a node is created`);h==null?w.current=new Xd(dm({controlledSelection:g,hasCustomHeader:u,hasGutterRenderUtility:l,onEditChange:b,onEditComplete:C,options:t}),d?void 0:_,T):w.current=new rf(dm({controlledSelection:g,hasCustomHeader:u,hasGutterRenderUtility:l,onEditChange:b,onEditComplete:C,options:t}),h,c,d?void 0:_,T),w.current.hydrate({file:e,fileContainer:n,lineAnnotations:a,prerenderedHTML:s})}else{if(w.current==null)throw Error(`File: A File instance should exist when unmounting`);w.current.cleanUp(),w.current=null,ee.forget()}});om(()=>{let{current:n}=w;if(n==null)return;let r=dm({controlledSelection:g,hasCustomHeader:u,hasGutterRenderUtility:l,onEditChange:b,onEditComplete:C,options:t}),i=!ht(n.options,r);n.setOptions(r),f||ee.detach();let s=um(e,a,x);n.render({file:s.file,lineAnnotations:s.lineAnnotations,forceRender:i}),o!==void 0&&n.setSelectedLines(o),f&&ee.attachWhenReady(n,()=>fm(n,O),T)});let te=(0,V.useCallback)(()=>w.current?.getHoveredLine(),[]),A=(0,V.useCallback)(e=>w.current?.getAnnotationSlotName(e)??vt(e),[]);return{...D,ref:k,getHoveredLine:te,getAnnotationSlotName:A}}function cm(e,t,n){"use no memo";return lm(t,n,e.current)}function lm(e,t,n){return{file:n?.file!=null&&R(e,n.file.stale)?n.file.installed:e,lineAnnotations:n?.annotations!=null&&t===n.annotations.stale?n.annotations.installed:t}}function um(e,t,n){let{current:r}=n,i=lm(e,t,r);return r==null||(r.file!=null&&!R(e,r.file.stale)&&(r.file=null),t!==r.annotations?.stale&&(r.annotations=null),r.file==null&&r.annotations==null&&(n.current=null)),i}function dm({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return{...e,controlledSelection:t,renderCustomHeader:n?Hn:e?.renderCustomHeader,renderGutterUtility:r?Hn:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}}function fm(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function pm({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,editStateKey:a,metrics:o,className:s,style:c,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,prerenderedHTML:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S,file:C,lineAnnotations:w}=sm({file:e,options:r,editorOptions:i,editStateKey:a,metrics:o,lineAnnotations:t,selectedLines:n,prerenderedHTML:m,hasGutterRenderUtility:h!=null,hasCustomHeader:u!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y}),T=im({file:C,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:h,lineAnnotations:w,getHoveredLine:x,getAnnotationSlotName:S});return(0,$.jsx)(it,{ref:b,className:s,style:c,children:kn(T,m)})}P();function mm(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}Array(12).fill(0);var hm=1,gm=100,_m=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:hm++,vm=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-gm;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{let{message:t,...n}=e,r=_m(e),i=this.pendingDismissals.get(r);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(r),this.dismissedToasts.delete(r));let a=this.dismissedToasts.has(r),o=e.dismissible===void 0||e.dismissible;return a&&(this.dismissedToasts.delete(r),this.toasts=this.toasts.filter(e=>e.id!==r)),!a&&this.toasts.find(e=>e.id===r)?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:o,title:t}):n):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],V.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(bm(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!V.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!V.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!V.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!V.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=_m(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},ym=(e,t)=>vm.message(e,t),bm=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,xm=Object.assign(ym,{success:vm.success,info:vm.info,warning:vm.warning,error:vm.error,custom:vm.custom,message:vm.message,promise:vm.promise,dismiss:vm.dismiss,loading:vm.loading},{getHistory:()=>vm.toasts,getToasts:()=>vm.getActiveToasts()});mm(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);var Sm=typeof window>`u`?V.useEffect:V.useLayoutEffect;function Cm(e,t,n){let r=e==null?null:(0,$.jsx)(`div`,{slot:Dr,children:e}),i=t!=null&&n!=null?(0,$.jsx)(`div`,{slot:Or,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,$.jsxs)($.Fragment,{children:[r,i]})}function wm(e,t){return typeof window>`u`&&t!=null?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,$.jsx)($.Fragment,{children:e})}function Tm(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement||e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function Em(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function Dm(e){let t=(0,V.useRef)(e.getComposition()),n=(0,V.useRef)(e);return n.current!==e&&(n.current=e,t.current=e.getComposition()),t.current}function Om({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),u=Dm(n),d=i!=null,[f,p]=(0,V.useState)(d);f!==d&&(p(d),o!=null&&s(null));let m=(0,V.useCallback)(()=>{s(null)},[]),h=(0,V.useCallback)((e,t)=>{s({context:t,item:e})},[]),g=(0,V.useMemo)(()=>Em(u,e,d,m,h),[u,m,h,d,e]),_=(0,V.useCallback)(e=>{l(e)},[]);Sm(()=>{n.setComposition(g)},[g,n]),Sm(()=>{if(c!=null)return r!=null&&Tm(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(u)}},[u,c,n,r]);let v=wm(Cm(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,$.jsx)(xr,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function km(e){let[t]=(0,V.useState)(()=>new Pd(e)),n=(0,V.useRef)({timeout:null,model:t});return(0,V.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}function Am(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!Object.is(e[n],t[n]))return!1;return!0}function jm(e,t,n){return Object.is(e,t)||n?.(e,t)===!0}function Mm(e,t,n){let r=(0,V.useRef)({hasValue:!1,model:null,selector:null,value:void 0}),i=(0,V.useCallback)(t=>e.subscribe(t),[e]),a=(0,V.useCallback)(()=>{let i=r.current,a=t(e);if(i.model!==e||i.selector!==t||!i.hasValue)return i.hasValue=!0,i.model=e,i.selector=t,i.value=a,a;let o=i.value;return jm(o,a,n)?o:(i.value=a,a)},[n,e,t]);return(0,V.useSyncExternalStore)(i,a,a)}function Nm(e,t){return e.isOpen===t.isOpen&&e.value===t.value&&Am(e.matchingPaths,t.matchingPaths)}function Pm(e){let t=Mm(e,e=>({isOpen:e.isSearchOpen(),matchingPaths:e.getSearchMatchingPaths(),value:e.getSearchValue()}),Nm);return(0,V.useMemo)(()=>({...t,close:()=>{e.closeSearch()},focusNextMatch:()=>{e.focusNextSearchMatch()},focusPreviousMatch:()=>{e.focusPreviousSearchMatch()},open:t=>{e.openSearch(t)},setValue:t=>{e.setSearch(t)}}),[e,t])}var Fm=`
|
|
1142
|
+
:host {
|
|
1143
|
+
--trees-bg-override: transparent;
|
|
1144
|
+
--trees-selected-bg-override: color-mix(in srgb, currentColor 12%, transparent);
|
|
1145
|
+
--trees-hover-bg-override: color-mix(in srgb, currentColor 7%, transparent);
|
|
1146
|
+
--trees-border-color-override: color-mix(in srgb, currentColor 14%, transparent);
|
|
1147
|
+
--trees-font-family-override: var(--font-sans);
|
|
1148
|
+
--trees-font-size-override: 0.75rem;
|
|
1149
|
+
}
|
|
1150
|
+
[data-truncate-content='visible'] { overflow: hidden; text-overflow: ellipsis; }
|
|
1151
|
+
[data-truncate-marker] { display: none; }
|
|
1152
|
+
button[data-type='item'], button[data-type='item']::before { border-radius: var(--radius-md); }
|
|
1153
|
+
`;function Im(e){return e===`??`?`untracked`:e.includes(`A`)?`added`:e.includes(`D`)?`deleted`:e.includes(`R`)?`renamed`:e===`!!`?`ignored`:e?`modified`:null}var Lm=e=>e&&e.isDirectory()?e:null,Rm=e=>e.kind===`directory`?`${e.path}/`:e.path,zm=e=>`forge.files.expanded:${e}`;function Bm(e){try{let t=JSON.parse(localStorage.getItem(zm(e))||`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Vm({projectId:e,selectedPath:t,revealId:n,onOpenFile:r,onRefreshSelected:i}){let a=ne(),o=Ge(),s=f(),c=_(a.projects.get.queryOptions({id:e})),[l,u]=V.useState(()=>[``]),p=V.useCallback(e=>u(t=>t.includes(e)?t:[...t,e]),[]),m=gr({queries:l.map(t=>a.files.tree.queryOptions({projectId:e,path:t}))}),[h,g]=V.useState(``),[v,y]=V.useState(``);V.useEffect(()=>{let e=setTimeout(()=>y(h.trim()),200);return()=>clearTimeout(e)},[h]);let b=_({...a.files.search.queryOptions({projectId:e,query:v.slice(0,256)}),enabled:!!v}),x=!!h.trim()&&(h.trim()!==v||b.isFetching),S=V.useMemo(()=>{let e=new Map;for(let t of m)for(let n of t.data||[])e.set(n.path,{path:n.path,kind:n.type===`dir`?`directory`:`file`,git:n.git});if(v&&b.data)for(let t of b.data.entries){e.has(t.path)||e.set(t.path,{path:t.path,kind:t.kind});let n=t.path.split(`/`);for(let t=1;t<n.length;t++){let r=n.slice(0,t).join(`/`);e.has(r)||e.set(r,{path:r,kind:`directory`})}}return[...e.values()]},[m,v,b.data]),C=V.useMemo(()=>new Map(S.map(e=>[e.path,e.kind])),[S]),w=V.useRef(C);w.current=C;let T=V.useMemo(()=>S.filter(e=>e.kind===`directory`).map(Rm),[S]),E=m[0]?.isSuccess??!1,D=m.find(e=>e.error)?.error?.message||b.error?.message||``,ee=V.useRef(null),[O,k]=V.useState(null),te=V.useRef(!1),A=V.useRef(null),{model:j}=km({composition:{contextMenu:{triggerMode:`right-click`,onOpen:(e,t)=>{let n=ee.current,r=n!==null&&performance.now()-n.at<1e3,i=t.anchorElement.getBoundingClientRect();t.close({restoreFocus:!r}),k({at:r?{x:n.x,y:n.y}:{x:i.left,y:i.bottom},item:e})}}},dragAndDrop:!1,density:`compact`,fileTreeSearchMode:`hide-non-matches`,flattenEmptyDirectories:!0,initialExpansion:`closed`,icons:Ae,onSelectionChange:e=>{if(te.current)return;let t=e.at(-1)?.replace(/\/$/,``);t&&w.current.get(t)===`file`&&(A.current=t,r(t))},paths:[],search:!1,unsafeCSS:Fm}),M=Pm(j),N=V.useRef(null),re=V.useRef(new Set),[ie]=V.useState(()=>new Set(Bm(e)));V.useEffect(()=>{if(!E)return;let e=S.map(Rm).sort(),t=N.current;if(N.current=e,t===null){j.resetPaths(e);return}let n=new Set(t),r=new Set(e),i=[...e.filter(e=>!n.has(e)).map(e=>({type:`add`,path:e})),...t.filter(e=>!r.has(e)).map(e=>({type:`remove`,path:e,recursive:!0}))];i.length&&j.batch(i)},[S,E,j]),V.useEffect(()=>{let e=[];for(let t of S){if(t.kind!==`file`||!t.git)continue;let n=Im(t.git);n&&e.push({path:t.path,status:n})}j.setGitStatus(e)},[S,j]),V.useEffect(()=>{let t=()=>{if(j.isSearchOpen())return;let t=!1;for(let e of T){let n=Lm(j.getItem(e));n&&(ie.delete(e)&&n.expand(),n.isExpanded()?(re.current.has(e)||(re.current.add(e),t=!0),p(e.slice(0,-1))):re.current.delete(e)&&(t=!0))}t&&localStorage.setItem(zm(e),JSON.stringify([...re.current,...ie]))};return t(),j.subscribe(t)},[T,j,p,e,ie]),V.useEffect(()=>{if(!t)return;let e=t.split(`/`);for(let t=1;t<e.length;t++)p(e.slice(0,t).join(`/`));w.current.get(t)===`directory`&&p(t)},[t,n,p,C]);let ae=V.useRef(``);V.useEffect(()=>{if(!t||!E)return;let e=`${t}#${n??0}`;if(ae.current===e)return;let r=w.current.get(t)===`directory`?`${t}/`:t,i=j.getItem(r);if(!i)return;if(ae.current=e,A.current===t){A.current=null;return}te.current=!0,g(``),j.closeSearch();for(let e of j.getSelectedPaths())j.getItem(e)?.deselect();let a=t.split(`/`);for(let e=1;e<a.length;e++)Lm(j.getItem(`${a.slice(0,e).join(`/`)}/`))?.expand();Lm(i)?.expand(),i.select(),j.scrollToPath(r,{focus:!1,offset:`center`}),queueMicrotask(()=>{te.current=!1})},[t,n,E,S,j]);let oe=e=>{g(e),e.trim()?M.setValue(e):M.close()},se=V.useRef(null),ce=Mm(j,e=>T.length>0&&T.every(t=>!!Lm(e.getItem(t))?.isExpanded())),le=()=>{let e=!ce;for(let t of T){let n=Lm(j.getItem(t));n&&(e?n.expand():n.collapse())}},ue=()=>{for(let t of l)o.invalidateQueries({queryKey:a.files.tree.queryKey({projectId:e,path:t})});v&&b.refetch(),i?.()},de=m.some(e=>e.isFetching),fe=!!M.value.trim()&&M.matchingPaths.length===0,pe=O?[...O.item.kind===`file`?[{id:`download`,label:`Download`}]:[],{id:`copy-path`,label:`Copy path`},{id:`copy-mention`,label:`Copy mention`},{id:`add-to-chat`,label:`Add to chat`}]:[];return(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,"data-file-browser-panel":e,onContextMenuCapture:e=>{ee.current={x:e.clientX,y:e.clientY,at:performance.now()}},onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`f`&&(e.preventDefault(),se.current?.focus(),se.current?.select())},children:[(0,$.jsxs)(`div`,{className:`flex h-10 min-h-10 shrink-0 items-center gap-1 border-b border-border/60 bg-background px-2`,children:[(0,$.jsx)($e,{label:de?`Refreshing…`:`Refresh files`,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":`Refresh workspace files`,onClick:ue,className:`inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-icon-muted hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:(0,$.jsx)(Oe,{className:d(`size-3.5`,de&&`animate-spin`)})})}),(0,$.jsx)(`input`,{ref:se,type:`text`,role:`searchbox`,name:`project-files-search`,"aria-label":`Search ${c.data?.name||`project`} files`,placeholder:`Search files`,spellCheck:!1,value:h,onChange:e=>oe(e.target.value),onKeyDown:e=>{e.key!==`Escape`||e.nativeEvent.isComposing||(h?(e.preventDefault(),e.stopPropagation(),oe(``)):e.currentTarget.blur())},className:`h-7 min-w-0 flex-1 rounded-md bg-transparent px-2 text-xs text-foreground outline-none placeholder:text-muted-foreground hover:bg-accent/50 focus-visible:bg-accent/50`}),T.length>0&&(0,$.jsx)($e,{label:ce?`Collapse all folders`:`Expand all folders`,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":ce?`Collapse all folders`:`Expand all folders`,onClick:le,className:`inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-icon-muted hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:ce?(0,$.jsx)(vr,{className:`size-3.5`}):(0,$.jsx)(br,{className:`size-3.5`})})})]}),D&&(0,$.jsxs)(`button`,{type:`button`,onClick:ue,className:`cursor-pointer p-4 text-left text-xs leading-relaxed text-destructive-foreground`,children:[D,` Click to retry.`]}),!!h.trim()&&b.data?.truncated&&!x&&(0,$.jsx)(`div`,{className:`px-3 py-1 text-xs text-muted-foreground`,children:`More matches available. Refine your search.`}),(!E||x)&&(0,$.jsx)(`div`,{role:`status`,className:S.length>0&&!fe?`sr-only`:`px-3 py-1 text-xs text-muted-foreground`,children:`Loading files…`}),fe?E&&!x&&!D?(0,$.jsx)(`div`,{role:`status`,className:`px-3 py-4 text-xs text-muted-foreground`,children:`No matching files.`}):null:(0,$.jsx)(Om,{model:j,"aria-label":`${c.data?.name||`Project`} files`,className:`min-h-0 flex-1 overflow-hidden`,style:{colorScheme:s?`dark`:`light`,"--trees-fg-override":`var(--foreground)`,"--trees-fg-muted-override":`var(--muted-foreground)`,"--trees-status-ignored-override":`var(--muted-foreground)`},onClickCapture:e=>{if(e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let t=j.getSelectedPaths(),n=t.length===1?t[0]:void 0;n&&w.current.get(n)===`file`&&e.nativeEvent.composedPath().some(e=>e instanceof HTMLElement&&e.getAttribute(`data-item-path`)===n)&&(A.current=n,r(n))},onPointerOver:e=>{let t=e.nativeEvent.composedPath().find(e=>e instanceof HTMLElement&&e.matches(`button[data-type='item']`));if(!t)return;let n=t.getAttribute(`aria-label`),r=Array.from(t.querySelectorAll(`[data-truncate-content='visible']`)).some(e=>e.scrollWidth>e.clientWidth);n&&r?t.title=n:t.removeAttribute(`title`)}}),(0,$.jsx)(qe,{at:O?.at??null,items:pe,onPick:async t=>{if(!O)return;let n=O.item.path.replace(/\/$/,``),r=Ce(n);k(null);try{if(t===`download`){let t=document.createElement(`a`);t.href=`/api/files/${encodeURIComponent(e)}/raw?path=${encodeURIComponent(n)}&download=1`,t.download=n.slice(n.lastIndexOf(`/`)+1),t.click()}else if(t===`copy-path`){let e=c.data?.path||``,t=e.includes(`\\`)?`\\`:`/`;await navigator.clipboard.writeText(e?`${e}${t}${n.split(`/`).join(t)}`:n)}else t===`copy-mention`?await navigator.clipboard.writeText(r):t===`add-to-chat`&&(Ee(`${r} `)||xm.error(`Unable to add to chat`,{description:`Open a chat for this project and try again.`}))}catch(e){xm.error(t===`copy-path`?`Failed to copy path`:`Failed to copy mention`,{description:e.message})}},onClose:()=>k(null)})]})}var Hm=160,Um=560,Wm=256,Gm=`forge.fileExplorerWidth`;function Km(){let e=Number(localStorage.getItem(Gm));return Number.isFinite(e)&&e>=Hm?e:256}function qm({resizable:e,children:t}){let[n,r]=V.useState(Km),[i,a]=V.useState(Um),o=V.useRef(null);V.useEffect(()=>{let t=o.current?.parentElement;if(!t||!e)return;let n=()=>a(Math.max(Hm,Math.min(Um,t.clientWidth-Wm)));n();let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[e]);let s=e=>{let t=Math.round(Math.min(i,Math.max(Hm,e)));r(t),localStorage.setItem(Gm,String(t))},c=e=>{e.preventDefault();let t=e.clientX,r=Math.min(n,i),a=e=>s(r+(t-e.clientX)),o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),document.body.style.cursor=``};document.body.style.cursor=`col-resize`,window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},l=Math.min(n,i);return(0,$.jsxs)(`aside`,{ref:o,"aria-label":`File explorer`,className:e?`relative flex min-h-0 min-w-0 shrink-0 border-l border-border/60 bg-background`:`relative flex min-h-0 min-w-0 flex-1 bg-background`,style:e?{width:l}:void 0,children:[e&&(0,$.jsx)(`div`,{role:`separator`,"aria-label":`Resize file explorer`,"aria-orientation":`vertical`,"aria-valuenow":l,"aria-valuemin":Hm,"aria-valuemax":i,tabIndex:0,onPointerDown:c,onKeyDown:e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;let t=e.key===`ArrowLeft`?l+16:e.key===`ArrowRight`?l-16:e.key===`Home`?Hm:e.key===`End`?i:null;t!==null&&(e.preventDefault(),e.stopPropagation(),s(t))},className:`group absolute top-0 -left-1.5 z-10 flex h-full w-3 cursor-col-resize justify-center outline-none`,children:(0,$.jsx)(`div`,{className:`h-full w-0.5 transition-colors group-hover:bg-border group-focus-visible:bg-ring`})}),t]})}var Jm=`flex min-h-7 cursor-default items-center gap-2 rounded-sm px-2 py-1 text-sm outline-none select-none data-[disabled]:opacity-50 data-[highlighted]:bg-accent [&>svg]:size-4 [&>svg]:shrink-0`,Ym=(e,t)=>e.slice(e.lastIndexOf(`/`)+1)||t;function Xm({projectId:e,projectName:t,dir:n,root:r,currentFile:i,onDir:a,onOpenFile:o}){let s=ne(),c=_(s.files.tree.queryOptions({projectId:e,path:n})),l=n.includes(`/`)?n.slice(0,n.lastIndexOf(`/`)):n?``:null,u=n!==r&&l!==null&&(r===``||l===r||l.startsWith(r+`/`));return(0,$.jsxs)(et,{className:`glass max-h-[min(24rem,var(--available-height))] min-w-48 max-w-72 origin-[var(--transform-origin)] overflow-y-auto rounded-lg p-1 outline-none transition-[opacity,scale] duration-150 data-[ending-style]:scale-98 data-[ending-style]:opacity-0 data-[starting-style]:scale-98 data-[starting-style]:opacity-0`,onKeyDown:e=>{e.key===`ArrowLeft`&&u&&l!==null&&(e.preventDefault(),e.stopPropagation(),a(l))},children:[u&&l!==null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(O,{className:Jm,closeOnClick:!1,onClick:()=>a(l),children:[(0,$.jsx)(E,{className:`text-icon-muted`}),(0,$.jsxs)(`span`,{className:`truncate`,children:[`Back to `,Ym(l,t)]})]}),(0,$.jsx)(rt,{className:`mx-2 my-1 h-px bg-border`})]}),c.isLoading?(0,$.jsxs)(O,{className:Jm,disabled:!0,children:[(0,$.jsx)(ae,{size:`sm`,muted:!0}),`Loading folder…`]}):c.error?(0,$.jsx)(O,{className:Jm,closeOnClick:!1,onClick:()=>c.refetch(),children:`Retry loading folder`}):c.data?.length?c.data.map(e=>e.type===`dir`?(0,$.jsxs)(O,{className:Jm,closeOnClick:!1,onClick:()=>a(e.path),children:[(0,$.jsx)(Ze,{path:e.path,kind:`directory`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.path,children:e.name}),(0,$.jsx)(m,{className:`text-icon-muted`})]},e.path):(0,$.jsxs)(O,{className:Jm,"aria-current":e.path===i?`page`:void 0,onClick:()=>o(e.path),children:[(0,$.jsx)(Ze,{path:e.path}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.path,children:e.name}),e.path===i&&(0,$.jsx)(v,{className:`text-foreground`})]},e.path)):(0,$.jsx)(O,{className:Jm,disabled:!0,children:`This folder is empty.`})]})}function Zm(e){let[t,n]=V.useState(!1),[r,i]=V.useState(e.crumb);return(0,$.jsxs)(tt,{open:t,onOpenChange:t=>{n(t),t&&i(e.crumb)},children:[(0,$.jsx)(ue,{"aria-label":`Browse ${e.label}`,className:`relative mx-0.5 flex h-5 w-4 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/60 outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset data-[popup-open]:bg-accent data-[popup-open]:text-foreground`,children:(0,$.jsx)(m,{className:`size-3.5`})}),t&&(0,$.jsx)(a,{children:(0,$.jsx)(D,{side:`bottom`,align:`start`,sideOffset:4,className:`z-50 outline-none`,children:(0,$.jsx)(Xm,{projectId:e.projectId,projectName:e.projectName,dir:r,root:e.crumb,currentFile:e.currentFile,onDir:i,onOpenFile:t=>{n(!1),e.onOpenFile(t)}})})})]})}function Qm({projectId:e,projectName:t,path:n,onOpenFile:r,onOpenFolder:i}){let a=n.split(`/`),o=[``,...a.map((e,t)=>a.slice(0,t+1).join(`/`))],s=V.useRef(null);return V.useEffect(()=>{s.current?.querySelector(`[data-current-file-crumb="true"]`)?.scrollIntoView({block:`nearest`,inline:`end`})},[n]),(0,$.jsx)(`nav`,{ref:s,"aria-label":`File path`,className:`flex h-full min-w-0 flex-1 items-center overflow-x-auto text-xs [scrollbar-width:none]`,children:(0,$.jsx)(`ol`,{className:`flex w-max items-center`,children:o.map((a,s)=>{let c=s===o.length-1,l=Ym(a,t);return(0,$.jsxs)(`li`,{className:`flex shrink-0 items-center`,"data-current-file-crumb":c,children:[c?(0,$.jsx)($e,{label:a,children:(0,$.jsx)(`span`,{"aria-current":`page`,className:`block max-w-40 truncate rounded-sm px-0.5 font-medium text-foreground`,children:l})}):(0,$.jsx)($e,{label:a||t,children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>i(a),className:d(`block max-w-40 cursor-pointer truncate rounded-sm px-0.5 text-left text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`),children:l})}),!c&&(0,$.jsx)(Zm,{projectId:e,projectName:t,crumb:a,label:l,currentFile:n,onOpenFile:r})]},a||`project`)})})})}var $m=ze(am(),1),eh=100,th=class{type;#e=new $m.default.LRUMap(eh);#t=new Map;constructor(e){this.type=e}activate(e,t,n){let r=this.#t.get(e);if(r!=null&&r.owner!==t)throw Error(`Editor: editStateKey "${e}" is already attached to another editor`);if(r!=null)return n!=null&&(r.session=n),r.session;let i=this.#e.delete(e),a={type:this.type},o=n??i??a;return this.#t.set(e,{owner:t,session:o}),o}release(e,t,n=!1){let r=this.#t.get(e);if(r?.owner!==t||(this.#t.delete(e),n))return;let i=ih(r.session);i!=null&&this.#e.set(e,i)}get(e){let t=this.#t.get(e);return t==null?this.#e.find(e):ih(t.session)??void 0}clear(e,t){if(this.#t.has(e))return!1;let n=this.#e.find(e);return n!=null&&(t==null||t.document===!0?this.#e.delete(e):ah(n,t),!0)}clearAll(){this.#e.clear()}setCapacity(e){if(!Number.isSafeInteger(e)||e<1)throw RangeError(`EditStateManager: capacity must be a positive integer`);for(;this.#e.size>e;)this.#e.shift();this.#e.limit=e}},nh=class{#e=new th(`file`);#t=new th(`file-diff`);activate(e,t,n,r){return e===`file`?this.#e.activate(t,n,r):this.#t.activate(t,n,r)}releaseFile(e,t,n=!1){this.#e.release(e,t,n)}releaseFileDiff(e,t,n=!1){this.#t.release(e,t,n)}get(e,t){return e===`file`?this.#e.get(t):this.#t.get(t)}clear(e,t,n){return e===`file`?this.#e.clear(t,n):this.#t.clear(t,n)}clearAll(){this.#e.clearAll(),this.#t.clearAll()}setCapacity(e){this.#e.setCapacity(e),this.#t.setCapacity(e)}};function rh(e){return{selections:e.selections?.map(e=>({...e,start:{...e.start},end:{...e.end}})),view:e.view==null?void 0:{...e.view}}}function ih(e){if(e.document!=null&&e.fileInfo!=null&&(e.type===`file`||e.diffSession!=null))return e.editor??={},e}function ah(e,t){e!=null&&(t.history===!0&&e.document?.clearHistory(),e.editor!=null&&((t.editor===!0||t.selections===!0)&&(e.editor.selections=void 0),(t.editor===!0||t.view===!0)&&(e.editor.view=void 0)))}var oh=new nh,sh=class{#e;#t;#n;#r;#i;#a;#o=0;#s=0;#c=0;#l=!0;#u;#d=new Map;#f;#p;constructor(e){this.#f=e.hasActivePopover,this.#p=e.updateActivePopover}setViewportElements(e,t){let n=this.#e!==e||this.#t!==t;this.#e=e,n&&(this.#t=t,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0)}cleanUp(){this.#t=void 0,this.#e=void 0,this.#n=void 0,this.#r=void 0,this.#i=void 0,this.#a=void 0,this.#o=0,this.#s=0,this.#c=0,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0,this.#d.clear()}resetPlacement(e=`default`){this.#d.delete(e)}setPlacement(e,t=`default`){this.#d.set(t,e)}choosePlacement(e){let{preferred:t,fallback:n,viewport:r,popoverHeight:i,atDocumentEdge:a,placementKey:o=`default`}=e,s=this.#d.get(o),c;if(r!==void 0&&i>0){let e=(e,t=0)=>e.top>=r.top+t&&e.bottom<=r.bottom-t;c=s===`fallback`&&e(n)&&!e(t,4)||!e(t)&&e(n)?`fallback`:`preferred`}else c=a?`fallback`:`preferred`;return this.#d.set(o,c),c}getPlacementBounds(){let e=this.#g();if(e===void 0)return;let t=this.#_(),n,r;if(t===void 0?(n=0,r=window.innerHeight):(n=t.top,r=t.bottom),n=Math.max(n,e.top),r=Math.min(r,e.bottom),r<=n)return;let i=this.#o,a=this.#s,o=this.#c>0?this.#c:e.width,s=t===void 0?0:t.left,c=t===void 0?window.innerWidth:t.right,l=i,u=i+o,d=Math.max(l,s-e.left+i),f=Math.min(u,c-e.left+i);return{top:n-e.top+a,bottom:r-e.top+a,left:d,right:Math.max(d,f)}}#m(){let e=this.#e;if(e===void 0)return;if(this.#r===e&&(this.#n===void 0||this.#n.isConnected))return this.#n;let t=e.parentElement;for(;t!==null;){let n=getComputedStyle(t).overflowY;if(n===`auto`||n===`scroll`||n===`overlay`)return this.#n=t,this.#r=e,t;t=t.parentElement}this.#n=void 0,this.#r=e}#h(){if(!this.#l)return;this.#v();let e=this.#t;this.#i=e?.getBoundingClientRect(),this.#o=e?.scrollLeft??0,this.#s=e?.scrollTop??0,this.#c=e?.clientWidth??0,this.#a=this.#m()?.getBoundingClientRect(),this.#l=!1}#g(){return this.#h(),this.#i}#_(){return this.#h(),this.#a}#v(){if(this.#u!==void 0)return;let e,t=()=>{this.#l=!0,this.#f()&&e===void 0&&(e=requestAnimationFrame(()=>{e=void 0,this.#p()}))},n=this.#m(),r=this.#t;this.#u=[B(n===void 0?window:n,`scroll`,t,{passive:!0}),...r===void 0?[]:[B(r,`scroll`,t,{passive:!0})],B(window,`resize`,t,{passive:!0}),()=>{e!==void 0&&(cancelAnimationFrame(e),e=void 0)}]}};function ch(e,{gutterWidth:t,placeAbove:n,viewport:r,x:i,y:a}){e.style.setProperty(`--gutter-width`,t+`px`),e.style.setProperty(`--popover-x`,i+`px`),e.style.setProperty(`--popover-y`,a+`px`),e.style.setProperty(`--popover-y-shift`,n?`-100%`:`0px`),r===void 0?(e.style.removeProperty(`--popover-viewport-left`),e.style.removeProperty(`--popover-viewport-right`),e.style.removeProperty(`--popover-viewport-top`),e.style.removeProperty(`--popover-viewport-bottom`)):(e.style.setProperty(`--popover-viewport-left`,r.left+`px`),e.style.setProperty(`--popover-viewport-right`,r.right+`px`),e.style.setProperty(`--popover-viewport-top`,r.top+`px`),e.style.setProperty(`--popover-viewport-bottom`,r.bottom+`px`))}var lh=300,uh=100,dh=`marker-popover`,fh=class{#e;#t=[];#n=0;#r;#i;#a;#o;#s;#c;#l;#u=!1;constructor(e){this.#e=e}get markers(){return this.#t}isPopoverVisible(){return this.#l!==void 0}updatePopoverPosition(){let e=this.#l,t=this.#r;if(e===void 0||t===void 0)return;let n=this.#t[e];n===void 0?this.removePopover():this.#_(t,n.start.line,n.start.character)}setMarkers(e,t){this.#n=t.lineCount,this.#t=e.map(e=>({...e,start:t.normalizePosition(e.start),end:t.normalizePosition(e.end)})),this.removePopover()}listenHover(e){this.#a?.forEach(e=>e()),this.#a=void 0,this.#t.length!==0&&(this.#a=[B(e,`mouseover`,e=>{if(this.#e.isMouseDown())return;let t=e.composedPath()[0];if(t===void 0)return;let n=this.#d(t);n===void 0?(this.#f(),this.#h()):this.#m(n)}),B(e,`mouseleave`,()=>{this.#f(),this.#h()})])}removePopover(){this.#f(),this.#p(),this.#v()}cleanup(){this.#a?.forEach(e=>e()),this.#a=void 0,this.removePopover(),this.#t=[]}#d(e){let t=e.closest(`[data-line]`);if(t==null)return;let n=tr(t);if(n===void 0)return;let r;if(e.tagName===`SPAN`){let t=e.dataset.char;if(t===void 0||(r=parseInt(t,10),Number.isNaN(r)))return}else if(e.tagName===`BR`)r=0;else return;let i={line:n-1,character:r};for(let e=this.#t.length-1;e>=0;e--)if(Lf({start:i,end:i},this.#t[e]))return e}#f(){this.#o!==void 0&&(clearTimeout(this.#o),this.#o=void 0),this.#c=void 0}#p(){this.#s!==void 0&&(clearTimeout(this.#s),this.#s=void 0)}#m(e){e===this.#l||e===this.#c?this.#p():(this.#f(),this.#p(),this.#r===void 0?(this.#c=e,this.#o=setTimeout(()=>{this.#o=void 0,this.#c=void 0,this.#y(e)},lh)):this.#y(e))}#h(){this.#u||(this.#p(),this.#s=setTimeout(()=>{this.#s=void 0,this.#u||this.removePopover()},uh))}#g(e,t,n,r,i=this.#e.popoverManager.getPlacementBounds()){ch(e,{gutterWidth:this.#e.getGutterWidth(),placeAbove:r,viewport:i,x:t,y:n})}#_(e,t,n){let{getCharX:r,getLineY:i,getLineHeight:a,popoverManager:o}=this.#e,[s,c]=r(t,n),l=a(),u=i(t)+c*l,d=e.offsetHeight,f={top:u+l,bottom:u+l+d},p={top:u-d,bottom:u},m=t>=this.#n-3,h=o.getPlacementBounds(),g=o.choosePlacement({preferred:f,fallback:p,viewport:h,popoverHeight:d,atDocumentEdge:m,placementKey:dh})===`fallback`;this.#g(e,s,g?u:u+l,g,h)}#v(){this.#i?.forEach(e=>e()),this.#i=void 0,this.#r?.remove(),this.#r=void 0,this.#l=void 0,this.#u=!1,this.#e.popoverManager.resetPlacement(dh)}#y(e){if(e===this.#l)return;let t=this.#e.getOverlayElement();if(e>=this.#t.length||t==null)return;let{start:n,message:r,severity:i}=this.#t[e],{line:a,character:o}=n,s=this.#r;if(this.#e.popoverManager.resetPlacement(dh),s!==void 0){mh(s,i);let t=s.firstElementChild;t?.dataset.markerMessage!==void 0&&(typeof r==`string`?t.textContent=r:r instanceof HTMLElement?t.replaceChildren(r):t.innerHTML=r.html),this.#_(s,a,o),this.#l=e}else this.#r=z(`div`,{dataset:{editorWidget:``,markerPopover:``,[hh(i)]:``},children:[z(`div`,{dataset:`markerMessage`,...typeof r==`string`?{textContent:r}:r instanceof HTMLElement?{children:[r]}:{innerHTML:r.html}})]},t),this.#_(this.#r,a,o),this.#l=e,this.#i=[B(this.#r,`mouseenter`,()=>{this.#u=!0,this.#p()}),B(this.#r,`mouseleave`,()=>{this.#u=!1,this.#h()})]}},ph=[`error`,`warning`,`info`,`hint`];function mh(e,t){for(let t of ph)delete e.dataset[hh(t)];e.dataset[hh(t)]=``}function hh(e){switch(e){case`error`:return`markerError`;case`warning`:return`markerWarning`;case`info`:return`markerInfo`;case`hint`:return`markerHint`}}function gh(e){return{...e,oldFile:e.oldFile==null?null:{...e.oldFile,lines:[...e.oldFile.lines]},hunks:yn(e.hunks)}}var _h=`@layer base,theme,rendered,unsafe;::selection{background-color:#0000}[data-deleted-text-selection] [data-deletions] ::selection,[data-deleted-text-selection] [data-line-type=change-deletion] ::selection{background-color:var(--diffs-editor-selection-bg)}@keyframes blinking{0%{opacity:1}50%{opacity:0}to{opacity:1}}:host,[data-code],[data-content],[data-diff-type=split][data-overflow=wrap]{position:relative}[data-code]{container-type:inline-size}[data-content]{cursor:text;caret-color:var(--diffs-bg-caret);background-color:#0000;outline:none}[data-line]{cursor:text;background-color:#0000}[data-line]:after{content:"";z-index:-20;background-color:var(--diffs-line-bg);pointer-events:none;position:absolute;inset:0}[data-line][data-editor-active-line]:after{box-shadow:inset 0 0 0 1px var(--diffs-editor-line-highlight-border)}[data-editor-overlay]{display:contents}[data-caret],[data-edit-prediction],[data-selection-range],[data-bracket-match-range],[data-edit-prediction-deletion-range],[data-edit-prediction-insertion-range],[data-edit-prediction-replacement-range],[data-marker-range],[data-remote-caret],[data-caret-highlight-range]{height:1lh;line-height:var(--diffs-line-height);pointer-events:none;position:absolute;top:0;left:0}[data-edit-prediction]{z-index:1;user-select:none;width:max-content;height:auto;color:var(--diffs-editor-edit-prediction-fg,color-mix(in lab, var(--diffs-fg) 45%, transparent));overflow:visible}[data-edit-prediction-line]{box-sizing:border-box;white-space:pre;width:max-content;min-height:1lh;display:block}[data-edit-prediction][data-replacement] [data-edit-prediction-line],[data-edit-prediction-insertion-range],[data-edit-prediction-replacement-range]{background-color:var(--diffs-edit-prediction-bg,var(--diffs-bg))}[data-edit-prediction-suffix]{color:var(--diffs-fg)}[data-edit-prediction][data-wrap] [data-edit-prediction-line]{overflow-wrap:anywhere;white-space:pre-wrap;max-width:100%}[data-edit-prediction-line][data-empty]:after{content:"↵"}[data-edit-prediction-spacer]{margin-block-end:var(--diffs-edit-prediction-spacer-height)}[data-code][data-deletions] [data-edit-prediction-spacer]{box-sizing:content-box;margin-block-end:0;padding-block-end:var(--diffs-edit-prediction-spacer-height)}[data-edit-prediction-deletion-range]{--diffs-edit-prediction-deletion-color:var(--diffs-editor-edit-prediction-deletion-fg,color-mix(in lab, var(--diffs-deletion-base) 70%, transparent));z-index:1;background:linear-gradient(to bottom, transparent calc(50% - .5px), var(--diffs-edit-prediction-deletion-color) calc(50% - .5px), var(--diffs-edit-prediction-deletion-color) calc(50% + .5px), transparent calc(50% + .5px))}[data-edit-prediction-insertion-range]{z-index:0}[data-edit-prediction-replacement-range]{z-index:1}[data-caret]{z-index:2;background-color:var(--diffs-bg-caret-override,var(--diffs-editor-cursor-fg,light-dark(color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg)))));visibility:hidden;width:2px}@media (prefers-reduced-motion:no-preference){[data-caret]{animation:1.2s .8s infinite blinking}}[data-selection-range]{z-index:-10;background-color:var(--diffs-editor-selection-bg)}[data-caret-highlight-range]{z-index:-10;background-color:var(--diffs-caret-highlight-bg,var(--diffs-editor-selection-bg))}[data-selection-corner]{background-color:var(--diffs-selection-corner-bg,var(--diffs-bg));width:100%;height:100%}[data-bracket-match-range]{z-index:-9;box-sizing:border-box;border-bottom:1px solid var(--diffs-editor-bracket-match-border,color-mix(in lab, var(--diffs-fg) 60%, transparent));background-color:var(--diffs-editor-bracket-match-bg,color-mix(in lab, var(--diffs-fg) 5%, transparent))}[data-rtl]{border-top-left-radius:3px}[data-rtr]{border-top-right-radius:3px}[data-rbl]{border-bottom-left-radius:3px}[data-rbr]{border-bottom-right-radius:3px}[data-marker-range]{z-index:1;background-color:var(--diffs-marker-bg);mask-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+);mask-position:0 100%;mask-size:6px 3px;mask-repeat:repeat-x}[data-marker-error]{--diffs-marker-contrast:light-dark(#fff,#000);--diffs-marker-bg:var(--diffs-editor-error-fg,var(--diffs-deletion-base))}[data-marker-warning]{--diffs-marker-contrast:#000;--diffs-marker-bg:var(--diffs-editor-warning-fg,light-dark(var(--diffs-warning-light),var(--diffs-warning-dark)))}[data-marker-info]{--diffs-marker-contrast:#000;--diffs-marker-bg:var(--diffs-editor-info-fg,var(--diffs-modified-base))}[data-marker-hint]{--diffs-marker-contrast:light-dark(#fff,#000);--diffs-marker-bg:var(--diffs-editor-hint-fg,var(--diffs-fg-number))}@media (width>=480px){[data-content]{caret-color:#0000}[data-content][data-composing]{caret-color:auto}[data-content]:not([data-composing]):focus~[data-editor-overlay] [data-caret]{visibility:visible}}[data-editor-widget]{--diffs-widget-fg:var(--diffs-fg);--diffs-widget-bg:color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));--diffs-widget-border:color-mix(in lab, var(--diffs-fg) 20%, transparent);--diffs-widget-shadow:inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013, 0 6px 18px #00000013;z-index:100;width:fit-content;max-width:calc(100% - 24px);font:14px/20px var(--diffs-header-font-fallback);border:1px solid var(--diffs-widget-border);background-color:var(--diffs-widget-bg);box-shadow:var(--diffs-widget-shadow);background-clip:padding-box;border-radius:9px;position:absolute;top:0;left:0}[data-marker-popover],[data-selection-action-popover]{--popover-gap:var(--diffs-popover-gap,var(--diffs-gap-fallback,8px));--popover-viewport-left:0px;--popover-viewport-right:100cqw;--popover-viewport-top:-99999px;--popover-viewport-bottom:99999px;--popover-min-left:calc(var(--popover-viewport-left) + var(--gutter-width,0px) + var(--popover-gap));--popover-available-width:max(0px, calc(var(--popover-viewport-right) - var(--popover-min-left) - var(--popover-gap)));max-width:min(640px, var(--popover-available-width));translate:clamp(var(--popover-min-left), var(--popover-x,var(--popover-min-left)), calc(var(--popover-viewport-right) - var(--popover-gap) - 100%)) clamp(var(--popover-viewport-top), calc(var(--popover-y,0px) + var(--popover-y-shift,0px)), calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%))}[data-marker-popover]{--diffs-widget-bg:var(--diffs-marker-bg);--diffs-widget-shadow:0 4px 8px #00000026, 0 6px 18px #00000026;min-width:min(180px, var(--popover-available-width));overflow-wrap:anywhere;color:var(--diffs-marker-contrast);white-space:normal;pointer-events:auto;border:0;padding:8px 12px;@supports (color:contrast-color(red)){color:contrast-color(var(--diffs-marker-bg,var(--diffs-bg)))}& [data-marker-message]{white-space:normal;overflow-wrap:anywhere;& code{white-space:normal;color:inherit;background-color:#0000;display:inline}}}[data-selection-action-popover]{pointer-events:auto;flex-wrap:wrap;align-items:center;gap:4px;width:max-content;padding:4px;display:flex}
|
|
1154
|
+
`,vh=350,yh=150,bh=512,xh=662,Sh=131072,Ch=6144,wh=1e3,Th=8,Eh=3,Dh=[11,Eh],Oh=new TextEncoder;function kh(e){let t=[0];for(let n=0;n<e.length;n++)e.charCodeAt(n)===13&&e.charCodeAt(n+1)===10&&n++,(e.charCodeAt(n)===10||e.charCodeAt(n)===13)&&t.push(n+1);return t}function Ah(e,t){return e.length===0?0:t.at(-1)===e.length?t.length-1:t.length}function jh(e,t,n){let r=t[n+1];return r===void 0?e.length:r-(e.charCodeAt(r-1)===10&&e.charCodeAt(r-2)===13?2:1)}function Mh(e,t,n,r,i,a){let o=t[n],s=i[a],c=jh(e,t,n)-o;if(c!==jh(r,i,a)-s)return!1;for(let t=0;t<c;t++)if(e.charCodeAt(o+t)!==r.charCodeAt(s+t))return!1;return!0}function Nh(e,t,n,r){let i=Ah(e,t),a=Ah(n,r),o=0;for(;o<i&&o<a&&Mh(e,t,o,n,r,o);)o++;let s=0;for(;s<i-o&&s<a-o&&Mh(e,t,i-1-s,n,r,a-1-s);)s++;return{oldLineCount:i,newLineCount:a,prefixLines:o,suffixLines:s}}function Ph(e,t,n,r=0){if(t===n)return;let i=kh(t),a=kh(n),o=Nh(t,i,n,a);if(o.prefixLines===o.oldLineCount&&o.prefixLines===o.newLineCount)return;let s=o.oldLineCount-o.suffixLines,c=o.newLineCount-o.suffixLines,l=t.slice(i[o.prefixLines]??t.length,i[s]??t.length),u=n.slice(a[o.prefixLines]??n.length,a[c]??n.length);if(Oh.encode(l).byteLength>Ch||Oh.encode(u).byteLength>Ch)return;let d=Math.max(0,o.prefixLines-Eh),f=Math.min(o.oldLineCount,s+Eh),p=Math.min(o.newLineCount,c+Eh),m=f-d,h=p-d,g=d+r,_=[`--- a/${e}`,`+++ b/${e}`,`@@ -${m===0?g:g+1},${m} +${h===0?g:g+1},${h} @@`];for(let e=d;e<o.prefixLines;e++)_.push(` ${t.slice(i[e],jh(t,i,e))}`);for(let e=o.prefixLines;e<s;e++)_.push(`-${t.slice(i[e],jh(t,i,e))}`);for(let e=o.prefixLines;e<c;e++)_.push(`+${n.slice(a[e],jh(n,a,e))}`);for(let e=s;e<f;e++)_.push(` ${t.slice(i[e],jh(t,i,e))}`);let v=_.join(`
|
|
1155
|
+
`);return Oh.encode(v).byteLength<=Ch?{hunk:v,bounds:o}:void 0}function Fh(e,t,n){let r=[],i=0;for(let a of n){let n=a.start-t,o=a.end-t;if(n<i||o<n||o>e.length)return;r.push(e.slice(i,n),a.text),i=o}return r.push(e.slice(i)),r.join(``)}function Ih(e,t){let n=t.inverseEdits;if(n.length===0)return;let r=n[0].start,i=n[0].end;for(let e=1;e<n.length;e++)r=Math.min(r,n[e].start),i=Math.max(i,n[e].end);let[a,o]=e.positionsAt([r,i]);for(let t of Dh){let r=Math.max(0,a.line-t),i=Math.min(e.lineCount-1,o.line+t),s=e.offsetAt({line:r,character:0}),c=i+1<e.lineCount?e.offsetAt({line:i+1,character:0}):e.offsetAt({line:i,character:e.getLineLength(i)});if(c-s>Ch)continue;let l=e.getTextSlice(s,c);if(Oh.encode(l).byteLength>Ch)continue;let u=Fh(l,s,n);if(!(u===void 0||u.length>Ch||Oh.encode(u).byteLength>Ch))return{beforeText:u,afterText:l,startOffset:s,startLine:r,bounds:Nh(u,kh(u),l,kh(l))}}}function Lh(e,t,n,r,i,a=Date.now()){let o=e.slice(-10),s=Ih(n,r);if(s===void 0){let e=o.at(-1);return e?.fragment!==void 0&&(o[o.length-1]={...e,fragment:void 0}),o}if(s.beforeText===s.afterText)return o;let c=s.startLine+s.bounds.prefixLines,l=s.startLine+s.bounds.oldLineCount-s.bounds.suffixLines,u=o.at(-1),d=u!==void 0&&c>u.end?c-u.end:u!==void 0&&u.start>l?u.start-l:0;if(u!==void 0&&u.fragment!==void 0&&u.path===t&&u.source===i&&a-u.at<wh&&d<=Th){let e=u.fragment,n=s.startOffset+s.beforeText.length,c=Math.max(e.currentStart,s.startOffset),l=Math.min(e.currentEnd,n);if(c<=l&&e.currentText.slice(c-e.currentStart,l-e.currentStart)===s.beforeText.slice(c-s.startOffset,l-s.startOffset)){let c=Math.min(e.currentStart,s.startOffset),l=e.currentStart<=s.startOffset?e.currentText+s.beforeText.slice(Math.max(0,e.currentEnd-s.startOffset)):s.beforeText+e.currentText.slice(Math.max(0,n-e.currentStart)),u=l.slice(0,e.currentStart-c),d=l.slice(e.currentEnd-c),f=u+e.baseText+d,p=Fh(l,c,r.appliedEdits),m=e.currentStart<=s.startOffset?e.startLine:s.startLine;if(p!==void 0&&f.length<=Ch&&p.length<=Ch&&Oh.encode(f).byteLength<=Ch&&Oh.encode(p).byteLength<=Ch){if(f===p)return o.pop(),o;let e=Ph(t,f,p,m);if(e!==void 0)return o[o.length-1]={path:t,hunk:e.hunk,start:m+e.bounds.prefixLines,end:m+e.bounds.newLineCount-e.bounds.suffixLines,at:a,source:i,fragment:{baseText:f,currentText:p,currentStart:c,currentEnd:c+p.length,startLine:m}},o}}}let f=o.at(-1);f?.fragment!==void 0&&(o[o.length-1]={...f,fragment:void 0});let p=Ph(t,s.beforeText,s.afterText,s.startLine);return p===void 0?o:(o.push({path:t,hunk:p.hunk,start:c,end:s.startLine+s.bounds.newLineCount-s.bounds.suffixLines,at:a,source:i,fragment:{baseText:s.beforeText,currentText:s.afterText,currentStart:s.startOffset,currentEnd:s.startOffset+s.afterText.length,startLine:s.startLine}}),o.slice(-10))}function Rh(e,t,n,r,i,a){for(;a>0&&(r>0||i<e-1);){let o=!1;if(r>0&&n(r-1)){let e=t(r-1);e<=a&&(r--,a-=e,o=!0)}if(i<e-1&&n(i+1)){let e=t(i+1);e<=a&&(i++,a-=e,o=!0)}if(!o)break}return{first:r,last:i}}function zh(e,t,n,r,i){if(t.lineCount<=0)return;let a=t.lineCount-1,o=t.offsetAt({line:a,character:t.getLineLength(a)}),s=Math.max(0,Math.min(Number.isFinite(n)?Math.trunc(n):0,o)),c=t.charAt(s-1).charCodeAt(0),l=t.charAt(s).charCodeAt(0);s>0&&s<o&&(c===13&&l===10||c>=55296&&c<=56319&&l>=56320&&l<=57343)&&s--;let u=t.positionAt(s).line,d=new Map,f=e=>{if(e<0||e>=t.lineCount)return!1;let n=d.get(e);return n??(n=i(e),d.set(e,n)),n};if(!f(u))return;let p=new Map,m=e=>{let n=p.get(e);if(n!==void 0)return n;let r=t.getLineLength(e);if(Math.floor(r/3)>xh)return p.set(e,663),663;let i=Math.max(1,Math.floor(Oh.encode(t.getLineText(e)).byteLength/3));return p.set(e,i),i},h=u,g=u,_=Math.max(0,Math.floor(vh*3/4)-m(u));for(;_>0&&(f(h-1)||f(g+1));){if(f(g+1)){let e=m(g+1);if(e>_)break;g++,_-=e}if(f(h-1)&&_>0){let e=m(h-1);if(e>_)break;h--,_-=e}}_+=88,{first:h,last:g}=Rh(t.lineCount,m,f,h,g,_);let v=h,y=g;({first:v,last:y}=Rh(t.lineCount,m,()=>!0,v,y,yh));let b=0;for(let e=h;e<=g;e++)b+=m(e);let x=0;for(let e=v;e<=y;e++)x+=m(e);if(b>bh||x>xh)return;let S=t.offsetAt({line:v,character:0}),C=t.offsetAt({line:y,character:t.getLineLength(y)}),w=t.getTextSlice(S,C),T={path:e,version:t.version,eol:t.eol,excerptText:w,excerptStartLine:v,cursorOffsetInExcerpt:s-S,editableRange:{start:t.offsetAt({line:h,character:0})-S,end:t.offsetAt({line:g,character:t.getLineLength(g)})-S},editHistory:r.slice(-10).map(({hunk:e,source:t})=>({diff:e,source:t}))};return Oh.encode(JSON.stringify(T)).byteLength<=Sh?T:void 0}function Bh(e,t){if(typeof t!=`string`)return new RegExp(t.source,t.flags).test(e);t=t.replaceAll(`\\`,`/`);let n=`^`;for(let e=0;e<t.length;e++){let r=t[e];r===`*`?t[e+1]===`*`?(e++,t[e+1]===`/`?(e++,n+=`(?:.*/)?`):n+=`.*`):n+=`[^/]*`:n+=r===`?`?`[^/]`:/[\\^$.*+?()[\]{}|]/.test(r)?`\\${r}`:r}return RegExp(`${n}$`).test(e)}var Vh=`//`,Hh=[`/*`,`*/`],Uh={sql:{lineComment:`--`},ruby:{lineComment:`#`,blockComment:[`=begin`,`=end`]},rst:{lineComment:`..`},coffeescript:{lineComment:`#`,blockComment:[`###`,`###`]},cmd:{lineComment:`@REM`},julia:{lineComment:`#`,blockComment:[`#=`,`=#`]},yaml:{lineComment:`#`},yml:{lineComment:`#`},markdown:{lineComment:null,blockComment:[`<!--`,`-->`]},zsh:{lineComment:`#`},makefile:{lineComment:`#`},handlebars:{lineComment:null,blockComment:[`{{!--`,`--}}`]},ini:{lineComment:`;`,blockComment:[`;`,` `]},powershell:{lineComment:`#`,blockComment:[`<#`,`#>`]},vb:{lineComment:`'`},xml:{lineComment:null,blockComment:[`<!--`,`-->`]},lua:{lineComment:`--`,blockComment:[`--[[`,`]]`]},html:{lineComment:null,blockComment:[`<!--`,`-->`]},diff:{lineComment:`#`,blockComment:[`#`,` `]},r:{lineComment:`#`},fsharp:{blockComment:[`(*`,`*)`]},pug:{lineComment:`//-`},perl:{lineComment:`#`},tex:{lineComment:`%`},clojure:{lineComment:`;;`},css:{lineComment:null},python:{lineComment:`#`,blockComment:[`"""`,`"""`]},dotenv:{lineComment:`#`},dockerfile:{lineComment:`#`},razor:{lineComment:null,blockComment:[`<!--`,`-->`]},prompt:{lineComment:null,blockComment:[`<!--`,`-->`]}};function Wh(e,t){let n={...Uh[e],...t?.[e]};return{lineComment:n.lineComment===void 0?Vh:n.lineComment,blockComment:n.blockComment??Hh}}function Gh(e,t,n){let r=[],i=new Set;for(let a of t){let t=a.end.line;a.start.line<t&&a.end.character===0&&t--;let o=r.length,s=1/0;for(let o=a.start.line;o<=t;o++){if(i.has(o))continue;i.add(o);let t=e.getLineText(o),a=t.length-t.trimStart().length,c=a===t.length;c||(s=Math.min(s,a)),r.push({line:o,comment:t.slice(a,a+n.length)===n?a:-1,empty:c,indent:a,single:!1})}if(s!==1/0)for(let e=o;e<r.length;e++)r[e].empty||(r[e].indent=s);r.length===o+1&&(r[o].single=!0)}let a=r.some(e=>e.comment<0&&(!e.empty||e.single)),o=[];if(a){for(let e of r){if(e.empty&&!e.single)continue;let t={line:e.line,character:e.indent};o.push({range:{start:t,end:t},newText:n+` `})}return o}for(let t of r){if(t.comment<0)continue;let r=e.getLineText(t.line),i=t.comment,a=i+n.length+ +(r[i+n.length]===` `);o.push({range:{start:{line:t.line,character:i},end:{line:t.line,character:a}},newText:``})}return o}var Kh=50;function qh(e,t,n,r,i){let a=Math.max(0,r-Kh),o=e.getTextSlice(a,r),s=e.getTextSlice(i,i+Kh),c=o.length-o.trimEnd().length,l=s.length-s.trimStart().length,u=o.length-c;if(o.slice(u-t.length,u)===t&&s.slice(l,l+n.length)===n)return{open:{start:r-c-t.length,end:r-c+ +(c>0),text:``},close:{start:i+l-+(l>0),end:i+l+n.length,text:``},contentStart:r,contentEnd:i};let d=i-r<=100?e.getTextSlice(r,i):void 0,f=d??e.getTextSlice(r,r+Kh),p=d??e.getTextSlice(i-Kh,i),m=f.length-f.trimStart().length,h=i-(p.length-p.trimEnd().length)-n.length;if(f.slice(m,m+t.length)!==t||e.getTextSlice(h,h+n.length)!==n)return;let g=r+m,_=g+t.length+ +!!/\s/.test(f[t.length+m]??``),v=h-+!!/\s/.test(e.getTextSlice(h-1,h));return{open:{start:g,end:_,text:``},close:{start:v,end:h+n.length,text:``},contentStart:_,contentEnd:v}}function Jh(e,t,n,r){let i=0,a=t.length;for(;i<a;){let n=i+a>>>1;t[n].end<e?i=n+1:a=n}let o=n[i];for(let n=i;n<t.length;n++){let i=t[n];if(e<i.start)break;if(i.start===i.end&&e===i.start){if(r<0)break;o+=i.text.length}else if(e>i.end)o+=i.text.length-(i.end-i.start);else return e===i.end?i.start+o+i.text.length:i.start+o+(r>0?i.text.length:0)}return e+o}function Yh(e,t,[n,r],i=!1){let a=t.map(t=>{let{start:n,end:r}=t;if(i){let t=r.line;n.line<t&&r.character===0&&t--;let i=e.getLineText(n.line),a=i.length-i.trimStart().length;n={line:n.line,character:a},r={line:t,character:e.getLineLength(t)}}return{from:e.offsetAt(n),to:e.offsetAt(r),direction:t.direction,comment:void 0}});if(i&&a.length>1){a.sort((e,t)=>{let n=e.from-t.from;return n===0?e.to-t.to:n});let e=0;for(let t=1;t<a.length;t++){let n=a[e],r=a[t];r.from<=n.to?n.to=Math.max(n.to,r.to):a[++e]=r}a.length=e+1}for(let t of a)t.comment=qh(e,n,r,t.from,t.to);let o=a.every(e=>e.comment!==void 0),s=[];for(let e of a){let t=e.comment;o&&t!==void 0?s.push(t.open,t.close):t===void 0&&(e.from===e.to?s.push({start:e.from,end:e.to,text:n+` `+r}):s.push({start:e.from,end:e.from,text:n+` `},{start:e.to,end:e.to,text:` `+r}))}if(s.length===0)return;s.sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});let c=s.map(t=>({range:{start:e.positionAt(t.start),end:e.positionAt(t.end)},newText:t.text}));if(i)return{edits:c,nextSelectionOffsets:[]};let l=a.map(e=>{let t=e.comment;return o&&t!==void 0?{start:t.contentStart,end:t.contentEnd,startAssociation:1,endAssociation:-1}:t===void 0?e.from===e.to?{start:e.from,end:e.to,startAssociation:-1,endAssociation:-1,collapsedInset:n.length+1}:{start:e.from,end:e.to,startAssociation:1,endAssociation:-1}:{start:e.from,end:e.to,startAssociation:1,endAssociation:1}}),u=Array(s.length+1);u[0]=0;for(let e=0;e<s.length;e++){let t=s[e];u[e+1]=u[e]+t.text.length-(t.end-t.start)}return{edits:c,nextSelectionOffsets:l.map((e,t)=>{let n=Jh(e.start,s,u,e.startAssociation)+(e.collapsedInset??0);return[n,e.collapsedInset===void 0?Jh(e.end,s,u,e.endAssociation):n,a[t].direction]})}}var Xh=new Map([[`(`,`)`],[`[`,`]`],[`{`,`}`]]),Zh=new Map([...Xh].map(([e,t])=>[t,e])),Qh=1e3,$h=5e4;function eg(e,t,n){let r=tg(e,t,e.normalizePosition(n));if(r===void 0)return;let i=Xh.get(r.char),a=Zh.get(r.char);if(i!==void 0)return ug(r,ig(e,t,r,i));if(a!==void 0)return ug(ag(e,t,r,a),r)}function tg(e,t,n){let r=ng(n);if(r!==void 0){let n=rg(e,t,r);if(n!==void 0)return n}return rg(e,t,n)}function ng(e){if(e.character>0)return{line:e.line,character:e.character-1}}function rg(e,t,n){let r=e.getLineText(n.line)[n.character];if(!(r===void 0||!Xh.has(r)&&!Zh.has(r)||og(t,n)))return{...n,char:r}}function ig(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s<e.lineCount;s++){if(a>=Qh)return;a++;let c=e.getLineText(s),l=t.getStringCommentRegexpRangesInLine(s),u={index:0},d=s===n.line?n.character:0;for(let e=d;e<c.length;e++){if(o>=$h)return;if(o++,cg(l,e,u))continue;let t=c[e];if(t===n.char)i++;else if(t===r&&(i--,i===0))return{line:s,character:e,char:t}}}}function ag(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s>=0;s--){if(a>=Qh)return;a++;let c=e.getLineText(s),l=t.getStringCommentRegexpRangesInLine(s),u={index:l===null?-1:l.length-1},d=s===n.line?n.character:c.length-1;for(let e=d;e>=0;e--){if(o>=$h)return;if(o++,lg(l,e,u))continue;let t=c[e];if(t===n.char)i++;else if(t===r&&(i--,i===0))return{line:s,character:e,char:t}}}}function og(e,t){return sg(e.getStringCommentRegexpRangesInLine(t.line),t.character)}function sg(e,t){if(e===null)return!1;for(let[n,r]of e){if(t<n)return!1;if(t<r)return!0}return!1}function cg(e,t,n){if(e===null)return!1;for(;n.index<e.length&&t>=e[n.index][1];)n.index++;let r=e[n.index];return r!==void 0&&t>=r[0]}function lg(e,t,n){if(e===null)return!1;for(;n.index>=0&&t<e[n.index][0];)n.index--;let r=e[n.index];return r!==void 0&&t<r[1]}function ug(e,t){if(e!==void 0&&t!==void 0)return[dg(e),dg(t)]}function dg(e){return{start:{line:e.line,character:e.character},end:{line:e.line,character:e.character+1}}}var fg=class{#e;#t;#n;constructor(e,t,n){this.#e=z(`div`,{dataset:{editorWidget:``,selectionActionPopover:``},contentEditable:`false`,children:[e]},t),this.#t=this.#e.offsetHeight,this.#n=new ResizeObserver(()=>{let e=this.#e.offsetHeight;e!==this.#t&&(this.#t=e,n())}),this.#n.observe(this.#e)}reposition(e,t,n,r,i,a){this.#e.style.visibility=i?``:`hidden`,ch(this.#e,{gutterWidth:n,placeAbove:r,viewport:a,x:e,y:t})}get height(){return this.#t}cleanup(){this.#n.disconnect(),this.#e.remove()}},pg=4096,mg=/\p{Mark}/u,hg=class{#e;#t;#n;#r;#i=new Map;ch=-1;tabSize=2;lineHeight=20;paddingTop=0;init(e){if(this.#e===e&&this.#n!==void 0&&this.ch!==-1)return;if(this.#e=e,this.#t??=z(`canvas`,{style:{display:`none`}}),this.#n??=this.#t.getContext(`2d`)??void 0,this.#n===void 0)throw Error(`Could not get canvas context`);let t=e.parentElement;if(t!==null){let{paddingTop:e}=getComputedStyle(t);e.endsWith(`px`)&&(this.paddingTop=parseFloat(e.slice(0,-2)))}let{fontSize:n,fontFamily:r,tabSize:i,lineHeight:a}=getComputedStyle(e);a.endsWith(`px`)?this.lineHeight=parseFloat(a.slice(0,-2)):n.endsWith(`px`)&&(this.lineHeight=nr(parseFloat(n.slice(0,-2))*parseFloat(a)));let o=n+` `+r;(this.#r!==o||this.ch===-1)&&(this.#r=o,this.#a(o),this.ch=this.canvasMeasureTextWidth(`0`),this.clearTextWidthCache());let s=parseInt(i,10);Number.isNaN(s)||(this.tabSize=s)}remeasureCharacterWidth(){if(this.#n===void 0||this.#r===void 0)return!1;this.#a(this.#r);let e=this.canvasMeasureTextWidth(`0`),t=e!==this.ch;t&&(this.ch=e);let n=this.#s();return t||n}#a(e){let t=this.#e,n=this.#t,r=this.#n;if(t==null||n==null||r==null)throw Error(`Metrics not initialized`);t.append(n);try{r.font=e}finally{n.remove()}}measureTextWidth(e){if(!e.includes(` `))return this.#o(e);if(this.#n===void 0)throw Error(`Metrics not initialized`);let t=yg(e,this.tabSize);if(t!==-1)return t*this.ch;let n=0,r=0,i=this.tabSize*this.ch;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===9){if(t>r&&(n+=this.#o(e.slice(r,t))),i>0){let e=n%i;n+=e===0?i:i-e}r=t+1}return r<e.length&&(n+=this.#o(e.slice(r))),nr(n)}segmentTextWidth(e,t,n){if(n<=t)return 0;let r=e.slice(t,n),i=yg(r,this.tabSize);return i===-1?this.measureTextWidth(r):i*this.ch}#o(e){return gg(e)?this.domMeasureTextWidth(e):this.canvasMeasureTextWidth(e)}canvasMeasureTextWidth(e){if(this.#n===void 0)throw Error(`Metrics not initialized`);return nr(this.#n.measureText(e).width)}domMeasureTextWidth(e){if(this.#e===void 0)throw Error(`Metrics not initialized`);let t=e+`|`+this.#r,n=this.#i.get(t);if(n!==void 0)return n;let r=z(`span`,{style:{position:`absolute`,top:`0`,left:`0`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre`,font:`inherit`},textContent:e},this.#e),i;try{i=nr(r.getBoundingClientRect().width)}finally{r.remove()}if(this.#i.size>=pg){let e=this.#i.keys().next().value;e!==void 0&&this.#i.delete(e)}return this.#i.set(t,i),i}clearTextWidthCache(){this.#s()}#s(){let e=this.#i.size>0;return this.#i.clear(),e}};function gg(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=57343||n===8205||n===65038||n===65039||n>127&&mg.test(e.charAt(t)))return!0}return!1}function _g(e,t){let n=Math.max(0,Math.min(t,e.length));if(n===0||n===e.length||!gg(e))return n;let r=or();if(r!==void 0){for(let t of r.segment(e)){let e=t.index,r=e+t.segment.length;if(n>e&&n<r)return r;if(n<=e)break}return n}let i=0;for(let t of e){let e=i+t.length;if(n>i&&n<e)return e;if(n<=i)break;i=e}return n}function vg(e){if(!gg(e))return;let t=[0],n=or();if(n!==void 0){for(let r of n.segment(e))t.push(r.index+r.segment.length);return t}let r=0;for(let n of e)r+=n.length,t.push(r);return t}function yg(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i>127)return-1;n+=i===9?t-n%t:1}return n}var bg=class{#e;#t;#n;#r;#i=`dark`;#a=``;#o;#s=``;#c;#l;#u=!1;get themeType(){return this.#i}get highlighter(){return this.#e}constructor({codeOptions:e,highlighter:t,textDocument:n,matchBrackets:r,setStyle:i,onDeferTokenize:a,onThemeChange:o,__debug:s}){let{themeType:c=`system`,theme:l=C,tokenizeMaxLineLength:u=1e3}=e;this.#r=window.matchMedia(`(prefers-color-scheme: dark)`);let d;if(d=c===`system`?this.#f():c,typeof l!=`string`&&c===`system`){let e=new MutationObserver(e=>{for(let{type:t,attributeName:n}of e)if(t===`attributes`&&n!==null&&(n===`class`||n.startsWith(`data-`))){let e=this.#f();this.#d(l[e],e);break}});e.observe(document.documentElement,{attributes:!0}),e.observe(document.body,{attributes:!0}),this.#l=[B(this.#r,`change`,()=>{let e=this.#f();this.#d(l[e],e)}),()=>e.disconnect()]}this.#u=this.#l!=null,this.#e=t,this.#o=i,this.#c=o,this.#p(typeof l==`string`?l:l[d],typeof l==`string`?void 0:d),this.#t=n,this.#n=t.createEditorTokenizer({textDocument:n,theme:this.#a,tokenizeMaxLineLength:u,matchBrackets:r,__debug:s,onDeferTokenize:e=>a(e,this.#i)})}#d(e,t){(e!==this.#a||t!==this.#i)&&(this.#p(e,t),this.#n.setTheme(e),this.#c?.())}#f(){try{if(typeof document<`u`&&typeof getComputedStyle==`function`&&document.body!=null){let e=getComputedStyle(document.body).colorScheme.split(/\s+/),t=e.includes(`dark`);if(t!==e.includes(`light`))return t?`dark`:`light`}}catch{}return this.#r.matches?`dark`:`light`}syncTheme(e){let{themeType:t=`system`,theme:n=C}=e;if(typeof n==`string`){this.#u=!1;let e=this.#e.getTheme(n).type;if(n===this.#a&&e===this.#i)return;this.#d(n,e);return}let r=t===`system`?this.#u?this.#i:this.#f():t;this.#u=t===`system`&&this.#l!=null;let i=n[r];(r!==this.#i||i!==this.#a)&&this.#d(i,r)}#p(e,t){let n=this.#e.getTheme(e),{colors:r={}}=n,i=r[`editor.selectionBackground`],a=r[`editor.lineHighlightBackground`],o=a!=null&&a.trim()!==``&&!Ar.isFullyTransparent(a)?a:void 0,s=r[`editor.lineHighlightBorder`]??(o==null?`color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-fg))`:`transparent`),c=o==null?`100%`:`85%`,l=r[`editorCursor.foreground`],u=r[`editorBracketMatch.background`],d=r[`editorBracketMatch.border`],f=r[`editorHint.foreground`],p=r[`editorInfo.foreground`],m=r[`editorWarning.foreground`],h=r[`editorError.foreground`];this.#s=`:host {
|
|
1156
|
+
--diffs-editor-selection-bg: ${i??`var(--diffs-line-bg)`};
|
|
1157
|
+
--diffs-editor-line-highlight-border: ${s};
|
|
1158
|
+
--diffs-editor-active-line-source-mix: ${c};
|
|
1159
|
+
--diffs-editor-bracket-match-bg: ${u??`initial`};
|
|
1160
|
+
--diffs-editor-bracket-match-border: ${d??`initial`};
|
|
1161
|
+
--diffs-editor-cursor-fg: ${l??`initial`};
|
|
1162
|
+
--diffs-editor-hint-fg: ${f??`initial`};
|
|
1163
|
+
--diffs-editor-info-fg: ${p??`initial`};
|
|
1164
|
+
--diffs-editor-warning-fg: ${m??`initial`};
|
|
1165
|
+
--diffs-editor-error-fg: ${h??`initial`};
|
|
1166
|
+
}`,this.#o(this.#s),this.#a=e,this.#i=t??n.type}applyStyle(){this.#o(this.#s)}cleanUp(){this.#n.dispose(),this.#l?.forEach(e=>e()),this.#l=void 0}tokenize(e,t){return this.#m=void 0,this.#n.tokenize(e,t)}getStringCommentRegexpRangesInLine(e){return this.#n.getStringCommentRegexpRangesInLine(e)}#m;prebuildStateStack(e,t=!1){this.#m={version:this.#t.version,renderRange:e},this.#n.prebuildStateStack(e,t)}flush(e){let t=this.#t.version,n=this.#m;return n!=null&&n.version===t&&Mn(n.renderRange,e)?new Map:(this.#m={version:t,renderRange:e},this.#n.flush(e))}pauseBackgroundTokenize(){this.#n.pauseBackgroundTokenize()}resumeBackgroundTokenize(){this.#n.resumeBackgroundTokenize()}};function xg(e,t){let n=qn(e),r=qn(t),i=Vn(n),a=i[i.length-1]??0;return{start:0,end:n.length,text:r,range:{start:{line:0,character:0},end:{line:i.length-1,character:n.length-a}}}}function Sg(e){return e!=null&&`renderType`in e&&e.renderType===`virtualized`}var Cg=1e4,wg=300,Tg=256,Eg=131072,Dg=new TextEncoder,Og=`selection-action`,kg=`application/vnd.pierre.diffs-selections+json`,Ag=class{type;#e;#t;#n;#r=new hg;#i;#a;#o;#s;#c;#l;#u=!1;#d={generation:0,callback:void 0,delivered:!1};#f;#p;#m;#h=new Map;#g=new Map;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;#D;#O;#k;#A;#j;#M;#N;#P;#F=!1;#I=!1;#L;#R;#z;#B;#V=0;#H;#U;#W;#G;#K;#q=!0;#J=!1;#Y=!1;#X=!1;#Z;#Q=!1;#$=!1;#ee=!1;#te;#ne=!1;#re;#ie=``;#ae;#oe;#se;#ce;#le;#ue;#de=!1;#fe;#pe;#me=!1;#he=!1;#ge=!1;#_e=!1;#ve;#ye;#be;#xe=0;#Se=!1;#Ce=!1;#we;#Te=[];#Ee=new Map;#De=new Map;#Oe=e=>{if(this.#M?.applyTokens(e),this.#F&&this.#H!==void 0&&this.#H.totalLines!==1/0&&this.#we!==void 0&&this.#se!==void 0){let t=new Set(this.#we.response.edits.map(e=>e.range.start.line)),{startingLine:n,totalLines:r}=this.#H,i=Math.min(n+r,(this.#n??this.#t)?.document?.lineCount??0);for(let r of e.keys())if(r>=n&&r<i&&t.has(r)){this.#sn(this.#se);break}}};constructor(e,t={},n){this.type=e,this.#e=t,this.#z=t.ownsVerticalViewport===!0,this.#t=t.initialState,this.#R=n}get#ke(){return this.type,this}setOptions(e){let t=this.#e.renderCaret,n=this.#e.editPrediction;this.#e={...this.#e,...e},t!==this.#e.renderCaret&&(this.#O?.forEach(e=>e.remove()),this.#O=void 0,this.#cn()),n!==this.#e.editPrediction&&(this.#tn(!0),this.#Te=[],this.#rn())}__emitEditComplete(e){this.#e.onComplete?.(e)}__getGhostTextRows(){return this.#De}setCarets(e){let t=this.#n?.document;t!==void 0&&(this.#O?.forEach(e=>e.remove()),this.#O=void 0,this.#k?.forEach(e=>e.remove()),this.#k=void 0,this.#W=e.length===0?void 0:e.map(e=>{let n=t.normalizePosition(e.anchor),r=t.normalizePosition(e.focus);return{caret:{...e,anchor:n,focus:r},anchorOffset:t.offsetAt(n),focusOffset:t.offsetAt(r)}}),this.#cn())}edit(e){this.__assertOutsideChangeCallback(`Editor.edit`);let t=this.#ke,n=this.#n;if(this.#F)throw Error(`Editor.edit: the editor is already rendering its component`);if(this.#M!=null&&this.#M!==e)throw Error(`Editor.edit: a recycled edit session cannot attach to a different component`);if(this.#n==null&&!e.isReadyToEdit())throw Error(`Editor.edit: the component is not ready to edit; await prepareForEditing() first`);let r=this.#t,i=r?.editor,a=this.#R,o=jg({type:this.type,editStateKey:a,owner:this,initialState:r,previousSession:n}),s=o.diffSession;this.#t=void 0,this.#n=o,this.#M=e,this.#je(),this.#F=!0,this.#I=o.editor!=null;try{if(this.#Qe(),e.type===`file`&&t.type===`file`)t.#N=e.applyChange.bind(e),t.#P=(n,r,i)=>{let a={changes:n,file:r,editor:t,lineAnnotations:i};e.__acceptEditorChange(a),t.#e.onChange?.(a),e.emitEditChange(a)},this.#l==null?this.#l=e.__attachEditor(t):e.__resumeEditor(t);else if(e.type===`file-diff`&&t.type===`file-diff`)t.#N=e.applyChange.bind(e),t.#P=(n,r,i)=>{let a={changes:n,file:r,editor:t,lineAnnotations:i};e.__acceptEditorChange(a),t.#e.onChange?.(a),e.emitEditChange(a)},this.#l==null?this.#l=e.__attachEditor(t):e.__resumeEditor(t);else throw Error(`Editor.edit: Impossible edit state`)}catch(e){throw this.cleanUp(`recycle`),o.type===`file-diff`&&o.diffSession==null&&(o.diffSession=s),this.#l==null&&a!=null&&(t.type===`file`?oh.releaseFile(a,t):oh.releaseFileDiff(a,t)),this.#n=n,this.#l??(this.#M=void 0,this.#je(),this.#N=void 0,this.#P=void 0),r!=null&&i!=null&&(r.editor=i),this.#t=r,e}return()=>{this.cleanUp(`complete`)}}applyEdits(e,t=!0){this.__assertOutsideChangeCallback(`Editor.applyEdits`);let n=this.#n?.document;if(n==null)throw Error(`Editor.applyEdits: Editor is not attached`);let r=this.#X,i=this.#se,a=i?.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]),o=i===void 0?void 0:n.resolveEdits(e).sort((e,t)=>e.start-t.start),s=n.applyEdits(e,t,i);if(s===void 0)return;let c;i!==void 0&&a!==void 0&&o!==void 0&&(c=Bf(n,i,a,o),t&&n.setLastUndoSelectionsAfter(c)),this.#Mn(s,c,this.#Pn(s),{skipFocus:!r})}replaceSearchMatches(e,t){let n=this.#n?.document;if(n==null)throw Error(`Editor.replaceSearchMatches: Editor is not attached`);if(e.length===0)return;let r=e.map(([e,r])=>({range:{start:n.positionAt(e),end:n.positionAt(r)},newText:wn(n,t,e,r)})),i=this.#se,a=i?.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]),o=n.resolveEdits(r).sort((e,t)=>e.start-t.start),s=o.at(-1).end;for(let{start:e,end:t,text:n}of o)s+=n.length-(t-e);let c=n.applyEdits(r,!0,i);if(c!=null){let e=i!=null&&a!=null?Bf(n,i,a,o):void 0;e!=null&&n.setLastUndoSelectionsAfter(e),this.#Mn(c,e,this.#Pn(c),{skipSearchRefresh:!0,skipFocus:!0})}return[s,s]}get canUndo(){return(this.#n??this.#t)?.document?.canUndo??!1}get canRedo(){return(this.#n??this.#t)?.document?.canRedo??!1}undo(){this.__assertOutsideChangeCallback(`Editor.undo`),this.#ct(`undo`)}redo(){this.__assertOutsideChangeCallback(`Editor.redo`),this.#ct(`redo`)}getFile(){let e=this.#n??this.#t,t=e?.fileInfo,n=e?.document;if(t===void 0||n===void 0)return;let r={...t};return Object.defineProperty(r,"contents",{enumerable:!0,get:()=>n.getText()}),r}getText(){return(this.#n??this.#t)?.document?.getText()??``}getViewState(){if(!this.#F&&this.#n?.editor!=null)return rh(this.#n.editor);let e=this.#se?.map(e=>({...e,start:{...e.start},end:{...e.end}})),t=this.#Ae();return t==null?{selections:e}:{selections:e,view:t}}#Ae(){let e=this.#F?this.#M:void 0;if(e==null)return;this.#je();let t=e.getCodeScrollLeft();return this.#B==null?{scrollLeft:t}:{scrollLeft:t,scrollTop:this.#V}}#je(){let e=this.#Ze();e!==this.#B&&(this.#B?.removeEventListener(`scroll`,this.#Me),this.#B=e,this.#V=e?.scrollTop??0,e?.addEventListener(`scroll`,this.#Me,{passive:!0}))}#Me=()=>{this.#V=this.#B?.scrollTop??0};getEditState(){let e=this.#n;if(e!=null){if(this.#M==null)throw Error(`Editor.getEditState: active ${this.type} session has no component`);return ih(e)}}setViewState({selections:e,view:t}){if(!this.#F||this.#M===void 0||this.#n?.document===void 0)throw Error(`Editor.setViewState: Editor is not attached`);if(this.#q=!1,this.#sn(e??[]),t!=null){this.#M.setCodeScrollLeft(t.scrollLeft);let e=this.#Ze();t.scrollTop!==void 0&&e!=null&&(this.#Le?.cancelScroll(),e.scrollTop=t.scrollTop,this.#V=e.scrollTop)}else this.#z&&this.#Dt();this.#Ne()}setSelections(e){let t=this.#n;if(t?.document==null)throw Error(`Editor.setSelections: Text document is not initialized`);let{document:n}=t,r=e.map(e=>{let t=n.normalizePosition(e.start),r=n.normalizePosition(e.end),i=e.direction===`none`?0:e.direction===`backward`?-1:1;return Q(t,r)>0&&([t,r]=[r,t],i!==0&&(i=i===1?-1:1)),{direction:i,start:t,end:r}});this.#q=!1,this.#sn(r),this.#F||(t.editor=rh({...t.editor,selections:this.#se}));let i=r.at(-1);i!==void 0&&this.#Be(Z(i).line),this.#Dt()}setMarkers(e){let t=this.#n?.document;if(t===void 0)throw Error(`Editor.setMarkers: Text document is not initialized`);e.length===0?(this.#U?.cleanup(),this.#U=void 0,this.#sn(this.#se??[])):(this.#U??=new fh({popoverManager:this.#We(),getLineHeight:()=>this.#r.lineHeight,getOverlayElement:()=>this.#E,getGutterWidth:()=>this.#Rn(),getCharX:(e,t)=>this.#Vn(e,t),getLineY:e=>this.#Bn(e),isMouseDown:()=>this.#ee||this.#$}),this.#U.setMarkers(e,t),this.#w!==void 0&&this.#U.listenHover(this.#w),this.#sn(this.#se??[]),this.#cn())}focus(e){let t=e?.preventScroll??!1,n=e?.lineNumber;if(n===`first-visible`||typeof n==`number`){let r=this.#n?.document;if(r==null||!this.#F||this.#M==null)return;let i=n===`first-visible`?this.#Ct(e?.offset):n;if(i==null)return;let a=r.normalizePosition({line:i-1,character:n===`first-visible`?0:e?.character??0});this.#wt(a,t)}else this.#vt(this.#se?.at(-1),t)}blur(){this.#X=!1,this.#bt(),this.#w?.blur()}cleanUp(e=`discard`){this.__assertOutsideChangeCallback(`Editor.cleanUp`);let t=this.#M,n=e===`recycle`;this.#Le?.cancelScroll(this.#kt),this.#tn(!0,!1),n||(this.#Te=[]);let r=this.#n;if(t!=null&&r!=null){let e=!this.#Ne();n||this.#Pe(e)}if(this.#Je(),n||(this.#d.delivered=!1),this.#F=!1,Kt(this.#at),n||(this.#i?.cleanUp(),this.#i=void 0),this.#s?.forEach(e=>e()),this.#s=void 0,this.#o?.forEach(e=>e()),this.#o=void 0,n||(this.#l?.(),this.#l=void 0),this.#p=void 0,this.#m=void 0,this.#h.clear(),this.#g.clear(),this.#_=void 0,this.#v?.remove(),this.#v=void 0,this.#y?.remove(),this.#y=void 0,this.#b?.remove(),this.#b=void 0,this.#x?.remove(),this.#x=void 0,this.#S=void 0,this.#a?.cleanUp(),this.#a=void 0,this.#C=void 0,this.#T=void 0,this.#w?.removeAttribute(`contentEditable`),this.#Ke(!1),this.#w=void 0,this.#bt(),this.#X=!1,this.#E?.remove(),this.#E=void 0,this.#j?.disconnect(),this.#j=void 0,this.#_e=!1,this.#ve!==void 0&&(cancelAnimationFrame(this.#ve),this.#ve=void 0),this.#qe(n),!n)try{if(t!=null&&r!=null){let n=this.#ke,r=e===`complete`?`install`:`discard`;if(t.type===`file`&&n.type===`file`)t.__completeEditSession(n,r);else if(t.type===`file-diff`&&n.type===`file-diff`)t.__completeEditSession(n,r);else throw Error(`Editor.cleanUp: Impossible edit state`)}}finally{this.#n=void 0,this.#M=void 0,this.#je(),this.#N=void 0,this.#P=void 0}}#Ne(){let e=this.#M,t=this.#n;if(e==null||t==null)return!1;let n=this.#F?this.getViewState():t.editor??{},{view:r}=n,i=r!=null&&(r.scrollLeft!==0||(r.scrollTop??0)!==0),a=n.selections!=null||i;if(t.editor=rh(n),t.type===`file`)return!1;let o=e.__captureDocumentSessionState();if(o==null)return t.diffSession=void 0,!1;t.diffSession=o.diffSession;let s=t.document;return o.hasChanges||a||s?.canUndo===!0||s?.canRedo===!0}#Pe(e=!1){let t=this.#R;if(t==null)return;let n=this.#ke;n.type===`file`?oh.releaseFile(t,n):oh.releaseFileDiff(t,n,e)}__postponeBgTokenizeToNextFrame(){let e=this.#i;e!==void 0&&(e.pauseBackgroundTokenize(),Yt(()=>{this.#i===e&&e.resumeBackgroundTokenize()}))}__prepareRender(e){let t=this.#i;if(t===void 0)return;let n=t.flush(e);return n.size>0?n:void 0}__captureFocusForDOMReplacement(){let e=this.#w,t=this.#S?.shadowRoot?.activeElement;if(e!=null&&(this.#X||t===e||t!=null&&e.contains(t))){let{frame:e,restore:t}=this.#Z??{},n=e!=null||t?.claimed===!0;this.#bt(),this.#Z={restore:{claimed:n}}}}__getDocumentContents(e){let t=this.#n?.fileInfo,n=this.#n?.document;if(n==null)return t==null||e==null?void 0:{...t,contents:e.contents};let r=t??e;if(r!=null)return{name:r.name,lang:r.lang,contents:n.getText()}}__getDocumentSessionState(){let e=this.#n?.diffSession;return e==null?void 0:gh(e)}__replaceDocument(e,t,n){this.__assertOutsideChangeCallback(`FileDiff.render`);let r=this.#n;if(r==null)throw Error(`Editor.__replaceDocument: no edit session`);let i=e.lang??Nn(e.name),a=r.document,o=a?.getText();a==null||t||r.fileInfo?.name!==e.name||a.languageId!==i?(this.#tn(!0),this.#Te=[],this.#Je(),r.editor=void 0,r.document=new _n(e.name,e.contents,i,0,new Xn({maxEntries:this.#e.historyMaxEntries})),r.diffSession=void 0,this.#i?.cleanUp(),this.#i=void 0,this.#qe(),this.#g.clear(),this.#se=this.#oe):this.#Fe(r,e.contents,n),r.fileInfo={name:e.name,lang:e.lang},n!=null&&(this.#L=n),this.#Ne();let s=r.document?.getText();o!=null&&s!=null&&s!==o&&this.#Nn([xg(o,s)],n)}__assertOutsideChangeCallback(e){if(this.#u)throw Error(`${e}: not allowed inside onChange or onEditChange; the editor owns the document, so observe the change and call back after the callback returns`)}__syncRenderView(e){let{highlighter:t,fileContainer:n,columns:r,renderRange:i,domCurrent:a}=e,o=e,s;if(`file`in o&&this.type===`file`)s=o.file;else if(`fileDiff`in o&&this.type===`file-diff`)s=o.fileDiff;else throw Error(`Editor.__syncRenderView: Impossible render state`);let c=o.lineAnnotations,l=this.#M,u=this.#n;if(!this.#F||l==null||u==null)return;let d=n.shadowRoot;if(d==null){console.error(`[editor] Could not find the shadow root.`);return}let f=r?.code,p=r?.content,m=r?.gutter;if(this.#T=r?.deletions,f===void 0||p===void 0){this.#Z?.restore!=null&&this.#bt();return}this.#We().setViewportElements(n,f),this.#S!==n&&(this.#S=n,this.#v!==void 0&&n.appendChild(this.#v),this.#y!==void 0&&d.appendChild(this.#y),this.#b!==void 0&&d.appendChild(this.#b),this.#x!==void 0&&d.prepend(this.#x));let h=s.lang??Nn(s.name),g=`contents`in s?s.contents:s.additionLines.join(``);if(u.document==null||u.fileInfo==null){this.#tn(!0),this.#Te=[],this.#Je();let{name:e,lang:t}=s;u.document??=new _n(s.name,g,h,0,new Xn({maxEntries:this.#e.historyMaxEntries})),u.fileInfo={name:e,lang:t},this.#i?.cleanUp(),this.#i=void 0,this.#qe(),this.#g.clear(),this.#se=this.#oe}let _=u.document;this.#i!=null&&this.#i.highlighter!==t&&(this.#i.cleanUp(),this.#i=void 0),this.#i==null&&_!=null&&(this.#i=new bg({highlighter:t,textDocument:_,codeOptions:this.#M?.__getEffectiveCodeOptions()??{},matchBrackets:this.#e.matchBrackets,onDeferTokenize:this.#Oe,onThemeChange:()=>this.#Gt(),setStyle:e=>{this.#b!=null&&(this.#b.textContent=e)},__debug:this.#e.__debug})),this.#w!==p&&(this.#w?.removeAttribute(`data-composing`),this.#C=m,this.#w=ir(p,{contentEditable:`true`,role:`textbox`,ariaMultiLine:`true`,autocapitalize:`off`,writingSuggestions:`off`,autocorrect:!1,spellcheck:!1,translate:!1}),this.#E!==void 0&&p.after(this.#E),this.#r.init(p),this.#ht(),this.#it(p,m));let v=this.#Z?.restore;v!=null&&(v.target=p),p.ariaLabel!==s.name&&(p.ariaLabel=s.name),this.#Ge(),this.#i?.syncTheme(this.#M?.__getEffectiveCodeOptions()??{}),this.#L=c,this.#H=i,this.#i?.prebuildStateStack(i,a);let y=u.editor,b=this.#I;try{this.#U?.removePopover(),(this.#se!==void 0||this.#ce!==void 0||this.#U!==void 0)&&this.#sn(this.#se??[]),this.#cn(),this.#Ce&&this.#rn(),this.#oe!==void 0&&this.#A!==void 0?(this.#oe=void 0,this.#Dt(!1,`center`)):this.#fe===void 0?this.#Z?.restore==null?this.#se!==void 0&&this.#se.length>0&&this.#X&&!this.#ge&&this.focus({preventScroll:!0}):this.#xt():this.#Mt(this.#fe,this.#pe,this.#he),this.#ge&&this.#G?.focus(),b&&(this.#I=!1,y!==void 0&&this.setViewState(y)),this.#Ne()}catch(e){throw this.#I=b,u.editor=y,e}this.#Ye(l),this.#e.onRender?.()}#Fe(e,t,n){let r=e.document;if(r==null)return;r.adoptLineEnding(t);let i=qn(t),a=r.lineCount-1,o=r.offsetAt({line:a,character:r.getLineLength(a)});if(r.getTextSlice(0,o)===i)return;let s=this.#se,c=s?.map(e=>[r.offsetAt(e.start),r.offsetAt(e.end)]),l={start:0,end:o,text:i};if(r.applyResolvedEdits([l],!0,s,void 0,!0)!=null){if(s!=null&&c!=null){let e=Bf(r,s,c,[l]);r.setLastUndoSelectionsAfter(e),this.#se=e}(this.#L!=null||n!=null)&&r.setLastUndoLineAnnotations(this.#L??[],n??[]),this.#i?.cleanUp(),this.#i=void 0,this.#Ge(),this.#g.clear(),this.#U?.removePopover(),this.#G!=null&&this.#G.updateMatches({skipNavigation:!0})}}get#Ie(){return this.#M?.type===`file-diff`?this.#M:void 0}get#Le(){return Sg(this.#M)?this.#M:void 0}#Re(e){return this.#Ie?.isLineInCollapsedContext?.(e+1)??!1}get#ze(){let e=this.#Ie;if(e!=null)return(t,n)=>{let r=e.getNearestRenderableLine(t+1,n);return r==null?void 0:r-1}}#Be(e){this.#Re(e)&&this.#Ie?.revealLine?.(e+1)}get#Ve(){return this.#Ie?.options.diffStyle??`split`}get#He(){return this.type===`file-diff`}get#Ue(){return this.#M?.options.overflow===`wrap`}#We(){return this.#a??=new sh({hasActivePopover:()=>this.#K!==void 0||this.#U?.isPopoverVisible()===!0,updateActivePopover:()=>{this.#mn(),this.#U?.updatePopoverPosition()}})}#Ge(){this.#h.clear(),this.#_=void 0}#Ke(e){this.#Q=e,this.#w?.toggleAttribute(`data-composing`,e)}#qe(e=!1){this.#Ke(!1),this.#le?.clear(),this.#le=void 0,this.#Wt(null),this.#p=void 0,this.#m=void 0,this.#$e(),this.#Y=!1,this.#D?.forEach(e=>e.remove()),this.#D=void 0,this.#O?.forEach(e=>e.remove()),this.#O=void 0,this.#k?.forEach(e=>e.remove()),this.#k=void 0,e||(this.#W=void 0),this.#se=void 0,this.#fe=void 0,this.#U?.cleanup(),this.#U=void 0,this.#G?.cleanup(),this.#G=void 0,this.#ce=void 0,this.#ue=void 0,this.#de=!1,this.#K?.cleanup(),this.#K=void 0,this.#q=!0}#Je(){let e=this.#d;e.generation++,e.callback!=null&&(Kt(e.callback),e.callback=void 0)}#Ye(e){let t=this.#d,n=this.#n?.document;if(t.delivered||t.callback!=null||n==null)return;let{generation:r}=t,i=()=>{if(t.callback!==i||(t.callback=void 0,r!==t.generation||this.#M!==e||this.#n?.document!==n))return;let a=this.#w,o=this.#S?.shadowRoot;a!=null&&o!=null&&o.contains(a)&&(t.delivered=!0,this.#e.onAttach?.(this,e))};t.callback=i,Yt(i)}#Xe(){let e=this.#Le?.getEditorViewport?.();if(e!=null)return e;let t=this.#S;if(this.#M!=null&&t!=null)return sr(t)}#Ze(){if(!this.#z)return;let e=this.#Le?.getEditorViewport?.();if(e instanceof HTMLElement)return e}#Qe(){this.#v=z(`style`,{dataset:`editorGlobalCss`,textContent:`
|
|
1167
|
+
[data-annotation-slot] {
|
|
1168
|
+
user-select: none;
|
|
1169
|
+
-webkit-user-select: none;
|
|
1170
|
+
}
|
|
1171
|
+
`}),this.#y=z(`style`,{dataset:`editorCss`,textContent:_h}),this.#b=z(`style`,{dataset:`editorThemeCss`}),this.#i?.applyStyle(),this.#x=$p(),this.#E=z(`div`,{dataset:`editorOverlay`});let e=e=>{let t=e.composedPath()[0];return t instanceof Node&&this.#w?.contains(t)===!0},t=()=>{this.#Z?.restore!=null&&(this.#bt(),this.#X=!1)},n=e=>{if(e.pointerType!==`mouse`)return;let t=this.#$;this.#$e(),t&&this.#vt(),this.#e.enabledSelectionAction===!0&&this.#se!==void 0&&this.#se.length>0&&!X(this.#se.at(-1))&&this.#sn(this.#se)};this.#s=[B(document,`focusin`,n=>{e(n)||(this.#Z!=null&&(this.#bt(),this.#X=!1),t())},{passive:!0}),B(document,`pointerdown`,n=>{e(n)?this.#bt():queueMicrotask(t)},{capture:!0,passive:!0}),B(document,`selectionchange`,()=>{let e=this.#S?.shadowRoot;if(e==null||!this.#rt()||this.#se!==void 0&&this.#se.length>1&&!this.#ee)return;let t=Gp(e);if(t===void 0||!this.#Wn(t))return;let n=hf(t,0);if(n!==void 0){if(this.#ee&&this.#ne&&this.#se!==void 0&&this.#se.length>0){let e=this.#se.at(-1);this.#sn([Hf(e,n)])}else{if(this.#re!==void 0)n.direction=Vf(this.#re,n).direction;else if(this.#ee)this.#re=n;else if(this.#se!==void 0&&this.#se.length===1){let e=this.#se[0];Q(e.start,n.start)===0&&Q(e.end,n.end)===0&&(n.direction=e.direction)}this.#te!==void 0&&(this.#te.focusLine=Z(n).line,this.#Kt())||(this.#ae===void 0?this.#sn([n]):this.#sn([...this.#ae.filter(e=>!Lf(e,n)),n]))}}},{passive:!0}),B(document,`pointerup`,n,{passive:!0}),B(document,`pointercancel`,n,{passive:!0}),B(document,`keydown`,e=>{e.key===`Shift`?this.#re=this.#se?.at(-1):e.key===`Alt`&&!e.repeat&&this.#X&&this.#e.editPrediction?.mode===`subtle`&&(this.#Se=!this.#Se,this.#sn(this.#se??[]))},{passive:!0}),B(document,`keyup`,e=>{e.key===`Shift`&&(this.#re=void 0)},{passive:!0})]}#$e(){this.#c?.forEach(e=>e()),this.#c=void 0,this.#J=!1,this.#$=!1,this.#ee=!1,this.#te=void 0,this.#ne=!1,this.#re=void 0,this.#ae=void 0}#et(e){this.#c?.forEach(e=>e()),this.#c=e}#tt(){return this.#M?.options.enableLineSelection===!0}#nt(){this.#Y=this.#se!==void 0}#rt(){return!this.#Q&&this.#Z==null&&!this.#J&&!this.#Y&&this.#X}#it(e,t){this.#Ke(!1);let{onFocus:n,onBlur:r}=this.#e,i=t=>{let n=t.composedPath()[0];return n!==void 0&&(n===e||e.contains(n))};this.#o?.forEach(e=>e()),this.#o=[B(e,`focus`,()=>{this.#X=!0,n?.(),!this.#ee&&!this.#Q&&this.#Z==null&&this.#se!==void 0&&this.#se.length>0&&this.#Tt(this.#se.at(-1))},{passive:!0}),B(e,`blur`,()=>{this.#Z?.restore?.target===e&&this.#bt(),this.#X=!1,r?.()},{passive:!0}),B(e,`pointerdown`,t=>{if(this.#q=!0,this.#Z?.restore!=null&&this.#bt(),this.#Y=!1,t.pointerType!==`mouse`)return;if(this.#te=void 0,this.#Lt(t)){this.#Ut(!0),this.#se!==void 0&&this.#sn([]);return}this.#Ut(!1),this.#U?.removePopover();let n=[];if(Sn()&&this.#L!==void 0&&this.#L.length>0){let t=[...e.querySelectorAll(`[data-line-annotation]`)].map(e=>[B(e,`mouseenter`,()=>{this.#J=!0}),B(e,`mouseleave`,()=>{this.#J=!1})]).flat();n.push(...t)}this.#ee=!0;let r=t.button===0&&t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey;if(this.#re=void 0,r?(this.#te={pointerId:t.pointerId,startClientX:t.clientX,clientX:t.clientX,startScrollLeft:e.parentElement?.scrollLeft??0},this.#ae=void 0,this.#sn([]),n.push(B(document,`pointermove`,e=>{let t=this.#te;t!==void 0&&e.pointerType===`mouse`&&e.pointerId===t.pointerId&&(t.clientX=e.clientX,this.#Kt())},{capture:!0,passive:!0}))):t.button===0&&Np(t)&&(this.#ae=this.#se?.map(e=>({...e}))),this.#et(n),t.shiftKey){let e=this.#se?.at(-1);if(e!==void 0){let t=e.direction===-1?e.end:e.start;this.#Et({start:t,end:t,direction:0})}this.#ne=!0}},{passive:!0}),B(e,`keydown`,e=>{if(!i(e)||(this.#q=!0,e.isComposing||e.keyCode===229))return;if(e.key===`Tab`&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&!e.isComposing&&!this.#Q&&(!e.altKey||this.#e.editPrediction?.mode===`subtle`)&&this.#we?.rendered===!0){this.#an(),e.preventDefault();return}if(e.key===`Escape`&&this.#we!==void 0){this.#tn(!0),e.preventDefault();return}let t=zp(e,this.#e.keymap),n=this.#e.searchPanel===`host`&&(t===`openSearchPanel`||t===`openSearchReplacePanel`);if(t!=null&&!n){e.preventDefault(),t===`simplifySelection`&&(this.#G?.close(),this.#G=void 0,this.#ge=!1,this.#K?.cleanup(),this.#K=void 0),this.#ct(t);return}let r=Pp(e),a=this.#n?.document;if(this.#se!==void 0&&this.#se.length>0&&r!==void 0&&a!==void 0){let t={getSoftLineOffsets:this.#Ue?e=>this.#Un(e):void 0,resolveRenderableLine:this.#ze};e.shiftKey?this.#sn(Cf(a,this.#se,r,t)):this.#sn(_f(a,this.#se,r,t)),this.#Dt(),e.preventDefault()}else{if((e.key.startsWith(`Arrow`)||e.key===`Home`||e.key===`End`||e.key===`PageUp`||e.key===`PageDown`)&&(this.#Y=!1),(e.key.length===1?e.key.toLowerCase():e.key)===`v`&&Np(e)){if(e.repeat){e.preventDefault();return}if(this.#e.clipboard!==void 0){e.preventDefault(),Yt(this.#at);return}}if(this.#G!==void 0){let t=Vp(e);if(t!==void 0){e.preventDefault(),this.#G.navigate(t===`previous`);return}}}}),B(e,`copy`,e=>{i(e)&&(e.preventDefault(),this.#Vt()?e.clipboardData?.setData(`text`,this.#Ht()):this.#Cn(e.clipboardData,this.#xn(),this.#Sn()))}),B(e,`cut`,e=>{if(i(e)){if(e.preventDefault(),this.#Vt())e.clipboardData?.setData(`text`,this.#Ht());else{let t=this.#Sn();this.#Cn(e.clipboardData,this.#wn(),t)}}}),B(e,`paste`,e=>{if(!i(e))return;e.preventDefault();let t=e.clipboardData,n=this.#n?.document;if(t===null||n===void 0)return;let r=t.getData(`text`),a=this.#se?.length??0;if(a>1){let e=t.getData(kg);if(e!==void 0)try{let t=JSON.parse(e);Array.isArray(t)&&t.length===a&&(r=t)}catch{}}this.#En(Array.isArray(r)?r.map(e=>n.normalizeEol(e)):n.normalizeEol(r),void 0,!0,`document`)}),B(e,`beforeinput`,e=>{i(e)&&(e.inputType===`insertCompositionText`?this.#tn(!0):(e.preventDefault(),this.#_t(e.inputType,e.data)))}),B(e,`drop`,e=>{i(e)&&e.preventDefault()}),B(e,`compositionstart`,e=>{if(!i(e))return;this.#tn(!0),this.#Ke(!0);let t=this.#S?.shadowRoot,n=t==null?void 0:Gp(t);n!=null&&!n.collapsed&&this.#Wn(n)&&window.getSelection()?.collapse(n.startContainer,n.startOffset)},{passive:!0}),B(e,`compositionend`,e=>{if(!i(e))return;let t=this.#Q;if(this.#Ke(!1),e.data!==``||!t)this.#_t(`insertText`,e.data);else if(this.#X){let e=this.#se?.at(-1);e!=null&&!X(e)&&this.#Tt(e)}},{passive:!0})];let a=this.#S?.shadowRoot?.querySelector(`[data-deletions]`);if(a!=null&&this.#o.push(B(a,`pointerdown`,e=>{let t=e.composedPath();if(Gn(t)){this.#nt();return}let n=t[0],r=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(r instanceof HTMLElement){if(this.#tt()){this.#nt();return}if(this.#Bt(r,a,e.pointerType===`mouse`))return}this.#Ut(!0),this.#se!==void 0&&this.#sn([])},{passive:!0}),B(a,`click`,this.#It,{passive:!0})),this.#o.push(B(e,`click`,e=>{this.#Lt(e)&&this.#It(e)},{passive:!0})),t!==void 0){let e=(e,t=!1)=>{let n=e;return n?.dataset.lineNumberContent===void 0?t&&n?.tagName===`SPAN`&&(n=n.closest(`[data-line]`)):n=n.parentElement??void 0,n},n=e=>{if(e===void 0)return;let t=e.dataset.lineType,n=tr(e)??tr(e,`columnNumber`);if(n!==void 0&&t!==void 0&&If(t))return n-1};this.#o.push(B(t,`pointerdown`,t=>{let r=t.composedPath();if(Gn(r)){this.#nt();return}let i=e(r[0]);if(i!==void 0&&this.#tt()){this.#nt();return}if(i?.dataset.lineType===`change-deletion`){let e=i.closest(`[data-code]`);e!=null&&this.#Bt(i,e,t.pointerType===`mouse`);return}if(t.pointerType!==`mouse`)return;let a=this.#n?.document,o=n(i);if(o===void 0||a===void 0)return;this.#q=!0,this.#U?.removePopover();let s=this.#Ft(o,o,a);this.#$=!0,this.#re=s,this.#sn([s]),this.#Tt(s),this.#vt(),this.#et([B(document,`mousemove`,t=>{if(!this.#$)return;let r=this.#n?.document,i=n(e(t.composedPath()[0],!0));if(i===void 0||r===void 0)return;let a=this.#re?.start.line??i,o=this.#Ft(a,i,r);this.#re??=o,this.#sn([o]),this.#vt(o)},{passive:!0})])},{passive:!0}))}this.#U?.listenHover(e),this.#j?.disconnect(),this.#j=new ResizeObserver(this.#mt),this.#j.observe(e),this.#j.observe(e.parentElement),this.#ot(e)}#at=async()=>{let e=this.#e.clipboard;if(e!==void 0){let t=await e.readText(),n=this.#se?.length??0;if(n>1){let r=await e.readText(kg);try{let e=JSON.parse(r);Array.isArray(e)&&e.length===n&&(t=e)}catch{}}let r=this.#n?.document;r!=null&&this.#En(Array.isArray(t)?t.map(e=>r.normalizeEol(e)):r.normalizeEol(t),void 0,!0,`document`)}};#ot(e){this.#He&&this.#Ve===`split`&&this.#Ue&&(this.#f={top:e.offsetTop-this.#r.paddingTop,left:e.offsetLeft-this.#Rn()})}get#st(){if(this.#He&&this.#Ve===`split`&&this.#Ue)return this.#f}#ct(e){let t=this.#n?.document;if(t!=null)switch(e){case`openSearchPanel`:this.#gn(`find`);break;case`openSearchReplacePanel`:this.#gn(`replace`);break;case`findNextMatch`:{let e=this.#se;if(e===void 0)break;if(e.some(X)){let n=e.map(e=>X(e)?sp(t,e):e);this.#sn(n),this.focus()}else{let n=qf(t,e);if(n!==void 0){this.#sn(n);let e=n.at(-1);e!==void 0&&this.#Be(Z(e).line),this.#Dt()}}break}case`moveLineUp`:case`moveLineDown`:this.#pt(e===`moveLineUp`?-1:1);break;case`copyLineUp`:case`copyLineDown`:this.#dt(e===`copyLineUp`?-1:1);break;case`simplifySelection`:{let e=this.#se,t=e?.at(-1);if(e===void 0||t===void 0)break;if(e.length>1)this.#sn([t]),this.#vt(t);else if(!X(t)){let e=Z(t),n={start:e,end:e,direction:0};this.#sn([n]),this.#vt(n)}break}case`insertBlankLine`:this.#ft();break;case`deleteHardLineForward`:this.#An();break;case`toggleComment`:case`toggleBlockComment`:{let n=this.#se;if(n===void 0)break;let{lineComment:r,blockComment:i}=Wh(t.languageId,this.#e.languageCommentConfig);if(e===`toggleComment`&&r!==null){this.#ut(Gh(t,n,r));break}let a=e===`toggleComment`,o=Yh(t,n,i,a);o!==void 0&&this.#ut(o.edits,a?void 0:e=>o.nextSelectionOffsets.map(([t,n,r])=>({start:e.positionAt(t),end:e.positionAt(n),direction:r})));break}case`indent`:case`outdent`:case`indentLess`:case`indentMore`:if(this.#se!==void 0){let n=[],r=[],i=new Set,a=[];for(let o of this.#se){let s=o.start.line,c=e===`outdent`||e===`indentLess`,l=e===`indentLess`||e===`indentMore`;if(s!==o.end.line||c||l){let e=gf(t,o,this.#r.tabSize,c);for(let t of e[0]){let e=t.range.start.line;i.has(e)||(i.add(e),n.push(t))}r.push(e[1])}else{let e=t.charAt({line:s,character:0})===` `?` `:` `.repeat(this.#r.tabSize);n.push({range:o,newText:e}),a.push({line:s,startCharacter:o.start.character,addedLength:e.length-(o.end.character-o.start.character),selectionIndex:r.length});let i={line:o.start.line,character:o.start.character+e.length};r.push({start:i,end:i,direction:0})}}for(let e of a){let t=0;for(let n of a)n.line===e.line&&n.startCharacter<e.startCharacter&&(t+=n.addedLength);if(t!==0){let n=r[e.selectionIndex],i={line:e.line,character:n.start.character+t};r[e.selectionIndex]={start:i,end:i,direction:0}}}let o=t.applyEdits(n,!0,this.#se,r);o!==void 0&&this.#Mn(o,r)}break;case`selectAll`:{let e=Jf(t);this.#sn([e]),this.focus();break}case`moveCursorToDocStart`:case`moveCursorToDocEnd`:{let n=Yf(t,e===`moveCursorToDocEnd`,this.#He);this.#sn([n]),this.#Be(Z(n).line),this.#Dt()}break;case`expandSelectionDocStart`:case`expandSelectionDocEnd`:{let n=e===`expandSelectionDocEnd`,r=this.#se;if(r!==void 0){let e=Yf(t,n,this.#He);this.#sn(Uf(r,e)),this.#Be(Z(e).line),this.#Dt()}}break;case`undo`:case`redo`:this.#lt(e)}}#lt(e){let t=this.#n?.document;if(t==null||e===`undo`&&!t.canUndo||e===`redo`&&!t.canRedo)return;let n=this.#se,r=n?.map(e=>[t.offsetAt(e.start),t.offsetAt(e.end)]),i=e===`undo`?t.undo():t.redo();if(i===void 0)return;let[a,o,s,c]=i,l=o??(n!==void 0&&r!==void 0&&c!==void 0?Bf(t,n,r,c):void 0),u=s??(this.#L==null?void 0:of(a,this.#L));this.#Mn(a,l,u)}#ut(e,t){let n=this.#n?.document,r=this.#se;if(n===void 0||r===void 0)return;let i=t===void 0,a=i?r.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]):void 0,o=i?e.map(e=>{let t=n.offsetAt(e.range.start),r=n.offsetAt(e.range.end);return{start:Math.min(t,r),end:Math.max(t,r),text:e.newText}}).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n}):void 0,s=n.applyEdits(e,!0,r,void 0,!0);if(s===void 0)return;let c=i?Bf(n,r,a,o):t(n);n.setLastUndoSelectionsAfter(c),this.#Mn(s,c,this.#Pn(s))}#dt(e){let t=this.#n?.document,n=this.#se;if(t===void 0||n===void 0)return;let r=Gf(n);if(r.length===0)return;let i=[],a=0,o=[];for(let n of r){i.push(a);let r=n.endLine-n.startLine+1;a+=r;let s=t.getTextSlice(t.offsetAt({line:n.startLine,character:0}),t.offsetAt({line:n.endLine,character:t.getLineLength(n.endLine)}));if(e>0){let e={line:n.startLine,character:0};o.push({range:{start:e,end:e},newText:s+`
|
|
1172
|
+
`})}else if(n.endLine<t.lineCount-1){let e={line:n.endLine+1,character:0};o.push({range:{start:e,end:e},newText:s+`
|
|
1173
|
+
`})}else{let e={line:n.endLine,character:t.getLineLength(n.endLine)};o.push({range:{start:e,end:e},newText:`
|
|
1174
|
+
`+s})}}let s=n.map(t=>{let n=t.start.line,a=0,o=r.length-1;for(;a<=o;){let e=a+o>>>1,t=r[e];if(n<t.startLine)o=e-1;else if(n>t.endLine)a=e+1;else{a=e;break}}let s=Math.max(0,a<=o?a:o),c=r[s],l=i[s]+(e>0?c.endLine-c.startLine+1:0);return{start:{...t.start,line:t.start.line+l},end:{...t.end,line:t.end.line+l},direction:t.direction}});this.#ut(o,()=>s)}#ft(){let e=this.#n?.document,t=this.#se;if(e===void 0||t===void 0)return;let n=t.map(e=>Z(e).line),r=Array.from(new Set(n)).sort((e,t)=>e-t),i=new Map,a=new Map,o=[];for(let t=0;t<r.length;t++){let n=r[t],s=e.getLineText(n),c=/^\s*/.exec(s)?.[0]??``;i.set(n,t),a.set(n,c);let l={line:n,character:e.getLineLength(n)};o.push({range:{start:l,end:l},newText:`
|
|
1175
|
+
`+c})}let s=t.map((e,t)=>{let r=n[t],o={line:r+1+i.get(r),character:a.get(r).length};return{start:o,end:o,direction:0}});this.#ut(o,()=>s)}#pt(e){let t=this.#n?.document,n=this.#se;if(t===void 0||n===void 0)return;let r=Gf(n);if(r.length===0||e<0&&r[0].startLine===0||e>0&&r.at(-1).endLine>=t.lineCount-1)return;let i=t.lineCount,a=e=>e<i-1?{line:e+1,character:0}:{line:e,character:t.getLineLength(e)},o=(e,n)=>{let r=e.map(e=>t.getLineText(e)).join(`
|
|
1176
|
+
`);return n?`${r}\n`:r},s=[];if(e<0)for(let e of r){let t=e.startLine-1,n=[];for(let t=e.startLine;t<=e.endLine;t++)n.push(t);s.push({range:{start:{line:t,character:0},end:a(e.endLine)},newText:o([...n,t],e.endLine<i-1)})}else for(let e=r.length-1;e>=0;e--){let t=r[e],n=t.endLine+1,c=[];for(let e=t.startLine;e<=t.endLine;e++)c.push(e);s.push({range:{start:{line:t.startLine,character:0},end:a(n)},newText:o([n,...c],n<i-1)})}let c=r.at(-1),l=e>0&&c.endLine===i-2?t.getLineLength(c.endLine):t.getLineLength(i-1),u=n.map(n=>Kf(n,e,i,e=>e===i-1?l:t.getLineLength(e))),d=t.applyEdits(s,!0,n,u,!0);d!==void 0&&this.#Mn(d,u)}#mt=()=>{let e=this.#L?.length??0,t=this.#p,n=this.#m;this.#p=void 0,this.#m=void 0;let r=this.#Rn()!==t,i=this.#zn()!==n;(r||i)&&(this.#_=void 0,this.#r.clearTextWidthCache(),i&&(this.#g.clear(),(this.#Ue||e>0)&&this.#h.clear()),(this.#se!==void 0||this.#ce!==void 0||this.#U!==void 0)&&(this.#sn(this.#se??[]),this.#se!==void 0&&this.#X&&this.focus()),this.#U?.removePopover(),this.#ot(this.#w),this.#cn())};#ht(){if(this.#_e)return;let e=document.fonts;e!==void 0&&(this.#_e=!0,e.ready.then(()=>{this.#w!==void 0&&this.#r.remeasureCharacterWidth()&&(this.#p=void 0,this.#m=void 0,this.#Ge(),this.#g.clear(),(this.#se!==void 0||this.#ce!==void 0||this.#U!==void 0)&&this.#sn(this.#se??[]),this.#cn(),this.#U?.removePopover())}))}#gt(e,t){let n=this.#H,r=this.#i,i=this.#M,a=this.#N,o=this.#n?.document;if(i==null||a==null||o==null||this.#w==null)return;let{rebuiltLines:s}=a(o,e,{tokens:r?.tokenize(e,n),lineAnnotations:t});(e.lineDelta!==0||s.length>0)&&this.#Ge(),t!=null&&(this.#L=t),this.#cn()}#_t(e,t){switch(e){case`insertText`:{let e=t??``,n=this.#n?.document,r=this.#se,i=n!==void 0&&r!==void 0?kf(n,r,e,this.#e.autoSurround):void 0;this.#En(i??e);break}case`insertCompositionText`:break;case`insertLineBreak`:case`insertParagraph`:this.#En(`
|
|
1177
|
+
`);break;case`deleteContentBackward`:this.#Dn();break;case`deleteContentForward`:this.#Dn(!0);break;case`deleteSoftLineBackward`:case`deleteHardLineBackward`:this.#On();break;case`deleteWordBackward`:this.#kn();break;case`insertTranspose`:this.#jn();break;default:console.warn(`[diffs] Unknown input type: ${e}`,t)}}#vt(e,t=!0,n){this.#X=!0;let r=this.#w,i=()=>n==null||n.claimed===!0||r!=null&&this.#St(r);if(e!==void 0){let r=this.#Tt(e);if(n!=null&&!r)return;let a=()=>{this.#Z===o&&(o.frame=void 0,!this.#X||!i()?this.#yt(o):(o.restore=void 0,this.#w?.focus({preventScroll:t}),Yt(()=>this.#yt(o))))},o={frame:a,restore:n};this.#bt(),this.#Z=o,Yt(a)}else n!=null&&this.#bt(),i()?this.#w?.focus({preventScroll:t}):this.#X=!1}#yt(e){this.#Z===e&&(this.#Z=void 0)}#bt(){let e=this.#Z;e!=null&&(e.frame!=null&&Kt(e.frame),this.#Z=void 0)}#xt(){let e=this.#Z?.restore;if(e==null)return;if(this.#ge){this.#bt(),this.#X=!1;return}let t=this.#w;t==null||!this.#St(t)?(this.#bt(),this.#X=!1):this.#vt(this.#se?.at(-1),!0,e)}#St(e){let t=this.#S,n=t?.shadowRoot;if(t==null||n==null||this.#w!==e||!n.contains(e))return!1;let{frame:r,restore:i}=this.#Z??{};if(r!=null||i?.claimed===!0&&this.#X)return!0;let{activeElement:a}=n;if(a===e||a!=null&&e.contains(a))return!0;if(a!=null)return!1;let{ownerDocument:o}=t,{activeElement:s}=o;return s==null||s===o.body||s===o.documentElement||s===t}#Ct(e=0){let t=this.#w,n=this.#S;if(this.#n?.document==null||t==null||n==null)return;let r=this.#Xe();if(r===void 0)return;let i,a;if(r instanceof HTMLElement){let e=r.getBoundingClientRect();i=e.top,a=e.bottom}else i=0,a=r.defaultView?.innerHeight??0;let o=n.shadowRoot?.querySelector(`[data-diffs-header][data-sticky]`);if(o!=null&&(i=Math.max(i,o.getBoundingClientRect().bottom)),Number.isFinite(e)&&(i+=Math.max(0,e)),!(a<=i))for(let e of t.children){let t=e,n=tr(t),r=t.dataset.lineType;if(n==null||r==null||!If(r))continue;let o=t.getBoundingClientRect();if(!(o.bottom<=o.top)&&o.top>=i&&o.top<a)return n}}#wt(e,t){let n={start:e,end:e,direction:0};this.#q=!1,this.#sn([n]),this.#Be(e.line),t?this.#vt(n,!0):this.#Dt()}#Tt(e){let t=this.#Et(e);if(this.#Y=!t,t||X(e))return t;let{start:n,end:r,direction:i}=e,a=this.#Fn().rendered,o=a.find(([,e])=>e>=n.line)?.[0],s=a.findLast(([e])=>e<=r.line)?.[1],c=this.#n?.document;return c==null||o==null||s==null||o>s?!1:this.#Et({start:o>n.line?{line:o,character:0}:n,end:s<r.line?{line:s,character:c.getLineLength(s)}:r,direction:i})}#Et(e){let t=window.getSelection();if(t===null)return!1;let{start:n,end:r,direction:i}=e;Q(n,r)>0&&([n,r]=[r,n]);let a=this.#Ln(n.line),o=this.#Ln(r.line);if(a===void 0||o===void 0)return!1;let[s,c]=ap(a,n.character),[l,u]=ap(o,r.character);i===-1&&([s,c,l,u]=[l,u,s,c]);try{return t.setBaseAndExtent(s,rr(s,c),l,rr(l,u)),!0}catch(e){return console.error(`[diffs/editor] failed to update window selection:`,e),!1}}#Dt(e=!1,t=`nearest`){let n=this.#se?.at(-1);if(n===void 0)return;let r=this.#A;if(this.#Le!==void 0)this.#Ot(t);else if(r!==void 0)r.scrollIntoView({block:t,inline:`nearest`});else{let t=Z(n);this.#Mt(t.line,t.character,e);return}e||this.#At()}#Ot(e){let t=this.#Le,n=this.#se?.at(-1);t!==void 0&&n!==void 0&&(this.__postponeBgTokenizeToNextFrame(),t.scrollToLine(Z(n).line+1,e,this.#kt))}#kt=e=>{let t=this.#se?.at(-1);if(e===`settled`&&t!==void 0){let{line:e,character:n}=Z(t);this.#Nt(e,n,`nearest`)}};#At(){this.#Z?.restore==null?this.#vt(this.#se?.at(-1)):this.#xt()}#jt(){let e=this.#G===void 0?0:48,t=this.#Rn()+this.#r.ch;return`${e}px ${this.#r.ch}px 0 ${t}px`}#Mt(e,t=0,n=!1){if(this.__postponeBgTokenizeToNextFrame(),this.#Nt(e,t,`center`)){n||this.#At(),this.#fe=void 0,this.#pe=void 0,this.#me=!1,this.#he=!1;return}let r=0;if(this.#fe===e&&this.#w!==void 0)for(let t=this.#w.childElementCount-1;t>=0;t--){let n=this.#w.children[t],i=n.dataset.lineType,a=tr(n);if(i!==void 0&&If(i)&&a!==void 0){r=(e-(a-1))*this.#r.lineHeight;break}}let i=((this.#L??[]).filter(t=>t.lineNumber<e).length+e)*this.#r.lineHeight+r,a=this.#Pt();a.style.top=i+`px`,this.#S?.shadowRoot?.appendChild(a),a.scrollIntoView({block:`center`,inline:`nearest`}),a.remove(),this.#fe===e&&(r===0||this.#me)||this.#Re(e)?(this.#fe=void 0,this.#pe=void 0,this.#me=!1,this.#he=!1):(this.#fe=e,this.#pe=t,this.#me=r!==0,this.#he=n)}#Nt(e,t,n){if(!this.#F||this.#Ln(e)===void 0)return!1;let[r,i]=this.#Vn(e,t),a=this.#Pt();return a.style.top=this.#Bn(e)+i*this.#r.lineHeight+`px`,a.style.left=r+`px`,this.#E?.appendChild(a),a.scrollIntoView({block:n,inline:`nearest`}),a.remove(),!0}#Pt(){return z(`div`,{style:{position:`absolute`,left:`0`,width:`2px`,height:this.#r.lineHeight+`px`,scrollMargin:this.#jt()}})}#Ft(e,t,n){let r=e=>({line:e,character:0}),i=e=>({line:e,character:n.getLineText(e).length});return t<e?{start:r(t),end:i(e),direction:-1}:{start:r(e),end:i(t),direction:1}}#It=e=>{let t=e.composedPath()[0],n=t instanceof HTMLElement?t.closest(`[data-line]`):null,r=this.#S?.shadowRoot,i=this.#n?.document;if(!(n instanceof HTMLElement)||r==null||i==null||!this.#F)return;let a=Gp(r);if(a!=null&&!a.collapsed)return;let o=tr(n),s=o==null?void 0:this.#Ie?.editLineFor(o);if(s==null)return;let c=n.dataset.lineType!==`change-deletion`&&a!=null&&n.contains(a.startContainer)?hf(a)?.start:void 0;this.#Ut(!1),this.#wt(i.normalizePosition({line:s,character:c?.character??0}),!1)};#Lt(e){let t=e.composedPath()[0];return t instanceof HTMLElement&&t.closest(`[data-line]`)?.getAttribute(`data-line-type`)===`change-deletion`}#Rt(e,t,n){let r=[...n.querySelectorAll(`[data-content] > [data-line]`)],i=r.indexOf(e),a=r.indexOf(t),[o,s]=a<i?[t,e]:[e,t],c=window.getSelection();if(c!==null){let e=document.createRange();e.setStart(o,0),e.setEnd(s,s.childNodes.length),c.removeAllRanges(),c.addRange(e)}this.#Ut(!0),this.#sn([]),this.#Wt(tr(t)??null,!0,`deletions`);let l=Math.min(i,a),u=Math.max(i,a);this.#ie=l<0?``:r.slice(l,u+1).filter(e=>e.getAttribute(`data-line-type`)===`change-deletion`).map(e=>e.textContent??``).join(`
|
|
1178
|
+
`)}#zt(e,t){let n=e.parentElement;if(n==null||t==null)return;let r=[...n.children].indexOf(e),i=t.children[r];return i instanceof HTMLElement?i:void 0}#Bt(e,t,n){let r=t.querySelector(`[data-content]`),i=this.#zt(e,r);return i!==void 0&&(this.#Rt(i,i,t),n&&this.#et([B(document,`mousemove`,e=>{let n=e.composedPath()[0],a=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(a instanceof HTMLElement&&t.contains(a)){let e=this.#zt(a,r);e!==void 0&&this.#Rt(i,e,t)}},{passive:!0})]),!0)}#Vt(){return this.#S?.shadowRoot?.querySelector(`pre`)?.hasAttribute(`data-deleted-text-selection`)??!1}#Ht(){return this.#ie===``?window.getSelection()?.toString()??``:this.#ie}#Ut(e){let t=this.#S?.shadowRoot?.querySelector(`pre`);t!=null&&(e?(t.setAttribute(`data-deleted-text-selection`,``),this.#Wt(null),this.#ie=``):(t.removeAttribute(`data-deleted-text-selection`),this.#ie=``))}#Wt(e,t=!1,n=`additions`){try{this.#M?.setEditorActiveLine(e,{lineNumberOnly:t,side:n})}catch{}}#Gt(){this.#ve===void 0&&(this.#ve=requestAnimationFrame(()=>{this.#ve=void 0,(this.#se!==void 0||this.#ce!==void 0||this.#U!==void 0)&&this.#sn(this.#se??[])}))}#Kt(){let e=this.#te,t=this.#re,n=this.#n?.document;if(e===void 0||e.focusLine===void 0||t===void 0||n===void 0)return!1;let r=t.direction===-1?t.end:t.start,i=this.#w?.parentElement?.scrollLeft??0,a=(e.clientX-e.startClientX+i-e.startScrollLeft)/this.#r.ch,o=a<0?-Math.round(-a):Math.round(a),s=Math.max(0,r.character+o),c={line:e.focusLine,character:s};if(e.renderedGoal!==void 0&&Q(e.renderedGoal,c)===0)return!0;e.renderedGoal=c;let l=[],u=c.line<r.line?-1:1;for(let e=r.line;;e+=u){if(!this.#Re(e)){let t=n.getLineText(e),i=Math.min(r.character,t.length),a=Math.min(s,t.length),o=yf(t,i),c=a===i?o:yf(t,a);l.push({start:{line:e,character:Math.min(o,c)},end:{line:e,character:Math.max(o,c)},direction:o===c?0:o<c?1:-1})}if(e===c.line)break}return this.#sn(l),!0}#qt(){for(let[e,t]of this.#D??[])e.startsWith(`editPrediction`)&&(t.remove(),this.#D?.delete(e))}#Jt(e,t,n){let r=t[n],i=n,a=r.range.end.line;for(;i+1<t.length&&t[i+1].range.start.line<=a;)i++,a=Math.max(a,t[i].range.end.line);if(i===n&&(r.newText.length===0||Q(r.range.start,r.range.end)===0))return{edit:r,endIndex:i};let o=r.range.start,s={line:a,character:e.getLineLength(a)},c=[],l=e.offsetAt(o);for(let r=n;r<=i;r++){let n=t[r],i=e.offsetAt(n.range.start),a=e.offsetAt(n.range.end);c.push(e.getTextSlice(l,i),n.newText),l=a}return c.push(e.getTextSlice(l,e.offsetAt(s))),{edit:{range:{start:o,end:s},newText:c.join(``)},endIndex:i}}#Yt(){let e=this.#we,t=this.#n?.document;if(e==null||t==null||e.document!==t||e.version!==t.version||this.#e.editPrediction?.mode===`subtle`&&!this.#Se)return;let{edits:n}=e.response,r=[],i=n.length>0;for(let e=0;e<n.length;){let{edit:a,endIndex:o}=this.#Jt(t,n,e);for(let e=a.range.start.line;i&&e<=a.range.end.line;e++)i=this.#Gn(e);r.push({edit:a,startIndex:e,endIndex:o}),e=o+1}return{groups:r,allVisible:i}}#Xt(e,t,n,r,i){this.#Ue?(e.dataset.wrap=``,e.style.width=`calc(100cqw - ${r}px)`):(delete e.dataset.wrap,e.style.width=`max-content`);let a=t.split(/\r\n|\r|\n/);for(let t=0;t<a.length;t++){let o=a[t],s=t===a.length-1?i:void 0,c=o.length===0&&s===void 0,l=z(`span`,{dataset:c?[`editPredictionLine`,`empty`]:`editPredictionLine`,textContent:c?``:o},e);s!==void 0&&z(`span`,{dataset:`editPredictionSuffix`},l).append(s),t===0&&n!==r&&(l.style.textIndent=`${n-r}px`)}}#Zt(e){let t=this.#we,n=this.#n?.document;if(t==null||n==null)return;let{edit:r,startIndex:i,endIndex:a}=e,{start:o,end:s}=r.range;if(!(Q(o,s)===0&&o.character<n.getLineLength(o.line))||t.response.edits[i-1]?.range.end.line===o.line||t.response.edits[a+1]?.range.start.line===o.line)return;let c=this.#Ln(o.line);if(c===void 0)return document.createTextNode(n.getLineText(o.line).slice(o.character));let[l,u]=ap(c,o.character),d=document.createRange();d.selectNodeContents(c),d.setStart(l,rr(l,u));let f=d.cloneContents();return f.firstChild?.textContent===``&&f.firstChild.remove(),f}#Qt(e){let{edit:t}=e,{start:n}=t.range,[r,i]=this.#Vn(n.line,n.character),a=1,o=t.newText.split(/\r\n|\r|\n/).length,s=this.#E;if(this.#Ue&&s!=null){a=Math.max(1,this.#Un(n.line).length-1);let i=z(`span`,{dataset:`editPrediction`,style:{visibility:`hidden`}},s);this.#Xt(i,t.newText,r,this.#Vn(n.line,0)[0],this.#Zt(e));let{width:c,height:l}=i.getBoundingClientRect();i.remove();let{lineHeight:u}=this.#r;c>0&&l>0&&u>0&&(o=Math.round(l/u))}return Math.max(0,o-(a-i))}#$t(e=!0){let t=new Map,n=new Map,r=this.#De,i=!1,a=this.#w,o=this.#Yt();if(a!=null&&o!=null&&o.allVisible){for(let e of o.groups){let{edit:t}=e;if(t.newText.length===0)continue;let r=this.#Qt(e);r>(n.get(t.range.start.line)??0)&&n.set(t.range.start.line,r)}if(n.size>0){let e,o=this.#H?.startingLine??0;for(let[s,c]of n){i||=r.get(s)!==c;let n=this.#Ln(s);if(n===void 0)continue;let l=s-o;if(a.children[l]!==n){if(e===void 0){e=new Map;for(let t=0;t<a.children.length;t++)e.set(a.children[t],t)}l=e.get(n)??-1}if(l<0)continue;t.set(n,c);let u=this.#C?.children[l];u instanceof HTMLElement&&t.set(u,c);let d=this.#en(l);d!=null&&(t.set(d.content,(t.get(d.content)??0)+c),t.set(d.gutter,(t.get(d.gutter)??0)+c))}}}let s=!1;for(let[e,n]of this.#Ee)t.get(e)!==n&&(delete e.dataset.editPredictionSpacer,e.style.removeProperty(`--diffs-edit-prediction-spacer-height`),s=!0);for(let[e,n]of t)this.#Ee.get(e)!==n&&(e.dataset.editPredictionSpacer=``,e.style.setProperty(`--diffs-edit-prediction-spacer-height`,`${n}lh`),s=!0);this.#Ee=t,(i||n.size!==r.size)&&(this.#De=n,e&&this.#Le?.syncGhostTextRows()),s&&this.#Ge()}#en(e){let t=this.#T,n=this.#w;if(t==null||n==null||!this.#He||this.#Ve!==`split`||this.#Ue)return;let r=0;for(let t=0;t<e;t++)r+=Mg(n.children[t]);let{content:i,gutter:a}=t,o=0;for(let e=0;e<i.children.length;e++){let t=i.children[e];if(o+=Mg(t),o>r){let n=a.children[e];if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))throw Error(`Editor: deletions column rows and gutter cells are out of step`);return{content:t,gutter:n}}}}#tn(e,t=!0){this.#ye!==void 0&&(clearTimeout(this.#ye),this.#ye=void 0),this.#be?.abort(),this.#be=void 0,this.#xe++,this.#Se=!1,this.#Ce=!1,this.#we=void 0,this.#$t(t),e&&this.#qt()}#nn(e){let t=this.#e.editPrediction;if(t===void 0)return!1;let n=e.replaceAll(`\\`,`/`);return(t.include===void 0||t.include.some(e=>Bh(n,e)))&&t.exclude?.some(e=>Bh(n,e))!==!0}#rn(){this.#tn(!0);let e=this.#se?.[0];if(this.#e.editPrediction===void 0||this.#n?.document===void 0||this.#n?.fileInfo===void 0||this.#se?.length!==1||e===void 0||!X(e))return;let t=this.#n?.document,n=t.offsetAt(Z(e));this.#ye=setTimeout(()=>{this.#ye=void 0;let e=this.#e.editPrediction,r=this.#se?.[0],i=this.#n?.fileInfo?.name;if(e===void 0||i===void 0||this.#n?.document!==t||this.#se?.length!==1||r===void 0||!X(r)||t.offsetAt(Z(r))!==n||!this.#nn(i))return;let a=e=>this.#In(e)&&!this.#Re(e);if(!a(Z(r).line)){this.#Ce=!0;return}let o=zh(i,t,n,this.#Te,a);if(o===void 0)return;let s=t.offsetAt({line:o.excerptStartLine,character:0}),c=s+o.editableRange.start,l=s+o.editableRange.end,u=new AbortController,d=++this.#xe;this.#be=u;let f;try{f=e.provider.predict(o,{signal:u.signal})}catch{this.#be=void 0;return}Promise.resolve(f).then(e=>{let r=this.#se?.[0];if(u.signal.aborted||d!==this.#xe||this.#be!==u||this.#n?.document!==t||t.version!==o.version||this.#se?.length!==1||r===void 0||!X(r)||t.offsetAt(Z(r))!==n||e==null||!Array.isArray(e.edits)||e.edits.length===0||e.edits.length>Tg||e.newCursor==null)return;let i=[],a=0;for(let n of e.edits){if(n==null||typeof n.newText!=`string`||!Ng(t,n.range?.start)||!Ng(t,n.range?.end)||Q(n.range.start,n.range.end)>0||(a+=Dg.encode(n.newText).byteLength,a>Eg))return;let e=t.offsetAt(n.range.start),r=t.offsetAt(n.range.end),o=t.resolveEdits([n])[0];if(o.start!==e||o.end!==r)return;i.push(o)}i.sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});for(let e=0;e<i.length;e++){let t=i[e];if(t.start<c||t.end>l||e>0&&i[e-1].end>t.start)return}let s=i.filter(e=>e.text!==t.getTextSlice(e.start,e.end));if(s.length===0)return;let f=t.positionAt(s[0].start),p=t.positionAt(s.at(-1).end),m=t.offsetAt({line:f.line,character:0}),h=t.offsetAt({line:p.line,character:t.getLineLength(p.line)}),g=[],_=m;for(let e of s)g.push(t.getTextSlice(_,e.start),e.text),_=e.end;g.push(t.getTextSlice(_,h));let v=g.join(``).split(/\r\n|\r|\n/),y=f.line+v.length-1,b=v.length-(p.line-f.line+1),x=e.newCursor;if(!(!Number.isInteger(x.line)||!Number.isInteger(x.character)||x.line<0||x.character<0)){if(x.line>=f.line&&x.line<=y){let e=v[x.line-f.line];if(x.character>e.length||Pg(e,x.character))return}else{let e=x.line<f.line?x.line:x.line-b;if(e<0||e>=t.lineCount||x.character>t.getLineLength(e))return;let n=t.offsetAt({line:e,character:x.character});if(Pg(t.charAt(n-1)+t.charAt(n),1))return}this.#we={document:t,version:o.version,cursorOffset:n,rendered:!1,response:{edits:s.map(e=>({range:{start:t.positionAt(e.start),end:t.positionAt(e.end)},newText:e.text})),newCursor:{...x}}},this.#sn(this.#se)}}).catch(()=>{}).finally(()=>{this.#be===u&&(this.#be=void 0)})},wg)}#in(e,t){let n=this.#n?.document,r=this.#n?.fileInfo?.name,i=Wn(e);n!==void 0&&r!==void 0&&i!==void 0&&this.#nn(r)&&(this.#Te=Lh(this.#Te,r,n,i,t))}#an(){let e=this.#we,t=this.#n?.document,n=this.#se?.[0];if(e===void 0||!e.rendered||t===void 0||e.document!==t||e.version!==t.version||this.#se?.length!==1||n===void 0||!X(n)||t.offsetAt(Z(n))!==e.cursorOffset)return;let{edits:r,newCursor:i}=e.response;this.#tn(!0);let a=t.applyEdits(r.map(e=>({range:{start:{...e.range.start},end:{...e.range.end}},newText:e.newText})),!0,this.#se,void 0,!0);if(a===void 0){this.#rn();return}let o=t.normalizePosition(i),s=[{start:o,end:o,direction:0}];t.setLastUndoSelectionsAfter(s),this.#Mn(a,s,this.#Pn(a),{editSource:`prediction`})}#on(e){let t=this.#we,n=this.#n?.document;t!==void 0&&(t.rendered=!1);let r=this.#Yt();if(t!=null&&n!=null&&r!=null&&r.allVisible){for(let t of r.groups){let{edit:r,endIndex:i}=t,{start:a,end:o}=r.range,s=r.newText.length===0,c=Q(a,o)!==0,l=n.getLineLength(a.line),u=!c&&a.character<l;if(c?this.#ln(e,s?`editPredictionDeletion`:`editPredictionReplacement`,{start:a,end:o}):u&&this.#ln(e,`editPredictionInsertion`,{start:a,end:{line:a.line,character:l}}),s)continue;let[d,f]=this.#Vn(a.line,a.character),p=this.#Vn(a.line,0)[0],m=this.#Bn(a.line)+f*this.#r.lineHeight,h=`editPrediction-${i}`,g=this.#D?.get(h);if(g===void 0?g=z(`span`,{ariaHidden:`true`,contentEditable:`false`,dataset:`editPrediction`},e.fragment):(this.#D?.delete(h),g.replaceChildren()),c){g.dataset.replacement=``;let e=this.#Ln(a.line);e!==void 0&&g.style.setProperty(`--diffs-edit-prediction-bg`,getComputedStyle(e).getPropertyValue(`--diffs-line-bg`))}else delete g.dataset.replacement,g.style.removeProperty(`--diffs-edit-prediction-bg`);this.#Xt(g,r.newText,d,p,this.#Zt(t)),g.style.transform=`translateX(${p}px) translateY(${m}px)`,e.elements.set(h,g)}t.rendered=!0}}#sn(e){this.__postponeBgTokenizeToNextFrame();let t=this.#se,n=t?.length!==e.length;if(!n&&t!==void 0)for(let r=0;r<e.length;r++){let i=t[r],a=e[r];if(i.direction!==a.direction||Q(i.start,a.start)!==0||Q(i.end,a.end)!==0){n=!0;break}}if(n&&this.#tn(!0),this.#$t(),this.#A=void 0,this.#Wt(null),e.length===0&&(this.#se=void 0),e.length===0&&this.#ce===void 0&&this.#U===void 0){this.#le?.clear(),this.#D?.forEach(e=>e.remove()),this.#D?.clear(),this.#K?.cleanup(),this.#K=void 0,n&&this.#rn();return}let r=document.createDocumentFragment(),i={fragment:r,elements:new Map};if(e.length>0){let t=Wf(e),n=t.at(-1);this.#se=t;let r=t.some(e=>!X(e)),a=Z(n).line+1;this.#Wt(a,r);for(let e of t)X(e)||this.#ln(i,`selection`,e),this.#pn(i,e,e===n);let o=this.#e.matchBrackets!==!1&&this.#n?.document!=null&&this.#i!==void 0&&X(n)?eg(this.#n?.document,this.#i,n.start):void 0;if(o!==void 0)for(let e of o)this.#ln(i,`bracketMatch`,e)}let a=this.#n?.document;if(this.#hn(),this.#U!==void 0&&a!==void 0)for(let e of this.#U.markers)this.#ln(i,`marker`,e,hh(e.severity));this.#on(i),this.#E?.appendChild(r),this.#D?.forEach(e=>e.remove()),this.#D?.clear(),this.#D=i.elements,this.#mn(),n&&this.#rn()}#cn(){let e=this.#W,t=this.#e.renderCaret,n=this.#E;if(this.#k?.forEach(e=>e.remove()),this.#k=void 0,e===void 0||t===void 0||n===void 0){this.#O?.forEach(e=>e.remove()),this.#O=void 0;return}let r=this.#O??=new Map;for(let[e,t]of r)this.#Gn(e.caret.focus.line)||(t.remove(),r.delete(e));let i=document.createDocumentFragment(),a=[];for(let n of e){let{caret:e}=n,{line:o,character:s}=e.focus;if(n.anchorOffset!==n.focusOffset){let t={fragment:i,elements:new Map};this.#ln(t,`caretHighlight`,n.anchorOffset<n.focusOffset?{start:e.anchor,end:e.focus}:{start:e.focus,end:e.anchor},void 0,e.focus);for(let n of t.elements.values())n.style.setProperty(`--diffs-caret-highlight-bg`,`color-mix(in srgb, ${e.metadata.color} 32%, transparent)`),a.push(n)}if(!this.#Gn(o))continue;let c=r.get(n);c===void 0&&(c=z(`div`,{dataset:`remoteCaret`,children:[t(e)]},i),r.set(n,c));let[l,u]=this.#Vn(o,s),d=rm(l),f=rm(this.#Bn(o)+u*this.#r.lineHeight);c.style.transform=`translateX(${d}px) translateY(${f}px)`}this.#k=a,n.appendChild(i)}#ln(e,t,n,r,i){if(this.#n?.document==null)return;let{start:a,end:o}=n,s=a.line,c=o.line+1;if(this.#H!==void 0){let{startingLine:e,totalLines:t}=this.#H;s=Math.max(s,e),c=Math.min(c,e+t)}for(let n=s;n<c;n++){if(!this.#Gn(n))continue;let s=n===o.line,c=n===a.line?a.character:0,l=s?o.character:this.#n?.document.getLineLength(n);if(c===l&&(t===`editPredictionDeletion`||t===`editPredictionReplacement`)){if(s&&n!==a.line)continue;let[i,o]=this.#Vn(n,c);this.#fn(e,t,n,o,i,this.#r.ch,r);continue}if(this.#Ue){let a=this.#zn(),o=this.#n?.document.getLineText(n);if(2*this.#r.ch+this.#r.measureTextWidth(o)>a){this.#un(e,n,o,c,l,s,t,r,i);continue}}let u=0,d=0,f=0;u=c===0?this.#Rn()+this.#r.ch+(this.#st?.left??0):this.#Vn(n,c)[0],!s&&t===`selection`&&(f=this.#r.ch),d=c===l?f:this.#Vn(n,l)[0]-u+f,this.#fn(e,t,n,0,u,d,r,{start:i?.line===a.line&&i.character===a.character&&n===a.line,end:i?.line===o.line&&i.character===o.character&&n===o.line})}}#un(e,t,n,r,i,a,o,s,c){let l=this.#Un(t),u=l.length-1,d=this.#Rn()+this.#r.ch+(this.#st?.left??0);for(let f=0;f<u;f++){let p=l[f],m=l[f+1],h=Math.max(r,p),g=Math.min(i,m);if(h>g)continue;let _=this.#dn(n,p,h),v=d+_,y=0;!a&&f===u-1&&o===`selection`&&(y=this.#r.ch);let b=h===g?y:this.#dn(n,p,g)-_+y;this.#fn(e,o,t,f,v,b,s,{start:c?.line===t&&c.character===r&&h===r,end:c?.line===t&&c.character===i&&g===i})}}#dn(e,t,n){if(n<=t)return 0;let r=e.slice(t,n),i=yg(r,this.#r.tabSize);return i===-1?this.#r.measureTextWidth(r):i*this.#r.ch}#fn(e,t,n,r,i,a,o,s){if(a===0)return;let{ch:c,lineHeight:l}=this.#r,u=this.#Bn(n)+r*l,d=`${t}-${n}/${r}-${i}-${a} ${o??``}`,f=this.#D,p=(this.#e.roundedSelection??!0)&&(t===`selection`||t===`caretHighlight`),m=(n,r,i,a)=>{let o=this.#Bn(n)+r*l,s=this.#Ln(n),u=`initial`;s!==void 0&&(s.dataset.lineType===`change-addition`||s.dataset.selectedLine!==void 0)&&(u=getComputedStyle(s).getPropertyValue(`--diffs-line-bg`));let d=`width:${c}px;transform:translateX(${i}px) translateY(${o}px);--diffs-selection-corner-bg:${u}`,p={selectionCorner:``,[a]:``},m=`${t}-block-${n}/${r}-${i}-1ch`,h=m+`-`+a;if(a===`rbl`){let t=m+`-rtl`,n=e.elements.get(t);n!==void 0&&(n.remove(),e.elements.delete(t),h+=`-rtl`,p.rtl=``)}let g=e.elements.get(h);g===void 0&&(f?.has(h)===!0?(g=f.get(h),g.style.cssText=d,f.delete(h)):g=z(`div`,{dataset:t===`caretHighlight`?`caretHighlightRange`:`selectionRange`,style:{cssText:d},children:[z(`div`,{dataset:p})]},e.fragment),e.elements.set(h,g))},h=t=>{let o=i+a,l=t.dataset,u=e.previousSelectionRange;if((u===void 0||u.line!==n||u.wrapLine!==r)&&(e.previousSelectionRange={element:t,line:n,wrapLine:r,left:i,width:a}),u===void 0||o<=u.left)[`rtl`,`rtr`,`rbl`,`rbr`].forEach(e=>{l[e]=``});else{let e=u.line,t=u.wrapLine,a=u.left,s=u.element.dataset,d=a+u.width;a>i&&m(e,t,a-c,`rbr`),delete s.rbl,delete l.rtl,delete l.rtr,o>=d&&delete s.rbr,o>d&&(m(e,t,d,`rbl`),l.rtr=``),o<d&&m(n,r,o,`rtl`),i<a&&(l.rtl=``),l.rbl=``,l.rbr=``}s?.start===!0&&(delete l.rtl,delete l.rbl),s?.end===!0&&(delete l.rtr,delete l.rbr)},g=e.elements.get(d);if(g!==void 0)p&&h(g);else{if(f?.has(d)===!0?(g=f.get(d),f.delete(d)):g=z(`div`,{dataset:o?[t+`Range`,o]:t+`Range`},e.fragment),g.style.width=`${a}px`,g.style.transform=`translateX(${i}px) translateY(${u}px)`,t===`editPredictionInsertion`||t===`editPredictionReplacement`){let e=this.#Ln(n);e!==void 0&&g.style.setProperty(`--diffs-edit-prediction-bg`,getComputedStyle(e).getPropertyValue(`--diffs-line-bg`))}else g.style.removeProperty(`--diffs-edit-prediction-bg`);p&&h(g),e.elements.set(d,g)}}#pn(e,t,n){let{line:r,character:i}=Z(t);if(!this.#Gn(r))return;let[a,o]=this.#Vn(r,i),s=`caret-`+r+`/`+o+`:`+i;if(e.elements.has(s))return;let c=rm(a-1),l=rm(this.#Bn(r)+o*this.#r.lineHeight),u=z(`div`,{dataset:`caret`,style:{transform:`translateX(${c}px) translateY(${l}px)`}},e.fragment);e.elements.set(s,u),n&&(u.style.scrollMargin=this.#jt(),this.#A=u)}#mn(){let e=this.#se?.at(-1),t=this.#E,n=this.#n?.document,r=this.#e.renderSelectionAction,i=()=>{this.#K?.cleanup(),this.#K=void 0};if(this.#e.enabledSelectionAction!==!0||r===void 0||e===void 0||X(e)||this.#ee||t===void 0||n===void 0){i();return}let a=Z(e);if(!this.#Gn(a.line)){i();return}if(this.#K===void 0){if(!this.#q)return;let a=()=>this.#se?.at(-1)??e,o=r({textDocument:n,get selection(){return a()},applyEdits:e=>this.applyEdits(e),getSelectionText:()=>this.#n?.document?.getText(a())??``,replaceSelectionText:e=>{this.#En(e,[a()])},close:()=>{i(),this.#Dt()}});this.#K=new fg(o,t,()=>this.#mn()),this.#We().resetPlacement(Og)}let o=this.#r.lineHeight,s=e.direction===-1,c={placeAbove:s,anchor:a},l=s?{placeAbove:!1,anchor:e.end}:{placeAbove:!0,anchor:e.start},u=this.#K.height,d=e=>{let[t,n]=this.#Vn(e.anchor.line,e.anchor.character),r=this.#Bn(e.anchor.line)+n*o,i=e.placeAbove?r:r+o,a=e.placeAbove?i-u:i;return{top:a,bottom:a+u,left:t,anchorTop:i,rowTop:r}},f=d(c),p=n.lineCount,m=s?a.line<3:a.line>=p-3,h=this.#Gn(l.anchor.line)?d(l):void 0,g=this.#We(),_=g.getPlacementBounds(),v=h!==void 0&&g.choosePlacement({preferred:f,fallback:h,viewport:_,popoverHeight:u,atDocumentEdge:m,placementKey:Og})===`fallback`;h===void 0&&g.setPlacement(`preferred`,Og);let{placeAbove:y}=v?l:c,{left:b,anchorTop:x}=v&&h!==void 0?h:f,S=s?f.rowTop:h?.rowTop??-1/0,C=(s?h?.rowTop??1/0:f.rowTop)+(e.end.line>e.start.line&&e.end.character===0?0:o),w=_===void 0||C>_.top&&S<_.bottom;this.#K.reposition(b,x,this.#Rn(),y,w,_)}#hn(){let e=this.#le;e?.clear();let t=this.#n?.document;if(e==null||this.#ce==null||t==null)return;let n=new Map,r=this.#ce,i=this.#H,a=i!=null&&Number.isFinite(i.totalLines)||this.#He&&this.#Ie?.options.expandUnchanged!==!0?this.#Fn().rendered:void 0,o=0,s=a?.length??1;for(let e=0;e<s;e++){let i=1/0,s=a?.[e];if(s!==void 0){let[e,n]=s,a=t.offsetAt({line:e,character:0}),c=n+1;i=c<t.lineCount?t.offsetAt({line:c,character:0}):t.offsetAt({line:c-1,character:t.getLineLength(c-1)});let l=o,u=r.length;for(;l<u;){let e=l+Math.floor((u-l)/2);r[e][1]<=a?l=e+1:u=e}o=l}for(;o<r.length;o++){let[e,a]=r[o];if(e>=i)break;let c={start:t.positionAt(e),end:t.positionAt(a)},l=this.#ue?.[0]===e&&this.#ue[1]===a,u=Math.max(c.start.line,s?.[0]??0),d=Math.min(c.end.line,s?.[1]??t.lineCount-1);for(let e=u;e<=d;e++){let r=e===c.start.line?c.start.character:0,i=e===c.end.line?c.end.character:t.getLineLength(e);if(i>r){let t=n.get(e+1);t??(t=[],n.set(e+1,t)),t.push({startCharacter:r,endCharacter:i,current:l})}}}}if(this.#w!=null&&n.size>0&&(e.paint(this.#w,(e,t)=>t===`deletions`?void 0:n.get(e)),this.#de)){let t=e.currentMatchRange;this.#de=t==null||!Kp(t)}}__setSearchPanelUnsafeCSS(e){this.#G?.setUnsafeCSS(e)}#gn(e){this.#G===void 0?this.#yn(e):this.#G.setMode(e)}#_n(){let e=this.#Xe();if(e==null)return;let t=0,n;if(e instanceof HTMLElement){let r=e.getBoundingClientRect();t=r.top,n=r.bottom}else n=e.defaultView?.innerHeight??0;let r=this.#S?.shadowRoot?.querySelector(`[data-diffs-header][data-sticky]`);return r!=null&&(t=Math.max(t,r.getBoundingClientRect().bottom)),{top:t,bottom:n}}#vn([e,t],n=this.#_n()){let r=this.#n?.document;if(r==null||n==null)return!1;let i=r.positionAt(e),a=r.positionAt(Math.max(e,t-1)),o=this.#Ln(i.line),s=this.#Ln(a.line);if(o==null||s==null)return!1;let c=this.#Vn(i.line,i.character)[1],l=this.#Vn(a.line,a.character)[1],u=o.getBoundingClientRect(),d=s.getBoundingClientRect();if(u.height===0||d.height===0)return!1;let f=u.top+c*this.#r.lineHeight,p=d.top+(l+1)*this.#r.lineHeight;return p>f&&f>=n.top&&p<=n.bottom}#yn(e){this.#G?.cleanup();let t=this.#n?.document,n=this.#S?.shadowRoot?.querySelector(`pre`),r=this.#se;if(t===void 0||n==null)return;this.#le??=Zp.create(n.ownerDocument);let i=op(t,r?.at(-1));this.#ue=void 0;let a=!1,o=(e,n)=>{this.#ue=e,this.#de=!0;let r=t.positionAt(e[0]);this.#Be(r.line),this.#fe=void 0,this.#me=!1,(a||!this.#vn(e))&&(a=!0,this.#Mt(r.line,r.character,!0)),this.#hn(),this.#ge=n},s=new nm({containerElement:n,unsafeCSS:this.#M?.options.unsafeCSS,defaultQuery:i,mode:e,onQueryChange:()=>{a=!1},search:e=>this.#bn(t,e),scrollToMatch:o,replace:{replaceMatch:(e,t)=>this.replaceSearchMatches([e],t),replaceAll:(e,t)=>{this.replaceSearchMatches(e,t)}},onUpdate:({matches:e,preferredMatch:t},n)=>{let r=this.#ue;this.#ce=e.length>0?e:void 0;let i=t=>{let n=0,r=e.length;for(;n<r;){let i=Math.floor((n+r)/2);e[i][0]<t?n=i+1:r=i}return n<e.length?n:void 0};if(n?.skipNavigation===!0){let t=r==null?void 0:i(r[0]),n=t==null?void 0:e[t],a=n!=null&&r!=null&&n[0]===r[0]&&n[1]===r[1];return this.#ue=a?n:void 0,a||(this.#de=!1),this.#hn(),a?t:void 0}let a=r!=null&&r[0]===r[1]?i(r[1]):t==null?void 0:i(t[0]);if(a==null)this.#ue=void 0,this.#de=!1,this.#hn();else return o(e[a],!0),a},onClose:()=>{this.#G=void 0,this.#ge=!1,this.#ce=void 0,this.#ue=void 0,this.#de=!1,this.#hn()}});this.#G=s,this.#ge=!1,s.mount()}#bn(e,t){let n=this.#_n(),{visible:r,anchorLine:i}=this.#Fn(n),a=i==null?void 0:e.offsetAt({line:i,character:0}),o=r.map(([t,n])=>[e.offsetAt({line:t,character:0}),e.offsetAt({line:n,character:e.getLineLength(n)})]),s=0,c,l,u=e.search(t,void 0,(e,t)=>{let[r]=e;for(;s<o.length&&r>o[s][1];)s++;c==null&&s<o.length&&r>=o[s][0]&&this.#vn(e,n)&&(c=t),l==null&&a!=null&&r>=a&&(l=t)});return{matches:u,preferredMatch:u[c??l??0]}}#xn(){let e=this.#n?.document,t=this.#se;return e===void 0||t===void 0?``:$f(e,t)}#Sn(){let e=this.#n?.document,t=this.#se;return e===void 0||t===void 0?[]:Qf(e,t)}#Cn(e,t,n){e!==null&&(e.setData(`text`,t),n.length>1&&e.setData(kg,JSON.stringify(n)))}#wn(){let e=this.#n?.document,t=this.#se;if(e===void 0||t===void 0||t.length===0)return``;if(t.some(e=>X(e))){let n=ip(e,t);return this.#Tn(n.edits,n.nextSelectionOffsets),n.text}let n=$f(e,t);return this.#En(``,void 0,!0),n}#Tn(e,t){let n=this.#n?.document,r=this.#se;if(n===void 0||r===void 0||e.length===0)return;let i=n.applyResolvedEdits(e,!0,r,void 0,!0);if(i===void 0)return;let a=t.map(e=>{let t=n.positionAt(e);return{start:t,end:t,direction:0}});n.setLastUndoSelectionsAfter(a),this.#Mn(i,a,this.#Pn(i))}#En(e,t=this.#se,n=!1,r=`selection`){if(t===void 0)return;let i=this.#n?.document,a=t.at(-1);if(i===void 0||a===void 0)return;let{nextSelections:o,change:s}=Array.isArray(e)&&e.length===t.length?Df(i,t,e,this.#L,n,r):wf(i,t,{start:i.offsetAt(a.start),end:i.offsetAt(a.end),text:Array.isArray(e)?e.join(`
|
|
1179
|
+
`):e},this.#L,void 0,n);s!==void 0&&this.#Mn(s,o,this.#Pn(s))}#Dn(e=!1){let t=this.#se,n=this.#n?.document;if(t===void 0||n===void 0)return;let{nextSelections:r,change:i}=Ff(n,t,e,this.#L,this.#r.tabSize);i!==void 0&&this.#Mn(i,r,this.#Pn(i))}#On(){let e=this.#se,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Mf(t,e,this.#Ue?(e,t)=>{let n=this.#Un(e);for(let e=0;e+1<n.length;e++){let r=n[e],i=n[e+1];if(t>=r&&t<=i)return r}return 0}:void 0,this.#L);r!==void 0&&this.#Mn(r,n,this.#Pn(r))}#kn(){let e=this.#se,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Nf(t,e,this.#L);r!==void 0&&this.#Mn(r,n,this.#Pn(r))}#An(){let e=this.#se,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=jf(t,e,this.#L);r!==void 0&&this.#Mn(r,n,this.#Pn(r))}#jn(){let e=this.#se,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Af(t,e,this.#L);r!==void 0&&this.#Mn(r,n,this.#Pn(r))}#Mn(e,t,n,r){this.#we!=null&&this.#tn(!0);let i=this.#n?.document;if(i!==void 0&&this.#W!==void 0)for(let t of this.#W)t.anchorOffset=zf(t.anchorOffset,e.changes),t.focusOffset=zf(t.focusOffset,e.changes),t.caret.anchor=i.positionAt(t.anchorOffset),t.caret.focus=i.positionAt(t.focusOffset);if(e.lineDelta!==0||this.#Ue)for(let t of this.#h.keys())t>=e.startLine&&this.#h.delete(t);if(this.#g.size>0){if(e.lineDelta===0&&(e.changedLineRanges.length===1||e.changedLineChanges?.every(([,,e])=>e===0)===!0))for(let[t,n]of e.changedLineRanges)for(let e=t;e<=n;e++)this.#g.delete(e);else for(let t of this.#g.keys())t>=e.startLine&&this.#g.delete(t)}if(this.#_=void 0,this.#F&&this.#i!=null&&this.#w!=null?this.#gt(e,n):i!=null&&(this.#N?.(i,e,{tokens:this.#i?.tokenize(e,this.#H),lineAnnotations:n}),n!=null&&(this.#L=n)),t!=null&&this.#sn(t),this.#Ne(),this.#in(e,r?.editSource??`user`),this.#rn(),this.#Nn(e.changes,n??this.#L),r?.skipSearchRefresh!==!0&&this.#G!==void 0&&this.#G.updateMatches({skipNavigation:!0}),t!=null&&r?.skipFocus!==!0){let e=t.at(-1);if(e!==void 0&&this.#Be(Z(e).line),this.#Le!==void 0)this.#Ot(`nearest`);else if(this.#A!==void 0)requestAnimationFrame(()=>{this.#A?.scrollIntoView({block:`nearest`,inline:`nearest`})});else if(t.length>0){let e=Z(t.at(-1));this.#Mt(e.line,e.character)}this.focus({preventScroll:!0})}}#Nn(e,t){let n=this.getFile(),r=this.#P;if(n!=null&&r!=null){this.#u=!0;try{r(e,n,t)}catch(e){console.error(e)}finally{this.#u=!1}}}#Pn(e){if(this.#L!=null){let t=of(e,this.#L);if(t!=null)return this.#n?.document?.setLastUndoLineAnnotations(this.#L,t),t}}#Fn(e){let t=[],n=[],r,i=this.#w?.children;if(i==null)return{rendered:t,visible:n,anchorLine:r};let a=this.#n?.document,o=e!=null&&a!=null&&this.#H==null&&(!this.#He||this.#Ie?.options.expandUnchanged===!0);o&&t.push([0,a.lineCount-1]);let s=0;if(e!=null&&this.#Le==null){let t=i.length;for(;s<t;){let n=s+Math.floor((t-s)/2);i[n].getBoundingClientRect().bottom<=e.top?s=n+1:t=n}}let c=(e,t)=>{let n=e.at(-1);n!=null&&t<=n[1]+1?n[1]=Math.max(n[1],t):e.push([t,t])},l=e!=null&&e.bottom<=e.top;for(let a=o?s:0;a<i.length;a++){let u=i[a],d=u.dataset.lineType,f=tr(u);if(f==null||d==null||!If(d))continue;let p=f-1;if(o||c(t,p),e==null||l||a<s)continue;let m=u.getBoundingClientRect();if(m.top>=e.top&&(r??=p),m.top>=e.bottom){if(l=!0,o)break}else m.bottom>e.top&&c(n,p)}return{rendered:t,visible:n,anchorLine:r}}#In(e){let t=this.#H;return t==null||e>=t.startingLine&&e<t.startingLine+t.totalLines}#Ln(e){return this.#M?.lineElement(e)}#Rn(){if(this.#C===void 0)return 0;if(this.#p===void 0){let e=this.#w?.parentElement?.style.getPropertyValue(`--diffs-column-number-width`);this.#p=e!==void 0&&e.length>2&&e.endsWith(`px`)?parseInt(e.slice(0,-2),10):this.#C.offsetWidth}return this.#p}#zn(){if(this.#w===void 0)return 0;if(this.#m===void 0){let e=this.#w.parentElement?.style.getPropertyValue(`--diffs-column-content-width`);this.#m=e!==void 0&&e.length>2&&e.endsWith(`px`)?parseFloat(e.slice(0,-2)):this.#w.offsetWidth}return this.#m}#Bn(e){let t=this.#h.get(e);if(t!==void 0)return t;let n=this.#Ln(e);if(n===void 0)return-1;let r=n.offsetTop+this.#r.paddingTop;return r+=this.#st?.top??0,this.#h.set(e,r),r}#Vn(e,t){if(this.#_!==void 0&&this.#_[0]===e&&this.#_[1]===t)return[this.#_[2],this.#_[3]];let n=this.#n?.document?.getLineText(e),r=this.#Rn()+this.#r.ch;if(n===void 0||n.length===0||t<=0)return[r+(this.#st?.left??0),0];let i=_g(n,Math.min(t,n.length)),a=n.slice(0,i),o=yg(a,this.#r.tabSize),s=0,c=0;if(s=o===-1?r+this.#r.measureTextWidth(a):r+o*this.#r.ch,this.#Ue){let t=this.#zn();if(2*this.#r.ch+this.#r.measureTextWidth(n)>t){let t=this.#Hn(e);if(t==null)return[s+(this.#st?.left??0),0];for(let e=0;e+1<t.length;e++){let a=t[e];if(i<=t[e+1]){c=e;let t=n.slice(a,i),o=yg(t,this.#r.tabSize);s=o===-1?r+this.#r.measureTextWidth(t):r+o*this.#r.ch;break}}}s+=this.#st?.left??0}return this.#_===void 0?this.#_=[e,t,s,c]:(this.#_[0]=e,this.#_[1]=t,this.#_[2]=s,this.#_[3]=c),[s,c]}#Hn(e){let t=this.#g.get(e);if(t!==void 0)return t;this.#g.size>=Cg&&this.#g.clear();let n=this.#n?.document?.getLineText(e);if(n===void 0||n.length===0){let t=new Uint32Array([0]);return this.#g.set(e,t),t}let r=this.#w;if(r==null||!r.isConnected)return;let i=z(`div`,{style:{position:`absolute`,top:`0`,left:`0`,width:`100%`,boxSizing:`border-box`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,font:`inherit`,paddingInline:`1ch`,tabSize:this.#r.tabSize.toString()},textContent:n},r),a=i.firstChild,o=document.createRange(),s=[];try{let t=i.getBoundingClientRect();if(t.width===0)return;let r=vg(n),c=t.left+this.#r.ch,l=r===void 0?n.length:r.length-1,u=e=>r===void 0?e:r[e],d=e=>{o.setStart(a,u(e)),o.setEnd(a,u(e+1));let t=o.getClientRects();return t.item(t.length-1)??o.getBoundingClientRect()};s.push(0);let f=d(0).top,p=1;for(;p<l;){let e=p,t=l;for(;e<t;){let n=e+t>>1;d(n).top>f?t=n:e=n+1}if(e>=l)break;let{left:n,top:r}=d(e),i=Sn()&&n-c>this.#r.ch/2;s.push(u(i?e-1:e)),f=r,p=e+1}let m=new Uint32Array(s.length+1);for(let e=0;e<s.length;e++)m[e]=s[e];return m[s.length]=n.length,this.#g.set(e,m),m}finally{i.remove()}}#Un(e){let t=this.#Hn(e);if(t!==void 0)return t;let n=this.#n?.document?.getLineText(e)?.length??0;return Uint32Array.of(0,n)}#Wn({startContainer:e,endContainer:t}){let n=this.#w;return n!==void 0&&n.contains(e)&&n.contains(t)}#Gn(e){let t=this.#n?.document?.lineCount??0;return e<0||e>=t?!1:this.#Ln(e)!==void 0}};function jg({type:e,editStateKey:t,owner:n,initialState:r,previousSession:i}){if(r!=null&&r.type!==e)throw TypeError(`Editor: initialState: a ${r.type} state cannot initialize a ${e} editor`);let a=r;return t==null?a??i??(e===`file`?{type:`file`}:{type:`file-diff`}):oh.activate(e,t,n,a)}function Mg(e){return e instanceof HTMLElement?Number(e.dataset.bufferSize??1):1}function Ng(e,t){return t!==void 0&&Number.isInteger(t.line)&&Number.isInteger(t.character)&&t.line>=0&&t.line<e.lineCount&&t.character>=0&&t.character<=e.getLineLength(t.line)}function Pg(e,t){let n=e.charCodeAt(t-1),r=e.charCodeAt(t);return t>0&&t<e.length&&n>=55296&&n<=56319&&r>=56320&&r<=57343}function Fg({kind:e,rangeLabel:t,text:r,onCancel:i,onComment:a,onDelete:s}){let[l,u]=V.useState(``),d=V.useRef(null);if(V.useLayoutEffect(()=>{if(e!==`draft`)return;let t=requestAnimationFrame(()=>d.current?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(t)},[e]),e===`comment`)return(0,$.jsxs)(`div`,{"data-comment-annotation":!0,contentEditable:!1,onPointerDown:e=>e.stopPropagation(),className:`group/comment flex min-w-0 items-start gap-2.5 border-s-2 border-primary/55 bg-primary/[0.045] px-3 py-2.5 font-sans text-foreground`,children:[(0,$.jsx)(n,{className:`size-3.5 h-5 shrink-0 text-primary/70`,"aria-hidden":`true`}),(0,$.jsx)(`p`,{className:`min-w-0 flex-1 text-sm leading-5 whitespace-pre-wrap`,children:r}),s&&(0,$.jsx)(`span`,{className:`-my-1 -mr-1 flex shrink-0 opacity-0 transition-opacity group-hover/comment:opacity-100 focus-within:opacity-100`,children:(0,$.jsx)(c,{variant:`ghost-muted`,size:`icon-xs`,"aria-label":`Delete comment`,onClick:s,children:(0,$.jsx)(o,{className:`size-3`})})})]});let f=l.trim();return(0,$.jsxs)(`div`,{"data-comment-annotation":!0,contentEditable:!1,onPointerDown:e=>e.stopPropagation(),className:`px-3 py-2 font-sans text-foreground caret-foreground`,children:[(0,$.jsx)(xe,{ref:d,value:l,placeholder:`Add a comment…`,"aria-label":`Comment on lines ${t}`,className:`text-sm`,onChange:e=>u(e.target.value),onKeyDown:e=>{e.nativeEvent.isComposing?e.stopPropagation():(e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i()),(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&f&&(e.preventDefault(),a(f)))}}),(0,$.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`mr-auto text-[10px] text-muted-foreground/70`,children:`⌘/Ctrl Enter to send`}),(0,$.jsx)(c,{variant:`ghost-muted`,size:`xs`,onClick:i,children:`Cancel`}),(0,$.jsx)(c,{size:`xs`,disabled:!f,onClick:()=>a(f),children:`Comment`})]})]})}var Ig=(e,t,n)=>new Ag(e,t,n),Lg=`data-file-line-reveal`,Rg=`
|
|
1180
|
+
diffs-container {
|
|
1181
|
+
--diffs-bg: var(--code-surface) !important;
|
|
1182
|
+
--diffs-light-bg: var(--code-surface) !important;
|
|
1183
|
+
--diffs-dark-bg: var(--code-surface) !important;
|
|
1184
|
+
--diffs-font-family: var(--font-mono) !important;
|
|
1185
|
+
background-color: var(--code-surface) !important;
|
|
1186
|
+
color: var(--foreground) !important;
|
|
1187
|
+
}
|
|
1188
|
+
[data-file] { transition: none; }
|
|
1189
|
+
[${Lg}][data-line] {
|
|
1190
|
+
--diffs-line-bg: color-mix(in lab, var(--diffs-computed-diff-line-bg) 78%, var(--diffs-bg-selection-override, var(--diffs-selection-base))) !important;
|
|
1191
|
+
}
|
|
1192
|
+
[${Lg}][data-column-number] {
|
|
1193
|
+
background-color: color-mix(in lab, var(--diffs-computed-diff-line-bg) 68%, var(--diffs-bg-selection-number-override, var(--diffs-selection-base))) !important;
|
|
1194
|
+
color: var(--diffs-selection-number-fg) !important;
|
|
1195
|
+
}
|
|
1196
|
+
`;function zg(e){return e.map(e=>({...e,metadata:{entries:e.metadata.entries.map(t=>({...t,endLine:e.lineNumber,startLine:Math.max(1,e.lineNumber-(t.endLine-t.startLine))}))}}))}var Bg=(e,t,n)=>e.split(`
|
|
1197
|
+
`).slice(t-1,n).join(`
|
|
1198
|
+
`);function Vg({projectId:e,path:t,contents:n,hash:r,readOnly:i,dark:a,wrap:o,revealLine:s,revealId:c}){let l=pe(e),u=V.useMemo(()=>new Set(l.map(e=>e.id)),[l]),[d,f]=V.useState([]),[p,m]=V.useState(null),h=V.useRef(null),g=V.useRef(null),[_,v]=V.useState(()=>({name:t,contents:n,cacheKey:`editor:${e}:${t}:${r}`})),[y,b]=V.useState(null);n!==(y??_.contents)&&(v({name:t,contents:n,cacheKey:`editor:${e}:${t}:${r}`}),b(null));let x=V.useRef(n);x.current=y??_.contents,V.useEffect(()=>{i||me(e,t,r)},[e,t,r,i]),V.useEffect(()=>()=>ke(e,t),[e,t]);let S={onAttach:e=>{h.current=e},onComplete:()=>{h.current=null}},C=({file:n,lineAnnotations:r})=>{if(n.contents===x.current||(b(n.contents),de(e,t,n.contents),!r))return;let i=zg(r);f(e=>e===r?e:i);for(let r of i)for(let i of r.metadata.entries)i.kind===`comment`&&u.has(i.id)&&Le(e,{id:i.id,filePath:t,startLine:i.startLine,endLine:i.endLine,text:i.text,lines:Bg(n.contents,i.startLine,i.endLine)})},w=t=>{m(null),Ke(e,t),f(e=>e.flatMap(e=>{let n=e.metadata.entries.filter(e=>e.id!==t);return n.length?[{...e,metadata:{entries:n}}]:[]}))},T=(n,r)=>{m(null);let i=d.flatMap(e=>e.metadata.entries).find(e=>e.id===n);i&&Le(e,{id:n,filePath:t,startLine:i.startLine,endLine:i.endLine,text:r,lines:Bg(x.current,i.startLine,i.endLine)}),f(e=>e.map(e=>({...e,metadata:{entries:e.metadata.entries.map(e=>e.id===n?{...e,kind:`comment`,text:r}:e)}})))},E=e=>{h.current?.setSelections([]),h.current?.blur();let t=Math.min(e.start,e.end),n=Math.max(e.start,e.end),r={id:ce(),kind:`draft`,startLine:t,endLine:n,text:``};f(e=>{let t=e.flatMap(e=>{let t=e.metadata.entries.filter(e=>e.kind!==`draft`);return t.length?[{...e,metadata:{entries:t}}]:[]}),i=t.findIndex(e=>e.lineNumber===n);return i<0?[...t,{lineNumber:n,metadata:{entries:[r]}}]:t.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,r]}}:e)})},D=d.some(e=>e.metadata.entries.some(e=>e.kind===`draft`));V.useEffect(()=>{let e=g.current;if(!e)return;let t=()=>{m(null),h.current?.setSelections([]);let t=e.querySelector(`diffs-container`)?.shadowRoot?.activeElement;t instanceof HTMLElement&&t.blur()},n=n=>{D||n.composedPath().includes(e)||t()},r=n=>{n.key!==`Escape`||D||(e.querySelector(`diffs-container`)?.shadowRoot?.activeElement)?.hasAttribute(`data-content`)&&(n.stopImmediatePropagation(),n.isComposing||(n.preventDefault(),t()))};return document.addEventListener(`pointerdown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`pointerdown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[D]);let ee=V.useRef(-1);return(0,$.jsx)(dn,{createEditor:Ig,children:(0,$.jsx)(`div`,{ref:g,className:`flex min-h-0 flex-1`,style:{"--code-surface":a?`var(--background)`:`color-mix(in srgb, var(--card) 90%, var(--background))`},children:(0,$.jsx)(xn,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:(0,$.jsx)(pm,{file:_,edit:!i,disableWorkerPool:!0,editorOptions:S,onEditChange:C,options:{disableFileHeader:!0,enableGutterUtility:!i&&!D,enableLineSelection:!i&&!D,onGutterUtilityClick:m,onLineSelectionChange:m,onLineSelectionEnd:e=>{m(e),e&&E(e)},overflow:o?`wrap`:`scroll`,theme:ie(a),themeType:a?`dark`:`light`,preferredHighlighter:be,unsafeCSS:Rg,onPostRender:(e,t,n)=>{if(n===`unmount`)return;let r=e.shadowRoot??e;for(let e of r.querySelectorAll(`[${Lg}]`))e.removeAttribute(Lg);if(s===null)return;let i=(t.file?.contents??``).split(`
|
|
1199
|
+
`).length,a=Math.min(Math.max(1,s),i);if(r.querySelector(`[data-line="${a}"]`)?.setAttribute(Lg,``),r.querySelector(`[data-column-number="${a}"]`)?.setAttribute(Lg,``),ee.current===c)return;let o=e.closest(`.file-preview-virtualizer`);if(!o)return;ee.current=c;let l=r.querySelector(`[data-line]`)?.getBoundingClientRect().height||20;requestAnimationFrame(()=>{o.scrollTop=Math.max(0,(a-1)*l-o.clientHeight/2+l/2)}),requestAnimationFrame(()=>t.setSelectedLines(p,{notify:!1}))}},selectedLines:p,lineAnnotations:d,renderAnnotation:e=>{let t=e.metadata.entries.filter(e=>e.kind===`draft`||u.has(e.id));return t.length?(0,$.jsx)(`div`,{className:`py-1`,children:t.map(e=>(0,$.jsx)(Fg,{kind:e.kind,rangeLabel:We(e.startLine,e.endLine),text:e.text,onCancel:()=>w(e.id),onComment:t=>T(e.id,t),onDelete:()=>w(e.id)},e.id))}):null},className:`min-h-full`})})})})}var Hg=`forge.fileExplorerOpen`,Ug=`forge.renderMarkdown`,Wg=/\.(png|jpe?g|gif|webp|avif|bmp|ico|svg)$/i,Gg=/\.(md|mdx|markdown|mdown|mkd)$/i;function Kg(e,t){let[n,r]=V.useState(()=>{let n=localStorage.getItem(e);return n===null?t:n===`true`});return[n,V.useCallback(t=>{r(t),localStorage.setItem(e,String(t))},[e])]}var qg=(e,t,n=!1)=>`/api/files/${encodeURIComponent(e)}/raw?path=${encodeURIComponent(t)}${n?`&download=1`:``}`;function Jg(e,t){let n=document.createElement(`a`);n.href=qg(e,t,!0),n.download=t.slice(t.lastIndexOf(`/`)+1),n.click()}function Yg({projectId:e,path:t}){let n=ne(),r=Ge(),a=f(),o=te(),s=_(n.projects.get.queryOptions({id:e})),u=s.data?.name||`Project`,d=!!t&&Wg.test(t),p=!!t&&Gg.test(t),m=_({...n.files.read.queryOptions({projectId:e,path:t||``}),enabled:!!t&&!d,staleTime:1/0}),[h,g]=Kg(Hg,!0),[b,C]=Kg(Ug,!1),[T,E]=V.useState(!0),[D,ee]=V.useState(!1),O=je(e,t||``),k=o.fileReveal&&o.fileReveal.path===t?o.fileReveal:null,j=m.data,M=!!j&&!j.binary&&!j.tooLarge,N=p&&b&&M&&!k?.line,re=!!t&&!d&&M&&!N,ie=t?ve(e,t):null,ae=M?ie??j.content:null,se=()=>r.invalidateQueries({queryKey:n.files.read.queryKey({projectId:e,path:t||``})}),ce=async()=>{if(ae!==null)try{await navigator.clipboard.writeText(ae),ee(!0),setTimeout(()=>ee(!1),1500)}catch(e){xm.error(`Could not copy file`,{description:e.message})}},le=e=>{A({panelTab:`files`,closedTabs:(o.closedTabs||[]).filter(e=>e!==`files`),fileReveal:e?{path:e,line:null,id:Date.now()}:null})},ue=(0,$.jsx)(Vm,{projectId:e,selectedPath:t??o.fileReveal?.path??null,revealId:t?k?.id:o.fileReveal?.id,onOpenFile:e=>i(e),onRefreshSelected:t&&!d?se:void 0});return t?(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-background`,children:[(0,$.jsxs)(`div`,{className:Ne,"data-surface-subheader":!0,children:[(0,$.jsx)(Qm,{projectId:e,projectName:u,path:t,onOpenFile:e=>i(e),onOpenFolder:le}),p&&M&&(0,$.jsx)(He,{label:N?`Show markdown source`:`Show rendered markdown`,pressed:N,onPress:()=>{C(!N),!N&&k?.line&&A({fileReveal:{...k,line:null}})},children:N?(0,$.jsx)(l,{}):(0,$.jsx)(y,{})}),re&&(0,$.jsx)(He,{label:T?`Disable word wrap`:`Enable word wrap`,pressed:T,onPress:()=>E(!T),children:(0,$.jsx)(S,{})}),ae!==null&&ae.length>0&&(0,$.jsx)(He,{label:D?`Copied`:`Copy contents`,onPress:ce,children:D?(0,$.jsx)(v,{}):(0,$.jsx)(w,{})}),!!j&&(j.binary||j.tooLarge)&&(0,$.jsx)(He,{label:`Save file`,onPress:()=>Jg(e,t),children:(0,$.jsx)(x,{})}),(0,$.jsx)(He,{label:h?`Hide file explorer`:`Show file explorer`,pressed:h,onPress:()=>g(!h),children:(0,$.jsx)(De,{})})]}),M&&j.readOnly&&(0,$.jsx)(Fe,{tone:`muted`,children:`Read-only: this file is owned by the workspace engine (pull and push update it).`}),O&&(0,$.jsxs)(Fe,{tone:O.kind===`conflict`?`warning`:`error`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:O.kind===`conflict`?`This file changed on disk since you started editing. Your edits are not saved.`:`Not saved: ${O.message}`}),(0,$.jsx)(c,{size:`xs`,variant:`outline`,onClick:()=>{Re(e,t,`reload`),se()},children:`Reload`}),(0,$.jsx)(c,{size:`xs`,variant:`outline`,onClick:async()=>{let i=await r.fetchQuery({...n.files.read.queryOptions({projectId:e,path:t}),staleTime:0});Re(e,t,`overwrite`,i.hash)},children:O.kind===`conflict`?`Overwrite`:`Retry`})]}),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:d?(0,$.jsx)(Xg,{projectId:e,path:t}):m.isLoading?(0,$.jsx)(oe,{}):m.error?(0,$.jsx)(`div`,{role:`alert`,className:`flex min-h-0 flex-1 flex-col overflow-auto`,children:(0,$.jsxs)(`div`,{className:`my-auto flex shrink-0 flex-col gap-3 px-6 py-6 text-center text-xs leading-relaxed`,children:[(0,$.jsx)(`p`,{className:`text-destructive-foreground`,children:m.error.data?.code===`NOT_FOUND`?`The file could not be accessed or read. It may be missing or inaccessible.`:m.error.data?.code===`BAD_REQUEST`?`The requested path is outside the workspace.`:m.error.message}),(0,$.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Attempted path`,(0,$.jsx)(`code`,{className:`block font-mono break-all text-foreground select-all`,children:t})]}),(0,$.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Workspace folder:`,` `,(0,$.jsx)(`code`,{className:`font-mono break-all select-all`,children:s.data?.path||``}),`. Check the link's path or locate the file in Files.`]})]})}):j&&(j.binary||j.tooLarge)?(0,$.jsx)(we,{message:(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[j.binary?`The file is binary and cannot be displayed as text.`:`The file is ${(j.size/1024/1024).toFixed(1)} MB, over the 2 MB the editor opens.`,` `,(0,$.jsx)(`button`,{type:`button`,onClick:()=>Jg(e,t),className:`cursor-pointer text-foreground underline underline-offset-2`,children:`Download it`})]})}):j&&N?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-6 py-5`,tabIndex:-1,onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()===`a`&&(e.preventDefault(),window.getSelection()?.selectAllChildren(e.currentTarget))},children:(0,$.jsx)(`div`,{className:`mx-auto max-w-3xl`,children:(0,$.jsx)(Se,{text:ie??j.content})})}):j?(0,$.jsx)(Vg,{projectId:e,path:j.path,contents:Ye(e,t)?ie??j.content:j.content,hash:j.hash,readOnly:!!j.readOnly,dark:a,wrap:T,revealLine:k?.line??null,revealId:k?.id??0},`${t}:${a?`dark`:`light`}`):null}),h&&(0,$.jsx)(qm,{resizable:!0,children:ue})]})]}):(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-background`,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:(0,$.jsx)(qm,{resizable:!1,children:ue})})})}function Xg({projectId:e,path:t}){let[n,r]=V.useState(`loading`),[i,a]=V.useState(0),o=`${qg(e,t)}&v=${i}`;return n===`error`?(0,$.jsx)(we,{message:`Unable to load workspace image.`,onRetry:()=>{r(`loading`),a(e=>e+1)}}):(0,$.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:[n===`loading`&&(0,$.jsx)(oe,{className:`absolute inset-0`}),(0,$.jsx)(`img`,{src:o,alt:t,onLoad:()=>r(`ok`),onError:()=>r(`error`),className:d(`max-h-full max-w-full object-contain`,n!==`ok`&&`invisible`)})]})}export{Yg as FilePanel};
|