cullmann.io/themes/blowfish/assets/lib/mermaid/mermaid.esm.min.mjs.map

1 line
20 KiB
Plaintext
Raw Normal View History

{"version":3,"file":"mermaid.esm.min.mjs","sources":["../../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/esm/index.js","../src/mermaid.ts"],"sourcesContent":["export function dedent(templ) {\n var values = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n values[_i - 1] = arguments[_i];\n }\n var strings = Array.from(typeof templ === 'string' ? [templ] : templ);\n strings[strings.length - 1] = strings[strings.length - 1].replace(/\\r?\\n([\\t ]*)$/, '');\n var indentLengths = strings.reduce(function (arr, str) {\n var matches = str.match(/\\n([\\t ]+|(?!\\s).)/g);\n if (matches) {\n return arr.concat(matches.map(function (match) { var _a, _b; return (_b = (_a = match.match(/[\\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0; }));\n }\n return arr;\n }, []);\n if (indentLengths.length) {\n var pattern_1 = new RegExp(\"\\n[\\t ]{\" + Math.min.apply(Math, indentLengths) + \"}\", 'g');\n strings = strings.map(function (str) { return str.replace(pattern_1, '\\n'); });\n }\n strings[0] = strings[0].replace(/^\\r?\\n/, '');\n var string = strings[0];\n values.forEach(function (value, i) {\n var endentations = string.match(/(?:^|\\n)( *)$/);\n var endentation = endentations ? endentations[1] : '';\n var indentedValue = value;\n if (typeof value === 'string' && value.includes('\\n')) {\n indentedValue = String(value)\n .split('\\n')\n .map(function (str, i) {\n return i === 0 ? str : \"\" + endentation + str;\n })\n .join('\\n');\n }\n string += indentedValue + strings[i + 1];\n });\n return string;\n}\nexport default dedent;\n//# sourceMappingURL=index.js.map","/**\n * Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid\n * functionality and to render the diagrams to svg code!\n */\nimport dedent from 'ts-dedent';\nimport { MermaidConfig } from './config.type';\nimport { log } from './logger';\nimport utils from './utils';\nimport { mermaidAPI, ParseOptions, RenderResult } from './mermaidAPI';\nimport { registerLazyLoadedDiagrams, loadRegisteredDiagrams } from './diagram-api/detectType';\nimport type { ParseErrorFunction } from './Diagram';\nimport { isDetailedError } from './utils';\nimport type { DetailedError } from './utils';\nimport { ExternalDiagramDefinition } from './diagram-api/types';\nimport { UnknownDiagramError } from './errors';\n\nexport type {\n MermaidConfig,\n DetailedError,\n ExternalDiagramDefinition,\n ParseErrorFunction,\n RenderResult,\n ParseOptions,\n UnknownDiagramError,\n};\n\nexport interface RunOptions {\n /**\n * The query selector to use when finding elements to render. Default: `\".mermaid\"`.\n */\n querySelector?: string;\n /**\n * The nodes to render. If this is set, `querySelector` will be ignored.\n */\n nodes?: ArrayLike<HTMLElement>;\n /**\n * A callback to call after each diagram is rendered.\n */\n postRenderCallback?: (id: string) => unknown;\n /**\n * If `true`, errors will be logged to the console, but not thrown. Default: `false`\n */\n suppressErrors?: boolean;\n}\n\nconst handleError = (error: unknown, errors: DetailedError[], parseError?: ParseErrorFunction) => {\n log.warn(error);\n if (isDetailedError(error)) {\n // handle case where error string and hash were\n // wrapped in object like`const error = { str, hash };`\n if (parseError) {\n parseError(error.str, error.hash);\n }\n errors.push({ ...error, message: error.str, error });\n } else {\n // assume it is just error string and pass it on\n if (parseError) {\n parseError(error);\n }\n if (error instanceof Error) {\n errors.push({\n str: error.message,\n message: error.message,\n hash: error.name,\n error,\n });\n }\n }\n};\n\n/**\n * ## run\n *\n * Function that goes through the document to