@hamak/smart-data-dico 1.16.0 → 1.16.2

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.
Files changed (96) hide show
  1. package/backend/dist/server.mjs +178 -60
  2. package/frontend/dist/assets/{abnfDiagram-VRR7QNED-345e4d0b.js → abnfDiagram-VRR7QNED-c0490a6e.js} +1 -1
  3. package/frontend/dist/assets/{arc-6cdfdcfa.js → arc-d9f42f85.js} +1 -1
  4. package/frontend/dist/assets/architecture-TIHT7OUA-4924d329.js +1 -0
  5. package/frontend/dist/assets/{architectureDiagram-ZJ3FMSHR-841ff116.js → architectureDiagram-ZJ3FMSHR-8d36e612.js} +1 -1
  6. package/frontend/dist/assets/{blockDiagram-677ZJIJ3-313b3a0f.js → blockDiagram-677ZJIJ3-0dfc7866.js} +1 -1
  7. package/frontend/dist/assets/{c4Diagram-LMCZKHZV-ae7b5915.js → c4Diagram-LMCZKHZV-e41e8523.js} +1 -1
  8. package/frontend/dist/assets/channel-c1d35bcb.js +1 -0
  9. package/frontend/dist/assets/{chunk-2Q5K7J3B-9207ac62.js → chunk-2Q5K7J3B-f3d8fedd.js} +1 -1
  10. package/frontend/dist/assets/{chunk-32BRIVSS-2b813a7f.js → chunk-32BRIVSS-1d402c0b.js} +1 -1
  11. package/frontend/dist/assets/{chunk-5VM5RSS4-e13d9c38.js → chunk-5VM5RSS4-3f60ca61.js} +1 -1
  12. package/frontend/dist/assets/{chunk-EX3LRPZG-cf2858ae.js → chunk-EX3LRPZG-37fe45eb.js} +1 -1
  13. package/frontend/dist/assets/{chunk-JWPE2WC7-5963eae9.js → chunk-JWPE2WC7-76a6de0e.js} +1 -1
  14. package/frontend/dist/assets/{chunk-MOJQB5TN-8fed6f00.js → chunk-MOJQB5TN-7327a1f1.js} +1 -1
  15. package/frontend/dist/assets/{chunk-PUDLZKDR-f81b8d43.js → chunk-PUDLZKDR-cabf5348.js} +1 -1
  16. package/frontend/dist/assets/{chunk-RYQCIY6F-e7692d7b.js → chunk-RYQCIY6F-24c07994.js} +1 -1
  17. package/frontend/dist/assets/{chunk-V7JOEXUC-d0d95128.js → chunk-V7JOEXUC-502fa72d.js} +1 -1
  18. package/frontend/dist/assets/{chunk-VR4S4FIN-9b0b88a1.js → chunk-VR4S4FIN-3ba950bb.js} +1 -1
  19. package/frontend/dist/assets/{chunk-XXDRQBXY-ba3383f4.js → chunk-XXDRQBXY-88fe29af.js} +1 -1
  20. package/frontend/dist/assets/classDiagram-OUVF2IWQ-27576e4f.js +1 -0
  21. package/frontend/dist/assets/classDiagram-v2-EOCWNBFH-27576e4f.js +1 -0
  22. package/frontend/dist/assets/{cose-bilkent-JH36ORCC-f4424166.js → cose-bilkent-JH36ORCC-52fa9765.js} +1 -1
  23. package/frontend/dist/assets/cynefin-VYW2F7L2-0c62363f.js +1 -0
  24. package/frontend/dist/assets/{cynefinDiagram-TSTJHNR4-c7ea27ae.js → cynefinDiagram-TSTJHNR4-131f7eba.js} +1 -1
  25. package/frontend/dist/assets/{dagre-VKFMJZFB-e6ba6307.js → dagre-VKFMJZFB-2a0bf613.js} +1 -1
  26. package/frontend/dist/assets/{diagram-FQU43EPY-3c665615.js → diagram-FQU43EPY-1b097df7.js} +1 -1
  27. package/frontend/dist/assets/{diagram-G47NLZAW-ba4965ff.js → diagram-G47NLZAW-d6474bd9.js} +1 -1
  28. package/frontend/dist/assets/{diagram-NH7WQ7WH-d9819f03.js → diagram-NH7WQ7WH-b3062101.js} +1 -1
  29. package/frontend/dist/assets/{diagram-OA4YK3LP-2288500e.js → diagram-OA4YK3LP-1958e3d9.js} +1 -1
  30. package/frontend/dist/assets/{diagram-WEI45ONY-4da00136.js → diagram-WEI45ONY-6afaa8fe.js} +1 -1
  31. package/frontend/dist/assets/{ebnfDiagram-CCIWWBDH-6721fc43.js → ebnfDiagram-CCIWWBDH-963352a5.js} +1 -1
  32. package/frontend/dist/assets/{erDiagram-Q63AITRT-6bc74a60.js → erDiagram-Q63AITRT-0b6003d5.js} +1 -1
  33. package/frontend/dist/assets/eventmodeling-45OFAUF4-e83cff7f.js +1 -0
  34. package/frontend/dist/assets/flowDiagram-23GEKE2U-0ede15fe.js +1 -0
  35. package/frontend/dist/assets/{ganttDiagram-NO4QXBWP-7ad7eab1.js → ganttDiagram-NO4QXBWP-a63b16f9.js} +1 -1
  36. package/frontend/dist/assets/gitGraph-TEB2WS4Q-56023b8c.js +1 -0
  37. package/frontend/dist/assets/{gitGraphDiagram-IHSO6WYX-915b2424.js → gitGraphDiagram-IHSO6WYX-ec5c5a77.js} +1 -1
  38. package/frontend/dist/assets/{index-ca784d3e.js → index-4d3efe4a.js} +96 -95
  39. package/frontend/dist/assets/info-DKCQHKI2-c2315d52.js +1 -0
  40. package/frontend/dist/assets/{infoDiagram-FWYZ7A6U-a4208f32.js → infoDiagram-FWYZ7A6U-214dd53c.js} +1 -1
  41. package/frontend/dist/assets/{ishikawaDiagram-FXEZZL3T-bd0ba7d8.js → ishikawaDiagram-FXEZZL3T-3355d0be.js} +1 -1
  42. package/frontend/dist/assets/{journeyDiagram-5HDEW3XC-3e68c993.js → journeyDiagram-5HDEW3XC-5109afe4.js} +1 -1
  43. package/frontend/dist/assets/{kanban-definition-HUTT4EX6-7ed911fe.js → kanban-definition-HUTT4EX6-41b00580.js} +1 -1
  44. package/frontend/dist/assets/{linear-5d959d99.js → linear-79848c0f.js} +1 -1
  45. package/frontend/dist/assets/{mermaid-parser.core-47d17681.js → mermaid-parser.core-c86c44bd.js} +2 -2
  46. package/frontend/dist/assets/{mermaid.core-da5e1357.js → mermaid.core-691e4744.js} +3 -3
  47. package/frontend/dist/assets/{mindmap-definition-LN4V7U3C-e46495de.js → mindmap-definition-LN4V7U3C-bff7972b.js} +1 -1
  48. package/frontend/dist/assets/packet-7NZHBO7P-b99d2242.js +1 -0
  49. package/frontend/dist/assets/{pegDiagram-2B236MQR-7e56f05f.js → pegDiagram-2B236MQR-d5e34b29.js} +1 -1
  50. package/frontend/dist/assets/pie-RZYD4A2V-6a3c8030.js +1 -0
  51. package/frontend/dist/assets/{pieDiagram-ENE6RG2P-a43019cb.js → pieDiagram-ENE6RG2P-075c8079.js} +1 -1
  52. package/frontend/dist/assets/{quadrantDiagram-ABIIQ3AL-62345aac.js → quadrantDiagram-ABIIQ3AL-f280035e.js} +1 -1
  53. package/frontend/dist/assets/radar-I7S5WNFK-532ca393.js +1 -0
  54. package/frontend/dist/assets/railroad-3IZDKUUU-233adf29.js +1 -0
  55. package/frontend/dist/assets/railroad-abnf-AHOZXSZD-b83b8849.js +1 -0
  56. package/frontend/dist/assets/railroad-ebnf-EBAXGLYW-6a00e878.js +1 -0
  57. package/frontend/dist/assets/railroad-peg-LSFZ7HO6-1b27abdc.js +1 -0
  58. package/frontend/dist/assets/{railroadDiagram-RFXS5EU6-58fc57a1.js → railroadDiagram-RFXS5EU6-5320351a.js} +1 -1
  59. package/frontend/dist/assets/{requirementDiagram-TGXJPOKE-86bbc2ad.js → requirementDiagram-TGXJPOKE-300648c1.js} +1 -1
  60. package/frontend/dist/assets/{sankeyDiagram-HTMAVEWB-a4a9fa5e.js → sankeyDiagram-HTMAVEWB-71d6b478.js} +1 -1
  61. package/frontend/dist/assets/{sequenceDiagram-DBY2YBRQ-107c625d.js → sequenceDiagram-DBY2YBRQ-99c93da4.js} +1 -1
  62. package/frontend/dist/assets/{sizeCapture-X5ZJPWSS-9120b239.js → sizeCapture-X5ZJPWSS-c6e6c33c.js} +1 -1
  63. package/frontend/dist/assets/{stateDiagram-2N3HPSRC-86d8d1b7.js → stateDiagram-2N3HPSRC-4c6dc9f4.js} +1 -1
  64. package/frontend/dist/assets/stateDiagram-v2-6OUMAXLB-a5384039.js +1 -0
  65. package/frontend/dist/assets/{swimlanes-5IMT3BWC-bf7e8552.js → swimlanes-5IMT3BWC-a69b67a2.js} +1 -1
  66. package/frontend/dist/assets/swimlanesDiagram-G3AALYLV-23e7d95f.js +8 -0
  67. package/frontend/dist/assets/{timeline-definition-FHXFAJF6-142f766b.js → timeline-definition-FHXFAJF6-aaa0156e.js} +1 -1
  68. package/frontend/dist/assets/treeView-QDETBFTQ-d40c65b3.js +1 -0
  69. package/frontend/dist/assets/treemap-6X3UGDF4-fff72606.js +1 -0
  70. package/frontend/dist/assets/{vennDiagram-L72KCM5P-592701fb.js → vennDiagram-L72KCM5P-591b6dbf.js} +1 -1
  71. package/frontend/dist/assets/wardley-OPB4EBWU-9ead5b4c.js +1 -0
  72. package/frontend/dist/assets/{wardleyDiagram-EHGQE667-a01b3060.js → wardleyDiagram-EHGQE667-60af22ca.js} +1 -1
  73. package/frontend/dist/assets/{xychartDiagram-FW5EYKEG-e1de06fe.js → xychartDiagram-FW5EYKEG-dac7e9e6.js} +1 -1
  74. package/frontend/dist/index.html +1 -1
  75. package/package.json +2 -2
  76. package/frontend/dist/assets/architecture-TIHT7OUA-7e025e91.js +0 -1
  77. package/frontend/dist/assets/channel-668c2256.js +0 -1
  78. package/frontend/dist/assets/classDiagram-OUVF2IWQ-9bbf6f54.js +0 -1
  79. package/frontend/dist/assets/classDiagram-v2-EOCWNBFH-9bbf6f54.js +0 -1
  80. package/frontend/dist/assets/cynefin-VYW2F7L2-dc466e04.js +0 -1
  81. package/frontend/dist/assets/eventmodeling-45OFAUF4-9f0de2b1.js +0 -1
  82. package/frontend/dist/assets/flowDiagram-23GEKE2U-832a820a.js +0 -1
  83. package/frontend/dist/assets/gitGraph-TEB2WS4Q-4cf08115.js +0 -1
  84. package/frontend/dist/assets/info-DKCQHKI2-634496e2.js +0 -1
  85. package/frontend/dist/assets/packet-7NZHBO7P-69205dd0.js +0 -1
  86. package/frontend/dist/assets/pie-RZYD4A2V-4e4cffd5.js +0 -1
  87. package/frontend/dist/assets/radar-I7S5WNFK-8451de53.js +0 -1
  88. package/frontend/dist/assets/railroad-3IZDKUUU-35726752.js +0 -1
  89. package/frontend/dist/assets/railroad-abnf-AHOZXSZD-aeb23d40.js +0 -1
  90. package/frontend/dist/assets/railroad-ebnf-EBAXGLYW-c13df05d.js +0 -1
  91. package/frontend/dist/assets/railroad-peg-LSFZ7HO6-4194648a.js +0 -1
  92. package/frontend/dist/assets/stateDiagram-v2-6OUMAXLB-99836850.js +0 -1
  93. package/frontend/dist/assets/swimlanesDiagram-G3AALYLV-f1b3226d.js +0 -8
  94. package/frontend/dist/assets/treeView-QDETBFTQ-4c7da9ed.js +0 -1
  95. package/frontend/dist/assets/treemap-6X3UGDF4-870159d1.js +0 -1
  96. package/frontend/dist/assets/wardley-OPB4EBWU-5bac06e4.js +0 -1
@@ -38675,11 +38675,11 @@ var require_src6 = __commonJS({
38675
38675
  }
38676
38676
  }
38677
38677
  __name(check2, "check");
38678
- function exists2(path22, type = exports2.READABLE) {
38678
+ function exists3(path22, type = exports2.READABLE) {
38679
38679
  return check2(path22, (type & exports2.FILE) > 0, (type & exports2.FOLDER) > 0);
38680
38680
  }
38681
- __name(exists2, "exists");
38682
- exports2.exists = exists2;
38681
+ __name(exists3, "exists");
38682
+ exports2.exists = exists3;
38683
38683
  exports2.FILE = 1;
38684
38684
  exports2.FOLDER = 2;
38685
38685
  exports2.READABLE = exports2.FILE + exports2.FOLDER;
@@ -149159,10 +149159,10 @@ var require_sync = __commonJS({
149159
149159
  }
149160
149160
  };
149161
149161
  GlobSync.prototype._processSimple = function(prefix, index) {
149162
- var exists2 = this._stat(prefix);
149162
+ var exists3 = this._stat(prefix);
149163
149163
  if (!this.matches[index])
149164
149164
  this.matches[index] = /* @__PURE__ */ Object.create(null);
149165
- if (!exists2)
149165
+ if (!exists3)
149166
149166
  return;
149167
149167
  if (prefix && isAbsolute(prefix) && !this.nomount) {
149168
149168
  var trail = /[\/\\]$/.test(prefix);
@@ -149192,7 +149192,7 @@ var require_sync = __commonJS({
149192
149192
  if (needDir && c === "FILE")
149193
149193
  return false;
149194
149194
  }
149195
- var exists2;
149195
+ var exists3;
149196
149196
  var stat = this.statCache[abs];
149197
149197
  if (!stat) {
149198
149198
  var lstat;
@@ -149835,14 +149835,14 @@ var require_glob = __commonJS({
149835
149835
  };
149836
149836
  Glob.prototype._processSimple = function(prefix, index, cb) {
149837
149837
  var self2 = this;
149838
- this._stat(prefix, function(er, exists2) {
149839
- self2._processSimple2(prefix, index, er, exists2, cb);
149838
+ this._stat(prefix, function(er, exists3) {
149839
+ self2._processSimple2(prefix, index, er, exists3, cb);
149840
149840
  });
149841
149841
  };
149842
- Glob.prototype._processSimple2 = function(prefix, index, er, exists2, cb) {
149842
+ Glob.prototype._processSimple2 = function(prefix, index, er, exists3, cb) {
149843
149843
  if (!this.matches[index])
149844
149844
  this.matches[index] = /* @__PURE__ */ Object.create(null);
149845
- if (!exists2)
149845
+ if (!exists3)
149846
149846
  return cb();
149847
149847
  if (prefix && isAbsolute(prefix) && !this.nomount) {
149848
149848
  var trail = /[\/\\]$/.test(prefix);
@@ -149873,7 +149873,7 @@ var require_glob = __commonJS({
149873
149873
  if (needDir && c === "FILE")
149874
149874
  return cb();
149875
149875
  }
149876
- var exists2;
149876
+ var exists3;
149877
149877
  var stat = this.statCache[abs];
149878
149878
  if (stat !== void 0) {
149879
149879
  if (stat === false)
@@ -171348,10 +171348,15 @@ var columnId = /* @__PURE__ */ __name((t, c) => `attribute:${t}.${c}`, "columnId
171348
171348
  var uniq = /* @__PURE__ */ __name((a) => [...new Set(a)], "uniq");
171349
171349
  function extractRepoCir(repo, progress, label2) {
171350
171350
  const tag = /* @__PURE__ */ __name((s) => label2 ? `[${label2}] ${s}` : s, "tag");
171351
+ const warnings = [];
171352
+ const lbl = label2 ? `${label2}: ` : "";
171351
171353
  const repoRoot = path15.resolve(repo.repoRoot);
171352
171354
  const masterAbs = path15.isAbsolute(repo.changelog) ? repo.changelog : path15.join(repoRoot, repo.changelog);
171355
+ if (!fs8.existsSync(repoRoot)) warnings.push(`${lbl}repository path not found: ${repoRoot}`);
171356
+ else if (!fs8.existsSync(masterAbs)) warnings.push(`${lbl}changelog not found: ${repo.changelog}`);
171353
171357
  progress({ stage: "liquibase", status: "start", detail: tag("parsing changelog") });
171354
171358
  const changeSets = loadChangelog(masterAbs, repoRoot);
171359
+ if (fs8.existsSync(masterAbs) && changeSets.length === 0) warnings.push(`${lbl}no changeSets parsed from ${repo.changelog} \u2014 check the format/includes`);
171355
171360
  progress({ stage: "liquibase", status: "done", count: changeSets.length, detail: tag(`${changeSets.length} changeSets`) });
171356
171361
  const hasGit = gitAvailable(repoRoot);
171357
171362
  const elements = /* @__PURE__ */ new Map();
@@ -171492,13 +171497,14 @@ function extractRepoCir(repo, progress, label2) {
171492
171497
  const prov = /* @__PURE__ */ __name(() => ({ source: "jpa", ref: rel, commit: commit?.sha, ticket: commit?.tickets?.[0], author: commit?.author }), "prov");
171493
171498
  jpaElements.push(...extractJpa(fs8.readFileSync(file2, "utf-8"), { fileRel: rel, provenance: prov }));
171494
171499
  }
171500
+ if (jpaFiles === 0) warnings.push(`${lbl}no .java files found under ${repo.srcDir} \u2014 JPA drift skipped`);
171495
171501
  progress({ stage: "jpa", status: "done", count: jpaFiles, detail: tag(`${jpaFiles} Java files`) });
171496
171502
  progress({ stage: "drift", status: "start", detail: tag("") });
171497
171503
  drift = mergeJpa(elements, jpaElements);
171498
171504
  progress({ stage: "drift", status: "done", count: drift.length, detail: tag(`${drift.length} findings`) });
171499
171505
  }
171500
171506
  if (label2) for (const el of elements.values()) el.repos = [label2];
171501
- return { label: label2, repoRoot, elements, events, drift, tickets: allTickets, withCommit, changeSets: changeSets.length, jpaFiles };
171507
+ return { label: label2, repoRoot, elements, events, drift, tickets: allTickets, withCommit, changeSets: changeSets.length, jpaFiles, warnings };
171502
171508
  }
171503
171509
  __name(extractRepoCir, "extractRepoCir");
171504
171510
  function combineRepos(parts) {
@@ -171508,6 +171514,7 @@ function combineRepos(parts) {
171508
171514
  const drift = [];
171509
171515
  const tickets = /* @__PURE__ */ new Set();
171510
171516
  const conflicts2 = [];
171517
+ const warnings = [];
171511
171518
  let withCommit = 0, changeSets = 0, jpaFiles = 0;
171512
171519
  const addRepo = /* @__PURE__ */ __name((id, label2) => (reposById.get(id) ?? reposById.set(id, /* @__PURE__ */ new Set()).get(id)).add(label2), "addRepo");
171513
171520
  const maxLen2 = /* @__PURE__ */ __name((el) => el.facts.validation?.maxLength, "maxLen");
@@ -171515,6 +171522,7 @@ function combineRepos(parts) {
171515
171522
  events.push(...p.events);
171516
171523
  drift.push(...p.drift);
171517
171524
  p.tickets.forEach((t) => tickets.add(t));
171525
+ warnings.push(...p.warnings);
171518
171526
  withCommit += p.withCommit;
171519
171527
  changeSets += p.changeSets;
171520
171528
  jpaFiles += p.jpaFiles;
@@ -171563,12 +171571,13 @@ function combineRepos(parts) {
171563
171571
  }
171564
171572
  }
171565
171573
  const report = { repos: parts.map((p) => p.label), sharedEntities, conflicts: conflicts2, crossRepoRelationships, danglingReferences };
171566
- const cir = { label: `multi(${parts.length})`, repoRoot: parts.map((p) => p.repoRoot).join(", "), elements, events, drift, tickets, withCommit, changeSets, jpaFiles };
171574
+ const cir = { label: `multi(${parts.length})`, repoRoot: parts.map((p) => p.repoRoot).join(", "), elements, events, drift, tickets, withCommit, changeSets, jpaFiles, warnings };
171567
171575
  return { cir, report };
171568
171576
  }
171569
171577
  __name(combineRepos, "combineRepos");
171570
171578
  async function finalize2(cir, opts, progress, crossRepo) {
171571
171579
  const allTickets = cir.tickets;
171580
+ const warnings = [...cir.warnings];
171572
171581
  let jiraIssues = 0;
171573
171582
  let jiraIssueMap = /* @__PURE__ */ new Map();
171574
171583
  if (opts.jira?.baseUrl && opts.jira.enabled !== false && allTickets.size > 0) {
@@ -171577,8 +171586,11 @@ async function finalize2(cir, opts, progress, crossRepo) {
171577
171586
  attachJira(cir.elements.values(), enriched.issues);
171578
171587
  jiraIssues = enriched.issues.size;
171579
171588
  jiraIssueMap = enriched.issues;
171580
- for (const e of enriched.errors) process.stderr.write(`[jira] ${e.key}: ${e.error}
171589
+ for (const e of enriched.errors) {
171590
+ process.stderr.write(`[jira] ${e.key}: ${e.error}
171581
171591
  `);
171592
+ warnings.push(`Jira ${e.key}: ${e.error}`);
171593
+ }
171582
171594
  progress({ stage: "jira", status: "done", count: jiraIssues, detail: `${jiraIssues} issues` });
171583
171595
  }
171584
171596
  let confluencePages = 0;
@@ -171586,8 +171598,11 @@ async function finalize2(cir, opts, progress, crossRepo) {
171586
171598
  progress({ stage: "confluence", status: "start", detail: `dumping space ${opts.confluence.spaceKey}` });
171587
171599
  const dump = await dumpConfluenceSpace(opts.confluence, { outDir: opts.out });
171588
171600
  confluencePages = dump.pages.length;
171589
- for (const e of dump.errors) process.stderr.write(`[confluence] ${e}
171601
+ for (const e of dump.errors) {
171602
+ process.stderr.write(`[confluence] ${e}
171590
171603
  `);
171604
+ warnings.push(`Confluence: ${e}`);
171605
+ }
171591
171606
  progress({ stage: "confluence", status: "done", count: confluencePages, detail: `${confluencePages} pages` });
171592
171607
  }
171593
171608
  const model = [...cir.elements.values()];
@@ -171613,7 +171628,8 @@ async function finalize2(cir, opts, progress, crossRepo) {
171613
171628
  progress({ stage: "synthesize", status: "done", count: r.briefs, detail: `${r.briefs} briefs (${opts.synthesis.mode})` });
171614
171629
  }
171615
171630
  }
171616
- progress({ stage: "done", status: "done", detail: `${model.length} elements` });
171631
+ if (model.length === 0) warnings.push("No model elements were extracted \u2014 check the repository path and changelog location.");
171632
+ progress({ stage: "done", status: "done", detail: `${model.length} elements${warnings.length ? `, ${warnings.length} warning(s)` : ""}` });
171617
171633
  return {
171618
171634
  summary: {
171619
171635
  elements: model.length,
@@ -171639,7 +171655,8 @@ async function finalize2(cir, opts, progress, crossRepo) {
171639
171655
  elements: model,
171640
171656
  events: cir.events,
171641
171657
  drift: cir.drift,
171642
- crossRepo
171658
+ crossRepo,
171659
+ warnings
171643
171660
  };
171644
171661
  }
171645
171662
  __name(finalize2, "finalize");
@@ -171692,35 +171709,69 @@ import path16 from "path";
171692
171709
  var import_yaml6 = __toESM(require_dist(), 1);
171693
171710
  var xml = new XMLParser({ ignoreAttributes: false, attributeNamePrefix: "@_", parseAttributeValue: false, isArray: /* @__PURE__ */ __name((n) => ["module", "plugin", "profile", "execution"].includes(n), "isArray") });
171694
171711
  var toArr = /* @__PURE__ */ __name((v) => v == null ? [] : Array.isArray(v) ? v : [v], "toArr");
171695
- function readPom(dir) {
171712
+ async function exists2(p) {
171713
+ try {
171714
+ await fs9.promises.access(p);
171715
+ return true;
171716
+ } catch {
171717
+ return false;
171718
+ }
171719
+ }
171720
+ __name(exists2, "exists");
171721
+ async function readPom(dir) {
171696
171722
  const p = path16.join(dir, "pom.xml");
171697
- if (!fs9.existsSync(p)) return void 0;
171698
171723
  try {
171699
- return xml.parse(fs9.readFileSync(p, "utf-8"))?.project;
171724
+ return xml.parse(await fs9.promises.readFile(p, "utf-8"))?.project;
171700
171725
  } catch {
171701
171726
  return void 0;
171702
171727
  }
171703
171728
  }
171704
171729
  __name(readPom, "readPom");
171705
- function reactorModules(root) {
171730
+ async function reactorModules(root) {
171706
171731
  const seen = /* @__PURE__ */ new Set();
171707
171732
  const out = [];
171708
- const visit2 = /* @__PURE__ */ __name((dir) => {
171733
+ const visit2 = /* @__PURE__ */ __name(async (dir) => {
171709
171734
  const real = path16.resolve(dir);
171710
171735
  if (seen.has(real)) return;
171711
171736
  seen.add(real);
171712
- const pom = readPom(real);
171737
+ const pom = await readPom(real);
171713
171738
  if (!pom) return;
171714
171739
  out.push(real);
171715
171740
  for (const m of toArr(pom.modules?.module)) {
171716
171741
  const target = path16.join(real, String(m));
171717
- visit2(fs9.existsSync(path16.join(target, "pom.xml")) ? target : path16.dirname(target));
171742
+ await visit2(await exists2(path16.join(target, "pom.xml")) ? target : path16.dirname(target));
171718
171743
  }
171719
171744
  }, "visit");
171720
- visit2(root);
171745
+ await visit2(root);
171721
171746
  return out;
171722
171747
  }
171723
171748
  __name(reactorModules, "reactorModules");
171749
+ var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", "target", "dist", "build", ".git", ".idea", ".vscode"]);
171750
+ async function findProjectRoots(root, maxDepth = 4) {
171751
+ if (await exists2(path16.join(root, "pom.xml"))) return [root];
171752
+ const roots = [];
171753
+ const visit2 = /* @__PURE__ */ __name(async (dir, depth) => {
171754
+ if (await exists2(path16.join(dir, "pom.xml"))) {
171755
+ roots.push(dir);
171756
+ return;
171757
+ }
171758
+ if (depth >= maxDepth) return;
171759
+ let entries;
171760
+ try {
171761
+ entries = await fs9.promises.readdir(dir, { withFileTypes: true });
171762
+ } catch {
171763
+ return;
171764
+ }
171765
+ for (const e of entries) {
171766
+ if (!e.isDirectory()) continue;
171767
+ if (SKIP_DIRS.has(e.name) || e.name.startsWith(".")) continue;
171768
+ await visit2(path16.join(dir, e.name), depth + 1);
171769
+ }
171770
+ }, "visit");
171771
+ await visit2(root, 0);
171772
+ return roots.sort();
171773
+ }
171774
+ __name(findProjectRoots, "findProjectRoots");
171724
171775
  var RESOURCE_ROOTS = ["src/main/resources", "src/test/resources"];
171725
171776
  var isTestPath = /* @__PURE__ */ __name((p) => /(^|\/)src\/test\//.test(p) || /(^|\/)test(s)?\//.test(p), "isTestPath");
171726
171777
  function resolveValue(value, moduleDir) {
@@ -171738,12 +171789,11 @@ function fmtOf(p) {
171738
171789
  return "yaml";
171739
171790
  }
171740
171791
  __name(fmtOf, "fmtOf");
171741
- function validate2(absPath) {
171792
+ async function validate2(absPath) {
171742
171793
  const format = fmtOf(absPath);
171743
- if (!fs9.existsSync(absPath)) return { valid: false, format };
171744
171794
  let body;
171745
171795
  try {
171746
- body = fs9.readFileSync(absPath, "utf-8");
171796
+ body = await fs9.promises.readFile(absPath, "utf-8");
171747
171797
  } catch {
171748
171798
  return { valid: false, format };
171749
171799
  }
@@ -171758,10 +171808,15 @@ function validate2(absPath) {
171758
171808
  }
171759
171809
  __name(validate2, "validate");
171760
171810
  var PROP_FILE_NAMES = ["liquibase.properties"];
171761
- function readProperty(file2, key2) {
171762
- if (!fs9.existsSync(file2)) return void 0;
171811
+ async function readProperty(file2, key2) {
171812
+ let body;
171813
+ try {
171814
+ body = await fs9.promises.readFile(file2, "utf-8");
171815
+ } catch {
171816
+ return void 0;
171817
+ }
171763
171818
  const re2 = new RegExp(`^\\s*${key2}\\s*[=:]\\s*(.+?)\\s*$`, "im");
171764
- return fs9.readFileSync(file2, "utf-8").match(re2)?.[1]?.replace(/^["']|["']$/g, "");
171819
+ return body.match(re2)?.[1]?.replace(/^["']|["']$/g, "");
171765
171820
  }
171766
171821
  __name(readProperty, "readProperty");
171767
171822
  function findLiquibasePlugin(pom) {
@@ -171782,26 +171837,32 @@ var CONVENTION = [
171782
171837
  { re: /(^|\/)db\.changelog-root\.(ya?ml|xml|json|sql)$/i, score: 0.68 },
171783
171838
  { re: /(^|\/)(master|changelog)\.(xml|ya?ml|json)$/i, score: 0.55 }
171784
171839
  ];
171785
- function scanConvention(moduleDir) {
171840
+ async function scanConvention(moduleDir) {
171786
171841
  const found = [];
171787
- const walk = /* @__PURE__ */ __name((dir, depth) => {
171788
- if (depth > 8 || !fs9.existsSync(dir)) return;
171789
- for (const e of fs9.readdirSync(dir, { withFileTypes: true })) {
171842
+ const walk = /* @__PURE__ */ __name(async (dir, depth) => {
171843
+ if (depth > 8) return;
171844
+ let entries;
171845
+ try {
171846
+ entries = await fs9.promises.readdir(dir, { withFileTypes: true });
171847
+ } catch {
171848
+ return;
171849
+ }
171850
+ for (const e of entries) {
171790
171851
  if (e.name === "node_modules" || e.name === "target" || e.name.startsWith(".")) continue;
171791
171852
  const full = path16.join(dir, e.name);
171792
- if (e.isDirectory()) walk(full, depth + 1);
171853
+ if (e.isDirectory()) await walk(full, depth + 1);
171793
171854
  else for (const c of CONVENTION) if (c.re.test(full.replace(/\\/g, "/"))) {
171794
171855
  found.push({ abs: full, score: c.score });
171795
171856
  break;
171796
171857
  }
171797
171858
  }
171798
171859
  }, "walk");
171799
- for (const r of RESOURCE_ROOTS) walk(path16.join(moduleDir, r), 0);
171860
+ for (const r of RESOURCE_ROOTS) await walk(path16.join(moduleDir, r), 0);
171800
171861
  return found;
171801
171862
  }
171802
171863
  __name(scanConvention, "scanConvention");
171803
- function detectInModule(moduleDir, label2, projectRoot, warnings) {
171804
- const pom = readPom(moduleDir);
171864
+ async function detectInModule(moduleDir, label2, projectRoot, warnings) {
171865
+ const pom = await readPom(moduleDir);
171805
171866
  const raw = [];
171806
171867
  const plugin = pom ? findLiquibasePlugin(pom) : void 0;
171807
171868
  if (plugin) {
@@ -171811,34 +171872,36 @@ function detectInModule(moduleDir, label2, projectRoot, warnings) {
171811
171872
  const propFile = cfg.propertyFile;
171812
171873
  if (propFile) {
171813
171874
  const pf = path16.isAbsolute(String(propFile)) ? String(propFile) : path16.join(moduleDir, String(propFile));
171814
- const clf = readProperty(pf, "changeLogFile");
171875
+ const clf = await readProperty(pf, "changeLogFile");
171815
171876
  if (clf) for (const abs of resolveValue(clf, moduleDir)) raw.push({ abs, by: "plugin", conf: 0.92 });
171816
171877
  }
171817
171878
  }
171818
171879
  }
171819
171880
  for (const base of ["", ...RESOURCE_ROOTS]) for (const name21 of PROP_FILE_NAMES) {
171820
- const clf = readProperty(path16.join(moduleDir, base, name21), "changeLogFile");
171881
+ const clf = await readProperty(path16.join(moduleDir, base, name21), "changeLogFile");
171821
171882
  if (clf) for (const abs of resolveValue(clf, moduleDir)) raw.push({ abs, by: "liquibase.properties", conf: 0.9 });
171822
171883
  }
171823
- for (const { abs, score } of scanConvention(moduleDir)) raw.push({ abs, by: "convention", conf: score });
171884
+ for (const { abs, score } of await scanConvention(moduleDir)) raw.push({ abs, by: "convention", conf: score });
171824
171885
  const byPath = /* @__PURE__ */ new Map();
171825
171886
  for (const r of raw) {
171826
171887
  const ex = byPath.get(r.abs);
171827
171888
  if (!ex || r.conf > ex.conf) byPath.set(r.abs, { by: r.by, conf: r.conf });
171828
171889
  }
171829
171890
  const srcMain = path16.join(moduleDir, "src/main/java");
171891
+ const srcExists = await exists2(srcMain);
171830
171892
  const out = [];
171831
171893
  for (const [abs, { by, conf }] of byPath) {
171832
- const v = validate2(abs);
171894
+ const v = await validate2(abs);
171833
171895
  if (!v.valid) continue;
171834
171896
  const isTest = isTestPath(abs);
171835
171897
  if (v.sqlUnsupported) warnings.push(`${label2}: ${path16.relative(projectRoot, abs)} is a SQL-formatted changelog \u2014 detected, but the SQL loader adapter is not implemented yet.`);
171836
171898
  out.push({
171837
171899
  module: label2,
171838
171900
  moduleDir,
171901
+ repoRoot: projectRoot,
171839
171902
  changelogAbs: abs,
171840
171903
  changelog: path16.relative(projectRoot, abs),
171841
- srcDir: fs9.existsSync(srcMain) ? path16.relative(projectRoot, srcMain) : void 0,
171904
+ srcDir: srcExists ? path16.relative(projectRoot, srcMain) : void 0,
171842
171905
  detectedBy: by,
171843
171906
  confidence: isTest ? conf * 0.4 : conf,
171844
171907
  isTest,
@@ -171849,23 +171912,54 @@ function detectInModule(moduleDir, label2, projectRoot, warnings) {
171849
171912
  return out.sort((a, b) => b.confidence - a.confidence);
171850
171913
  }
171851
171914
  __name(detectInModule, "detectInModule");
171852
- function detectMaven(projectRoot) {
171853
- const root = path16.resolve(projectRoot);
171915
+ async function* detectMavenStream(scanRoot) {
171916
+ const root = path16.resolve(scanRoot);
171854
171917
  const warnings = [];
171855
- if (!fs9.existsSync(path16.join(root, "pom.xml"))) {
171856
- return { projectRoot: root, modules: 0, candidates: [], warnings: ["No pom.xml at the project root \u2014 not a Maven project."] };
171857
- }
171858
- const modules = reactorModules(root);
171918
+ const projectRoots = await findProjectRoots(root);
171919
+ if (!projectRoots.length) {
171920
+ const w = `No Maven project (pom.xml) found at or under ${root}.`;
171921
+ warnings.push(w);
171922
+ yield { type: "warning", message: w };
171923
+ return { projectRoot: root, projects: 0, modules: 0, candidates: [], warnings };
171924
+ }
171925
+ const multiProject = projectRoots.length > 1;
171859
171926
  const candidates = [];
171860
- for (const dir of modules) {
171861
- const pom = readPom(dir);
171862
- const label2 = pom?.artifactId ?? path16.basename(dir);
171863
- const found = detectInModule(dir, label2, root, warnings);
171864
- if (found.length) candidates.push(...found.filter((c) => c.confidence >= found[0].confidence - 0.15));
171927
+ let moduleCount = 0;
171928
+ for (let pi = 0; pi < projectRoots.length; pi++) {
171929
+ const pr = projectRoots[pi];
171930
+ yield { type: "project", project: path16.basename(pr), path: pr, index: pi + 1, total: projectRoots.length };
171931
+ const modules = await reactorModules(pr);
171932
+ moduleCount += modules.length;
171933
+ for (const dir of modules) {
171934
+ const pom = await readPom(dir);
171935
+ const artifactId = pom?.artifactId ?? path16.basename(dir);
171936
+ const label2 = multiProject ? `${path16.basename(pr)}/${artifactId}` : artifactId;
171937
+ yield { type: "module", module: label2, project: path16.basename(pr) };
171938
+ const before = warnings.length;
171939
+ const found = await detectInModule(dir, label2, pr, warnings);
171940
+ for (let i = before; i < warnings.length; i++) yield { type: "warning", message: warnings[i] };
171941
+ if (found.length) {
171942
+ const kept = found.filter((c) => c.confidence >= found[0].confidence - 0.15);
171943
+ candidates.push(...kept);
171944
+ for (const c of kept) yield { type: "candidate", candidate: c };
171945
+ }
171946
+ }
171865
171947
  }
171866
171948
  candidates.sort((a, b) => b.confidence - a.confidence);
171867
- if (!candidates.length) warnings.push(`No Liquibase changelog detected across ${modules.length} module(s). Looked at liquibase-maven-plugin config, liquibase.properties, and db/changelog conventions under src/main|test/resources.`);
171868
- return { projectRoot: root, modules: modules.length, candidates, warnings };
171949
+ if (!candidates.length) {
171950
+ const scope = multiProject ? `${projectRoots.length} project(s), ${moduleCount} module(s)` : `${moduleCount} module(s)`;
171951
+ const w = `No Liquibase changelog detected across ${scope}. Looked at liquibase-maven-plugin config, liquibase.properties, and db/changelog conventions under src/main|test/resources.`;
171952
+ warnings.push(w);
171953
+ yield { type: "warning", message: w };
171954
+ }
171955
+ return { projectRoot: root, projects: projectRoots.length, modules: moduleCount, candidates, warnings };
171956
+ }
171957
+ __name(detectMavenStream, "detectMavenStream");
171958
+ async function detectMaven(scanRoot) {
171959
+ const gen = detectMavenStream(scanRoot);
171960
+ let r = await gen.next();
171961
+ while (!r.done) r = await gen.next();
171962
+ return r.value;
171869
171963
  }
171870
171964
  __name(detectMaven, "detectMaven");
171871
171965
  function detectionToPlan(result, opts = {}) {
@@ -171876,7 +171970,7 @@ function detectionToPlan(result, opts = {}) {
171876
171970
  const ex = bestPerModule.get(c.module);
171877
171971
  if (!ex || c.confidence > ex.confidence) bestPerModule.set(c.module, c);
171878
171972
  }
171879
- return [...bestPerModule.values()].map((c) => ({ name: c.module, repoRoot: result.projectRoot, changelog: c.changelog, srcDir: c.srcDir }));
171973
+ return [...bestPerModule.values()].map((c) => ({ name: c.module, repoRoot: c.repoRoot, changelog: c.changelog, srcDir: c.srcDir }));
171880
171974
  }
171881
171975
  __name(detectionToPlan, "detectionToPlan");
171882
171976
 
@@ -171955,17 +172049,40 @@ var reverseEngineerRunStream = /* @__PURE__ */ __name(async (req, res) => {
171955
172049
  res.end();
171956
172050
  }
171957
172051
  }, "reverseEngineerRunStream");
171958
- var detectMavenChangelogs = /* @__PURE__ */ __name((req, res) => {
172052
+ var detectMavenChangelogs = /* @__PURE__ */ __name(async (req, res) => {
171959
172053
  if (!localOnly(res)) return;
171960
172054
  const { repoRoot, includeTest } = req.body ?? {};
171961
172055
  if (!repoRoot || typeof repoRoot !== "string") return res.status(400).json({ message: "repoRoot (string) is required" });
171962
172056
  try {
171963
- const result = detectMaven(repoRoot);
172057
+ const result = await detectMaven(repoRoot);
171964
172058
  res.json({ data: { ...result, plan: detectionToPlan(result, { includeTest: includeTest === true }) } });
171965
172059
  } catch (err) {
171966
172060
  res.status(422).json({ message: "Detection failed", error: err instanceof Error ? err.message : String(err) });
171967
172061
  }
171968
172062
  }, "detectMavenChangelogs");
172063
+ var detectMavenChangelogsStream = /* @__PURE__ */ __name(async (req, res) => {
172064
+ if (!localOnly(res)) return;
172065
+ const { repoRoot, includeTest } = req.body ?? {};
172066
+ if (!repoRoot || typeof repoRoot !== "string") return res.status(400).json({ message: "repoRoot (string) is required" });
172067
+ res.setHeader("Content-Type", "application/x-ndjson");
172068
+ res.setHeader("Cache-Control", "no-cache, no-transform");
172069
+ res.setHeader("X-Accel-Buffering", "no");
172070
+ const write = /* @__PURE__ */ __name((o) => res.write(JSON.stringify(o) + "\n"), "write");
172071
+ try {
172072
+ const gen = detectMavenStream(repoRoot);
172073
+ let r = await gen.next();
172074
+ while (!r.done) {
172075
+ write(r.value);
172076
+ r = await gen.next();
172077
+ }
172078
+ const result = r.value;
172079
+ write({ type: "result", data: { ...result, plan: detectionToPlan(result, { includeTest: includeTest === true }) } });
172080
+ } catch (err) {
172081
+ write({ type: "error", error: err instanceof Error ? err.message : String(err) });
172082
+ } finally {
172083
+ res.end();
172084
+ }
172085
+ }, "detectMavenChangelogsStream");
171969
172086
  var jiraGetConfig = /* @__PURE__ */ __name((_req, res) => {
171970
172087
  const cfg = getConfigSection("jira");
171971
172088
  res.json({
@@ -172112,6 +172229,7 @@ var ADMIN = authorizeJwt(["admin" /* ADMIN */]);
172112
172229
  router29.post("/api/reverse-engineer/run", WRITE2, reverseEngineerRun);
172113
172230
  router29.post("/api/reverse-engineer/run-stream", WRITE2, reverseEngineerRunStream);
172114
172231
  router29.post("/api/reverse-engineer/detect", WRITE2, detectMavenChangelogs);
172232
+ router29.post("/api/reverse-engineer/detect-stream", WRITE2, detectMavenChangelogsStream);
172115
172233
  router29.get("/api/reverse-engineer/jira-config", ADMIN, jiraGetConfig);
172116
172234
  router29.post("/api/reverse-engineer/jira-config", ADMIN, jiraSaveConfig);
172117
172235
  router29.post("/api/reverse-engineer/jira-test", ADMIN, jiraTestConnection);
@@ -1 +1 @@
1
- import{d as a,r as p,g as u}from"./chunk-MOJQB5TN-8fed6f00.js";import{p as f}from"./chunk-JWPE2WC7-5963eae9.js";import{_ as n,l as o}from"./mermaid.core-da5e1357.js";import{o as c,M as d}from"./mermaid-parser.core-47d17681.js";import"./index-ca784d3e.js";var v=c().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new d(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:p,styles:u};export{B as diagram};
1
+ import{d as a,r as p,g as u}from"./chunk-MOJQB5TN-7327a1f1.js";import{p as f}from"./chunk-JWPE2WC7-76a6de0e.js";import{_ as n,l as o}from"./mermaid.core-691e4744.js";import{o as c,M as d}from"./mermaid-parser.core-c86c44bd.js";import"./index-4d3efe4a.js";var v=c().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new d(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:p,styles:u};export{B as diagram};
@@ -1 +1 @@
1
- import{a1 as ln,a2 as an,a3 as y,a4 as tn,a5 as H,a6 as q,a7 as _,a8 as un,a9 as rn,aa as L,ab as o,ac as B,ad as sn,ae as on,af as fn}from"./mermaid.core-da5e1357.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,C,a){var O=I-l,i=D-h,n=C-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function W(l,h,I,D,v,A,C){var a=l-I,O=h-D,i=(C?A:-A)/L(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,F=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*L(fn(0,T*T*R-P*P)),j=(P*g-m*S)/R,z=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=j-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(j=w,z=p),{cx:j,cy:z,x01:-n,y01:-d,x11:j*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=yn,I=B(0),D=null,v=gn,A=dn,C=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,F=un(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(F>tn-y)a.moveTo(s*H(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*H(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=F,S=F,j=C.apply(this,arguments)/2,z=j>y&&(D?+D.apply(this,arguments):L(u*u+s*s)),w=_(un(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(z>y){var G=sn(z/u*q(j)),M=sn(z/s*q(j));(P-=G*2)>y?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(S-=M*2)>y?(M*=t?1:-1,m+=M,g-=M):(S=0,m=g=(f+c)/2)}var J=s*H(m),K=s*q(m),N=u*H(T),Q=u*q(T);if(w>y){var U=s*H(g),V=s*q(g),X=u*H(R),Y=u*q(R),E;if(F<rn)if(E=pn(J,K,X,Y,U,V,N,Q)){var Z=J-E[0],$=K-E[1],b=U-E[0],k=V-E[1],nn=1/q(on((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(J,K),a.arc(0,0,s,m,g,!t)):a.moveTo(J,K),!(u>y)||!(P>y)?a.lineTo(N,Q):p>y?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[H(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:B(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:B(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:B(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:B(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:B(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:B(+n),i):A},i.padAngle=function(n){return arguments.length?(C=typeof n=="function"?n:B(+n),i):C},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
1
+ import{a1 as ln,a2 as an,a3 as y,a4 as tn,a5 as H,a6 as q,a7 as _,a8 as un,a9 as rn,aa as L,ab as o,ac as B,ad as sn,ae as on,af as fn}from"./mermaid.core-691e4744.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,C,a){var O=I-l,i=D-h,n=C-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function W(l,h,I,D,v,A,C){var a=l-I,O=h-D,i=(C?A:-A)/L(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,F=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*L(fn(0,T*T*R-P*P)),j=(P*g-m*S)/R,z=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=j-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(j=w,z=p),{cx:j,cy:z,x01:-n,y01:-d,x11:j*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=yn,I=B(0),D=null,v=gn,A=dn,C=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,F=un(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(F>tn-y)a.moveTo(s*H(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*H(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=F,S=F,j=C.apply(this,arguments)/2,z=j>y&&(D?+D.apply(this,arguments):L(u*u+s*s)),w=_(un(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(z>y){var G=sn(z/u*q(j)),M=sn(z/s*q(j));(P-=G*2)>y?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(S-=M*2)>y?(M*=t?1:-1,m+=M,g-=M):(S=0,m=g=(f+c)/2)}var J=s*H(m),K=s*q(m),N=u*H(T),Q=u*q(T);if(w>y){var U=s*H(g),V=s*q(g),X=u*H(R),Y=u*q(R),E;if(F<rn)if(E=pn(J,K,X,Y,U,V,N,Q)){var Z=J-E[0],$=K-E[1],b=U-E[0],k=V-E[1],nn=1/q(on((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(J,K),a.arc(0,0,s,m,g,!t)):a.moveTo(J,K),!(u>y)||!(P>y)?a.lineTo(N,Q):p>y?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[H(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:B(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:B(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:B(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:B(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:B(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:B(+n),i):A},i.padAngle=function(n){return arguments.length?(C=typeof n=="function"?n:B(+n),i):C},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
@@ -0,0 +1 @@
1
+ import{A as c,f as i}from"./mermaid-parser.core-c86c44bd.js";import"./index-4d3efe4a.js";export{c as ArchitectureModule,i as createArchitectureServices};
@@ -1,4 +1,4 @@
1
- import{p as gt}from"./chunk-JWPE2WC7-5963eae9.js";import{E as ut,s as mt,g as pt,n as yt,o as wt,b as kt,c as xt,_ as f,v as bt,F as vt,G as $t,an as Et,al as St,l as tt,j as At,K as Tt,X as Dt,r as Ct,ao as Z,d as V,am as _,i as It}from"./mermaid.core-da5e1357.js";import{v as Lt}from"./mermaid-parser.core-47d17681.js";import{c as et,f as Bt}from"./index-ca784d3e.js";var Q={L:"left",R:"right",T:"top",B:"bottom"},U={L:f(e=>`${e},${e/2} 0,${e} 0,0`,"L"),R:f(e=>`0,${e/2} ${e},0 ${e},${e}`,"R"),T:f(e=>`0,0 ${e},0 ${e/2},${e}`,"T"),B:f(e=>`${e/2},0 ${e},${e} 0,${e}`,"B")},Y={L:f((e,t)=>e-t+2,"L"),R:f((e,t)=>e-2,"R"),T:f((e,t)=>e-t+2,"T"),B:f((e,t)=>e-2,"B")},jt=f(function(e){return L(e)?e==="L"?"R":"L":e==="T"?"B":"T"},"getOppositeArchitectureDirection"),K=f(function(e){const t=e;return t==="L"||t==="R"||t==="T"||t==="B"},"isArchitectureDirection"),L=f(function(e){const t=e;return t==="L"||t==="R"},"isArchitectureDirectionX"),P=f(function(e){const t=e;return t==="T"||t==="B"},"isArchitectureDirectionY"),q=f(function(e,t){const r=L(e)&&P(t),i=P(e)&&L(t);return r||i},"isArchitectureDirectionXY"),zt=f(function(e){const t=e[0],r=e[1],i=L(t)&&P(r),s=P(t)&&L(r);return i||s},"isArchitecturePairXY"),Ft=f(function(e){return e!=="LL"&&e!=="RR"&&e!=="TT"&&e!=="BB"},"isValidArchitectureDirectionPair"),H=f(function(e,t){const r=`${e}${t}`;return Ft(r)?r:void 0},"getArchitectureDirectionPair"),Pt=f(function([e,t],r){const i=r[0],s=r[1];return L(i)?P(s)?[e+(i==="L"?-1:1),t+(s==="T"?1:-1)]:[e+(i==="L"?-1:1),t]:L(s)?[e+(s==="L"?1:-1),t+(i==="T"?1:-1)]:[e,t+(i==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Mt=f(function(e){return e==="LT"||e==="TL"?[1,1]:e==="BL"||e==="LB"?[1,-1]:e==="BR"||e==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Rt=f(function(e,t){return q(e,t)?"bend":L(e)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Ot=f(function(e){return e.type==="service"},"isArchitectureService"),Xt=f(function(e){return e.type==="junction"},"isArchitectureJunction"),it=f(e=>e.data(),"edgeData"),R=f(e=>e.data(),"nodeData"),Yt=ut.architecture,X,rt=(X=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=mt,this.getAccTitle=pt,this.setDiagramTitle=yt,this.getDiagramTitle=wt,this.getAccDescription=kt,this.setAccDescription=xt,this.clear()}setDiagramId(t){this.diagramId=t}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",bt()}addService({id:t,icon:r,in:i,title:s,iconText:l}){if(this.registeredIds[t]!==void 0)throw new Error(`The service id [${t}] is already in use by another ${this.registeredIds[t]}`);if(i!==void 0){if(t===i)throw new Error(`The service [${t}] cannot be placed within itself`);if(this.registeredIds[i]===void 0)throw new Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[i]==="node")throw new Error(`The service [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"service",icon:r,iconText:l,title:s,edges:[],in:i}}getServices(){return Object.values(this.nodes).filter(Ot)}addJunction({id:t,in:r}){if(this.registeredIds[t]!==void 0)throw new Error(`The junction id [${t}] is already in use by another ${this.registeredIds[t]}`);if(r!==void 0){if(t===r)throw new Error(`The junction [${t}] cannot be placed within itself`);if(this.registeredIds[r]===void 0)throw new Error(`The junction [${t}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[r]==="node")throw new Error(`The junction [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"junction",edges:[],in:r}}getJunctions(){return Object.values(this.nodes).filter(Xt)}getNodes(){return Object.values(this.nodes)}getNode(t){return this.nodes[t]??null}addGroup({id:t,icon:r,in:i,title:s}){var l,p,g;if(((l=this.registeredIds)==null?void 0:l[t])!==void 0)throw new Error(`The group id [${t}] is already in use by another ${this.registeredIds[t]}`);if(i!==void 0){if(t===i)throw new Error(`The group [${t}] cannot be placed within itself`);if(((p=this.registeredIds)==null?void 0:p[i])===void 0)throw new Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if(((g=this.registeredIds)==null?void 0:g[i])==="node")throw new Error(`The group [${t}]'s parent is not a group`)}this.registeredIds[t]="group",this.groups[t]={id:t,icon:r,title:s,in:i}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:t,rhsId:r,lhsDir:i,rhsDir:s,lhsInto:l,rhsInto:p,lhsGroup:g,rhsGroup:m,title:u}){if(!K(i))throw new Error(`Invalid direction given for left hand side of edge ${t}--${r}. Expected (L,R,T,B) got ${String(i)}`);if(!K(s))throw new Error(`Invalid direction given for right hand side of edge ${t}--${r}. Expected (L,R,T,B) got ${String(s)}`);if(this.nodes[t]===void 0&&this.groups[t]===void 0)throw new Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[r]===void 0&&this.groups[r]===void 0)throw new Error(`The right-hand id [${r}] does not yet exist. Please create the service/group before declaring an edge to it.`);const h=this.nodes[t].in,o=this.nodes[r].in;if(g&&h&&o&&h==o)throw new Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(m&&h&&o&&h==o)throw new Error(`The right-hand id [${r}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const a={lhsId:t,lhsDir:i,lhsInto:l,lhsGroup:g,rhsId:r,rhsDir:s,rhsInto:p,rhsGroup:m,title:u};this.edges.push(a),this.nodes[t]&&this.nodes[r]&&(this.nodes[t].edges.push(this.edges[this.edges.length-1]),this.nodes[r].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(t){if(t.members.length<2)throw new Error(`An align directive requires at least two members; got ${t.members.length}`);const r=new Set;t.members.forEach(i=>{if(this.registeredIds[i]!=="node")throw new Error(`align ${t.direction} references [${i}], which is not a service or junction`);if(r.has(i))throw new Error(`align ${t.direction} lists [${i}] more than once`);r.add(i)}),this.layoutHints.push(t)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){const t={},r=Object.entries(this.nodes).reduce((m,[u,h])=>(m[u]=h.edges.reduce((o,a)=>{var n,b;const d=(n=this.getNode(a.lhsId))==null?void 0:n.in,c=(b=this.getNode(a.rhsId))==null?void 0:b.in;if(d&&c&&d!==c){const k=Rt(a.lhsDir,a.rhsDir);k!=="bend"&&(t[d]??(t[d]={}),t[d][c]=k,t[c]??(t[c]={}),t[c][d]=k)}if(a.lhsId===u){const k=H(a.lhsDir,a.rhsDir);k&&(o[k]=a.rhsId)}else{const k=H(a.rhsDir,a.lhsDir);k&&(o[k]=a.lhsId)}return o},{}),m),{}),i=Object.keys(r)[0],s={[i]:1},l=Object.keys(r).reduce((m,u)=>u===i?m:{...m,[u]:1},{}),p=f(m=>{const u={[m]:[0,0]},h=[m];for(;h.length>0;){const o=h.shift();if(o){s[o]=1,delete l[o];const a=r[o],[d,c]=u[o];Object.entries(a).forEach(([n,b])=>{s[b]||(u[b]=Pt([d,c],n),h.push(b))})}}return u},"BFS"),g=[p(i)];for(;Object.keys(l).length>0;)g.push(p(Object.keys(l)[0]));this.dataStructures={adjList:r,spatialMaps:g,groupAlignments:t}}return this.dataStructures}setElementForId(t,r){this.elements[t]=r}getElementById(t){return this.elements[t]}getConfig(){return vt({...Yt,...$t().architecture})}getConfigField(t){return this.getConfig()[t]}},f(X,"ArchitectureDB"),X),Gt=f((e,t)=>{var r;gt(e,t),e.groups.map(i=>t.addGroup(i)),e.services.map(i=>t.addService({...i,type:"service"})),e.junctions.map(i=>t.addJunction({...i,type:"junction"})),e.edges.map(i=>t.addEdge(i)),(r=e.alignments)==null||r.map(i=>t.addLayoutHint({direction:i.direction,members:[...i.members]}))},"populateDb"),st={parser:{yy:void 0},parse:f(async e=>{var i;const t=await Lt("architecture",e);tt.debug(t);const r=(i=st.parser)==null?void 0:i.yy;if(!(r instanceof rt))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(t,r)},"parse")},Nt=f(e=>`
1
+ import{p as gt}from"./chunk-JWPE2WC7-76a6de0e.js";import{E as ut,s as mt,g as pt,n as yt,o as wt,b as kt,c as xt,_ as f,v as bt,F as vt,G as $t,an as Et,al as St,l as tt,j as At,K as Tt,X as Dt,r as Ct,ao as Z,d as V,am as _,i as It}from"./mermaid.core-691e4744.js";import{v as Lt}from"./mermaid-parser.core-c86c44bd.js";import{c as et,f as Bt}from"./index-4d3efe4a.js";var Q={L:"left",R:"right",T:"top",B:"bottom"},U={L:f(e=>`${e},${e/2} 0,${e} 0,0`,"L"),R:f(e=>`0,${e/2} ${e},0 ${e},${e}`,"R"),T:f(e=>`0,0 ${e},0 ${e/2},${e}`,"T"),B:f(e=>`${e/2},0 ${e},${e} 0,${e}`,"B")},Y={L:f((e,t)=>e-t+2,"L"),R:f((e,t)=>e-2,"R"),T:f((e,t)=>e-t+2,"T"),B:f((e,t)=>e-2,"B")},jt=f(function(e){return L(e)?e==="L"?"R":"L":e==="T"?"B":"T"},"getOppositeArchitectureDirection"),K=f(function(e){const t=e;return t==="L"||t==="R"||t==="T"||t==="B"},"isArchitectureDirection"),L=f(function(e){const t=e;return t==="L"||t==="R"},"isArchitectureDirectionX"),P=f(function(e){const t=e;return t==="T"||t==="B"},"isArchitectureDirectionY"),q=f(function(e,t){const r=L(e)&&P(t),i=P(e)&&L(t);return r||i},"isArchitectureDirectionXY"),zt=f(function(e){const t=e[0],r=e[1],i=L(t)&&P(r),s=P(t)&&L(r);return i||s},"isArchitecturePairXY"),Ft=f(function(e){return e!=="LL"&&e!=="RR"&&e!=="TT"&&e!=="BB"},"isValidArchitectureDirectionPair"),H=f(function(e,t){const r=`${e}${t}`;return Ft(r)?r:void 0},"getArchitectureDirectionPair"),Pt=f(function([e,t],r){const i=r[0],s=r[1];return L(i)?P(s)?[e+(i==="L"?-1:1),t+(s==="T"?1:-1)]:[e+(i==="L"?-1:1),t]:L(s)?[e+(s==="L"?1:-1),t+(i==="T"?1:-1)]:[e,t+(i==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Mt=f(function(e){return e==="LT"||e==="TL"?[1,1]:e==="BL"||e==="LB"?[1,-1]:e==="BR"||e==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Rt=f(function(e,t){return q(e,t)?"bend":L(e)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Ot=f(function(e){return e.type==="service"},"isArchitectureService"),Xt=f(function(e){return e.type==="junction"},"isArchitectureJunction"),it=f(e=>e.data(),"edgeData"),R=f(e=>e.data(),"nodeData"),Yt=ut.architecture,X,rt=(X=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=mt,this.getAccTitle=pt,this.setDiagramTitle=yt,this.getDiagramTitle=wt,this.getAccDescription=kt,this.setAccDescription=xt,this.clear()}setDiagramId(t){this.diagramId=t}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",bt()}addService({id:t,icon:r,in:i,title:s,iconText:l}){if(this.registeredIds[t]!==void 0)throw new Error(`The service id [${t}] is already in use by another ${this.registeredIds[t]}`);if(i!==void 0){if(t===i)throw new Error(`The service [${t}] cannot be placed within itself`);if(this.registeredIds[i]===void 0)throw new Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[i]==="node")throw new Error(`The service [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"service",icon:r,iconText:l,title:s,edges:[],in:i}}getServices(){return Object.values(this.nodes).filter(Ot)}addJunction({id:t,in:r}){if(this.registeredIds[t]!==void 0)throw new Error(`The junction id [${t}] is already in use by another ${this.registeredIds[t]}`);if(r!==void 0){if(t===r)throw new Error(`The junction [${t}] cannot be placed within itself`);if(this.registeredIds[r]===void 0)throw new Error(`The junction [${t}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[r]==="node")throw new Error(`The junction [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"junction",edges:[],in:r}}getJunctions(){return Object.values(this.nodes).filter(Xt)}getNodes(){return Object.values(this.nodes)}getNode(t){return this.nodes[t]??null}addGroup({id:t,icon:r,in:i,title:s}){var l,p,g;if(((l=this.registeredIds)==null?void 0:l[t])!==void 0)throw new Error(`The group id [${t}] is already in use by another ${this.registeredIds[t]}`);if(i!==void 0){if(t===i)throw new Error(`The group [${t}] cannot be placed within itself`);if(((p=this.registeredIds)==null?void 0:p[i])===void 0)throw new Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if(((g=this.registeredIds)==null?void 0:g[i])==="node")throw new Error(`The group [${t}]'s parent is not a group`)}this.registeredIds[t]="group",this.groups[t]={id:t,icon:r,title:s,in:i}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:t,rhsId:r,lhsDir:i,rhsDir:s,lhsInto:l,rhsInto:p,lhsGroup:g,rhsGroup:m,title:u}){if(!K(i))throw new Error(`Invalid direction given for left hand side of edge ${t}--${r}. Expected (L,R,T,B) got ${String(i)}`);if(!K(s))throw new Error(`Invalid direction given for right hand side of edge ${t}--${r}. Expected (L,R,T,B) got ${String(s)}`);if(this.nodes[t]===void 0&&this.groups[t]===void 0)throw new Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[r]===void 0&&this.groups[r]===void 0)throw new Error(`The right-hand id [${r}] does not yet exist. Please create the service/group before declaring an edge to it.`);const h=this.nodes[t].in,o=this.nodes[r].in;if(g&&h&&o&&h==o)throw new Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(m&&h&&o&&h==o)throw new Error(`The right-hand id [${r}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const a={lhsId:t,lhsDir:i,lhsInto:l,lhsGroup:g,rhsId:r,rhsDir:s,rhsInto:p,rhsGroup:m,title:u};this.edges.push(a),this.nodes[t]&&this.nodes[r]&&(this.nodes[t].edges.push(this.edges[this.edges.length-1]),this.nodes[r].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(t){if(t.members.length<2)throw new Error(`An align directive requires at least two members; got ${t.members.length}`);const r=new Set;t.members.forEach(i=>{if(this.registeredIds[i]!=="node")throw new Error(`align ${t.direction} references [${i}], which is not a service or junction`);if(r.has(i))throw new Error(`align ${t.direction} lists [${i}] more than once`);r.add(i)}),this.layoutHints.push(t)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){const t={},r=Object.entries(this.nodes).reduce((m,[u,h])=>(m[u]=h.edges.reduce((o,a)=>{var n,b;const d=(n=this.getNode(a.lhsId))==null?void 0:n.in,c=(b=this.getNode(a.rhsId))==null?void 0:b.in;if(d&&c&&d!==c){const k=Rt(a.lhsDir,a.rhsDir);k!=="bend"&&(t[d]??(t[d]={}),t[d][c]=k,t[c]??(t[c]={}),t[c][d]=k)}if(a.lhsId===u){const k=H(a.lhsDir,a.rhsDir);k&&(o[k]=a.rhsId)}else{const k=H(a.rhsDir,a.lhsDir);k&&(o[k]=a.lhsId)}return o},{}),m),{}),i=Object.keys(r)[0],s={[i]:1},l=Object.keys(r).reduce((m,u)=>u===i?m:{...m,[u]:1},{}),p=f(m=>{const u={[m]:[0,0]},h=[m];for(;h.length>0;){const o=h.shift();if(o){s[o]=1,delete l[o];const a=r[o],[d,c]=u[o];Object.entries(a).forEach(([n,b])=>{s[b]||(u[b]=Pt([d,c],n),h.push(b))})}}return u},"BFS"),g=[p(i)];for(;Object.keys(l).length>0;)g.push(p(Object.keys(l)[0]));this.dataStructures={adjList:r,spatialMaps:g,groupAlignments:t}}return this.dataStructures}setElementForId(t,r){this.elements[t]=r}getElementById(t){return this.elements[t]}getConfig(){return vt({...Yt,...$t().architecture})}getConfigField(t){return this.getConfig()[t]}},f(X,"ArchitectureDB"),X),Gt=f((e,t)=>{var r;gt(e,t),e.groups.map(i=>t.addGroup(i)),e.services.map(i=>t.addService({...i,type:"service"})),e.junctions.map(i=>t.addJunction({...i,type:"junction"})),e.edges.map(i=>t.addEdge(i)),(r=e.alignments)==null||r.map(i=>t.addLayoutHint({direction:i.direction,members:[...i.members]}))},"populateDb"),st={parser:{yy:void 0},parse:f(async e=>{var i;const t=await Lt("architecture",e);tt.debug(t);const r=(i=st.parser)==null?void 0:i.yy;if(!(r instanceof rt))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(t,r)},"parse")},Nt=f(e=>`
2
2
  .edge {
3
3
  stroke-width: ${e.archEdgeWidth};
4
4
  stroke: ${e.archEdgeColor};