@septkit/ui 0.0.41 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/code/code-block.js +7 -0
- package/dist/code/code-block.vue_vue_type_script_setup_true_lang.js +63 -0
- package/dist/code/diff.js +35 -0
- package/dist/code/highlight.js +30 -0
- package/dist/code/index.js +5 -0
- package/dist/code/xml-diff.js +5 -0
- package/dist/code/xml-diff.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/dialecte/composables/index.js +2 -1
- package/dist/dialecte/composables/use-active-document.js +24 -0
- package/dist/dialecte/create-document-store.js +3 -3
- package/dist/dialecte/index.js +2 -1
- package/dist/dialog/dialog-host.js +5 -0
- package/dist/dialog/dialog-host.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/dialog/dialog.js +5 -0
- package/dist/dialog/dialog.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/dialog/index.js +4 -0
- package/dist/dialog/use-dialog-host.js +32 -0
- package/dist/explorer/collect-expandable-node-ids.js +8 -0
- package/dist/explorer/explorer.js +1 -1
- package/dist/explorer/explorer.vue_vue_type_script_setup_true_lang.js +47 -33
- package/dist/explorer/index.js +3 -2
- package/dist/external/.pnpm/@dialecte_core@0.4.5/node_modules/@dialecte/core/dist/helpers.js +142 -0
- package/dist/external/.pnpm/@dialecte_core@0.4.5/node_modules/@dialecte/core/dist/index.js +3 -0
- package/dist/external/.pnpm/{@dialecte_core@0.4.2/node_modules/@dialecte/core/dist/project-E32sEthh.js → @dialecte_core@0.4.5/node_modules/@dialecte/core/dist/project-wohrish5.js} +3352 -1170
- package/dist/external/.pnpm/{@dialecte_core@0.4.2/node_modules/@dialecte/core/dist/utils-DgKwrT2n.js → @dialecte_core@0.4.5/node_modules/@dialecte/core/dist/utils-C5_11hqg.js} +73 -3
- package/dist/external/.pnpm/@dialecte_scl@0.3.3/node_modules/@dialecte/scl/dist/hooks-BTkrNj6r.js +25264 -0
- package/dist/external/.pnpm/@dialecte_scl@0.3.3/node_modules/@dialecte/scl/dist/v2019C1/index.js +3 -0
- package/dist/external/.pnpm/@lucide_vue@1.23.0_vue@3.5.39_typescript@5.8.3_/node_modules/@lucide/vue/dist/esm/icons/arrow-right.js +11 -0
- package/dist/external/.pnpm/@lucide_vue@1.23.0_vue@3.5.39_typescript@5.8.3_/node_modules/@lucide/vue/dist/esm/icons/copy.js +16 -0
- package/dist/external/.pnpm/@lucide_vue@1.23.0_vue@3.5.39_typescript@5.8.3_/node_modules/@lucide/vue/dist/esm/icons/text-wrap.js +22 -0
- package/dist/external/.pnpm/@lucide_vue@1.23.0_vue@3.5.39_typescript@5.8.3_/node_modules/@lucide/vue/dist/esm/icons/x.js +11 -0
- package/dist/external/.pnpm/@shikijs_core@3.23.0/node_modules/@shikijs/core/dist/index.js +1299 -0
- package/dist/external/.pnpm/@shikijs_engine-javascript@3.23.0/node_modules/@shikijs/engine-javascript/dist/engine-compile.js +34 -0
- package/dist/external/.pnpm/@shikijs_engine-javascript@3.23.0/node_modules/@shikijs/engine-javascript/dist/shared/engine-javascript.hzpS1_41.js +66 -0
- package/dist/external/.pnpm/@shikijs_langs@3.23.0/node_modules/@shikijs/langs/dist/java.js +3 -0
- package/dist/external/.pnpm/@shikijs_langs@3.23.0/node_modules/@shikijs/langs/dist/xml.js +5 -0
- package/dist/external/.pnpm/@shikijs_themes@3.23.0/node_modules/@shikijs/themes/dist/github-dark.js +4 -0
- package/dist/external/.pnpm/@shikijs_types@3.23.0/node_modules/@shikijs/types/dist/index.js +8 -0
- package/dist/external/.pnpm/@shikijs_vscode-textmate@10.0.2/node_modules/@shikijs/vscode-textmate/dist/index.js +1576 -0
- package/dist/external/.pnpm/@vueuse_core@14.3.0_vue@3.5.39_typescript@5.8.3_/node_modules/@vueuse/core/dist/index.js +126 -43
- package/dist/external/.pnpm/@vueuse_shared@14.3.0_vue@3.5.39_typescript@5.8.3_/node_modules/@vueuse/shared/dist/index.js +84 -55
- package/dist/external/.pnpm/ccount@2.0.1/node_modules/ccount/index.js +10 -0
- package/dist/external/.pnpm/character-entities-html4@2.1.0/node_modules/character-entities-html4/index.js +257 -0
- package/dist/external/.pnpm/character-entities-legacy@3.0.0/node_modules/character-entities-legacy/index.js +4 -0
- package/dist/external/.pnpm/comma-separated-tokens@2.0.3/node_modules/comma-separated-tokens/index.js +7 -0
- package/dist/external/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/comment.js +11 -0
- package/dist/external/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/doctype.js +6 -0
- package/dist/external/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/element.js +49 -0
- package/dist/external/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/index.js +28 -0
- package/dist/external/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/raw.js +7 -0
- package/dist/external/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/root.js +6 -0
- package/dist/external/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/text.js +8 -0
- package/dist/external/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/index.js +48 -0
- package/dist/external/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/omission/closing.js +86 -0
- package/dist/external/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/omission/omission.js +10 -0
- package/dist/external/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/omission/opening.js +39 -0
- package/dist/external/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/omission/util/siblings.js +13 -0
- package/dist/external/.pnpm/hast-util-whitespace@3.0.0/node_modules/hast-util-whitespace/lib/index.js +10 -0
- package/dist/external/.pnpm/html-void-elements@3.0.0/node_modules/html-void-elements/index.js +25 -0
- package/dist/external/.pnpm/oniguruma-parser@0.12.2/node_modules/oniguruma-parser/dist/parser/node-utils.js +23 -0
- package/dist/external/.pnpm/oniguruma-parser@0.12.2/node_modules/oniguruma-parser/dist/parser/parse.js +419 -0
- package/dist/external/.pnpm/oniguruma-parser@0.12.2/node_modules/oniguruma-parser/dist/tokenizer/tokenize.js +487 -0
- package/dist/external/.pnpm/oniguruma-parser@0.12.2/node_modules/oniguruma-parser/dist/traverser/traverse.js +84 -0
- package/dist/external/.pnpm/oniguruma-parser@0.12.2/node_modules/oniguruma-parser/dist/utils.js +30 -0
- package/dist/external/.pnpm/oniguruma-to-es@4.3.6/node_modules/oniguruma-to-es/dist/esm/index.js +970 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/index.js +25 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/aria.js +61 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/find.js +31 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/html.js +326 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/normalize.js +6 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/svg.js +564 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/case-insensitive-transform.js +7 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/case-sensitive-transform.js +6 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/create.js +14 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/defined-info.js +18 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/info.js +9 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/merge.js +9 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/schema.js +9 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/types.js +16 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/xlink.js +19 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/xml.js +15 -0
- package/dist/external/.pnpm/property-information@7.2.0/node_modules/property-information/lib/xmlns.js +14 -0
- package/dist/external/.pnpm/regex-recursion@6.0.2/node_modules/regex-recursion/src/index.js +110 -0
- package/dist/external/.pnpm/regex-utilities@2.3.0/node_modules/regex-utilities/src/index.js +56 -0
- package/dist/external/.pnpm/regex@6.1.0/node_modules/regex/src/atomic.js +94 -0
- package/dist/external/.pnpm/regex@6.1.0/node_modules/regex/src/internals.js +2 -0
- package/dist/external/.pnpm/regex@6.1.0/node_modules/regex/src/utils-internals.js +10 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Dialog/DialogContent.js +72 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Dialog/DialogContentImpl.js +101 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Dialog/DialogContentModal.js +83 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Dialog/DialogContentNonModal.js +74 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Dialog/DialogOverlay.js +48 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Dialog/DialogOverlayImpl.js +47 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Dialog/DialogPortal.js +33 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Dialog/DialogRoot.js +61 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Dialog/DialogTitle.js +28 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Dialog/utils.js +17 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Menu/utils.js +16 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Splitter/SplitterGroup.js +384 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Splitter/SplitterPanel.js +136 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Splitter/SplitterResizeHandle.js +119 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Stepper/StepperIndicator.js +27 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Stepper/StepperItem.js +67 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Stepper/StepperRoot.js +136 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Stepper/StepperTitle.js +28 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/composables/useWindowSplitterBehavior.js +37 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/composables/useWindowSplitterPanelGroupBehavior.js +82 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/shared/arrays.js +7 -2
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/shared/browser.js +4 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/assert.js +6 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/calculate.js +73 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/callPanelCallbacks.js +19 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/compare.js +11 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/debounce.js +11 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/dom.js +20 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/events.js +33 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/layout.js +103 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/pivot.js +8 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/rects.js +6 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/registry.js +106 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/resizePanel.js +15 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/stackingOrder.js +57 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/storage.js +50 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/style.js +35 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/units.js +57 -0
- package/dist/external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/utils/validation.js +39 -0
- package/dist/external/.pnpm/space-separated-tokens@2.0.2/node_modules/space-separated-tokens/index.js +6 -0
- package/dist/external/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/constant/dangerous.js +13 -0
- package/dist/external/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/core.js +23 -0
- package/dist/external/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/index.js +8 -0
- package/dist/external/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/util/format-smart.js +14 -0
- package/dist/external/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/util/to-decimal.js +8 -0
- package/dist/external/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/util/to-hexadecimal.js +8 -0
- package/dist/external/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/util/to-named.js +17 -0
- package/dist/external/.pnpm/zwitch@2.0.4/node_modules/zwitch/index.js +16 -0
- package/dist/index.d.ts +422 -4
- package/dist/index.js +24 -7
- package/dist/merge/build-view-model.js +168 -0
- package/dist/merge/decision-toggle.js +5 -0
- package/dist/merge/decision-toggle.vue_vue_type_script_setup_true_lang.js +40 -0
- package/dist/merge/element-detail.js +5 -0
- package/dist/merge/element-detail.vue_vue_type_script_setup_true_lang.js +53 -0
- package/dist/merge/index.js +6 -0
- package/dist/merge/merge-progress.js +5 -0
- package/dist/merge/merge-progress.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/merge/merge-review.js +5 -0
- package/dist/merge/merge-review.vue_vue_type_script_setup_true_lang.js +305 -0
- package/dist/merge/merge-summary.js +5 -0
- package/dist/merge/merge-summary.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/merge/merge-tree.js +5 -0
- package/dist/merge/merge-tree.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/merge/merge.service.js +69 -0
- package/dist/merge/use-document-progress.js +27 -0
- package/dist/merge/use-merge-session.js +151 -0
- package/dist/ui.css +1 -1
- package/package.json +4 -2
- package/dist/external/.pnpm/@dialecte_core@0.4.2/node_modules/@dialecte/core/dist/helpers.js +0 -13
- package/dist/external/.pnpm/@dialecte_core@0.4.2/node_modules/@dialecte/core/dist/index.js +0 -3
|
@@ -0,0 +1,1299 @@
|
|
|
1
|
+
import { ShikiError as e } from "../../../../../@shikijs_types@3.23.0/node_modules/@shikijs/types/dist/index.js";
|
|
2
|
+
import { EncodedTokenMetadata as t, FontStyle as n, INITIAL as r, Registry as i, Theme as a } from "../../../../../@shikijs_vscode-textmate@10.0.2/node_modules/@shikijs/vscode-textmate/dist/index.js";
|
|
3
|
+
import { toHtml as o } from "../../../../../hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/index.js";
|
|
4
|
+
//#region node_modules/.pnpm/@shikijs+core@3.23.0/node_modules/@shikijs/core/dist/index.mjs
|
|
5
|
+
function s(e, t) {
|
|
6
|
+
let n = typeof e == "string" ? {} : { ...e.colorReplacements }, r = typeof e == "string" ? e : e.name;
|
|
7
|
+
for (let [e, i] of Object.entries(t?.colorReplacements || {})) typeof i == "string" ? n[e] = i : e === r && Object.assign(n, i);
|
|
8
|
+
return n;
|
|
9
|
+
}
|
|
10
|
+
function c(e, t) {
|
|
11
|
+
return e && (t?.[e?.toLowerCase()] || e);
|
|
12
|
+
}
|
|
13
|
+
function l(e) {
|
|
14
|
+
return Array.isArray(e) ? e : [e];
|
|
15
|
+
}
|
|
16
|
+
async function u(e) {
|
|
17
|
+
return Promise.resolve(typeof e == "function" ? e() : e).then((e) => e.default || e);
|
|
18
|
+
}
|
|
19
|
+
function d(e) {
|
|
20
|
+
return !e || [
|
|
21
|
+
"plaintext",
|
|
22
|
+
"txt",
|
|
23
|
+
"text",
|
|
24
|
+
"plain"
|
|
25
|
+
].includes(e);
|
|
26
|
+
}
|
|
27
|
+
function f(e) {
|
|
28
|
+
return e === "ansi" || d(e);
|
|
29
|
+
}
|
|
30
|
+
function p(e) {
|
|
31
|
+
return e === "none";
|
|
32
|
+
}
|
|
33
|
+
function m(e) {
|
|
34
|
+
return p(e);
|
|
35
|
+
}
|
|
36
|
+
function h(e, t) {
|
|
37
|
+
if (!t) return e;
|
|
38
|
+
e.properties ||= {}, e.properties.class ||= [], typeof e.properties.class == "string" && (e.properties.class = e.properties.class.split(/\s+/g)), Array.isArray(e.properties.class) || (e.properties.class = []);
|
|
39
|
+
let n = Array.isArray(t) ? t : t.split(/\s+/g);
|
|
40
|
+
for (let t of n) t && !e.properties.class.includes(t) && e.properties.class.push(t);
|
|
41
|
+
return e;
|
|
42
|
+
}
|
|
43
|
+
function g(e, t = !1) {
|
|
44
|
+
if (e.length === 0) return [["", 0]];
|
|
45
|
+
let n = e.split(/(\r?\n)/g), r = 0, i = [];
|
|
46
|
+
for (let e = 0; e < n.length; e += 2) {
|
|
47
|
+
let a = t ? n[e] + (n[e + 1] || "") : n[e];
|
|
48
|
+
i.push([a, r]), r += n[e].length, r += n[e + 1]?.length || 0;
|
|
49
|
+
}
|
|
50
|
+
return i;
|
|
51
|
+
}
|
|
52
|
+
function _(e) {
|
|
53
|
+
let t = g(e, !0).map(([e]) => e);
|
|
54
|
+
function n(n) {
|
|
55
|
+
if (n === e.length) return {
|
|
56
|
+
line: t.length - 1,
|
|
57
|
+
character: t[t.length - 1].length
|
|
58
|
+
};
|
|
59
|
+
let r = n, i = 0;
|
|
60
|
+
for (let e of t) {
|
|
61
|
+
if (r < e.length) break;
|
|
62
|
+
r -= e.length, i++;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
line: i,
|
|
66
|
+
character: r
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function r(e, n) {
|
|
70
|
+
let r = 0;
|
|
71
|
+
for (let n = 0; n < e; n++) r += t[n].length;
|
|
72
|
+
return r += n, r;
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
lines: t,
|
|
76
|
+
indexToPos: n,
|
|
77
|
+
posToIndex: r
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
var v = "light-dark()", y = ["color", "background-color"];
|
|
81
|
+
function b(e, t) {
|
|
82
|
+
let n = 0, r = [];
|
|
83
|
+
for (let i of t) i > n && r.push({
|
|
84
|
+
...e,
|
|
85
|
+
content: e.content.slice(n, i),
|
|
86
|
+
offset: e.offset + n
|
|
87
|
+
}), n = i;
|
|
88
|
+
return n < e.content.length && r.push({
|
|
89
|
+
...e,
|
|
90
|
+
content: e.content.slice(n),
|
|
91
|
+
offset: e.offset + n
|
|
92
|
+
}), r;
|
|
93
|
+
}
|
|
94
|
+
function ee(e, t) {
|
|
95
|
+
let n = Array.from(t instanceof Set ? t : new Set(t)).sort((e, t) => e - t);
|
|
96
|
+
return n.length ? e.map((e) => e.flatMap((e) => {
|
|
97
|
+
let t = n.filter((t) => e.offset < t && t < e.offset + e.content.length).map((t) => t - e.offset).sort((e, t) => e - t);
|
|
98
|
+
return t.length ? b(e, t) : e;
|
|
99
|
+
})) : e;
|
|
100
|
+
}
|
|
101
|
+
function te(t, n, r, i, a = "css-vars") {
|
|
102
|
+
let o = {
|
|
103
|
+
content: t.content,
|
|
104
|
+
explanation: t.explanation,
|
|
105
|
+
offset: t.offset
|
|
106
|
+
}, s = n.map((e) => x(t.variants[e])), c = new Set(s.flatMap((e) => Object.keys(e))), l = {}, u = (e, t) => {
|
|
107
|
+
let i = t === "color" ? "" : t === "background-color" ? "-bg" : `-${t}`;
|
|
108
|
+
return r + n[e] + (t === "color" ? "" : i);
|
|
109
|
+
};
|
|
110
|
+
return s.forEach((t, r) => {
|
|
111
|
+
for (let o of c) {
|
|
112
|
+
let c = t[o] || "inherit";
|
|
113
|
+
if (r === 0 && i && y.includes(o)) if (i === v && s.length > 1) {
|
|
114
|
+
let t = n.findIndex((e) => e === "light"), i = n.findIndex((e) => e === "dark");
|
|
115
|
+
if (t === -1 || i === -1) throw new e("When using `defaultColor: \"light-dark()\"`, you must provide both `light` and `dark` themes");
|
|
116
|
+
let d = s[t][o] || "inherit", f = s[i][o] || "inherit";
|
|
117
|
+
l[o] = `light-dark(${d}, ${f})`, a === "css-vars" && (l[u(r, o)] = c);
|
|
118
|
+
} else l[o] = c;
|
|
119
|
+
else a === "css-vars" && (l[u(r, o)] = c);
|
|
120
|
+
}
|
|
121
|
+
}), o.htmlStyle = l, o;
|
|
122
|
+
}
|
|
123
|
+
function x(e) {
|
|
124
|
+
let t = {};
|
|
125
|
+
if (e.color && (t.color = e.color), e.bgColor && (t["background-color"] = e.bgColor), e.fontStyle) {
|
|
126
|
+
e.fontStyle & n.Italic && (t["font-style"] = "italic"), e.fontStyle & n.Bold && (t["font-weight"] = "bold");
|
|
127
|
+
let r = [];
|
|
128
|
+
e.fontStyle & n.Underline && r.push("underline"), e.fontStyle & n.Strikethrough && r.push("line-through"), r.length && (t["text-decoration"] = r.join(" "));
|
|
129
|
+
}
|
|
130
|
+
return t;
|
|
131
|
+
}
|
|
132
|
+
function S(e) {
|
|
133
|
+
return typeof e == "string" ? e : Object.entries(e).map(([e, t]) => `${e}:${t}`).join(";");
|
|
134
|
+
}
|
|
135
|
+
var ne = /* @__PURE__ */ new WeakMap();
|
|
136
|
+
function C(e, t) {
|
|
137
|
+
ne.set(e, t);
|
|
138
|
+
}
|
|
139
|
+
function w(e) {
|
|
140
|
+
return ne.get(e);
|
|
141
|
+
}
|
|
142
|
+
var T = class e {
|
|
143
|
+
_stacks = {};
|
|
144
|
+
lang;
|
|
145
|
+
get themes() {
|
|
146
|
+
return Object.keys(this._stacks);
|
|
147
|
+
}
|
|
148
|
+
get theme() {
|
|
149
|
+
return this.themes[0];
|
|
150
|
+
}
|
|
151
|
+
get _stack() {
|
|
152
|
+
return this._stacks[this.theme];
|
|
153
|
+
}
|
|
154
|
+
static initial(t, n) {
|
|
155
|
+
return new e(Object.fromEntries(l(n).map((e) => [e, r])), t);
|
|
156
|
+
}
|
|
157
|
+
constructor(...e) {
|
|
158
|
+
if (e.length === 2) {
|
|
159
|
+
let [t, n] = e;
|
|
160
|
+
this.lang = n, this._stacks = t;
|
|
161
|
+
} else {
|
|
162
|
+
let [t, n, r] = e;
|
|
163
|
+
this.lang = n, this._stacks = { [r]: t };
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
getInternalStack(e = this.theme) {
|
|
167
|
+
return this._stacks[e];
|
|
168
|
+
}
|
|
169
|
+
getScopes(e = this.theme) {
|
|
170
|
+
return re(this._stacks[e]);
|
|
171
|
+
}
|
|
172
|
+
toJSON() {
|
|
173
|
+
return {
|
|
174
|
+
lang: this.lang,
|
|
175
|
+
theme: this.theme,
|
|
176
|
+
themes: this.themes,
|
|
177
|
+
scopes: this.getScopes()
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
function re(e) {
|
|
182
|
+
let t = [], n = /* @__PURE__ */ new Set();
|
|
183
|
+
function r(e) {
|
|
184
|
+
if (n.has(e)) return;
|
|
185
|
+
n.add(e);
|
|
186
|
+
let i = e?.nameScopesList?.scopeName;
|
|
187
|
+
i && t.push(i), e.parent && r(e.parent);
|
|
188
|
+
}
|
|
189
|
+
return r(e), t;
|
|
190
|
+
}
|
|
191
|
+
function ie(t, n) {
|
|
192
|
+
if (!(t instanceof T)) throw new e("Invalid grammar state");
|
|
193
|
+
return t.getInternalStack(n);
|
|
194
|
+
}
|
|
195
|
+
function E() {
|
|
196
|
+
let t = /* @__PURE__ */ new WeakMap();
|
|
197
|
+
function n(n) {
|
|
198
|
+
if (!t.has(n.meta)) {
|
|
199
|
+
let r = function(t) {
|
|
200
|
+
if (typeof t == "number") {
|
|
201
|
+
if (t < 0 || t > n.source.length) throw new e(`Invalid decoration offset: ${t}. Code length: ${n.source.length}`);
|
|
202
|
+
return {
|
|
203
|
+
...i.indexToPos(t),
|
|
204
|
+
offset: t
|
|
205
|
+
};
|
|
206
|
+
} else {
|
|
207
|
+
let n = i.lines[t.line];
|
|
208
|
+
if (n === void 0) throw new e(`Invalid decoration position ${JSON.stringify(t)}. Lines length: ${i.lines.length}`);
|
|
209
|
+
let r = t.character;
|
|
210
|
+
if (r < 0 && (r = n.length + r), r < 0 || r > n.length) throw new e(`Invalid decoration position ${JSON.stringify(t)}. Line ${t.line} length: ${n.length}`);
|
|
211
|
+
return {
|
|
212
|
+
...t,
|
|
213
|
+
character: r,
|
|
214
|
+
offset: i.posToIndex(t.line, r)
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}, i = _(n.source), a = (n.options.decorations || []).map((e) => ({
|
|
218
|
+
...e,
|
|
219
|
+
start: r(e.start),
|
|
220
|
+
end: r(e.end)
|
|
221
|
+
}));
|
|
222
|
+
ae(a), t.set(n.meta, {
|
|
223
|
+
decorations: a,
|
|
224
|
+
converter: i,
|
|
225
|
+
source: n.source
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
return t.get(n.meta);
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
name: "shiki:decorations",
|
|
232
|
+
tokens(e) {
|
|
233
|
+
if (this.options.decorations?.length) return ee(e, n(this).decorations.flatMap((e) => [e.start.offset, e.end.offset]));
|
|
234
|
+
},
|
|
235
|
+
code(t) {
|
|
236
|
+
if (!this.options.decorations?.length) return;
|
|
237
|
+
let r = n(this), i = Array.from(t.children).filter((e) => e.type === "element" && e.tagName === "span");
|
|
238
|
+
if (i.length !== r.converter.lines.length) throw new e(`Number of lines in code element (${i.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);
|
|
239
|
+
function a(t, n, r, a) {
|
|
240
|
+
let o = i[t], c = "", l = -1, u = -1;
|
|
241
|
+
if (n === 0 && (l = 0), r === 0 && (u = 0), r === Infinity && (u = o.children.length), l === -1 || u === -1) for (let e = 0; e < o.children.length; e++) c += D(o.children[e]), l === -1 && c.length === n && (l = e + 1), u === -1 && c.length === r && (u = e + 1);
|
|
242
|
+
if (l === -1) throw new e(`Failed to find start index for decoration ${JSON.stringify(a.start)}`);
|
|
243
|
+
if (u === -1) throw new e(`Failed to find end index for decoration ${JSON.stringify(a.end)}`);
|
|
244
|
+
let d = o.children.slice(l, u);
|
|
245
|
+
if (!a.alwaysWrap && d.length === o.children.length) s(o, a, "line");
|
|
246
|
+
else if (!a.alwaysWrap && d.length === 1 && d[0].type === "element") s(d[0], a, "token");
|
|
247
|
+
else {
|
|
248
|
+
let e = {
|
|
249
|
+
type: "element",
|
|
250
|
+
tagName: "span",
|
|
251
|
+
properties: {},
|
|
252
|
+
children: d
|
|
253
|
+
};
|
|
254
|
+
s(e, a, "wrapper"), o.children.splice(l, d.length, e);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function o(e, t) {
|
|
258
|
+
i[e] = s(i[e], t, "line");
|
|
259
|
+
}
|
|
260
|
+
function s(e, t, n) {
|
|
261
|
+
let r = t.properties || {}, i = t.transform || ((e) => e);
|
|
262
|
+
return e.tagName = t.tagName || "span", e.properties = {
|
|
263
|
+
...e.properties,
|
|
264
|
+
...r,
|
|
265
|
+
class: e.properties.class
|
|
266
|
+
}, t.properties?.class && h(e, t.properties.class), e = i(e, n) || e, e;
|
|
267
|
+
}
|
|
268
|
+
let c = [], l = r.decorations.sort((e, t) => t.start.offset - e.start.offset || e.end.offset - t.end.offset);
|
|
269
|
+
for (let e of l) {
|
|
270
|
+
let { start: t, end: n } = e;
|
|
271
|
+
if (t.line === n.line) a(t.line, t.character, n.character, e);
|
|
272
|
+
else if (t.line < n.line) {
|
|
273
|
+
a(t.line, t.character, Infinity, e);
|
|
274
|
+
for (let r = t.line + 1; r < n.line; r++) c.unshift(() => o(r, e));
|
|
275
|
+
a(n.line, 0, n.character, e);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
c.forEach((e) => e());
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
function ae(t) {
|
|
283
|
+
for (let n = 0; n < t.length; n++) {
|
|
284
|
+
let r = t[n];
|
|
285
|
+
if (r.start.offset > r.end.offset) throw new e(`Invalid decoration range: ${JSON.stringify(r.start)} - ${JSON.stringify(r.end)}`);
|
|
286
|
+
for (let i = n + 1; i < t.length; i++) {
|
|
287
|
+
let n = t[i], a = r.start.offset <= n.start.offset && n.start.offset < r.end.offset, o = r.start.offset < n.end.offset && n.end.offset <= r.end.offset, s = n.start.offset <= r.start.offset && r.start.offset < n.end.offset, c = n.start.offset < r.end.offset && r.end.offset <= n.end.offset;
|
|
288
|
+
if (a || o || s || c) {
|
|
289
|
+
if (a && o || s && c || s && r.start.offset === r.end.offset || o && n.start.offset === n.end.offset) continue;
|
|
290
|
+
throw new e(`Decorations ${JSON.stringify(r.start)} and ${JSON.stringify(n.start)} intersect.`);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
function D(e) {
|
|
296
|
+
return e.type === "text" ? e.value : e.type === "element" ? e.children.map(D).join("") : "";
|
|
297
|
+
}
|
|
298
|
+
var oe = [/* @__PURE__ */ E()];
|
|
299
|
+
function O(e) {
|
|
300
|
+
let t = se(e.transformers || []);
|
|
301
|
+
return [
|
|
302
|
+
...t.pre,
|
|
303
|
+
...t.normal,
|
|
304
|
+
...t.post,
|
|
305
|
+
...oe
|
|
306
|
+
];
|
|
307
|
+
}
|
|
308
|
+
function se(e) {
|
|
309
|
+
let t = [], n = [], r = [];
|
|
310
|
+
for (let i of e) switch (i.enforce) {
|
|
311
|
+
case "pre":
|
|
312
|
+
t.push(i);
|
|
313
|
+
break;
|
|
314
|
+
case "post":
|
|
315
|
+
n.push(i);
|
|
316
|
+
break;
|
|
317
|
+
default: r.push(i);
|
|
318
|
+
}
|
|
319
|
+
return {
|
|
320
|
+
pre: t,
|
|
321
|
+
post: n,
|
|
322
|
+
normal: r
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
var k = [
|
|
326
|
+
"black",
|
|
327
|
+
"red",
|
|
328
|
+
"green",
|
|
329
|
+
"yellow",
|
|
330
|
+
"blue",
|
|
331
|
+
"magenta",
|
|
332
|
+
"cyan",
|
|
333
|
+
"white",
|
|
334
|
+
"brightBlack",
|
|
335
|
+
"brightRed",
|
|
336
|
+
"brightGreen",
|
|
337
|
+
"brightYellow",
|
|
338
|
+
"brightBlue",
|
|
339
|
+
"brightMagenta",
|
|
340
|
+
"brightCyan",
|
|
341
|
+
"brightWhite"
|
|
342
|
+
], A = {
|
|
343
|
+
1: "bold",
|
|
344
|
+
2: "dim",
|
|
345
|
+
3: "italic",
|
|
346
|
+
4: "underline",
|
|
347
|
+
7: "reverse",
|
|
348
|
+
8: "hidden",
|
|
349
|
+
9: "strikethrough"
|
|
350
|
+
};
|
|
351
|
+
function ce(e, t) {
|
|
352
|
+
let n = e.indexOf("\x1B", t);
|
|
353
|
+
if (n !== -1 && e[n + 1] === "[") {
|
|
354
|
+
let t = e.indexOf("m", n);
|
|
355
|
+
if (t !== -1) return {
|
|
356
|
+
sequence: e.substring(n + 2, t).split(";"),
|
|
357
|
+
startPosition: n,
|
|
358
|
+
position: t + 1
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
return { position: e.length };
|
|
362
|
+
}
|
|
363
|
+
function j(e) {
|
|
364
|
+
let t = e.shift();
|
|
365
|
+
if (t === "2") {
|
|
366
|
+
let t = e.splice(0, 3).map((e) => Number.parseInt(e));
|
|
367
|
+
return t.length !== 3 || t.some((e) => Number.isNaN(e)) ? void 0 : {
|
|
368
|
+
type: "rgb",
|
|
369
|
+
rgb: t
|
|
370
|
+
};
|
|
371
|
+
} else if (t === "5") {
|
|
372
|
+
let t = e.shift();
|
|
373
|
+
if (t) return {
|
|
374
|
+
type: "table",
|
|
375
|
+
index: Number(t)
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
function le(e) {
|
|
380
|
+
let t = [];
|
|
381
|
+
for (; e.length > 0;) {
|
|
382
|
+
let n = e.shift();
|
|
383
|
+
if (!n) continue;
|
|
384
|
+
let r = Number.parseInt(n);
|
|
385
|
+
if (!Number.isNaN(r)) if (r === 0) t.push({ type: "resetAll" });
|
|
386
|
+
else if (r <= 9) A[r] && t.push({
|
|
387
|
+
type: "setDecoration",
|
|
388
|
+
value: A[r]
|
|
389
|
+
});
|
|
390
|
+
else if (r <= 29) {
|
|
391
|
+
let e = A[r - 20];
|
|
392
|
+
e && (t.push({
|
|
393
|
+
type: "resetDecoration",
|
|
394
|
+
value: e
|
|
395
|
+
}), e === "dim" && t.push({
|
|
396
|
+
type: "resetDecoration",
|
|
397
|
+
value: "bold"
|
|
398
|
+
}));
|
|
399
|
+
} else if (r <= 37) t.push({
|
|
400
|
+
type: "setForegroundColor",
|
|
401
|
+
value: {
|
|
402
|
+
type: "named",
|
|
403
|
+
name: k[r - 30]
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
else if (r === 38) {
|
|
407
|
+
let n = j(e);
|
|
408
|
+
n && t.push({
|
|
409
|
+
type: "setForegroundColor",
|
|
410
|
+
value: n
|
|
411
|
+
});
|
|
412
|
+
} else if (r === 39) t.push({ type: "resetForegroundColor" });
|
|
413
|
+
else if (r <= 47) t.push({
|
|
414
|
+
type: "setBackgroundColor",
|
|
415
|
+
value: {
|
|
416
|
+
type: "named",
|
|
417
|
+
name: k[r - 40]
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
else if (r === 48) {
|
|
421
|
+
let n = j(e);
|
|
422
|
+
n && t.push({
|
|
423
|
+
type: "setBackgroundColor",
|
|
424
|
+
value: n
|
|
425
|
+
});
|
|
426
|
+
} else r === 49 ? t.push({ type: "resetBackgroundColor" }) : r === 53 ? t.push({
|
|
427
|
+
type: "setDecoration",
|
|
428
|
+
value: "overline"
|
|
429
|
+
}) : r === 55 ? t.push({
|
|
430
|
+
type: "resetDecoration",
|
|
431
|
+
value: "overline"
|
|
432
|
+
}) : r >= 90 && r <= 97 ? t.push({
|
|
433
|
+
type: "setForegroundColor",
|
|
434
|
+
value: {
|
|
435
|
+
type: "named",
|
|
436
|
+
name: k[r - 90 + 8]
|
|
437
|
+
}
|
|
438
|
+
}) : r >= 100 && r <= 107 && t.push({
|
|
439
|
+
type: "setBackgroundColor",
|
|
440
|
+
value: {
|
|
441
|
+
type: "named",
|
|
442
|
+
name: k[r - 100 + 8]
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
return t;
|
|
447
|
+
}
|
|
448
|
+
function ue() {
|
|
449
|
+
let e = null, t = null, n = /* @__PURE__ */ new Set();
|
|
450
|
+
return { parse(r) {
|
|
451
|
+
let i = [], a = 0;
|
|
452
|
+
do {
|
|
453
|
+
let o = ce(r, a), s = o.sequence ? r.substring(a, o.startPosition) : r.substring(a);
|
|
454
|
+
if (s.length > 0 && i.push({
|
|
455
|
+
value: s,
|
|
456
|
+
foreground: e,
|
|
457
|
+
background: t,
|
|
458
|
+
decorations: new Set(n)
|
|
459
|
+
}), o.sequence) {
|
|
460
|
+
let r = le(o.sequence);
|
|
461
|
+
for (let i of r) i.type === "resetAll" ? (e = null, t = null, n.clear()) : i.type === "resetForegroundColor" ? e = null : i.type === "resetBackgroundColor" ? t = null : i.type === "resetDecoration" && n.delete(i.value);
|
|
462
|
+
for (let i of r) i.type === "setForegroundColor" ? e = i.value : i.type === "setBackgroundColor" ? t = i.value : i.type === "setDecoration" && n.add(i.value);
|
|
463
|
+
}
|
|
464
|
+
a = o.position;
|
|
465
|
+
} while (a < r.length);
|
|
466
|
+
return i;
|
|
467
|
+
} };
|
|
468
|
+
}
|
|
469
|
+
var de = {
|
|
470
|
+
black: "#000000",
|
|
471
|
+
red: "#bb0000",
|
|
472
|
+
green: "#00bb00",
|
|
473
|
+
yellow: "#bbbb00",
|
|
474
|
+
blue: "#0000bb",
|
|
475
|
+
magenta: "#ff00ff",
|
|
476
|
+
cyan: "#00bbbb",
|
|
477
|
+
white: "#eeeeee",
|
|
478
|
+
brightBlack: "#555555",
|
|
479
|
+
brightRed: "#ff5555",
|
|
480
|
+
brightGreen: "#00ff00",
|
|
481
|
+
brightYellow: "#ffff55",
|
|
482
|
+
brightBlue: "#5555ff",
|
|
483
|
+
brightMagenta: "#ff55ff",
|
|
484
|
+
brightCyan: "#55ffff",
|
|
485
|
+
brightWhite: "#ffffff"
|
|
486
|
+
};
|
|
487
|
+
function fe(e = de) {
|
|
488
|
+
function t(t) {
|
|
489
|
+
return e[t];
|
|
490
|
+
}
|
|
491
|
+
function n(e) {
|
|
492
|
+
return `#${e.map((e) => Math.max(0, Math.min(e, 255)).toString(16).padStart(2, "0")).join("")}`;
|
|
493
|
+
}
|
|
494
|
+
let r;
|
|
495
|
+
function i() {
|
|
496
|
+
if (r) return r;
|
|
497
|
+
r = [];
|
|
498
|
+
for (let e = 0; e < k.length; e++) r.push(t(k[e]));
|
|
499
|
+
let e = [
|
|
500
|
+
0,
|
|
501
|
+
95,
|
|
502
|
+
135,
|
|
503
|
+
175,
|
|
504
|
+
215,
|
|
505
|
+
255
|
|
506
|
+
];
|
|
507
|
+
for (let t = 0; t < 6; t++) for (let i = 0; i < 6; i++) for (let a = 0; a < 6; a++) r.push(n([
|
|
508
|
+
e[t],
|
|
509
|
+
e[i],
|
|
510
|
+
e[a]
|
|
511
|
+
]));
|
|
512
|
+
let i = 8;
|
|
513
|
+
for (let e = 0; e < 24; e++, i += 10) r.push(n([
|
|
514
|
+
i,
|
|
515
|
+
i,
|
|
516
|
+
i
|
|
517
|
+
]));
|
|
518
|
+
return r;
|
|
519
|
+
}
|
|
520
|
+
function a(e) {
|
|
521
|
+
return i()[e];
|
|
522
|
+
}
|
|
523
|
+
function o(e) {
|
|
524
|
+
switch (e.type) {
|
|
525
|
+
case "named": return t(e.name);
|
|
526
|
+
case "rgb": return n(e.rgb);
|
|
527
|
+
case "table": return a(e.index);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
return { value: o };
|
|
531
|
+
}
|
|
532
|
+
var pe = {
|
|
533
|
+
black: "#000000",
|
|
534
|
+
red: "#cd3131",
|
|
535
|
+
green: "#0DBC79",
|
|
536
|
+
yellow: "#E5E510",
|
|
537
|
+
blue: "#2472C8",
|
|
538
|
+
magenta: "#BC3FBC",
|
|
539
|
+
cyan: "#11A8CD",
|
|
540
|
+
white: "#E5E5E5",
|
|
541
|
+
brightBlack: "#666666",
|
|
542
|
+
brightRed: "#F14C4C",
|
|
543
|
+
brightGreen: "#23D18B",
|
|
544
|
+
brightYellow: "#F5F543",
|
|
545
|
+
brightBlue: "#3B8EEA",
|
|
546
|
+
brightMagenta: "#D670D6",
|
|
547
|
+
brightCyan: "#29B8DB",
|
|
548
|
+
brightWhite: "#FFFFFF"
|
|
549
|
+
};
|
|
550
|
+
function M(e, t, r) {
|
|
551
|
+
let i = s(e, r), a = g(t), o = fe(Object.fromEntries(k.map((t) => {
|
|
552
|
+
let n = `terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;
|
|
553
|
+
return [t, e.colors?.[n] || pe[t]];
|
|
554
|
+
}))), l = ue();
|
|
555
|
+
return a.map((t) => l.parse(t[0]).map((r) => {
|
|
556
|
+
let a, s;
|
|
557
|
+
r.decorations.has("reverse") ? (a = r.background ? o.value(r.background) : e.bg, s = r.foreground ? o.value(r.foreground) : e.fg) : (a = r.foreground ? o.value(r.foreground) : e.fg, s = r.background ? o.value(r.background) : void 0), a = c(a, i), s = c(s, i), r.decorations.has("dim") && (a = me(a));
|
|
558
|
+
let l = n.None;
|
|
559
|
+
return r.decorations.has("bold") && (l |= n.Bold), r.decorations.has("italic") && (l |= n.Italic), r.decorations.has("underline") && (l |= n.Underline), r.decorations.has("strikethrough") && (l |= n.Strikethrough), {
|
|
560
|
+
content: r.value,
|
|
561
|
+
offset: t[1],
|
|
562
|
+
color: a,
|
|
563
|
+
bgColor: s,
|
|
564
|
+
fontStyle: l
|
|
565
|
+
};
|
|
566
|
+
}));
|
|
567
|
+
}
|
|
568
|
+
function me(e) {
|
|
569
|
+
let t = e.match(/#([0-9a-f]{3,8})/i);
|
|
570
|
+
if (t) {
|
|
571
|
+
let e = t[1];
|
|
572
|
+
if (e.length === 8) {
|
|
573
|
+
let t = Math.round(Number.parseInt(e.slice(6, 8), 16) / 2).toString(16).padStart(2, "0");
|
|
574
|
+
return `#${e.slice(0, 6)}${t}`;
|
|
575
|
+
} else if (e.length === 6) return `#${e}80`;
|
|
576
|
+
else if (e.length === 4) {
|
|
577
|
+
let t = e[0], n = e[1], r = e[2], i = e[3];
|
|
578
|
+
return `#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`, 16) / 2).toString(16).padStart(2, "0")}`;
|
|
579
|
+
} else if (e.length === 3) {
|
|
580
|
+
let t = e[0], n = e[1], r = e[2];
|
|
581
|
+
return `#${t}${t}${n}${n}${r}${r}80`;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
let n = e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);
|
|
585
|
+
return n ? `var(${n[1]}-dim)` : e;
|
|
586
|
+
}
|
|
587
|
+
function N(t, n, r = {}) {
|
|
588
|
+
let { theme: i = t.getLoadedThemes()[0] } = r, a = t.resolveLangAlias(r.lang || "text");
|
|
589
|
+
if (d(a) || p(i)) return g(n).map((e) => [{
|
|
590
|
+
content: e[0],
|
|
591
|
+
offset: e[1]
|
|
592
|
+
}]);
|
|
593
|
+
let { theme: o, colorMap: s } = t.setTheme(i);
|
|
594
|
+
if (a === "ansi") return M(o, n, r);
|
|
595
|
+
let c = t.getLanguage(r.lang || "text");
|
|
596
|
+
if (r.grammarState) {
|
|
597
|
+
if (r.grammarState.lang !== c.name) throw new e(`Grammar state language "${r.grammarState.lang}" does not match highlight language "${c.name}"`);
|
|
598
|
+
if (!r.grammarState.themes.includes(o.name)) throw new e(`Grammar state themes "${r.grammarState.themes}" do not contain highlight theme "${o.name}"`);
|
|
599
|
+
}
|
|
600
|
+
return P(n, c, o, s, r);
|
|
601
|
+
}
|
|
602
|
+
function he(...t) {
|
|
603
|
+
if (t.length === 2) return w(t[1]);
|
|
604
|
+
let [n, r, i = {}] = t, { lang: a = "text", theme: o = n.getLoadedThemes()[0] } = i;
|
|
605
|
+
if (d(a) || p(o)) throw new e("Plain language does not have grammar state");
|
|
606
|
+
if (a === "ansi") throw new e("ANSI language does not have grammar state");
|
|
607
|
+
let { theme: s, colorMap: c } = n.setTheme(o), l = n.getLanguage(a);
|
|
608
|
+
return new T(F(r, l, s, c, i).stateStack, l.name, s.name);
|
|
609
|
+
}
|
|
610
|
+
function P(e, t, n, r, i) {
|
|
611
|
+
let a = F(e, t, n, r, i), o = new T(a.stateStack, t.name, n.name);
|
|
612
|
+
return C(a.tokens, o), a.tokens;
|
|
613
|
+
}
|
|
614
|
+
function F(e, n, i, a, o) {
|
|
615
|
+
let l = s(i, o), { tokenizeMaxLineLength: u = 0, tokenizeTimeLimit: d = 500 } = o, f = g(e), p = o.grammarState ? ie(o.grammarState, i.name) ?? r : o.grammarContextCode == null ? r : F(o.grammarContextCode, n, i, a, {
|
|
616
|
+
...o,
|
|
617
|
+
grammarState: void 0,
|
|
618
|
+
grammarContextCode: void 0
|
|
619
|
+
}).stateStack, m = [], h = [];
|
|
620
|
+
for (let e = 0, r = f.length; e < r; e++) {
|
|
621
|
+
let [r, s] = f[e];
|
|
622
|
+
if (r === "") {
|
|
623
|
+
m = [], h.push([]);
|
|
624
|
+
continue;
|
|
625
|
+
}
|
|
626
|
+
if (u > 0 && r.length >= u) {
|
|
627
|
+
m = [], h.push([{
|
|
628
|
+
content: r,
|
|
629
|
+
offset: s,
|
|
630
|
+
color: "",
|
|
631
|
+
fontStyle: 0
|
|
632
|
+
}]);
|
|
633
|
+
continue;
|
|
634
|
+
}
|
|
635
|
+
let g, _, v;
|
|
636
|
+
o.includeExplanation && (g = n.tokenizeLine(r, p, d), _ = g.tokens, v = 0);
|
|
637
|
+
let y = n.tokenizeLine2(r, p, d), b = y.tokens.length / 2;
|
|
638
|
+
for (let e = 0; e < b; e++) {
|
|
639
|
+
let n = y.tokens[2 * e], u = e + 1 < b ? y.tokens[2 * e + 2] : r.length;
|
|
640
|
+
if (n === u) continue;
|
|
641
|
+
let d = y.tokens[2 * e + 1], f = c(a[t.getForeground(d)], l), p = t.getFontStyle(d), h = {
|
|
642
|
+
content: r.substring(n, u),
|
|
643
|
+
offset: s + n,
|
|
644
|
+
color: f,
|
|
645
|
+
fontStyle: p
|
|
646
|
+
};
|
|
647
|
+
if (o.includeExplanation) {
|
|
648
|
+
let e = [];
|
|
649
|
+
if (o.includeExplanation !== "scopeName") for (let t of i.settings) {
|
|
650
|
+
let n;
|
|
651
|
+
switch (typeof t.scope) {
|
|
652
|
+
case "string":
|
|
653
|
+
n = t.scope.split(/,/).map((e) => e.trim());
|
|
654
|
+
break;
|
|
655
|
+
case "object":
|
|
656
|
+
n = t.scope;
|
|
657
|
+
break;
|
|
658
|
+
default: continue;
|
|
659
|
+
}
|
|
660
|
+
e.push({
|
|
661
|
+
settings: t,
|
|
662
|
+
selectors: n.map((e) => e.split(/ /))
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
h.explanation = [];
|
|
666
|
+
let t = 0;
|
|
667
|
+
for (; n + t < u;) {
|
|
668
|
+
let n = _[v], i = r.substring(n.startIndex, n.endIndex);
|
|
669
|
+
t += i.length, h.explanation.push({
|
|
670
|
+
content: i,
|
|
671
|
+
scopes: o.includeExplanation === "scopeName" ? ge(n.scopes) : _e(e, n.scopes)
|
|
672
|
+
}), v += 1;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
m.push(h);
|
|
676
|
+
}
|
|
677
|
+
h.push(m), m = [], p = y.ruleStack;
|
|
678
|
+
}
|
|
679
|
+
return {
|
|
680
|
+
tokens: h,
|
|
681
|
+
stateStack: p
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
function ge(e) {
|
|
685
|
+
return e.map((e) => ({ scopeName: e }));
|
|
686
|
+
}
|
|
687
|
+
function _e(e, t) {
|
|
688
|
+
let n = [];
|
|
689
|
+
for (let r = 0, i = t.length; r < i; r++) {
|
|
690
|
+
let i = t[r];
|
|
691
|
+
n[r] = {
|
|
692
|
+
scopeName: i,
|
|
693
|
+
themeMatches: ye(e, i, t.slice(0, r))
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
return n;
|
|
697
|
+
}
|
|
698
|
+
function I(e, t) {
|
|
699
|
+
return e === t || t.substring(0, e.length) === e && t[e.length] === ".";
|
|
700
|
+
}
|
|
701
|
+
function ve(e, t, n) {
|
|
702
|
+
if (!I(e[e.length - 1], t)) return !1;
|
|
703
|
+
let r = e.length - 2, i = n.length - 1;
|
|
704
|
+
for (; r >= 0 && i >= 0;) I(e[r], n[i]) && --r, --i;
|
|
705
|
+
return r === -1;
|
|
706
|
+
}
|
|
707
|
+
function ye(e, t, n) {
|
|
708
|
+
let r = [];
|
|
709
|
+
for (let { selectors: i, settings: a } of e) for (let e of i) if (ve(e, t, n)) {
|
|
710
|
+
r.push(a);
|
|
711
|
+
break;
|
|
712
|
+
}
|
|
713
|
+
return r;
|
|
714
|
+
}
|
|
715
|
+
function L(e, t, n) {
|
|
716
|
+
let r = Object.entries(n.themes).filter((e) => e[1]).map((e) => ({
|
|
717
|
+
color: e[0],
|
|
718
|
+
theme: e[1]
|
|
719
|
+
})), i = r.map((r) => {
|
|
720
|
+
let i = N(e, t, {
|
|
721
|
+
...n,
|
|
722
|
+
theme: r.theme
|
|
723
|
+
});
|
|
724
|
+
return {
|
|
725
|
+
tokens: i,
|
|
726
|
+
state: w(i),
|
|
727
|
+
theme: typeof r.theme == "string" ? r.theme : r.theme.name
|
|
728
|
+
};
|
|
729
|
+
}), a = be(...i.map((e) => e.tokens)), o = a[0].map((e, t) => e.map((e, i) => {
|
|
730
|
+
let o = {
|
|
731
|
+
content: e.content,
|
|
732
|
+
variants: {},
|
|
733
|
+
offset: e.offset
|
|
734
|
+
};
|
|
735
|
+
return "includeExplanation" in n && n.includeExplanation && (o.explanation = e.explanation), a.forEach((e, n) => {
|
|
736
|
+
let { content: a, explanation: s, offset: c, ...l } = e[t][i];
|
|
737
|
+
o.variants[r[n].color] = l;
|
|
738
|
+
}), o;
|
|
739
|
+
})), s = i[0].state ? new T(Object.fromEntries(i.map((e) => [e.theme, e.state?.getInternalStack(e.theme)])), i[0].state.lang) : void 0;
|
|
740
|
+
return s && C(o, s), o;
|
|
741
|
+
}
|
|
742
|
+
function be(...e) {
|
|
743
|
+
let t = e.map(() => []), n = e.length;
|
|
744
|
+
for (let r = 0; r < e[0].length; r++) {
|
|
745
|
+
let i = e.map((e) => e[r]), a = t.map(() => []);
|
|
746
|
+
t.forEach((e, t) => e.push(a[t]));
|
|
747
|
+
let o = i.map(() => 0), s = i.map((e) => e[0]);
|
|
748
|
+
for (; s.every((e) => e);) {
|
|
749
|
+
let e = Math.min(...s.map((e) => e.content.length));
|
|
750
|
+
for (let t = 0; t < n; t++) {
|
|
751
|
+
let n = s[t];
|
|
752
|
+
n.content.length === e ? (a[t].push(n), o[t] += 1, s[t] = i[t][o[t]]) : (a[t].push({
|
|
753
|
+
...n,
|
|
754
|
+
content: n.content.slice(0, e)
|
|
755
|
+
}), s[t] = {
|
|
756
|
+
...n,
|
|
757
|
+
content: n.content.slice(e),
|
|
758
|
+
offset: n.offset + e
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
return t;
|
|
764
|
+
}
|
|
765
|
+
function R(t, n, r) {
|
|
766
|
+
let i, a, o, l, u, d;
|
|
767
|
+
if ("themes" in r) {
|
|
768
|
+
let { defaultColor: c = "light", cssVariablePrefix: f = "--shiki-", colorsRendering: p = "css-vars" } = r, m = Object.entries(r.themes).filter((e) => e[1]).map((e) => ({
|
|
769
|
+
color: e[0],
|
|
770
|
+
theme: e[1]
|
|
771
|
+
})).sort((e, t) => e.color === c ? -1 : +(t.color === c));
|
|
772
|
+
if (m.length === 0) throw new e("`themes` option must not be empty");
|
|
773
|
+
let h = L(t, n, r);
|
|
774
|
+
if (d = w(h), c && v !== c && !m.find((e) => e.color === c)) throw new e(`\`themes\` option must contain the defaultColor key \`${c}\``);
|
|
775
|
+
let g = m.map((e) => t.getTheme(e.theme)), _ = m.map((e) => e.color);
|
|
776
|
+
o = h.map((e) => e.map((e) => te(e, _, f, c, p))), d && C(o, d);
|
|
777
|
+
let y = m.map((e) => s(e.theme, r));
|
|
778
|
+
a = z(m, g, y, f, c, "fg", p), i = z(m, g, y, f, c, "bg", p), l = `shiki-themes ${g.map((e) => e.name).join(" ")}`, u = c ? void 0 : [a, i].join(";");
|
|
779
|
+
} else if ("theme" in r) {
|
|
780
|
+
let e = s(r.theme, r);
|
|
781
|
+
o = N(t, n, r);
|
|
782
|
+
let u = t.getTheme(r.theme);
|
|
783
|
+
i = c(u.bg, e), a = c(u.fg, e), l = u.name, d = w(o);
|
|
784
|
+
} else throw new e("Invalid options, either `theme` or `themes` must be provided");
|
|
785
|
+
return {
|
|
786
|
+
tokens: o,
|
|
787
|
+
fg: a,
|
|
788
|
+
bg: i,
|
|
789
|
+
themeName: l,
|
|
790
|
+
rootStyle: u,
|
|
791
|
+
grammarState: d
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
function z(t, n, r, i, a, o, s) {
|
|
795
|
+
return t.map((l, u) => {
|
|
796
|
+
let d = c(n[u][o], r[u]) || "inherit", f = `${i + l.color}${o === "bg" ? "-bg" : ""}:${d}`;
|
|
797
|
+
if (u === 0 && a) {
|
|
798
|
+
if (a === v && t.length > 1) {
|
|
799
|
+
let i = t.findIndex((e) => e.color === "light"), a = t.findIndex((e) => e.color === "dark");
|
|
800
|
+
if (i === -1 || a === -1) throw new e("When using `defaultColor: \"light-dark()\"`, you must provide both `light` and `dark` themes");
|
|
801
|
+
return `light-dark(${c(n[i][o], r[i]) || "inherit"}, ${c(n[a][o], r[a]) || "inherit"});${f}`;
|
|
802
|
+
}
|
|
803
|
+
return d;
|
|
804
|
+
}
|
|
805
|
+
return s === "css-vars" ? f : null;
|
|
806
|
+
}).filter((e) => !!e).join(";");
|
|
807
|
+
}
|
|
808
|
+
function B(e, t, n, r = {
|
|
809
|
+
meta: {},
|
|
810
|
+
options: n,
|
|
811
|
+
codeToHast: (t, n) => B(e, t, n),
|
|
812
|
+
codeToTokens: (t, n) => R(e, t, n)
|
|
813
|
+
}) {
|
|
814
|
+
let i = t;
|
|
815
|
+
for (let e of O(n)) i = e.preprocess?.call(r, i, n) || i;
|
|
816
|
+
let { tokens: a, fg: o, bg: s, themeName: c, rootStyle: l, grammarState: u } = R(e, i, n), { mergeWhitespaces: d = !0, mergeSameStyleTokens: f = !1 } = n;
|
|
817
|
+
d === !0 ? a = xe(a) : d === "never" && (a = Se(a)), f && (a = Ce(a));
|
|
818
|
+
let p = {
|
|
819
|
+
...r,
|
|
820
|
+
get source() {
|
|
821
|
+
return i;
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
for (let e of O(n)) a = e.tokens?.call(p, a) || a;
|
|
825
|
+
return V(a, {
|
|
826
|
+
...n,
|
|
827
|
+
fg: o,
|
|
828
|
+
bg: s,
|
|
829
|
+
themeName: c,
|
|
830
|
+
rootStyle: n.rootStyle === !1 ? !1 : n.rootStyle ?? l
|
|
831
|
+
}, p, u);
|
|
832
|
+
}
|
|
833
|
+
function V(e, t, n, r = w(e)) {
|
|
834
|
+
let i = O(t), a = [], o = {
|
|
835
|
+
type: "root",
|
|
836
|
+
children: []
|
|
837
|
+
}, { structure: s = "classic", tabindex: c = "0" } = t, l = { class: `shiki ${t.themeName || ""}` };
|
|
838
|
+
t.rootStyle !== !1 && (t.rootStyle == null ? l.style = `background-color:${t.bg};color:${t.fg}` : l.style = t.rootStyle), c !== !1 && c != null && (l.tabindex = c.toString());
|
|
839
|
+
for (let [e, n] of Object.entries(t.meta || {})) e.startsWith("_") || (l[e] = n);
|
|
840
|
+
let u = {
|
|
841
|
+
type: "element",
|
|
842
|
+
tagName: "pre",
|
|
843
|
+
properties: l,
|
|
844
|
+
children: [],
|
|
845
|
+
data: t.data
|
|
846
|
+
}, d = {
|
|
847
|
+
type: "element",
|
|
848
|
+
tagName: "code",
|
|
849
|
+
properties: {},
|
|
850
|
+
children: a
|
|
851
|
+
}, f = [], p = {
|
|
852
|
+
...n,
|
|
853
|
+
structure: s,
|
|
854
|
+
addClassToHast: h,
|
|
855
|
+
get source() {
|
|
856
|
+
return n.source;
|
|
857
|
+
},
|
|
858
|
+
get tokens() {
|
|
859
|
+
return e;
|
|
860
|
+
},
|
|
861
|
+
get options() {
|
|
862
|
+
return t;
|
|
863
|
+
},
|
|
864
|
+
get root() {
|
|
865
|
+
return o;
|
|
866
|
+
},
|
|
867
|
+
get pre() {
|
|
868
|
+
return u;
|
|
869
|
+
},
|
|
870
|
+
get code() {
|
|
871
|
+
return d;
|
|
872
|
+
},
|
|
873
|
+
get lines() {
|
|
874
|
+
return f;
|
|
875
|
+
}
|
|
876
|
+
};
|
|
877
|
+
if (e.forEach((e, t) => {
|
|
878
|
+
t && (s === "inline" ? o.children.push({
|
|
879
|
+
type: "element",
|
|
880
|
+
tagName: "br",
|
|
881
|
+
properties: {},
|
|
882
|
+
children: []
|
|
883
|
+
}) : s === "classic" && a.push({
|
|
884
|
+
type: "text",
|
|
885
|
+
value: "\n"
|
|
886
|
+
}));
|
|
887
|
+
let n = {
|
|
888
|
+
type: "element",
|
|
889
|
+
tagName: "span",
|
|
890
|
+
properties: { class: "line" },
|
|
891
|
+
children: []
|
|
892
|
+
}, r = 0;
|
|
893
|
+
for (let a of e) {
|
|
894
|
+
let e = {
|
|
895
|
+
type: "element",
|
|
896
|
+
tagName: "span",
|
|
897
|
+
properties: { ...a.htmlAttrs },
|
|
898
|
+
children: [{
|
|
899
|
+
type: "text",
|
|
900
|
+
value: a.content
|
|
901
|
+
}]
|
|
902
|
+
}, c = S(a.htmlStyle || x(a));
|
|
903
|
+
c && (e.properties.style = c);
|
|
904
|
+
for (let o of i) e = o?.span?.call(p, e, t + 1, r, n, a) || e;
|
|
905
|
+
s === "inline" ? o.children.push(e) : s === "classic" && n.children.push(e), r += a.content.length;
|
|
906
|
+
}
|
|
907
|
+
if (s === "classic") {
|
|
908
|
+
for (let e of i) n = e?.line?.call(p, n, t + 1) || n;
|
|
909
|
+
f.push(n), a.push(n);
|
|
910
|
+
} else s === "inline" && f.push(n);
|
|
911
|
+
}), s === "classic") {
|
|
912
|
+
for (let e of i) d = e?.code?.call(p, d) || d;
|
|
913
|
+
u.children.push(d);
|
|
914
|
+
for (let e of i) u = e?.pre?.call(p, u) || u;
|
|
915
|
+
o.children.push(u);
|
|
916
|
+
} else if (s === "inline") {
|
|
917
|
+
let e = [], t = {
|
|
918
|
+
type: "element",
|
|
919
|
+
tagName: "span",
|
|
920
|
+
properties: { class: "line" },
|
|
921
|
+
children: []
|
|
922
|
+
};
|
|
923
|
+
for (let n of o.children) n.type === "element" && n.tagName === "br" ? (e.push(t), t = {
|
|
924
|
+
type: "element",
|
|
925
|
+
tagName: "span",
|
|
926
|
+
properties: { class: "line" },
|
|
927
|
+
children: []
|
|
928
|
+
}) : (n.type === "element" || n.type === "text") && t.children.push(n);
|
|
929
|
+
e.push(t);
|
|
930
|
+
let n = {
|
|
931
|
+
type: "element",
|
|
932
|
+
tagName: "code",
|
|
933
|
+
properties: {},
|
|
934
|
+
children: e
|
|
935
|
+
};
|
|
936
|
+
for (let e of i) n = e?.code?.call(p, n) || n;
|
|
937
|
+
o.children = [];
|
|
938
|
+
for (let e = 0; e < n.children.length; e++) {
|
|
939
|
+
e > 0 && o.children.push({
|
|
940
|
+
type: "element",
|
|
941
|
+
tagName: "br",
|
|
942
|
+
properties: {},
|
|
943
|
+
children: []
|
|
944
|
+
});
|
|
945
|
+
let t = n.children[e];
|
|
946
|
+
t.type === "element" && o.children.push(...t.children);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
let m = o;
|
|
950
|
+
for (let e of i) m = e?.root?.call(p, m) || m;
|
|
951
|
+
return r && C(m, r), m;
|
|
952
|
+
}
|
|
953
|
+
function xe(e) {
|
|
954
|
+
return e.map((e) => {
|
|
955
|
+
let t = [], r = "", i;
|
|
956
|
+
return e.forEach((a, o) => {
|
|
957
|
+
let s = !(a.fontStyle && (a.fontStyle & n.Underline || a.fontStyle & n.Strikethrough));
|
|
958
|
+
s && a.content.match(/^\s+$/) && e[o + 1] ? (i === void 0 && (i = a.offset), r += a.content) : r ? (s ? t.push({
|
|
959
|
+
...a,
|
|
960
|
+
offset: i,
|
|
961
|
+
content: r + a.content
|
|
962
|
+
}) : t.push({
|
|
963
|
+
content: r,
|
|
964
|
+
offset: i
|
|
965
|
+
}, a), i = void 0, r = "") : t.push(a);
|
|
966
|
+
}), t;
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
function Se(e) {
|
|
970
|
+
return e.map((e) => e.flatMap((e) => {
|
|
971
|
+
if (e.content.match(/^\s+$/)) return e;
|
|
972
|
+
let t = e.content.match(/^(\s*)(.*?)(\s*)$/);
|
|
973
|
+
if (!t) return e;
|
|
974
|
+
let [, n, r, i] = t;
|
|
975
|
+
if (!n && !i) return e;
|
|
976
|
+
let a = [{
|
|
977
|
+
...e,
|
|
978
|
+
offset: e.offset + n.length,
|
|
979
|
+
content: r
|
|
980
|
+
}];
|
|
981
|
+
return n && a.unshift({
|
|
982
|
+
content: n,
|
|
983
|
+
offset: e.offset
|
|
984
|
+
}), i && a.push({
|
|
985
|
+
content: i,
|
|
986
|
+
offset: e.offset + n.length + r.length
|
|
987
|
+
}), a;
|
|
988
|
+
}));
|
|
989
|
+
}
|
|
990
|
+
function Ce(e) {
|
|
991
|
+
return e.map((e) => {
|
|
992
|
+
let t = [];
|
|
993
|
+
for (let r of e) {
|
|
994
|
+
if (t.length === 0) {
|
|
995
|
+
t.push({ ...r });
|
|
996
|
+
continue;
|
|
997
|
+
}
|
|
998
|
+
let e = t[t.length - 1], i = S(e.htmlStyle || x(e)), a = S(r.htmlStyle || x(r)), o = e.fontStyle && (e.fontStyle & n.Underline || e.fontStyle & n.Strikethrough), s = r.fontStyle && (r.fontStyle & n.Underline || r.fontStyle & n.Strikethrough);
|
|
999
|
+
!o && !s && i === a ? e.content += r.content : t.push({ ...r });
|
|
1000
|
+
}
|
|
1001
|
+
return t;
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
var H = o;
|
|
1005
|
+
function U(e, t, n) {
|
|
1006
|
+
let r = {
|
|
1007
|
+
meta: {},
|
|
1008
|
+
options: n,
|
|
1009
|
+
codeToHast: (t, n) => B(e, t, n),
|
|
1010
|
+
codeToTokens: (t, n) => R(e, t, n)
|
|
1011
|
+
}, i = H(B(e, t, n, r));
|
|
1012
|
+
for (let e of O(n)) i = e.postprocess?.call(r, i, n) || i;
|
|
1013
|
+
return i;
|
|
1014
|
+
}
|
|
1015
|
+
var W = {
|
|
1016
|
+
light: "#333333",
|
|
1017
|
+
dark: "#bbbbbb"
|
|
1018
|
+
}, G = {
|
|
1019
|
+
light: "#fffffe",
|
|
1020
|
+
dark: "#1e1e1e"
|
|
1021
|
+
}, K = "__shiki_resolved";
|
|
1022
|
+
function q(e) {
|
|
1023
|
+
if (e?.[K]) return e;
|
|
1024
|
+
let t = { ...e };
|
|
1025
|
+
t.tokenColors && !t.settings && (t.settings = t.tokenColors, delete t.tokenColors), t.type ||= "dark", t.colorReplacements = { ...t.colorReplacements }, t.settings ||= [];
|
|
1026
|
+
let { bg: n, fg: r } = t;
|
|
1027
|
+
if (!n || !r) {
|
|
1028
|
+
let e = t.settings ? t.settings.find((e) => !e.name && !e.scope) : void 0;
|
|
1029
|
+
e?.settings?.foreground && (r = e.settings.foreground), e?.settings?.background && (n = e.settings.background), !r && t?.colors?.["editor.foreground"] && (r = t.colors["editor.foreground"]), !n && t?.colors?.["editor.background"] && (n = t.colors["editor.background"]), r ||= t.type === "light" ? W.light : W.dark, n ||= t.type === "light" ? G.light : G.dark, t.fg = r, t.bg = n;
|
|
1030
|
+
}
|
|
1031
|
+
t.settings[0] && t.settings[0].settings && !t.settings[0].scope || t.settings.unshift({ settings: {
|
|
1032
|
+
foreground: t.fg,
|
|
1033
|
+
background: t.bg
|
|
1034
|
+
} });
|
|
1035
|
+
let i = 0, a = /* @__PURE__ */ new Map();
|
|
1036
|
+
function o(e) {
|
|
1037
|
+
if (a.has(e)) return a.get(e);
|
|
1038
|
+
i += 1;
|
|
1039
|
+
let n = `#${i.toString(16).padStart(8, "0").toLowerCase()}`;
|
|
1040
|
+
return t.colorReplacements?.[`#${n}`] ? o(e) : (a.set(e, n), n);
|
|
1041
|
+
}
|
|
1042
|
+
t.settings = t.settings.map((e) => {
|
|
1043
|
+
let n = e.settings?.foreground && !e.settings.foreground.startsWith("#"), r = e.settings?.background && !e.settings.background.startsWith("#");
|
|
1044
|
+
if (!n && !r) return e;
|
|
1045
|
+
let i = {
|
|
1046
|
+
...e,
|
|
1047
|
+
settings: { ...e.settings }
|
|
1048
|
+
};
|
|
1049
|
+
if (n) {
|
|
1050
|
+
let n = o(e.settings.foreground);
|
|
1051
|
+
t.colorReplacements[n] = e.settings.foreground, i.settings.foreground = n;
|
|
1052
|
+
}
|
|
1053
|
+
if (r) {
|
|
1054
|
+
let n = o(e.settings.background);
|
|
1055
|
+
t.colorReplacements[n] = e.settings.background, i.settings.background = n;
|
|
1056
|
+
}
|
|
1057
|
+
return i;
|
|
1058
|
+
});
|
|
1059
|
+
for (let e of Object.keys(t.colors || {})) if ((e === "editor.foreground" || e === "editor.background" || e.startsWith("terminal.ansi")) && !t.colors[e]?.startsWith("#")) {
|
|
1060
|
+
let n = o(t.colors[e]);
|
|
1061
|
+
t.colorReplacements[n] = t.colors[e], t.colors[e] = n;
|
|
1062
|
+
}
|
|
1063
|
+
return Object.defineProperty(t, K, {
|
|
1064
|
+
enumerable: !1,
|
|
1065
|
+
writable: !1,
|
|
1066
|
+
value: !0
|
|
1067
|
+
}), t;
|
|
1068
|
+
}
|
|
1069
|
+
async function J(e) {
|
|
1070
|
+
return Array.from(new Set((await Promise.all(e.filter((e) => !f(e)).map(async (e) => await u(e).then((e) => Array.isArray(e) ? e : [e])))).flat()));
|
|
1071
|
+
}
|
|
1072
|
+
async function Y(e) {
|
|
1073
|
+
return (await Promise.all(e.map(async (e) => m(e) ? null : q(await u(e))))).filter((e) => !!e);
|
|
1074
|
+
}
|
|
1075
|
+
var X = 3;
|
|
1076
|
+
function we(e, t = 3) {
|
|
1077
|
+
X && (typeof X == "number" && t > X || console.trace(`[SHIKI DEPRECATE]: ${e}`));
|
|
1078
|
+
}
|
|
1079
|
+
var Z = class extends Error {
|
|
1080
|
+
constructor(e) {
|
|
1081
|
+
super(e), this.name = "ShikiError";
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
function Q(e, t) {
|
|
1085
|
+
if (!t) return e;
|
|
1086
|
+
if (t[e]) {
|
|
1087
|
+
let n = /* @__PURE__ */ new Set([e]);
|
|
1088
|
+
for (; t[e];) {
|
|
1089
|
+
if (e = t[e], n.has(e)) throw new Z(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);
|
|
1090
|
+
n.add(e);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
return e;
|
|
1094
|
+
}
|
|
1095
|
+
var Te = class extends i {
|
|
1096
|
+
constructor(e, t, n, r = {}) {
|
|
1097
|
+
super(e), this._resolver = e, this._themes = t, this._langs = n, this._alias = r, this._themes.map((e) => this.loadTheme(e)), this.loadLanguages(this._langs);
|
|
1098
|
+
}
|
|
1099
|
+
_resolvedThemes = /* @__PURE__ */ new Map();
|
|
1100
|
+
_resolvedGrammars = /* @__PURE__ */ new Map();
|
|
1101
|
+
_langMap = /* @__PURE__ */ new Map();
|
|
1102
|
+
_langGraph = /* @__PURE__ */ new Map();
|
|
1103
|
+
_textmateThemeCache = /* @__PURE__ */ new WeakMap();
|
|
1104
|
+
_loadedThemesCache = null;
|
|
1105
|
+
_loadedLanguagesCache = null;
|
|
1106
|
+
getTheme(e) {
|
|
1107
|
+
return typeof e == "string" ? this._resolvedThemes.get(e) : this.loadTheme(e);
|
|
1108
|
+
}
|
|
1109
|
+
loadTheme(e) {
|
|
1110
|
+
let t = q(e);
|
|
1111
|
+
return t.name && (this._resolvedThemes.set(t.name, t), this._loadedThemesCache = null), t;
|
|
1112
|
+
}
|
|
1113
|
+
getLoadedThemes() {
|
|
1114
|
+
return this._loadedThemesCache ||= [...this._resolvedThemes.keys()], this._loadedThemesCache;
|
|
1115
|
+
}
|
|
1116
|
+
setTheme(e) {
|
|
1117
|
+
let t = this._textmateThemeCache.get(e);
|
|
1118
|
+
t || (t = a.createFromRawTheme(e), this._textmateThemeCache.set(e, t)), this._syncRegistry.setTheme(t);
|
|
1119
|
+
}
|
|
1120
|
+
getGrammar(e) {
|
|
1121
|
+
return e = Q(e, this._alias), this._resolvedGrammars.get(e);
|
|
1122
|
+
}
|
|
1123
|
+
loadLanguage(e) {
|
|
1124
|
+
if (this.getGrammar(e.name)) return;
|
|
1125
|
+
let t = new Set([...this._langMap.values()].filter((t) => t.embeddedLangsLazy?.includes(e.name)));
|
|
1126
|
+
this._resolver.addLanguage(e);
|
|
1127
|
+
let n = {
|
|
1128
|
+
balancedBracketSelectors: e.balancedBracketSelectors || ["*"],
|
|
1129
|
+
unbalancedBracketSelectors: e.unbalancedBracketSelectors || []
|
|
1130
|
+
};
|
|
1131
|
+
this._syncRegistry._rawGrammars.set(e.scopeName, e);
|
|
1132
|
+
let r = this.loadGrammarWithConfiguration(e.scopeName, 1, n);
|
|
1133
|
+
if (r.name = e.name, this._resolvedGrammars.set(e.name, r), e.aliases && e.aliases.forEach((t) => {
|
|
1134
|
+
this._alias[t] = e.name;
|
|
1135
|
+
}), this._loadedLanguagesCache = null, t.size) for (let e of t) this._resolvedGrammars.delete(e.name), this._loadedLanguagesCache = null, this._syncRegistry?._injectionGrammars?.delete(e.scopeName), this._syncRegistry?._grammars?.delete(e.scopeName), this.loadLanguage(this._langMap.get(e.name));
|
|
1136
|
+
}
|
|
1137
|
+
dispose() {
|
|
1138
|
+
super.dispose(), this._resolvedThemes.clear(), this._resolvedGrammars.clear(), this._langMap.clear(), this._langGraph.clear(), this._loadedThemesCache = null;
|
|
1139
|
+
}
|
|
1140
|
+
loadLanguages(e) {
|
|
1141
|
+
for (let t of e) this.resolveEmbeddedLanguages(t);
|
|
1142
|
+
let t = Array.from(this._langGraph.entries()), n = t.filter(([e, t]) => !t);
|
|
1143
|
+
if (n.length) {
|
|
1144
|
+
let e = t.filter(([e, t]) => t ? (t.embeddedLanguages || t.embeddedLangs)?.some((e) => n.map(([e]) => e).includes(e)) : !1).filter((e) => !n.includes(e));
|
|
1145
|
+
throw new Z(`Missing languages ${n.map(([e]) => `\`${e}\``).join(", ")}, required by ${e.map(([e]) => `\`${e}\``).join(", ")}`);
|
|
1146
|
+
}
|
|
1147
|
+
for (let [e, n] of t) this._resolver.addLanguage(n);
|
|
1148
|
+
for (let [e, n] of t) this.loadLanguage(n);
|
|
1149
|
+
}
|
|
1150
|
+
getLoadedLanguages() {
|
|
1151
|
+
return this._loadedLanguagesCache ||= [.../* @__PURE__ */ new Set([...this._resolvedGrammars.keys(), ...Object.keys(this._alias)])], this._loadedLanguagesCache;
|
|
1152
|
+
}
|
|
1153
|
+
resolveEmbeddedLanguages(e) {
|
|
1154
|
+
this._langMap.set(e.name, e), this._langGraph.set(e.name, e);
|
|
1155
|
+
let t = e.embeddedLanguages ?? e.embeddedLangs;
|
|
1156
|
+
if (t) for (let e of t) this._langGraph.set(e, this._langMap.get(e));
|
|
1157
|
+
}
|
|
1158
|
+
}, Ee = class {
|
|
1159
|
+
_langs = /* @__PURE__ */ new Map();
|
|
1160
|
+
_scopeToLang = /* @__PURE__ */ new Map();
|
|
1161
|
+
_injections = /* @__PURE__ */ new Map();
|
|
1162
|
+
_onigLib;
|
|
1163
|
+
constructor(e, t) {
|
|
1164
|
+
this._onigLib = {
|
|
1165
|
+
createOnigScanner: (t) => e.createScanner(t),
|
|
1166
|
+
createOnigString: (t) => e.createString(t)
|
|
1167
|
+
}, t.forEach((e) => this.addLanguage(e));
|
|
1168
|
+
}
|
|
1169
|
+
get onigLib() {
|
|
1170
|
+
return this._onigLib;
|
|
1171
|
+
}
|
|
1172
|
+
getLangRegistration(e) {
|
|
1173
|
+
return this._langs.get(e);
|
|
1174
|
+
}
|
|
1175
|
+
loadGrammar(e) {
|
|
1176
|
+
return this._scopeToLang.get(e);
|
|
1177
|
+
}
|
|
1178
|
+
addLanguage(e) {
|
|
1179
|
+
this._langs.set(e.name, e), e.aliases && e.aliases.forEach((t) => {
|
|
1180
|
+
this._langs.set(t, e);
|
|
1181
|
+
}), this._scopeToLang.set(e.scopeName, e), e.injectTo && e.injectTo.forEach((t) => {
|
|
1182
|
+
this._injections.get(t) || this._injections.set(t, []), this._injections.get(t).push(e.scopeName);
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
getInjections(e) {
|
|
1186
|
+
let t = e.split("."), n = [];
|
|
1187
|
+
for (let e = 1; e <= t.length; e++) {
|
|
1188
|
+
let r = t.slice(0, e).join(".");
|
|
1189
|
+
n = [...n, ...this._injections.get(r) || []];
|
|
1190
|
+
}
|
|
1191
|
+
return n;
|
|
1192
|
+
}
|
|
1193
|
+
}, $ = 0;
|
|
1194
|
+
function De(e) {
|
|
1195
|
+
$ += 1, e.warnings !== !1 && $ >= 10 && $ % 10 == 0 && console.warn(`[Shiki] ${$} 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.`);
|
|
1196
|
+
let t = !1;
|
|
1197
|
+
if (!e.engine) throw new Z("`engine` option is required for synchronous mode");
|
|
1198
|
+
let n = (e.langs || []).flat(1), r = (e.themes || []).flat(1).map(q), i = new Te(new Ee(e.engine, n), r, n, e.langAlias), a;
|
|
1199
|
+
function o(t) {
|
|
1200
|
+
return Q(t, e.langAlias);
|
|
1201
|
+
}
|
|
1202
|
+
function s(e) {
|
|
1203
|
+
g();
|
|
1204
|
+
let t = i.getGrammar(typeof e == "string" ? e : e.name);
|
|
1205
|
+
if (!t) throw new Z(`Language \`${e}\` not found, you may need to load it first`);
|
|
1206
|
+
return t;
|
|
1207
|
+
}
|
|
1208
|
+
function c(e) {
|
|
1209
|
+
if (e === "none") return {
|
|
1210
|
+
bg: "",
|
|
1211
|
+
fg: "",
|
|
1212
|
+
name: "none",
|
|
1213
|
+
settings: [],
|
|
1214
|
+
type: "dark"
|
|
1215
|
+
};
|
|
1216
|
+
g();
|
|
1217
|
+
let t = i.getTheme(e);
|
|
1218
|
+
if (!t) throw new Z(`Theme \`${e}\` not found, you may need to load it first`);
|
|
1219
|
+
return t;
|
|
1220
|
+
}
|
|
1221
|
+
function l(e) {
|
|
1222
|
+
g();
|
|
1223
|
+
let t = c(e);
|
|
1224
|
+
return a !== e && (i.setTheme(t), a = e), {
|
|
1225
|
+
theme: t,
|
|
1226
|
+
colorMap: i.getColorMap()
|
|
1227
|
+
};
|
|
1228
|
+
}
|
|
1229
|
+
function u() {
|
|
1230
|
+
return g(), i.getLoadedThemes();
|
|
1231
|
+
}
|
|
1232
|
+
function d() {
|
|
1233
|
+
return g(), i.getLoadedLanguages();
|
|
1234
|
+
}
|
|
1235
|
+
function f(...e) {
|
|
1236
|
+
g(), i.loadLanguages(e.flat(1));
|
|
1237
|
+
}
|
|
1238
|
+
async function p(...e) {
|
|
1239
|
+
return f(await J(e));
|
|
1240
|
+
}
|
|
1241
|
+
function m(...e) {
|
|
1242
|
+
g();
|
|
1243
|
+
for (let t of e.flat(1)) i.loadTheme(t);
|
|
1244
|
+
}
|
|
1245
|
+
async function h(...e) {
|
|
1246
|
+
return g(), m(await Y(e));
|
|
1247
|
+
}
|
|
1248
|
+
function g() {
|
|
1249
|
+
if (t) throw new Z("Shiki instance has been disposed");
|
|
1250
|
+
}
|
|
1251
|
+
function _() {
|
|
1252
|
+
t || (t = !0, i.dispose(), --$);
|
|
1253
|
+
}
|
|
1254
|
+
return {
|
|
1255
|
+
setTheme: l,
|
|
1256
|
+
getTheme: c,
|
|
1257
|
+
getLanguage: s,
|
|
1258
|
+
getLoadedThemes: u,
|
|
1259
|
+
getLoadedLanguages: d,
|
|
1260
|
+
resolveLangAlias: o,
|
|
1261
|
+
loadLanguage: p,
|
|
1262
|
+
loadLanguageSync: f,
|
|
1263
|
+
loadTheme: h,
|
|
1264
|
+
loadThemeSync: m,
|
|
1265
|
+
dispose: _,
|
|
1266
|
+
[Symbol.dispose]: _
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
async function Oe(e) {
|
|
1270
|
+
e.engine || we("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");
|
|
1271
|
+
let [t, n, r] = await Promise.all([
|
|
1272
|
+
Y(e.themes || []),
|
|
1273
|
+
J(e.langs || []),
|
|
1274
|
+
e.engine
|
|
1275
|
+
]);
|
|
1276
|
+
return De({
|
|
1277
|
+
...e,
|
|
1278
|
+
themes: t,
|
|
1279
|
+
langs: n,
|
|
1280
|
+
engine: r
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
async function ke(e) {
|
|
1284
|
+
let t = await Oe(e);
|
|
1285
|
+
return {
|
|
1286
|
+
getLastGrammarState: (...e) => he(t, ...e),
|
|
1287
|
+
codeToTokensBase: (e, n) => N(t, e, n),
|
|
1288
|
+
codeToTokensWithThemes: (e, n) => L(t, e, n),
|
|
1289
|
+
codeToTokens: (e, n) => R(t, e, n),
|
|
1290
|
+
codeToHast: (e, n) => B(t, e, n),
|
|
1291
|
+
codeToHtml: (e, n) => U(t, e, n),
|
|
1292
|
+
getBundledLanguages: () => ({}),
|
|
1293
|
+
getBundledThemes: () => ({}),
|
|
1294
|
+
...t,
|
|
1295
|
+
getInternalContext: () => t
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
//#endregion
|
|
1299
|
+
export { e as ShikiError, h as addClassToHast, c as applyColorReplacements, B as codeToHast, U as codeToHtml, R as codeToTokens, N as codeToTokensBase, L as codeToTokensWithThemes, ke as createHighlighterCore, _ as createPositionConverter, Oe as createShikiInternal, De as createShikiInternalSync, te as flatTokenVariants, x as getTokenStyleObject, H as hastToHtml, p as isNoneTheme, d as isPlainLang, f as isSpecialLang, m as isSpecialTheme, u as normalizeGetter, q as normalizeTheme, s as resolveColorReplacements, g as splitLines, b as splitToken, ee as splitTokens, S as stringifyTokenStyle, l as toArray, M as tokenizeAnsiWithTheme, P as tokenizeWithTheme, V as tokensToHast, E as transformerDecorations, we as warnDeprecated };
|