mdts 0.16.0 → 0.17.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/dist/frontend/bundle.js +184 -96
- package/dist/frontend/{node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_architecture-U656AL7Q_mjs.bundle.js → node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_architecture-PBZL5I3N_mjs.bundle.js} +4 -4
- package/dist/frontend/{node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_gitGraph-F6HP7TQM_mjs.bundle.js → node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_gitGraph-HDMCJU4V_mjs.bundle.js} +4 -4
- package/dist/frontend/{node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_info-NVLQJR56_mjs.bundle.js → node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_info-3K5VOQVL_mjs.bundle.js} +4 -4
- package/dist/frontend/{node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_packet-BFZMPI3H_mjs.bundle.js → node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_packet-RMMSAZCW_mjs.bundle.js} +4 -4
- package/dist/frontend/{node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_pie-7BOR55EZ_mjs.bundle.js → node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_pie-UPGHQEXC_mjs.bundle.js} +4 -4
- package/dist/frontend/{node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_radar-NHE76QYJ_mjs.bundle.js → node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_radar-KQ55EAFF_mjs.bundle.js} +4 -4
- package/dist/frontend/{node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_treemap-KMMF4GRG_mjs.bundle.js → node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_treemap-KZPCXAKY_mjs.bundle.js} +4 -4
- package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_classDiagram-VBA2DB6C_mjs.bundle.js +22 -0
- package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_classDiagram-v2-RAHNMMFH_mjs.bundle.js +22 -0
- package/dist/frontend/{node_modules_mermaid_dist_chunks_mermaid_core_diagram-S2PKOQOG_mjs.bundle.js → node_modules_mermaid_dist_chunks_mermaid_core_diagram-P4PSJMXO_mjs.bundle.js} +4 -4
- package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_infoDiagram-LFFYTUFH_mjs.bundle.js +22 -0
- package/dist/frontend/{node_modules_mermaid_dist_chunks_mermaid_core_pieDiagram-ADFJNKIX_mjs.bundle.js → node_modules_mermaid_dist_chunks_mermaid_core_pieDiagram-SKSYHLDU_mjs.bundle.js} +4 -4
- package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_stateDiagram-v2-FVOUBMTO_mjs.bundle.js +22 -0
- package/dist/frontend/vendors-node_modules_cytoscape_dist_cytoscape_esm_mjs.bundle.js +1 -1
- package/dist/frontend/vendors-node_modules_dagre-d3-es_src_dagre_index_js.bundle.js +14 -14
- package/dist/frontend/vendors-node_modules_dagre-d3-es_src_graphlib_index_js.bundle.js +1 -1
- package/dist/frontend/vendors-node_modules_mermaid-js_parser_dist_mermaid-parser_core_mjs.bundle.js +476 -76
- package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_architectureDiagram-VXUJARFQ_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_architectureDiagram-2XIMDMQ5_mjs.bundle.js} +4 -4
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_blockDiagram-WCTKOSBZ_mjs.bundle.js +52 -0
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_c4Diagram-IC4MRINW_mjs.bundle.js +32 -0
- package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_chunk-DI55MBZ5_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_chunk-NQ4KR5QH_mjs.bundle.js} +7 -7
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_chunk-WL4C6EOR_mjs.bundle.js +62 -0
- package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_dagre-6UL2VRFP_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_dagre-KLK3FWXG_mjs.bundle.js} +5 -5
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_diagram-E7M64L7V_mjs.bundle.js +42 -0
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_diagram-IFDJBPK2_mjs.bundle.js +32 -0
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_erDiagram-INFDFZHY_mjs.bundle.js +52 -0
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_flowDiagram-PKNHOUZH_mjs.bundle.js +72 -0
- package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_ganttDiagram-JELNMOA3_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_ganttDiagram-A5KZAMGK_mjs.bundle.js} +4 -4
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_gitGraphDiagram-K3NZZRJ6_mjs.bundle.js +42 -0
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_ishikawaDiagram-PHBUUO56_mjs.bundle.js +22 -0
- package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_journeyDiagram-XKPGCS4Q_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_journeyDiagram-4ABVD52K_mjs.bundle.js} +7 -7
- package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_kanban-definition-3W4ZIXB7_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_kanban-definition-K7BYSVSG_mjs.bundle.js} +4 -4
- package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_mindmap-definition-VGOIOE7T_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_mindmap-definition-YRQLILUH_mjs.bundle.js} +7 -7
- package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_quadrantDiagram-AYHSOK5B_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_quadrantDiagram-337W2JSQ_mjs.bundle.js} +4 -4
- package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_requirementDiagram-UZGBJVZJ_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_requirementDiagram-Z7DCOOCP_mjs.bundle.js} +7 -7
- package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_sankeyDiagram-TZEHDZUN_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_sankeyDiagram-WA2Y5GQK_mjs.bundle.js} +4 -4
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_sequenceDiagram-2WXFIKYE_mjs.bundle.js +42 -0
- package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_stateDiagram-FKZM4ZOC_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_stateDiagram-RAJIS63D_mjs.bundle.js} +4 -4
- package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_timeline-definition-IT6M3QCI_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_timeline-definition-YZTLITO2_mjs.bundle.js} +4 -4
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_vennDiagram-LZ73GAT5_mjs.bundle.js +42 -0
- package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_xychartDiagram-PRI3JC2R_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_xychartDiagram-JWTSCODW_mjs.bundle.js} +4 -4
- package/dist/server/routes/diff.js +87 -0
- package/dist/server/routes/filetree.js +1 -1
- package/dist/server/server.js +3 -0
- package/package.json +4 -3
- package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_classDiagram-2ON5EDUG_mjs.bundle.js +0 -22
- package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_classDiagram-v2-WZHVMYZB_mjs.bundle.js +0 -22
- package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_infoDiagram-WHAUD3N6_mjs.bundle.js +0 -22
- package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_stateDiagram-v2-4FDKWEC3_mjs.bundle.js +0 -22
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_blockDiagram-VD42YOAC_mjs.bundle.js +0 -52
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_c4Diagram-YG6GDRKO_mjs.bundle.js +0 -32
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_chunk-B4BG7PRW_mjs.bundle.js +0 -52
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_diagram-PSM6KHXK_mjs.bundle.js +0 -42
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_diagram-QEK2KX5R_mjs.bundle.js +0 -32
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_erDiagram-Q2GNP2WA_mjs.bundle.js +0 -52
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_flowDiagram-NV44I4VS_mjs.bundle.js +0 -62
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_gitGraphDiagram-NY62KEGX_mjs.bundle.js +0 -42
- package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_sequenceDiagram-WL72ISMW_mjs.bundle.js +0 -42
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
4
|
+
* This devtool is neither made for production nor for readable output files.
|
|
5
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
6
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
7
|
+
* or disable the default devtool with "devtool: false".
|
|
8
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
9
|
+
*/
|
|
10
|
+
(self["webpackChunk_mdts_frontend"] = self["webpackChunk_mdts_frontend"] || []).push([["vendors-node_modules_mermaid_dist_chunks_mermaid_core_gitGraphDiagram-K3NZZRJ6_mjs"],{
|
|
11
|
+
|
|
12
|
+
/***/ "./node_modules/mermaid/dist/chunks/mermaid.core/chunk-4BX2VUAB.mjs"
|
|
13
|
+
/*!**************************************************************************!*\
|
|
14
|
+
!*** ./node_modules/mermaid/dist/chunks/mermaid.core/chunk-4BX2VUAB.mjs ***!
|
|
15
|
+
\**************************************************************************/
|
|
16
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
17
|
+
|
|
18
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ populateCommonDb: () => (/* binding */ populateCommonDb)\n/* harmony export */ });\n/* harmony import */ var _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunk-AGHRB4JF.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-AGHRB4JF.mjs\");\n\n\n// src/diagrams/common/populateCommonDb.ts\nfunction populateCommonDb(ast, db) {\n if (ast.accDescr) {\n db.setAccDescription?.(ast.accDescr);\n }\n if (ast.accTitle) {\n db.setAccTitle?.(ast.accTitle);\n }\n if (ast.title) {\n db.setDiagramTitle?.(ast.title);\n }\n}\n(0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_0__.__name)(populateCommonDb, \"populateCommonDb\");\n\n\n\n\n//# sourceURL=webpack://@mdts/frontend/./node_modules/mermaid/dist/chunks/mermaid.core/chunk-4BX2VUAB.mjs?\n}");
|
|
19
|
+
|
|
20
|
+
/***/ },
|
|
21
|
+
|
|
22
|
+
/***/ "./node_modules/mermaid/dist/chunks/mermaid.core/chunk-QZHKN3VN.mjs"
|
|
23
|
+
/*!**************************************************************************!*\
|
|
24
|
+
!*** ./node_modules/mermaid/dist/chunks/mermaid.core/chunk-QZHKN3VN.mjs ***!
|
|
25
|
+
\**************************************************************************/
|
|
26
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
27
|
+
|
|
28
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ImperativeState: () => (/* binding */ ImperativeState)\n/* harmony export */ });\n/* harmony import */ var _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunk-AGHRB4JF.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-AGHRB4JF.mjs\");\n\n\n// src/utils/imperativeState.ts\nvar ImperativeState = class {\n /**\n * @param init - Function that creates the default state.\n */\n constructor(init) {\n this.init = init;\n this.records = this.init();\n }\n static {\n (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_0__.__name)(this, \"ImperativeState\");\n }\n reset() {\n this.records = this.init();\n }\n};\n\n\n\n\n//# sourceURL=webpack://@mdts/frontend/./node_modules/mermaid/dist/chunks/mermaid.core/chunk-QZHKN3VN.mjs?\n}");
|
|
29
|
+
|
|
30
|
+
/***/ },
|
|
31
|
+
|
|
32
|
+
/***/ "./node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-K3NZZRJ6.mjs"
|
|
33
|
+
/*!************************************************************************************!*\
|
|
34
|
+
!*** ./node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-K3NZZRJ6.mjs ***!
|
|
35
|
+
\************************************************************************************/
|
|
36
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
37
|
+
|
|
38
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ diagram: () => (/* binding */ diagram)\n/* harmony export */ });\n/* harmony import */ var _chunk_4BX2VUAB_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunk-4BX2VUAB.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-4BX2VUAB.mjs\");\n/* harmony import */ var _chunk_QZHKN3VN_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./chunk-QZHKN3VN.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-QZHKN3VN.mjs\");\n/* harmony import */ var _chunk_GEFDOKGD_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./chunk-GEFDOKGD.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-GEFDOKGD.mjs\");\n/* harmony import */ var _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./chunk-7R4GIKGN.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-7R4GIKGN.mjs\");\n/* harmony import */ var _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./chunk-AGHRB4JF.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-AGHRB4JF.mjs\");\n/* harmony import */ var _mermaid_js_parser__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @mermaid-js/parser */ \"./node_modules/@mermaid-js/parser/dist/mermaid-parser.core.mjs\");\n/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! d3 */ \"./node_modules/d3/src/index.js\");\n\n\n\n\n\n\n// src/diagrams/git/gitGraphParser.ts\n\n\n// src/diagrams/git/gitGraphTypes.ts\nvar commitType = {\n NORMAL: 0,\n REVERSE: 1,\n HIGHLIGHT: 2,\n MERGE: 3,\n CHERRY_PICK: 4\n};\n\n// src/diagrams/git/gitGraphAst.ts\nvar DEFAULT_GITGRAPH_CONFIG = _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.defaultConfig_default.gitGraph;\nvar getConfig2 = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(() => {\n const config = (0,_chunk_GEFDOKGD_mjs__WEBPACK_IMPORTED_MODULE_2__.cleanAndMerge)({\n ...DEFAULT_GITGRAPH_CONFIG,\n ...(0,_chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.getConfig)().gitGraph\n });\n return config;\n}, \"getConfig\");\nvar state = new _chunk_QZHKN3VN_mjs__WEBPACK_IMPORTED_MODULE_1__.ImperativeState(() => {\n const config = getConfig2();\n const mainBranchName = config.mainBranchName;\n const mainBranchOrder = config.mainBranchOrder;\n return {\n mainBranchName,\n commits: /* @__PURE__ */ new Map(),\n head: null,\n branchConfig: /* @__PURE__ */ new Map([[mainBranchName, { name: mainBranchName, order: mainBranchOrder }]]),\n branches: /* @__PURE__ */ new Map([[mainBranchName, null]]),\n currBranch: mainBranchName,\n direction: \"LR\",\n seq: 0,\n options: {}\n };\n});\nfunction getID() {\n return (0,_chunk_GEFDOKGD_mjs__WEBPACK_IMPORTED_MODULE_2__.random)({ length: 7 });\n}\n(0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(getID, \"getID\");\nfunction uniqBy(list, fn) {\n const recordMap = /* @__PURE__ */ Object.create(null);\n return list.reduce((out, item) => {\n const key = fn(item);\n if (!recordMap[key]) {\n recordMap[key] = true;\n out.push(item);\n }\n return out;\n }, []);\n}\n(0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(uniqBy, \"uniqBy\");\nvar setDirection = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function(dir2) {\n state.records.direction = dir2;\n}, \"setDirection\");\nvar setOptions = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function(rawOptString) {\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(\"options str\", rawOptString);\n rawOptString = rawOptString?.trim();\n rawOptString = rawOptString || \"{}\";\n try {\n state.records.options = JSON.parse(rawOptString);\n } catch (e) {\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.error(\"error while parsing gitGraph options\", e.message);\n }\n}, \"setOptions\");\nvar getOptions = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function() {\n return state.records.options;\n}, \"getOptions\");\nvar commit = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function(commitDB) {\n let msg = commitDB.msg;\n let id = commitDB.id;\n const type = commitDB.type;\n let tags = commitDB.tags;\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.info(\"commit\", msg, id, type, tags);\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(\"Entering commit:\", msg, id, type, tags);\n const config = getConfig2();\n id = _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(id, config);\n msg = _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(msg, config);\n tags = tags?.map((tag) => _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(tag, config));\n const newCommit = {\n id: id ? id : state.records.seq + \"-\" + getID(),\n message: msg,\n seq: state.records.seq++,\n type: type ?? commitType.NORMAL,\n tags: tags ?? [],\n parents: state.records.head == null ? [] : [state.records.head.id],\n branch: state.records.currBranch\n };\n state.records.head = newCommit;\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.info(\"main branch\", config.mainBranchName);\n if (state.records.commits.has(newCommit.id)) {\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.warn(`Commit ID ${newCommit.id} already exists`);\n }\n state.records.commits.set(newCommit.id, newCommit);\n state.records.branches.set(state.records.currBranch, newCommit.id);\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(\"in pushCommit \" + newCommit.id);\n}, \"commit\");\nvar branch = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function(branchDB) {\n let name = branchDB.name;\n const order = branchDB.order;\n name = _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(name, getConfig2());\n if (state.records.branches.has(name)) {\n throw new Error(\n `Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using \"checkout ${name}\")`\n );\n }\n state.records.branches.set(name, state.records.head != null ? state.records.head.id : null);\n state.records.branchConfig.set(name, { name, order });\n checkout(name);\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(\"in createBranch\");\n}, \"branch\");\nvar merge = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((mergeDB) => {\n let otherBranch = mergeDB.branch;\n let customId = mergeDB.id;\n const overrideType = mergeDB.type;\n const customTags = mergeDB.tags;\n const config = getConfig2();\n otherBranch = _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(otherBranch, config);\n if (customId) {\n customId = _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(customId, config);\n }\n const currentBranchCheck = state.records.branches.get(state.records.currBranch);\n const otherBranchCheck = state.records.branches.get(otherBranch);\n const currentCommit = currentBranchCheck ? state.records.commits.get(currentBranchCheck) : void 0;\n const otherCommit = otherBranchCheck ? state.records.commits.get(otherBranchCheck) : void 0;\n if (currentCommit && otherCommit && currentCommit.branch === otherBranch) {\n throw new Error(`Cannot merge branch '${otherBranch}' into itself.`);\n }\n if (state.records.currBranch === otherBranch) {\n const error = new Error('Incorrect usage of \"merge\". Cannot merge a branch to itself');\n error.hash = {\n text: `merge ${otherBranch}`,\n token: `merge ${otherBranch}`,\n expected: [\"branch abc\"]\n };\n throw error;\n }\n if (currentCommit === void 0 || !currentCommit) {\n const error = new Error(\n `Incorrect usage of \"merge\". Current branch (${state.records.currBranch})has no commits`\n );\n error.hash = {\n text: `merge ${otherBranch}`,\n token: `merge ${otherBranch}`,\n expected: [\"commit\"]\n };\n throw error;\n }\n if (!state.records.branches.has(otherBranch)) {\n const error = new Error(\n 'Incorrect usage of \"merge\". Branch to be merged (' + otherBranch + \") does not exist\"\n );\n error.hash = {\n text: `merge ${otherBranch}`,\n token: `merge ${otherBranch}`,\n expected: [`branch ${otherBranch}`]\n };\n throw error;\n }\n if (otherCommit === void 0 || !otherCommit) {\n const error = new Error(\n 'Incorrect usage of \"merge\". Branch to be merged (' + otherBranch + \") has no commits\"\n );\n error.hash = {\n text: `merge ${otherBranch}`,\n token: `merge ${otherBranch}`,\n expected: ['\"commit\"']\n };\n throw error;\n }\n if (currentCommit === otherCommit) {\n const error = new Error('Incorrect usage of \"merge\". Both branches have same head');\n error.hash = {\n text: `merge ${otherBranch}`,\n token: `merge ${otherBranch}`,\n expected: [\"branch abc\"]\n };\n throw error;\n }\n if (customId && state.records.commits.has(customId)) {\n const error = new Error(\n 'Incorrect usage of \"merge\". Commit with id:' + customId + \" already exists, use different custom id\"\n );\n error.hash = {\n text: `merge ${otherBranch} ${customId} ${overrideType} ${customTags?.join(\" \")}`,\n token: `merge ${otherBranch} ${customId} ${overrideType} ${customTags?.join(\" \")}`,\n expected: [\n `merge ${otherBranch} ${customId}_UNIQUE ${overrideType} ${customTags?.join(\" \")}`\n ]\n };\n throw error;\n }\n const verifiedBranch = otherBranchCheck ? otherBranchCheck : \"\";\n const commit2 = {\n id: customId || `${state.records.seq}-${getID()}`,\n message: `merged branch ${otherBranch} into ${state.records.currBranch}`,\n seq: state.records.seq++,\n parents: state.records.head == null ? [] : [state.records.head.id, verifiedBranch],\n branch: state.records.currBranch,\n type: commitType.MERGE,\n customType: overrideType,\n customId: customId ? true : false,\n tags: customTags ?? []\n };\n state.records.head = commit2;\n state.records.commits.set(commit2.id, commit2);\n state.records.branches.set(state.records.currBranch, commit2.id);\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(state.records.branches);\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(\"in mergeBranch\");\n}, \"merge\");\nvar cherryPick = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function(cherryPickDB) {\n let sourceId = cherryPickDB.id;\n let targetId = cherryPickDB.targetId;\n let tags = cherryPickDB.tags;\n let parentCommitId = cherryPickDB.parent;\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(\"Entering cherryPick:\", sourceId, targetId, tags);\n const config = getConfig2();\n sourceId = _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(sourceId, config);\n targetId = _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(targetId, config);\n tags = tags?.map((tag) => _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(tag, config));\n parentCommitId = _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(parentCommitId, config);\n if (!sourceId || !state.records.commits.has(sourceId)) {\n const error = new Error(\n 'Incorrect usage of \"cherryPick\". Source commit id should exist and provided'\n );\n error.hash = {\n text: `cherryPick ${sourceId} ${targetId}`,\n token: `cherryPick ${sourceId} ${targetId}`,\n expected: [\"cherry-pick abc\"]\n };\n throw error;\n }\n const sourceCommit = state.records.commits.get(sourceId);\n if (sourceCommit === void 0 || !sourceCommit) {\n throw new Error('Incorrect usage of \"cherryPick\". Source commit id should exist and provided');\n }\n if (parentCommitId && !(Array.isArray(sourceCommit.parents) && sourceCommit.parents.includes(parentCommitId))) {\n const error = new Error(\n \"Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.\"\n );\n throw error;\n }\n const sourceCommitBranch = sourceCommit.branch;\n if (sourceCommit.type === commitType.MERGE && !parentCommitId) {\n const error = new Error(\n \"Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.\"\n );\n throw error;\n }\n if (!targetId || !state.records.commits.has(targetId)) {\n if (sourceCommitBranch === state.records.currBranch) {\n const error = new Error(\n 'Incorrect usage of \"cherryPick\". Source commit is already on current branch'\n );\n error.hash = {\n text: `cherryPick ${sourceId} ${targetId}`,\n token: `cherryPick ${sourceId} ${targetId}`,\n expected: [\"cherry-pick abc\"]\n };\n throw error;\n }\n const currentCommitId = state.records.branches.get(state.records.currBranch);\n if (currentCommitId === void 0 || !currentCommitId) {\n const error = new Error(\n `Incorrect usage of \"cherry-pick\". Current branch (${state.records.currBranch})has no commits`\n );\n error.hash = {\n text: `cherryPick ${sourceId} ${targetId}`,\n token: `cherryPick ${sourceId} ${targetId}`,\n expected: [\"cherry-pick abc\"]\n };\n throw error;\n }\n const currentCommit = state.records.commits.get(currentCommitId);\n if (currentCommit === void 0 || !currentCommit) {\n const error = new Error(\n `Incorrect usage of \"cherry-pick\". Current branch (${state.records.currBranch})has no commits`\n );\n error.hash = {\n text: `cherryPick ${sourceId} ${targetId}`,\n token: `cherryPick ${sourceId} ${targetId}`,\n expected: [\"cherry-pick abc\"]\n };\n throw error;\n }\n const commit2 = {\n id: state.records.seq + \"-\" + getID(),\n message: `cherry-picked ${sourceCommit?.message} into ${state.records.currBranch}`,\n seq: state.records.seq++,\n parents: state.records.head == null ? [] : [state.records.head.id, sourceCommit.id],\n branch: state.records.currBranch,\n type: commitType.CHERRY_PICK,\n tags: tags ? tags.filter(Boolean) : [\n `cherry-pick:${sourceCommit.id}${sourceCommit.type === commitType.MERGE ? `|parent:${parentCommitId}` : \"\"}`\n ]\n };\n state.records.head = commit2;\n state.records.commits.set(commit2.id, commit2);\n state.records.branches.set(state.records.currBranch, commit2.id);\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(state.records.branches);\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(\"in cherryPick\");\n }\n}, \"cherryPick\");\nvar checkout = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function(branch2) {\n branch2 = _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(branch2, getConfig2());\n if (!state.records.branches.has(branch2)) {\n const error = new Error(\n `Trying to checkout branch which is not yet created. (Help try using \"branch ${branch2}\")`\n );\n error.hash = {\n text: `checkout ${branch2}`,\n token: `checkout ${branch2}`,\n expected: [`branch ${branch2}`]\n };\n throw error;\n } else {\n state.records.currBranch = branch2;\n const id = state.records.branches.get(state.records.currBranch);\n if (id === void 0 || !id) {\n state.records.head = null;\n } else {\n state.records.head = state.records.commits.get(id) ?? null;\n }\n }\n}, \"checkout\");\nfunction upsert(arr, key, newVal) {\n const index = arr.indexOf(key);\n if (index === -1) {\n arr.push(newVal);\n } else {\n arr.splice(index, 1, newVal);\n }\n}\n(0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(upsert, \"upsert\");\nfunction prettyPrintCommitHistory(commitArr) {\n const commit2 = commitArr.reduce((out, commit3) => {\n if (out.seq > commit3.seq) {\n return out;\n }\n return commit3;\n }, commitArr[0]);\n let line = \"\";\n commitArr.forEach(function(c) {\n if (c === commit2) {\n line += \"\t*\";\n } else {\n line += \"\t|\";\n }\n });\n const label = [line, commit2.id, commit2.seq];\n for (const branch2 in state.records.branches) {\n if (state.records.branches.get(branch2) === commit2.id) {\n label.push(branch2);\n }\n }\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(label.join(\" \"));\n if (commit2.parents && commit2.parents.length == 2 && commit2.parents[0] && commit2.parents[1]) {\n const newCommit = state.records.commits.get(commit2.parents[0]);\n upsert(commitArr, commit2, newCommit);\n if (commit2.parents[1]) {\n commitArr.push(state.records.commits.get(commit2.parents[1]));\n }\n } else if (commit2.parents.length == 0) {\n return;\n } else {\n if (commit2.parents[0]) {\n const newCommit = state.records.commits.get(commit2.parents[0]);\n upsert(commitArr, commit2, newCommit);\n }\n }\n commitArr = uniqBy(commitArr, (c) => c.id);\n prettyPrintCommitHistory(commitArr);\n}\n(0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(prettyPrintCommitHistory, \"prettyPrintCommitHistory\");\nvar prettyPrint = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function() {\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(state.records.commits);\n const node = getCommitsArray()[0];\n prettyPrintCommitHistory([node]);\n}, \"prettyPrint\");\nvar clear2 = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function() {\n state.reset();\n (0,_chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.clear)();\n}, \"clear\");\nvar getBranchesAsObjArray = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function() {\n const branchesArray = [...state.records.branchConfig.values()].map((branchConfig, i) => {\n if (branchConfig.order !== null && branchConfig.order !== void 0) {\n return branchConfig;\n }\n return {\n ...branchConfig,\n order: parseFloat(`0.${i}`)\n };\n }).sort((a, b) => (a.order ?? 0) - (b.order ?? 0)).map(({ name }) => ({ name }));\n return branchesArray;\n}, \"getBranchesAsObjArray\");\nvar getBranches = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function() {\n return state.records.branches;\n}, \"getBranches\");\nvar getCommits = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function() {\n return state.records.commits;\n}, \"getCommits\");\nvar getCommitsArray = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function() {\n const commitArr = [...state.records.commits.values()];\n commitArr.forEach(function(o) {\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(o.id);\n });\n commitArr.sort((a, b) => a.seq - b.seq);\n return commitArr;\n}, \"getCommitsArray\");\nvar getCurrentBranch = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function() {\n return state.records.currBranch;\n}, \"getCurrentBranch\");\nvar getDirection = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function() {\n return state.records.direction;\n}, \"getDirection\");\nvar getHead = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function() {\n return state.records.head;\n}, \"getHead\");\nvar db = {\n commitType,\n getConfig: getConfig2,\n setDirection,\n setOptions,\n getOptions,\n commit,\n branch,\n merge,\n cherryPick,\n checkout,\n //reset,\n prettyPrint,\n clear: clear2,\n getBranchesAsObjArray,\n getBranches,\n getCommits,\n getCommitsArray,\n getCurrentBranch,\n getDirection,\n getHead,\n setAccTitle: _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.setAccTitle,\n getAccTitle: _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.getAccTitle,\n getAccDescription: _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.getAccDescription,\n setAccDescription: _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.setAccDescription,\n setDiagramTitle: _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.setDiagramTitle,\n getDiagramTitle: _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.getDiagramTitle\n};\n\n// src/diagrams/git/gitGraphParser.ts\nvar populate = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((ast, db2) => {\n (0,_chunk_4BX2VUAB_mjs__WEBPACK_IMPORTED_MODULE_0__.populateCommonDb)(ast, db2);\n if (ast.dir) {\n db2.setDirection(ast.dir);\n }\n for (const statement of ast.statements) {\n parseStatement(statement, db2);\n }\n}, \"populate\");\nvar parseStatement = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((statement, db2) => {\n const parsers = {\n Commit: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((stmt) => db2.commit(parseCommit(stmt)), \"Commit\"),\n Branch: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((stmt) => db2.branch(parseBranch(stmt)), \"Branch\"),\n Merge: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((stmt) => db2.merge(parseMerge(stmt)), \"Merge\"),\n Checkout: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((stmt) => db2.checkout(parseCheckout(stmt)), \"Checkout\"),\n CherryPicking: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((stmt) => db2.cherryPick(parseCherryPicking(stmt)), \"CherryPicking\")\n };\n const parser2 = parsers[statement.$type];\n if (parser2) {\n parser2(statement);\n } else {\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.error(`Unknown statement type: ${statement.$type}`);\n }\n}, \"parseStatement\");\nvar parseCommit = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((commit2) => {\n const commitDB = {\n id: commit2.id,\n msg: commit2.message ?? \"\",\n type: commit2.type !== void 0 ? commitType[commit2.type] : commitType.NORMAL,\n tags: commit2.tags ?? void 0\n };\n return commitDB;\n}, \"parseCommit\");\nvar parseBranch = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((branch2) => {\n const branchDB = {\n name: branch2.name,\n order: branch2.order ?? 0\n };\n return branchDB;\n}, \"parseBranch\");\nvar parseMerge = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((merge2) => {\n const mergeDB = {\n branch: merge2.branch,\n id: merge2.id ?? \"\",\n type: merge2.type !== void 0 ? commitType[merge2.type] : void 0,\n tags: merge2.tags ?? void 0\n };\n return mergeDB;\n}, \"parseMerge\");\nvar parseCheckout = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((checkout2) => {\n const branch2 = checkout2.branch;\n return branch2;\n}, \"parseCheckout\");\nvar parseCherryPicking = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((cherryPicking) => {\n const cherryPickDB = {\n id: cherryPicking.id,\n targetId: \"\",\n tags: cherryPicking.tags?.length === 0 ? void 0 : cherryPicking.tags,\n parent: cherryPicking.parent\n };\n return cherryPickDB;\n}, \"parseCherryPicking\");\nvar parser = {\n parse: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(async (input) => {\n const ast = await (0,_mermaid_js_parser__WEBPACK_IMPORTED_MODULE_5__.parse)(\"gitGraph\", input);\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(ast);\n populate(ast, db);\n }, \"parse\")\n};\nif (void 0) {\n const { it, expect, describe } = void 0;\n const mockDB = {\n commitType,\n setDirection: vi.fn(),\n commit: vi.fn(),\n branch: vi.fn(),\n merge: vi.fn(),\n cherryPick: vi.fn(),\n checkout: vi.fn()\n };\n describe(\"GitGraph Parser\", () => {\n it(\"should parse a commit statement\", () => {\n const commit2 = {\n $type: \"Commit\",\n id: \"1\",\n message: \"test\",\n tags: [\"tag1\", \"tag2\"],\n type: \"NORMAL\"\n };\n parseStatement(commit2, mockDB);\n expect(mockDB.commit).toHaveBeenCalledWith({\n id: \"1\",\n msg: \"test\",\n tags: [\"tag1\", \"tag2\"],\n type: 0\n });\n });\n it(\"should parse a branch statement\", () => {\n const branch2 = {\n $type: \"Branch\",\n name: \"newBranch\",\n order: 1\n };\n parseStatement(branch2, mockDB);\n expect(mockDB.branch).toHaveBeenCalledWith({ name: \"newBranch\", order: 1 });\n });\n it(\"should parse a checkout statement\", () => {\n const checkout2 = {\n $type: \"Checkout\",\n branch: \"newBranch\"\n };\n parseStatement(checkout2, mockDB);\n expect(mockDB.checkout).toHaveBeenCalledWith(\"newBranch\");\n });\n it(\"should parse a merge statement\", () => {\n const merge2 = {\n $type: \"Merge\",\n branch: \"newBranch\",\n id: \"1\",\n tags: [\"tag1\", \"tag2\"],\n type: \"NORMAL\"\n };\n parseStatement(merge2, mockDB);\n expect(mockDB.merge).toHaveBeenCalledWith({\n branch: \"newBranch\",\n id: \"1\",\n tags: [\"tag1\", \"tag2\"],\n type: 0\n });\n });\n it(\"should parse a cherry picking statement\", () => {\n const cherryPick2 = {\n $type: \"CherryPicking\",\n id: \"1\",\n tags: [\"tag1\", \"tag2\"],\n parent: \"2\"\n };\n parseStatement(cherryPick2, mockDB);\n expect(mockDB.cherryPick).toHaveBeenCalledWith({\n id: \"1\",\n targetId: \"\",\n parent: \"2\",\n tags: [\"tag1\", \"tag2\"]\n });\n });\n it(\"should parse a langium generated gitGraph ast\", () => {\n const dummy = {\n $type: \"GitGraph\",\n statements: [],\n accDescr: \"\",\n accTitle: \"\",\n title: \"\"\n };\n const gitGraphAst = {\n $type: \"GitGraph\",\n statements: [\n {\n $container: dummy,\n $type: \"Commit\",\n id: \"1\",\n message: \"test\",\n tags: [\"tag1\", \"tag2\"],\n type: \"NORMAL\"\n },\n {\n $container: dummy,\n $type: \"Branch\",\n name: \"newBranch\",\n order: 1\n },\n {\n $container: dummy,\n $type: \"Merge\",\n branch: \"newBranch\",\n id: \"1\",\n tags: [\"tag1\", \"tag2\"],\n type: \"NORMAL\"\n },\n {\n $container: dummy,\n $type: \"Checkout\",\n branch: \"newBranch\"\n },\n {\n $container: dummy,\n $type: \"CherryPicking\",\n id: \"1\",\n tags: [\"tag1\", \"tag2\"],\n parent: \"2\"\n }\n ],\n accDescr: \"\",\n accTitle: \"\",\n title: \"\"\n };\n populate(gitGraphAst, mockDB);\n expect(mockDB.commit).toHaveBeenCalledWith({\n id: \"1\",\n msg: \"test\",\n tags: [\"tag1\", \"tag2\"],\n type: 0\n });\n expect(mockDB.branch).toHaveBeenCalledWith({ name: \"newBranch\", order: 1 });\n expect(mockDB.merge).toHaveBeenCalledWith({\n branch: \"newBranch\",\n id: \"1\",\n tags: [\"tag1\", \"tag2\"],\n type: 0\n });\n expect(mockDB.checkout).toHaveBeenCalledWith(\"newBranch\");\n });\n });\n}\n\n// src/diagrams/git/gitGraphRenderer.ts\n\nvar LAYOUT_OFFSET = 10;\nvar COMMIT_STEP = 40;\nvar PX = 4;\nvar PY = 2;\nvar THEME_COLOR_LIMIT = 8;\nvar branchPos = /* @__PURE__ */ new Map();\nvar commitPos = /* @__PURE__ */ new Map();\nvar defaultPos = 30;\nvar allCommitsDict = /* @__PURE__ */ new Map();\nvar lanes = [];\nvar maxPos = 0;\nvar dir = \"LR\";\nvar clear3 = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(() => {\n branchPos.clear();\n commitPos.clear();\n allCommitsDict.clear();\n maxPos = 0;\n lanes = [];\n dir = \"LR\";\n}, \"clear\");\nvar drawText = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((txt) => {\n const svgLabel = document.createElementNS(\"http://www.w3.org/2000/svg\", \"text\");\n const rows = typeof txt === \"string\" ? txt.split(/\\\\n|\\n|<br\\s*\\/?>/gi) : txt;\n rows.forEach((row) => {\n const tspan = document.createElementNS(\"http://www.w3.org/2000/svg\", \"tspan\");\n tspan.setAttributeNS(\"http://www.w3.org/XML/1998/namespace\", \"xml:space\", \"preserve\");\n tspan.setAttribute(\"dy\", \"1em\");\n tspan.setAttribute(\"x\", \"0\");\n tspan.setAttribute(\"class\", \"row\");\n tspan.textContent = row.trim();\n svgLabel.appendChild(tspan);\n });\n return svgLabel;\n}, \"drawText\");\nvar findClosestParent = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((parents) => {\n let closestParent;\n let comparisonFunc;\n let targetPosition;\n if (dir === \"BT\") {\n comparisonFunc = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((a, b) => a <= b, \"comparisonFunc\");\n targetPosition = Infinity;\n } else {\n comparisonFunc = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((a, b) => a >= b, \"comparisonFunc\");\n targetPosition = 0;\n }\n parents.forEach((parent) => {\n const parentPosition = dir === \"TB\" || dir == \"BT\" ? commitPos.get(parent)?.y : commitPos.get(parent)?.x;\n if (parentPosition !== void 0 && comparisonFunc(parentPosition, targetPosition)) {\n closestParent = parent;\n targetPosition = parentPosition;\n }\n });\n return closestParent;\n}, \"findClosestParent\");\nvar findClosestParentBT = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((parents) => {\n let closestParent = \"\";\n let maxPosition = Infinity;\n parents.forEach((parent) => {\n const parentPosition = commitPos.get(parent).y;\n if (parentPosition <= maxPosition) {\n closestParent = parent;\n maxPosition = parentPosition;\n }\n });\n return closestParent || void 0;\n}, \"findClosestParentBT\");\nvar setParallelBTPos = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((sortedKeys, commits, defaultPos2) => {\n let curPos = defaultPos2;\n let maxPosition = defaultPos2;\n const roots = [];\n sortedKeys.forEach((key) => {\n const commit2 = commits.get(key);\n if (!commit2) {\n throw new Error(`Commit not found for key ${key}`);\n }\n if (commit2.parents.length) {\n curPos = calculateCommitPosition(commit2);\n maxPosition = Math.max(curPos, maxPosition);\n } else {\n roots.push(commit2);\n }\n setCommitPosition(commit2, curPos);\n });\n curPos = maxPosition;\n roots.forEach((commit2) => {\n setRootPosition(commit2, curPos, defaultPos2);\n });\n sortedKeys.forEach((key) => {\n const commit2 = commits.get(key);\n if (commit2?.parents.length) {\n const closestParent = findClosestParentBT(commit2.parents);\n curPos = commitPos.get(closestParent).y - COMMIT_STEP;\n if (curPos <= maxPosition) {\n maxPosition = curPos;\n }\n const x = branchPos.get(commit2.branch).pos;\n const y = curPos - LAYOUT_OFFSET;\n commitPos.set(commit2.id, { x, y });\n }\n });\n}, \"setParallelBTPos\");\nvar findClosestParentPos = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((commit2) => {\n const closestParent = findClosestParent(commit2.parents.filter((p) => p !== null));\n if (!closestParent) {\n throw new Error(`Closest parent not found for commit ${commit2.id}`);\n }\n const closestParentPos = commitPos.get(closestParent)?.y;\n if (closestParentPos === void 0) {\n throw new Error(`Closest parent position not found for commit ${commit2.id}`);\n }\n return closestParentPos;\n}, \"findClosestParentPos\");\nvar calculateCommitPosition = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((commit2) => {\n const closestParentPos = findClosestParentPos(commit2);\n return closestParentPos + COMMIT_STEP;\n}, \"calculateCommitPosition\");\nvar setCommitPosition = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((commit2, curPos) => {\n const branch2 = branchPos.get(commit2.branch);\n if (!branch2) {\n throw new Error(`Branch not found for commit ${commit2.id}`);\n }\n const x = branch2.pos;\n const y = curPos + LAYOUT_OFFSET;\n commitPos.set(commit2.id, { x, y });\n return { x, y };\n}, \"setCommitPosition\");\nvar setRootPosition = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((commit2, curPos, defaultPos2) => {\n const branch2 = branchPos.get(commit2.branch);\n if (!branch2) {\n throw new Error(`Branch not found for commit ${commit2.id}`);\n }\n const y = curPos + defaultPos2;\n const x = branch2.pos;\n commitPos.set(commit2.id, { x, y });\n}, \"setRootPosition\");\nvar drawCommitBullet = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType) => {\n if (commitSymbolType === commitType.HIGHLIGHT) {\n gBullets.append(\"rect\").attr(\"x\", commitPosition.x - 10).attr(\"y\", commitPosition.y - 10).attr(\"width\", 20).attr(\"height\", 20).attr(\n \"class\",\n `commit ${commit2.id} commit-highlight${branchIndex % THEME_COLOR_LIMIT} ${typeClass}-outer`\n );\n gBullets.append(\"rect\").attr(\"x\", commitPosition.x - 6).attr(\"y\", commitPosition.y - 6).attr(\"width\", 12).attr(\"height\", 12).attr(\n \"class\",\n `commit ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT} ${typeClass}-inner`\n );\n } else if (commitSymbolType === commitType.CHERRY_PICK) {\n gBullets.append(\"circle\").attr(\"cx\", commitPosition.x).attr(\"cy\", commitPosition.y).attr(\"r\", 10).attr(\"class\", `commit ${commit2.id} ${typeClass}`);\n gBullets.append(\"circle\").attr(\"cx\", commitPosition.x - 3).attr(\"cy\", commitPosition.y + 2).attr(\"r\", 2.75).attr(\"fill\", \"#fff\").attr(\"class\", `commit ${commit2.id} ${typeClass}`);\n gBullets.append(\"circle\").attr(\"cx\", commitPosition.x + 3).attr(\"cy\", commitPosition.y + 2).attr(\"r\", 2.75).attr(\"fill\", \"#fff\").attr(\"class\", `commit ${commit2.id} ${typeClass}`);\n gBullets.append(\"line\").attr(\"x1\", commitPosition.x + 3).attr(\"y1\", commitPosition.y + 1).attr(\"x2\", commitPosition.x).attr(\"y2\", commitPosition.y - 5).attr(\"stroke\", \"#fff\").attr(\"class\", `commit ${commit2.id} ${typeClass}`);\n gBullets.append(\"line\").attr(\"x1\", commitPosition.x - 3).attr(\"y1\", commitPosition.y + 1).attr(\"x2\", commitPosition.x).attr(\"y2\", commitPosition.y - 5).attr(\"stroke\", \"#fff\").attr(\"class\", `commit ${commit2.id} ${typeClass}`);\n } else {\n const circle = gBullets.append(\"circle\");\n circle.attr(\"cx\", commitPosition.x);\n circle.attr(\"cy\", commitPosition.y);\n circle.attr(\"r\", commit2.type === commitType.MERGE ? 9 : 10);\n circle.attr(\"class\", `commit ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT}`);\n if (commitSymbolType === commitType.MERGE) {\n const circle2 = gBullets.append(\"circle\");\n circle2.attr(\"cx\", commitPosition.x);\n circle2.attr(\"cy\", commitPosition.y);\n circle2.attr(\"r\", 6);\n circle2.attr(\n \"class\",\n `commit ${typeClass} ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT}`\n );\n }\n if (commitSymbolType === commitType.REVERSE) {\n const cross = gBullets.append(\"path\");\n cross.attr(\n \"d\",\n `M ${commitPosition.x - 5},${commitPosition.y - 5}L${commitPosition.x + 5},${commitPosition.y + 5}M${commitPosition.x - 5},${commitPosition.y + 5}L${commitPosition.x + 5},${commitPosition.y - 5}`\n ).attr(\"class\", `commit ${typeClass} ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT}`);\n }\n }\n}, \"drawCommitBullet\");\nvar drawCommitLabel = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((gLabels, commit2, commitPosition, pos, gitGraphConfig) => {\n if (commit2.type !== commitType.CHERRY_PICK && (commit2.customId && commit2.type === commitType.MERGE || commit2.type !== commitType.MERGE) && gitGraphConfig.showCommitLabel) {\n const wrapper = gLabels.append(\"g\");\n const labelBkg = wrapper.insert(\"rect\").attr(\"class\", \"commit-label-bkg\");\n const text = wrapper.append(\"text\").attr(\"x\", pos).attr(\"y\", commitPosition.y + 25).attr(\"class\", \"commit-label\").text(commit2.id);\n const bbox = text.node()?.getBBox();\n if (bbox) {\n labelBkg.attr(\"x\", commitPosition.posWithOffset - bbox.width / 2 - PY).attr(\"y\", commitPosition.y + 13.5).attr(\"width\", bbox.width + 2 * PY).attr(\"height\", bbox.height + 2 * PY);\n if (dir === \"TB\" || dir === \"BT\") {\n labelBkg.attr(\"x\", commitPosition.x - (bbox.width + 4 * PX + 5)).attr(\"y\", commitPosition.y - 12);\n text.attr(\"x\", commitPosition.x - (bbox.width + 4 * PX)).attr(\"y\", commitPosition.y + bbox.height - 12);\n } else {\n text.attr(\"x\", commitPosition.posWithOffset - bbox.width / 2);\n }\n if (gitGraphConfig.rotateCommitLabel) {\n if (dir === \"TB\" || dir === \"BT\") {\n text.attr(\n \"transform\",\n \"rotate(-45, \" + commitPosition.x + \", \" + commitPosition.y + \")\"\n );\n labelBkg.attr(\n \"transform\",\n \"rotate(-45, \" + commitPosition.x + \", \" + commitPosition.y + \")\"\n );\n } else {\n const r_x = -7.5 - (bbox.width + 10) / 25 * 9.5;\n const r_y = 10 + bbox.width / 25 * 8.5;\n wrapper.attr(\n \"transform\",\n \"translate(\" + r_x + \", \" + r_y + \") rotate(-45, \" + pos + \", \" + commitPosition.y + \")\"\n );\n }\n }\n }\n }\n}, \"drawCommitLabel\");\nvar drawCommitTags = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((gLabels, commit2, commitPosition, pos) => {\n if (commit2.tags.length > 0) {\n let yOffset = 0;\n let maxTagBboxWidth = 0;\n let maxTagBboxHeight = 0;\n const tagElements = [];\n for (const tagValue of commit2.tags.reverse()) {\n const rect = gLabels.insert(\"polygon\");\n const hole = gLabels.append(\"circle\");\n const tag = gLabels.append(\"text\").attr(\"y\", commitPosition.y - 16 - yOffset).attr(\"class\", \"tag-label\").text(tagValue);\n const tagBbox = tag.node()?.getBBox();\n if (!tagBbox) {\n throw new Error(\"Tag bbox not found\");\n }\n maxTagBboxWidth = Math.max(maxTagBboxWidth, tagBbox.width);\n maxTagBboxHeight = Math.max(maxTagBboxHeight, tagBbox.height);\n tag.attr(\"x\", commitPosition.posWithOffset - tagBbox.width / 2);\n tagElements.push({\n tag,\n hole,\n rect,\n yOffset\n });\n yOffset += 20;\n }\n for (const { tag, hole, rect, yOffset: yOffset2 } of tagElements) {\n const h2 = maxTagBboxHeight / 2;\n const ly = commitPosition.y - 19.2 - yOffset2;\n rect.attr(\"class\", \"tag-label-bkg\").attr(\n \"points\",\n `\n ${pos - maxTagBboxWidth / 2 - PX / 2},${ly + PY} \n ${pos - maxTagBboxWidth / 2 - PX / 2},${ly - PY}\n ${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly - h2 - PY}\n ${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly - h2 - PY}\n ${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly + h2 + PY}\n ${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly + h2 + PY}`\n );\n hole.attr(\"cy\", ly).attr(\"cx\", pos - maxTagBboxWidth / 2 + PX / 2).attr(\"r\", 1.5).attr(\"class\", \"tag-hole\");\n if (dir === \"TB\" || dir === \"BT\") {\n const yOrigin = pos + yOffset2;\n rect.attr(\"class\", \"tag-label-bkg\").attr(\n \"points\",\n `\n ${commitPosition.x},${yOrigin + 2}\n ${commitPosition.x},${yOrigin - 2}\n ${commitPosition.x + LAYOUT_OFFSET},${yOrigin - h2 - 2}\n ${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin - h2 - 2}\n ${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin + h2 + 2}\n ${commitPosition.x + LAYOUT_OFFSET},${yOrigin + h2 + 2}`\n ).attr(\"transform\", \"translate(12,12) rotate(45, \" + commitPosition.x + \",\" + pos + \")\");\n hole.attr(\"cx\", commitPosition.x + PX / 2).attr(\"cy\", yOrigin).attr(\"transform\", \"translate(12,12) rotate(45, \" + commitPosition.x + \",\" + pos + \")\");\n tag.attr(\"x\", commitPosition.x + 5).attr(\"y\", yOrigin + 3).attr(\"transform\", \"translate(14,14) rotate(45, \" + commitPosition.x + \",\" + pos + \")\");\n }\n }\n }\n}, \"drawCommitTags\");\nvar getCommitClassType = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((commit2) => {\n const commitSymbolType = commit2.customType ?? commit2.type;\n switch (commitSymbolType) {\n case commitType.NORMAL:\n return \"commit-normal\";\n case commitType.REVERSE:\n return \"commit-reverse\";\n case commitType.HIGHLIGHT:\n return \"commit-highlight\";\n case commitType.MERGE:\n return \"commit-merge\";\n case commitType.CHERRY_PICK:\n return \"commit-cherry-pick\";\n default:\n return \"commit-normal\";\n }\n}, \"getCommitClassType\");\nvar calculatePosition = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((commit2, dir2, pos, commitPos2) => {\n const defaultCommitPosition = { x: 0, y: 0 };\n if (commit2.parents.length > 0) {\n const closestParent = findClosestParent(commit2.parents);\n if (closestParent) {\n const parentPosition = commitPos2.get(closestParent) ?? defaultCommitPosition;\n if (dir2 === \"TB\") {\n return parentPosition.y + COMMIT_STEP;\n } else if (dir2 === \"BT\") {\n const currentPosition = commitPos2.get(commit2.id) ?? defaultCommitPosition;\n return currentPosition.y - COMMIT_STEP;\n } else {\n return parentPosition.x + COMMIT_STEP;\n }\n }\n } else {\n if (dir2 === \"TB\") {\n return defaultPos;\n } else if (dir2 === \"BT\") {\n const currentPosition = commitPos2.get(commit2.id) ?? defaultCommitPosition;\n return currentPosition.y - COMMIT_STEP;\n } else {\n return 0;\n }\n }\n return 0;\n}, \"calculatePosition\");\nvar getCommitPosition = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((commit2, pos, isParallelCommits) => {\n const posWithOffset = dir === \"BT\" && isParallelCommits ? pos : pos + LAYOUT_OFFSET;\n const y = dir === \"TB\" || dir === \"BT\" ? posWithOffset : branchPos.get(commit2.branch)?.pos;\n const x = dir === \"TB\" || dir === \"BT\" ? branchPos.get(commit2.branch)?.pos : posWithOffset;\n if (x === void 0 || y === void 0) {\n throw new Error(`Position were undefined for commit ${commit2.id}`);\n }\n return { x, y, posWithOffset };\n}, \"getCommitPosition\");\nvar drawCommits = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((svg, commits, modifyGraph, gitGraphConfig) => {\n const gBullets = svg.append(\"g\").attr(\"class\", \"commit-bullets\");\n const gLabels = svg.append(\"g\").attr(\"class\", \"commit-labels\");\n let pos = dir === \"TB\" || dir === \"BT\" ? defaultPos : 0;\n const keys = [...commits.keys()];\n const isParallelCommits = gitGraphConfig.parallelCommits ?? false;\n const sortKeys = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((a, b) => {\n const seqA = commits.get(a)?.seq;\n const seqB = commits.get(b)?.seq;\n return seqA !== void 0 && seqB !== void 0 ? seqA - seqB : 0;\n }, \"sortKeys\");\n let sortedKeys = keys.sort(sortKeys);\n if (dir === \"BT\") {\n if (isParallelCommits) {\n setParallelBTPos(sortedKeys, commits, pos);\n }\n sortedKeys = sortedKeys.reverse();\n }\n sortedKeys.forEach((key) => {\n const commit2 = commits.get(key);\n if (!commit2) {\n throw new Error(`Commit not found for key ${key}`);\n }\n if (isParallelCommits) {\n pos = calculatePosition(commit2, dir, pos, commitPos);\n }\n const commitPosition = getCommitPosition(commit2, pos, isParallelCommits);\n if (modifyGraph) {\n const typeClass = getCommitClassType(commit2);\n const commitSymbolType = commit2.customType ?? commit2.type;\n const branchIndex = branchPos.get(commit2.branch)?.index ?? 0;\n drawCommitBullet(gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType);\n drawCommitLabel(gLabels, commit2, commitPosition, pos, gitGraphConfig);\n drawCommitTags(gLabels, commit2, commitPosition, pos);\n }\n if (dir === \"TB\" || dir === \"BT\") {\n commitPos.set(commit2.id, { x: commitPosition.x, y: commitPosition.posWithOffset });\n } else {\n commitPos.set(commit2.id, { x: commitPosition.posWithOffset, y: commitPosition.y });\n }\n pos = dir === \"BT\" && isParallelCommits ? pos + COMMIT_STEP : pos + COMMIT_STEP + LAYOUT_OFFSET;\n if (pos > maxPos) {\n maxPos = pos;\n }\n });\n}, \"drawCommits\");\nvar shouldRerouteArrow = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((commitA, commitB, p1, p2, allCommits) => {\n const commitBIsFurthest = dir === \"TB\" || dir === \"BT\" ? p1.x < p2.x : p1.y < p2.y;\n const branchToGetCurve = commitBIsFurthest ? commitB.branch : commitA.branch;\n const isOnBranchToGetCurve = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((x) => x.branch === branchToGetCurve, \"isOnBranchToGetCurve\");\n const isBetweenCommits = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((x) => x.seq > commitA.seq && x.seq < commitB.seq, \"isBetweenCommits\");\n return [...allCommits.values()].some((commitX) => {\n return isBetweenCommits(commitX) && isOnBranchToGetCurve(commitX);\n });\n}, \"shouldRerouteArrow\");\nvar findLane = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((y1, y2, depth = 0) => {\n const candidate = y1 + Math.abs(y1 - y2) / 2;\n if (depth > 5) {\n return candidate;\n }\n const ok = lanes.every((lane) => Math.abs(lane - candidate) >= 10);\n if (ok) {\n lanes.push(candidate);\n return candidate;\n }\n const diff = Math.abs(y1 - y2);\n return findLane(y1, y2 - diff / 5, depth + 1);\n}, \"findLane\");\nvar drawArrow = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((svg, commitA, commitB, allCommits) => {\n const p1 = commitPos.get(commitA.id);\n const p2 = commitPos.get(commitB.id);\n if (p1 === void 0 || p2 === void 0) {\n throw new Error(`Commit positions not found for commits ${commitA.id} and ${commitB.id}`);\n }\n const arrowNeedsRerouting = shouldRerouteArrow(commitA, commitB, p1, p2, allCommits);\n let arc = \"\";\n let arc2 = \"\";\n let radius = 0;\n let offset = 0;\n let colorClassNum = branchPos.get(commitB.branch)?.index;\n if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {\n colorClassNum = branchPos.get(commitA.branch)?.index;\n }\n let lineDef;\n if (arrowNeedsRerouting) {\n arc = \"A 10 10, 0, 0, 0,\";\n arc2 = \"A 10 10, 0, 0, 1,\";\n radius = 10;\n offset = 10;\n const lineY = p1.y < p2.y ? findLane(p1.y, p2.y) : findLane(p2.y, p1.y);\n const lineX = p1.x < p2.x ? findLane(p1.x, p2.x) : findLane(p2.x, p1.x);\n if (dir === \"TB\") {\n if (p1.x < p2.x) {\n lineDef = `M ${p1.x} ${p1.y} L ${lineX - radius} ${p1.y} ${arc2} ${lineX} ${p1.y + offset} L ${lineX} ${p2.y - radius} ${arc} ${lineX + offset} ${p2.y} L ${p2.x} ${p2.y}`;\n } else {\n colorClassNum = branchPos.get(commitA.branch)?.index;\n lineDef = `M ${p1.x} ${p1.y} L ${lineX + radius} ${p1.y} ${arc} ${lineX} ${p1.y + offset} L ${lineX} ${p2.y - radius} ${arc2} ${lineX - offset} ${p2.y} L ${p2.x} ${p2.y}`;\n }\n } else if (dir === \"BT\") {\n if (p1.x < p2.x) {\n lineDef = `M ${p1.x} ${p1.y} L ${lineX - radius} ${p1.y} ${arc} ${lineX} ${p1.y - offset} L ${lineX} ${p2.y + radius} ${arc2} ${lineX + offset} ${p2.y} L ${p2.x} ${p2.y}`;\n } else {\n colorClassNum = branchPos.get(commitA.branch)?.index;\n lineDef = `M ${p1.x} ${p1.y} L ${lineX + radius} ${p1.y} ${arc2} ${lineX} ${p1.y - offset} L ${lineX} ${p2.y + radius} ${arc} ${lineX - offset} ${p2.y} L ${p2.x} ${p2.y}`;\n }\n } else {\n if (p1.y < p2.y) {\n lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${lineY - radius} ${arc} ${p1.x + offset} ${lineY} L ${p2.x - radius} ${lineY} ${arc2} ${p2.x} ${lineY + offset} L ${p2.x} ${p2.y}`;\n } else {\n colorClassNum = branchPos.get(commitA.branch)?.index;\n lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${lineY + radius} ${arc2} ${p1.x + offset} ${lineY} L ${p2.x - radius} ${lineY} ${arc} ${p2.x} ${lineY - offset} L ${p2.x} ${p2.y}`;\n }\n }\n } else {\n arc = \"A 20 20, 0, 0, 0,\";\n arc2 = \"A 20 20, 0, 0, 1,\";\n radius = 20;\n offset = 20;\n if (dir === \"TB\") {\n if (p1.x < p2.x) {\n if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {\n lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;\n } else {\n lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc2} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;\n }\n }\n if (p1.x > p2.x) {\n arc = \"A 20 20, 0, 0, 0,\";\n arc2 = \"A 20 20, 0, 0, 1,\";\n radius = 20;\n offset = 20;\n if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {\n lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc2} ${p1.x - offset} ${p2.y} L ${p2.x} ${p2.y}`;\n } else {\n lineDef = `M ${p1.x} ${p1.y} L ${p2.x + radius} ${p1.y} ${arc} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;\n }\n }\n if (p1.x === p2.x) {\n lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;\n }\n } else if (dir === \"BT\") {\n if (p1.x < p2.x) {\n if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {\n lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc2} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;\n } else {\n lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;\n }\n }\n if (p1.x > p2.x) {\n arc = \"A 20 20, 0, 0, 0,\";\n arc2 = \"A 20 20, 0, 0, 1,\";\n radius = 20;\n offset = 20;\n if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {\n lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc} ${p1.x - offset} ${p2.y} L ${p2.x} ${p2.y}`;\n } else {\n lineDef = `M ${p1.x} ${p1.y} L ${p2.x + radius} ${p1.y} ${arc2} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;\n }\n }\n if (p1.x === p2.x) {\n lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;\n }\n } else {\n if (p1.y < p2.y) {\n if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {\n lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc2} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;\n } else {\n lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;\n }\n }\n if (p1.y > p2.y) {\n if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {\n lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;\n } else {\n lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc2} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;\n }\n }\n if (p1.y === p2.y) {\n lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;\n }\n }\n }\n if (lineDef === void 0) {\n throw new Error(\"Line definition not found\");\n }\n svg.append(\"path\").attr(\"d\", lineDef).attr(\"class\", \"arrow arrow\" + colorClassNum % THEME_COLOR_LIMIT);\n}, \"drawArrow\");\nvar drawArrows = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((svg, commits) => {\n const gArrows = svg.append(\"g\").attr(\"class\", \"commit-arrows\");\n [...commits.keys()].forEach((key) => {\n const commit2 = commits.get(key);\n if (commit2.parents && commit2.parents.length > 0) {\n commit2.parents.forEach((parent) => {\n drawArrow(gArrows, commits.get(parent), commit2, commits);\n });\n }\n });\n}, \"drawArrows\");\nvar drawBranches = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((svg, branches, gitGraphConfig) => {\n const g = svg.append(\"g\");\n branches.forEach((branch2, index) => {\n const adjustIndexForTheme = index % THEME_COLOR_LIMIT;\n const pos = branchPos.get(branch2.name)?.pos;\n if (pos === void 0) {\n throw new Error(`Position not found for branch ${branch2.name}`);\n }\n const line = g.append(\"line\");\n line.attr(\"x1\", 0);\n line.attr(\"y1\", pos);\n line.attr(\"x2\", maxPos);\n line.attr(\"y2\", pos);\n line.attr(\"class\", \"branch branch\" + adjustIndexForTheme);\n if (dir === \"TB\") {\n line.attr(\"y1\", defaultPos);\n line.attr(\"x1\", pos);\n line.attr(\"y2\", maxPos);\n line.attr(\"x2\", pos);\n } else if (dir === \"BT\") {\n line.attr(\"y1\", maxPos);\n line.attr(\"x1\", pos);\n line.attr(\"y2\", defaultPos);\n line.attr(\"x2\", pos);\n }\n lanes.push(pos);\n const name = branch2.name;\n const labelElement = drawText(name);\n const bkg = g.insert(\"rect\");\n const branchLabel = g.insert(\"g\").attr(\"class\", \"branchLabel\");\n const label = branchLabel.insert(\"g\").attr(\"class\", \"label branch-label\" + adjustIndexForTheme);\n label.node().appendChild(labelElement);\n const bbox = labelElement.getBBox();\n bkg.attr(\"class\", \"branchLabelBkg label\" + adjustIndexForTheme).attr(\"rx\", 4).attr(\"ry\", 4).attr(\"x\", -bbox.width - 4 - (gitGraphConfig.rotateCommitLabel === true ? 30 : 0)).attr(\"y\", -bbox.height / 2 + 8).attr(\"width\", bbox.width + 18).attr(\"height\", bbox.height + 4);\n label.attr(\n \"transform\",\n \"translate(\" + (-bbox.width - 14 - (gitGraphConfig.rotateCommitLabel === true ? 30 : 0)) + \", \" + (pos - bbox.height / 2 - 1) + \")\"\n );\n if (dir === \"TB\") {\n bkg.attr(\"x\", pos - bbox.width / 2 - 10).attr(\"y\", 0);\n label.attr(\"transform\", \"translate(\" + (pos - bbox.width / 2 - 5) + \", 0)\");\n } else if (dir === \"BT\") {\n bkg.attr(\"x\", pos - bbox.width / 2 - 10).attr(\"y\", maxPos);\n label.attr(\"transform\", \"translate(\" + (pos - bbox.width / 2 - 5) + \", \" + maxPos + \")\");\n } else {\n bkg.attr(\"transform\", \"translate(-19, \" + (pos - bbox.height / 2) + \")\");\n }\n });\n}, \"drawBranches\");\nvar setBranchPosition = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function(name, pos, index, bbox, rotateCommitLabel) {\n branchPos.set(name, { pos, index });\n pos += 50 + (rotateCommitLabel ? 40 : 0) + (dir === \"TB\" || dir === \"BT\" ? bbox.width / 2 : 0);\n return pos;\n}, \"setBranchPosition\");\nvar draw = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(function(txt, id, ver, diagObj) {\n clear3();\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(\"in gitgraph renderer\", txt + \"\\n\", \"id:\", id, ver);\n const db2 = diagObj.db;\n if (!db2.getConfig) {\n _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.log.error(\"getConfig method is not available on db\");\n return;\n }\n const gitGraphConfig = db2.getConfig();\n const rotateCommitLabel = gitGraphConfig.rotateCommitLabel ?? false;\n allCommitsDict = db2.getCommits();\n const branches = db2.getBranchesAsObjArray();\n dir = db2.getDirection();\n const diagram2 = (0,d3__WEBPACK_IMPORTED_MODULE_6__.select)(`[id=\"${id}\"]`);\n let pos = 0;\n branches.forEach((branch2, index) => {\n const labelElement = drawText(branch2.name);\n const g = diagram2.append(\"g\");\n const branchLabel = g.insert(\"g\").attr(\"class\", \"branchLabel\");\n const label = branchLabel.insert(\"g\").attr(\"class\", \"label branch-label\");\n label.node()?.appendChild(labelElement);\n const bbox = labelElement.getBBox();\n pos = setBranchPosition(branch2.name, pos, index, bbox, rotateCommitLabel);\n label.remove();\n branchLabel.remove();\n g.remove();\n });\n drawCommits(diagram2, allCommitsDict, false, gitGraphConfig);\n if (gitGraphConfig.showBranches) {\n drawBranches(diagram2, branches, gitGraphConfig);\n }\n drawArrows(diagram2, allCommitsDict);\n drawCommits(diagram2, allCommitsDict, true, gitGraphConfig);\n _chunk_GEFDOKGD_mjs__WEBPACK_IMPORTED_MODULE_2__.utils_default.insertTitle(\n diagram2,\n \"gitTitleText\",\n gitGraphConfig.titleTopMargin ?? 0,\n db2.getDiagramTitle()\n );\n (0,_chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_3__.setupGraphViewbox2)(void 0, diagram2, gitGraphConfig.diagramPadding, gitGraphConfig.useMaxWidth);\n}, \"draw\");\nvar gitGraphRenderer_default = {\n draw\n};\nif (void 0) {\n const { it, expect, describe } = void 0;\n describe(\"drawText\", () => {\n it(\"should drawText\", () => {\n const svgLabel = drawText(\"main\");\n expect(svgLabel).toBeDefined();\n expect(svgLabel.children[0].innerHTML).toBe(\"main\");\n });\n });\n describe(\"branchPosition\", () => {\n const bbox = {\n x: 0,\n y: 0,\n width: 10,\n height: 10,\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n toJSON: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(() => \"\", \"toJSON\")\n };\n it(\"should setBranchPositions LR with two branches\", () => {\n dir = \"LR\";\n const pos = setBranchPosition(\"main\", 0, 0, bbox, true);\n expect(pos).toBe(90);\n expect(branchPos.get(\"main\")).toEqual({ pos: 0, index: 0 });\n const posNext = setBranchPosition(\"develop\", pos, 1, bbox, true);\n expect(posNext).toBe(180);\n expect(branchPos.get(\"develop\")).toEqual({ pos, index: 1 });\n });\n it(\"should setBranchPositions TB with two branches\", () => {\n dir = \"TB\";\n bbox.width = 34.9921875;\n const pos = setBranchPosition(\"main\", 0, 0, bbox, true);\n expect(pos).toBe(107.49609375);\n expect(branchPos.get(\"main\")).toEqual({ pos: 0, index: 0 });\n bbox.width = 56.421875;\n const posNext = setBranchPosition(\"develop\", pos, 1, bbox, true);\n expect(posNext).toBe(225.70703125);\n expect(branchPos.get(\"develop\")).toEqual({ pos, index: 1 });\n });\n });\n describe(\"commitPosition\", () => {\n const commits = /* @__PURE__ */ new Map([\n [\n \"commitZero\",\n {\n id: \"ZERO\",\n message: \"\",\n seq: 0,\n type: commitType.NORMAL,\n tags: [],\n parents: [],\n branch: \"main\"\n }\n ],\n [\n \"commitA\",\n {\n id: \"A\",\n message: \"\",\n seq: 1,\n type: commitType.NORMAL,\n tags: [],\n parents: [\"ZERO\"],\n branch: \"feature\"\n }\n ],\n [\n \"commitB\",\n {\n id: \"B\",\n message: \"\",\n seq: 2,\n type: commitType.NORMAL,\n tags: [],\n parents: [\"A\"],\n branch: \"feature\"\n }\n ],\n [\n \"commitM\",\n {\n id: \"M\",\n message: \"merged branch feature into main\",\n seq: 3,\n type: commitType.MERGE,\n tags: [],\n parents: [\"ZERO\", \"B\"],\n branch: \"main\",\n customId: true\n }\n ],\n [\n \"commitC\",\n {\n id: \"C\",\n message: \"\",\n seq: 4,\n type: commitType.NORMAL,\n tags: [],\n parents: [\"ZERO\"],\n branch: \"release\"\n }\n ],\n [\n \"commit5_8928ea0\",\n {\n id: \"5-8928ea0\",\n message: \"cherry-picked [object Object] into release\",\n seq: 5,\n type: commitType.CHERRY_PICK,\n tags: [],\n parents: [\"C\", \"M\"],\n branch: \"release\"\n }\n ],\n [\n \"commitD\",\n {\n id: \"D\",\n message: \"\",\n seq: 6,\n type: commitType.NORMAL,\n tags: [],\n parents: [\"5-8928ea0\"],\n branch: \"release\"\n }\n ],\n [\n \"commit7_ed848ba\",\n {\n id: \"7-ed848ba\",\n message: \"cherry-picked [object Object] into release\",\n seq: 7,\n type: commitType.CHERRY_PICK,\n tags: [],\n parents: [\"D\", \"M\"],\n branch: \"release\"\n }\n ]\n ]);\n let pos = 0;\n branchPos.set(\"main\", { pos: 0, index: 0 });\n branchPos.set(\"feature\", { pos: 107.49609375, index: 1 });\n branchPos.set(\"release\", { pos: 224.03515625, index: 2 });\n describe(\"TB\", () => {\n pos = 30;\n dir = \"TB\";\n const expectedCommitPositionTB = /* @__PURE__ */ new Map([\n [\"commitZero\", { x: 0, y: 40, posWithOffset: 40 }],\n [\"commitA\", { x: 107.49609375, y: 90, posWithOffset: 90 }],\n [\"commitB\", { x: 107.49609375, y: 140, posWithOffset: 140 }],\n [\"commitM\", { x: 0, y: 190, posWithOffset: 190 }],\n [\"commitC\", { x: 224.03515625, y: 240, posWithOffset: 240 }],\n [\"commit5_8928ea0\", { x: 224.03515625, y: 290, posWithOffset: 290 }],\n [\"commitD\", { x: 224.03515625, y: 340, posWithOffset: 340 }],\n [\"commit7_ed848ba\", { x: 224.03515625, y: 390, posWithOffset: 390 }]\n ]);\n commits.forEach((commit2, key) => {\n it(`should give the correct position for commit ${key}`, () => {\n const position = getCommitPosition(commit2, pos, false);\n expect(position).toEqual(expectedCommitPositionTB.get(key));\n pos += 50;\n });\n });\n });\n describe(\"LR\", () => {\n let pos2 = 30;\n dir = \"LR\";\n const expectedCommitPositionLR = /* @__PURE__ */ new Map([\n [\"commitZero\", { x: 0, y: 40, posWithOffset: 40 }],\n [\"commitA\", { x: 107.49609375, y: 90, posWithOffset: 90 }],\n [\"commitB\", { x: 107.49609375, y: 140, posWithOffset: 140 }],\n [\"commitM\", { x: 0, y: 190, posWithOffset: 190 }],\n [\"commitC\", { x: 224.03515625, y: 240, posWithOffset: 240 }],\n [\"commit5_8928ea0\", { x: 224.03515625, y: 290, posWithOffset: 290 }],\n [\"commitD\", { x: 224.03515625, y: 340, posWithOffset: 340 }],\n [\"commit7_ed848ba\", { x: 224.03515625, y: 390, posWithOffset: 390 }]\n ]);\n commits.forEach((commit2, key) => {\n it(`should give the correct position for commit ${key}`, () => {\n const position = getCommitPosition(commit2, pos2, false);\n expect(position).toEqual(expectedCommitPositionLR.get(key));\n pos2 += 50;\n });\n });\n });\n describe(\"getCommitClassType\", () => {\n const expectedCommitClassType = /* @__PURE__ */ new Map([\n [\"commitZero\", \"commit-normal\"],\n [\"commitA\", \"commit-normal\"],\n [\"commitB\", \"commit-normal\"],\n [\"commitM\", \"commit-merge\"],\n [\"commitC\", \"commit-normal\"],\n [\"commit5_8928ea0\", \"commit-cherry-pick\"],\n [\"commitD\", \"commit-normal\"],\n [\"commit7_ed848ba\", \"commit-cherry-pick\"]\n ]);\n commits.forEach((commit2, key) => {\n it(`should give the correct class type for commit ${key}`, () => {\n const classType = getCommitClassType(commit2);\n expect(classType).toBe(expectedCommitClassType.get(key));\n });\n });\n });\n });\n describe(\"building BT parallel commit diagram\", () => {\n const commits = /* @__PURE__ */ new Map([\n [\n \"1-abcdefg\",\n {\n id: \"1-abcdefg\",\n message: \"\",\n seq: 0,\n type: 0,\n tags: [],\n parents: [],\n branch: \"main\"\n }\n ],\n [\n \"2-abcdefg\",\n {\n id: \"2-abcdefg\",\n message: \"\",\n seq: 1,\n type: 0,\n tags: [],\n parents: [\"1-abcdefg\"],\n branch: \"main\"\n }\n ],\n [\n \"3-abcdefg\",\n {\n id: \"3-abcdefg\",\n message: \"\",\n seq: 2,\n type: 0,\n tags: [],\n parents: [\"2-abcdefg\"],\n branch: \"develop\"\n }\n ],\n [\n \"4-abcdefg\",\n {\n id: \"4-abcdefg\",\n message: \"\",\n seq: 3,\n type: 0,\n tags: [],\n parents: [\"3-abcdefg\"],\n branch: \"develop\"\n }\n ],\n [\n \"5-abcdefg\",\n {\n id: \"5-abcdefg\",\n message: \"\",\n seq: 4,\n type: 0,\n tags: [],\n parents: [\"2-abcdefg\"],\n branch: \"feature\"\n }\n ],\n [\n \"6-abcdefg\",\n {\n id: \"6-abcdefg\",\n message: \"\",\n seq: 5,\n type: 0,\n tags: [],\n parents: [\"5-abcdefg\"],\n branch: \"feature\"\n }\n ],\n [\n \"7-abcdefg\",\n {\n id: \"7-abcdefg\",\n message: \"\",\n seq: 6,\n type: 0,\n tags: [],\n parents: [\"2-abcdefg\"],\n branch: \"main\"\n }\n ],\n [\n \"8-abcdefg\",\n {\n id: \"8-abcdefg\",\n message: \"\",\n seq: 7,\n type: 0,\n tags: [],\n parents: [\"7-abcdefg\"],\n branch: \"main\"\n }\n ]\n ]);\n const expectedCommitPosition = /* @__PURE__ */ new Map([\n [\"1-abcdefg\", { x: 0, y: 40 }],\n [\"2-abcdefg\", { x: 0, y: 90 }],\n [\"3-abcdefg\", { x: 107.49609375, y: 140 }],\n [\"4-abcdefg\", { x: 107.49609375, y: 190 }],\n [\"5-abcdefg\", { x: 225.70703125, y: 140 }],\n [\"6-abcdefg\", { x: 225.70703125, y: 190 }],\n [\"7-abcdefg\", { x: 0, y: 140 }],\n [\"8-abcdefg\", { x: 0, y: 190 }]\n ]);\n const expectedCommitPositionAfterParallel = /* @__PURE__ */ new Map([\n [\"1-abcdefg\", { x: 0, y: 210 }],\n [\"2-abcdefg\", { x: 0, y: 160 }],\n [\"3-abcdefg\", { x: 107.49609375, y: 110 }],\n [\"4-abcdefg\", { x: 107.49609375, y: 60 }],\n [\"5-abcdefg\", { x: 225.70703125, y: 110 }],\n [\"6-abcdefg\", { x: 225.70703125, y: 60 }],\n [\"7-abcdefg\", { x: 0, y: 110 }],\n [\"8-abcdefg\", { x: 0, y: 60 }]\n ]);\n const expectedCommitCurrentPosition = /* @__PURE__ */ new Map([\n [\"1-abcdefg\", 30],\n [\"2-abcdefg\", 80],\n [\"3-abcdefg\", 130],\n [\"4-abcdefg\", 180],\n [\"5-abcdefg\", 130],\n [\"6-abcdefg\", 180],\n [\"7-abcdefg\", 130],\n [\"8-abcdefg\", 180]\n ]);\n const sortedKeys = [...expectedCommitPosition.keys()];\n it(\"should get the correct commit position and current position\", () => {\n dir = \"BT\";\n let curPos = 30;\n commitPos.clear();\n branchPos.clear();\n branchPos.set(\"main\", { pos: 0, index: 0 });\n branchPos.set(\"develop\", { pos: 107.49609375, index: 1 });\n branchPos.set(\"feature\", { pos: 225.70703125, index: 2 });\n commits.forEach((commit2, key) => {\n if (commit2.parents.length > 0) {\n curPos = calculateCommitPosition(commit2);\n }\n const position = setCommitPosition(commit2, curPos);\n expect(position).toEqual(expectedCommitPosition.get(key));\n expect(curPos).toEqual(expectedCommitCurrentPosition.get(key));\n });\n });\n it(\"should get the correct commit position after parallel commits\", () => {\n commitPos.clear();\n branchPos.clear();\n dir = \"BT\";\n const curPos = 30;\n commitPos.clear();\n branchPos.clear();\n branchPos.set(\"main\", { pos: 0, index: 0 });\n branchPos.set(\"develop\", { pos: 107.49609375, index: 1 });\n branchPos.set(\"feature\", { pos: 225.70703125, index: 2 });\n setParallelBTPos(sortedKeys, commits, curPos);\n sortedKeys.forEach((commit2) => {\n const position = commitPos.get(commit2);\n expect(position).toEqual(expectedCommitPositionAfterParallel.get(commit2));\n });\n });\n });\n it(\"add\", () => {\n commitPos.set(\"parent1\", { x: 1, y: 1 });\n commitPos.set(\"parent2\", { x: 2, y: 2 });\n commitPos.set(\"parent3\", { x: 3, y: 3 });\n dir = \"LR\";\n const parents = [\"parent1\", \"parent2\", \"parent3\"];\n const closestParent = findClosestParent(parents);\n expect(closestParent).toBe(\"parent3\");\n commitPos.clear();\n });\n}\n\n// src/diagrams/git/styles.js\nvar getStyles = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)((options) => `\n .commit-id,\n .commit-msg,\n .branch-label {\n fill: lightgrey;\n color: lightgrey;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n ${[0, 1, 2, 3, 4, 5, 6, 7].map(\n (i) => `\n .branch-label${i} { fill: ${options[\"gitBranchLabel\" + i]}; }\n .commit${i} { stroke: ${options[\"git\" + i]}; fill: ${options[\"git\" + i]}; }\n .commit-highlight${i} { stroke: ${options[\"gitInv\" + i]}; fill: ${options[\"gitInv\" + i]}; }\n .label${i} { fill: ${options[\"git\" + i]}; }\n .arrow${i} { stroke: ${options[\"git\" + i]}; }\n `\n).join(\"\\n\")}\n\n .branch {\n stroke-width: 1;\n stroke: ${options.lineColor};\n stroke-dasharray: 2;\n }\n .commit-label { font-size: ${options.commitLabelFontSize}; fill: ${options.commitLabelColor};}\n .commit-label-bkg { font-size: ${options.commitLabelFontSize}; fill: ${options.commitLabelBackground}; opacity: 0.5; }\n .tag-label { font-size: ${options.tagLabelFontSize}; fill: ${options.tagLabelColor};}\n .tag-label-bkg { fill: ${options.tagLabelBackground}; stroke: ${options.tagLabelBorder}; }\n .tag-hole { fill: ${options.textColor}; }\n\n .commit-merge {\n stroke: ${options.primaryColor};\n fill: ${options.primaryColor};\n }\n .commit-reverse {\n stroke: ${options.primaryColor};\n fill: ${options.primaryColor};\n stroke-width: 3;\n }\n .commit-highlight-outer {\n }\n .commit-highlight-inner {\n stroke: ${options.primaryColor};\n fill: ${options.primaryColor};\n }\n\n .arrow { stroke-width: 8; stroke-linecap: round; fill: none}\n .gitTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${options.textColor};\n }\n`, \"getStyles\");\nvar styles_default = getStyles;\n\n// src/diagrams/git/gitGraphDiagram.ts\nvar diagram = {\n parser,\n db,\n renderer: gitGraphRenderer_default,\n styles: styles_default\n};\n\n\n\n//# sourceURL=webpack://@mdts/frontend/./node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-K3NZZRJ6.mjs?\n}");
|
|
39
|
+
|
|
40
|
+
/***/ }
|
|
41
|
+
|
|
42
|
+
}]);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
4
|
+
* This devtool is neither made for production nor for readable output files.
|
|
5
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
6
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
7
|
+
* or disable the default devtool with "devtool: false".
|
|
8
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
9
|
+
*/
|
|
10
|
+
(self["webpackChunk_mdts_frontend"] = self["webpackChunk_mdts_frontend"] || []).push([["vendors-node_modules_mermaid_dist_chunks_mermaid_core_ishikawaDiagram-PHBUUO56_mjs"],{
|
|
11
|
+
|
|
12
|
+
/***/ "./node_modules/mermaid/dist/chunks/mermaid.core/ishikawaDiagram-PHBUUO56.mjs"
|
|
13
|
+
/*!************************************************************************************!*\
|
|
14
|
+
!*** ./node_modules/mermaid/dist/chunks/mermaid.core/ishikawaDiagram-PHBUUO56.mjs ***!
|
|
15
|
+
\************************************************************************************/
|
|
16
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
17
|
+
|
|
18
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ diagram: () => (/* binding */ diagram)\n/* harmony export */ });\n/* harmony import */ var _chunk_HHEYEP7N_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunk-HHEYEP7N.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-HHEYEP7N.mjs\");\n/* harmony import */ var _chunk_GEFDOKGD_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./chunk-GEFDOKGD.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-GEFDOKGD.mjs\");\n/* harmony import */ var _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./chunk-7R4GIKGN.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-7R4GIKGN.mjs\");\n/* harmony import */ var _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./chunk-AGHRB4JF.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-AGHRB4JF.mjs\");\n/* harmony import */ var roughjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! roughjs */ \"./node_modules/roughjs/bundled/rough.esm.js\");\n\n\n\n\n\n// src/diagrams/ishikawa/parser/ishikawa.jison\nvar parser = (function() {\n var o = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function(k, v, o2, l) {\n for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;\n return o2;\n }, \"o\"), $V0 = [1, 4], $V1 = [1, 14], $V2 = [1, 12], $V3 = [1, 13], $V4 = [6, 7, 8], $V5 = [1, 20], $V6 = [1, 18], $V7 = [1, 19], $V8 = [6, 7, 11], $V9 = [1, 6, 13, 14], $Va = [1, 23], $Vb = [1, 24], $Vc = [1, 6, 7, 11, 13, 14];\n var parser2 = {\n trace: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function trace() {\n }, \"trace\"),\n yy: {},\n symbols_: { \"error\": 2, \"start\": 3, \"ishikawa\": 4, \"spaceLines\": 5, \"SPACELINE\": 6, \"NL\": 7, \"ISHIKAWA\": 8, \"document\": 9, \"stop\": 10, \"EOF\": 11, \"statement\": 12, \"SPACELIST\": 13, \"TEXT\": 14, \"$accept\": 0, \"$end\": 1 },\n terminals_: { 2: \"error\", 6: \"SPACELINE\", 7: \"NL\", 8: \"ISHIKAWA\", 11: \"EOF\", 13: \"SPACELIST\", 14: \"TEXT\" },\n productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 2], [12, 1], [12, 1], [12, 1]],\n performAction: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {\n var $0 = $$.length - 1;\n switch (yystate) {\n case 6:\n case 7:\n return yy;\n // removed by dead control flow\n\n case 15:\n yy.addNode($$[$0 - 1].length, $$[$0].trim());\n break;\n case 16:\n yy.addNode(0, $$[$0].trim());\n break;\n }\n }, \"anonymous\"),\n table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: $V0 }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: $V0 }, { 6: $V1, 7: [1, 10], 9: 9, 12: 11, 13: $V2, 14: $V3 }, o($V4, [2, 3]), { 1: [2, 2] }, o($V4, [2, 4]), o($V4, [2, 5]), { 1: [2, 6], 6: $V1, 12: 15, 13: $V2, 14: $V3 }, { 6: $V1, 9: 16, 12: 11, 13: $V2, 14: $V3 }, { 6: $V5, 7: $V6, 10: 17, 11: $V7 }, o($V8, [2, 18], { 14: [1, 21] }), o($V8, [2, 16]), o($V8, [2, 17]), { 6: $V5, 7: $V6, 10: 22, 11: $V7 }, { 1: [2, 7], 6: $V1, 12: 15, 13: $V2, 14: $V3 }, o($V9, [2, 14], { 7: $Va, 11: $Vb }), o($Vc, [2, 8]), o($Vc, [2, 9]), o($Vc, [2, 10]), o($V8, [2, 15]), o($V9, [2, 13], { 7: $Va, 11: $Vb }), o($Vc, [2, 11]), o($Vc, [2, 12])],\n defaultActions: { 2: [2, 1], 6: [2, 2] },\n parseError: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function parseError(str, hash) {\n if (hash.recoverable) {\n this.trace(str);\n } else {\n var error = new Error(str);\n error.hash = hash;\n throw error;\n }\n }, \"parseError\"),\n parse: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function parse(input) {\n var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = \"\", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\n var args = lstack.slice.call(arguments, 1);\n var lexer2 = Object.create(this.lexer);\n var sharedState = { yy: {} };\n for (var k in this.yy) {\n if (Object.prototype.hasOwnProperty.call(this.yy, k)) {\n sharedState.yy[k] = this.yy[k];\n }\n }\n lexer2.setInput(input, sharedState.yy);\n sharedState.yy.lexer = lexer2;\n sharedState.yy.parser = this;\n if (typeof lexer2.yylloc == \"undefined\") {\n lexer2.yylloc = {};\n }\n var yyloc = lexer2.yylloc;\n lstack.push(yyloc);\n var ranges = lexer2.options && lexer2.options.ranges;\n if (typeof sharedState.yy.parseError === \"function\") {\n this.parseError = sharedState.yy.parseError;\n } else {\n this.parseError = Object.getPrototypeOf(this).parseError;\n }\n function popStack(n) {\n stack.length = stack.length - 2 * n;\n vstack.length = vstack.length - n;\n lstack.length = lstack.length - n;\n }\n (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(popStack, \"popStack\");\n function lex() {\n var token;\n token = tstack.pop() || lexer2.lex() || EOF;\n if (typeof token !== \"number\") {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n token = self.symbols_[token] || token;\n }\n return token;\n }\n (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(lex, \"lex\");\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\n while (true) {\n state = stack[stack.length - 1];\n if (this.defaultActions[state]) {\n action = this.defaultActions[state];\n } else {\n if (symbol === null || typeof symbol == \"undefined\") {\n symbol = lex();\n }\n action = table[state] && table[state][symbol];\n }\n if (typeof action === \"undefined\" || !action.length || !action[0]) {\n var errStr = \"\";\n expected = [];\n for (p in table[state]) {\n if (this.terminals_[p] && p > TERROR) {\n expected.push(\"'\" + this.terminals_[p] + \"'\");\n }\n }\n if (lexer2.showPosition) {\n errStr = \"Parse error on line \" + (yylineno + 1) + \":\\n\" + lexer2.showPosition() + \"\\nExpecting \" + expected.join(\", \") + \", got '\" + (this.terminals_[symbol] || symbol) + \"'\";\n } else {\n errStr = \"Parse error on line \" + (yylineno + 1) + \": Unexpected \" + (symbol == EOF ? \"end of input\" : \"'\" + (this.terminals_[symbol] || symbol) + \"'\");\n }\n this.parseError(errStr, {\n text: lexer2.match,\n token: this.terminals_[symbol] || symbol,\n line: lexer2.yylineno,\n loc: yyloc,\n expected\n });\n }\n if (action[0] instanceof Array && action.length > 1) {\n throw new Error(\"Parse Error: multiple actions possible at state: \" + state + \", token: \" + symbol);\n }\n switch (action[0]) {\n case 1:\n stack.push(symbol);\n vstack.push(lexer2.yytext);\n lstack.push(lexer2.yylloc);\n stack.push(action[1]);\n symbol = null;\n if (!preErrorSymbol) {\n yyleng = lexer2.yyleng;\n yytext = lexer2.yytext;\n yylineno = lexer2.yylineno;\n yyloc = lexer2.yylloc;\n if (recovering > 0) {\n recovering--;\n }\n } else {\n symbol = preErrorSymbol;\n preErrorSymbol = null;\n }\n break;\n case 2:\n len = this.productions_[action[1]][1];\n yyval.$ = vstack[vstack.length - len];\n yyval._$ = {\n first_line: lstack[lstack.length - (len || 1)].first_line,\n last_line: lstack[lstack.length - 1].last_line,\n first_column: lstack[lstack.length - (len || 1)].first_column,\n last_column: lstack[lstack.length - 1].last_column\n };\n if (ranges) {\n yyval._$.range = [\n lstack[lstack.length - (len || 1)].range[0],\n lstack[lstack.length - 1].range[1]\n ];\n }\n r = this.performAction.apply(yyval, [\n yytext,\n yyleng,\n yylineno,\n sharedState.yy,\n action[1],\n vstack,\n lstack\n ].concat(args));\n if (typeof r !== \"undefined\") {\n return r;\n }\n if (len) {\n stack = stack.slice(0, -1 * len * 2);\n vstack = vstack.slice(0, -1 * len);\n lstack = lstack.slice(0, -1 * len);\n }\n stack.push(this.productions_[action[1]][0]);\n vstack.push(yyval.$);\n lstack.push(yyval._$);\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\n stack.push(newState);\n break;\n case 3:\n return true;\n }\n }\n return true;\n }, \"parse\")\n };\n var lexer = /* @__PURE__ */ (function() {\n var lexer2 = {\n EOF: 1,\n parseError: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function parseError(str, hash) {\n if (this.yy.parser) {\n this.yy.parser.parseError(str, hash);\n } else {\n throw new Error(str);\n }\n }, \"parseError\"),\n // resets the lexer, sets new input\n setInput: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function(input, yy) {\n this.yy = yy || this.yy || {};\n this._input = input;\n this._more = this._backtrack = this.done = false;\n this.yylineno = this.yyleng = 0;\n this.yytext = this.matched = this.match = \"\";\n this.conditionStack = [\"INITIAL\"];\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0\n };\n if (this.options.ranges) {\n this.yylloc.range = [0, 0];\n }\n this.offset = 0;\n return this;\n }, \"setInput\"),\n // consumes and returns one char from the input\n input: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function() {\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n var lines = ch.match(/(?:\\r\\n?|\\n).*/g);\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n } else {\n this.yylloc.last_column++;\n }\n if (this.options.ranges) {\n this.yylloc.range[1]++;\n }\n this._input = this._input.slice(1);\n return ch;\n }, \"input\"),\n // unshifts one char (or a string) into the input\n unput: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.offset -= len;\n var oldLines = this.match.split(/(?:\\r\\n?|\\n)/g);\n this.match = this.match.substr(0, this.match.length - 1);\n this.matched = this.matched.substr(0, this.matched.length - 1);\n if (lines.length - 1) {\n this.yylineno -= lines.length - 1;\n }\n var r = this.yylloc.range;\n this.yylloc = {\n first_line: this.yylloc.first_line,\n last_line: this.yylineno + 1,\n first_column: this.yylloc.first_column,\n last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len\n };\n if (this.options.ranges) {\n this.yylloc.range = [r[0], r[0] + this.yyleng - len];\n }\n this.yyleng = this.yytext.length;\n return this;\n }, \"unput\"),\n // When called from action, caches matched text and appends it on next action\n more: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function() {\n this._more = true;\n return this;\n }, \"more\"),\n // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.\n reject: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n return this.parseError(\"Lexical error on line \" + (this.yylineno + 1) + \". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\" + this.showPosition(), {\n text: \"\",\n token: null,\n line: this.yylineno\n });\n }\n return this;\n }, \"reject\"),\n // retain first n characters of the match\n less: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function(n) {\n this.unput(this.match.slice(n));\n }, \"less\"),\n // displays already matched input, i.e. for error messages\n pastInput: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function() {\n var past = this.matched.substr(0, this.matched.length - this.match.length);\n return (past.length > 20 ? \"...\" : \"\") + past.substr(-20).replace(/\\n/g, \"\");\n }, \"pastInput\"),\n // displays upcoming input, i.e. for error messages\n upcomingInput: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function() {\n var next = this.match;\n if (next.length < 20) {\n next += this._input.substr(0, 20 - next.length);\n }\n return (next.substr(0, 20) + (next.length > 20 ? \"...\" : \"\")).replace(/\\n/g, \"\");\n }, \"upcomingInput\"),\n // displays the character position where the lexing error occurred, i.e. for error messages\n showPosition: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function() {\n var pre = this.pastInput();\n var c = new Array(pre.length + 1).join(\"-\");\n return pre + this.upcomingInput() + \"\\n\" + c + \"^\";\n }, \"showPosition\"),\n // test the lexed token: return FALSE when not a match, otherwise return token\n test_match: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function(match, indexed_rule) {\n var token, lines, backup;\n if (this.options.backtrack_lexer) {\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n if (this.options.ranges) {\n backup.yylloc.range = this.yylloc.range.slice(0);\n }\n }\n lines = match[0].match(/(?:\\r\\n?|\\n).*/g);\n if (lines) {\n this.yylineno += lines.length;\n }\n this.yylloc = {\n first_line: this.yylloc.last_line,\n last_line: this.yylineno + 1,\n first_column: this.yylloc.last_column,\n last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\\r?\\n?/)[0].length : this.yylloc.last_column + match[0].length\n };\n this.yytext += match[0];\n this.match += match[0];\n this.matches = match;\n this.yyleng = this.yytext.length;\n if (this.options.ranges) {\n this.yylloc.range = [this.offset, this.offset += this.yyleng];\n }\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match[0].length);\n this.matched += match[0];\n token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n for (var k in backup) {\n this[k] = backup[k];\n }\n return false;\n }\n return false;\n }, \"test_match\"),\n // return next match in input\n next: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function() {\n if (this.done) {\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n var token, match, tempMatch, index;\n if (!this._more) {\n this.yytext = \"\";\n this.match = \"\";\n }\n var rules = this._currentRules();\n for (var i = 0; i < rules.length; i++) {\n tempMatch = this._input.match(this.rules[rules[i]]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rules[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = false;\n continue;\n } else {\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rules[index]);\n if (token !== false) {\n return token;\n }\n return false;\n }\n if (this._input === \"\") {\n return this.EOF;\n } else {\n return this.parseError(\"Lexical error on line \" + (this.yylineno + 1) + \". Unrecognized text.\\n\" + this.showPosition(), {\n text: \"\",\n token: null,\n line: this.yylineno\n });\n }\n }, \"next\"),\n // return next match that has a token\n lex: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function lex() {\n var r = this.next();\n if (r) {\n return r;\n } else {\n return this.lex();\n }\n }, \"lex\"),\n // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)\n begin: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function begin(condition) {\n this.conditionStack.push(condition);\n }, \"begin\"),\n // pop the previously active lexer condition state off the condition stack\n popState: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n }, \"popState\"),\n // produce the lexer rule set which is active for the currently active lexer condition state\n _currentRules: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function _currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;\n } else {\n return this.conditions[\"INITIAL\"].rules;\n }\n }, \"_currentRules\"),\n // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available\n topState: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \"INITIAL\";\n }\n }, \"topState\"),\n // alias for begin(condition)\n pushState: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function pushState(condition) {\n this.begin(condition);\n }, \"pushState\"),\n // return the number of states currently on the stack\n stateStackSize: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function stateStackSize() {\n return this.conditionStack.length;\n }, \"stateStackSize\"),\n options: { \"case-insensitive\": true },\n performAction: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {\n var YYSTATE = YY_START;\n switch ($avoiding_name_collisions) {\n case 0:\n return 6;\n // removed by dead control flow\n\n case 1:\n return 8;\n // removed by dead control flow\n\n case 2:\n return 8;\n // removed by dead control flow\n\n case 3:\n return 6;\n // removed by dead control flow\n\n case 4:\n return 7;\n // removed by dead control flow\n\n case 5:\n return 13;\n // removed by dead control flow\n\n case 6:\n return 14;\n // removed by dead control flow\n\n case 7:\n return 11;\n // removed by dead control flow\n\n }\n }, \"anonymous\"),\n rules: [/^(?:\\s*%%.*)/i, /^(?:ishikawa-beta\\b)/i, /^(?:ishikawa\\b)/i, /^(?:[\\s]+[\\n])/i, /^(?:[\\n]+)/i, /^(?:[\\s]+)/i, /^(?:[^\\n]+)/i, /^(?:$)/i],\n conditions: { \"INITIAL\": { \"rules\": [0, 1, 2, 3, 4, 5, 6, 7], \"inclusive\": true } }\n };\n return lexer2;\n })();\n parser2.lexer = lexer;\n function Parser() {\n this.yy = {};\n }\n (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(Parser, \"Parser\");\n Parser.prototype = parser2;\n parser2.Parser = Parser;\n return new Parser();\n})();\nparser.parser = parser;\nvar ishikawa_default = parser;\n\n// src/diagrams/ishikawa/ishikawaDb.ts\nvar IshikawaDB = class {\n constructor() {\n this.stack = [];\n this.clear = this.clear.bind(this);\n this.addNode = this.addNode.bind(this);\n this.getRoot = this.getRoot.bind(this);\n }\n static {\n (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(this, \"IshikawaDB\");\n }\n clear() {\n this.root = void 0;\n this.stack = [];\n this.baseLevel = void 0;\n (0,_chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_2__.clear)();\n }\n getRoot() {\n return this.root;\n }\n addNode(rawLevel, text) {\n const label = _chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_2__.common_default.sanitizeText(text, (0,_chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_2__.getConfig2)());\n if (!this.root) {\n this.baseLevel = rawLevel;\n this.root = { text: label, children: [] };\n this.stack = [{ level: 0, node: this.root }];\n (0,_chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_2__.setDiagramTitle)(label);\n return;\n }\n let level = rawLevel - (this.baseLevel ?? 0);\n if (level <= 0) {\n level = 1;\n }\n while (this.stack.length > 1 && this.stack[this.stack.length - 1].level >= level) {\n this.stack.pop();\n }\n const parent = this.stack[this.stack.length - 1].node;\n const node = { text: label, children: [] };\n parent.children.push(node);\n this.stack.push({ level, node });\n }\n getAccTitle() {\n return (0,_chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_2__.getAccTitle)();\n }\n setAccTitle(title) {\n (0,_chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_2__.setAccTitle)(title);\n }\n getAccDescription() {\n return (0,_chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_2__.getAccDescription)();\n }\n setAccDescription(description) {\n (0,_chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_2__.setAccDescription)(description);\n }\n getDiagramTitle() {\n return (0,_chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_2__.getDiagramTitle)();\n }\n setDiagramTitle(title) {\n (0,_chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_2__.setDiagramTitle)(title);\n }\n};\n\n// src/diagrams/ishikawa/ishikawaRenderer.ts\n\nvar FONT_SIZE_DEFAULT = 14;\nvar SPINE_BASE_LENGTH = 250;\nvar BONE_STUB = 30;\nvar BONE_BASE = 60;\nvar BONE_PER_CHILD = 5;\nvar ANGLE = 82 * Math.PI / 180;\nvar COS_A = Math.cos(ANGLE);\nvar SIN_A = Math.sin(ANGLE);\nvar applyPaddedViewBox = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((svgEl, pad, maxW) => {\n const bbox = svgEl.node().getBBox();\n const w = bbox.width + pad * 2;\n const h = bbox.height + pad * 2;\n (0,_chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_2__.configureSvgSize)(svgEl, h, w, maxW);\n svgEl.attr(\"viewBox\", `${bbox.x - pad} ${bbox.y - pad} ${w} ${h}`);\n}, \"applyPaddedViewBox\");\nvar draw = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((_text, id, _version, diagram2) => {\n const db = diagram2.db;\n const root = db.getRoot();\n if (!root) {\n return;\n }\n const drawConfig = (0,_chunk_7R4GIKGN_mjs__WEBPACK_IMPORTED_MODULE_2__.getConfig2)();\n const { look, handDrawnSeed, themeVariables } = drawConfig;\n const fontSize = (0,_chunk_GEFDOKGD_mjs__WEBPACK_IMPORTED_MODULE_1__.parseFontSize)(drawConfig.fontSize)[0] ?? FONT_SIZE_DEFAULT;\n const isHandDrawn = look === \"handDrawn\";\n const causes = root.children ?? [];\n const padding = drawConfig.ishikawa?.diagramPadding ?? 20;\n const useMaxWidth = drawConfig.ishikawa?.useMaxWidth ?? false;\n const svg = (0,_chunk_HHEYEP7N_mjs__WEBPACK_IMPORTED_MODULE_0__.selectSvgElement)(id);\n const g = svg.append(\"g\").attr(\"class\", \"ishikawa\");\n const roughSvg = isHandDrawn ? roughjs__WEBPACK_IMPORTED_MODULE_4__[\"default\"].svg(svg.node()) : void 0;\n const roughContext = roughSvg ? {\n roughSvg,\n seed: handDrawnSeed ?? 0,\n lineColor: themeVariables?.lineColor ?? \"#333\",\n fillColor: themeVariables?.mainBkg ?? \"#fff\"\n } : void 0;\n const markerId = `ishikawa-arrow-${id}`;\n if (!isHandDrawn) {\n g.append(\"defs\").append(\"marker\").attr(\"id\", markerId).attr(\"viewBox\", \"0 0 10 10\").attr(\"refX\", 0).attr(\"refY\", 5).attr(\"markerWidth\", 6).attr(\"markerHeight\", 6).attr(\"orient\", \"auto\").append(\"path\").attr(\"d\", \"M 10 0 L 0 5 L 10 10 Z\").attr(\"class\", \"ishikawa-arrow\");\n }\n let spineX = 0;\n let spineY = SPINE_BASE_LENGTH;\n const spineLine = isHandDrawn ? void 0 : drawLine(g, spineX, spineY, spineX, spineY, \"ishikawa-spine\");\n drawHead(g, spineX, spineY, root.text, fontSize, roughContext);\n if (!causes.length) {\n if (isHandDrawn) {\n drawLine(g, spineX, spineY, spineX, spineY, \"ishikawa-spine\", roughContext);\n }\n applyPaddedViewBox(svg, padding, useMaxWidth);\n return;\n }\n spineX -= 20;\n const upperCauses = causes.filter((_, i) => i % 2 === 0);\n const lowerCauses = causes.filter((_, i) => i % 2 === 1);\n const upperStats = sideStats(upperCauses);\n const lowerStats = sideStats(lowerCauses);\n const descendantTotal = upperStats.total + lowerStats.total;\n let upperLen = SPINE_BASE_LENGTH;\n let lowerLen = SPINE_BASE_LENGTH;\n if (descendantTotal > 0) {\n const pool = SPINE_BASE_LENGTH * 2;\n const minLen = SPINE_BASE_LENGTH * 0.3;\n upperLen = Math.max(minLen, pool * (upperStats.total / descendantTotal));\n lowerLen = Math.max(minLen, pool * (lowerStats.total / descendantTotal));\n }\n const minSpacing = fontSize * 2;\n upperLen = Math.max(upperLen, upperStats.max * minSpacing);\n lowerLen = Math.max(lowerLen, lowerStats.max * minSpacing);\n spineY = Math.max(upperLen, SPINE_BASE_LENGTH);\n if (spineLine) {\n spineLine.attr(\"y1\", spineY).attr(\"y2\", spineY);\n }\n g.select(\".ishikawa-head-group\").attr(\"transform\", `translate(0,${spineY})`);\n const pairCount = Math.ceil(causes.length / 2);\n for (let p = 0; p < pairCount; p++) {\n const pg = g.append(\"g\").attr(\"class\", \"ishikawa-pair\");\n for (const [cause, dir, len] of [\n [causes[p * 2], -1, upperLen],\n [causes[p * 2 + 1], 1, lowerLen]\n ]) {\n if (cause) {\n drawBranch(pg, cause, spineX, spineY, dir, len, fontSize, roughContext);\n }\n }\n spineX = pg.selectAll(\"text\").nodes().reduce((left, n) => Math.min(left, n.getBBox().x), Infinity);\n }\n if (isHandDrawn) {\n drawLine(g, spineX, spineY, 0, spineY, \"ishikawa-spine\", roughContext);\n } else {\n spineLine.attr(\"x1\", spineX);\n const markerUrl = `url(#${markerId})`;\n g.selectAll(\"line.ishikawa-branch, line.ishikawa-sub-branch\").attr(\"marker-start\", markerUrl);\n }\n applyPaddedViewBox(svg, padding, useMaxWidth);\n}, \"draw\");\nvar sideStats = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((nodes) => {\n const countDescendants = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((node) => node.children.reduce((sum, child) => sum + 1 + countDescendants(child), 0), \"countDescendants\");\n return nodes.reduce(\n (stats, node) => {\n const descendants = countDescendants(node);\n stats.total += descendants;\n stats.max = Math.max(stats.max, descendants);\n return stats;\n },\n { total: 0, max: 0 }\n );\n}, \"sideStats\");\nvar drawHead = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((svg, x, y, label, fontSize, roughContext) => {\n const maxChars = Math.max(6, Math.floor(110 / (fontSize * 0.6)));\n const headGroup = svg.append(\"g\").attr(\"class\", \"ishikawa-head-group\").attr(\"transform\", `translate(${x},${y})`);\n const textEl = drawMultilineText(\n headGroup,\n wrapText(label, maxChars),\n 0,\n 0,\n \"ishikawa-head-label\",\n \"start\",\n fontSize\n );\n const tb = textEl.node().getBBox();\n const w = Math.max(60, tb.width + 6);\n const h = Math.max(40, tb.height * 2 + 40);\n const headPath = `M 0 ${-h / 2} L 0 ${h / 2} Q ${w * 2.4} 0 0 ${-h / 2} Z`;\n if (roughContext) {\n const roughNode = roughContext.roughSvg.path(headPath, {\n roughness: 1.5,\n seed: roughContext.seed,\n fill: roughContext.fillColor,\n fillStyle: \"hachure\",\n fillWeight: 2.5,\n hachureGap: 5,\n stroke: roughContext.lineColor,\n strokeWidth: 2\n });\n headGroup.insert(() => roughNode, \":first-child\").attr(\"class\", \"ishikawa-head\");\n } else {\n headGroup.insert(\"path\", \":first-child\").attr(\"class\", \"ishikawa-head\").attr(\"d\", headPath);\n }\n textEl.attr(\"transform\", `translate(${(w - tb.width) / 2 - tb.x + 3},${-tb.y - tb.height / 2})`);\n}, \"drawHead\");\nvar flattenTree = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((children, direction) => {\n const entries = [];\n const yOrder = [];\n const walk = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((nodes, pid, depth) => {\n const ordered = direction === -1 ? [...nodes].reverse() : nodes;\n for (const child of ordered) {\n const idx = entries.length;\n const gc = child.children ?? [];\n entries.push({\n depth,\n text: wrapText(child.text, 15),\n parentIndex: pid,\n childCount: gc.length\n });\n if (depth % 2 === 0) {\n yOrder.push(idx);\n if (gc.length) {\n walk(gc, idx, depth + 1);\n }\n } else {\n if (gc.length) {\n walk(gc, idx, depth + 1);\n }\n yOrder.push(idx);\n }\n }\n }, \"walk\");\n walk(children, -1, 2);\n return { entries, yOrder };\n}, \"flattenTree\");\nvar drawCauseLabel = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((svg, text, x, y, direction, fontSize, roughContext) => {\n const lg = svg.append(\"g\").attr(\"class\", \"ishikawa-label-group\");\n const lt = drawMultilineText(\n lg,\n text,\n x,\n y + 11 * direction,\n \"ishikawa-label cause\",\n \"middle\",\n fontSize\n );\n const tb = lt.node().getBBox();\n if (roughContext) {\n const roughNode = roughContext.roughSvg.rectangle(\n tb.x - 20,\n tb.y - 2,\n tb.width + 40,\n tb.height + 4,\n {\n roughness: 1.5,\n seed: roughContext.seed,\n fill: roughContext.fillColor,\n fillStyle: \"hachure\",\n fillWeight: 2.5,\n hachureGap: 5,\n stroke: roughContext.lineColor,\n strokeWidth: 2\n }\n );\n lg.insert(() => roughNode, \":first-child\").attr(\"class\", \"ishikawa-label-box\");\n } else {\n lg.insert(\"rect\", \":first-child\").attr(\"class\", \"ishikawa-label-box\").attr(\"x\", tb.x - 20).attr(\"y\", tb.y - 2).attr(\"width\", tb.width + 40).attr(\"height\", tb.height + 4);\n }\n}, \"drawCauseLabel\");\nvar drawArrowMarker = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((g, x, y, dx, dy, roughContext) => {\n const len = Math.sqrt(dx * dx + dy * dy);\n if (len === 0) {\n return;\n }\n const ux = dx / len;\n const uy = dy / len;\n const s = 6;\n const px = -uy * s;\n const py = ux * s;\n const tipX = x;\n const tipY = y;\n const d = `M ${tipX} ${tipY} L ${tipX - ux * s * 2 + px} ${tipY - uy * s * 2 + py} L ${tipX - ux * s * 2 - px} ${tipY - uy * s * 2 - py} Z`;\n const roughNode = roughContext.roughSvg.path(d, {\n roughness: 1,\n seed: roughContext.seed,\n fill: roughContext.lineColor,\n fillStyle: \"solid\",\n stroke: roughContext.lineColor,\n strokeWidth: 1\n });\n g.append(() => roughNode);\n}, \"drawArrowMarker\");\nvar drawBranch = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((svg, node, startX, startY, direction, length, fontSize, roughContext) => {\n const children = node.children ?? [];\n const lineLen = length * (children.length ? 1 : 0.2);\n const dx = -COS_A * lineLen;\n const dy = SIN_A * lineLen * direction;\n const endX = startX + dx;\n const endY = startY + dy;\n drawLine(svg, startX, startY, endX, endY, \"ishikawa-branch\", roughContext);\n if (roughContext) {\n drawArrowMarker(svg, startX, startY, startX - endX, startY - endY, roughContext);\n }\n drawCauseLabel(svg, node.text, endX, endY, direction, fontSize, roughContext);\n if (!children.length) {\n return;\n }\n const { entries, yOrder } = flattenTree(children, direction);\n const entryCount = entries.length;\n const ys = new Array(entryCount);\n for (const [slot, entryIdx] of yOrder.entries()) {\n ys[entryIdx] = startY + dy * ((slot + 1) / (entryCount + 1));\n }\n const bones = /* @__PURE__ */ new Map();\n bones.set(-1, {\n x0: startX,\n y0: startY,\n x1: endX,\n y1: endY,\n childCount: children.length,\n childrenDrawn: 0\n });\n const diagonalX = -COS_A;\n const diagonalY = SIN_A * direction;\n const oddLabel = direction < 0 ? \"ishikawa-label up\" : \"ishikawa-label down\";\n for (const [i, e] of entries.entries()) {\n const y = ys[i];\n const par = bones.get(e.parentIndex);\n const grp = svg.append(\"g\").attr(\"class\", \"ishikawa-sub-group\");\n let bx0 = 0;\n let by0 = 0;\n let bx1 = 0;\n if (e.depth % 2 === 0) {\n const dyP = par.y1 - par.y0;\n bx0 = lerp(par.x0, par.x1, dyP ? (y - par.y0) / dyP : 0.5);\n by0 = y;\n bx1 = bx0 - (e.childCount > 0 ? BONE_BASE + e.childCount * BONE_PER_CHILD : BONE_STUB);\n drawLine(grp, bx0, y, bx1, y, \"ishikawa-sub-branch\", roughContext);\n if (roughContext) {\n drawArrowMarker(grp, bx0, y, 1, 0, roughContext);\n }\n drawMultilineText(grp, e.text, bx1, y, \"ishikawa-label align\", \"end\", fontSize);\n } else {\n const k = par.childrenDrawn++;\n bx0 = lerp(par.x0, par.x1, (par.childCount - k) / (par.childCount + 1));\n by0 = par.y0;\n bx1 = bx0 + diagonalX * ((y - by0) / diagonalY);\n drawLine(grp, bx0, by0, bx1, y, \"ishikawa-sub-branch\", roughContext);\n if (roughContext) {\n drawArrowMarker(grp, bx0, by0, bx0 - bx1, by0 - y, roughContext);\n }\n drawMultilineText(grp, e.text, bx1, y, oddLabel, \"end\", fontSize);\n }\n if (e.childCount > 0) {\n bones.set(i, {\n x0: bx0,\n y0: by0,\n x1: bx1,\n y1: y,\n childCount: e.childCount,\n childrenDrawn: 0\n });\n }\n }\n}, \"drawBranch\");\nvar splitLines = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((text) => text.split(/<br\\s*\\/?>|\\n/), \"splitLines\");\nvar wrapText = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((text, maxChars) => {\n if (text.length <= maxChars) {\n return text;\n }\n const lines = [];\n for (const word of text.split(/\\s+/)) {\n const last = lines.length - 1;\n if (last >= 0 && lines[last].length + 1 + word.length <= maxChars) {\n lines[last] += \" \" + word;\n } else {\n lines.push(word);\n }\n }\n return lines.join(\"\\n\");\n}, \"wrapText\");\nvar drawMultilineText = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((g, text, x, y, cls, anchor, fontSize) => {\n const lines = splitLines(text);\n const lh = fontSize * 1.05;\n const el = g.append(\"text\").attr(\"class\", cls).attr(\"text-anchor\", anchor).attr(\"x\", x).attr(\"y\", y - (lines.length - 1) * lh / 2);\n for (const [i, line] of lines.entries()) {\n el.append(\"tspan\").attr(\"x\", x).attr(\"dy\", i === 0 ? 0 : lh).text(line);\n }\n return el;\n}, \"drawMultilineText\");\nvar lerp = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((a, b, t) => a + (b - a) * t, \"lerp\");\nvar drawLine = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((g, x1, y1, x2, y2, cls, roughContext) => {\n if (roughContext) {\n const roughNode = roughContext.roughSvg.line(x1, y1, x2, y2, {\n roughness: 1.5,\n seed: roughContext.seed,\n stroke: roughContext.lineColor,\n strokeWidth: 2\n });\n g.append(() => roughNode).attr(\"class\", cls);\n return void 0;\n }\n return g.append(\"line\").attr(\"class\", cls).attr(\"x1\", x1).attr(\"y1\", y1).attr(\"x2\", x2).attr(\"y2\", y2);\n}, \"drawLine\");\nvar renderer = { draw };\n\n// src/diagrams/ishikawa/ishikawaStyles.ts\nvar getStyles = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((options) => `\n.ishikawa .ishikawa-spine,\n.ishikawa .ishikawa-branch,\n.ishikawa .ishikawa-sub-branch {\n stroke: ${options.lineColor};\n stroke-width: 2;\n fill: none;\n}\n\n.ishikawa .ishikawa-sub-branch {\n stroke-width: 1;\n}\n\n.ishikawa .ishikawa-arrow {\n fill: ${options.lineColor};\n}\n\n.ishikawa .ishikawa-head {\n fill: ${options.mainBkg};\n stroke: ${options.lineColor};\n stroke-width: 2;\n}\n\n.ishikawa .ishikawa-label-box {\n fill: ${options.mainBkg};\n stroke: ${options.lineColor};\n stroke-width: 2;\n}\n\n.ishikawa text {\n font-family: ${options.fontFamily};\n font-size: ${options.fontSize};\n fill: ${options.textColor};\n}\n\n.ishikawa .ishikawa-head-label {\n font-weight: 600;\n text-anchor: middle;\n dominant-baseline: middle;\n font-size: 14px;\n}\n\n.ishikawa .ishikawa-label {\n text-anchor: end;\n}\n\n.ishikawa .ishikawa-label.cause {\n text-anchor: middle;\n dominant-baseline: middle;\n}\n\n.ishikawa .ishikawa-label.align {\n text-anchor: end;\n dominant-baseline: middle;\n}\n\n.ishikawa .ishikawa-label.up {\n dominant-baseline: baseline;\n}\n\n.ishikawa .ishikawa-label.down {\n dominant-baseline: hanging;\n}\n`, \"getStyles\");\nvar ishikawaStyles_default = getStyles;\n\n// src/diagrams/ishikawa/ishikawaDiagram.ts\nvar diagram = {\n parser: ishikawa_default,\n get db() {\n return new IshikawaDB();\n },\n renderer,\n styles: ishikawaStyles_default\n};\n\n\n\n//# sourceURL=webpack://@mdts/frontend/./node_modules/mermaid/dist/chunks/mermaid.core/ishikawaDiagram-PHBUUO56.mjs?\n}");
|
|
19
|
+
|
|
20
|
+
/***/ }
|
|
21
|
+
|
|
22
|
+
}]);
|