@namzu/cli 52.1.0 → 52.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/bin.js +1 -1
- package/dist/chunks/{acp-C2H6FGPR.js → acp-QNJODJHL.js} +51 -24
- package/dist/chunks/{acp-C2H6FGPR.js.map → acp-QNJODJHL.js.map} +1 -1
- package/dist/chunks/{add-VOR5M5BV.js → add-L6FKDP7N.js} +9 -9
- package/dist/chunks/{agent-EWZGPBGI.js → agent-VJRVABX2.js} +13 -13
- package/dist/chunks/{agent-session-EKTTB7TN.js → agent-session-JO5HEUHN.js} +14 -14
- package/dist/chunks/{apply-at-exit-FVOHKVHQ.js → apply-at-exit-OGSLNQHX.js} +4 -4
- package/dist/chunks/bash-5556UNOY.js +404 -0
- package/dist/chunks/bash-5556UNOY.js.map +6 -0
- package/dist/chunks/{bin-main-C5UNGSAQ.js → bin-main-XIAVK2BK.js} +5 -5
- package/dist/chunks/c-SMQ2QLVV.js +304 -0
- package/dist/chunks/c-SMQ2QLVV.js.map +6 -0
- package/dist/chunks/{chat-YQCC2O5F.js → chat-AQICSI4M.js} +2 -2
- package/dist/chunks/{chunk-F7LMCISP.js → chunk-33CQRXME.js} +3 -3
- package/dist/chunks/{chunk-H6KPEFAR.js → chunk-47E6HKJT.js} +2 -2
- package/dist/chunks/{chunk-6KB5XGKP.js → chunk-4XZ67B3M.js} +2 -2
- package/dist/chunks/{chunk-FWAUXNV2.js → chunk-625CBBTB.js} +2 -2
- package/dist/chunks/{chunk-W7JMWUGD.js → chunk-A54YZM6S.js} +13 -13
- package/dist/chunks/{chunk-WK6RNDIK.js → chunk-BCPKC2WP.js} +2 -2
- package/dist/chunks/{chunk-YIBJO76L.js → chunk-DMUQFCYZ.js} +2 -2
- package/dist/chunks/{chunk-ZNYLVJIS.js → chunk-FTVJAKCW.js} +3 -3
- package/dist/chunks/{chunk-WNVU6MMP.js → chunk-IZJ5JESH.js} +2 -2
- package/dist/chunks/{chunk-JWS3NQAH.js → chunk-JCIHE3LO.js} +4 -4
- package/dist/chunks/{chunk-J2JLP6NV.js → chunk-LJNIEZAF.js} +27 -8
- package/dist/chunks/{chunk-J2JLP6NV.js.map → chunk-LJNIEZAF.js.map} +1 -1
- package/dist/chunks/{chunk-Y2DDE2WB.js → chunk-NRFNUYVH.js} +3 -3
- package/dist/chunks/{chunk-IBTPIZKL.js → chunk-PRTQ2L3O.js} +8 -8
- package/dist/chunks/{chunk-MVMWAXEY.js → chunk-PVHTDN4J.js} +2 -2
- package/dist/chunks/{chunk-2ZYV3IZA.js → chunk-R3BEW6BX.js} +22 -22
- package/dist/chunks/{chunk-QZODMCBW.js → chunk-RX22HLIT.js} +2 -2
- package/dist/chunks/{chunk-FMBLLPNE.js → chunk-S2JWPUUH.js} +67 -1
- package/dist/chunks/{chunk-FMBLLPNE.js.map → chunk-S2JWPUUH.js.map} +1 -1
- package/dist/chunks/{chunk-SFAK4Z6T.js → chunk-SRHEX5JB.js} +3342 -1228
- package/dist/chunks/chunk-SRHEX5JB.js.map +6 -0
- package/dist/chunks/{chunk-N3LPO5PK.js → chunk-TITSLPYI.js} +11 -11
- package/dist/chunks/{chunk-F7MCS63F.js → chunk-UF6F2Z62.js} +3 -3
- package/dist/chunks/{chunk-6O5Q6YBP.js → chunk-UKOCGHMU.js} +489 -57
- package/dist/chunks/{chunk-6O5Q6YBP.js.map → chunk-UKOCGHMU.js.map} +2 -2
- package/dist/chunks/{chunk-4SEHD4ZI.js → chunk-USDNK4TL.js} +2 -2
- package/dist/chunks/{chunk-EJCQKJZ2.js → chunk-WD2F6EO3.js} +35 -3
- package/dist/chunks/chunk-WD2F6EO3.js.map +6 -0
- package/dist/chunks/{chunk-TEBW5NV3.js → chunk-WSEJK4WO.js} +3 -3
- package/dist/chunks/{chunk-GFEHVD2U.js → chunk-WZHS724Y.js} +2 -2
- package/dist/chunks/{chunk-JBC4TK56.js → chunk-YMMEAXUK.js} +2 -2
- package/dist/chunks/{chunk-47R3EA5L.js → chunk-ZDEQIXJX.js} +2 -2
- package/dist/chunks/{chunk-OIYJMKAT.js → chunk-ZIFCQKET.js} +2 -2
- package/dist/chunks/{cli-runtime-SWBSTK5Y.js → cli-runtime-J5E5XM6I.js} +7 -7
- package/dist/chunks/core-6GH4J4QJ.js +1647 -0
- package/dist/chunks/core-6GH4J4QJ.js.map +6 -0
- package/dist/chunks/cpp-VMCZSFFM.js +553 -0
- package/dist/chunks/cpp-VMCZSFFM.js.map +6 -0
- package/dist/chunks/csharp-OVPHVEVY.js +410 -0
- package/dist/chunks/csharp-OVPHVEVY.js.map +6 -0
- package/dist/chunks/css-RIXPOU7U.js +947 -0
- package/dist/chunks/css-RIXPOU7U.js.map +6 -0
- package/dist/chunks/diff-IP3Y64PF.js +63 -0
- package/dist/chunks/diff-IP3Y64PF.js.map +6 -0
- package/dist/chunks/dockerfile-DVPABFVZ.js +44 -0
- package/dist/chunks/dockerfile-DVPABFVZ.js.map +6 -0
- package/dist/chunks/{doctor-BO6742WI.js → doctor-TC5F3XFP.js} +20 -20
- package/dist/chunks/{drain-R55GDZ6K.js → drain-VINUZDH4.js} +2 -2
- package/dist/chunks/{entry-OIRUHLN6.js → entry-UEPUPWGI.js} +4 -4
- package/dist/chunks/{eval-LC2YEQE4.js → eval-YTQCMDNP.js} +5 -5
- package/dist/chunks/{exec-MVNCTFY2.js → exec-DGX427HX.js} +32 -32
- package/dist/chunks/go-RKN2IZ6A.js +164 -0
- package/dist/chunks/go-RKN2IZ6A.js.map +6 -0
- package/dist/chunks/graphql-2VQIML4V.js +80 -0
- package/dist/chunks/graphql-2VQIML4V.js.map +6 -0
- package/dist/chunks/{host-OJRB5UR4.js → host-KTD5OE67.js} +5 -5
- package/dist/chunks/{host-queries-BTUGRPDQ.js → host-queries-JPW6LDTA.js} +2 -2
- package/dist/chunks/ini-W63MIP5J.js +126 -0
- package/dist/chunks/ini-W63MIP5J.js.map +6 -0
- package/dist/chunks/java-R4N7OXMG.js +265 -0
- package/dist/chunks/java-R4N7OXMG.js.map +6 -0
- package/dist/chunks/javascript-26OKUOUQ.js +712 -0
- package/dist/chunks/javascript-26OKUOUQ.js.map +6 -0
- package/dist/chunks/json-4GADDWNK.js +50 -0
- package/dist/chunks/json-4GADDWNK.js.map +6 -0
- package/dist/chunks/kotlin-MB7RKXOG.js +265 -0
- package/dist/chunks/kotlin-MB7RKXOG.js.map +6 -0
- package/dist/chunks/{learn-L7W4AY6F.js → learn-VUJQOB57.js} +2 -2
- package/dist/chunks/{learn-builtin-F6D7VG2T.js → learn-builtin-POKSGCNI.js} +3 -3
- package/dist/chunks/less-GNSNU2PC.js +1028 -0
- package/dist/chunks/less-GNSNU2PC.js.map +6 -0
- package/dist/chunks/{lifecycle-VH5JVETC.js → lifecycle-7BOLGSXR.js} +11 -11
- package/dist/chunks/{list-O6NVVBVF.js → list-QTYDGVQY.js} +7 -7
- package/dist/chunks/{live-VMIC5YSV.js → live-WTDKDIAG.js} +19 -19
- package/dist/chunks/lua-RNOSKZ3S.js +71 -0
- package/dist/chunks/lua-RNOSKZ3S.js.map +6 -0
- package/dist/chunks/makefile-ZK3QWG3U.js +81 -0
- package/dist/chunks/makefile-ZK3QWG3U.js.map +6 -0
- package/dist/chunks/markdown-JVOBZC3L.js +242 -0
- package/dist/chunks/markdown-JVOBZC3L.js.map +6 -0
- package/dist/chunks/{mcp-SUQ5VHS3.js → mcp-6QVO6CF6.js} +5 -5
- package/dist/chunks/{message-command-D72XMTER.js → message-command-LZDQXRHW.js} +16 -16
- package/dist/chunks/objectivec-SSOLSTDI.js +253 -0
- package/dist/chunks/objectivec-SSOLSTDI.js.map +6 -0
- package/dist/chunks/{pal-IMTWZXWM.js → pal-EHDMM5XR.js} +3 -3
- package/dist/chunks/{palette-V2OJ6BIE.js → palette-GXE6GZA5.js} +4 -4
- package/dist/chunks/perl-G647IKFY.js +495 -0
- package/dist/chunks/perl-G647IKFY.js.map +6 -0
- package/dist/chunks/php-KMB36QTV.js +611 -0
- package/dist/chunks/php-KMB36QTV.js.map +6 -0
- package/dist/chunks/php-template-56RLSWZJ.js +56 -0
- package/dist/chunks/php-template-56RLSWZJ.js.map +6 -0
- package/dist/chunks/powershell-CPSUXW3K.js +266 -0
- package/dist/chunks/powershell-CPSUXW3K.js.map +6 -0
- package/dist/chunks/python-OSTRJJHH.js +425 -0
- package/dist/chunks/python-OSTRJJHH.js.map +6 -0
- package/dist/chunks/python-repl-LLFK2MIA.js +35 -0
- package/dist/chunks/python-repl-LLFK2MIA.js.map +6 -0
- package/dist/chunks/r-CJCHZ5CO.js +220 -0
- package/dist/chunks/r-CJCHZ5CO.js.map +6 -0
- package/dist/chunks/ruby-CFOXHYOD.js +423 -0
- package/dist/chunks/ruby-CFOXHYOD.js.map +6 -0
- package/dist/chunks/rust-2CAQW5OE.js +323 -0
- package/dist/chunks/rust-2CAQW5OE.js.map +6 -0
- package/dist/chunks/{schedule-CKRLCLZE.js → schedule-BLLPDUT7.js} +5 -5
- package/dist/chunks/scss-BWFJU4ST.js +932 -0
- package/dist/chunks/scss-BWFJU4ST.js.map +6 -0
- package/dist/chunks/{service-X3J6SDE6.js → service-E2JXIOD6.js} +10 -10
- package/dist/chunks/shell-DRNHCIHJ.js +34 -0
- package/dist/chunks/shell-DRNHCIHJ.js.map +6 -0
- package/dist/chunks/sql-QPNQXTYW.js +655 -0
- package/dist/chunks/sql-QPNQXTYW.js.map +6 -0
- package/dist/chunks/{start-check-U4TZS2VO.js → start-check-NHTTM354.js} +2 -2
- package/dist/chunks/swift-VA7FJ27U.js +890 -0
- package/dist/chunks/swift-VA7FJ27U.js.map +6 -0
- package/dist/chunks/{tui-C2YPD5ZD.js → tui-MYBPZUMK.js} +57 -681
- package/dist/chunks/tui-MYBPZUMK.js.map +6 -0
- package/dist/chunks/typescript-AD6TOU6X.js +826 -0
- package/dist/chunks/typescript-AD6TOU6X.js.map +6 -0
- package/dist/chunks/{upgrade-7AKSY32I.js → upgrade-LG2D66IY.js} +3 -3
- package/dist/chunks/vbnet-RRNEF3GL.js +143 -0
- package/dist/chunks/vbnet-RRNEF3GL.js.map +6 -0
- package/dist/chunks/wasm-4AFLPXP5.js +131 -0
- package/dist/chunks/wasm-4AFLPXP5.js.map +6 -0
- package/dist/chunks/{watch-X7HL77BT.js → watch-E5G5E7SZ.js} +77 -41
- package/dist/chunks/watch-E5G5E7SZ.js.map +6 -0
- package/dist/chunks/{workspaces-4BNGHUKR.js → workspaces-XNXMVP5C.js} +5 -5
- package/dist/chunks/xml-FZC4FVGO.js +236 -0
- package/dist/chunks/xml-FZC4FVGO.js.map +6 -0
- package/dist/chunks/yaml-KHJI72O5.js +211 -0
- package/dist/chunks/yaml-KHJI72O5.js.map +6 -0
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/config/load.d.ts +1 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/schema.d.ts +27 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/settings-descriptors.d.ts.map +1 -1
- package/dist/index.js +22 -22
- package/dist/integrations/sessions/watch-view.d.ts +10 -1
- package/dist/integrations/sessions/watch-view.d.ts.map +1 -1
- package/dist/tui/App.d.ts +4 -0
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/BackgroundAgentRows.d.ts.map +1 -1
- package/dist/tui/Markdown.d.ts +13 -3
- package/dist/tui/Markdown.d.ts.map +1 -1
- package/dist/tui/Transcript.d.ts +10 -0
- package/dist/tui/Transcript.d.ts.map +1 -1
- package/dist/tui/TranscriptScrollView.d.ts.map +1 -1
- package/dist/tui/agent-calls.d.ts +49 -0
- package/dist/tui/agent-calls.d.ts.map +1 -0
- package/dist/tui/agent-transcript-rows.d.ts +17 -0
- package/dist/tui/agent-transcript-rows.d.ts.map +1 -1
- package/dist/tui/background-agents.d.ts +22 -2
- package/dist/tui/background-agents.d.ts.map +1 -1
- package/dist/tui/code-highlight.d.ts +222 -0
- package/dist/tui/code-highlight.d.ts.map +1 -0
- package/dist/tui/copy-targets.d.ts.map +1 -1
- package/dist/tui/fullscreen/FullscreenTranscript.d.ts +13 -1
- package/dist/tui/fullscreen/FullscreenTranscript.d.ts.map +1 -1
- package/dist/tui/fullscreen/glide.d.ts +87 -0
- package/dist/tui/fullscreen/glide.d.ts.map +1 -0
- package/dist/tui/fullscreen/layout.d.ts +10 -1
- package/dist/tui/fullscreen/layout.d.ts.map +1 -1
- package/dist/tui/fullscreen/markdown-rows.d.ts.map +1 -1
- package/dist/tui/fullscreen/rows.d.ts +6 -0
- package/dist/tui/fullscreen/rows.d.ts.map +1 -1
- package/dist/tui/fullscreen/selection.d.ts.map +1 -1
- package/dist/tui/fullscreen/viewport.d.ts +4 -1
- package/dist/tui/fullscreen/viewport.d.ts.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/markdown-fence.d.ts +47 -0
- package/dist/tui/markdown-fence.d.ts.map +1 -0
- package/dist/tui/markdown-structure.d.ts +22 -0
- package/dist/tui/markdown-structure.d.ts.map +1 -1
- package/dist/tui/markdownParser.d.ts +8 -1
- package/dist/tui/markdownParser.d.ts.map +1 -1
- package/dist/tui/new-output.d.ts +60 -0
- package/dist/tui/new-output.d.ts.map +1 -0
- package/dist/tui/paint/live-paint.d.ts +39 -0
- package/dist/tui/paint/live-paint.d.ts.map +1 -1
- package/dist/tui/read-search-group.d.ts +24 -0
- package/dist/tui/read-search-group.d.ts.map +1 -1
- package/dist/tui/restored-rows.d.ts +26 -2
- package/dist/tui/restored-rows.d.ts.map +1 -1
- package/dist/tui/stream-flow.d.ts +24 -0
- package/dist/tui/stream-flow.d.ts.map +1 -1
- package/dist/tui/theme-launch.d.ts +2 -2
- package/dist/tui/theme-launch.d.ts.map +1 -1
- package/dist/tui/theme-palettes.d.ts +20 -0
- package/dist/tui/theme-palettes.d.ts.map +1 -1
- package/dist/tui/theme.d.ts +5 -0
- package/dist/tui/theme.d.ts.map +1 -1
- package/dist/tui/transcript-scroll.d.ts +7 -2
- package/dist/tui/transcript-scroll.d.ts.map +1 -1
- package/dist/tui/types.d.ts +9 -0
- package/dist/tui/types.d.ts.map +1 -1
- package/package.json +5 -4
- package/dist/chunks/chunk-EJCQKJZ2.js.map +0 -6
- package/dist/chunks/chunk-SFAK4Z6T.js.map +0 -6
- package/dist/chunks/tui-C2YPD5ZD.js.map +0 -6
- package/dist/chunks/watch-X7HL77BT.js.map +0 -6
- /package/dist/chunks/{add-VOR5M5BV.js.map → add-L6FKDP7N.js.map} +0 -0
- /package/dist/chunks/{agent-EWZGPBGI.js.map → agent-VJRVABX2.js.map} +0 -0
- /package/dist/chunks/{agent-session-EKTTB7TN.js.map → agent-session-JO5HEUHN.js.map} +0 -0
- /package/dist/chunks/{apply-at-exit-FVOHKVHQ.js.map → apply-at-exit-OGSLNQHX.js.map} +0 -0
- /package/dist/chunks/{bin-main-C5UNGSAQ.js.map → bin-main-XIAVK2BK.js.map} +0 -0
- /package/dist/chunks/{chat-YQCC2O5F.js.map → chat-AQICSI4M.js.map} +0 -0
- /package/dist/chunks/{chunk-F7LMCISP.js.map → chunk-33CQRXME.js.map} +0 -0
- /package/dist/chunks/{chunk-H6KPEFAR.js.map → chunk-47E6HKJT.js.map} +0 -0
- /package/dist/chunks/{chunk-6KB5XGKP.js.map → chunk-4XZ67B3M.js.map} +0 -0
- /package/dist/chunks/{chunk-FWAUXNV2.js.map → chunk-625CBBTB.js.map} +0 -0
- /package/dist/chunks/{chunk-W7JMWUGD.js.map → chunk-A54YZM6S.js.map} +0 -0
- /package/dist/chunks/{chunk-WK6RNDIK.js.map → chunk-BCPKC2WP.js.map} +0 -0
- /package/dist/chunks/{chunk-YIBJO76L.js.map → chunk-DMUQFCYZ.js.map} +0 -0
- /package/dist/chunks/{chunk-ZNYLVJIS.js.map → chunk-FTVJAKCW.js.map} +0 -0
- /package/dist/chunks/{chunk-WNVU6MMP.js.map → chunk-IZJ5JESH.js.map} +0 -0
- /package/dist/chunks/{chunk-JWS3NQAH.js.map → chunk-JCIHE3LO.js.map} +0 -0
- /package/dist/chunks/{chunk-Y2DDE2WB.js.map → chunk-NRFNUYVH.js.map} +0 -0
- /package/dist/chunks/{chunk-IBTPIZKL.js.map → chunk-PRTQ2L3O.js.map} +0 -0
- /package/dist/chunks/{chunk-MVMWAXEY.js.map → chunk-PVHTDN4J.js.map} +0 -0
- /package/dist/chunks/{chunk-2ZYV3IZA.js.map → chunk-R3BEW6BX.js.map} +0 -0
- /package/dist/chunks/{chunk-QZODMCBW.js.map → chunk-RX22HLIT.js.map} +0 -0
- /package/dist/chunks/{chunk-N3LPO5PK.js.map → chunk-TITSLPYI.js.map} +0 -0
- /package/dist/chunks/{chunk-F7MCS63F.js.map → chunk-UF6F2Z62.js.map} +0 -0
- /package/dist/chunks/{chunk-4SEHD4ZI.js.map → chunk-USDNK4TL.js.map} +0 -0
- /package/dist/chunks/{chunk-TEBW5NV3.js.map → chunk-WSEJK4WO.js.map} +0 -0
- /package/dist/chunks/{chunk-GFEHVD2U.js.map → chunk-WZHS724Y.js.map} +0 -0
- /package/dist/chunks/{chunk-JBC4TK56.js.map → chunk-YMMEAXUK.js.map} +0 -0
- /package/dist/chunks/{chunk-47R3EA5L.js.map → chunk-ZDEQIXJX.js.map} +0 -0
- /package/dist/chunks/{chunk-OIYJMKAT.js.map → chunk-ZIFCQKET.js.map} +0 -0
- /package/dist/chunks/{cli-runtime-SWBSTK5Y.js.map → cli-runtime-J5E5XM6I.js.map} +0 -0
- /package/dist/chunks/{doctor-BO6742WI.js.map → doctor-TC5F3XFP.js.map} +0 -0
- /package/dist/chunks/{drain-R55GDZ6K.js.map → drain-VINUZDH4.js.map} +0 -0
- /package/dist/chunks/{entry-OIRUHLN6.js.map → entry-UEPUPWGI.js.map} +0 -0
- /package/dist/chunks/{eval-LC2YEQE4.js.map → eval-YTQCMDNP.js.map} +0 -0
- /package/dist/chunks/{exec-MVNCTFY2.js.map → exec-DGX427HX.js.map} +0 -0
- /package/dist/chunks/{host-OJRB5UR4.js.map → host-KTD5OE67.js.map} +0 -0
- /package/dist/chunks/{host-queries-BTUGRPDQ.js.map → host-queries-JPW6LDTA.js.map} +0 -0
- /package/dist/chunks/{learn-L7W4AY6F.js.map → learn-VUJQOB57.js.map} +0 -0
- /package/dist/chunks/{learn-builtin-F6D7VG2T.js.map → learn-builtin-POKSGCNI.js.map} +0 -0
- /package/dist/chunks/{lifecycle-VH5JVETC.js.map → lifecycle-7BOLGSXR.js.map} +0 -0
- /package/dist/chunks/{list-O6NVVBVF.js.map → list-QTYDGVQY.js.map} +0 -0
- /package/dist/chunks/{live-VMIC5YSV.js.map → live-WTDKDIAG.js.map} +0 -0
- /package/dist/chunks/{mcp-SUQ5VHS3.js.map → mcp-6QVO6CF6.js.map} +0 -0
- /package/dist/chunks/{message-command-D72XMTER.js.map → message-command-LZDQXRHW.js.map} +0 -0
- /package/dist/chunks/{pal-IMTWZXWM.js.map → pal-EHDMM5XR.js.map} +0 -0
- /package/dist/chunks/{palette-V2OJ6BIE.js.map → palette-GXE6GZA5.js.map} +0 -0
- /package/dist/chunks/{schedule-CKRLCLZE.js.map → schedule-BLLPDUT7.js.map} +0 -0
- /package/dist/chunks/{service-X3J6SDE6.js.map → service-E2JXIOD6.js.map} +0 -0
- /package/dist/chunks/{start-check-U4TZS2VO.js.map → start-check-NHTTM354.js.map} +0 -0
- /package/dist/chunks/{upgrade-7AKSY32I.js.map → upgrade-LG2D66IY.js.map} +0 -0
- /package/dist/chunks/{workspaces-4BNGHUKR.js.map → workspaces-XNXMVP5C.js.map} +0 -0
|
@@ -0,0 +1,1647 @@
|
|
|
1
|
+
import { createRequire as __namzuCreateRequire } from 'node:module';
|
|
2
|
+
const require = __namzuCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
__commonJS,
|
|
5
|
+
__name,
|
|
6
|
+
__toESM
|
|
7
|
+
} from "./chunk-76FLAFCG.js";
|
|
8
|
+
|
|
9
|
+
// ../../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/core.js
|
|
10
|
+
var require_core = __commonJS({
|
|
11
|
+
"../../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/core.js"(exports, module) {
|
|
12
|
+
"use strict";
|
|
13
|
+
function deepFreeze(obj) {
|
|
14
|
+
if (obj instanceof Map) {
|
|
15
|
+
obj.clear = obj.delete = obj.set = function() {
|
|
16
|
+
throw new Error("map is read-only");
|
|
17
|
+
};
|
|
18
|
+
} else if (obj instanceof Set) {
|
|
19
|
+
obj.add = obj.clear = obj.delete = function() {
|
|
20
|
+
throw new Error("set is read-only");
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
Object.freeze(obj);
|
|
24
|
+
Object.getOwnPropertyNames(obj).forEach((name) => {
|
|
25
|
+
const prop = obj[name];
|
|
26
|
+
const type = typeof prop;
|
|
27
|
+
if ((type === "object" || type === "function") && !Object.isFrozen(prop)) {
|
|
28
|
+
deepFreeze(prop);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return obj;
|
|
32
|
+
}
|
|
33
|
+
__name(deepFreeze, "deepFreeze");
|
|
34
|
+
var Response = class {
|
|
35
|
+
static {
|
|
36
|
+
__name(this, "Response");
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @param {CompiledMode} mode
|
|
40
|
+
*/
|
|
41
|
+
constructor(mode) {
|
|
42
|
+
if (mode.data === void 0) mode.data = {};
|
|
43
|
+
this.data = mode.data;
|
|
44
|
+
this.isMatchIgnored = false;
|
|
45
|
+
}
|
|
46
|
+
ignoreMatch() {
|
|
47
|
+
this.isMatchIgnored = true;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
function escapeHTML(value) {
|
|
51
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
52
|
+
}
|
|
53
|
+
__name(escapeHTML, "escapeHTML");
|
|
54
|
+
function inherit$1(original, ...objects) {
|
|
55
|
+
const result = /* @__PURE__ */ Object.create(null);
|
|
56
|
+
for (const key in original) {
|
|
57
|
+
result[key] = original[key];
|
|
58
|
+
}
|
|
59
|
+
objects.forEach(function(obj) {
|
|
60
|
+
for (const key in obj) {
|
|
61
|
+
result[key] = obj[key];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return (
|
|
65
|
+
/** @type {T} */
|
|
66
|
+
result
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
__name(inherit$1, "inherit$1");
|
|
70
|
+
var SPAN_CLOSE = "</span>";
|
|
71
|
+
var emitsWrappingTags = /* @__PURE__ */ __name((node) => {
|
|
72
|
+
return !!node.scope;
|
|
73
|
+
}, "emitsWrappingTags");
|
|
74
|
+
var scopeToCSSClass = /* @__PURE__ */ __name((name, { prefix }) => {
|
|
75
|
+
if (name.startsWith("language:")) {
|
|
76
|
+
return name.replace("language:", "language-");
|
|
77
|
+
}
|
|
78
|
+
if (name.includes(".")) {
|
|
79
|
+
const pieces = name.split(".");
|
|
80
|
+
return [
|
|
81
|
+
`${prefix}${pieces.shift()}`,
|
|
82
|
+
...pieces.map((x, i) => `${x}${"_".repeat(i + 1)}`)
|
|
83
|
+
].join(" ");
|
|
84
|
+
}
|
|
85
|
+
return `${prefix}${name}`;
|
|
86
|
+
}, "scopeToCSSClass");
|
|
87
|
+
var HTMLRenderer = class {
|
|
88
|
+
static {
|
|
89
|
+
__name(this, "HTMLRenderer");
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Creates a new HTMLRenderer
|
|
93
|
+
*
|
|
94
|
+
* @param {Tree} parseTree - the parse tree (must support `walk` API)
|
|
95
|
+
* @param {{classPrefix: string}} options
|
|
96
|
+
*/
|
|
97
|
+
constructor(parseTree, options) {
|
|
98
|
+
this.buffer = "";
|
|
99
|
+
this.classPrefix = options.classPrefix;
|
|
100
|
+
parseTree.walk(this);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Adds texts to the output stream
|
|
104
|
+
*
|
|
105
|
+
* @param {string} text */
|
|
106
|
+
addText(text) {
|
|
107
|
+
this.buffer += escapeHTML(text);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Adds a node open to the output stream (if needed)
|
|
111
|
+
*
|
|
112
|
+
* @param {Node} node */
|
|
113
|
+
openNode(node) {
|
|
114
|
+
if (!emitsWrappingTags(node)) return;
|
|
115
|
+
const className = scopeToCSSClass(
|
|
116
|
+
node.scope,
|
|
117
|
+
{ prefix: this.classPrefix }
|
|
118
|
+
);
|
|
119
|
+
this.span(className);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Adds a node close to the output stream (if needed)
|
|
123
|
+
*
|
|
124
|
+
* @param {Node} node */
|
|
125
|
+
closeNode(node) {
|
|
126
|
+
if (!emitsWrappingTags(node)) return;
|
|
127
|
+
this.buffer += SPAN_CLOSE;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* returns the accumulated buffer
|
|
131
|
+
*/
|
|
132
|
+
value() {
|
|
133
|
+
return this.buffer;
|
|
134
|
+
}
|
|
135
|
+
// helpers
|
|
136
|
+
/**
|
|
137
|
+
* Builds a span element
|
|
138
|
+
*
|
|
139
|
+
* @param {string} className */
|
|
140
|
+
span(className) {
|
|
141
|
+
this.buffer += `<span class="${className}">`;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
var newNode = /* @__PURE__ */ __name((opts = {}) => {
|
|
145
|
+
const result = { children: [] };
|
|
146
|
+
Object.assign(result, opts);
|
|
147
|
+
return result;
|
|
148
|
+
}, "newNode");
|
|
149
|
+
var TokenTree = class _TokenTree {
|
|
150
|
+
static {
|
|
151
|
+
__name(this, "TokenTree");
|
|
152
|
+
}
|
|
153
|
+
constructor() {
|
|
154
|
+
this.rootNode = newNode();
|
|
155
|
+
this.stack = [this.rootNode];
|
|
156
|
+
}
|
|
157
|
+
get top() {
|
|
158
|
+
return this.stack[this.stack.length - 1];
|
|
159
|
+
}
|
|
160
|
+
get root() {
|
|
161
|
+
return this.rootNode;
|
|
162
|
+
}
|
|
163
|
+
/** @param {Node} node */
|
|
164
|
+
add(node) {
|
|
165
|
+
this.top.children.push(node);
|
|
166
|
+
}
|
|
167
|
+
/** @param {string} scope */
|
|
168
|
+
openNode(scope) {
|
|
169
|
+
const node = newNode({ scope });
|
|
170
|
+
this.add(node);
|
|
171
|
+
this.stack.push(node);
|
|
172
|
+
}
|
|
173
|
+
closeNode() {
|
|
174
|
+
if (this.stack.length > 1) {
|
|
175
|
+
return this.stack.pop();
|
|
176
|
+
}
|
|
177
|
+
return void 0;
|
|
178
|
+
}
|
|
179
|
+
closeAllNodes() {
|
|
180
|
+
while (this.closeNode()) ;
|
|
181
|
+
}
|
|
182
|
+
toJSON() {
|
|
183
|
+
return JSON.stringify(this.rootNode, null, 4);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* @typedef { import("./html_renderer").Renderer } Renderer
|
|
187
|
+
* @param {Renderer} builder
|
|
188
|
+
*/
|
|
189
|
+
walk(builder) {
|
|
190
|
+
return this.constructor._walk(builder, this.rootNode);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* @param {Renderer} builder
|
|
194
|
+
* @param {Node} node
|
|
195
|
+
*/
|
|
196
|
+
static _walk(builder, node) {
|
|
197
|
+
if (typeof node === "string") {
|
|
198
|
+
builder.addText(node);
|
|
199
|
+
} else if (node.children) {
|
|
200
|
+
builder.openNode(node);
|
|
201
|
+
node.children.forEach((child) => this._walk(builder, child));
|
|
202
|
+
builder.closeNode(node);
|
|
203
|
+
}
|
|
204
|
+
return builder;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* @param {Node} node
|
|
208
|
+
*/
|
|
209
|
+
static _collapse(node) {
|
|
210
|
+
if (typeof node === "string") return;
|
|
211
|
+
if (!node.children) return;
|
|
212
|
+
if (node.children.every((el) => typeof el === "string")) {
|
|
213
|
+
node.children = [node.children.join("")];
|
|
214
|
+
} else {
|
|
215
|
+
node.children.forEach((child) => {
|
|
216
|
+
_TokenTree._collapse(child);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
var TokenTreeEmitter = class extends TokenTree {
|
|
222
|
+
static {
|
|
223
|
+
__name(this, "TokenTreeEmitter");
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* @param {*} options
|
|
227
|
+
*/
|
|
228
|
+
constructor(options) {
|
|
229
|
+
super();
|
|
230
|
+
this.options = options;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* @param {string} text
|
|
234
|
+
*/
|
|
235
|
+
addText(text) {
|
|
236
|
+
if (text === "") {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
this.add(text);
|
|
240
|
+
}
|
|
241
|
+
/** @param {string} scope */
|
|
242
|
+
startScope(scope) {
|
|
243
|
+
this.openNode(scope);
|
|
244
|
+
}
|
|
245
|
+
endScope() {
|
|
246
|
+
this.closeNode();
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* @param {Emitter & {root: DataNode}} emitter
|
|
250
|
+
* @param {string} name
|
|
251
|
+
*/
|
|
252
|
+
__addSublanguage(emitter, name) {
|
|
253
|
+
const node = emitter.root;
|
|
254
|
+
if (name) node.scope = `language:${name}`;
|
|
255
|
+
this.add(node);
|
|
256
|
+
}
|
|
257
|
+
toHTML() {
|
|
258
|
+
const renderer = new HTMLRenderer(this, this.options);
|
|
259
|
+
return renderer.value();
|
|
260
|
+
}
|
|
261
|
+
finalize() {
|
|
262
|
+
this.closeAllNodes();
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
function source(re) {
|
|
267
|
+
if (!re) return null;
|
|
268
|
+
if (typeof re === "string") return re;
|
|
269
|
+
return re.source;
|
|
270
|
+
}
|
|
271
|
+
__name(source, "source");
|
|
272
|
+
function lookahead(re) {
|
|
273
|
+
return concat("(?=", re, ")");
|
|
274
|
+
}
|
|
275
|
+
__name(lookahead, "lookahead");
|
|
276
|
+
function anyNumberOfTimes(re) {
|
|
277
|
+
return concat("(?:", re, ")*");
|
|
278
|
+
}
|
|
279
|
+
__name(anyNumberOfTimes, "anyNumberOfTimes");
|
|
280
|
+
function optional(re) {
|
|
281
|
+
return concat("(?:", re, ")?");
|
|
282
|
+
}
|
|
283
|
+
__name(optional, "optional");
|
|
284
|
+
function concat(...args) {
|
|
285
|
+
const joined = args.map((x) => source(x)).join("");
|
|
286
|
+
return joined;
|
|
287
|
+
}
|
|
288
|
+
__name(concat, "concat");
|
|
289
|
+
function stripOptionsFromArgs(args) {
|
|
290
|
+
const opts = args[args.length - 1];
|
|
291
|
+
if (typeof opts === "object" && opts.constructor === Object) {
|
|
292
|
+
args.splice(args.length - 1, 1);
|
|
293
|
+
return opts;
|
|
294
|
+
} else {
|
|
295
|
+
return {};
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
__name(stripOptionsFromArgs, "stripOptionsFromArgs");
|
|
299
|
+
function either(...args) {
|
|
300
|
+
const opts = stripOptionsFromArgs(args);
|
|
301
|
+
const joined = "(" + (opts.capture ? "" : "?:") + args.map((x) => source(x)).join("|") + ")";
|
|
302
|
+
return joined;
|
|
303
|
+
}
|
|
304
|
+
__name(either, "either");
|
|
305
|
+
function countMatchGroups(re) {
|
|
306
|
+
return new RegExp(re.toString() + "|").exec("").length - 1;
|
|
307
|
+
}
|
|
308
|
+
__name(countMatchGroups, "countMatchGroups");
|
|
309
|
+
function startsWith(re, lexeme) {
|
|
310
|
+
const match = re && re.exec(lexeme);
|
|
311
|
+
return match && match.index === 0;
|
|
312
|
+
}
|
|
313
|
+
__name(startsWith, "startsWith");
|
|
314
|
+
var BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
|
|
315
|
+
function _rewriteBackreferences(regexps, { joinWith }) {
|
|
316
|
+
let numCaptures = 0;
|
|
317
|
+
return regexps.map((regex) => {
|
|
318
|
+
numCaptures += 1;
|
|
319
|
+
const offset = numCaptures;
|
|
320
|
+
let re = source(regex);
|
|
321
|
+
let out = "";
|
|
322
|
+
while (re.length > 0) {
|
|
323
|
+
const match = BACKREF_RE.exec(re);
|
|
324
|
+
if (!match) {
|
|
325
|
+
out += re;
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
out += re.substring(0, match.index);
|
|
329
|
+
re = re.substring(match.index + match[0].length);
|
|
330
|
+
if (match[0][0] === "\\" && match[1]) {
|
|
331
|
+
out += "\\" + String(Number(match[1]) + offset);
|
|
332
|
+
} else {
|
|
333
|
+
out += match[0];
|
|
334
|
+
if (match[0] === "(") {
|
|
335
|
+
numCaptures++;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return out;
|
|
340
|
+
}).map((re) => `(${re})`).join(joinWith);
|
|
341
|
+
}
|
|
342
|
+
__name(_rewriteBackreferences, "_rewriteBackreferences");
|
|
343
|
+
var MATCH_NOTHING_RE = /\b\B/;
|
|
344
|
+
var IDENT_RE = "[a-zA-Z]\\w*";
|
|
345
|
+
var UNDERSCORE_IDENT_RE = "[a-zA-Z_]\\w*";
|
|
346
|
+
var NUMBER_RE = "\\b\\d+(\\.\\d+)?";
|
|
347
|
+
var C_NUMBER_RE = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";
|
|
348
|
+
var BINARY_NUMBER_RE = "\\b(0b[01]+)";
|
|
349
|
+
var RE_STARTERS_RE = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";
|
|
350
|
+
var SHEBANG = /* @__PURE__ */ __name((opts = {}) => {
|
|
351
|
+
const beginShebang = /^#![ ]*\//;
|
|
352
|
+
if (opts.binary) {
|
|
353
|
+
opts.begin = concat(
|
|
354
|
+
beginShebang,
|
|
355
|
+
/.*\b/,
|
|
356
|
+
opts.binary,
|
|
357
|
+
/\b.*/
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
return inherit$1({
|
|
361
|
+
scope: "meta",
|
|
362
|
+
begin: beginShebang,
|
|
363
|
+
end: /$/,
|
|
364
|
+
relevance: 0,
|
|
365
|
+
/** @type {ModeCallback} */
|
|
366
|
+
"on:begin": /* @__PURE__ */ __name((m, resp) => {
|
|
367
|
+
if (m.index !== 0) resp.ignoreMatch();
|
|
368
|
+
}, "on:begin")
|
|
369
|
+
}, opts);
|
|
370
|
+
}, "SHEBANG");
|
|
371
|
+
var BACKSLASH_ESCAPE = {
|
|
372
|
+
begin: "\\\\[\\s\\S]",
|
|
373
|
+
relevance: 0
|
|
374
|
+
};
|
|
375
|
+
var APOS_STRING_MODE = {
|
|
376
|
+
scope: "string",
|
|
377
|
+
begin: "'",
|
|
378
|
+
end: "'",
|
|
379
|
+
illegal: "\\n",
|
|
380
|
+
contains: [BACKSLASH_ESCAPE]
|
|
381
|
+
};
|
|
382
|
+
var QUOTE_STRING_MODE = {
|
|
383
|
+
scope: "string",
|
|
384
|
+
begin: '"',
|
|
385
|
+
end: '"',
|
|
386
|
+
illegal: "\\n",
|
|
387
|
+
contains: [BACKSLASH_ESCAPE]
|
|
388
|
+
};
|
|
389
|
+
var PHRASAL_WORDS_MODE = {
|
|
390
|
+
begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
|
|
391
|
+
};
|
|
392
|
+
var COMMENT = /* @__PURE__ */ __name(function(begin, end, modeOptions = {}) {
|
|
393
|
+
const mode = inherit$1(
|
|
394
|
+
{
|
|
395
|
+
scope: "comment",
|
|
396
|
+
begin,
|
|
397
|
+
end,
|
|
398
|
+
contains: []
|
|
399
|
+
},
|
|
400
|
+
modeOptions
|
|
401
|
+
);
|
|
402
|
+
mode.contains.push({
|
|
403
|
+
scope: "doctag",
|
|
404
|
+
// hack to avoid the space from being included. the space is necessary to
|
|
405
|
+
// match here to prevent the plain text rule below from gobbling up doctags
|
|
406
|
+
begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
|
|
407
|
+
end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,
|
|
408
|
+
excludeBegin: true,
|
|
409
|
+
relevance: 0
|
|
410
|
+
});
|
|
411
|
+
const ENGLISH_WORD = either(
|
|
412
|
+
// list of common 1 and 2 letter words in English
|
|
413
|
+
"I",
|
|
414
|
+
"a",
|
|
415
|
+
"is",
|
|
416
|
+
"so",
|
|
417
|
+
"us",
|
|
418
|
+
"to",
|
|
419
|
+
"at",
|
|
420
|
+
"if",
|
|
421
|
+
"in",
|
|
422
|
+
"it",
|
|
423
|
+
"on",
|
|
424
|
+
// note: this is not an exhaustive list of contractions, just popular ones
|
|
425
|
+
/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,
|
|
426
|
+
// contractions - can't we'd they're let's, etc
|
|
427
|
+
/[A-Za-z]+[-][a-z]+/,
|
|
428
|
+
// `no-way`, etc.
|
|
429
|
+
/[A-Za-z][a-z]{2,}/
|
|
430
|
+
// allow capitalized words at beginning of sentences
|
|
431
|
+
);
|
|
432
|
+
mode.contains.push(
|
|
433
|
+
{
|
|
434
|
+
// TODO: how to include ", (, ) without breaking grammars that use these for
|
|
435
|
+
// comment delimiters?
|
|
436
|
+
// begin: /[ ]+([()"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()":]?([.][ ]|[ ]|\))){3}/
|
|
437
|
+
// ---
|
|
438
|
+
// this tries to find sequences of 3 english words in a row (without any
|
|
439
|
+
// "programming" type syntax) this gives us a strong signal that we've
|
|
440
|
+
// TRULY found a comment - vs perhaps scanning with the wrong language.
|
|
441
|
+
// It's possible to find something that LOOKS like the start of the
|
|
442
|
+
// comment - but then if there is no readable text - good chance it is a
|
|
443
|
+
// false match and not a comment.
|
|
444
|
+
//
|
|
445
|
+
// for a visual example please see:
|
|
446
|
+
// https://github.com/highlightjs/highlight.js/issues/2827
|
|
447
|
+
begin: concat(
|
|
448
|
+
/[ ]+/,
|
|
449
|
+
// necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
|
|
450
|
+
"(",
|
|
451
|
+
ENGLISH_WORD,
|
|
452
|
+
/[.]?[:]?([.][ ]|[ ])/,
|
|
453
|
+
"){3}"
|
|
454
|
+
)
|
|
455
|
+
// look for 3 words in a row
|
|
456
|
+
}
|
|
457
|
+
);
|
|
458
|
+
return mode;
|
|
459
|
+
}, "COMMENT");
|
|
460
|
+
var C_LINE_COMMENT_MODE = COMMENT("//", "$");
|
|
461
|
+
var C_BLOCK_COMMENT_MODE = COMMENT("/\\*", "\\*/");
|
|
462
|
+
var HASH_COMMENT_MODE = COMMENT("#", "$");
|
|
463
|
+
var NUMBER_MODE = {
|
|
464
|
+
scope: "number",
|
|
465
|
+
begin: NUMBER_RE,
|
|
466
|
+
relevance: 0
|
|
467
|
+
};
|
|
468
|
+
var C_NUMBER_MODE = {
|
|
469
|
+
scope: "number",
|
|
470
|
+
begin: C_NUMBER_RE,
|
|
471
|
+
relevance: 0
|
|
472
|
+
};
|
|
473
|
+
var BINARY_NUMBER_MODE = {
|
|
474
|
+
scope: "number",
|
|
475
|
+
begin: BINARY_NUMBER_RE,
|
|
476
|
+
relevance: 0
|
|
477
|
+
};
|
|
478
|
+
var REGEXP_MODE = {
|
|
479
|
+
scope: "regexp",
|
|
480
|
+
begin: /\/(?=[^/\n]*\/)/,
|
|
481
|
+
end: /\/[gimuy]*/,
|
|
482
|
+
contains: [
|
|
483
|
+
BACKSLASH_ESCAPE,
|
|
484
|
+
{
|
|
485
|
+
begin: /\[/,
|
|
486
|
+
end: /\]/,
|
|
487
|
+
relevance: 0,
|
|
488
|
+
contains: [BACKSLASH_ESCAPE]
|
|
489
|
+
}
|
|
490
|
+
]
|
|
491
|
+
};
|
|
492
|
+
var TITLE_MODE = {
|
|
493
|
+
scope: "title",
|
|
494
|
+
begin: IDENT_RE,
|
|
495
|
+
relevance: 0
|
|
496
|
+
};
|
|
497
|
+
var UNDERSCORE_TITLE_MODE = {
|
|
498
|
+
scope: "title",
|
|
499
|
+
begin: UNDERSCORE_IDENT_RE,
|
|
500
|
+
relevance: 0
|
|
501
|
+
};
|
|
502
|
+
var METHOD_GUARD = {
|
|
503
|
+
// excludes method names from keyword processing
|
|
504
|
+
begin: "\\.\\s*" + UNDERSCORE_IDENT_RE,
|
|
505
|
+
relevance: 0
|
|
506
|
+
};
|
|
507
|
+
var END_SAME_AS_BEGIN = /* @__PURE__ */ __name(function(mode) {
|
|
508
|
+
return Object.assign(
|
|
509
|
+
mode,
|
|
510
|
+
{
|
|
511
|
+
/** @type {ModeCallback} */
|
|
512
|
+
"on:begin": /* @__PURE__ */ __name((m, resp) => {
|
|
513
|
+
resp.data._beginMatch = m[1];
|
|
514
|
+
}, "on:begin"),
|
|
515
|
+
/** @type {ModeCallback} */
|
|
516
|
+
"on:end": /* @__PURE__ */ __name((m, resp) => {
|
|
517
|
+
if (resp.data._beginMatch !== m[1]) resp.ignoreMatch();
|
|
518
|
+
}, "on:end")
|
|
519
|
+
}
|
|
520
|
+
);
|
|
521
|
+
}, "END_SAME_AS_BEGIN");
|
|
522
|
+
var MODES = /* @__PURE__ */ Object.freeze({
|
|
523
|
+
__proto__: null,
|
|
524
|
+
APOS_STRING_MODE,
|
|
525
|
+
BACKSLASH_ESCAPE,
|
|
526
|
+
BINARY_NUMBER_MODE,
|
|
527
|
+
BINARY_NUMBER_RE,
|
|
528
|
+
COMMENT,
|
|
529
|
+
C_BLOCK_COMMENT_MODE,
|
|
530
|
+
C_LINE_COMMENT_MODE,
|
|
531
|
+
C_NUMBER_MODE,
|
|
532
|
+
C_NUMBER_RE,
|
|
533
|
+
END_SAME_AS_BEGIN,
|
|
534
|
+
HASH_COMMENT_MODE,
|
|
535
|
+
IDENT_RE,
|
|
536
|
+
MATCH_NOTHING_RE,
|
|
537
|
+
METHOD_GUARD,
|
|
538
|
+
NUMBER_MODE,
|
|
539
|
+
NUMBER_RE,
|
|
540
|
+
PHRASAL_WORDS_MODE,
|
|
541
|
+
QUOTE_STRING_MODE,
|
|
542
|
+
REGEXP_MODE,
|
|
543
|
+
RE_STARTERS_RE,
|
|
544
|
+
SHEBANG,
|
|
545
|
+
TITLE_MODE,
|
|
546
|
+
UNDERSCORE_IDENT_RE,
|
|
547
|
+
UNDERSCORE_TITLE_MODE
|
|
548
|
+
});
|
|
549
|
+
function skipIfHasPrecedingDot(match, response) {
|
|
550
|
+
const before = match.input[match.index - 1];
|
|
551
|
+
if (before === ".") {
|
|
552
|
+
response.ignoreMatch();
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
__name(skipIfHasPrecedingDot, "skipIfHasPrecedingDot");
|
|
556
|
+
function scopeClassName(mode, _parent) {
|
|
557
|
+
if (mode.className !== void 0) {
|
|
558
|
+
mode.scope = mode.className;
|
|
559
|
+
delete mode.className;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
__name(scopeClassName, "scopeClassName");
|
|
563
|
+
function beginKeywords(mode, parent) {
|
|
564
|
+
if (!parent) return;
|
|
565
|
+
if (!mode.beginKeywords) return;
|
|
566
|
+
mode.begin = "\\b(" + mode.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)";
|
|
567
|
+
mode.__beforeBegin = skipIfHasPrecedingDot;
|
|
568
|
+
mode.keywords = mode.keywords || mode.beginKeywords;
|
|
569
|
+
delete mode.beginKeywords;
|
|
570
|
+
if (mode.relevance === void 0) mode.relevance = 0;
|
|
571
|
+
}
|
|
572
|
+
__name(beginKeywords, "beginKeywords");
|
|
573
|
+
function compileIllegal(mode, _parent) {
|
|
574
|
+
if (!Array.isArray(mode.illegal)) return;
|
|
575
|
+
mode.illegal = either(...mode.illegal);
|
|
576
|
+
}
|
|
577
|
+
__name(compileIllegal, "compileIllegal");
|
|
578
|
+
function compileMatch(mode, _parent) {
|
|
579
|
+
if (!mode.match) return;
|
|
580
|
+
if (mode.begin || mode.end) throw new Error("begin & end are not supported with match");
|
|
581
|
+
mode.begin = mode.match;
|
|
582
|
+
delete mode.match;
|
|
583
|
+
}
|
|
584
|
+
__name(compileMatch, "compileMatch");
|
|
585
|
+
function compileRelevance(mode, _parent) {
|
|
586
|
+
if (mode.relevance === void 0) mode.relevance = 1;
|
|
587
|
+
}
|
|
588
|
+
__name(compileRelevance, "compileRelevance");
|
|
589
|
+
var beforeMatchExt = /* @__PURE__ */ __name((mode, parent) => {
|
|
590
|
+
if (!mode.beforeMatch) return;
|
|
591
|
+
if (mode.starts) throw new Error("beforeMatch cannot be used with starts");
|
|
592
|
+
const originalMode = Object.assign({}, mode);
|
|
593
|
+
Object.keys(mode).forEach((key) => {
|
|
594
|
+
delete mode[key];
|
|
595
|
+
});
|
|
596
|
+
mode.keywords = originalMode.keywords;
|
|
597
|
+
mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));
|
|
598
|
+
mode.starts = {
|
|
599
|
+
relevance: 0,
|
|
600
|
+
contains: [
|
|
601
|
+
Object.assign(originalMode, { endsParent: true })
|
|
602
|
+
]
|
|
603
|
+
};
|
|
604
|
+
mode.relevance = 0;
|
|
605
|
+
delete originalMode.beforeMatch;
|
|
606
|
+
}, "beforeMatchExt");
|
|
607
|
+
var COMMON_KEYWORDS = [
|
|
608
|
+
"of",
|
|
609
|
+
"and",
|
|
610
|
+
"for",
|
|
611
|
+
"in",
|
|
612
|
+
"not",
|
|
613
|
+
"or",
|
|
614
|
+
"if",
|
|
615
|
+
"then",
|
|
616
|
+
"parent",
|
|
617
|
+
// common variable name
|
|
618
|
+
"list",
|
|
619
|
+
// common variable name
|
|
620
|
+
"value"
|
|
621
|
+
// common variable name
|
|
622
|
+
];
|
|
623
|
+
var DEFAULT_KEYWORD_SCOPE = "keyword";
|
|
624
|
+
function compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {
|
|
625
|
+
const compiledKeywords = /* @__PURE__ */ Object.create(null);
|
|
626
|
+
if (typeof rawKeywords === "string") {
|
|
627
|
+
compileList(scopeName, rawKeywords.split(" "));
|
|
628
|
+
} else if (Array.isArray(rawKeywords)) {
|
|
629
|
+
compileList(scopeName, rawKeywords);
|
|
630
|
+
} else {
|
|
631
|
+
Object.keys(rawKeywords).forEach(function(scopeName2) {
|
|
632
|
+
Object.assign(
|
|
633
|
+
compiledKeywords,
|
|
634
|
+
compileKeywords(rawKeywords[scopeName2], caseInsensitive, scopeName2)
|
|
635
|
+
);
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
return compiledKeywords;
|
|
639
|
+
function compileList(scopeName2, keywordList) {
|
|
640
|
+
if (caseInsensitive) {
|
|
641
|
+
keywordList = keywordList.map((x) => x.toLowerCase());
|
|
642
|
+
}
|
|
643
|
+
keywordList.forEach(function(keyword) {
|
|
644
|
+
const pair = keyword.split("|");
|
|
645
|
+
compiledKeywords[pair[0]] = [scopeName2, scoreForKeyword(pair[0], pair[1])];
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
__name(compileList, "compileList");
|
|
649
|
+
}
|
|
650
|
+
__name(compileKeywords, "compileKeywords");
|
|
651
|
+
function scoreForKeyword(keyword, providedScore) {
|
|
652
|
+
if (providedScore) {
|
|
653
|
+
return Number(providedScore);
|
|
654
|
+
}
|
|
655
|
+
return commonKeyword(keyword) ? 0 : 1;
|
|
656
|
+
}
|
|
657
|
+
__name(scoreForKeyword, "scoreForKeyword");
|
|
658
|
+
function commonKeyword(keyword) {
|
|
659
|
+
return COMMON_KEYWORDS.includes(keyword.toLowerCase());
|
|
660
|
+
}
|
|
661
|
+
__name(commonKeyword, "commonKeyword");
|
|
662
|
+
var seenDeprecations = {};
|
|
663
|
+
var error = /* @__PURE__ */ __name((message) => {
|
|
664
|
+
console.error(message);
|
|
665
|
+
}, "error");
|
|
666
|
+
var warn = /* @__PURE__ */ __name((message, ...args) => {
|
|
667
|
+
console.log(`WARN: ${message}`, ...args);
|
|
668
|
+
}, "warn");
|
|
669
|
+
var deprecated = /* @__PURE__ */ __name((version2, message) => {
|
|
670
|
+
if (seenDeprecations[`${version2}/${message}`]) return;
|
|
671
|
+
console.log(`Deprecated as of ${version2}. ${message}`);
|
|
672
|
+
seenDeprecations[`${version2}/${message}`] = true;
|
|
673
|
+
}, "deprecated");
|
|
674
|
+
var MultiClassError = new Error();
|
|
675
|
+
function remapScopeNames(mode, regexes, { key }) {
|
|
676
|
+
let offset = 0;
|
|
677
|
+
const scopeNames = mode[key];
|
|
678
|
+
const emit = {};
|
|
679
|
+
const positions = {};
|
|
680
|
+
for (let i = 1; i <= regexes.length; i++) {
|
|
681
|
+
positions[i + offset] = scopeNames[i];
|
|
682
|
+
emit[i + offset] = true;
|
|
683
|
+
offset += countMatchGroups(regexes[i - 1]);
|
|
684
|
+
}
|
|
685
|
+
mode[key] = positions;
|
|
686
|
+
mode[key]._emit = emit;
|
|
687
|
+
mode[key]._multi = true;
|
|
688
|
+
}
|
|
689
|
+
__name(remapScopeNames, "remapScopeNames");
|
|
690
|
+
function beginMultiClass(mode) {
|
|
691
|
+
if (!Array.isArray(mode.begin)) return;
|
|
692
|
+
if (mode.skip || mode.excludeBegin || mode.returnBegin) {
|
|
693
|
+
error("skip, excludeBegin, returnBegin not compatible with beginScope: {}");
|
|
694
|
+
throw MultiClassError;
|
|
695
|
+
}
|
|
696
|
+
if (typeof mode.beginScope !== "object" || mode.beginScope === null) {
|
|
697
|
+
error("beginScope must be object");
|
|
698
|
+
throw MultiClassError;
|
|
699
|
+
}
|
|
700
|
+
remapScopeNames(mode, mode.begin, { key: "beginScope" });
|
|
701
|
+
mode.begin = _rewriteBackreferences(mode.begin, { joinWith: "" });
|
|
702
|
+
}
|
|
703
|
+
__name(beginMultiClass, "beginMultiClass");
|
|
704
|
+
function endMultiClass(mode) {
|
|
705
|
+
if (!Array.isArray(mode.end)) return;
|
|
706
|
+
if (mode.skip || mode.excludeEnd || mode.returnEnd) {
|
|
707
|
+
error("skip, excludeEnd, returnEnd not compatible with endScope: {}");
|
|
708
|
+
throw MultiClassError;
|
|
709
|
+
}
|
|
710
|
+
if (typeof mode.endScope !== "object" || mode.endScope === null) {
|
|
711
|
+
error("endScope must be object");
|
|
712
|
+
throw MultiClassError;
|
|
713
|
+
}
|
|
714
|
+
remapScopeNames(mode, mode.end, { key: "endScope" });
|
|
715
|
+
mode.end = _rewriteBackreferences(mode.end, { joinWith: "" });
|
|
716
|
+
}
|
|
717
|
+
__name(endMultiClass, "endMultiClass");
|
|
718
|
+
function scopeSugar(mode) {
|
|
719
|
+
if (mode.scope && typeof mode.scope === "object" && mode.scope !== null) {
|
|
720
|
+
mode.beginScope = mode.scope;
|
|
721
|
+
delete mode.scope;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
__name(scopeSugar, "scopeSugar");
|
|
725
|
+
function MultiClass(mode) {
|
|
726
|
+
scopeSugar(mode);
|
|
727
|
+
if (typeof mode.beginScope === "string") {
|
|
728
|
+
mode.beginScope = { _wrap: mode.beginScope };
|
|
729
|
+
}
|
|
730
|
+
if (typeof mode.endScope === "string") {
|
|
731
|
+
mode.endScope = { _wrap: mode.endScope };
|
|
732
|
+
}
|
|
733
|
+
beginMultiClass(mode);
|
|
734
|
+
endMultiClass(mode);
|
|
735
|
+
}
|
|
736
|
+
__name(MultiClass, "MultiClass");
|
|
737
|
+
function compileLanguage(language) {
|
|
738
|
+
function langRe(value, global) {
|
|
739
|
+
return new RegExp(
|
|
740
|
+
source(value),
|
|
741
|
+
"m" + (language.case_insensitive ? "i" : "") + (language.unicodeRegex ? "u" : "") + (global ? "g" : "")
|
|
742
|
+
);
|
|
743
|
+
}
|
|
744
|
+
__name(langRe, "langRe");
|
|
745
|
+
class MultiRegex {
|
|
746
|
+
static {
|
|
747
|
+
__name(this, "MultiRegex");
|
|
748
|
+
}
|
|
749
|
+
constructor() {
|
|
750
|
+
this.matchIndexes = {};
|
|
751
|
+
this.regexes = [];
|
|
752
|
+
this.matchAt = 1;
|
|
753
|
+
this.position = 0;
|
|
754
|
+
}
|
|
755
|
+
// @ts-ignore
|
|
756
|
+
addRule(re, opts) {
|
|
757
|
+
opts.position = this.position++;
|
|
758
|
+
this.matchIndexes[this.matchAt] = opts;
|
|
759
|
+
this.regexes.push([opts, re]);
|
|
760
|
+
this.matchAt += countMatchGroups(re) + 1;
|
|
761
|
+
}
|
|
762
|
+
compile() {
|
|
763
|
+
if (this.regexes.length === 0) {
|
|
764
|
+
this.exec = () => null;
|
|
765
|
+
}
|
|
766
|
+
const terminators = this.regexes.map((el) => el[1]);
|
|
767
|
+
this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: "|" }), true);
|
|
768
|
+
this.lastIndex = 0;
|
|
769
|
+
}
|
|
770
|
+
/** @param {string} s */
|
|
771
|
+
exec(s) {
|
|
772
|
+
this.matcherRe.lastIndex = this.lastIndex;
|
|
773
|
+
const match = this.matcherRe.exec(s);
|
|
774
|
+
if (!match) {
|
|
775
|
+
return null;
|
|
776
|
+
}
|
|
777
|
+
const i = match.findIndex((el, i2) => i2 > 0 && el !== void 0);
|
|
778
|
+
const matchData = this.matchIndexes[i];
|
|
779
|
+
match.splice(0, i);
|
|
780
|
+
return Object.assign(match, matchData);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
class ResumableMultiRegex {
|
|
784
|
+
static {
|
|
785
|
+
__name(this, "ResumableMultiRegex");
|
|
786
|
+
}
|
|
787
|
+
constructor() {
|
|
788
|
+
this.rules = [];
|
|
789
|
+
this.multiRegexes = [];
|
|
790
|
+
this.count = 0;
|
|
791
|
+
this.lastIndex = 0;
|
|
792
|
+
this.regexIndex = 0;
|
|
793
|
+
}
|
|
794
|
+
// @ts-ignore
|
|
795
|
+
getMatcher(index) {
|
|
796
|
+
if (this.multiRegexes[index]) return this.multiRegexes[index];
|
|
797
|
+
const matcher = new MultiRegex();
|
|
798
|
+
this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));
|
|
799
|
+
matcher.compile();
|
|
800
|
+
this.multiRegexes[index] = matcher;
|
|
801
|
+
return matcher;
|
|
802
|
+
}
|
|
803
|
+
resumingScanAtSamePosition() {
|
|
804
|
+
return this.regexIndex !== 0;
|
|
805
|
+
}
|
|
806
|
+
considerAll() {
|
|
807
|
+
this.regexIndex = 0;
|
|
808
|
+
}
|
|
809
|
+
// @ts-ignore
|
|
810
|
+
addRule(re, opts) {
|
|
811
|
+
this.rules.push([re, opts]);
|
|
812
|
+
if (opts.type === "begin") this.count++;
|
|
813
|
+
}
|
|
814
|
+
/** @param {string} s */
|
|
815
|
+
exec(s) {
|
|
816
|
+
const m = this.getMatcher(this.regexIndex);
|
|
817
|
+
m.lastIndex = this.lastIndex;
|
|
818
|
+
let result = m.exec(s);
|
|
819
|
+
if (this.resumingScanAtSamePosition()) {
|
|
820
|
+
if (result && result.index === this.lastIndex) ;
|
|
821
|
+
else {
|
|
822
|
+
const m2 = this.getMatcher(0);
|
|
823
|
+
m2.lastIndex = this.lastIndex + 1;
|
|
824
|
+
result = m2.exec(s);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
if (result) {
|
|
828
|
+
this.regexIndex += result.position + 1;
|
|
829
|
+
if (this.regexIndex === this.count) {
|
|
830
|
+
this.considerAll();
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
return result;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
function buildModeRegex(mode) {
|
|
837
|
+
const mm = new ResumableMultiRegex();
|
|
838
|
+
mode.contains.forEach((term) => mm.addRule(term.begin, { rule: term, type: "begin" }));
|
|
839
|
+
if (mode.terminatorEnd) {
|
|
840
|
+
mm.addRule(mode.terminatorEnd, { type: "end" });
|
|
841
|
+
}
|
|
842
|
+
if (mode.illegal) {
|
|
843
|
+
mm.addRule(mode.illegal, { type: "illegal" });
|
|
844
|
+
}
|
|
845
|
+
return mm;
|
|
846
|
+
}
|
|
847
|
+
__name(buildModeRegex, "buildModeRegex");
|
|
848
|
+
function compileMode(mode, parent) {
|
|
849
|
+
const cmode = (
|
|
850
|
+
/** @type CompiledMode */
|
|
851
|
+
mode
|
|
852
|
+
);
|
|
853
|
+
if (mode.isCompiled) return cmode;
|
|
854
|
+
[
|
|
855
|
+
scopeClassName,
|
|
856
|
+
// do this early so compiler extensions generally don't have to worry about
|
|
857
|
+
// the distinction between match/begin
|
|
858
|
+
compileMatch,
|
|
859
|
+
MultiClass,
|
|
860
|
+
beforeMatchExt
|
|
861
|
+
].forEach((ext) => ext(mode, parent));
|
|
862
|
+
language.compilerExtensions.forEach((ext) => ext(mode, parent));
|
|
863
|
+
mode.__beforeBegin = null;
|
|
864
|
+
[
|
|
865
|
+
beginKeywords,
|
|
866
|
+
// do this later so compiler extensions that come earlier have access to the
|
|
867
|
+
// raw array if they wanted to perhaps manipulate it, etc.
|
|
868
|
+
compileIllegal,
|
|
869
|
+
// default to 1 relevance if not specified
|
|
870
|
+
compileRelevance
|
|
871
|
+
].forEach((ext) => ext(mode, parent));
|
|
872
|
+
mode.isCompiled = true;
|
|
873
|
+
let keywordPattern = null;
|
|
874
|
+
if (typeof mode.keywords === "object" && mode.keywords.$pattern) {
|
|
875
|
+
mode.keywords = Object.assign({}, mode.keywords);
|
|
876
|
+
keywordPattern = mode.keywords.$pattern;
|
|
877
|
+
delete mode.keywords.$pattern;
|
|
878
|
+
}
|
|
879
|
+
keywordPattern = keywordPattern || /\w+/;
|
|
880
|
+
if (mode.keywords) {
|
|
881
|
+
mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);
|
|
882
|
+
}
|
|
883
|
+
cmode.keywordPatternRe = langRe(keywordPattern, true);
|
|
884
|
+
if (parent) {
|
|
885
|
+
if (!mode.begin) mode.begin = /\B|\b/;
|
|
886
|
+
cmode.beginRe = langRe(cmode.begin);
|
|
887
|
+
if (!mode.end && !mode.endsWithParent) mode.end = /\B|\b/;
|
|
888
|
+
if (mode.end) cmode.endRe = langRe(cmode.end);
|
|
889
|
+
cmode.terminatorEnd = source(cmode.end) || "";
|
|
890
|
+
if (mode.endsWithParent && parent.terminatorEnd) {
|
|
891
|
+
cmode.terminatorEnd += (mode.end ? "|" : "") + parent.terminatorEnd;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
if (mode.illegal) cmode.illegalRe = langRe(
|
|
895
|
+
/** @type {RegExp | string} */
|
|
896
|
+
mode.illegal
|
|
897
|
+
);
|
|
898
|
+
if (!mode.contains) mode.contains = [];
|
|
899
|
+
mode.contains = [].concat(...mode.contains.map(function(c) {
|
|
900
|
+
return expandOrCloneMode(c === "self" ? mode : c);
|
|
901
|
+
}));
|
|
902
|
+
mode.contains.forEach(function(c) {
|
|
903
|
+
compileMode(
|
|
904
|
+
/** @type Mode */
|
|
905
|
+
c,
|
|
906
|
+
cmode
|
|
907
|
+
);
|
|
908
|
+
});
|
|
909
|
+
if (mode.starts) {
|
|
910
|
+
compileMode(mode.starts, parent);
|
|
911
|
+
}
|
|
912
|
+
cmode.matcher = buildModeRegex(cmode);
|
|
913
|
+
return cmode;
|
|
914
|
+
}
|
|
915
|
+
__name(compileMode, "compileMode");
|
|
916
|
+
if (!language.compilerExtensions) language.compilerExtensions = [];
|
|
917
|
+
if (language.contains && language.contains.includes("self")) {
|
|
918
|
+
throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
|
|
919
|
+
}
|
|
920
|
+
language.classNameAliases = inherit$1(language.classNameAliases || {});
|
|
921
|
+
return compileMode(
|
|
922
|
+
/** @type Mode */
|
|
923
|
+
language
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
__name(compileLanguage, "compileLanguage");
|
|
927
|
+
function dependencyOnParent(mode) {
|
|
928
|
+
if (!mode) return false;
|
|
929
|
+
return mode.endsWithParent || dependencyOnParent(mode.starts);
|
|
930
|
+
}
|
|
931
|
+
__name(dependencyOnParent, "dependencyOnParent");
|
|
932
|
+
function expandOrCloneMode(mode) {
|
|
933
|
+
if (mode.variants && !mode.cachedVariants) {
|
|
934
|
+
mode.cachedVariants = mode.variants.map(function(variant) {
|
|
935
|
+
return inherit$1(mode, { variants: null }, variant);
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
if (mode.cachedVariants) {
|
|
939
|
+
return mode.cachedVariants;
|
|
940
|
+
}
|
|
941
|
+
if (dependencyOnParent(mode)) {
|
|
942
|
+
return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });
|
|
943
|
+
}
|
|
944
|
+
if (Object.isFrozen(mode)) {
|
|
945
|
+
return inherit$1(mode);
|
|
946
|
+
}
|
|
947
|
+
return mode;
|
|
948
|
+
}
|
|
949
|
+
__name(expandOrCloneMode, "expandOrCloneMode");
|
|
950
|
+
var version = "11.11.1";
|
|
951
|
+
var HTMLInjectionError = class extends Error {
|
|
952
|
+
static {
|
|
953
|
+
__name(this, "HTMLInjectionError");
|
|
954
|
+
}
|
|
955
|
+
constructor(reason, html) {
|
|
956
|
+
super(reason);
|
|
957
|
+
this.name = "HTMLInjectionError";
|
|
958
|
+
this.html = html;
|
|
959
|
+
}
|
|
960
|
+
};
|
|
961
|
+
var escape = escapeHTML;
|
|
962
|
+
var inherit = inherit$1;
|
|
963
|
+
var NO_MATCH = /* @__PURE__ */ Symbol("nomatch");
|
|
964
|
+
var MAX_KEYWORD_HITS = 7;
|
|
965
|
+
var HLJS = /* @__PURE__ */ __name(function(hljs) {
|
|
966
|
+
const languages = /* @__PURE__ */ Object.create(null);
|
|
967
|
+
const aliases = /* @__PURE__ */ Object.create(null);
|
|
968
|
+
const plugins = [];
|
|
969
|
+
let SAFE_MODE = true;
|
|
970
|
+
const LANGUAGE_NOT_FOUND = "Could not find the language '{}', did you forget to load/include a language module?";
|
|
971
|
+
const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: "Plain text", contains: [] };
|
|
972
|
+
let options = {
|
|
973
|
+
ignoreUnescapedHTML: false,
|
|
974
|
+
throwUnescapedHTML: false,
|
|
975
|
+
noHighlightRe: /^(no-?highlight)$/i,
|
|
976
|
+
languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
|
|
977
|
+
classPrefix: "hljs-",
|
|
978
|
+
cssSelector: "pre code",
|
|
979
|
+
languages: null,
|
|
980
|
+
// beta configuration options, subject to change, welcome to discuss
|
|
981
|
+
// https://github.com/highlightjs/highlight.js/issues/1086
|
|
982
|
+
__emitter: TokenTreeEmitter
|
|
983
|
+
};
|
|
984
|
+
function shouldNotHighlight(languageName) {
|
|
985
|
+
return options.noHighlightRe.test(languageName);
|
|
986
|
+
}
|
|
987
|
+
__name(shouldNotHighlight, "shouldNotHighlight");
|
|
988
|
+
function blockLanguage(block) {
|
|
989
|
+
let classes = block.className + " ";
|
|
990
|
+
classes += block.parentNode ? block.parentNode.className : "";
|
|
991
|
+
const match = options.languageDetectRe.exec(classes);
|
|
992
|
+
if (match) {
|
|
993
|
+
const language = getLanguage(match[1]);
|
|
994
|
+
if (!language) {
|
|
995
|
+
warn(LANGUAGE_NOT_FOUND.replace("{}", match[1]));
|
|
996
|
+
warn("Falling back to no-highlight mode for this block.", block);
|
|
997
|
+
}
|
|
998
|
+
return language ? match[1] : "no-highlight";
|
|
999
|
+
}
|
|
1000
|
+
return classes.split(/\s+/).find((_class) => shouldNotHighlight(_class) || getLanguage(_class));
|
|
1001
|
+
}
|
|
1002
|
+
__name(blockLanguage, "blockLanguage");
|
|
1003
|
+
function highlight2(codeOrLanguageName, optionsOrCode, ignoreIllegals) {
|
|
1004
|
+
let code = "";
|
|
1005
|
+
let languageName = "";
|
|
1006
|
+
if (typeof optionsOrCode === "object") {
|
|
1007
|
+
code = codeOrLanguageName;
|
|
1008
|
+
ignoreIllegals = optionsOrCode.ignoreIllegals;
|
|
1009
|
+
languageName = optionsOrCode.language;
|
|
1010
|
+
} else {
|
|
1011
|
+
deprecated("10.7.0", "highlight(lang, code, ...args) has been deprecated.");
|
|
1012
|
+
deprecated("10.7.0", "Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277");
|
|
1013
|
+
languageName = codeOrLanguageName;
|
|
1014
|
+
code = optionsOrCode;
|
|
1015
|
+
}
|
|
1016
|
+
if (ignoreIllegals === void 0) {
|
|
1017
|
+
ignoreIllegals = true;
|
|
1018
|
+
}
|
|
1019
|
+
const context = {
|
|
1020
|
+
code,
|
|
1021
|
+
language: languageName
|
|
1022
|
+
};
|
|
1023
|
+
fire("before:highlight", context);
|
|
1024
|
+
const result = context.result ? context.result : _highlight(context.language, context.code, ignoreIllegals);
|
|
1025
|
+
result.code = context.code;
|
|
1026
|
+
fire("after:highlight", result);
|
|
1027
|
+
return result;
|
|
1028
|
+
}
|
|
1029
|
+
__name(highlight2, "highlight");
|
|
1030
|
+
function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {
|
|
1031
|
+
const keywordHits = /* @__PURE__ */ Object.create(null);
|
|
1032
|
+
function keywordData(mode, matchText) {
|
|
1033
|
+
return mode.keywords[matchText];
|
|
1034
|
+
}
|
|
1035
|
+
__name(keywordData, "keywordData");
|
|
1036
|
+
function processKeywords() {
|
|
1037
|
+
if (!top.keywords) {
|
|
1038
|
+
emitter.addText(modeBuffer);
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
let lastIndex = 0;
|
|
1042
|
+
top.keywordPatternRe.lastIndex = 0;
|
|
1043
|
+
let match = top.keywordPatternRe.exec(modeBuffer);
|
|
1044
|
+
let buf = "";
|
|
1045
|
+
while (match) {
|
|
1046
|
+
buf += modeBuffer.substring(lastIndex, match.index);
|
|
1047
|
+
const word = language.case_insensitive ? match[0].toLowerCase() : match[0];
|
|
1048
|
+
const data = keywordData(top, word);
|
|
1049
|
+
if (data) {
|
|
1050
|
+
const [kind, keywordRelevance] = data;
|
|
1051
|
+
emitter.addText(buf);
|
|
1052
|
+
buf = "";
|
|
1053
|
+
keywordHits[word] = (keywordHits[word] || 0) + 1;
|
|
1054
|
+
if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;
|
|
1055
|
+
if (kind.startsWith("_")) {
|
|
1056
|
+
buf += match[0];
|
|
1057
|
+
} else {
|
|
1058
|
+
const cssClass = language.classNameAliases[kind] || kind;
|
|
1059
|
+
emitKeyword(match[0], cssClass);
|
|
1060
|
+
}
|
|
1061
|
+
} else {
|
|
1062
|
+
buf += match[0];
|
|
1063
|
+
}
|
|
1064
|
+
lastIndex = top.keywordPatternRe.lastIndex;
|
|
1065
|
+
match = top.keywordPatternRe.exec(modeBuffer);
|
|
1066
|
+
}
|
|
1067
|
+
buf += modeBuffer.substring(lastIndex);
|
|
1068
|
+
emitter.addText(buf);
|
|
1069
|
+
}
|
|
1070
|
+
__name(processKeywords, "processKeywords");
|
|
1071
|
+
function processSubLanguage() {
|
|
1072
|
+
if (modeBuffer === "") return;
|
|
1073
|
+
let result2 = null;
|
|
1074
|
+
if (typeof top.subLanguage === "string") {
|
|
1075
|
+
if (!languages[top.subLanguage]) {
|
|
1076
|
+
emitter.addText(modeBuffer);
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1079
|
+
result2 = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);
|
|
1080
|
+
continuations[top.subLanguage] = /** @type {CompiledMode} */
|
|
1081
|
+
result2._top;
|
|
1082
|
+
} else {
|
|
1083
|
+
result2 = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);
|
|
1084
|
+
}
|
|
1085
|
+
if (top.relevance > 0) {
|
|
1086
|
+
relevance += result2.relevance;
|
|
1087
|
+
}
|
|
1088
|
+
emitter.__addSublanguage(result2._emitter, result2.language);
|
|
1089
|
+
}
|
|
1090
|
+
__name(processSubLanguage, "processSubLanguage");
|
|
1091
|
+
function processBuffer() {
|
|
1092
|
+
if (top.subLanguage != null) {
|
|
1093
|
+
processSubLanguage();
|
|
1094
|
+
} else {
|
|
1095
|
+
processKeywords();
|
|
1096
|
+
}
|
|
1097
|
+
modeBuffer = "";
|
|
1098
|
+
}
|
|
1099
|
+
__name(processBuffer, "processBuffer");
|
|
1100
|
+
function emitKeyword(keyword, scope) {
|
|
1101
|
+
if (keyword === "") return;
|
|
1102
|
+
emitter.startScope(scope);
|
|
1103
|
+
emitter.addText(keyword);
|
|
1104
|
+
emitter.endScope();
|
|
1105
|
+
}
|
|
1106
|
+
__name(emitKeyword, "emitKeyword");
|
|
1107
|
+
function emitMultiClass(scope, match) {
|
|
1108
|
+
let i = 1;
|
|
1109
|
+
const max = match.length - 1;
|
|
1110
|
+
while (i <= max) {
|
|
1111
|
+
if (!scope._emit[i]) {
|
|
1112
|
+
i++;
|
|
1113
|
+
continue;
|
|
1114
|
+
}
|
|
1115
|
+
const klass = language.classNameAliases[scope[i]] || scope[i];
|
|
1116
|
+
const text = match[i];
|
|
1117
|
+
if (klass) {
|
|
1118
|
+
emitKeyword(text, klass);
|
|
1119
|
+
} else {
|
|
1120
|
+
modeBuffer = text;
|
|
1121
|
+
processKeywords();
|
|
1122
|
+
modeBuffer = "";
|
|
1123
|
+
}
|
|
1124
|
+
i++;
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
__name(emitMultiClass, "emitMultiClass");
|
|
1128
|
+
function startNewMode(mode, match) {
|
|
1129
|
+
if (mode.scope && typeof mode.scope === "string") {
|
|
1130
|
+
emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);
|
|
1131
|
+
}
|
|
1132
|
+
if (mode.beginScope) {
|
|
1133
|
+
if (mode.beginScope._wrap) {
|
|
1134
|
+
emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);
|
|
1135
|
+
modeBuffer = "";
|
|
1136
|
+
} else if (mode.beginScope._multi) {
|
|
1137
|
+
emitMultiClass(mode.beginScope, match);
|
|
1138
|
+
modeBuffer = "";
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
top = Object.create(mode, { parent: { value: top } });
|
|
1142
|
+
return top;
|
|
1143
|
+
}
|
|
1144
|
+
__name(startNewMode, "startNewMode");
|
|
1145
|
+
function endOfMode(mode, match, matchPlusRemainder) {
|
|
1146
|
+
let matched = startsWith(mode.endRe, matchPlusRemainder);
|
|
1147
|
+
if (matched) {
|
|
1148
|
+
if (mode["on:end"]) {
|
|
1149
|
+
const resp = new Response(mode);
|
|
1150
|
+
mode["on:end"](match, resp);
|
|
1151
|
+
if (resp.isMatchIgnored) matched = false;
|
|
1152
|
+
}
|
|
1153
|
+
if (matched) {
|
|
1154
|
+
while (mode.endsParent && mode.parent) {
|
|
1155
|
+
mode = mode.parent;
|
|
1156
|
+
}
|
|
1157
|
+
return mode;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
if (mode.endsWithParent) {
|
|
1161
|
+
return endOfMode(mode.parent, match, matchPlusRemainder);
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
__name(endOfMode, "endOfMode");
|
|
1165
|
+
function doIgnore(lexeme) {
|
|
1166
|
+
if (top.matcher.regexIndex === 0) {
|
|
1167
|
+
modeBuffer += lexeme[0];
|
|
1168
|
+
return 1;
|
|
1169
|
+
} else {
|
|
1170
|
+
resumeScanAtSamePosition = true;
|
|
1171
|
+
return 0;
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
__name(doIgnore, "doIgnore");
|
|
1175
|
+
function doBeginMatch(match) {
|
|
1176
|
+
const lexeme = match[0];
|
|
1177
|
+
const newMode = match.rule;
|
|
1178
|
+
const resp = new Response(newMode);
|
|
1179
|
+
const beforeCallbacks = [newMode.__beforeBegin, newMode["on:begin"]];
|
|
1180
|
+
for (const cb of beforeCallbacks) {
|
|
1181
|
+
if (!cb) continue;
|
|
1182
|
+
cb(match, resp);
|
|
1183
|
+
if (resp.isMatchIgnored) return doIgnore(lexeme);
|
|
1184
|
+
}
|
|
1185
|
+
if (newMode.skip) {
|
|
1186
|
+
modeBuffer += lexeme;
|
|
1187
|
+
} else {
|
|
1188
|
+
if (newMode.excludeBegin) {
|
|
1189
|
+
modeBuffer += lexeme;
|
|
1190
|
+
}
|
|
1191
|
+
processBuffer();
|
|
1192
|
+
if (!newMode.returnBegin && !newMode.excludeBegin) {
|
|
1193
|
+
modeBuffer = lexeme;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
startNewMode(newMode, match);
|
|
1197
|
+
return newMode.returnBegin ? 0 : lexeme.length;
|
|
1198
|
+
}
|
|
1199
|
+
__name(doBeginMatch, "doBeginMatch");
|
|
1200
|
+
function doEndMatch(match) {
|
|
1201
|
+
const lexeme = match[0];
|
|
1202
|
+
const matchPlusRemainder = codeToHighlight.substring(match.index);
|
|
1203
|
+
const endMode = endOfMode(top, match, matchPlusRemainder);
|
|
1204
|
+
if (!endMode) {
|
|
1205
|
+
return NO_MATCH;
|
|
1206
|
+
}
|
|
1207
|
+
const origin = top;
|
|
1208
|
+
if (top.endScope && top.endScope._wrap) {
|
|
1209
|
+
processBuffer();
|
|
1210
|
+
emitKeyword(lexeme, top.endScope._wrap);
|
|
1211
|
+
} else if (top.endScope && top.endScope._multi) {
|
|
1212
|
+
processBuffer();
|
|
1213
|
+
emitMultiClass(top.endScope, match);
|
|
1214
|
+
} else if (origin.skip) {
|
|
1215
|
+
modeBuffer += lexeme;
|
|
1216
|
+
} else {
|
|
1217
|
+
if (!(origin.returnEnd || origin.excludeEnd)) {
|
|
1218
|
+
modeBuffer += lexeme;
|
|
1219
|
+
}
|
|
1220
|
+
processBuffer();
|
|
1221
|
+
if (origin.excludeEnd) {
|
|
1222
|
+
modeBuffer = lexeme;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
do {
|
|
1226
|
+
if (top.scope) {
|
|
1227
|
+
emitter.closeNode();
|
|
1228
|
+
}
|
|
1229
|
+
if (!top.skip && !top.subLanguage) {
|
|
1230
|
+
relevance += top.relevance;
|
|
1231
|
+
}
|
|
1232
|
+
top = top.parent;
|
|
1233
|
+
} while (top !== endMode.parent);
|
|
1234
|
+
if (endMode.starts) {
|
|
1235
|
+
startNewMode(endMode.starts, match);
|
|
1236
|
+
}
|
|
1237
|
+
return origin.returnEnd ? 0 : lexeme.length;
|
|
1238
|
+
}
|
|
1239
|
+
__name(doEndMatch, "doEndMatch");
|
|
1240
|
+
function processContinuations() {
|
|
1241
|
+
const list = [];
|
|
1242
|
+
for (let current = top; current !== language; current = current.parent) {
|
|
1243
|
+
if (current.scope) {
|
|
1244
|
+
list.unshift(current.scope);
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
list.forEach((item) => emitter.openNode(item));
|
|
1248
|
+
}
|
|
1249
|
+
__name(processContinuations, "processContinuations");
|
|
1250
|
+
let lastMatch = {};
|
|
1251
|
+
function processLexeme(textBeforeMatch, match) {
|
|
1252
|
+
const lexeme = match && match[0];
|
|
1253
|
+
modeBuffer += textBeforeMatch;
|
|
1254
|
+
if (lexeme == null) {
|
|
1255
|
+
processBuffer();
|
|
1256
|
+
return 0;
|
|
1257
|
+
}
|
|
1258
|
+
if (lastMatch.type === "begin" && match.type === "end" && lastMatch.index === match.index && lexeme === "") {
|
|
1259
|
+
modeBuffer += codeToHighlight.slice(match.index, match.index + 1);
|
|
1260
|
+
if (!SAFE_MODE) {
|
|
1261
|
+
const err = new Error(`0 width match regex (${languageName})`);
|
|
1262
|
+
err.languageName = languageName;
|
|
1263
|
+
err.badRule = lastMatch.rule;
|
|
1264
|
+
throw err;
|
|
1265
|
+
}
|
|
1266
|
+
return 1;
|
|
1267
|
+
}
|
|
1268
|
+
lastMatch = match;
|
|
1269
|
+
if (match.type === "begin") {
|
|
1270
|
+
return doBeginMatch(match);
|
|
1271
|
+
} else if (match.type === "illegal" && !ignoreIllegals) {
|
|
1272
|
+
const err = new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.scope || "<unnamed>") + '"');
|
|
1273
|
+
err.mode = top;
|
|
1274
|
+
throw err;
|
|
1275
|
+
} else if (match.type === "end") {
|
|
1276
|
+
const processed = doEndMatch(match);
|
|
1277
|
+
if (processed !== NO_MATCH) {
|
|
1278
|
+
return processed;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
if (match.type === "illegal" && lexeme === "") {
|
|
1282
|
+
modeBuffer += "\n";
|
|
1283
|
+
return 1;
|
|
1284
|
+
}
|
|
1285
|
+
if (iterations > 1e5 && iterations > match.index * 3) {
|
|
1286
|
+
const err = new Error("potential infinite loop, way more iterations than matches");
|
|
1287
|
+
throw err;
|
|
1288
|
+
}
|
|
1289
|
+
modeBuffer += lexeme;
|
|
1290
|
+
return lexeme.length;
|
|
1291
|
+
}
|
|
1292
|
+
__name(processLexeme, "processLexeme");
|
|
1293
|
+
const language = getLanguage(languageName);
|
|
1294
|
+
if (!language) {
|
|
1295
|
+
error(LANGUAGE_NOT_FOUND.replace("{}", languageName));
|
|
1296
|
+
throw new Error('Unknown language: "' + languageName + '"');
|
|
1297
|
+
}
|
|
1298
|
+
const md = compileLanguage(language);
|
|
1299
|
+
let result = "";
|
|
1300
|
+
let top = continuation || md;
|
|
1301
|
+
const continuations = {};
|
|
1302
|
+
const emitter = new options.__emitter(options);
|
|
1303
|
+
processContinuations();
|
|
1304
|
+
let modeBuffer = "";
|
|
1305
|
+
let relevance = 0;
|
|
1306
|
+
let index = 0;
|
|
1307
|
+
let iterations = 0;
|
|
1308
|
+
let resumeScanAtSamePosition = false;
|
|
1309
|
+
try {
|
|
1310
|
+
if (!language.__emitTokens) {
|
|
1311
|
+
top.matcher.considerAll();
|
|
1312
|
+
for (; ; ) {
|
|
1313
|
+
iterations++;
|
|
1314
|
+
if (resumeScanAtSamePosition) {
|
|
1315
|
+
resumeScanAtSamePosition = false;
|
|
1316
|
+
} else {
|
|
1317
|
+
top.matcher.considerAll();
|
|
1318
|
+
}
|
|
1319
|
+
top.matcher.lastIndex = index;
|
|
1320
|
+
const match = top.matcher.exec(codeToHighlight);
|
|
1321
|
+
if (!match) break;
|
|
1322
|
+
const beforeMatch = codeToHighlight.substring(index, match.index);
|
|
1323
|
+
const processedCount = processLexeme(beforeMatch, match);
|
|
1324
|
+
index = match.index + processedCount;
|
|
1325
|
+
}
|
|
1326
|
+
processLexeme(codeToHighlight.substring(index));
|
|
1327
|
+
} else {
|
|
1328
|
+
language.__emitTokens(codeToHighlight, emitter);
|
|
1329
|
+
}
|
|
1330
|
+
emitter.finalize();
|
|
1331
|
+
result = emitter.toHTML();
|
|
1332
|
+
return {
|
|
1333
|
+
language: languageName,
|
|
1334
|
+
value: result,
|
|
1335
|
+
relevance,
|
|
1336
|
+
illegal: false,
|
|
1337
|
+
_emitter: emitter,
|
|
1338
|
+
_top: top
|
|
1339
|
+
};
|
|
1340
|
+
} catch (err) {
|
|
1341
|
+
if (err.message && err.message.includes("Illegal")) {
|
|
1342
|
+
return {
|
|
1343
|
+
language: languageName,
|
|
1344
|
+
value: escape(codeToHighlight),
|
|
1345
|
+
illegal: true,
|
|
1346
|
+
relevance: 0,
|
|
1347
|
+
_illegalBy: {
|
|
1348
|
+
message: err.message,
|
|
1349
|
+
index,
|
|
1350
|
+
context: codeToHighlight.slice(index - 100, index + 100),
|
|
1351
|
+
mode: err.mode,
|
|
1352
|
+
resultSoFar: result
|
|
1353
|
+
},
|
|
1354
|
+
_emitter: emitter
|
|
1355
|
+
};
|
|
1356
|
+
} else if (SAFE_MODE) {
|
|
1357
|
+
return {
|
|
1358
|
+
language: languageName,
|
|
1359
|
+
value: escape(codeToHighlight),
|
|
1360
|
+
illegal: false,
|
|
1361
|
+
relevance: 0,
|
|
1362
|
+
errorRaised: err,
|
|
1363
|
+
_emitter: emitter,
|
|
1364
|
+
_top: top
|
|
1365
|
+
};
|
|
1366
|
+
} else {
|
|
1367
|
+
throw err;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
__name(_highlight, "_highlight");
|
|
1372
|
+
function justTextHighlightResult(code) {
|
|
1373
|
+
const result = {
|
|
1374
|
+
value: escape(code),
|
|
1375
|
+
illegal: false,
|
|
1376
|
+
relevance: 0,
|
|
1377
|
+
_top: PLAINTEXT_LANGUAGE,
|
|
1378
|
+
_emitter: new options.__emitter(options)
|
|
1379
|
+
};
|
|
1380
|
+
result._emitter.addText(code);
|
|
1381
|
+
return result;
|
|
1382
|
+
}
|
|
1383
|
+
__name(justTextHighlightResult, "justTextHighlightResult");
|
|
1384
|
+
function highlightAuto(code, languageSubset) {
|
|
1385
|
+
languageSubset = languageSubset || options.languages || Object.keys(languages);
|
|
1386
|
+
const plaintext = justTextHighlightResult(code);
|
|
1387
|
+
const results = languageSubset.filter(getLanguage).filter(autoDetection).map(
|
|
1388
|
+
(name) => _highlight(name, code, false)
|
|
1389
|
+
);
|
|
1390
|
+
results.unshift(plaintext);
|
|
1391
|
+
const sorted = results.sort((a, b) => {
|
|
1392
|
+
if (a.relevance !== b.relevance) return b.relevance - a.relevance;
|
|
1393
|
+
if (a.language && b.language) {
|
|
1394
|
+
if (getLanguage(a.language).supersetOf === b.language) {
|
|
1395
|
+
return 1;
|
|
1396
|
+
} else if (getLanguage(b.language).supersetOf === a.language) {
|
|
1397
|
+
return -1;
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
return 0;
|
|
1401
|
+
});
|
|
1402
|
+
const [best, secondBest] = sorted;
|
|
1403
|
+
const result = best;
|
|
1404
|
+
result.secondBest = secondBest;
|
|
1405
|
+
return result;
|
|
1406
|
+
}
|
|
1407
|
+
__name(highlightAuto, "highlightAuto");
|
|
1408
|
+
function updateClassName(element, currentLang, resultLang) {
|
|
1409
|
+
const language = currentLang && aliases[currentLang] || resultLang;
|
|
1410
|
+
element.classList.add("hljs");
|
|
1411
|
+
element.classList.add(`language-${language}`);
|
|
1412
|
+
}
|
|
1413
|
+
__name(updateClassName, "updateClassName");
|
|
1414
|
+
function highlightElement(element) {
|
|
1415
|
+
let node = null;
|
|
1416
|
+
const language = blockLanguage(element);
|
|
1417
|
+
if (shouldNotHighlight(language)) return;
|
|
1418
|
+
fire(
|
|
1419
|
+
"before:highlightElement",
|
|
1420
|
+
{ el: element, language }
|
|
1421
|
+
);
|
|
1422
|
+
if (element.dataset.highlighted) {
|
|
1423
|
+
console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", element);
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1426
|
+
if (element.children.length > 0) {
|
|
1427
|
+
if (!options.ignoreUnescapedHTML) {
|
|
1428
|
+
console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk.");
|
|
1429
|
+
console.warn("https://github.com/highlightjs/highlight.js/wiki/security");
|
|
1430
|
+
console.warn("The element with unescaped HTML:");
|
|
1431
|
+
console.warn(element);
|
|
1432
|
+
}
|
|
1433
|
+
if (options.throwUnescapedHTML) {
|
|
1434
|
+
const err = new HTMLInjectionError(
|
|
1435
|
+
"One of your code blocks includes unescaped HTML.",
|
|
1436
|
+
element.innerHTML
|
|
1437
|
+
);
|
|
1438
|
+
throw err;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
node = element;
|
|
1442
|
+
const text = node.textContent;
|
|
1443
|
+
const result = language ? highlight2(text, { language, ignoreIllegals: true }) : highlightAuto(text);
|
|
1444
|
+
element.innerHTML = result.value;
|
|
1445
|
+
element.dataset.highlighted = "yes";
|
|
1446
|
+
updateClassName(element, language, result.language);
|
|
1447
|
+
element.result = {
|
|
1448
|
+
language: result.language,
|
|
1449
|
+
// TODO: remove with version 11.0
|
|
1450
|
+
re: result.relevance,
|
|
1451
|
+
relevance: result.relevance
|
|
1452
|
+
};
|
|
1453
|
+
if (result.secondBest) {
|
|
1454
|
+
element.secondBest = {
|
|
1455
|
+
language: result.secondBest.language,
|
|
1456
|
+
relevance: result.secondBest.relevance
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
fire("after:highlightElement", { el: element, result, text });
|
|
1460
|
+
}
|
|
1461
|
+
__name(highlightElement, "highlightElement");
|
|
1462
|
+
function configure(userOptions) {
|
|
1463
|
+
options = inherit(options, userOptions);
|
|
1464
|
+
}
|
|
1465
|
+
__name(configure, "configure");
|
|
1466
|
+
const initHighlighting = /* @__PURE__ */ __name(() => {
|
|
1467
|
+
highlightAll();
|
|
1468
|
+
deprecated("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
|
|
1469
|
+
}, "initHighlighting");
|
|
1470
|
+
function initHighlightingOnLoad() {
|
|
1471
|
+
highlightAll();
|
|
1472
|
+
deprecated("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
|
|
1473
|
+
}
|
|
1474
|
+
__name(initHighlightingOnLoad, "initHighlightingOnLoad");
|
|
1475
|
+
let wantsHighlight = false;
|
|
1476
|
+
function highlightAll() {
|
|
1477
|
+
function boot() {
|
|
1478
|
+
highlightAll();
|
|
1479
|
+
}
|
|
1480
|
+
__name(boot, "boot");
|
|
1481
|
+
if (document.readyState === "loading") {
|
|
1482
|
+
if (!wantsHighlight) {
|
|
1483
|
+
window.addEventListener("DOMContentLoaded", boot, false);
|
|
1484
|
+
}
|
|
1485
|
+
wantsHighlight = true;
|
|
1486
|
+
return;
|
|
1487
|
+
}
|
|
1488
|
+
const blocks = document.querySelectorAll(options.cssSelector);
|
|
1489
|
+
blocks.forEach(highlightElement);
|
|
1490
|
+
}
|
|
1491
|
+
__name(highlightAll, "highlightAll");
|
|
1492
|
+
function registerLanguage(languageName, languageDefinition) {
|
|
1493
|
+
let lang = null;
|
|
1494
|
+
try {
|
|
1495
|
+
lang = languageDefinition(hljs);
|
|
1496
|
+
} catch (error$1) {
|
|
1497
|
+
error("Language definition for '{}' could not be registered.".replace("{}", languageName));
|
|
1498
|
+
if (!SAFE_MODE) {
|
|
1499
|
+
throw error$1;
|
|
1500
|
+
} else {
|
|
1501
|
+
error(error$1);
|
|
1502
|
+
}
|
|
1503
|
+
lang = PLAINTEXT_LANGUAGE;
|
|
1504
|
+
}
|
|
1505
|
+
if (!lang.name) lang.name = languageName;
|
|
1506
|
+
languages[languageName] = lang;
|
|
1507
|
+
lang.rawDefinition = languageDefinition.bind(null, hljs);
|
|
1508
|
+
if (lang.aliases) {
|
|
1509
|
+
registerAliases(lang.aliases, { languageName });
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
__name(registerLanguage, "registerLanguage");
|
|
1513
|
+
function unregisterLanguage(languageName) {
|
|
1514
|
+
delete languages[languageName];
|
|
1515
|
+
for (const alias of Object.keys(aliases)) {
|
|
1516
|
+
if (aliases[alias] === languageName) {
|
|
1517
|
+
delete aliases[alias];
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
__name(unregisterLanguage, "unregisterLanguage");
|
|
1522
|
+
function listLanguages() {
|
|
1523
|
+
return Object.keys(languages);
|
|
1524
|
+
}
|
|
1525
|
+
__name(listLanguages, "listLanguages");
|
|
1526
|
+
function getLanguage(name) {
|
|
1527
|
+
name = (name || "").toLowerCase();
|
|
1528
|
+
return languages[name] || languages[aliases[name]];
|
|
1529
|
+
}
|
|
1530
|
+
__name(getLanguage, "getLanguage");
|
|
1531
|
+
function registerAliases(aliasList, { languageName }) {
|
|
1532
|
+
if (typeof aliasList === "string") {
|
|
1533
|
+
aliasList = [aliasList];
|
|
1534
|
+
}
|
|
1535
|
+
aliasList.forEach((alias) => {
|
|
1536
|
+
aliases[alias.toLowerCase()] = languageName;
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
__name(registerAliases, "registerAliases");
|
|
1540
|
+
function autoDetection(name) {
|
|
1541
|
+
const lang = getLanguage(name);
|
|
1542
|
+
return lang && !lang.disableAutodetect;
|
|
1543
|
+
}
|
|
1544
|
+
__name(autoDetection, "autoDetection");
|
|
1545
|
+
function upgradePluginAPI(plugin) {
|
|
1546
|
+
if (plugin["before:highlightBlock"] && !plugin["before:highlightElement"]) {
|
|
1547
|
+
plugin["before:highlightElement"] = (data) => {
|
|
1548
|
+
plugin["before:highlightBlock"](
|
|
1549
|
+
Object.assign({ block: data.el }, data)
|
|
1550
|
+
);
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
if (plugin["after:highlightBlock"] && !plugin["after:highlightElement"]) {
|
|
1554
|
+
plugin["after:highlightElement"] = (data) => {
|
|
1555
|
+
plugin["after:highlightBlock"](
|
|
1556
|
+
Object.assign({ block: data.el }, data)
|
|
1557
|
+
);
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
__name(upgradePluginAPI, "upgradePluginAPI");
|
|
1562
|
+
function addPlugin(plugin) {
|
|
1563
|
+
upgradePluginAPI(plugin);
|
|
1564
|
+
plugins.push(plugin);
|
|
1565
|
+
}
|
|
1566
|
+
__name(addPlugin, "addPlugin");
|
|
1567
|
+
function removePlugin(plugin) {
|
|
1568
|
+
const index = plugins.indexOf(plugin);
|
|
1569
|
+
if (index !== -1) {
|
|
1570
|
+
plugins.splice(index, 1);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
__name(removePlugin, "removePlugin");
|
|
1574
|
+
function fire(event, args) {
|
|
1575
|
+
const cb = event;
|
|
1576
|
+
plugins.forEach(function(plugin) {
|
|
1577
|
+
if (plugin[cb]) {
|
|
1578
|
+
plugin[cb](args);
|
|
1579
|
+
}
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
__name(fire, "fire");
|
|
1583
|
+
function deprecateHighlightBlock(el) {
|
|
1584
|
+
deprecated("10.7.0", "highlightBlock will be removed entirely in v12.0");
|
|
1585
|
+
deprecated("10.7.0", "Please use highlightElement now.");
|
|
1586
|
+
return highlightElement(el);
|
|
1587
|
+
}
|
|
1588
|
+
__name(deprecateHighlightBlock, "deprecateHighlightBlock");
|
|
1589
|
+
Object.assign(hljs, {
|
|
1590
|
+
highlight: highlight2,
|
|
1591
|
+
highlightAuto,
|
|
1592
|
+
highlightAll,
|
|
1593
|
+
highlightElement,
|
|
1594
|
+
// TODO: Remove with v12 API
|
|
1595
|
+
highlightBlock: deprecateHighlightBlock,
|
|
1596
|
+
configure,
|
|
1597
|
+
initHighlighting,
|
|
1598
|
+
initHighlightingOnLoad,
|
|
1599
|
+
registerLanguage,
|
|
1600
|
+
unregisterLanguage,
|
|
1601
|
+
listLanguages,
|
|
1602
|
+
getLanguage,
|
|
1603
|
+
registerAliases,
|
|
1604
|
+
autoDetection,
|
|
1605
|
+
inherit,
|
|
1606
|
+
addPlugin,
|
|
1607
|
+
removePlugin
|
|
1608
|
+
});
|
|
1609
|
+
hljs.debugMode = function() {
|
|
1610
|
+
SAFE_MODE = false;
|
|
1611
|
+
};
|
|
1612
|
+
hljs.safeMode = function() {
|
|
1613
|
+
SAFE_MODE = true;
|
|
1614
|
+
};
|
|
1615
|
+
hljs.versionString = version;
|
|
1616
|
+
hljs.regex = {
|
|
1617
|
+
concat,
|
|
1618
|
+
lookahead,
|
|
1619
|
+
either,
|
|
1620
|
+
optional,
|
|
1621
|
+
anyNumberOfTimes
|
|
1622
|
+
};
|
|
1623
|
+
for (const key in MODES) {
|
|
1624
|
+
if (typeof MODES[key] === "object") {
|
|
1625
|
+
deepFreeze(MODES[key]);
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
Object.assign(hljs, MODES);
|
|
1629
|
+
return hljs;
|
|
1630
|
+
}, "HLJS");
|
|
1631
|
+
var highlight = HLJS({});
|
|
1632
|
+
highlight.newInstance = () => HLJS({});
|
|
1633
|
+
module.exports = highlight;
|
|
1634
|
+
highlight.HighlightJS = highlight;
|
|
1635
|
+
highlight.default = highlight;
|
|
1636
|
+
}
|
|
1637
|
+
});
|
|
1638
|
+
|
|
1639
|
+
// ../../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/core.js
|
|
1640
|
+
var import_core = __toESM(require_core(), 1);
|
|
1641
|
+
var core_default = import_core.default;
|
|
1642
|
+
var export_HighlightJS = import_core.default;
|
|
1643
|
+
export {
|
|
1644
|
+
export_HighlightJS as HighlightJS,
|
|
1645
|
+
core_default as default
|
|
1646
|
+
};
|
|
1647
|
+
//# sourceMappingURL=core-6GH4J4QJ.js.map
|