@loopstack/loopstack-studio 0.21.0 → 0.21.1
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/components/LoadingCentered.js +2 -2
- package/dist/components/ai-elements/code-block.js +96 -0
- package/dist/components/ai-elements/message.js +87 -0
- package/dist/components/ai-elements/prompt-input.js +321 -0
- package/dist/components/ai-elements/reasoning.js +124 -0
- package/dist/components/ai-elements/shimmer.js +37 -0
- package/dist/components/ai-elements/sources.js +65 -0
- package/dist/components/ai-elements/tool.js +158 -0
- package/dist/components/content/ErrorAlert.js +17 -0
- package/dist/components/data-table/DataTable.js +99 -96
- package/dist/components/dynamic-form/CodeContent.js +2 -2
- package/dist/components/dynamic-form/FormElement.js +3 -3
- package/dist/components/dynamic-form/FormElementHeader.js +2 -2
- package/dist/components/dynamic-form/ObjectController.js +2 -2
- package/dist/components/layout/MainLayout.js +0 -1
- package/dist/components/lists/ListView.js +62 -59
- package/dist/components/loopstack-elements/link.js +115 -0
- package/dist/components/ui/button-group.js +13 -0
- package/dist/components/ui/command.js +7 -0
- package/dist/components/ui/context-menu.js +63 -0
- package/dist/components/ui/hover-card.js +6 -0
- package/dist/components/ui/input-group.js +85 -0
- package/dist/components/ui/table.js +2 -2
- package/dist/components/ui/tabs.js +54 -0
- package/dist/components/ui-widgets/UiActions.js +24 -0
- package/dist/components/ui-widgets/UiWidget.js +43 -0
- package/dist/components/ui-widgets/widgets/AiPromptInput.js +43 -0
- package/dist/components/ui-widgets/widgets/ButtonFullWidth.js +23 -0
- package/dist/components/ui-widgets/widgets/SubmitButton.js +23 -0
- package/dist/features/code-explorer/CodeExplorer.js +69 -0
- package/dist/features/code-explorer/components/CodeExplorerTree.js +43 -0
- package/dist/features/code-explorer/components/CodeExplorerTreeNode.js +82 -0
- package/dist/features/code-explorer/components/FileContentViewer.js +237 -0
- package/dist/features/code-explorer/components/FileTabsBar.js +191 -0
- package/dist/features/code-explorer/providers/CodeExplorerProvider.js +165 -0
- package/dist/features/code-explorer/utils/fileIcons.js +42 -0
- package/dist/features/dashboard/Dashboard.js +125 -0
- package/dist/features/dashboard/RunItem.js +76 -0
- package/dist/features/dashboard/RunList.js +32 -0
- package/dist/features/debug/components/ConfigFlowViewer.js +79 -0
- package/dist/features/debug/components/PipelineDebugHeader.js +48 -0
- package/dist/features/debug/components/PipelineDebugLegend.js +68 -0
- package/dist/features/debug/components/PipelineFlowViewer.js +109 -0
- package/dist/features/debug/components/pipeline-flow/StateNode.js +111 -0
- package/dist/features/debug/components/pipeline-flow/WorkflowGraph.js +41 -0
- package/dist/features/debug/components/pipeline-flow/WorkflowTransitionEdge.js +97 -0
- package/dist/features/debug/lib/edge-paths.js +47 -0
- package/dist/features/debug/lib/flow-utils.js +247 -0
- package/dist/features/health/LocalHealthCheck.js +1 -1
- package/dist/features/oauth/OAuthCallbackPage.js +2 -0
- package/dist/features/oauth/OAuthPromptRenderer.js +223 -0
- package/dist/features/oauth/index.js +3 -0
- package/dist/features/oauth/useOAuthPopup.js +83 -0
- package/dist/features/workbench/NavigationItems.js +52 -0
- package/dist/features/workbench/Workbench.js +101 -0
- package/dist/features/workbench/WorkbenchNavigation.js +38 -0
- package/dist/features/workbench/WorkflowItem.js +67 -0
- package/dist/features/workbench/WorkflowList.js +110 -0
- package/dist/features/workbench/components/DocumentItem.js +27 -0
- package/dist/features/workbench/components/DocumentList.js +40 -0
- package/dist/features/workbench/components/DocumentMetadataPills.js +63 -0
- package/dist/features/workbench/components/DocumentRenderer.js +54 -0
- package/dist/features/workbench/components/NavigationItem.js +68 -0
- package/dist/features/workbench/components/PipelineHistoryList.js +56 -0
- package/dist/features/workbench/components/WorkbenchSettingsModal.js +89 -0
- package/dist/features/workbench/components/WorkbenchSidebar.js +109 -0
- package/dist/features/workbench/components/WorkflowForms.js +22 -0
- package/dist/features/workbench/components/WorkflowHistoryItem.js +144 -0
- package/dist/features/workbench/components/buttons/WorkflowButtons.js +85 -0
- package/dist/features/workbench/components/document-details/DocumentDetails.js +425 -0
- package/dist/features/workbench/components/document-details/PromptDetails.js +146 -0
- package/dist/features/workbench/components/document-renderer/AiMessage.js +56 -0
- package/dist/features/workbench/components/document-renderer/AiMessageContent.js +174 -0
- package/dist/features/workbench/components/document-renderer/DocumentDebugRenderer.js +30 -0
- package/dist/features/workbench/components/document-renderer/DocumentFormRenderer.js +79 -0
- package/dist/features/workbench/components/document-renderer/DocumentMessageRenderer.js +10 -0
- package/dist/features/workbench/components/document-renderer/ErrorMessageRenderer.js +13 -0
- package/dist/features/workbench/components/document-renderer/LinkMessageRenderer.js +17 -0
- package/dist/features/workbench/components/document-renderer/MarkdownMessageRenderer.js +10 -0
- package/dist/features/workbench/components/document-renderer/PlainMessageRenderer.js +9 -0
- package/dist/features/workbench/hooks/useAutoScrollBottom.js +29 -0
- package/dist/features/workbench/hooks/useIntersectionObserver.js +44 -0
- package/dist/features/workbench/hooks/useScrollToListItem.js +23 -0
- package/dist/features/workbench/providers/ScrollProvider.js +22 -0
- package/dist/features/workbench/providers/WorkbenchContextProvider.js +3 -0
- package/dist/features/workspaces/Workspaces.js +156 -89
- package/dist/features/workspaces/components/CreateWorkspace.js +101 -78
- package/dist/features/workspaces/components/ExecutionTimeline.js +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useDashboard.js +23 -0
- package/dist/hooks/useDocuments.js +45 -0
- package/dist/hooks/useFiles.js +63 -0
- package/dist/hooks/useNamespaceTree.js +27 -0
- package/dist/hooks/useNamespaces.js +34 -0
- package/dist/hooks/usePipelines.js +83 -6
- package/dist/hooks/useWorkflows.js +122 -0
- package/dist/hooks/useWorkspaces.js +49 -29
- package/dist/index.d.ts +75 -9
- package/dist/index.js +9 -1
- package/dist/lib/requireParam.js +6 -0
- package/dist/loopstack-studio.css +1 -1
- package/dist/node_modules/@ai-sdk/provider/dist/index.js +65 -0
- package/dist/node_modules/@ai-sdk/provider-utils/dist/index.js +1008 -0
- package/dist/node_modules/@dagrejs/dagre/dist/dagre.esm.js +1968 -0
- package/dist/node_modules/@shikijs/core/dist/index.js +1420 -0
- package/dist/node_modules/@shikijs/engine-oniguruma/dist/index.js +236 -0
- package/dist/node_modules/@shikijs/engine-oniguruma/dist/wasm-inlined.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/abap.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/actionscript-3.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ada.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-expression.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-html.js +14 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-inline-style.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-inline-template.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-let-declaration.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-template-blocks.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-template.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-ts.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/apache.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/apex.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/apl.js +14 -0
- package/dist/node_modules/@shikijs/langs/dist/applescript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ara.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/asciidoc.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/asm.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/astro.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/awk.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ballerina.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/bat.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/beancount.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/berry.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/bibtex.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/bicep.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/bird2.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/blade.js +18 -0
- package/dist/node_modules/@shikijs/langs/dist/bsl.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/c.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/c3.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/cadence.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/cairo.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/clarity.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/clojure.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/cmake.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/cobol.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/codeowners.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/codeql.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/coffee.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/common-lisp.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/coq.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/cpp-macro.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/cpp.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/crystal.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/csharp.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/css.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/csv.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/cue.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/cypher.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/d.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/dart.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/dax.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/desktop.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/diff.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/docker.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/dotenv.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/dream-maker.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/edge.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/elixir.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/elm.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/emacs-lisp.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/erb.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/erlang.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/es-tag-css.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/es-tag-glsl.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/es-tag-html.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/es-tag-sql.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/es-tag-xml.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/fennel.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/fish.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/fluent.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/fortran-fixed-form.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/fortran-free-form.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/fsharp.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/gdresource.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/gdscript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/gdshader.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/genie.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/gherkin.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/git-commit.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/git-rebase.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/gleam.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/glimmer-js.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/glimmer-ts.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/glsl.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/gn.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/gnuplot.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/go.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/graphql.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/groovy.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/hack.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/haml.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/handlebars.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/haskell.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/haxe.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/hcl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/hjson.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/hlsl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/html-derivative.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/html.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/http.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/hurl.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/hxml.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/hy.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/imba.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ini.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/java.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/javascript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/jinja-html.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/jinja.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/jison.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/json.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/json5.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/jsonc.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/jsonl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/jsonnet.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/jssm.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/jsx.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/julia.js +14 -0
- package/dist/node_modules/@shikijs/langs/dist/just.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/kdl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/kotlin.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/kusto.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/latex.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/lean.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/less.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/liquid.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/llvm.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/log.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/logo.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/lua.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/luau.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/make.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/markdown-nix.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/markdown-vue.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/markdown.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/marko.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/matlab.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/mdc.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/mdx.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/mermaid.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/mipsasm.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/mojo.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/moonbit.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/move.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/narrat.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/nextflow-groovy.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/nextflow.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/nginx.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/nim.js +18 -0
- package/dist/node_modules/@shikijs/langs/dist/nix.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/nushell.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/objective-c.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/objective-cpp.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ocaml.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/odin.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/openscad.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/pascal.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/perl.js +14 -0
- package/dist/node_modules/@shikijs/langs/dist/php.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/pkl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/plsql.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/po.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/polar.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/postcss.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/powerquery.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/powershell.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/prisma.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/prolog.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/proto.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/pug.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/puppet.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/purescript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/python.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/qml.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/qmldir.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/qss.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/r.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/racket.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/raku.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/razor.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/reg.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/regexp.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/rel.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/riscv.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ron.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/rosmsg.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/rst.js +20 -0
- package/dist/node_modules/@shikijs/langs/dist/ruby.js +28 -0
- package/dist/node_modules/@shikijs/langs/dist/rust.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/sas.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/sass.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/scala.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/scheme.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/scss.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/sdbl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/shaderlab.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/shellscript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/shellsession.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/smalltalk.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/solidity.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/soy.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/sparql.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/splunk.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/sql.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ssh-config.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/stata.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/stylus.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/surrealql.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/svelte.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/swift.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/system-verilog.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/systemd.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/talonscript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/tasl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/tcl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/templ.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/terraform.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/tex.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/toml.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ts-tags.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/tsv.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/tsx.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/turtle.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/twig.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/typescript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/typespec.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/typst.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/v.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/vala.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/vb.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/verilog.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/vhdl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/viml.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/vue-directives.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/vue-html.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/vue-interpolations.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/vue-sfc-style-variable-injection.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/vue-vine.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/vue.js +24 -0
- package/dist/node_modules/@shikijs/langs/dist/vyper.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/wasm.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/wenyan.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/wgsl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/wikitext.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/wit.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/wolfram.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/xml.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/xsl.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/yaml.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/zenscript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/zig.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/andromeeda.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/aurora-x.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/ayu-dark.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/ayu-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/ayu-mirage.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/catppuccin-frappe.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/catppuccin-latte.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/catppuccin-macchiato.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/catppuccin-mocha.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/dark-plus.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/dracula-soft.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/dracula.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/everforest-dark.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/everforest-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/github-dark-default.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/github-dark-dimmed.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/github-dark-high-contrast.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/github-dark.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/github-light-default.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/github-light-high-contrast.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/github-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/gruvbox-dark-hard.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/gruvbox-dark-medium.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/gruvbox-dark-soft.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/gruvbox-light-hard.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/gruvbox-light-medium.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/gruvbox-light-soft.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/horizon-bright.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/horizon.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/houston.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/kanagawa-dragon.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/kanagawa-lotus.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/kanagawa-wave.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/laserwave.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/light-plus.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/material-theme-darker.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/material-theme-lighter.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/material-theme-ocean.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/material-theme-palenight.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/material-theme.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/min-dark.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/min-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/monokai.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/night-owl-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/night-owl.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/nord.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/one-dark-pro.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/one-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/plastic.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/poimandres.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/red.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/rose-pine-dawn.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/rose-pine-moon.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/rose-pine.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/slack-dark.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/slack-ochin.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/snazzy-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/solarized-dark.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/solarized-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/synthwave-84.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/tokyo-night.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/vesper.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/vitesse-black.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/vitesse-dark.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/vitesse-light.js +2 -0
- package/dist/node_modules/@shikijs/types/dist/index.js +6 -0
- package/dist/node_modules/@shikijs/vscode-textmate/dist/index.js +1580 -0
- package/dist/node_modules/@ungap/structured-clone/esm/deserialize.js +51 -0
- package/dist/node_modules/@ungap/structured-clone/esm/index.js +4 -0
- package/dist/node_modules/@ungap/structured-clone/esm/serialize.js +91 -0
- package/dist/node_modules/@ungap/structured-clone/esm/types.js +2 -0
- package/dist/node_modules/@xyflow/react/dist/esm/index.js +3280 -0
- package/dist/node_modules/@xyflow/system/dist/esm/index.js +1839 -0
- package/dist/node_modules/ai/dist/index.js +1083 -0
- package/dist/node_modules/bail/index.js +4 -0
- package/dist/node_modules/character-entities-html4/index.js +255 -0
- package/dist/node_modules/character-entities-legacy/index.js +2 -0
- package/dist/node_modules/chevrotain/lib/src/parse/errors_public.js +6 -1
- package/dist/node_modules/chevrotain/lib/src/scan/lexer.js +4 -10
- package/dist/node_modules/chevrotain/lib/src/scan/lexer_public.js +56 -65
- package/dist/node_modules/classcat/index.js +8 -0
- package/dist/node_modules/comma-separated-tokens/index.js +5 -1
- package/dist/node_modules/d3/src/index.js +5 -0
- package/dist/node_modules/d3-drag/src/constant.js +2 -0
- package/dist/node_modules/d3-drag/src/drag.js +112 -0
- package/dist/node_modules/d3-drag/src/event.js +60 -0
- package/dist/node_modules/d3-drag/src/nodrag.js +13 -0
- package/dist/node_modules/d3-drag/src/noevent.js +11 -0
- package/dist/node_modules/d3-interpolate/src/zoom.js +39 -0
- package/dist/node_modules/d3-selection/src/pointer.js +16 -0
- package/dist/node_modules/d3-selection/src/sourceEvent.js +6 -0
- package/dist/node_modules/d3-zoom/src/constant.js +2 -0
- package/dist/node_modules/d3-zoom/src/event.js +26 -0
- package/dist/node_modules/d3-zoom/src/index.js +1 -1
- package/dist/node_modules/d3-zoom/src/noevent.js +7 -0
- package/dist/node_modules/d3-zoom/src/zoom.js +214 -1
- package/dist/node_modules/decode-named-character-reference/index.dom.js +8 -0
- package/dist/node_modules/entities/dist/esm/decode-codepoint.js +35 -0
- package/dist/node_modules/entities/dist/esm/decode.js +129 -0
- package/dist/node_modules/entities/dist/esm/generated/decode-data-html.js +2 -0
- package/dist/node_modules/estree-util-is-identifier-name/lib/index.js +5 -0
- package/dist/node_modules/extend/index.js +37 -0
- package/dist/node_modules/hast-util-from-parse5/lib/index.js +121 -0
- package/dist/node_modules/hast-util-raw/lib/index.js +204 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/common/doctype.js +34 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/common/error-codes.js +5 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/common/foreign-content.js +150 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/common/html.js +267 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/common/token.js +9 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/common/unicode.js +65 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/index.js +8 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/parser/formatting-element-list.js +69 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/parser/index.js +1936 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/parser/open-element-stack.js +239 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/serializer/index.js +22 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/tokenizer/index.js +1451 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/tokenizer/preprocessor.js +75 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/tree-adapters/default.js +155 -0
- package/dist/node_modules/hast-util-sanitize/lib/index.js +159 -0
- package/dist/node_modules/hast-util-sanitize/lib/schema.js +73 -0
- package/dist/node_modules/hast-util-to-html/lib/handle/comment.js +9 -0
- package/dist/node_modules/hast-util-to-html/lib/handle/doctype.js +4 -0
- package/dist/node_modules/hast-util-to-html/lib/handle/element.js +47 -0
- package/dist/node_modules/hast-util-to-html/lib/handle/index.js +27 -0
- package/dist/node_modules/hast-util-to-html/lib/handle/raw.js +5 -0
- package/dist/node_modules/hast-util-to-html/lib/handle/root.js +4 -0
- package/dist/node_modules/hast-util-to-html/lib/handle/text.js +6 -0
- package/dist/node_modules/hast-util-to-html/lib/index.js +46 -0
- package/dist/node_modules/hast-util-to-html/lib/omission/closing.js +84 -0
- package/dist/node_modules/hast-util-to-html/lib/omission/omission.js +8 -0
- package/dist/node_modules/hast-util-to-html/lib/omission/opening.js +37 -0
- package/dist/node_modules/hast-util-to-html/lib/omission/util/siblings.js +12 -0
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +251 -0
- package/dist/node_modules/hast-util-to-parse5/lib/index.js +113 -0
- package/dist/node_modules/hast-util-whitespace/lib/index.js +8 -0
- package/dist/node_modules/html-url-attributes/lib/index.js +34 -0
- package/dist/node_modules/html-void-elements/index.js +23 -0
- package/dist/node_modules/inline-style-parser/cjs/index.js +88 -0
- package/dist/node_modules/mdast-util-from-markdown/lib/index.js +555 -0
- package/dist/node_modules/mdast-util-to-hast/lib/footer.js +101 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/blockquote.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/break.js +13 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/code.js +20 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/delete.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/emphasis.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js +28 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/heading.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/html.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/image-reference.js +19 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/image.js +13 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/index.js +54 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/inline-code.js +15 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/link-reference.js +16 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/link.js +13 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/list-item.js +57 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/list.js +18 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/paragraph.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/root.js +8 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/strong.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/table-cell.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/table-row.js +22 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/table.js +33 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/text.js +9 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/index.js +17 -0
- package/dist/node_modules/mdast-util-to-hast/lib/revert.js +18 -0
- package/dist/node_modules/mdast-util-to-hast/lib/state.js +106 -0
- package/dist/node_modules/micromark/lib/constructs.js +79 -0
- package/dist/node_modules/micromark/lib/create-tokenizer.js +175 -0
- package/dist/node_modules/micromark/lib/initialize/content.js +32 -0
- package/dist/node_modules/micromark/lib/initialize/document.js +101 -0
- package/dist/node_modules/micromark/lib/initialize/flow.js +23 -0
- package/dist/node_modules/micromark/lib/initialize/text.js +84 -0
- package/dist/node_modules/micromark/lib/parse.js +27 -0
- package/dist/node_modules/micromark/lib/postprocess.js +6 -0
- package/dist/node_modules/micromark/lib/preprocess.js +30 -0
- package/dist/node_modules/micromark-core-commonmark/lib/attention.js +112 -0
- package/dist/node_modules/micromark-core-commonmark/lib/autolink.js +41 -0
- package/dist/node_modules/micromark-core-commonmark/lib/block-quote.js +36 -0
- package/dist/node_modules/micromark-core-commonmark/lib/character-escape.js +15 -0
- package/dist/node_modules/micromark-core-commonmark/lib/character-reference.js +27 -0
- package/dist/node_modules/micromark-core-commonmark/lib/code-fenced.js +88 -0
- package/dist/node_modules/micromark-core-commonmark/lib/code-indented.js +42 -0
- package/dist/node_modules/micromark-core-commonmark/lib/code-text.js +41 -0
- package/dist/node_modules/micromark-core-commonmark/lib/content.js +46 -0
- package/dist/node_modules/micromark-core-commonmark/lib/definition.js +59 -0
- package/dist/node_modules/micromark-core-commonmark/lib/hard-break-escape.js +15 -0
- package/dist/node_modules/micromark-core-commonmark/lib/heading-atx.js +65 -0
- package/dist/node_modules/micromark-core-commonmark/lib/html-flow.js +140 -0
- package/dist/node_modules/micromark-core-commonmark/lib/html-text.js +98 -0
- package/dist/node_modules/micromark-core-commonmark/lib/label-end.js +157 -0
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-image.js +21 -0
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-link.js +18 -0
- package/dist/node_modules/micromark-core-commonmark/lib/line-ending.js +12 -0
- package/dist/node_modules/micromark-core-commonmark/lib/list.js +77 -0
- package/dist/node_modules/micromark-core-commonmark/lib/setext-underline.js +57 -0
- package/dist/node_modules/micromark-core-commonmark/lib/thematic-break.js +23 -0
- package/dist/node_modules/micromark-factory-destination/index.js +24 -0
- package/dist/node_modules/micromark-factory-label/index.js +18 -0
- package/dist/node_modules/micromark-factory-title/index.js +22 -0
- package/dist/node_modules/micromark-factory-whitespace/index.js +10 -0
- package/dist/node_modules/micromark-util-character/index.js +6 -5
- package/dist/node_modules/micromark-util-chunked/index.js +4 -1
- package/dist/node_modules/micromark-util-decode-numeric-character-reference/index.js +5 -0
- package/dist/node_modules/micromark-util-decode-string/index.js +15 -0
- package/dist/node_modules/micromark-util-html-tag-name/index.js +7 -0
- package/dist/node_modules/micromark-util-sanitize-uri/index.js +16 -0
- package/dist/node_modules/micromark-util-subtokenize/index.js +33 -0
- package/dist/node_modules/micromark-util-subtokenize/lib/splice-buffer.js +55 -0
- package/dist/node_modules/motion/dist/es/react.js +3 -0
- package/dist/node_modules/nanoid/index.browser.js +7 -0
- package/dist/node_modules/nanoid/url-alphabet/index.js +2 -0
- package/dist/node_modules/property-information/index.js +1 -0
- package/dist/node_modules/property-information/lib/hast-to-react.js +20 -0
- package/dist/node_modules/rehype-harden/dist/index.js +168 -0
- package/dist/node_modules/rehype-raw/lib/index.js +10 -0
- package/dist/node_modules/rehype-sanitize/lib/index.js +7 -0
- package/dist/node_modules/remark-parse/lib/index.js +14 -0
- package/dist/node_modules/remark-rehype/lib/index.js +16 -0
- package/dist/node_modules/remend/dist/index.js +459 -0
- package/dist/node_modules/shiki/dist/bundle-full.js +11 -0
- package/dist/node_modules/shiki/dist/langs.js +1278 -0
- package/dist/node_modules/shiki/dist/themes.js +393 -0
- package/dist/node_modules/shiki/dist/wasm.js +2 -0
- package/dist/node_modules/space-separated-tokens/index.js +4 -1
- package/dist/node_modules/streamdown/dist/chunk-RLXIAIE6.js +2189 -0
- package/dist/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js +33 -0
- package/dist/node_modules/streamdown/dist/index.js +2 -0
- package/dist/node_modules/streamdown/dist/mermaid-3ZIDBTTL.js +3 -0
- package/dist/node_modules/streamdown/node_modules/marked/lib/marked.esm.js +1421 -0
- package/dist/node_modules/stringify-entities/lib/constant/dangerous.js +11 -0
- package/dist/node_modules/stringify-entities/lib/core.js +21 -0
- package/dist/node_modules/stringify-entities/lib/index.js +6 -0
- package/dist/node_modules/stringify-entities/lib/util/format-smart.js +12 -0
- package/dist/node_modules/stringify-entities/lib/util/to-decimal.js +6 -0
- package/dist/node_modules/stringify-entities/lib/util/to-hexadecimal.js +6 -0
- package/dist/node_modules/stringify-entities/lib/util/to-named.js +15 -0
- package/dist/node_modules/style-to-js/cjs/index.js +17 -0
- package/dist/node_modules/style-to-js/cjs/utilities.js +16 -0
- package/dist/node_modules/style-to-object/cjs/index.js +21 -0
- package/dist/node_modules/trim-lines/index.js +19 -0
- package/dist/node_modules/trough/lib/index.js +48 -0
- package/dist/node_modules/unified/lib/callable-instance.js +7 -0
- package/dist/node_modules/unified/lib/index.js +160 -0
- package/dist/node_modules/unified/node_modules/is-plain-obj/index.js +6 -0
- package/dist/node_modules/unist-util-position/lib/index.js +20 -0
- package/dist/node_modules/unist-util-stringify-position/lib/index.js +13 -0
- package/dist/node_modules/vfile/lib/index.js +87 -0
- package/dist/node_modules/vfile/lib/minpath.browser.js +97 -0
- package/dist/node_modules/vfile/lib/minproc.browser.js +5 -0
- package/dist/node_modules/vfile/lib/minurl.browser.js +29 -0
- package/dist/node_modules/vfile/lib/minurl.shared.js +4 -0
- package/dist/node_modules/vfile-location/lib/index.js +41 -0
- package/dist/node_modules/vfile-message/lib/index.js +22 -0
- package/dist/node_modules/zod/v3/ZodError.js +79 -0
- package/dist/node_modules/zod/v3/errors.js +6 -0
- package/dist/node_modules/zod/v3/helpers/errorUtil.js +5 -0
- package/dist/node_modules/zod/v3/helpers/parseUtil.js +90 -0
- package/dist/node_modules/zod/v3/helpers/util.js +72 -0
- package/dist/node_modules/zod/v3/locales/en.js +58 -0
- package/dist/node_modules/zod/v3/types.js +2425 -0
- package/dist/node_modules/zod/v4/classic/errors.js +21 -0
- package/dist/node_modules/zod/v4/classic/iso.js +29 -0
- package/dist/node_modules/zod/v4/classic/parse.js +4 -0
- package/dist/node_modules/zod/v4/classic/schemas.js +392 -0
- package/dist/node_modules/zod/v4/core/api.js +532 -0
- package/dist/node_modules/zod/v4/core/checks.js +283 -0
- package/dist/node_modules/zod/v4/core/core.js +44 -0
- package/dist/node_modules/zod/v4/core/doc.js +21 -0
- package/dist/node_modules/zod/v4/core/errors.js +40 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +305 -0
- package/dist/node_modules/zod/v4/core/parse.js +66 -0
- package/dist/node_modules/zod/v4/core/regexes.js +28 -0
- package/dist/node_modules/zod/v4/core/registries.js +38 -0
- package/dist/node_modules/zod/v4/core/schemas.js +863 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.js +220 -0
- package/dist/node_modules/zod/v4/core/util.js +267 -0
- package/dist/node_modules/zod/v4/core/versions.js +6 -0
- package/dist/node_modules/zwitch/index.js +14 -0
- package/dist/pages/DashboardPage.js +58 -0
- package/dist/pages/DebugWorkflowDetailsPage.js +121 -0
- package/dist/pages/DebugWorkflowsPage.js +130 -0
- package/dist/pages/EmbedWorkbenchPage.js +73 -0
- package/dist/pages/PipelineDebugPage.js +114 -0
- package/dist/pages/WorkbenchPage.js +67 -0
- package/dist/pages/WorkspacePage.js +1 -1
- package/dist/providers/ComponentOverridesProvider.js +12 -0
- package/dist/routing/LocalRouter.js +3 -0
- package/package.json +3 -3
|
@@ -0,0 +1,1420 @@
|
|
|
1
|
+
import { ShikiError } from "../../types/dist/index.js";
|
|
2
|
+
import { EncodedTokenMetadata, FontStyle, INITIAL, Registry, Theme } from "../../vscode-textmate/dist/index.js";
|
|
3
|
+
import { toHtml } from "../../../hast-util-to-html/lib/index.js";
|
|
4
|
+
function resolveColorReplacements(a, P) {
|
|
5
|
+
let F = typeof a == "string" ? {} : { ...a.colorReplacements }, I = typeof a == "string" ? a : a.name;
|
|
6
|
+
for (let [a, L] of Object.entries(P?.colorReplacements || {})) typeof L == "string" ? F[a] = L : a === I && Object.assign(F, L);
|
|
7
|
+
return F;
|
|
8
|
+
}
|
|
9
|
+
function applyColorReplacements(a, P) {
|
|
10
|
+
return a && (P?.[a?.toLowerCase()] || a);
|
|
11
|
+
}
|
|
12
|
+
function toArray(a) {
|
|
13
|
+
return Array.isArray(a) ? a : [a];
|
|
14
|
+
}
|
|
15
|
+
async function normalizeGetter(a) {
|
|
16
|
+
return Promise.resolve(typeof a == "function" ? a() : a).then((a) => a.default || a);
|
|
17
|
+
}
|
|
18
|
+
function isPlainLang(a) {
|
|
19
|
+
return !a || [
|
|
20
|
+
"plaintext",
|
|
21
|
+
"txt",
|
|
22
|
+
"text",
|
|
23
|
+
"plain"
|
|
24
|
+
].includes(a);
|
|
25
|
+
}
|
|
26
|
+
function isSpecialLang(a) {
|
|
27
|
+
return a === "ansi" || isPlainLang(a);
|
|
28
|
+
}
|
|
29
|
+
function isNoneTheme(a) {
|
|
30
|
+
return a === "none";
|
|
31
|
+
}
|
|
32
|
+
function isSpecialTheme(a) {
|
|
33
|
+
return isNoneTheme(a);
|
|
34
|
+
}
|
|
35
|
+
function addClassToHast(a, P) {
|
|
36
|
+
if (!P) return a;
|
|
37
|
+
a.properties ||= {}, a.properties.class ||= [], typeof a.properties.class == "string" && (a.properties.class = a.properties.class.split(/\s+/g)), Array.isArray(a.properties.class) || (a.properties.class = []);
|
|
38
|
+
let F = Array.isArray(P) ? P : P.split(/\s+/g);
|
|
39
|
+
for (let P of F) P && !a.properties.class.includes(P) && a.properties.class.push(P);
|
|
40
|
+
return a;
|
|
41
|
+
}
|
|
42
|
+
function splitLines(a, P = !1) {
|
|
43
|
+
if (a.length === 0) return [["", 0]];
|
|
44
|
+
let F = a.split(/(\r?\n)/g), I = 0, L = [];
|
|
45
|
+
for (let a = 0; a < F.length; a += 2) {
|
|
46
|
+
let R = P ? F[a] + (F[a + 1] || "") : F[a];
|
|
47
|
+
L.push([R, I]), I += F[a].length, I += F[a + 1]?.length || 0;
|
|
48
|
+
}
|
|
49
|
+
return L;
|
|
50
|
+
}
|
|
51
|
+
function createPositionConverter(a) {
|
|
52
|
+
let P = splitLines(a, !0).map(([a]) => a);
|
|
53
|
+
function F(F) {
|
|
54
|
+
if (F === a.length) return {
|
|
55
|
+
line: P.length - 1,
|
|
56
|
+
character: P[P.length - 1].length
|
|
57
|
+
};
|
|
58
|
+
let I = F, L = 0;
|
|
59
|
+
for (let a of P) {
|
|
60
|
+
if (I < a.length) break;
|
|
61
|
+
I -= a.length, L++;
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
line: L,
|
|
65
|
+
character: I
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function I(a, F) {
|
|
69
|
+
let I = 0;
|
|
70
|
+
for (let F = 0; F < a; F++) I += P[F].length;
|
|
71
|
+
return I += F, I;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
lines: P,
|
|
75
|
+
indexToPos: F,
|
|
76
|
+
posToIndex: I
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function guessEmbeddedLanguages(a, P, F) {
|
|
80
|
+
let I = /* @__PURE__ */ new Set();
|
|
81
|
+
for (let P of a.matchAll(/:?lang=["']([^"']+)["']/g)) {
|
|
82
|
+
let a = P[1].toLowerCase().trim();
|
|
83
|
+
a && I.add(a);
|
|
84
|
+
}
|
|
85
|
+
for (let P of a.matchAll(/(?:```|~~~)([\w-]+)/g)) {
|
|
86
|
+
let a = P[1].toLowerCase().trim();
|
|
87
|
+
a && I.add(a);
|
|
88
|
+
}
|
|
89
|
+
for (let P of a.matchAll(/\\begin\{([\w-]+)\}/g)) {
|
|
90
|
+
let a = P[1].toLowerCase().trim();
|
|
91
|
+
a && I.add(a);
|
|
92
|
+
}
|
|
93
|
+
for (let P of a.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)) {
|
|
94
|
+
let a = P[1].toLowerCase().trim(), F = a.includes("/") ? a.split("/").pop() : a;
|
|
95
|
+
F && I.add(F);
|
|
96
|
+
}
|
|
97
|
+
if (!F) return Array.from(I);
|
|
98
|
+
let L = F.getBundledLanguages();
|
|
99
|
+
return Array.from(I).filter((a) => a && L[a]);
|
|
100
|
+
}
|
|
101
|
+
var DEFAULT_COLOR_LIGHT_DARK = "light-dark()", COLOR_KEYS = ["color", "background-color"];
|
|
102
|
+
function splitToken(a, P) {
|
|
103
|
+
let F = 0, I = [];
|
|
104
|
+
for (let L of P) L > F && I.push({
|
|
105
|
+
...a,
|
|
106
|
+
content: a.content.slice(F, L),
|
|
107
|
+
offset: a.offset + F
|
|
108
|
+
}), F = L;
|
|
109
|
+
return F < a.content.length && I.push({
|
|
110
|
+
...a,
|
|
111
|
+
content: a.content.slice(F),
|
|
112
|
+
offset: a.offset + F
|
|
113
|
+
}), I;
|
|
114
|
+
}
|
|
115
|
+
function splitTokens(a, P) {
|
|
116
|
+
let F = Array.from(P instanceof Set ? P : new Set(P)).sort((a, P) => a - P);
|
|
117
|
+
return F.length ? a.map((a) => a.flatMap((a) => {
|
|
118
|
+
let P = F.filter((P) => a.offset < P && P < a.offset + a.content.length).map((P) => P - a.offset).sort((a, P) => a - P);
|
|
119
|
+
return P.length ? splitToken(a, P) : a;
|
|
120
|
+
})) : a;
|
|
121
|
+
}
|
|
122
|
+
function flatTokenVariants(P, F, I, L, R = "css-vars") {
|
|
123
|
+
let z = {
|
|
124
|
+
content: P.content,
|
|
125
|
+
explanation: P.explanation,
|
|
126
|
+
offset: P.offset
|
|
127
|
+
}, B = F.map((a) => getTokenStyleObject(P.variants[a])), V = new Set(B.flatMap((a) => Object.keys(a))), H = {}, U = (a, P) => {
|
|
128
|
+
let L = P === "color" ? "" : P === "background-color" ? "-bg" : `-${P}`;
|
|
129
|
+
return I + F[a] + (P === "color" ? "" : L);
|
|
130
|
+
};
|
|
131
|
+
return B.forEach((P, I) => {
|
|
132
|
+
for (let z of V) {
|
|
133
|
+
let V = P[z] || "inherit";
|
|
134
|
+
if (I === 0 && L && COLOR_KEYS.includes(z)) if (L === DEFAULT_COLOR_LIGHT_DARK && B.length > 1) {
|
|
135
|
+
let P = F.findIndex((a) => a === "light"), L = F.findIndex((a) => a === "dark");
|
|
136
|
+
if (P === -1 || L === -1) throw new ShikiError("When using `defaultColor: \"light-dark()\"`, you must provide both `light` and `dark` themes");
|
|
137
|
+
H[z] = `light-dark(${B[P][z] || "inherit"}, ${B[L][z] || "inherit"})`, R === "css-vars" && (H[U(I, z)] = V);
|
|
138
|
+
} else H[z] = V;
|
|
139
|
+
else R === "css-vars" && (H[U(I, z)] = V);
|
|
140
|
+
}
|
|
141
|
+
}), z.htmlStyle = H, z;
|
|
142
|
+
}
|
|
143
|
+
function getTokenStyleObject(a) {
|
|
144
|
+
let P = {};
|
|
145
|
+
if (a.color && (P.color = a.color), a.bgColor && (P["background-color"] = a.bgColor), a.fontStyle) {
|
|
146
|
+
a.fontStyle & FontStyle.Italic && (P["font-style"] = "italic"), a.fontStyle & FontStyle.Bold && (P["font-weight"] = "bold");
|
|
147
|
+
let I = [];
|
|
148
|
+
a.fontStyle & FontStyle.Underline && I.push("underline"), a.fontStyle & FontStyle.Strikethrough && I.push("line-through"), I.length && (P["text-decoration"] = I.join(" "));
|
|
149
|
+
}
|
|
150
|
+
return P;
|
|
151
|
+
}
|
|
152
|
+
function stringifyTokenStyle(a) {
|
|
153
|
+
return typeof a == "string" ? a : Object.entries(a).map(([a, P]) => `${a}:${P}`).join(";");
|
|
154
|
+
}
|
|
155
|
+
var _grammarStateMap = /* @__PURE__ */ new WeakMap();
|
|
156
|
+
function setLastGrammarStateToMap(a, P) {
|
|
157
|
+
_grammarStateMap.set(a, P);
|
|
158
|
+
}
|
|
159
|
+
function getLastGrammarStateFromMap(a) {
|
|
160
|
+
return _grammarStateMap.get(a);
|
|
161
|
+
}
|
|
162
|
+
var GrammarState = class a {
|
|
163
|
+
_stacks = {};
|
|
164
|
+
lang;
|
|
165
|
+
get themes() {
|
|
166
|
+
return Object.keys(this._stacks);
|
|
167
|
+
}
|
|
168
|
+
get theme() {
|
|
169
|
+
return this.themes[0];
|
|
170
|
+
}
|
|
171
|
+
get _stack() {
|
|
172
|
+
return this._stacks[this.theme];
|
|
173
|
+
}
|
|
174
|
+
static initial(P, F) {
|
|
175
|
+
return new a(Object.fromEntries(toArray(F).map((a) => [a, INITIAL])), P);
|
|
176
|
+
}
|
|
177
|
+
constructor(...a) {
|
|
178
|
+
if (a.length === 2) {
|
|
179
|
+
let [P, F] = a;
|
|
180
|
+
this.lang = F, this._stacks = P;
|
|
181
|
+
} else {
|
|
182
|
+
let [P, F, I] = a;
|
|
183
|
+
this.lang = F, this._stacks = { [I]: P };
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
getInternalStack(a = this.theme) {
|
|
187
|
+
return this._stacks[a];
|
|
188
|
+
}
|
|
189
|
+
getScopes(a = this.theme) {
|
|
190
|
+
return getScopes(this._stacks[a]);
|
|
191
|
+
}
|
|
192
|
+
toJSON() {
|
|
193
|
+
return {
|
|
194
|
+
lang: this.lang,
|
|
195
|
+
theme: this.theme,
|
|
196
|
+
themes: this.themes,
|
|
197
|
+
scopes: this.getScopes()
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
function getScopes(a) {
|
|
202
|
+
let P = [], F = /* @__PURE__ */ new Set();
|
|
203
|
+
function I(a) {
|
|
204
|
+
if (F.has(a)) return;
|
|
205
|
+
F.add(a);
|
|
206
|
+
let L = a?.nameScopesList?.scopeName;
|
|
207
|
+
L && P.push(L), a.parent && I(a.parent);
|
|
208
|
+
}
|
|
209
|
+
return I(a), P;
|
|
210
|
+
}
|
|
211
|
+
function getGrammarStack(P, F) {
|
|
212
|
+
if (!(P instanceof GrammarState)) throw new ShikiError("Invalid grammar state");
|
|
213
|
+
return P.getInternalStack(F);
|
|
214
|
+
}
|
|
215
|
+
function transformerDecorations() {
|
|
216
|
+
let P = /* @__PURE__ */ new WeakMap();
|
|
217
|
+
function F(F) {
|
|
218
|
+
if (!P.has(F.meta)) {
|
|
219
|
+
let I = function(P) {
|
|
220
|
+
if (typeof P == "number") {
|
|
221
|
+
if (P < 0 || P > F.source.length) throw new ShikiError(`Invalid decoration offset: ${P}. Code length: ${F.source.length}`);
|
|
222
|
+
return {
|
|
223
|
+
...L.indexToPos(P),
|
|
224
|
+
offset: P
|
|
225
|
+
};
|
|
226
|
+
} else {
|
|
227
|
+
let F = L.lines[P.line];
|
|
228
|
+
if (F === void 0) throw new ShikiError(`Invalid decoration position ${JSON.stringify(P)}. Lines length: ${L.lines.length}`);
|
|
229
|
+
let I = P.character;
|
|
230
|
+
if (I < 0 && (I = F.length + I), I < 0 || I > F.length) throw new ShikiError(`Invalid decoration position ${JSON.stringify(P)}. Line ${P.line} length: ${F.length}`);
|
|
231
|
+
return {
|
|
232
|
+
...P,
|
|
233
|
+
character: I,
|
|
234
|
+
offset: L.posToIndex(P.line, I)
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}, L = createPositionConverter(F.source), R = (F.options.decorations || []).map((a) => ({
|
|
238
|
+
...a,
|
|
239
|
+
start: I(a.start),
|
|
240
|
+
end: I(a.end)
|
|
241
|
+
}));
|
|
242
|
+
verifyIntersections(R), P.set(F.meta, {
|
|
243
|
+
decorations: R,
|
|
244
|
+
converter: L,
|
|
245
|
+
source: F.source
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
return P.get(F.meta);
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
name: "shiki:decorations",
|
|
252
|
+
tokens(a) {
|
|
253
|
+
if (this.options.decorations?.length) return splitTokens(a, F(this).decorations.flatMap((a) => [a.start.offset, a.end.offset]));
|
|
254
|
+
},
|
|
255
|
+
code(P) {
|
|
256
|
+
if (!this.options.decorations?.length) return;
|
|
257
|
+
let I = F(this), L = Array.from(P.children).filter((a) => a.type === "element" && a.tagName === "span");
|
|
258
|
+
if (L.length !== I.converter.lines.length) throw new ShikiError(`Number of lines in code element (${L.length}) does not match the number of lines in the source (${I.converter.lines.length}). Failed to apply decorations.`);
|
|
259
|
+
function R(P, F, I, R) {
|
|
260
|
+
let z = L[P], V = "", H = -1, U = -1;
|
|
261
|
+
if (F === 0 && (H = 0), I === 0 && (U = 0), I === Infinity && (U = z.children.length), H === -1 || U === -1) for (let a = 0; a < z.children.length; a++) V += stringify(z.children[a]), H === -1 && V.length === F && (H = a + 1), U === -1 && V.length === I && (U = a + 1);
|
|
262
|
+
if (H === -1) throw new ShikiError(`Failed to find start index for decoration ${JSON.stringify(R.start)}`);
|
|
263
|
+
if (U === -1) throw new ShikiError(`Failed to find end index for decoration ${JSON.stringify(R.end)}`);
|
|
264
|
+
let W = z.children.slice(H, U);
|
|
265
|
+
if (!R.alwaysWrap && W.length === z.children.length) B(z, R, "line");
|
|
266
|
+
else if (!R.alwaysWrap && W.length === 1 && W[0].type === "element") B(W[0], R, "token");
|
|
267
|
+
else {
|
|
268
|
+
let a = {
|
|
269
|
+
type: "element",
|
|
270
|
+
tagName: "span",
|
|
271
|
+
properties: {},
|
|
272
|
+
children: W
|
|
273
|
+
};
|
|
274
|
+
B(a, R, "wrapper"), z.children.splice(H, W.length, a);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
function z(a, P) {
|
|
278
|
+
L[a] = B(L[a], P, "line");
|
|
279
|
+
}
|
|
280
|
+
function B(a, P, F) {
|
|
281
|
+
let I = P.properties || {}, L = P.transform || ((a) => a);
|
|
282
|
+
return a.tagName = P.tagName || "span", a.properties = {
|
|
283
|
+
...a.properties,
|
|
284
|
+
...I,
|
|
285
|
+
class: a.properties.class
|
|
286
|
+
}, P.properties?.class && addClassToHast(a, P.properties.class), a = L(a, F) || a, a;
|
|
287
|
+
}
|
|
288
|
+
let V = [], H = I.decorations.sort((a, P) => P.start.offset - a.start.offset || a.end.offset - P.end.offset);
|
|
289
|
+
for (let a of H) {
|
|
290
|
+
let { start: P, end: F } = a;
|
|
291
|
+
if (P.line === F.line) R(P.line, P.character, F.character, a);
|
|
292
|
+
else if (P.line < F.line) {
|
|
293
|
+
R(P.line, P.character, Infinity, a);
|
|
294
|
+
for (let I = P.line + 1; I < F.line; I++) V.unshift(() => z(I, a));
|
|
295
|
+
R(F.line, 0, F.character, a);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
V.forEach((a) => a());
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function verifyIntersections(P) {
|
|
303
|
+
for (let F = 0; F < P.length; F++) {
|
|
304
|
+
let I = P[F];
|
|
305
|
+
if (I.start.offset > I.end.offset) throw new ShikiError(`Invalid decoration range: ${JSON.stringify(I.start)} - ${JSON.stringify(I.end)}`);
|
|
306
|
+
for (let L = F + 1; L < P.length; L++) {
|
|
307
|
+
let F = P[L], R = I.start.offset <= F.start.offset && F.start.offset < I.end.offset, z = I.start.offset < F.end.offset && F.end.offset <= I.end.offset, B = F.start.offset <= I.start.offset && I.start.offset < F.end.offset, V = F.start.offset < I.end.offset && I.end.offset <= F.end.offset;
|
|
308
|
+
if (R || z || B || V) {
|
|
309
|
+
if (R && z || B && V || B && I.start.offset === I.end.offset || z && F.start.offset === F.end.offset) continue;
|
|
310
|
+
throw new ShikiError(`Decorations ${JSON.stringify(I.start)} and ${JSON.stringify(F.start)} intersect.`);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function stringify(a) {
|
|
316
|
+
return a.type === "text" ? a.value : a.type === "element" ? a.children.map(stringify).join("") : "";
|
|
317
|
+
}
|
|
318
|
+
var builtInTransformers = [/* @__PURE__ */ transformerDecorations()];
|
|
319
|
+
function getTransformers(a) {
|
|
320
|
+
let P = sortTransformersByEnforcement(a.transformers || []);
|
|
321
|
+
return [
|
|
322
|
+
...P.pre,
|
|
323
|
+
...P.normal,
|
|
324
|
+
...P.post,
|
|
325
|
+
...builtInTransformers
|
|
326
|
+
];
|
|
327
|
+
}
|
|
328
|
+
function sortTransformersByEnforcement(a) {
|
|
329
|
+
let P = [], F = [], I = [];
|
|
330
|
+
for (let L of a) switch (L.enforce) {
|
|
331
|
+
case "pre":
|
|
332
|
+
P.push(L);
|
|
333
|
+
break;
|
|
334
|
+
case "post":
|
|
335
|
+
F.push(L);
|
|
336
|
+
break;
|
|
337
|
+
default: I.push(L);
|
|
338
|
+
}
|
|
339
|
+
return {
|
|
340
|
+
pre: P,
|
|
341
|
+
post: F,
|
|
342
|
+
normal: I
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
var namedColors = [
|
|
346
|
+
"black",
|
|
347
|
+
"red",
|
|
348
|
+
"green",
|
|
349
|
+
"yellow",
|
|
350
|
+
"blue",
|
|
351
|
+
"magenta",
|
|
352
|
+
"cyan",
|
|
353
|
+
"white",
|
|
354
|
+
"brightBlack",
|
|
355
|
+
"brightRed",
|
|
356
|
+
"brightGreen",
|
|
357
|
+
"brightYellow",
|
|
358
|
+
"brightBlue",
|
|
359
|
+
"brightMagenta",
|
|
360
|
+
"brightCyan",
|
|
361
|
+
"brightWhite"
|
|
362
|
+
], decorations = {
|
|
363
|
+
1: "bold",
|
|
364
|
+
2: "dim",
|
|
365
|
+
3: "italic",
|
|
366
|
+
4: "underline",
|
|
367
|
+
7: "reverse",
|
|
368
|
+
8: "hidden",
|
|
369
|
+
9: "strikethrough"
|
|
370
|
+
};
|
|
371
|
+
function findSequence(a, P) {
|
|
372
|
+
let F = a.indexOf("\x1B", P);
|
|
373
|
+
if (F !== -1 && a[F + 1] === "[") {
|
|
374
|
+
let P = a.indexOf("m", F);
|
|
375
|
+
if (P !== -1) return {
|
|
376
|
+
sequence: a.substring(F + 2, P).split(";"),
|
|
377
|
+
startPosition: F,
|
|
378
|
+
position: P + 1
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
return { position: a.length };
|
|
382
|
+
}
|
|
383
|
+
function parseColor(a) {
|
|
384
|
+
let P = a.shift();
|
|
385
|
+
if (P === "2") {
|
|
386
|
+
let P = a.splice(0, 3).map((a) => Number.parseInt(a));
|
|
387
|
+
return P.length !== 3 || P.some((a) => Number.isNaN(a)) ? void 0 : {
|
|
388
|
+
type: "rgb",
|
|
389
|
+
rgb: P
|
|
390
|
+
};
|
|
391
|
+
} else if (P === "5") {
|
|
392
|
+
let P = a.shift();
|
|
393
|
+
if (P) return {
|
|
394
|
+
type: "table",
|
|
395
|
+
index: Number(P)
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
function parseSequence(a) {
|
|
400
|
+
let P = [];
|
|
401
|
+
for (; a.length > 0;) {
|
|
402
|
+
let F = a.shift();
|
|
403
|
+
if (!F) continue;
|
|
404
|
+
let I = Number.parseInt(F);
|
|
405
|
+
if (!Number.isNaN(I)) if (I === 0) P.push({ type: "resetAll" });
|
|
406
|
+
else if (I <= 9) decorations[I] && P.push({
|
|
407
|
+
type: "setDecoration",
|
|
408
|
+
value: decorations[I]
|
|
409
|
+
});
|
|
410
|
+
else if (I <= 29) {
|
|
411
|
+
let a = decorations[I - 20];
|
|
412
|
+
a && (P.push({
|
|
413
|
+
type: "resetDecoration",
|
|
414
|
+
value: a
|
|
415
|
+
}), a === "dim" && P.push({
|
|
416
|
+
type: "resetDecoration",
|
|
417
|
+
value: "bold"
|
|
418
|
+
}));
|
|
419
|
+
} else if (I <= 37) P.push({
|
|
420
|
+
type: "setForegroundColor",
|
|
421
|
+
value: {
|
|
422
|
+
type: "named",
|
|
423
|
+
name: namedColors[I - 30]
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
else if (I === 38) {
|
|
427
|
+
let F = parseColor(a);
|
|
428
|
+
F && P.push({
|
|
429
|
+
type: "setForegroundColor",
|
|
430
|
+
value: F
|
|
431
|
+
});
|
|
432
|
+
} else if (I === 39) P.push({ type: "resetForegroundColor" });
|
|
433
|
+
else if (I <= 47) P.push({
|
|
434
|
+
type: "setBackgroundColor",
|
|
435
|
+
value: {
|
|
436
|
+
type: "named",
|
|
437
|
+
name: namedColors[I - 40]
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
else if (I === 48) {
|
|
441
|
+
let F = parseColor(a);
|
|
442
|
+
F && P.push({
|
|
443
|
+
type: "setBackgroundColor",
|
|
444
|
+
value: F
|
|
445
|
+
});
|
|
446
|
+
} else I === 49 ? P.push({ type: "resetBackgroundColor" }) : I === 53 ? P.push({
|
|
447
|
+
type: "setDecoration",
|
|
448
|
+
value: "overline"
|
|
449
|
+
}) : I === 55 ? P.push({
|
|
450
|
+
type: "resetDecoration",
|
|
451
|
+
value: "overline"
|
|
452
|
+
}) : I >= 90 && I <= 97 ? P.push({
|
|
453
|
+
type: "setForegroundColor",
|
|
454
|
+
value: {
|
|
455
|
+
type: "named",
|
|
456
|
+
name: namedColors[I - 90 + 8]
|
|
457
|
+
}
|
|
458
|
+
}) : I >= 100 && I <= 107 && P.push({
|
|
459
|
+
type: "setBackgroundColor",
|
|
460
|
+
value: {
|
|
461
|
+
type: "named",
|
|
462
|
+
name: namedColors[I - 100 + 8]
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
return P;
|
|
467
|
+
}
|
|
468
|
+
function createAnsiSequenceParser() {
|
|
469
|
+
let a = null, P = null, F = /* @__PURE__ */ new Set();
|
|
470
|
+
return { parse(I) {
|
|
471
|
+
let L = [], R = 0;
|
|
472
|
+
do {
|
|
473
|
+
let z = findSequence(I, R), B = z.sequence ? I.substring(R, z.startPosition) : I.substring(R);
|
|
474
|
+
if (B.length > 0 && L.push({
|
|
475
|
+
value: B,
|
|
476
|
+
foreground: a,
|
|
477
|
+
background: P,
|
|
478
|
+
decorations: new Set(F)
|
|
479
|
+
}), z.sequence) {
|
|
480
|
+
let I = parseSequence(z.sequence);
|
|
481
|
+
for (let L of I) L.type === "resetAll" ? (a = null, P = null, F.clear()) : L.type === "resetForegroundColor" ? a = null : L.type === "resetBackgroundColor" ? P = null : L.type === "resetDecoration" && F.delete(L.value);
|
|
482
|
+
for (let L of I) L.type === "setForegroundColor" ? a = L.value : L.type === "setBackgroundColor" ? P = L.value : L.type === "setDecoration" && F.add(L.value);
|
|
483
|
+
}
|
|
484
|
+
R = z.position;
|
|
485
|
+
} while (R < I.length);
|
|
486
|
+
return L;
|
|
487
|
+
} };
|
|
488
|
+
}
|
|
489
|
+
var defaultNamedColorsMap = {
|
|
490
|
+
black: "#000000",
|
|
491
|
+
red: "#bb0000",
|
|
492
|
+
green: "#00bb00",
|
|
493
|
+
yellow: "#bbbb00",
|
|
494
|
+
blue: "#0000bb",
|
|
495
|
+
magenta: "#ff00ff",
|
|
496
|
+
cyan: "#00bbbb",
|
|
497
|
+
white: "#eeeeee",
|
|
498
|
+
brightBlack: "#555555",
|
|
499
|
+
brightRed: "#ff5555",
|
|
500
|
+
brightGreen: "#00ff00",
|
|
501
|
+
brightYellow: "#ffff55",
|
|
502
|
+
brightBlue: "#5555ff",
|
|
503
|
+
brightMagenta: "#ff55ff",
|
|
504
|
+
brightCyan: "#55ffff",
|
|
505
|
+
brightWhite: "#ffffff"
|
|
506
|
+
};
|
|
507
|
+
function createColorPalette(a = defaultNamedColorsMap) {
|
|
508
|
+
function P(P) {
|
|
509
|
+
return a[P];
|
|
510
|
+
}
|
|
511
|
+
function F(a) {
|
|
512
|
+
return `#${a.map((a) => Math.max(0, Math.min(a, 255)).toString(16).padStart(2, "0")).join("")}`;
|
|
513
|
+
}
|
|
514
|
+
let I;
|
|
515
|
+
function L() {
|
|
516
|
+
if (I) return I;
|
|
517
|
+
I = [];
|
|
518
|
+
for (let a = 0; a < namedColors.length; a++) I.push(P(namedColors[a]));
|
|
519
|
+
let a = [
|
|
520
|
+
0,
|
|
521
|
+
95,
|
|
522
|
+
135,
|
|
523
|
+
175,
|
|
524
|
+
215,
|
|
525
|
+
255
|
|
526
|
+
];
|
|
527
|
+
for (let P = 0; P < 6; P++) for (let L = 0; L < 6; L++) for (let R = 0; R < 6; R++) I.push(F([
|
|
528
|
+
a[P],
|
|
529
|
+
a[L],
|
|
530
|
+
a[R]
|
|
531
|
+
]));
|
|
532
|
+
let L = 8;
|
|
533
|
+
for (let a = 0; a < 24; a++, L += 10) I.push(F([
|
|
534
|
+
L,
|
|
535
|
+
L,
|
|
536
|
+
L
|
|
537
|
+
]));
|
|
538
|
+
return I;
|
|
539
|
+
}
|
|
540
|
+
function R(a) {
|
|
541
|
+
return L()[a];
|
|
542
|
+
}
|
|
543
|
+
function z(a) {
|
|
544
|
+
switch (a.type) {
|
|
545
|
+
case "named": return P(a.name);
|
|
546
|
+
case "rgb": return F(a.rgb);
|
|
547
|
+
case "table": return R(a.index);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return { value: z };
|
|
551
|
+
}
|
|
552
|
+
var defaultAnsiColors = {
|
|
553
|
+
black: "#000000",
|
|
554
|
+
red: "#cd3131",
|
|
555
|
+
green: "#0DBC79",
|
|
556
|
+
yellow: "#E5E510",
|
|
557
|
+
blue: "#2472C8",
|
|
558
|
+
magenta: "#BC3FBC",
|
|
559
|
+
cyan: "#11A8CD",
|
|
560
|
+
white: "#E5E5E5",
|
|
561
|
+
brightBlack: "#666666",
|
|
562
|
+
brightRed: "#F14C4C",
|
|
563
|
+
brightGreen: "#23D18B",
|
|
564
|
+
brightYellow: "#F5F543",
|
|
565
|
+
brightBlue: "#3B8EEA",
|
|
566
|
+
brightMagenta: "#D670D6",
|
|
567
|
+
brightCyan: "#29B8DB",
|
|
568
|
+
brightWhite: "#FFFFFF"
|
|
569
|
+
};
|
|
570
|
+
function tokenizeAnsiWithTheme(a, P, I) {
|
|
571
|
+
let L = resolveColorReplacements(a, I), R = splitLines(P), z = createColorPalette(Object.fromEntries(namedColors.map((P) => {
|
|
572
|
+
let F = `terminal.ansi${P[0].toUpperCase()}${P.substring(1)}`;
|
|
573
|
+
return [P, a.colors?.[F] || defaultAnsiColors[P]];
|
|
574
|
+
}))), H = createAnsiSequenceParser();
|
|
575
|
+
return R.map((P) => H.parse(P[0]).map((I) => {
|
|
576
|
+
let R, B;
|
|
577
|
+
I.decorations.has("reverse") ? (R = I.background ? z.value(I.background) : a.bg, B = I.foreground ? z.value(I.foreground) : a.fg) : (R = I.foreground ? z.value(I.foreground) : a.fg, B = I.background ? z.value(I.background) : void 0), R = applyColorReplacements(R, L), B = applyColorReplacements(B, L), I.decorations.has("dim") && (R = dimColor(R));
|
|
578
|
+
let H = FontStyle.None;
|
|
579
|
+
return I.decorations.has("bold") && (H |= FontStyle.Bold), I.decorations.has("italic") && (H |= FontStyle.Italic), I.decorations.has("underline") && (H |= FontStyle.Underline), I.decorations.has("strikethrough") && (H |= FontStyle.Strikethrough), {
|
|
580
|
+
content: I.value,
|
|
581
|
+
offset: P[1],
|
|
582
|
+
color: R,
|
|
583
|
+
bgColor: B,
|
|
584
|
+
fontStyle: H
|
|
585
|
+
};
|
|
586
|
+
}));
|
|
587
|
+
}
|
|
588
|
+
function dimColor(a) {
|
|
589
|
+
let P = a.match(/#([0-9a-f]{3,8})/i);
|
|
590
|
+
if (P) {
|
|
591
|
+
let a = P[1];
|
|
592
|
+
if (a.length === 8) {
|
|
593
|
+
let P = Math.round(Number.parseInt(a.slice(6, 8), 16) / 2).toString(16).padStart(2, "0");
|
|
594
|
+
return `#${a.slice(0, 6)}${P}`;
|
|
595
|
+
} else if (a.length === 6) return `#${a}80`;
|
|
596
|
+
else if (a.length === 4) {
|
|
597
|
+
let P = a[0], F = a[1], I = a[2], L = a[3];
|
|
598
|
+
return `#${P}${P}${F}${F}${I}${I}${Math.round(Number.parseInt(`${L}${L}`, 16) / 2).toString(16).padStart(2, "0")}`;
|
|
599
|
+
} else if (a.length === 3) {
|
|
600
|
+
let P = a[0], F = a[1], I = a[2];
|
|
601
|
+
return `#${P}${P}${F}${F}${I}${I}80`;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
let F = a.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);
|
|
605
|
+
return F ? `var(${F[1]}-dim)` : a;
|
|
606
|
+
}
|
|
607
|
+
function codeToTokensBase(P, F, I = {}) {
|
|
608
|
+
let { theme: L = P.getLoadedThemes()[0] } = I, R = P.resolveLangAlias(I.lang || "text");
|
|
609
|
+
if (isPlainLang(R) || isNoneTheme(L)) return splitLines(F).map((a) => [{
|
|
610
|
+
content: a[0],
|
|
611
|
+
offset: a[1]
|
|
612
|
+
}]);
|
|
613
|
+
let { theme: z, colorMap: B } = P.setTheme(L);
|
|
614
|
+
if (R === "ansi") return tokenizeAnsiWithTheme(z, F, I);
|
|
615
|
+
let V = P.getLanguage(I.lang || "text");
|
|
616
|
+
if (I.grammarState) {
|
|
617
|
+
if (I.grammarState.lang !== V.name) throw new ShikiError(`Grammar state language "${I.grammarState.lang}" does not match highlight language "${V.name}"`);
|
|
618
|
+
if (!I.grammarState.themes.includes(z.name)) throw new ShikiError(`Grammar state themes "${I.grammarState.themes}" do not contain highlight theme "${z.name}"`);
|
|
619
|
+
}
|
|
620
|
+
return tokenizeWithTheme(F, V, z, B, I);
|
|
621
|
+
}
|
|
622
|
+
function getLastGrammarState(...P) {
|
|
623
|
+
if (P.length === 2) return getLastGrammarStateFromMap(P[1]);
|
|
624
|
+
let [F, I, L = {}] = P, { lang: R = "text", theme: z = F.getLoadedThemes()[0] } = L;
|
|
625
|
+
if (isPlainLang(R) || isNoneTheme(z)) throw new ShikiError("Plain language does not have grammar state");
|
|
626
|
+
if (R === "ansi") throw new ShikiError("ANSI language does not have grammar state");
|
|
627
|
+
let { theme: B, colorMap: V } = F.setTheme(z), H = F.getLanguage(R);
|
|
628
|
+
return new GrammarState(_tokenizeWithTheme(I, H, B, V, L).stateStack, H.name, B.name);
|
|
629
|
+
}
|
|
630
|
+
function tokenizeWithTheme(a, P, F, I, L) {
|
|
631
|
+
let R = _tokenizeWithTheme(a, P, F, I, L), z = new GrammarState(R.stateStack, P.name, F.name);
|
|
632
|
+
return setLastGrammarStateToMap(R.tokens, z), R.tokens;
|
|
633
|
+
}
|
|
634
|
+
function _tokenizeWithTheme(a, F, L, R, z) {
|
|
635
|
+
let H = resolveColorReplacements(L, z), { tokenizeMaxLineLength: U = 0, tokenizeTimeLimit: W = 500 } = z, G = splitLines(a), K = z.grammarState ? getGrammarStack(z.grammarState, L.name) ?? INITIAL : z.grammarContextCode == null ? INITIAL : _tokenizeWithTheme(z.grammarContextCode, F, L, R, {
|
|
636
|
+
...z,
|
|
637
|
+
grammarState: void 0,
|
|
638
|
+
grammarContextCode: void 0
|
|
639
|
+
}).stateStack, q = [], J = [];
|
|
640
|
+
for (let a = 0, I = G.length; a < I; a++) {
|
|
641
|
+
let [I, B] = G[a];
|
|
642
|
+
if (I === "") {
|
|
643
|
+
q = [], J.push([]);
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
if (U > 0 && I.length >= U) {
|
|
647
|
+
q = [], J.push([{
|
|
648
|
+
content: I,
|
|
649
|
+
offset: B,
|
|
650
|
+
color: "",
|
|
651
|
+
fontStyle: 0
|
|
652
|
+
}]);
|
|
653
|
+
continue;
|
|
654
|
+
}
|
|
655
|
+
let Y, X, Z;
|
|
656
|
+
z.includeExplanation && (Y = F.tokenizeLine(I, K, W), X = Y.tokens, Z = 0);
|
|
657
|
+
let Q = F.tokenizeLine2(I, K, W), $ = Q.tokens.length / 2;
|
|
658
|
+
for (let a = 0; a < $; a++) {
|
|
659
|
+
let F = Q.tokens[2 * a], U = a + 1 < $ ? Q.tokens[2 * a + 2] : I.length;
|
|
660
|
+
if (F === U) continue;
|
|
661
|
+
let W = Q.tokens[2 * a + 1], G = applyColorReplacements(R[EncodedTokenMetadata.getForeground(W)], H), K = EncodedTokenMetadata.getFontStyle(W), J = {
|
|
662
|
+
content: I.substring(F, U),
|
|
663
|
+
offset: B + F,
|
|
664
|
+
color: G,
|
|
665
|
+
fontStyle: K
|
|
666
|
+
};
|
|
667
|
+
if (z.includeExplanation) {
|
|
668
|
+
let a = [];
|
|
669
|
+
if (z.includeExplanation !== "scopeName") for (let P of L.settings) {
|
|
670
|
+
let F;
|
|
671
|
+
switch (typeof P.scope) {
|
|
672
|
+
case "string":
|
|
673
|
+
F = P.scope.split(/,/).map((a) => a.trim());
|
|
674
|
+
break;
|
|
675
|
+
case "object":
|
|
676
|
+
F = P.scope;
|
|
677
|
+
break;
|
|
678
|
+
default: continue;
|
|
679
|
+
}
|
|
680
|
+
a.push({
|
|
681
|
+
settings: P,
|
|
682
|
+
selectors: F.map((a) => a.split(/ /))
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
J.explanation = [];
|
|
686
|
+
let P = 0;
|
|
687
|
+
for (; F + P < U;) {
|
|
688
|
+
let F = X[Z], L = I.substring(F.startIndex, F.endIndex);
|
|
689
|
+
P += L.length, J.explanation.push({
|
|
690
|
+
content: L,
|
|
691
|
+
scopes: z.includeExplanation === "scopeName" ? explainThemeScopesNameOnly(F.scopes) : explainThemeScopesFull(a, F.scopes)
|
|
692
|
+
}), Z += 1;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
q.push(J);
|
|
696
|
+
}
|
|
697
|
+
J.push(q), q = [], K = Q.ruleStack;
|
|
698
|
+
}
|
|
699
|
+
return {
|
|
700
|
+
tokens: J,
|
|
701
|
+
stateStack: K
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
function explainThemeScopesNameOnly(a) {
|
|
705
|
+
return a.map((a) => ({ scopeName: a }));
|
|
706
|
+
}
|
|
707
|
+
function explainThemeScopesFull(a, P) {
|
|
708
|
+
let F = [];
|
|
709
|
+
for (let I = 0, L = P.length; I < L; I++) {
|
|
710
|
+
let L = P[I];
|
|
711
|
+
F[I] = {
|
|
712
|
+
scopeName: L,
|
|
713
|
+
themeMatches: explainThemeScope(a, L, P.slice(0, I))
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
return F;
|
|
717
|
+
}
|
|
718
|
+
function matchesOne(a, P) {
|
|
719
|
+
return a === P || P.substring(0, a.length) === a && P[a.length] === ".";
|
|
720
|
+
}
|
|
721
|
+
function matches(a, P, F) {
|
|
722
|
+
if (!matchesOne(a[a.length - 1], P)) return !1;
|
|
723
|
+
let I = a.length - 2, L = F.length - 1;
|
|
724
|
+
for (; I >= 0 && L >= 0;) matchesOne(a[I], F[L]) && --I, --L;
|
|
725
|
+
return I === -1;
|
|
726
|
+
}
|
|
727
|
+
function explainThemeScope(a, P, F) {
|
|
728
|
+
let I = [];
|
|
729
|
+
for (let { selectors: L, settings: R } of a) for (let a of L) if (matches(a, P, F)) {
|
|
730
|
+
I.push(R);
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
733
|
+
return I;
|
|
734
|
+
}
|
|
735
|
+
function codeToTokensWithThemes(a, P, F) {
|
|
736
|
+
let I = Object.entries(F.themes).filter((a) => a[1]).map((a) => ({
|
|
737
|
+
color: a[0],
|
|
738
|
+
theme: a[1]
|
|
739
|
+
})), L = I.map((I) => {
|
|
740
|
+
let L = codeToTokensBase(a, P, {
|
|
741
|
+
...F,
|
|
742
|
+
theme: I.theme
|
|
743
|
+
});
|
|
744
|
+
return {
|
|
745
|
+
tokens: L,
|
|
746
|
+
state: getLastGrammarStateFromMap(L),
|
|
747
|
+
theme: typeof I.theme == "string" ? I.theme : I.theme.name
|
|
748
|
+
};
|
|
749
|
+
}), R = syncThemesTokenization(...L.map((a) => a.tokens)), z = R[0].map((a, P) => a.map((a, L) => {
|
|
750
|
+
let z = {
|
|
751
|
+
content: a.content,
|
|
752
|
+
variants: {},
|
|
753
|
+
offset: a.offset
|
|
754
|
+
};
|
|
755
|
+
return "includeExplanation" in F && F.includeExplanation && (z.explanation = a.explanation), R.forEach((a, F) => {
|
|
756
|
+
let { content: R, explanation: B, offset: V, ...H } = a[P][L];
|
|
757
|
+
z.variants[I[F].color] = H;
|
|
758
|
+
}), z;
|
|
759
|
+
})), B = L[0].state ? new GrammarState(Object.fromEntries(L.map((a) => [a.theme, a.state?.getInternalStack(a.theme)])), L[0].state.lang) : void 0;
|
|
760
|
+
return B && setLastGrammarStateToMap(z, B), z;
|
|
761
|
+
}
|
|
762
|
+
function syncThemesTokenization(...a) {
|
|
763
|
+
let P = a.map(() => []), F = a.length;
|
|
764
|
+
for (let I = 0; I < a[0].length; I++) {
|
|
765
|
+
let L = a.map((a) => a[I]), R = P.map(() => []);
|
|
766
|
+
P.forEach((a, P) => a.push(R[P]));
|
|
767
|
+
let z = L.map(() => 0), B = L.map((a) => a[0]);
|
|
768
|
+
for (; B.every((a) => a);) {
|
|
769
|
+
let a = Math.min(...B.map((a) => a.content.length));
|
|
770
|
+
for (let P = 0; P < F; P++) {
|
|
771
|
+
let F = B[P];
|
|
772
|
+
F.content.length === a ? (R[P].push(F), z[P] += 1, B[P] = L[P][z[P]]) : (R[P].push({
|
|
773
|
+
...F,
|
|
774
|
+
content: F.content.slice(0, a)
|
|
775
|
+
}), B[P] = {
|
|
776
|
+
...F,
|
|
777
|
+
content: F.content.slice(a),
|
|
778
|
+
offset: F.offset + a
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
return P;
|
|
784
|
+
}
|
|
785
|
+
function codeToTokens(P, F, I) {
|
|
786
|
+
let L, R, z, H, U, W;
|
|
787
|
+
if ("themes" in I) {
|
|
788
|
+
let { defaultColor: V = "light", cssVariablePrefix: G = "--shiki-", colorsRendering: K = "css-vars" } = I, q = Object.entries(I.themes).filter((a) => a[1]).map((a) => ({
|
|
789
|
+
color: a[0],
|
|
790
|
+
theme: a[1]
|
|
791
|
+
})).sort((a, P) => a.color === V ? -1 : P.color === V ? 1 : 0);
|
|
792
|
+
if (q.length === 0) throw new ShikiError("`themes` option must not be empty");
|
|
793
|
+
let J = codeToTokensWithThemes(P, F, I);
|
|
794
|
+
if (W = getLastGrammarStateFromMap(J), V && DEFAULT_COLOR_LIGHT_DARK !== V && !q.find((a) => a.color === V)) throw new ShikiError(`\`themes\` option must contain the defaultColor key \`${V}\``);
|
|
795
|
+
let Y = q.map((a) => P.getTheme(a.theme)), X = q.map((a) => a.color);
|
|
796
|
+
z = J.map((a) => a.map((a) => flatTokenVariants(a, X, G, V, K))), W && setLastGrammarStateToMap(z, W);
|
|
797
|
+
let Z = q.map((a) => resolveColorReplacements(a.theme, I));
|
|
798
|
+
R = mapThemeColors(q, Y, Z, G, V, "fg", K), L = mapThemeColors(q, Y, Z, G, V, "bg", K), H = `shiki-themes ${Y.map((a) => a.name).join(" ")}`, U = V ? void 0 : [R, L].join(";");
|
|
799
|
+
} else if ("theme" in I) {
|
|
800
|
+
let a = resolveColorReplacements(I.theme, I);
|
|
801
|
+
z = codeToTokensBase(P, F, I);
|
|
802
|
+
let U = P.getTheme(I.theme);
|
|
803
|
+
L = applyColorReplacements(U.bg, a), R = applyColorReplacements(U.fg, a), H = U.name, W = getLastGrammarStateFromMap(z);
|
|
804
|
+
} else throw new ShikiError("Invalid options, either `theme` or `themes` must be provided");
|
|
805
|
+
return {
|
|
806
|
+
tokens: z,
|
|
807
|
+
fg: R,
|
|
808
|
+
bg: L,
|
|
809
|
+
themeName: H,
|
|
810
|
+
rootStyle: U,
|
|
811
|
+
grammarState: W
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
function mapThemeColors(P, F, I, L, R, z, B) {
|
|
815
|
+
return P.map((H, U) => {
|
|
816
|
+
let W = applyColorReplacements(F[U][z], I[U]) || "inherit", G = `${L + H.color}${z === "bg" ? "-bg" : ""}:${W}`;
|
|
817
|
+
if (U === 0 && R) {
|
|
818
|
+
if (R === DEFAULT_COLOR_LIGHT_DARK && P.length > 1) {
|
|
819
|
+
let L = P.findIndex((a) => a.color === "light"), R = P.findIndex((a) => a.color === "dark");
|
|
820
|
+
if (L === -1 || R === -1) throw new ShikiError("When using `defaultColor: \"light-dark()\"`, you must provide both `light` and `dark` themes");
|
|
821
|
+
return `light-dark(${applyColorReplacements(F[L][z], I[L]) || "inherit"}, ${applyColorReplacements(F[R][z], I[R]) || "inherit"});${G}`;
|
|
822
|
+
}
|
|
823
|
+
return W;
|
|
824
|
+
}
|
|
825
|
+
return B === "css-vars" ? G : null;
|
|
826
|
+
}).filter((a) => !!a).join(";");
|
|
827
|
+
}
|
|
828
|
+
function codeToHast(a, P, F, I = {
|
|
829
|
+
meta: {},
|
|
830
|
+
options: F,
|
|
831
|
+
codeToHast: (P, F) => codeToHast(a, P, F),
|
|
832
|
+
codeToTokens: (P, F) => codeToTokens(a, P, F)
|
|
833
|
+
}) {
|
|
834
|
+
let L = P;
|
|
835
|
+
for (let a of getTransformers(F)) L = a.preprocess?.call(I, L, F) || L;
|
|
836
|
+
let { tokens: R, fg: z, bg: B, themeName: V, rootStyle: H, grammarState: U } = codeToTokens(a, L, F), { mergeWhitespaces: W = !0, mergeSameStyleTokens: G = !1 } = F;
|
|
837
|
+
W === !0 ? R = mergeWhitespaceTokens(R) : W === "never" && (R = splitWhitespaceTokens(R)), G && (R = mergeAdjacentStyledTokens(R));
|
|
838
|
+
let K = {
|
|
839
|
+
...I,
|
|
840
|
+
get source() {
|
|
841
|
+
return L;
|
|
842
|
+
}
|
|
843
|
+
};
|
|
844
|
+
for (let a of getTransformers(F)) R = a.tokens?.call(K, R) || R;
|
|
845
|
+
return tokensToHast(R, {
|
|
846
|
+
...F,
|
|
847
|
+
fg: z,
|
|
848
|
+
bg: B,
|
|
849
|
+
themeName: V,
|
|
850
|
+
rootStyle: F.rootStyle === !1 ? !1 : F.rootStyle ?? H
|
|
851
|
+
}, K, U);
|
|
852
|
+
}
|
|
853
|
+
function tokensToHast(a, P, F, I = getLastGrammarStateFromMap(a)) {
|
|
854
|
+
let L = getTransformers(P), R = [], z = {
|
|
855
|
+
type: "root",
|
|
856
|
+
children: []
|
|
857
|
+
}, { structure: B = "classic", tabindex: V = "0" } = P, H = { class: `shiki ${P.themeName || ""}` };
|
|
858
|
+
P.rootStyle !== !1 && (P.rootStyle == null ? H.style = `background-color:${P.bg};color:${P.fg}` : H.style = P.rootStyle), V !== !1 && V != null && (H.tabindex = V.toString());
|
|
859
|
+
for (let [a, F] of Object.entries(P.meta || {})) a.startsWith("_") || (H[a] = F);
|
|
860
|
+
let U = {
|
|
861
|
+
type: "element",
|
|
862
|
+
tagName: "pre",
|
|
863
|
+
properties: H,
|
|
864
|
+
children: [],
|
|
865
|
+
data: P.data
|
|
866
|
+
}, W = {
|
|
867
|
+
type: "element",
|
|
868
|
+
tagName: "code",
|
|
869
|
+
properties: {},
|
|
870
|
+
children: R
|
|
871
|
+
}, G = [], K = {
|
|
872
|
+
...F,
|
|
873
|
+
structure: B,
|
|
874
|
+
addClassToHast,
|
|
875
|
+
get source() {
|
|
876
|
+
return F.source;
|
|
877
|
+
},
|
|
878
|
+
get tokens() {
|
|
879
|
+
return a;
|
|
880
|
+
},
|
|
881
|
+
get options() {
|
|
882
|
+
return P;
|
|
883
|
+
},
|
|
884
|
+
get root() {
|
|
885
|
+
return z;
|
|
886
|
+
},
|
|
887
|
+
get pre() {
|
|
888
|
+
return U;
|
|
889
|
+
},
|
|
890
|
+
get code() {
|
|
891
|
+
return W;
|
|
892
|
+
},
|
|
893
|
+
get lines() {
|
|
894
|
+
return G;
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
if (a.forEach((a, P) => {
|
|
898
|
+
P && (B === "inline" ? z.children.push({
|
|
899
|
+
type: "element",
|
|
900
|
+
tagName: "br",
|
|
901
|
+
properties: {},
|
|
902
|
+
children: []
|
|
903
|
+
}) : B === "classic" && R.push({
|
|
904
|
+
type: "text",
|
|
905
|
+
value: "\n"
|
|
906
|
+
}));
|
|
907
|
+
let F = {
|
|
908
|
+
type: "element",
|
|
909
|
+
tagName: "span",
|
|
910
|
+
properties: { class: "line" },
|
|
911
|
+
children: []
|
|
912
|
+
}, I = 0;
|
|
913
|
+
for (let R of a) {
|
|
914
|
+
let a = {
|
|
915
|
+
type: "element",
|
|
916
|
+
tagName: "span",
|
|
917
|
+
properties: { ...R.htmlAttrs },
|
|
918
|
+
children: [{
|
|
919
|
+
type: "text",
|
|
920
|
+
value: R.content
|
|
921
|
+
}]
|
|
922
|
+
}, V = stringifyTokenStyle(R.htmlStyle || getTokenStyleObject(R));
|
|
923
|
+
V && (a.properties.style = V);
|
|
924
|
+
for (let z of L) a = z?.span?.call(K, a, P + 1, I, F, R) || a;
|
|
925
|
+
B === "inline" ? z.children.push(a) : B === "classic" && F.children.push(a), I += R.content.length;
|
|
926
|
+
}
|
|
927
|
+
if (B === "classic") {
|
|
928
|
+
for (let a of L) F = a?.line?.call(K, F, P + 1) || F;
|
|
929
|
+
G.push(F), R.push(F);
|
|
930
|
+
} else B === "inline" && G.push(F);
|
|
931
|
+
}), B === "classic") {
|
|
932
|
+
for (let a of L) W = a?.code?.call(K, W) || W;
|
|
933
|
+
U.children.push(W);
|
|
934
|
+
for (let a of L) U = a?.pre?.call(K, U) || U;
|
|
935
|
+
z.children.push(U);
|
|
936
|
+
} else if (B === "inline") {
|
|
937
|
+
let a = [], P = {
|
|
938
|
+
type: "element",
|
|
939
|
+
tagName: "span",
|
|
940
|
+
properties: { class: "line" },
|
|
941
|
+
children: []
|
|
942
|
+
};
|
|
943
|
+
for (let F of z.children) F.type === "element" && F.tagName === "br" ? (a.push(P), P = {
|
|
944
|
+
type: "element",
|
|
945
|
+
tagName: "span",
|
|
946
|
+
properties: { class: "line" },
|
|
947
|
+
children: []
|
|
948
|
+
}) : (F.type === "element" || F.type === "text") && P.children.push(F);
|
|
949
|
+
a.push(P);
|
|
950
|
+
let F = {
|
|
951
|
+
type: "element",
|
|
952
|
+
tagName: "code",
|
|
953
|
+
properties: {},
|
|
954
|
+
children: a
|
|
955
|
+
};
|
|
956
|
+
for (let a of L) F = a?.code?.call(K, F) || F;
|
|
957
|
+
z.children = [];
|
|
958
|
+
for (let a = 0; a < F.children.length; a++) {
|
|
959
|
+
a > 0 && z.children.push({
|
|
960
|
+
type: "element",
|
|
961
|
+
tagName: "br",
|
|
962
|
+
properties: {},
|
|
963
|
+
children: []
|
|
964
|
+
});
|
|
965
|
+
let P = F.children[a];
|
|
966
|
+
P.type === "element" && z.children.push(...P.children);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
let q = z;
|
|
970
|
+
for (let a of L) q = a?.root?.call(K, q) || q;
|
|
971
|
+
return I && setLastGrammarStateToMap(q, I), q;
|
|
972
|
+
}
|
|
973
|
+
function mergeWhitespaceTokens(a) {
|
|
974
|
+
return a.map((a) => {
|
|
975
|
+
let P = [], I = "", L;
|
|
976
|
+
return a.forEach((R, z) => {
|
|
977
|
+
let B = !(R.fontStyle && (R.fontStyle & FontStyle.Underline || R.fontStyle & FontStyle.Strikethrough));
|
|
978
|
+
B && R.content.match(/^\s+$/) && a[z + 1] ? (L === void 0 && (L = R.offset), I += R.content) : I ? (B ? P.push({
|
|
979
|
+
...R,
|
|
980
|
+
offset: L,
|
|
981
|
+
content: I + R.content
|
|
982
|
+
}) : P.push({
|
|
983
|
+
content: I,
|
|
984
|
+
offset: L
|
|
985
|
+
}, R), L = void 0, I = "") : P.push(R);
|
|
986
|
+
}), P;
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
function splitWhitespaceTokens(a) {
|
|
990
|
+
return a.map((a) => a.flatMap((a) => {
|
|
991
|
+
if (a.content.match(/^\s+$/)) return a;
|
|
992
|
+
let P = a.content.match(/^(\s*)(.*?)(\s*)$/);
|
|
993
|
+
if (!P) return a;
|
|
994
|
+
let [, F, I, L] = P;
|
|
995
|
+
if (!F && !L) return a;
|
|
996
|
+
let R = [{
|
|
997
|
+
...a,
|
|
998
|
+
offset: a.offset + F.length,
|
|
999
|
+
content: I
|
|
1000
|
+
}];
|
|
1001
|
+
return F && R.unshift({
|
|
1002
|
+
content: F,
|
|
1003
|
+
offset: a.offset
|
|
1004
|
+
}), L && R.push({
|
|
1005
|
+
content: L,
|
|
1006
|
+
offset: a.offset + F.length + I.length
|
|
1007
|
+
}), R;
|
|
1008
|
+
}));
|
|
1009
|
+
}
|
|
1010
|
+
function mergeAdjacentStyledTokens(a) {
|
|
1011
|
+
return a.map((a) => {
|
|
1012
|
+
let P = [];
|
|
1013
|
+
for (let I of a) {
|
|
1014
|
+
if (P.length === 0) {
|
|
1015
|
+
P.push({ ...I });
|
|
1016
|
+
continue;
|
|
1017
|
+
}
|
|
1018
|
+
let a = P[P.length - 1], L = stringifyTokenStyle(a.htmlStyle || getTokenStyleObject(a)), R = stringifyTokenStyle(I.htmlStyle || getTokenStyleObject(I)), z = a.fontStyle && (a.fontStyle & FontStyle.Underline || a.fontStyle & FontStyle.Strikethrough), B = I.fontStyle && (I.fontStyle & FontStyle.Underline || I.fontStyle & FontStyle.Strikethrough);
|
|
1019
|
+
!z && !B && L === R ? a.content += I.content : P.push({ ...I });
|
|
1020
|
+
}
|
|
1021
|
+
return P;
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
var hastToHtml = toHtml;
|
|
1025
|
+
function codeToHtml(a, P, F) {
|
|
1026
|
+
let I = {
|
|
1027
|
+
meta: {},
|
|
1028
|
+
options: F,
|
|
1029
|
+
codeToHast: (P, F) => codeToHast(a, P, F),
|
|
1030
|
+
codeToTokens: (P, F) => codeToTokens(a, P, F)
|
|
1031
|
+
}, L = hastToHtml(codeToHast(a, P, F, I));
|
|
1032
|
+
for (let a of getTransformers(F)) L = a.postprocess?.call(I, L, F) || L;
|
|
1033
|
+
return L;
|
|
1034
|
+
}
|
|
1035
|
+
var VSCODE_FALLBACK_EDITOR_FG = {
|
|
1036
|
+
light: "#333333",
|
|
1037
|
+
dark: "#bbbbbb"
|
|
1038
|
+
}, VSCODE_FALLBACK_EDITOR_BG = {
|
|
1039
|
+
light: "#fffffe",
|
|
1040
|
+
dark: "#1e1e1e"
|
|
1041
|
+
}, RESOLVED_KEY = "__shiki_resolved";
|
|
1042
|
+
function normalizeTheme(a) {
|
|
1043
|
+
if (a?.[RESOLVED_KEY]) return a;
|
|
1044
|
+
let P = { ...a };
|
|
1045
|
+
P.tokenColors && !P.settings && (P.settings = P.tokenColors, delete P.tokenColors), P.type ||= "dark", P.colorReplacements = { ...P.colorReplacements }, P.settings ||= [];
|
|
1046
|
+
let { bg: F, fg: I } = P;
|
|
1047
|
+
if (!F || !I) {
|
|
1048
|
+
let a = P.settings ? P.settings.find((a) => !a.name && !a.scope) : void 0;
|
|
1049
|
+
a?.settings?.foreground && (I = a.settings.foreground), a?.settings?.background && (F = a.settings.background), !I && P?.colors?.["editor.foreground"] && (I = P.colors["editor.foreground"]), !F && P?.colors?.["editor.background"] && (F = P.colors["editor.background"]), I ||= P.type === "light" ? VSCODE_FALLBACK_EDITOR_FG.light : VSCODE_FALLBACK_EDITOR_FG.dark, F ||= P.type === "light" ? VSCODE_FALLBACK_EDITOR_BG.light : VSCODE_FALLBACK_EDITOR_BG.dark, P.fg = I, P.bg = F;
|
|
1050
|
+
}
|
|
1051
|
+
P.settings[0] && P.settings[0].settings && !P.settings[0].scope || P.settings.unshift({ settings: {
|
|
1052
|
+
foreground: P.fg,
|
|
1053
|
+
background: P.bg
|
|
1054
|
+
} });
|
|
1055
|
+
let L = 0, R = /* @__PURE__ */ new Map();
|
|
1056
|
+
function z(a) {
|
|
1057
|
+
if (R.has(a)) return R.get(a);
|
|
1058
|
+
L += 1;
|
|
1059
|
+
let F = `#${L.toString(16).padStart(8, "0").toLowerCase()}`;
|
|
1060
|
+
return P.colorReplacements?.[`#${F}`] ? z(a) : (R.set(a, F), F);
|
|
1061
|
+
}
|
|
1062
|
+
P.settings = P.settings.map((a) => {
|
|
1063
|
+
let F = a.settings?.foreground && !a.settings.foreground.startsWith("#"), I = a.settings?.background && !a.settings.background.startsWith("#");
|
|
1064
|
+
if (!F && !I) return a;
|
|
1065
|
+
let L = {
|
|
1066
|
+
...a,
|
|
1067
|
+
settings: { ...a.settings }
|
|
1068
|
+
};
|
|
1069
|
+
if (F) {
|
|
1070
|
+
let F = z(a.settings.foreground);
|
|
1071
|
+
P.colorReplacements[F] = a.settings.foreground, L.settings.foreground = F;
|
|
1072
|
+
}
|
|
1073
|
+
if (I) {
|
|
1074
|
+
let F = z(a.settings.background);
|
|
1075
|
+
P.colorReplacements[F] = a.settings.background, L.settings.background = F;
|
|
1076
|
+
}
|
|
1077
|
+
return L;
|
|
1078
|
+
});
|
|
1079
|
+
for (let a of Object.keys(P.colors || {})) if ((a === "editor.foreground" || a === "editor.background" || a.startsWith("terminal.ansi")) && !P.colors[a]?.startsWith("#")) {
|
|
1080
|
+
let F = z(P.colors[a]);
|
|
1081
|
+
P.colorReplacements[F] = P.colors[a], P.colors[a] = F;
|
|
1082
|
+
}
|
|
1083
|
+
return Object.defineProperty(P, RESOLVED_KEY, {
|
|
1084
|
+
enumerable: !1,
|
|
1085
|
+
writable: !1,
|
|
1086
|
+
value: !0
|
|
1087
|
+
}), P;
|
|
1088
|
+
}
|
|
1089
|
+
async function resolveLangs(a) {
|
|
1090
|
+
return Array.from(new Set((await Promise.all(a.filter((a) => !isSpecialLang(a)).map(async (a) => await normalizeGetter(a).then((a) => Array.isArray(a) ? a : [a])))).flat()));
|
|
1091
|
+
}
|
|
1092
|
+
async function resolveThemes(a) {
|
|
1093
|
+
return (await Promise.all(a.map(async (a) => isSpecialTheme(a) ? null : normalizeTheme(await normalizeGetter(a))))).filter((a) => !!a);
|
|
1094
|
+
}
|
|
1095
|
+
var _emitDeprecation = 3, _emitError = !1;
|
|
1096
|
+
function warnDeprecated(a, P = 3) {
|
|
1097
|
+
if (_emitDeprecation && !(typeof _emitDeprecation == "number" && P > _emitDeprecation)) {
|
|
1098
|
+
if (_emitError) throw Error(`[SHIKI DEPRECATE]: ${a}`);
|
|
1099
|
+
console.trace(`[SHIKI DEPRECATE]: ${a}`);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
var ShikiError$1 = class extends Error {
|
|
1103
|
+
constructor(a) {
|
|
1104
|
+
super(a), this.name = "ShikiError";
|
|
1105
|
+
}
|
|
1106
|
+
};
|
|
1107
|
+
function resolveLangAlias(a, P) {
|
|
1108
|
+
if (!P) return a;
|
|
1109
|
+
if (P[a]) {
|
|
1110
|
+
let F = /* @__PURE__ */ new Set([a]);
|
|
1111
|
+
for (; P[a];) {
|
|
1112
|
+
if (a = P[a], F.has(a)) throw new ShikiError$1(`Circular alias \`${Array.from(F).join(" -> ")} -> ${a}\``);
|
|
1113
|
+
F.add(a);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
return a;
|
|
1117
|
+
}
|
|
1118
|
+
var Registry$1 = class extends Registry {
|
|
1119
|
+
constructor(a, P, F, I = {}) {
|
|
1120
|
+
super(a), this._resolver = a, this._themes = P, this._langs = F, this._alias = I, this._themes.map((a) => this.loadTheme(a)), this.loadLanguages(this._langs);
|
|
1121
|
+
}
|
|
1122
|
+
_resolvedThemes = /* @__PURE__ */ new Map();
|
|
1123
|
+
_resolvedGrammars = /* @__PURE__ */ new Map();
|
|
1124
|
+
_langMap = /* @__PURE__ */ new Map();
|
|
1125
|
+
_langGraph = /* @__PURE__ */ new Map();
|
|
1126
|
+
_textmateThemeCache = /* @__PURE__ */ new WeakMap();
|
|
1127
|
+
_loadedThemesCache = null;
|
|
1128
|
+
_loadedLanguagesCache = null;
|
|
1129
|
+
getTheme(a) {
|
|
1130
|
+
return typeof a == "string" ? this._resolvedThemes.get(a) : this.loadTheme(a);
|
|
1131
|
+
}
|
|
1132
|
+
loadTheme(a) {
|
|
1133
|
+
let P = normalizeTheme(a);
|
|
1134
|
+
return P.name && (this._resolvedThemes.set(P.name, P), this._loadedThemesCache = null), P;
|
|
1135
|
+
}
|
|
1136
|
+
getLoadedThemes() {
|
|
1137
|
+
return this._loadedThemesCache ||= [...this._resolvedThemes.keys()], this._loadedThemesCache;
|
|
1138
|
+
}
|
|
1139
|
+
setTheme(a) {
|
|
1140
|
+
let P = this._textmateThemeCache.get(a);
|
|
1141
|
+
P || (P = Theme.createFromRawTheme(a), this._textmateThemeCache.set(a, P)), this._syncRegistry.setTheme(P);
|
|
1142
|
+
}
|
|
1143
|
+
getGrammar(a) {
|
|
1144
|
+
return a = resolveLangAlias(a, this._alias), this._resolvedGrammars.get(a);
|
|
1145
|
+
}
|
|
1146
|
+
loadLanguage(a) {
|
|
1147
|
+
if (this.getGrammar(a.name)) return;
|
|
1148
|
+
let P = new Set([...this._langMap.values()].filter((P) => P.embeddedLangsLazy?.includes(a.name)));
|
|
1149
|
+
this._resolver.addLanguage(a);
|
|
1150
|
+
let F = {
|
|
1151
|
+
balancedBracketSelectors: a.balancedBracketSelectors || ["*"],
|
|
1152
|
+
unbalancedBracketSelectors: a.unbalancedBracketSelectors || []
|
|
1153
|
+
};
|
|
1154
|
+
this._syncRegistry._rawGrammars.set(a.scopeName, a);
|
|
1155
|
+
let I = this.loadGrammarWithConfiguration(a.scopeName, 1, F);
|
|
1156
|
+
if (I.name = a.name, this._resolvedGrammars.set(a.name, I), a.aliases && a.aliases.forEach((P) => {
|
|
1157
|
+
this._alias[P] = a.name;
|
|
1158
|
+
}), this._loadedLanguagesCache = null, P.size) for (let a of P) this._resolvedGrammars.delete(a.name), this._loadedLanguagesCache = null, this._syncRegistry?._injectionGrammars?.delete(a.scopeName), this._syncRegistry?._grammars?.delete(a.scopeName), this.loadLanguage(this._langMap.get(a.name));
|
|
1159
|
+
}
|
|
1160
|
+
dispose() {
|
|
1161
|
+
super.dispose(), this._resolvedThemes.clear(), this._resolvedGrammars.clear(), this._langMap.clear(), this._langGraph.clear(), this._loadedThemesCache = null;
|
|
1162
|
+
}
|
|
1163
|
+
loadLanguages(a) {
|
|
1164
|
+
for (let P of a) this.resolveEmbeddedLanguages(P);
|
|
1165
|
+
let P = Array.from(this._langGraph.entries()), F = P.filter(([a, P]) => !P);
|
|
1166
|
+
if (F.length) {
|
|
1167
|
+
let a = P.filter(([a, P]) => P ? (P.embeddedLanguages || P.embeddedLangs)?.some((a) => F.map(([a]) => a).includes(a)) : !1).filter((a) => !F.includes(a));
|
|
1168
|
+
throw new ShikiError$1(`Missing languages ${F.map(([a]) => `\`${a}\``).join(", ")}, required by ${a.map(([a]) => `\`${a}\``).join(", ")}`);
|
|
1169
|
+
}
|
|
1170
|
+
for (let [a, F] of P) this._resolver.addLanguage(F);
|
|
1171
|
+
for (let [a, F] of P) this.loadLanguage(F);
|
|
1172
|
+
}
|
|
1173
|
+
getLoadedLanguages() {
|
|
1174
|
+
return this._loadedLanguagesCache ||= [.../* @__PURE__ */ new Set([...this._resolvedGrammars.keys(), ...Object.keys(this._alias)])], this._loadedLanguagesCache;
|
|
1175
|
+
}
|
|
1176
|
+
resolveEmbeddedLanguages(a) {
|
|
1177
|
+
this._langMap.set(a.name, a), this._langGraph.set(a.name, a);
|
|
1178
|
+
let P = a.embeddedLanguages ?? a.embeddedLangs;
|
|
1179
|
+
if (P) for (let a of P) this._langGraph.set(a, this._langMap.get(a));
|
|
1180
|
+
}
|
|
1181
|
+
}, Resolver = class {
|
|
1182
|
+
_langs = /* @__PURE__ */ new Map();
|
|
1183
|
+
_scopeToLang = /* @__PURE__ */ new Map();
|
|
1184
|
+
_injections = /* @__PURE__ */ new Map();
|
|
1185
|
+
_onigLib;
|
|
1186
|
+
constructor(a, P) {
|
|
1187
|
+
this._onigLib = {
|
|
1188
|
+
createOnigScanner: (P) => a.createScanner(P),
|
|
1189
|
+
createOnigString: (P) => a.createString(P)
|
|
1190
|
+
}, P.forEach((a) => this.addLanguage(a));
|
|
1191
|
+
}
|
|
1192
|
+
get onigLib() {
|
|
1193
|
+
return this._onigLib;
|
|
1194
|
+
}
|
|
1195
|
+
getLangRegistration(a) {
|
|
1196
|
+
return this._langs.get(a);
|
|
1197
|
+
}
|
|
1198
|
+
loadGrammar(a) {
|
|
1199
|
+
return this._scopeToLang.get(a);
|
|
1200
|
+
}
|
|
1201
|
+
addLanguage(a) {
|
|
1202
|
+
this._langs.set(a.name, a), a.aliases && a.aliases.forEach((P) => {
|
|
1203
|
+
this._langs.set(P, a);
|
|
1204
|
+
}), this._scopeToLang.set(a.scopeName, a), a.injectTo && a.injectTo.forEach((P) => {
|
|
1205
|
+
this._injections.get(P) || this._injections.set(P, []), this._injections.get(P).push(a.scopeName);
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
getInjections(a) {
|
|
1209
|
+
let P = a.split("."), F = [];
|
|
1210
|
+
for (let a = 1; a <= P.length; a++) {
|
|
1211
|
+
let I = P.slice(0, a).join(".");
|
|
1212
|
+
F = [...F, ...this._injections.get(I) || []];
|
|
1213
|
+
}
|
|
1214
|
+
return F;
|
|
1215
|
+
}
|
|
1216
|
+
}, instancesCount = 0;
|
|
1217
|
+
function createShikiInternalSync(a) {
|
|
1218
|
+
instancesCount += 1, a.warnings !== !1 && instancesCount >= 10 && instancesCount % 10 == 0 && console.warn(`[Shiki] ${instancesCount} 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.`);
|
|
1219
|
+
let P = !1;
|
|
1220
|
+
if (!a.engine) throw new ShikiError$1("`engine` option is required for synchronous mode");
|
|
1221
|
+
let F = (a.langs || []).flat(1), I = (a.themes || []).flat(1).map(normalizeTheme), L = new Registry$1(new Resolver(a.engine, F), I, F, a.langAlias), R;
|
|
1222
|
+
function z(P) {
|
|
1223
|
+
return resolveLangAlias(P, a.langAlias);
|
|
1224
|
+
}
|
|
1225
|
+
function B(a) {
|
|
1226
|
+
Y();
|
|
1227
|
+
let P = L.getGrammar(typeof a == "string" ? a : a.name);
|
|
1228
|
+
if (!P) throw new ShikiError$1(`Language \`${a}\` not found, you may need to load it first`);
|
|
1229
|
+
return P;
|
|
1230
|
+
}
|
|
1231
|
+
function V(a) {
|
|
1232
|
+
if (a === "none") return {
|
|
1233
|
+
bg: "",
|
|
1234
|
+
fg: "",
|
|
1235
|
+
name: "none",
|
|
1236
|
+
settings: [],
|
|
1237
|
+
type: "dark"
|
|
1238
|
+
};
|
|
1239
|
+
Y();
|
|
1240
|
+
let P = L.getTheme(a);
|
|
1241
|
+
if (!P) throw new ShikiError$1(`Theme \`${a}\` not found, you may need to load it first`);
|
|
1242
|
+
return P;
|
|
1243
|
+
}
|
|
1244
|
+
function H(a) {
|
|
1245
|
+
Y();
|
|
1246
|
+
let P = V(a);
|
|
1247
|
+
return R !== a && (L.setTheme(P), R = a), {
|
|
1248
|
+
theme: P,
|
|
1249
|
+
colorMap: L.getColorMap()
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
function U() {
|
|
1253
|
+
return Y(), L.getLoadedThemes();
|
|
1254
|
+
}
|
|
1255
|
+
function W() {
|
|
1256
|
+
return Y(), L.getLoadedLanguages();
|
|
1257
|
+
}
|
|
1258
|
+
function G(...a) {
|
|
1259
|
+
Y(), L.loadLanguages(a.flat(1));
|
|
1260
|
+
}
|
|
1261
|
+
async function K(...a) {
|
|
1262
|
+
return G(await resolveLangs(a));
|
|
1263
|
+
}
|
|
1264
|
+
function q(...a) {
|
|
1265
|
+
Y();
|
|
1266
|
+
for (let P of a.flat(1)) L.loadTheme(P);
|
|
1267
|
+
}
|
|
1268
|
+
async function J(...a) {
|
|
1269
|
+
return Y(), q(await resolveThemes(a));
|
|
1270
|
+
}
|
|
1271
|
+
function Y() {
|
|
1272
|
+
if (P) throw new ShikiError$1("Shiki instance has been disposed");
|
|
1273
|
+
}
|
|
1274
|
+
function X() {
|
|
1275
|
+
P || (P = !0, L.dispose(), --instancesCount);
|
|
1276
|
+
}
|
|
1277
|
+
return {
|
|
1278
|
+
setTheme: H,
|
|
1279
|
+
getTheme: V,
|
|
1280
|
+
getLanguage: B,
|
|
1281
|
+
getLoadedThemes: U,
|
|
1282
|
+
getLoadedLanguages: W,
|
|
1283
|
+
resolveLangAlias: z,
|
|
1284
|
+
loadLanguage: K,
|
|
1285
|
+
loadLanguageSync: G,
|
|
1286
|
+
loadTheme: J,
|
|
1287
|
+
loadThemeSync: q,
|
|
1288
|
+
dispose: X,
|
|
1289
|
+
[Symbol.dispose]: X
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
async function createShikiInternal(a) {
|
|
1293
|
+
a.engine || warnDeprecated("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");
|
|
1294
|
+
let [P, F, I] = await Promise.all([
|
|
1295
|
+
resolveThemes(a.themes || []),
|
|
1296
|
+
resolveLangs(a.langs || []),
|
|
1297
|
+
a.engine
|
|
1298
|
+
]);
|
|
1299
|
+
return createShikiInternalSync({
|
|
1300
|
+
...a,
|
|
1301
|
+
themes: P,
|
|
1302
|
+
langs: F,
|
|
1303
|
+
engine: I
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
async function createHighlighterCore(a) {
|
|
1307
|
+
let P = await createShikiInternal(a);
|
|
1308
|
+
return {
|
|
1309
|
+
getLastGrammarState: (...a) => getLastGrammarState(P, ...a),
|
|
1310
|
+
codeToTokensBase: (a, F) => codeToTokensBase(P, a, F),
|
|
1311
|
+
codeToTokensWithThemes: (a, F) => codeToTokensWithThemes(P, a, F),
|
|
1312
|
+
codeToTokens: (a, F) => codeToTokens(P, a, F),
|
|
1313
|
+
codeToHast: (a, F) => codeToHast(P, a, F),
|
|
1314
|
+
codeToHtml: (a, F) => codeToHtml(P, a, F),
|
|
1315
|
+
getBundledLanguages: () => ({}),
|
|
1316
|
+
getBundledThemes: () => ({}),
|
|
1317
|
+
...P,
|
|
1318
|
+
getInternalContext: () => P
|
|
1319
|
+
};
|
|
1320
|
+
}
|
|
1321
|
+
function createBundledHighlighter(P) {
|
|
1322
|
+
let F = P.langs, I = P.themes, L = P.engine;
|
|
1323
|
+
async function R(P) {
|
|
1324
|
+
function R(I) {
|
|
1325
|
+
if (typeof I == "string") {
|
|
1326
|
+
if (I = P.langAlias?.[I] || I, isSpecialLang(I)) return [];
|
|
1327
|
+
let L = F[I];
|
|
1328
|
+
if (!L) throw new ShikiError(`Language \`${I}\` is not included in this bundle. You may want to load it from external source.`);
|
|
1329
|
+
return L;
|
|
1330
|
+
}
|
|
1331
|
+
return I;
|
|
1332
|
+
}
|
|
1333
|
+
function z(P) {
|
|
1334
|
+
if (isSpecialTheme(P)) return "none";
|
|
1335
|
+
if (typeof P == "string") {
|
|
1336
|
+
let F = I[P];
|
|
1337
|
+
if (!F) throw new ShikiError(`Theme \`${P}\` is not included in this bundle. You may want to load it from external source.`);
|
|
1338
|
+
return F;
|
|
1339
|
+
}
|
|
1340
|
+
return P;
|
|
1341
|
+
}
|
|
1342
|
+
let B = (P.themes ?? []).map((a) => z(a)), V = (P.langs ?? []).map((a) => R(a)), H = await createHighlighterCore({
|
|
1343
|
+
engine: P.engine ?? L(),
|
|
1344
|
+
...P,
|
|
1345
|
+
themes: B,
|
|
1346
|
+
langs: V
|
|
1347
|
+
});
|
|
1348
|
+
return {
|
|
1349
|
+
...H,
|
|
1350
|
+
loadLanguage(...a) {
|
|
1351
|
+
return H.loadLanguage(...a.map(R));
|
|
1352
|
+
},
|
|
1353
|
+
loadTheme(...a) {
|
|
1354
|
+
return H.loadTheme(...a.map(z));
|
|
1355
|
+
},
|
|
1356
|
+
getBundledLanguages() {
|
|
1357
|
+
return F;
|
|
1358
|
+
},
|
|
1359
|
+
getBundledThemes() {
|
|
1360
|
+
return I;
|
|
1361
|
+
}
|
|
1362
|
+
};
|
|
1363
|
+
}
|
|
1364
|
+
return R;
|
|
1365
|
+
}
|
|
1366
|
+
function makeSingletonHighlighter(a) {
|
|
1367
|
+
let P;
|
|
1368
|
+
async function F(F = {}) {
|
|
1369
|
+
if (P) {
|
|
1370
|
+
let a = await P;
|
|
1371
|
+
return await Promise.all([a.loadTheme(...F.themes || []), a.loadLanguage(...F.langs || [])]), a;
|
|
1372
|
+
} else {
|
|
1373
|
+
P = a({
|
|
1374
|
+
...F,
|
|
1375
|
+
themes: [],
|
|
1376
|
+
langs: []
|
|
1377
|
+
});
|
|
1378
|
+
let I = await P;
|
|
1379
|
+
return await Promise.all([I.loadTheme(...F.themes || []), I.loadLanguage(...F.langs || [])]), I;
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
return F;
|
|
1383
|
+
}
|
|
1384
|
+
function createSingletonShorthands(a, P) {
|
|
1385
|
+
let F = makeSingletonHighlighter(a);
|
|
1386
|
+
async function I(a, I) {
|
|
1387
|
+
let L = await F({
|
|
1388
|
+
langs: [I.lang],
|
|
1389
|
+
themes: "theme" in I ? [I.theme] : Object.values(I.themes)
|
|
1390
|
+
}), R = await P?.guessEmbeddedLanguages?.(a, I.lang, L);
|
|
1391
|
+
return R && await L.loadLanguage(...R), L;
|
|
1392
|
+
}
|
|
1393
|
+
return {
|
|
1394
|
+
getSingletonHighlighter(a) {
|
|
1395
|
+
return F(a);
|
|
1396
|
+
},
|
|
1397
|
+
async codeToHtml(a, P) {
|
|
1398
|
+
return (await I(a, P)).codeToHtml(a, P);
|
|
1399
|
+
},
|
|
1400
|
+
async codeToHast(a, P) {
|
|
1401
|
+
return (await I(a, P)).codeToHast(a, P);
|
|
1402
|
+
},
|
|
1403
|
+
async codeToTokens(a, P) {
|
|
1404
|
+
return (await I(a, P)).codeToTokens(a, P);
|
|
1405
|
+
},
|
|
1406
|
+
async codeToTokensBase(a, P) {
|
|
1407
|
+
return (await I(a, P)).codeToTokensBase(a, P);
|
|
1408
|
+
},
|
|
1409
|
+
async codeToTokensWithThemes(a, P) {
|
|
1410
|
+
return (await I(a, P)).codeToTokensWithThemes(a, P);
|
|
1411
|
+
},
|
|
1412
|
+
async getLastGrammarState(a, P) {
|
|
1413
|
+
return (await F({
|
|
1414
|
+
langs: [P.lang],
|
|
1415
|
+
themes: [P.theme]
|
|
1416
|
+
})).getLastGrammarState(a, P);
|
|
1417
|
+
}
|
|
1418
|
+
};
|
|
1419
|
+
}
|
|
1420
|
+
export { addClassToHast, applyColorReplacements, createBundledHighlighter, createHighlighterCore, createPositionConverter, createShikiInternal, createShikiInternalSync, createSingletonShorthands, flatTokenVariants, getTokenStyleObject, guessEmbeddedLanguages, hastToHtml, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, makeSingletonHighlighter, normalizeGetter, normalizeTheme, resolveColorReplacements, splitLines, splitToken, splitTokens, stringifyTokenStyle, toArray, tokenizeAnsiWithTheme, tokenizeWithTheme, tokensToHast, transformerDecorations, warnDeprecated };
|