summaryrefslogtreecommitdiff
path: root/themes/blowfish/assets/lib/mermaid/mermaidAPI-a31c2c80.js.map
blob: f044ff66fa7d83af77f052ad51699b6104fb7730 (plain)
1
{"version":3,"file":"mermaidAPI-a31c2c80.js","sources":["../../../node_modules/.pnpm/stylis@4.1.2/node_modules/stylis/src/Enum.js","../../../node_modules/.pnpm/stylis@4.1.2/node_modules/stylis/src/Utility.js","../../../node_modules/.pnpm/stylis@4.1.2/node_modules/stylis/src/Tokenizer.js","../../../node_modules/.pnpm/stylis@4.1.2/node_modules/stylis/src/Parser.js","../../../node_modules/.pnpm/stylis@4.1.2/node_modules/stylis/src/Serializer.js","../src/diagrams/c4/c4Detector.ts","../src/diagrams/flowchart/flowDetector.ts","../src/diagrams/flowchart/flowDetector-v2.ts","../src/diagrams/er/erDetector.ts","../src/diagrams/git/gitGraphDetector.ts","../src/diagrams/gantt/ganttDetector.ts","../src/diagrams/info/infoDetector.ts","../src/diagrams/pie/pieDetector.ts","../src/diagrams/requirement/requirementDetector.ts","../src/diagrams/sequence/sequenceDetector.ts","../src/diagrams/class/classDetector.ts","../src/diagrams/class/classDetector-V2.ts","../src/diagrams/state/stateDetector.ts","../src/diagrams/state/stateDetector-V2.ts","../src/diagrams/user-journey/journeyDetector.ts","../src/diagrams/error/errorDetector.ts","../src/diagrams/flowchart/elk/detector.ts","../src/diagrams/timeline/detector.ts","../src/diagrams/mindmap/detector.ts","../src/diagram-api/diagram-orchestration.ts","../src/Diagram.ts","../src/interactionDb.ts","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isPrototype.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_overArg.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeys.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeys.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_DataView.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Promise.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_WeakMap.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getTag.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isLength.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLike.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubFalse.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBuffer.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsTypedArray.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnary.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nodeUtil.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isTypedArray.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEmpty.js","../src/accessibility.ts","../src/mermaidAPI.ts"],"sourcesContent":["export var MS = '-ms-'\nexport var MOZ = '-moz-'\nexport var WEBKIT = '-webkit-'\n\nexport var COMMENT = 'comm'\nexport var RULESET = 'rule'\nexport var DECLARATION = 'decl'\n\nexport var PAGE = '@page'\nexport var MEDIA = '@media'\nexport var IMPORT = '@import'\nexport var CHARSET = '@charset'\nexport var VIEWPORT = '@viewport'\nexport var SUPPORTS = '@supports'\nexport var DOCUMENT = '@document'\nexport var NAMESPACE = '@namespace'\nexport var KEYFRAMES = '@keyframes'\nexport var FONT_FACE = '@font-face'\nexport var COUNTER_STYLE = '@counter-style'\nexport var FONT_FEATURE_VALUES = '@font-feature-values'\n","/**\n * @param {number}\n * @return {number}\n */\nexport var abs = Math.abs\n\n/**\n * @param {number}\n * @return {string}\n */\nexport var from = String.fromCharCode\n\n/**\n * @param {object}\n * @return {object}\n */\nexport var assign = Object.assign\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {number}\n */\nexport function hash (value, length) {\n\treturn charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0\n}\n\n/**\n * @param {string} value\n * @return {string}\n */\nexport function trim (value) {\n\treturn value.trim()\n}\n\n/**\n * @param {string} value\n * @param {RegExp} pattern\n * @return {string?}\n */\nexport function match (value, pattern) {\n\treturn (value = pattern.exec(value)) ? value[0] : value\n}\n\n/**\n * @param {string} value\n * @param {(string|RegExp)} pattern\n * @param {string} replacement\n * @return {string}\n */\nexport function replace (value, pattern, replacement) {\n\treturn value.replace(pattern, replacement)\n}\n\n/**\n * @param {string} value\n * @param {string} search\n * @return {number}\n */\nexport function indexof (value, search) {\n\treturn value.indexOf(search)\n}\n\n/**\n * @param {string} value\n * @param {number} index\n * @return {number}\n */\nexport function charat (value, index) {\n\treturn value.charCodeAt(index) | 0\n}\n\n/**\n * @param {string} value\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function substr (value, begin, end) {\n\treturn value.slice(begin, end)\n}\n\n/**\n * @param {string} value\n * @return {number}\n */\nexport function strlen (value) {\n\treturn value.length\n}\n\n/**\n * @param {any[]} value\n * @return {number}\n */\nexport function sizeof (value) {\n\treturn value.length\n}\n\n/**\n * @param {any} value\n * @param {any[]} array\n * @return {any}\n */\nexport function append (value, array) {\n\treturn array.push(value), value\n}\n\n/**\n * @param {string[]} array\n * @param {function} callback\n * @return {string}\n */\nexport function combine (array, callback) {\n\treturn array.map(callback).join('')\n}\n","import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'\n\nexport var line = 1\nexport var column = 1\nexport var length = 0\nexport var position = 0\nexport var character = 0\nexport var characters = ''\n\n/**\n * @param {string} value\n * @param {object | null} root\n * @param {object | null} parent\n * @param {string} type\n * @param {string[] | string} props\n * @param {object[] | string} children\n * @param {number} length\n */\nexport function node (value, root, parent, type, props, children, length) {\n\treturn {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}\n}\n\n/**\n * @param {object} root\n * @param {object} props\n * @return {object}\n */\nexport function copy (root, props) {\n\treturn assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)\n}\n\n/**\n * @return {number}\n */\nexport function char () {\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function prev () {\n\tcharacter = position > 0 ? charat(characters, --position) : 0\n\n\tif (column--, character === 10)\n\t\tcolumn = 1, line--\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function next () {\n\tcharacter = position < length ? charat(characters, position++) : 0\n\n\tif (column++, character === 10)\n\t\tcolumn = 1, line++\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function peek () {\n\treturn charat(characters, position)\n}\n\n/**\n * @return {number}\n */\nexport function caret () {\n\treturn position\n}\n\n/**\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function slice (begin, end) {\n\treturn substr(characters, begin, end)\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function token (type) {\n\tswitch (type) {\n\t\t// \\0 \\t \\n \\r \\s whitespace token\n\t\tcase 0: case 9: case 10: case 13: case 32:\n\t\t\treturn 5\n\t\t// ! + , / > @ ~ isolate token\n\t\tcase 33: case 43: case 44: case 47: case 62: case 64: case 126:\n\t\t// ; { } breakpoint token\n\t\tcase 59: case 123: case 125:\n\t\t\treturn 4\n\t\t// : accompanied token\n\t\tcase 58:\n\t\t\treturn 3\n\t\t// \" ' ( [ opening delimit token\n\t\tcase 34: case 39: case 40: case 91:\n\t\t\treturn 2\n\t\t// ) ] closing delimit token\n\t\tcase 41: case 93:\n\t\t\treturn 1\n\t}\n\n\treturn 0\n}\n\n/**\n * @param {string} value\n * @return {any[]}\n */\nexport function alloc (value) {\n\treturn line = column = 1, length = strlen(characters = value), position = 0, []\n}\n\n/**\n * @param {any} value\n * @return {any}\n */\nexport function dealloc (value) {\n\treturn characters = '', value\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function delimit (type) {\n\treturn trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))\n}\n\n/**\n * @param {string} value\n * @return {string[]}\n */\nexport function tokenize (value) {\n\treturn dealloc(tokenizer(alloc(value)))\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function whitespace (type) {\n\twhile (character = peek())\n\t\tif (character < 33)\n\t\t\tnext()\n\t\telse\n\t\t\tbreak\n\n\treturn token(type) > 2 || token(character) > 3 ? '' : ' '\n}\n\n/**\n * @param {string[]} children\n * @return {string[]}\n */\nexport function tokenizer (children) {\n\twhile (next())\n\t\tswitch (token(character)) {\n\t\t\tcase 0: append(identifier(position - 1), children)\n\t\t\t\tbreak\n\t\t\tcase 2: append(delimit(character), children)\n\t\t\t\tbreak\n\t\t\tdefault: append(from(character), children)\n\t\t}\n\n\treturn children\n}\n\n/**\n * @param {number} index\n * @param {number} count\n * @return {string}\n */\nexport function escaping (index, count) {\n\twhile (--count && next())\n\t\t// not 0-9 A-F a-f\n\t\tif (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))\n\t\t\tbreak\n\n\treturn slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function delimiter (type) {\n\twhile (next())\n\t\tswitch (character) {\n\t\t\t// ] ) \" '\n\t\t\tcase type:\n\t\t\t\treturn position\n\t\t\t// \" '\n\t\t\tcase 34: case 39:\n\t\t\t\tif (type !== 34 && type !== 39)\n\t\t\t\t\tdelimiter(character)\n\t\t\t\tbreak\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (type === 41)\n\t\t\t\t\tdelimiter(type)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tnext()\n\t\t\t\tbreak\n\t\t}\n\n\treturn position\n}\n\n/**\n * @param {number} type\n * @param {number} index\n * @return {number}\n */\nexport function commenter (type, index) {\n\twhile (next())\n\t\t// //\n\t\tif (type + character === 47 + 10)\n\t\t\tbreak\n\t\t// /*\n\t\telse if (type + character === 42 + 42 && peek() === 47)\n\t\t\tbreak\n\n\treturn '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())\n}\n\n/**\n * @param {number} index\n * @return {string}\n */\nexport function identifier (index) {\n\twhile (!token(peek()))\n\t\tnext()\n\n\treturn slice(index, position)\n}\n","import {COMMENT, RULESET, DECLARATION} from './Enum.js'\nimport {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'\nimport {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'\n\n/**\n * @param {string} value\n * @return {object[]}\n */\nexport function compile (value) {\n\treturn dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {string[]} rule\n * @param {string[]} rules\n * @param {string[]} rulesets\n * @param {number[]} pseudo\n * @param {number[]} points\n * @param {string[]} declarations\n * @return {object}\n */\nexport function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {\n\tvar index = 0\n\tvar offset = 0\n\tvar length = pseudo\n\tvar atrule = 0\n\tvar property = 0\n\tvar previous = 0\n\tvar variable = 1\n\tvar scanning = 1\n\tvar ampersand = 1\n\tvar character = 0\n\tvar type = ''\n\tvar props = rules\n\tvar children = rulesets\n\tvar reference = rule\n\tvar characters = type\n\n\twhile (scanning)\n\t\tswitch (previous = character, character = next()) {\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (previous != 108 && charat(characters, length - 1) == 58) {\n\t\t\t\t\tif (indexof(characters += replace(delimit(character), '&', '&\\f'), '&\\f') != -1)\n\t\t\t\t\t\tampersand = -1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t// \" ' [\n\t\t\tcase 34: case 39: case 91:\n\t\t\t\tcharacters += delimit(character)\n\t\t\t\tbreak\n\t\t\t// \\t \\n \\r \\s\n\t\t\tcase 9: case 10: case 13: case 32:\n\t\t\t\tcharacters += whitespace(previous)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tcharacters += escaping(caret() - 1, 7)\n\t\t\t\tcontinue\n\t\t\t// /\n\t\t\tcase 47:\n\t\t\t\tswitch (peek()) {\n\t\t\t\t\tcase 42: case 47:\n\t\t\t\t\t\tappend(comment(commenter(next(), caret()), root, parent), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcharacters += '/'\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t// {\n\t\t\tcase 123 * variable:\n\t\t\t\tpoints[index++] = strlen(characters) * ampersand\n\t\t\t// } ; \\0\n\t\t\tcase 125 * variable: case 59: case 0:\n\t\t\t\tswitch (character) {\n\t\t\t\t\t// \\0 }\n\t\t\t\t\tcase 0: case 125: scanning = 0\n\t\t\t\t\t// ;\n\t\t\t\t\tcase 59 + offset:\n\t\t\t\t\t\tif (property > 0 && (strlen(characters) - length))\n\t\t\t\t\t\t\tappend(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @ ;\n\t\t\t\t\tcase 59: characters += ';'\n\t\t\t\t\t// { rule/at-rule\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tappend(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)\n\n\t\t\t\t\t\tif (character === 123)\n\t\t\t\t\t\t\tif (offset === 0)\n\t\t\t\t\t\t\t\tparse(characters, root, reference, reference, props, rulesets, length, points, children)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tswitch (atrule) {\n\t\t\t\t\t\t\t\t\t// d m s\n\t\t\t\t\t\t\t\t\tcase 100: case 109: case 115:\n\t\t\t\t\t\t\t\t\t\tparse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children)\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tparse(characters, reference, reference, reference, [''], children, 0, points, children)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindex = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo\n\t\t\t\tbreak\n\t\t\t// :\n\t\t\tcase 58:\n\t\t\t\tlength = 1 + strlen(characters), property = previous\n\t\t\tdefault:\n\t\t\t\tif (variable < 1)\n\t\t\t\t\tif (character == 123)\n\t\t\t\t\t\t--variable\n\t\t\t\t\telse if (character == 125 && variable++ == 0 && prev() == 125)\n\t\t\t\t\t\tcontinue\n\n\t\t\t\tswitch (characters += from(character), character * variable) {\n\t\t\t\t\t// &\n\t\t\t\t\tcase 38:\n\t\t\t\t\t\tampersand = offset > 0 ? 1 : (characters += '\\f', -1)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// ,\n\t\t\t\t\tcase 44:\n\t\t\t\t\t\tpoints[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @\n\t\t\t\t\tcase 64:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (peek() === 45)\n\t\t\t\t\t\t\tcharacters += delimit(next())\n\n\t\t\t\t\t\tatrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// -\n\t\t\t\t\tcase 45:\n\t\t\t\t\t\tif (previous === 45 && strlen(characters) == 2)\n\t\t\t\t\t\t\tvariable = 0\n\t\t\t\t}\n\t\t}\n\n\treturn rulesets\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} index\n * @param {number} offset\n * @param {string[]} rules\n * @param {number[]} points\n * @param {string} type\n * @param {string[]} props\n * @param {string[]} children\n * @param {number} length\n * @return {object}\n */\nexport function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {\n\tvar post = offset - 1\n\tvar rule = offset === 0 ? rules : ['']\n\tvar size = sizeof(rule)\n\n\tfor (var i = 0, j = 0, k = 0; i < index; ++i)\n\t\tfor (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)\n\t\t\tif (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\\f/g, rule[x])))\n\t\t\t\tprops[k++] = z\n\n\treturn node(value, root, parent, offset === 0 ? RULESET : type, props, children, length)\n}\n\n/**\n * @param {number} value\n * @param {object} root\n * @param {object?} parent\n * @return {object}\n */\nexport function comment (value, root, parent) {\n\treturn node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0)\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} length\n * @return {object}\n */\nexport function declaration (value, root, parent, length) {\n\treturn node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length)\n}\n","import {IMPORT, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'\nimport {strlen, sizeof} from './Utility.js'\n\n/**\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function serialize (children, callback) {\n\tvar output = ''\n\tvar length = sizeof(children)\n\n\tfor (var i = 0; i < length; i++)\n\t\toutput += callback(children[i], i, children, callback) || ''\n\n\treturn output\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function stringify (element, index, children, callback) {\n\tswitch (element.type) {\n\t\tcase IMPORT: case DECLARATION: return element.return = element.return || element.value\n\t\tcase COMMENT: return ''\n\t\tcase KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'\n\t\tcase RULESET: element.value = element.props.join(',')\n\t}\n\n\treturn strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''\n}\n","import type { ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'c4';\n\nconst detector = (txt: string) => {\n  return txt.match(/^\\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./c4Diagram');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'flowchart';\n\nconst detector: DiagramDetector = (txt, config) => {\n  // If we have conferred to only use new flow charts this function should always return false\n  // as in not signalling true for a legacy flowchart\n  if (\n    config?.flowchart?.defaultRenderer === 'dagre-wrapper' ||\n    config?.flowchart?.defaultRenderer === 'elk'\n  ) {\n    return false;\n  }\n  return txt.match(/^\\s*graph/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./flowDiagram');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector } from '../../diagram-api/types';\nimport type { ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'flowchart-v2';\n\nconst detector: DiagramDetector = (txt, config) => {\n  if (\n    config?.flowchart?.defaultRenderer === 'dagre-d3' ||\n    config?.flowchart?.defaultRenderer === 'elk'\n  ) {\n    return false;\n  }\n\n  // If we have configured to use dagre-wrapper then we should return true in this function for graph code thus making it use the new flowchart diagram\n  if (txt.match(/^\\s*graph/) !== null && config?.flowchart?.defaultRenderer === 'dagre-wrapper') {\n    return true;\n  }\n  return txt.match(/^\\s*flowchart/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./flowDiagram-v2');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'er';\n\nconst detector: DiagramDetector = (txt) => {\n  return txt.match(/^\\s*erDiagram/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./erDiagram');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector } from '../../diagram-api/types';\nimport type { ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'gitGraph';\n\nconst detector: DiagramDetector = (txt) => {\n  return txt.match(/^\\s*gitGraph/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./gitGraphDiagram');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'gantt';\n\nconst detector: DiagramDetector = (txt) => {\n  return txt.match(/^\\s*gantt/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./ganttDiagram');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'info';\n\nconst detector: DiagramDetector = (txt) => {\n  return txt.match(/^\\s*info/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./infoDiagram');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'pie';\n\nconst detector: DiagramDetector = (txt) => {\n  return txt.match(/^\\s*pie/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./pieDiagram');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'requirement';\n\nconst detector: DiagramDetector = (txt) => {\n  return txt.match(/^\\s*requirement(Diagram)?/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./requirementDiagram');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'sequence';\n\nconst detector: DiagramDetector = (txt) => {\n  return txt.match(/^\\s*sequenceDiagram/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./sequenceDiagram');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'class';\n\nconst detector: DiagramDetector = (txt, config) => {\n  // If we have configured to use dagre-wrapper then we should never return true in this function\n  if (config?.class?.defaultRenderer === 'dagre-wrapper') {\n    return false;\n  }\n  // We have not opted to use the new renderer so we should return true if we detect a class diagram\n  return txt.match(/^\\s*classDiagram/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./classDiagram');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'classDiagram';\n\nconst detector: DiagramDetector = (txt, config) => {\n  // If we have configured to use dagre-wrapper then we should return true in this function for classDiagram code thus making it use the new class diagram\n  if (\n    txt.match(/^\\s*classDiagram/) !== null &&\n    config?.class?.defaultRenderer === 'dagre-wrapper'\n  ) {\n    return true;\n  }\n  // We have not opted to use the new renderer so we should return true if we detect a class diagram\n  return txt.match(/^\\s*classDiagram-v2/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./classDiagram-v2');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'state';\n\nconst detector: DiagramDetector = (txt, config) => {\n  // If we have confirmed to only use new state diagrams this function should always return false\n  // as in not signalling true for a legacy state diagram\n  if (config?.state?.defaultRenderer === 'dagre-wrapper') {\n    return false;\n  }\n  return txt.match(/^\\s*stateDiagram/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./stateDiagram');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'stateDiagram';\n\nconst detector: DiagramDetector = (text, config) => {\n  if (text.match(/^\\s*stateDiagram-v2/) !== null) {\n    return true;\n  }\n  if (text.match(/^\\s*stateDiagram/) && config?.state?.defaultRenderer === 'dagre-wrapper') {\n    return true;\n  }\n  if (text.match(/^\\s*stateDiagram/) && config?.state?.defaultRenderer === 'dagre-wrapper') {\n    return true;\n  }\n  return false;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./stateDiagram-v2');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'journey';\n\nconst detector: DiagramDetector = (txt) => {\n  return txt.match(/^\\s*journey/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./journeyDiagram');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'error';\n\nconst detector: DiagramDetector = (text) => {\n  return text.toLowerCase().trim() === 'error';\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./errorDiagram');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { MermaidConfig } from '../../../config.type';\nimport type { ExternalDiagramDefinition, DiagramDetector } from '../../../diagram-api/types';\n\nconst id = 'flowchart-elk';\n\nconst detector: DiagramDetector = (txt: string, config?: MermaidConfig): boolean => {\n  if (\n    // If diagram explicitly states flowchart-elk\n    txt.match(/^\\s*flowchart-elk/) ||\n    // If a flowchart/graph diagram has their default renderer set to elk\n    (txt.match(/^\\s*flowchart|graph/) && config?.flowchart?.defaultRenderer === 'elk')\n  ) {\n    return true;\n  }\n  return false;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./flowchart-elk-definition.js');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { ExternalDiagramDefinition } from '../../diagram-api/types';\n\nconst id = 'timeline';\n\nconst detector = (txt: string) => {\n  return txt.match(/^\\s*timeline/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./timeline-definition.js');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import type { ExternalDiagramDefinition } from '../../diagram-api/types';\nconst id = 'mindmap';\n\nconst detector = (txt: string) => {\n  return txt.match(/^\\s*mindmap/) !== null;\n};\n\nconst loader = async () => {\n  const { diagram } = await import('./mindmap-definition.js');\n  return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n  id,\n  detector,\n  loader,\n};\n\nexport default plugin;\n","import c4 from '../diagrams/c4/c4Detector';\nimport flowchart from '../diagrams/flowchart/flowDetector';\nimport flowchartV2 from '../diagrams/flowchart/flowDetector-v2';\nimport er from '../diagrams/er/erDetector';\nimport git from '../diagrams/git/gitGraphDetector';\nimport gantt from '../diagrams/gantt/ganttDetector';\nimport info from '../diagrams/info/infoDetector';\nimport pie from '../diagrams/pie/pieDetector';\nimport requirement from '../diagrams/requirement/requirementDetector';\nimport sequence from '../diagrams/sequence/sequenceDetector';\nimport classDiagram from '../diagrams/class/classDetector';\nimport classDiagramV2 from '../diagrams/class/classDetector-V2';\nimport state from '../diagrams/state/stateDetector';\nimport stateV2 from '../diagrams/state/stateDetector-V2';\nimport journey from '../diagrams/user-journey/journeyDetector';\nimport error from '../diagrams/error/errorDetector';\nimport flowchartElk from '../diagrams/flowchart/elk/detector';\nimport timeline from '../diagrams/timeline/detector';\nimport mindmap from '../diagrams/mindmap/detector';\nimport { registerLazyLoadedDiagrams } from './detectType';\nimport { registerDiagram } from './diagramAPI';\n\nlet hasLoadedDiagrams = false;\nexport const addDiagrams = () => {\n  if (hasLoadedDiagrams) {\n    return;\n  }\n  // This is added here to avoid race-conditions.\n  // We could optimize the loading logic somehow.\n  hasLoadedDiagrams = true;\n  registerDiagram(\n    '---',\n    // --- diagram type may appear if YAML front-matter is not parsed correctly\n    {\n      db: {\n        clear: () => {\n          // Quite ok, clear needs to be there for --- to work as a regular diagram\n        },\n      },\n      styles: {}, // should never be used\n      renderer: {}, // should never be used\n      parser: {\n        parser: { yy: {} },\n        parse: () => {\n          throw new Error(\n            'Diagrams beginning with --- are not valid. ' +\n              'If you were trying to use a YAML front-matter, please ensure that ' +\n              \"you've correctly opened and closed the YAML front-matter with un-indented `---` blocks\"\n          );\n        },\n      },\n      init: () => null, // no op\n    },\n    (text) => {\n      return text.toLowerCase().trimStart().startsWith('---');\n    }\n  );\n  // Ordering of detectors is important. The first one to return true will be used.\n  registerLazyLoadedDiagrams(\n    error,\n    c4,\n    classDiagramV2,\n    classDiagram,\n    er,\n    gantt,\n    info,\n    pie,\n    requirement,\n    sequence,\n    flowchartElk,\n    flowchartV2,\n    flowchart,\n    mindmap,\n    timeline,\n    git,\n    stateV2,\n    state,\n    journey\n  );\n};\n","import * as configApi from './config';\nimport { log } from './logger';\nimport { getDiagram, registerDiagram } from './diagram-api/diagramAPI';\nimport { detectType, getDiagramLoader } from './diagram-api/detectType';\nimport { extractFrontMatter } from './diagram-api/frontmatter';\nimport { UnknownDiagramError } from './errors';\nimport { DetailedError } from './utils';\n\nexport type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void;\nexport class Diagram {\n  type = 'graph';\n  parser;\n  renderer;\n  db;\n  private detectError?: UnknownDiagramError;\n  constructor(public text: string) {\n    this.text += '\\n';\n    const cnf = configApi.getConfig();\n    try {\n      this.type = detectType(text, cnf);\n    } catch (e) {\n      this.type = 'error';\n      this.detectError = e as UnknownDiagramError;\n    }\n    const diagram = getDiagram(this.type);\n    log.debug('Type ' + this.type);\n    // Setup diagram\n    this.db = diagram.db;\n    this.db.clear?.();\n    this.renderer = diagram.renderer;\n    this.parser = diagram.parser;\n    const originalParse = this.parser.parse.bind(this.parser);\n    // Wrap the jison parse() method to handle extracting frontmatter.\n    //\n    // This can't be done in this.parse() because some code\n    // directly calls diagram.parser.parse(), bypassing this.parse().\n    //\n    // Similarly, we can't do this in getDiagramFromText() because some code\n    // calls diagram.db.clear(), which would reset anything set by\n    // extractFrontMatter().\n    this.parser.parse = (text: string) => originalParse(extractFrontMatter(text, this.db));\n    this.parser.parser.yy = this.db;\n    if (diagram.init) {\n      diagram.init(cnf);\n      log.info('Initialized diagram ' + this.type, cnf);\n    }\n    this.parse();\n  }\n\n  parse() {\n    if (this.detectError) {\n      throw this.detectError;\n    }\n    this.db.clear?.();\n    this.parser.parse(this.text);\n  }\n\n  async render(id: string, version: string) {\n    await this.renderer.draw(this.text, id, version, this);\n  }\n\n  getParser() {\n    return this.parser;\n  }\n\n  getType() {\n    return this.type;\n  }\n}\n\nexport const getDiagramFromText = async (text: string): Promise<Diagram> => {\n  const type = detectType(text, configApi.getConfig());\n  try {\n    // Trying to find the diagram\n    getDiagram(type);\n  } catch (error) {\n    const loader = getDiagramLoader(type);\n    if (!loader) {\n      throw new UnknownDiagramError(`Diagram ${type} not found.`);\n    }\n    // Diagram not available, loading it.\n    // new diagram will try getDiagram again and if fails then it is a valid throw\n    const { id, diagram } = await loader();\n    registerDiagram(id, diagram);\n  }\n  return new Diagram(text);\n};\n","let interactionFunctions: (() => void)[] = [];\nexport const addFunction = (func: () => void) => {\n  interactionFunctions.push(func);\n};\nexport const attachFunctions = () => {\n  interactionFunctions.forEach((f) => {\n    f();\n  });\n  interactionFunctions = [];\n};\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n  var Ctor = value && value.constructor,\n      proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n  return value === proto;\n}\n\nexport default isPrototype;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n  return function(arg) {\n    return func(transform(arg));\n  };\n}\n\nexport default overArg;\n","import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n","import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n  if (!isPrototype(object)) {\n    return nativeKeys(object);\n  }\n  var result = [];\n  for (var key in Object(object)) {\n    if (hasOwnProperty.call(object, key) && key != 'constructor') {\n      result.push(key);\n    }\n  }\n  return result;\n}\n\nexport default baseKeys;\n","import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nexport default DataView;\n","import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nexport default Promise;\n","import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nexport default Set;\n","import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nexport default WeakMap;\n","import DataView from './_DataView.js';\nimport Map from './_Map.js';\nimport Promise from './_Promise.js';\nimport Set from './_Set.js';\nimport WeakMap from './_WeakMap.js';\nimport baseGetTag from './_baseGetTag.js';\nimport toSource from './_toSource.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n    objectTag = '[object Object]',\n    promiseTag = '[object Promise]',\n    setTag = '[object Set]',\n    weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n    mapCtorString = toSource(Map),\n    promiseCtorString = toSource(Promise),\n    setCtorString = toSource(Set),\n    weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n    (Map && getTag(new Map) != mapTag) ||\n    (Promise && getTag(Promise.resolve()) != promiseTag) ||\n    (Set && getTag(new Set) != setTag) ||\n    (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n  getTag = function(value) {\n    var result = baseGetTag(value),\n        Ctor = result == objectTag ? value.constructor : undefined,\n        ctorString = Ctor ? toSource(Ctor) : '';\n\n    if (ctorString) {\n      switch (ctorString) {\n        case dataViewCtorString: return dataViewTag;\n        case mapCtorString: return mapTag;\n        case promiseCtorString: return promiseTag;\n        case setCtorString: return setTag;\n        case weakMapCtorString: return weakMapTag;\n      }\n    }\n    return result;\n  };\n}\n\nexport default getTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n  return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n  return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n","import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n *  else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n  return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n    !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n  return typeof value == 'number' &&\n    value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n","import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n  return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n","/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n  return false;\n}\n\nexport default stubFalse;\n","import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n","import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n    arrayTag = '[object Array]',\n    boolTag = '[object Boolean]',\n    dateTag = '[object Date]',\n    errorTag = '[object Error]',\n    funcTag = '[object Function]',\n    mapTag = '[object Map]',\n    numberTag = '[object Number]',\n    objectTag = '[object Object]',\n    regexpTag = '[object RegExp]',\n    setTag = '[object Set]',\n    stringTag = '[object String]',\n    weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n    dataViewTag = '[object DataView]',\n    float32Tag = '[object Float32Array]',\n    float64Tag = '[object Float64Array]',\n    int8Tag = '[object Int8Array]',\n    int16Tag = '[object Int16Array]',\n    int32Tag = '[object Int32Array]',\n    uint8Tag = '[object Uint8Array]',\n    uint8ClampedTag = '[object Uint8ClampedArray]',\n    uint16Tag = '[object Uint16Array]',\n    uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n  return isObjectLike(value) &&\n    isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n","/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n  return function(value) {\n    return func(value);\n  };\n}\n\nexport default baseUnary;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n  try {\n    // Use `util.types` for Node.js 10+.\n    var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n    if (types) {\n      return types;\n    }\n\n    // Legacy `process.binding('util')` for Node.js < 10.\n    return freeProcess && freeProcess.binding && freeProcess.binding('util');\n  } catch (e) {}\n}());\n\nexport default nodeUtil;\n","import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n","import baseKeys from './_baseKeys.js';\nimport getTag from './_getTag.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isArrayLike from './isArrayLike.js';\nimport isBuffer from './isBuffer.js';\nimport isPrototype from './_isPrototype.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n    setTag = '[object Set]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if `value` is an empty object, collection, map, or set.\n *\n * Objects are considered empty if they have no own enumerable string keyed\n * properties.\n *\n * Array-like values such as `arguments` objects, arrays, buffers, strings, or\n * jQuery-like collections are considered empty if they have a `length` of `0`.\n * Similarly, maps and sets are considered empty if they have a `size` of `0`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\nfunction isEmpty(value) {\n  if (value == null) {\n    return true;\n  }\n  if (isArrayLike(value) &&\n      (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||\n        isBuffer(value) || isTypedArray(value) || isArguments(value))) {\n    return !value.length;\n  }\n  var tag = getTag(value);\n  if (tag == mapTag || tag == setTag) {\n    return !value.size;\n  }\n  if (isPrototype(value)) {\n    return !baseKeys(value).length;\n  }\n  for (var key in value) {\n    if (hasOwnProperty.call(value, key)) {\n      return false;\n    }\n  }\n  return true;\n}\n\nexport default isEmpty;\n","/**\n * Accessibility (a11y) functions, types, helpers\n * @see https://www.w3.org/WAI/\n * @see https://www.w3.org/TR/wai-aria-1.1/\n * @see https://www.w3.org/TR/svg-aam-1.0/\n *\n */\nimport { D3Element } from './mermaidAPI';\n\nimport isEmpty from 'lodash-es/isEmpty.js';\n\n/**\n * SVG element role:\n * The SVG element role _should_ be set to 'graphics-document' per SVG standard\n * but in practice is not always done by browsers, etc. (As of 2022-12-08).\n * A fallback role of 'document' should be set for those browsers, etc., that only support ARIA 1.0.\n *\n * @see https://www.w3.org/TR/svg-aam-1.0/#roleMappingGeneralRules\n * @see https://www.w3.org/TR/graphics-aria-1.0/#graphics-document\n */\nconst SVG_ROLE = 'graphics-document document';\n\n/**\n * Add role and aria-roledescription to the svg element\n *\n * @param svg - d3 object that contains the SVG HTML element\n * @param diagramType - diagram name for to the aria-roledescription\n */\nexport function setA11yDiagramInfo(svg: D3Element, diagramType: string | null | undefined) {\n  svg.attr('role', SVG_ROLE);\n  if (!isEmpty(diagramType)) {\n    svg.attr('aria-roledescription', diagramType);\n  }\n}\n/**\n * Add an accessible title and/or description element to a chart.\n * The title is usually not displayed and the description is never displayed.\n *\n * The following charts display their title as a visual and accessibility element: gantt\n *\n * @param svg - d3 node to insert the a11y title and desc info\n * @param a11yTitle - a11y title. null and undefined are meaningful: means to skip it\n * @param a11yDesc - a11y description.  null and undefined are meaningful: means to skip it\n * @param baseId - id used to construct the a11y title and description id\n */\nexport function addSVGa11yTitleDescription(\n  svg: D3Element,\n  a11yTitle: string | null | undefined,\n  a11yDesc: string | null | undefined,\n  baseId: string\n) {\n  if (svg.insert === undefined) {\n    return;\n  }\n\n  if (a11yTitle || a11yDesc) {\n    if (a11yDesc) {\n      const descId = 'chart-desc-' + baseId;\n      svg.attr('aria-describedby', descId);\n      svg.insert('desc', ':first-child').attr('id', descId).text(a11yDesc);\n    }\n    if (a11yTitle) {\n      const titleId = 'chart-title-' + baseId;\n      svg.attr('aria-labelledby', titleId);\n      svg.insert('title', ':first-child').attr('id', titleId).text(a11yTitle);\n    }\n  } else {\n    return;\n  }\n}\n","/**\n * This is the API to be used when optionally handling the integration with the web page, instead of\n * using the default integration provided by mermaid.js.\n *\n * The core of this api is the [**render**](Setup.md?id=render) function which, given a graph\n * definition as text, renders the graph/diagram and returns an svg element for the graph.\n *\n * It is then up to the user of the API to make use of the svg, either insert it somewhere in the\n * page or do something completely different.\n *\n * In addition to the render function, a number of behavioral configuration options are available.\n */\n// @ts-ignore TODO: Investigate D3 issue\nimport { select } from 'd3';\nimport { compile, serialize, stringify } from 'stylis';\n// @ts-ignore: TODO Fix ts errors\nimport { version } from '../package.json';\nimport * as configApi from './config';\nimport { addDiagrams } from './diagram-api/diagram-orchestration';\nimport { Diagram, getDiagramFromText } from './Diagram';\nimport errorRenderer from './diagrams/error/errorRenderer';\nimport { attachFunctions } from './interactionDb';\nimport { log, setLogLevel } from './logger';\nimport getStyles from './styles';\nimport theme from './themes';\nimport utils, { directiveSanitizer } from './utils';\nimport DOMPurify from 'dompurify';\nimport { MermaidConfig } from './config.type';\nimport { evaluate } from './diagrams/common/common';\nimport isEmpty from 'lodash-es/isEmpty.js';\nimport { setA11yDiagramInfo, addSVGa11yTitleDescription } from './accessibility';\nimport { parseDirective } from './directiveUtils';\n\n// diagram names that support classDef statements\nconst CLASSDEF_DIAGRAMS = ['graph', 'flowchart', 'flowchart-v2', 'stateDiagram', 'stateDiagram-v2'];\nconst MAX_TEXTLENGTH = 50_000;\nconst MAX_TEXTLENGTH_EXCEEDED_MSG =\n  'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';\n\nconst SECURITY_LVL_SANDBOX = 'sandbox';\nconst SECURITY_LVL_LOOSE = 'loose';\n\nconst XMLNS_SVG_STD = 'http://www.w3.org/2000/svg';\nconst XMLNS_XLINK_STD = 'http://www.w3.org/1999/xlink';\nconst XMLNS_XHTML_STD = 'http://www.w3.org/1999/xhtml';\n\n// ------------------------------\n// iFrame\nconst IFRAME_WIDTH = '100%';\nconst IFRAME_HEIGHT = '100%';\nconst IFRAME_STYLES = 'border:0;margin:0;';\nconst IFRAME_BODY_STYLE = 'margin:0';\nconst IFRAME_SANDBOX_OPTS = 'allow-top-navigation-by-user-activation allow-popups';\nconst IFRAME_NOT_SUPPORTED_MSG = 'The \"iframe\" tag is not supported by your browser.';\n\n// DOMPurify settings for svgCode\nconst DOMPURIFY_TAGS = ['foreignobject'];\nconst DOMPURIFY_ATTR = ['dominant-baseline'];\n\n// This is what is returned from getClasses(...) methods.\n// It is slightly renamed to ..StyleClassDef instead of just ClassDef because \"class\" is a greatly ambiguous and overloaded word.\n// It makes it clear we're working with a style class definition, even though defining the type is currently difficult.\ninterface DiagramStyleClassDef {\n  id: string;\n  styles?: string[];\n  textStyles?: string[];\n}\n\nexport interface ParseOptions {\n  suppressErrors?: boolean;\n}\n\n// This makes it clear that we're working with a d3 selected element of some kind, even though it's hard to specify the exact type.\n// @ts-ignore Could replicate the type definition in d3. This also makes it possible to use the untyped info from the js diagram files.\nexport type D3Element = any;\n\nexport interface RenderResult {\n  /**\n   * The svg code for the rendered graph.\n   */\n  svg: string;\n  /**\n   * Bind function to be called after the svg has been inserted into the DOM.\n   * This is necessary for adding event listeners to the elements in the svg.\n   * ```js\n   * const { svg, bindFunctions } = mermaidAPI.render('id1', 'graph TD;A-->B');\n   * div.innerHTML = svg;\n   * bindFunctions?.(div); // To call bindFunctions only if it's present.\n   * ```\n   */\n  bindFunctions?: (element: Element) => void;\n}\n\n/**\n * Parse the text and validate the syntax.\n * @param text - The mermaid diagram definition.\n * @param parseOptions - Options for parsing.\n * @returns true if the diagram is valid, false otherwise if parseOptions.suppressErrors is true.\n * @throws Error if the diagram is invalid and parseOptions.suppressErrors is false.\n */\n\nasync function parse(text: string, parseOptions?: ParseOptions): Promise<boolean | void> {\n  addDiagrams();\n  let error;\n  try {\n    const diagram = await getDiagramFromText(text);\n    diagram.parse();\n  } catch (err) {\n    error = err;\n  }\n  if (parseOptions?.suppressErrors) {\n    return error === undefined;\n  }\n  if (error) {\n    throw error;\n  }\n}\n\n/**\n * @param  text - text to be encoded\n * @returns\n */\nexport const encodeEntities = function (text: string): string {\n  let txt = text;\n\n  txt = txt.replace(/style.*:\\S*#.*;/g, function (s): string {\n    return s.substring(0, s.length - 1);\n  });\n  txt = txt.replace(/classDef.*:\\S*#.*;/g, function (s): string {\n    return s.substring(0, s.length - 1);\n  });\n\n  txt = txt.replace(/#\\w+;/g, function (s) {\n    const innerTxt = s.substring(1, s.length - 1);\n\n    const isInt = /^\\+?\\d+$/.test(innerTxt);\n    if (isInt) {\n      return 'fl°°' + innerTxt + '¶ß';\n    } else {\n      return 'fl°' + innerTxt + '¶ß';\n    }\n  });\n\n  return txt;\n};\n\n/**\n *\n * @param  text - text to be decoded\n * @returns\n */\nexport const decodeEntities = function (text: string): string {\n  let txt = text;\n\n  txt = txt.replace(/fl°°/g, '&#');\n  txt = txt.replace(/fl°/g, '&');\n  txt = txt.replace(/¶ß/g, ';');\n\n  return txt;\n};\n\n// append !important; to each cssClass followed by a final !important, all enclosed in { }\n//\n/**\n * Create a CSS style that starts with the given class name, then the element,\n * with an enclosing block that has each of the cssClasses followed by !important;\n * @param cssClass - CSS class name\n * @param element - CSS element\n * @param cssClasses - list of CSS styles to append after the element\n * @returns - the constructed string\n */\nexport const cssImportantStyles = (\n  cssClass: string,\n  element: string,\n  cssClasses: string[] = []\n): string => {\n  return `\\n.${cssClass} ${element} { ${cssClasses.join(' !important; ')} !important; }`;\n};\n\n/**\n * Create the user styles\n *\n * @param  config - configuration that has style and theme settings to use\n * @param graphType - used for checking if classDefs should be applied\n * @param  classDefs - the classDefs in the diagram text. Might be null if none were defined. Usually is the result of a call to getClasses(...)\n * @returns  the string with all the user styles\n */\nexport const createCssStyles = (\n  config: MermaidConfig,\n  graphType: string,\n  classDefs: Record<string, DiagramStyleClassDef> | null | undefined = {}\n): string => {\n  let cssStyles = '';\n\n  // user provided theme CSS info\n  // If you add more configuration driven data into the user styles make sure that the value is\n  // sanitized by the sanitize CSS function TODO where is this method?  what should be used to replace it?  refactor so that it's always sanitized\n  if (config.themeCSS !== undefined) {\n    cssStyles += `\\n${config.themeCSS}`;\n  }\n\n  if (config.fontFamily !== undefined) {\n    cssStyles += `\\n:root { --mermaid-font-family: ${config.fontFamily}}`;\n  }\n  if (config.altFontFamily !== undefined) {\n    cssStyles += `\\n:root { --mermaid-alt-font-family: ${config.altFontFamily}}`;\n  }\n\n  // classDefs defined in the diagram text\n  if (!isEmpty(classDefs) && CLASSDEF_DIAGRAMS.includes(graphType)) {\n    const htmlLabels = config.htmlLabels || config.flowchart?.htmlLabels; // TODO why specifically check the Flowchart diagram config?\n\n    const cssHtmlElements = ['> *', 'span']; // TODO make a constant\n    const cssShapeElements = ['rect', 'polygon', 'ellipse', 'circle', 'path']; // TODO make a constant\n\n    const cssElements = htmlLabels ? cssHtmlElements : cssShapeElements;\n\n    // create the CSS styles needed for each styleClass definition and css element\n    for (const classId in classDefs) {\n      const styleClassDef = classDefs[classId];\n      // create the css styles for each cssElement and the styles (only if there are styles)\n      if (!isEmpty(styleClassDef.styles)) {\n        cssElements.forEach((cssElement) => {\n          cssStyles += cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles);\n        });\n      }\n      // create the css styles for the tspan element and the text styles (only if there are textStyles)\n      if (!isEmpty(styleClassDef.textStyles)) {\n        cssStyles += cssImportantStyles(styleClassDef.id, 'tspan', styleClassDef.textStyles);\n      }\n    }\n  }\n  return cssStyles;\n};\n\nexport const createUserStyles = (\n  config: MermaidConfig,\n  graphType: string,\n  classDefs: Record<string, DiagramStyleClassDef>,\n  svgId: string\n): string => {\n  const userCSSstyles = createCssStyles(config, graphType, classDefs);\n  const allStyles = getStyles(graphType, userCSSstyles, config.themeVariables);\n\n  // Now turn all of the styles into a (compiled) string that starts with the id\n  // use the stylis library to compile the css, turn the results into a valid CSS string (serialize(...., stringify))\n  // @see https://github.com/thysultan/stylis\n  return serialize(compile(`${svgId}{${allStyles}}`), stringify);\n};\n\n/**\n * Clean up svgCode. Do replacements needed\n *\n * @param svgCode - the code to clean up\n * @param inSandboxMode - security level\n * @param useArrowMarkerUrls - should arrow marker's use full urls? (vs. just the anchors)\n * @returns the cleaned up svgCode\n */\nexport const cleanUpSvgCode = (\n  svgCode = '',\n  inSandboxMode: boolean,\n  useArrowMarkerUrls: boolean\n): string => {\n  let cleanedUpSvg = svgCode;\n\n  // Replace marker-end urls with just the # anchor (remove the preceding part of the URL)\n  if (!useArrowMarkerUrls && !inSandboxMode) {\n    cleanedUpSvg = cleanedUpSvg.replace(/marker-end=\"url\\(.*?#/g, 'marker-end=\"url(#');\n  }\n\n  cleanedUpSvg = decodeEntities(cleanedUpSvg);\n\n  // replace old br tags with newer style\n  cleanedUpSvg = cleanedUpSvg.replace(/<br>/g, '<br/>');\n\n  return cleanedUpSvg;\n};\n\n/**\n * Put the svgCode into an iFrame. Return the iFrame code\n *\n * @param svgCode - the svg code to put inside the iFrame\n * @param svgElement - the d3 node that has the current svgElement so we can get the height from it\n * @returns  - the code with the iFrame that now contains the svgCode\n * TODO replace btoa(). Replace with  buf.toString('base64')?\n */\nexport const putIntoIFrame = (svgCode = '', svgElement?: D3Element): string => {\n  const height = svgElement ? svgElement.viewBox.baseVal.height + 'px' : IFRAME_HEIGHT;\n  const base64encodedSrc = btoa('<body style=\"' + IFRAME_BODY_STYLE + '\">' + svgCode + '</body>');\n  return `<iframe style=\"width:${IFRAME_WIDTH};height:${height};${IFRAME_STYLES}\" src=\"data:text/html;base64,${base64encodedSrc}\" sandbox=\"${IFRAME_SANDBOX_OPTS}\">\n  ${IFRAME_NOT_SUPPORTED_MSG}\n</iframe>`;\n};\n\n/**\n * Append an enclosing div, then svg, then g (group) to the d3 parentRoot. Set attributes.\n * Only set the style attribute on the enclosing div if divStyle is given.\n * Only set the xmlns:xlink attribute on svg if svgXlink is given.\n * Return the last node appended\n *\n * @param parentRoot - the d3 node to append things to\n * @param id - the value to set the id attr to\n * @param enclosingDivId - the id to set the enclosing div to\n * @param divStyle - if given, the style to set the enclosing div to\n * @param svgXlink - if given, the link to set the new svg element to\n * @returns - returns the parentRoot that had nodes appended\n */\nexport const appendDivSvgG = (\n  parentRoot: D3Element,\n  id: string,\n  enclosingDivId: string,\n  divStyle?: string,\n  svgXlink?: string\n): D3Element => {\n  const enclosingDiv = parentRoot.append('div');\n  enclosingDiv.attr('id', enclosingDivId);\n  if (divStyle) {\n    enclosingDiv.attr('style', divStyle);\n  }\n\n  const svgNode = enclosingDiv\n    .append('svg')\n    .attr('id', id)\n    .attr('width', '100%')\n    .attr('xmlns', XMLNS_SVG_STD);\n  if (svgXlink) {\n    svgNode.attr('xmlns:xlink', svgXlink);\n  }\n\n  svgNode.append('g');\n  return parentRoot;\n};\n\n/**\n * Append an iFrame node to the given parentNode and set the id, style, and 'sandbox' attributes\n *  Return the appended iframe d3 node\n *\n * @param parentNode - the d3 node to append the iFrame node to\n * @param iFrameId - id to use for the iFrame\n * @returns the appended iframe d3 node\n */\nfunction sandboxedIframe(parentNode: D3Element, iFrameId: string): D3Element {\n  return parentNode\n    .append('iframe')\n    .attr('id', iFrameId)\n    .attr('style', 'width: 100%; height: 100%;')\n    .attr('sandbox', '');\n}\n\n/**\n * Remove any existing elements from the given document\n *\n * @param doc - the document to removed elements from\n * @param id - id for any existing SVG element\n * @param divSelector - selector for any existing enclosing div element\n * @param iFrameSelector - selector for any existing iFrame element\n */\nexport const removeExistingElements = (\n  doc: Document,\n  id: string,\n  divId: string,\n  iFrameId: string\n) => {\n  // Remove existing SVG element if it exists\n  doc.getElementById(id)?.remove();\n  // Remove previous temporary element if it exists\n  // Both div and iframe needs to be cleared in case there is a config change happening between renders.\n  doc.getElementById(divId)?.remove();\n  doc.getElementById(iFrameId)?.remove();\n};\n\n/**\n * @deprecated - use the `mermaid.render` function instead of `mermaid.mermaidAPI.render`\n *\n * Deprecated for external use.\n */\n\nconst render = async function (\n  id: string,\n  text: string,\n  svgContainingElement?: Element\n): Promise<RenderResult> {\n  addDiagrams();\n\n  configApi.reset();\n\n  // Add Directives. Must do this before getting the config and before creating the diagram.\n  const graphInit = utils.detectInit(text);\n  if (graphInit) {\n    directiveSanitizer(graphInit);\n    configApi.addDirective(graphInit);\n  }\n\n  const config = configApi.getConfig();\n  log.debug(config);\n\n  // Check the maximum allowed text size\n  if (text.length > (config?.maxTextSize ?? MAX_TEXTLENGTH)) {\n    text = MAX_TEXTLENGTH_EXCEEDED_MSG;\n  }\n\n  // clean up text CRLFs\n  text = text.replace(/\\r\\n?/g, '\\n'); // parser problems on CRLF ignore all CR and leave LF;;\n\n  const idSelector = '#' + id;\n  const iFrameID = 'i' + id;\n  const iFrameID_selector = '#' + iFrameID;\n  const enclosingDivID = 'd' + id;\n  const enclosingDivID_selector = '#' + enclosingDivID;\n\n  let root: any = select('body');\n\n  const isSandboxed = config.securityLevel === SECURITY_LVL_SANDBOX;\n  const isLooseSecurityLevel = config.securityLevel === SECURITY_LVL_LOOSE;\n\n  const fontFamily = config.fontFamily;\n\n  // -------------------------------------------------------------------------------\n  // Define the root d3 node\n  // In regular execution the svgContainingElement will be the element with a mermaid class\n\n  if (svgContainingElement !== undefined) {\n    if (svgContainingElement) {\n      svgContainingElement.innerHTML = '';\n    }\n\n    if (isSandboxed) {\n      // If we are in sandboxed mode, we do everything mermaid related in a (sandboxed )iFrame\n      const iframe = sandboxedIframe(select(svgContainingElement), iFrameID);\n      root = select(iframe.nodes()[0]!.contentDocument!.body);\n      root.node().style.margin = 0;\n    } else {\n      root = select(svgContainingElement);\n    }\n    appendDivSvgG(root, id, enclosingDivID, `font-family: ${fontFamily}`, XMLNS_XLINK_STD);\n  } else {\n    // No svgContainingElement was provided\n\n    // If there is an existing element with the id, we remove it. This likely a previously rendered diagram\n    removeExistingElements(document, id, enclosingDivID, iFrameID);\n\n    // Add the temporary div used for rendering with the enclosingDivID.\n    // This temporary div will contain a svg with the id == id\n\n    if (isSandboxed) {\n      // If we are in sandboxed mode, we do everything mermaid related in a (sandboxed) iFrame\n      const iframe = sandboxedIframe(select('body'), iFrameID);\n      root = select(iframe.nodes()[0]!.contentDocument!.body);\n      root.node().style.margin = 0;\n    } else {\n      root = select('body');\n    }\n\n    appendDivSvgG(root, id, enclosingDivID);\n  }\n\n  text = encodeEntities(text);\n\n  // -------------------------------------------------------------------------------\n  // Create the diagram\n\n  // Important that we do not create the diagram until after the directives have been included\n  let diag: Diagram;\n  let parseEncounteredException;\n\n  try {\n    diag = await getDiagramFromText(text);\n  } catch (error) {\n    diag = new Diagram('error');\n    parseEncounteredException = error;\n  }\n\n  // Get the temporary div element containing the svg\n  const element = root.select(enclosingDivID_selector).node();\n  const graphType = diag.type;\n\n  // -------------------------------------------------------------------------------\n  // Create and insert the styles (user styles, theme styles, config styles)\n\n  // Insert an element into svg. This is where we put the styles\n  const svg = element.firstChild;\n  const firstChild = svg.firstChild;\n  const diagramClassDefs = CLASSDEF_DIAGRAMS.includes(graphType)\n    ? diag.renderer.getClasses(text, diag)\n    : {};\n\n  const rules = createUserStyles(\n    config,\n    graphType,\n    // @ts-ignore convert renderer to TS.\n    diagramClassDefs,\n    idSelector\n  );\n\n  const style1 = document.createElement('style');\n  style1.innerHTML = rules;\n  svg.insertBefore(style1, firstChild);\n\n  // -------------------------------------------------------------------------------\n  // Draw the diagram with the renderer\n  try {\n    await diag.renderer.draw(text, id, version, diag);\n  } catch (e) {\n    errorRenderer.draw(text, id, version);\n    throw e;\n  }\n\n  // This is the d3 node for the svg element\n  const svgNode = root.select(`${enclosingDivID_selector} svg`);\n  const a11yTitle = diag.db.getAccTitle?.();\n  const a11yDescr = diag.db.getAccDescription?.();\n  addA11yInfo(graphType, svgNode, a11yTitle, a11yDescr);\n\n  // -------------------------------------------------------------------------------\n  // Clean up SVG code\n  root.select(`[id=\"${id}\"]`).selectAll('foreignobject > *').attr('xmlns', XMLNS_XHTML_STD);\n\n  // Fix for when the base tag is used\n  let svgCode: string = root.select(enclosingDivID_selector).node().innerHTML;\n\n  log.debug('config.arrowMarkerAbsolute', config.arrowMarkerAbsolute);\n  svgCode = cleanUpSvgCode(svgCode, isSandboxed, evaluate(config.arrowMarkerAbsolute));\n\n  if (isSandboxed) {\n    const svgEl = root.select(enclosingDivID_selector + ' svg').node();\n    svgCode = putIntoIFrame(svgCode, svgEl);\n  } else if (!isLooseSecurityLevel) {\n    // Sanitize the svgCode using DOMPurify\n    svgCode = DOMPurify.sanitize(svgCode, {\n      ADD_TAGS: DOMPURIFY_TAGS,\n      ADD_ATTR: DOMPURIFY_ATTR,\n    });\n  }\n\n  attachFunctions();\n\n  // -------------------------------------------------------------------------------\n  // Remove the temporary HTML element if appropriate\n  const tmpElementSelector = isSandboxed ? iFrameID_selector : enclosingDivID_selector;\n  const node = select(tmpElementSelector).node();\n  if (node && 'remove' in node) {\n    node.remove();\n  }\n\n  if (parseEncounteredException) {\n    throw parseEncounteredException;\n  }\n\n  return {\n    svg: svgCode,\n    bindFunctions: diag.db.bindFunctions,\n  };\n};\n\n/**\n * @param  options - Initial Mermaid options\n */\nfunction initialize(options: MermaidConfig = {}) {\n  // Handle legacy location of font-family configuration\n  if (options?.fontFamily && !options.themeVariables?.fontFamily) {\n    if (!options.themeVariables) {\n      options.themeVariables = {};\n    }\n    options.themeVariables.fontFamily = options.fontFamily;\n  }\n\n  // Set default options\n  configApi.saveConfigFromInitialize(options);\n\n  if (options?.theme && options.theme in theme) {\n    // Todo merge with user options\n    options.themeVariables = theme[options.theme as keyof typeof theme].getThemeVariables(\n      options.themeVariables\n    );\n  } else if (options) {\n    options.themeVariables = theme.default.getThemeVariables(options.themeVariables);\n  }\n\n  const config =\n    typeof options === 'object' ? configApi.setSiteConfig(options) : configApi.getSiteConfig();\n\n  setLogLevel(config.logLevel);\n  addDiagrams();\n}\n\n/**\n * Add accessibility (a11y) information to the diagram.\n *\n */\nfunction addA11yInfo(\n  graphType: string,\n  svgNode: D3Element,\n  a11yTitle: string | undefined,\n  a11yDescr: string | undefined\n) {\n  setA11yDiagramInfo(svgNode, graphType);\n  addSVGa11yTitleDescription(svgNode, a11yTitle, a11yDescr, svgNode.attr('id'));\n}\n\n/**\n * ## mermaidAPI configuration defaults\n *\n * ```ts\n *   const config = {\n *     theme: 'default',\n *     logLevel: 'fatal',\n *     securityLevel: 'strict',\n *     startOnLoad: true,\n *     arrowMarkerAbsolute: false,\n *\n *     er: {\n *       diagramPadding: 20,\n *       layoutDirection: 'TB',\n *       minEntityWidth: 100,\n *       minEntityHeight: 75,\n *       entityPadding: 15,\n *       stroke: 'gray',\n *       fill: 'honeydew',\n *       fontSize: 12,\n *       useMaxWidth: true,\n *     },\n *     flowchart: {\n *       diagramPadding: 8,\n *       htmlLabels: true,\n *       curve: 'basis',\n *     },\n *     sequence: {\n *       diagramMarginX: 50,\n *       diagramMarginY: 10,\n *       actorMargin: 50,\n *       width: 150,\n *       height: 65,\n *       boxMargin: 10,\n *       boxTextMargin: 5,\n *       noteMargin: 10,\n *       messageMargin: 35,\n *       messageAlign: 'center',\n *       mirrorActors: true,\n *       bottomMarginAdj: 1,\n *       useMaxWidth: true,\n *       rightAngles: false,\n *       showSequenceNumbers: false,\n *     },\n *     gantt: {\n *       titleTopMargin: 25,\n *       barHeight: 20,\n *       barGap: 4,\n *       topPadding: 50,\n *       leftPadding: 75,\n *       gridLineStartPadding: 35,\n *       fontSize: 11,\n *       fontFamily: '\"Open Sans\", sans-serif',\n *       numberSectionStyles: 4,\n *       axisFormat: '%Y-%m-%d',\n *       topAxis: false,\n *     },\n *   };\n *   mermaid.initialize(config);\n * ```\n */\n\nexport const mermaidAPI = Object.freeze({\n  render,\n  parse,\n  parseDirective,\n  initialize,\n  getConfig: configApi.getConfig,\n  setConfig: configApi.setConfig,\n  getSiteConfig: configApi.getSiteConfig,\n  updateSiteConfig: configApi.updateSiteConfig,\n  reset: () => {\n    configApi.reset();\n  },\n  globalReset: () => {\n    configApi.reset(configApi.defaultConfig);\n  },\n  defaultConfig: configApi.defaultConfig,\n});\n\nsetLogLevel(configApi.getConfig().logLevel);\nconfigApi.reset(configApi.getConfig());\nexport default mermaidAPI;\n"],"names":["root","length","parse","character","characters","id","detector","loader","plugin","configApi.getConfig","text","version","error","objectProto","hasOwnProperty","nativeKeys","Promise","mapTag","objectTag","setTag","weakMapTag","dataViewTag","DataView","Set","WeakMap","argsTag","freeExports","freeModule","moduleExports","nodeUtil","isArray","isBuffer","isTypedArray","isArguments","getTag","configApi.reset","configApi.addDirective","errorRenderer","DOMPurify","node","configApi.saveConfigFromInitialize","configApi.setSiteConfig","configApi.getSiteConfig","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