@kilocode/cli-darwin-arm64 7.3.42 → 7.3.44
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/bin/console/assets/abap-BdImnpbu.js +1 -0
- package/bin/console/assets/actionscript-3-CfeIJUat.js +1 -0
- package/bin/console/assets/ada-bCR0ucgS.js +1 -0
- package/bin/console/assets/andromeeda-C-Jbm3Hp.js +1 -0
- package/bin/console/assets/angular-html-CU67Zn6k.js +1 -0
- package/bin/console/assets/angular-ts-BwZT4LLn.js +1 -0
- package/bin/console/assets/apache-Pmp26Uib.js +1 -0
- package/bin/console/assets/apex-DDbsPZ6N.js +1 -0
- package/bin/console/assets/apl-dKokRX4l.js +1 -0
- package/bin/console/assets/applescript-Co6uUVPk.js +1 -0
- package/bin/console/assets/ara-BRHolxvo.js +1 -0
- package/bin/console/assets/asciidoc-Dv7Oe6Be.js +1 -0
- package/bin/console/assets/asm-D_Q5rh1f.js +1 -0
- package/bin/console/assets/astro-CbQHKStN.js +1 -0
- package/bin/console/assets/aurora-x-D-2ljcwZ.js +1 -0
- package/bin/console/assets/awk-DMzUqQB5.js +1 -0
- package/bin/console/assets/ayu-dark-Cv9koXgw.js +1 -0
- package/bin/console/assets/ballerina-BFfxhgS-.js +1 -0
- package/bin/console/assets/bat-BkioyH1T.js +1 -0
- package/bin/console/assets/beancount-k_qm7-4y.js +1 -0
- package/bin/console/assets/berry-uYugtg8r.js +1 -0
- package/bin/console/assets/bibtex-CHM0blh-.js +1 -0
- package/bin/console/assets/bicep-Bmn6On1c.js +1 -0
- package/bin/console/assets/blade-DVc8C-J4.js +1 -0
- package/bin/console/assets/bsl-BO_Y6i37.js +1 -0
- package/bin/console/assets/c-BIGW1oBm.js +1 -0
- package/bin/console/assets/cadence-Bv_4Rxtq.js +1 -0
- package/bin/console/assets/cairo-KRGpt6FW.js +1 -0
- package/bin/console/assets/catppuccin-frappe-DFWUc33u.js +1 -0
- package/bin/console/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
- package/bin/console/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
- package/bin/console/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
- package/bin/console/assets/clarity-D53aC0YG.js +1 -0
- package/bin/console/assets/clojure-P80f7IUj.js +1 -0
- package/bin/console/assets/cmake-D1j8_8rp.js +1 -0
- package/bin/console/assets/cobol-nwyudZeR.js +1 -0
- package/bin/console/assets/codeowners-Bp6g37R7.js +1 -0
- package/bin/console/assets/codeql-DsOJ9woJ.js +1 -0
- package/bin/console/assets/coffee-Ch7k5sss.js +1 -0
- package/bin/console/assets/common-lisp-Cg-RD9OK.js +1 -0
- package/bin/console/assets/coq-DkFqJrB1.js +1 -0
- package/bin/console/assets/cpp-CofmeUqb.js +1 -0
- package/bin/console/assets/crystal-tKQVLTB8.js +1 -0
- package/bin/console/assets/csharp-K5feNrxe.js +1 -0
- package/bin/console/assets/css-DPfMkruS.js +1 -0
- package/bin/console/assets/csv-fuZLfV_i.js +1 -0
- package/bin/console/assets/cue-D82EKSYY.js +1 -0
- package/bin/console/assets/cypher-COkxafJQ.js +1 -0
- package/bin/console/assets/d-85-TOEBH.js +1 -0
- package/bin/console/assets/dark-plus-C3mMm8J8.js +1 -0
- package/bin/console/assets/dart-CF10PKvl.js +1 -0
- package/bin/console/assets/dax-CEL-wOlO.js +1 -0
- package/bin/console/assets/desktop-BmXAJ9_W.js +1 -0
- package/bin/console/assets/diff-D97Zzqfu.js +1 -0
- package/bin/console/assets/docker-BcOcwvcX.js +1 -0
- package/bin/console/assets/dotenv-Da5cRb03.js +1 -0
- package/bin/console/assets/dracula-BzJJZx-M.js +1 -0
- package/bin/console/assets/dracula-soft-BXkSAIEj.js +1 -0
- package/bin/console/assets/dream-maker-BtqSS_iP.js +1 -0
- package/bin/console/assets/edge-BkV0erSs.js +1 -0
- package/bin/console/assets/elixir-CDX3lj18.js +1 -0
- package/bin/console/assets/elm-DbKCFpqz.js +1 -0
- package/bin/console/assets/emacs-lisp-C9XAeP06.js +1 -0
- package/bin/console/assets/erb-BOJIQeun.js +1 -0
- package/bin/console/assets/erlang-DsQrWhSR.js +1 -0
- package/bin/console/assets/everforest-dark-BgDCqdQA.js +1 -0
- package/bin/console/assets/everforest-light-C8M2exoo.js +1 -0
- package/bin/console/assets/fennel-BYunw83y.js +1 -0
- package/bin/console/assets/fish-BvzEVeQv.js +1 -0
- package/bin/console/assets/fluent-C4IJs8-o.js +1 -0
- package/bin/console/assets/fortran-fixed-form-BZjJHVRy.js +1 -0
- package/bin/console/assets/fortran-free-form-D22FLkUw.js +1 -0
- package/bin/console/assets/fsharp-CXgrBDvD.js +1 -0
- package/bin/console/assets/gdresource-B7Tvp0Sc.js +1 -0
- package/bin/console/assets/gdscript-DTMYz4Jt.js +1 -0
- package/bin/console/assets/gdshader-DkwncUOv.js +1 -0
- package/bin/console/assets/genie-D0YGMca9.js +1 -0
- package/bin/console/assets/gherkin-DyxjwDmM.js +1 -0
- package/bin/console/assets/git-commit-F4YmCXRG.js +1 -0
- package/bin/console/assets/git-rebase-r7XF79zn.js +1 -0
- package/bin/console/assets/github-dark-DHJKELXO.js +1 -0
- package/bin/console/assets/github-dark-default-Cuk6v7N8.js +1 -0
- package/bin/console/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/bin/console/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
- package/bin/console/assets/github-light-DAi9KRSo.js +1 -0
- package/bin/console/assets/github-light-default-D7oLnXFd.js +1 -0
- package/bin/console/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
- package/bin/console/assets/gleam-BspZqrRM.js +1 -0
- package/bin/console/assets/glimmer-js-Rg0-pVw9.js +1 -0
- package/bin/console/assets/glimmer-ts-U6CK756n.js +1 -0
- package/bin/console/assets/glsl-DplSGwfg.js +1 -0
- package/bin/console/assets/gnuplot-DdkO51Og.js +1 -0
- package/bin/console/assets/go-Dn2_MT6a.js +1 -0
- package/bin/console/assets/graphql-ChdNCCLP.js +1 -0
- package/bin/console/assets/groovy-gcz8RCvz.js +1 -0
- package/bin/console/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
- package/bin/console/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
- package/bin/console/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
- package/bin/console/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
- package/bin/console/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
- package/bin/console/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
- package/bin/console/assets/hack-CaT9iCJl.js +1 -0
- package/bin/console/assets/haml-B8DHNrY2.js +1 -0
- package/bin/console/assets/handlebars-BL8al0AC.js +1 -0
- package/bin/console/assets/haskell-Df6bDoY_.js +1 -0
- package/bin/console/assets/haxe-CzTSHFRz.js +1 -0
- package/bin/console/assets/hcl-BWvSN4gD.js +1 -0
- package/bin/console/assets/hjson-D5-asLiD.js +1 -0
- package/bin/console/assets/hlsl-D3lLCCz7.js +1 -0
- package/bin/console/assets/houston-DnULxvSX.js +1 -0
- package/bin/console/assets/html-GMplVEZG.js +1 -0
- package/bin/console/assets/html-derivative-BFtXZ54Q.js +1 -0
- package/bin/console/assets/http-jrhK8wxY.js +1 -0
- package/bin/console/assets/hurl-irOxFIW8.js +1 -0
- package/bin/console/assets/hxml-Bvhsp5Yf.js +1 -0
- package/bin/console/assets/hy-DFXneXwc.js +1 -0
- package/bin/console/assets/imba-DGztddWO.js +1 -0
- package/bin/console/assets/index-DeoiWEXh.js +836 -0
- package/bin/console/assets/{index-_cX_rJVD.css → index-umuVO9UY.css} +1 -1
- package/bin/console/assets/ini-BEwlwnbL.js +1 -0
- package/bin/console/assets/java-CylS5w8V.js +1 -0
- package/bin/console/assets/javascript-wDzz0qaB.js +1 -0
- package/bin/console/assets/jinja-4LBKfQ-Z.js +1 -0
- package/bin/console/assets/jison-wvAkD_A8.js +1 -0
- package/bin/console/assets/json-Cp-IABpG.js +1 -0
- package/bin/console/assets/json5-C9tS-k6U.js +1 -0
- package/bin/console/assets/jsonc-Des-eS-w.js +1 -0
- package/bin/console/assets/jsonl-DcaNXYhu.js +1 -0
- package/bin/console/assets/jsonnet-DFQXde-d.js +1 -0
- package/bin/console/assets/jssm-C2t-YnRu.js +1 -0
- package/bin/console/assets/jsx-g9-lgVsj.js +1 -0
- package/bin/console/assets/julia-C8NyazO9.js +1 -0
- package/bin/console/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
- package/bin/console/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
- package/bin/console/assets/kanagawa-wave-DWedfzmr.js +1 -0
- package/bin/console/assets/kdl-DV7GczEv.js +1 -0
- package/bin/console/assets/kotlin-BdnUsdx6.js +1 -0
- package/bin/console/assets/kusto-BvAqAH-y.js +1 -0
- package/bin/console/assets/laserwave-DUszq2jm.js +1 -0
- package/bin/console/assets/latex-BdAV_C_H.js +1 -0
- package/bin/console/assets/lean-Bc6EcWN3.js +1 -0
- package/bin/console/assets/less-B1dDrJ26.js +1 -0
- package/bin/console/assets/light-plus-B7mTdjB0.js +1 -0
- package/bin/console/assets/liquid-DYVedYrR.js +1 -0
- package/bin/console/assets/llvm-BtvRca6l.js +1 -0
- package/bin/console/assets/log-2UxHyX5q.js +1 -0
- package/bin/console/assets/logo-BtOb2qkB.js +1 -0
- package/bin/console/assets/lua-BbnMAYS6.js +1 -0
- package/bin/console/assets/luau-CXu1NL6O.js +1 -0
- package/bin/console/assets/make-CHLpvVh8.js +1 -0
- package/bin/console/assets/markdown-Cvjx9yec.js +1 -0
- package/bin/console/assets/marko-CPi9NSCl.js +1 -0
- package/bin/console/assets/material-theme-D5KoaKCx.js +1 -0
- package/bin/console/assets/material-theme-darker-BfHTSMKl.js +1 -0
- package/bin/console/assets/material-theme-lighter-B0m2ddpp.js +1 -0
- package/bin/console/assets/material-theme-ocean-CyktbL80.js +1 -0
- package/bin/console/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
- package/bin/console/assets/matlab-D7o27uSR.js +1 -0
- package/bin/console/assets/mdc-DUICxH0z.js +1 -0
- package/bin/console/assets/mdx-Cmh6b_Ma.js +1 -0
- package/bin/console/assets/mermaid-DKYwYmdq.js +1 -0
- package/bin/console/assets/min-dark-CafNBF8u.js +1 -0
- package/bin/console/assets/min-light-CTRr51gU.js +1 -0
- package/bin/console/assets/mipsasm-CKIfxQSi.js +1 -0
- package/bin/console/assets/mojo-1DNp92w6.js +1 -0
- package/bin/console/assets/monokai-D4h5O-jR.js +1 -0
- package/bin/console/assets/move-Bu9oaDYs.js +1 -0
- package/bin/console/assets/narrat-DRg8JJMk.js +1 -0
- package/bin/console/assets/nextflow-BrzmwbiE.js +1 -0
- package/bin/console/assets/nginx-DknmC5AR.js +1 -0
- package/bin/console/assets/night-owl-C39BiMTA.js +1 -0
- package/bin/console/assets/nim-CVrawwO9.js +1 -0
- package/bin/console/assets/nix-c8nO5XWb.js +1 -0
- package/bin/console/assets/nord-Ddv68eIx.js +1 -0
- package/bin/console/assets/nushell-C-sUppwS.js +1 -0
- package/bin/console/assets/objective-c-DXmwc3jG.js +1 -0
- package/bin/console/assets/objective-cpp-CLxacb5B.js +1 -0
- package/bin/console/assets/ocaml-C0hk2d4L.js +1 -0
- package/bin/console/assets/one-dark-pro-DVMEJ2y_.js +1 -0
- package/bin/console/assets/one-light-PoHY5YXO.js +1 -0
- package/bin/console/assets/openscad-C4EeE6gA.js +1 -0
- package/bin/console/assets/pascal-D93ZcfNL.js +1 -0
- package/bin/console/assets/perl-C0TMdlhV.js +1 -0
- package/bin/console/assets/php-CDn_0X-4.js +1 -0
- package/bin/console/assets/pierre-dark-DF2SEV7i.js +1 -0
- package/bin/console/assets/pierre-light-DOlZxES8.js +1 -0
- package/bin/console/assets/pkl-u5AG7uiY.js +1 -0
- package/bin/console/assets/plastic-3e1v2bzS.js +1 -0
- package/bin/console/assets/plsql-ChMvpjG-.js +1 -0
- package/bin/console/assets/po-BTJTHyun.js +1 -0
- package/bin/console/assets/poimandres-CS3Unz2-.js +1 -0
- package/bin/console/assets/polar-C0HS_06l.js +1 -0
- package/bin/console/assets/postcss-CXtECtnM.js +1 -0
- package/bin/console/assets/powerquery-CEu0bR-o.js +1 -0
- package/bin/console/assets/powershell-Dpen1YoG.js +1 -0
- package/bin/console/assets/prisma-Dd19v3D-.js +1 -0
- package/bin/console/assets/prolog-CbFg5uaA.js +1 -0
- package/bin/console/assets/proto-DyJlTyXw.js +1 -0
- package/bin/console/assets/pug-CGlum2m_.js +1 -0
- package/bin/console/assets/puppet-BMWR74SV.js +1 -0
- package/bin/console/assets/purescript-CklMAg4u.js +1 -0
- package/bin/console/assets/python-B6aJPvgy.js +1 -0
- package/bin/console/assets/qml-3beO22l8.js +1 -0
- package/bin/console/assets/qmldir-C8lEn-DE.js +1 -0
- package/bin/console/assets/qss-IeuSbFQv.js +1 -0
- package/bin/console/assets/r-DiinP2Uv.js +1 -0
- package/bin/console/assets/racket-BqYA7rlc.js +1 -0
- package/bin/console/assets/raku-DXvB9xmW.js +1 -0
- package/bin/console/assets/razor-CE9lU5zL.js +1 -0
- package/bin/console/assets/red-bN70gL4F.js +1 -0
- package/bin/console/assets/reg-C-SQnVFl.js +1 -0
- package/bin/console/assets/regexp-CDVJQ6XC.js +1 -0
- package/bin/console/assets/rel-C3B-1QV4.js +1 -0
- package/bin/console/assets/riscv-BM1_JUlF.js +1 -0
- package/bin/console/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
- package/bin/console/assets/rose-pine-moon-D4_iv3hh.js +1 -0
- package/bin/console/assets/rose-pine-qdsjHGoJ.js +1 -0
- package/bin/console/assets/rosmsg-BJDFO7_C.js +1 -0
- package/bin/console/assets/rst-B0xPkSld.js +1 -0
- package/bin/console/assets/ruby-BvKwtOVI.js +1 -0
- package/bin/console/assets/rust-B1yitclQ.js +1 -0
- package/bin/console/assets/sas-cz2c8ADy.js +1 -0
- package/bin/console/assets/sass-Cj5Yp3dK.js +1 -0
- package/bin/console/assets/scala-C151Ov-r.js +1 -0
- package/bin/console/assets/scheme-C98Dy4si.js +1 -0
- package/bin/console/assets/scss-OYdSNvt2.js +1 -0
- package/bin/console/assets/sdbl-DVxCFoDh.js +1 -0
- package/bin/console/assets/shaderlab-Dg9Lc6iA.js +1 -0
- package/bin/console/assets/shellscript-Yzrsuije.js +1 -0
- package/bin/console/assets/shellsession-BADoaaVG.js +1 -0
- package/bin/console/assets/slack-dark-BthQWCQV.js +1 -0
- package/bin/console/assets/slack-ochin-DqwNpetd.js +1 -0
- package/bin/console/assets/smalltalk-BERRCDM3.js +1 -0
- package/bin/console/assets/snazzy-light-Bw305WKR.js +1 -0
- package/bin/console/assets/solarized-dark-DXbdFlpD.js +1 -0
- package/bin/console/assets/solarized-light-L9t79GZl.js +1 -0
- package/bin/console/assets/solidity-rGO070M0.js +1 -0
- package/bin/console/assets/soy-Brmx7dQM.js +1 -0
- package/bin/console/assets/sparql-rVzFXLq3.js +1 -0
- package/bin/console/assets/splunk-BtCnVYZw.js +1 -0
- package/bin/console/assets/sprite-Fb-TFjRY.svg +11707 -0
- package/bin/console/assets/sql-BLtJtn59.js +1 -0
- package/bin/console/assets/ssh-config-_ykCGR6B.js +1 -0
- package/bin/console/assets/stata-BH5u7GGu.js +1 -0
- package/bin/console/assets/stylus-BEDo0Tqx.js +1 -0
- package/bin/console/assets/svelte-3Dk4HxPD.js +1 -0
- package/bin/console/assets/swift-Dg5xB15N.js +1 -0
- package/bin/console/assets/synthwave-84-CbfX1IO0.js +1 -0
- package/bin/console/assets/system-verilog-CnnmHF94.js +1 -0
- package/bin/console/assets/systemd-4A_iFExJ.js +1 -0
- package/bin/console/assets/talonscript-CkByrt1z.js +1 -0
- package/bin/console/assets/tasl-QIJgUcNo.js +1 -0
- package/bin/console/assets/tcl-dwOrl1Do.js +1 -0
- package/bin/console/assets/templ-W15q3VgB.js +1 -0
- package/bin/console/assets/terraform-BETggiCN.js +1 -0
- package/bin/console/assets/tex-CxkMU7Pf.js +1 -0
- package/bin/console/assets/tokyo-night-hegEt444.js +1 -0
- package/bin/console/assets/toml-vGWfd6FD.js +1 -0
- package/bin/console/assets/ts-tags-zn1MmPIZ.js +1 -0
- package/bin/console/assets/tsv-B_m7g4N7.js +1 -0
- package/bin/console/assets/tsx-COt5Ahok.js +1 -0
- package/bin/console/assets/turtle-BsS91CYL.js +1 -0
- package/bin/console/assets/twig-CO9l9SDP.js +1 -0
- package/bin/console/assets/typescript-BPQ3VLAy.js +1 -0
- package/bin/console/assets/typespec-BGHnOYBU.js +1 -0
- package/bin/console/assets/typst-DHCkPAjA.js +1 -0
- package/bin/console/assets/v-BcVCzyr7.js +1 -0
- package/bin/console/assets/vala-CsfeWuGM.js +1 -0
- package/bin/console/assets/vb-D17OF-Vu.js +1 -0
- package/bin/console/assets/verilog-BQ8w6xss.js +1 -0
- package/bin/console/assets/vesper-DU1UobuO.js +1 -0
- package/bin/console/assets/vhdl-CeAyd5Ju.js +1 -0
- package/bin/console/assets/viml-CJc9bBzg.js +1 -0
- package/bin/console/assets/vitesse-black-Bkuqu6BP.js +1 -0
- package/bin/console/assets/vitesse-dark-D0r3Knsf.js +1 -0
- package/bin/console/assets/vitesse-light-CVO1_9PV.js +1 -0
- package/bin/console/assets/vue-DnHKYNfI.js +1 -0
- package/bin/console/assets/vue-html-CChd_i61.js +1 -0
- package/bin/console/assets/vue-vine-8moa0y9V.js +1 -0
- package/bin/console/assets/vyper-CDx5xZoG.js +1 -0
- package/bin/console/assets/wasm-CG6Dc4jp.js +1 -0
- package/bin/console/assets/wasm-MzD3tlZU.js +1 -0
- package/bin/console/assets/wenyan-BV7otONQ.js +1 -0
- package/bin/console/assets/wgsl-Dx-B1_4e.js +1 -0
- package/bin/console/assets/wikitext-BhOHFoWU.js +1 -0
- package/bin/console/assets/wit-5i3qLPDT.js +1 -0
- package/bin/console/assets/wolfram-lXgVvXCa.js +1 -0
- package/bin/console/assets/worker-DtSoTC-m.js +155 -0
- package/bin/console/assets/xml-sdJ4AIDG.js +1 -0
- package/bin/console/assets/xsl-CtQFsRM5.js +1 -0
- package/bin/console/assets/yaml-Buea-lGh.js +1 -0
- package/bin/console/assets/zenscript-DVFEvuxE.js +1 -0
- package/bin/console/assets/zig-VOosw3JB.js +1 -0
- package/bin/console/index.html +2 -2
- package/bin/kilo +0 -0
- package/bin/models-snapshot.json +1 -1
- package/package.json +1 -1
- package/bin/console/assets/index-CkTaXE55.js +0 -182
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
let F=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Ds(t){return cn(t)}function cn(t){return Array.isArray(t)?Gs(t):t instanceof RegExp?t:typeof t=="object"?Bs(t):t}function Gs(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=cn(t[n]);return e}function Bs(t){let e={};for(let n in t)e[n]=cn(t[n]);return e}function xr(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function vr(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?vr(t.substring(0,t.length-1)):t.substr(~e+1)}var xt=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,ze=class{static hasCaptures(t){return t===null?!1:(xt.lastIndex=0,xt.test(t))}static replaceCaptures(t,e,n){return t.replace(xt,(r,s,o,i)=>{let a=n[parseInt(s||o,10)];if(a){let l=e.substring(a.start,a.end);for(;l[0]===".";)l=l.substring(1);switch(i){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function Ir(t,e){return t<e?-1:t>e?1:0}function Er(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let o=Ir(t[s],e[s]);if(o!==0)return o}return 0}return n-r}function En(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function Ar(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Lr=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},rt=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(js(t),e)}static createFromParsedTheme(t,e){return zs(t,e)}_cachedMatchRoot=new Lr(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,r=this._cachedMatchRoot.get(e).find(s=>Fs(t.parent,s.parentScopes));return r?new Rr(r.fontStyle,r.foreground,r.background):null}},vt=class Je{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new Je(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new Je(n,e[r]);return n}push(e){return new Je(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function Fs(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}for(;t&&!Us(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Us(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var Rr=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function js(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let s=0,o=e.length;s<o;s++){let i=e[s];if(!i.settings)continue;let a;if(typeof i.scope=="string"){let f=i.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),a=f.split(",")}else Array.isArray(i.scope)?a=i.scope:a=[""];let l=-1;if(typeof i.settings.fontStyle=="string"){l=0;let f=i.settings.fontStyle.split(" ");for(let h=0,d=f.length;h<d;h++)switch(f[h]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let c=null;typeof i.settings.foreground=="string"&&En(i.settings.foreground)&&(c=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&En(i.settings.background)&&(u=i.settings.background);for(let f=0,h=a.length;f<h;f++){let p=a[f].trim().split(" "),b=p[p.length-1],w=null;p.length>1&&(w=p.slice(0,p.length-1),w.reverse()),n[r++]=new Ws(b,w,s,l,c,u)}}return n}var Ws=class{constructor(t,e,n,r,s,o){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=o}},W=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(W||{});function zs(t,e){t.sort((l,c)=>{let u=Ir(l.scope,c.scope);return u!==0||(u=Er(l.parentScopes,c.parentScopes),u!==0)?u:l.index-c.index});let n=0,r="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let l=t.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(s=l.background)}let o=new Hs(e),i=new Rr(n,o.getId(r),o.getId(s)),a=new qs(new jt(0,null,-1,0,0),[]);for(let l=0,c=t.length;l<c;l++){let u=t[l];a.insert(0,u.scope,u.parentScopes,u.fontStyle,o.getId(u.foreground),o.getId(u.background))}return new rt(o,i,a)}var Hs=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},Vs=Object.freeze([]),jt=class Nr{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,o){this.scopeDepth=e,this.parentScopes=n||Vs,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new Nr(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},qs=class Wt{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=n.parentScopes.length);){const o=n.parentScopes[s].length-e.parentScopes[r].length;if(o!==0)return o;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,o;if(r===-1?(s=e,o=""):(s=e.substring(0,r),o=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Wt._cmpBySpecificity),n}insert(e,n,r,s,o,i){if(n===""){this._doInsertHere(e,r,s,o,i);return}let a=n.indexOf("."),l,c;a===-1?(l=n,c=""):(l=n.substring(0,a),c=n.substring(a+1));let u;this._children.hasOwnProperty(l)?u=this._children[l]:(u=new Wt(this._mainRule.clone(),jt.cloneArr(this._rulesWithParentScopes)),this._children[l]=u),u.insert(e+1,c,r,s,o,i)}_doInsertHere(e,n,r,s,o){if(n===null){this._mainRule.acceptOverwrite(e,r,s,o);return}for(let i=0,a=this._rulesWithParentScopes.length;i<a;i++){let l=this._rulesWithParentScopes[i];if(Er(l.parentScopes,n)===0){l.acceptOverwrite(e,r,s,o);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new jt(e,n,r,s,o))}},xe=class K{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=K.getLanguageId(e),r=K.getTokenType(e),s=K.getFontStyle(e),o=K.getForeground(e),i=K.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:o,background:i})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,s,o,i,a){let l=K.getLanguageId(e),c=K.getTokenType(e),u=K.containsBalancedBrackets(e)?1:0,f=K.getFontStyle(e),h=K.getForeground(e),d=K.getBackground(e);return n!==0&&(l=n),r!==8&&(c=r),s!==null&&(u=s?1:0),o!==-1&&(f=o),i!==0&&(h=i),a!==0&&(d=a),(l<<0|c<<8|u<<10|f<<11|h<<15|d<<24)>>>0}};function st(t,e){const n=[],r=Xs(t);let s=r.next();for(;s!==null;){let l=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let c=i();if(n.push({matcher:c,priority:l}),s!==",")break;s=r.next()}return n;function o(){if(s==="-"){s=r.next();const l=o();return c=>!!l&&!l(c)}if(s==="("){s=r.next();const l=a();return s===")"&&(s=r.next()),l}if(An(s)){const l=[];do l.push(s),s=r.next();while(An(s));return c=>e(l,c)}return null}function i(){const l=[];let c=o();for(;c;)l.push(c),c=o();return u=>l.every(f=>f(u))}function a(){const l=[];let c=i();for(;c&&(l.push(c),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");c=i()}return u=>l.some(f=>f(u))}}function An(t){return!!t&&!!t.match(/[\w\.:]+/)}function Xs(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function Pr(t){typeof t.dispose=="function"&&t.dispose()}var Me=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},Ks=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},Zs=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},Qs=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Me(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new Zs;for(const n of t)Ys(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Me){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function Ys(t,e,n,r){const s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const o=n.lookup(e);t instanceof Me?et({baseGrammar:o,selfGrammar:s},r):zt(t.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=n.injections(t.scopeName);if(i)for(const a of i)r.add(new Me(a))}function zt(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];ot([r],e,n)}}function et(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&ot(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&ot(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function ot(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?xr({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&ot(r.patterns,{...e,repository:s},n);const o=r.include;if(!o)continue;const i=Tr(o);switch(i.kind){case 0:et({...e,selfGrammar:e.baseGrammar},n);break;case 1:et(e,n);break;case 2:zt(i.ruleName,{...e,repository:s},n);break;case 3:case 4:const a=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(a){const l={baseGrammar:e.baseGrammar,selfGrammar:a,repository:s};i.kind===4?zt(i.ruleName,l,n):et(l,n)}else i.kind===4?n.add(new Ks(i.scopeName,i.ruleName)):n.add(new Me(i.scopeName));break}}}var Js=class{kind=0},eo=class{kind=1},to=class{constructor(t){this.ruleName=t}kind=2},no=class{constructor(t){this.scopeName=t}kind=3},ro=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function Tr(t){if(t==="$base")return new Js;if(t==="$self")return new eo;const e=t.indexOf("#");if(e===-1)return new no(t);if(e===0)return new to(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new ro(n,r)}}var so=/\\(\d+)/,Ln=/\\(\d+)/g,oo=-1,$r=-2;var Ue=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=ze.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=ze.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${vr(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:ze.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:ze.replaceCaptures(this._contentName,t,e)}},io=class extends Ue{retokenizeCapturedWithRuleId;constructor(t,e,n,r,s){super(t,e,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,r){throw new Error("Not supported!")}},ao=class extends Ue{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null),this._match=new Oe(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new De,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Rn=class extends Ue{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new De,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ht=class extends Ue{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,o,i,a,l,c){super(t,e,n,r),this._begin=new Oe(s,this.id),this.beginCaptures=o,this._end=new Oe(i||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new De;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},it=class extends Ue{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,o,i,a,l){super(t,e,n,r),this._begin=new Oe(s,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new Oe(i,$r),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new De;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new De,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||""),this._cachedCompiledWhilePatterns}},Mr=class j{static createCaptureRule(e,n,r,s,o){return e.registerRule(i=>new io(n,i,r,s,o))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new ao(e.$vscodeTextmateLocation,e.id,e.name,e.match,j._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=xr({},r,e.repository));let o=e.patterns;return typeof o>"u"&&e.include&&(o=[{include:e.include}]),new Rn(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,j._compilePatterns(o,n,r))}return e.while?new it(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,j._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,j._compileCaptures(e.whileCaptures||e.captures,n,r),j._compilePatterns(e.patterns,n,r)):new Ht(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,j._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,j._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,j._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let o=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);a>o&&(o=a)}for(let i=0;i<=o;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);let l=0;e[i].patterns&&(l=j.getCompiledRuleId(e[i],n,r)),s[a]=j.createCaptureRule(n,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,l)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let o=0,i=e.length;o<i;o++){const a=e[o];let l=-1;if(a.include){const c=Tr(a.include);switch(c.kind){case 0:case 1:l=j.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[c.ruleName];u&&(l=j.getCompiledRuleId(u,n,r));break;case 3:case 4:const f=c.scopeName,h=c.kind===4?c.ruleName:null,d=n.getExternalGrammar(f,r);if(d)if(h){let p=d.repository[h];p&&(l=j.getCompiledRuleId(p,n,d.repository))}else l=j.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else l=j.getCompiledRuleId(a,n,r);if(l!==-1){const c=n.getRule(l);let u=!1;if((c instanceof Rn||c instanceof Ht||c instanceof it)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(l)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},Oe=class Or{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const r=e.length;let s=0,o=[],i=!1;for(let a=0;a<r;a++)if(e.charAt(a)==="\\"&&a+1<r){const c=e.charAt(a+1);c==="z"?(o.push(e.substring(s,a)),o.push("$(?!\\n)(?<!\\n)"),s=a+2):(c==="A"||c==="G")&&(i=!0),a++}this.hasAnchor=i,s===0?this.source=e:(o.push(e.substring(s,r)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=so.test(this.source):this.hasBackReferences=!1}clone(){return new Or(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>e.substring(s.start,s.end));return Ln.lastIndex=0,this.source.replace(Ln,(s,o)=>Ar(r[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],r=[],s=[],o,i,a,l;for(o=0,i=this.source.length;o<i;o++)a=this.source.charAt(o),e[o]=a,n[o]=a,r[o]=a,s[o]=a,a==="\\"&&o+1<i&&(l=this.source.charAt(o+1),l==="A"?(e[o+1]="",n[o+1]="",r[o+1]="A",s[o+1]="A"):l==="G"?(e[o+1]="",n[o+1]="G",r[o+1]="",s[o+1]="G"):(e[o+1]=l,n[o+1]=l,r[o+1]=l,s[o+1]=l),o++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},De=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new Nn(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let r=this._items.map(s=>s.resolveAnchors(e,n));return new Nn(t,r,this._items.map(s=>s.ruleId))}},Nn=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
2
|
+
`)}findNextMatchSync(t,e,n){const r=this.scanner.findNextMatchSync(t,e,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},It=class{constructor(t,e){this.languageId=t,this.tokenType=e}},lo=class Vt{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new It(e,8),this._embeddedLanguagesMatcher=new co(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?Vt._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new It(0,0);_getBasicScopeAttributes=new Lr(e=>{const n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new It(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(Vt.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},co=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,r])=>Ar(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},Pn=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function Dr(t,e,n,r,s,o,i,a){const l=e.content.length;let c=!1,u=-1;if(i){const d=uo(t,e,n,r,s,o);s=d.stack,r=d.linePos,n=d.isFirstLine,u=d.anchorPosition}const f=Date.now();for(;!c;){if(a!==0&&Date.now()-f>a)return new Pn(s,!0);h()}return new Pn(s,!1);function h(){const d=fo(t,e,n,r,s,u);if(!d){o.produce(s,l),c=!0;return}const p=d.captureIndices,b=d.matchedRuleId,w=p&&p.length>0?p[0].end>r:!1;if(b===oo){const m=s.getRule(t);o.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),Pe(t,e,n,s,o,m.endCaptures,p),o.produce(s,p[0].end);const y=s;if(s=s.parent,u=y.getAnchorPos(),!w&&y.getEnterPos()===r){s=y,o.produce(s,l),c=!0;return}}else{const m=t.getRule(b);o.produce(s,p[0].start);const y=s,g=m.getName(e.content,p),_=s.contentNameScopesList.pushAttributed(g,t);if(s=s.push(b,r,u,p[0].end===l,null,_,_),m instanceof Ht){const S=m;Pe(t,e,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const x=S.getContentName(e.content,p),v=_.pushAttributed(x,t);if(s=s.withContentNameScopesList(v),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(e.content,p))),!w&&y.hasSameRuleAs(s)){s=s.pop(),o.produce(s,l),c=!0;return}}else if(m instanceof it){const S=m;Pe(t,e,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const x=S.getContentName(e.content,p),v=_.pushAttributed(x,t);if(s=s.withContentNameScopesList(v),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(e.content,p))),!w&&y.hasSameRuleAs(s)){s=s.pop(),o.produce(s,l),c=!0;return}}else if(Pe(t,e,n,s,o,m.captures,p),o.produce(s,p[0].end),s=s.pop(),!w){s=s.safePop(),o.produce(s,l),c=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function uo(t,e,n,r,s,o){let i=s.beginRuleCapturedEOL?0:-1;const a=[];for(let l=s;l;l=l.pop()){const c=l.getRule(t);c instanceof it&&a.push({rule:c,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:c,findOptions:u}=go(l.rule,t,l.stack.endRule,n,r===i),f=c.findNextMatchSync(e,r,u);if(f){if(f.ruleId!==$r){s=l.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(o.produce(l.stack,f.captureIndices[0].start),Pe(t,e,n,l.stack,o,l.rule.whileCaptures,f.captureIndices),o.produce(l.stack,f.captureIndices[0].end),i=f.captureIndices[0].end,f.captureIndices[0].end>r&&(r=f.captureIndices[0].end,n=!1))}else{s=l.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:i,isFirstLine:n}}function fo(t,e,n,r,s,o){const i=ho(t,e,n,r,s,o),a=t.getInjections();if(a.length===0)return i;const l=po(a,t,e,n,r,s,o);if(!l)return i;if(!i)return l;const c=i.captureIndices[0].start,u=l.captureIndices[0].start;return u<c||l.priorityMatch&&u===c?l:i}function ho(t,e,n,r,s,o){const i=s.getRule(t),{ruleScanner:a,findOptions:l}=Gr(i,t,s.endRule,n,r===o),c=a.findNextMatchSync(e,r,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function po(t,e,n,r,s,o,i){let a=Number.MAX_VALUE,l=null,c,u=0;const f=o.contentNameScopesList.getScopeNames();for(let h=0,d=t.length;h<d;h++){const p=t[h];if(!p.matcher(f))continue;const b=e.getRule(p.ruleId),{ruleScanner:w,findOptions:m}=Gr(b,e,null,r,s===i),y=w.findNextMatchSync(n,s,m);if(!y)continue;const g=y.captureIndices[0].start;if(!(g>=a)&&(a=g,l=y.captureIndices,c=y.ruleId,u=p.priority,a===s))break}return l?{priorityMatch:u===-1,captureIndices:l,matchedRuleId:c}:null}function Gr(t,e,n,r,s){return{ruleScanner:t.compileAG(e,n,r,s),findOptions:0}}function go(t,e,n,r,s){return{ruleScanner:t.compileWhileAG(e,n,r,s),findOptions:0}}function Pe(t,e,n,r,s,o,i){if(o.length===0)return;const a=e.content,l=Math.min(o.length,i.length),c=[],u=i[0].end;for(let f=0;f<l;f++){const h=o[f];if(h===null)continue;const d=i[f];if(d.length===0)continue;if(d.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=d.start;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?s.produceFromScopes(c[c.length-1].scopes,d.start):s.produce(r,d.start),h.retokenizeCapturedWithRuleId){const b=h.getName(a,i),w=r.contentNameScopesList.pushAttributed(b,t),m=h.getContentName(a,i),y=w.pushAttributed(m,t),g=r.push(h.retokenizeCapturedWithRuleId,d.start,-1,!1,null,w,y),_=t.createOnigString(a.substring(0,d.end));Dr(t,_,n&&d.start===0,d.start,g,s,!1,0),Pr(_);continue}const p=h.getName(a,i);if(p!==null){const w=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(p,t);c.push(new mo(w,d.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var mo=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function yo(t,e,n,r,s,o,i,a){return new wo(t,e,n,r,s,o,i,a)}function Tn(t,e,n,r,s){const o=st(e,at),i=Mr.getCompiledRuleId(n,r,s.repository);for(const a of o)t.push({debugSelector:e,matcher:a.matcher,ruleId:i,grammar:s,priority:a.priority})}function at(t,e){if(e.length<t.length)return!1;let n=0;return t.every(r=>{for(let s=n;s<e.length;s++)if(bo(e[s],r))return n=s+1,!0;return!1})}function bo(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var wo=class{constructor(t,e,n,r,s,o,i,a){if(this._rootScopeName=t,this.balancedBracketSelectors=o,this._onigLib=a,this._basicScopeAttributesProvider=new lo(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=$n(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const l of Object.keys(s)){const c=st(l,at);for(const u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[l]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],n=this._rootScopeName,r=t.lookup(n);if(r){const s=r.injections;if(s)for(let i in s)Tn(e,i,s[i],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(i=>{const a=this.getExternalGrammar(i);if(a){const l=a.injectionSelector;l&&Tn(e,l,a,this,a)}})}return e.sort((s,o)=>s.priority-o.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=$n(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){const r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){this._rootId===-1&&(this._rootId=Mr.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===qt.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),f=xe.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),h=this.getRule(this._rootId).getName(null,null);let d;h?d=Te.createRootAndLookUpScopeName(h,f,this):d=Te.createRoot("unknown",f),e=new qt(null,this._rootId,-1,-1,!1,null,d,d)}else s=!1,e.reset();t=t+`
|
|
3
|
+
`;const o=this.createOnigString(t),i=o.content.length,a=new _o(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),l=Dr(this,o,s,0,e,a,!0,r);return Pr(o),{lineLength:i,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function $n(t,e){return t=Ds(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var Te=class ee{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,s=e?.scopePath??null;for(const o of n)s=vt.push(s,o.scopeNames),r=new ee(r,s,o.encodedTokenAttributes);return r}static createRoot(e,n){return new ee(null,new vt(null,e),n)}static createRootAndLookUpScopeName(e,n,r){const s=r.getMetadataForScope(e),o=new vt(null,e),i=r.themeProvider.themeMatch(o),a=ee.mergeAttributes(n,s,i);return new ee(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return ee.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,r){let s=-1,o=0,i=0;return r!==null&&(s=r.fontStyle,o=r.foregroundId,i=r.backgroundId),xe.set(e,n.languageId,n.tokenType,null,s,o,i)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return ee._pushAttributed(this,e,n);const r=e.split(/ /g);let s=this;for(const o of r)s=ee._pushAttributed(s,o,n);return s}static _pushAttributed(e,n,r){const s=r.getMetadataForScope(n),o=e.scopePath.push(n),i=r.themeProvider.themeMatch(o),a=ee.mergeAttributes(e.tokenAttributes,s,i);return new ee(e,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?n.reverse():void 0}},qt=class ue{constructor(e,n,r,s,o,i,a,l){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new ue(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:ue._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?Te.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){ue._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,s,o,i,a){return new ue(this,e,n,r,s,o,i,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new ue(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){const r=Te.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new ue(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Te.fromExtension(r,n.contentNameScopesList))}},Co=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):st(n,at).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>st(n,at).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},_o=class{constructor(t,e,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let r=t?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=t?.getScopeNames()??[];for(const i of this._tokenTypeOverrides)i.matcher(o)&&(r=xe.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(o))}if(s&&(r=xe.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=e;return}const n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},So=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,r,s){if(!this._grammars.has(t)){let o=this._rawGrammars.get(t);if(!o)return null;this._grammars.set(t,yo(t,o,e,n,r,s,this,this._onigLib))}return this._grammars.get(t)}},ko=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new So(rt.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(rt.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,r){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,n,r){return this._loadGrammar(e,n,r.embeddedLanguages,r.tokenTypes,new Co(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,r,s,o){const i=new Qs(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(a=>this._loadSingleGrammar(a.scopeName)),i.processQueue();return this._grammarForScopeName(e,n,r,s,o)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(e,n=[],r=0,s=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,r,s)}_grammarForScopeName(e,n=0,r=null,s=null,o=null){return this._syncRegistry.grammarForScopeName(e,n,r,s,o)}},Xt=qt.NULL;const xo=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class je{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}je.prototype.normal={};je.prototype.property={};je.prototype.space=void 0;function Br(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new je(n,r,e)}function Kt(t){return t.toLowerCase()}class H{constructor(e,n){this.attribute=n,this.property=e}}H.prototype.attribute="";H.prototype.booleanish=!1;H.prototype.boolean=!1;H.prototype.commaOrSpaceSeparated=!1;H.prototype.commaSeparated=!1;H.prototype.defined=!1;H.prototype.mustUseProperty=!1;H.prototype.number=!1;H.prototype.overloadedBoolean=!1;H.prototype.property="";H.prototype.spaceSeparated=!1;H.prototype.space=void 0;let vo=0;const E=me(),M=me(),Zt=me(),C=me(),P=me(),Se=me(),V=me();function me(){return 2**++vo}var Qt=Object.freeze({__proto__:null,boolean:E,booleanish:M,commaOrSpaceSeparated:V,commaSeparated:Se,number:C,overloadedBoolean:Zt,spaceSeparated:P});const Et=Object.keys(Qt);class un extends H{constructor(e,n,r,s){let o=-1;if(super(e,n),Mn(this,"space",s),typeof r=="number")for(;++o<Et.length;){const i=Et[o];Mn(this,Et[o],(r&Qt[i])===Qt[i])}}}un.prototype.defined=!0;function Mn(t,e,n){n&&(t[e]=n)}function ve(t){const e={},n={};for(const[r,s]of Object.entries(t.properties)){const o=new un(r,t.transform(t.attributes||{},r),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),e[r]=o,n[Kt(r)]=r,n[Kt(o.attribute)]=r}return new je(e,n,t.space)}const Fr=ve({properties:{ariaActiveDescendant:null,ariaAtomic:M,ariaAutoComplete:null,ariaBusy:M,ariaChecked:M,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:P,ariaCurrent:null,ariaDescribedBy:P,ariaDetails:null,ariaDisabled:M,ariaDropEffect:P,ariaErrorMessage:null,ariaExpanded:M,ariaFlowTo:P,ariaGrabbed:M,ariaHasPopup:null,ariaHidden:M,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:P,ariaLevel:C,ariaLive:null,ariaModal:M,ariaMultiLine:M,ariaMultiSelectable:M,ariaOrientation:null,ariaOwns:P,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:M,ariaReadOnly:M,ariaRelevant:null,ariaRequired:M,ariaRoleDescription:P,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:M,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function Ur(t,e){return e in t?t[e]:e}function jr(t,e){return Ur(t,e.toLowerCase())}const Io=ve({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Se,acceptCharset:P,accessKey:P,action:null,allow:null,allowFullScreen:E,allowPaymentRequest:E,allowUserMedia:E,alt:null,as:null,async:E,autoCapitalize:null,autoComplete:P,autoFocus:E,autoPlay:E,blocking:P,capture:null,charSet:null,checked:E,cite:null,className:P,cols:C,colSpan:null,content:null,contentEditable:M,controls:E,controlsList:P,coords:C|Se,crossOrigin:null,data:null,dateTime:null,decoding:null,default:E,defer:E,dir:null,dirName:null,disabled:E,download:Zt,draggable:M,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:E,formTarget:null,headers:P,height:C,hidden:Zt,high:C,href:null,hrefLang:null,htmlFor:P,httpEquiv:P,id:null,imageSizes:null,imageSrcSet:null,inert:E,inputMode:null,integrity:null,is:null,isMap:E,itemId:null,itemProp:P,itemRef:P,itemScope:E,itemType:P,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:E,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:E,muted:E,name:null,nonce:null,noModule:E,noValidate:E,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:E,optimum:C,pattern:null,ping:P,placeholder:null,playsInline:E,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:E,referrerPolicy:null,rel:P,required:E,reversed:E,rows:C,rowSpan:C,sandbox:P,scope:null,scoped:E,seamless:E,selected:E,shadowRootClonable:E,shadowRootDelegatesFocus:E,shadowRootMode:null,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:M,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:E,useMap:null,value:M,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:P,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:E,declare:E,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:E,noHref:E,noShade:E,noWrap:E,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:M,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:E,disableRemotePlayback:E,prefix:null,property:null,results:C,security:null,unselectable:null},space:"html",transform:jr}),Eo=ve({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:V,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:P,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:E,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Se,g2:Se,glyphName:Se,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:V,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:C,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:P,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:V,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:V,rev:V,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:V,requiredFeatures:V,requiredFonts:V,requiredFormats:V,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:V,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:V,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:V,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ur}),Wr=ve({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),zr=ve({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:jr}),Hr=ve({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),Ao=/[A-Z]/g,On=/-[a-z]/g,Lo=/^data[-\w.:]+$/i;function Ro(t,e){const n=Kt(e);let r=e,s=H;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Lo.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(On,Po);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!On.test(o)){let i=o.replace(Ao,No);i.charAt(0)!=="-"&&(i="-"+i),e="data"+i}}s=un}return new s(r,e)}function No(t){return"-"+t.toLowerCase()}function Po(t){return t.charAt(1).toUpperCase()}const To=Br([Fr,Io,Wr,zr,Hr],"html"),Vr=Br([Fr,Eo,Wr,zr,Hr],"svg"),Dn={}.hasOwnProperty;function $o(t,e){const n=e||{};function r(s,...o){let i=r.invalid;const a=r.handlers;if(s&&Dn.call(s,t)){const l=String(s[t]);i=Dn.call(a,l)?a[l]:r.unknown}if(i)return i.call(this,s,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const Mo=/["&'<>`]/g,Oo=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Do=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Go=/[|\\{}()[\]^$+*?.]/g,Gn=new WeakMap;function Bo(t,e){if(t=t.replace(e.subset?Fo(e.subset):Mo,r),e.subset||e.escapeOnly)return t;return t.replace(Oo,n).replace(Do,r);function n(s,o,i){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(o+2),e)}function r(s,o,i){return e.format(s.charCodeAt(0),i.charCodeAt(o+1),e)}}function Fo(t){let e=Gn.get(t);return e||(e=Uo(t),Gn.set(t,e)),e}function Uo(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Go,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const jo=/[\dA-Fa-f]/;function Wo(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!jo.test(String.fromCharCode(e))?r:r+";"}const zo=/\d/;function Ho(t,e,n){const r="&#"+String(t);return n&&e&&!zo.test(String.fromCharCode(e))?r:r+";"}const Vo=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],At={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},qo=["cent","copy","divide","gt","lt","not","para","times"],qr={}.hasOwnProperty,Yt={};let He;for(He in At)qr.call(At,He)&&(Yt[At[He]]=He);const Xo=/[^\dA-Za-z]/;function Ko(t,e,n,r){const s=String.fromCharCode(t);if(qr.call(Yt,s)){const o=Yt[s],i="&"+o;return n&&Vo.includes(o)&&!qo.includes(o)&&(!r||e&&e!==61&&Xo.test(String.fromCharCode(e)))?i:i+";"}return""}function Zo(t,e,n){let r=Wo(t,e,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=Ko(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const o=Ho(t,e,n.omitOptionalSemicolons);o.length<r.length&&(r=o)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function ke(t,e){return Bo(t,Object.assign({format:Zo},e))}const Qo=/^>|^->|<!--|-->|--!>|<!-$/g,Yo=[">"],Jo=["<",">"];function ei(t,e,n,r){return r.settings.bogusComments?"<?"+ke(t.value,Object.assign({},r.settings.characterReferences,{subset:Yo}))+">":"<!--"+t.value.replace(Qo,s)+"-->";function s(o){return ke(o,Object.assign({},r.settings.characterReferences,{subset:Jo}))}}function ti(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function Bn(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function ni(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function ri(t){return t.join(" ").trim()}const si=/[ \t\n\f\r]/g;function fn(t){return typeof t=="object"?t.type==="text"?Fn(t.value):!1:Fn(t)}function Fn(t){return t.replace(si,"")===""}const G=Kr(1),Xr=Kr(-1),oi=[];function Kr(t){return e;function e(n,r,s){const o=n?n.children:oi;let i=(r||0)+t,a=o[i];if(!s)for(;a&&fn(a);)i+=t,a=o[i];return a}}const ii={}.hasOwnProperty;function Zr(t){return e;function e(n,r,s){return ii.call(t,n.tagName)&&t[n.tagName](n,r,s)}}const hn=Zr({body:li,caption:Lt,colgroup:Lt,dd:hi,dt:fi,head:Lt,html:ai,li:ui,optgroup:di,option:pi,p:ci,rp:Un,rt:Un,tbody:mi,td:jn,tfoot:yi,th:jn,thead:gi,tr:bi});function Lt(t,e,n){const r=G(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&fn(r.value.charAt(0)))}function ai(t,e,n){const r=G(n,e);return!r||r.type!=="comment"}function li(t,e,n){const r=G(n,e);return!r||r.type!=="comment"}function ci(t,e,n){const r=G(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function ui(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="li"}function fi(t,e,n){const r=G(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function hi(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function Un(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function di(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function pi(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function gi(t,e,n){const r=G(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function mi(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function yi(t,e,n){return!G(n,e)}function bi(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function jn(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const wi=Zr({body:Si,colgroup:ki,head:_i,html:Ci,tbody:xi});function Ci(t){const e=G(t,-1);return!e||e.type!=="comment"}function _i(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function Si(t){const e=G(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&fn(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function ki(t,e,n){const r=Xr(n,e),s=G(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&hn(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function xi(t,e,n){const r=Xr(n,e),s=G(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&hn(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Ve={name:[[`
|
|
4
|
+
\f\r &/=>`.split(""),`
|
|
5
|
+
\f\r "&'/=>\``.split("")],[`\0
|
|
6
|
+
\f\r "&'/<=>`.split(""),`\0
|
|
7
|
+
\f\r "&'/<=>\``.split("")]],unquoted:[[`
|
|
8
|
+
\f\r &>`.split(""),`\0
|
|
9
|
+
\f\r "&'<=>\``.split("")],[`\0
|
|
10
|
+
\f\r "&'<=>\``.split(""),`\0
|
|
11
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function vi(t,e,n,r){const s=r.schema,o=s.space==="svg"?!1:r.settings.omitOptionalTags;let i=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;s.space==="html"&&t.tagName==="svg"&&(r.schema=Vr);const c=Ii(r,t.properties),u=r.all(s.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=s,u&&(i=!1),(c||!o||!wi(t,e,n))&&(a.push("<",t.tagName,c?" "+c:""),i&&(s.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!i&&(!o||!hn(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function Ii(t,e){const n=[];let r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){const o=Ei(t,s,e[s]);o&&n.push(o)}}for(;++r<n.length;){const o=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&o!=='"'&&o!=="'"&&(n[r]+=" ")}return n.join("")}function Ei(t,e,n){const r=Ro(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,o=t.settings.allowDangerousCharacters?0:1;let i=t.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=ke(r.attribute,Object.assign({},t.settings.characterReferences,{subset:Ve.name[s][o]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?ni:ri)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?l:(t.settings.preferUnquoted&&(a=ke(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:Ve.unquoted[s][o]}))),a!==n&&(t.settings.quoteSmart&&Bn(n,i)>Bn(n,t.alternative)&&(i=t.alternative),a=i+ke(n,Object.assign({},t.settings.characterReferences,{subset:(i==="'"?Ve.single:Ve.double)[s][o],attribute:!0}))+i),l+(a&&"="+a))}const Ai=["<","&"];function Qr(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:ke(t.value,Object.assign({},r.settings.characterReferences,{subset:Ai}))}function Li(t,e,n,r){return r.settings.allowDangerousHtml?t.value:Qr(t,e,n,r)}function Ri(t,e,n,r){return r.all(t)}const Ni=$o("type",{invalid:Pi,unknown:Ti,handlers:{comment:ei,doctype:ti,element:vi,raw:Li,root:Ri,text:Qr}});function Pi(t){throw new Error("Expected node, not `"+t+"`")}function Ti(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const $i={},Mi={},Oi=[];function Di(t,e){const n=e||$i,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Gi,all:Bi,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||xo,characterReferences:n.characterReferences||Mi,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Vr:To,quote:r,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Gi(t,e,n){return Ni(t,e,n,this)}function Bi(t){const e=[],n=t&&t.children||Oi;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function lt(t,e){const n=typeof t=="string"?{}:{...t.colorReplacements},r=typeof t=="string"?t:t.name;for(const[s,o]of Object.entries(e?.colorReplacements||{}))typeof o=="string"?n[s]=o:s===r&&Object.assign(n,o);return n}function le(t,e){return t&&(e?.[t?.toLowerCase()]||t)}function Fi(t){return Array.isArray(t)?t:[t]}async function Yr(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function dn(t){return!t||["plaintext","txt","text","plain"].includes(t)}function Ui(t){return t==="ansi"||dn(t)}function pn(t){return t==="none"}function ji(t){return pn(t)}function Jr(t,e){if(!e)return t;t.properties||={},t.properties.class||=[],typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const n=Array.isArray(e)?e:e.split(/\s+/g);for(const r of n)r&&!t.properties.class.includes(r)&&t.properties.class.push(r);return t}function pt(t,e=!1){if(t.length===0)return[["",0]];const n=t.split(/(\r?\n)/g);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const i=e?n[o]+(n[o+1]||""):n[o];s.push([i,r]),r+=n[o].length,r+=n[o+1]?.length||0}return s}function Wi(t){const e=pt(t,!0).map(([s])=>s);function n(s){if(s===t.length)return{line:e.length-1,character:e[e.length-1].length};let o=s,i=0;for(const a of e){if(o<a.length)break;o-=a.length,i++}return{line:i,character:o}}function r(s,o){let i=0;for(let a=0;a<s;a++)i+=e[a].length;return i+=o,i}return{lines:e,indexToPos:n,posToIndex:r}}const gn="light-dark()",zi=["color","background-color"];function Hi(t,e){let n=0;const r=[];for(const s of e)s>n&&r.push({...t,content:t.content.slice(n,s),offset:t.offset+n}),n=s;return n<t.content.length&&r.push({...t,content:t.content.slice(n),offset:t.offset+n}),r}function Vi(t,e){const n=Array.from(e instanceof Set?e:new Set(e)).sort((r,s)=>r-s);return n.length?t.map(r=>r.flatMap(s=>{const o=n.filter(i=>s.offset<i&&i<s.offset+s.content.length).map(i=>i-s.offset).sort((i,a)=>i-a);return o.length?Hi(s,o):s})):t}function qi(t,e,n,r,s="css-vars"){const o={content:t.content,explanation:t.explanation,offset:t.offset},i=e.map(u=>ct(t.variants[u])),a=new Set(i.flatMap(u=>Object.keys(u))),l={},c=(u,f)=>{const h=f==="color"?"":f==="background-color"?"-bg":`-${f}`;return n+e[u]+(f==="color"?"":h)};return i.forEach((u,f)=>{for(const h of a){const d=u[h]||"inherit";if(f===0&&r&&zi.includes(h))if(r===gn&&i.length>1){const p=e.findIndex(y=>y==="light"),b=e.findIndex(y=>y==="dark");if(p===-1||b===-1)throw new F('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const w=i[p][h]||"inherit",m=i[b][h]||"inherit";l[h]=`light-dark(${w}, ${m})`,s==="css-vars"&&(l[c(f,h)]=d)}else l[h]=d;else s==="css-vars"&&(l[c(f,h)]=d)}}),o.htmlStyle=l,o}function ct(t){const e={};if(t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle){t.fontStyle&W.Italic&&(e["font-style"]="italic"),t.fontStyle&W.Bold&&(e["font-weight"]="bold");const n=[];t.fontStyle&W.Underline&&n.push("underline"),t.fontStyle&W.Strikethrough&&n.push("line-through"),n.length&&(e["text-decoration"]=n.join(" "))}return e}function Jt(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}const es=new WeakMap;function gt(t,e){es.set(t,e)}function Ge(t){return es.get(t)}class Ie{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,n){return new Ie(Object.fromEntries(Fi(n).map(r=>[r,Xt])),e)}constructor(...e){if(e.length===2){const[n,r]=e;this.lang=r,this._stacks=n}else{const[n,r,s]=e;this.lang=r,this._stacks={[s]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Xi(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function Xi(t){const e=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);const o=s?.nameScopesList?.scopeName;o&&e.push(o),s.parent&&r(s.parent)}return r(t),e}function Ki(t,e){if(!(t instanceof Ie))throw new F("Invalid grammar state");return t.getInternalStack(e)}function Zi(){const t=new WeakMap;function e(n){if(!t.has(n.meta)){let r=function(i){if(typeof i=="number"){if(i<0||i>n.source.length)throw new F(`Invalid decoration offset: ${i}. Code length: ${n.source.length}`);return{...s.indexToPos(i),offset:i}}else{const a=s.lines[i.line];if(a===void 0)throw new F(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${s.lines.length}`);let l=i.character;if(l<0&&(l=a.length+l),l<0||l>a.length)throw new F(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${a.length}`);return{...i,character:l,offset:s.posToIndex(i.line,l)}}};const s=Wi(n.source),o=(n.options.decorations||[]).map(i=>({...i,start:r(i.start),end:r(i.end)}));Qi(o),t.set(n.meta,{decorations:o,converter:s,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(!this.options.decorations?.length)return;const s=e(this).decorations.flatMap(i=>[i.start.offset,i.end.offset]);return Vi(n,s)},code(n){if(!this.options.decorations?.length)return;const r=e(this),s=Array.from(n.children).filter(u=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new F(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function o(u,f,h,d){const p=s[u];let b="",w=-1,m=-1;if(f===0&&(w=0),h===0&&(m=0),h===Number.POSITIVE_INFINITY&&(m=p.children.length),w===-1||m===-1)for(let g=0;g<p.children.length;g++)b+=ts(p.children[g]),w===-1&&b.length===f&&(w=g+1),m===-1&&b.length===h&&(m=g+1);if(w===-1)throw new F(`Failed to find start index for decoration ${JSON.stringify(d.start)}`);if(m===-1)throw new F(`Failed to find end index for decoration ${JSON.stringify(d.end)}`);const y=p.children.slice(w,m);if(!d.alwaysWrap&&y.length===p.children.length)a(p,d,"line");else if(!d.alwaysWrap&&y.length===1&&y[0].type==="element")a(y[0],d,"token");else{const g={type:"element",tagName:"span",properties:{},children:y};a(g,d,"wrapper"),p.children.splice(w,y.length,g)}}function i(u,f){s[u]=a(s[u],f,"line")}function a(u,f,h){const d=f.properties||{},p=f.transform||(b=>b);return u.tagName=f.tagName||"span",u.properties={...u.properties,...d,class:u.properties.class},f.properties?.class&&Jr(u,f.properties.class),u=p(u,h)||u,u}const l=[],c=r.decorations.sort((u,f)=>f.start.offset-u.start.offset||u.end.offset-f.end.offset);for(const u of c){const{start:f,end:h}=u;if(f.line===h.line)o(f.line,f.character,h.character,u);else if(f.line<h.line){o(f.line,f.character,Number.POSITIVE_INFINITY,u);for(let d=f.line+1;d<h.line;d++)l.unshift(()=>i(d,u));o(h.line,0,h.character,u)}}l.forEach(u=>u())}}}function Qi(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.start.offset>n.end.offset)throw new F(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;r<t.length;r++){const s=t[r],o=n.start.offset<=s.start.offset&&s.start.offset<n.end.offset,i=n.start.offset<s.end.offset&&s.end.offset<=n.end.offset,a=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,l=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset;if(o||i||a||l){if(o&&i||a&&l||a&&n.start.offset===n.end.offset||i&&s.start.offset===s.end.offset)continue;throw new F(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function ts(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(ts).join(""):""}const Yi=[Zi()];function ut(t){const e=Ji(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...Yi]}function Ji(t){const e=[],n=[],r=[];for(const s of t)switch(s.enforce){case"pre":e.push(s);break;case"post":n.push(s);break;default:r.push(s)}return{pre:e,post:n,normal:r}}var he=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Rt={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function ea(t,e){const n=t.indexOf("\x1B",e);if(n!==-1&&t[n+1]==="["){const r=t.indexOf("m",n);if(r!==-1)return{sequence:t.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:t.length}}function Wn(t){const e=t.shift();if(e==="2"){const n=t.splice(0,3).map(r=>Number.parseInt(r));return n.length!==3||n.some(r=>Number.isNaN(r))?void 0:{type:"rgb",rgb:n}}else if(e==="5"){const n=t.shift();if(n)return{type:"table",index:Number(n)}}}function ta(t){const e=[];for(;t.length>0;){const n=t.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)e.push({type:"resetAll"});else if(r<=9)Rt[r]&&e.push({type:"setDecoration",value:Rt[r]});else if(r<=29){const s=Rt[r-20];s&&(e.push({type:"resetDecoration",value:s}),s==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)e.push({type:"setForegroundColor",value:{type:"named",name:he[r-30]}});else if(r===38){const s=Wn(t);s&&e.push({type:"setForegroundColor",value:s})}else if(r===39)e.push({type:"resetForegroundColor"});else if(r<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:he[r-40]}});else if(r===48){const s=Wn(t);s&&e.push({type:"setBackgroundColor",value:s})}else r===49?e.push({type:"resetBackgroundColor"}):r===53?e.push({type:"setDecoration",value:"overline"}):r===55?e.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?e.push({type:"setForegroundColor",value:{type:"named",name:he[r-90+8]}}):r>=100&&r<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:he[r-100+8]}})}return e}function na(){let t=null,e=null,n=new Set;return{parse(r){const s=[];let o=0;do{const i=ea(r,o),a=i.sequence?r.substring(o,i.startPosition):r.substring(o);if(a.length>0&&s.push({value:a,foreground:t,background:e,decorations:new Set(n)}),i.sequence){const l=ta(i.sequence);for(const c of l)c.type==="resetAll"?(t=null,e=null,n.clear()):c.type==="resetForegroundColor"?t=null:c.type==="resetBackgroundColor"?e=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of l)c.type==="setForegroundColor"?t=c.value:c.type==="setBackgroundColor"?e=c.value:c.type==="setDecoration"&&n.add(c.value)}o=i.position}while(o<r.length);return s}}}var ra={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function sa(t=ra){function e(a){return t[a]}function n(a){return`#${a.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let c=0;c<he.length;c++)r.push(e(he[c]));let a=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let u=0;u<6;u++)for(let f=0;f<6;f++)r.push(n([a[c],a[u],a[f]]));let l=8;for(let c=0;c<24;c++,l+=10)r.push(n([l,l,l]));return r}function o(a){return s()[a]}function i(a){switch(a.type){case"named":return e(a.name);case"rgb":return n(a.rgb);case"table":return o(a.index)}}return{value:i}}const oa={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function ia(t,e,n){const r=lt(t,n),s=pt(e),o=Object.fromEntries(he.map(l=>{const c=`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`,u=t.colors?.[c];return[l,u||oa[l]]})),i=sa(o),a=na();return s.map(l=>a.parse(l[0]).map(c=>{let u,f;c.decorations.has("reverse")?(u=c.background?i.value(c.background):t.bg,f=c.foreground?i.value(c.foreground):t.fg):(u=c.foreground?i.value(c.foreground):t.fg,f=c.background?i.value(c.background):void 0),u=le(u,r),f=le(f,r),c.decorations.has("dim")&&(u=aa(u));let h=W.None;return c.decorations.has("bold")&&(h|=W.Bold),c.decorations.has("italic")&&(h|=W.Italic),c.decorations.has("underline")&&(h|=W.Underline),c.decorations.has("strikethrough")&&(h|=W.Strikethrough),{content:c.value,offset:l[1],color:u,bgColor:f,fontStyle:h}}))}function aa(t){const e=t.match(/#([0-9a-f]{3,8})/i);if(e){const r=e[1];if(r.length===8){const s=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${s}`}else{if(r.length===6)return`#${r}80`;if(r.length===4){const s=r[0],o=r[1],i=r[2],a=r[3],l=Math.round(Number.parseInt(`${a}${a}`,16)/2).toString(16).padStart(2,"0");return`#${s}${s}${o}${o}${i}${i}${l}`}else if(r.length===3){const s=r[0],o=r[1],i=r[2];return`#${s}${s}${o}${o}${i}${i}80`}}}const n=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:t}function mn(t,e,n={}){const{theme:r=t.getLoadedThemes()[0]}=n,s=t.resolveLangAlias(n.lang||"text");if(dn(s)||pn(r))return pt(e).map(l=>[{content:l[0],offset:l[1]}]);const{theme:o,colorMap:i}=t.setTheme(r);if(s==="ansi")return ia(o,e,n);const a=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==a.name)throw new F(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(o.name))throw new F(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return ca(e,a,o,i,n)}function la(...t){if(t.length===2)return Ge(t[1]);const[e,n,r={}]=t,{lang:s="text",theme:o=e.getLoadedThemes()[0]}=r;if(dn(s)||pn(o))throw new F("Plain language does not have grammar state");if(s==="ansi")throw new F("ANSI language does not have grammar state");const{theme:i,colorMap:a}=e.setTheme(o),l=e.getLanguage(s);return new Ie(yn(n,l,i,a,r).stateStack,l.name,i.name)}function ca(t,e,n,r,s){const o=yn(t,e,n,r,s),i=new Ie(o.stateStack,e.name,n.name);return gt(o.tokens,i),o.tokens}function yn(t,e,n,r,s){const o=lt(n,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:a=500}=s,l=pt(t);let c=s.grammarState?Ki(s.grammarState,n.name)??Xt:s.grammarContextCode!=null?yn(s.grammarContextCode,e,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:Xt,u=[];const f=[];for(let h=0,d=l.length;h<d;h++){const[p,b]=l[h];if(p===""){u=[],f.push([]);continue}if(i>0&&p.length>=i){u=[],f.push([{content:p,offset:b,color:"",fontStyle:0}]);continue}let w,m,y;s.includeExplanation&&(w=e.tokenizeLine(p,c,a),m=w.tokens,y=0);const g=e.tokenizeLine2(p,c,a),_=g.tokens.length/2;for(let S=0;S<_;S++){const x=g.tokens[2*S],v=S+1<_?g.tokens[2*S+2]:p.length;if(x===v)continue;const k=g.tokens[2*S+1],A=le(r[xe.getForeground(k)],o),R=xe.getFontStyle(k),$={content:p.substring(x,v),offset:b+x,color:A,fontStyle:R};if(s.includeExplanation){const N=[];if(s.includeExplanation!=="scopeName")for(const L of n.settings){let X;switch(typeof L.scope){case"string":X=L.scope.split(/,/).map(Le=>Le.trim());break;case"object":X=L.scope;break;default:continue}N.push({settings:L,selectors:X.map(Le=>Le.split(/ /))})}$.explanation=[];let z=0;for(;x+z<v;){const L=m[y],X=p.substring(L.startIndex,L.endIndex);z+=X.length,$.explanation.push({content:X,scopes:s.includeExplanation==="scopeName"?ua(L.scopes):fa(N,L.scopes)}),y+=1}}u.push($)}f.push(u),u=[],c=g.ruleStack}return{tokens:f,stateStack:c}}function ua(t){return t.map(e=>({scopeName:e}))}function fa(t,e){const n=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];n[r]={scopeName:o,themeMatches:da(t,o,e.slice(0,r))}}return n}function zn(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function ha(t,e,n){if(!zn(t[t.length-1],e))return!1;let r=t.length-2,s=n.length-1;for(;r>=0&&s>=0;)zn(t[r],n[s])&&(r-=1),s-=1;return r===-1}function da(t,e,n){const r=[];for(const{selectors:s,settings:o}of t)for(const i of s)if(ha(i,e,n)){r.push(o);break}return r}function ns(t,e,n){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),s=r.map(l=>{const c=mn(t,e,{...n,theme:l.theme}),u=Ge(c),f=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:u,theme:f}}),o=pa(...s.map(l=>l.tokens)),i=o[0].map((l,c)=>l.map((u,f)=>{const h={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=u.explanation),o.forEach((d,p)=>{const{content:b,explanation:w,offset:m,...y}=d[c][f];h.variants[r[p].color]=y}),h})),a=s[0].state?new Ie(Object.fromEntries(s.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),s[0].state.lang):void 0;return a&>(i,a),i}function pa(...t){const e=t.map(()=>[]),n=t.length;for(let r=0;r<t[0].length;r++){const s=t.map(l=>l[r]),o=e.map(()=>[]);e.forEach((l,c)=>l.push(o[c]));const i=s.map(()=>0),a=s.map(l=>l[0]);for(;a.every(l=>l);){const l=Math.min(...a.map(c=>c.content.length));for(let c=0;c<n;c++){const u=a[c];u.content.length===l?(o[c].push(u),i[c]+=1,a[c]=s[c][i[c]]):(o[c].push({...u,content:u.content.slice(0,l)}),a[c]={...u,content:u.content.slice(l),offset:u.offset+l})}}}return e}function ft(t,e,n){let r,s,o,i,a,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:f="css-vars"}=n,h=Object.entries(n.themes).filter(m=>m[1]).map(m=>({color:m[0],theme:m[1]})).sort((m,y)=>m.color===c?-1:y.color===c?1:0);if(h.length===0)throw new F("`themes` option must not be empty");const d=ns(t,e,n);if(l=Ge(d),c&&gn!==c&&!h.find(m=>m.color===c))throw new F(`\`themes\` option must contain the defaultColor key \`${c}\``);const p=h.map(m=>t.getTheme(m.theme)),b=h.map(m=>m.color);o=d.map(m=>m.map(y=>qi(y,b,u,c,f))),l&>(o,l);const w=h.map(m=>lt(m.theme,n));s=Hn(h,p,w,u,c,"fg",f),r=Hn(h,p,w,u,c,"bg",f),i=`shiki-themes ${p.map(m=>m.name).join(" ")}`,a=c?void 0:[s,r].join(";")}else if("theme"in n){const c=lt(n.theme,n);o=mn(t,e,n);const u=t.getTheme(n.theme);r=le(u.bg,c),s=le(u.fg,c),i=u.name,l=Ge(o)}else throw new F("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:s,bg:r,themeName:i,rootStyle:a,grammarState:l}}function Hn(t,e,n,r,s,o,i){return t.map((a,l)=>{const c=le(e[l][o],n[l])||"inherit",u=`${r+a.color}${o==="bg"?"-bg":""}:${c}`;if(l===0&&s){if(s===gn&&t.length>1){const f=t.findIndex(b=>b.color==="light"),h=t.findIndex(b=>b.color==="dark");if(f===-1||h===-1)throw new F('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const d=le(e[f][o],n[f])||"inherit",p=le(e[h][o],n[h])||"inherit";return`light-dark(${d}, ${p});${u}`}return c}return i==="css-vars"?u:null}).filter(a=>!!a).join(";")}function ht(t,e,n,r={meta:{},options:n,codeToHast:(s,o)=>ht(t,s,o),codeToTokens:(s,o)=>ft(t,s,o)}){let s=e;for(const p of ut(n))s=p.preprocess?.call(r,s,n)||s;let{tokens:o,fg:i,bg:a,themeName:l,rootStyle:c,grammarState:u}=ft(t,s,n);const{mergeWhitespaces:f=!0,mergeSameStyleTokens:h=!1}=n;f===!0?o=ma(o):f==="never"&&(o=ya(o)),h&&(o=ba(o));const d={...r,get source(){return s}};for(const p of ut(n))o=p.tokens?.call(d,o)||o;return ga(o,{...n,fg:i,bg:a,themeName:l,rootStyle:n.rootStyle===!1?!1:n.rootStyle??c},d,u)}function ga(t,e,n,r=Ge(t)){const s=ut(e),o=[],i={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=e,c={class:`shiki ${e.themeName||""}`};e.rootStyle!==!1&&(e.rootStyle!=null?c.style=e.rootStyle:c.style=`background-color:${e.bg};color:${e.fg}`),l!==!1&&l!=null&&(c.tabindex=l.toString());for(const[b,w]of Object.entries(e.meta||{}))b.startsWith("_")||(c[b]=w);let u={type:"element",tagName:"pre",properties:c,children:[]},f={type:"element",tagName:"code",properties:{},children:o};const h=[],d={...n,structure:a,addClassToHast:Jr,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return i},get pre(){return u},get code(){return f},get lines(){return h}};if(t.forEach((b,w)=>{w&&(a==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&o.push({type:"text",value:`
|
|
12
|
+
`}));let m={type:"element",tagName:"span",properties:{class:"line"},children:[]},y=0;for(const g of b){let _={type:"element",tagName:"span",properties:{...g.htmlAttrs},children:[{type:"text",value:g.content}]};const S=Jt(g.htmlStyle||ct(g));S&&(_.properties.style=S);for(const x of s)_=x?.span?.call(d,_,w+1,y,m,g)||_;a==="inline"?i.children.push(_):a==="classic"&&m.children.push(_),y+=g.content.length}if(a==="classic"){for(const g of s)m=g?.line?.call(d,m,w+1)||m;h.push(m),o.push(m)}else a==="inline"&&h.push(m)}),a==="classic"){for(const b of s)f=b?.code?.call(d,f)||f;u.children.push(f);for(const b of s)u=b?.pre?.call(d,u)||u;i.children.push(u)}else if(a==="inline"){const b=[];let w={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const g of i.children)g.type==="element"&&g.tagName==="br"?(b.push(w),w={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(g.type==="element"||g.type==="text")&&w.children.push(g);b.push(w);let y={type:"element",tagName:"code",properties:{},children:b};for(const g of s)y=g?.code?.call(d,y)||y;i.children=[];for(let g=0;g<y.children.length;g++){g>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const _=y.children[g];_.type==="element"&&i.children.push(..._.children)}}let p=i;for(const b of s)p=b?.root?.call(d,p)||p;return r&>(p,r),p}function ma(t){return t.map(e=>{const n=[];let r="",s;return e.forEach((o,i)=>{const l=!(o.fontStyle&&(o.fontStyle&W.Underline||o.fontStyle&W.Strikethrough));l&&o.content.match(/^\s+$/)&&e[i+1]?(s===void 0&&(s=o.offset),r+=o.content):r?(l?n.push({...o,offset:s,content:r+o.content}):n.push({content:r,offset:s},o),s=void 0,r=""):n.push(o)}),n})}function ya(t){return t.map(e=>e.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,s,o,i]=r;if(!s&&!i)return n;const a=[{...n,offset:n.offset+s.length,content:o}];return s&&a.unshift({content:s,offset:n.offset}),i&&a.push({content:i,offset:n.offset+s.length+o.length}),a}))}function ba(t){return t.map(e=>{const n=[];for(const r of e){if(n.length===0){n.push({...r});continue}const s=n[n.length-1],o=Jt(s.htmlStyle||ct(s)),i=Jt(r.htmlStyle||ct(r)),a=s.fontStyle&&(s.fontStyle&W.Underline||s.fontStyle&W.Strikethrough),l=r.fontStyle&&(r.fontStyle&W.Underline||r.fontStyle&W.Strikethrough);!a&&!l&&o===i?s.content+=r.content:n.push({...r})}return n})}const wa=Di;function Ca(t,e,n){const r={meta:{},options:n,codeToHast:(o,i)=>ht(t,o,i),codeToTokens:(o,i)=>ft(t,o,i)};let s=wa(ht(t,e,n,r));for(const o of ut(n))s=o.postprocess?.call(r,s,n)||s;return s}const Vn={light:"#333333",dark:"#bbbbbb"},qn={light:"#fffffe",dark:"#1e1e1e"},Xn="__shiki_resolved";function bn(t){if(t?.[Xn])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:r}=e;if(!n||!r){const a=e.settings?e.settings.find(l=>!l.name&&!l.scope):void 0;a?.settings?.foreground&&(r=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!r&&e?.colors?.["editor.foreground"]&&(r=e.colors["editor.foreground"]),!n&&e?.colors?.["editor.background"]&&(n=e.colors["editor.background"]),r||(r=e.type==="light"?Vn.light:Vn.dark),n||(n=e.type==="light"?qn.light:qn.dark),e.fg=r,e.bg=n}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0;const o=new Map;function i(a){if(o.has(a))return o.get(a);s+=1;const l=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${l}`]?i(a):(o.set(a,l),l)}e.settings=e.settings.map(a=>{const l=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),c=a.settings?.background&&!a.settings.background.startsWith("#");if(!l&&!c)return a;const u={...a,settings:{...a.settings}};if(l){const f=i(a.settings.foreground);e.colorReplacements[f]=a.settings.foreground,u.settings.foreground=f}if(c){const f=i(a.settings.background);e.colorReplacements[f]=a.settings.background,u.settings.background=f}return u});for(const a of Object.keys(e.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!e.colors[a]?.startsWith("#")){const l=i(e.colors[a]);e.colorReplacements[l]=e.colors[a],e.colors[a]=l}return Object.defineProperty(e,Xn,{enumerable:!1,writable:!1,value:!0}),e}async function rs(t){return Array.from(new Set((await Promise.all(t.filter(e=>!Ui(e)).map(async e=>await Yr(e).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function ss(t){return(await Promise.all(t.map(async n=>ji(n)?null:bn(await Yr(n))))).filter(n=>!!n)}let _a=3;function Sa(t,e=3){e>_a||console.trace(`[SHIKI DEPRECATE]: ${t}`)}let _e=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function os(t,e){if(!e)return t;if(e[t]){const n=new Set([t]);for(;e[t];){if(t=e[t],n.has(t))throw new _e(`Circular alias \`${Array.from(n).join(" -> ")} -> ${t}\``);n.add(t)}}return t}class ka extends ko{constructor(e,n,r,s={}){super(e),this._resolver=e,this._themes=n,this._langs=r,this._alias=s,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const n=bn(e);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let n=this._textmateThemeCache.get(e);n||(n=rt.createFromRawTheme(e),this._textmateThemeCache.set(e,n)),this._syncRegistry.setTheme(n)}getGrammar(e){return e=os(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const n=new Set([...this._langMap.values()].filter(o=>o.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(o=>{this._alias[o]=e.name}),this._loadedLanguagesCache=null,n.size)for(const o of n)this._resolvedGrammars.delete(o.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(o.scopeName),this._syncRegistry?._grammars?.delete(o.scopeName),this.loadLanguage(this._langMap.get(o.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const s of e)this.resolveEmbeddedLanguages(s);const n=Array.from(this._langGraph.entries()),r=n.filter(([s,o])=>!o);if(r.length){const s=n.filter(([o,i])=>i?(i.embeddedLanguages||i.embeddedLangs)?.some(l=>r.map(([c])=>c).includes(l)):!1).filter(o=>!r.includes(o));throw new _e(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${s.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[s,o]of n)this._resolver.addLanguage(o);for(const[s,o]of n)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const n=e.embeddedLanguages??e.embeddedLangs;if(n)for(const r of n)this._langGraph.set(r,this._langMap.get(r))}}class xa{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,n){this._onigLib={createOnigScanner:r=>e.createScanner(r),createOnigString:r=>e.createString(r)},n.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(n=>{this._langs.set(n,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(e.scopeName)})}getInjections(e){const n=e.split(".");let r=[];for(let s=1;s<=n.length;s++){const o=n.slice(0,s).join(".");r=[...r,...this._injections.get(o)||[]]}return r}}let Re=0;function va(t){Re+=1,t.warnings!==!1&&Re>=10&&Re%10===0&&console.warn(`[Shiki] ${Re} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!t.engine)throw new _e("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(bn),s=new xa(t.engine,n),o=new ka(s,r,n,t.langAlias);let i;function a(g){return os(g,t.langAlias)}function l(g){m();const _=o.getGrammar(typeof g=="string"?g:g.name);if(!_)throw new _e(`Language \`${g}\` not found, you may need to load it first`);return _}function c(g){if(g==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};m();const _=o.getTheme(g);if(!_)throw new _e(`Theme \`${g}\` not found, you may need to load it first`);return _}function u(g){m();const _=c(g);i!==g&&(o.setTheme(_),i=g);const S=o.getColorMap();return{theme:_,colorMap:S}}function f(){return m(),o.getLoadedThemes()}function h(){return m(),o.getLoadedLanguages()}function d(...g){m(),o.loadLanguages(g.flat(1))}async function p(...g){return d(await rs(g))}function b(...g){m();for(const _ of g.flat(1))o.loadTheme(_)}async function w(...g){return m(),b(await ss(g))}function m(){if(e)throw new _e("Shiki instance has been disposed")}function y(){e||(e=!0,o.dispose(),Re-=1)}return{setTheme:u,getTheme:c,getLanguage:l,getLoadedThemes:f,getLoadedLanguages:h,resolveLangAlias:a,loadLanguage:p,loadLanguageSync:d,loadTheme:w,loadThemeSync:b,dispose:y,[Symbol.dispose]:y}}async function Ia(t){t.engine||Sa("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,n,r]=await Promise.all([ss(t.themes||[]),rs(t.langs||[]),t.engine]);return va({...t,themes:e,langs:n,engine:r})}async function Ea(t){const e=await Ia(t);return{getLastGrammarState:(...n)=>la(e,...n),codeToTokensBase:(n,r)=>mn(e,n,r),codeToTokensWithThemes:(n,r)=>ns(e,n,r),codeToTokens:(n,r)=>ft(e,n,r),codeToHast:(n,r)=>ht(e,n,r),codeToHtml:(n,r)=>Ca(e,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}function Ee(t){if([...t].length!==1)throw new Error(`Expected "${t}" to be a single code point`);return t.codePointAt(0)}function Aa(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}const wn=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),U=String.raw;function Ae(t,e){if(t==null)throw new Error(e??"Value expected");return t}const is=U`\[\^?`,as=`c.? | C(?:-.?)?|${U`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${U`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${U`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${U`o\{[^\}]*\}?`}|${U`\d{1,3}`}`,Cn=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,qe=new RegExp(U`
|
|
13
|
+
\\ (?:
|
|
14
|
+
${as}
|
|
15
|
+
| [gk]<[^>]*>?
|
|
16
|
+
| [gk]'[^']*'?
|
|
17
|
+
| .
|
|
18
|
+
)
|
|
19
|
+
| \( (?:
|
|
20
|
+
\? (?:
|
|
21
|
+
[:=!>({]
|
|
22
|
+
| <[=!]
|
|
23
|
+
| <[^>]*>
|
|
24
|
+
| '[^']*'
|
|
25
|
+
| ~\|?
|
|
26
|
+
| #(?:[^)\\]|\\.?)*
|
|
27
|
+
| [^:)]*[:)]
|
|
28
|
+
)?
|
|
29
|
+
| \*[^\)]*\)?
|
|
30
|
+
)?
|
|
31
|
+
| (?:${Cn.source})+
|
|
32
|
+
| ${is}
|
|
33
|
+
| .
|
|
34
|
+
`.replace(/\s+/g,""),"gsu"),Nt=new RegExp(U`
|
|
35
|
+
\\ (?:
|
|
36
|
+
${as}
|
|
37
|
+
| .
|
|
38
|
+
)
|
|
39
|
+
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
40
|
+
| ${is}
|
|
41
|
+
| &&
|
|
42
|
+
| .
|
|
43
|
+
`.replace(/\s+/g,""),"gsu");function La(t,e={}){const n={flags:"",...e,rules:{captureGroup:!1,singleline:!1,...e.rules}};if(typeof t!="string")throw new Error("String expected as pattern");const r=Xa(n.flags),s=[r.extended],o={captureGroup:n.rules.captureGroup,getCurrentModX(){return s.at(-1)},numOpenGroups:0,popModX(){s.pop()},pushModX(f){s.push(f)},replaceCurrentModX(f){s[s.length-1]=f},singleline:n.rules.singleline};let i=[],a;for(qe.lastIndex=0;a=qe.exec(t);){const f=Ra(o,t,a[0],qe.lastIndex);f.tokens?i.push(...f.tokens):f.token&&i.push(f.token),f.lastIndex!==void 0&&(qe.lastIndex=f.lastIndex)}const l=[];let c=0;i.filter(f=>f.type==="GroupOpen").forEach(f=>{f.kind==="capturing"?f.number=++c:f.raw==="("&&l.push(f)}),c||l.forEach((f,h)=>{f.kind="capturing",f.number=h+1});const u=c||l.length;return{tokens:i.map(f=>f.type==="EscapedNumber"?Za(f,u):f).flat(),flags:r}}function Ra(t,e,n,r){const[s,o]=n;if(n==="["||n==="[^"){const i=Na(e,n,r);return{tokens:i.tokens,lastIndex:i.lastIndex}}if(s==="\\"){if("AbBGyYzZ".includes(o))return{token:Kn(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:Ua(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:cs(n)}}if(o==="K")return{token:us("keep",n)};if(o==="N"||o==="R")return{token:de("newline",n,{negate:o==="N"})};if(o==="O")return{token:de("any",n)};if(o==="X")return{token:de("text_segment",n)};const i=ls(n,{inCharClass:!1});return Array.isArray(i)?{tokens:i}:{token:i}}if(s==="("){if(o==="*")return{token:Ha(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(e[r]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:za(n,t)};if(t.pushModX(t.getCurrentModX()),t.numOpenGroups++,n==="("&&!t.captureGroup||n==="(?:")return{token:we("group",n)};if(n==="(?>")return{token:we("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:we(n[2]==="<"?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if(n==="("&&t.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:we("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:we("absence_repeater",n)}}throw n==="(?("?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(n===")"){if(t.popModX(),t.numOpenGroups--,t.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:Ga(n)}}if(t.getCurrentModX()){if(n==="#"){const i=e.indexOf(`
|
|
44
|
+
`,r);return{lastIndex:i===-1?e.length:i}}if(/^\s$/.test(n)){const i=/\s+/y;return i.lastIndex=r,{lastIndex:i.exec(e)?i.lastIndex:r}}}if(n===".")return{token:de("dot",n)};if(n==="^"||n==="$"){const i=t.singleline?{"^":U`\A`,$:U`\Z`}[n]:n;return{token:Kn(i,n)}}return n==="|"?{token:Ta(n)}:Cn.test(n)?{tokens:Qa(n)}:{token:se(Ee(n),n)}}function Na(t,e,n){const r=[Zn(e[1]==="^",e)];let s=1,o;for(Nt.lastIndex=n;o=Nt.exec(t);){const i=o[0];if(i[0]==="["&&i[1]!==":")s++,r.push(Zn(i[1]==="^",i));else if(i==="]"){if(r.at(-1).type==="CharacterClassOpen")r.push(se(93,i));else if(s--,r.push($a(i)),!s)break}else{const a=Pa(i);Array.isArray(a)?r.push(...a):r.push(a)}}return{tokens:r,lastIndex:Nt.lastIndex||t.length}}function Pa(t){if(t[0]==="\\")return ls(t,{inCharClass:!0});if(t[0]==="["){const e=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(t);if(!e||!wn.has(e.groups.name))throw new Error(`Invalid POSIX class "${t}"`);return de("posix",t,{value:e.groups.name,negate:!!e.groups.negate})}return t==="-"?Ma(t):t==="&&"?Oa(t):se(Ee(t),t)}function ls(t,{inCharClass:e}){const n=t[1];if(n==="c"||n==="C")return Wa(t);if("dDhHsSwW".includes(n))return Va(t);if(t.startsWith(U`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${t}"`);if(/^\\[pP]\{/.test(t)){if(t.length===3)throw new Error(`Incomplete or invalid Unicode property "${t}"`);return qa(t)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(t))try{const r=t.split(/\\x/).slice(1).map(i=>parseInt(i,16)),s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(r)),o=new TextEncoder;return[...s].map(i=>{const a=[...o.encode(i)].map(l=>`\\x${l.toString(16)}`).join("");return se(Ee(i),a)})}catch{throw new Error(`Multibyte code "${t}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return se(Ka(t),t);if(Qn.has(n))return se(Qn.get(n),t);if(/\d/.test(n))return Da(e,t);if(t==="\\")throw new Error(U`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${t}"`);if([...t].length===2)return se(t.codePointAt(1),t);throw new Error(`Unexpected escape "${t}"`)}function Ta(t){return{type:"Alternator",raw:t}}function Kn(t,e){return{type:"Assertion",kind:t,raw:e}}function cs(t){return{type:"Backreference",raw:t}}function se(t,e){return{type:"Character",value:t,raw:e}}function $a(t){return{type:"CharacterClassClose",raw:t}}function Ma(t){return{type:"CharacterClassHyphen",raw:t}}function Oa(t){return{type:"CharacterClassIntersector",raw:t}}function Zn(t,e){return{type:"CharacterClassOpen",negate:t,raw:e}}function de(t,e,n={}){return{type:"CharacterSet",kind:t,...n,raw:e}}function us(t,e,n={}){return t==="keep"?{type:"Directive",kind:t,raw:e}:{type:"Directive",kind:t,flags:Ae(n.flags),raw:e}}function Da(t,e){return{type:"EscapedNumber",inCharClass:t,raw:e}}function Ga(t){return{type:"GroupClose",raw:t}}function we(t,e,n={}){return{type:"GroupOpen",kind:t,...n,raw:e}}function Ba(t,e,n,r){return{type:"NamedCallout",kind:t,tag:e,arguments:n,raw:r}}function Fa(t,e,n,r){return{type:"Quantifier",kind:t,min:e,max:n,raw:r}}function Ua(t){return{type:"Subroutine",raw:t}}const ja=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),Qn=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function Wa(t){const e=t[1]==="c"?t[2]:t[3];if(!e||!/[A-Za-z]/.test(e))throw new Error(`Unsupported control character "${t}"`);return se(Ee(e.toUpperCase())-64,t)}function za(t,e){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(t).groups;r??="";const s=(e.getCurrentModX()||n.includes("x"))&&!r.includes("x"),o=Jn(n),i=Jn(r),a={};if(o&&(a.enable=o),i&&(a.disable=i),t.endsWith(")"))return e.replaceCurrentModX(s),us("flags",t,{flags:a});if(t.endsWith(":"))return e.pushModX(s),e.numOpenGroups++,we("group",t,{...(o||i)&&{flags:a}});throw new Error(`Unexpected flag modifier "${t}"`)}function Ha(t){const e=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(t);if(!e)throw new Error(`Incomplete or invalid named callout "${t}"`);const{name:n,tag:r,args:s}=e.groups;if(!n)throw new Error(`Invalid named callout "${t}"`);if(r==="")throw new Error(`Named callout tag with empty value not allowed "${t}"`);const o=s?s.split(",").filter(u=>u!=="").map(u=>/^[+-]?\d+$/.test(u)?+u:u):[],[i,a,l]=o,c=ja.has(n)?n.toLowerCase():"custom";switch(c){case"fail":case"mismatch":case"skip":if(o.length>0)throw new Error(`Named callout arguments not allowed "${o}"`);break;case"error":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(typeof i=="string")throw new Error(`Named callout argument must be a number "${i}"`);break;case"max":if(!o.length||o.length>2)throw new Error(`Named callout must have one or two arguments "${o}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(o.length===2&&(typeof a=="number"||!/^[<>X]$/.test(a)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${a}"`);break;case"count":case"total_count":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(o.length===1&&(typeof i=="number"||!/^[<>X]$/.test(i)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${i}"`);break;case"cmp":if(o.length!==3)throw new Error(`Named callout must have three arguments "${o}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(typeof a=="number"||!/^(?:[<>!=]=|[<>])$/.test(a))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${a}"`);if(typeof l=="string"&&!/^[A-Za-z_]\w*$/.test(l))throw new Error(`Named callout argument three must be a tag or number "${l}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${c}"`)}return Ba(c,r??null,s?.split(",")??null,t)}function Yn(t){let e=null,n,r;if(t[0]==="{"){const{minStr:s,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(t).groups,i=1e5;if(+s>i||o&&+o>i)throw new Error("Quantifier value unsupported in Oniguruma");if(n=+s,r=o===void 0?+s:o===""?1/0:+o,n>r&&(e="possessive",[n,r]=[r,n]),t.endsWith("?")){if(e==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');e="lazy"}else e||(e="greedy")}else n=t[0]==="+"?1:0,r=t[0]==="?"?1:1/0,e=t[1]==="+"?"possessive":t[1]==="?"?"lazy":"greedy";return Fa(e,n,r,t)}function Va(t){const e=t[1].toLowerCase();return de({d:"digit",h:"hex",s:"space",w:"word"}[e],t,{negate:t[1]!==e})}function qa(t){const{p:e,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(t).groups;return de("property",t,{value:r,negate:e==="P"&&!n||e==="p"&&!!n})}function Jn(t){const e={};return t.includes("i")&&(e.ignoreCase=!0),t.includes("m")&&(e.dotAll=!0),t.includes("x")&&(e.extended=!0),Object.keys(e).length?e:null}function Xa(t){const e={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<t.length;n++){const r=t[n];if(!"imxDPSWy".includes(r))throw new Error(`Invalid flag "${r}"`);if(r==="y"){if(!/^y{[gw]}/.test(t.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');e.textSegmentMode=t[n+2]==="g"?"grapheme":"word",n+=3;continue}e[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[r]]=!0}return e}function Ka(t){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(t))throw new Error(`Incomplete or invalid escape "${t}"`);const e=t[2]==="{"?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(t).groups.hex:t.slice(2);return parseInt(e,16)}function Za(t,e){const{raw:n,inCharClass:r}=t,s=n.slice(1);if(!r&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=e))return[cs(n)];const o=[],i=s.match(/^[0-7]+|\d/g);for(let a=0;a<i.length;a++){const l=i[a];let c;if(a===0&&l!=="8"&&l!=="9"){if(c=parseInt(l,8),c>127)throw new Error(U`Octal encoded byte above 177 unsupported "${n}"`)}else c=Ee(l);o.push(se(c,(a===0?"\\":"")+l))}return o}function Qa(t){const e=[],n=new RegExp(Cn,"gy");let r;for(;r=n.exec(t);){const s=r[0];if(s[0]==="{"){const o=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);if(o){const{min:i,max:a}=o.groups;if(+i>+a&&s.endsWith("?")){n.lastIndex--,e.push(Yn(s.slice(0,-1)));continue}}}e.push(Yn(s))}return e}function fs(t,e){if(!Array.isArray(t.body))throw new Error("Expected node with body array");if(t.body.length!==1)return!1;const n=t.body[0];return!e||Object.keys(e).every(r=>e[r]===n[r])}function Ya(t){return Ja.has(t.type)}const Ja=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function hs(t,e={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e,rules:{captureGroup:!1,singleline:!1,...e.rules}},r=La(t,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),s=(h,d)=>{const p=r.tokens[o.nextIndex];switch(o.parent=h,o.nextIndex++,p.type){case"Alternator":return ge();case"Assertion":return el(p);case"Backreference":return tl(p,o);case"Character":return mt(p.value,{useLastValid:!!d.isCheckingRangeEnd});case"CharacterClassHyphen":return nl(p,o,d);case"CharacterClassOpen":return rl(p,o,d);case"CharacterSet":return sl(p,o);case"Directive":return ul(p.kind,{flags:p.flags});case"GroupOpen":return ol(p,o,d);case"NamedCallout":return hl(p.kind,p.tag,p.arguments);case"Quantifier":return il(p,o);case"Subroutine":return al(p,o);default:throw new Error(`Unexpected token type "${p.type}"`)}},o={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:s},i=pl(fl(r.flags));let a=i.body[0];for(;o.nextIndex<r.tokens.length;){const h=s(a,{});h.type==="Alternative"?(i.body.push(h),a=h):a.body.push(h)}const{capturingGroups:l,hasNumberedRef:c,namedGroupsByName:u,subroutines:f}=o;if(c&&u.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:h}of f)if(typeof h=="number"){if(h>l.length)throw new Error("Subroutine uses a group number that's not defined");h&&(l[h-1].isSubroutined=!0)}else if(u.has(h)){if(u.get(h).length>1)throw new Error(U`Subroutine uses a duplicate group name "\g<${h}>"`);u.get(h)[0].isSubroutined=!0}else throw new Error(U`Subroutine uses a group name that's not defined "\g<${h}>"`);return i}function el({kind:t}){return en(Ae({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[t],`Unexpected assertion kind "${t}"`),{negate:t===U`\B`||t===U`\Y`})}function tl({raw:t},e){const n=/^\\k[<']/.test(t),r=n?t.slice(3,-1):t.slice(1),s=(o,i=!1)=>{const a=e.capturingGroups.length;let l=!1;if(o>a)if(e.skipBackrefValidation)l=!0;else throw new Error(`Not enough capturing groups defined to the left "${t}"`);return e.hasNumberedRef=!0,tn(i?a+1-o:o,{orphan:l})};if(n){const o=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(o)return s(+o.groups.num,!!o.groups.sign);if(/[-+]/.test(r))throw new Error(`Invalid backref name "${t}"`);if(!e.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${t}"`);return tn(r)}return s(+r)}function nl(t,e,n){const{tokens:r,walk:s}=e,o=e.parent,i=o.body.at(-1),a=r[e.nextIndex];if(!n.isCheckingRangeEnd&&i&&i.type!=="CharacterClass"&&i.type!=="CharacterClassRange"&&a&&a.type!=="CharacterClassOpen"&&a.type!=="CharacterClassClose"&&a.type!=="CharacterClassIntersector"){const l=s(o,{...n,isCheckingRangeEnd:!0});if(i.type==="Character"&&l.type==="Character")return o.body.pop(),cl(i,l);throw new Error("Invalid character class range")}return mt(Ee("-"))}function rl({negate:t},e,n){const{tokens:r,walk:s}=e,o=r[e.nextIndex],i=[tt()];let a=nr(o);for(;a.type!=="CharacterClassClose";){if(a.type==="CharacterClassIntersector")i.push(tt()),e.nextIndex++;else{const c=i.at(-1);c.body.push(s(c,n))}a=nr(r[e.nextIndex],o)}const l=tt({negate:t});return i.length===1?l.body=i[0].body:(l.kind="intersection",l.body=i.map(c=>c.body.length===1?c.body[0]:c)),e.nextIndex++,l}function sl({kind:t,negate:e,value:n},r){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i}=r;if(t==="property"){const a=yt(n);if(wn.has(a)&&!i?.has(a))t="posix",n=a;else return Ce(n,{negate:e,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i})}return t==="posix"?dl(n,{negate:e}):nn(t,{negate:e})}function ol(t,e,n){const{tokens:r,capturingGroups:s,namedGroupsByName:o,skipLookbehindValidation:i,walk:a}=e,l=gl(t),c=l.type==="AbsenceFunction",u=tr(l),f=u&&l.negate;if(l.type==="CapturingGroup"&&(s.push(l),l.name&&Aa(o,l.name,[]).push(l)),c&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let h=rr(r[e.nextIndex]);for(;h.type!=="GroupClose";){if(h.type==="Alternator")l.body.push(ge()),e.nextIndex++;else{const d=l.body.at(-1),p=a(d,{...n,isInAbsenceFunction:n.isInAbsenceFunction||c,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||f});if(d.body.push(p),(u||n.isInLookbehind)&&!i){const b="Lookbehind includes a pattern not allowed by Oniguruma";if(f||n.isInNegLookbehind){if(er(p)||p.type==="CapturingGroup")throw new Error(b)}else if(er(p)||tr(p)&&p.negate)throw new Error(b)}}h=rr(r[e.nextIndex])}return e.nextIndex++,l}function il({kind:t,min:e,max:n},r){const s=r.parent,o=s.body.at(-1);if(!o||!Ya(o))throw new Error("Quantifier requires a repeatable token");const i=ps(t,e,n,o);return s.body.pop(),i}function al({raw:t},e){const{capturingGroups:n,subroutines:r}=e;let s=t.slice(3,-1);const o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(o){const a=+o.groups.num,l=n.length;if(e.hasNumberedRef=!0,s={"":a,"+":l+a,"-":l+1-a}[o.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);const i=gs(s);return r.push(i),i}function ll(t,e){return{type:"AbsenceFunction",kind:t,body:We(e?.body)}}function ge(t){return{type:"Alternative",body:ms(t?.body)}}function en(t,e){const n={type:"Assertion",kind:t};return(t==="word_boundary"||t==="text_segment_boundary")&&(n.negate=!!e?.negate),n}function tn(t,e){const n=!!e?.orphan;return{type:"Backreference",ref:t,...n&&{orphan:n}}}function ds(t,e){const n={name:void 0,isSubroutined:!1,...e};if(n.name!==void 0&&!ml(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:t,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:We(e?.body)}}function mt(t,e){const n={useLastValid:!1,...e};if(t>1114111){const r=t.toString(16);if(n.useLastValid)t=1114111;else throw t>1310719?new Error(`Invalid code point out of range "\\x{${r}}"`):new Error(`Invalid code point out of range in JS "\\x{${r}}"`)}return{type:"Character",value:t}}function tt(t){const e={kind:"union",negate:!1,...t};return{type:"CharacterClass",kind:e.kind,negate:e.negate,body:ms(t?.body)}}function cl(t,e){if(e.value<t.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:t,max:e}}function nn(t,e){const n=!!e?.negate,r={type:"CharacterSet",kind:t};return(t==="digit"||t==="hex"||t==="newline"||t==="space"||t==="word")&&(r.negate=n),(t==="text_segment"||t==="newline"&&!n)&&(r.variableLength=!0),r}function ul(t,e={}){if(t==="keep")return{type:"Directive",kind:t};if(t==="flags")return{type:"Directive",kind:t,flags:Ae(e.flags)};throw new Error(`Unexpected directive kind "${t}"`)}function fl(t){return{type:"Flags",...t}}function Y(t){const e=t?.atomic,n=t?.flags;if(e&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...e&&{atomic:e},...n&&{flags:n},body:We(t?.body)}}function fe(t){const e={behind:!1,negate:!1,...t};return{type:"LookaroundAssertion",kind:e.behind?"lookbehind":"lookahead",negate:e.negate,body:We(t?.body)}}function hl(t,e,n){return{type:"NamedCallout",kind:t,tag:e,arguments:n}}function dl(t,e){const n=!!e?.negate;if(!wn.has(t))throw new Error(`Invalid POSIX class "${t}"`);return{type:"CharacterSet",kind:"posix",value:t,negate:n}}function ps(t,e,n,r){if(e>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:t,min:e,max:n,body:r}}function pl(t,e){return{type:"Regex",body:We(e?.body),flags:t}}function gs(t){return{type:"Subroutine",ref:t}}function Ce(t,e){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e};let r=n.unicodePropertyMap?.get(yt(t));if(!r){if(n.normalizeUnknownPropertyNames)r=yl(t);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(U`Invalid Unicode property "\p{${t}}"`)}return{type:"CharacterSet",kind:"property",value:r??t,negate:n.negate}}function gl({flags:t,kind:e,name:n,negate:r,number:s}){switch(e){case"absence_repeater":return ll("repeater");case"atomic":return Y({atomic:!0});case"capturing":return ds(s,{name:n});case"group":return Y({flags:t});case"lookahead":case"lookbehind":return fe({behind:e==="lookbehind",negate:r});default:throw new Error(`Unexpected group kind "${e}"`)}}function We(t){if(t===void 0)t=[ge()];else if(!Array.isArray(t)||!t.length||!t.every(e=>e.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return t}function ms(t){if(t===void 0)t=[];else if(!Array.isArray(t)||!t.every(e=>!!e.type))throw new Error("Invalid body; expected array of nodes");return t}function er(t){return t.type==="LookaroundAssertion"&&t.kind==="lookahead"}function tr(t){return t.type==="LookaroundAssertion"&&t.kind==="lookbehind"}function ml(t){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(t)}function yl(t){return t.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function yt(t){return t.replace(/[- _]+/g,"").toLowerCase()}function nr(t,e){return Ae(t,`${e?.type==="Character"&&e.value===93?"Empty":"Unclosed"} character class`)}function rr(t){return Ae(t,"Unclosed group")}function $e(t,e,n=null){function r(o,i){for(let a=0;a<o.length;a++){const l=s(o[a],i,a,o);a=Math.max(-1,a+l)}}function s(o,i=null,a=null,l=null){let c=0,u=!1;const f={node:o,parent:i,key:a,container:l,root:t,remove(){Xe(l).splice(Math.max(0,ye(a)+c),1),c--,u=!0},removeAllNextSiblings(){return Xe(l).splice(ye(a)+1)},removeAllPrevSiblings(){const m=ye(a)+c;return c-=m,Xe(l).splice(0,Math.max(0,m))},replaceWith(m,y={}){const g=!!y.traverse;l?l[Math.max(0,ye(a)+c)]=m:Ae(i,"Can't replace root node")[a]=m,g&&s(m,i,a,l),u=!0},replaceWithMultiple(m,y={}){const g=!!y.traverse;if(Xe(l).splice(Math.max(0,ye(a)+c),1,...m),c+=m.length-1,g){let _=0;for(let S=0;S<m.length;S++)_+=s(m[S],i,ye(a)+S+_,l)}u=!0},skip(){u=!0}},{type:h}=o,d=e["*"],p=e[h],b=typeof d=="function"?d:d?.enter,w=typeof p=="function"?p:p?.enter;if(b?.(f,n),w?.(f,n),!u)switch(h){case"AbsenceFunction":case"CapturingGroup":case"Group":r(o.body,o);break;case"Alternative":case"CharacterClass":r(o.body,o);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":s(o.min,o,"min"),s(o.max,o,"max");break;case"LookaroundAssertion":r(o.body,o);break;case"Quantifier":s(o.body,o,"body");break;case"Regex":r(o.body,o),s(o.flags,o,"flags");break;default:throw new Error(`Unexpected node type "${h}"`)}return p?.exit?.(f,n),d?.exit?.(f,n),c}return s(t),t}function Xe(t){if(!Array.isArray(t))throw new Error("Container expected");return t}function ye(t){if(typeof t!="number")throw new Error("Numeric key expected");return t}const bl=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function wl(t,e){for(let n=0;n<t.length;n++)t[n]>=e&&t[n]++}function Cl(t,e,n,r){return t.slice(0,e)+r+t.slice(e+n.length)}const Q=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function _n(t,e,n,r){const s=new RegExp(String.raw`${e}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let i=0,a="";for(const l of t.matchAll(s)){const{0:c,groups:{$skip:u}}=l;if(!u&&(!r||r===Q.DEFAULT==!i)){n instanceof Function?a+=n(l,{context:i?Q.CHAR_CLASS:Q.DEFAULT,negated:o[o.length-1]}):a+=n;continue}c[0]==="["?(i++,o.push(c[1]==="^")):c==="]"&&i&&(i--,o.pop()),a+=c}return a}function ys(t,e,n,r){_n(t,e,n,r)}function _l(t,e,n=0,r){if(!new RegExp(e,"su").test(t))return null;const s=new RegExp(`${e}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=n;let o=0,i;for(;i=s.exec(t);){const{0:a,groups:{$skip:l}}=i;if(!l&&(!r||r===Q.DEFAULT==!o))return i;a==="["?o++:a==="]"&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}function Ke(t,e,n){return!!_l(t,e,0,n)}function Sl(t,e){const n=/\\?./gsu;n.lastIndex=e;let r=t.length,s=0,o=1,i;for(;i=n.exec(t);){const[a]=i;if(a==="[")s++;else if(s)a==="]"&&s--;else if(a==="(")o++;else if(a===")"&&(o--,!o)){r=i.index;break}}return t.slice(e,r)}const sr=new RegExp(String.raw`(?<noncapturingStart>${bl})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function kl(t,e){const n=e?.hiddenCaptures??[];let r=e?.captureTransfers??new Map;if(!/\(\?>/.test(t))return{pattern:t,captureTransfers:r,hiddenCaptures:n};const s="(?>",o="(?:(?=(",i=[0],a=[];let l=0,c=0,u=NaN,f;do{f=!1;let h=0,d=0,p=!1,b;for(sr.lastIndex=Number.isNaN(u)?0:u+o.length;b=sr.exec(t);){const{0:w,index:m,groups:{capturingStart:y,noncapturingStart:g}}=b;if(w==="[")h++;else if(h)w==="]"&&h--;else if(w===s&&!p)u=m,p=!0;else if(p&&g)d++;else if(y)p?d++:(l++,i.push(l+c));else if(w===")"&&p){if(!d){c++;const _=l+c;if(t=`${t.slice(0,u)}${o}${t.slice(u+s.length,m)}))<$$${_}>)${t.slice(m+1)}`,f=!0,a.push(_),wl(n,_),r.size){const S=new Map;r.forEach((x,v)=>{S.set(v>=_?v+1:v,x.map(k=>k>=_?k+1:k))}),r=S}break}d--}}}while(f);return n.push(...a),t=_n(t,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:h,groups:{backrefNum:d,wrappedBackrefNum:p}})=>{if(d){const b=+d;if(b>i.length-1)throw new Error(`Backref "${h}" greater than number of captures`);return`\\${i[b]}`}return`\\${p}`},Q.DEFAULT),{pattern:t,captureTransfers:r,hiddenCaptures:n}}const bs=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Pt=new RegExp(String.raw`
|
|
45
|
+
\\(?: \d+
|
|
46
|
+
| c[A-Za-z]
|
|
47
|
+
| [gk]<[^>]+>
|
|
48
|
+
| [pPu]\{[^\}]+\}
|
|
49
|
+
| u[A-Fa-f\d]{4}
|
|
50
|
+
| x[A-Fa-f\d]{2}
|
|
51
|
+
)
|
|
52
|
+
| \((?: \? (?: [:=!>]
|
|
53
|
+
| <(?:[=!]|[^>]+>)
|
|
54
|
+
| [A-Za-z\-]+:
|
|
55
|
+
| \(DEFINE\)
|
|
56
|
+
))?
|
|
57
|
+
| (?<qBase>${bs})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
58
|
+
| \\?.
|
|
59
|
+
`.replace(/\s+/g,""),"gsu");function xl(t){if(!new RegExp(`${bs}\\+`).test(t))return{pattern:t};const e=[];let n=null,r=null,s="",o=0,i;for(Pt.lastIndex=0;i=Pt.exec(t);){const{0:a,index:l,groups:{qBase:c,qMod:u,invalidQ:f}}=i;if(a==="[")o||(r=l),o++;else if(a==="]")o?o--:r=null;else if(!o)if(u==="+"&&s&&!s.startsWith("(")){if(f)throw new Error(`Invalid quantifier "${a}"`);let h=-1;if(/^\{\d+\}$/.test(c))t=Cl(t,l+c.length,u,"");else{if(s===")"||s==="]"){const d=s===")"?n:r;if(d===null)throw new Error(`Invalid unmatched "${s}"`);t=`${t.slice(0,d)}(?>${t.slice(d,l)}${c})${t.slice(l+a.length)}`}else t=`${t.slice(0,l-s.length)}(?>${s}${c})${t.slice(l+a.length)}`;h+=4}Pt.lastIndex+=h}else a[0]==="("?e.push(l):a===")"&&(n=e.length?e.pop():null);s=a}return{pattern:t}}const Z=String.raw,vl=Z`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,rn=Z`\(\?R=(?<rDepth>[^\)]+)\)|${vl}`,bt=Z`\(\?<(?![=!])(?<captureName>[^>]+)>`,ws=Z`${bt}|(?<unnamed>\()(?!\?)`,ce=new RegExp(Z`${bt}|${rn}|\(\?|\\?.`,"gsu"),Tt="Cannot use multiple overlapping recursions";function Il(t,e){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...e};let s=e?.captureTransfers??new Map;if(!new RegExp(rn,"su").test(t))return{pattern:t,captureTransfers:s,hiddenCaptures:n};if(r==="plugin"&&Ke(t,Z`\(\?\(DEFINE\)`,Q.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const o=[],i=Ke(t,Z`\\[1-9]`,Q.DEFAULT),a=new Map,l=[];let c=!1,u=0,f=0,h;for(ce.lastIndex=0;h=ce.exec(t);){const{0:d,groups:{captureName:p,rDepth:b,gRNameOrNum:w,gRDepth:m}}=h;if(d==="[")u++;else if(u)d==="]"&&u--;else if(b){if(or(b),c)throw new Error(Tt);if(i)throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const y=t.slice(0,h.index),g=t.slice(ce.lastIndex);if(Ke(g,rn,Q.DEFAULT))throw new Error(Tt);const _=+b-1;t=ir(y,g,_,!1,n,o,f),s=lr(s,y,_,o.length,0,f);break}else if(w){or(m);let y=!1;for(const N of l)if(N.name===w||N.num===+w){if(y=!0,N.hasRecursedWithin)throw new Error(Tt);break}if(!y)throw new Error(Z`Recursive \g cannot be used outside the referenced group "${r==="external"?w:Z`\g<${w}&R=${m}>`}"`);const g=a.get(w),_=Sl(t,g);if(i&&Ke(_,Z`${bt}|\((?!\?)`,Q.DEFAULT))throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const S=t.slice(g,h.index),x=_.slice(S.length+d.length),v=o.length,k=+m-1,A=ir(S,x,k,!0,n,o,f);s=lr(s,S,k,o.length-v,v,f);const R=t.slice(0,g),$=t.slice(g+_.length);t=`${R}${A}${$}`,ce.lastIndex+=A.length-d.length-S.length-x.length,l.forEach(N=>N.hasRecursedWithin=!0),c=!0}else if(p)f++,a.set(String(f),ce.lastIndex),a.set(p,ce.lastIndex),l.push({num:f,name:p});else if(d[0]==="("){const y=d==="(";y&&(f++,a.set(String(f),ce.lastIndex)),l.push(y?{num:f}:{})}else d===")"&&l.pop()}return n.push(...o),{pattern:t,captureTransfers:s,hiddenCaptures:n}}function or(t){const e=`Max depth must be integer between 2 and 100; used ${t}`;if(!/^[1-9]\d*$/.test(t))throw new Error(e);if(t=+t,t<2||t>100)throw new Error(e)}function ir(t,e,n,r,s,o,i){const a=new Set;r&&ys(t+e,bt,({groups:{captureName:c}})=>{a.add(c)},Q.DEFAULT);const l=[n,r?a:null,s,o,i];return`${t}${ar(`(?:${t}`,"forward",...l)}(?:)${ar(`${e})`,"backward",...l)}${e}`}function ar(t,e,n,r,s,o,i){const l=u=>e==="forward"?u+2:n-u+2-1;let c="";for(let u=0;u<n;u++){const f=l(u);c+=_n(t,Z`${ws}|\\k<(?<backref>[^>]+)>`,({0:h,groups:{captureName:d,unnamed:p,backref:b}})=>{if(b&&r&&!r.has(b))return h;const w=`_$${f}`;if(p||d){const m=i+o.length+1;return o.push(m),El(s,m),p?h:`(?<${d}${w}>`}return Z`\k<${b}${w}>`},Q.DEFAULT)}return c}function El(t,e){for(let n=0;n<t.length;n++)t[n]>=e&&t[n]++}function lr(t,e,n,r,s,o){if(t.size&&r){let i=0;ys(e,ws,()=>i++,Q.DEFAULT);const a=o-i+s,l=new Map;return t.forEach((c,u)=>{const f=(r-i*n)/n,h=i*n,d=u>a+i?u+r:u,p=[];for(const b of c)if(b<=a)p.push(b);else if(b>a+i+f)p.push(b+r);else if(b<=a+i)for(let w=0;w<=n;w++)p.push(b+i*w);else for(let w=0;w<=n;w++)p.push(b+h+f*w);l.set(d,p)}),l}return t}var O=String.fromCodePoint,I=String.raw,J={},wt=globalThis.RegExp;J.flagGroups=(()=>{try{new wt("(?i:)")}catch{return!1}return!0})();J.unicodeSets=(()=>{try{new wt("[[]]","v")}catch{return!1}return!0})();J.bugFlagVLiteralHyphenIsRange=J.unicodeSets?(()=>{try{new wt(I`[\d\-a]`,"v")}catch{return!0}return!1})():!1;J.bugNestedClassIgnoresNegation=J.unicodeSets&&new wt("[[^a]]","v").test("a");function dt(t,{enable:e,disable:n}){return{dotAll:!n?.dotAll&&!!(e?.dotAll||t.dotAll),ignoreCase:!n?.ignoreCase&&!!(e?.ignoreCase||t.ignoreCase)}}function Be(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}function sn(t,e){return cr[t]>=cr[e]}function Al(t,e){if(t==null)throw new Error(e??"Value expected");return t}var cr={ES2025:2025,ES2024:2024,ES2018:2018},Ll={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function Cs(t={}){if({}.toString.call(t)!=="[object Object]")throw new Error("Unexpected options");if(t.target!==void 0&&!Ll[t.target])throw new Error(`Unexpected target "${t.target}"`);const e={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...t,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...t.rules}};return e.target==="auto"&&(e.target=J.flagGroups?"ES2025":J.unicodeSets?"ES2024":"ES2018"),e}var Rl="[ -\r ]",Nl=new Set([O(304),O(305)]),ne=I`[\p{L}\p{M}\p{N}\p{Pc}]`;function _s(t){if(Nl.has(t))return[t];const e=new Set,n=t.toLowerCase(),r=n.toUpperCase(),s=$l.get(n),o=Pl.get(n),i=Tl.get(n);return[...r].length===1&&e.add(r),i&&e.add(i),s&&e.add(s),e.add(n),o&&e.add(o),[...e]}var Sn=new Map(`C Other
|
|
60
|
+
Cc Control cntrl
|
|
61
|
+
Cf Format
|
|
62
|
+
Cn Unassigned
|
|
63
|
+
Co Private_Use
|
|
64
|
+
Cs Surrogate
|
|
65
|
+
L Letter
|
|
66
|
+
LC Cased_Letter
|
|
67
|
+
Ll Lowercase_Letter
|
|
68
|
+
Lm Modifier_Letter
|
|
69
|
+
Lo Other_Letter
|
|
70
|
+
Lt Titlecase_Letter
|
|
71
|
+
Lu Uppercase_Letter
|
|
72
|
+
M Mark Combining_Mark
|
|
73
|
+
Mc Spacing_Mark
|
|
74
|
+
Me Enclosing_Mark
|
|
75
|
+
Mn Nonspacing_Mark
|
|
76
|
+
N Number
|
|
77
|
+
Nd Decimal_Number digit
|
|
78
|
+
Nl Letter_Number
|
|
79
|
+
No Other_Number
|
|
80
|
+
P Punctuation punct
|
|
81
|
+
Pc Connector_Punctuation
|
|
82
|
+
Pd Dash_Punctuation
|
|
83
|
+
Pe Close_Punctuation
|
|
84
|
+
Pf Final_Punctuation
|
|
85
|
+
Pi Initial_Punctuation
|
|
86
|
+
Po Other_Punctuation
|
|
87
|
+
Ps Open_Punctuation
|
|
88
|
+
S Symbol
|
|
89
|
+
Sc Currency_Symbol
|
|
90
|
+
Sk Modifier_Symbol
|
|
91
|
+
Sm Math_Symbol
|
|
92
|
+
So Other_Symbol
|
|
93
|
+
Z Separator
|
|
94
|
+
Zl Line_Separator
|
|
95
|
+
Zp Paragraph_Separator
|
|
96
|
+
Zs Space_Separator
|
|
97
|
+
ASCII
|
|
98
|
+
ASCII_Hex_Digit AHex
|
|
99
|
+
Alphabetic Alpha
|
|
100
|
+
Any
|
|
101
|
+
Assigned
|
|
102
|
+
Bidi_Control Bidi_C
|
|
103
|
+
Bidi_Mirrored Bidi_M
|
|
104
|
+
Case_Ignorable CI
|
|
105
|
+
Cased
|
|
106
|
+
Changes_When_Casefolded CWCF
|
|
107
|
+
Changes_When_Casemapped CWCM
|
|
108
|
+
Changes_When_Lowercased CWL
|
|
109
|
+
Changes_When_NFKC_Casefolded CWKCF
|
|
110
|
+
Changes_When_Titlecased CWT
|
|
111
|
+
Changes_When_Uppercased CWU
|
|
112
|
+
Dash
|
|
113
|
+
Default_Ignorable_Code_Point DI
|
|
114
|
+
Deprecated Dep
|
|
115
|
+
Diacritic Dia
|
|
116
|
+
Emoji
|
|
117
|
+
Emoji_Component EComp
|
|
118
|
+
Emoji_Modifier EMod
|
|
119
|
+
Emoji_Modifier_Base EBase
|
|
120
|
+
Emoji_Presentation EPres
|
|
121
|
+
Extended_Pictographic ExtPict
|
|
122
|
+
Extender Ext
|
|
123
|
+
Grapheme_Base Gr_Base
|
|
124
|
+
Grapheme_Extend Gr_Ext
|
|
125
|
+
Hex_Digit Hex
|
|
126
|
+
IDS_Binary_Operator IDSB
|
|
127
|
+
IDS_Trinary_Operator IDST
|
|
128
|
+
ID_Continue IDC
|
|
129
|
+
ID_Start IDS
|
|
130
|
+
Ideographic Ideo
|
|
131
|
+
Join_Control Join_C
|
|
132
|
+
Logical_Order_Exception LOE
|
|
133
|
+
Lowercase Lower
|
|
134
|
+
Math
|
|
135
|
+
Noncharacter_Code_Point NChar
|
|
136
|
+
Pattern_Syntax Pat_Syn
|
|
137
|
+
Pattern_White_Space Pat_WS
|
|
138
|
+
Quotation_Mark QMark
|
|
139
|
+
Radical
|
|
140
|
+
Regional_Indicator RI
|
|
141
|
+
Sentence_Terminal STerm
|
|
142
|
+
Soft_Dotted SD
|
|
143
|
+
Terminal_Punctuation Term
|
|
144
|
+
Unified_Ideograph UIdeo
|
|
145
|
+
Uppercase Upper
|
|
146
|
+
Variation_Selector VS
|
|
147
|
+
White_Space space
|
|
148
|
+
XID_Continue XIDC
|
|
149
|
+
XID_Start XIDS`.split(/\s/).map(t=>[yt(t),t])),Pl=new Map([["s",O(383)],[O(383),"s"]]),Tl=new Map([[O(223),O(7838)],[O(107),O(8490)],[O(229),O(8491)],[O(969),O(8486)]]),$l=new Map([oe(453),oe(456),oe(459),oe(498),...$t(8072,8079),...$t(8088,8095),...$t(8104,8111),oe(8124),oe(8140),oe(8188)]),Ml=new Map([["alnum",I`[\p{Alpha}\p{Nd}]`],["alpha",I`\p{Alpha}`],["ascii",I`\p{ASCII}`],["blank",I`[\p{Zs}\t]`],["cntrl",I`\p{Cc}`],["digit",I`\p{Nd}`],["graph",I`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",I`\p{Lower}`],["print",I`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",I`[\p{P}\p{S}]`],["space",I`\p{space}`],["upper",I`\p{Upper}`],["word",I`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",I`\p{AHex}`]]);function Ol(t,e){const n=[];for(let r=t;r<=e;r++)n.push(r);return n}function oe(t){const e=O(t);return[e.toLowerCase(),e]}function $t(t,e){return Ol(t,e).map(n=>oe(n))}var Ss=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function Dl(t,e){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...e};ks(t);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:sn(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:t.flags.digitIsAscii,spaceIsAscii:t.flags.spaceIsAscii,wordIsAscii:t.flags.wordIsAscii};$e(t,Gl,r);const s={dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},o={currentFlags:s,prevFlags:null,globalFlags:s,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};$e(t,Bl,o);const i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return $e(t,Fl,i),t._originMap=o.groupOriginByCopy,t._strategy=r.strategy,t}var Gl={AbsenceFunction({node:t,parent:e,replaceWith:n}){const{body:r,kind:s}=t;if(s==="repeater"){const o=Y();o.body[0].body.push(fe({negate:!0,body:r}),Ce("Any"));const i=Y();i.body[0].body.push(ps("greedy",0,1/0,o)),n(T(i,e),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:t,parent:e,key:n},{flagDirectivesByAlt:r}){const s=t.body.filter(o=>o.kind==="flags");for(let o=n+1;o<e.body.length;o++){const i=e.body[o];Be(r,i,[]).push(...s)}},exit({node:t},{flagDirectivesByAlt:e}){if(e.get(t)?.length){const n=vs(e.get(t));if(n){const r=Y({flags:n});r.body[0].body=t.body,t.body=[T(r,t)]}}}},Assertion({node:t,parent:e,key:n,container:r,root:s,remove:o,replaceWith:i},a){const{kind:l,negate:c}=t,{asciiWordBoundaries:u,avoidSubclass:f,supportedGNodes:h,wordIsAscii:d}=a;if(l==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${c?"Y":"y"}"`);if(l==="line_end")i(T(fe({body:[ge({body:[en("string_end")]}),ge({body:[mt(10)]})]}),e));else if(l==="line_start")i(T(re(I`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),e));else if(l==="search_start")if(h.has(t))s.flags.sticky=!0,o();else{const p=r[n-1];if(p&&Vl(p))i(T(fe({negate:!0}),e));else{if(f)throw new Error(I`Uses "\G" in a way that requires a subclass`);i(ie(en("string_start"),e)),a.strategy="clip_search"}}else if(!(l==="string_end"||l==="string_start"))if(l==="string_end_newline")i(T(re(I`(?=\n?\z)`),e));else if(l==="word_boundary"){if(!d&&!u){const p=`(?:(?<=${ne})(?!${ne})|(?<!${ne})(?=${ne}))`,b=`(?:(?<=${ne})(?=${ne})|(?<!${ne})(?!${ne}))`;i(T(re(c?b:p),e))}}else throw new Error(`Unexpected assertion kind "${l}"`)},Backreference({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!Ot(n)&&(n=Mt(n,e),t.ref=n)},CapturingGroup({node:t},{jsGroupNameMap:e,subroutineRefMap:n}){let{name:r}=t;r&&!Ot(r)&&(r=Mt(r,e),t.name=r),n.set(t.number,t),r&&n.set(r,t)},CharacterClassRange({node:t,parent:e,replaceWith:n}){if(e.kind==="intersection"){const r=tt({body:[t]});n(T(r,e),{traverse:!0})}},CharacterSet({node:t,parent:e,replaceWith:n},{accuracy:r,minTargetEs2024:s,digitIsAscii:o,spaceIsAscii:i,wordIsAscii:a}){const{kind:l,negate:c,value:u}=t;if(o&&(l==="digit"||u==="digit")){n(ie(nn("digit",{negate:c}),e));return}if(i&&(l==="space"||u==="space")){n(T(Dt(re(Rl),c),e));return}if(a&&(l==="word"||u==="word")){n(ie(nn("word",{negate:c}),e));return}if(l==="any")n(ie(Ce("Any"),e));else if(l==="digit")n(ie(Ce("Nd",{negate:c}),e));else if(l!=="dot")if(l==="text_segment"){if(r==="strict")throw new Error(I`Use of "\X" requires non-strict accuracy`);const f="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",h=I`\p{RI}{2}|${f}(?:\u200D${f})*`;n(T(re(I`(?>\r\n|${s?I`\p{RGI_Emoji}`:h}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),e))}else if(l==="hex")n(ie(Ce("AHex",{negate:c}),e));else if(l==="newline")n(T(re(c?`[^
|
|
150
|
+
]`:`(?>\r
|
|
151
|
+
?|[
|
|
152
|
+
\v\f
\u2028\u2029])`),e));else if(l==="posix")if(!s&&(u==="graph"||u==="print")){if(r==="strict")throw new Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let f={graph:"!-~",print:" -~"}[u];c&&(f=`\0-${O(f.codePointAt(0)-1)}${O(f.codePointAt(2)+1)}-`),n(T(re(`[${f}]`),e))}else n(T(Dt(re(Ml.get(u)),c),e));else if(l==="property")Sn.has(yt(u))||(t.key="sc");else if(l==="space")n(ie(Ce("space",{negate:c}),e));else if(l==="word")n(T(Dt(re(ne),c),e));else throw new Error(`Unexpected character set kind "${l}"`)},Directive({node:t,parent:e,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:i}){const{kind:a,flags:l}=t;if(a==="flags")if(!l.enable&&!l.disable)r();else{const c=Y({flags:l});c.body[0].body=i(),s(T(c,e),{traverse:!0})}else if(a==="keep"){const c=n.body[0],f=n.body.length===1&&fs(c,{type:"Group"})&&c.body[0].body.length===1?c.body[0]:n;if(e.parent!==f||f.body.length>1)throw new Error(I`Uses "\K" in a way that's unsupported`);const h=fe({behind:!0});h.body[0].body=o(),s(T(h,e))}else throw new Error(`Unexpected directive kind "${a}"`)},Flags({node:t,parent:e}){if(t.posixIsAscii)throw new Error('Unsupported flag "P"');if(t.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete t[n]),Object.assign(t,{global:!1,hasIndices:!1,multiline:!1,sticky:t.sticky??!1}),e.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:t}){if(!t.flags)return;const{enable:e,disable:n}=t.flags;e?.extended&&delete e.extended,n?.extended&&delete n.extended,e?.dotAll&&n?.dotAll&&delete e.dotAll,e?.ignoreCase&&n?.ignoreCase&&delete e.ignoreCase,e&&!Object.keys(e).length&&delete t.flags.enable,n&&!Object.keys(n).length&&delete t.flags.disable,!t.flags.enable&&!t.flags.disable&&delete t.flags},LookaroundAssertion({node:t},e){const{kind:n}=t;n==="lookbehind"&&(e.passedLookbehind=!0)},NamedCallout({node:t,parent:e,replaceWith:n}){const{kind:r}=t;if(r==="fail")n(T(fe({negate:!0}),e));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:t}){if(t.body.type==="Quantifier"){const e=Y();e.body[0].body.push(t.body),t.body=T(e,t)}},Regex:{enter({node:t},{supportedGNodes:e}){const n=[];let r=!1,s=!1;for(const o of t.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const i=Es(o.body);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):s=!0}r&&!s&&n.forEach(o=>e.add(o))},exit(t,{accuracy:e,passedLookbehind:n,strategy:r}){if(e==="strict"&&n&&r)throw new Error(I`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!Ot(n)&&(n=Mt(n,e),t.ref=n)}},Bl={Backreference({node:t},{multiplexCapturesToLeftByRef:e,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=t;r||n.set(t,[...e.get(s).map(({node:o})=>o)])},CapturingGroup:{enter({node:t,parent:e,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:o,multiplexCapturesToLeftByRef:i,openRefs:a,reffedNodesByReferencer:l}){const c=s.get(t);if(c&&a.has(t.number)){const f=ie(ur(t.number),e);l.set(f,a.get(t.number)),n(f);return}a.set(t.number,t),i.set(t.number,[]),t.name&&Be(i,t.name,[]);const u=i.get(t.name??t.number);for(let f=0;f<u.length;f++){const h=u[f];if(c===h.node||c&&c===h.origin||t===h.origin){u.splice(f,1);break}}if(i.get(t.number).push({node:t,origin:c}),t.name&&i.get(t.name).push({node:t,origin:c}),t.name){const f=Be(o,t.name,new Map);let h=!1;if(c)h=!0;else for(const d of f.values())if(!d.hasDuplicateNameToRemove){h=!0;break}o.get(t.name).set(t,{node:t,hasDuplicateNameToRemove:h})}},exit({node:t},{openRefs:e}){e.delete(t.number)}},Group:{enter({node:t},e){e.prevFlags=e.currentFlags,t.flags&&(e.currentFlags=dt(e.currentFlags,t.flags))},exit(t,e){e.currentFlags=e.prevFlags}},Subroutine({node:t,parent:e,replaceWith:n},r){const{isRecursive:s,ref:o}=t;if(s){let u=e;for(;(u=u.parent)&&!(u.type==="CapturingGroup"&&(u.name===o||u.number===o)););r.reffedNodesByReferencer.set(t,u);return}const i=r.subroutineRefMap.get(o),a=o===0,l=a?ur(0):xs(i,r.groupOriginByCopy,null);let c=l;if(!a){const u=vs(Wl(i,h=>h.type==="Group"&&!!h.flags)),f=u?dt(r.globalFlags,u):r.globalFlags;Ul(f,r.currentFlags)||(c=Y({flags:zl(f)}),c.body[0].body.push(l))}n(T(c,e),{traverse:!a})}},Fl={Backreference({node:t,parent:e,replaceWith:n},r){if(t.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,t.ref);return}const o=r.reffedNodesByReferencer.get(t).filter(i=>jl(i,t));if(!o.length)n(T(fe({negate:!0}),e));else if(o.length>1){const i=Y({atomic:!0,body:o.reverse().map(a=>ge({body:[tn(a.number)]}))});n(T(i,e))}else t.ref=o[0].number},CapturingGroup({node:t},e){t.number=++e.numCapturesToLeft,t.name&&e.groupsByName.get(t.name).get(t).hasDuplicateNameToRemove&&delete t.name},Regex:{exit({node:t},e){const n=Math.max(e.highestOrphanBackref-e.numCapturesToLeft,0);for(let r=0;r<n;r++){const s=ds();t.body.at(-1).body.push(s)}}},Subroutine({node:t},e){!t.isRecursive||t.ref===0||(t.ref=e.reffedNodesByReferencer.get(t).number)}};function ks(t){$e(t,{"*"({node:e,parent:n}){e.parent=n}})}function Ul(t,e){return t.dotAll===e.dotAll&&t.ignoreCase===e.ignoreCase}function jl(t,e){let n=e;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===t)return!1;const r=Is(n.parent);for(const s of r){if(s===n)break;if(s===t||As(s,t))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function xs(t,e,n,r){const s=Array.isArray(t)?[]:{};for(const[o,i]of Object.entries(t))o==="parent"?s.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?s[o]=xs(i,e,s,n):(o==="type"&&i==="CapturingGroup"&&e.set(s,e.get(t)??t),s[o]=i);return s}function ur(t){const e=gs(t);return e.isRecursive=!0,e}function Wl(t,e){const n=[];for(;t=t.parent;)(!e||e(t))&&n.push(t);return n}function Mt(t,e){if(e.has(t))return e.get(t);const n=`$${e.size}_${t.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return e.set(t,n),n}function vs(t){const e=["dotAll","ignoreCase"],n={enable:{},disable:{}};return t.forEach(({flags:r})=>{e.forEach(s=>{r.enable?.[s]&&(delete n.disable[s],n.enable[s]=!0),r.disable?.[s]&&(n.disable[s]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function zl({dotAll:t,ignoreCase:e}){const n={};return(t||e)&&(n.enable={},t&&(n.enable.dotAll=!0),e&&(n.enable.ignoreCase=!0)),(!t||!e)&&(n.disable={},!t&&(n.disable.dotAll=!0),!e&&(n.disable.ignoreCase=!0)),n}function Is(t){if(!t)throw new Error("Node expected");const{body:e}=t;return Array.isArray(e)?e:e?[e]:null}function Es(t){const e=t.find(n=>n.kind==="search_start"||ql(n,{negate:!1})||!Hl(n));if(!e)return null;if(e.kind==="search_start")return e;if(e.type==="LookaroundAssertion")return e.body[0].body[0];if(e.type==="CapturingGroup"||e.type==="Group"){const n=[];for(const r of e.body){const s=Es(r.body);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function As(t,e){const n=Is(t)??[];for(const r of n)if(r===e||As(r,e))return!0;return!1}function Hl({type:t}){return t==="Assertion"||t==="Directive"||t==="LookaroundAssertion"}function Vl(t){const e=["Character","CharacterClass","CharacterSet"];return e.includes(t.type)||t.type==="Quantifier"&&t.min&&e.includes(t.body.type)}function ql(t,e){const n={negate:null,...e};return t.type==="LookaroundAssertion"&&(n.negate===null||t.negate===n.negate)&&t.body.length===1&&fs(t.body[0],{type:"Assertion",kind:"search_start"})}function Ot(t){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(t)}function re(t,e){const r=hs(t,{...e,unicodePropertyMap:Sn}).body;return r.length>1||r[0].body.length>1?Y({body:r}):r[0].body[0]}function Dt(t,e){return t.negate=e,t}function ie(t,e){return t.parent=e,t}function T(t,e){return ks(t),t.parent=e,t}function Xl(t,e){const n=Cs(e),r=sn(n.target,"ES2024"),s=sn(n.target,"ES2025"),o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,a=null;if(!s){const d=[t.flags.ignoreCase];$e(t,Kl,{getCurrentModI:()=>d.at(-1),popModI(){d.pop()},pushModI(p){d.push(p)},setHasCasedChar(){d.at(-1)?i=!0:a=!0}})}const l={dotAll:t.flags.dotAll,ignoreCase:!!((t.flags.ignoreCase||i)&&!a)};let c=t;const u={accuracy:n.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:t._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!s&&i&&a),useFlagMods:s,useFlagV:r,verbose:n.verbose};function f(d){return u.lastNode=c,c=d,Al(Zl[d.type],`Unexpected node type "${d.type}"`)(d,u,f)}const h={pattern:t.body.map(f).join("|"),flags:f(t.flags),options:{...t.options}};return r||(delete h.options.force.v,h.options.disable.v=!0,h.options.unicodeSetsPlugin=null),h._captureTransfers=new Map,h._hiddenCaptures=[],u.captureMap.forEach((d,p)=>{d.hidden&&h._hiddenCaptures.push(p),d.transferTo&&Be(h._captureTransfers,d.transferTo,[]).push(p)}),h}var Kl={"*":{enter({node:t},e){if(hr(t)){const n=e.getCurrentModI();e.pushModI(t.flags?dt({ignoreCase:n},t.flags).ignoreCase:n)}},exit({node:t},e){hr(t)&&e.popModI()}},Backreference(t,e){e.setHasCasedChar()},Character({node:t},e){kn(O(t.value))&&e.setHasCasedChar()},CharacterClassRange({node:t,skip:e},n){e(),Ls(t,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:t},e){t.kind==="property"&&Ss.has(t.value)&&e.setHasCasedChar()}},Zl={Alternative({body:t},e,n){return t.map(n).join("")},Assertion({kind:t,negate:e}){if(t==="string_end")return"$";if(t==="string_start")return"^";if(t==="word_boundary")return e?I`\B`:I`\b`;throw new Error(`Unexpected assertion kind "${t}"`)},Backreference({ref:t},e){if(typeof t!="number")throw new Error("Unexpected named backref in transformed AST");if(!e.useFlagMods&&e.accuracy==="strict"&&e.currentFlags.ignoreCase&&!e.captureMap.get(t).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+t},CapturingGroup(t,e,n){const{body:r,name:s,number:o}=t,i={ignoreCase:e.currentFlags.ignoreCase},a=e.originMap.get(t);return a&&(i.hidden=!0,o>a.number&&(i.transferTo=a.number)),e.captureMap.set(o,i),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:t},e){const n=O(t),r=be(t,{escDigit:e.lastNode.type==="Backreference",inCharClass:e.inCharClass,useFlagV:e.useFlagV});if(r!==n)return r;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase&&kn(n)){const s=_s(n);return e.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n},CharacterClass(t,e,n){const{kind:r,negate:s,parent:o}=t;let{body:i}=t;if(r==="intersection"&&!e.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");J.bugFlagVLiteralHyphenIsRange&&e.useFlagV&&i.some(dr)&&(i=[mt(45),...i.filter(c=>!dr(c))]);const a=()=>`[${s?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!e.inCharClass){if((!e.useFlagV||J.bugNestedClassIgnoresNegation)&&!s){const u=i.filter(f=>f.type==="CharacterClass"&&f.kind==="union"&&f.negate);if(u.length){const f=Y(),h=f.body[0];return f.parent=o,h.parent=f,i=i.filter(d=>!u.includes(d)),t.body=i,i.length?(t.parent=h,h.body.push(t)):f.body.pop(),u.forEach(d=>{const p=ge({body:[d]});d.parent=p,p.parent=f,f.body.push(p)}),n(f)}}e.inCharClass=!0;const c=a();return e.inCharClass=!1,c}const l=i[0];if(r==="union"&&!s&&l&&((!e.useFlagV||!e.verbose)&&o.kind==="union"&&!(J.bugFlagVLiteralHyphenIsRange&&e.useFlagV)||!e.verbose&&o.kind==="intersection"&&i.length===1&&l.type!=="CharacterClassRange"))return i.map(n).join("");if(!e.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return a()},CharacterClassRange(t,e){const n=t.min.value,r=t.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:e.useFlagV},o=be(n,s),i=be(r,s),a=new Set;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase){const l=Ls(t);tc(l).forEach(u=>{a.add(Array.isArray(u)?`${be(u[0],s)}-${be(u[1],s)}`:be(u,s))})}return`${o}-${i}${[...a].join("")}`},CharacterSet({kind:t,negate:e,value:n,key:r},s){if(t==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":I`[^\n]`;if(t==="digit")return e?I`\D`:I`\d`;if(t==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&Ss.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${e?I`\P`:I`\p`}{${r?`${r}=`:""}${n}}`}if(t==="word")return e?I`\W`:I`\w`;throw new Error(`Unexpected character set kind "${t}"`)},Flags(t,e){return(e.appliedGlobalFlags.ignoreCase?"i":"")+(t.dotAll?"s":"")+(t.sticky?"y":"")},Group({atomic:t,body:e,flags:n,parent:r},s,o){const i=s.currentFlags;n&&(s.currentFlags=dt(i,n));const a=e.map(o).join("|"),l=!s.verbose&&e.length===1&&r.type!=="Quantifier"&&!t&&(!s.useFlagMods||!n)?a:`(?${nc(t,n,s.useFlagMods)}${a})`;return s.currentFlags=i,l},LookaroundAssertion({body:t,kind:e,negate:n},r,s){return`(?${`${e==="lookahead"?"":"<"}${n?"!":"="}`}${t.map(s).join("|")})`},Quantifier(t,e,n){return n(t.body)+rc(t)},Subroutine({isRecursive:t,ref:e},n){if(!t)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return e===0?`(?R=${r})`:I`\g<${e}&R=${r}>`}},Ql=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),Yl=new Set(["-","\\","]","^","["]),Jl=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),fr=new Map([[9,I`\t`],[10,I`\n`],[11,I`\v`],[12,I`\f`],[13,I`\r`],[8232,I`\u2028`],[8233,I`\u2029`],[65279,I`\uFEFF`]]),ec=/^\p{Cased}$/u;function kn(t){return ec.test(t)}function Ls(t,e){const n=!!e?.firstOnly,r=t.min.value,s=t.max.value,o=[];if(r<65&&(s===65535||s>=131071)||r===65536&&s>=131071)return o;for(let i=r;i<=s;i++){const a=O(i);if(!kn(a))continue;const l=_s(a).filter(c=>{const u=c.codePointAt(0);return u<r||u>s});if(l.length&&(o.push(...l),n))break}return o}function be(t,{escDigit:e,inCharClass:n,useFlagV:r}){if(fr.has(t))return fr.get(t);if(t<32||t>126&&t<160||t>262143||e&&sc(t))return t>255?`\\u{${t.toString(16).toUpperCase()}}`:`\\x${t.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?Jl:Yl:Ql,o=O(t);return(s.has(o)?"\\":"")+o}function tc(t){const e=t.map(s=>s.codePointAt(0)).sort((s,o)=>s-o),n=[];let r=null;for(let s=0;s<e.length;s++)e[s+1]===e[s]+1?r??=e[s]:r===null?n.push(e[s]):(n.push([r,e[s]]),r=null);return n}function nc(t,e,n){if(t)return">";let r="";if(e&&n){const{enable:s,disable:o}=e;r=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(o?"-":"")+(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")}return`${r}:`}function rc({kind:t,max:e,min:n}){let r;return!n&&e===1?r="?":!n&&e===1/0?r="*":n===1&&e===1/0?r="+":n===e?r=`{${n}}`:r=`{${n},${e===1/0?"":e}}`,r+{greedy:"",lazy:"?",possessive:"+"}[t]}function hr({type:t}){return t==="CapturingGroup"||t==="Group"||t==="LookaroundAssertion"}function sc(t){return t>47&&t<58}function dr({type:t,value:e}){return t==="Character"&&e===45}var oc=class on extends RegExp{#t=new Map;#e=null;#r;#n=null;#s=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(e,n,r){const s=!!r?.lazyCompile;if(e instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const o=e;super(o,n),this.#r=o.source,o instanceof on&&(this.#t=o.#t,this.#n=o.#n,this.#s=o.#s,this.rawOptions=o.rawOptions)}else{const o={hiddenCaptures:[],strategy:null,transfers:[],...r};super(s?"":e,n),this.#r=e,this.#t=ac(o.hiddenCaptures,o.transfers),this.#s=o.strategy,this.rawOptions=r??{}}s||(this.#e=this)}exec(e){if(!this.#e){const{lazyCompile:s,...o}=this.rawOptions;this.#e=new on(this.#r,this.flags,o)}const n=this.global||this.sticky,r=this.lastIndex;if(this.#s==="clip_search"&&n&&r){this.lastIndex=0;const s=this.#o(e.slice(r));return s&&(ic(s,r,e,this.hasIndices),this.lastIndex+=r),s}return this.#o(e)}#o(e){this.#e.lastIndex=this.lastIndex;const n=super.exec.call(this.#e,e);if(this.lastIndex=this.#e.lastIndex,!n||!this.#t.size)return n;const r=[...n];n.length=1;let s;this.hasIndices&&(s=[...n.indices],n.indices.length=1);const o=[0];for(let i=1;i<r.length;i++){const{hidden:a,transferTo:l}=this.#t.get(i)??{};if(a?o.push(null):(o.push(n.length),n.push(r[i]),this.hasIndices&&n.indices.push(s[i])),l&&r[i]!==void 0){const c=o[l];if(!c)throw new Error(`Invalid capture transfer to "${c}"`);if(n[c]=r[i],this.hasIndices&&(n.indices[c]=s[i]),n.groups){this.#n||(this.#n=lc(this.source));const u=this.#n.get(l);u&&(n.groups[u]=r[i],this.hasIndices&&(n.indices.groups[u]=s[i]))}}}return n}};function ic(t,e,n,r){if(t.index+=e,t.input=n,r){const s=t.indices;for(let i=0;i<s.length;i++){const a=s[i];a&&(s[i]=[a[0]+e,a[1]+e])}const o=s.groups;o&&Object.keys(o).forEach(i=>{const a=o[i];a&&(o[i]=[a[0]+e,a[1]+e])})}}function ac(t,e){const n=new Map;for(const r of t)n.set(r,{hidden:!0});for(const[r,s]of e)for(const o of s)Be(n,o,{}).transferTo=r;return n}function lc(t){const e=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,s=0,o;for(;o=e.exec(t);){const{0:i,groups:{capture:a,name:l}}=o;i==="["?r++:r?i==="]"&&r--:a&&(s++,l&&n.set(s,l))}return n}function cc(t,e){const n=uc(t,e);return n.options?new oc(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function uc(t,e){const n=Cs(e),r=hs(t,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Sn}),s=Dl(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=Xl(s,n),i=Il(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),a=xl(i.pattern),l=kl(a.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),c={pattern:l.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const u=l.hiddenCaptures.sort((p,b)=>p-b),f=Array.from(l.captureTransfers),h=s._strategy,d=c.pattern.length>=n.lazyCompileLength;(u.length||f.length||h||d)&&(c.options={...u.length&&{hiddenCaptures:u},...f.length&&{transfers:f},...h&&{strategy:h},...d&&{lazyCompile:d}})}return c}const pr=4294967295;class fc{constructor(e,n={}){this.patterns=e,this.options=n;const{forgiving:r=!1,cache:s,regexConstructor:o}=n;if(!o)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(i=>{if(typeof i!="string")return i;const a=s?.get(i);if(a){if(a instanceof RegExp)return a;if(r)return null;throw a}try{const l=o(i);return s?.set(i,l),l}catch(l){if(s?.set(i,l),r)return null;throw l}})}regexps;findNextMatchSync(e,n,r){const s=typeof e=="string"?e:e.content,o=[];function i(a,l,c=0){return{index:a,captureIndices:l.indices.map(u=>u==null?{start:pr,end:pr,length:0}:{start:u[0]+c,end:u[1]+c,length:u[1]-u[0]})}}for(let a=0;a<this.regexps.length;a++){const l=this.regexps[a];if(l)try{l.lastIndex=n;const c=l.exec(s);if(!c)continue;if(c.index===n)return i(a,c,0);o.push([a,c,0])}catch(c){if(this.options.forgiving)continue;throw c}}if(o.length){const a=Math.min(...o.map(l=>l[1].index));for(const[l,c,u]of o)if(c.index===a)return i(l,c,u)}return null}}function hc(t,e){return cc(t,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...e})}function dc(t={}){const e=Object.assign({target:"auto",cache:new Map},t);return e.regexConstructor||=n=>hc(n,{target:e.target}),{createScanner(n){return new fc(n,e)},createString(n){return{content:n}}}}class xn extends Error{constructor(e){super(e),this.name="ShikiError"}}function pc(){return 2147483648}function gc(){return typeof performance<"u"?performance.now():Date.now()}const mc=(t,e)=>t+(e-t%e)%e;async function yc(t){let e,n;const r={};function s(d){n=d,r.HEAPU8=new Uint8Array(d),r.HEAPU32=new Uint32Array(d)}function o(d,p,b){r.HEAPU8.copyWithin(d,p,p+b)}function i(d){try{return e.grow(d-n.byteLength+65535>>>16),s(e.buffer),1}catch{}}function a(d){const p=r.HEAPU8.length;d=d>>>0;const b=pc();if(d>b)return!1;for(let w=1;w<=4;w*=2){let m=p*(1+.2/w);m=Math.min(m,d+100663296);const y=Math.min(b,mc(Math.max(d,m),65536));if(i(y))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(d,p,b=1024){const w=p+b;let m=p;for(;d[m]&&!(m>=w);)++m;if(m-p>16&&d.buffer&&l)return l.decode(d.subarray(p,m));let y="";for(;p<m;){let g=d[p++];if(!(g&128)){y+=String.fromCharCode(g);continue}const _=d[p++]&63;if((g&224)===192){y+=String.fromCharCode((g&31)<<6|_);continue}const S=d[p++]&63;if((g&240)===224?g=(g&15)<<12|_<<6|S:g=(g&7)<<18|_<<12|S<<6|d[p++]&63,g<65536)y+=String.fromCharCode(g);else{const x=g-65536;y+=String.fromCharCode(55296|x>>10,56320|x&1023)}}return y}function u(d,p){return d?c(r.HEAPU8,d,p):""}const f={emscripten_get_now:gc,emscripten_memcpy_big:o,emscripten_resize_heap:a,fd_write:()=>0};async function h(){const p=await t({env:f,wasi_snapshot_preview1:f});e=p.memory,s(e.buffer),Object.assign(r,p),r.UTF8ToString=u}return await h(),r}var bc=Object.defineProperty,wc=(t,e,n)=>e in t?bc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,D=(t,e,n)=>wc(t,typeof e!="symbol"?e+"":e,n);let B=null;function Cc(t){throw new xn(t.UTF8ToString(t.getLastOnigError()))}class Ct{constructor(e){D(this,"utf16Length"),D(this,"utf8Length"),D(this,"utf16Value"),D(this,"utf8Value"),D(this,"utf16OffsetToUtf8"),D(this,"utf8OffsetToUtf16");const n=e.length,r=Ct._utf8ByteLength(e),s=r!==n,o=s?new Uint32Array(n+1):null;s&&(o[n]=r);const i=s?new Uint32Array(r+1):null;s&&(i[r]=n);const a=new Uint8Array(r);let l=0;for(let c=0;c<n;c++){const u=e.charCodeAt(c);let f=u,h=!1;if(u>=55296&&u<=56319&&c+1<n){const d=e.charCodeAt(c+1);d>=56320&&d<=57343&&(f=(u-55296<<10)+65536|d-56320,h=!0)}s&&(o[c]=l,h&&(o[c+1]=l),f<=127?i[l+0]=c:f<=2047?(i[l+0]=c,i[l+1]=c):f<=65535?(i[l+0]=c,i[l+1]=c,i[l+2]=c):(i[l+0]=c,i[l+1]=c,i[l+2]=c,i[l+3]=c)),f<=127?a[l++]=f:f<=2047?(a[l++]=192|(f&1984)>>>6,a[l++]=128|(f&63)>>>0):f<=65535?(a[l++]=224|(f&61440)>>>12,a[l++]=128|(f&4032)>>>6,a[l++]=128|(f&63)>>>0):(a[l++]=240|(f&1835008)>>>18,a[l++]=128|(f&258048)>>>12,a[l++]=128|(f&4032)>>>6,a[l++]=128|(f&63)>>>0),h&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=e,this.utf8Value=a,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=i}static _utf8ByteLength(e){let n=0;for(let r=0,s=e.length;r<s;r++){const o=e.charCodeAt(r);let i=o,a=!1;if(o>=55296&&o<=56319&&r+1<s){const l=e.charCodeAt(r+1);l>=56320&&l<=57343&&(i=(o-55296<<10)+65536|l-56320,a=!0)}i<=127?n+=1:i<=2047?n+=2:i<=65535?n+=3:n+=4,a&&r++}return n}createString(e){const n=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,n),n}}const _t=class te{constructor(e){if(D(this,"id",++te.LAST_ID),D(this,"_onigBinding"),D(this,"content"),D(this,"utf16Length"),D(this,"utf8Length"),D(this,"utf16OffsetToUtf8"),D(this,"utf8OffsetToUtf16"),D(this,"ptr"),!B)throw new xn("Must invoke loadWasm first.");this._onigBinding=B,this.content=e;const n=new Ct(e);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!te._sharedPtrInUse?(te._sharedPtr||(te._sharedPtr=B.omalloc(1e4)),te._sharedPtrInUse=!0,B.HEAPU8.set(n.utf8Value,te._sharedPtr),this.ptr=te._sharedPtr):this.ptr=n.createString(B)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===te._sharedPtr?te._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};D(_t,"LAST_ID",0);D(_t,"_sharedPtr",0);D(_t,"_sharedPtrInUse",!1);let Rs=_t;class _c{constructor(e){if(D(this,"_onigBinding"),D(this,"_ptr"),!B)throw new xn("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=e.length;a<l;a++){const c=new Ct(e[a]);n[a]=c.createString(B),r[a]=c.utf8Length}const s=B.omalloc(4*e.length);B.HEAPU32.set(n,s/4);const o=B.omalloc(4*e.length);B.HEAPU32.set(r,o/4);const i=B.createOnigScanner(s,o,e.length);for(let a=0,l=e.length;a<l;a++)B.ofree(n[a]);B.ofree(o),B.ofree(s),i===0&&Cc(B),this._onigBinding=B,this._ptr=i}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,n,r){let s=0;if(typeof r=="number"&&(s=r),typeof e=="string"){e=new Rs(e);const o=this._findNextMatchSync(e,n,!1,s);return e.dispose(),o}return this._findNextMatchSync(e,n,!1,s)}_findNextMatchSync(e,n,r,s){const o=this._onigBinding,i=o.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(n),s);if(i===0)return null;const a=o.HEAPU32;let l=i/4;const c=a[l++],u=a[l++],f=[];for(let h=0;h<u;h++){const d=e.convertUtf8OffsetToUtf16(a[l++]),p=e.convertUtf8OffsetToUtf16(a[l++]);f[h]={start:d,end:p,length:p-d}}return{index:c,captureIndices:f}}}function Sc(t){return typeof t.instantiator=="function"}function kc(t){return typeof t.default=="function"}function xc(t){return typeof t.data<"u"}function vc(t){return typeof Response<"u"&&t instanceof Response}function Ic(t){return typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||ArrayBuffer.isView(t))||typeof Buffer<"u"&&Buffer.isBuffer?.(t)||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&t instanceof Uint32Array}let Ze;function Ec(t){if(Ze)return Ze;async function e(){B=await yc(async n=>{let r=t;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),Sc(r)?r=await r.instantiator(n):kc(r)?r=await r.default(n):(xc(r)&&(r=r.data),vc(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await Ac(r)(n):r=await Lc(r)(n):Ic(r)?r=await Gt(r)(n):r instanceof WebAssembly.Module?r=await Gt(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await Gt(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Ze=e(),Ze}function Gt(t){return e=>WebAssembly.instantiate(t,e)}function Ac(t){return e=>WebAssembly.instantiateStreaming(t,e)}function Lc(t){return async e=>{const n=await t.arrayBuffer();return WebAssembly.instantiate(n,e)}}async function Rc(t){return t&&await Ec(t),{createScanner(e){return new _c(e.map(n=>typeof n=="string"?n:n.source))},createString(e){return new Rs(e)}}}class Ns{diff(e,n,r={}){let s;typeof r=="function"?(s=r,r={}):"callback"in r&&(s=r.callback);const o=this.castInput(e,r),i=this.castInput(n,r),a=this.removeEmpty(this.tokenize(o,r)),l=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(a,l,r,s)}diffWithOptionsObj(e,n,r,s){var o;const i=y=>{if(y=this.postProcess(y,r),s){setTimeout(function(){s(y)},0);return}else return y},a=n.length,l=e.length;let c=1,u=a+l;r.maxEditLength!=null&&(u=Math.min(u,r.maxEditLength));const f=(o=r.timeout)!==null&&o!==void 0?o:1/0,h=Date.now()+f,d=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(d[0],n,e,0,r);if(d[0].oldPos+1>=l&&p+1>=a)return i(this.buildValues(d[0].lastComponent,n,e));let b=-1/0,w=1/0;const m=()=>{for(let y=Math.max(b,-c);y<=Math.min(w,c);y+=2){let g;const _=d[y-1],S=d[y+1];_&&(d[y-1]=void 0);let x=!1;if(S){const k=S.oldPos-y;x=S&&0<=k&&k<a}const v=_&&_.oldPos+1<l;if(!x&&!v){d[y]=void 0;continue}if(!v||x&&_.oldPos<S.oldPos?g=this.addToPath(S,!0,!1,0,r):g=this.addToPath(_,!1,!0,1,r),p=this.extractCommon(g,n,e,y,r),g.oldPos+1>=l&&p+1>=a)return i(this.buildValues(g.lastComponent,n,e))||!0;d[y]=g,g.oldPos+1>=l&&(w=Math.min(w,y-1)),p+1>=a&&(b=Math.max(b,y+1))}c++};if(s)(function y(){setTimeout(function(){if(c>u||Date.now()>h)return s(void 0);m()||y()},0)})();else for(;c<=u&&Date.now()<=h;){const y=m();if(y)return y}}addToPath(e,n,r,s,o){const i=e.lastComponent;return i&&!o.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:e.oldPos+s,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(e,n,r,s,o){const i=n.length,a=r.length;let l=e.oldPos,c=l-s,u=0;for(;c+1<i&&l+1<a&&this.equals(r[l+1],n[c+1],o);)c++,l++,u++,o.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!o.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const s=[];let o;for(;e;)s.push(e),o=e.previousComponent,delete e.previousComponent,e=o;s.reverse();const i=s.length;let a=0,l=0,c=0;for(;a<i;a++){const u=s[a];if(u.removed)u.value=this.join(r.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=n.slice(l,l+u.count);f=f.map(function(h,d){const p=r[c+d];return p.length>h.length?p:h}),u.value=this.join(f)}else u.value=this.join(n.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return s}}class Nc extends Ns{}const Pc=new Nc;function Tc(t,e,n){return Pc.diff(t,e,n)}const gr="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class $c extends Ns{tokenize(e){const n=new RegExp(`(\\r?\\n)|[${gr}]+|[^\\S\\n\\r]+|[^${gr}]`,"ug");return e.match(n)||[]}}const Mc=new $c;function Oc(t,e,n){return Mc.diff(t,e,n)}function Dc(t={}){const{classPrefix:e="__shiki_",classSuffix:n="",classReplacer:r=a=>a}=t,s=new Map;function o(a){return Object.entries(a).map(([l,c])=>`${l}:${c}`).join(";")}function i(a){const l=typeof a=="string"?a:o(a);let c=e+Gc(l)+n;return c=r(c),s.has(c)||s.set(c,typeof a=="string"?a:{...a}),c}return{name:"@shikijs/transformers:style-to-class",pre(a){if(!a.properties.style)return;const l=i(a.properties.style);delete a.properties.style,this.addClassToHast(a,l)},tokens(a){for(const l of a)for(const c of l){if(!c.htmlStyle)continue;const u=i(c.htmlStyle);c.htmlStyle={},c.htmlAttrs||={},c.htmlAttrs.class?c.htmlAttrs.class+=` ${u}`:c.htmlAttrs.class=u}},getClassRegistry(){return s},getCSS(){let a="";for(const[l,c]of s.entries())a+=`.${l}{${typeof c=="string"?c:o(c)}}`;return a},clearRegistry(){s.clear()}}}function Gc(t,e=0){let n=3735928559^e,r=1103547991^e;for(let s=0,o;s<t.length;s++)o=t.charCodeAt(s),n=Math.imul(n^o,2654435761),r=Math.imul(r^o,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}const Bc=/(?<=\n)/,St={dark:"pierre-dark",light:"pierre-light"},Ps=1,mr=new Map,yr=new Set;function vn(t,e){t=Array.isArray(t)?t:[t];for(const n of t){if(yr.has(n.name))continue;let r=mr.get(n.name);r==null&&(r=n,mr.set(n.name,r)),yr.add(r.name),e.loadLanguageSync(r.data)}}const Bt=new Map,br=new Set;function Ts(t,e){t=Array.isArray(t)?t:[t];for(let n of t){let r;if(typeof n=="string"){if(r=Bt.get(n),r==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else r=n,n=n.name,Bt.has(n)||Bt.set(n,r);br.has(n)||(br.add(n),e.loadThemeSync(r))}}const ae=new Map;let wr=0;const Ne={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function an(t){if(ae.has(t))return ae.get(t)??"text";if(Ne[t]!=null)return Ne[t];const e=t.match(/\.([^/\\]+\.[^/\\]+)$/);if(e!=null){if(ae.has(e[1]))return ae.get(e[1])??"text";if(Ne[e[1]]!=null)return Ne[e[1]]??"text"}const n=t.match(/\.([^.]+)$/)?.[1]??"";return ae.has(n)?ae.get(n)??"text":Ne[n]??"text"}function Fc(t,e){if(t<=wr)return!1;ae.clear();for(const n in e){const r=e[n];r!=null&&ae.set(n,r)}return wr=t,!0}function Fe(t){return t.replace(/\n$|\r\n$/,"")}function Uc(t){return{type:"text",value:t}}function jc({tagName:t,children:e=[],properties:n={}}){return{type:"element",tagName:t,properties:n,children:e}}function Wc(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e;"children"in e?e=e.children[0]:e=null}}function zc(t,e,n){const r=typeof n.lineInfo=="function"?n.lineInfo(e):n.lineInfo[e-1];if(r==null){const s=`processLine: line ${e}, contains no state.lineInfo`;throw console.error(s,{node:t,line:e,state:n}),new Error(s)}return t.tagName="div",t.properties["data-line"]=r.lineNumber,t.properties["data-alt-line"]=r.altLineNumber,t.properties["data-line-type"]=r.type,t.properties["data-line-index"]=r.lineIndex,t.children.length===0&&t.children.push(Uc(`
|
|
153
|
+
`)),t}const Qe=Symbol("no-token"),Ft=Symbol("multiple-tokens");function $s(t){const e=Hc(t);if(e!=null)return e;let n=Qe;const r=[];let s=[],o;const i=()=>{if(s.length===0||o==null){s=[],o=void 0;return}if(s.length===1){const l=s[0];if(l?.type==="element"){Vc(l,o);for(const c of l.children)nt(c)}else nt(l);r.push(l),s=[],o=void 0;return}for(const l of s)nt(l);r.push(jc({tagName:"span",properties:{"data-char":o},children:s})),s=[],o=void 0},a=l=>{if(l!==Qe){if(l===Ft){n=Ft;return}if(n===Qe){n=l;return}n!==l&&(n=Ft)}};for(const l of t.children){const c=l.type==="element"?$s(l):Qe;if(a(c),typeof c!="number"){i(),r.push(l);continue}o!=null&&o!==c&&i(),o??=c,s.push(l)}return i(),t.children=r,n}function Hc(t){const e=t.properties["data-char"];if(typeof e=="number")return e}function nt(t){if(t.type==="element"){t.properties["data-char"]=void 0;for(const e of t.children)nt(e)}}function Vc(t,e){t.properties["data-char"]=e}function Ms(t=!1,e=!1){const n={lineInfo:[]},r=[{line(s){return delete s.properties.class,s},pre(s){const o=Wc(s),i=[];if(o!=null){let a=1;for(const l of o.children)l.type==="element"&&(t&&$s(l),i.push(zc(l,a,n)),a++);o.children=i}return s},...t?{tokens(s){for(const o of s){let i=0;for(const a of o){const l=a;l.__lineChar??=i,i+=a.content.length}}},preprocess(s,o){o.mergeWhitespaces="never"},span(s,o,i,a,l){if(l?.offset!=null&&l.content!=null){const c=l.__lineChar;return c!=null&&(s.properties["data-char"]=c),s}return s}}:null}];return e&&r.push(qc,Cr),{state:n,transformers:r,toClass:Cr}}const Cr=Dc({classPrefix:"hl-"}),qc={name:"token-style-normalizer",tokens(t){for(const e of t)for(const n of e){if(n.htmlStyle!=null)continue;const r={};n.color!=null&&(r.color=n.color),n.bgColor!=null&&(r["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(r["font-style"]="italic"),(n.fontStyle&2)!==0&&(r["font-weight"]="bold"),(n.fontStyle&4)!==0&&(r["text-decoration"]="underline")),Object.keys(r).length>0&&(n.htmlStyle=r)}}};function q(t){return`--${t==="token"?"diffs-token":"diffs"}-`}function Os({theme:t=St,highlighter:e,prefix:n}){let r="";if(typeof t=="string"){const s=e.getTheme(t);r+=`color:${s.fg};`,r+=`background-color:${s.bg};`,r+=`${q("global")}fg:${s.fg};`,r+=`${q("global")}bg:${s.bg};`,r+=Ut(s,n)}else{let s=e.getTheme(t.dark);r+=`${q("global")}dark:${s.fg};`,r+=`${q("global")}dark-bg:${s.bg};`,r+=Ut(s,"dark"),s=e.getTheme(t.light),r+=`${q("global")}light:${s.fg};`,r+=`${q("global")}light-bg:${s.bg};`,r+=Ut(s,"light")}return r}function Ut(t,e){e=e!=null?`${e}-`:"";let n="";const r=t.colors?.["gitDecoration.addedResourceForeground"]??t.colors?.["terminal.ansiGreen"];r!=null&&(n+=`${q("global")}${e}addition-color:${r};`);const s=t.colors?.["gitDecoration.deletedResourceForeground"]??t.colors?.["terminal.ansiRed"];s!=null&&(n+=`${q("global")}${e}deletion-color:${s};`);const o=t.colors?.["gitDecoration.modifiedResourceForeground"]??t.colors?.["terminal.ansiBlue"];return o!=null&&(n+=`${q("global")}${e}modified-color:${o};`),n}function ln(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e.children;"children"in e?e=e.children[0]:e=null}throw console.error(t),new Error("getLineNodes: Unable to find children")}function Xc({diff:t,diffStyle:e,startingLine:n=0,totalLines:r=1/0,expandedHunks:s,collapsedContextThreshold:o=Ps,callback:i}){const a={finalHunk:t.hunks.at(-1),viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:0,unifiedCount:0,shouldBreak(){if(!a.isWindowedHighlight)return!1;const u=a.unifiedCount>=n+r,f=a.splitCount>=n+r;return u&&f},shouldSkip(u,f){if(!a.isWindowedHighlight)return!1;const h=a.unifiedCount+u<n,d=a.splitCount+f<n;return h&&d},incrementCounts(u,f){a.unifiedCount+=u,a.splitCount+=f},isInWindow(u,f){if(!a.isWindowedHighlight)return!0;const h=a.isInUnifiedWindow(u),d=a.isInSplitWindow(f);return h||d},isInUnifiedWindow(u){return!a.isWindowedHighlight||a.unifiedCount>=n-u&&a.unifiedCount<n+r},isInSplitWindow(u){return!a.isWindowedHighlight||a.splitCount>=n-u&&a.splitCount<n+r},emit(u,f=!1){return f||a.incrementCounts(1,1),i(u)??!1}};e:for(const[u,f]of t.hunks.entries()){let b=function(k,A){return d==null||d.collapsedLines<=0||d.fromStart+d.fromEnd>0?0:A===f.splitLineStart+f.splitLineCount-1?d.collapsedLines:0},w=function(){if(h.collapsedLines===0)return 0;const k=h.collapsedLines;return h.collapsedLines=0,k};var l=b,c=w;if(a.shouldBreak())break;const h=_r(t.isPartial,f.collapsedBefore,s,u,o),d=(()=>{if(f!==a.finalHunk||!Kc(t))return;const k=t.additionLines.length-(f.additionLineIndex+f.additionCount),A=t.deletionLines.length-(f.deletionLineIndex+f.deletionCount);if(k!==A)throw new Error(`iterateOverDiff: trailing context mismatch (additions=${k}, deletions=${A}) for ${t.name}`);const R=Math.min(k,A);return _r(t.isPartial,R,s,t.hunks.length,o)})(),p=h.fromStart+h.fromEnd;if(a.shouldSkip(p,p))a.incrementCounts(p,p),w();else{let k=f.unifiedLineStart-h.rangeSize,A=f.splitLineStart-h.rangeSize,R=f.deletionLineIndex-h.rangeSize,$=f.additionLineIndex-h.rangeSize,N=f.deletionStart-h.rangeSize,z=f.additionStart-h.rangeSize,L=0;for(;L<h.fromStart;){if(a.isInWindow(0,0)){if(a.emit({hunkIndex:u,hunk:f,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:N+L,lineIndex:R+L,noEOFCR:!1,unifiedLineIndex:k+L,splitLineIndex:A+L},additionLine:{unifiedLineIndex:k+L,splitLineIndex:A+L,lineIndex:$+L,lineNumber:z+L,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);L++}for(k=f.unifiedLineStart-h.fromEnd,A=f.splitLineStart-h.fromEnd,R=f.deletionLineIndex-h.fromEnd,$=f.additionLineIndex-h.fromEnd,N=f.deletionStart-h.fromEnd,z=f.additionStart-h.fromEnd,L=0;L<h.fromEnd;){if(a.isInWindow(0,0)){if(a.emit({hunkIndex:u,hunk:f,collapsedBefore:w(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:N+L,lineIndex:R+L,noEOFCR:!1,unifiedLineIndex:k+L,splitLineIndex:A+L},additionLine:{unifiedLineIndex:k+L,splitLineIndex:A+L,lineIndex:$+L,lineNumber:z+L,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);L++}}let m=f.unifiedLineStart,y=f.splitLineStart,g=f.deletionLineIndex,_=f.additionLineIndex,S=f.deletionStart,x=f.additionStart;const v=f.hunkContent.at(-1);for(const k of f.hunkContent){if(a.shouldBreak())break e;const A=k===v;if(k.type==="context"){if(a.shouldSkip(k.lines,k.lines))a.incrementCounts(k.lines,k.lines),w();else{let R=0;for(;R<k.lines;){if(a.isInWindow(0,0)){const $=A&&R===k.lines-1,N=m+R,z=y+R;if(a.emit({hunkIndex:u,hunk:f,collapsedBefore:w(),collapsedAfter:b(N,z),type:"context",deletionLine:{lineNumber:S+R,lineIndex:g+R,noEOFCR:$&&f.noEOFCRDeletions,unifiedLineIndex:N,splitLineIndex:z},additionLine:{unifiedLineIndex:N,splitLineIndex:z,lineIndex:_+R,lineNumber:x+R,noEOFCR:$&&f.noEOFCRAdditions}}))break e}else a.incrementCounts(1,1);R++}}m+=k.lines,y+=k.lines,g+=k.lines,_+=k.lines,S+=k.lines,x+=k.lines}else{const R=Math.max(k.deletions,k.additions),$=k.deletions+k.additions;if(!a.shouldSkip($,R)){const N=Zc(a,k);for(const[z,L]of N)for(let X=z;X<L;X++){const Le=b(m+X,y+X);if(a.emit(Qc({hunkIndex:u,hunk:f,collapsedBefore:w(),collapsedAfter:Le,diffStyle:e,index:X,unifiedLineIndex:m,splitLineIndex:y,additionLineIndex:_,deletionLineIndex:g,additionLineNumber:x,deletionLineNumber:S,content:k,isLastContent:A,unifiedCount:$,splitCount:R}),!0))break e}}w(),a.incrementCounts($,R),m+=$,y+=R,g+=k.deletions,_+=k.additions,S+=k.deletions,x+=k.additions}}if(d!=null){const{collapsedLines:k,fromStart:A,fromEnd:R}=d,$=A+R;let N=0;for(;N<$;){if(a.shouldBreak())break e;if(a.isInWindow(0,0)){const z=N===$-1;if(a.emit({hunkIndex:t.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:z?k:0,type:"context-expanded",deletionLine:{lineNumber:S+N,lineIndex:g+N,noEOFCR:!1,unifiedLineIndex:m+N,splitLineIndex:y+N},additionLine:{unifiedLineIndex:m+N,splitLineIndex:y+N,lineIndex:_+N,lineNumber:x+N,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);N++}}}}function _r(t,e,n,r,s){if(e=Math.max(e,0),e===0||t)return{fromStart:0,fromEnd:0,rangeSize:e,collapsedLines:Math.max(e,0)};if(n===!0||e<=s)return{fromStart:e,fromEnd:0,rangeSize:e,collapsedLines:0};const o=n?.get(r),i=Math.min(Math.max(o?.fromStart??0,0),e),a=Math.min(Math.max(o?.fromEnd??0,0),e),l=i+a,c=l>=e;return{fromStart:c?e:i,fromEnd:c?0:a,rangeSize:e,collapsedLines:Math.max(e-l,0)}}function Kc(t){const e=t.hunks.at(-1);return e==null||t.isPartial||t.additionLines.length===0||t.deletionLines.length===0?!1:e.additionLineIndex+e.additionCount<t.additionLines.length||e.deletionLineIndex+e.deletionCount<t.deletionLines.length}function Zc(t,e,n){if(!t.isWindowedHighlight)return[[0,Math.max(e.deletions,e.additions)]];const r=[];function s(l,c){if(l+c<=t.viewportStart||l>=t.viewportEnd)return;const u=Math.max(0,t.viewportStart-l),f=Math.min(c,t.viewportEnd-l);return f>u?[u,f]:void 0}function o(l,c){return l}function i(l,c){if(l==null)return;const[u,f]=o(l);f>u&&r.push([u,f])}if(i(s(t.unifiedCount,e.deletions)),i(s(t.unifiedCount+e.deletions,e.additions)),i(s(t.splitCount,e.deletions)),i(s(t.splitCount,e.additions)),r.length===0)return r;r.sort((l,c)=>l[0]-c[0]);const a=[r[0]];for(const[l,c]of r.slice(1)){const u=a[a.length-1];l<=u[1]?u[1]=Math.max(u[1],c):a.push([l,c])}return a}function Qc({hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,diffStyle:s,index:o,unifiedLineIndex:i,splitLineIndex:a,additionLineIndex:l,deletionLineIndex:c,additionLineNumber:u,deletionLineNumber:f,content:h,isLastContent:d,unifiedCount:p,splitCount:b}){const w=o<h.deletions?i+o:void 0,m=o<h.additions?i+h.deletions+o:void 0,y=a+o,g=o<h.deletions?c+o:void 0,_=o<h.deletions?f+o:void 0,S=o<h.additions?l+o:void 0,x=o<h.additions?u+o:void 0,v=d&&o===b-1&&e.noEOFCRDeletions,k=d&&o===b-1&&e.noEOFCRAdditions,A=g!=null&&_!=null&&w!=null?{lineNumber:_,lineIndex:g,noEOFCR:v,unifiedLineIndex:w,splitLineIndex:y}:void 0,R=S!=null&&x!=null&&m!=null?{unifiedLineIndex:m,splitLineIndex:y,lineIndex:S,lineNumber:x,noEOFCR:k}:void 0;if(A==null&&R!=null)return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:R};if(A!=null&&R==null)return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:A,additionLine:void 0};if(A==null||R==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:A,additionLine:R}}function Sr({line:t,spanStart:e,spanLength:n}){return{start:{line:t,character:e},end:{line:t,character:e+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function Ye({item:t,arr:e,enableJoin:n,isNeutral:r=!1,isLastItem:s=!1}){const o=e[e.length-1];if(o==null||s||!n){e.push([r?0:1,t.value]);return}const i=o[0]===0;if(r===i||r&&t.value.length===1&&!i){o[1]+=t.value;return}e.push([r?0:1,t.value])}const Yc={forcePlainText:!1};function Jc(t,e,n,{forcePlainText:r,startingLine:s,totalLines:o,expandedHunks:i,collapsedContextThreshold:a=Ps}=Yc){r?(s??=0,o??=1/0):(s=0,o=1/0);const l=s>0||o<1/0,c=typeof n.theme=="string"?e.getTheme(n.theme).type:void 0,u=Os({theme:n.theme,highlighter:e}),f=r&&!l&&(t.unifiedLineCount>1e3||t.splitLineCount>1e3)?"none":n.lineDiffType,h={deletionLines:[],additionLines:[]},{maxLineDiffLength:d}=n,p=!r&&!t.isPartial,b=r?i:void 0,w=new Map;function m(g){const _=p?0:g,S=w.get(_)??tu();return w.set(_,S),S}function y(g,_,S,x){if(l){let v=S.at(-1);(v==null||v.targetIndex+v.count!==_)&&(v={targetIndex:_,originalOffset:x.length,count:0},S.push(v)),v.count++}x.push(g)}Xc({diff:t,diffStyle:"both",startingLine:s,totalLines:o,expandedHunks:l?b:!0,collapsedContextThreshold:a,callback:({hunkIndex:g,additionLine:_,deletionLine:S,type:x})=>{const v=m(g),k=_!=null?_.splitLineIndex:S.splitLineIndex;x==="change"&&_!=null&&S!=null&&eu({additionLine:t.additionLines[_.lineIndex],deletionLine:t.deletionLines[S.lineIndex],deletionLineIndex:v.deletionContent.length,additionLineIndex:v.additionContent.length,deletionDecorations:v.deletionDecorations,additionDecorations:v.additionDecorations,lineDiffType:f,maxLineDiffLength:d}),S!=null&&(y(t.deletionLines[S.lineIndex],S.lineIndex,v.deletionSegments,v.deletionContent),v.deletionInfo.push({type:x==="change"?"change-deletion":x,lineNumber:S.lineNumber,altLineNumber:x==="change"?void 0:_.lineNumber??void 0,lineIndex:`${S.unifiedLineIndex},${k}`})),_!=null&&(y(t.additionLines[_.lineIndex],_.lineIndex,v.additionSegments,v.additionContent),v.additionInfo.push({type:x==="change"?"change-addition":x,lineNumber:_.lineNumber,altLineNumber:x==="change"?void 0:S.lineNumber??void 0,lineIndex:`${_.unifiedLineIndex},${k}`}))}});for(const g of w.values()){if(g.deletionContent.length===0&&g.additionContent.length===0)continue;const _={name:t.prevName??t.name,contents:g.deletionContent.value},S={name:t.name,contents:g.additionContent.value},{deletionLines:x,additionLines:v}=nu({deletionFile:_,deletionInfo:g.deletionInfo,deletionDecorations:g.deletionDecorations,additionFile:S,additionInfo:g.additionInfo,additionDecorations:g.additionDecorations,highlighter:e,options:n,languageOverride:r?"text":t.lang});if(p){h.deletionLines=x,h.additionLines=v;continue}if(g.deletionSegments.length>0)for(const k of g.deletionSegments)for(let A=0;A<k.count;A++)h.deletionLines[k.targetIndex+A]=x[k.originalOffset+A];else h.deletionLines.push(...x);if(g.additionSegments.length>0)for(const k of g.additionSegments)for(let A=0;A<k.count;A++)h.additionLines[k.targetIndex+A]=v[k.originalOffset+A];else h.additionLines.push(...v)}return{code:h,themeStyles:u,baseThemeType:c}}function eu({deletionLine:t,additionLine:e,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:s,additionDecorations:o,lineDiffType:i,maxLineDiffLength:a}){if(t==null||e==null||i==="none"||(t=Fe(t),e=Fe(e),t.length>a||e.length>a))return;const l=i==="char"?Tc(t,e):Oc(t,e),c=[],u=[],f=i==="word-alt",h=l.at(-1);for(const p of l){const b=p===h;!p.added&&!p.removed?(Ye({item:p,arr:c,enableJoin:f,isNeutral:!0,isLastItem:b}),Ye({item:p,arr:u,enableJoin:f,isNeutral:!0,isLastItem:b})):p.removed?Ye({item:p,arr:c,enableJoin:f,isLastItem:b}):Ye({item:p,arr:u,enableJoin:f,isLastItem:b})}let d=0;for(const p of c)p[0]===1&&s.push(Sr({line:n,spanStart:d,spanLength:p[1].length})),d+=p[1].length;d=0;for(const p of u)p[0]===1&&o.push(Sr({line:r,spanStart:d,spanLength:p[1].length})),d+=p[1].length}function tu(){return{deletionContent:{push(t){this.value+=t,this.length++},value:"",length:0},additionContent:{push(t){this.value+=t,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function nu({deletionFile:t,additionFile:e,deletionInfo:n,additionInfo:r,highlighter:s,deletionDecorations:o,additionDecorations:i,languageOverride:a,options:{theme:l=St,...c}}){const u=a??an(t.name),f=a??an(e.name),{state:h,transformers:d}=Ms(c.useTokenTransformer),p=typeof l=="string"?{...c,lang:"text",theme:l,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:q("token")}:{...c,lang:"text",themes:l,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:q("token")};return{deletionLines:t.contents===""?[]:(p.lang=u,h.lineInfo=n,p.decorations=o,ln(s.codeToHast(Fe(t.contents),p))),additionLines:e.contents===""?[]:(p.lang=f,p.decorations=i,h.lineInfo=r,ln(s.codeToHast(Fe(e.contents),p)))}}function ru({lines:t,startingLine:e=0,totalLines:n=1/0,callback:r}){const s=Math.min(e+n,t.length),o=(()=>{const i=t.at(-1);return i===""||i===`
|
|
154
|
+
`||i===`\r
|
|
155
|
+
`||i==="\r"?Math.max(0,t.length-2):t.length-1})();for(let i=e;i<s;i++){const a=i===o;if(r({lineIndex:i,lineNumber:i+1,content:t[i],isLastLine:a})===!0||a)break}}function su(t){return t!==""?t.split(Bc):[]}const ou={forcePlainText:!1};function iu(t,e,{theme:n=St,tokenizeMaxLineLength:r,useTokenTransformer:s},{forcePlainText:o,startingLine:i,totalLines:a,lines:l}=ou){o?(i??=0,a??=1/0):(i=0,a=1/0);const c=i>0||a<1/0,{state:u,transformers:f}=Ms(s),h=o?"text":t.lang??an(t.name),d=typeof n=="string"?e.getTheme(n).type:void 0,p=Os({theme:n,highlighter:e});u.lineInfo=y=>({type:"context",lineIndex:y-1+i,lineNumber:y+i});const b=typeof n=="string"?{lang:h,theme:n,transformers:f,defaultColor:!1,cssVariablePrefix:q("token"),tokenizeMaxLineLength:r}:{lang:h,themes:n,transformers:f,defaultColor:!1,cssVariablePrefix:q("token"),tokenizeMaxLineLength:r},w=ln(e.codeToHast(c?au(l??su(t.contents),i,a):Fe(t.contents),b)),m=c?new Array(i):w;return c&&m.push(...w),{code:m,themeStyles:p,baseThemeType:d}}function au(t,e,n){let r="";return ru({lines:t,startingLine:e,totalLines:n,callback({content:s}){r+=s}}),r}let kr,pe={theme:St,useTokenTransformer:!1,tokenizeMaxLineLength:1e3,lineDiffType:"word-alt",maxLineDiffLength:1e3};self.addEventListener("error",t=>{console.error("[Shiki Worker] Unhandled error:",t.error)});self.addEventListener("message",t=>{lu(t.data)});async function lu(t){try{switch(t.type){case"initialize":await cu(t);break;case"set-render-options":await uu(t);break;case"file":await fu(t);break;case"diff":await hu(t);break;default:throw new Error(`Unknown request type: ${t.type}`)}}catch(e){console.error("Worker error:",e),gu(t.id,e)}}async function cu({id:t,renderOptions:e,preferredHighlighter:n,resolvedThemes:r,resolvedLanguages:s,customExtensionsVersion:o,customExtensionMap:i}){let a=kt(n);"then"in a&&(a=await a),In({customExtensionsVersion:o,customExtensionMap:i}),Ts(r,a),s!=null&&vn(s,a),pe=e,postMessage({type:"success",id:t,requestType:"initialize",sentAt:Date.now()})}async function uu({id:t,renderOptions:e,resolvedThemes:n}){let r=kt();"then"in r&&(r=await r),Ts(n,r),pe=e,postMessage({type:"success",id:t,requestType:"set-render-options",sentAt:Date.now()})}async function fu({id:t,file:e,resolvedLanguages:n,customExtensionsVersion:r,customExtensionMap:s}){let o=kt();"then"in o&&(o=await o),In({customExtensionsVersion:r,customExtensionMap:s}),n!=null&&vn(n,o);const i={theme:pe.theme,useTokenTransformer:pe.useTokenTransformer,tokenizeMaxLineLength:pe.tokenizeMaxLineLength};du(t,iu(e,o,i),i)}async function hu({id:t,diff:e,resolvedLanguages:n,customExtensionsVersion:r,customExtensionMap:s}){let o=kt();"then"in o&&(o=await o),In({customExtensionsVersion:r,customExtensionMap:s}),n!=null&&vn(n,o),pu(t,Jc(e,o,pe),pe)}function kt(t="shiki-js"){return kr??=Ea({themes:[],langs:[],engine:t==="shiki-wasm"?Rc(import("./wasm-CG6Dc4jp.js")):dc()}),kr}function In({customExtensionsVersion:t,customExtensionMap:e}){if(!(t==null&&e==null)){if(t==null||e==null)throw new Error("Worker request must include both customExtensionsVersion and customExtensionMap");Fc(t,e)}}function du(t,e,n){postMessage({type:"success",requestType:"file",id:t,result:e,options:n,sentAt:Date.now()})}function pu(t,e,n){postMessage({type:"success",requestType:"diff",id:t,result:e,options:n,sentAt:Date.now()})}function gu(t,e){const n={type:"error",id:t,error:e instanceof Error?e.message:String(e),stack:e instanceof Error?e.stack:void 0};postMessage(n)}
|