@atom8n/n8n-editor-ui 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.stylelintcache +1 -0
- package/README.md +59 -0
- package/biome.jsonc +8 -0
- package/build.log +55 -0
- package/data/node-popularity.json +3998 -0
- package/dist/assets/AddDataTableModal-UINkk54_.js +1555 -0
- package/dist/assets/AgentEditorModal-CVww87TJ.js +358 -0
- package/dist/assets/Alert-Dy86dyOr.js +102 -0
- package/dist/assets/AnimatedSpinner-DmPN4poP.js +15 -0
- package/dist/assets/AnnotationTagsDropdown.ee-BJ7N9lek.js +71 -0
- package/dist/assets/AuthView-D2LWHrMp.js +106 -0
- package/dist/assets/BottomMenu-CIQiK_dJ.js +532 -0
- package/dist/assets/CalendarDate-DgQUMbNo.js +875 -0
- package/dist/assets/ChangePasswordView-Z6tUkw0u.js +133 -0
- package/dist/assets/ChatAgentAvatar-50YBnv3N.js +67 -0
- package/dist/assets/ChatFile-xZxmc2nV.js +146 -0
- package/dist/assets/ChatLayout-CTE_5SiM.js +96 -0
- package/dist/assets/ChatPersonalAgentsView-BGpHk03K.js +149 -0
- package/dist/assets/ChatSidebar-BkVwIypC.js +528 -0
- package/dist/assets/ChatView-BbbdeU9x.js +1559 -0
- package/dist/assets/ChatWorkflowAgentsView-BtunOxlC.js +116 -0
- package/dist/assets/CollectionParameter-BdcPG1lu.js +52 -0
- package/dist/assets/CommitMonoVariable-ytizKI8U.woff2 +0 -0
- package/dist/assets/CommunityNodeUpdateInfo-C37kca4W.js +273 -0
- package/dist/assets/CopyInput-DDZVu2iU.js +74 -0
- package/dist/assets/CredentialIcon-8YdTTFZ1.js +80 -0
- package/dist/assets/CredentialPicker-DWtj314o.js +293 -0
- package/dist/assets/CredentialSelectorModal-DTW2fKh0.js +138 -0
- package/dist/assets/CredentialsView-BjUchcCu.js +480 -0
- package/dist/assets/DataTableActions-DpAkoxg_.js +95 -0
- package/dist/assets/DataTableDetailsView-Coq7zdW5.js +41922 -0
- package/dist/assets/DataTableView-Cs-BIkzw.js +293 -0
- package/dist/assets/DemoFooter-Cga3jvi-.js +65 -0
- package/dist/assets/Draggable-vfvXl9Sp.js +105 -0
- package/dist/assets/EmptySharedSectionActionBox-DOXZtTCv.js +36 -0
- package/dist/assets/EnterpriseEdition.ee-D_rCFexM.js +15 -0
- package/dist/assets/EntityNotFound-3dhTRWsE.js +85 -0
- package/dist/assets/EntityUnAuthorised-ChJYZakE.js +66 -0
- package/dist/assets/ErrorView-zT9cX76a.js +61 -0
- package/dist/assets/EvaluationsRootView-C-OVWYnY.js +523 -0
- package/dist/assets/EvaluationsView-CJwJTruc.js +469 -0
- package/dist/assets/ExecutionsTime-DEQiyozR.js +573 -0
- package/dist/assets/ExecutionsView-Bd5Oh8TH.js +791 -0
- package/dist/assets/ExternalSecretsProviderConnectionSwitch.ee-C7Ih-uRo.js +191 -0
- package/dist/assets/FixedCollectionParameter-CYuTDW9t.js +496 -0
- package/dist/assets/ForgotMyPasswordView-Bs_L9P27.js +102 -0
- package/dist/assets/InsightsChartAverageRuntime-Bp3VA8_7.js +62 -0
- package/dist/assets/InsightsChartFailed-KPaNWoEr.js +52 -0
- package/dist/assets/InsightsChartFailureRate-DE6kE3FM.js +54 -0
- package/dist/assets/InsightsChartTimeSaved-auABNZlc.js +68 -0
- package/dist/assets/InsightsChartTotal-BKzYRKE7.js +56 -0
- package/dist/assets/InsightsDashboard-JWx4W6Db.js +473 -0
- package/dist/assets/InsightsPaywall-C8zLLKe8.js +63 -0
- package/dist/assets/InsightsSummary-cmN1lHDm.js +210 -0
- package/dist/assets/InsightsTableWorkflows-CqcC3IbQ.js +203 -0
- package/dist/assets/InterVariable-DiVDrmQJ.woff2 +0 -0
- package/dist/assets/InterVariable-Italic-FCBEiFp6.woff2 +0 -0
- package/dist/assets/ItemsRenderer-DC8WVyMv.js +922 -0
- package/dist/assets/KeyboardShortcutTooltip-D8PAK5JP.js +31 -0
- package/dist/assets/LogsPanel-BR06u9RK.js +52 -0
- package/dist/assets/LogsPanel-C-_acMHp.js +2325 -0
- package/dist/assets/MCPConnectWorkflowsModal-3g8_iUa4.js +303 -0
- package/dist/assets/MainHeader-DiQc1edn.js +2153 -0
- package/dist/assets/MainSidebar-CoPGG5Ea.js +804 -0
- package/dist/assets/MigrationRuleDetail-BAxk1Pvl.js +295 -0
- package/dist/assets/MigrationRules-IW9lZMpE.js +285 -0
- package/dist/assets/Modal-CIzXlZdZ.js +204 -0
- package/dist/assets/ModelByIdSelectorModal-DLvBjzJO.js +115 -0
- package/dist/assets/NDVEmptyState-33UoX00I.js +19743 -0
- package/dist/assets/NodeCreation-BNzbSWSB.js +240 -0
- package/dist/assets/NodeCreator-BftgCKx7.js +1288 -0
- package/dist/assets/NodeDetailsView-CsoQCpcF.js +1075 -0
- package/dist/assets/NodeDetailsViewV2-C_wNQR_3.js +981 -0
- package/dist/assets/NodeIcon-B9VW6tX6.js +87 -0
- package/dist/assets/NodeSettings-ZwVip6VR.js +1872 -0
- package/dist/assets/NodeView-D4WUEvLB.js +2452 -0
- package/dist/assets/OAuthConsentView-DlrUqZbT.js +230 -0
- package/dist/assets/PageViewLayout-NT1KPFgy.js +12 -0
- package/dist/assets/ParameterInputList-sG2nz-Jo.js +38091 -0
- package/dist/assets/PrebuiltAgentTemplatesView-Csi5U8dc.js +154 -0
- package/dist/assets/ProjectBreadcrumb-C_XiY7sc.js +98 -0
- package/dist/assets/ProjectCardBadge-t_hs7vzx.js +209 -0
- package/dist/assets/ProjectHeader-Dq5Ihb26.js +549 -0
- package/dist/assets/ProjectIcon-DY8gGuHX.js +64 -0
- package/dist/assets/ProjectRoleView-Du-KTrAC.js +435 -0
- package/dist/assets/ProjectRolesView-DjxM_y4u.js +239 -0
- package/dist/assets/ProjectSettings-C6kWuV21.js +966 -0
- package/dist/assets/ProjectSharing-CVUgNWAY.js +262 -0
- package/dist/assets/ProjectVariables-CJlAo3dv.js +467 -0
- package/dist/assets/ProviderSettingsModal-BUFC2ZLv.js +307 -0
- package/dist/assets/PushConnectionTracker-DPBnGV0v.js +27 -0
- package/dist/assets/ResolversView-3BdkvvYA.js +209 -0
- package/dist/assets/ResourceFiltersDropdown-dgyXpcEX.js +159 -0
- package/dist/assets/ResourcesListLayout-qBLtomK6.js +631 -0
- package/dist/assets/RunDataHtml-BrW0OQra.js +7 -0
- package/dist/assets/RunDataHtml-Cleia4Cj.js +40 -0
- package/dist/assets/RunDataJson-uxkrhYRK.js +227 -0
- package/dist/assets/RunDataJsonActions-DkPk7E8d.js +5007 -0
- package/dist/assets/RunDataParsedAiContent-CtPRjig-.js +26 -0
- package/dist/assets/RunDataParsedAiContent-WAuqLQ5M.js +192 -0
- package/dist/assets/RunDataSearch-YBWUr93C.js +141 -0
- package/dist/assets/RunDataTable-DcXaBynW.js +631 -0
- package/dist/assets/SamlOnboarding-BTdQ_hr3.js +78 -0
- package/dist/assets/SaveButton-D5sQSxIk.js +89 -0
- package/dist/assets/SelectedItemsInfo-BHZ-NvF5.js +58 -0
- package/dist/assets/SettingsApiView-IfZTMXx1.js +313 -0
- package/dist/assets/SettingsChatHubView-gWh2X6vX.js +285 -0
- package/dist/assets/SettingsCommunityNodesView-D8VQtpGY.js +349 -0
- package/dist/assets/SettingsExternalSecrets-CpMc7mkW.js +233 -0
- package/dist/assets/SettingsLdapView-CU5a2MAy.js +2553 -0
- package/dist/assets/SettingsLogStreamingView-uojTe-oX.js +375 -0
- package/dist/assets/SettingsMCPView-B5Swp1C_.js +1214 -0
- package/dist/assets/SettingsPersonalView-Cr3aGood.js +402 -0
- package/dist/assets/SettingsSourceControl-DXOvFDEY.js +547 -0
- package/dist/assets/SettingsSso-27MfU1HV.js +1032 -0
- package/dist/assets/SettingsUsageAndPlan-DqIO-G46.js +419 -0
- package/dist/assets/SettingsUsersView-DfHB4_Kh.js +833 -0
- package/dist/assets/SettingsView-C4sA7Uny.js +90 -0
- package/dist/assets/SetupTemplateFormStep-BmiSzZin.js +258 -0
- package/dist/assets/SetupView-VORZ-L_u.js +112 -0
- package/dist/assets/SetupWorkflowCredentialsButton-DTmkOAW5.js +73 -0
- package/dist/assets/SetupWorkflowFromTemplateView-B9NupdJE.js +286 -0
- package/dist/assets/SeverityTag-CX1qTTNA.js +45 -0
- package/dist/assets/SigninView-D9_Pm16j.js +358 -0
- package/dist/assets/SignoutView-BFsjEAGz.js +19 -0
- package/dist/assets/SignupView-Am4ot0QZ.js +137 -0
- package/dist/assets/SkeletonAgentCard-C5TL-h8F.js +191 -0
- package/dist/assets/TagsDropdown-Bvx_Hd6Q.js +230 -0
- package/dist/assets/TemplateCard-CyQ1GuVz.js +105 -0
- package/dist/assets/TemplateDetails-CZRusTxE.js +124 -0
- package/dist/assets/TemplateList-DKvbwuiY.js +333 -0
- package/dist/assets/TemplatesCollectionView-D8dxU8By.js +184 -0
- package/dist/assets/TemplatesSearchView-CebC_GLs.js +1230 -0
- package/dist/assets/TemplatesView-025CcmIY.js +57 -0
- package/dist/assets/TemplatesWorkflowView-C2JfwJAn.js +170 -0
- package/dist/assets/TestRunDetailView-Ck78TTWO.js +395 -0
- package/dist/assets/TextWithHighlights-BxumwGnv.js +57 -0
- package/dist/assets/TimeAgo-C6EN4lCs.js +123 -0
- package/dist/assets/ToolsSelectorModal-8QJoUvRL.js +368 -0
- package/dist/assets/TriggerPanel-B6pacLkk.js +1225 -0
- package/dist/assets/VirtualSchema-B3zGe_8b.js +2402 -0
- package/dist/assets/VirtualSchema-Dkh0Cu5z.js +37 -0
- package/dist/assets/VueMarkdown-CQqJL9vK.js +28 -0
- package/dist/assets/WorkerView-Caznsljo.js +563 -0
- package/dist/assets/WorkflowActivationErrorMessage-CGrfPi9O.js +17 -0
- package/dist/assets/WorkflowActivator-BINnz0f7.js +362 -0
- package/dist/assets/WorkflowExecutionsInfoAccordion-Dg37yEfT.js +166 -0
- package/dist/assets/WorkflowExecutionsLandingPage-V2wdubhK.js +93 -0
- package/dist/assets/WorkflowExecutionsPreview-DdJaqYV6.js +616 -0
- package/dist/assets/WorkflowExecutionsView-DV8ySTfn.js +808 -0
- package/dist/assets/WorkflowHistory-GtaBMzIM.js +973 -0
- package/dist/assets/WorkflowLocation-CQ9Sq-2y.js +164 -0
- package/dist/assets/WorkflowOnboardingView-C49gt0Jr.js +61 -0
- package/dist/assets/WorkflowPreview-CXdvv4Nq.js +186 -0
- package/dist/assets/WorkflowTagsDropdown-QwbICWjN.js +71 -0
- package/dist/assets/WorkflowsView-B-MWIECO.js +3253 -0
- package/dist/assets/_MapCache-CcdIl4Ae.js +363 -0
- package/dist/assets/_baseOrderBy-N8Be_6z6.js +2989 -0
- package/dist/assets/_initCloneObject-viQQyT6o.js +80 -0
- package/dist/assets/_plugin-vue_export-helper-BwBpWJRZ.js +6 -0
- package/dist/assets/aiTemplatesStarterCollection.store-nL9nePkK.js +656 -0
- package/dist/assets/apiKeys.store-BhOFmP2j.js +51 -0
- package/dist/assets/assistant.store-CNywgN4S.js +518 -0
- package/dist/assets/auth.eventBus-CWXS0Qp7.js +5 -0
- package/dist/assets/banners.store-CGEcBTDn.js +195 -0
- package/dist/assets/builder.store-Czk2ipDE.js +31417 -0
- package/dist/assets/buttons.esm-yintpW2E.js +364 -0
- package/dist/assets/chart-CNvyywtJ.js +10958 -0
- package/dist/assets/chartjs.utils-BAE52Cv9.js +155 -0
- package/dist/assets/chat.store-290YeyrQ.js +865 -0
- package/dist/assets/chatPanel.store-NDaawEZL.js +118 -0
- package/dist/assets/chunk-6z4oVpB-.js +36 -0
- package/dist/assets/col-Cmt4cmuS.js +158 -0
- package/dist/assets/constants-C8OH4tTq.js +106256 -0
- package/dist/assets/constants-DMrsrpD7.js +32 -0
- package/dist/assets/core-B9gt_4yk.js +4 -0
- package/dist/assets/core-CP5FY4aX.js +1202 -0
- package/dist/assets/core-CRbPymLT.js +9741 -0
- package/dist/assets/dataTable.store-DmipQsol.js +207 -0
- package/dist/assets/date-picker-2IDsBs2n.js +4115 -0
- package/dist/assets/dateFormatter-ik4-9_9r.js +33 -0
- package/dist/assets/dateformat-hG8NERse.js +181 -0
- package/dist/assets/dialog-lMho1TD8.js +425 -0
- package/dist/assets/dist-Cw46Is-h.js +151 -0
- package/dist/assets/doppler-B__k0MeW.webp +0 -0
- package/dist/assets/element-icons-B-tDfklg.woff +0 -0
- package/dist/assets/element-icons-_lZGOqcG.ttf +0 -0
- package/dist/assets/empty-BuGRxzl4.js +2210 -0
- package/dist/assets/en-CF30SCh2.js +95 -0
- package/dist/assets/en-DyO2pPiC.js +2 -0
- package/dist/assets/es-BkUFJVtD.js +43338 -0
- package/dist/assets/evaluation.constants-GYAwmJnh.js +284 -0
- package/dist/assets/executions.store-B9uRYwgv.js +205 -0
- package/dist/assets/exports-Crx_gvt_.js +1799 -0
- package/dist/assets/externalSecrets.ee.store-BJh4a_6G.js +118 -0
- package/dist/assets/fileUtils-CRWqOQje.js +20 -0
- package/dist/assets/folders.store-yAFj-5Vl.js +235 -0
- package/dist/assets/get-BcEmeOxn.js +2781 -0
- package/dist/assets/index-SL8542zQ.js +28372 -0
- package/dist/assets/insights.constants-BkJCYJTL.js +55 -0
- package/dist/assets/insights.store-BFc3kDUo.js +61 -0
- package/dist/assets/insights.utils-CcLXdrrz.js +77 -0
- package/dist/assets/isEmpty-C3XXoHqJ.js +35216 -0
- package/dist/assets/languageModules-9LyndCqU.js +13862 -0
- package/dist/assets/logStreaming.store-IZhWe_VK.js +190 -0
- package/dist/assets/mcp.constants-_Jcn7fPq.js +10 -0
- package/dist/assets/mcp.store-B9yfcAN9.js +116 -0
- package/dist/assets/merge-DhuTk1HM.js +564 -0
- package/dist/assets/nodeCreator.store-Bpnrwp2l.js +5444 -0
- package/dist/assets/nodeIcon-D6X-ENYt.js +102 -0
- package/dist/assets/nodeTransforms-RzcOM0v2.js +42 -0
- package/dist/assets/orderBy-Cu9F9DU_.js +15 -0
- package/dist/assets/path-browserify-RUt2u7iT.js +328 -0
- package/dist/assets/personalizedTemplatesV3.store-BGYp0YBN.js +334 -0
- package/dist/assets/pickBy-UI0Jt4wC.js +18 -0
- package/dist/assets/preload-helper-dyVz7ck7.js +59 -0
- package/dist/assets/radio-CSce3UT0.js +262 -0
- package/dist/assets/readyToRun.store-YEMvPUqo.js +626 -0
- package/dist/assets/readyToRunWorkflows.store-G3srgIze.js +1319 -0
- package/dist/assets/retry-BgHaYzbB.js +23 -0
- package/dist/assets/roles.store-CRf_zJTb.js +51 -0
- package/dist/assets/router-DNpzz3GH.js +2631 -0
- package/dist/assets/sanitize-html-CbW56HUN.js +10758 -0
- package/dist/assets/schemaPreview.store-DUgN1yVE.js +113 -0
- package/dist/assets/semver-Bk6DGseV.js +1306 -0
- package/dist/assets/smartDecimal-DAZl4HKA.js +6 -0
- package/dist/assets/sortByProperty-Cn7iGKYu.js +8 -0
- package/dist/assets/sourceControl.eventBus-D47xXSc_.js +3 -0
- package/dist/assets/sqlite3-DBpDb1lf.wasm +0 -0
- package/dist/assets/sqlite3-opfs-async-proxy-vVtmDGHX.js +461 -0
- package/dist/assets/sqlite3-worker1-bundler-friendly-DLarOZDL.js +9405 -0
- package/dist/assets/src-jviYSG25.js +55454 -0
- package/dist/assets/sso.store-DyApJwhx.js +139 -0
- package/dist/assets/style-E3CrYFV8.css +111829 -0
- package/dist/assets/table-we1DjFMV.js +3944 -0
- package/dist/assets/templateActions-bEDSARw2.js +65 -0
- package/dist/assets/templateTransforms-BHWiRbtR.js +43 -0
- package/dist/assets/truncate-C0KYt7i3.js +4176 -0
- package/dist/assets/typescript.worker-CYqLvLHh.js +152048 -0
- package/dist/assets/uniqBy-xDyuCRP0.js +10 -0
- package/dist/assets/usage.store-CU5J_nGm.js +100 -0
- package/dist/assets/useActions-B1JckIRj.js +255 -0
- package/dist/assets/useBeforeUnload-DiDkvI8p.js +40 -0
- package/dist/assets/useCanvasMapping-BXT7rGhC.js +12570 -0
- package/dist/assets/useCanvasOperations-8ULLtMkY.js +1765 -0
- package/dist/assets/useClipboard-DvjhVHqJ.js +39 -0
- package/dist/assets/useCommandBar-C4tLJbKt.js +2425 -0
- package/dist/assets/useCredentialResolvers-BKeFGJnY.js +78 -0
- package/dist/assets/useCustomAgent-DpILEt5e.js +471 -0
- package/dist/assets/useDebounce-Br5_1ug-.js +147 -0
- package/dist/assets/useExecutionData-M5iKsX6z.js +23 -0
- package/dist/assets/useExecutionDebugging-8azMzbnd.js +191 -0
- package/dist/assets/useExecutionHelpers-BgRRhpBM.js +91 -0
- package/dist/assets/useImportCurlCommand-CKiEmX5P.js +8891 -0
- package/dist/assets/useIntersectionObserver-BWMwOueh.js +33 -0
- package/dist/assets/useKeybindings-B2jfN6rd.js +62 -0
- package/dist/assets/useLogsTreeExpand-sZViUfdM.js +843 -0
- package/dist/assets/useMcp-DoMOIfqT.js +27 -0
- package/dist/assets/usePageRedirectionHelper-DjkznpX6.js +51 -0
- package/dist/assets/usePinnedData-BhZkqttf.js +203 -0
- package/dist/assets/usePushConnection-DMS-F_IW.js +513 -0
- package/dist/assets/useRecentResources-BVORr7eM.js +118 -0
- package/dist/assets/useRunWorkflow-LO7ffLp9.js +950 -0
- package/dist/assets/useSettingsItems-BhZXwMZn.js +144 -0
- package/dist/assets/useTelemetryContext-V6bv4YRq.js +34 -0
- package/dist/assets/useWorkflowActivate-DeSmDXjI.js +152 -0
- package/dist/assets/useWorkflowsCache-DtcEEAIR.js +179 -0
- package/dist/assets/userRoleProvisioning.store-kkSIdeTo.js +33 -0
- package/dist/assets/utils-DI7dLldp.js +54 -0
- package/dist/assets/versions.store-B1z2OrLE.js +191 -0
- package/dist/assets/vue-CydWIhxN.js +4378 -0
- package/dist/assets/vue-json-pretty-CsGX66mG.js +1130 -0
- package/dist/assets/vue.runtime.esm-bundler-tP5dCd7J.js +7325 -0
- package/dist/assets/xml-B_oj6Mle.js +2060 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.html +157 -0
- package/dist/static/base-path.js +1 -0
- package/dist/static/community_package_tooltip_img.png +0 -0
- package/dist/static/data-mapping-gif.gif +0 -0
- package/dist/static/form-grey.svg +1 -0
- package/dist/static/google-auth/disabled.dark.png +0 -0
- package/dist/static/google-auth/disabled.png +0 -0
- package/dist/static/google-auth/focus.dark.png +0 -0
- package/dist/static/google-auth/focus.png +0 -0
- package/dist/static/google-auth/normal.dark.png +0 -0
- package/dist/static/google-auth/normal.png +0 -0
- package/dist/static/google-auth/pressed.dark.png +0 -0
- package/dist/static/google-auth/pressed.png +0 -0
- package/dist/static/n8n-logo.png +0 -0
- package/dist/static/og_image.png +0 -0
- package/dist/static/open-ai.svg +1 -0
- package/dist/static/openChat.png +0 -0
- package/dist/static/posthog.init.js +41 -0
- package/dist/static/prefers-color-scheme.css +5 -0
- package/dist/static/webhook-icon.svg +1 -0
- package/dist/tree-sitter-bash.wasm +0 -0
- package/dist/tree-sitter.wasm +0 -0
- package/eslint.config.mjs +59 -0
- package/index.html +45 -0
- package/index.js +0 -0
- package/package.json +147 -0
- package/postcss.config.cjs +6 -0
- package/scripts/fetch-node-popularity.mjs +102 -0
- package/stylelint.config.mjs +9 -0
- package/tailwind.config.js +8 -0
- package/tsconfig.json +36 -0
- package/vite/i18n-locales-hmr-helpers.ts +19 -0
- package/vite/source-map-js-shim.ts +1 -0
- package/vite/vite-plugin-node-popularity.mts +32 -0
- package/vite.config.mts +304 -0
|
@@ -0,0 +1,1202 @@
|
|
|
1
|
+
import { t as __commonJSMin } from "./chunk-6z4oVpB-.js";
|
|
2
|
+
var require_core = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3
|
+
function deepFreeze(obj) {
|
|
4
|
+
if (obj instanceof Map) obj.clear = obj.delete = obj.set = function() {
|
|
5
|
+
throw new Error("map is read-only");
|
|
6
|
+
};
|
|
7
|
+
else if (obj instanceof Set) obj.add = obj.clear = obj.delete = function() {
|
|
8
|
+
throw new Error("set is read-only");
|
|
9
|
+
};
|
|
10
|
+
Object.freeze(obj);
|
|
11
|
+
Object.getOwnPropertyNames(obj).forEach((name) => {
|
|
12
|
+
const prop = obj[name];
|
|
13
|
+
const type = typeof prop;
|
|
14
|
+
if ((type === "object" || type === "function") && !Object.isFrozen(prop)) deepFreeze(prop);
|
|
15
|
+
});
|
|
16
|
+
return obj;
|
|
17
|
+
}
|
|
18
|
+
var Response = class {
|
|
19
|
+
constructor(mode) {
|
|
20
|
+
if (mode.data === void 0) mode.data = {};
|
|
21
|
+
this.data = mode.data;
|
|
22
|
+
this.isMatchIgnored = false;
|
|
23
|
+
}
|
|
24
|
+
ignoreMatch() {
|
|
25
|
+
this.isMatchIgnored = true;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function escapeHTML(value) {
|
|
29
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
30
|
+
}
|
|
31
|
+
function inherit$1(original, ...objects) {
|
|
32
|
+
const result = Object.create(null);
|
|
33
|
+
for (const key in original) result[key] = original[key];
|
|
34
|
+
objects.forEach(function(obj) {
|
|
35
|
+
for (const key in obj) result[key] = obj[key];
|
|
36
|
+
});
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
var SPAN_CLOSE = "</span>";
|
|
40
|
+
var emitsWrappingTags = (node) => {
|
|
41
|
+
return !!node.scope;
|
|
42
|
+
};
|
|
43
|
+
var scopeToCSSClass = (name, { prefix }) => {
|
|
44
|
+
if (name.startsWith("language:")) return name.replace("language:", "language-");
|
|
45
|
+
if (name.includes(".")) {
|
|
46
|
+
const pieces = name.split(".");
|
|
47
|
+
return [`${prefix}${pieces.shift()}`, ...pieces.map((x, i) => `${x}${"_".repeat(i + 1)}`)].join(" ");
|
|
48
|
+
}
|
|
49
|
+
return `${prefix}${name}`;
|
|
50
|
+
};
|
|
51
|
+
var HTMLRenderer = class {
|
|
52
|
+
constructor(parseTree, options) {
|
|
53
|
+
this.buffer = "";
|
|
54
|
+
this.classPrefix = options.classPrefix;
|
|
55
|
+
parseTree.walk(this);
|
|
56
|
+
}
|
|
57
|
+
addText(text) {
|
|
58
|
+
this.buffer += escapeHTML(text);
|
|
59
|
+
}
|
|
60
|
+
openNode(node) {
|
|
61
|
+
if (!emitsWrappingTags(node)) return;
|
|
62
|
+
const className = scopeToCSSClass(node.scope, { prefix: this.classPrefix });
|
|
63
|
+
this.span(className);
|
|
64
|
+
}
|
|
65
|
+
closeNode(node) {
|
|
66
|
+
if (!emitsWrappingTags(node)) return;
|
|
67
|
+
this.buffer += SPAN_CLOSE;
|
|
68
|
+
}
|
|
69
|
+
value() {
|
|
70
|
+
return this.buffer;
|
|
71
|
+
}
|
|
72
|
+
span(className) {
|
|
73
|
+
this.buffer += `<span class="${className}">`;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var newNode = (opts = {}) => {
|
|
77
|
+
const result = { children: [] };
|
|
78
|
+
Object.assign(result, opts);
|
|
79
|
+
return result;
|
|
80
|
+
};
|
|
81
|
+
var TokenTree = class TokenTree {
|
|
82
|
+
constructor() {
|
|
83
|
+
this.rootNode = newNode();
|
|
84
|
+
this.stack = [this.rootNode];
|
|
85
|
+
}
|
|
86
|
+
get top() {
|
|
87
|
+
return this.stack[this.stack.length - 1];
|
|
88
|
+
}
|
|
89
|
+
get root() {
|
|
90
|
+
return this.rootNode;
|
|
91
|
+
}
|
|
92
|
+
add(node) {
|
|
93
|
+
this.top.children.push(node);
|
|
94
|
+
}
|
|
95
|
+
openNode(scope) {
|
|
96
|
+
const node = newNode({ scope });
|
|
97
|
+
this.add(node);
|
|
98
|
+
this.stack.push(node);
|
|
99
|
+
}
|
|
100
|
+
closeNode() {
|
|
101
|
+
if (this.stack.length > 1) return this.stack.pop();
|
|
102
|
+
}
|
|
103
|
+
closeAllNodes() {
|
|
104
|
+
while (this.closeNode());
|
|
105
|
+
}
|
|
106
|
+
toJSON() {
|
|
107
|
+
return JSON.stringify(this.rootNode, null, 4);
|
|
108
|
+
}
|
|
109
|
+
walk(builder) {
|
|
110
|
+
return this.constructor._walk(builder, this.rootNode);
|
|
111
|
+
}
|
|
112
|
+
static _walk(builder, node) {
|
|
113
|
+
if (typeof node === "string") builder.addText(node);
|
|
114
|
+
else if (node.children) {
|
|
115
|
+
builder.openNode(node);
|
|
116
|
+
node.children.forEach((child) => this._walk(builder, child));
|
|
117
|
+
builder.closeNode(node);
|
|
118
|
+
}
|
|
119
|
+
return builder;
|
|
120
|
+
}
|
|
121
|
+
static _collapse(node) {
|
|
122
|
+
if (typeof node === "string") return;
|
|
123
|
+
if (!node.children) return;
|
|
124
|
+
if (node.children.every((el) => typeof el === "string")) node.children = [node.children.join("")];
|
|
125
|
+
else node.children.forEach((child) => {
|
|
126
|
+
TokenTree._collapse(child);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
var TokenTreeEmitter = class extends TokenTree {
|
|
131
|
+
constructor(options) {
|
|
132
|
+
super();
|
|
133
|
+
this.options = options;
|
|
134
|
+
}
|
|
135
|
+
addText(text) {
|
|
136
|
+
if (text === "") return;
|
|
137
|
+
this.add(text);
|
|
138
|
+
}
|
|
139
|
+
startScope(scope) {
|
|
140
|
+
this.openNode(scope);
|
|
141
|
+
}
|
|
142
|
+
endScope() {
|
|
143
|
+
this.closeNode();
|
|
144
|
+
}
|
|
145
|
+
__addSublanguage(emitter, name) {
|
|
146
|
+
const node = emitter.root;
|
|
147
|
+
if (name) node.scope = `language:${name}`;
|
|
148
|
+
this.add(node);
|
|
149
|
+
}
|
|
150
|
+
toHTML() {
|
|
151
|
+
return new HTMLRenderer(this, this.options).value();
|
|
152
|
+
}
|
|
153
|
+
finalize() {
|
|
154
|
+
this.closeAllNodes();
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
function source(re) {
|
|
159
|
+
if (!re) return null;
|
|
160
|
+
if (typeof re === "string") return re;
|
|
161
|
+
return re.source;
|
|
162
|
+
}
|
|
163
|
+
function lookahead(re) {
|
|
164
|
+
return concat("(?=", re, ")");
|
|
165
|
+
}
|
|
166
|
+
function anyNumberOfTimes(re) {
|
|
167
|
+
return concat("(?:", re, ")*");
|
|
168
|
+
}
|
|
169
|
+
function optional(re) {
|
|
170
|
+
return concat("(?:", re, ")?");
|
|
171
|
+
}
|
|
172
|
+
function concat(...args) {
|
|
173
|
+
return args.map((x) => source(x)).join("");
|
|
174
|
+
}
|
|
175
|
+
function stripOptionsFromArgs(args) {
|
|
176
|
+
const opts = args[args.length - 1];
|
|
177
|
+
if (typeof opts === "object" && opts.constructor === Object) {
|
|
178
|
+
args.splice(args.length - 1, 1);
|
|
179
|
+
return opts;
|
|
180
|
+
} else return {};
|
|
181
|
+
}
|
|
182
|
+
function either(...args) {
|
|
183
|
+
return "(" + (stripOptionsFromArgs(args).capture ? "" : "?:") + args.map((x) => source(x)).join("|") + ")";
|
|
184
|
+
}
|
|
185
|
+
function countMatchGroups(re) {
|
|
186
|
+
return (/* @__PURE__ */ new RegExp(re.toString() + "|")).exec("").length - 1;
|
|
187
|
+
}
|
|
188
|
+
function startsWith(re, lexeme) {
|
|
189
|
+
const match = re && re.exec(lexeme);
|
|
190
|
+
return match && match.index === 0;
|
|
191
|
+
}
|
|
192
|
+
var BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
|
|
193
|
+
function _rewriteBackreferences(regexps, { joinWith }) {
|
|
194
|
+
let numCaptures = 0;
|
|
195
|
+
return regexps.map((regex) => {
|
|
196
|
+
numCaptures += 1;
|
|
197
|
+
const offset = numCaptures;
|
|
198
|
+
let re = source(regex);
|
|
199
|
+
let out = "";
|
|
200
|
+
while (re.length > 0) {
|
|
201
|
+
const match = BACKREF_RE.exec(re);
|
|
202
|
+
if (!match) {
|
|
203
|
+
out += re;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
out += re.substring(0, match.index);
|
|
207
|
+
re = re.substring(match.index + match[0].length);
|
|
208
|
+
if (match[0][0] === "\\" && match[1]) out += "\\" + String(Number(match[1]) + offset);
|
|
209
|
+
else {
|
|
210
|
+
out += match[0];
|
|
211
|
+
if (match[0] === "(") numCaptures++;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return out;
|
|
215
|
+
}).map((re) => `(${re})`).join(joinWith);
|
|
216
|
+
}
|
|
217
|
+
var MATCH_NOTHING_RE = /\b\B/;
|
|
218
|
+
var IDENT_RE = "[a-zA-Z]\\w*";
|
|
219
|
+
var UNDERSCORE_IDENT_RE = "[a-zA-Z_]\\w*";
|
|
220
|
+
var NUMBER_RE = "\\b\\d+(\\.\\d+)?";
|
|
221
|
+
var C_NUMBER_RE = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";
|
|
222
|
+
var BINARY_NUMBER_RE = "\\b(0b[01]+)";
|
|
223
|
+
var RE_STARTERS_RE = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";
|
|
224
|
+
var SHEBANG = (opts = {}) => {
|
|
225
|
+
const beginShebang = /^#![ ]*\//;
|
|
226
|
+
if (opts.binary) opts.begin = concat(beginShebang, /.*\b/, opts.binary, /\b.*/);
|
|
227
|
+
return inherit$1({
|
|
228
|
+
scope: "meta",
|
|
229
|
+
begin: beginShebang,
|
|
230
|
+
end: /$/,
|
|
231
|
+
relevance: 0,
|
|
232
|
+
"on:begin": (m, resp) => {
|
|
233
|
+
if (m.index !== 0) resp.ignoreMatch();
|
|
234
|
+
}
|
|
235
|
+
}, opts);
|
|
236
|
+
};
|
|
237
|
+
var BACKSLASH_ESCAPE = {
|
|
238
|
+
begin: "\\\\[\\s\\S]",
|
|
239
|
+
relevance: 0
|
|
240
|
+
};
|
|
241
|
+
var APOS_STRING_MODE = {
|
|
242
|
+
scope: "string",
|
|
243
|
+
begin: "'",
|
|
244
|
+
end: "'",
|
|
245
|
+
illegal: "\\n",
|
|
246
|
+
contains: [BACKSLASH_ESCAPE]
|
|
247
|
+
};
|
|
248
|
+
var QUOTE_STRING_MODE = {
|
|
249
|
+
scope: "string",
|
|
250
|
+
begin: "\"",
|
|
251
|
+
end: "\"",
|
|
252
|
+
illegal: "\\n",
|
|
253
|
+
contains: [BACKSLASH_ESCAPE]
|
|
254
|
+
};
|
|
255
|
+
var PHRASAL_WORDS_MODE = { begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ };
|
|
256
|
+
var COMMENT = function(begin, end, modeOptions = {}) {
|
|
257
|
+
const mode = inherit$1({
|
|
258
|
+
scope: "comment",
|
|
259
|
+
begin,
|
|
260
|
+
end,
|
|
261
|
+
contains: []
|
|
262
|
+
}, modeOptions);
|
|
263
|
+
mode.contains.push({
|
|
264
|
+
scope: "doctag",
|
|
265
|
+
begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
|
|
266
|
+
end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,
|
|
267
|
+
excludeBegin: true,
|
|
268
|
+
relevance: 0
|
|
269
|
+
});
|
|
270
|
+
const ENGLISH_WORD = either("I", "a", "is", "so", "us", "to", "at", "if", "in", "it", "on", /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, /[A-Za-z]+[-][a-z]+/, /[A-Za-z][a-z]{2,}/);
|
|
271
|
+
mode.contains.push({ begin: concat(/[ ]+/, "(", ENGLISH_WORD, /[.]?[:]?([.][ ]|[ ])/, "){3}") });
|
|
272
|
+
return mode;
|
|
273
|
+
};
|
|
274
|
+
var C_LINE_COMMENT_MODE = COMMENT("//", "$");
|
|
275
|
+
var C_BLOCK_COMMENT_MODE = COMMENT("/\\*", "\\*/");
|
|
276
|
+
var HASH_COMMENT_MODE = COMMENT("#", "$");
|
|
277
|
+
var NUMBER_MODE = {
|
|
278
|
+
scope: "number",
|
|
279
|
+
begin: NUMBER_RE,
|
|
280
|
+
relevance: 0
|
|
281
|
+
};
|
|
282
|
+
var C_NUMBER_MODE = {
|
|
283
|
+
scope: "number",
|
|
284
|
+
begin: C_NUMBER_RE,
|
|
285
|
+
relevance: 0
|
|
286
|
+
};
|
|
287
|
+
var BINARY_NUMBER_MODE = {
|
|
288
|
+
scope: "number",
|
|
289
|
+
begin: BINARY_NUMBER_RE,
|
|
290
|
+
relevance: 0
|
|
291
|
+
};
|
|
292
|
+
var REGEXP_MODE = {
|
|
293
|
+
begin: /(?=\/[^/\n]*\/)/,
|
|
294
|
+
contains: [{
|
|
295
|
+
scope: "regexp",
|
|
296
|
+
begin: /\//,
|
|
297
|
+
end: /\/[gimuy]*/,
|
|
298
|
+
illegal: /\n/,
|
|
299
|
+
contains: [BACKSLASH_ESCAPE, {
|
|
300
|
+
begin: /\[/,
|
|
301
|
+
end: /\]/,
|
|
302
|
+
relevance: 0,
|
|
303
|
+
contains: [BACKSLASH_ESCAPE]
|
|
304
|
+
}]
|
|
305
|
+
}]
|
|
306
|
+
};
|
|
307
|
+
var TITLE_MODE = {
|
|
308
|
+
scope: "title",
|
|
309
|
+
begin: IDENT_RE,
|
|
310
|
+
relevance: 0
|
|
311
|
+
};
|
|
312
|
+
var UNDERSCORE_TITLE_MODE = {
|
|
313
|
+
scope: "title",
|
|
314
|
+
begin: UNDERSCORE_IDENT_RE,
|
|
315
|
+
relevance: 0
|
|
316
|
+
};
|
|
317
|
+
var METHOD_GUARD = {
|
|
318
|
+
begin: "\\.\\s*" + UNDERSCORE_IDENT_RE,
|
|
319
|
+
relevance: 0
|
|
320
|
+
};
|
|
321
|
+
var END_SAME_AS_BEGIN = function(mode) {
|
|
322
|
+
return Object.assign(mode, {
|
|
323
|
+
"on:begin": (m, resp) => {
|
|
324
|
+
resp.data._beginMatch = m[1];
|
|
325
|
+
},
|
|
326
|
+
"on:end": (m, resp) => {
|
|
327
|
+
if (resp.data._beginMatch !== m[1]) resp.ignoreMatch();
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
};
|
|
331
|
+
var MODES = /* @__PURE__ */ Object.freeze({
|
|
332
|
+
__proto__: null,
|
|
333
|
+
MATCH_NOTHING_RE,
|
|
334
|
+
IDENT_RE,
|
|
335
|
+
UNDERSCORE_IDENT_RE,
|
|
336
|
+
NUMBER_RE,
|
|
337
|
+
C_NUMBER_RE,
|
|
338
|
+
BINARY_NUMBER_RE,
|
|
339
|
+
RE_STARTERS_RE,
|
|
340
|
+
SHEBANG,
|
|
341
|
+
BACKSLASH_ESCAPE,
|
|
342
|
+
APOS_STRING_MODE,
|
|
343
|
+
QUOTE_STRING_MODE,
|
|
344
|
+
PHRASAL_WORDS_MODE,
|
|
345
|
+
COMMENT,
|
|
346
|
+
C_LINE_COMMENT_MODE,
|
|
347
|
+
C_BLOCK_COMMENT_MODE,
|
|
348
|
+
HASH_COMMENT_MODE,
|
|
349
|
+
NUMBER_MODE,
|
|
350
|
+
C_NUMBER_MODE,
|
|
351
|
+
BINARY_NUMBER_MODE,
|
|
352
|
+
REGEXP_MODE,
|
|
353
|
+
TITLE_MODE,
|
|
354
|
+
UNDERSCORE_TITLE_MODE,
|
|
355
|
+
METHOD_GUARD,
|
|
356
|
+
END_SAME_AS_BEGIN
|
|
357
|
+
});
|
|
358
|
+
function skipIfHasPrecedingDot(match, response) {
|
|
359
|
+
if (match.input[match.index - 1] === ".") response.ignoreMatch();
|
|
360
|
+
}
|
|
361
|
+
function scopeClassName(mode, _parent) {
|
|
362
|
+
if (mode.className !== void 0) {
|
|
363
|
+
mode.scope = mode.className;
|
|
364
|
+
delete mode.className;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
function beginKeywords(mode, parent) {
|
|
368
|
+
if (!parent) return;
|
|
369
|
+
if (!mode.beginKeywords) return;
|
|
370
|
+
mode.begin = "\\b(" + mode.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)";
|
|
371
|
+
mode.__beforeBegin = skipIfHasPrecedingDot;
|
|
372
|
+
mode.keywords = mode.keywords || mode.beginKeywords;
|
|
373
|
+
delete mode.beginKeywords;
|
|
374
|
+
if (mode.relevance === void 0) mode.relevance = 0;
|
|
375
|
+
}
|
|
376
|
+
function compileIllegal(mode, _parent) {
|
|
377
|
+
if (!Array.isArray(mode.illegal)) return;
|
|
378
|
+
mode.illegal = either(...mode.illegal);
|
|
379
|
+
}
|
|
380
|
+
function compileMatch(mode, _parent) {
|
|
381
|
+
if (!mode.match) return;
|
|
382
|
+
if (mode.begin || mode.end) throw new Error("begin & end are not supported with match");
|
|
383
|
+
mode.begin = mode.match;
|
|
384
|
+
delete mode.match;
|
|
385
|
+
}
|
|
386
|
+
function compileRelevance(mode, _parent) {
|
|
387
|
+
if (mode.relevance === void 0) mode.relevance = 1;
|
|
388
|
+
}
|
|
389
|
+
var beforeMatchExt = (mode, parent) => {
|
|
390
|
+
if (!mode.beforeMatch) return;
|
|
391
|
+
if (mode.starts) throw new Error("beforeMatch cannot be used with starts");
|
|
392
|
+
const originalMode = Object.assign({}, mode);
|
|
393
|
+
Object.keys(mode).forEach((key) => {
|
|
394
|
+
delete mode[key];
|
|
395
|
+
});
|
|
396
|
+
mode.keywords = originalMode.keywords;
|
|
397
|
+
mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));
|
|
398
|
+
mode.starts = {
|
|
399
|
+
relevance: 0,
|
|
400
|
+
contains: [Object.assign(originalMode, { endsParent: true })]
|
|
401
|
+
};
|
|
402
|
+
mode.relevance = 0;
|
|
403
|
+
delete originalMode.beforeMatch;
|
|
404
|
+
};
|
|
405
|
+
var COMMON_KEYWORDS = [
|
|
406
|
+
"of",
|
|
407
|
+
"and",
|
|
408
|
+
"for",
|
|
409
|
+
"in",
|
|
410
|
+
"not",
|
|
411
|
+
"or",
|
|
412
|
+
"if",
|
|
413
|
+
"then",
|
|
414
|
+
"parent",
|
|
415
|
+
"list",
|
|
416
|
+
"value"
|
|
417
|
+
];
|
|
418
|
+
var DEFAULT_KEYWORD_SCOPE = "keyword";
|
|
419
|
+
function compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {
|
|
420
|
+
const compiledKeywords = Object.create(null);
|
|
421
|
+
if (typeof rawKeywords === "string") compileList(scopeName, rawKeywords.split(" "));
|
|
422
|
+
else if (Array.isArray(rawKeywords)) compileList(scopeName, rawKeywords);
|
|
423
|
+
else Object.keys(rawKeywords).forEach(function(scopeName$1) {
|
|
424
|
+
Object.assign(compiledKeywords, compileKeywords(rawKeywords[scopeName$1], caseInsensitive, scopeName$1));
|
|
425
|
+
});
|
|
426
|
+
return compiledKeywords;
|
|
427
|
+
function compileList(scopeName$1, keywordList) {
|
|
428
|
+
if (caseInsensitive) keywordList = keywordList.map((x) => x.toLowerCase());
|
|
429
|
+
keywordList.forEach(function(keyword) {
|
|
430
|
+
const pair = keyword.split("|");
|
|
431
|
+
compiledKeywords[pair[0]] = [scopeName$1, scoreForKeyword(pair[0], pair[1])];
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
function scoreForKeyword(keyword, providedScore) {
|
|
436
|
+
if (providedScore) return Number(providedScore);
|
|
437
|
+
return commonKeyword(keyword) ? 0 : 1;
|
|
438
|
+
}
|
|
439
|
+
function commonKeyword(keyword) {
|
|
440
|
+
return COMMON_KEYWORDS.includes(keyword.toLowerCase());
|
|
441
|
+
}
|
|
442
|
+
var seenDeprecations = {};
|
|
443
|
+
var error = (message) => {
|
|
444
|
+
console.error(message);
|
|
445
|
+
};
|
|
446
|
+
var warn = (message, ...args) => {
|
|
447
|
+
console.log(`WARN: ${message}`, ...args);
|
|
448
|
+
};
|
|
449
|
+
var deprecated = (version$1, message) => {
|
|
450
|
+
if (seenDeprecations[`${version$1}/${message}`]) return;
|
|
451
|
+
console.log(`Deprecated as of ${version$1}. ${message}`);
|
|
452
|
+
seenDeprecations[`${version$1}/${message}`] = true;
|
|
453
|
+
};
|
|
454
|
+
var MultiClassError = /* @__PURE__ */ new Error();
|
|
455
|
+
function remapScopeNames(mode, regexes, { key }) {
|
|
456
|
+
let offset = 0;
|
|
457
|
+
const scopeNames = mode[key];
|
|
458
|
+
const emit = {};
|
|
459
|
+
const positions = {};
|
|
460
|
+
for (let i = 1; i <= regexes.length; i++) {
|
|
461
|
+
positions[i + offset] = scopeNames[i];
|
|
462
|
+
emit[i + offset] = true;
|
|
463
|
+
offset += countMatchGroups(regexes[i - 1]);
|
|
464
|
+
}
|
|
465
|
+
mode[key] = positions;
|
|
466
|
+
mode[key]._emit = emit;
|
|
467
|
+
mode[key]._multi = true;
|
|
468
|
+
}
|
|
469
|
+
function beginMultiClass(mode) {
|
|
470
|
+
if (!Array.isArray(mode.begin)) return;
|
|
471
|
+
if (mode.skip || mode.excludeBegin || mode.returnBegin) {
|
|
472
|
+
error("skip, excludeBegin, returnBegin not compatible with beginScope: {}");
|
|
473
|
+
throw MultiClassError;
|
|
474
|
+
}
|
|
475
|
+
if (typeof mode.beginScope !== "object" || mode.beginScope === null) {
|
|
476
|
+
error("beginScope must be object");
|
|
477
|
+
throw MultiClassError;
|
|
478
|
+
}
|
|
479
|
+
remapScopeNames(mode, mode.begin, { key: "beginScope" });
|
|
480
|
+
mode.begin = _rewriteBackreferences(mode.begin, { joinWith: "" });
|
|
481
|
+
}
|
|
482
|
+
function endMultiClass(mode) {
|
|
483
|
+
if (!Array.isArray(mode.end)) return;
|
|
484
|
+
if (mode.skip || mode.excludeEnd || mode.returnEnd) {
|
|
485
|
+
error("skip, excludeEnd, returnEnd not compatible with endScope: {}");
|
|
486
|
+
throw MultiClassError;
|
|
487
|
+
}
|
|
488
|
+
if (typeof mode.endScope !== "object" || mode.endScope === null) {
|
|
489
|
+
error("endScope must be object");
|
|
490
|
+
throw MultiClassError;
|
|
491
|
+
}
|
|
492
|
+
remapScopeNames(mode, mode.end, { key: "endScope" });
|
|
493
|
+
mode.end = _rewriteBackreferences(mode.end, { joinWith: "" });
|
|
494
|
+
}
|
|
495
|
+
function scopeSugar(mode) {
|
|
496
|
+
if (mode.scope && typeof mode.scope === "object" && mode.scope !== null) {
|
|
497
|
+
mode.beginScope = mode.scope;
|
|
498
|
+
delete mode.scope;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
function MultiClass(mode) {
|
|
502
|
+
scopeSugar(mode);
|
|
503
|
+
if (typeof mode.beginScope === "string") mode.beginScope = { _wrap: mode.beginScope };
|
|
504
|
+
if (typeof mode.endScope === "string") mode.endScope = { _wrap: mode.endScope };
|
|
505
|
+
beginMultiClass(mode);
|
|
506
|
+
endMultiClass(mode);
|
|
507
|
+
}
|
|
508
|
+
function compileLanguage(language) {
|
|
509
|
+
function langRe(value, global) {
|
|
510
|
+
return new RegExp(source(value), "m" + (language.case_insensitive ? "i" : "") + (language.unicodeRegex ? "u" : "") + (global ? "g" : ""));
|
|
511
|
+
}
|
|
512
|
+
class MultiRegex {
|
|
513
|
+
constructor() {
|
|
514
|
+
this.matchIndexes = {};
|
|
515
|
+
this.regexes = [];
|
|
516
|
+
this.matchAt = 1;
|
|
517
|
+
this.position = 0;
|
|
518
|
+
}
|
|
519
|
+
addRule(re, opts) {
|
|
520
|
+
opts.position = this.position++;
|
|
521
|
+
this.matchIndexes[this.matchAt] = opts;
|
|
522
|
+
this.regexes.push([opts, re]);
|
|
523
|
+
this.matchAt += countMatchGroups(re) + 1;
|
|
524
|
+
}
|
|
525
|
+
compile() {
|
|
526
|
+
if (this.regexes.length === 0) this.exec = () => null;
|
|
527
|
+
this.matcherRe = langRe(_rewriteBackreferences(this.regexes.map((el) => el[1]), { joinWith: "|" }), true);
|
|
528
|
+
this.lastIndex = 0;
|
|
529
|
+
}
|
|
530
|
+
exec(s) {
|
|
531
|
+
this.matcherRe.lastIndex = this.lastIndex;
|
|
532
|
+
const match = this.matcherRe.exec(s);
|
|
533
|
+
if (!match) return null;
|
|
534
|
+
const i = match.findIndex((el, i$1) => i$1 > 0 && el !== void 0);
|
|
535
|
+
const matchData = this.matchIndexes[i];
|
|
536
|
+
match.splice(0, i);
|
|
537
|
+
return Object.assign(match, matchData);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
class ResumableMultiRegex {
|
|
541
|
+
constructor() {
|
|
542
|
+
this.rules = [];
|
|
543
|
+
this.multiRegexes = [];
|
|
544
|
+
this.count = 0;
|
|
545
|
+
this.lastIndex = 0;
|
|
546
|
+
this.regexIndex = 0;
|
|
547
|
+
}
|
|
548
|
+
getMatcher(index) {
|
|
549
|
+
if (this.multiRegexes[index]) return this.multiRegexes[index];
|
|
550
|
+
const matcher = new MultiRegex();
|
|
551
|
+
this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));
|
|
552
|
+
matcher.compile();
|
|
553
|
+
this.multiRegexes[index] = matcher;
|
|
554
|
+
return matcher;
|
|
555
|
+
}
|
|
556
|
+
resumingScanAtSamePosition() {
|
|
557
|
+
return this.regexIndex !== 0;
|
|
558
|
+
}
|
|
559
|
+
considerAll() {
|
|
560
|
+
this.regexIndex = 0;
|
|
561
|
+
}
|
|
562
|
+
addRule(re, opts) {
|
|
563
|
+
this.rules.push([re, opts]);
|
|
564
|
+
if (opts.type === "begin") this.count++;
|
|
565
|
+
}
|
|
566
|
+
exec(s) {
|
|
567
|
+
const m = this.getMatcher(this.regexIndex);
|
|
568
|
+
m.lastIndex = this.lastIndex;
|
|
569
|
+
let result = m.exec(s);
|
|
570
|
+
if (this.resumingScanAtSamePosition()) if (result && result.index === this.lastIndex);
|
|
571
|
+
else {
|
|
572
|
+
const m2 = this.getMatcher(0);
|
|
573
|
+
m2.lastIndex = this.lastIndex + 1;
|
|
574
|
+
result = m2.exec(s);
|
|
575
|
+
}
|
|
576
|
+
if (result) {
|
|
577
|
+
this.regexIndex += result.position + 1;
|
|
578
|
+
if (this.regexIndex === this.count) this.considerAll();
|
|
579
|
+
}
|
|
580
|
+
return result;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
function buildModeRegex(mode) {
|
|
584
|
+
const mm = new ResumableMultiRegex();
|
|
585
|
+
mode.contains.forEach((term) => mm.addRule(term.begin, {
|
|
586
|
+
rule: term,
|
|
587
|
+
type: "begin"
|
|
588
|
+
}));
|
|
589
|
+
if (mode.terminatorEnd) mm.addRule(mode.terminatorEnd, { type: "end" });
|
|
590
|
+
if (mode.illegal) mm.addRule(mode.illegal, { type: "illegal" });
|
|
591
|
+
return mm;
|
|
592
|
+
}
|
|
593
|
+
function compileMode(mode, parent) {
|
|
594
|
+
const cmode = mode;
|
|
595
|
+
if (mode.isCompiled) return cmode;
|
|
596
|
+
[
|
|
597
|
+
scopeClassName,
|
|
598
|
+
compileMatch,
|
|
599
|
+
MultiClass,
|
|
600
|
+
beforeMatchExt
|
|
601
|
+
].forEach((ext) => ext(mode, parent));
|
|
602
|
+
language.compilerExtensions.forEach((ext) => ext(mode, parent));
|
|
603
|
+
mode.__beforeBegin = null;
|
|
604
|
+
[
|
|
605
|
+
beginKeywords,
|
|
606
|
+
compileIllegal,
|
|
607
|
+
compileRelevance
|
|
608
|
+
].forEach((ext) => ext(mode, parent));
|
|
609
|
+
mode.isCompiled = true;
|
|
610
|
+
let keywordPattern = null;
|
|
611
|
+
if (typeof mode.keywords === "object" && mode.keywords.$pattern) {
|
|
612
|
+
mode.keywords = Object.assign({}, mode.keywords);
|
|
613
|
+
keywordPattern = mode.keywords.$pattern;
|
|
614
|
+
delete mode.keywords.$pattern;
|
|
615
|
+
}
|
|
616
|
+
keywordPattern = keywordPattern || /\w+/;
|
|
617
|
+
if (mode.keywords) mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);
|
|
618
|
+
cmode.keywordPatternRe = langRe(keywordPattern, true);
|
|
619
|
+
if (parent) {
|
|
620
|
+
if (!mode.begin) mode.begin = /\B|\b/;
|
|
621
|
+
cmode.beginRe = langRe(cmode.begin);
|
|
622
|
+
if (!mode.end && !mode.endsWithParent) mode.end = /\B|\b/;
|
|
623
|
+
if (mode.end) cmode.endRe = langRe(cmode.end);
|
|
624
|
+
cmode.terminatorEnd = source(cmode.end) || "";
|
|
625
|
+
if (mode.endsWithParent && parent.terminatorEnd) cmode.terminatorEnd += (mode.end ? "|" : "") + parent.terminatorEnd;
|
|
626
|
+
}
|
|
627
|
+
if (mode.illegal) cmode.illegalRe = langRe(mode.illegal);
|
|
628
|
+
if (!mode.contains) mode.contains = [];
|
|
629
|
+
mode.contains = [].concat(...mode.contains.map(function(c) {
|
|
630
|
+
return expandOrCloneMode(c === "self" ? mode : c);
|
|
631
|
+
}));
|
|
632
|
+
mode.contains.forEach(function(c) {
|
|
633
|
+
compileMode(c, cmode);
|
|
634
|
+
});
|
|
635
|
+
if (mode.starts) compileMode(mode.starts, parent);
|
|
636
|
+
cmode.matcher = buildModeRegex(cmode);
|
|
637
|
+
return cmode;
|
|
638
|
+
}
|
|
639
|
+
if (!language.compilerExtensions) language.compilerExtensions = [];
|
|
640
|
+
if (language.contains && language.contains.includes("self")) throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
|
|
641
|
+
language.classNameAliases = inherit$1(language.classNameAliases || {});
|
|
642
|
+
return compileMode(language);
|
|
643
|
+
}
|
|
644
|
+
function dependencyOnParent(mode) {
|
|
645
|
+
if (!mode) return false;
|
|
646
|
+
return mode.endsWithParent || dependencyOnParent(mode.starts);
|
|
647
|
+
}
|
|
648
|
+
function expandOrCloneMode(mode) {
|
|
649
|
+
if (mode.variants && !mode.cachedVariants) mode.cachedVariants = mode.variants.map(function(variant) {
|
|
650
|
+
return inherit$1(mode, { variants: null }, variant);
|
|
651
|
+
});
|
|
652
|
+
if (mode.cachedVariants) return mode.cachedVariants;
|
|
653
|
+
if (dependencyOnParent(mode)) return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });
|
|
654
|
+
if (Object.isFrozen(mode)) return inherit$1(mode);
|
|
655
|
+
return mode;
|
|
656
|
+
}
|
|
657
|
+
var version = "11.8.0";
|
|
658
|
+
var HTMLInjectionError = class extends Error {
|
|
659
|
+
constructor(reason, html) {
|
|
660
|
+
super(reason);
|
|
661
|
+
this.name = "HTMLInjectionError";
|
|
662
|
+
this.html = html;
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
var escape = escapeHTML;
|
|
666
|
+
var inherit = inherit$1;
|
|
667
|
+
var NO_MATCH = Symbol("nomatch");
|
|
668
|
+
var MAX_KEYWORD_HITS = 7;
|
|
669
|
+
var HLJS = function(hljs) {
|
|
670
|
+
const languages = Object.create(null);
|
|
671
|
+
const aliases = Object.create(null);
|
|
672
|
+
const plugins = [];
|
|
673
|
+
let SAFE_MODE = true;
|
|
674
|
+
const LANGUAGE_NOT_FOUND = "Could not find the language '{}', did you forget to load/include a language module?";
|
|
675
|
+
const PLAINTEXT_LANGUAGE = {
|
|
676
|
+
disableAutodetect: true,
|
|
677
|
+
name: "Plain text",
|
|
678
|
+
contains: []
|
|
679
|
+
};
|
|
680
|
+
let options = {
|
|
681
|
+
ignoreUnescapedHTML: false,
|
|
682
|
+
throwUnescapedHTML: false,
|
|
683
|
+
noHighlightRe: /^(no-?highlight)$/i,
|
|
684
|
+
languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
|
|
685
|
+
classPrefix: "hljs-",
|
|
686
|
+
cssSelector: "pre code",
|
|
687
|
+
languages: null,
|
|
688
|
+
__emitter: TokenTreeEmitter
|
|
689
|
+
};
|
|
690
|
+
function shouldNotHighlight(languageName) {
|
|
691
|
+
return options.noHighlightRe.test(languageName);
|
|
692
|
+
}
|
|
693
|
+
function blockLanguage(block) {
|
|
694
|
+
let classes = block.className + " ";
|
|
695
|
+
classes += block.parentNode ? block.parentNode.className : "";
|
|
696
|
+
const match = options.languageDetectRe.exec(classes);
|
|
697
|
+
if (match) {
|
|
698
|
+
const language = getLanguage(match[1]);
|
|
699
|
+
if (!language) {
|
|
700
|
+
warn(LANGUAGE_NOT_FOUND.replace("{}", match[1]));
|
|
701
|
+
warn("Falling back to no-highlight mode for this block.", block);
|
|
702
|
+
}
|
|
703
|
+
return language ? match[1] : "no-highlight";
|
|
704
|
+
}
|
|
705
|
+
return classes.split(/\s+/).find((_class) => shouldNotHighlight(_class) || getLanguage(_class));
|
|
706
|
+
}
|
|
707
|
+
function highlight$1(codeOrLanguageName, optionsOrCode, ignoreIllegals) {
|
|
708
|
+
let code = "";
|
|
709
|
+
let languageName = "";
|
|
710
|
+
if (typeof optionsOrCode === "object") {
|
|
711
|
+
code = codeOrLanguageName;
|
|
712
|
+
ignoreIllegals = optionsOrCode.ignoreIllegals;
|
|
713
|
+
languageName = optionsOrCode.language;
|
|
714
|
+
} else {
|
|
715
|
+
deprecated("10.7.0", "highlight(lang, code, ...args) has been deprecated.");
|
|
716
|
+
deprecated("10.7.0", "Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277");
|
|
717
|
+
languageName = codeOrLanguageName;
|
|
718
|
+
code = optionsOrCode;
|
|
719
|
+
}
|
|
720
|
+
if (ignoreIllegals === void 0) ignoreIllegals = true;
|
|
721
|
+
const context = {
|
|
722
|
+
code,
|
|
723
|
+
language: languageName
|
|
724
|
+
};
|
|
725
|
+
fire("before:highlight", context);
|
|
726
|
+
const result = context.result ? context.result : _highlight(context.language, context.code, ignoreIllegals);
|
|
727
|
+
result.code = context.code;
|
|
728
|
+
fire("after:highlight", result);
|
|
729
|
+
return result;
|
|
730
|
+
}
|
|
731
|
+
function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {
|
|
732
|
+
const keywordHits = Object.create(null);
|
|
733
|
+
function keywordData(mode, matchText) {
|
|
734
|
+
return mode.keywords[matchText];
|
|
735
|
+
}
|
|
736
|
+
function processKeywords() {
|
|
737
|
+
if (!top.keywords) {
|
|
738
|
+
emitter.addText(modeBuffer);
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
let lastIndex = 0;
|
|
742
|
+
top.keywordPatternRe.lastIndex = 0;
|
|
743
|
+
let match = top.keywordPatternRe.exec(modeBuffer);
|
|
744
|
+
let buf = "";
|
|
745
|
+
while (match) {
|
|
746
|
+
buf += modeBuffer.substring(lastIndex, match.index);
|
|
747
|
+
const word = language.case_insensitive ? match[0].toLowerCase() : match[0];
|
|
748
|
+
const data = keywordData(top, word);
|
|
749
|
+
if (data) {
|
|
750
|
+
const [kind, keywordRelevance] = data;
|
|
751
|
+
emitter.addText(buf);
|
|
752
|
+
buf = "";
|
|
753
|
+
keywordHits[word] = (keywordHits[word] || 0) + 1;
|
|
754
|
+
if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;
|
|
755
|
+
if (kind.startsWith("_")) buf += match[0];
|
|
756
|
+
else {
|
|
757
|
+
const cssClass = language.classNameAliases[kind] || kind;
|
|
758
|
+
emitKeyword(match[0], cssClass);
|
|
759
|
+
}
|
|
760
|
+
} else buf += match[0];
|
|
761
|
+
lastIndex = top.keywordPatternRe.lastIndex;
|
|
762
|
+
match = top.keywordPatternRe.exec(modeBuffer);
|
|
763
|
+
}
|
|
764
|
+
buf += modeBuffer.substring(lastIndex);
|
|
765
|
+
emitter.addText(buf);
|
|
766
|
+
}
|
|
767
|
+
function processSubLanguage() {
|
|
768
|
+
if (modeBuffer === "") return;
|
|
769
|
+
let result$1 = null;
|
|
770
|
+
if (typeof top.subLanguage === "string") {
|
|
771
|
+
if (!languages[top.subLanguage]) {
|
|
772
|
+
emitter.addText(modeBuffer);
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
result$1 = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);
|
|
776
|
+
continuations[top.subLanguage] = result$1._top;
|
|
777
|
+
} else result$1 = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);
|
|
778
|
+
if (top.relevance > 0) relevance += result$1.relevance;
|
|
779
|
+
emitter.__addSublanguage(result$1._emitter, result$1.language);
|
|
780
|
+
}
|
|
781
|
+
function processBuffer() {
|
|
782
|
+
if (top.subLanguage != null) processSubLanguage();
|
|
783
|
+
else processKeywords();
|
|
784
|
+
modeBuffer = "";
|
|
785
|
+
}
|
|
786
|
+
function emitKeyword(keyword, scope) {
|
|
787
|
+
if (keyword === "") return;
|
|
788
|
+
emitter.startScope(scope);
|
|
789
|
+
emitter.addText(keyword);
|
|
790
|
+
emitter.endScope();
|
|
791
|
+
}
|
|
792
|
+
function emitMultiClass(scope, match) {
|
|
793
|
+
let i = 1;
|
|
794
|
+
const max = match.length - 1;
|
|
795
|
+
while (i <= max) {
|
|
796
|
+
if (!scope._emit[i]) {
|
|
797
|
+
i++;
|
|
798
|
+
continue;
|
|
799
|
+
}
|
|
800
|
+
const klass = language.classNameAliases[scope[i]] || scope[i];
|
|
801
|
+
const text = match[i];
|
|
802
|
+
if (klass) emitKeyword(text, klass);
|
|
803
|
+
else {
|
|
804
|
+
modeBuffer = text;
|
|
805
|
+
processKeywords();
|
|
806
|
+
modeBuffer = "";
|
|
807
|
+
}
|
|
808
|
+
i++;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
function startNewMode(mode, match) {
|
|
812
|
+
if (mode.scope && typeof mode.scope === "string") emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);
|
|
813
|
+
if (mode.beginScope) {
|
|
814
|
+
if (mode.beginScope._wrap) {
|
|
815
|
+
emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);
|
|
816
|
+
modeBuffer = "";
|
|
817
|
+
} else if (mode.beginScope._multi) {
|
|
818
|
+
emitMultiClass(mode.beginScope, match);
|
|
819
|
+
modeBuffer = "";
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
top = Object.create(mode, { parent: { value: top } });
|
|
823
|
+
return top;
|
|
824
|
+
}
|
|
825
|
+
function endOfMode(mode, match, matchPlusRemainder) {
|
|
826
|
+
let matched = startsWith(mode.endRe, matchPlusRemainder);
|
|
827
|
+
if (matched) {
|
|
828
|
+
if (mode["on:end"]) {
|
|
829
|
+
const resp = new Response(mode);
|
|
830
|
+
mode["on:end"](match, resp);
|
|
831
|
+
if (resp.isMatchIgnored) matched = false;
|
|
832
|
+
}
|
|
833
|
+
if (matched) {
|
|
834
|
+
while (mode.endsParent && mode.parent) mode = mode.parent;
|
|
835
|
+
return mode;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
if (mode.endsWithParent) return endOfMode(mode.parent, match, matchPlusRemainder);
|
|
839
|
+
}
|
|
840
|
+
function doIgnore(lexeme) {
|
|
841
|
+
if (top.matcher.regexIndex === 0) {
|
|
842
|
+
modeBuffer += lexeme[0];
|
|
843
|
+
return 1;
|
|
844
|
+
} else {
|
|
845
|
+
resumeScanAtSamePosition = true;
|
|
846
|
+
return 0;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
function doBeginMatch(match) {
|
|
850
|
+
const lexeme = match[0];
|
|
851
|
+
const newMode = match.rule;
|
|
852
|
+
const resp = new Response(newMode);
|
|
853
|
+
const beforeCallbacks = [newMode.__beforeBegin, newMode["on:begin"]];
|
|
854
|
+
for (const cb of beforeCallbacks) {
|
|
855
|
+
if (!cb) continue;
|
|
856
|
+
cb(match, resp);
|
|
857
|
+
if (resp.isMatchIgnored) return doIgnore(lexeme);
|
|
858
|
+
}
|
|
859
|
+
if (newMode.skip) modeBuffer += lexeme;
|
|
860
|
+
else {
|
|
861
|
+
if (newMode.excludeBegin) modeBuffer += lexeme;
|
|
862
|
+
processBuffer();
|
|
863
|
+
if (!newMode.returnBegin && !newMode.excludeBegin) modeBuffer = lexeme;
|
|
864
|
+
}
|
|
865
|
+
startNewMode(newMode, match);
|
|
866
|
+
return newMode.returnBegin ? 0 : lexeme.length;
|
|
867
|
+
}
|
|
868
|
+
function doEndMatch(match) {
|
|
869
|
+
const lexeme = match[0];
|
|
870
|
+
const matchPlusRemainder = codeToHighlight.substring(match.index);
|
|
871
|
+
const endMode = endOfMode(top, match, matchPlusRemainder);
|
|
872
|
+
if (!endMode) return NO_MATCH;
|
|
873
|
+
const origin = top;
|
|
874
|
+
if (top.endScope && top.endScope._wrap) {
|
|
875
|
+
processBuffer();
|
|
876
|
+
emitKeyword(lexeme, top.endScope._wrap);
|
|
877
|
+
} else if (top.endScope && top.endScope._multi) {
|
|
878
|
+
processBuffer();
|
|
879
|
+
emitMultiClass(top.endScope, match);
|
|
880
|
+
} else if (origin.skip) modeBuffer += lexeme;
|
|
881
|
+
else {
|
|
882
|
+
if (!(origin.returnEnd || origin.excludeEnd)) modeBuffer += lexeme;
|
|
883
|
+
processBuffer();
|
|
884
|
+
if (origin.excludeEnd) modeBuffer = lexeme;
|
|
885
|
+
}
|
|
886
|
+
do {
|
|
887
|
+
if (top.scope) emitter.closeNode();
|
|
888
|
+
if (!top.skip && !top.subLanguage) relevance += top.relevance;
|
|
889
|
+
top = top.parent;
|
|
890
|
+
} while (top !== endMode.parent);
|
|
891
|
+
if (endMode.starts) startNewMode(endMode.starts, match);
|
|
892
|
+
return origin.returnEnd ? 0 : lexeme.length;
|
|
893
|
+
}
|
|
894
|
+
function processContinuations() {
|
|
895
|
+
const list = [];
|
|
896
|
+
for (let current = top; current !== language; current = current.parent) if (current.scope) list.unshift(current.scope);
|
|
897
|
+
list.forEach((item) => emitter.openNode(item));
|
|
898
|
+
}
|
|
899
|
+
let lastMatch = {};
|
|
900
|
+
function processLexeme(textBeforeMatch, match) {
|
|
901
|
+
const lexeme = match && match[0];
|
|
902
|
+
modeBuffer += textBeforeMatch;
|
|
903
|
+
if (lexeme == null) {
|
|
904
|
+
processBuffer();
|
|
905
|
+
return 0;
|
|
906
|
+
}
|
|
907
|
+
if (lastMatch.type === "begin" && match.type === "end" && lastMatch.index === match.index && lexeme === "") {
|
|
908
|
+
modeBuffer += codeToHighlight.slice(match.index, match.index + 1);
|
|
909
|
+
if (!SAFE_MODE) {
|
|
910
|
+
const err = /* @__PURE__ */ new Error(`0 width match regex (${languageName})`);
|
|
911
|
+
err.languageName = languageName;
|
|
912
|
+
err.badRule = lastMatch.rule;
|
|
913
|
+
throw err;
|
|
914
|
+
}
|
|
915
|
+
return 1;
|
|
916
|
+
}
|
|
917
|
+
lastMatch = match;
|
|
918
|
+
if (match.type === "begin") return doBeginMatch(match);
|
|
919
|
+
else if (match.type === "illegal" && !ignoreIllegals) {
|
|
920
|
+
const err = /* @__PURE__ */ new Error("Illegal lexeme \"" + lexeme + "\" for mode \"" + (top.scope || "<unnamed>") + "\"");
|
|
921
|
+
err.mode = top;
|
|
922
|
+
throw err;
|
|
923
|
+
} else if (match.type === "end") {
|
|
924
|
+
const processed = doEndMatch(match);
|
|
925
|
+
if (processed !== NO_MATCH) return processed;
|
|
926
|
+
}
|
|
927
|
+
if (match.type === "illegal" && lexeme === "") return 1;
|
|
928
|
+
if (iterations > 1e5 && iterations > match.index * 3) throw /* @__PURE__ */ new Error("potential infinite loop, way more iterations than matches");
|
|
929
|
+
modeBuffer += lexeme;
|
|
930
|
+
return lexeme.length;
|
|
931
|
+
}
|
|
932
|
+
const language = getLanguage(languageName);
|
|
933
|
+
if (!language) {
|
|
934
|
+
error(LANGUAGE_NOT_FOUND.replace("{}", languageName));
|
|
935
|
+
throw new Error("Unknown language: \"" + languageName + "\"");
|
|
936
|
+
}
|
|
937
|
+
const md = compileLanguage(language);
|
|
938
|
+
let result = "";
|
|
939
|
+
let top = continuation || md;
|
|
940
|
+
const continuations = {};
|
|
941
|
+
const emitter = new options.__emitter(options);
|
|
942
|
+
processContinuations();
|
|
943
|
+
let modeBuffer = "";
|
|
944
|
+
let relevance = 0;
|
|
945
|
+
let index = 0;
|
|
946
|
+
let iterations = 0;
|
|
947
|
+
let resumeScanAtSamePosition = false;
|
|
948
|
+
try {
|
|
949
|
+
if (!language.__emitTokens) {
|
|
950
|
+
top.matcher.considerAll();
|
|
951
|
+
for (;;) {
|
|
952
|
+
iterations++;
|
|
953
|
+
if (resumeScanAtSamePosition) resumeScanAtSamePosition = false;
|
|
954
|
+
else top.matcher.considerAll();
|
|
955
|
+
top.matcher.lastIndex = index;
|
|
956
|
+
const match = top.matcher.exec(codeToHighlight);
|
|
957
|
+
if (!match) break;
|
|
958
|
+
const processedCount = processLexeme(codeToHighlight.substring(index, match.index), match);
|
|
959
|
+
index = match.index + processedCount;
|
|
960
|
+
}
|
|
961
|
+
processLexeme(codeToHighlight.substring(index));
|
|
962
|
+
} else language.__emitTokens(codeToHighlight, emitter);
|
|
963
|
+
emitter.finalize();
|
|
964
|
+
result = emitter.toHTML();
|
|
965
|
+
return {
|
|
966
|
+
language: languageName,
|
|
967
|
+
value: result,
|
|
968
|
+
relevance,
|
|
969
|
+
illegal: false,
|
|
970
|
+
_emitter: emitter,
|
|
971
|
+
_top: top
|
|
972
|
+
};
|
|
973
|
+
} catch (err) {
|
|
974
|
+
if (err.message && err.message.includes("Illegal")) return {
|
|
975
|
+
language: languageName,
|
|
976
|
+
value: escape(codeToHighlight),
|
|
977
|
+
illegal: true,
|
|
978
|
+
relevance: 0,
|
|
979
|
+
_illegalBy: {
|
|
980
|
+
message: err.message,
|
|
981
|
+
index,
|
|
982
|
+
context: codeToHighlight.slice(index - 100, index + 100),
|
|
983
|
+
mode: err.mode,
|
|
984
|
+
resultSoFar: result
|
|
985
|
+
},
|
|
986
|
+
_emitter: emitter
|
|
987
|
+
};
|
|
988
|
+
else if (SAFE_MODE) return {
|
|
989
|
+
language: languageName,
|
|
990
|
+
value: escape(codeToHighlight),
|
|
991
|
+
illegal: false,
|
|
992
|
+
relevance: 0,
|
|
993
|
+
errorRaised: err,
|
|
994
|
+
_emitter: emitter,
|
|
995
|
+
_top: top
|
|
996
|
+
};
|
|
997
|
+
else throw err;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
function justTextHighlightResult(code) {
|
|
1001
|
+
const result = {
|
|
1002
|
+
value: escape(code),
|
|
1003
|
+
illegal: false,
|
|
1004
|
+
relevance: 0,
|
|
1005
|
+
_top: PLAINTEXT_LANGUAGE,
|
|
1006
|
+
_emitter: new options.__emitter(options)
|
|
1007
|
+
};
|
|
1008
|
+
result._emitter.addText(code);
|
|
1009
|
+
return result;
|
|
1010
|
+
}
|
|
1011
|
+
function highlightAuto(code, languageSubset) {
|
|
1012
|
+
languageSubset = languageSubset || options.languages || Object.keys(languages);
|
|
1013
|
+
const plaintext = justTextHighlightResult(code);
|
|
1014
|
+
const results = languageSubset.filter(getLanguage).filter(autoDetection).map((name) => _highlight(name, code, false));
|
|
1015
|
+
results.unshift(plaintext);
|
|
1016
|
+
const [best, secondBest] = results.sort((a, b) => {
|
|
1017
|
+
if (a.relevance !== b.relevance) return b.relevance - a.relevance;
|
|
1018
|
+
if (a.language && b.language) {
|
|
1019
|
+
if (getLanguage(a.language).supersetOf === b.language) return 1;
|
|
1020
|
+
else if (getLanguage(b.language).supersetOf === a.language) return -1;
|
|
1021
|
+
}
|
|
1022
|
+
return 0;
|
|
1023
|
+
});
|
|
1024
|
+
const result = best;
|
|
1025
|
+
result.secondBest = secondBest;
|
|
1026
|
+
return result;
|
|
1027
|
+
}
|
|
1028
|
+
function updateClassName(element, currentLang, resultLang) {
|
|
1029
|
+
const language = currentLang && aliases[currentLang] || resultLang;
|
|
1030
|
+
element.classList.add("hljs");
|
|
1031
|
+
element.classList.add(`language-${language}`);
|
|
1032
|
+
}
|
|
1033
|
+
function highlightElement(element) {
|
|
1034
|
+
let node = null;
|
|
1035
|
+
const language = blockLanguage(element);
|
|
1036
|
+
if (shouldNotHighlight(language)) return;
|
|
1037
|
+
fire("before:highlightElement", {
|
|
1038
|
+
el: element,
|
|
1039
|
+
language
|
|
1040
|
+
});
|
|
1041
|
+
if (element.children.length > 0) {
|
|
1042
|
+
if (!options.ignoreUnescapedHTML) {
|
|
1043
|
+
console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk.");
|
|
1044
|
+
console.warn("https://github.com/highlightjs/highlight.js/wiki/security");
|
|
1045
|
+
console.warn("The element with unescaped HTML:");
|
|
1046
|
+
console.warn(element);
|
|
1047
|
+
}
|
|
1048
|
+
if (options.throwUnescapedHTML) throw new HTMLInjectionError("One of your code blocks includes unescaped HTML.", element.innerHTML);
|
|
1049
|
+
}
|
|
1050
|
+
node = element;
|
|
1051
|
+
const text = node.textContent;
|
|
1052
|
+
const result = language ? highlight$1(text, {
|
|
1053
|
+
language,
|
|
1054
|
+
ignoreIllegals: true
|
|
1055
|
+
}) : highlightAuto(text);
|
|
1056
|
+
element.innerHTML = result.value;
|
|
1057
|
+
updateClassName(element, language, result.language);
|
|
1058
|
+
element.result = {
|
|
1059
|
+
language: result.language,
|
|
1060
|
+
re: result.relevance,
|
|
1061
|
+
relevance: result.relevance
|
|
1062
|
+
};
|
|
1063
|
+
if (result.secondBest) element.secondBest = {
|
|
1064
|
+
language: result.secondBest.language,
|
|
1065
|
+
relevance: result.secondBest.relevance
|
|
1066
|
+
};
|
|
1067
|
+
fire("after:highlightElement", {
|
|
1068
|
+
el: element,
|
|
1069
|
+
result,
|
|
1070
|
+
text
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
function configure(userOptions) {
|
|
1074
|
+
options = inherit(options, userOptions);
|
|
1075
|
+
}
|
|
1076
|
+
const initHighlighting = () => {
|
|
1077
|
+
highlightAll();
|
|
1078
|
+
deprecated("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
|
|
1079
|
+
};
|
|
1080
|
+
function initHighlightingOnLoad() {
|
|
1081
|
+
highlightAll();
|
|
1082
|
+
deprecated("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
|
|
1083
|
+
}
|
|
1084
|
+
let wantsHighlight = false;
|
|
1085
|
+
function highlightAll() {
|
|
1086
|
+
if (document.readyState === "loading") {
|
|
1087
|
+
wantsHighlight = true;
|
|
1088
|
+
return;
|
|
1089
|
+
}
|
|
1090
|
+
document.querySelectorAll(options.cssSelector).forEach(highlightElement);
|
|
1091
|
+
}
|
|
1092
|
+
function boot() {
|
|
1093
|
+
if (wantsHighlight) highlightAll();
|
|
1094
|
+
}
|
|
1095
|
+
if (typeof window !== "undefined" && window.addEventListener) window.addEventListener("DOMContentLoaded", boot, false);
|
|
1096
|
+
function registerLanguage(languageName, languageDefinition) {
|
|
1097
|
+
let lang = null;
|
|
1098
|
+
try {
|
|
1099
|
+
lang = languageDefinition(hljs);
|
|
1100
|
+
} catch (error$1) {
|
|
1101
|
+
error("Language definition for '{}' could not be registered.".replace("{}", languageName));
|
|
1102
|
+
if (!SAFE_MODE) throw error$1;
|
|
1103
|
+
else error(error$1);
|
|
1104
|
+
lang = PLAINTEXT_LANGUAGE;
|
|
1105
|
+
}
|
|
1106
|
+
if (!lang.name) lang.name = languageName;
|
|
1107
|
+
languages[languageName] = lang;
|
|
1108
|
+
lang.rawDefinition = languageDefinition.bind(null, hljs);
|
|
1109
|
+
if (lang.aliases) registerAliases(lang.aliases, { languageName });
|
|
1110
|
+
}
|
|
1111
|
+
function unregisterLanguage(languageName) {
|
|
1112
|
+
delete languages[languageName];
|
|
1113
|
+
for (const alias of Object.keys(aliases)) if (aliases[alias] === languageName) delete aliases[alias];
|
|
1114
|
+
}
|
|
1115
|
+
function listLanguages() {
|
|
1116
|
+
return Object.keys(languages);
|
|
1117
|
+
}
|
|
1118
|
+
function getLanguage(name) {
|
|
1119
|
+
name = (name || "").toLowerCase();
|
|
1120
|
+
return languages[name] || languages[aliases[name]];
|
|
1121
|
+
}
|
|
1122
|
+
function registerAliases(aliasList, { languageName }) {
|
|
1123
|
+
if (typeof aliasList === "string") aliasList = [aliasList];
|
|
1124
|
+
aliasList.forEach((alias) => {
|
|
1125
|
+
aliases[alias.toLowerCase()] = languageName;
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
function autoDetection(name) {
|
|
1129
|
+
const lang = getLanguage(name);
|
|
1130
|
+
return lang && !lang.disableAutodetect;
|
|
1131
|
+
}
|
|
1132
|
+
function upgradePluginAPI(plugin) {
|
|
1133
|
+
if (plugin["before:highlightBlock"] && !plugin["before:highlightElement"]) plugin["before:highlightElement"] = (data) => {
|
|
1134
|
+
plugin["before:highlightBlock"](Object.assign({ block: data.el }, data));
|
|
1135
|
+
};
|
|
1136
|
+
if (plugin["after:highlightBlock"] && !plugin["after:highlightElement"]) plugin["after:highlightElement"] = (data) => {
|
|
1137
|
+
plugin["after:highlightBlock"](Object.assign({ block: data.el }, data));
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
function addPlugin(plugin) {
|
|
1141
|
+
upgradePluginAPI(plugin);
|
|
1142
|
+
plugins.push(plugin);
|
|
1143
|
+
}
|
|
1144
|
+
function removePlugin(plugin) {
|
|
1145
|
+
const index = plugins.indexOf(plugin);
|
|
1146
|
+
if (index !== -1) plugins.splice(index, 1);
|
|
1147
|
+
}
|
|
1148
|
+
function fire(event, args) {
|
|
1149
|
+
const cb = event;
|
|
1150
|
+
plugins.forEach(function(plugin) {
|
|
1151
|
+
if (plugin[cb]) plugin[cb](args);
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
function deprecateHighlightBlock(el) {
|
|
1155
|
+
deprecated("10.7.0", "highlightBlock will be removed entirely in v12.0");
|
|
1156
|
+
deprecated("10.7.0", "Please use highlightElement now.");
|
|
1157
|
+
return highlightElement(el);
|
|
1158
|
+
}
|
|
1159
|
+
Object.assign(hljs, {
|
|
1160
|
+
highlight: highlight$1,
|
|
1161
|
+
highlightAuto,
|
|
1162
|
+
highlightAll,
|
|
1163
|
+
highlightElement,
|
|
1164
|
+
highlightBlock: deprecateHighlightBlock,
|
|
1165
|
+
configure,
|
|
1166
|
+
initHighlighting,
|
|
1167
|
+
initHighlightingOnLoad,
|
|
1168
|
+
registerLanguage,
|
|
1169
|
+
unregisterLanguage,
|
|
1170
|
+
listLanguages,
|
|
1171
|
+
getLanguage,
|
|
1172
|
+
registerAliases,
|
|
1173
|
+
autoDetection,
|
|
1174
|
+
inherit,
|
|
1175
|
+
addPlugin,
|
|
1176
|
+
removePlugin
|
|
1177
|
+
});
|
|
1178
|
+
hljs.debugMode = function() {
|
|
1179
|
+
SAFE_MODE = false;
|
|
1180
|
+
};
|
|
1181
|
+
hljs.safeMode = function() {
|
|
1182
|
+
SAFE_MODE = true;
|
|
1183
|
+
};
|
|
1184
|
+
hljs.versionString = version;
|
|
1185
|
+
hljs.regex = {
|
|
1186
|
+
concat,
|
|
1187
|
+
lookahead,
|
|
1188
|
+
either,
|
|
1189
|
+
optional,
|
|
1190
|
+
anyNumberOfTimes
|
|
1191
|
+
};
|
|
1192
|
+
for (const key in MODES) if (typeof MODES[key] === "object") deepFreeze(MODES[key]);
|
|
1193
|
+
Object.assign(hljs, MODES);
|
|
1194
|
+
return hljs;
|
|
1195
|
+
};
|
|
1196
|
+
var highlight = HLJS({});
|
|
1197
|
+
highlight.newInstance = () => HLJS({});
|
|
1198
|
+
module.exports = highlight;
|
|
1199
|
+
highlight.HighlightJS = highlight;
|
|
1200
|
+
highlight.default = highlight;
|
|
1201
|
+
}));
|
|
1202
|
+
export { require_core as t };
|