"use strict";
/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] = self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] || []).push([["vendors-node_modules_mermaid_dist_chunks_mermaid_core_gitGraphDiagram-NY62KEGX_mjs"],{

/***/ "../node_modules/mermaid/dist/chunks/mermaid.core/chunk-4BX2VUAB.mjs":
/*!***************************************************************************!*\
  !*** ../node_modules/mermaid/dist/chunks/mermaid.core/chunk-4BX2VUAB.mjs ***!
  \***************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

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://_JUPYTERLAB.CORE_OUTPUT/../node_modules/mermaid/dist/chunks/mermaid.core/chunk-4BX2VUAB.mjs?");

/***/ }),

/***/ "../node_modules/mermaid/dist/chunks/mermaid.core/chunk-QZHKN3VN.mjs":
/*!***************************************************************************!*\
  !*** ../node_modules/mermaid/dist/chunks/mermaid.core/chunk-QZHKN3VN.mjs ***!
  \***************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

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://_JUPYTERLAB.CORE_OUTPUT/../node_modules/mermaid/dist/chunks/mermaid.core/chunk-QZHKN3VN.mjs?");

/***/ }),

/***/ "../node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-NY62KEGX.mjs":
/*!*************************************************************************************!*\
  !*** ../node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-NY62KEGX.mjs ***!
  \*************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

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_S3R3BYOJ_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./chunk-S3R3BYOJ.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.mjs\");\n/* harmony import */ var _chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./chunk-ABZYJK2D.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-ABZYJK2D.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_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.defaultConfig_default.gitGraph;\nvar getConfig3 = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_4__.__name)(() => {\n  const config = (0,_chunk_S3R3BYOJ_mjs__WEBPACK_IMPORTED_MODULE_2__.cleanAndMerge)({\n    ...DEFAULT_GITGRAPH_CONFIG,\n    ...(0,_chunk_ABZYJK2D_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 = getConfig3();\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_S3R3BYOJ_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 = getConfig3();\n  id = _chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(id, config);\n  msg = _chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(msg, config);\n  tags = tags?.map((tag) => _chunk_ABZYJK2D_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_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(name, getConfig3());\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 = getConfig3();\n  otherBranch = _chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(otherBranch, config);\n  if (customId) {\n    customId = _chunk_ABZYJK2D_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 = getConfig3();\n  sourceId = _chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(sourceId, config);\n  targetId = _chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(targetId, config);\n  tags = tags?.map((tag) => _chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(tag, config));\n  parentCommitId = _chunk_ABZYJK2D_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_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.common_default.sanitizeText(branch2, getConfig3());\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_ABZYJK2D_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: getConfig3,\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_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.setAccTitle,\n  getAccTitle: _chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.getAccTitle,\n  getAccDescription: _chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.getAccDescription,\n  setAccDescription: _chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.setAccDescription,\n  setDiagramTitle: _chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.setDiagramTitle,\n  getDiagramTitle: _chunk_ABZYJK2D_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      };\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      };\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 DEFAULT_CONFIG = (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.getConfig2)();\nvar DEFAULT_GITGRAPH_CONFIG2 = DEFAULT_CONFIG?.gitGraph;\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) => {\n  if (commit2.type !== commitType.CHERRY_PICK && (commit2.customId && commit2.type === commitType.MERGE || commit2.type !== commitType.MERGE) && DEFAULT_GITGRAPH_CONFIG2?.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 (DEFAULT_GITGRAPH_CONFIG2.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) => {\n  if (!DEFAULT_GITGRAPH_CONFIG2) {\n    throw new Error(\"GitGraph config not found\");\n  }\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 = DEFAULT_GITGRAPH_CONFIG2?.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);\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} ${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 {\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) => {\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 - (DEFAULT_GITGRAPH_CONFIG2?.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 - (DEFAULT_GITGRAPH_CONFIG2?.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  if (!DEFAULT_GITGRAPH_CONFIG2) {\n    throw new Error(\"GitGraph config not found\");\n  }\n  const rotateCommitLabel = DEFAULT_GITGRAPH_CONFIG2.rotateCommitLabel ?? false;\n  const db2 = diagObj.db;\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);\n  if (DEFAULT_GITGRAPH_CONFIG2.showBranches) {\n    drawBranches(diagram2, branches);\n  }\n  drawArrows(diagram2, allCommitsDict);\n  drawCommits(diagram2, allCommitsDict, true);\n  _chunk_S3R3BYOJ_mjs__WEBPACK_IMPORTED_MODULE_2__.utils_default.insertTitle(\n    diagram2,\n    \"gitTitleText\",\n    DEFAULT_GITGRAPH_CONFIG2.titleTopMargin ?? 0,\n    db2.getDiagramTitle()\n  );\n  (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_3__.setupGraphViewbox2)(\n    void 0,\n    diagram2,\n    DEFAULT_GITGRAPH_CONFIG2.diagramPadding,\n    DEFAULT_GITGRAPH_CONFIG2.useMaxWidth\n  );\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      DEFAULT_GITGRAPH_CONFIG2.parallelCommits = true;\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  DEFAULT_GITGRAPH_CONFIG2.parallelCommits = false;\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://_JUPYTERLAB.CORE_OUTPUT/../node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-NY62KEGX.mjs?");

/***/ })

}]);