update the theme

This commit is contained in:
Christoph Cullmann 2024-06-26 21:44:28 +02:00
parent b1a7697b03
commit 58e2c9ae87
No known key found for this signature in database
166 changed files with 326580 additions and 582 deletions

View file

@ -36,10 +36,12 @@ Blowfish is designed to be a powerful, lightweight theme for [Hugo](https://gohu
- Multiple homepage layouts - Multiple homepage layouts
- Multiple authors - Multiple authors
- Series of articles - Series of articles
- Date and weight based article sorting
- Zen mode for article reading - Zen mode for article reading
- Flexible with any content types, taxonomies and menus - Flexible with any content types, taxonomies and menus
- Header and footer menus - Header and footer menus
- Nested menus & sub-navigation menu - Nested menus & sub-navigation menu
- Scrollable table of contents
- Multilingual content support including support for RTL languages - Multilingual content support including support for RTL languages
- Ability to link to posts on third-party websites - Ability to link to posts on third-party websites
- Support for several shortcodes like Gallery, Timeline, GitHub cards, and Carousels - Support for several shortcodes like Gallery, Timeline, GitHub cards, and Carousels

View file

@ -14,7 +14,7 @@ body.zen-mode-enable {
} }
} }
/*! tailwindcss v3.4.3 | MIT License | https://tailwindcss.com */ /*! tailwindcss v3.4.4 | MIT License | https://tailwindcss.com */
/* /*
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
@ -655,6 +655,13 @@ select {
outline:1px auto -webkit-focus-ring-color outline:1px auto -webkit-focus-ring-color
} }
@supports (-moz-appearance:none) {
* {
scrollbar-color:initial;
scrollbar-width:initial
}
}
*, ::before, ::after { *, ::before, ::after {
--tw-border-spacing-x:0; --tw-border-spacing-x:0;
--tw-border-spacing-y:0; --tw-border-spacing-y:0;
@ -1233,19 +1240,19 @@ select {
margin-bottom:0.75em margin-bottom:0.75em
} }
.prose :where(.prose > ul > li > *:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { .prose :where(.prose > ul > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
margin-top:1.25em margin-top:1.25em
} }
.prose :where(.prose > ul > li > *:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { .prose :where(.prose > ul > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
margin-bottom:1.25em margin-bottom:1.25em
} }
.prose :where(.prose > ol > li > *:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { .prose :where(.prose > ol > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
margin-top:1.25em margin-top:1.25em
} }
.prose :where(.prose > ol > li > *:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { .prose :where(.prose > ol > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
margin-bottom:1.25em margin-bottom:1.25em
} }
@ -2213,6 +2220,14 @@ select {
overflow:visible overflow:visible
} }
.overflow-y-scroll {
overflow-y:scroll
}
.overscroll-contain {
overscroll-behavior:contain
}
.scroll-smooth { .scroll-smooth {
scroll-behavior:smooth scroll-behavior:smooth
} }
@ -3074,6 +3089,66 @@ select {
transition-timing-function:linear transition-timing-function:linear
} }
.scrollbar-thin::-webkit-scrollbar-track {
background-color:var(--scrollbar-track);
border-radius:var(--scrollbar-track-radius)
}
.scrollbar-thin::-webkit-scrollbar-track:hover {
background-color:var(--scrollbar-track-hover, var(--scrollbar-track))
}
.scrollbar-thin::-webkit-scrollbar-track:active {
background-color:var(--scrollbar-track-active, var(--scrollbar-track-hover, var(--scrollbar-track)))
}
.scrollbar-thin::-webkit-scrollbar-thumb {
background-color:var(--scrollbar-thumb);
border-radius:var(--scrollbar-thumb-radius)
}
.scrollbar-thin::-webkit-scrollbar-thumb:hover {
background-color:var(--scrollbar-thumb-hover, var(--scrollbar-thumb))
}
.scrollbar-thin::-webkit-scrollbar-thumb:active {
background-color:var(--scrollbar-thumb-active, var(--scrollbar-thumb-hover, var(--scrollbar-thumb)))
}
.scrollbar-thin::-webkit-scrollbar-corner {
background-color:var(--scrollbar-corner);
border-radius:var(--scrollbar-corner-radius)
}
.scrollbar-thin::-webkit-scrollbar-corner:hover {
background-color:var(--scrollbar-corner-hover, var(--scrollbar-corner))
}
.scrollbar-thin::-webkit-scrollbar-corner:active {
background-color:var(--scrollbar-corner-active, var(--scrollbar-corner-hover, var(--scrollbar-corner)))
}
@supports (-moz-appearance:none) {
.scrollbar-thin {
scrollbar-width:thin;
scrollbar-color:var(--scrollbar-thumb, initial) var(--scrollbar-track, initial)
}
}
.scrollbar-thin::-webkit-scrollbar {
display:block;
width:8px;
height:8px
}
.scrollbar-track-neutral-200 {
--scrollbar-track:rgba(var(--color-neutral-200), 1) !important
}
.scrollbar-thumb-neutral-400 {
--scrollbar-thumb:rgba(var(--color-neutral-400), 1) !important
}
.\!\[clip\:rect\(0\2c 0\2c 0\2c 0\)\] { .\!\[clip\:rect\(0\2c 0\2c 0\2c 0\)\] {
clip:rect(0,0,0,0) !important clip:rect(0,0,0,0) !important
} }
@ -4724,6 +4799,102 @@ pre {
display:none display:none
} }
.group:hover .group-hover\:text-primary-300 {
--tw-text-opacity:1;
color:rgba(var(--color-primary-300), var(--tw-text-opacity))
}
.group:hover .group-hover\:text-primary-600 {
--tw-text-opacity:1;
color:rgba(var(--color-primary-600), var(--tw-text-opacity))
}
.group:hover .group-hover\:underline {
text-decoration-line:underline
}
.group:hover .group-hover\:decoration-primary-500 {
text-decoration-color:rgba(var(--color-primary-500), 1)
}
.group:hover .group-hover\:opacity-100 {
opacity:1
}
.data-\[twe-carousel-fade\]\:z-0[data-twe-carousel-fade] {
z-index:0
}
.data-\[twe-carousel-fade\]\:z-\[1\][data-twe-carousel-fade] {
z-index:1
}
.data-\[popper-reference-hidden\]\:hidden[data-popper-reference-hidden] {
display:none
}
.data-\[twe-carousel-fade\]\:opacity-0[data-twe-carousel-fade] {
opacity:0
}
.data-\[twe-carousel-fade\]\:opacity-100[data-twe-carousel-fade] {
opacity:1
}
.data-\[twe-carousel-fade\]\:duration-\[600ms\][data-twe-carousel-fade] {
transition-duration:600ms
}
.group[data-twe-input-focused] .group-data-\[twe-input-focused\]\:border-x-0 {
border-left-width:0px;
border-right-width:0px
}
.group[data-twe-input-state-active] .group-data-\[twe-input-state-active\]\:border-x-0 {
border-left-width:0px;
border-right-width:0px
}
.group[data-twe-input-focused] .group-data-\[twe-input-focused\]\:border-e-0 {
border-inline-end-width:0px
}
.group[data-twe-input-focused] .group-data-\[twe-input-focused\]\:border-s-0 {
border-inline-start-width:0px
}
.group[data-twe-input-focused] .group-data-\[twe-input-focused\]\:border-t {
border-top-width:1px
}
.group[data-twe-input-state-active] .group-data-\[twe-input-state-active\]\:border-e-0 {
border-inline-end-width:0px
}
.group[data-twe-input-state-active] .group-data-\[twe-input-state-active\]\:border-s-0 {
border-inline-start-width:0px
}
.group[data-twe-input-state-active] .group-data-\[twe-input-state-active\]\:border-t {
border-top-width:1px
}
.group[data-twe-input-focused] .group-data-\[twe-input-focused\]\:border-solid {
border-style:solid
}
.group[data-twe-input-state-active] .group-data-\[twe-input-state-active\]\:border-solid {
border-style:solid
}
.group[data-twe-input-focused] .group-data-\[twe-input-focused\]\:border-t-transparent {
border-top-color:transparent
}
.group[data-twe-input-state-active] .group-data-\[twe-input-state-active\]\:border-t-transparent {
border-top-color:transparent
}
.hover\:border-transparent:hover { .hover\:border-transparent:hover {
border-color:transparent border-color:transparent
} }
@ -4837,102 +5008,6 @@ pre {
outline-color:transparent outline-color:transparent
} }
.group:hover .group-hover\:text-primary-300 {
--tw-text-opacity:1;
color:rgba(var(--color-primary-300), var(--tw-text-opacity))
}
.group:hover .group-hover\:text-primary-600 {
--tw-text-opacity:1;
color:rgba(var(--color-primary-600), var(--tw-text-opacity))
}
.group:hover .group-hover\:underline {
text-decoration-line:underline
}
.group:hover .group-hover\:decoration-primary-500 {
text-decoration-color:rgba(var(--color-primary-500), 1)
}
.group:hover .group-hover\:opacity-100 {
opacity:1
}
.data-\[twe-carousel-fade\]\:z-0[data-twe-carousel-fade] {
z-index:0
}
.data-\[twe-carousel-fade\]\:z-\[1\][data-twe-carousel-fade] {
z-index:1
}
.data-\[popper-reference-hidden\]\:hidden[data-popper-reference-hidden] {
display:none
}
.data-\[twe-carousel-fade\]\:opacity-0[data-twe-carousel-fade] {
opacity:0
}
.data-\[twe-carousel-fade\]\:opacity-100[data-twe-carousel-fade] {
opacity:1
}
.data-\[twe-carousel-fade\]\:duration-\[600ms\][data-twe-carousel-fade] {
transition-duration:600ms
}
.group[data-twe-input-focused] .group-data-\[twe-input-focused\]\:border-x-0 {
border-left-width:0px;
border-right-width:0px
}
.group[data-twe-input-state-active] .group-data-\[twe-input-state-active\]\:border-x-0 {
border-left-width:0px;
border-right-width:0px
}
.group[data-twe-input-focused] .group-data-\[twe-input-focused\]\:border-e-0 {
border-inline-end-width:0px
}
.group[data-twe-input-focused] .group-data-\[twe-input-focused\]\:border-s-0 {
border-inline-start-width:0px
}
.group[data-twe-input-focused] .group-data-\[twe-input-focused\]\:border-t {
border-top-width:1px
}
.group[data-twe-input-state-active] .group-data-\[twe-input-state-active\]\:border-e-0 {
border-inline-end-width:0px
}
.group[data-twe-input-state-active] .group-data-\[twe-input-state-active\]\:border-s-0 {
border-inline-start-width:0px
}
.group[data-twe-input-state-active] .group-data-\[twe-input-state-active\]\:border-t {
border-top-width:1px
}
.group[data-twe-input-focused] .group-data-\[twe-input-focused\]\:border-solid {
border-style:solid
}
.group[data-twe-input-state-active] .group-data-\[twe-input-state-active\]\:border-solid {
border-style:solid
}
.group[data-twe-input-focused] .group-data-\[twe-input-focused\]\:border-t-transparent {
border-top-color:transparent
}
.group[data-twe-input-state-active] .group-data-\[twe-input-state-active\]\:border-t-transparent {
border-top-color:transparent
}
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
.motion-reduce\:transition-none { .motion-reduce\:transition-none {
transition-property:none transition-property:none
@ -5094,6 +5169,24 @@ pre {
opacity:0.6 opacity:0.6
} }
.dark\:scrollbar-track-neutral-800:is(.dark *) {
--scrollbar-track:rgba(var(--color-neutral-800), 1) !important
}
.dark\:scrollbar-thumb-neutral-600:is(.dark *) {
--scrollbar-thumb:rgba(var(--color-neutral-600), 1) !important
}
.group:hover .dark\:group-hover\:text-neutral-700:is(.dark *) {
--tw-text-opacity:1;
color:rgba(var(--color-neutral-700), var(--tw-text-opacity))
}
.group:hover .dark\:group-hover\:text-primary-400:is(.dark *) {
--tw-text-opacity:1;
color:rgba(var(--color-primary-400), var(--tw-text-opacity))
}
.dark\:hover\:\!bg-primary-700:hover:is(.dark *) { .dark\:hover\:\!bg-primary-700:hover:is(.dark *) {
--tw-bg-opacity:1 !important; --tw-bg-opacity:1 !important;
background-color:rgba(var(--color-primary-700), var(--tw-bg-opacity)) !important background-color:rgba(var(--color-primary-700), var(--tw-bg-opacity)) !important
@ -5124,16 +5217,6 @@ pre {
background-color:rgba(var(--color-primary-900), var(--tw-bg-opacity)) background-color:rgba(var(--color-primary-900), var(--tw-bg-opacity))
} }
.group:hover .dark\:group-hover\:text-neutral-700:is(.dark *) {
--tw-text-opacity:1;
color:rgba(var(--color-neutral-700), var(--tw-text-opacity))
}
.group:hover .dark\:group-hover\:text-primary-400:is(.dark *) {
--tw-text-opacity:1;
color:rgba(var(--color-primary-400), var(--tw-text-opacity))
}
@media (min-width: 640px) { @media (min-width: 640px) {
.sm\:mb-0 { .sm\:mb-0 {
margin-bottom:0px margin-bottom:0px

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<svg fill="currentColor" viewBox="0 0 24 24" role="img" xmlns="http://www.w3.org/2000/svg"><path d="M11.955.49A12 12 0 0 0 0 12.49a12 12 0 0 0 1.832 6.373L11.838 5.928a.187.14 0 0 1 .324 0l10.006 12.935A12 12 0 0 0 24 12.49a12 12 0 0 0-12-12 12 12 0 0 0-.045 0zm.375 6.467 4.416 16.553a12 12 0 0 0 5.137-4.213z"/></svg>

After

Width:  |  Height:  |  Size: 359 B

View file

@ -1,57 +1,59 @@
function _toogleZenMode(zendModeButton) { function _toogleZenMode(zendModeButton) {
// Nodes selection // Nodes selection
const body = document.querySelector('body'); const body = document.querySelector('body');
const tocRight = document.querySelector('.toc-right'); const tocRight = document.querySelector('.toc-right');
const tocInside = document.querySelector('.toc-inside'); const tocInside = document.querySelector('.toc-inside');
const articleContent = document.querySelector('.article-content'); const articleContent = document.querySelector('.article-content');
const header = document.querySelector('#single_header'); const header = document.querySelector('#single_header');
// Add semantic class into body tag // Add semantic class into body tag
body.classList.toggle('zen-mode-enable'); body.classList.toggle('zen-mode-enable');
// Show/Hide 'toc right' and 'toc inside' // Show/Hide 'toc right' and 'toc inside'
if (tocRight)
tocRight.classList.toggle('lg:block'); tocRight.classList.toggle('lg:block');
if (tocInside)
tocInside.classList.toggle('lg:hidden'); tocInside.classList.toggle('lg:hidden');
// Change width of article content // Change width of article content
articleContent.classList.toggle('max-w-fit'); articleContent.classList.toggle('max-w-fit');
articleContent.classList.toggle('max-w-prose'); articleContent.classList.toggle('max-w-prose');
// Read i18n title from data-attributes // Read i18n title from data-attributes
const titleI18nDisable = zendModeButton.getAttribute('data-title-i18n-disable'); const titleI18nDisable = zendModeButton.getAttribute('data-title-i18n-disable');
const titleI18nEnable = zendModeButton.getAttribute('data-title-i18n-enable'); const titleI18nEnable = zendModeButton.getAttribute('data-title-i18n-enable');
if (body.classList.contains('zen-mode-enable')) { if (body.classList.contains('zen-mode-enable')) {
// Persist configuration // Persist configuration
//localStorage.setItem('blowfish-zen-mode-enabled', 'true'); //localStorage.setItem('blowfish-zen-mode-enabled', 'true');
// Change title to enable // Change title to enable
zendModeButton.setAttribute('title', titleI18nEnable) zendModeButton.setAttribute('title', titleI18nEnable)
// Auto-scroll to title article // Auto-scroll to title article
window.scrollTo(window.scrollX, header.getBoundingClientRect().top - 90); window.scrollTo(window.scrollX, header.getBoundingClientRect().top - 90);
} else { } else {
//localStorage.setItem('blowfish-zen-mode-enabled', 'false'); //localStorage.setItem('blowfish-zen-mode-enabled', 'false');
zendModeButton.setAttribute('title', titleI18nDisable); zendModeButton.setAttribute('title', titleI18nDisable);
document.querySelector('body').scrollIntoView(); document.querySelector('body').scrollIntoView();
} }
} }
function _registerZendModeButtonClick(zendModeButton) { function _registerZendModeButtonClick(zendModeButton) {
zendModeButton.addEventListener('click', function (event) { zendModeButton.addEventListener('click', function (event) {
event.preventDefault(); event.preventDefault();
// Toggle zen-mode // Toggle zen-mode
_toogleZenMode(zendModeButton); _toogleZenMode(zendModeButton);
}); });
} }
(function init() { (function init() {
window.addEventListener("DOMContentLoaded", (event) => { window.addEventListener("DOMContentLoaded", (event) => {
// Register click on 'zen-mode-button' node element // Register click on 'zen-mode-button' node element
const zendModeButton = document.getElementById('zen-mode-button'); const zendModeButton = document.getElementById('zen-mode-button');
if(zendModeButton !== null && zendModeButton !== undefined) { if (zendModeButton !== null && zendModeButton !== undefined) {
_registerZendModeButtonClick(zendModeButton); _registerZendModeButtonClick(zendModeButton);
} }
}); });
})(); })();

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,148 @@
import { w as withPath, c as constant } from "./path-39bad7e2.js";
import { aw as pi, ax as cos, ay as sin, az as halfPi, aA as epsilon, V as tau, aB as sqrt, aC as min, aD as abs, aE as atan2, aF as asin, aG as acos, aH as max } from "./mermaid-dcacb631.js";
function arcInnerRadius(d) {
return d.innerRadius;
}
function arcOuterRadius(d) {
return d.outerRadius;
}
function arcStartAngle(d) {
return d.startAngle;
}
function arcEndAngle(d) {
return d.endAngle;
}
function arcPadAngle(d) {
return d && d.padAngle;
}
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10;
if (t * t < epsilon)
return;
t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
return [x0 + t * x10, y0 + t * y10];
}
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1)
cx0 = cx1, cy0 = cy1;
return {
cx: cx0,
cy: cy0,
x01: -ox,
y01: -oy,
x11: cx0 * (r1 / r - 1),
y11: cy0 * (r1 / r - 1)
};
}
function d3arc() {
var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null, path = withPath(arc);
function arc() {
var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0;
if (!context)
context = buffer = path();
if (r1 < r0)
r = r1, r1 = r0, r0 = r;
if (!(r1 > epsilon))
context.moveTo(0, 0);
else if (da > tau - epsilon) {
context.moveTo(r1 * cos(a0), r1 * sin(a0));
context.arc(0, 0, r1, a0, a1, !cw);
if (r0 > epsilon) {
context.moveTo(r0 * cos(a1), r0 * sin(a1));
context.arc(0, 0, r0, a1, a0, cw);
}
} else {
var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1;
if (rp > epsilon) {
var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap));
if ((da0 -= p0 * 2) > epsilon)
p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;
else
da0 = 0, a00 = a10 = (a0 + a1) / 2;
if ((da1 -= p1 * 2) > epsilon)
p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;
else
da1 = 0, a01 = a11 = (a0 + a1) / 2;
}
var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10);
if (rc > epsilon) {
var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc;
if (da < pi) {
if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {
var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
rc0 = min(rc, (r0 - lc) / (kc - 1));
rc1 = min(rc, (r1 - lc) / (kc + 1));
} else {
rc0 = rc1 = 0;
}
}
}
if (!(da1 > epsilon))
context.moveTo(x01, y01);
else if (rc1 > epsilon) {
t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
if (rc1 < rc)
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
else {
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
}
} else
context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
if (!(r0 > epsilon) || !(da0 > epsilon))
context.lineTo(x10, y10);
else if (rc0 > epsilon) {
t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
if (rc0 < rc)
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
else {
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
}
} else
context.arc(0, 0, r0, a10, a00, cw);
}
context.closePath();
if (buffer)
return context = null, buffer + "" || null;
}
arc.centroid = function() {
var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
return [cos(a) * r, sin(a) * r];
};
arc.innerRadius = function(_) {
return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius;
};
arc.outerRadius = function(_) {
return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius;
};
arc.cornerRadius = function(_) {
return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius;
};
arc.padRadius = function(_) {
return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius;
};
arc.startAngle = function(_) {
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle;
};
arc.endAngle = function(_) {
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle;
};
arc.padAngle = function(_) {
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle;
};
arc.context = function(_) {
return arguments.length ? (context = _ == null ? null : _, arc) : context;
};
return arc;
}
export {
d3arc as d
};

View file

@ -0,0 +1,86 @@
import { w as ln, c as H } from "./path-428ebac9.js";
import { aw as an, ax as V, ay as D, az as rn, aA as y, V as on, aB as K, aC as _, aD as un, aE as t, aF as sn, aG as tn, aH as fn } from "./mermaid-9f2aa176.js";
function cn(l) {
return l.innerRadius;
}
function yn(l) {
return l.outerRadius;
}
function gn(l) {
return l.startAngle;
}
function mn(l) {
return l.endAngle;
}
function pn(l) {
return l && l.padAngle;
}
function dn(l, h, z, E, v, A, I, a) {
var B = z - l, i = E - h, n = I - v, m = a - A, r = m * B - n * i;
if (!(r * r < y))
return r = (n * (h - A) - m * (l - v)) / r, [l + r * B, h + r * i];
}
function W(l, h, z, E, v, A, I) {
var a = l - z, B = h - E, i = (I ? A : -A) / K(a * a + B * B), n = i * B, m = -i * a, r = l + n, s = h + m, f = z + n, c = E + m, O = (r + f) / 2, o = (s + c) / 2, p = f - r, g = c - s, R = p * p + g * g, T = v - A, w = r * c - f * s, C = (g < 0 ? -1 : 1) * K(fn(0, T * T * R - w * w)), F = (w * g - p * C) / R, G = (-w * p - g * C) / R, P = (w * g + p * C) / R, d = (-w * p + g * C) / R, x = F - O, e = G - o, u = P - O, S = d - o;
return x * x + e * e > u * u + S * S && (F = P, G = d), {
cx: F,
cy: G,
x01: -n,
y01: -m,
x11: F * (v / T - 1),
y11: G * (v / T - 1)
};
}
function vn() {
var l = cn, h = yn, z = H(0), E = null, v = gn, A = mn, I = pn, a = null, B = ln(i);
function i() {
var n, m, r = +l.apply(this, arguments), s = +h.apply(this, arguments), f = v.apply(this, arguments) - rn, c = A.apply(this, arguments) - rn, O = un(c - f), o = c > f;
if (a || (a = n = B()), s < r && (m = s, s = r, r = m), !(s > y))
a.moveTo(0, 0);
else if (O > on - y)
a.moveTo(s * V(f), s * D(f)), a.arc(0, 0, s, f, c, !o), r > y && (a.moveTo(r * V(c), r * D(c)), a.arc(0, 0, r, c, f, o));
else {
var p = f, g = c, R = f, T = c, w = O, C = O, F = I.apply(this, arguments) / 2, G = F > y && (E ? +E.apply(this, arguments) : K(r * r + s * s)), P = _(un(s - r) / 2, +z.apply(this, arguments)), d = P, x = P, e, u;
if (G > y) {
var S = sn(G / r * D(F)), L = sn(G / s * D(F));
(w -= S * 2) > y ? (S *= o ? 1 : -1, R += S, T -= S) : (w = 0, R = T = (f + c) / 2), (C -= L * 2) > y ? (L *= o ? 1 : -1, p += L, g -= L) : (C = 0, p = g = (f + c) / 2);
}
var j = s * V(p), J = s * D(p), M = r * V(T), N = r * D(T);
if (P > y) {
var Q = s * V(g), U = s * D(g), X = r * V(R), Y = r * D(R), q;
if (O < an)
if (q = dn(j, J, X, Y, Q, U, M, N)) {
var Z = j - q[0], $ = J - q[1], k = Q - q[0], b = U - q[1], nn = 1 / D(tn((Z * k + $ * b) / (K(Z * Z + $ * $) * K(k * k + b * b))) / 2), en = K(q[0] * q[0] + q[1] * q[1]);
d = _(P, (r - en) / (nn - 1)), x = _(P, (s - en) / (nn + 1));
} else
d = x = 0;
}
C > y ? x > y ? (e = W(X, Y, j, J, s, x, o), u = W(Q, U, M, N, s, x, o), a.moveTo(e.cx + e.x01, e.cy + e.y01), x < P ? a.arc(e.cx, e.cy, x, t(e.y01, e.x01), t(u.y01, u.x01), !o) : (a.arc(e.cx, e.cy, x, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, s, t(e.cy + e.y11, e.cx + e.x11), t(u.cy + u.y11, u.cx + u.x11), !o), a.arc(u.cx, u.cy, x, t(u.y11, u.x11), t(u.y01, u.x01), !o))) : (a.moveTo(j, J), a.arc(0, 0, s, p, g, !o)) : a.moveTo(j, J), !(r > y) || !(w > y) ? a.lineTo(M, N) : d > y ? (e = W(M, N, Q, U, r, -d, o), u = W(j, J, X, Y, r, -d, o), a.lineTo(e.cx + e.x01, e.cy + e.y01), d < P ? a.arc(e.cx, e.cy, d, t(e.y01, e.x01), t(u.y01, u.x01), !o) : (a.arc(e.cx, e.cy, d, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, r, t(e.cy + e.y11, e.cx + e.x11), t(u.cy + u.y11, u.cx + u.x11), o), a.arc(u.cx, u.cy, d, t(u.y11, u.x11), t(u.y01, u.x01), !o))) : a.arc(0, 0, r, T, R, o);
}
if (a.closePath(), n)
return a = null, n + "" || null;
}
return i.centroid = function() {
var n = (+l.apply(this, arguments) + +h.apply(this, arguments)) / 2, m = (+v.apply(this, arguments) + +A.apply(this, arguments)) / 2 - an / 2;
return [V(m) * n, D(m) * n];
}, i.innerRadius = function(n) {
return arguments.length ? (l = typeof n == "function" ? n : H(+n), i) : l;
}, i.outerRadius = function(n) {
return arguments.length ? (h = typeof n == "function" ? n : H(+n), i) : h;
}, i.cornerRadius = function(n) {
return arguments.length ? (z = typeof n == "function" ? n : H(+n), i) : z;
}, i.padRadius = function(n) {
return arguments.length ? (E = n == null ? null : typeof n == "function" ? n : H(+n), i) : E;
}, i.startAngle = function(n) {
return arguments.length ? (v = typeof n == "function" ? n : H(+n), i) : v;
}, i.endAngle = function(n) {
return arguments.length ? (A = typeof n == "function" ? n : H(+n), i) : A;
}, i.padAngle = function(n) {
return arguments.length ? (I = typeof n == "function" ? n : H(+n), i) : I;
}, i.context = function(n) {
return arguments.length ? (a = n ?? null, i) : a;
}, i;
}
export {
vn as d
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,5 @@
import { aI as o, aJ as r } from "./mermaid-9f2aa176.js";
const s = (a, n) => o.lang.round(r.parse(a)[n]), e = s;
export {
e as c
};

View file

@ -0,0 +1,8 @@
import { aI as _, aJ as Color } from "./mermaid-dcacb631.js";
const channel = (color, channel2) => {
return _.lang.round(Color.parse(color)[channel2]);
};
const channel$1 = channel;
export {
channel$1 as c
};

View file

@ -0,0 +1,356 @@
import { p as parser, d as db, s as styles } from "./styles-36a1a2e8.js";
import { F as curveBasis, A as utils, l as log, G as parseGenericTypes, c as getConfig, j as d3select, k as configureSvgSize } from "./mermaid-dcacb631.js";
import { G as Graph } from "./graph-fe24fab6.js";
import { l as layout } from "./layout-163b9689.js";
import { l as line } from "./line-87f517ef.js";
import "./array-b7dcf730.js";
import "./path-39bad7e2.js";
let edgeCount = 0;
const drawEdge = function(elem, path, relation, conf, diagObj) {
const getRelationType = function(type) {
switch (type) {
case diagObj.db.relationType.AGGREGATION:
return "aggregation";
case diagObj.db.relationType.EXTENSION:
return "extension";
case diagObj.db.relationType.COMPOSITION:
return "composition";
case diagObj.db.relationType.DEPENDENCY:
return "dependency";
case diagObj.db.relationType.LOLLIPOP:
return "lollipop";
}
};
path.points = path.points.filter((p) => !Number.isNaN(p.y));
const lineData = path.points;
const lineFunction = line().x(function(d) {
return d.x;
}).y(function(d) {
return d.y;
}).curve(curveBasis);
const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "relation");
let url = "";
if (conf.arrowMarkerAbsolute) {
url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
url = url.replace(/\(/g, "\\(");
url = url.replace(/\)/g, "\\)");
}
if (relation.relation.lineType == 1) {
svgPath.attr("class", "relation dashed-line");
}
if (relation.relation.lineType == 10) {
svgPath.attr("class", "relation dotted-line");
}
if (relation.relation.type1 !== "none") {
svgPath.attr(
"marker-start",
"url(" + url + "#" + getRelationType(relation.relation.type1) + "Start)"
);
}
if (relation.relation.type2 !== "none") {
svgPath.attr(
"marker-end",
"url(" + url + "#" + getRelationType(relation.relation.type2) + "End)"
);
}
let x, y;
const l = path.points.length;
let labelPosition = utils.calcLabelPosition(path.points);
x = labelPosition.x;
y = labelPosition.y;
let p1_card_x, p1_card_y;
let p2_card_x, p2_card_y;
if (l % 2 !== 0 && l > 1) {
let cardinality_1_point = utils.calcCardinalityPosition(
relation.relation.type1 !== "none",
path.points,
path.points[0]
);
let cardinality_2_point = utils.calcCardinalityPosition(
relation.relation.type2 !== "none",
path.points,
path.points[l - 1]
);
log.debug("cardinality_1_point " + JSON.stringify(cardinality_1_point));
log.debug("cardinality_2_point " + JSON.stringify(cardinality_2_point));
p1_card_x = cardinality_1_point.x;
p1_card_y = cardinality_1_point.y;
p2_card_x = cardinality_2_point.x;
p2_card_y = cardinality_2_point.y;
}
if (relation.title !== void 0) {
const g = elem.append("g").attr("class", "classLabel");
const label = g.append("text").attr("class", "label").attr("x", x).attr("y", y).attr("fill", "red").attr("text-anchor", "middle").text(relation.title);
window.label = label;
const bounds = label.node().getBBox();
g.insert("rect", ":first-child").attr("class", "box").attr("x", bounds.x - conf.padding / 2).attr("y", bounds.y - conf.padding / 2).attr("width", bounds.width + conf.padding).attr("height", bounds.height + conf.padding);
}
log.info("Rendering relation " + JSON.stringify(relation));
if (relation.relationTitle1 !== void 0 && relation.relationTitle1 !== "none") {
const g = elem.append("g").attr("class", "cardinality");
g.append("text").attr("class", "type1").attr("x", p1_card_x).attr("y", p1_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle1);
}
if (relation.relationTitle2 !== void 0 && relation.relationTitle2 !== "none") {
const g = elem.append("g").attr("class", "cardinality");
g.append("text").attr("class", "type2").attr("x", p2_card_x).attr("y", p2_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle2);
}
edgeCount++;
};
const drawClass = function(elem, classDef, conf, diagObj) {
log.debug("Rendering class ", classDef, conf);
const id = classDef.id;
const classInfo = {
id,
label: classDef.id,
width: 0,
height: 0
};
const g = elem.append("g").attr("id", diagObj.db.lookUpDomId(id)).attr("class", "classGroup");
let title;
if (classDef.link) {
title = g.append("svg:a").attr("xlink:href", classDef.link).attr("target", classDef.linkTarget).append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
} else {
title = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
}
let isFirst = true;
classDef.annotations.forEach(function(member) {
const titleText2 = title.append("tspan").text("«" + member + "»");
if (!isFirst) {
titleText2.attr("dy", conf.textHeight);
}
isFirst = false;
});
let classTitleString = getClassTitleString(classDef);
const classTitle = title.append("tspan").text(classTitleString).attr("class", "title");
if (!isFirst) {
classTitle.attr("dy", conf.textHeight);
}
const titleHeight = title.node().getBBox().height;
let membersLine;
let membersBox;
let methodsLine;
if (classDef.members.length > 0) {
membersLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin / 2).attr("y2", conf.padding + titleHeight + conf.dividerMargin / 2);
const members = g.append("text").attr("x", conf.padding).attr("y", titleHeight + conf.dividerMargin + conf.textHeight).attr("fill", "white").attr("class", "classText");
isFirst = true;
classDef.members.forEach(function(member) {
addTspan(members, member, isFirst, conf);
isFirst = false;
});
membersBox = members.node().getBBox();
}
if (classDef.methods.length > 0) {
methodsLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin + membersBox.height).attr("y2", conf.padding + titleHeight + conf.dividerMargin + membersBox.height);
const methods = g.append("text").attr("x", conf.padding).attr("y", titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight).attr("fill", "white").attr("class", "classText");
isFirst = true;
classDef.methods.forEach(function(method) {
addTspan(methods, method, isFirst, conf);
isFirst = false;
});
}
const classBox = g.node().getBBox();
var cssClassStr = " ";
if (classDef.cssClasses.length > 0) {
cssClassStr = cssClassStr + classDef.cssClasses.join(" ");
}
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", classBox.width + 2 * conf.padding).attr("height", classBox.height + conf.padding + 0.5 * conf.dividerMargin).attr("class", cssClassStr);
const rectWidth = rect.node().getBBox().width;
title.node().childNodes.forEach(function(x) {
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
});
if (classDef.tooltip) {
title.insert("title").text(classDef.tooltip);
}
if (membersLine) {
membersLine.attr("x2", rectWidth);
}
if (methodsLine) {
methodsLine.attr("x2", rectWidth);
}
classInfo.width = rectWidth;
classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
return classInfo;
};
const getClassTitleString = function(classDef) {
let classTitleString = classDef.id;
if (classDef.type) {
classTitleString += "<" + parseGenericTypes(classDef.type) + ">";
}
return classTitleString;
};
const drawNote = function(elem, note, conf, diagObj) {
log.debug("Rendering note ", note, conf);
const id = note.id;
const noteInfo = {
id,
text: note.text,
width: 0,
height: 0
};
const g = elem.append("g").attr("id", id).attr("class", "classGroup");
let text = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
const lines = JSON.parse(`"${note.text}"`).split("\n");
lines.forEach(function(line2) {
log.debug(`Adding line: ${line2}`);
text.append("tspan").text(line2).attr("class", "title").attr("dy", conf.textHeight);
});
const noteBox = g.node().getBBox();
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", noteBox.width + 2 * conf.padding).attr(
"height",
noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin
);
const rectWidth = rect.node().getBBox().width;
text.node().childNodes.forEach(function(x) {
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
});
noteInfo.width = rectWidth;
noteInfo.height = noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin;
return noteInfo;
};
const addTspan = function(textEl, member, isFirst, conf) {
const { displayText, cssStyle } = member.getDisplayDetails();
const tSpan = textEl.append("tspan").attr("x", conf.padding).text(displayText);
if (cssStyle !== "") {
tSpan.attr("style", member.cssStyle);
}
if (!isFirst) {
tSpan.attr("dy", conf.textHeight);
}
};
const svgDraw = {
getClassTitleString,
drawClass,
drawEdge,
drawNote
};
let idCache = {};
const padding = 20;
const getGraphId = function(label) {
const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label);
if (foundEntry) {
return foundEntry[0];
}
};
const insertMarkers = function(elem) {
elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
elem.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
elem.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
};
const draw = function(text, id, _version, diagObj) {
const conf = getConfig().class;
idCache = {};
log.info("Rendering diagram " + text);
const securityLevel = getConfig().securityLevel;
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = d3select("#i" + id);
}
const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
const diagram2 = root.select(`[id='${id}']`);
insertMarkers(diagram2);
const g = new Graph({
multigraph: true
});
g.setGraph({
isMultiGraph: true
});
g.setDefaultEdgeLabel(function() {
return {};
});
const classes = diagObj.db.getClasses();
const keys = Object.keys(classes);
for (const key of keys) {
const classDef = classes[key];
const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj);
idCache[node.id] = node;
g.setNode(node.id, node);
log.info("Org height: " + node.height);
}
const relations = diagObj.db.getRelations();
relations.forEach(function(relation) {
log.info(
// cspell:ignore tjoho
"tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
);
g.setEdge(
getGraphId(relation.id1),
getGraphId(relation.id2),
{
relation
},
relation.title || "DEFAULT"
);
});
const notes = diagObj.db.getNotes();
notes.forEach(function(note) {
log.debug(`Adding note: ${JSON.stringify(note)}`);
const node = svgDraw.drawNote(diagram2, note, conf, diagObj);
idCache[node.id] = node;
g.setNode(node.id, node);
if (note.class && note.class in classes) {
g.setEdge(
note.id,
getGraphId(note.class),
{
relation: {
id1: note.id,
id2: note.class,
relation: {
type1: "none",
type2: "none",
lineType: 10
}
}
},
"DEFAULT"
);
}
});
layout(g);
g.nodes().forEach(function(v) {
if (v !== void 0 && g.node(v) !== void 0) {
log.debug("Node " + v + ": " + JSON.stringify(g.node(v)));
root.select("#" + (diagObj.db.lookUpDomId(v) || v)).attr(
"transform",
"translate(" + (g.node(v).x - g.node(v).width / 2) + "," + (g.node(v).y - g.node(v).height / 2) + " )"
);
}
});
g.edges().forEach(function(e) {
if (e !== void 0 && g.edge(e) !== void 0) {
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e)));
svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj);
}
});
const svgBounds = diagram2.node().getBBox();
const width = svgBounds.width + padding * 2;
const height = svgBounds.height + padding * 2;
configureSvgSize(diagram2, height, width, conf.useMaxWidth);
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
log.debug(`viewBox ${vBox}`);
diagram2.attr("viewBox", vBox);
};
const renderer = {
draw
};
const diagram = {
parser,
db,
renderer,
styles,
init: (cnf) => {
if (!cnf.class) {
cnf.class = {};
}
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
db.clear();
}
};
export {
diagram
};

View file

@ -0,0 +1,220 @@
import { p as A, d as S, s as G } from "./styles-11e81fdd.js";
import { F as W, A as B, l as u, G as I, c as H, j as M, k as O } from "./mermaid-9f2aa176.js";
import { G as P } from "./graph-0ee63739.js";
import { l as X } from "./layout-fd473db2.js";
import { l as Y } from "./line-24d93f1b.js";
import "./array-2ff2c7a6.js";
import "./path-428ebac9.js";
let _ = 0;
const $ = function(i, a, t, o, p) {
const g = function(e) {
switch (e) {
case p.db.relationType.AGGREGATION:
return "aggregation";
case p.db.relationType.EXTENSION:
return "extension";
case p.db.relationType.COMPOSITION:
return "composition";
case p.db.relationType.DEPENDENCY:
return "dependency";
case p.db.relationType.LOLLIPOP:
return "lollipop";
}
};
a.points = a.points.filter((e) => !Number.isNaN(e.y));
const s = a.points, c = Y().x(function(e) {
return e.x;
}).y(function(e) {
return e.y;
}).curve(W), n = i.append("path").attr("d", c(s)).attr("id", "edge" + _).attr("class", "relation");
let r = "";
o.arrowMarkerAbsolute && (r = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, r = r.replace(/\(/g, "\\("), r = r.replace(/\)/g, "\\)")), t.relation.lineType == 1 && n.attr("class", "relation dashed-line"), t.relation.lineType == 10 && n.attr("class", "relation dotted-line"), t.relation.type1 !== "none" && n.attr(
"marker-start",
"url(" + r + "#" + g(t.relation.type1) + "Start)"
), t.relation.type2 !== "none" && n.attr(
"marker-end",
"url(" + r + "#" + g(t.relation.type2) + "End)"
);
let f, h;
const x = a.points.length;
let k = B.calcLabelPosition(a.points);
f = k.x, h = k.y;
let y, m, w, b;
if (x % 2 !== 0 && x > 1) {
let e = B.calcCardinalityPosition(
t.relation.type1 !== "none",
a.points,
a.points[0]
), d = B.calcCardinalityPosition(
t.relation.type2 !== "none",
a.points,
a.points[x - 1]
);
u.debug("cardinality_1_point " + JSON.stringify(e)), u.debug("cardinality_2_point " + JSON.stringify(d)), y = e.x, m = e.y, w = d.x, b = d.y;
}
if (t.title !== void 0) {
const e = i.append("g").attr("class", "classLabel"), d = e.append("text").attr("class", "label").attr("x", f).attr("y", h).attr("fill", "red").attr("text-anchor", "middle").text(t.title);
window.label = d;
const l = d.node().getBBox();
e.insert("rect", ":first-child").attr("class", "box").attr("x", l.x - o.padding / 2).attr("y", l.y - o.padding / 2).attr("width", l.width + o.padding).attr("height", l.height + o.padding);
}
u.info("Rendering relation " + JSON.stringify(t)), t.relationTitle1 !== void 0 && t.relationTitle1 !== "none" && i.append("g").attr("class", "cardinality").append("text").attr("class", "type1").attr("x", y).attr("y", m).attr("fill", "black").attr("font-size", "6").text(t.relationTitle1), t.relationTitle2 !== void 0 && t.relationTitle2 !== "none" && i.append("g").attr("class", "cardinality").append("text").attr("class", "type2").attr("x", w).attr("y", b).attr("fill", "black").attr("font-size", "6").text(t.relationTitle2), _++;
}, J = function(i, a, t, o) {
u.debug("Rendering class ", a, t);
const p = a.id, g = {
id: p,
label: a.id,
width: 0,
height: 0
}, s = i.append("g").attr("id", o.db.lookUpDomId(p)).attr("class", "classGroup");
let c;
a.link ? c = s.append("svg:a").attr("xlink:href", a.link).attr("target", a.linkTarget).append("text").attr("y", t.textHeight + t.padding).attr("x", 0) : c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
let n = !0;
a.annotations.forEach(function(d) {
const l = c.append("tspan").text("«" + d + "»");
n || l.attr("dy", t.textHeight), n = !1;
});
let r = C(a);
const f = c.append("tspan").text(r).attr("class", "title");
n || f.attr("dy", t.textHeight);
const h = c.node().getBBox().height;
let x, k, y;
if (a.members.length > 0) {
x = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin / 2).attr("y2", t.padding + h + t.dividerMargin / 2);
const d = s.append("text").attr("x", t.padding).attr("y", h + t.dividerMargin + t.textHeight).attr("fill", "white").attr("class", "classText");
n = !0, a.members.forEach(function(l) {
v(d, l, n, t), n = !1;
}), k = d.node().getBBox();
}
if (a.methods.length > 0) {
y = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin + k.height).attr("y2", t.padding + h + t.dividerMargin + k.height);
const d = s.append("text").attr("x", t.padding).attr("y", h + 2 * t.dividerMargin + k.height + t.textHeight).attr("fill", "white").attr("class", "classText");
n = !0, a.methods.forEach(function(l) {
v(d, l, n, t), n = !1;
});
}
const m = s.node().getBBox();
var w = " ";
a.cssClasses.length > 0 && (w = w + a.cssClasses.join(" "));
const e = s.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", m.width + 2 * t.padding).attr("height", m.height + t.padding + 0.5 * t.dividerMargin).attr("class", w).node().getBBox().width;
return c.node().childNodes.forEach(function(d) {
d.setAttribute("x", (e - d.getBBox().width) / 2);
}), a.tooltip && c.insert("title").text(a.tooltip), x && x.attr("x2", e), y && y.attr("x2", e), g.width = e, g.height = m.height + t.padding + 0.5 * t.dividerMargin, g;
}, C = function(i) {
let a = i.id;
return i.type && (a += "<" + I(i.type) + ">"), a;
}, Z = function(i, a, t, o) {
u.debug("Rendering note ", a, t);
const p = a.id, g = {
id: p,
text: a.text,
width: 0,
height: 0
}, s = i.append("g").attr("id", p).attr("class", "classGroup");
let c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
const n = JSON.parse(`"${a.text}"`).split(`
`);
n.forEach(function(x) {
u.debug(`Adding line: ${x}`), c.append("tspan").text(x).attr("class", "title").attr("dy", t.textHeight);
});
const r = s.node().getBBox(), h = s.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", r.width + 2 * t.padding).attr(
"height",
r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin
).node().getBBox().width;
return c.node().childNodes.forEach(function(x) {
x.setAttribute("x", (h - x.getBBox().width) / 2);
}), g.width = h, g.height = r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin, g;
}, v = function(i, a, t, o) {
const { displayText: p, cssStyle: g } = a.getDisplayDetails(), s = i.append("tspan").attr("x", o.padding).text(p);
g !== "" && s.attr("style", a.cssStyle), t || s.attr("dy", o.textHeight);
}, N = {
getClassTitleString: C,
drawClass: J,
drawEdge: $,
drawNote: Z
};
let T = {};
const E = 20, L = function(i) {
const a = Object.entries(T).find((t) => t[1].label === i);
if (a)
return a[0];
}, R = function(i) {
i.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), i.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"), i.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
}, F = function(i, a, t, o) {
const p = H().class;
T = {}, u.info("Rendering diagram " + i);
const g = H().securityLevel;
let s;
g === "sandbox" && (s = M("#i" + a));
const c = g === "sandbox" ? M(s.nodes()[0].contentDocument.body) : M("body"), n = c.select(`[id='${a}']`);
R(n);
const r = new P({
multigraph: !0
});
r.setGraph({
isMultiGraph: !0
}), r.setDefaultEdgeLabel(function() {
return {};
});
const f = o.db.getClasses(), h = Object.keys(f);
for (const e of h) {
const d = f[e], l = N.drawClass(n, d, p, o);
T[l.id] = l, r.setNode(l.id, l), u.info("Org height: " + l.height);
}
o.db.getRelations().forEach(function(e) {
u.info(
// cspell:ignore tjoho
"tjoho" + L(e.id1) + L(e.id2) + JSON.stringify(e)
), r.setEdge(
L(e.id1),
L(e.id2),
{
relation: e
},
e.title || "DEFAULT"
);
}), o.db.getNotes().forEach(function(e) {
u.debug(`Adding note: ${JSON.stringify(e)}`);
const d = N.drawNote(n, e, p, o);
T[d.id] = d, r.setNode(d.id, d), e.class && e.class in f && r.setEdge(
e.id,
L(e.class),
{
relation: {
id1: e.id,
id2: e.class,
relation: {
type1: "none",
type2: "none",
lineType: 10
}
}
},
"DEFAULT"
);
}), X(r), r.nodes().forEach(function(e) {
e !== void 0 && r.node(e) !== void 0 && (u.debug("Node " + e + ": " + JSON.stringify(r.node(e))), c.select("#" + (o.db.lookUpDomId(e) || e)).attr(
"transform",
"translate(" + (r.node(e).x - r.node(e).width / 2) + "," + (r.node(e).y - r.node(e).height / 2) + " )"
));
}), r.edges().forEach(function(e) {
e !== void 0 && r.edge(e) !== void 0 && (u.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(r.edge(e))), N.drawEdge(n, r.edge(e), r.edge(e).relation, p, o));
});
const y = n.node().getBBox(), m = y.width + E * 2, w = y.height + E * 2;
O(n, w, m, p.useMaxWidth);
const b = `${y.x - E} ${y.y - E} ${m} ${w}`;
u.debug(`viewBox ${b}`), n.attr("viewBox", b);
}, U = {
draw: F
}, tt = {
parser: A,
db: S,
renderer: U,
styles: G,
init: (i) => {
i.class || (i.class = {}), i.class.arrowMarkerAbsolute = i.arrowMarkerAbsolute, S.clear();
}
};
export {
tt as diagram
};

View file

@ -0,0 +1,363 @@
import { p as parser, d as db, s as styles } from "./styles-b83b31c9.js";
import { line, curveBasis, select } from "d3";
import { layout } from "dagre-d3-es/src/dagre/index.js";
import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
import { u as utils, l as log, x as parseGenericTypes, c as getConfig, i as configureSvgSize } from "./mermaid-6dc72991.js";
import "ts-dedent";
import "dayjs";
import "@braintree/sanitize-url";
import "dompurify";
import "khroma";
import "lodash-es/memoize.js";
import "lodash-es/merge.js";
import "stylis";
import "lodash-es/isEmpty.js";
let edgeCount = 0;
const drawEdge = function(elem, path, relation, conf, diagObj) {
const getRelationType = function(type) {
switch (type) {
case diagObj.db.relationType.AGGREGATION:
return "aggregation";
case diagObj.db.relationType.EXTENSION:
return "extension";
case diagObj.db.relationType.COMPOSITION:
return "composition";
case diagObj.db.relationType.DEPENDENCY:
return "dependency";
case diagObj.db.relationType.LOLLIPOP:
return "lollipop";
}
};
path.points = path.points.filter((p) => !Number.isNaN(p.y));
const lineData = path.points;
const lineFunction = line().x(function(d) {
return d.x;
}).y(function(d) {
return d.y;
}).curve(curveBasis);
const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "relation");
let url = "";
if (conf.arrowMarkerAbsolute) {
url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
url = url.replace(/\(/g, "\\(");
url = url.replace(/\)/g, "\\)");
}
if (relation.relation.lineType == 1) {
svgPath.attr("class", "relation dashed-line");
}
if (relation.relation.lineType == 10) {
svgPath.attr("class", "relation dotted-line");
}
if (relation.relation.type1 !== "none") {
svgPath.attr(
"marker-start",
"url(" + url + "#" + getRelationType(relation.relation.type1) + "Start)"
);
}
if (relation.relation.type2 !== "none") {
svgPath.attr(
"marker-end",
"url(" + url + "#" + getRelationType(relation.relation.type2) + "End)"
);
}
let x, y;
const l = path.points.length;
let labelPosition = utils.calcLabelPosition(path.points);
x = labelPosition.x;
y = labelPosition.y;
let p1_card_x, p1_card_y;
let p2_card_x, p2_card_y;
if (l % 2 !== 0 && l > 1) {
let cardinality_1_point = utils.calcCardinalityPosition(
relation.relation.type1 !== "none",
path.points,
path.points[0]
);
let cardinality_2_point = utils.calcCardinalityPosition(
relation.relation.type2 !== "none",
path.points,
path.points[l - 1]
);
log.debug("cardinality_1_point " + JSON.stringify(cardinality_1_point));
log.debug("cardinality_2_point " + JSON.stringify(cardinality_2_point));
p1_card_x = cardinality_1_point.x;
p1_card_y = cardinality_1_point.y;
p2_card_x = cardinality_2_point.x;
p2_card_y = cardinality_2_point.y;
}
if (relation.title !== void 0) {
const g = elem.append("g").attr("class", "classLabel");
const label = g.append("text").attr("class", "label").attr("x", x).attr("y", y).attr("fill", "red").attr("text-anchor", "middle").text(relation.title);
window.label = label;
const bounds = label.node().getBBox();
g.insert("rect", ":first-child").attr("class", "box").attr("x", bounds.x - conf.padding / 2).attr("y", bounds.y - conf.padding / 2).attr("width", bounds.width + conf.padding).attr("height", bounds.height + conf.padding);
}
log.info("Rendering relation " + JSON.stringify(relation));
if (relation.relationTitle1 !== void 0 && relation.relationTitle1 !== "none") {
const g = elem.append("g").attr("class", "cardinality");
g.append("text").attr("class", "type1").attr("x", p1_card_x).attr("y", p1_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle1);
}
if (relation.relationTitle2 !== void 0 && relation.relationTitle2 !== "none") {
const g = elem.append("g").attr("class", "cardinality");
g.append("text").attr("class", "type2").attr("x", p2_card_x).attr("y", p2_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle2);
}
edgeCount++;
};
const drawClass = function(elem, classDef, conf, diagObj) {
log.debug("Rendering class ", classDef, conf);
const id = classDef.id;
const classInfo = {
id,
label: classDef.id,
width: 0,
height: 0
};
const g = elem.append("g").attr("id", diagObj.db.lookUpDomId(id)).attr("class", "classGroup");
let title;
if (classDef.link) {
title = g.append("svg:a").attr("xlink:href", classDef.link).attr("target", classDef.linkTarget).append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
} else {
title = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
}
let isFirst = true;
classDef.annotations.forEach(function(member) {
const titleText2 = title.append("tspan").text("«" + member + "»");
if (!isFirst) {
titleText2.attr("dy", conf.textHeight);
}
isFirst = false;
});
let classTitleString = getClassTitleString(classDef);
const classTitle = title.append("tspan").text(classTitleString).attr("class", "title");
if (!isFirst) {
classTitle.attr("dy", conf.textHeight);
}
const titleHeight = title.node().getBBox().height;
let membersLine;
let membersBox;
let methodsLine;
if (classDef.members.length > 0) {
membersLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin / 2).attr("y2", conf.padding + titleHeight + conf.dividerMargin / 2);
const members = g.append("text").attr("x", conf.padding).attr("y", titleHeight + conf.dividerMargin + conf.textHeight).attr("fill", "white").attr("class", "classText");
isFirst = true;
classDef.members.forEach(function(member) {
addTspan(members, member, isFirst, conf);
isFirst = false;
});
membersBox = members.node().getBBox();
}
if (classDef.methods.length > 0) {
methodsLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin + membersBox.height).attr("y2", conf.padding + titleHeight + conf.dividerMargin + membersBox.height);
const methods = g.append("text").attr("x", conf.padding).attr("y", titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight).attr("fill", "white").attr("class", "classText");
isFirst = true;
classDef.methods.forEach(function(method) {
addTspan(methods, method, isFirst, conf);
isFirst = false;
});
}
const classBox = g.node().getBBox();
var cssClassStr = " ";
if (classDef.cssClasses.length > 0) {
cssClassStr = cssClassStr + classDef.cssClasses.join(" ");
}
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", classBox.width + 2 * conf.padding).attr("height", classBox.height + conf.padding + 0.5 * conf.dividerMargin).attr("class", cssClassStr);
const rectWidth = rect.node().getBBox().width;
title.node().childNodes.forEach(function(x) {
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
});
if (classDef.tooltip) {
title.insert("title").text(classDef.tooltip);
}
if (membersLine) {
membersLine.attr("x2", rectWidth);
}
if (methodsLine) {
methodsLine.attr("x2", rectWidth);
}
classInfo.width = rectWidth;
classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
return classInfo;
};
const getClassTitleString = function(classDef) {
let classTitleString = classDef.id;
if (classDef.type) {
classTitleString += "<" + parseGenericTypes(classDef.type) + ">";
}
return classTitleString;
};
const drawNote = function(elem, note, conf, diagObj) {
log.debug("Rendering note ", note, conf);
const id = note.id;
const noteInfo = {
id,
text: note.text,
width: 0,
height: 0
};
const g = elem.append("g").attr("id", id).attr("class", "classGroup");
let text = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
const lines = JSON.parse(`"${note.text}"`).split("\n");
lines.forEach(function(line2) {
log.debug(`Adding line: ${line2}`);
text.append("tspan").text(line2).attr("class", "title").attr("dy", conf.textHeight);
});
const noteBox = g.node().getBBox();
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", noteBox.width + 2 * conf.padding).attr(
"height",
noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin
);
const rectWidth = rect.node().getBBox().width;
text.node().childNodes.forEach(function(x) {
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
});
noteInfo.width = rectWidth;
noteInfo.height = noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin;
return noteInfo;
};
const addTspan = function(textEl, member, isFirst, conf) {
const { displayText, cssStyle } = member.getDisplayDetails();
const tSpan = textEl.append("tspan").attr("x", conf.padding).text(displayText);
if (cssStyle !== "") {
tSpan.attr("style", member.cssStyle);
}
if (!isFirst) {
tSpan.attr("dy", conf.textHeight);
}
};
const svgDraw = {
getClassTitleString,
drawClass,
drawEdge,
drawNote
};
let idCache = {};
const padding = 20;
const getGraphId = function(label) {
const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label);
if (foundEntry) {
return foundEntry[0];
}
};
const insertMarkers = function(elem) {
elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
elem.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
elem.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
};
const draw = function(text, id, _version, diagObj) {
const conf = getConfig().class;
idCache = {};
log.info("Rendering diagram " + text);
const securityLevel = getConfig().securityLevel;
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = select("#i" + id);
}
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
const diagram2 = root.select(`[id='${id}']`);
insertMarkers(diagram2);
const g = new graphlib.Graph({
multigraph: true
});
g.setGraph({
isMultiGraph: true
});
g.setDefaultEdgeLabel(function() {
return {};
});
const classes = diagObj.db.getClasses();
const keys = Object.keys(classes);
for (const key of keys) {
const classDef = classes[key];
const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj);
idCache[node.id] = node;
g.setNode(node.id, node);
log.info("Org height: " + node.height);
}
const relations = diagObj.db.getRelations();
relations.forEach(function(relation) {
log.info(
// cspell:ignore tjoho
"tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
);
g.setEdge(
getGraphId(relation.id1),
getGraphId(relation.id2),
{
relation
},
relation.title || "DEFAULT"
);
});
const notes = diagObj.db.getNotes();
notes.forEach(function(note) {
log.debug(`Adding note: ${JSON.stringify(note)}`);
const node = svgDraw.drawNote(diagram2, note, conf, diagObj);
idCache[node.id] = node;
g.setNode(node.id, node);
if (note.class && note.class in classes) {
g.setEdge(
note.id,
getGraphId(note.class),
{
relation: {
id1: note.id,
id2: note.class,
relation: {
type1: "none",
type2: "none",
lineType: 10
}
}
},
"DEFAULT"
);
}
});
layout(g);
g.nodes().forEach(function(v) {
if (v !== void 0 && g.node(v) !== void 0) {
log.debug("Node " + v + ": " + JSON.stringify(g.node(v)));
root.select("#" + (diagObj.db.lookUpDomId(v) || v)).attr(
"transform",
"translate(" + (g.node(v).x - g.node(v).width / 2) + "," + (g.node(v).y - g.node(v).height / 2) + " )"
);
}
});
g.edges().forEach(function(e) {
if (e !== void 0 && g.edge(e) !== void 0) {
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e)));
svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj);
}
});
const svgBounds = diagram2.node().getBBox();
const width = svgBounds.width + padding * 2;
const height = svgBounds.height + padding * 2;
configureSvgSize(diagram2, height, width, conf.useMaxWidth);
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
log.debug(`viewBox ${vBox}`);
diagram2.attr("viewBox", vBox);
};
const renderer = {
draw
};
const diagram = {
parser,
db,
renderer,
styles,
init: (cnf) => {
if (!cnf.class) {
cnf.class = {};
}
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
db.clear();
}
};
export {
diagram
};

View file

@ -0,0 +1,206 @@
import { p as R, d as N, s as $ } from "./styles-11e81fdd.js";
import { l as c, c as r, j as k, A as B, t as G, o as E, q as A, n as C, f as _ } from "./mermaid-9f2aa176.js";
import { G as q } from "./graph-0ee63739.js";
import { r as z } from "./index-bb6d8841.js";
import "./layout-fd473db2.js";
import "./clone-afc2f047.js";
import "./edges-16357fde.js";
import "./createText-03b82060.js";
import "./line-24d93f1b.js";
import "./array-2ff2c7a6.js";
import "./path-428ebac9.js";
const S = (o) => _.sanitizeText(o, r());
let v = {
dividerMargin: 10,
padding: 5,
textHeight: 10,
curve: void 0
};
const P = function(o, e, p, n) {
const t = Object.keys(o);
c.info("keys:", t), c.info(o), t.forEach(function(s) {
var y, d;
const l = o[s], i = {
shape: "rect",
id: l.id,
domId: l.domId,
labelText: S(l.id),
labelStyle: "",
style: "fill: none; stroke: black",
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
padding: ((y = r().flowchart) == null ? void 0 : y.padding) ?? ((d = r().class) == null ? void 0 : d.padding)
};
e.setNode(l.id, i), I(l.classes, e, p, n, l.id), c.info("setNode", i);
});
}, I = function(o, e, p, n, t) {
const s = Object.keys(o);
c.info("keys:", s), c.info(o), s.filter((l) => o[l].parent == t).forEach(function(l) {
var u, m;
const a = o[l], i = a.cssClasses.join(" "), y = E(a.styles), d = a.label ?? a.id, f = 0, h = "class_box", b = {
labelStyle: y.labelStyle,
shape: h,
labelText: S(d),
classData: a,
rx: f,
ry: f,
class: i,
style: y.style,
id: a.id,
domId: a.domId,
tooltip: n.db.getTooltip(a.id, t) || "",
haveCallback: a.haveCallback,
link: a.link,
width: a.type === "group" ? 500 : void 0,
type: a.type,
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
padding: ((u = r().flowchart) == null ? void 0 : u.padding) ?? ((m = r().class) == null ? void 0 : m.padding)
};
e.setNode(a.id, b), t && e.setParent(a.id, t), c.info("setNode", b);
});
}, F = function(o, e, p, n) {
c.info(o), o.forEach(function(t, s) {
var m, g;
const l = t, a = "", i = { labelStyle: "", style: "" }, y = l.text, d = 0, f = "note", h = {
labelStyle: i.labelStyle,
shape: f,
labelText: S(y),
noteData: l,
rx: d,
ry: d,
class: a,
style: i.style,
id: l.id,
domId: l.id,
tooltip: "",
type: "note",
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
padding: ((m = r().flowchart) == null ? void 0 : m.padding) ?? ((g = r().class) == null ? void 0 : g.padding)
};
if (e.setNode(l.id, h), c.info("setNode", h), !l.class || !(l.class in n))
return;
const b = p + s, u = {
id: `edgeNote${b}`,
//Set relationship style and line type
classes: "relation",
pattern: "dotted",
// Set link type for rendering
arrowhead: "none",
//Set edge extra labels
startLabelRight: "",
endLabelLeft: "",
//Set relation arrow types
arrowTypeStart: "none",
arrowTypeEnd: "none",
style: "fill:none",
labelStyle: "",
curve: A(v.curve, C)
};
e.setEdge(l.id, l.class, u, b);
});
}, H = function(o, e) {
const p = r().flowchart;
let n = 0;
o.forEach(function(t) {
var l;
n++;
const s = {
//Set relationship style and line type
classes: "relation",
pattern: t.relation.lineType == 1 ? "dashed" : "solid",
id: `id_${t.id1}_${t.id2}_${n}`,
// Set link type for rendering
arrowhead: t.type === "arrow_open" ? "none" : "normal",
//Set edge extra labels
startLabelRight: t.relationTitle1 === "none" ? "" : t.relationTitle1,
endLabelLeft: t.relationTitle2 === "none" ? "" : t.relationTitle2,
//Set relation arrow types
arrowTypeStart: D(t.relation.type1),
arrowTypeEnd: D(t.relation.type2),
style: "fill:none",
labelStyle: "",
curve: A(p == null ? void 0 : p.curve, C)
};
if (c.info(s, t), t.style !== void 0) {
const a = E(t.style);
s.style = a.style, s.labelStyle = a.labelStyle;
}
t.text = t.title, t.text === void 0 ? t.style !== void 0 && (s.arrowheadStyle = "fill: #333") : (s.arrowheadStyle = "fill: #333", s.labelpos = "c", ((l = r().flowchart) == null ? void 0 : l.htmlLabels) ?? r().htmlLabels ? (s.labelType = "html", s.label = '<span class="edgeLabel">' + t.text + "</span>") : (s.labelType = "text", s.label = t.text.replace(_.lineBreakRegex, `
`), t.style === void 0 && (s.style = s.style || "stroke: #333; stroke-width: 1.5px;fill:none"), s.labelStyle = s.labelStyle.replace("color:", "fill:"))), e.setEdge(t.id1, t.id2, s, n);
});
}, V = function(o) {
v = {
...v,
...o
};
}, W = async function(o, e, p, n) {
c.info("Drawing class - ", e);
const t = r().flowchart ?? r().class, s = r().securityLevel;
c.info("config:", t);
const l = (t == null ? void 0 : t.nodeSpacing) ?? 50, a = (t == null ? void 0 : t.rankSpacing) ?? 50, i = new q({
multigraph: !0,
compound: !0
}).setGraph({
rankdir: n.db.getDirection(),
nodesep: l,
ranksep: a,
marginx: 8,
marginy: 8
}).setDefaultEdgeLabel(function() {
return {};
}), y = n.db.getNamespaces(), d = n.db.getClasses(), f = n.db.getRelations(), h = n.db.getNotes();
c.info(f), P(y, i, e, n), I(d, i, e, n), H(f, i), F(h, i, f.length + 1, d);
let b;
s === "sandbox" && (b = k("#i" + e));
const u = s === "sandbox" ? k(b.nodes()[0].contentDocument.body) : k("body"), m = u.select(`[id="${e}"]`), g = u.select("#" + e + " g");
if (await z(
g,
i,
["aggregation", "extension", "composition", "dependency", "lollipop"],
"classDiagram",
e
), B.insertTitle(m, "classTitleText", (t == null ? void 0 : t.titleTopMargin) ?? 5, n.db.getDiagramTitle()), G(i, m, t == null ? void 0 : t.diagramPadding, t == null ? void 0 : t.useMaxWidth), !(t != null && t.htmlLabels)) {
const T = s === "sandbox" ? b.nodes()[0].contentDocument : document, M = T.querySelectorAll('[id="' + e + '"] .edgeLabel .label');
for (const w of M) {
const L = w.getBBox(), x = T.createElementNS("http://www.w3.org/2000/svg", "rect");
x.setAttribute("rx", 0), x.setAttribute("ry", 0), x.setAttribute("width", L.width), x.setAttribute("height", L.height), w.insertBefore(x, w.firstChild);
}
}
};
function D(o) {
let e;
switch (o) {
case 0:
e = "aggregation";
break;
case 1:
e = "extension";
break;
case 2:
e = "composition";
break;
case 3:
e = "dependency";
break;
case 4:
e = "lollipop";
break;
default:
e = "none";
}
return e;
}
const J = {
setConf: V,
draw: W
}, ot = {
parser: R,
db: N,
renderer: J,
styles: $,
init: (o) => {
o.class || (o.class = {}), o.class.arrowMarkerAbsolute = o.arrowMarkerAbsolute, N.clear();
}
};
export {
ot as diagram
};

View file

@ -0,0 +1,298 @@
import { p as parser, d as db, s as styles } from "./styles-b83b31c9.js";
import { select, curveLinear } from "d3";
import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
import { l as log, c as getConfig, u as utils, o as setupGraphViewbox, k as getStylesFromArray, n as interpolateToCurve, e as common } from "./mermaid-6dc72991.js";
import { r as render } from "./index-01f381cb.js";
import "ts-dedent";
import "dayjs";
import "@braintree/sanitize-url";
import "dompurify";
import "khroma";
import "lodash-es/memoize.js";
import "lodash-es/merge.js";
import "stylis";
import "lodash-es/isEmpty.js";
import "dagre-d3-es/src/dagre/index.js";
import "dagre-d3-es/src/graphlib/json.js";
import "./edges-066a5561.js";
import "./createText-ca0c5216.js";
import "mdast-util-from-markdown";
const sanitizeText = (txt) => common.sanitizeText(txt, getConfig());
let conf = {
dividerMargin: 10,
padding: 5,
textHeight: 10,
curve: void 0
};
const addNamespaces = function(namespaces, g, _id, diagObj) {
const keys = Object.keys(namespaces);
log.info("keys:", keys);
log.info(namespaces);
keys.forEach(function(id) {
var _a, _b;
const vertex = namespaces[id];
const shape = "rect";
const node = {
shape,
id: vertex.id,
domId: vertex.domId,
labelText: sanitizeText(vertex.id),
labelStyle: "",
style: "fill: none; stroke: black",
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
};
g.setNode(vertex.id, node);
addClasses(vertex.classes, g, _id, diagObj, vertex.id);
log.info("setNode", node);
});
};
const addClasses = function(classes, g, _id, diagObj, parent) {
const keys = Object.keys(classes);
log.info("keys:", keys);
log.info(classes);
keys.filter((id) => classes[id].parent == parent).forEach(function(id) {
var _a, _b;
const vertex = classes[id];
const cssClassStr = vertex.cssClasses.join(" ");
const styles2 = getStylesFromArray(vertex.styles);
const vertexText = vertex.label ?? vertex.id;
const radius = 0;
const shape = "class_box";
const node = {
labelStyle: styles2.labelStyle,
shape,
labelText: sanitizeText(vertexText),
classData: vertex,
rx: radius,
ry: radius,
class: cssClassStr,
style: styles2.style,
id: vertex.id,
domId: vertex.domId,
tooltip: diagObj.db.getTooltip(vertex.id, parent) || "",
haveCallback: vertex.haveCallback,
link: vertex.link,
width: vertex.type === "group" ? 500 : void 0,
type: vertex.type,
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
};
g.setNode(vertex.id, node);
if (parent) {
g.setParent(vertex.id, parent);
}
log.info("setNode", node);
});
};
const addNotes = function(notes, g, startEdgeId, classes) {
log.info(notes);
notes.forEach(function(note, i) {
var _a, _b;
const vertex = note;
const cssNoteStr = "";
const styles2 = { labelStyle: "", style: "" };
const vertexText = vertex.text;
const radius = 0;
const shape = "note";
const node = {
labelStyle: styles2.labelStyle,
shape,
labelText: sanitizeText(vertexText),
noteData: vertex,
rx: radius,
ry: radius,
class: cssNoteStr,
style: styles2.style,
id: vertex.id,
domId: vertex.id,
tooltip: "",
type: "note",
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
};
g.setNode(vertex.id, node);
log.info("setNode", node);
if (!vertex.class || !(vertex.class in classes)) {
return;
}
const edgeId = startEdgeId + i;
const edgeData = {
id: `edgeNote${edgeId}`,
//Set relationship style and line type
classes: "relation",
pattern: "dotted",
// Set link type for rendering
arrowhead: "none",
//Set edge extra labels
startLabelRight: "",
endLabelLeft: "",
//Set relation arrow types
arrowTypeStart: "none",
arrowTypeEnd: "none",
style: "fill:none",
labelStyle: "",
curve: interpolateToCurve(conf.curve, curveLinear)
};
g.setEdge(vertex.id, vertex.class, edgeData, edgeId);
});
};
const addRelations = function(relations, g) {
const conf2 = getConfig().flowchart;
let cnt = 0;
relations.forEach(function(edge) {
var _a;
cnt++;
const edgeData = {
//Set relationship style and line type
classes: "relation",
pattern: edge.relation.lineType == 1 ? "dashed" : "solid",
id: `id_${edge.id1}_${edge.id2}_${cnt}`,
// Set link type for rendering
arrowhead: edge.type === "arrow_open" ? "none" : "normal",
//Set edge extra labels
startLabelRight: edge.relationTitle1 === "none" ? "" : edge.relationTitle1,
endLabelLeft: edge.relationTitle2 === "none" ? "" : edge.relationTitle2,
//Set relation arrow types
arrowTypeStart: getArrowMarker(edge.relation.type1),
arrowTypeEnd: getArrowMarker(edge.relation.type2),
style: "fill:none",
labelStyle: "",
curve: interpolateToCurve(conf2 == null ? void 0 : conf2.curve, curveLinear)
};
log.info(edgeData, edge);
if (edge.style !== void 0) {
const styles2 = getStylesFromArray(edge.style);
edgeData.style = styles2.style;
edgeData.labelStyle = styles2.labelStyle;
}
edge.text = edge.title;
if (edge.text === void 0) {
if (edge.style !== void 0) {
edgeData.arrowheadStyle = "fill: #333";
}
} else {
edgeData.arrowheadStyle = "fill: #333";
edgeData.labelpos = "c";
if (((_a = getConfig().flowchart) == null ? void 0 : _a.htmlLabels) ?? getConfig().htmlLabels) {
edgeData.labelType = "html";
edgeData.label = '<span class="edgeLabel">' + edge.text + "</span>";
} else {
edgeData.labelType = "text";
edgeData.label = edge.text.replace(common.lineBreakRegex, "\n");
if (edge.style === void 0) {
edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none";
}
edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
}
}
g.setEdge(edge.id1, edge.id2, edgeData, cnt);
});
};
const setConf = function(cnf) {
conf = {
...conf,
...cnf
};
};
const draw = async function(text, id, _version, diagObj) {
log.info("Drawing class - ", id);
const conf2 = getConfig().flowchart ?? getConfig().class;
const securityLevel = getConfig().securityLevel;
log.info("config:", conf2);
const nodeSpacing = (conf2 == null ? void 0 : conf2.nodeSpacing) ?? 50;
const rankSpacing = (conf2 == null ? void 0 : conf2.rankSpacing) ?? 50;
const g = new graphlib.Graph({
multigraph: true,
compound: true
}).setGraph({
rankdir: diagObj.db.getDirection(),
nodesep: nodeSpacing,
ranksep: rankSpacing,
marginx: 8,
marginy: 8
}).setDefaultEdgeLabel(function() {
return {};
});
const namespaces = diagObj.db.getNamespaces();
const classes = diagObj.db.getClasses();
const relations = diagObj.db.getRelations();
const notes = diagObj.db.getNotes();
log.info(relations);
addNamespaces(namespaces, g, id, diagObj);
addClasses(classes, g, id, diagObj);
addRelations(relations, g);
addNotes(notes, g, relations.length + 1, classes);
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = select("#i" + id);
}
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
const svg = root.select(`[id="${id}"]`);
const element = root.select("#" + id + " g");
await render(
element,
g,
["aggregation", "extension", "composition", "dependency", "lollipop"],
"classDiagram",
id
);
utils.insertTitle(svg, "classTitleText", (conf2 == null ? void 0 : conf2.titleTopMargin) ?? 5, diagObj.db.getDiagramTitle());
setupGraphViewbox(g, svg, conf2 == null ? void 0 : conf2.diagramPadding, conf2 == null ? void 0 : conf2.useMaxWidth);
if (!(conf2 == null ? void 0 : conf2.htmlLabels)) {
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
for (const label of labels) {
const dim = label.getBBox();
const rect = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
rect.setAttribute("rx", 0);
rect.setAttribute("ry", 0);
rect.setAttribute("width", dim.width);
rect.setAttribute("height", dim.height);
label.insertBefore(rect, label.firstChild);
}
}
};
function getArrowMarker(type) {
let marker;
switch (type) {
case 0:
marker = "aggregation";
break;
case 1:
marker = "extension";
break;
case 2:
marker = "composition";
break;
case 3:
marker = "dependency";
break;
case 4:
marker = "lollipop";
break;
default:
marker = "none";
}
return marker;
}
const renderer = {
setConf,
draw
};
const diagram = {
parser,
db,
renderer,
styles,
init: (cnf) => {
if (!cnf.class) {
cnf.class = {};
}
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
db.clear();
}
};
export {
diagram
};

View file

@ -0,0 +1,290 @@
import { p as parser, d as db, s as styles } from "./styles-36a1a2e8.js";
import { l as log, c as getConfig, j as d3select, A as utils, t as setupGraphViewbox, o as getStylesFromArray, q as interpolateToCurve, n as curveLinear, f as common } from "./mermaid-dcacb631.js";
import { G as Graph } from "./graph-fe24fab6.js";
import { r as render } from "./index-fc479858.js";
import "./layout-163b9689.js";
import "./clone-9ea6bfeb.js";
import "./edges-ce5cfb7c.js";
import "./createText-b70fe78a.js";
import "./line-87f517ef.js";
import "./array-b7dcf730.js";
import "./path-39bad7e2.js";
const sanitizeText = (txt) => common.sanitizeText(txt, getConfig());
let conf = {
dividerMargin: 10,
padding: 5,
textHeight: 10,
curve: void 0
};
const addNamespaces = function(namespaces, g, _id, diagObj) {
const keys = Object.keys(namespaces);
log.info("keys:", keys);
log.info(namespaces);
keys.forEach(function(id) {
var _a, _b;
const vertex = namespaces[id];
const shape = "rect";
const node = {
shape,
id: vertex.id,
domId: vertex.domId,
labelText: sanitizeText(vertex.id),
labelStyle: "",
style: "fill: none; stroke: black",
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
};
g.setNode(vertex.id, node);
addClasses(vertex.classes, g, _id, diagObj, vertex.id);
log.info("setNode", node);
});
};
const addClasses = function(classes, g, _id, diagObj, parent) {
const keys = Object.keys(classes);
log.info("keys:", keys);
log.info(classes);
keys.filter((id) => classes[id].parent == parent).forEach(function(id) {
var _a, _b;
const vertex = classes[id];
const cssClassStr = vertex.cssClasses.join(" ");
const styles2 = getStylesFromArray(vertex.styles);
const vertexText = vertex.label ?? vertex.id;
const radius = 0;
const shape = "class_box";
const node = {
labelStyle: styles2.labelStyle,
shape,
labelText: sanitizeText(vertexText),
classData: vertex,
rx: radius,
ry: radius,
class: cssClassStr,
style: styles2.style,
id: vertex.id,
domId: vertex.domId,
tooltip: diagObj.db.getTooltip(vertex.id, parent) || "",
haveCallback: vertex.haveCallback,
link: vertex.link,
width: vertex.type === "group" ? 500 : void 0,
type: vertex.type,
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
};
g.setNode(vertex.id, node);
if (parent) {
g.setParent(vertex.id, parent);
}
log.info("setNode", node);
});
};
const addNotes = function(notes, g, startEdgeId, classes) {
log.info(notes);
notes.forEach(function(note, i) {
var _a, _b;
const vertex = note;
const cssNoteStr = "";
const styles2 = { labelStyle: "", style: "" };
const vertexText = vertex.text;
const radius = 0;
const shape = "note";
const node = {
labelStyle: styles2.labelStyle,
shape,
labelText: sanitizeText(vertexText),
noteData: vertex,
rx: radius,
ry: radius,
class: cssNoteStr,
style: styles2.style,
id: vertex.id,
domId: vertex.id,
tooltip: "",
type: "note",
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
};
g.setNode(vertex.id, node);
log.info("setNode", node);
if (!vertex.class || !(vertex.class in classes)) {
return;
}
const edgeId = startEdgeId + i;
const edgeData = {
id: `edgeNote${edgeId}`,
//Set relationship style and line type
classes: "relation",
pattern: "dotted",
// Set link type for rendering
arrowhead: "none",
//Set edge extra labels
startLabelRight: "",
endLabelLeft: "",
//Set relation arrow types
arrowTypeStart: "none",
arrowTypeEnd: "none",
style: "fill:none",
labelStyle: "",
curve: interpolateToCurve(conf.curve, curveLinear)
};
g.setEdge(vertex.id, vertex.class, edgeData, edgeId);
});
};
const addRelations = function(relations, g) {
const conf2 = getConfig().flowchart;
let cnt = 0;
relations.forEach(function(edge) {
var _a;
cnt++;
const edgeData = {
//Set relationship style and line type
classes: "relation",
pattern: edge.relation.lineType == 1 ? "dashed" : "solid",
id: `id_${edge.id1}_${edge.id2}_${cnt}`,
// Set link type for rendering
arrowhead: edge.type === "arrow_open" ? "none" : "normal",
//Set edge extra labels
startLabelRight: edge.relationTitle1 === "none" ? "" : edge.relationTitle1,
endLabelLeft: edge.relationTitle2 === "none" ? "" : edge.relationTitle2,
//Set relation arrow types
arrowTypeStart: getArrowMarker(edge.relation.type1),
arrowTypeEnd: getArrowMarker(edge.relation.type2),
style: "fill:none",
labelStyle: "",
curve: interpolateToCurve(conf2 == null ? void 0 : conf2.curve, curveLinear)
};
log.info(edgeData, edge);
if (edge.style !== void 0) {
const styles2 = getStylesFromArray(edge.style);
edgeData.style = styles2.style;
edgeData.labelStyle = styles2.labelStyle;
}
edge.text = edge.title;
if (edge.text === void 0) {
if (edge.style !== void 0) {
edgeData.arrowheadStyle = "fill: #333";
}
} else {
edgeData.arrowheadStyle = "fill: #333";
edgeData.labelpos = "c";
if (((_a = getConfig().flowchart) == null ? void 0 : _a.htmlLabels) ?? getConfig().htmlLabels) {
edgeData.labelType = "html";
edgeData.label = '<span class="edgeLabel">' + edge.text + "</span>";
} else {
edgeData.labelType = "text";
edgeData.label = edge.text.replace(common.lineBreakRegex, "\n");
if (edge.style === void 0) {
edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none";
}
edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
}
}
g.setEdge(edge.id1, edge.id2, edgeData, cnt);
});
};
const setConf = function(cnf) {
conf = {
...conf,
...cnf
};
};
const draw = async function(text, id, _version, diagObj) {
log.info("Drawing class - ", id);
const conf2 = getConfig().flowchart ?? getConfig().class;
const securityLevel = getConfig().securityLevel;
log.info("config:", conf2);
const nodeSpacing = (conf2 == null ? void 0 : conf2.nodeSpacing) ?? 50;
const rankSpacing = (conf2 == null ? void 0 : conf2.rankSpacing) ?? 50;
const g = new Graph({
multigraph: true,
compound: true
}).setGraph({
rankdir: diagObj.db.getDirection(),
nodesep: nodeSpacing,
ranksep: rankSpacing,
marginx: 8,
marginy: 8
}).setDefaultEdgeLabel(function() {
return {};
});
const namespaces = diagObj.db.getNamespaces();
const classes = diagObj.db.getClasses();
const relations = diagObj.db.getRelations();
const notes = diagObj.db.getNotes();
log.info(relations);
addNamespaces(namespaces, g, id, diagObj);
addClasses(classes, g, id, diagObj);
addRelations(relations, g);
addNotes(notes, g, relations.length + 1, classes);
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = d3select("#i" + id);
}
const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
const svg = root.select(`[id="${id}"]`);
const element = root.select("#" + id + " g");
await render(
element,
g,
["aggregation", "extension", "composition", "dependency", "lollipop"],
"classDiagram",
id
);
utils.insertTitle(svg, "classTitleText", (conf2 == null ? void 0 : conf2.titleTopMargin) ?? 5, diagObj.db.getDiagramTitle());
setupGraphViewbox(g, svg, conf2 == null ? void 0 : conf2.diagramPadding, conf2 == null ? void 0 : conf2.useMaxWidth);
if (!(conf2 == null ? void 0 : conf2.htmlLabels)) {
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
for (const label of labels) {
const dim = label.getBBox();
const rect = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
rect.setAttribute("rx", 0);
rect.setAttribute("ry", 0);
rect.setAttribute("width", dim.width);
rect.setAttribute("height", dim.height);
label.insertBefore(rect, label.firstChild);
}
}
};
function getArrowMarker(type) {
let marker;
switch (type) {
case 0:
marker = "aggregation";
break;
case 1:
marker = "extension";
break;
case 2:
marker = "composition";
break;
case 3:
marker = "dependency";
break;
case 4:
marker = "lollipop";
break;
default:
marker = "none";
}
return marker;
}
const renderer = {
setConf,
draw
};
const diagram = {
parser,
db,
renderer,
styles,
init: (cnf) => {
if (!cnf.class) {
cnf.class = {};
}
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
db.clear();
}
};
export {
diagram
};

View file

@ -0,0 +1,8 @@
import { c as baseClone } from "./graph-fe24fab6.js";
var CLONE_SYMBOLS_FLAG = 4;
function clone(value) {
return baseClone(value, CLONE_SYMBOLS_FLAG);
}
export {
clone as c
};

View file

@ -0,0 +1,8 @@
import { c as r } from "./graph-0ee63739.js";
var e = 4;
function a(o) {
return r(o, e);
}
export {
a as c
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,251 @@
import { l as log, M as decodeEntities } from "./mermaid-6dc72991.js";
import { fromMarkdown } from "mdast-util-from-markdown";
import { dedent } from "ts-dedent";
function preprocessMarkdown(markdown) {
const withoutMultipleNewlines = markdown.replace(/\n{2,}/g, "\n");
const withoutExtraSpaces = dedent(withoutMultipleNewlines);
return withoutExtraSpaces;
}
function markdownToLines(markdown) {
const preprocessedMarkdown = preprocessMarkdown(markdown);
const { children } = fromMarkdown(preprocessedMarkdown);
const lines = [[]];
let currentLine = 0;
function processNode(node, parentType = "normal") {
if (node.type === "text") {
const textLines = node.value.split("\n");
textLines.forEach((textLine, index) => {
if (index !== 0) {
currentLine++;
lines.push([]);
}
textLine.split(" ").forEach((word) => {
if (word) {
lines[currentLine].push({ content: word, type: parentType });
}
});
});
} else if (node.type === "strong" || node.type === "emphasis") {
node.children.forEach((contentNode) => {
processNode(contentNode, node.type);
});
}
}
children.forEach((treeNode) => {
if (treeNode.type === "paragraph") {
treeNode.children.forEach((contentNode) => {
processNode(contentNode);
});
}
});
return lines;
}
function markdownToHTML(markdown) {
const { children } = fromMarkdown(markdown);
function output(node) {
if (node.type === "text") {
return node.value.replace(/\n/g, "<br/>");
} else if (node.type === "strong") {
return `<strong>${node.children.map(output).join("")}</strong>`;
} else if (node.type === "emphasis") {
return `<em>${node.children.map(output).join("")}</em>`;
} else if (node.type === "paragraph") {
return `<p>${node.children.map(output).join("")}</p>`;
}
return `Unsupported markdown: ${node.type}`;
}
return children.map(output).join("");
}
function splitTextToChars(text) {
if (Intl.Segmenter) {
return [...new Intl.Segmenter().segment(text)].map((s) => s.segment);
}
return [...text];
}
function splitWordToFitWidth(checkFit, word) {
const characters = splitTextToChars(word.content);
return splitWordToFitWidthRecursion(checkFit, [], characters, word.type);
}
function splitWordToFitWidthRecursion(checkFit, usedChars, remainingChars, type) {
if (remainingChars.length === 0) {
return [
{ content: usedChars.join(""), type },
{ content: "", type }
];
}
const [nextChar, ...rest] = remainingChars;
const newWord = [...usedChars, nextChar];
if (checkFit([{ content: newWord.join(""), type }])) {
return splitWordToFitWidthRecursion(checkFit, newWord, rest, type);
}
if (usedChars.length === 0 && nextChar) {
usedChars.push(nextChar);
remainingChars.shift();
}
return [
{ content: usedChars.join(""), type },
{ content: remainingChars.join(""), type }
];
}
function splitLineToFitWidth(line, checkFit) {
if (line.some(({ content }) => content.includes("\n"))) {
throw new Error("splitLineToFitWidth does not support newlines in the line");
}
return splitLineToFitWidthRecursion(line, checkFit);
}
function splitLineToFitWidthRecursion(words, checkFit, lines = [], newLine = []) {
if (words.length === 0) {
if (newLine.length > 0) {
lines.push(newLine);
}
return lines.length > 0 ? lines : [];
}
let joiner = "";
if (words[0].content === " ") {
joiner = " ";
words.shift();
}
const nextWord = words.shift() ?? { content: " ", type: "normal" };
const lineWithNextWord = [...newLine];
if (joiner !== "") {
lineWithNextWord.push({ content: joiner, type: "normal" });
}
lineWithNextWord.push(nextWord);
if (checkFit(lineWithNextWord)) {
return splitLineToFitWidthRecursion(words, checkFit, lines, lineWithNextWord);
}
if (newLine.length > 0) {
lines.push(newLine);
words.unshift(nextWord);
} else if (nextWord.content) {
const [line, rest] = splitWordToFitWidth(checkFit, nextWord);
lines.push([line]);
if (rest.content) {
words.unshift(rest);
}
}
return splitLineToFitWidthRecursion(words, checkFit, lines);
}
function applyStyle(dom, styleFn) {
if (styleFn) {
dom.attr("style", styleFn);
}
}
function addHtmlSpan(element, node, width, classes, addBackground = false) {
const fo = element.append("foreignObject");
const div = fo.append("xhtml:div");
const label = node.label;
const labelClass = node.isNode ? "nodeLabel" : "edgeLabel";
div.html(
`
<span class="${labelClass} ${classes}" ` + (node.labelStyle ? 'style="' + node.labelStyle + '"' : "") + ">" + label + "</span>"
);
applyStyle(div, node.labelStyle);
div.style("display", "table-cell");
div.style("white-space", "nowrap");
div.style("max-width", width + "px");
div.attr("xmlns", "http://www.w3.org/1999/xhtml");
if (addBackground) {
div.attr("class", "labelBkg");
}
let bbox = div.node().getBoundingClientRect();
if (bbox.width === width) {
div.style("display", "table");
div.style("white-space", "break-spaces");
div.style("width", width + "px");
bbox = div.node().getBoundingClientRect();
}
fo.style("width", bbox.width);
fo.style("height", bbox.height);
return fo.node();
}
function createTspan(textElement, lineIndex, lineHeight) {
return textElement.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", lineIndex * lineHeight - 0.1 + "em").attr("dy", lineHeight + "em");
}
function computeWidthOfText(parentNode, lineHeight, line) {
const testElement = parentNode.append("text");
const testSpan = createTspan(testElement, 1, lineHeight);
updateTextContentAndStyles(testSpan, line);
const textLength = testSpan.node().getComputedTextLength();
testElement.remove();
return textLength;
}
function computeDimensionOfText(parentNode, lineHeight, text) {
var _a;
const testElement = parentNode.append("text");
const testSpan = createTspan(testElement, 1, lineHeight);
updateTextContentAndStyles(testSpan, [{ content: text, type: "normal" }]);
const textDimension = (_a = testSpan.node()) == null ? void 0 : _a.getBoundingClientRect();
if (textDimension) {
testElement.remove();
}
return textDimension;
}
function createFormattedText(width, g, structuredText, addBackground = false) {
const lineHeight = 1.1;
const labelGroup = g.append("g");
const bkg = labelGroup.insert("rect").attr("class", "background");
const textElement = labelGroup.append("text").attr("y", "-10.1");
let lineIndex = 0;
for (const line of structuredText) {
const checkWidth = (line2) => computeWidthOfText(labelGroup, lineHeight, line2) <= width;
const linesUnderWidth = checkWidth(line) ? [line] : splitLineToFitWidth(line, checkWidth);
for (const preparedLine of linesUnderWidth) {
const tspan = createTspan(textElement, lineIndex, lineHeight);
updateTextContentAndStyles(tspan, preparedLine);
lineIndex++;
}
}
if (addBackground) {
const bbox = textElement.node().getBBox();
const padding = 2;
bkg.attr("x", -padding).attr("y", -padding).attr("width", bbox.width + 2 * padding).attr("height", bbox.height + 2 * padding);
return labelGroup.node();
} else {
return textElement.node();
}
}
function updateTextContentAndStyles(tspan, wrappedLine) {
tspan.text("");
wrappedLine.forEach((word, index) => {
const innerTspan = tspan.append("tspan").attr("font-style", word.type === "emphasis" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", word.type === "strong" ? "bold" : "normal");
if (index === 0) {
innerTspan.text(word.content);
} else {
innerTspan.text(" " + word.content);
}
});
}
const createText = (el, text = "", {
style = "",
isTitle = false,
classes = "",
useHtmlLabels = true,
isNode = true,
width = 200,
addSvgBackground = false
} = {}) => {
log.info("createText", text, style, isTitle, classes, useHtmlLabels, isNode, addSvgBackground);
if (useHtmlLabels) {
const htmlText = markdownToHTML(text);
const node = {
isNode,
label: decodeEntities(htmlText).replace(
/fa[blrs]?:fa-[\w-]+/g,
// cspell: disable-line
(s) => `<i class='${s.replace(":", " ")}'></i>`
),
labelStyle: style.replace("fill:", "color:")
};
const vertexNode = addHtmlSpan(el, node, width, classes, addSvgBackground);
return vertexNode;
} else {
const structuredText = markdownToLines(text);
const svgLabel = createFormattedText(width, el, structuredText, addSvgBackground);
return svgLabel;
}
};
export {
createText as a,
computeDimensionOfText as c
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,931 @@
import { c as Z, s as Et, g as mt, b as gt, a as kt, C as xt, D as Rt, l as V, E as Ot, j as rt, A as bt, k as Nt, F as Tt, G as At } from "./mermaid-9f2aa176.js";
import { G as Mt } from "./graph-0ee63739.js";
import { l as St } from "./layout-fd473db2.js";
import { l as wt } from "./line-24d93f1b.js";
import "./array-2ff2c7a6.js";
import "./path-428ebac9.js";
var at = function() {
var t = function(S, a, n, c) {
for (n = n || {}, c = S.length; c--; n[S[c]] = a)
;
return n;
}, e = [6, 8, 10, 20, 22, 24, 26, 27, 28], r = [1, 10], u = [1, 11], l = [1, 12], p = [1, 13], f = [1, 14], o = [1, 15], h = [1, 21], _ = [1, 22], m = [1, 23], g = [1, 24], x = [1, 25], y = [6, 8, 10, 13, 15, 18, 19, 20, 22, 24, 26, 27, 28, 41, 42, 43, 44, 45], N = [1, 34], I = [27, 28, 46, 47], F = [41, 42, 43, 44, 45], W = [17, 34], C = [1, 54], T = [1, 53], M = [17, 34, 36, 38], R = {
trace: function() {
},
yy: {},
symbols_: { error: 2, start: 3, ER_DIAGRAM: 4, document: 5, EOF: 6, line: 7, SPACE: 8, statement: 9, NEWLINE: 10, entityName: 11, relSpec: 12, ":": 13, role: 14, BLOCK_START: 15, attributes: 16, BLOCK_STOP: 17, SQS: 18, SQE: 19, title: 20, title_value: 21, acc_title: 22, acc_title_value: 23, acc_descr: 24, acc_descr_value: 25, acc_descr_multiline_value: 26, ALPHANUM: 27, ENTITY_NAME: 28, attribute: 29, attributeType: 30, attributeName: 31, attributeKeyTypeList: 32, attributeComment: 33, ATTRIBUTE_WORD: 34, attributeKeyType: 35, COMMA: 36, ATTRIBUTE_KEY: 37, COMMENT: 38, cardinality: 39, relType: 40, ZERO_OR_ONE: 41, ZERO_OR_MORE: 42, ONE_OR_MORE: 43, ONLY_ONE: 44, MD_PARENT: 45, NON_IDENTIFYING: 46, IDENTIFYING: 47, WORD: 48, $accept: 0, $end: 1 },
terminals_: { 2: "error", 4: "ER_DIAGRAM", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 13: ":", 15: "BLOCK_START", 17: "BLOCK_STOP", 18: "SQS", 19: "SQE", 20: "title", 21: "title_value", 22: "acc_title", 23: "acc_title_value", 24: "acc_descr", 25: "acc_descr_value", 26: "acc_descr_multiline_value", 27: "ALPHANUM", 28: "ENTITY_NAME", 34: "ATTRIBUTE_WORD", 36: "COMMA", 37: "ATTRIBUTE_KEY", 38: "COMMENT", 41: "ZERO_OR_ONE", 42: "ZERO_OR_MORE", 43: "ONE_OR_MORE", 44: "ONLY_ONE", 45: "MD_PARENT", 46: "NON_IDENTIFYING", 47: "IDENTIFYING", 48: "WORD" },
productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 5], [9, 4], [9, 3], [9, 1], [9, 7], [9, 6], [9, 4], [9, 2], [9, 2], [9, 2], [9, 1], [11, 1], [11, 1], [16, 1], [16, 2], [29, 2], [29, 3], [29, 3], [29, 4], [30, 1], [31, 1], [32, 1], [32, 3], [35, 1], [33, 1], [12, 3], [39, 1], [39, 1], [39, 1], [39, 1], [39, 1], [40, 1], [40, 1], [14, 1], [14, 1], [14, 1]],
performAction: function(a, n, c, d, E, i, K) {
var s = i.length - 1;
switch (E) {
case 1:
break;
case 2:
this.$ = [];
break;
case 3:
i[s - 1].push(i[s]), this.$ = i[s - 1];
break;
case 4:
case 5:
this.$ = i[s];
break;
case 6:
case 7:
this.$ = [];
break;
case 8:
d.addEntity(i[s - 4]), d.addEntity(i[s - 2]), d.addRelationship(i[s - 4], i[s], i[s - 2], i[s - 3]);
break;
case 9:
d.addEntity(i[s - 3]), d.addAttributes(i[s - 3], i[s - 1]);
break;
case 10:
d.addEntity(i[s - 2]);
break;
case 11:
d.addEntity(i[s]);
break;
case 12:
d.addEntity(i[s - 6], i[s - 4]), d.addAttributes(i[s - 6], i[s - 1]);
break;
case 13:
d.addEntity(i[s - 5], i[s - 3]);
break;
case 14:
d.addEntity(i[s - 3], i[s - 1]);
break;
case 15:
case 16:
this.$ = i[s].trim(), d.setAccTitle(this.$);
break;
case 17:
case 18:
this.$ = i[s].trim(), d.setAccDescription(this.$);
break;
case 19:
case 43:
this.$ = i[s];
break;
case 20:
case 41:
case 42:
this.$ = i[s].replace(/"/g, "");
break;
case 21:
case 29:
this.$ = [i[s]];
break;
case 22:
i[s].push(i[s - 1]), this.$ = i[s];
break;
case 23:
this.$ = { attributeType: i[s - 1], attributeName: i[s] };
break;
case 24:
this.$ = { attributeType: i[s - 2], attributeName: i[s - 1], attributeKeyTypeList: i[s] };
break;
case 25:
this.$ = { attributeType: i[s - 2], attributeName: i[s - 1], attributeComment: i[s] };
break;
case 26:
this.$ = { attributeType: i[s - 3], attributeName: i[s - 2], attributeKeyTypeList: i[s - 1], attributeComment: i[s] };
break;
case 27:
case 28:
case 31:
this.$ = i[s];
break;
case 30:
i[s - 2].push(i[s]), this.$ = i[s - 2];
break;
case 32:
this.$ = i[s].replace(/"/g, "");
break;
case 33:
this.$ = { cardA: i[s], relType: i[s - 1], cardB: i[s - 2] };
break;
case 34:
this.$ = d.Cardinality.ZERO_OR_ONE;
break;
case 35:
this.$ = d.Cardinality.ZERO_OR_MORE;
break;
case 36:
this.$ = d.Cardinality.ONE_OR_MORE;
break;
case 37:
this.$ = d.Cardinality.ONLY_ONE;
break;
case 38:
this.$ = d.Cardinality.MD_PARENT;
break;
case 39:
this.$ = d.Identification.NON_IDENTIFYING;
break;
case 40:
this.$ = d.Identification.IDENTIFYING;
break;
}
},
table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, t(e, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 9, 20: r, 22: u, 24: l, 26: p, 27: f, 28: o }, t(e, [2, 7], { 1: [2, 1] }), t(e, [2, 3]), { 9: 16, 11: 9, 20: r, 22: u, 24: l, 26: p, 27: f, 28: o }, t(e, [2, 5]), t(e, [2, 6]), t(e, [2, 11], { 12: 17, 39: 20, 15: [1, 18], 18: [1, 19], 41: h, 42: _, 43: m, 44: g, 45: x }), { 21: [1, 26] }, { 23: [1, 27] }, { 25: [1, 28] }, t(e, [2, 18]), t(y, [2, 19]), t(y, [2, 20]), t(e, [2, 4]), { 11: 29, 27: f, 28: o }, { 16: 30, 17: [1, 31], 29: 32, 30: 33, 34: N }, { 11: 35, 27: f, 28: o }, { 40: 36, 46: [1, 37], 47: [1, 38] }, t(I, [2, 34]), t(I, [2, 35]), t(I, [2, 36]), t(I, [2, 37]), t(I, [2, 38]), t(e, [2, 15]), t(e, [2, 16]), t(e, [2, 17]), { 13: [1, 39] }, { 17: [1, 40] }, t(e, [2, 10]), { 16: 41, 17: [2, 21], 29: 32, 30: 33, 34: N }, { 31: 42, 34: [1, 43] }, { 34: [2, 27] }, { 19: [1, 44] }, { 39: 45, 41: h, 42: _, 43: m, 44: g, 45: x }, t(F, [2, 39]), t(F, [2, 40]), { 14: 46, 27: [1, 49], 28: [1, 48], 48: [1, 47] }, t(e, [2, 9]), { 17: [2, 22] }, t(W, [2, 23], { 32: 50, 33: 51, 35: 52, 37: C, 38: T }), t([17, 34, 37, 38], [2, 28]), t(e, [2, 14], { 15: [1, 55] }), t([27, 28], [2, 33]), t(e, [2, 8]), t(e, [2, 41]), t(e, [2, 42]), t(e, [2, 43]), t(W, [2, 24], { 33: 56, 36: [1, 57], 38: T }), t(W, [2, 25]), t(M, [2, 29]), t(W, [2, 32]), t(M, [2, 31]), { 16: 58, 17: [1, 59], 29: 32, 30: 33, 34: N }, t(W, [2, 26]), { 35: 60, 37: C }, { 17: [1, 61] }, t(e, [2, 13]), t(M, [2, 30]), t(e, [2, 12])],
defaultActions: { 34: [2, 27], 41: [2, 22] },
parseError: function(a, n) {
if (n.recoverable)
this.trace(a);
else {
var c = new Error(a);
throw c.hash = n, c;
}
},
parse: function(a) {
var n = this, c = [0], d = [], E = [null], i = [], K = this.table, s = "", Q = 0, st = 0, ft = 2, ot = 1, yt = i.slice.call(arguments, 1), b = Object.create(this.lexer), G = { yy: {} };
for (var J in this.yy)
Object.prototype.hasOwnProperty.call(this.yy, J) && (G.yy[J] = this.yy[J]);
b.setInput(a, G.yy), G.yy.lexer = b, G.yy.parser = this, typeof b.yylloc > "u" && (b.yylloc = {});
var $ = b.yylloc;
i.push($);
var pt = b.options && b.options.ranges;
typeof G.yy.parseError == "function" ? this.parseError = G.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
function _t() {
var Y;
return Y = d.pop() || b.lex() || ot, typeof Y != "number" && (Y instanceof Array && (d = Y, Y = d.pop()), Y = n.symbols_[Y] || Y), Y;
}
for (var w, H, D, tt, z = {}, j, P, lt, q; ; ) {
if (H = c[c.length - 1], this.defaultActions[H] ? D = this.defaultActions[H] : ((w === null || typeof w > "u") && (w = _t()), D = K[H] && K[H][w]), typeof D > "u" || !D.length || !D[0]) {
var et = "";
q = [];
for (j in K[H])
this.terminals_[j] && j > ft && q.push("'" + this.terminals_[j] + "'");
b.showPosition ? et = "Parse error on line " + (Q + 1) + `:
` + b.showPosition() + `
Expecting ` + q.join(", ") + ", got '" + (this.terminals_[w] || w) + "'" : et = "Parse error on line " + (Q + 1) + ": Unexpected " + (w == ot ? "end of input" : "'" + (this.terminals_[w] || w) + "'"), this.parseError(et, {
text: b.match,
token: this.terminals_[w] || w,
line: b.yylineno,
loc: $,
expected: q
});
}
if (D[0] instanceof Array && D.length > 1)
throw new Error("Parse Error: multiple actions possible at state: " + H + ", token: " + w);
switch (D[0]) {
case 1:
c.push(w), E.push(b.yytext), i.push(b.yylloc), c.push(D[1]), w = null, st = b.yyleng, s = b.yytext, Q = b.yylineno, $ = b.yylloc;
break;
case 2:
if (P = this.productions_[D[1]][1], z.$ = E[E.length - P], z._$ = {
first_line: i[i.length - (P || 1)].first_line,
last_line: i[i.length - 1].last_line,
first_column: i[i.length - (P || 1)].first_column,
last_column: i[i.length - 1].last_column
}, pt && (z._$.range = [
i[i.length - (P || 1)].range[0],
i[i.length - 1].range[1]
]), tt = this.performAction.apply(z, [
s,
st,
Q,
G.yy,
D[1],
E,
i
].concat(yt)), typeof tt < "u")
return tt;
P && (c = c.slice(0, -1 * P * 2), E = E.slice(0, -1 * P), i = i.slice(0, -1 * P)), c.push(this.productions_[D[1]][0]), E.push(z.$), i.push(z._$), lt = K[c[c.length - 2]][c[c.length - 1]], c.push(lt);
break;
case 3:
return !0;
}
}
return !0;
}
}, O = function() {
var S = {
EOF: 1,
parseError: function(n, c) {
if (this.yy.parser)
this.yy.parser.parseError(n, c);
else
throw new Error(n);
},
// resets the lexer, sets new input
setInput: function(a, n) {
return this.yy = n || this.yy || {}, this._input = a, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
},
// consumes and returns one char from the input
input: function() {
var a = this._input[0];
this.yytext += a, this.yyleng++, this.offset++, this.match += a, this.matched += a;
var n = a.match(/(?:\r\n?|\n).*/g);
return n ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), a;
},
// unshifts one char (or a string) into the input
unput: function(a) {
var n = a.length, c = a.split(/(?:\r\n?|\n)/g);
this._input = a + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - n), this.offset -= n;
var d = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), c.length - 1 && (this.yylineno -= c.length - 1);
var E = this.yylloc.range;
return this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: c ? (c.length === d.length ? this.yylloc.first_column : 0) + d[d.length - c.length].length - c[0].length : this.yylloc.first_column - n
}, this.options.ranges && (this.yylloc.range = [E[0], E[0] + this.yyleng - n]), this.yyleng = this.yytext.length, this;
},
// When called from action, caches matched text and appends it on next action
more: function() {
return this._more = !0, this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject: function() {
if (this.options.backtrack_lexer)
this._backtrack = !0;
else
return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
return this;
},
// retain first n characters of the match
less: function(a) {
this.unput(this.match.slice(a));
},
// displays already matched input, i.e. for error messages
pastInput: function() {
var a = this.matched.substr(0, this.matched.length - this.match.length);
return (a.length > 20 ? "..." : "") + a.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput: function() {
var a = this.match;
return a.length < 20 && (a += this._input.substr(0, 20 - a.length)), (a.substr(0, 20) + (a.length > 20 ? "..." : "")).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition: function() {
var a = this.pastInput(), n = new Array(a.length + 1).join("-");
return a + this.upcomingInput() + `
` + n + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match: function(a, n) {
var c, d, E;
if (this.options.backtrack_lexer && (E = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
}, this.options.ranges && (E.yylloc.range = this.yylloc.range.slice(0))), d = a[0].match(/(?:\r\n?|\n).*/g), d && (this.yylineno += d.length), this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: d ? d[d.length - 1].length - d[d.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + a[0].length
}, this.yytext += a[0], this.match += a[0], this.matches = a, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(a[0].length), this.matched += a[0], c = this.performAction.call(this, this.yy, this, n, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), c)
return c;
if (this._backtrack) {
for (var i in E)
this[i] = E[i];
return !1;
}
return !1;
},
// return next match in input
next: function() {
if (this.done)
return this.EOF;
this._input || (this.done = !0);
var a, n, c, d;
this._more || (this.yytext = "", this.match = "");
for (var E = this._currentRules(), i = 0; i < E.length; i++)
if (c = this._input.match(this.rules[E[i]]), c && (!n || c[0].length > n[0].length)) {
if (n = c, d = i, this.options.backtrack_lexer) {
if (a = this.test_match(c, E[i]), a !== !1)
return a;
if (this._backtrack) {
n = !1;
continue;
} else
return !1;
} else if (!this.options.flex)
break;
}
return n ? (a = this.test_match(n, E[d]), a !== !1 ? a : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
},
// return next match that has a token
lex: function() {
var n = this.next();
return n || this.lex();
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin: function(n) {
this.conditionStack.push(n);
},
// pop the previously active lexer condition state off the condition stack
popState: function() {
var n = this.conditionStack.length - 1;
return n > 0 ? this.conditionStack.pop() : this.conditionStack[0];
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules: function() {
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState: function(n) {
return n = this.conditionStack.length - 1 - Math.abs(n || 0), n >= 0 ? this.conditionStack[n] : "INITIAL";
},
// alias for begin(condition)
pushState: function(n) {
this.begin(n);
},
// return the number of states currently on the stack
stateStackSize: function() {
return this.conditionStack.length;
},
options: { "case-insensitive": !0 },
performAction: function(n, c, d, E) {
switch (d) {
case 0:
return this.begin("acc_title"), 22;
case 1:
return this.popState(), "acc_title_value";
case 2:
return this.begin("acc_descr"), 24;
case 3:
return this.popState(), "acc_descr_value";
case 4:
this.begin("acc_descr_multiline");
break;
case 5:
this.popState();
break;
case 6:
return "acc_descr_multiline_value";
case 7:
return 10;
case 8:
break;
case 9:
return 8;
case 10:
return 28;
case 11:
return 48;
case 12:
return 4;
case 13:
return this.begin("block"), 15;
case 14:
return 36;
case 15:
break;
case 16:
return 37;
case 17:
return 34;
case 18:
return 34;
case 19:
return 38;
case 20:
break;
case 21:
return this.popState(), 17;
case 22:
return c.yytext[0];
case 23:
return 18;
case 24:
return 19;
case 25:
return 41;
case 26:
return 43;
case 27:
return 43;
case 28:
return 43;
case 29:
return 41;
case 30:
return 41;
case 31:
return 42;
case 32:
return 42;
case 33:
return 42;
case 34:
return 42;
case 35:
return 42;
case 36:
return 43;
case 37:
return 42;
case 38:
return 43;
case 39:
return 44;
case 40:
return 44;
case 41:
return 44;
case 42:
return 44;
case 43:
return 41;
case 44:
return 42;
case 45:
return 43;
case 46:
return 45;
case 47:
return 46;
case 48:
return 47;
case 49:
return 47;
case 50:
return 46;
case 51:
return 46;
case 52:
return 46;
case 53:
return 27;
case 54:
return c.yytext[0];
case 55:
return 6;
}
},
rules: [/^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:[\s]+)/i, /^(?:"[^"%\r\n\v\b\\]+")/i, /^(?:"[^"]*")/i, /^(?:erDiagram\b)/i, /^(?:\{)/i, /^(?:,)/i, /^(?:\s+)/i, /^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i, /^(?:(.*?)[~](.*?)*[~])/i, /^(?:[\*A-Za-z_][A-Za-z0-9\-_\[\]\(\)]*)/i, /^(?:"[^"]*")/i, /^(?:[\n]+)/i, /^(?:\})/i, /^(?:.)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:one or zero\b)/i, /^(?:one or more\b)/i, /^(?:one or many\b)/i, /^(?:1\+)/i, /^(?:\|o\b)/i, /^(?:zero or one\b)/i, /^(?:zero or more\b)/i, /^(?:zero or many\b)/i, /^(?:0\+)/i, /^(?:\}o\b)/i, /^(?:many\(0\))/i, /^(?:many\(1\))/i, /^(?:many\b)/i, /^(?:\}\|)/i, /^(?:one\b)/i, /^(?:only one\b)/i, /^(?:1\b)/i, /^(?:\|\|)/i, /^(?:o\|)/i, /^(?:o\{)/i, /^(?:\|\{)/i, /^(?:\s*u\b)/i, /^(?:\.\.)/i, /^(?:--)/i, /^(?:to\b)/i, /^(?:optionally to\b)/i, /^(?:\.-)/i, /^(?:-\.)/i, /^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i, /^(?:.)/i, /^(?:$)/i],
conditions: { acc_descr_multiline: { rules: [5, 6], inclusive: !1 }, acc_descr: { rules: [3], inclusive: !1 }, acc_title: { rules: [1], inclusive: !1 }, block: { rules: [14, 15, 16, 17, 18, 19, 20, 21, 22], inclusive: !1 }, INITIAL: { rules: [0, 2, 4, 7, 8, 9, 10, 11, 12, 13, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55], inclusive: !0 } }
};
return S;
}();
R.lexer = O;
function L() {
this.yy = {};
}
return L.prototype = R, R.Parser = L, new L();
}();
at.parser = at;
const It = at;
let U = {}, nt = [];
const Dt = {
ZERO_OR_ONE: "ZERO_OR_ONE",
ZERO_OR_MORE: "ZERO_OR_MORE",
ONE_OR_MORE: "ONE_OR_MORE",
ONLY_ONE: "ONLY_ONE",
MD_PARENT: "MD_PARENT"
}, Lt = {
NON_IDENTIFYING: "NON_IDENTIFYING",
IDENTIFYING: "IDENTIFYING"
}, dt = function(t, e = void 0) {
return U[t] === void 0 ? (U[t] = { attributes: [], alias: e }, V.info("Added new entity :", t)) : U[t] && !U[t].alias && e && (U[t].alias = e, V.info(`Add alias '${e}' to entity '${t}'`)), U[t];
}, vt = () => U, Bt = function(t, e) {
let r = dt(t), u;
for (u = e.length - 1; u >= 0; u--)
r.attributes.push(e[u]), V.debug("Added attribute ", e[u].attributeName);
}, Ct = function(t, e, r, u) {
let l = {
entityA: t,
roleA: e,
entityB: r,
relSpec: u
};
nt.push(l), V.debug("Added new relationship :", l);
}, Pt = () => nt, Yt = function() {
U = {}, nt = [], Ot();
}, Zt = {
Cardinality: Dt,
Identification: Lt,
getConfig: () => Z().er,
addEntity: dt,
addAttributes: Bt,
getEntities: vt,
addRelationship: Ct,
getRelationships: Pt,
clear: Yt,
setAccTitle: Et,
getAccTitle: mt,
setAccDescription: gt,
getAccDescription: kt,
setDiagramTitle: xt,
getDiagramTitle: Rt
}, v = {
ONLY_ONE_START: "ONLY_ONE_START",
ONLY_ONE_END: "ONLY_ONE_END",
ZERO_OR_ONE_START: "ZERO_OR_ONE_START",
ZERO_OR_ONE_END: "ZERO_OR_ONE_END",
ONE_OR_MORE_START: "ONE_OR_MORE_START",
ONE_OR_MORE_END: "ONE_OR_MORE_END",
ZERO_OR_MORE_START: "ZERO_OR_MORE_START",
ZERO_OR_MORE_END: "ZERO_OR_MORE_END",
MD_PARENT_END: "MD_PARENT_END",
MD_PARENT_START: "MD_PARENT_START"
}, Ft = function(t, e) {
let r;
t.append("defs").append("marker").attr("id", v.MD_PARENT_START).attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", v.MD_PARENT_END).attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", v.ONLY_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M9,0 L9,18 M15,0 L15,18"), t.append("defs").append("marker").attr("id", v.ONLY_ONE_END).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M3,0 L3,18 M9,0 L9,18"), r = t.append("defs").append("marker").attr("id", v.ZERO_OR_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto"), r.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 21).attr("cy", 9).attr("r", 6), r.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M9,0 L9,18"), r = t.append("defs").append("marker").attr("id", v.ZERO_OR_ONE_END).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto"), r.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 9).attr("r", 6), r.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M21,0 L21,18"), t.append("defs").append("marker").attr("id", v.ONE_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"), t.append("defs").append("marker").attr("id", v.ONE_OR_MORE_END).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18"), r = t.append("defs").append("marker").attr("id", v.ZERO_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto"), r.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 48).attr("cy", 18).attr("r", 6), r.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18"), r = t.append("defs").append("marker").attr("id", v.ZERO_OR_MORE_END).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto"), r.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 18).attr("r", 6), r.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18");
}, B = {
ERMarkers: v,
insertMarkers: Ft
}, Wt = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
function Ut(t) {
return typeof t == "string" && Wt.test(t);
}
const A = [];
for (let t = 0; t < 256; ++t)
A.push((t + 256).toString(16).slice(1));
function Gt(t, e = 0) {
return A[t[e + 0]] + A[t[e + 1]] + A[t[e + 2]] + A[t[e + 3]] + "-" + A[t[e + 4]] + A[t[e + 5]] + "-" + A[t[e + 6]] + A[t[e + 7]] + "-" + A[t[e + 8]] + A[t[e + 9]] + "-" + A[t[e + 10]] + A[t[e + 11]] + A[t[e + 12]] + A[t[e + 13]] + A[t[e + 14]] + A[t[e + 15]];
}
function Ht(t) {
if (!Ut(t))
throw TypeError("Invalid UUID");
let e;
const r = new Uint8Array(16);
return r[0] = (e = parseInt(t.slice(0, 8), 16)) >>> 24, r[1] = e >>> 16 & 255, r[2] = e >>> 8 & 255, r[3] = e & 255, r[4] = (e = parseInt(t.slice(9, 13), 16)) >>> 8, r[5] = e & 255, r[6] = (e = parseInt(t.slice(14, 18), 16)) >>> 8, r[7] = e & 255, r[8] = (e = parseInt(t.slice(19, 23), 16)) >>> 8, r[9] = e & 255, r[10] = (e = parseInt(t.slice(24, 36), 16)) / 1099511627776 & 255, r[11] = e / 4294967296 & 255, r[12] = e >>> 24 & 255, r[13] = e >>> 16 & 255, r[14] = e >>> 8 & 255, r[15] = e & 255, r;
}
function zt(t) {
t = unescape(encodeURIComponent(t));
const e = [];
for (let r = 0; r < t.length; ++r)
e.push(t.charCodeAt(r));
return e;
}
const Kt = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", Vt = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
function Xt(t, e, r) {
function u(l, p, f, o) {
var h;
if (typeof l == "string" && (l = zt(l)), typeof p == "string" && (p = Ht(p)), ((h = p) === null || h === void 0 ? void 0 : h.length) !== 16)
throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
let _ = new Uint8Array(16 + l.length);
if (_.set(p), _.set(l, p.length), _ = r(_), _[6] = _[6] & 15 | e, _[8] = _[8] & 63 | 128, f) {
o = o || 0;
for (let m = 0; m < 16; ++m)
f[o + m] = _[m];
return f;
}
return Gt(_);
}
try {
u.name = t;
} catch {
}
return u.DNS = Kt, u.URL = Vt, u;
}
function Qt(t, e, r, u) {
switch (t) {
case 0:
return e & r ^ ~e & u;
case 1:
return e ^ r ^ u;
case 2:
return e & r ^ e & u ^ r & u;
case 3:
return e ^ r ^ u;
}
}
function it(t, e) {
return t << e | t >>> 32 - e;
}
function jt(t) {
const e = [1518500249, 1859775393, 2400959708, 3395469782], r = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
if (typeof t == "string") {
const f = unescape(encodeURIComponent(t));
t = [];
for (let o = 0; o < f.length; ++o)
t.push(f.charCodeAt(o));
} else
Array.isArray(t) || (t = Array.prototype.slice.call(t));
t.push(128);
const u = t.length / 4 + 2, l = Math.ceil(u / 16), p = new Array(l);
for (let f = 0; f < l; ++f) {
const o = new Uint32Array(16);
for (let h = 0; h < 16; ++h)
o[h] = t[f * 64 + h * 4] << 24 | t[f * 64 + h * 4 + 1] << 16 | t[f * 64 + h * 4 + 2] << 8 | t[f * 64 + h * 4 + 3];
p[f] = o;
}
p[l - 1][14] = (t.length - 1) * 8 / Math.pow(2, 32), p[l - 1][14] = Math.floor(p[l - 1][14]), p[l - 1][15] = (t.length - 1) * 8 & 4294967295;
for (let f = 0; f < l; ++f) {
const o = new Uint32Array(80);
for (let y = 0; y < 16; ++y)
o[y] = p[f][y];
for (let y = 16; y < 80; ++y)
o[y] = it(o[y - 3] ^ o[y - 8] ^ o[y - 14] ^ o[y - 16], 1);
let h = r[0], _ = r[1], m = r[2], g = r[3], x = r[4];
for (let y = 0; y < 80; ++y) {
const N = Math.floor(y / 20), I = it(h, 5) + Qt(N, _, m, g) + x + e[N] + o[y] >>> 0;
x = g, g = m, m = it(_, 30) >>> 0, _ = h, h = I;
}
r[0] = r[0] + h >>> 0, r[1] = r[1] + _ >>> 0, r[2] = r[2] + m >>> 0, r[3] = r[3] + g >>> 0, r[4] = r[4] + x >>> 0;
}
return [r[0] >> 24 & 255, r[0] >> 16 & 255, r[0] >> 8 & 255, r[0] & 255, r[1] >> 24 & 255, r[1] >> 16 & 255, r[1] >> 8 & 255, r[1] & 255, r[2] >> 24 & 255, r[2] >> 16 & 255, r[2] >> 8 & 255, r[2] & 255, r[3] >> 24 & 255, r[3] >> 16 & 255, r[3] >> 8 & 255, r[3] & 255, r[4] >> 24 & 255, r[4] >> 16 & 255, r[4] >> 8 & 255, r[4] & 255];
}
const qt = Xt("v5", 80, jt), Jt = qt, $t = /[^\dA-Za-z](\W)*/g;
let k = {}, X = /* @__PURE__ */ new Map();
const te = function(t) {
const e = Object.keys(t);
for (const r of e)
k[r] = t[r];
}, ee = (t, e, r) => {
const u = k.entityPadding / 3, l = k.entityPadding / 3, p = k.fontSize * 0.85, f = e.node().getBBox(), o = [];
let h = !1, _ = !1, m = 0, g = 0, x = 0, y = 0, N = f.height + u * 2, I = 1;
r.forEach((T) => {
T.attributeKeyTypeList !== void 0 && T.attributeKeyTypeList.length > 0 && (h = !0), T.attributeComment !== void 0 && (_ = !0);
}), r.forEach((T) => {
const M = `${e.node().id}-attr-${I}`;
let R = 0;
const O = At(T.attributeType), L = t.append("text").classed("er entityLabel", !0).attr("id", `${M}-type`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Z().fontFamily).style("font-size", p + "px").text(O), S = t.append("text").classed("er entityLabel", !0).attr("id", `${M}-name`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Z().fontFamily).style("font-size", p + "px").text(T.attributeName), a = {};
a.tn = L, a.nn = S;
const n = L.node().getBBox(), c = S.node().getBBox();
if (m = Math.max(m, n.width), g = Math.max(g, c.width), R = Math.max(n.height, c.height), h) {
const d = T.attributeKeyTypeList !== void 0 ? T.attributeKeyTypeList.join(",") : "", E = t.append("text").classed("er entityLabel", !0).attr("id", `${M}-key`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Z().fontFamily).style("font-size", p + "px").text(d);
a.kn = E;
const i = E.node().getBBox();
x = Math.max(x, i.width), R = Math.max(R, i.height);
}
if (_) {
const d = t.append("text").classed("er entityLabel", !0).attr("id", `${M}-comment`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Z().fontFamily).style("font-size", p + "px").text(T.attributeComment || "");
a.cn = d;
const E = d.node().getBBox();
y = Math.max(y, E.width), R = Math.max(R, E.height);
}
a.height = R, o.push(a), N += R + u * 2, I += 1;
});
let F = 4;
h && (F += 2), _ && (F += 2);
const W = m + g + x + y, C = {
width: Math.max(
k.minEntityWidth,
Math.max(
f.width + k.entityPadding * 2,
W + l * F
)
),
height: r.length > 0 ? N : Math.max(k.minEntityHeight, f.height + k.entityPadding * 2)
};
if (r.length > 0) {
const T = Math.max(
0,
(C.width - W - l * F) / (F / 2)
);
e.attr(
"transform",
"translate(" + C.width / 2 + "," + (u + f.height / 2) + ")"
);
let M = f.height + u * 2, R = "attributeBoxOdd";
o.forEach((O) => {
const L = M + u + O.height / 2;
O.tn.attr("transform", "translate(" + l + "," + L + ")");
const S = t.insert("rect", "#" + O.tn.node().id).classed(`er ${R}`, !0).attr("x", 0).attr("y", M).attr("width", m + l * 2 + T).attr("height", O.height + u * 2), a = parseFloat(S.attr("x")) + parseFloat(S.attr("width"));
O.nn.attr(
"transform",
"translate(" + (a + l) + "," + L + ")"
);
const n = t.insert("rect", "#" + O.nn.node().id).classed(`er ${R}`, !0).attr("x", a).attr("y", M).attr("width", g + l * 2 + T).attr("height", O.height + u * 2);
let c = parseFloat(n.attr("x")) + parseFloat(n.attr("width"));
if (h) {
O.kn.attr(
"transform",
"translate(" + (c + l) + "," + L + ")"
);
const d = t.insert("rect", "#" + O.kn.node().id).classed(`er ${R}`, !0).attr("x", c).attr("y", M).attr("width", x + l * 2 + T).attr("height", O.height + u * 2);
c = parseFloat(d.attr("x")) + parseFloat(d.attr("width"));
}
_ && (O.cn.attr(
"transform",
"translate(" + (c + l) + "," + L + ")"
), t.insert("rect", "#" + O.cn.node().id).classed(`er ${R}`, "true").attr("x", c).attr("y", M).attr("width", y + l * 2 + T).attr("height", O.height + u * 2)), M += O.height + u * 2, R = R === "attributeBoxOdd" ? "attributeBoxEven" : "attributeBoxOdd";
});
} else
C.height = Math.max(k.minEntityHeight, N), e.attr("transform", "translate(" + C.width / 2 + "," + C.height / 2 + ")");
return C;
}, re = function(t, e, r) {
const u = Object.keys(e);
let l;
return u.forEach(function(p) {
const f = le(p, "entity");
X.set(p, f);
const o = t.append("g").attr("id", f);
l = l === void 0 ? f : l;
const h = "text-" + f, _ = o.append("text").classed("er entityLabel", !0).attr("id", h).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "middle").style("font-family", Z().fontFamily).style("font-size", k.fontSize + "px").text(e[p].alias ?? p), { width: m, height: g } = ee(
o,
_,
e[p].attributes
), y = o.insert("rect", "#" + h).classed("er entityBox", !0).attr("x", 0).attr("y", 0).attr("width", m).attr("height", g).node().getBBox();
r.setNode(f, {
width: y.width,
height: y.height,
shape: "rect",
id: f
});
}), l;
}, ie = function(t, e) {
e.nodes().forEach(function(r) {
r !== void 0 && e.node(r) !== void 0 && t.select("#" + r).attr(
"transform",
"translate(" + (e.node(r).x - e.node(r).width / 2) + "," + (e.node(r).y - e.node(r).height / 2) + " )"
);
});
}, ut = function(t) {
return (t.entityA + t.roleA + t.entityB).replace(/\s/g, "");
}, ae = function(t, e) {
return t.forEach(function(r) {
e.setEdge(
X.get(r.entityA),
X.get(r.entityB),
{ relationship: r },
ut(r)
);
}), t;
};
let ct = 0;
const ne = function(t, e, r, u, l) {
ct++;
const p = r.edge(
X.get(e.entityA),
X.get(e.entityB),
ut(e)
), f = wt().x(function(N) {
return N.x;
}).y(function(N) {
return N.y;
}).curve(Tt), o = t.insert("path", "#" + u).classed("er relationshipLine", !0).attr("d", f(p.points)).style("stroke", k.stroke).style("fill", "none");
e.relSpec.relType === l.db.Identification.NON_IDENTIFYING && o.attr("stroke-dasharray", "8,8");
let h = "";
switch (k.arrowMarkerAbsolute && (h = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, h = h.replace(/\(/g, "\\("), h = h.replace(/\)/g, "\\)")), e.relSpec.cardA) {
case l.db.Cardinality.ZERO_OR_ONE:
o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.ZERO_OR_ONE_END + ")");
break;
case l.db.Cardinality.ZERO_OR_MORE:
o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.ZERO_OR_MORE_END + ")");
break;
case l.db.Cardinality.ONE_OR_MORE:
o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.ONE_OR_MORE_END + ")");
break;
case l.db.Cardinality.ONLY_ONE:
o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.ONLY_ONE_END + ")");
break;
case l.db.Cardinality.MD_PARENT:
o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.MD_PARENT_END + ")");
break;
}
switch (e.relSpec.cardB) {
case l.db.Cardinality.ZERO_OR_ONE:
o.attr(
"marker-start",
"url(" + h + "#" + B.ERMarkers.ZERO_OR_ONE_START + ")"
);
break;
case l.db.Cardinality.ZERO_OR_MORE:
o.attr(
"marker-start",
"url(" + h + "#" + B.ERMarkers.ZERO_OR_MORE_START + ")"
);
break;
case l.db.Cardinality.ONE_OR_MORE:
o.attr(
"marker-start",
"url(" + h + "#" + B.ERMarkers.ONE_OR_MORE_START + ")"
);
break;
case l.db.Cardinality.ONLY_ONE:
o.attr("marker-start", "url(" + h + "#" + B.ERMarkers.ONLY_ONE_START + ")");
break;
case l.db.Cardinality.MD_PARENT:
o.attr("marker-start", "url(" + h + "#" + B.ERMarkers.MD_PARENT_START + ")");
break;
}
const _ = o.node().getTotalLength(), m = o.node().getPointAtLength(_ * 0.5), g = "rel" + ct, y = t.append("text").classed("er relationshipLabel", !0).attr("id", g).attr("x", m.x).attr("y", m.y).style("text-anchor", "middle").style("dominant-baseline", "middle").style("font-family", Z().fontFamily).style("font-size", k.fontSize + "px").text(e.roleA).node().getBBox();
t.insert("rect", "#" + g).classed("er relationshipLabelBox", !0).attr("x", m.x - y.width / 2).attr("y", m.y - y.height / 2).attr("width", y.width).attr("height", y.height);
}, se = function(t, e, r, u) {
k = Z().er, V.info("Drawing ER diagram");
const l = Z().securityLevel;
let p;
l === "sandbox" && (p = rt("#i" + e));
const o = (l === "sandbox" ? rt(p.nodes()[0].contentDocument.body) : rt("body")).select(`[id='${e}']`);
B.insertMarkers(o, k);
let h;
h = new Mt({
multigraph: !0,
directed: !0,
compound: !1
}).setGraph({
rankdir: k.layoutDirection,
marginx: 20,
marginy: 20,
nodesep: 100,
edgesep: 100,
ranksep: 100
}).setDefaultEdgeLabel(function() {
return {};
});
const _ = re(o, u.db.getEntities(), h), m = ae(u.db.getRelationships(), h);
St(h), ie(o, h), m.forEach(function(I) {
ne(o, I, h, _, u);
});
const g = k.diagramPadding;
bt.insertTitle(o, "entityTitleText", k.titleTopMargin, u.db.getDiagramTitle());
const x = o.node().getBBox(), y = x.width + g * 2, N = x.height + g * 2;
Nt(o, N, y, k.useMaxWidth), o.attr("viewBox", `${x.x - g} ${x.y - g} ${y} ${N}`);
}, oe = "28e9f9db-3c8d-5aa5-9faf-44286ae5937c";
function le(t = "", e = "") {
const r = t.replace($t, "");
return `${ht(e)}${ht(r)}${Jt(
t,
oe
)}`;
}
function ht(t = "") {
return t.length > 0 ? `${t}-` : "";
}
const ce = {
setConf: te,
draw: se
}, he = (t) => `
.entityBox {
fill: ${t.mainBkg};
stroke: ${t.nodeBorder};
}
.attributeBoxOdd {
fill: ${t.attributeBackgroundColorOdd};
stroke: ${t.nodeBorder};
}
.attributeBoxEven {
fill: ${t.attributeBackgroundColorEven};
stroke: ${t.nodeBorder};
}
.relationshipLabelBox {
fill: ${t.tertiaryColor};
opacity: 0.7;
background-color: ${t.tertiaryColor};
rect {
opacity: 0.5;
}
}
.relationshipLine {
stroke: ${t.lineColor};
}
.entityTitleText {
text-anchor: middle;
font-size: 18px;
fill: ${t.textColor};
}
#MD_PARENT_START {
fill: #f5f5f5 !important;
stroke: ${t.lineColor} !important;
stroke-width: 1;
}
#MD_PARENT_END {
fill: #f5f5f5 !important;
stroke: ${t.lineColor} !important;
stroke-width: 1;
}
`, de = he, me = {
parser: It,
db: Zt,
renderer: ce,
styles: de
};
export {
me as diagram
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,797 @@
import { p as Lt, f as V } from "./flowDb-9a89ea33.js";
import { h as S, f as tt, G as _t } from "./graph-0ee63739.js";
import { j as x, n as U, o as Y, p as et, c as G, r as rt, f as at, l as R, q as z, t as Et } from "./mermaid-9f2aa176.js";
import { u as Tt, r as Nt, p as At, l as Ct, d as M } from "./layout-fd473db2.js";
import { a as N, b as nt, i as st, c as E, e as it, d as ot, s as It, f as Bt, g as Mt } from "./styles-e75131e4.js";
import { l as Dt } from "./line-24d93f1b.js";
import "./index-bb6d8841.js";
import "./clone-afc2f047.js";
import "./edges-16357fde.js";
import "./createText-03b82060.js";
import "./channel-ebbc4130.js";
import "./array-2ff2c7a6.js";
import "./path-428ebac9.js";
function Rt(r) {
if (!r.ok)
throw new Error(r.status + " " + r.statusText);
return r.text();
}
function Gt(r, e) {
return fetch(r, e).then(Rt);
}
function Pt(r) {
return (e, t) => Gt(e, t).then((n) => new DOMParser().parseFromString(n, r));
}
var Ut = Pt("image/svg+xml"), H = {
normal: $t,
vee: Vt,
undirected: zt
};
function Wt(r) {
H = r;
}
function $t(r, e, t, n) {
var a = r.append("marker").attr("id", e).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto"), s = a.append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").style("stroke-width", 1).style("stroke-dasharray", "1,0");
N(s, t[n + "Style"]), t[n + "Class"] && s.attr("class", t[n + "Class"]);
}
function Vt(r, e, t, n) {
var a = r.append("marker").attr("id", e).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto"), s = a.append("path").attr("d", "M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width", 1).style("stroke-dasharray", "1,0");
N(s, t[n + "Style"]), t[n + "Class"] && s.attr("class", t[n + "Class"]);
}
function zt(r, e, t, n) {
var a = r.append("marker").attr("id", e).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto"), s = a.append("path").attr("d", "M 0 5 L 10 5").style("stroke-width", 1).style("stroke-dasharray", "1,0");
N(s, t[n + "Style"]), t[n + "Class"] && s.attr("class", t[n + "Class"]);
}
function Yt(r, e) {
var t = r;
return t.node().appendChild(e.label), N(t, e.labelStyle), t;
}
function Ht(r, e) {
for (var t = r.append("text"), n = Xt(e.label).split(`
`), a = 0; a < n.length; a++)
t.append("tspan").attr("xml:space", "preserve").attr("dy", "1em").attr("x", "1").text(n[a]);
return N(t, e.labelStyle), t;
}
function Xt(r) {
for (var e = "", t = !1, n, a = 0; a < r.length; ++a)
if (n = r[a], t) {
switch (n) {
case "n":
e += `
`;
break;
default:
e += n;
}
t = !1;
} else
n === "\\" ? t = !0 : e += n;
return e;
}
function J(r, e, t) {
var n = e.label, a = r.append("g");
e.labelType === "svg" ? Yt(a, e) : typeof n != "string" || e.labelType === "html" ? nt(a, e) : Ht(a, e);
var s = a.node().getBBox(), i;
switch (t) {
case "top":
i = -e.height / 2;
break;
case "bottom":
i = e.height / 2 - s.height;
break;
default:
i = -s.height / 2;
}
return a.attr("transform", "translate(" + -s.width / 2 + "," + i + ")"), a;
}
var X = function(r, e) {
var t = e.nodes().filter(function(s) {
return st(e, s);
}), n = r.selectAll("g.cluster").data(t, function(s) {
return s;
});
E(n.exit(), e).style("opacity", 0).remove();
var a = n.enter().append("g").attr("class", "cluster").attr("id", function(s) {
var i = e.node(s);
return i.id;
}).style("opacity", 0).each(function(s) {
var i = e.node(s), o = x(this);
x(this).append("rect");
var c = o.append("g").attr("class", "label");
J(c, i, i.clusterLabelPos);
});
return n = n.merge(a), n = E(n, e).style("opacity", 1), n.selectAll("rect").each(function(s) {
var i = e.node(s), o = x(this);
N(o, i.style);
}), n;
};
function Ft(r) {
X = r;
}
let F = function(r, e) {
var t = r.selectAll("g.edgeLabel").data(e.edges(), function(a) {
return it(a);
}).classed("update", !0);
t.exit().remove(), t.enter().append("g").classed("edgeLabel", !0).style("opacity", 0), t = r.selectAll("g.edgeLabel"), t.each(function(a) {
var s = x(this);
s.select(".label").remove();
var i = e.edge(a), o = J(s, e.edge(a), 0).classed("label", !0), c = o.node().getBBox();
i.labelId && o.attr("id", i.labelId), S(i, "width") || (i.width = c.width), S(i, "height") || (i.height = c.height);
});
var n;
return t.exit ? n = t.exit() : n = t.selectAll(null), E(n, e).style("opacity", 0).remove(), t;
};
function qt(r) {
F = r;
}
function O(r, e) {
return r.intersect(e);
}
var q = function(r, e, t) {
var n = r.selectAll("g.edgePath").data(e.edges(), function(i) {
return it(i);
}).classed("update", !0), a = Ot(n, e);
jt(n, e);
var s = n.merge !== void 0 ? n.merge(a) : n;
return E(s, e).style("opacity", 1), s.each(function(i) {
var o = x(this), c = e.edge(i);
c.elem = this, c.id && o.attr("id", c.id), ot(
o,
c.class,
(o.classed("update") ? "update " : "") + "edgePath"
);
}), s.selectAll("path.path").each(function(i) {
var o = e.edge(i);
o.arrowheadId = Tt("arrowhead");
var c = x(this).attr("marker-end", function() {
return "url(" + Kt(location.href, o.arrowheadId) + ")";
}).style("fill", "none");
E(c, e).attr("d", function(d) {
return Jt(e, d);
}), N(c, o.style);
}), s.selectAll("defs *").remove(), s.selectAll("defs").each(function(i) {
var o = e.edge(i), c = t[o.arrowhead];
c(x(this), o.arrowheadId, o, "arrowhead");
}), s;
};
function Qt(r) {
q = r;
}
function Kt(r, e) {
var t = r.split("#")[0];
return t + "#" + e;
}
function Jt(r, e) {
var t = r.edge(e), n = r.node(e.v), a = r.node(e.w), s = t.points.slice(1, t.points.length - 1);
return s.unshift(O(n, s[0])), s.push(O(a, s[s.length - 1])), lt(t, s);
}
function lt(r, e) {
var t = (Dt || Ut.line)().x(function(n) {
return n.x;
}).y(function(n) {
return n.y;
});
return (t.curve || t.interpolate)(r.curve), t(e);
}
function Zt(r) {
var e = r.getBBox(), t = r.ownerSVGElement.getScreenCTM().inverse().multiply(r.getScreenCTM()).translate(e.width / 2, e.height / 2);
return { x: t.e, y: t.f };
}
function Ot(r, e) {
var t = r.enter().append("g").attr("class", "edgePath").style("opacity", 0);
return t.append("path").attr("class", "path").attr("d", function(n) {
var a = e.edge(n), s = e.node(n.v).elem, i = Nt(a.points.length).map(function() {
return Zt(s);
});
return lt(a, i);
}), t.append("defs"), t;
}
function jt(r, e) {
var t = r.exit();
E(t, e).style("opacity", 0).remove();
}
var Q = function(r, e, t) {
var n = e.nodes().filter(function(i) {
return !st(e, i);
}), a = r.selectAll("g.node").data(n, function(i) {
return i;
}).classed("update", !0);
a.exit().remove(), a.enter().append("g").attr("class", "node").style("opacity", 0), a = r.selectAll("g.node"), a.each(function(i) {
var o = e.node(i), c = x(this);
ot(
c,
o.class,
(c.classed("update") ? "update " : "") + "node"
), c.select("g.label").remove();
var d = c.append("g").attr("class", "label"), l = J(d, o), g = t[o.shape], h = At(l.node().getBBox(), "width", "height");
o.elem = this, o.id && c.attr("id", o.id), o.labelId && d.attr("id", o.labelId), S(o, "width") && (h.width = o.width), S(o, "height") && (h.height = o.height), h.width += o.paddingLeft + o.paddingRight, h.height += o.paddingTop + o.paddingBottom, d.attr(
"transform",
"translate(" + (o.paddingLeft - o.paddingRight) / 2 + "," + (o.paddingTop - o.paddingBottom) / 2 + ")"
);
var u = x(this);
u.select(".label-container").remove();
var p = g(u, h, o).classed("label-container", !0);
N(p, o.style);
var v = p.node().getBBox();
o.width = v.width, o.height = v.height;
});
var s;
return a.exit ? s = a.exit() : s = a.selectAll(null), E(s, e).style("opacity", 0).remove(), a;
};
function te(r) {
Q = r;
}
function ee(r, e) {
var t = r.filter(function() {
return !x(this).classed("update");
});
function n(a) {
var s = e.node(a);
return "translate(" + s.x + "," + s.y + ")";
}
t.attr("transform", n), E(r, e).style("opacity", 1).attr("transform", n), E(t.selectAll("rect"), e).attr("width", function(a) {
return e.node(a).width;
}).attr("height", function(a) {
return e.node(a).height;
}).attr("x", function(a) {
var s = e.node(a);
return -s.width / 2;
}).attr("y", function(a) {
var s = e.node(a);
return -s.height / 2;
});
}
function re(r, e) {
var t = r.filter(function() {
return !x(this).classed("update");
});
function n(a) {
var s = e.edge(a);
return S(s, "x") ? "translate(" + s.x + "," + s.y + ")" : "";
}
t.attr("transform", n), E(r, e).style("opacity", 1).attr("transform", n);
}
function ae(r, e) {
var t = r.filter(function() {
return !x(this).classed("update");
});
function n(a) {
var s = e.node(a);
return "translate(" + s.x + "," + s.y + ")";
}
t.attr("transform", n), E(r, e).style("opacity", 1).attr("transform", n);
}
function ct(r, e, t, n) {
var a = r.x, s = r.y, i = a - n.x, o = s - n.y, c = Math.sqrt(e * e * o * o + t * t * i * i), d = Math.abs(e * t * i / c);
n.x < a && (d = -d);
var l = Math.abs(e * t * o / c);
return n.y < s && (l = -l), { x: a + d, y: s + l };
}
function ne(r, e, t) {
return ct(r, e, e, t);
}
function se(r, e, t, n) {
var a, s, i, o, c, d, l, g, h, u, p, v, f, y, k;
if (a = e.y - r.y, i = r.x - e.x, c = e.x * r.y - r.x * e.y, h = a * t.x + i * t.y + c, u = a * n.x + i * n.y + c, !(h !== 0 && u !== 0 && j(h, u)) && (s = n.y - t.y, o = t.x - n.x, d = n.x * t.y - t.x * n.y, l = s * r.x + o * r.y + d, g = s * e.x + o * e.y + d, !(l !== 0 && g !== 0 && j(l, g)) && (p = a * o - s * i, p !== 0)))
return v = Math.abs(p / 2), f = i * d - o * c, y = f < 0 ? (f - v) / p : (f + v) / p, f = s * c - a * d, k = f < 0 ? (f - v) / p : (f + v) / p, { x: y, y: k };
}
function j(r, e) {
return r * e > 0;
}
function T(r, e, t) {
var n = r.x, a = r.y, s = [], i = Number.POSITIVE_INFINITY, o = Number.POSITIVE_INFINITY;
e.forEach(function(p) {
i = Math.min(i, p.x), o = Math.min(o, p.y);
});
for (var c = n - r.width / 2 - i, d = a - r.height / 2 - o, l = 0; l < e.length; l++) {
var g = e[l], h = e[l < e.length - 1 ? l + 1 : 0], u = se(
r,
t,
{ x: c + g.x, y: d + g.y },
{ x: c + h.x, y: d + h.y }
);
u && s.push(u);
}
return s.length ? (s.length > 1 && s.sort(function(p, v) {
var f = p.x - t.x, y = p.y - t.y, k = Math.sqrt(f * f + y * y), I = v.x - t.x, _ = v.y - t.y, W = Math.sqrt(I * I + _ * _);
return k < W ? -1 : k === W ? 0 : 1;
}), s[0]) : (console.log("NO INTERSECTION FOUND, RETURN NODE CENTER", r), r);
}
function Z(r, e) {
var t = r.x, n = r.y, a = e.x - t, s = e.y - n, i = r.width / 2, o = r.height / 2, c, d;
return Math.abs(s) * i > Math.abs(a) * o ? (s < 0 && (o = -o), c = s === 0 ? 0 : o * a / s, d = o) : (a < 0 && (i = -i), c = i, d = a === 0 ? 0 : i * s / a), { x: t + c, y: n + d };
}
var K = {
rect: oe,
ellipse: le,
circle: ce,
diamond: de
};
function ie(r) {
K = r;
}
function oe(r, e, t) {
var n = r.insert("rect", ":first-child").attr("rx", t.rx).attr("ry", t.ry).attr("x", -e.width / 2).attr("y", -e.height / 2).attr("width", e.width).attr("height", e.height);
return t.intersect = function(a) {
return Z(t, a);
}, n;
}
function le(r, e, t) {
var n = e.width / 2, a = e.height / 2, s = r.insert("ellipse", ":first-child").attr("x", -e.width / 2).attr("y", -e.height / 2).attr("rx", n).attr("ry", a);
return t.intersect = function(i) {
return ct(t, n, a, i);
}, s;
}
function ce(r, e, t) {
var n = Math.max(e.width, e.height) / 2, a = r.insert("circle", ":first-child").attr("x", -e.width / 2).attr("y", -e.height / 2).attr("r", n);
return t.intersect = function(s) {
return ne(t, n, s);
}, a;
}
function de(r, e, t) {
var n = e.width * Math.SQRT2 / 2, a = e.height * Math.SQRT2 / 2, s = [
{ x: 0, y: -a },
{ x: -n, y: 0 },
{ x: 0, y: a },
{ x: n, y: 0 }
], i = r.insert("polygon", ":first-child").attr(
"points",
s.map(function(o) {
return o.x + "," + o.y;
}).join(" ")
);
return t.intersect = function(o) {
return T(t, s, o);
}, i;
}
function he() {
var r = function(e, t) {
pe(t);
var n = D(e, "output"), a = D(n, "clusters"), s = D(n, "edgePaths"), i = F(D(n, "edgeLabels"), t), o = Q(D(n, "nodes"), t, K);
Ct(t), ae(o, t), re(i, t), q(s, t, H);
var c = X(a, t);
ee(c, t), ge(t);
};
return r.createNodes = function(e) {
return arguments.length ? (te(e), r) : Q;
}, r.createClusters = function(e) {
return arguments.length ? (Ft(e), r) : X;
}, r.createEdgeLabels = function(e) {
return arguments.length ? (qt(e), r) : F;
}, r.createEdgePaths = function(e) {
return arguments.length ? (Qt(e), r) : q;
}, r.shapes = function(e) {
return arguments.length ? (ie(e), r) : K;
}, r.arrows = function(e) {
return arguments.length ? (Wt(e), r) : H;
}, r;
}
var ue = {
paddingLeft: 10,
paddingRight: 10,
paddingTop: 10,
paddingBottom: 10,
rx: 0,
ry: 0,
shape: "rect"
}, fe = {
arrowhead: "normal",
curve: U
};
function pe(r) {
r.nodes().forEach(function(e) {
var t = r.node(e);
!S(t, "label") && !r.children(e).length && (t.label = e), S(t, "paddingX") && M(t, {
paddingLeft: t.paddingX,
paddingRight: t.paddingX
}), S(t, "paddingY") && M(t, {
paddingTop: t.paddingY,
paddingBottom: t.paddingY
}), S(t, "padding") && M(t, {
paddingLeft: t.padding,
paddingRight: t.padding,
paddingTop: t.padding,
paddingBottom: t.padding
}), M(t, ue), tt(["paddingLeft", "paddingRight", "paddingTop", "paddingBottom"], function(n) {
t[n] = Number(t[n]);
}), S(t, "width") && (t._prevWidth = t.width), S(t, "height") && (t._prevHeight = t.height);
}), r.edges().forEach(function(e) {
var t = r.edge(e);
S(t, "label") || (t.label = ""), M(t, fe);
});
}
function ge(r) {
tt(r.nodes(), function(e) {
var t = r.node(e);
S(t, "_prevWidth") ? t.width = t._prevWidth : delete t.width, S(t, "_prevHeight") ? t.height = t._prevHeight : delete t.height, delete t._prevWidth, delete t._prevHeight;
});
}
function D(r, e) {
var t = r.select("g." + e);
return t.empty() && (t = r.append("g").attr("class", e)), t;
}
function dt(r, e, t) {
const n = e.width, a = e.height, s = (n + a) * 0.9, i = [
{ x: s / 2, y: 0 },
{ x: s, y: -s / 2 },
{ x: s / 2, y: -s },
{ x: 0, y: -s / 2 }
], o = A(r, s, s, i);
return t.intersect = function(c) {
return T(t, i, c);
}, o;
}
function ht(r, e, t) {
const a = e.height, s = a / 4, i = e.width + 2 * s, o = [
{ x: s, y: 0 },
{ x: i - s, y: 0 },
{ x: i, y: -a / 2 },
{ x: i - s, y: -a },
{ x: s, y: -a },
{ x: 0, y: -a / 2 }
], c = A(r, i, a, o);
return t.intersect = function(d) {
return T(t, o, d);
}, c;
}
function ut(r, e, t) {
const n = e.width, a = e.height, s = [
{ x: -a / 2, y: 0 },
{ x: n, y: 0 },
{ x: n, y: -a },
{ x: -a / 2, y: -a },
{ x: 0, y: -a / 2 }
], i = A(r, n, a, s);
return t.intersect = function(o) {
return T(t, s, o);
}, i;
}
function ft(r, e, t) {
const n = e.width, a = e.height, s = [
{ x: -2 * a / 6, y: 0 },
{ x: n - a / 6, y: 0 },
{ x: n + 2 * a / 6, y: -a },
{ x: a / 6, y: -a }
], i = A(r, n, a, s);
return t.intersect = function(o) {
return T(t, s, o);
}, i;
}
function pt(r, e, t) {
const n = e.width, a = e.height, s = [
{ x: 2 * a / 6, y: 0 },
{ x: n + a / 6, y: 0 },
{ x: n - 2 * a / 6, y: -a },
{ x: -a / 6, y: -a }
], i = A(r, n, a, s);
return t.intersect = function(o) {
return T(t, s, o);
}, i;
}
function gt(r, e, t) {
const n = e.width, a = e.height, s = [
{ x: -2 * a / 6, y: 0 },
{ x: n + 2 * a / 6, y: 0 },
{ x: n - a / 6, y: -a },
{ x: a / 6, y: -a }
], i = A(r, n, a, s);
return t.intersect = function(o) {
return T(t, s, o);
}, i;
}
function yt(r, e, t) {
const n = e.width, a = e.height, s = [
{ x: a / 6, y: 0 },
{ x: n - a / 6, y: 0 },
{ x: n + 2 * a / 6, y: -a },
{ x: -2 * a / 6, y: -a }
], i = A(r, n, a, s);
return t.intersect = function(o) {
return T(t, s, o);
}, i;
}
function vt(r, e, t) {
const n = e.width, a = e.height, s = [
{ x: 0, y: 0 },
{ x: n + a / 2, y: 0 },
{ x: n, y: -a / 2 },
{ x: n + a / 2, y: -a },
{ x: 0, y: -a }
], i = A(r, n, a, s);
return t.intersect = function(o) {
return T(t, s, o);
}, i;
}
function wt(r, e, t) {
const n = e.height, a = e.width + n / 4, s = r.insert("rect", ":first-child").attr("rx", n / 2).attr("ry", n / 2).attr("x", -a / 2).attr("y", -n / 2).attr("width", a).attr("height", n);
return t.intersect = function(i) {
return Z(t, i);
}, s;
}
function mt(r, e, t) {
const n = e.width, a = e.height, s = [
{ x: 0, y: 0 },
{ x: n, y: 0 },
{ x: n, y: -a },
{ x: 0, y: -a },
{ x: 0, y: 0 },
{ x: -8, y: 0 },
{ x: n + 8, y: 0 },
{ x: n + 8, y: -a },
{ x: -8, y: -a },
{ x: -8, y: 0 }
], i = A(r, n, a, s);
return t.intersect = function(o) {
return T(t, s, o);
}, i;
}
function xt(r, e, t) {
const n = e.width, a = n / 2, s = a / (2.5 + n / 50), i = e.height + s, o = "M 0," + s + " a " + a + "," + s + " 0,0,0 " + n + " 0 a " + a + "," + s + " 0,0,0 " + -n + " 0 l 0," + i + " a " + a + "," + s + " 0,0,0 " + n + " 0 l 0," + -i, c = r.attr("label-offset-y", s).insert("path", ":first-child").attr("d", o).attr("transform", "translate(" + -n / 2 + "," + -(i / 2 + s) + ")");
return t.intersect = function(d) {
const l = Z(t, d), g = l.x - t.x;
if (a != 0 && (Math.abs(g) < t.width / 2 || Math.abs(g) == t.width / 2 && Math.abs(l.y - t.y) > t.height / 2 - s)) {
let h = s * s * (1 - g * g / (a * a));
h != 0 && (h = Math.sqrt(h)), h = s - h, d.y - t.y > 0 && (h = -h), l.y += h;
}
return l;
}, c;
}
function ye(r) {
r.shapes().question = dt, r.shapes().hexagon = ht, r.shapes().stadium = wt, r.shapes().subroutine = mt, r.shapes().cylinder = xt, r.shapes().rect_left_inv_arrow = ut, r.shapes().lean_right = ft, r.shapes().lean_left = pt, r.shapes().trapezoid = gt, r.shapes().inv_trapezoid = yt, r.shapes().rect_right_inv_arrow = vt;
}
function ve(r) {
r({ question: dt }), r({ hexagon: ht }), r({ stadium: wt }), r({ subroutine: mt }), r({ cylinder: xt }), r({ rect_left_inv_arrow: ut }), r({ lean_right: ft }), r({ lean_left: pt }), r({ trapezoid: gt }), r({ inv_trapezoid: yt }), r({ rect_right_inv_arrow: vt });
}
function A(r, e, t, n) {
return r.insert("polygon", ":first-child").attr(
"points",
n.map(function(a) {
return a.x + "," + a.y;
}).join(" ")
).attr("transform", "translate(" + -e / 2 + "," + t / 2 + ")");
}
const we = {
addToRender: ye,
addToRenderV2: ve
}, bt = {}, me = function(r) {
const e = Object.keys(r);
for (const t of e)
bt[t] = r[t];
}, kt = async function(r, e, t, n, a, s) {
const i = n ? n.select(`[id="${t}"]`) : x(`[id="${t}"]`), o = a || document, c = Object.keys(r);
for (const d of c) {
const l = r[d];
let g = "default";
l.classes.length > 0 && (g = l.classes.join(" "));
const h = Y(l.styles);
let u = l.text !== void 0 ? l.text : l.id, p;
if (et(G().flowchart.htmlLabels)) {
const y = {
label: await rt(
u.replace(
/fa[blrs]?:fa-[\w-]+/g,
// cspell:disable-line
(k) => `<i class='${k.replace(":", " ")}'></i>`
),
G()
)
};
p = nt(i, y).node(), p.parentNode.removeChild(p);
} else {
const y = o.createElementNS("http://www.w3.org/2000/svg", "text");
y.setAttribute("style", h.labelStyle.replace("color:", "fill:"));
const k = u.split(at.lineBreakRegex);
for (const I of k) {
const _ = o.createElementNS("http://www.w3.org/2000/svg", "tspan");
_.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), _.setAttribute("dy", "1em"), _.setAttribute("x", "1"), _.textContent = I, y.appendChild(_);
}
p = y;
}
let v = 0, f = "";
switch (l.type) {
case "round":
v = 5, f = "rect";
break;
case "square":
f = "rect";
break;
case "diamond":
f = "question";
break;
case "hexagon":
f = "hexagon";
break;
case "odd":
f = "rect_left_inv_arrow";
break;
case "lean_right":
f = "lean_right";
break;
case "lean_left":
f = "lean_left";
break;
case "trapezoid":
f = "trapezoid";
break;
case "inv_trapezoid":
f = "inv_trapezoid";
break;
case "odd_right":
f = "rect_left_inv_arrow";
break;
case "circle":
f = "circle";
break;
case "ellipse":
f = "ellipse";
break;
case "stadium":
f = "stadium";
break;
case "subroutine":
f = "subroutine";
break;
case "cylinder":
f = "cylinder";
break;
case "group":
f = "rect";
break;
default:
f = "rect";
}
R.warn("Adding node", l.id, l.domId), e.setNode(s.db.lookUpDomId(l.id), {
labelType: "svg",
labelStyle: h.labelStyle,
shape: f,
label: p,
rx: v,
ry: v,
class: g,
style: h.style,
id: s.db.lookUpDomId(l.id)
});
}
}, St = async function(r, e, t) {
let n = 0, a, s;
if (r.defaultStyle !== void 0) {
const i = Y(r.defaultStyle);
a = i.style, s = i.labelStyle;
}
for (const i of r) {
n++;
const o = "L-" + i.start + "-" + i.end, c = "LS-" + i.start, d = "LE-" + i.end, l = {};
i.type === "arrow_open" ? l.arrowhead = "none" : l.arrowhead = "normal";
let g = "", h = "";
if (i.style !== void 0) {
const u = Y(i.style);
g = u.style, h = u.labelStyle;
} else
switch (i.stroke) {
case "normal":
g = "fill:none", a !== void 0 && (g = a), s !== void 0 && (h = s);
break;
case "dotted":
g = "fill:none;stroke-width:2px;stroke-dasharray:3;";
break;
case "thick":
g = " stroke-width: 3.5px;fill:none";
break;
}
l.style = g, l.labelStyle = h, i.interpolate !== void 0 ? l.curve = z(i.interpolate, U) : r.defaultInterpolate !== void 0 ? l.curve = z(r.defaultInterpolate, U) : l.curve = z(bt.curve, U), i.text === void 0 ? i.style !== void 0 && (l.arrowheadStyle = "fill: #333") : (l.arrowheadStyle = "fill: #333", l.labelpos = "c", et(G().flowchart.htmlLabels) ? (l.labelType = "html", l.label = `<span id="L-${o}" class="edgeLabel L-${c}' L-${d}" style="${l.labelStyle}">${await rt(
i.text.replace(
/fa[blrs]?:fa-[\w-]+/g,
// cspell:disable-line
(u) => `<i class='${u.replace(":", " ")}'></i>`
),
G()
)}</span>`) : (l.labelType = "text", l.label = i.text.replace(at.lineBreakRegex, `
`), i.style === void 0 && (l.style = l.style || "stroke: #333; stroke-width: 1.5px;fill:none"), l.labelStyle = l.labelStyle.replace("color:", "fill:"))), l.id = o, l.class = c + " " + d, l.minlen = i.length || 1, e.setEdge(t.db.lookUpDomId(i.start), t.db.lookUpDomId(i.end), l, n);
}
}, xe = function(r, e) {
return R.info("Extracting classes"), e.db.getClasses();
}, be = async function(r, e, t, n) {
R.info("Drawing flowchart");
const { securityLevel: a, flowchart: s } = G();
let i;
a === "sandbox" && (i = x("#i" + e));
const o = a === "sandbox" ? x(i.nodes()[0].contentDocument.body) : x("body"), c = a === "sandbox" ? i.nodes()[0].contentDocument : document;
let d = n.db.getDirection();
d === void 0 && (d = "TD");
const l = s.nodeSpacing || 50, g = s.rankSpacing || 50, h = new _t({
multigraph: !0,
compound: !0
}).setGraph({
rankdir: d,
nodesep: l,
ranksep: g,
marginx: 8,
marginy: 8
}).setDefaultEdgeLabel(function() {
return {};
});
let u;
const p = n.db.getSubGraphs();
for (let w = p.length - 1; w >= 0; w--)
u = p[w], n.db.addVertex(u.id, u.title, "group", void 0, u.classes);
const v = n.db.getVertices();
R.warn("Get vertices", v);
const f = n.db.getEdges();
let y = 0;
for (y = p.length - 1; y >= 0; y--) {
u = p[y], It("cluster").append("text");
for (let w = 0; w < u.nodes.length; w++)
R.warn(
"Setting subgraph",
u.nodes[w],
n.db.lookUpDomId(u.nodes[w]),
n.db.lookUpDomId(u.id)
), h.setParent(n.db.lookUpDomId(u.nodes[w]), n.db.lookUpDomId(u.id));
}
await kt(v, h, e, o, c, n), await St(f, h, n);
const k = new he();
we.addToRender(k), k.arrows().none = function(b, L, m, B) {
const C = b.append("marker").attr("id", L).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto").append("path").attr("d", "M 0 0 L 0 0 L 0 0 z");
N(C, m[B + "Style"]);
}, k.arrows().normal = function(b, L) {
b.append("marker").attr("id", L).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowheadPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
};
const I = o.select(`[id="${e}"]`), _ = o.select("#" + e + " g");
for (k(_, h), _.selectAll("g.node").attr("title", function() {
return n.db.getTooltip(this.id);
}), n.db.indexNodes("subGraph" + y), y = 0; y < p.length; y++)
if (u = p[y], u.title !== "undefined") {
const w = c.querySelectorAll(
"#" + e + ' [id="' + n.db.lookUpDomId(u.id) + '"] rect'
), b = c.querySelectorAll(
"#" + e + ' [id="' + n.db.lookUpDomId(u.id) + '"]'
), L = w[0].x.baseVal.value, m = w[0].y.baseVal.value, B = w[0].width.baseVal.value, C = x(b[0]).select(".label");
C.attr("transform", `translate(${L + B / 2}, ${m + 14})`), C.attr("id", e + "Text");
for (let $ = 0; $ < u.classes.length; $++)
b[0].classList.add(u.classes[$]);
}
if (!s.htmlLabels) {
const w = c.querySelectorAll('[id="' + e + '"] .edgeLabel .label');
for (const b of w) {
const L = b.getBBox(), m = c.createElementNS("http://www.w3.org/2000/svg", "rect");
m.setAttribute("rx", 0), m.setAttribute("ry", 0), m.setAttribute("width", L.width), m.setAttribute("height", L.height), b.insertBefore(m, b.firstChild);
}
}
Et(h, I, s.diagramPadding, s.useMaxWidth), Object.keys(v).forEach(function(w) {
const b = v[w];
if (b.link) {
const L = o.select("#" + e + ' [id="' + n.db.lookUpDomId(w) + '"]');
if (L) {
const m = c.createElementNS("http://www.w3.org/2000/svg", "a");
m.setAttributeNS("http://www.w3.org/2000/svg", "class", b.classes.join(" ")), m.setAttributeNS("http://www.w3.org/2000/svg", "href", b.link), m.setAttributeNS("http://www.w3.org/2000/svg", "rel", "noopener"), a === "sandbox" ? m.setAttributeNS("http://www.w3.org/2000/svg", "target", "_top") : b.linkTarget && m.setAttributeNS("http://www.w3.org/2000/svg", "target", b.linkTarget);
const B = L.insert(function() {
return m;
}, ":first-child"), P = L.select(".label-container");
P && B.append(function() {
return P.node();
});
const C = L.select(".label");
C && B.append(function() {
return C.node();
});
}
}
});
}, ke = {
setConf: me,
addVertices: kt,
addEdges: St,
getClasses: xe,
draw: be
}, Ge = {
parser: Lt,
db: V,
renderer: Bt,
styles: Mt,
init: (r) => {
r.flowchart || (r.flowchart = {}), r.flowchart.arrowMarkerAbsolute = r.arrowMarkerAbsolute, ke.setConf(r.flowchart), V.clear(), V.setGen("gen-1");
}
};
export {
Ge as diagram
};

View file

@ -0,0 +1,614 @@
import { p as parser, f as flowDb } from "./flowDb-c1833063.js";
import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
import { select, curveLinear, selectAll } from "d3";
import { k as getStylesFromArray, m as evaluate, c as getConfig, r as renderKatex, e as common, l as log, n as interpolateToCurve, o as setupGraphViewbox } from "./mermaid-6dc72991.js";
import { render } from "dagre-d3-es";
import { applyStyle } from "dagre-d3-es/src/dagre-js/util.js";
import { addHtmlLabel } from "dagre-d3-es/src/dagre-js/label/add-html-label.js";
import { intersectPolygon } from "dagre-d3-es/src/dagre-js/intersect/intersect-polygon.js";
import { intersectRect } from "dagre-d3-es/src/dagre-js/intersect/intersect-rect.js";
import { f as flowRendererV2, a as flowStyles } from "./styles-483fbfea.js";
import "ts-dedent";
import "dayjs";
import "@braintree/sanitize-url";
import "dompurify";
import "khroma";
import "lodash-es/memoize.js";
import "lodash-es/merge.js";
import "stylis";
import "lodash-es/isEmpty.js";
import "./index-01f381cb.js";
import "dagre-d3-es/src/dagre/index.js";
import "dagre-d3-es/src/graphlib/json.js";
import "./edges-066a5561.js";
import "./createText-ca0c5216.js";
import "mdast-util-from-markdown";
function question(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
const s = (w + h) * 0.9;
const points = [
{ x: s / 2, y: 0 },
{ x: s, y: -s / 2 },
{ x: s / 2, y: -s },
{ x: 0, y: -s / 2 }
];
const shapeSvg = insertPolygonShape(parent, s, s, points);
node.intersect = function(point) {
return intersectPolygon(node, points, point);
};
return shapeSvg;
}
function hexagon(parent, bbox, node) {
const f = 4;
const h = bbox.height;
const m = h / f;
const w = bbox.width + 2 * m;
const points = [
{ x: m, y: 0 },
{ x: w - m, y: 0 },
{ x: w, y: -h / 2 },
{ x: w - m, y: -h },
{ x: m, y: -h },
{ x: 0, y: -h / 2 }
];
const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) {
return intersectPolygon(node, points, point);
};
return shapeSvg;
}
function rect_left_inv_arrow(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
const points = [
{ x: -h / 2, y: 0 },
{ x: w, y: 0 },
{ x: w, y: -h },
{ x: -h / 2, y: -h },
{ x: 0, y: -h / 2 }
];
const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) {
return intersectPolygon(node, points, point);
};
return shapeSvg;
}
function lean_right(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
const points = [
{ x: -2 * h / 6, y: 0 },
{ x: w - h / 6, y: 0 },
{ x: w + 2 * h / 6, y: -h },
{ x: h / 6, y: -h }
];
const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) {
return intersectPolygon(node, points, point);
};
return shapeSvg;
}
function lean_left(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
const points = [
{ x: 2 * h / 6, y: 0 },
{ x: w + h / 6, y: 0 },
{ x: w - 2 * h / 6, y: -h },
{ x: -h / 6, y: -h }
];
const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) {
return intersectPolygon(node, points, point);
};
return shapeSvg;
}
function trapezoid(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
const points = [
{ x: -2 * h / 6, y: 0 },
{ x: w + 2 * h / 6, y: 0 },
{ x: w - h / 6, y: -h },
{ x: h / 6, y: -h }
];
const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) {
return intersectPolygon(node, points, point);
};
return shapeSvg;
}
function inv_trapezoid(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
const points = [
{ x: h / 6, y: 0 },
{ x: w - h / 6, y: 0 },
{ x: w + 2 * h / 6, y: -h },
{ x: -2 * h / 6, y: -h }
];
const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) {
return intersectPolygon(node, points, point);
};
return shapeSvg;
}
function rect_right_inv_arrow(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
const points = [
{ x: 0, y: 0 },
{ x: w + h / 2, y: 0 },
{ x: w, y: -h / 2 },
{ x: w + h / 2, y: -h },
{ x: 0, y: -h }
];
const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) {
return intersectPolygon(node, points, point);
};
return shapeSvg;
}
function stadium(parent, bbox, node) {
const h = bbox.height;
const w = bbox.width + h / 4;
const shapeSvg = parent.insert("rect", ":first-child").attr("rx", h / 2).attr("ry", h / 2).attr("x", -w / 2).attr("y", -h / 2).attr("width", w).attr("height", h);
node.intersect = function(point) {
return intersectRect(node, point);
};
return shapeSvg;
}
function subroutine(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
const points = [
{ x: 0, y: 0 },
{ x: w, y: 0 },
{ x: w, y: -h },
{ x: 0, y: -h },
{ x: 0, y: 0 },
{ x: -8, y: 0 },
{ x: w + 8, y: 0 },
{ x: w + 8, y: -h },
{ x: -8, y: -h },
{ x: -8, y: 0 }
];
const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) {
return intersectPolygon(node, points, point);
};
return shapeSvg;
}
function cylinder(parent, bbox, node) {
const w = bbox.width;
const rx = w / 2;
const ry = rx / (2.5 + w / 50);
const h = bbox.height + ry;
const shape = "M 0," + ry + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 a " + rx + "," + ry + " 0,0,0 " + -w + " 0 l 0," + h + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 l 0," + -h;
const shapeSvg = parent.attr("label-offset-y", ry).insert("path", ":first-child").attr("d", shape).attr("transform", "translate(" + -w / 2 + "," + -(h / 2 + ry) + ")");
node.intersect = function(point) {
const pos = intersectRect(node, point);
const x = pos.x - node.x;
if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
let y = ry * ry * (1 - x * x / (rx * rx));
if (y != 0) {
y = Math.sqrt(y);
}
y = ry - y;
if (point.y - node.y > 0) {
y = -y;
}
pos.y += y;
}
return pos;
};
return shapeSvg;
}
function addToRender(render2) {
render2.shapes().question = question;
render2.shapes().hexagon = hexagon;
render2.shapes().stadium = stadium;
render2.shapes().subroutine = subroutine;
render2.shapes().cylinder = cylinder;
render2.shapes().rect_left_inv_arrow = rect_left_inv_arrow;
render2.shapes().lean_right = lean_right;
render2.shapes().lean_left = lean_left;
render2.shapes().trapezoid = trapezoid;
render2.shapes().inv_trapezoid = inv_trapezoid;
render2.shapes().rect_right_inv_arrow = rect_right_inv_arrow;
}
function addToRenderV2(addShape) {
addShape({ question });
addShape({ hexagon });
addShape({ stadium });
addShape({ subroutine });
addShape({ cylinder });
addShape({ rect_left_inv_arrow });
addShape({ lean_right });
addShape({ lean_left });
addShape({ trapezoid });
addShape({ inv_trapezoid });
addShape({ rect_right_inv_arrow });
}
function insertPolygonShape(parent, w, h, points) {
return parent.insert("polygon", ":first-child").attr(
"points",
points.map(function(d) {
return d.x + "," + d.y;
}).join(" ")
).attr("transform", "translate(" + -w / 2 + "," + h / 2 + ")");
}
const flowChartShapes = {
addToRender,
addToRenderV2
};
const conf = {};
const setConf = function(cnf) {
const keys = Object.keys(cnf);
for (const key of keys) {
conf[key] = cnf[key];
}
};
const addVertices = async function(vert, g, svgId, root, _doc, diagObj) {
const svg = !root ? select(`[id="${svgId}"]`) : root.select(`[id="${svgId}"]`);
const doc = !_doc ? document : _doc;
const keys = Object.keys(vert);
for (const id of keys) {
const vertex = vert[id];
let classStr = "default";
if (vertex.classes.length > 0) {
classStr = vertex.classes.join(" ");
}
const styles = getStylesFromArray(vertex.styles);
let vertexText = vertex.text !== void 0 ? vertex.text : vertex.id;
let vertexNode;
if (evaluate(getConfig().flowchart.htmlLabels)) {
const node = {
label: await renderKatex(
vertexText.replace(
/fa[blrs]?:fa-[\w-]+/g,
// cspell:disable-line
(s) => `<i class='${s.replace(":", " ")}'></i>`
),
getConfig()
)
};
vertexNode = addHtmlLabel(svg, node).node();
vertexNode.parentNode.removeChild(vertexNode);
} else {
const svgLabel = doc.createElementNS("http://www.w3.org/2000/svg", "text");
svgLabel.setAttribute("style", styles.labelStyle.replace("color:", "fill:"));
const rows = vertexText.split(common.lineBreakRegex);
for (const row of rows) {
const tspan = doc.createElementNS("http://www.w3.org/2000/svg", "tspan");
tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
tspan.setAttribute("dy", "1em");
tspan.setAttribute("x", "1");
tspan.textContent = row;
svgLabel.appendChild(tspan);
}
vertexNode = svgLabel;
}
let radius = 0;
let _shape = "";
switch (vertex.type) {
case "round":
radius = 5;
_shape = "rect";
break;
case "square":
_shape = "rect";
break;
case "diamond":
_shape = "question";
break;
case "hexagon":
_shape = "hexagon";
break;
case "odd":
_shape = "rect_left_inv_arrow";
break;
case "lean_right":
_shape = "lean_right";
break;
case "lean_left":
_shape = "lean_left";
break;
case "trapezoid":
_shape = "trapezoid";
break;
case "inv_trapezoid":
_shape = "inv_trapezoid";
break;
case "odd_right":
_shape = "rect_left_inv_arrow";
break;
case "circle":
_shape = "circle";
break;
case "ellipse":
_shape = "ellipse";
break;
case "stadium":
_shape = "stadium";
break;
case "subroutine":
_shape = "subroutine";
break;
case "cylinder":
_shape = "cylinder";
break;
case "group":
_shape = "rect";
break;
default:
_shape = "rect";
}
log.warn("Adding node", vertex.id, vertex.domId);
g.setNode(diagObj.db.lookUpDomId(vertex.id), {
labelType: "svg",
labelStyle: styles.labelStyle,
shape: _shape,
label: vertexNode,
rx: radius,
ry: radius,
class: classStr,
style: styles.style,
id: diagObj.db.lookUpDomId(vertex.id)
});
}
};
const addEdges = async function(edges, g, diagObj) {
let cnt = 0;
let defaultStyle;
let defaultLabelStyle;
if (edges.defaultStyle !== void 0) {
const defaultStyles = getStylesFromArray(edges.defaultStyle);
defaultStyle = defaultStyles.style;
defaultLabelStyle = defaultStyles.labelStyle;
}
for (const edge of edges) {
cnt++;
const linkId = "L-" + edge.start + "-" + edge.end;
const linkNameStart = "LS-" + edge.start;
const linkNameEnd = "LE-" + edge.end;
const edgeData = {};
if (edge.type === "arrow_open") {
edgeData.arrowhead = "none";
} else {
edgeData.arrowhead = "normal";
}
let style = "";
let labelStyle = "";
if (edge.style !== void 0) {
const styles = getStylesFromArray(edge.style);
style = styles.style;
labelStyle = styles.labelStyle;
} else {
switch (edge.stroke) {
case "normal":
style = "fill:none";
if (defaultStyle !== void 0) {
style = defaultStyle;
}
if (defaultLabelStyle !== void 0) {
labelStyle = defaultLabelStyle;
}
break;
case "dotted":
style = "fill:none;stroke-width:2px;stroke-dasharray:3;";
break;
case "thick":
style = " stroke-width: 3.5px;fill:none";
break;
}
}
edgeData.style = style;
edgeData.labelStyle = labelStyle;
if (edge.interpolate !== void 0) {
edgeData.curve = interpolateToCurve(edge.interpolate, curveLinear);
} else if (edges.defaultInterpolate !== void 0) {
edgeData.curve = interpolateToCurve(edges.defaultInterpolate, curveLinear);
} else {
edgeData.curve = interpolateToCurve(conf.curve, curveLinear);
}
if (edge.text === void 0) {
if (edge.style !== void 0) {
edgeData.arrowheadStyle = "fill: #333";
}
} else {
edgeData.arrowheadStyle = "fill: #333";
edgeData.labelpos = "c";
if (evaluate(getConfig().flowchart.htmlLabels)) {
edgeData.labelType = "html";
edgeData.label = `<span id="L-${linkId}" class="edgeLabel L-${linkNameStart}' L-${linkNameEnd}" style="${edgeData.labelStyle}">${await renderKatex(
edge.text.replace(
/fa[blrs]?:fa-[\w-]+/g,
// cspell:disable-line
(s) => `<i class='${s.replace(":", " ")}'></i>`
),
getConfig()
)}</span>`;
} else {
edgeData.labelType = "text";
edgeData.label = edge.text.replace(common.lineBreakRegex, "\n");
if (edge.style === void 0) {
edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none";
}
edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
}
}
edgeData.id = linkId;
edgeData.class = linkNameStart + " " + linkNameEnd;
edgeData.minlen = edge.length || 1;
g.setEdge(diagObj.db.lookUpDomId(edge.start), diagObj.db.lookUpDomId(edge.end), edgeData, cnt);
}
};
const getClasses = function(text, diagObj) {
log.info("Extracting classes");
return diagObj.db.getClasses();
};
const draw = async function(text, id, _version, diagObj) {
log.info("Drawing flowchart");
const { securityLevel, flowchart: conf2 } = getConfig();
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = select("#i" + id);
}
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
let dir = diagObj.db.getDirection();
if (dir === void 0) {
dir = "TD";
}
const nodeSpacing = conf2.nodeSpacing || 50;
const rankSpacing = conf2.rankSpacing || 50;
const g = new graphlib.Graph({
multigraph: true,
compound: true
}).setGraph({
rankdir: dir,
nodesep: nodeSpacing,
ranksep: rankSpacing,
marginx: 8,
marginy: 8
}).setDefaultEdgeLabel(function() {
return {};
});
let subG;
const subGraphs = diagObj.db.getSubGraphs();
for (let i2 = subGraphs.length - 1; i2 >= 0; i2--) {
subG = subGraphs[i2];
diagObj.db.addVertex(subG.id, subG.title, "group", void 0, subG.classes);
}
const vert = diagObj.db.getVertices();
log.warn("Get vertices", vert);
const edges = diagObj.db.getEdges();
let i = 0;
for (i = subGraphs.length - 1; i >= 0; i--) {
subG = subGraphs[i];
selectAll("cluster").append("text");
for (let j = 0; j < subG.nodes.length; j++) {
log.warn(
"Setting subgraph",
subG.nodes[j],
diagObj.db.lookUpDomId(subG.nodes[j]),
diagObj.db.lookUpDomId(subG.id)
);
g.setParent(diagObj.db.lookUpDomId(subG.nodes[j]), diagObj.db.lookUpDomId(subG.id));
}
}
await addVertices(vert, g, id, root, doc, diagObj);
await addEdges(edges, g, diagObj);
const render$1 = new render();
flowChartShapes.addToRender(render$1);
render$1.arrows().none = function normal(parent, id2, edge, type) {
const marker = parent.append("marker").attr("id", id2).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto");
const path = marker.append("path").attr("d", "M 0 0 L 0 0 L 0 0 z");
applyStyle(path, edge[type + "Style"]);
};
render$1.arrows().normal = function normal(parent, id2) {
const marker = parent.append("marker").attr("id", id2).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto");
marker.append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowheadPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
};
const svg = root.select(`[id="${id}"]`);
const element = root.select("#" + id + " g");
render$1(element, g);
element.selectAll("g.node").attr("title", function() {
return diagObj.db.getTooltip(this.id);
});
diagObj.db.indexNodes("subGraph" + i);
for (i = 0; i < subGraphs.length; i++) {
subG = subGraphs[i];
if (subG.title !== "undefined") {
const clusterRects = doc.querySelectorAll(
"#" + id + ' [id="' + diagObj.db.lookUpDomId(subG.id) + '"] rect'
);
const clusterEl = doc.querySelectorAll(
"#" + id + ' [id="' + diagObj.db.lookUpDomId(subG.id) + '"]'
);
const xPos = clusterRects[0].x.baseVal.value;
const yPos = clusterRects[0].y.baseVal.value;
const _width = clusterRects[0].width.baseVal.value;
const cluster = select(clusterEl[0]);
const te = cluster.select(".label");
te.attr("transform", `translate(${xPos + _width / 2}, ${yPos + 14})`);
te.attr("id", id + "Text");
for (let j = 0; j < subG.classes.length; j++) {
clusterEl[0].classList.add(subG.classes[j]);
}
}
}
if (!conf2.htmlLabels) {
const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
for (const label of labels) {
const dim = label.getBBox();
const rect = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
rect.setAttribute("rx", 0);
rect.setAttribute("ry", 0);
rect.setAttribute("width", dim.width);
rect.setAttribute("height", dim.height);
label.insertBefore(rect, label.firstChild);
}
}
setupGraphViewbox(g, svg, conf2.diagramPadding, conf2.useMaxWidth);
const keys = Object.keys(vert);
keys.forEach(function(key) {
const vertex = vert[key];
if (vertex.link) {
const node = root.select("#" + id + ' [id="' + diagObj.db.lookUpDomId(key) + '"]');
if (node) {
const link = doc.createElementNS("http://www.w3.org/2000/svg", "a");
link.setAttributeNS("http://www.w3.org/2000/svg", "class", vertex.classes.join(" "));
link.setAttributeNS("http://www.w3.org/2000/svg", "href", vertex.link);
link.setAttributeNS("http://www.w3.org/2000/svg", "rel", "noopener");
if (securityLevel === "sandbox") {
link.setAttributeNS("http://www.w3.org/2000/svg", "target", "_top");
} else if (vertex.linkTarget) {
link.setAttributeNS("http://www.w3.org/2000/svg", "target", vertex.linkTarget);
}
const linkNode = node.insert(function() {
return link;
}, ":first-child");
const shape = node.select(".label-container");
if (shape) {
linkNode.append(function() {
return shape.node();
});
}
const label = node.select(".label");
if (label) {
linkNode.append(function() {
return label.node();
});
}
}
}
});
};
const flowRenderer = {
setConf,
addVertices,
addEdges,
getClasses,
draw
};
const diagram = {
parser,
db: flowDb,
renderer: flowRendererV2,
styles: flowStyles,
init: (cnf) => {
if (!cnf.flowchart) {
cnf.flowchart = {};
}
cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
flowRenderer.setConf(cnf.flowchart);
flowDb.clear();
flowDb.setGen("gen-1");
}
};
export {
diagram
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,40 @@
import { p as parser, f as flowDb } from "./flowDb-c1833063.js";
import { f as flowRendererV2, a as flowStyles } from "./styles-483fbfea.js";
import { p as setConfig } from "./mermaid-6dc72991.js";
import "d3";
import "dagre-d3-es/src/graphlib/index.js";
import "./index-01f381cb.js";
import "dagre-d3-es/src/dagre/index.js";
import "dagre-d3-es/src/graphlib/json.js";
import "./edges-066a5561.js";
import "./createText-ca0c5216.js";
import "mdast-util-from-markdown";
import "ts-dedent";
import "dagre-d3-es/src/dagre-js/label/add-html-label.js";
import "khroma";
import "dayjs";
import "@braintree/sanitize-url";
import "dompurify";
import "lodash-es/memoize.js";
import "lodash-es/merge.js";
import "stylis";
import "lodash-es/isEmpty.js";
const diagram = {
parser,
db: flowDb,
renderer: flowRendererV2,
styles: flowStyles,
init: (cnf) => {
if (!cnf.flowchart) {
cnf.flowchart = {};
}
cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
setConfig({ flowchart: { arrowMarkerAbsolute: cnf.arrowMarkerAbsolute } });
flowRendererV2.setConf(cnf.flowchart);
flowDb.clear();
flowDb.setGen("gen-2");
}
};
export {
diagram
};

View file

@ -0,0 +1,32 @@
import { p as parser, f as flowDb } from "./flowDb-ba9bd7fa.js";
import { f as flowRendererV2, g as flowStyles } from "./styles-727cdd61.js";
import { u as setConfig } from "./mermaid-dcacb631.js";
import "./graph-fe24fab6.js";
import "./index-fc479858.js";
import "./layout-163b9689.js";
import "./clone-9ea6bfeb.js";
import "./edges-ce5cfb7c.js";
import "./createText-b70fe78a.js";
import "./line-87f517ef.js";
import "./array-b7dcf730.js";
import "./path-39bad7e2.js";
import "./channel-f9001828.js";
const diagram = {
parser,
db: flowDb,
renderer: flowRendererV2,
styles: flowStyles,
init: (cnf) => {
if (!cnf.flowchart) {
cnf.flowchart = {};
}
cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
setConfig({ flowchart: { arrowMarkerAbsolute: cnf.arrowMarkerAbsolute } });
flowRendererV2.setConf(cnf.flowchart);
flowDb.clear();
flowDb.setGen("gen-2");
}
};
export {
diagram
};

View file

@ -0,0 +1,25 @@
import { p as e, f as o } from "./flowDb-9a89ea33.js";
import { f as t, g as a } from "./styles-e75131e4.js";
import { u as i } from "./mermaid-9f2aa176.js";
import "./graph-0ee63739.js";
import "./index-bb6d8841.js";
import "./layout-fd473db2.js";
import "./clone-afc2f047.js";
import "./edges-16357fde.js";
import "./createText-03b82060.js";
import "./line-24d93f1b.js";
import "./array-2ff2c7a6.js";
import "./path-428ebac9.js";
import "./channel-ebbc4130.js";
const M = {
parser: e,
db: o,
renderer: t,
styles: a,
init: (r) => {
r.flowchart || (r.flowchart = {}), r.flowchart.arrowMarkerAbsolute = r.arrowMarkerAbsolute, i({ flowchart: { arrowMarkerAbsolute: r.arrowMarkerAbsolute } }), t.setConf(r.flowchart), o.clear(), o.setGen("gen-2");
}
};
export {
M as diagram
};

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,814 @@
import { d as db, p as parser } from "./flowDb-c1833063.js";
import { select, curveLinear, line } from "d3";
import { a as insertMarkers, e as insertNode, l as labelHelper, f as insertEdgeLabel, k as getLineFunctionsWithOffset, m as addEdgeMarkers } from "./edges-066a5561.js";
import { l as log, F as getConfig, o as setupGraphViewbox, k as getStylesFromArray, n as interpolateToCurve, e as common } from "./mermaid-6dc72991.js";
import ELK from "elkjs/lib/elk.bundled.js";
import "./createText-ca0c5216.js";
import "mdast-util-from-markdown";
import "ts-dedent";
import "dayjs";
import "@braintree/sanitize-url";
import "dompurify";
import "khroma";
import "lodash-es/memoize.js";
import "lodash-es/merge.js";
import "stylis";
import "lodash-es/isEmpty.js";
const findCommonAncestor = (id1, id2, treeData) => {
const { parentById } = treeData;
const visited = /* @__PURE__ */ new Set();
let currentId = id1;
while (currentId) {
visited.add(currentId);
if (currentId === id2) {
return currentId;
}
currentId = parentById[currentId];
}
currentId = id2;
while (currentId) {
if (visited.has(currentId)) {
return currentId;
}
currentId = parentById[currentId];
}
return "root";
};
const elk = new ELK();
let portPos = {};
const conf = {};
let nodeDb = {};
const addVertices = async function(vert, svgId, root, doc, diagObj, parentLookupDb, graph) {
const svg = root.select(`[id="${svgId}"]`);
const nodes = svg.insert("g").attr("class", "nodes");
const keys = Object.keys(vert);
await Promise.all(
keys.map(async function(id) {
const vertex = vert[id];
let classStr = "default";
if (vertex.classes.length > 0) {
classStr = vertex.classes.join(" ");
}
classStr = classStr + " flowchart-label";
const styles2 = getStylesFromArray(vertex.styles);
let vertexText = vertex.text !== void 0 ? vertex.text : vertex.id;
const labelData = { width: 0, height: 0 };
const ports = [
{
id: vertex.id + "-west",
layoutOptions: {
"port.side": "WEST"
}
},
{
id: vertex.id + "-east",
layoutOptions: {
"port.side": "EAST"
}
},
{
id: vertex.id + "-south",
layoutOptions: {
"port.side": "SOUTH"
}
},
{
id: vertex.id + "-north",
layoutOptions: {
"port.side": "NORTH"
}
}
];
let radius = 0;
let _shape = "";
let layoutOptions = {};
switch (vertex.type) {
case "round":
radius = 5;
_shape = "rect";
break;
case "square":
_shape = "rect";
break;
case "diamond":
_shape = "question";
layoutOptions = {
portConstraints: "FIXED_SIDE"
};
break;
case "hexagon":
_shape = "hexagon";
break;
case "odd":
_shape = "rect_left_inv_arrow";
break;
case "lean_right":
_shape = "lean_right";
break;
case "lean_left":
_shape = "lean_left";
break;
case "trapezoid":
_shape = "trapezoid";
break;
case "inv_trapezoid":
_shape = "inv_trapezoid";
break;
case "odd_right":
_shape = "rect_left_inv_arrow";
break;
case "circle":
_shape = "circle";
break;
case "ellipse":
_shape = "ellipse";
break;
case "stadium":
_shape = "stadium";
break;
case "subroutine":
_shape = "subroutine";
break;
case "cylinder":
_shape = "cylinder";
break;
case "group":
_shape = "rect";
break;
case "doublecircle":
_shape = "doublecircle";
break;
default:
_shape = "rect";
}
const node = {
labelStyle: styles2.labelStyle,
shape: _shape,
labelText: vertexText,
labelType: vertex.labelType,
rx: radius,
ry: radius,
class: classStr,
style: styles2.style,
id: vertex.id,
link: vertex.link,
linkTarget: vertex.linkTarget,
tooltip: diagObj.db.getTooltip(vertex.id) || "",
domId: diagObj.db.lookUpDomId(vertex.id),
haveCallback: vertex.haveCallback,
width: vertex.type === "group" ? 500 : void 0,
dir: vertex.dir,
type: vertex.type,
props: vertex.props,
padding: getConfig().flowchart.padding
};
let boundingBox;
let nodeEl;
if (node.type !== "group") {
nodeEl = await insertNode(nodes, node, vertex.dir);
boundingBox = nodeEl.node().getBBox();
} else {
doc.createElementNS("http://www.w3.org/2000/svg", "text");
const { shapeSvg, bbox } = await labelHelper(nodes, node, void 0, true);
labelData.width = bbox.width;
labelData.wrappingWidth = getConfig().flowchart.wrappingWidth;
labelData.height = bbox.height;
labelData.labelNode = shapeSvg.node();
node.labelData = labelData;
}
const data = {
id: vertex.id,
ports: vertex.type === "diamond" ? ports : [],
// labelStyle: styles.labelStyle,
// shape: _shape,
layoutOptions,
labelText: vertexText,
labelData,
// labels: [{ text: vertexText }],
// rx: radius,
// ry: radius,
// class: classStr,
// style: styles.style,
// link: vertex.link,
// linkTarget: vertex.linkTarget,
// tooltip: diagObj.db.getTooltip(vertex.id) || '',
domId: diagObj.db.lookUpDomId(vertex.id),
// haveCallback: vertex.haveCallback,
width: boundingBox == null ? void 0 : boundingBox.width,
height: boundingBox == null ? void 0 : boundingBox.height,
// dir: vertex.dir,
type: vertex.type,
// props: vertex.props,
// padding: getConfig().flowchart.padding,
// boundingBox,
el: nodeEl,
parent: parentLookupDb.parentById[vertex.id]
};
nodeDb[node.id] = data;
})
);
return graph;
};
const getNextPosition = (position, edgeDirection, graphDirection) => {
const portPos2 = {
TB: {
in: {
north: "north"
},
out: {
south: "west",
west: "east",
east: "south"
}
},
LR: {
in: {
west: "west"
},
out: {
east: "south",
south: "north",
north: "east"
}
},
RL: {
in: {
east: "east"
},
out: {
west: "north",
north: "south",
south: "west"
}
},
BT: {
in: {
south: "south"
},
out: {
north: "east",
east: "west",
west: "north"
}
}
};
portPos2.TD = portPos2.TB;
return portPos2[graphDirection][edgeDirection][position];
};
const getNextPort = (node, edgeDirection, graphDirection) => {
log.info("getNextPort", { node, edgeDirection, graphDirection });
if (!portPos[node]) {
switch (graphDirection) {
case "TB":
case "TD":
portPos[node] = {
inPosition: "north",
outPosition: "south"
};
break;
case "BT":
portPos[node] = {
inPosition: "south",
outPosition: "north"
};
break;
case "RL":
portPos[node] = {
inPosition: "east",
outPosition: "west"
};
break;
case "LR":
portPos[node] = {
inPosition: "west",
outPosition: "east"
};
break;
}
}
const result = edgeDirection === "in" ? portPos[node].inPosition : portPos[node].outPosition;
if (edgeDirection === "in") {
portPos[node].inPosition = getNextPosition(
portPos[node].inPosition,
edgeDirection,
graphDirection
);
} else {
portPos[node].outPosition = getNextPosition(
portPos[node].outPosition,
edgeDirection,
graphDirection
);
}
return result;
};
const getEdgeStartEndPoint = (edge, dir) => {
let source = edge.start;
let target = edge.end;
const sourceId = source;
const targetId = target;
const startNode = nodeDb[source];
const endNode = nodeDb[target];
if (!startNode || !endNode) {
return { source, target };
}
if (startNode.type === "diamond") {
source = `${source}-${getNextPort(source, "out", dir)}`;
}
if (endNode.type === "diamond") {
target = `${target}-${getNextPort(target, "in", dir)}`;
}
return { source, target, sourceId, targetId };
};
const addEdges = function(edges, diagObj, graph, svg) {
log.info("abc78 edges = ", edges);
const labelsEl = svg.insert("g").attr("class", "edgeLabels");
let linkIdCnt = {};
let dir = diagObj.db.getDirection();
let defaultStyle;
let defaultLabelStyle;
if (edges.defaultStyle !== void 0) {
const defaultStyles = getStylesFromArray(edges.defaultStyle);
defaultStyle = defaultStyles.style;
defaultLabelStyle = defaultStyles.labelStyle;
}
edges.forEach(function(edge) {
const linkIdBase = "L-" + edge.start + "-" + edge.end;
if (linkIdCnt[linkIdBase] === void 0) {
linkIdCnt[linkIdBase] = 0;
log.info("abc78 new entry", linkIdBase, linkIdCnt[linkIdBase]);
} else {
linkIdCnt[linkIdBase]++;
log.info("abc78 new entry", linkIdBase, linkIdCnt[linkIdBase]);
}
let linkId = linkIdBase + "-" + linkIdCnt[linkIdBase];
log.info("abc78 new link id to be used is", linkIdBase, linkId, linkIdCnt[linkIdBase]);
const linkNameStart = "LS-" + edge.start;
const linkNameEnd = "LE-" + edge.end;
const edgeData = { style: "", labelStyle: "" };
edgeData.minlen = edge.length || 1;
if (edge.type === "arrow_open") {
edgeData.arrowhead = "none";
} else {
edgeData.arrowhead = "normal";
}
edgeData.arrowTypeStart = "arrow_open";
edgeData.arrowTypeEnd = "arrow_open";
switch (edge.type) {
case "double_arrow_cross":
edgeData.arrowTypeStart = "arrow_cross";
case "arrow_cross":
edgeData.arrowTypeEnd = "arrow_cross";
break;
case "double_arrow_point":
edgeData.arrowTypeStart = "arrow_point";
case "arrow_point":
edgeData.arrowTypeEnd = "arrow_point";
break;
case "double_arrow_circle":
edgeData.arrowTypeStart = "arrow_circle";
case "arrow_circle":
edgeData.arrowTypeEnd = "arrow_circle";
break;
}
let style = "";
let labelStyle = "";
switch (edge.stroke) {
case "normal":
style = "fill:none;";
if (defaultStyle !== void 0) {
style = defaultStyle;
}
if (defaultLabelStyle !== void 0) {
labelStyle = defaultLabelStyle;
}
edgeData.thickness = "normal";
edgeData.pattern = "solid";
break;
case "dotted":
edgeData.thickness = "normal";
edgeData.pattern = "dotted";
edgeData.style = "fill:none;stroke-width:2px;stroke-dasharray:3;";
break;
case "thick":
edgeData.thickness = "thick";
edgeData.pattern = "solid";
edgeData.style = "stroke-width: 3.5px;fill:none;";
break;
}
if (edge.style !== void 0) {
const styles2 = getStylesFromArray(edge.style);
style = styles2.style;
labelStyle = styles2.labelStyle;
}
edgeData.style = edgeData.style += style;
edgeData.labelStyle = edgeData.labelStyle += labelStyle;
if (edge.interpolate !== void 0) {
edgeData.curve = interpolateToCurve(edge.interpolate, curveLinear);
} else if (edges.defaultInterpolate !== void 0) {
edgeData.curve = interpolateToCurve(edges.defaultInterpolate, curveLinear);
} else {
edgeData.curve = interpolateToCurve(conf.curve, curveLinear);
}
if (edge.text === void 0) {
if (edge.style !== void 0) {
edgeData.arrowheadStyle = "fill: #333";
}
} else {
edgeData.arrowheadStyle = "fill: #333";
edgeData.labelpos = "c";
}
edgeData.labelType = edge.labelType;
edgeData.label = edge.text.replace(common.lineBreakRegex, "\n");
if (edge.style === void 0) {
edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none;";
}
edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
edgeData.id = linkId;
edgeData.classes = "flowchart-link " + linkNameStart + " " + linkNameEnd;
const labelEl = insertEdgeLabel(labelsEl, edgeData);
const { source, target, sourceId, targetId } = getEdgeStartEndPoint(edge, dir);
log.debug("abc78 source and target", source, target);
graph.edges.push({
id: "e" + edge.start + edge.end,
sources: [source],
targets: [target],
sourceId,
targetId,
labelEl,
labels: [
{
width: edgeData.width,
height: edgeData.height,
orgWidth: edgeData.width,
orgHeight: edgeData.height,
text: edgeData.label,
layoutOptions: {
"edgeLabels.inline": "true",
"edgeLabels.placement": "CENTER"
}
}
],
edgeData
});
});
return graph;
};
const addMarkersToEdge = function(svgPath, edgeData, diagramType, arrowMarkerAbsolute, id) {
let url = "";
if (arrowMarkerAbsolute) {
url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
url = url.replace(/\(/g, "\\(");
url = url.replace(/\)/g, "\\)");
}
addEdgeMarkers(svgPath, edgeData, url, id, diagramType);
};
const getClasses = function(text, diagObj) {
log.info("Extracting classes");
return diagObj.db.getClasses();
};
const addSubGraphs = function(db2) {
const parentLookupDb = { parentById: {}, childrenById: {} };
const subgraphs = db2.getSubGraphs();
log.info("Subgraphs - ", subgraphs);
subgraphs.forEach(function(subgraph) {
subgraph.nodes.forEach(function(node) {
parentLookupDb.parentById[node] = subgraph.id;
if (parentLookupDb.childrenById[subgraph.id] === void 0) {
parentLookupDb.childrenById[subgraph.id] = [];
}
parentLookupDb.childrenById[subgraph.id].push(node);
});
});
subgraphs.forEach(function(subgraph) {
({ id: subgraph.id });
if (parentLookupDb.parentById[subgraph.id] !== void 0) {
parentLookupDb.parentById[subgraph.id];
}
});
return parentLookupDb;
};
const calcOffset = function(src, dest, parentLookupDb) {
const ancestor = findCommonAncestor(src, dest, parentLookupDb);
if (ancestor === void 0 || ancestor === "root") {
return { x: 0, y: 0 };
}
const ancestorOffset = nodeDb[ancestor].offset;
return { x: ancestorOffset.posX, y: ancestorOffset.posY };
};
const insertEdge = function(edgesEl, edge, edgeData, diagObj, parentLookupDb, id) {
const offset = calcOffset(edge.sourceId, edge.targetId, parentLookupDb);
const src = edge.sections[0].startPoint;
const dest = edge.sections[0].endPoint;
const segments = edge.sections[0].bendPoints ? edge.sections[0].bendPoints : [];
const segPoints = segments.map((segment) => [segment.x + offset.x, segment.y + offset.y]);
const points = [
[src.x + offset.x, src.y + offset.y],
...segPoints,
[dest.x + offset.x, dest.y + offset.y]
];
const { x, y } = getLineFunctionsWithOffset(edge.edgeData);
const curve = line().x(x).y(y).curve(curveLinear);
const edgePath = edgesEl.insert("path").attr("d", curve(points)).attr("class", "path " + edgeData.classes).attr("fill", "none");
const edgeG = edgesEl.insert("g").attr("class", "edgeLabel");
const edgeWithLabel = select(edgeG.node().appendChild(edge.labelEl));
const box = edgeWithLabel.node().firstChild.getBoundingClientRect();
edgeWithLabel.attr("width", box.width);
edgeWithLabel.attr("height", box.height);
edgeG.attr(
"transform",
`translate(${edge.labels[0].x + offset.x}, ${edge.labels[0].y + offset.y})`
);
addMarkersToEdge(edgePath, edgeData, diagObj.type, diagObj.arrowMarkerAbsolute, id);
};
const insertChildren = (nodeArray, parentLookupDb) => {
nodeArray.forEach((node) => {
if (!node.children) {
node.children = [];
}
const childIds = parentLookupDb.childrenById[node.id];
if (childIds) {
childIds.forEach((childId) => {
node.children.push(nodeDb[childId]);
});
}
insertChildren(node.children, parentLookupDb);
});
};
const draw = async function(text, id, _version, diagObj) {
var _a;
diagObj.db.clear();
nodeDb = {};
portPos = {};
diagObj.db.setGen("gen-2");
diagObj.parser.parse(text);
const renderEl = select("body").append("div").attr("style", "height:400px").attr("id", "cy");
let graph = {
id: "root",
layoutOptions: {
"elk.hierarchyHandling": "INCLUDE_CHILDREN",
"org.eclipse.elk.padding": "[top=100, left=100, bottom=110, right=110]",
"elk.layered.spacing.edgeNodeBetweenLayers": "30",
// 'elk.layered.mergeEdges': 'true',
"elk.direction": "DOWN"
// 'elk.ports.sameLayerEdges': true,
// 'nodePlacement.strategy': 'SIMPLE',
},
children: [],
edges: []
};
log.info("Drawing flowchart using v3 renderer", elk);
let dir = diagObj.db.getDirection();
switch (dir) {
case "BT":
graph.layoutOptions["elk.direction"] = "UP";
break;
case "TB":
graph.layoutOptions["elk.direction"] = "DOWN";
break;
case "LR":
graph.layoutOptions["elk.direction"] = "RIGHT";
break;
case "RL":
graph.layoutOptions["elk.direction"] = "LEFT";
break;
}
const { securityLevel, flowchart: conf2 } = getConfig();
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = select("#i" + id);
}
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
const svg = root.select(`[id="${id}"]`);
const markers = ["point", "circle", "cross"];
insertMarkers(svg, markers, diagObj.type, id);
const vert = diagObj.db.getVertices();
let subG;
const subGraphs = diagObj.db.getSubGraphs();
log.info("Subgraphs - ", subGraphs);
for (let i = subGraphs.length - 1; i >= 0; i--) {
subG = subGraphs[i];
diagObj.db.addVertex(
subG.id,
{ text: subG.title, type: subG.labelType },
"group",
void 0,
subG.classes,
subG.dir
);
}
const subGraphsEl = svg.insert("g").attr("class", "subgraphs");
const parentLookupDb = addSubGraphs(diagObj.db);
graph = await addVertices(vert, id, root, doc, diagObj, parentLookupDb, graph);
const edgesEl = svg.insert("g").attr("class", "edges edgePath");
const edges = diagObj.db.getEdges();
graph = addEdges(edges, diagObj, graph, svg);
const nodes = Object.keys(nodeDb);
nodes.forEach((nodeId) => {
const node = nodeDb[nodeId];
if (!node.parent) {
graph.children.push(node);
}
if (parentLookupDb.childrenById[nodeId] !== void 0) {
node.labels = [
{
text: node.labelText,
layoutOptions: {
"nodeLabels.placement": "[H_CENTER, V_TOP, INSIDE]"
},
width: node.labelData.width,
height: node.labelData.height
// width: 100,
// height: 100,
}
];
delete node.x;
delete node.y;
delete node.width;
delete node.height;
}
});
insertChildren(graph.children, parentLookupDb);
log.info("after layout", JSON.stringify(graph, null, 2));
const g = await elk.layout(graph);
drawNodes(0, 0, g.children, svg, subGraphsEl, diagObj, 0);
log.info("after layout", g);
(_a = g.edges) == null ? void 0 : _a.map((edge) => {
insertEdge(edgesEl, edge, edge.edgeData, diagObj, parentLookupDb, id);
});
setupGraphViewbox({}, svg, conf2.diagramPadding, conf2.useMaxWidth);
renderEl.remove();
};
const drawNodes = (relX, relY, nodeArray, svg, subgraphsEl, diagObj, depth) => {
nodeArray.forEach(function(node) {
if (node) {
nodeDb[node.id].offset = {
posX: node.x + relX,
posY: node.y + relY,
x: relX,
y: relY,
depth,
width: node.width,
height: node.height
};
if (node.type === "group") {
const subgraphEl = subgraphsEl.insert("g").attr("class", "subgraph");
subgraphEl.insert("rect").attr("class", "subgraph subgraph-lvl-" + depth % 5 + " node").attr("x", node.x + relX).attr("y", node.y + relY).attr("width", node.width).attr("height", node.height);
const label = subgraphEl.insert("g").attr("class", "label");
const labelCentering = getConfig().flowchart.htmlLabels ? node.labelData.width / 2 : 0;
label.attr(
"transform",
`translate(${node.labels[0].x + relX + node.x + labelCentering}, ${node.labels[0].y + relY + node.y + 3})`
);
label.node().appendChild(node.labelData.labelNode);
log.info("Id (UGH)= ", node.type, node.labels);
} else {
log.info("Id (UGH)= ", node.id);
node.el.attr(
"transform",
`translate(${node.x + relX + node.width / 2}, ${node.y + relY + node.height / 2})`
);
}
}
});
nodeArray.forEach(function(node) {
if (node && node.type === "group") {
drawNodes(relX + node.x, relY + node.y, node.children, svg, subgraphsEl, diagObj, depth + 1);
}
});
};
const renderer = {
getClasses,
draw
};
const genSections = (options) => {
let sections = "";
for (let i = 0; i < 5; i++) {
sections += `
.subgraph-lvl-${i} {
fill: ${options[`surface${i}`]};
stroke: ${options[`surfacePeer${i}`]};
}
`;
}
return sections;
};
const getStyles = (options) => `.label {
font-family: ${options.fontFamily};
color: ${options.nodeTextColor || options.textColor};
}
.cluster-label text {
fill: ${options.titleColor};
}
.cluster-label span {
color: ${options.titleColor};
}
.label text,span {
fill: ${options.nodeTextColor || options.textColor};
color: ${options.nodeTextColor || options.textColor};
}
.node rect,
.node circle,
.node ellipse,
.node polygon,
.node path {
fill: ${options.mainBkg};
stroke: ${options.nodeBorder};
stroke-width: 1px;
}
.node .label {
text-align: center;
}
.node.clickable {
cursor: pointer;
}
.arrowheadPath {
fill: ${options.arrowheadColor};
}
.edgePath .path {
stroke: ${options.lineColor};
stroke-width: 2.0px;
}
.flowchart-link {
stroke: ${options.lineColor};
fill: none;
}
.edgeLabel {
background-color: ${options.edgeLabelBackground};
rect {
opacity: 0.85;
background-color: ${options.edgeLabelBackground};
fill: ${options.edgeLabelBackground};
}
text-align: center;
}
.cluster rect {
fill: ${options.clusterBkg};
stroke: ${options.clusterBorder};
stroke-width: 1px;
}
.cluster text {
fill: ${options.titleColor};
}
.cluster span {
color: ${options.titleColor};
}
/* .cluster div {
color: ${options.titleColor};
} */
div.mermaidTooltip {
position: absolute;
text-align: center;
max-width: 200px;
padding: 2px;
font-family: ${options.fontFamily};
font-size: 12px;
background: ${options.tertiaryColor};
border: 1px solid ${options.border2};
border-radius: 2px;
pointer-events: none;
z-index: 100;
}
.flowchartTitleText {
text-anchor: middle;
font-size: 18px;
fill: ${options.textColor};
}
.subgraph {
stroke-width:2;
rx:3;
}
// .subgraph-lvl-1 {
// fill:#ccc;
// // stroke:black;
// }
.flowchart-label text {
text-anchor: middle;
}
${genSections(options)}
`;
const styles = getStyles;
const diagram = {
db,
renderer,
parser,
styles
};
export {
diagram
};

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,881 @@
import { aK as I, aL as qe, aM as O, ah as y, ag as Te, aN as Xe, aO as Qe, aP as We, aQ as Ee, aR as G, ae as X, aS as Je, aT as Oe, aU as ze, aV as C, aW as R, an as $e, a8 as me, aX as Ve, aY as Z, aZ as ke, a_ as en, a$ as L, am as nn, b0 as rn, af as tn, b1 as re, b2 as sn, b3 as an, al as un, ak as we, ai as fn, b4 as B, ac as on, b5 as dn, ao as M, z as te, b6 as ie } from "./mermaid-9f2aa176.js";
var hn = "[object Symbol]";
function Q(e) {
return typeof e == "symbol" || I(e) && qe(e) == hn;
}
function ve(e, n) {
for (var r = -1, t = e == null ? 0 : e.length, i = Array(t); ++r < t; )
i[r] = n(e[r], r, e);
return i;
}
var ln = 1 / 0, se = O ? O.prototype : void 0, ae = se ? se.toString : void 0;
function Pe(e) {
if (typeof e == "string")
return e;
if (y(e))
return ve(e, Pe) + "";
if (Q(e))
return ae ? ae.call(e) : "";
var n = e + "";
return n == "0" && 1 / e == -ln ? "-0" : n;
}
function gn() {
}
function Le(e, n) {
for (var r = -1, t = e == null ? 0 : e.length; ++r < t && n(e[r], r, e) !== !1; )
;
return e;
}
function cn(e, n, r, t) {
for (var i = e.length, s = r + (t ? 1 : -1); t ? s-- : ++s < i; )
if (n(e[s], s, e))
return s;
return -1;
}
function _n(e) {
return e !== e;
}
function pn(e, n, r) {
for (var t = r - 1, i = e.length; ++t < i; )
if (e[t] === n)
return t;
return -1;
}
function bn(e, n, r) {
return n === n ? pn(e, n, r) : cn(e, _n, r);
}
function yn(e, n) {
var r = e == null ? 0 : e.length;
return !!r && bn(e, n, 0) > -1;
}
function T(e) {
return Te(e) ? Xe(e) : Qe(e);
}
var An = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Tn = /^\w*$/;
function W(e, n) {
if (y(e))
return !1;
var r = typeof e;
return r == "number" || r == "symbol" || r == "boolean" || e == null || Q(e) ? !0 : Tn.test(e) || !An.test(e) || n != null && e in Object(n);
}
var En = 500;
function On(e) {
var n = We(e, function(t) {
return r.size === En && r.clear(), t;
}), r = n.cache;
return n;
}
var $n = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, mn = /\\(\\)?/g, wn = On(function(e) {
var n = [];
return e.charCodeAt(0) === 46 && n.push(""), e.replace($n, function(r, t, i, s) {
n.push(i ? s.replace(mn, "$1") : t || r);
}), n;
});
const vn = wn;
function Pn(e) {
return e == null ? "" : Pe(e);
}
function Ie(e, n) {
return y(e) ? e : W(e, n) ? [e] : vn(Pn(e));
}
var Ln = 1 / 0;
function U(e) {
if (typeof e == "string" || Q(e))
return e;
var n = e + "";
return n == "0" && 1 / e == -Ln ? "-0" : n;
}
function Ce(e, n) {
n = Ie(n, e);
for (var r = 0, t = n.length; e != null && r < t; )
e = e[U(n[r++])];
return r && r == t ? e : void 0;
}
function In(e, n, r) {
var t = e == null ? void 0 : Ce(e, n);
return t === void 0 ? r : t;
}
function J(e, n) {
for (var r = -1, t = n.length, i = e.length; ++r < t; )
e[i + r] = n[r];
return e;
}
var ue = O ? O.isConcatSpreadable : void 0;
function Cn(e) {
return y(e) || Ee(e) || !!(ue && e && e[ue]);
}
function Se(e, n, r, t, i) {
var s = -1, a = e.length;
for (r || (r = Cn), i || (i = []); ++s < a; ) {
var u = e[s];
n > 0 && r(u) ? n > 1 ? Se(u, n - 1, r, t, i) : J(i, u) : t || (i[i.length] = u);
}
return i;
}
function Sn(e, n, r, t) {
var i = -1, s = e == null ? 0 : e.length;
for (t && s && (r = e[++i]); ++i < s; )
r = n(r, e[i], i, e);
return r;
}
function Nn(e, n) {
return e && G(n, T(n), e);
}
function Fn(e, n) {
return e && G(n, X(n), e);
}
function Ne(e, n) {
for (var r = -1, t = e == null ? 0 : e.length, i = 0, s = []; ++r < t; ) {
var a = e[r];
n(a, r, e) && (s[i++] = a);
}
return s;
}
function Fe() {
return [];
}
var Mn = Object.prototype, xn = Mn.propertyIsEnumerable, fe = Object.getOwnPropertySymbols, Dn = fe ? function(e) {
return e == null ? [] : (e = Object(e), Ne(fe(e), function(n) {
return xn.call(e, n);
}));
} : Fe;
const z = Dn;
function Rn(e, n) {
return G(e, z(e), n);
}
var Gn = Object.getOwnPropertySymbols, Un = Gn ? function(e) {
for (var n = []; e; )
J(n, z(e)), e = Je(e);
return n;
} : Fe;
const Me = Un;
function Bn(e, n) {
return G(e, Me(e), n);
}
function xe(e, n, r) {
var t = n(e);
return y(e) ? t : J(t, r(e));
}
function q(e) {
return xe(e, T, z);
}
function jn(e) {
return xe(e, X, Me);
}
var Kn = Object.prototype, Hn = Kn.hasOwnProperty;
function Yn(e) {
var n = e.length, r = new e.constructor(n);
return n && typeof e[0] == "string" && Hn.call(e, "index") && (r.index = e.index, r.input = e.input), r;
}
function Zn(e, n) {
var r = n ? Oe(e.buffer) : e.buffer;
return new e.constructor(r, e.byteOffset, e.byteLength);
}
var qn = /\w*$/;
function Xn(e) {
var n = new e.constructor(e.source, qn.exec(e));
return n.lastIndex = e.lastIndex, n;
}
var oe = O ? O.prototype : void 0, de = oe ? oe.valueOf : void 0;
function Qn(e) {
return de ? Object(de.call(e)) : {};
}
var Wn = "[object Boolean]", Jn = "[object Date]", zn = "[object Map]", Vn = "[object Number]", kn = "[object RegExp]", er = "[object Set]", nr = "[object String]", rr = "[object Symbol]", tr = "[object ArrayBuffer]", ir = "[object DataView]", sr = "[object Float32Array]", ar = "[object Float64Array]", ur = "[object Int8Array]", fr = "[object Int16Array]", or = "[object Int32Array]", dr = "[object Uint8Array]", hr = "[object Uint8ClampedArray]", lr = "[object Uint16Array]", gr = "[object Uint32Array]";
function cr(e, n, r) {
var t = e.constructor;
switch (n) {
case tr:
return Oe(e);
case Wn:
case Jn:
return new t(+e);
case ir:
return Zn(e, r);
case sr:
case ar:
case ur:
case fr:
case or:
case dr:
case hr:
case lr:
case gr:
return ze(e, r);
case zn:
return new t();
case Vn:
case nr:
return new t(e);
case kn:
return Xn(e);
case er:
return new t();
case rr:
return Qn(e);
}
}
var _r = "[object Map]";
function pr(e) {
return I(e) && C(e) == _r;
}
var he = R && R.isMap, br = he ? $e(he) : pr;
const yr = br;
var Ar = "[object Set]";
function Tr(e) {
return I(e) && C(e) == Ar;
}
var le = R && R.isSet, Er = le ? $e(le) : Tr;
const Or = Er;
var $r = 1, mr = 2, wr = 4, De = "[object Arguments]", vr = "[object Array]", Pr = "[object Boolean]", Lr = "[object Date]", Ir = "[object Error]", Re = "[object Function]", Cr = "[object GeneratorFunction]", Sr = "[object Map]", Nr = "[object Number]", Ge = "[object Object]", Fr = "[object RegExp]", Mr = "[object Set]", xr = "[object String]", Dr = "[object Symbol]", Rr = "[object WeakMap]", Gr = "[object ArrayBuffer]", Ur = "[object DataView]", Br = "[object Float32Array]", jr = "[object Float64Array]", Kr = "[object Int8Array]", Hr = "[object Int16Array]", Yr = "[object Int32Array]", Zr = "[object Uint8Array]", qr = "[object Uint8ClampedArray]", Xr = "[object Uint16Array]", Qr = "[object Uint32Array]", h = {};
h[De] = h[vr] = h[Gr] = h[Ur] = h[Pr] = h[Lr] = h[Br] = h[jr] = h[Kr] = h[Hr] = h[Yr] = h[Sr] = h[Nr] = h[Ge] = h[Fr] = h[Mr] = h[xr] = h[Dr] = h[Zr] = h[qr] = h[Xr] = h[Qr] = !0;
h[Ir] = h[Re] = h[Rr] = !1;
function j(e, n, r, t, i, s) {
var a, u = n & $r, f = n & mr, g = n & wr;
if (r && (a = i ? r(e, t, i, s) : r(e)), a !== void 0)
return a;
if (!me(e))
return e;
var l = y(e);
if (l) {
if (a = Yn(e), !u)
return Ve(e, a);
} else {
var o = C(e), d = o == Re || o == Cr;
if (Z(e))
return ke(e, u);
if (o == Ge || o == De || d && !i) {
if (a = f || d ? {} : en(e), !u)
return f ? Bn(e, Fn(a, e)) : Rn(e, Nn(a, e));
} else {
if (!h[o])
return i ? e : {};
a = cr(e, o, u);
}
}
s || (s = new L());
var A = s.get(e);
if (A)
return A;
s.set(e, a), Or(e) ? e.forEach(function(c) {
a.add(j(c, n, r, c, e, s));
}) : yr(e) && e.forEach(function(c, _) {
a.set(_, j(c, n, r, _, e, s));
});
var p = g ? f ? jn : q : f ? X : T, b = l ? void 0 : p(e);
return Le(b || e, function(c, _) {
b && (_ = c, c = e[_]), nn(a, _, j(c, n, r, _, e, s));
}), a;
}
var Wr = "__lodash_hash_undefined__";
function Jr(e) {
return this.__data__.set(e, Wr), this;
}
function zr(e) {
return this.__data__.has(e);
}
function S(e) {
var n = -1, r = e == null ? 0 : e.length;
for (this.__data__ = new rn(); ++n < r; )
this.add(e[n]);
}
S.prototype.add = S.prototype.push = Jr;
S.prototype.has = zr;
function Vr(e, n) {
for (var r = -1, t = e == null ? 0 : e.length; ++r < t; )
if (n(e[r], r, e))
return !0;
return !1;
}
function Ue(e, n) {
return e.has(n);
}
var kr = 1, et = 2;
function Be(e, n, r, t, i, s) {
var a = r & kr, u = e.length, f = n.length;
if (u != f && !(a && f > u))
return !1;
var g = s.get(e), l = s.get(n);
if (g && l)
return g == n && l == e;
var o = -1, d = !0, A = r & et ? new S() : void 0;
for (s.set(e, n), s.set(n, e); ++o < u; ) {
var p = e[o], b = n[o];
if (t)
var c = a ? t(b, p, o, n, e, s) : t(p, b, o, e, n, s);
if (c !== void 0) {
if (c)
continue;
d = !1;
break;
}
if (A) {
if (!Vr(n, function(_, $) {
if (!Ue(A, $) && (p === _ || i(p, _, r, t, s)))
return A.push($);
})) {
d = !1;
break;
}
} else if (!(p === b || i(p, b, r, t, s))) {
d = !1;
break;
}
}
return s.delete(e), s.delete(n), d;
}
function nt(e) {
var n = -1, r = Array(e.size);
return e.forEach(function(t, i) {
r[++n] = [i, t];
}), r;
}
function V(e) {
var n = -1, r = Array(e.size);
return e.forEach(function(t) {
r[++n] = t;
}), r;
}
var rt = 1, tt = 2, it = "[object Boolean]", st = "[object Date]", at = "[object Error]", ut = "[object Map]", ft = "[object Number]", ot = "[object RegExp]", dt = "[object Set]", ht = "[object String]", lt = "[object Symbol]", gt = "[object ArrayBuffer]", ct = "[object DataView]", ge = O ? O.prototype : void 0, K = ge ? ge.valueOf : void 0;
function _t(e, n, r, t, i, s, a) {
switch (r) {
case ct:
if (e.byteLength != n.byteLength || e.byteOffset != n.byteOffset)
return !1;
e = e.buffer, n = n.buffer;
case gt:
return !(e.byteLength != n.byteLength || !s(new re(e), new re(n)));
case it:
case st:
case ft:
return tn(+e, +n);
case at:
return e.name == n.name && e.message == n.message;
case ot:
case ht:
return e == n + "";
case ut:
var u = nt;
case dt:
var f = t & rt;
if (u || (u = V), e.size != n.size && !f)
return !1;
var g = a.get(e);
if (g)
return g == n;
t |= tt, a.set(e, n);
var l = Be(u(e), u(n), t, i, s, a);
return a.delete(e), l;
case lt:
if (K)
return K.call(e) == K.call(n);
}
return !1;
}
var pt = 1, bt = Object.prototype, yt = bt.hasOwnProperty;
function At(e, n, r, t, i, s) {
var a = r & pt, u = q(e), f = u.length, g = q(n), l = g.length;
if (f != l && !a)
return !1;
for (var o = f; o--; ) {
var d = u[o];
if (!(a ? d in n : yt.call(n, d)))
return !1;
}
var A = s.get(e), p = s.get(n);
if (A && p)
return A == n && p == e;
var b = !0;
s.set(e, n), s.set(n, e);
for (var c = a; ++o < f; ) {
d = u[o];
var _ = e[d], $ = n[d];
if (t)
var ne = a ? t($, _, d, n, e, s) : t(_, $, d, e, n, s);
if (!(ne === void 0 ? _ === $ || i(_, $, r, t, s) : ne)) {
b = !1;
break;
}
c || (c = d == "constructor");
}
if (b && !c) {
var N = e.constructor, F = n.constructor;
N != F && "constructor" in e && "constructor" in n && !(typeof N == "function" && N instanceof N && typeof F == "function" && F instanceof F) && (b = !1);
}
return s.delete(e), s.delete(n), b;
}
var Tt = 1, ce = "[object Arguments]", _e = "[object Array]", x = "[object Object]", Et = Object.prototype, pe = Et.hasOwnProperty;
function Ot(e, n, r, t, i, s) {
var a = y(e), u = y(n), f = a ? _e : C(e), g = u ? _e : C(n);
f = f == ce ? x : f, g = g == ce ? x : g;
var l = f == x, o = g == x, d = f == g;
if (d && Z(e)) {
if (!Z(n))
return !1;
a = !0, l = !1;
}
if (d && !l)
return s || (s = new L()), a || sn(e) ? Be(e, n, r, t, i, s) : _t(e, n, f, r, t, i, s);
if (!(r & Tt)) {
var A = l && pe.call(e, "__wrapped__"), p = o && pe.call(n, "__wrapped__");
if (A || p) {
var b = A ? e.value() : e, c = p ? n.value() : n;
return s || (s = new L()), i(b, c, r, t, s);
}
}
return d ? (s || (s = new L()), At(e, n, r, t, i, s)) : !1;
}
function k(e, n, r, t, i) {
return e === n ? !0 : e == null || n == null || !I(e) && !I(n) ? e !== e && n !== n : Ot(e, n, r, t, k, i);
}
var $t = 1, mt = 2;
function wt(e, n, r, t) {
var i = r.length, s = i, a = !t;
if (e == null)
return !s;
for (e = Object(e); i--; ) {
var u = r[i];
if (a && u[2] ? u[1] !== e[u[0]] : !(u[0] in e))
return !1;
}
for (; ++i < s; ) {
u = r[i];
var f = u[0], g = e[f], l = u[1];
if (a && u[2]) {
if (g === void 0 && !(f in e))
return !1;
} else {
var o = new L();
if (t)
var d = t(g, l, f, e, n, o);
if (!(d === void 0 ? k(l, g, $t | mt, t, o) : d))
return !1;
}
}
return !0;
}
function je(e) {
return e === e && !me(e);
}
function vt(e) {
for (var n = T(e), r = n.length; r--; ) {
var t = n[r], i = e[t];
n[r] = [t, i, je(i)];
}
return n;
}
function Ke(e, n) {
return function(r) {
return r == null ? !1 : r[e] === n && (n !== void 0 || e in Object(r));
};
}
function Pt(e) {
var n = vt(e);
return n.length == 1 && n[0][2] ? Ke(n[0][0], n[0][1]) : function(r) {
return r === e || wt(r, e, n);
};
}
function Lt(e, n) {
return e != null && n in Object(e);
}
function He(e, n, r) {
n = Ie(n, e);
for (var t = -1, i = n.length, s = !1; ++t < i; ) {
var a = U(n[t]);
if (!(s = e != null && r(e, a)))
break;
e = e[a];
}
return s || ++t != i ? s : (i = e == null ? 0 : e.length, !!i && an(i) && un(a, i) && (y(e) || Ee(e)));
}
function It(e, n) {
return e != null && He(e, n, Lt);
}
var Ct = 1, St = 2;
function Nt(e, n) {
return W(e) && je(n) ? Ke(U(e), n) : function(r) {
var t = In(r, e);
return t === void 0 && t === n ? It(r, e) : k(n, t, Ct | St);
};
}
function Ft(e) {
return function(n) {
return n == null ? void 0 : n[e];
};
}
function Mt(e) {
return function(n) {
return Ce(n, e);
};
}
function xt(e) {
return W(e) ? Ft(U(e)) : Mt(e);
}
function Ye(e) {
return typeof e == "function" ? e : e == null ? we : typeof e == "object" ? y(e) ? Nt(e[0], e[1]) : Pt(e) : xt(e);
}
function Dt(e, n) {
return e && fn(e, n, T);
}
function Rt(e, n) {
return function(r, t) {
if (r == null)
return r;
if (!Te(r))
return e(r, t);
for (var i = r.length, s = n ? i : -1, a = Object(r); (n ? s-- : ++s < i) && t(a[s], s, a) !== !1; )
;
return r;
};
}
var Gt = Rt(Dt);
const ee = Gt;
function Ut(e, n, r) {
for (var t = -1, i = e == null ? 0 : e.length; ++t < i; )
if (r(n, e[t]))
return !0;
return !1;
}
function Bt(e) {
return typeof e == "function" ? e : we;
}
function m(e, n) {
var r = y(e) ? Le : ee;
return r(e, Bt(n));
}
function jt(e, n) {
var r = [];
return ee(e, function(t, i, s) {
n(t, i, s) && r.push(t);
}), r;
}
function D(e, n) {
var r = y(e) ? Ne : jt;
return r(e, Ye(n));
}
var Kt = Object.prototype, Ht = Kt.hasOwnProperty;
function Yt(e, n) {
return e != null && Ht.call(e, n);
}
function E(e, n) {
return e != null && He(e, n, Yt);
}
function Zt(e, n) {
return ve(n, function(r) {
return e[r];
});
}
function H(e) {
return e == null ? [] : Zt(e, T(e));
}
function v(e) {
return e === void 0;
}
function qt(e, n, r, t, i) {
return i(e, function(s, a, u) {
r = t ? (t = !1, s) : n(r, s, a, u);
}), r;
}
function Xt(e, n, r) {
var t = y(e) ? Sn : qt, i = arguments.length < 3;
return t(e, Ye(n), r, i, ee);
}
var Qt = 1 / 0, Wt = B && 1 / V(new B([, -0]))[1] == Qt ? function(e) {
return new B(e);
} : gn;
const Jt = Wt;
var zt = 200;
function Vt(e, n, r) {
var t = -1, i = yn, s = e.length, a = !0, u = [], f = u;
if (r)
a = !1, i = Ut;
else if (s >= zt) {
var g = n ? null : Jt(e);
if (g)
return V(g);
a = !1, i = Ue, f = new S();
} else
f = n ? [] : u;
e:
for (; ++t < s; ) {
var l = e[t], o = n ? n(l) : l;
if (l = r || l !== 0 ? l : 0, a && o === o) {
for (var d = f.length; d--; )
if (f[d] === o)
continue e;
n && f.push(o), u.push(l);
} else
i(f, o, r) || (f !== u && f.push(o), u.push(l));
}
return u;
}
var kt = on(function(e) {
return Vt(Se(e, 1, dn, !0));
});
const ei = kt;
var ni = "\0", w = "\0", be = "";
class Ze {
constructor(n = {}) {
this._isDirected = E(n, "directed") ? n.directed : !0, this._isMultigraph = E(n, "multigraph") ? n.multigraph : !1, this._isCompound = E(n, "compound") ? n.compound : !1, this._label = void 0, this._defaultNodeLabelFn = M(void 0), this._defaultEdgeLabelFn = M(void 0), this._nodes = {}, this._isCompound && (this._parent = {}, this._children = {}, this._children[w] = {}), this._in = {}, this._preds = {}, this._out = {}, this._sucs = {}, this._edgeObjs = {}, this._edgeLabels = {};
}
/* === Graph functions ========= */
isDirected() {
return this._isDirected;
}
isMultigraph() {
return this._isMultigraph;
}
isCompound() {
return this._isCompound;
}
setGraph(n) {
return this._label = n, this;
}
graph() {
return this._label;
}
/* === Node functions ========== */
setDefaultNodeLabel(n) {
return te(n) || (n = M(n)), this._defaultNodeLabelFn = n, this;
}
nodeCount() {
return this._nodeCount;
}
nodes() {
return T(this._nodes);
}
sources() {
var n = this;
return D(this.nodes(), function(r) {
return ie(n._in[r]);
});
}
sinks() {
var n = this;
return D(this.nodes(), function(r) {
return ie(n._out[r]);
});
}
setNodes(n, r) {
var t = arguments, i = this;
return m(n, function(s) {
t.length > 1 ? i.setNode(s, r) : i.setNode(s);
}), this;
}
setNode(n, r) {
return E(this._nodes, n) ? (arguments.length > 1 && (this._nodes[n] = r), this) : (this._nodes[n] = arguments.length > 1 ? r : this._defaultNodeLabelFn(n), this._isCompound && (this._parent[n] = w, this._children[n] = {}, this._children[w][n] = !0), this._in[n] = {}, this._preds[n] = {}, this._out[n] = {}, this._sucs[n] = {}, ++this._nodeCount, this);
}
node(n) {
return this._nodes[n];
}
hasNode(n) {
return E(this._nodes, n);
}
removeNode(n) {
var r = this;
if (E(this._nodes, n)) {
var t = function(i) {
r.removeEdge(r._edgeObjs[i]);
};
delete this._nodes[n], this._isCompound && (this._removeFromParentsChildList(n), delete this._parent[n], m(this.children(n), function(i) {
r.setParent(i);
}), delete this._children[n]), m(T(this._in[n]), t), delete this._in[n], delete this._preds[n], m(T(this._out[n]), t), delete this._out[n], delete this._sucs[n], --this._nodeCount;
}
return this;
}
setParent(n, r) {
if (!this._isCompound)
throw new Error("Cannot set parent in a non-compound graph");
if (v(r))
r = w;
else {
r += "";
for (var t = r; !v(t); t = this.parent(t))
if (t === n)
throw new Error("Setting " + r + " as parent of " + n + " would create a cycle");
this.setNode(r);
}
return this.setNode(n), this._removeFromParentsChildList(n), this._parent[n] = r, this._children[r][n] = !0, this;
}
_removeFromParentsChildList(n) {
delete this._children[this._parent[n]][n];
}
parent(n) {
if (this._isCompound) {
var r = this._parent[n];
if (r !== w)
return r;
}
}
children(n) {
if (v(n) && (n = w), this._isCompound) {
var r = this._children[n];
if (r)
return T(r);
} else {
if (n === w)
return this.nodes();
if (this.hasNode(n))
return [];
}
}
predecessors(n) {
var r = this._preds[n];
if (r)
return T(r);
}
successors(n) {
var r = this._sucs[n];
if (r)
return T(r);
}
neighbors(n) {
var r = this.predecessors(n);
if (r)
return ei(r, this.successors(n));
}
isLeaf(n) {
var r;
return this.isDirected() ? r = this.successors(n) : r = this.neighbors(n), r.length === 0;
}
filterNodes(n) {
var r = new this.constructor({
directed: this._isDirected,
multigraph: this._isMultigraph,
compound: this._isCompound
});
r.setGraph(this.graph());
var t = this;
m(this._nodes, function(a, u) {
n(u) && r.setNode(u, a);
}), m(this._edgeObjs, function(a) {
r.hasNode(a.v) && r.hasNode(a.w) && r.setEdge(a, t.edge(a));
});
var i = {};
function s(a) {
var u = t.parent(a);
return u === void 0 || r.hasNode(u) ? (i[a] = u, u) : u in i ? i[u] : s(u);
}
return this._isCompound && m(r.nodes(), function(a) {
r.setParent(a, s(a));
}), r;
}
/* === Edge functions ========== */
setDefaultEdgeLabel(n) {
return te(n) || (n = M(n)), this._defaultEdgeLabelFn = n, this;
}
edgeCount() {
return this._edgeCount;
}
edges() {
return H(this._edgeObjs);
}
setPath(n, r) {
var t = this, i = arguments;
return Xt(n, function(s, a) {
return i.length > 1 ? t.setEdge(s, a, r) : t.setEdge(s, a), a;
}), this;
}
/*
* setEdge(v, w, [value, [name]])
* setEdge({ v, w, [name] }, [value])
*/
setEdge() {
var n, r, t, i, s = !1, a = arguments[0];
typeof a == "object" && a !== null && "v" in a ? (n = a.v, r = a.w, t = a.name, arguments.length === 2 && (i = arguments[1], s = !0)) : (n = a, r = arguments[1], t = arguments[3], arguments.length > 2 && (i = arguments[2], s = !0)), n = "" + n, r = "" + r, v(t) || (t = "" + t);
var u = P(this._isDirected, n, r, t);
if (E(this._edgeLabels, u))
return s && (this._edgeLabels[u] = i), this;
if (!v(t) && !this._isMultigraph)
throw new Error("Cannot set a named edge when isMultigraph = false");
this.setNode(n), this.setNode(r), this._edgeLabels[u] = s ? i : this._defaultEdgeLabelFn(n, r, t);
var f = ri(this._isDirected, n, r, t);
return n = f.v, r = f.w, Object.freeze(f), this._edgeObjs[u] = f, ye(this._preds[r], n), ye(this._sucs[n], r), this._in[r][u] = f, this._out[n][u] = f, this._edgeCount++, this;
}
edge(n, r, t) {
var i = arguments.length === 1 ? Y(this._isDirected, arguments[0]) : P(this._isDirected, n, r, t);
return this._edgeLabels[i];
}
hasEdge(n, r, t) {
var i = arguments.length === 1 ? Y(this._isDirected, arguments[0]) : P(this._isDirected, n, r, t);
return E(this._edgeLabels, i);
}
removeEdge(n, r, t) {
var i = arguments.length === 1 ? Y(this._isDirected, arguments[0]) : P(this._isDirected, n, r, t), s = this._edgeObjs[i];
return s && (n = s.v, r = s.w, delete this._edgeLabels[i], delete this._edgeObjs[i], Ae(this._preds[r], n), Ae(this._sucs[n], r), delete this._in[r][i], delete this._out[n][i], this._edgeCount--), this;
}
inEdges(n, r) {
var t = this._in[n];
if (t) {
var i = H(t);
return r ? D(i, function(s) {
return s.v === r;
}) : i;
}
}
outEdges(n, r) {
var t = this._out[n];
if (t) {
var i = H(t);
return r ? D(i, function(s) {
return s.w === r;
}) : i;
}
}
nodeEdges(n, r) {
var t = this.inEdges(n, r);
if (t)
return t.concat(this.outEdges(n, r));
}
}
Ze.prototype._nodeCount = 0;
Ze.prototype._edgeCount = 0;
function ye(e, n) {
e[n] ? e[n]++ : e[n] = 1;
}
function Ae(e, n) {
--e[n] || delete e[n];
}
function P(e, n, r, t) {
var i = "" + n, s = "" + r;
if (!e && i > s) {
var a = i;
i = s, s = a;
}
return i + be + s + be + (v(t) ? ni : t);
}
function ri(e, n, r, t) {
var i = "" + n, s = "" + r;
if (!e && i > s) {
var a = i;
i = s, s = a;
}
var u = { v: i, w: s };
return t && (u.name = t), u;
}
function Y(e, n) {
return P(e, n.v, n.w, n.name);
}
export {
Ze as G,
Q as a,
Se as b,
j as c,
Ye as d,
cn as e,
m as f,
ee as g,
E as h,
v as i,
ve as j,
T as k,
Bt as l,
Dt as m,
Ie as n,
Ce as o,
It as p,
Pn as q,
D as r,
Xt as s,
U as t,
H as v
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,622 @@
import { layout } from "dagre-d3-es/src/dagre/index.js";
import * as graphlibJson from "dagre-d3-es/src/graphlib/json.js";
import { c as createLabel, g as getSubGraphTitleMargins, i as intersectRect, a as insertMarkers, b as clear$2, d as clear$3, u as updateNodeBounds, s as setNodeElem, e as insertNode, f as insertEdgeLabel, p as positionNode, h as insertEdge, j as positionEdgeLabel } from "./edges-066a5561.js";
import { l as log, c as getConfig, m as evaluate } from "./mermaid-6dc72991.js";
import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
import { a as createText } from "./createText-ca0c5216.js";
import { select } from "d3";
let clusterDb = {};
let descendants = {};
let parents = {};
const clear$1 = () => {
descendants = {};
parents = {};
clusterDb = {};
};
const isDescendant = (id, ancestorId) => {
log.trace("In isDescendant", ancestorId, " ", id, " = ", descendants[ancestorId].includes(id));
if (descendants[ancestorId].includes(id)) {
return true;
}
return false;
};
const edgeInCluster = (edge, clusterId) => {
log.info("Descendants of ", clusterId, " is ", descendants[clusterId]);
log.info("Edge is ", edge);
if (edge.v === clusterId) {
return false;
}
if (edge.w === clusterId) {
return false;
}
if (!descendants[clusterId]) {
log.debug("Tilt, ", clusterId, ",not in descendants");
return false;
}
return descendants[clusterId].includes(edge.v) || isDescendant(edge.v, clusterId) || isDescendant(edge.w, clusterId) || descendants[clusterId].includes(edge.w);
};
const copy = (clusterId, graph, newGraph, rootId) => {
log.warn(
"Copying children of ",
clusterId,
"root",
rootId,
"data",
graph.node(clusterId),
rootId
);
const nodes = graph.children(clusterId) || [];
if (clusterId !== rootId) {
nodes.push(clusterId);
}
log.warn("Copying (nodes) clusterId", clusterId, "nodes", nodes);
nodes.forEach((node) => {
if (graph.children(node).length > 0) {
copy(node, graph, newGraph, rootId);
} else {
const data = graph.node(node);
log.info("cp ", node, " to ", rootId, " with parent ", clusterId);
newGraph.setNode(node, data);
if (rootId !== graph.parent(node)) {
log.warn("Setting parent", node, graph.parent(node));
newGraph.setParent(node, graph.parent(node));
}
if (clusterId !== rootId && node !== clusterId) {
log.debug("Setting parent", node, clusterId);
newGraph.setParent(node, clusterId);
} else {
log.info("In copy ", clusterId, "root", rootId, "data", graph.node(clusterId), rootId);
log.debug(
"Not Setting parent for node=",
node,
"cluster!==rootId",
clusterId !== rootId,
"node!==clusterId",
node !== clusterId
);
}
const edges = graph.edges(node);
log.debug("Copying Edges", edges);
edges.forEach((edge) => {
log.info("Edge", edge);
const data2 = graph.edge(edge.v, edge.w, edge.name);
log.info("Edge data", data2, rootId);
try {
if (edgeInCluster(edge, rootId)) {
log.info("Copying as ", edge.v, edge.w, data2, edge.name);
newGraph.setEdge(edge.v, edge.w, data2, edge.name);
log.info("newGraph edges ", newGraph.edges(), newGraph.edge(newGraph.edges()[0]));
} else {
log.info(
"Skipping copy of edge ",
edge.v,
"-->",
edge.w,
" rootId: ",
rootId,
" clusterId:",
clusterId
);
}
} catch (e) {
log.error(e);
}
});
}
log.debug("Removing node", node);
graph.removeNode(node);
});
};
const extractDescendants = (id, graph) => {
const children = graph.children(id);
let res = [...children];
for (const child of children) {
parents[child] = id;
res = [...res, ...extractDescendants(child, graph)];
}
return res;
};
const findNonClusterChild = (id, graph) => {
log.trace("Searching", id);
const children = graph.children(id);
log.trace("Searching children of id ", id, children);
if (children.length < 1) {
log.trace("This is a valid node", id);
return id;
}
for (const child of children) {
const _id = findNonClusterChild(child, graph);
if (_id) {
log.trace("Found replacement for", id, " => ", _id);
return _id;
}
}
};
const getAnchorId = (id) => {
if (!clusterDb[id]) {
return id;
}
if (!clusterDb[id].externalConnections) {
return id;
}
if (clusterDb[id]) {
return clusterDb[id].id;
}
return id;
};
const adjustClustersAndEdges = (graph, depth) => {
if (!graph || depth > 10) {
log.debug("Opting out, no graph ");
return;
} else {
log.debug("Opting in, graph ");
}
graph.nodes().forEach(function(id) {
const children = graph.children(id);
if (children.length > 0) {
log.warn(
"Cluster identified",
id,
" Replacement id in edges: ",
findNonClusterChild(id, graph)
);
descendants[id] = extractDescendants(id, graph);
clusterDb[id] = { id: findNonClusterChild(id, graph), clusterData: graph.node(id) };
}
});
graph.nodes().forEach(function(id) {
const children = graph.children(id);
const edges = graph.edges();
if (children.length > 0) {
log.debug("Cluster identified", id, descendants);
edges.forEach((edge) => {
if (edge.v !== id && edge.w !== id) {
const d1 = isDescendant(edge.v, id);
const d2 = isDescendant(edge.w, id);
if (d1 ^ d2) {
log.warn("Edge: ", edge, " leaves cluster ", id);
log.warn("Descendants of XXX ", id, ": ", descendants[id]);
clusterDb[id].externalConnections = true;
}
}
});
} else {
log.debug("Not a cluster ", id, descendants);
}
});
for (let id of Object.keys(clusterDb)) {
const nonClusterChild = clusterDb[id].id;
const parent = graph.parent(nonClusterChild);
if (parent !== id && clusterDb[parent] && !clusterDb[parent].externalConnections) {
clusterDb[id].id = parent;
}
}
graph.edges().forEach(function(e) {
const edge = graph.edge(e);
log.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
log.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph.edge(e)));
let v = e.v;
let w = e.w;
log.warn(
"Fix XXX",
clusterDb,
"ids:",
e.v,
e.w,
"Translating: ",
clusterDb[e.v],
" --- ",
clusterDb[e.w]
);
if (clusterDb[e.v] && clusterDb[e.w] && clusterDb[e.v] === clusterDb[e.w]) {
log.warn("Fixing and trixing link to self - removing XXX", e.v, e.w, e.name);
log.warn("Fixing and trixing - removing XXX", e.v, e.w, e.name);
v = getAnchorId(e.v);
w = getAnchorId(e.w);
graph.removeEdge(e.v, e.w, e.name);
const specialId = e.w + "---" + e.v;
graph.setNode(specialId, {
domId: specialId,
id: specialId,
labelStyle: "",
labelText: edge.label,
padding: 0,
shape: "labelRect",
style: ""
});
const edge1 = structuredClone(edge);
const edge2 = structuredClone(edge);
edge1.label = "";
edge1.arrowTypeEnd = "none";
edge2.label = "";
edge1.fromCluster = e.v;
edge2.toCluster = e.v;
graph.setEdge(v, specialId, edge1, e.name + "-cyclic-special");
graph.setEdge(specialId, w, edge2, e.name + "-cyclic-special");
} else if (clusterDb[e.v] || clusterDb[e.w]) {
log.warn("Fixing and trixing - removing XXX", e.v, e.w, e.name);
v = getAnchorId(e.v);
w = getAnchorId(e.w);
graph.removeEdge(e.v, e.w, e.name);
if (v !== e.v) {
const parent = graph.parent(v);
clusterDb[parent].externalConnections = true;
edge.fromCluster = e.v;
}
if (w !== e.w) {
const parent = graph.parent(w);
clusterDb[parent].externalConnections = true;
edge.toCluster = e.w;
}
log.warn("Fix Replacing with XXX", v, w, e.name);
graph.setEdge(v, w, edge, e.name);
}
});
log.warn("Adjusted Graph", graphlibJson.write(graph));
extractor(graph, 0);
log.trace(clusterDb);
};
const extractor = (graph, depth) => {
log.warn("extractor - ", depth, graphlibJson.write(graph), graph.children("D"));
if (depth > 10) {
log.error("Bailing out");
return;
}
let nodes = graph.nodes();
let hasChildren = false;
for (const node of nodes) {
const children = graph.children(node);
hasChildren = hasChildren || children.length > 0;
}
if (!hasChildren) {
log.debug("Done, no node has children", graph.nodes());
return;
}
log.debug("Nodes = ", nodes, depth);
for (const node of nodes) {
log.debug(
"Extracting node",
node,
clusterDb,
clusterDb[node] && !clusterDb[node].externalConnections,
!graph.parent(node),
graph.node(node),
graph.children("D"),
" Depth ",
depth
);
if (!clusterDb[node]) {
log.debug("Not a cluster", node, depth);
} else if (!clusterDb[node].externalConnections && // !graph.parent(node) &&
graph.children(node) && graph.children(node).length > 0) {
log.warn(
"Cluster without external connections, without a parent and with children",
node,
depth
);
const graphSettings = graph.graph();
let dir = graphSettings.rankdir === "TB" ? "LR" : "TB";
if (clusterDb[node] && clusterDb[node].clusterData && clusterDb[node].clusterData.dir) {
dir = clusterDb[node].clusterData.dir;
log.warn("Fixing dir", clusterDb[node].clusterData.dir, dir);
}
const clusterGraph = new graphlib.Graph({
multigraph: true,
compound: true
}).setGraph({
rankdir: dir,
// Todo: set proper spacing
nodesep: 50,
ranksep: 50,
marginx: 8,
marginy: 8
}).setDefaultEdgeLabel(function() {
return {};
});
log.warn("Old graph before copy", graphlibJson.write(graph));
copy(node, graph, clusterGraph, node);
graph.setNode(node, {
clusterNode: true,
id: node,
clusterData: clusterDb[node].clusterData,
labelText: clusterDb[node].labelText,
graph: clusterGraph
});
log.warn("New graph after copy node: (", node, ")", graphlibJson.write(clusterGraph));
log.debug("Old graph after copy", graphlibJson.write(graph));
} else {
log.warn(
"Cluster ** ",
node,
" **not meeting the criteria !externalConnections:",
!clusterDb[node].externalConnections,
" no parent: ",
!graph.parent(node),
" children ",
graph.children(node) && graph.children(node).length > 0,
graph.children("D"),
depth
);
log.debug(clusterDb);
}
}
nodes = graph.nodes();
log.warn("New list of nodes", nodes);
for (const node of nodes) {
const data = graph.node(node);
log.warn(" Now next level", node, data);
if (data.clusterNode) {
extractor(data.graph, depth + 1);
}
}
};
const sorter = (graph, nodes) => {
if (nodes.length === 0) {
return [];
}
let result = Object.assign(nodes);
nodes.forEach((node) => {
const children = graph.children(node);
const sorted = sorter(graph, children);
result = [...result, ...sorted];
});
return result;
};
const sortNodesByHierarchy = (graph) => sorter(graph, graph.children());
const rect = (parent, node) => {
log.info("Creating subgraph rect for ", node.id, node);
const siteConfig = getConfig();
const shapeSvg = parent.insert("g").attr("class", "cluster" + (node.class ? " " + node.class : "")).attr("id", node.id);
const rect2 = shapeSvg.insert("rect", ":first-child");
const useHtmlLabels = evaluate(siteConfig.flowchart.htmlLabels);
const label = shapeSvg.insert("g").attr("class", "cluster-label");
const text = node.labelType === "markdown" ? createText(label, node.labelText, { style: node.labelStyle, useHtmlLabels }) : label.node().appendChild(createLabel(node.labelText, node.labelStyle, void 0, true));
let bbox = text.getBBox();
if (evaluate(siteConfig.flowchart.htmlLabels)) {
const div = text.children[0];
const dv = select(text);
bbox = div.getBoundingClientRect();
dv.attr("width", bbox.width);
dv.attr("height", bbox.height);
}
const padding = 0 * node.padding;
const halfPadding = padding / 2;
const width = node.width <= bbox.width + padding ? bbox.width + padding : node.width;
if (node.width <= bbox.width + padding) {
node.diff = (bbox.width - node.width) / 2 - node.padding / 2;
} else {
node.diff = -node.padding / 2;
}
log.trace("Data ", node, JSON.stringify(node));
rect2.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("x", node.x - width / 2).attr("y", node.y - node.height / 2 - halfPadding).attr("width", width).attr("height", node.height + padding);
const { subGraphTitleTopMargin } = getSubGraphTitleMargins(siteConfig);
if (useHtmlLabels) {
label.attr(
"transform",
// This puts the label on top of the box instead of inside it
`translate(${node.x - bbox.width / 2}, ${node.y - node.height / 2 + subGraphTitleTopMargin})`
);
} else {
label.attr(
"transform",
// This puts the label on top of the box instead of inside it
`translate(${node.x}, ${node.y - node.height / 2 + subGraphTitleTopMargin})`
);
}
const rectBox = rect2.node().getBBox();
node.width = rectBox.width;
node.height = rectBox.height;
node.intersect = function(point) {
return intersectRect(node, point);
};
return shapeSvg;
};
const noteGroup = (parent, node) => {
const shapeSvg = parent.insert("g").attr("class", "note-cluster").attr("id", node.id);
const rect2 = shapeSvg.insert("rect", ":first-child");
const padding = 0 * node.padding;
const halfPadding = padding / 2;
rect2.attr("rx", node.rx).attr("ry", node.ry).attr("x", node.x - node.width / 2 - halfPadding).attr("y", node.y - node.height / 2 - halfPadding).attr("width", node.width + padding).attr("height", node.height + padding).attr("fill", "none");
const rectBox = rect2.node().getBBox();
node.width = rectBox.width;
node.height = rectBox.height;
node.intersect = function(point) {
return intersectRect(node, point);
};
return shapeSvg;
};
const roundedWithTitle = (parent, node) => {
const siteConfig = getConfig();
const shapeSvg = parent.insert("g").attr("class", node.classes).attr("id", node.id);
const rect2 = shapeSvg.insert("rect", ":first-child");
const label = shapeSvg.insert("g").attr("class", "cluster-label");
const innerRect = shapeSvg.append("rect");
const text = label.node().appendChild(createLabel(node.labelText, node.labelStyle, void 0, true));
let bbox = text.getBBox();
if (evaluate(siteConfig.flowchart.htmlLabels)) {
const div = text.children[0];
const dv = select(text);
bbox = div.getBoundingClientRect();
dv.attr("width", bbox.width);
dv.attr("height", bbox.height);
}
bbox = text.getBBox();
const padding = 0 * node.padding;
const halfPadding = padding / 2;
const width = node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width;
if (node.width <= bbox.width + node.padding) {
node.diff = (bbox.width + node.padding * 0 - node.width) / 2;
} else {
node.diff = -node.padding / 2;
}
rect2.attr("class", "outer").attr("x", node.x - width / 2 - halfPadding).attr("y", node.y - node.height / 2 - halfPadding).attr("width", width + padding).attr("height", node.height + padding);
innerRect.attr("class", "inner").attr("x", node.x - width / 2 - halfPadding).attr("y", node.y - node.height / 2 - halfPadding + bbox.height - 1).attr("width", width + padding).attr("height", node.height + padding - bbox.height - 3);
const { subGraphTitleTopMargin } = getSubGraphTitleMargins(siteConfig);
label.attr(
"transform",
`translate(${node.x - bbox.width / 2}, ${node.y - node.height / 2 - node.padding / 3 + (evaluate(siteConfig.flowchart.htmlLabels) ? 5 : 3) + subGraphTitleTopMargin})`
);
const rectBox = rect2.node().getBBox();
node.height = rectBox.height;
node.intersect = function(point) {
return intersectRect(node, point);
};
return shapeSvg;
};
const divider = (parent, node) => {
const shapeSvg = parent.insert("g").attr("class", node.classes).attr("id", node.id);
const rect2 = shapeSvg.insert("rect", ":first-child");
const padding = 0 * node.padding;
const halfPadding = padding / 2;
rect2.attr("class", "divider").attr("x", node.x - node.width / 2 - halfPadding).attr("y", node.y - node.height / 2).attr("width", node.width + padding).attr("height", node.height + padding);
const rectBox = rect2.node().getBBox();
node.width = rectBox.width;
node.height = rectBox.height;
node.diff = -node.padding / 2;
node.intersect = function(point) {
return intersectRect(node, point);
};
return shapeSvg;
};
const shapes = { rect, roundedWithTitle, noteGroup, divider };
let clusterElems = {};
const insertCluster = (elem, node) => {
log.trace("Inserting cluster");
const shape = node.shape || "rect";
clusterElems[node.id] = shapes[shape](elem, node);
};
const clear = () => {
clusterElems = {};
};
const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, siteConfig) => {
log.info("Graph in recursive render: XXX", graphlibJson.write(graph), parentCluster);
const dir = graph.graph().rankdir;
log.trace("Dir in recursive render - dir:", dir);
const elem = _elem.insert("g").attr("class", "root");
if (!graph.nodes()) {
log.info("No nodes found for", graph);
} else {
log.info("Recursive render XXX", graph.nodes());
}
if (graph.edges().length > 0) {
log.trace("Recursive edges", graph.edge(graph.edges()[0]));
}
const clusters = elem.insert("g").attr("class", "clusters");
const edgePaths = elem.insert("g").attr("class", "edgePaths");
const edgeLabels = elem.insert("g").attr("class", "edgeLabels");
const nodes = elem.insert("g").attr("class", "nodes");
await Promise.all(
graph.nodes().map(async function(v) {
const node = graph.node(v);
if (parentCluster !== void 0) {
const data = JSON.parse(JSON.stringify(parentCluster.clusterData));
log.info("Setting data for cluster XXX (", v, ") ", data, parentCluster);
graph.setNode(parentCluster.id, data);
if (!graph.parent(v)) {
log.trace("Setting parent", v, parentCluster.id);
graph.setParent(v, parentCluster.id, data);
}
}
log.info("(Insert) Node XXX" + v + ": " + JSON.stringify(graph.node(v)));
if (node && node.clusterNode) {
log.info("Cluster identified", v, node.width, graph.node(v));
const o = await recursiveRender(
nodes,
node.graph,
diagramType,
id,
graph.node(v),
siteConfig
);
const newEl = o.elem;
updateNodeBounds(node, newEl);
node.diff = o.diff || 0;
log.info("Node bounds (abc123)", v, node, node.width, node.x, node.y);
setNodeElem(newEl, node);
log.warn("Recursive render complete ", newEl, node);
} else {
if (graph.children(v).length > 0) {
log.info("Cluster - the non recursive path XXX", v, node.id, node, graph);
log.info(findNonClusterChild(node.id, graph));
clusterDb[node.id] = { id: findNonClusterChild(node.id, graph), node };
} else {
log.info("Node - the non recursive path", v, node.id, node);
await insertNode(nodes, graph.node(v), dir);
}
}
})
);
graph.edges().forEach(function(e) {
const edge = graph.edge(e.v, e.w, e.name);
log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
log.info("Edge " + e.v + " -> " + e.w + ": ", e, " ", JSON.stringify(graph.edge(e)));
log.info("Fix", clusterDb, "ids:", e.v, e.w, "Translating: ", clusterDb[e.v], clusterDb[e.w]);
insertEdgeLabel(edgeLabels, edge);
});
graph.edges().forEach(function(e) {
log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
});
log.info("#############################################");
log.info("### Layout ###");
log.info("#############################################");
log.info(graph);
layout(graph);
log.info("Graph after layout:", graphlibJson.write(graph));
let diff = 0;
const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
sortNodesByHierarchy(graph).forEach(function(v) {
const node = graph.node(v);
log.info("Position " + v + ": " + JSON.stringify(graph.node(v)));
log.info(
"Position " + v + ": (" + node.x,
"," + node.y,
") width: ",
node.width,
" height: ",
node.height
);
if (node && node.clusterNode) {
node.y += subGraphTitleTotalMargin;
positionNode(node);
} else {
if (graph.children(v).length > 0) {
node.height += subGraphTitleTotalMargin;
insertCluster(clusters, node);
clusterDb[node.id].node = node;
} else {
node.y += subGraphTitleTotalMargin / 2;
positionNode(node);
}
}
});
graph.edges().forEach(function(e) {
const edge = graph.edge(e);
log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(edge), edge);
edge.points.forEach((point) => point.y += subGraphTitleTotalMargin / 2);
const paths = insertEdge(edgePaths, e, edge, clusterDb, diagramType, graph, id);
positionEdgeLabel(edge, paths);
});
graph.nodes().forEach(function(v) {
const n = graph.node(v);
log.info(v, n.type, n.diff);
if (n.type === "group") {
diff = n.diff;
}
});
return { elem, diff };
};
const render = async (elem, graph, markers, diagramType, id) => {
insertMarkers(elem, markers, diagramType, id);
clear$2();
clear$3();
clear();
clear$1();
log.warn("Graph at first:", JSON.stringify(graphlibJson.write(graph)));
adjustClustersAndEdges(graph);
log.warn("Graph after:", JSON.stringify(graphlibJson.write(graph)));
const siteConfig = getConfig();
await recursiveRender(elem, graph, diagramType, id, void 0, siteConfig);
};
export {
render as r
};

View file

@ -0,0 +1,373 @@
import { i as N, G as A } from "./graph-0ee63739.js";
import { m as J, l as H } from "./layout-fd473db2.js";
import { c as V } from "./clone-afc2f047.js";
import { c as L, g as D, i as p, a as U, b as W, d as _, u as q, s as z, e as K, f as Q, p as O, h as Y, j as Z } from "./edges-16357fde.js";
import { l as s, c as T, p as S, j as R } from "./mermaid-9f2aa176.js";
import { a as I } from "./createText-03b82060.js";
function m(e) {
var t = {
options: {
directed: e.isDirected(),
multigraph: e.isMultigraph(),
compound: e.isCompound()
},
nodes: tt(e),
edges: et(e)
};
return N(e.graph()) || (t.value = V(e.graph())), t;
}
function tt(e) {
return J(e.nodes(), function(t) {
var n = e.node(t), r = e.parent(t), i = { v: t };
return N(n) || (i.value = n), N(r) || (i.parent = r), i;
});
}
function et(e) {
return J(e.edges(), function(t) {
var n = e.edge(t), r = { v: t.v, w: t.w };
return N(t.name) || (r.name = t.name), N(n) || (r.value = n), r;
});
}
let l = {}, g = {}, P = {};
const nt = () => {
g = {}, P = {}, l = {};
}, B = (e, t) => (s.trace("In isDescendant", t, " ", e, " = ", g[t].includes(e)), !!g[t].includes(e)), it = (e, t) => (s.info("Descendants of ", t, " is ", g[t]), s.info("Edge is ", e), e.v === t || e.w === t ? !1 : g[t] ? g[t].includes(e.v) || B(e.v, t) || B(e.w, t) || g[t].includes(e.w) : (s.debug("Tilt, ", t, ",not in descendants"), !1)), k = (e, t, n, r) => {
s.warn(
"Copying children of ",
e,
"root",
r,
"data",
t.node(e),
r
);
const i = t.children(e) || [];
e !== r && i.push(e), s.warn("Copying (nodes) clusterId", e, "nodes", i), i.forEach((a) => {
if (t.children(a).length > 0)
k(a, t, n, r);
else {
const d = t.node(a);
s.info("cp ", a, " to ", r, " with parent ", e), n.setNode(a, d), r !== t.parent(a) && (s.warn("Setting parent", a, t.parent(a)), n.setParent(a, t.parent(a))), e !== r && a !== e ? (s.debug("Setting parent", a, e), n.setParent(a, e)) : (s.info("In copy ", e, "root", r, "data", t.node(e), r), s.debug(
"Not Setting parent for node=",
a,
"cluster!==rootId",
e !== r,
"node!==clusterId",
a !== e
));
const u = t.edges(a);
s.debug("Copying Edges", u), u.forEach((f) => {
s.info("Edge", f);
const h = t.edge(f.v, f.w, f.name);
s.info("Edge data", h, r);
try {
it(f, r) ? (s.info("Copying as ", f.v, f.w, h, f.name), n.setEdge(f.v, f.w, h, f.name), s.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : s.info(
"Skipping copy of edge ",
f.v,
"-->",
f.w,
" rootId: ",
r,
" clusterId:",
e
);
} catch (w) {
s.error(w);
}
});
}
s.debug("Removing node", a), t.removeNode(a);
});
}, $ = (e, t) => {
const n = t.children(e);
let r = [...n];
for (const i of n)
P[i] = e, r = [...r, ...$(i, t)];
return r;
}, C = (e, t) => {
s.trace("Searching", e);
const n = t.children(e);
if (s.trace("Searching children of id ", e, n), n.length < 1)
return s.trace("This is a valid node", e), e;
for (const r of n) {
const i = C(r, t);
if (i)
return s.trace("Found replacement for", e, " => ", i), i;
}
}, X = (e) => !l[e] || !l[e].externalConnections ? e : l[e] ? l[e].id : e, st = (e, t) => {
if (!e || t > 10) {
s.debug("Opting out, no graph ");
return;
} else
s.debug("Opting in, graph ");
e.nodes().forEach(function(n) {
e.children(n).length > 0 && (s.warn(
"Cluster identified",
n,
" Replacement id in edges: ",
C(n, e)
), g[n] = $(n, e), l[n] = { id: C(n, e), clusterData: e.node(n) });
}), e.nodes().forEach(function(n) {
const r = e.children(n), i = e.edges();
r.length > 0 ? (s.debug("Cluster identified", n, g), i.forEach((a) => {
if (a.v !== n && a.w !== n) {
const d = B(a.v, n), u = B(a.w, n);
d ^ u && (s.warn("Edge: ", a, " leaves cluster ", n), s.warn("Descendants of XXX ", n, ": ", g[n]), l[n].externalConnections = !0);
}
})) : s.debug("Not a cluster ", n, g);
});
for (let n of Object.keys(l)) {
const r = l[n].id, i = e.parent(r);
i !== n && l[i] && !l[i].externalConnections && (l[n].id = i);
}
e.edges().forEach(function(n) {
const r = e.edge(n);
s.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), s.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n)));
let i = n.v, a = n.w;
if (s.warn(
"Fix XXX",
l,
"ids:",
n.v,
n.w,
"Translating: ",
l[n.v],
" --- ",
l[n.w]
), l[n.v] && l[n.w] && l[n.v] === l[n.w]) {
s.warn("Fixing and trixing link to self - removing XXX", n.v, n.w, n.name), s.warn("Fixing and trixing - removing XXX", n.v, n.w, n.name), i = X(n.v), a = X(n.w), e.removeEdge(n.v, n.w, n.name);
const d = n.w + "---" + n.v;
e.setNode(d, {
domId: d,
id: d,
labelStyle: "",
labelText: r.label,
padding: 0,
shape: "labelRect",
style: ""
});
const u = structuredClone(r), f = structuredClone(r);
u.label = "", u.arrowTypeEnd = "none", f.label = "", u.fromCluster = n.v, f.toCluster = n.v, e.setEdge(i, d, u, n.name + "-cyclic-special"), e.setEdge(d, a, f, n.name + "-cyclic-special");
} else if (l[n.v] || l[n.w]) {
if (s.warn("Fixing and trixing - removing XXX", n.v, n.w, n.name), i = X(n.v), a = X(n.w), e.removeEdge(n.v, n.w, n.name), i !== n.v) {
const d = e.parent(i);
l[d].externalConnections = !0, r.fromCluster = n.v;
}
if (a !== n.w) {
const d = e.parent(a);
l[d].externalConnections = !0, r.toCluster = n.w;
}
s.warn("Fix Replacing with XXX", i, a, n.name), e.setEdge(i, a, r, n.name);
}
}), s.warn("Adjusted Graph", m(e)), F(e, 0), s.trace(l);
}, F = (e, t) => {
if (s.warn("extractor - ", t, m(e), e.children("D")), t > 10) {
s.error("Bailing out");
return;
}
let n = e.nodes(), r = !1;
for (const i of n) {
const a = e.children(i);
r = r || a.length > 0;
}
if (!r) {
s.debug("Done, no node has children", e.nodes());
return;
}
s.debug("Nodes = ", n, t);
for (const i of n)
if (s.debug(
"Extracting node",
i,
l,
l[i] && !l[i].externalConnections,
!e.parent(i),
e.node(i),
e.children("D"),
" Depth ",
t
), !l[i])
s.debug("Not a cluster", i, t);
else if (!l[i].externalConnections && // !graph.parent(node) &&
e.children(i) && e.children(i).length > 0) {
s.warn(
"Cluster without external connections, without a parent and with children",
i,
t
);
let d = e.graph().rankdir === "TB" ? "LR" : "TB";
l[i] && l[i].clusterData && l[i].clusterData.dir && (d = l[i].clusterData.dir, s.warn("Fixing dir", l[i].clusterData.dir, d));
const u = new A({
multigraph: !0,
compound: !0
}).setGraph({
rankdir: d,
// Todo: set proper spacing
nodesep: 50,
ranksep: 50,
marginx: 8,
marginy: 8
}).setDefaultEdgeLabel(function() {
return {};
});
s.warn("Old graph before copy", m(e)), k(i, e, u, i), e.setNode(i, {
clusterNode: !0,
id: i,
clusterData: l[i].clusterData,
labelText: l[i].labelText,
graph: u
}), s.warn("New graph after copy node: (", i, ")", m(u)), s.debug("Old graph after copy", m(e));
} else
s.warn(
"Cluster ** ",
i,
" **not meeting the criteria !externalConnections:",
!l[i].externalConnections,
" no parent: ",
!e.parent(i),
" children ",
e.children(i) && e.children(i).length > 0,
e.children("D"),
t
), s.debug(l);
n = e.nodes(), s.warn("New list of nodes", n);
for (const i of n) {
const a = e.node(i);
s.warn(" Now next level", i, a), a.clusterNode && F(a.graph, t + 1);
}
}, G = (e, t) => {
if (t.length === 0)
return [];
let n = Object.assign(t);
return t.forEach((r) => {
const i = e.children(r), a = G(e, i);
n = [...n, ...a];
}), n;
}, rt = (e) => G(e, e.children()), at = (e, t) => {
s.info("Creating subgraph rect for ", t.id, t);
const n = T(), r = e.insert("g").attr("class", "cluster" + (t.class ? " " + t.class : "")).attr("id", t.id), i = r.insert("rect", ":first-child"), a = S(n.flowchart.htmlLabels), d = r.insert("g").attr("class", "cluster-label"), u = t.labelType === "markdown" ? I(d, t.labelText, { style: t.labelStyle, useHtmlLabels: a }) : d.node().appendChild(L(t.labelText, t.labelStyle, void 0, !0));
let f = u.getBBox();
if (S(n.flowchart.htmlLabels)) {
const c = u.children[0], o = R(u);
f = c.getBoundingClientRect(), o.attr("width", f.width), o.attr("height", f.height);
}
const h = 0 * t.padding, w = h / 2, x = t.width <= f.width + h ? f.width + h : t.width;
t.width <= f.width + h ? t.diff = (f.width - t.width) / 2 - t.padding / 2 : t.diff = -t.padding / 2, s.trace("Data ", t, JSON.stringify(t)), i.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", t.x - x / 2).attr("y", t.y - t.height / 2 - w).attr("width", x).attr("height", t.height + h);
const { subGraphTitleTopMargin: v } = D(n);
a ? d.attr(
"transform",
// This puts the label on top of the box instead of inside it
`translate(${t.x - f.width / 2}, ${t.y - t.height / 2 + v})`
) : d.attr(
"transform",
// This puts the label on top of the box instead of inside it
`translate(${t.x}, ${t.y - t.height / 2 + v})`
);
const y = i.node().getBBox();
return t.width = y.width, t.height = y.height, t.intersect = function(c) {
return p(t, c);
}, r;
}, ct = (e, t) => {
const n = e.insert("g").attr("class", "note-cluster").attr("id", t.id), r = n.insert("rect", ":first-child"), i = 0 * t.padding, a = i / 2;
r.attr("rx", t.rx).attr("ry", t.ry).attr("x", t.x - t.width / 2 - a).attr("y", t.y - t.height / 2 - a).attr("width", t.width + i).attr("height", t.height + i).attr("fill", "none");
const d = r.node().getBBox();
return t.width = d.width, t.height = d.height, t.intersect = function(u) {
return p(t, u);
}, n;
}, ot = (e, t) => {
const n = T(), r = e.insert("g").attr("class", t.classes).attr("id", t.id), i = r.insert("rect", ":first-child"), a = r.insert("g").attr("class", "cluster-label"), d = r.append("rect"), u = a.node().appendChild(L(t.labelText, t.labelStyle, void 0, !0));
let f = u.getBBox();
if (S(n.flowchart.htmlLabels)) {
const c = u.children[0], o = R(u);
f = c.getBoundingClientRect(), o.attr("width", f.width), o.attr("height", f.height);
}
f = u.getBBox();
const h = 0 * t.padding, w = h / 2, x = t.width <= f.width + t.padding ? f.width + t.padding : t.width;
t.width <= f.width + t.padding ? t.diff = (f.width + t.padding * 0 - t.width) / 2 : t.diff = -t.padding / 2, i.attr("class", "outer").attr("x", t.x - x / 2 - w).attr("y", t.y - t.height / 2 - w).attr("width", x + h).attr("height", t.height + h), d.attr("class", "inner").attr("x", t.x - x / 2 - w).attr("y", t.y - t.height / 2 - w + f.height - 1).attr("width", x + h).attr("height", t.height + h - f.height - 3);
const { subGraphTitleTopMargin: v } = D(n);
a.attr(
"transform",
`translate(${t.x - f.width / 2}, ${t.y - t.height / 2 - t.padding / 3 + (S(n.flowchart.htmlLabels) ? 5 : 3) + v})`
);
const y = i.node().getBBox();
return t.height = y.height, t.intersect = function(c) {
return p(t, c);
}, r;
}, lt = (e, t) => {
const n = e.insert("g").attr("class", t.classes).attr("id", t.id), r = n.insert("rect", ":first-child"), i = 0 * t.padding, a = i / 2;
r.attr("class", "divider").attr("x", t.x - t.width / 2 - a).attr("y", t.y - t.height / 2).attr("width", t.width + i).attr("height", t.height + i);
const d = r.node().getBBox();
return t.width = d.width, t.height = d.height, t.diff = -t.padding / 2, t.intersect = function(u) {
return p(t, u);
}, n;
}, ft = { rect: at, roundedWithTitle: ot, noteGroup: ct, divider: lt };
let j = {};
const dt = (e, t) => {
s.trace("Inserting cluster");
const n = t.shape || "rect";
j[t.id] = ft[n](e, t);
}, ut = () => {
j = {};
}, M = async (e, t, n, r, i, a) => {
s.info("Graph in recursive render: XXX", m(t), i);
const d = t.graph().rankdir;
s.trace("Dir in recursive render - dir:", d);
const u = e.insert("g").attr("class", "root");
t.nodes() ? s.info("Recursive render XXX", t.nodes()) : s.info("No nodes found for", t), t.edges().length > 0 && s.trace("Recursive edges", t.edge(t.edges()[0]));
const f = u.insert("g").attr("class", "clusters"), h = u.insert("g").attr("class", "edgePaths"), w = u.insert("g").attr("class", "edgeLabels"), x = u.insert("g").attr("class", "nodes");
await Promise.all(
t.nodes().map(async function(c) {
const o = t.node(c);
if (i !== void 0) {
const b = JSON.parse(JSON.stringify(i.clusterData));
s.info("Setting data for cluster XXX (", c, ") ", b, i), t.setNode(i.id, b), t.parent(c) || (s.trace("Setting parent", c, i.id), t.setParent(c, i.id, b));
}
if (s.info("(Insert) Node XXX" + c + ": " + JSON.stringify(t.node(c))), o && o.clusterNode) {
s.info("Cluster identified", c, o.width, t.node(c));
const b = await M(
x,
o.graph,
n,
r,
t.node(c),
a
), E = b.elem;
q(o, E), o.diff = b.diff || 0, s.info("Node bounds (abc123)", c, o, o.width, o.x, o.y), z(E, o), s.warn("Recursive render complete ", E, o);
} else
t.children(c).length > 0 ? (s.info("Cluster - the non recursive path XXX", c, o.id, o, t), s.info(C(o.id, t)), l[o.id] = { id: C(o.id, t), node: o }) : (s.info("Node - the non recursive path", c, o.id, o), await K(x, t.node(c), d));
})
), t.edges().forEach(function(c) {
const o = t.edge(c.v, c.w, c.name);
s.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(c)), s.info("Edge " + c.v + " -> " + c.w + ": ", c, " ", JSON.stringify(t.edge(c))), s.info("Fix", l, "ids:", c.v, c.w, "Translating: ", l[c.v], l[c.w]), Q(w, o);
}), t.edges().forEach(function(c) {
s.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(c));
}), s.info("#############################################"), s.info("### Layout ###"), s.info("#############################################"), s.info(t), H(t), s.info("Graph after layout:", m(t));
let v = 0;
const { subGraphTitleTotalMargin: y } = D(a);
return rt(t).forEach(function(c) {
const o = t.node(c);
s.info("Position " + c + ": " + JSON.stringify(t.node(c))), s.info(
"Position " + c + ": (" + o.x,
"," + o.y,
") width: ",
o.width,
" height: ",
o.height
), o && o.clusterNode ? (o.y += y, O(o)) : t.children(c).length > 0 ? (o.height += y, dt(f, o), l[o.id].node = o) : (o.y += y / 2, O(o));
}), t.edges().forEach(function(c) {
const o = t.edge(c);
s.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(o), o), o.points.forEach((E) => E.y += y / 2);
const b = Y(h, c, o, l, n, t, r);
Z(o, b);
}), t.nodes().forEach(function(c) {
const o = t.node(c);
s.info(c, o.type, o.diff), o.type === "group" && (v = o.diff);
}), { elem: u, diff: v };
}, bt = async (e, t, n, r, i) => {
U(e, n, r, i), W(), _(), ut(), nt(), s.warn("Graph at first:", JSON.stringify(m(t))), st(t), s.warn("Graph after:", JSON.stringify(m(t)));
const a = T();
await M(e, t, r, i, void 0, a);
};
export {
bt as r
};

View file

@ -0,0 +1,663 @@
import { i as isUndefined, G as Graph } from "./graph-fe24fab6.js";
import { m as map, l as layout } from "./layout-163b9689.js";
import { c as clone } from "./clone-9ea6bfeb.js";
import { c as createLabel, g as getSubGraphTitleMargins, i as intersectRect, a as insertMarkers, b as clear$2, d as clear$3, u as updateNodeBounds, s as setNodeElem, e as insertNode, f as insertEdgeLabel, p as positionNode, h as insertEdge, j as positionEdgeLabel } from "./edges-ce5cfb7c.js";
import { l as log, c as getConfig, p as evaluate, j as d3select } from "./mermaid-dcacb631.js";
import { a as createText } from "./createText-b70fe78a.js";
function write(g) {
var json = {
options: {
directed: g.isDirected(),
multigraph: g.isMultigraph(),
compound: g.isCompound()
},
nodes: writeNodes(g),
edges: writeEdges(g)
};
if (!isUndefined(g.graph())) {
json.value = clone(g.graph());
}
return json;
}
function writeNodes(g) {
return map(g.nodes(), function(v) {
var nodeValue = g.node(v);
var parent = g.parent(v);
var node = { v };
if (!isUndefined(nodeValue)) {
node.value = nodeValue;
}
if (!isUndefined(parent)) {
node.parent = parent;
}
return node;
});
}
function writeEdges(g) {
return map(g.edges(), function(e) {
var edgeValue = g.edge(e);
var edge = { v: e.v, w: e.w };
if (!isUndefined(e.name)) {
edge.name = e.name;
}
if (!isUndefined(edgeValue)) {
edge.value = edgeValue;
}
return edge;
});
}
let clusterDb = {};
let descendants = {};
let parents = {};
const clear$1 = () => {
descendants = {};
parents = {};
clusterDb = {};
};
const isDescendant = (id, ancestorId) => {
log.trace("In isDescendant", ancestorId, " ", id, " = ", descendants[ancestorId].includes(id));
if (descendants[ancestorId].includes(id)) {
return true;
}
return false;
};
const edgeInCluster = (edge, clusterId) => {
log.info("Descendants of ", clusterId, " is ", descendants[clusterId]);
log.info("Edge is ", edge);
if (edge.v === clusterId) {
return false;
}
if (edge.w === clusterId) {
return false;
}
if (!descendants[clusterId]) {
log.debug("Tilt, ", clusterId, ",not in descendants");
return false;
}
return descendants[clusterId].includes(edge.v) || isDescendant(edge.v, clusterId) || isDescendant(edge.w, clusterId) || descendants[clusterId].includes(edge.w);
};
const copy = (clusterId, graph, newGraph, rootId) => {
log.warn(
"Copying children of ",
clusterId,
"root",
rootId,
"data",
graph.node(clusterId),
rootId
);
const nodes = graph.children(clusterId) || [];
if (clusterId !== rootId) {
nodes.push(clusterId);
}
log.warn("Copying (nodes) clusterId", clusterId, "nodes", nodes);
nodes.forEach((node) => {
if (graph.children(node).length > 0) {
copy(node, graph, newGraph, rootId);
} else {
const data = graph.node(node);
log.info("cp ", node, " to ", rootId, " with parent ", clusterId);
newGraph.setNode(node, data);
if (rootId !== graph.parent(node)) {
log.warn("Setting parent", node, graph.parent(node));
newGraph.setParent(node, graph.parent(node));
}
if (clusterId !== rootId && node !== clusterId) {
log.debug("Setting parent", node, clusterId);
newGraph.setParent(node, clusterId);
} else {
log.info("In copy ", clusterId, "root", rootId, "data", graph.node(clusterId), rootId);
log.debug(
"Not Setting parent for node=",
node,
"cluster!==rootId",
clusterId !== rootId,
"node!==clusterId",
node !== clusterId
);
}
const edges = graph.edges(node);
log.debug("Copying Edges", edges);
edges.forEach((edge) => {
log.info("Edge", edge);
const data2 = graph.edge(edge.v, edge.w, edge.name);
log.info("Edge data", data2, rootId);
try {
if (edgeInCluster(edge, rootId)) {
log.info("Copying as ", edge.v, edge.w, data2, edge.name);
newGraph.setEdge(edge.v, edge.w, data2, edge.name);
log.info("newGraph edges ", newGraph.edges(), newGraph.edge(newGraph.edges()[0]));
} else {
log.info(
"Skipping copy of edge ",
edge.v,
"-->",
edge.w,
" rootId: ",
rootId,
" clusterId:",
clusterId
);
}
} catch (e) {
log.error(e);
}
});
}
log.debug("Removing node", node);
graph.removeNode(node);
});
};
const extractDescendants = (id, graph) => {
const children = graph.children(id);
let res = [...children];
for (const child of children) {
parents[child] = id;
res = [...res, ...extractDescendants(child, graph)];
}
return res;
};
const findNonClusterChild = (id, graph) => {
log.trace("Searching", id);
const children = graph.children(id);
log.trace("Searching children of id ", id, children);
if (children.length < 1) {
log.trace("This is a valid node", id);
return id;
}
for (const child of children) {
const _id = findNonClusterChild(child, graph);
if (_id) {
log.trace("Found replacement for", id, " => ", _id);
return _id;
}
}
};
const getAnchorId = (id) => {
if (!clusterDb[id]) {
return id;
}
if (!clusterDb[id].externalConnections) {
return id;
}
if (clusterDb[id]) {
return clusterDb[id].id;
}
return id;
};
const adjustClustersAndEdges = (graph, depth) => {
if (!graph || depth > 10) {
log.debug("Opting out, no graph ");
return;
} else {
log.debug("Opting in, graph ");
}
graph.nodes().forEach(function(id) {
const children = graph.children(id);
if (children.length > 0) {
log.warn(
"Cluster identified",
id,
" Replacement id in edges: ",
findNonClusterChild(id, graph)
);
descendants[id] = extractDescendants(id, graph);
clusterDb[id] = { id: findNonClusterChild(id, graph), clusterData: graph.node(id) };
}
});
graph.nodes().forEach(function(id) {
const children = graph.children(id);
const edges = graph.edges();
if (children.length > 0) {
log.debug("Cluster identified", id, descendants);
edges.forEach((edge) => {
if (edge.v !== id && edge.w !== id) {
const d1 = isDescendant(edge.v, id);
const d2 = isDescendant(edge.w, id);
if (d1 ^ d2) {
log.warn("Edge: ", edge, " leaves cluster ", id);
log.warn("Descendants of XXX ", id, ": ", descendants[id]);
clusterDb[id].externalConnections = true;
}
}
});
} else {
log.debug("Not a cluster ", id, descendants);
}
});
for (let id of Object.keys(clusterDb)) {
const nonClusterChild = clusterDb[id].id;
const parent = graph.parent(nonClusterChild);
if (parent !== id && clusterDb[parent] && !clusterDb[parent].externalConnections) {
clusterDb[id].id = parent;
}
}
graph.edges().forEach(function(e) {
const edge = graph.edge(e);
log.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
log.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph.edge(e)));
let v = e.v;
let w = e.w;
log.warn(
"Fix XXX",
clusterDb,
"ids:",
e.v,
e.w,
"Translating: ",
clusterDb[e.v],
" --- ",
clusterDb[e.w]
);
if (clusterDb[e.v] && clusterDb[e.w] && clusterDb[e.v] === clusterDb[e.w]) {
log.warn("Fixing and trixing link to self - removing XXX", e.v, e.w, e.name);
log.warn("Fixing and trixing - removing XXX", e.v, e.w, e.name);
v = getAnchorId(e.v);
w = getAnchorId(e.w);
graph.removeEdge(e.v, e.w, e.name);
const specialId = e.w + "---" + e.v;
graph.setNode(specialId, {
domId: specialId,
id: specialId,
labelStyle: "",
labelText: edge.label,
padding: 0,
shape: "labelRect",
style: ""
});
const edge1 = structuredClone(edge);
const edge2 = structuredClone(edge);
edge1.label = "";
edge1.arrowTypeEnd = "none";
edge2.label = "";
edge1.fromCluster = e.v;
edge2.toCluster = e.v;
graph.setEdge(v, specialId, edge1, e.name + "-cyclic-special");
graph.setEdge(specialId, w, edge2, e.name + "-cyclic-special");
} else if (clusterDb[e.v] || clusterDb[e.w]) {
log.warn("Fixing and trixing - removing XXX", e.v, e.w, e.name);
v = getAnchorId(e.v);
w = getAnchorId(e.w);
graph.removeEdge(e.v, e.w, e.name);
if (v !== e.v) {
const parent = graph.parent(v);
clusterDb[parent].externalConnections = true;
edge.fromCluster = e.v;
}
if (w !== e.w) {
const parent = graph.parent(w);
clusterDb[parent].externalConnections = true;
edge.toCluster = e.w;
}
log.warn("Fix Replacing with XXX", v, w, e.name);
graph.setEdge(v, w, edge, e.name);
}
});
log.warn("Adjusted Graph", write(graph));
extractor(graph, 0);
log.trace(clusterDb);
};
const extractor = (graph, depth) => {
log.warn("extractor - ", depth, write(graph), graph.children("D"));
if (depth > 10) {
log.error("Bailing out");
return;
}
let nodes = graph.nodes();
let hasChildren = false;
for (const node of nodes) {
const children = graph.children(node);
hasChildren = hasChildren || children.length > 0;
}
if (!hasChildren) {
log.debug("Done, no node has children", graph.nodes());
return;
}
log.debug("Nodes = ", nodes, depth);
for (const node of nodes) {
log.debug(
"Extracting node",
node,
clusterDb,
clusterDb[node] && !clusterDb[node].externalConnections,
!graph.parent(node),
graph.node(node),
graph.children("D"),
" Depth ",
depth
);
if (!clusterDb[node]) {
log.debug("Not a cluster", node, depth);
} else if (!clusterDb[node].externalConnections && // !graph.parent(node) &&
graph.children(node) && graph.children(node).length > 0) {
log.warn(
"Cluster without external connections, without a parent and with children",
node,
depth
);
const graphSettings = graph.graph();
let dir = graphSettings.rankdir === "TB" ? "LR" : "TB";
if (clusterDb[node] && clusterDb[node].clusterData && clusterDb[node].clusterData.dir) {
dir = clusterDb[node].clusterData.dir;
log.warn("Fixing dir", clusterDb[node].clusterData.dir, dir);
}
const clusterGraph = new Graph({
multigraph: true,
compound: true
}).setGraph({
rankdir: dir,
// Todo: set proper spacing
nodesep: 50,
ranksep: 50,
marginx: 8,
marginy: 8
}).setDefaultEdgeLabel(function() {
return {};
});
log.warn("Old graph before copy", write(graph));
copy(node, graph, clusterGraph, node);
graph.setNode(node, {
clusterNode: true,
id: node,
clusterData: clusterDb[node].clusterData,
labelText: clusterDb[node].labelText,
graph: clusterGraph
});
log.warn("New graph after copy node: (", node, ")", write(clusterGraph));
log.debug("Old graph after copy", write(graph));
} else {
log.warn(
"Cluster ** ",
node,
" **not meeting the criteria !externalConnections:",
!clusterDb[node].externalConnections,
" no parent: ",
!graph.parent(node),
" children ",
graph.children(node) && graph.children(node).length > 0,
graph.children("D"),
depth
);
log.debug(clusterDb);
}
}
nodes = graph.nodes();
log.warn("New list of nodes", nodes);
for (const node of nodes) {
const data = graph.node(node);
log.warn(" Now next level", node, data);
if (data.clusterNode) {
extractor(data.graph, depth + 1);
}
}
};
const sorter = (graph, nodes) => {
if (nodes.length === 0) {
return [];
}
let result = Object.assign(nodes);
nodes.forEach((node) => {
const children = graph.children(node);
const sorted = sorter(graph, children);
result = [...result, ...sorted];
});
return result;
};
const sortNodesByHierarchy = (graph) => sorter(graph, graph.children());
const rect = (parent, node) => {
log.info("Creating subgraph rect for ", node.id, node);
const siteConfig = getConfig();
const shapeSvg = parent.insert("g").attr("class", "cluster" + (node.class ? " " + node.class : "")).attr("id", node.id);
const rect2 = shapeSvg.insert("rect", ":first-child");
const useHtmlLabels = evaluate(siteConfig.flowchart.htmlLabels);
const label = shapeSvg.insert("g").attr("class", "cluster-label");
const text = node.labelType === "markdown" ? createText(label, node.labelText, { style: node.labelStyle, useHtmlLabels }) : label.node().appendChild(createLabel(node.labelText, node.labelStyle, void 0, true));
let bbox = text.getBBox();
if (evaluate(siteConfig.flowchart.htmlLabels)) {
const div = text.children[0];
const dv = d3select(text);
bbox = div.getBoundingClientRect();
dv.attr("width", bbox.width);
dv.attr("height", bbox.height);
}
const padding = 0 * node.padding;
const halfPadding = padding / 2;
const width = node.width <= bbox.width + padding ? bbox.width + padding : node.width;
if (node.width <= bbox.width + padding) {
node.diff = (bbox.width - node.width) / 2 - node.padding / 2;
} else {
node.diff = -node.padding / 2;
}
log.trace("Data ", node, JSON.stringify(node));
rect2.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("x", node.x - width / 2).attr("y", node.y - node.height / 2 - halfPadding).attr("width", width).attr("height", node.height + padding);
const { subGraphTitleTopMargin } = getSubGraphTitleMargins(siteConfig);
if (useHtmlLabels) {
label.attr(
"transform",
// This puts the label on top of the box instead of inside it
`translate(${node.x - bbox.width / 2}, ${node.y - node.height / 2 + subGraphTitleTopMargin})`
);
} else {
label.attr(
"transform",
// This puts the label on top of the box instead of inside it
`translate(${node.x}, ${node.y - node.height / 2 + subGraphTitleTopMargin})`
);
}
const rectBox = rect2.node().getBBox();
node.width = rectBox.width;
node.height = rectBox.height;
node.intersect = function(point) {
return intersectRect(node, point);
};
return shapeSvg;
};
const noteGroup = (parent, node) => {
const shapeSvg = parent.insert("g").attr("class", "note-cluster").attr("id", node.id);
const rect2 = shapeSvg.insert("rect", ":first-child");
const padding = 0 * node.padding;
const halfPadding = padding / 2;
rect2.attr("rx", node.rx).attr("ry", node.ry).attr("x", node.x - node.width / 2 - halfPadding).attr("y", node.y - node.height / 2 - halfPadding).attr("width", node.width + padding).attr("height", node.height + padding).attr("fill", "none");
const rectBox = rect2.node().getBBox();
node.width = rectBox.width;
node.height = rectBox.height;
node.intersect = function(point) {
return intersectRect(node, point);
};
return shapeSvg;
};
const roundedWithTitle = (parent, node) => {
const siteConfig = getConfig();
const shapeSvg = parent.insert("g").attr("class", node.classes).attr("id", node.id);
const rect2 = shapeSvg.insert("rect", ":first-child");
const label = shapeSvg.insert("g").attr("class", "cluster-label");
const innerRect = shapeSvg.append("rect");
const text = label.node().appendChild(createLabel(node.labelText, node.labelStyle, void 0, true));
let bbox = text.getBBox();
if (evaluate(siteConfig.flowchart.htmlLabels)) {
const div = text.children[0];
const dv = d3select(text);
bbox = div.getBoundingClientRect();
dv.attr("width", bbox.width);
dv.attr("height", bbox.height);
}
bbox = text.getBBox();
const padding = 0 * node.padding;
const halfPadding = padding / 2;
const width = node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width;
if (node.width <= bbox.width + node.padding) {
node.diff = (bbox.width + node.padding * 0 - node.width) / 2;
} else {
node.diff = -node.padding / 2;
}
rect2.attr("class", "outer").attr("x", node.x - width / 2 - halfPadding).attr("y", node.y - node.height / 2 - halfPadding).attr("width", width + padding).attr("height", node.height + padding);
innerRect.attr("class", "inner").attr("x", node.x - width / 2 - halfPadding).attr("y", node.y - node.height / 2 - halfPadding + bbox.height - 1).attr("width", width + padding).attr("height", node.height + padding - bbox.height - 3);
const { subGraphTitleTopMargin } = getSubGraphTitleMargins(siteConfig);
label.attr(
"transform",
`translate(${node.x - bbox.width / 2}, ${node.y - node.height / 2 - node.padding / 3 + (evaluate(siteConfig.flowchart.htmlLabels) ? 5 : 3) + subGraphTitleTopMargin})`
);
const rectBox = rect2.node().getBBox();
node.height = rectBox.height;
node.intersect = function(point) {
return intersectRect(node, point);
};
return shapeSvg;
};
const divider = (parent, node) => {
const shapeSvg = parent.insert("g").attr("class", node.classes).attr("id", node.id);
const rect2 = shapeSvg.insert("rect", ":first-child");
const padding = 0 * node.padding;
const halfPadding = padding / 2;
rect2.attr("class", "divider").attr("x", node.x - node.width / 2 - halfPadding).attr("y", node.y - node.height / 2).attr("width", node.width + padding).attr("height", node.height + padding);
const rectBox = rect2.node().getBBox();
node.width = rectBox.width;
node.height = rectBox.height;
node.diff = -node.padding / 2;
node.intersect = function(point) {
return intersectRect(node, point);
};
return shapeSvg;
};
const shapes = { rect, roundedWithTitle, noteGroup, divider };
let clusterElems = {};
const insertCluster = (elem, node) => {
log.trace("Inserting cluster");
const shape = node.shape || "rect";
clusterElems[node.id] = shapes[shape](elem, node);
};
const clear = () => {
clusterElems = {};
};
const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, siteConfig) => {
log.info("Graph in recursive render: XXX", write(graph), parentCluster);
const dir = graph.graph().rankdir;
log.trace("Dir in recursive render - dir:", dir);
const elem = _elem.insert("g").attr("class", "root");
if (!graph.nodes()) {
log.info("No nodes found for", graph);
} else {
log.info("Recursive render XXX", graph.nodes());
}
if (graph.edges().length > 0) {
log.trace("Recursive edges", graph.edge(graph.edges()[0]));
}
const clusters = elem.insert("g").attr("class", "clusters");
const edgePaths = elem.insert("g").attr("class", "edgePaths");
const edgeLabels = elem.insert("g").attr("class", "edgeLabels");
const nodes = elem.insert("g").attr("class", "nodes");
await Promise.all(
graph.nodes().map(async function(v) {
const node = graph.node(v);
if (parentCluster !== void 0) {
const data = JSON.parse(JSON.stringify(parentCluster.clusterData));
log.info("Setting data for cluster XXX (", v, ") ", data, parentCluster);
graph.setNode(parentCluster.id, data);
if (!graph.parent(v)) {
log.trace("Setting parent", v, parentCluster.id);
graph.setParent(v, parentCluster.id, data);
}
}
log.info("(Insert) Node XXX" + v + ": " + JSON.stringify(graph.node(v)));
if (node && node.clusterNode) {
log.info("Cluster identified", v, node.width, graph.node(v));
const o = await recursiveRender(
nodes,
node.graph,
diagramType,
id,
graph.node(v),
siteConfig
);
const newEl = o.elem;
updateNodeBounds(node, newEl);
node.diff = o.diff || 0;
log.info("Node bounds (abc123)", v, node, node.width, node.x, node.y);
setNodeElem(newEl, node);
log.warn("Recursive render complete ", newEl, node);
} else {
if (graph.children(v).length > 0) {
log.info("Cluster - the non recursive path XXX", v, node.id, node, graph);
log.info(findNonClusterChild(node.id, graph));
clusterDb[node.id] = { id: findNonClusterChild(node.id, graph), node };
} else {
log.info("Node - the non recursive path", v, node.id, node);
await insertNode(nodes, graph.node(v), dir);
}
}
})
);
graph.edges().forEach(function(e) {
const edge = graph.edge(e.v, e.w, e.name);
log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
log.info("Edge " + e.v + " -> " + e.w + ": ", e, " ", JSON.stringify(graph.edge(e)));
log.info("Fix", clusterDb, "ids:", e.v, e.w, "Translating: ", clusterDb[e.v], clusterDb[e.w]);
insertEdgeLabel(edgeLabels, edge);
});
graph.edges().forEach(function(e) {
log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
});
log.info("#############################################");
log.info("### Layout ###");
log.info("#############################################");
log.info(graph);
layout(graph);
log.info("Graph after layout:", write(graph));
let diff = 0;
const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
sortNodesByHierarchy(graph).forEach(function(v) {
const node = graph.node(v);
log.info("Position " + v + ": " + JSON.stringify(graph.node(v)));
log.info(
"Position " + v + ": (" + node.x,
"," + node.y,
") width: ",
node.width,
" height: ",
node.height
);
if (node && node.clusterNode) {
node.y += subGraphTitleTotalMargin;
positionNode(node);
} else {
if (graph.children(v).length > 0) {
node.height += subGraphTitleTotalMargin;
insertCluster(clusters, node);
clusterDb[node.id].node = node;
} else {
node.y += subGraphTitleTotalMargin / 2;
positionNode(node);
}
}
});
graph.edges().forEach(function(e) {
const edge = graph.edge(e);
log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(edge), edge);
edge.points.forEach((point) => point.y += subGraphTitleTotalMargin / 2);
const paths = insertEdge(edgePaths, e, edge, clusterDb, diagramType, graph, id);
positionEdgeLabel(edge, paths);
});
graph.nodes().forEach(function(v) {
const n = graph.node(v);
log.info(v, n.type, n.diff);
if (n.type === "group") {
diff = n.diff;
}
});
return { elem, diff };
};
const render = async (elem, graph, markers, diagramType, id) => {
insertMarkers(elem, markers, diagramType, id);
clear$2();
clear$3();
clear();
clear$1();
log.warn("Graph at first:", JSON.stringify(write(graph)));
adjustClustersAndEdges(graph);
log.warn("Graph after:", JSON.stringify(write(graph)));
const siteConfig = getConfig();
await recursiveRender(elem, graph, diagramType, id, void 0, siteConfig);
};
export {
render as r
};

View file

@ -0,0 +1,319 @@
import { l as Y, U as D, k as M } from "./mermaid-9f2aa176.js";
var O = function() {
var a = function(u, t, e, n) {
for (e = e || {}, n = u.length; n--; e[u[n]] = t)
;
return e;
}, f = [6, 9, 10], m = {
trace: function() {
},
yy: {},
symbols_: { error: 2, start: 3, info: 4, document: 5, EOF: 6, line: 7, statement: 8, NL: 9, showInfo: 10, $accept: 0, $end: 1 },
terminals_: { 2: "error", 4: "info", 6: "EOF", 9: "NL", 10: "showInfo" },
productions_: [0, [3, 3], [5, 0], [5, 2], [7, 1], [7, 1], [8, 1]],
performAction: function(t, e, n, s, r, i, d) {
switch (i.length - 1, r) {
case 1:
return s;
case 4:
break;
case 6:
s.setInfo(!0);
break;
}
},
table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, a(f, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: 6, 9: [1, 7], 10: [1, 8] }, { 1: [2, 1] }, a(f, [2, 3]), a(f, [2, 4]), a(f, [2, 5]), a(f, [2, 6])],
defaultActions: { 4: [2, 1] },
parseError: function(t, e) {
if (e.recoverable)
this.trace(t);
else {
var n = new Error(t);
throw n.hash = e, n;
}
},
parse: function(t) {
var e = this, n = [0], s = [], r = [null], i = [], d = this.table, $ = "", v = 0, L = 0, N = 2, T = 1, R = i.slice.call(arguments, 1), o = Object.create(this.lexer), p = { yy: {} };
for (var E in this.yy)
Object.prototype.hasOwnProperty.call(this.yy, E) && (p.yy[E] = this.yy[E]);
o.setInput(t, p.yy), p.yy.lexer = o, p.yy.parser = this, typeof o.yylloc > "u" && (o.yylloc = {});
var I = o.yylloc;
i.push(I);
var z = o.options && o.options.ranges;
typeof p.yy.parseError == "function" ? this.parseError = p.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
function U() {
var y;
return y = s.pop() || o.lex() || T, typeof y != "number" && (y instanceof Array && (s = y, y = s.pop()), y = e.symbols_[y] || y), y;
}
for (var l, g, h, w, _ = {}, b, c, F, S; ; ) {
if (g = n[n.length - 1], this.defaultActions[g] ? h = this.defaultActions[g] : ((l === null || typeof l > "u") && (l = U()), h = d[g] && d[g][l]), typeof h > "u" || !h.length || !h[0]) {
var A = "";
S = [];
for (b in d[g])
this.terminals_[b] && b > N && S.push("'" + this.terminals_[b] + "'");
o.showPosition ? A = "Parse error on line " + (v + 1) + `:
` + o.showPosition() + `
Expecting ` + S.join(", ") + ", got '" + (this.terminals_[l] || l) + "'" : A = "Parse error on line " + (v + 1) + ": Unexpected " + (l == T ? "end of input" : "'" + (this.terminals_[l] || l) + "'"), this.parseError(A, {
text: o.match,
token: this.terminals_[l] || l,
line: o.yylineno,
loc: I,
expected: S
});
}
if (h[0] instanceof Array && h.length > 1)
throw new Error("Parse Error: multiple actions possible at state: " + g + ", token: " + l);
switch (h[0]) {
case 1:
n.push(l), r.push(o.yytext), i.push(o.yylloc), n.push(h[1]), l = null, L = o.yyleng, $ = o.yytext, v = o.yylineno, I = o.yylloc;
break;
case 2:
if (c = this.productions_[h[1]][1], _.$ = r[r.length - c], _._$ = {
first_line: i[i.length - (c || 1)].first_line,
last_line: i[i.length - 1].last_line,
first_column: i[i.length - (c || 1)].first_column,
last_column: i[i.length - 1].last_column
}, z && (_._$.range = [
i[i.length - (c || 1)].range[0],
i[i.length - 1].range[1]
]), w = this.performAction.apply(_, [
$,
L,
v,
p.yy,
h[1],
r,
i
].concat(R)), typeof w < "u")
return w;
c && (n = n.slice(0, -1 * c * 2), r = r.slice(0, -1 * c), i = i.slice(0, -1 * c)), n.push(this.productions_[h[1]][0]), r.push(_.$), i.push(_._$), F = d[n[n.length - 2]][n[n.length - 1]], n.push(F);
break;
case 3:
return !0;
}
}
return !0;
}
}, k = function() {
var u = {
EOF: 1,
parseError: function(e, n) {
if (this.yy.parser)
this.yy.parser.parseError(e, n);
else
throw new Error(e);
},
// resets the lexer, sets new input
setInput: function(t, e) {
return this.yy = e || this.yy || {}, this._input = t, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
},
// consumes and returns one char from the input
input: function() {
var t = this._input[0];
this.yytext += t, this.yyleng++, this.offset++, this.match += t, this.matched += t;
var e = t.match(/(?:\r\n?|\n).*/g);
return e ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), t;
},
// unshifts one char (or a string) into the input
unput: function(t) {
var e = t.length, n = t.split(/(?:\r\n?|\n)/g);
this._input = t + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - e), this.offset -= e;
var s = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), n.length - 1 && (this.yylineno -= n.length - 1);
var r = this.yylloc.range;
return this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: n ? (n.length === s.length ? this.yylloc.first_column : 0) + s[s.length - n.length].length - n[0].length : this.yylloc.first_column - e
}, this.options.ranges && (this.yylloc.range = [r[0], r[0] + this.yyleng - e]), this.yyleng = this.yytext.length, this;
},
// When called from action, caches matched text and appends it on next action
more: function() {
return this._more = !0, this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject: function() {
if (this.options.backtrack_lexer)
this._backtrack = !0;
else
return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
return this;
},
// retain first n characters of the match
less: function(t) {
this.unput(this.match.slice(t));
},
// displays already matched input, i.e. for error messages
pastInput: function() {
var t = this.matched.substr(0, this.matched.length - this.match.length);
return (t.length > 20 ? "..." : "") + t.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput: function() {
var t = this.match;
return t.length < 20 && (t += this._input.substr(0, 20 - t.length)), (t.substr(0, 20) + (t.length > 20 ? "..." : "")).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition: function() {
var t = this.pastInput(), e = new Array(t.length + 1).join("-");
return t + this.upcomingInput() + `
` + e + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match: function(t, e) {
var n, s, r;
if (this.options.backtrack_lexer && (r = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
}, this.options.ranges && (r.yylloc.range = this.yylloc.range.slice(0))), s = t[0].match(/(?:\r\n?|\n).*/g), s && (this.yylineno += s.length), this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: s ? s[s.length - 1].length - s[s.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + t[0].length
}, this.yytext += t[0], this.match += t[0], this.matches = t, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(t[0].length), this.matched += t[0], n = this.performAction.call(this, this.yy, this, e, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), n)
return n;
if (this._backtrack) {
for (var i in r)
this[i] = r[i];
return !1;
}
return !1;
},
// return next match in input
next: function() {
if (this.done)
return this.EOF;
this._input || (this.done = !0);
var t, e, n, s;
this._more || (this.yytext = "", this.match = "");
for (var r = this._currentRules(), i = 0; i < r.length; i++)
if (n = this._input.match(this.rules[r[i]]), n && (!e || n[0].length > e[0].length)) {
if (e = n, s = i, this.options.backtrack_lexer) {
if (t = this.test_match(n, r[i]), t !== !1)
return t;
if (this._backtrack) {
e = !1;
continue;
} else
return !1;
} else if (!this.options.flex)
break;
}
return e ? (t = this.test_match(e, r[s]), t !== !1 ? t : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
},
// return next match that has a token
lex: function() {
var e = this.next();
return e || this.lex();
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin: function(e) {
this.conditionStack.push(e);
},
// pop the previously active lexer condition state off the condition stack
popState: function() {
var e = this.conditionStack.length - 1;
return e > 0 ? this.conditionStack.pop() : this.conditionStack[0];
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules: function() {
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState: function(e) {
return e = this.conditionStack.length - 1 - Math.abs(e || 0), e >= 0 ? this.conditionStack[e] : "INITIAL";
},
// alias for begin(condition)
pushState: function(e) {
this.begin(e);
},
// return the number of states currently on the stack
stateStackSize: function() {
return this.conditionStack.length;
},
options: { "case-insensitive": !0 },
performAction: function(e, n, s, r) {
switch (s) {
case 0:
return 4;
case 1:
return 9;
case 2:
return "space";
case 3:
return 10;
case 4:
return 6;
case 5:
return "TXT";
}
},
rules: [/^(?:info\b)/i, /^(?:[\s\n\r]+)/i, /^(?:[\s]+)/i, /^(?:showInfo\b)/i, /^(?:$)/i, /^(?:.)/i],
conditions: { INITIAL: { rules: [0, 1, 2, 3, 4, 5], inclusive: !0 } }
};
return u;
}();
m.lexer = k;
function x() {
this.yy = {};
}
return x.prototype = m, m.Parser = x, new x();
}();
O.parser = O;
const B = O, j = {
info: !1
};
let P = j.info;
const V = (a) => {
P = a;
}, X = () => P, q = () => {
P = j.info;
}, C = {
clear: q,
setInfo: V,
getInfo: X
}, G = (a, f, m) => {
Y.debug(`rendering info diagram
` + a);
const k = D(f);
M(k, 100, 400, !0), k.append("g").append("text").attr("x", 100).attr("y", 40).attr("class", "version").attr("font-size", 32).style("text-anchor", "middle").text(`v${m}`);
}, H = { draw: G }, K = {
parser: B,
db: C,
renderer: H
};
export {
K as diagram
};

View file

@ -0,0 +1,520 @@
import { l as log, A as selectSvgElement, i as configureSvgSize } from "./mermaid-6dc72991.js";
import "ts-dedent";
import "dayjs";
import "@braintree/sanitize-url";
import "d3";
import "dompurify";
import "khroma";
import "lodash-es/memoize.js";
import "lodash-es/merge.js";
import "stylis";
import "lodash-es/isEmpty.js";
var parser = function() {
var o = function(k, v, o2, l) {
for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
;
return o2;
}, $V0 = [6, 9, 10];
var parser2 = {
trace: function trace() {
},
yy: {},
symbols_: { "error": 2, "start": 3, "info": 4, "document": 5, "EOF": 6, "line": 7, "statement": 8, "NL": 9, "showInfo": 10, "$accept": 0, "$end": 1 },
terminals_: { 2: "error", 4: "info", 6: "EOF", 9: "NL", 10: "showInfo" },
productions_: [0, [3, 3], [5, 0], [5, 2], [7, 1], [7, 1], [8, 1]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
$$.length - 1;
switch (yystate) {
case 1:
return yy;
case 4:
break;
case 6:
yy.setInfo(true);
break;
}
},
table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: 6, 9: [1, 7], 10: [1, 8] }, { 1: [2, 1] }, o($V0, [2, 3]), o($V0, [2, 4]), o($V0, [2, 5]), o($V0, [2, 6])],
defaultActions: { 4: [2, 1] },
parseError: function parseError(str, hash) {
if (hash.recoverable) {
this.trace(str);
} else {
var error = new Error(str);
error.hash = hash;
throw error;
}
},
parse: function parse(input) {
var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
var args = lstack.slice.call(arguments, 1);
var lexer2 = Object.create(this.lexer);
var sharedState = { yy: {} };
for (var k in this.yy) {
if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
sharedState.yy[k] = this.yy[k];
}
}
lexer2.setInput(input, sharedState.yy);
sharedState.yy.lexer = lexer2;
sharedState.yy.parser = this;
if (typeof lexer2.yylloc == "undefined") {
lexer2.yylloc = {};
}
var yyloc = lexer2.yylloc;
lstack.push(yyloc);
var ranges = lexer2.options && lexer2.options.ranges;
if (typeof sharedState.yy.parseError === "function") {
this.parseError = sharedState.yy.parseError;
} else {
this.parseError = Object.getPrototypeOf(this).parseError;
}
function lex() {
var token;
token = tstack.pop() || lexer2.lex() || EOF;
if (typeof token !== "number") {
if (token instanceof Array) {
tstack = token;
token = tstack.pop();
}
token = self.symbols_[token] || token;
}
return token;
}
var symbol, state, action, r, yyval = {}, p, len, newState, expected;
while (true) {
state = stack[stack.length - 1];
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || typeof symbol == "undefined") {
symbol = lex();
}
action = table[state] && table[state][symbol];
}
if (typeof action === "undefined" || !action.length || !action[0]) {
var errStr = "";
expected = [];
for (p in table[state]) {
if (this.terminals_[p] && p > TERROR) {
expected.push("'" + this.terminals_[p] + "'");
}
}
if (lexer2.showPosition) {
errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
} else {
errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
}
this.parseError(errStr, {
text: lexer2.match,
token: this.terminals_[symbol] || symbol,
line: lexer2.yylineno,
loc: yyloc,
expected
});
}
if (action[0] instanceof Array && action.length > 1) {
throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
}
switch (action[0]) {
case 1:
stack.push(symbol);
vstack.push(lexer2.yytext);
lstack.push(lexer2.yylloc);
stack.push(action[1]);
symbol = null;
{
yyleng = lexer2.yyleng;
yytext = lexer2.yytext;
yylineno = lexer2.yylineno;
yyloc = lexer2.yylloc;
}
break;
case 2:
len = this.productions_[action[1]][1];
yyval.$ = vstack[vstack.length - len];
yyval._$ = {
first_line: lstack[lstack.length - (len || 1)].first_line,
last_line: lstack[lstack.length - 1].last_line,
first_column: lstack[lstack.length - (len || 1)].first_column,
last_column: lstack[lstack.length - 1].last_column
};
if (ranges) {
yyval._$.range = [
lstack[lstack.length - (len || 1)].range[0],
lstack[lstack.length - 1].range[1]
];
}
r = this.performAction.apply(yyval, [
yytext,
yyleng,
yylineno,
sharedState.yy,
action[1],
vstack,
lstack
].concat(args));
if (typeof r !== "undefined") {
return r;
}
if (len) {
stack = stack.slice(0, -1 * len * 2);
vstack = vstack.slice(0, -1 * len);
lstack = lstack.slice(0, -1 * len);
}
stack.push(this.productions_[action[1]][0]);
vstack.push(yyval.$);
lstack.push(yyval._$);
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
stack.push(newState);
break;
case 3:
return true;
}
}
return true;
}
};
var lexer = function() {
var lexer2 = {
EOF: 1,
parseError: function parseError(str, hash) {
if (this.yy.parser) {
this.yy.parser.parseError(str, hash);
} else {
throw new Error(str);
}
},
// resets the lexer, sets new input
setInput: function(input, yy) {
this.yy = yy || this.yy || {};
this._input = input;
this._more = this._backtrack = this.done = false;
this.yylineno = this.yyleng = 0;
this.yytext = this.matched = this.match = "";
this.conditionStack = ["INITIAL"];
this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
};
if (this.options.ranges) {
this.yylloc.range = [0, 0];
}
this.offset = 0;
return this;
},
// consumes and returns one char from the input
input: function() {
var ch = this._input[0];
this.yytext += ch;
this.yyleng++;
this.offset++;
this.match += ch;
this.matched += ch;
var lines = ch.match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno++;
this.yylloc.last_line++;
} else {
this.yylloc.last_column++;
}
if (this.options.ranges) {
this.yylloc.range[1]++;
}
this._input = this._input.slice(1);
return ch;
},
// unshifts one char (or a string) into the input
unput: function(ch) {
var len = ch.length;
var lines = ch.split(/(?:\r\n?|\n)/g);
this._input = ch + this._input;
this.yytext = this.yytext.substr(0, this.yytext.length - len);
this.offset -= len;
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1);
this.matched = this.matched.substr(0, this.matched.length - 1);
if (lines.length - 1) {
this.yylineno -= lines.length - 1;
}
var r = this.yylloc.range;
this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
};
if (this.options.ranges) {
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
}
this.yyleng = this.yytext.length;
return this;
},
// When called from action, caches matched text and appends it on next action
more: function() {
this._more = true;
return this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject: function() {
if (this.options.backtrack_lexer) {
this._backtrack = true;
} else {
return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
return this;
},
// retain first n characters of the match
less: function(n) {
this.unput(this.match.slice(n));
},
// displays already matched input, i.e. for error messages
pastInput: function() {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput: function() {
var next = this.match;
if (next.length < 20) {
next += this._input.substr(0, 20 - next.length);
}
return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition: function() {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match: function(match, indexed_rule) {
var token, lines, backup;
if (this.options.backtrack_lexer) {
backup = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
};
if (this.options.ranges) {
backup.yylloc.range = this.yylloc.range.slice(0);
}
}
lines = match[0].match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno += lines.length;
}
this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
};
this.yytext += match[0];
this.match += match[0];
this.matches = match;
this.yyleng = this.yytext.length;
if (this.options.ranges) {
this.yylloc.range = [this.offset, this.offset += this.yyleng];
}
this._more = false;
this._backtrack = false;
this._input = this._input.slice(match[0].length);
this.matched += match[0];
token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
if (this.done && this._input) {
this.done = false;
}
if (token) {
return token;
} else if (this._backtrack) {
for (var k in backup) {
this[k] = backup[k];
}
return false;
}
return false;
},
// return next match in input
next: function() {
if (this.done) {
return this.EOF;
}
if (!this._input) {
this.done = true;
}
var token, match, tempMatch, index;
if (!this._more) {
this.yytext = "";
this.match = "";
}
var rules = this._currentRules();
for (var i = 0; i < rules.length; i++) {
tempMatch = this._input.match(this.rules[rules[i]]);
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
match = tempMatch;
index = i;
if (this.options.backtrack_lexer) {
token = this.test_match(tempMatch, rules[i]);
if (token !== false) {
return token;
} else if (this._backtrack) {
match = false;
continue;
} else {
return false;
}
} else if (!this.options.flex) {
break;
}
}
}
if (match) {
token = this.test_match(match, rules[index]);
if (token !== false) {
return token;
}
return false;
}
if (this._input === "") {
return this.EOF;
} else {
return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
},
// return next match that has a token
lex: function lex() {
var r = this.next();
if (r) {
return r;
} else {
return this.lex();
}
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin: function begin(condition) {
this.conditionStack.push(condition);
},
// pop the previously active lexer condition state off the condition stack
popState: function popState() {
var n = this.conditionStack.length - 1;
if (n > 0) {
return this.conditionStack.pop();
} else {
return this.conditionStack[0];
}
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules: function _currentRules() {
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
} else {
return this.conditions["INITIAL"].rules;
}
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState: function topState(n) {
n = this.conditionStack.length - 1 - Math.abs(n || 0);
if (n >= 0) {
return this.conditionStack[n];
} else {
return "INITIAL";
}
},
// alias for begin(condition)
pushState: function pushState(condition) {
this.begin(condition);
},
// return the number of states currently on the stack
stateStackSize: function stateStackSize() {
return this.conditionStack.length;
},
options: { "case-insensitive": true },
performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
switch ($avoiding_name_collisions) {
case 0:
return 4;
case 1:
return 9;
case 2:
return "space";
case 3:
return 10;
case 4:
return 6;
case 5:
return "TXT";
}
},
rules: [/^(?:info\b)/i, /^(?:[\s\n\r]+)/i, /^(?:[\s]+)/i, /^(?:showInfo\b)/i, /^(?:$)/i, /^(?:.)/i],
conditions: { "INITIAL": { "rules": [0, 1, 2, 3, 4, 5], "inclusive": true } }
};
return lexer2;
}();
parser2.lexer = lexer;
function Parser() {
this.yy = {};
}
Parser.prototype = parser2;
parser2.Parser = Parser;
return new Parser();
}();
parser.parser = parser;
const parser$1 = parser;
const DEFAULT_INFO_DB = {
info: false
};
let info = DEFAULT_INFO_DB.info;
const setInfo = (toggle) => {
info = toggle;
};
const getInfo = () => info;
const clear = () => {
info = DEFAULT_INFO_DB.info;
};
const db = {
clear,
setInfo,
getInfo
};
const draw = (text, id, version) => {
log.debug("rendering info diagram\n" + text);
const svg = selectSvgElement(id);
configureSvgSize(svg, 100, 400, true);
const group = svg.append("g");
group.append("text").attr("x", 100).attr("y", 40).attr("class", "version").attr("font-size", 32).style("text-anchor", "middle").text(`v${version}`);
};
const renderer = { draw };
const diagram = {
parser: parser$1,
db,
renderer
};
export {
diagram
};

View file

@ -0,0 +1,510 @@
import { l as log, U as selectSvgElement, k as configureSvgSize } from "./mermaid-dcacb631.js";
var parser = function() {
var o = function(k, v, o2, l) {
for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
;
return o2;
}, $V0 = [6, 9, 10];
var parser2 = {
trace: function trace() {
},
yy: {},
symbols_: { "error": 2, "start": 3, "info": 4, "document": 5, "EOF": 6, "line": 7, "statement": 8, "NL": 9, "showInfo": 10, "$accept": 0, "$end": 1 },
terminals_: { 2: "error", 4: "info", 6: "EOF", 9: "NL", 10: "showInfo" },
productions_: [0, [3, 3], [5, 0], [5, 2], [7, 1], [7, 1], [8, 1]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
$$.length - 1;
switch (yystate) {
case 1:
return yy;
case 4:
break;
case 6:
yy.setInfo(true);
break;
}
},
table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: 6, 9: [1, 7], 10: [1, 8] }, { 1: [2, 1] }, o($V0, [2, 3]), o($V0, [2, 4]), o($V0, [2, 5]), o($V0, [2, 6])],
defaultActions: { 4: [2, 1] },
parseError: function parseError(str, hash) {
if (hash.recoverable) {
this.trace(str);
} else {
var error = new Error(str);
error.hash = hash;
throw error;
}
},
parse: function parse(input) {
var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
var args = lstack.slice.call(arguments, 1);
var lexer2 = Object.create(this.lexer);
var sharedState = { yy: {} };
for (var k in this.yy) {
if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
sharedState.yy[k] = this.yy[k];
}
}
lexer2.setInput(input, sharedState.yy);
sharedState.yy.lexer = lexer2;
sharedState.yy.parser = this;
if (typeof lexer2.yylloc == "undefined") {
lexer2.yylloc = {};
}
var yyloc = lexer2.yylloc;
lstack.push(yyloc);
var ranges = lexer2.options && lexer2.options.ranges;
if (typeof sharedState.yy.parseError === "function") {
this.parseError = sharedState.yy.parseError;
} else {
this.parseError = Object.getPrototypeOf(this).parseError;
}
function lex() {
var token;
token = tstack.pop() || lexer2.lex() || EOF;
if (typeof token !== "number") {
if (token instanceof Array) {
tstack = token;
token = tstack.pop();
}
token = self.symbols_[token] || token;
}
return token;
}
var symbol, state, action, r, yyval = {}, p, len, newState, expected;
while (true) {
state = stack[stack.length - 1];
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || typeof symbol == "undefined") {
symbol = lex();
}
action = table[state] && table[state][symbol];
}
if (typeof action === "undefined" || !action.length || !action[0]) {
var errStr = "";
expected = [];
for (p in table[state]) {
if (this.terminals_[p] && p > TERROR) {
expected.push("'" + this.terminals_[p] + "'");
}
}
if (lexer2.showPosition) {
errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
} else {
errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
}
this.parseError(errStr, {
text: lexer2.match,
token: this.terminals_[symbol] || symbol,
line: lexer2.yylineno,
loc: yyloc,
expected
});
}
if (action[0] instanceof Array && action.length > 1) {
throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
}
switch (action[0]) {
case 1:
stack.push(symbol);
vstack.push(lexer2.yytext);
lstack.push(lexer2.yylloc);
stack.push(action[1]);
symbol = null;
{
yyleng = lexer2.yyleng;
yytext = lexer2.yytext;
yylineno = lexer2.yylineno;
yyloc = lexer2.yylloc;
}
break;
case 2:
len = this.productions_[action[1]][1];
yyval.$ = vstack[vstack.length - len];
yyval._$ = {
first_line: lstack[lstack.length - (len || 1)].first_line,
last_line: lstack[lstack.length - 1].last_line,
first_column: lstack[lstack.length - (len || 1)].first_column,
last_column: lstack[lstack.length - 1].last_column
};
if (ranges) {
yyval._$.range = [
lstack[lstack.length - (len || 1)].range[0],
lstack[lstack.length - 1].range[1]
];
}
r = this.performAction.apply(yyval, [
yytext,
yyleng,
yylineno,
sharedState.yy,
action[1],
vstack,
lstack
].concat(args));
if (typeof r !== "undefined") {
return r;
}
if (len) {
stack = stack.slice(0, -1 * len * 2);
vstack = vstack.slice(0, -1 * len);
lstack = lstack.slice(0, -1 * len);
}
stack.push(this.productions_[action[1]][0]);
vstack.push(yyval.$);
lstack.push(yyval._$);
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
stack.push(newState);
break;
case 3:
return true;
}
}
return true;
}
};
var lexer = function() {
var lexer2 = {
EOF: 1,
parseError: function parseError(str, hash) {
if (this.yy.parser) {
this.yy.parser.parseError(str, hash);
} else {
throw new Error(str);
}
},
// resets the lexer, sets new input
setInput: function(input, yy) {
this.yy = yy || this.yy || {};
this._input = input;
this._more = this._backtrack = this.done = false;
this.yylineno = this.yyleng = 0;
this.yytext = this.matched = this.match = "";
this.conditionStack = ["INITIAL"];
this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
};
if (this.options.ranges) {
this.yylloc.range = [0, 0];
}
this.offset = 0;
return this;
},
// consumes and returns one char from the input
input: function() {
var ch = this._input[0];
this.yytext += ch;
this.yyleng++;
this.offset++;
this.match += ch;
this.matched += ch;
var lines = ch.match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno++;
this.yylloc.last_line++;
} else {
this.yylloc.last_column++;
}
if (this.options.ranges) {
this.yylloc.range[1]++;
}
this._input = this._input.slice(1);
return ch;
},
// unshifts one char (or a string) into the input
unput: function(ch) {
var len = ch.length;
var lines = ch.split(/(?:\r\n?|\n)/g);
this._input = ch + this._input;
this.yytext = this.yytext.substr(0, this.yytext.length - len);
this.offset -= len;
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1);
this.matched = this.matched.substr(0, this.matched.length - 1);
if (lines.length - 1) {
this.yylineno -= lines.length - 1;
}
var r = this.yylloc.range;
this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
};
if (this.options.ranges) {
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
}
this.yyleng = this.yytext.length;
return this;
},
// When called from action, caches matched text and appends it on next action
more: function() {
this._more = true;
return this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject: function() {
if (this.options.backtrack_lexer) {
this._backtrack = true;
} else {
return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
return this;
},
// retain first n characters of the match
less: function(n) {
this.unput(this.match.slice(n));
},
// displays already matched input, i.e. for error messages
pastInput: function() {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput: function() {
var next = this.match;
if (next.length < 20) {
next += this._input.substr(0, 20 - next.length);
}
return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition: function() {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match: function(match, indexed_rule) {
var token, lines, backup;
if (this.options.backtrack_lexer) {
backup = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
};
if (this.options.ranges) {
backup.yylloc.range = this.yylloc.range.slice(0);
}
}
lines = match[0].match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno += lines.length;
}
this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
};
this.yytext += match[0];
this.match += match[0];
this.matches = match;
this.yyleng = this.yytext.length;
if (this.options.ranges) {
this.yylloc.range = [this.offset, this.offset += this.yyleng];
}
this._more = false;
this._backtrack = false;
this._input = this._input.slice(match[0].length);
this.matched += match[0];
token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
if (this.done && this._input) {
this.done = false;
}
if (token) {
return token;
} else if (this._backtrack) {
for (var k in backup) {
this[k] = backup[k];
}
return false;
}
return false;
},
// return next match in input
next: function() {
if (this.done) {
return this.EOF;
}
if (!this._input) {
this.done = true;
}
var token, match, tempMatch, index;
if (!this._more) {
this.yytext = "";
this.match = "";
}
var rules = this._currentRules();
for (var i = 0; i < rules.length; i++) {
tempMatch = this._input.match(this.rules[rules[i]]);
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
match = tempMatch;
index = i;
if (this.options.backtrack_lexer) {
token = this.test_match(tempMatch, rules[i]);
if (token !== false) {
return token;
} else if (this._backtrack) {
match = false;
continue;
} else {
return false;
}
} else if (!this.options.flex) {
break;
}
}
}
if (match) {
token = this.test_match(match, rules[index]);
if (token !== false) {
return token;
}
return false;
}
if (this._input === "") {
return this.EOF;
} else {
return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
},
// return next match that has a token
lex: function lex() {
var r = this.next();
if (r) {
return r;
} else {
return this.lex();
}
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin: function begin(condition) {
this.conditionStack.push(condition);
},
// pop the previously active lexer condition state off the condition stack
popState: function popState() {
var n = this.conditionStack.length - 1;
if (n > 0) {
return this.conditionStack.pop();
} else {
return this.conditionStack[0];
}
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules: function _currentRules() {
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
} else {
return this.conditions["INITIAL"].rules;
}
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState: function topState(n) {
n = this.conditionStack.length - 1 - Math.abs(n || 0);
if (n >= 0) {
return this.conditionStack[n];
} else {
return "INITIAL";
}
},
// alias for begin(condition)
pushState: function pushState(condition) {
this.begin(condition);
},
// return the number of states currently on the stack
stateStackSize: function stateStackSize() {
return this.conditionStack.length;
},
options: { "case-insensitive": true },
performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
switch ($avoiding_name_collisions) {
case 0:
return 4;
case 1:
return 9;
case 2:
return "space";
case 3:
return 10;
case 4:
return 6;
case 5:
return "TXT";
}
},
rules: [/^(?:info\b)/i, /^(?:[\s\n\r]+)/i, /^(?:[\s]+)/i, /^(?:showInfo\b)/i, /^(?:$)/i, /^(?:.)/i],
conditions: { "INITIAL": { "rules": [0, 1, 2, 3, 4, 5], "inclusive": true } }
};
return lexer2;
}();
parser2.lexer = lexer;
function Parser() {
this.yy = {};
}
Parser.prototype = parser2;
parser2.Parser = Parser;
return new Parser();
}();
parser.parser = parser;
const parser$1 = parser;
const DEFAULT_INFO_DB = {
info: false
};
let info = DEFAULT_INFO_DB.info;
const setInfo = (toggle) => {
info = toggle;
};
const getInfo = () => info;
const clear = () => {
info = DEFAULT_INFO_DB.info;
};
const db = {
clear,
setInfo,
getInfo
};
const draw = (text, id, version) => {
log.debug("rendering info diagram\n" + text);
const svg = selectSvgElement(id);
configureSvgSize(svg, 100, 400, true);
const group = svg.append("g");
group.append("text").attr("x", 100).attr("y", 40).attr("class", "version").attr("font-size", 32).style("text-anchor", "middle").text(`v${version}`);
};
const renderer = { draw };
const diagram = {
parser: parser$1,
db,
renderer
};
export {
diagram
};

View file

@ -0,0 +1,804 @@
import { c as C, C as yt, D as dt, s as ft, g as pt, b as gt, a as mt, E as xt, j as W, k as kt } from "./mermaid-9f2aa176.js";
import { d as _t, f as bt, a as vt, g as it } from "./svgDrawCommon-ecc5f780.js";
import { d as Q } from "./arc-d1f6357e.js";
import "./path-428ebac9.js";
var G = function() {
var t = function(p, s, r, a) {
for (r = r || {}, a = p.length; a--; r[p[a]] = s)
;
return r;
}, e = [6, 8, 10, 11, 12, 14, 16, 17, 18], i = [1, 9], o = [1, 10], n = [1, 11], h = [1, 12], c = [1, 13], d = [1, 14], y = {
trace: function() {
},
yy: {},
symbols_: { error: 2, start: 3, journey: 4, document: 5, EOF: 6, line: 7, SPACE: 8, statement: 9, NEWLINE: 10, title: 11, acc_title: 12, acc_title_value: 13, acc_descr: 14, acc_descr_value: 15, acc_descr_multiline_value: 16, section: 17, taskName: 18, taskData: 19, $accept: 0, $end: 1 },
terminals_: { 2: "error", 4: "journey", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 11: "title", 12: "acc_title", 13: "acc_title_value", 14: "acc_descr", 15: "acc_descr_value", 16: "acc_descr_multiline_value", 17: "section", 18: "taskName", 19: "taskData" },
productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2]],
performAction: function(s, r, a, u, f, l, w) {
var k = l.length - 1;
switch (f) {
case 1:
return l[k - 1];
case 2:
this.$ = [];
break;
case 3:
l[k - 1].push(l[k]), this.$ = l[k - 1];
break;
case 4:
case 5:
this.$ = l[k];
break;
case 6:
case 7:
this.$ = [];
break;
case 8:
u.setDiagramTitle(l[k].substr(6)), this.$ = l[k].substr(6);
break;
case 9:
this.$ = l[k].trim(), u.setAccTitle(this.$);
break;
case 10:
case 11:
this.$ = l[k].trim(), u.setAccDescription(this.$);
break;
case 12:
u.addSection(l[k].substr(8)), this.$ = l[k].substr(8);
break;
case 13:
u.addTask(l[k - 1], l[k]), this.$ = "task";
break;
}
},
table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, t(e, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: i, 12: o, 14: n, 16: h, 17: c, 18: d }, t(e, [2, 7], { 1: [2, 1] }), t(e, [2, 3]), { 9: 15, 11: i, 12: o, 14: n, 16: h, 17: c, 18: d }, t(e, [2, 5]), t(e, [2, 6]), t(e, [2, 8]), { 13: [1, 16] }, { 15: [1, 17] }, t(e, [2, 11]), t(e, [2, 12]), { 19: [1, 18] }, t(e, [2, 4]), t(e, [2, 9]), t(e, [2, 10]), t(e, [2, 13])],
defaultActions: {},
parseError: function(s, r) {
if (r.recoverable)
this.trace(s);
else {
var a = new Error(s);
throw a.hash = r, a;
}
},
parse: function(s) {
var r = this, a = [0], u = [], f = [null], l = [], w = this.table, k = "", R = 0, Z = 0, ot = 2, J = 1, ct = l.slice.call(arguments, 1), x = Object.create(this.lexer), S = { yy: {} };
for (var z in this.yy)
Object.prototype.hasOwnProperty.call(this.yy, z) && (S.yy[z] = this.yy[z]);
x.setInput(s, S.yy), S.yy.lexer = x, S.yy.parser = this, typeof x.yylloc > "u" && (x.yylloc = {});
var Y = x.yylloc;
l.push(Y);
var ht = x.options && x.options.ranges;
typeof S.yy.parseError == "function" ? this.parseError = S.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
function ut() {
var $;
return $ = u.pop() || x.lex() || J, typeof $ != "number" && ($ instanceof Array && (u = $, $ = u.pop()), $ = r.symbols_[$] || $), $;
}
for (var _, E, b, O, I = {}, N, T, K, B; ; ) {
if (E = a[a.length - 1], this.defaultActions[E] ? b = this.defaultActions[E] : ((_ === null || typeof _ > "u") && (_ = ut()), b = w[E] && w[E][_]), typeof b > "u" || !b.length || !b[0]) {
var q = "";
B = [];
for (N in w[E])
this.terminals_[N] && N > ot && B.push("'" + this.terminals_[N] + "'");
x.showPosition ? q = "Parse error on line " + (R + 1) + `:
` + x.showPosition() + `
Expecting ` + B.join(", ") + ", got '" + (this.terminals_[_] || _) + "'" : q = "Parse error on line " + (R + 1) + ": Unexpected " + (_ == J ? "end of input" : "'" + (this.terminals_[_] || _) + "'"), this.parseError(q, {
text: x.match,
token: this.terminals_[_] || _,
line: x.yylineno,
loc: Y,
expected: B
});
}
if (b[0] instanceof Array && b.length > 1)
throw new Error("Parse Error: multiple actions possible at state: " + E + ", token: " + _);
switch (b[0]) {
case 1:
a.push(_), f.push(x.yytext), l.push(x.yylloc), a.push(b[1]), _ = null, Z = x.yyleng, k = x.yytext, R = x.yylineno, Y = x.yylloc;
break;
case 2:
if (T = this.productions_[b[1]][1], I.$ = f[f.length - T], I._$ = {
first_line: l[l.length - (T || 1)].first_line,
last_line: l[l.length - 1].last_line,
first_column: l[l.length - (T || 1)].first_column,
last_column: l[l.length - 1].last_column
}, ht && (I._$.range = [
l[l.length - (T || 1)].range[0],
l[l.length - 1].range[1]
]), O = this.performAction.apply(I, [
k,
Z,
R,
S.yy,
b[1],
f,
l
].concat(ct)), typeof O < "u")
return O;
T && (a = a.slice(0, -1 * T * 2), f = f.slice(0, -1 * T), l = l.slice(0, -1 * T)), a.push(this.productions_[b[1]][0]), f.push(I.$), l.push(I._$), K = w[a[a.length - 2]][a[a.length - 1]], a.push(K);
break;
case 3:
return !0;
}
}
return !0;
}
}, m = function() {
var p = {
EOF: 1,
parseError: function(r, a) {
if (this.yy.parser)
this.yy.parser.parseError(r, a);
else
throw new Error(r);
},
// resets the lexer, sets new input
setInput: function(s, r) {
return this.yy = r || this.yy || {}, this._input = s, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
},
// consumes and returns one char from the input
input: function() {
var s = this._input[0];
this.yytext += s, this.yyleng++, this.offset++, this.match += s, this.matched += s;
var r = s.match(/(?:\r\n?|\n).*/g);
return r ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), s;
},
// unshifts one char (or a string) into the input
unput: function(s) {
var r = s.length, a = s.split(/(?:\r\n?|\n)/g);
this._input = s + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - r), this.offset -= r;
var u = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), a.length - 1 && (this.yylineno -= a.length - 1);
var f = this.yylloc.range;
return this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: a ? (a.length === u.length ? this.yylloc.first_column : 0) + u[u.length - a.length].length - a[0].length : this.yylloc.first_column - r
}, this.options.ranges && (this.yylloc.range = [f[0], f[0] + this.yyleng - r]), this.yyleng = this.yytext.length, this;
},
// When called from action, caches matched text and appends it on next action
more: function() {
return this._more = !0, this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject: function() {
if (this.options.backtrack_lexer)
this._backtrack = !0;
else
return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
return this;
},
// retain first n characters of the match
less: function(s) {
this.unput(this.match.slice(s));
},
// displays already matched input, i.e. for error messages
pastInput: function() {
var s = this.matched.substr(0, this.matched.length - this.match.length);
return (s.length > 20 ? "..." : "") + s.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput: function() {
var s = this.match;
return s.length < 20 && (s += this._input.substr(0, 20 - s.length)), (s.substr(0, 20) + (s.length > 20 ? "..." : "")).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition: function() {
var s = this.pastInput(), r = new Array(s.length + 1).join("-");
return s + this.upcomingInput() + `
` + r + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match: function(s, r) {
var a, u, f;
if (this.options.backtrack_lexer && (f = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
}, this.options.ranges && (f.yylloc.range = this.yylloc.range.slice(0))), u = s[0].match(/(?:\r\n?|\n).*/g), u && (this.yylineno += u.length), this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: u ? u[u.length - 1].length - u[u.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + s[0].length
}, this.yytext += s[0], this.match += s[0], this.matches = s, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(s[0].length), this.matched += s[0], a = this.performAction.call(this, this.yy, this, r, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), a)
return a;
if (this._backtrack) {
for (var l in f)
this[l] = f[l];
return !1;
}
return !1;
},
// return next match in input
next: function() {
if (this.done)
return this.EOF;
this._input || (this.done = !0);
var s, r, a, u;
this._more || (this.yytext = "", this.match = "");
for (var f = this._currentRules(), l = 0; l < f.length; l++)
if (a = this._input.match(this.rules[f[l]]), a && (!r || a[0].length > r[0].length)) {
if (r = a, u = l, this.options.backtrack_lexer) {
if (s = this.test_match(a, f[l]), s !== !1)
return s;
if (this._backtrack) {
r = !1;
continue;
} else
return !1;
} else if (!this.options.flex)
break;
}
return r ? (s = this.test_match(r, f[u]), s !== !1 ? s : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
},
// return next match that has a token
lex: function() {
var r = this.next();
return r || this.lex();
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin: function(r) {
this.conditionStack.push(r);
},
// pop the previously active lexer condition state off the condition stack
popState: function() {
var r = this.conditionStack.length - 1;
return r > 0 ? this.conditionStack.pop() : this.conditionStack[0];
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules: function() {
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState: function(r) {
return r = this.conditionStack.length - 1 - Math.abs(r || 0), r >= 0 ? this.conditionStack[r] : "INITIAL";
},
// alias for begin(condition)
pushState: function(r) {
this.begin(r);
},
// return the number of states currently on the stack
stateStackSize: function() {
return this.conditionStack.length;
},
options: { "case-insensitive": !0 },
performAction: function(r, a, u, f) {
switch (u) {
case 0:
break;
case 1:
break;
case 2:
return 10;
case 3:
break;
case 4:
break;
case 5:
return 4;
case 6:
return 11;
case 7:
return this.begin("acc_title"), 12;
case 8:
return this.popState(), "acc_title_value";
case 9:
return this.begin("acc_descr"), 14;
case 10:
return this.popState(), "acc_descr_value";
case 11:
this.begin("acc_descr_multiline");
break;
case 12:
this.popState();
break;
case 13:
return "acc_descr_multiline_value";
case 14:
return 17;
case 15:
return 18;
case 16:
return 19;
case 17:
return ":";
case 18:
return 6;
case 19:
return "INVALID";
}
},
rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:journey\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?::[^#\n;]+)/i, /^(?::)/i, /^(?:$)/i, /^(?:.)/i],
conditions: { acc_descr_multiline: { rules: [12, 13], inclusive: !1 }, acc_descr: { rules: [10], inclusive: !1 }, acc_title: { rules: [8], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19], inclusive: !0 } }
};
return p;
}();
y.lexer = m;
function g() {
this.yy = {};
}
return g.prototype = y, y.Parser = g, new g();
}();
G.parser = G;
const wt = G;
let A = "";
const H = [], V = [], F = [], Tt = function() {
H.length = 0, V.length = 0, A = "", F.length = 0, xt();
}, $t = function(t) {
A = t, H.push(t);
}, Mt = function() {
return H;
}, St = function() {
let t = D();
const e = 100;
let i = 0;
for (; !t && i < e; )
t = D(), i++;
return V.push(...F), V;
}, Et = function() {
const t = [];
return V.forEach((i) => {
i.people && t.push(...i.people);
}), [...new Set(t)].sort();
}, Pt = function(t, e) {
const i = e.substr(1).split(":");
let o = 0, n = [];
i.length === 1 ? (o = Number(i[0]), n = []) : (o = Number(i[0]), n = i[1].split(","));
const h = n.map((d) => d.trim()), c = {
section: A,
type: A,
people: h,
task: t,
score: o
};
F.push(c);
}, Ct = function(t) {
const e = {
section: A,
type: A,
description: t,
task: t,
classes: []
};
V.push(e);
}, D = function() {
const t = function(i) {
return F[i].processed;
};
let e = !0;
for (const [i, o] of F.entries())
t(i), e = e && o.processed;
return e;
}, It = function() {
return Et();
}, tt = {
getConfig: () => C().journey,
clear: Tt,
setDiagramTitle: yt,
getDiagramTitle: dt,
setAccTitle: ft,
getAccTitle: pt,
setAccDescription: gt,
getAccDescription: mt,
addSection: $t,
getSections: Mt,
getTasks: St,
addTask: Pt,
addTaskOrg: Ct,
getActors: It
}, At = (t) => `.label {
font-family: 'trebuchet ms', verdana, arial, sans-serif;
font-family: var(--mermaid-font-family);
color: ${t.textColor};
}
.mouth {
stroke: #666;
}
line {
stroke: ${t.textColor}
}
.legend {
fill: ${t.textColor};
}
.label text {
fill: #333;
}
.label {
color: ${t.textColor}
}
.face {
${t.faceColor ? `fill: ${t.faceColor}` : "fill: #FFF8DC"};
stroke: #999;
}
.node rect,
.node circle,
.node ellipse,
.node polygon,
.node path {
fill: ${t.mainBkg};
stroke: ${t.nodeBorder};
stroke-width: 1px;
}
.node .label {
text-align: center;
}
.node.clickable {
cursor: pointer;
}
.arrowheadPath {
fill: ${t.arrowheadColor};
}
.edgePath .path {
stroke: ${t.lineColor};
stroke-width: 1.5px;
}
.flowchart-link {
stroke: ${t.lineColor};
fill: none;
}
.edgeLabel {
background-color: ${t.edgeLabelBackground};
rect {
opacity: 0.5;
}
text-align: center;
}
.cluster rect {
}
.cluster text {
fill: ${t.titleColor};
}
div.mermaidTooltip {
position: absolute;
text-align: center;
max-width: 200px;
padding: 2px;
font-family: 'trebuchet ms', verdana, arial, sans-serif;
font-family: var(--mermaid-font-family);
font-size: 12px;
background: ${t.tertiaryColor};
border: 1px solid ${t.border2};
border-radius: 2px;
pointer-events: none;
z-index: 100;
}
.task-type-0, .section-type-0 {
${t.fillType0 ? `fill: ${t.fillType0}` : ""};
}
.task-type-1, .section-type-1 {
${t.fillType0 ? `fill: ${t.fillType1}` : ""};
}
.task-type-2, .section-type-2 {
${t.fillType0 ? `fill: ${t.fillType2}` : ""};
}
.task-type-3, .section-type-3 {
${t.fillType0 ? `fill: ${t.fillType3}` : ""};
}
.task-type-4, .section-type-4 {
${t.fillType0 ? `fill: ${t.fillType4}` : ""};
}
.task-type-5, .section-type-5 {
${t.fillType0 ? `fill: ${t.fillType5}` : ""};
}
.task-type-6, .section-type-6 {
${t.fillType0 ? `fill: ${t.fillType6}` : ""};
}
.task-type-7, .section-type-7 {
${t.fillType0 ? `fill: ${t.fillType7}` : ""};
}
.actor-0 {
${t.actor0 ? `fill: ${t.actor0}` : ""};
}
.actor-1 {
${t.actor1 ? `fill: ${t.actor1}` : ""};
}
.actor-2 {
${t.actor2 ? `fill: ${t.actor2}` : ""};
}
.actor-3 {
${t.actor3 ? `fill: ${t.actor3}` : ""};
}
.actor-4 {
${t.actor4 ? `fill: ${t.actor4}` : ""};
}
.actor-5 {
${t.actor5 ? `fill: ${t.actor5}` : ""};
}
`, Vt = At, U = function(t, e) {
return _t(t, e);
}, Ft = function(t, e) {
const o = t.append("circle").attr("cx", e.cx).attr("cy", e.cy).attr("class", "face").attr("r", 15).attr("stroke-width", 2).attr("overflow", "visible"), n = t.append("g");
n.append("circle").attr("cx", e.cx - 15 / 3).attr("cy", e.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"), n.append("circle").attr("cx", e.cx + 15 / 3).attr("cy", e.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
function h(y) {
const m = Q().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(7.5).outerRadius(6.8181818181818175);
y.append("path").attr("class", "mouth").attr("d", m).attr("transform", "translate(" + e.cx + "," + (e.cy + 2) + ")");
}
function c(y) {
const m = Q().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(7.5).outerRadius(6.8181818181818175);
y.append("path").attr("class", "mouth").attr("d", m).attr("transform", "translate(" + e.cx + "," + (e.cy + 7) + ")");
}
function d(y) {
y.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", e.cx - 5).attr("y1", e.cy + 7).attr("x2", e.cx + 5).attr("y2", e.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
}
return e.score > 3 ? h(n) : e.score < 3 ? c(n) : d(n), o;
}, rt = function(t, e) {
const i = t.append("circle");
return i.attr("cx", e.cx), i.attr("cy", e.cy), i.attr("class", "actor-" + e.pos), i.attr("fill", e.fill), i.attr("stroke", e.stroke), i.attr("r", e.r), i.class !== void 0 && i.attr("class", i.class), e.title !== void 0 && i.append("title").text(e.title), i;
}, at = function(t, e) {
return bt(t, e);
}, Lt = function(t, e) {
function i(n, h, c, d, y) {
return n + "," + h + " " + (n + c) + "," + h + " " + (n + c) + "," + (h + d - y) + " " + (n + c - y * 1.2) + "," + (h + d) + " " + n + "," + (h + d);
}
const o = t.append("polygon");
o.attr("points", i(e.x, e.y, 50, 20, 7)), o.attr("class", "labelBox"), e.y = e.y + e.labelMargin, e.x = e.x + 0.5 * e.labelMargin, at(t, e);
}, Rt = function(t, e, i) {
const o = t.append("g"), n = it();
n.x = e.x, n.y = e.y, n.fill = e.fill, n.width = i.width * e.taskCount + // width of the tasks
i.diagramMarginX * (e.taskCount - 1), n.height = i.height, n.class = "journey-section section-type-" + e.num, n.rx = 3, n.ry = 3, U(o, n), lt(i)(
e.text,
o,
n.x,
n.y,
n.width,
n.height,
{ class: "journey-section section-type-" + e.num },
i,
e.colour
);
};
let et = -1;
const Nt = function(t, e, i) {
const o = e.x + i.width / 2, n = t.append("g");
et++;
const h = 300 + 5 * 30;
n.append("line").attr("id", "task" + et).attr("x1", o).attr("y1", e.y).attr("x2", o).attr("y2", h).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666"), Ft(n, {
cx: o,
cy: 300 + (5 - e.score) * 30,
score: e.score
});
const c = it();
c.x = e.x, c.y = e.y, c.fill = e.fill, c.width = i.width, c.height = i.height, c.class = "task task-type-" + e.num, c.rx = 3, c.ry = 3, U(n, c);
let d = e.x + 14;
e.people.forEach((y) => {
const m = e.actors[y].color, g = {
cx: d,
cy: e.y,
r: 7,
fill: m,
stroke: "#000",
title: y,
pos: e.actors[y].position
};
rt(n, g), d += 10;
}), lt(i)(
e.task,
n,
c.x,
c.y,
c.width,
c.height,
{ class: "task" },
i,
e.colour
);
}, Bt = function(t, e) {
vt(t, e);
}, lt = function() {
function t(n, h, c, d, y, m, g, p) {
const s = h.append("text").attr("x", c + y / 2).attr("y", d + m / 2 + 5).style("font-color", p).style("text-anchor", "middle").text(n);
o(s, g);
}
function e(n, h, c, d, y, m, g, p, s) {
const { taskFontSize: r, taskFontFamily: a } = p, u = n.split(/<br\s*\/?>/gi);
for (let f = 0; f < u.length; f++) {
const l = f * r - r * (u.length - 1) / 2, w = h.append("text").attr("x", c + y / 2).attr("y", d).attr("fill", s).style("text-anchor", "middle").style("font-size", r).style("font-family", a);
w.append("tspan").attr("x", c + y / 2).attr("dy", l).text(u[f]), w.attr("y", d + m / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), o(w, g);
}
}
function i(n, h, c, d, y, m, g, p) {
const s = h.append("switch"), a = s.append("foreignObject").attr("x", c).attr("y", d).attr("width", y).attr("height", m).attr("position", "fixed").append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
a.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(n), e(n, s, c, d, y, m, g, p), o(a, g);
}
function o(n, h) {
for (const c in h)
c in h && n.attr(c, h[c]);
}
return function(n) {
return n.textPlacement === "fo" ? i : n.textPlacement === "old" ? t : e;
};
}(), jt = function(t) {
t.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z");
}, L = {
drawRect: U,
drawCircle: rt,
drawSection: Rt,
drawText: at,
drawLabel: Lt,
drawTask: Nt,
drawBackgroundRect: Bt,
initGraphics: jt
}, zt = function(t) {
Object.keys(t).forEach(function(i) {
j[i] = t[i];
});
}, M = {};
function Yt(t) {
const e = C().journey;
let i = 60;
Object.keys(M).forEach((o) => {
const n = M[o].color, h = {
cx: 20,
cy: i,
r: 7,
fill: n,
stroke: "#000",
pos: M[o].position
};
L.drawCircle(t, h);
const c = {
x: 40,
y: i + 7,
fill: "#666",
text: o,
textMargin: e.boxTextMargin | 5
};
L.drawText(t, c), i += 20;
});
}
const j = C().journey, P = j.leftMargin, Ot = function(t, e, i, o) {
const n = C().journey, h = C().securityLevel;
let c;
h === "sandbox" && (c = W("#i" + e));
const d = h === "sandbox" ? W(c.nodes()[0].contentDocument.body) : W("body");
v.init();
const y = d.select("#" + e);
L.initGraphics(y);
const m = o.db.getTasks(), g = o.db.getDiagramTitle(), p = o.db.getActors();
for (const l in M)
delete M[l];
let s = 0;
p.forEach((l) => {
M[l] = {
color: n.actorColours[s % n.actorColours.length],
position: s
}, s++;
}), Yt(y), v.insert(0, 0, P, Object.keys(M).length * 50), qt(y, m, 0);
const r = v.getBounds();
g && y.append("text").text(g).attr("x", P).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 25);
const a = r.stopy - r.starty + 2 * n.diagramMarginY, u = P + r.stopx + 2 * n.diagramMarginX;
kt(y, a, u, n.useMaxWidth), y.append("line").attr("x1", P).attr("y1", n.height * 4).attr("x2", u - P - 4).attr("y2", n.height * 4).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)");
const f = g ? 70 : 0;
y.attr("viewBox", `${r.startx} -25 ${u} ${a + f}`), y.attr("preserveAspectRatio", "xMinYMin meet"), y.attr("height", a + f + 25);
}, v = {
data: {
startx: void 0,
stopx: void 0,
starty: void 0,
stopy: void 0
},
verticalPos: 0,
sequenceItems: [],
init: function() {
this.sequenceItems = [], this.data = {
startx: void 0,
stopx: void 0,
starty: void 0,
stopy: void 0
}, this.verticalPos = 0;
},
updateVal: function(t, e, i, o) {
t[e] === void 0 ? t[e] = i : t[e] = o(i, t[e]);
},
updateBounds: function(t, e, i, o) {
const n = C().journey, h = this;
let c = 0;
function d(y) {
return function(g) {
c++;
const p = h.sequenceItems.length - c + 1;
h.updateVal(g, "starty", e - p * n.boxMargin, Math.min), h.updateVal(g, "stopy", o + p * n.boxMargin, Math.max), h.updateVal(v.data, "startx", t - p * n.boxMargin, Math.min), h.updateVal(v.data, "stopx", i + p * n.boxMargin, Math.max), y !== "activation" && (h.updateVal(g, "startx", t - p * n.boxMargin, Math.min), h.updateVal(g, "stopx", i + p * n.boxMargin, Math.max), h.updateVal(v.data, "starty", e - p * n.boxMargin, Math.min), h.updateVal(v.data, "stopy", o + p * n.boxMargin, Math.max));
};
}
this.sequenceItems.forEach(d());
},
insert: function(t, e, i, o) {
const n = Math.min(t, i), h = Math.max(t, i), c = Math.min(e, o), d = Math.max(e, o);
this.updateVal(v.data, "startx", n, Math.min), this.updateVal(v.data, "starty", c, Math.min), this.updateVal(v.data, "stopx", h, Math.max), this.updateVal(v.data, "stopy", d, Math.max), this.updateBounds(n, c, h, d);
},
bumpVerticalPos: function(t) {
this.verticalPos = this.verticalPos + t, this.data.stopy = this.verticalPos;
},
getVerticalPos: function() {
return this.verticalPos;
},
getBounds: function() {
return this.data;
}
}, X = j.sectionFills, st = j.sectionColours, qt = function(t, e, i) {
const o = C().journey;
let n = "";
const h = o.height * 2 + o.diagramMarginY, c = i + h;
let d = 0, y = "#CCC", m = "black", g = 0;
for (const [p, s] of e.entries()) {
if (n !== s.section) {
y = X[d % X.length], g = d % X.length, m = st[d % st.length];
let a = 0;
const u = s.section;
for (let l = p; l < e.length && e[l].section == u; l++)
a = a + 1;
const f = {
x: p * o.taskMargin + p * o.width + P,
y: 50,
text: s.section,
fill: y,
num: g,
colour: m,
taskCount: a
};
L.drawSection(t, f, o), n = s.section, d++;
}
const r = s.people.reduce((a, u) => (M[u] && (a[u] = M[u]), a), {});
s.x = p * o.taskMargin + p * o.width + P, s.y = c, s.width = o.diagramMarginX, s.height = o.diagramMarginY, s.colour = m, s.fill = y, s.num = g, s.actors = r, L.drawTask(t, s, o), v.insert(s.x, s.y, s.x + s.width + o.taskMargin, 300 + 5 * 30);
}
}, nt = {
setConf: zt,
draw: Ot
}, Ut = {
parser: wt,
db: tt,
renderer: nt,
styles: Vt,
init: (t) => {
nt.setConf(t.journey), tt.clear();
}
};
export {
Ut as diagram
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,34 @@
import { a as h } from "./array-2ff2c7a6.js";
import { w as d, c as o } from "./path-428ebac9.js";
import { n as v } from "./mermaid-9f2aa176.js";
function w(t) {
return t[0];
}
function b(t) {
return t[1];
}
function P(t, u) {
var s = o(!0), i = null, l = v, r = null, m = d(e);
t = typeof t == "function" ? t : t === void 0 ? w : o(t), u = typeof u == "function" ? u : u === void 0 ? b : o(u);
function e(n) {
var f, g = (n = h(n)).length, p, c = !1, a;
for (i == null && (r = l(a = m())), f = 0; f <= g; ++f)
!(f < g && s(p = n[f], f, n)) === c && ((c = !c) ? r.lineStart() : r.lineEnd()), c && r.point(+t(p, f, n), +u(p, f, n));
if (a)
return r = null, a + "" || null;
}
return e.x = function(n) {
return arguments.length ? (t = typeof n == "function" ? n : o(+n), e) : t;
}, e.y = function(n) {
return arguments.length ? (u = typeof n == "function" ? n : o(+n), e) : u;
}, e.defined = function(n) {
return arguments.length ? (s = typeof n == "function" ? n : o(!!n), e) : s;
}, e.curve = function(n) {
return arguments.length ? (l = n, i != null && (r = l(i)), e) : l;
}, e.context = function(n) {
return arguments.length ? (n == null ? i = r = null : r = l(i = n), e) : i;
}, e;
}
export {
P as l
};

View file

@ -0,0 +1,50 @@
import { a as array } from "./array-b7dcf730.js";
import { w as withPath, c as constant } from "./path-39bad7e2.js";
import { n as curveLinear } from "./mermaid-dcacb631.js";
function x(p) {
return p[0];
}
function y(p) {
return p[1];
}
function line(x$1, y$1) {
var defined = constant(true), context = null, curve = curveLinear, output = null, path = withPath(line2);
x$1 = typeof x$1 === "function" ? x$1 : x$1 === void 0 ? x : constant(x$1);
y$1 = typeof y$1 === "function" ? y$1 : y$1 === void 0 ? y : constant(y$1);
function line2(data) {
var i, n = (data = array(data)).length, d, defined0 = false, buffer;
if (context == null)
output = curve(buffer = path());
for (i = 0; i <= n; ++i) {
if (!(i < n && defined(d = data[i], i, data)) === defined0) {
if (defined0 = !defined0)
output.lineStart();
else
output.lineEnd();
}
if (defined0)
output.point(+x$1(d, i, data), +y$1(d, i, data));
}
if (buffer)
return output = null, buffer + "" || null;
}
line2.x = function(_) {
return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant(+_), line2) : x$1;
};
line2.y = function(_) {
return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant(+_), line2) : y$1;
};
line2.defined = function(_) {
return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line2) : defined;
};
line2.curve = function(_) {
return arguments.length ? (curve = _, context != null && (output = curve(context)), line2) : curve;
};
line2.context = function(_) {
return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line2) : context;
};
return line2;
}
export {
line as l
};

View file

@ -0,0 +1,595 @@
import { $ as constant, a0 as interpolateNumber, a1 as color, a2 as interpolateRgb, a3 as interpolateString } from "./mermaid-dcacb631.js";
import { i as initRange } from "./init-cc95ec8e.js";
function ascending(a, b) {
return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
function descending(a, b) {
return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
}
function bisector(f) {
let compare1, compare2, delta;
if (f.length !== 2) {
compare1 = ascending;
compare2 = (d, x) => ascending(f(d), x);
delta = (d, x) => f(d) - x;
} else {
compare1 = f === ascending || f === descending ? f : zero;
compare2 = f;
delta = f;
}
function left(a, x, lo = 0, hi = a.length) {
if (lo < hi) {
if (compare1(x, x) !== 0)
return hi;
do {
const mid = lo + hi >>> 1;
if (compare2(a[mid], x) < 0)
lo = mid + 1;
else
hi = mid;
} while (lo < hi);
}
return lo;
}
function right(a, x, lo = 0, hi = a.length) {
if (lo < hi) {
if (compare1(x, x) !== 0)
return hi;
do {
const mid = lo + hi >>> 1;
if (compare2(a[mid], x) <= 0)
lo = mid + 1;
else
hi = mid;
} while (lo < hi);
}
return lo;
}
function center(a, x, lo = 0, hi = a.length) {
const i = left(a, x, lo, hi - 1);
return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
}
return { left, center, right };
}
function zero() {
return 0;
}
function number$1(x) {
return x === null ? NaN : +x;
}
const ascendingBisect = bisector(ascending);
const bisectRight = ascendingBisect.right;
bisector(number$1).center;
const bisect = bisectRight;
const e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2);
function tickSpec(start, stop, count) {
const step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log10(step)), error = step / Math.pow(10, power), factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;
let i1, i2, inc;
if (power < 0) {
inc = Math.pow(10, -power) / factor;
i1 = Math.round(start * inc);
i2 = Math.round(stop * inc);
if (i1 / inc < start)
++i1;
if (i2 / inc > stop)
--i2;
inc = -inc;
} else {
inc = Math.pow(10, power) * factor;
i1 = Math.round(start / inc);
i2 = Math.round(stop / inc);
if (i1 * inc < start)
++i1;
if (i2 * inc > stop)
--i2;
}
if (i2 < i1 && 0.5 <= count && count < 2)
return tickSpec(start, stop, count * 2);
return [i1, i2, inc];
}
function ticks(start, stop, count) {
stop = +stop, start = +start, count = +count;
if (!(count > 0))
return [];
if (start === stop)
return [start];
const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);
if (!(i2 >= i1))
return [];
const n = i2 - i1 + 1, ticks2 = new Array(n);
if (reverse) {
if (inc < 0)
for (let i = 0; i < n; ++i)
ticks2[i] = (i2 - i) / -inc;
else
for (let i = 0; i < n; ++i)
ticks2[i] = (i2 - i) * inc;
} else {
if (inc < 0)
for (let i = 0; i < n; ++i)
ticks2[i] = (i1 + i) / -inc;
else
for (let i = 0; i < n; ++i)
ticks2[i] = (i1 + i) * inc;
}
return ticks2;
}
function tickIncrement(start, stop, count) {
stop = +stop, start = +start, count = +count;
return tickSpec(start, stop, count)[2];
}
function tickStep(start, stop, count) {
stop = +stop, start = +start, count = +count;
const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);
return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
}
function numberArray(a, b) {
if (!b)
b = [];
var n = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i;
return function(t) {
for (i = 0; i < n; ++i)
c[i] = a[i] * (1 - t) + b[i] * t;
return c;
};
}
function isNumberArray(x) {
return ArrayBuffer.isView(x) && !(x instanceof DataView);
}
function genericArray(a, b) {
var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i;
for (i = 0; i < na; ++i)
x[i] = interpolate(a[i], b[i]);
for (; i < nb; ++i)
c[i] = b[i];
return function(t) {
for (i = 0; i < na; ++i)
c[i] = x[i](t);
return c;
};
}
function date(a, b) {
var d = /* @__PURE__ */ new Date();
return a = +a, b = +b, function(t) {
return d.setTime(a * (1 - t) + b * t), d;
};
}
function object(a, b) {
var i = {}, c = {}, k;
if (a === null || typeof a !== "object")
a = {};
if (b === null || typeof b !== "object")
b = {};
for (k in b) {
if (k in a) {
i[k] = interpolate(a[k], b[k]);
} else {
c[k] = b[k];
}
}
return function(t) {
for (k in i)
c[k] = i[k](t);
return c;
};
}
function interpolate(a, b) {
var t = typeof b, c;
return b == null || t === "boolean" ? constant(b) : (t === "number" ? interpolateNumber : t === "string" ? (c = color(b)) ? (b = c, interpolateRgb) : interpolateString : b instanceof color ? interpolateRgb : b instanceof Date ? date : isNumberArray(b) ? numberArray : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object : interpolateNumber)(a, b);
}
function interpolateRound(a, b) {
return a = +a, b = +b, function(t) {
return Math.round(a * (1 - t) + b * t);
};
}
function formatDecimal(x) {
return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
}
function formatDecimalParts(x, p) {
if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0)
return null;
var i, coefficient = x.slice(0, i);
return [
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
+x.slice(i + 1)
];
}
function exponent(x) {
return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
}
function formatGroup(grouping, thousands) {
return function(value, width) {
var i = value.length, t = [], j = 0, g = grouping[0], length = 0;
while (i > 0 && g > 0) {
if (length + g + 1 > width)
g = Math.max(1, width - length);
t.push(value.substring(i -= g, i + g));
if ((length += g + 1) > width)
break;
g = grouping[j = (j + 1) % grouping.length];
}
return t.reverse().join(thousands);
};
}
function formatNumerals(numerals) {
return function(value) {
return value.replace(/[0-9]/g, function(i) {
return numerals[+i];
});
};
}
var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function formatSpecifier(specifier) {
if (!(match = re.exec(specifier)))
throw new Error("invalid format: " + specifier);
var match;
return new FormatSpecifier({
fill: match[1],
align: match[2],
sign: match[3],
symbol: match[4],
zero: match[5],
width: match[6],
comma: match[7],
precision: match[8] && match[8].slice(1),
trim: match[9],
type: match[10]
});
}
formatSpecifier.prototype = FormatSpecifier.prototype;
function FormatSpecifier(specifier) {
this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
this.align = specifier.align === void 0 ? ">" : specifier.align + "";
this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
this.zero = !!specifier.zero;
this.width = specifier.width === void 0 ? void 0 : +specifier.width;
this.comma = !!specifier.comma;
this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
this.trim = !!specifier.trim;
this.type = specifier.type === void 0 ? "" : specifier.type + "";
}
FormatSpecifier.prototype.toString = function() {
return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
};
function formatTrim(s) {
out:
for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
switch (s[i]) {
case ".":
i0 = i1 = i;
break;
case "0":
if (i0 === 0)
i0 = i;
i1 = i;
break;
default:
if (!+s[i])
break out;
if (i0 > 0)
i0 = 0;
break;
}
}
return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
}
var prefixExponent;
function formatPrefixAuto(x, p) {
var d = formatDecimalParts(x, p);
if (!d)
return x + "";
var coefficient = d[0], exponent2 = d[1], i = exponent2 - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent2 / 3))) * 3) + 1, n = coefficient.length;
return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0];
}
function formatRounded(x, p) {
var d = formatDecimalParts(x, p);
if (!d)
return x + "";
var coefficient = d[0], exponent2 = d[1];
return exponent2 < 0 ? "0." + new Array(-exponent2).join("0") + coefficient : coefficient.length > exponent2 + 1 ? coefficient.slice(0, exponent2 + 1) + "." + coefficient.slice(exponent2 + 1) : coefficient + new Array(exponent2 - coefficient.length + 2).join("0");
}
const formatTypes = {
"%": (x, p) => (x * 100).toFixed(p),
"b": (x) => Math.round(x).toString(2),
"c": (x) => x + "",
"d": formatDecimal,
"e": (x, p) => x.toExponential(p),
"f": (x, p) => x.toFixed(p),
"g": (x, p) => x.toPrecision(p),
"o": (x) => Math.round(x).toString(8),
"p": (x, p) => formatRounded(x * 100, p),
"r": formatRounded,
"s": formatPrefixAuto,
"X": (x) => Math.round(x).toString(16).toUpperCase(),
"x": (x) => Math.round(x).toString(16)
};
function identity$1(x) {
return x;
}
var map = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
function formatLocale(locale2) {
var group = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity$1 : formatGroup(map.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity$1 : formatNumerals(map.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + "";
function newFormat(specifier) {
specifier = formatSpecifier(specifier);
var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero2 = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type;
if (type === "n")
comma = true, type = "g";
else if (!formatTypes[type])
precision === void 0 && (precision = 12), trim = true, type = "g";
if (zero2 || fill === "0" && align === "=")
zero2 = true, fill = "0", align = "=";
var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
var formatType = formatTypes[type], maybeSuffix = /[defgprs%]/.test(type);
precision = precision === void 0 ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));
function format2(value) {
var valuePrefix = prefix, valueSuffix = suffix, i, n, c;
if (type === "c") {
valueSuffix = formatType(value) + valueSuffix;
value = "";
} else {
value = +value;
var valueNegative = value < 0 || 1 / value < 0;
value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
if (trim)
value = formatTrim(value);
if (valueNegative && +value === 0 && sign !== "+")
valueNegative = false;
valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
if (maybeSuffix) {
i = -1, n = value.length;
while (++i < n) {
if (c = value.charCodeAt(i), 48 > c || c > 57) {
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
value = value.slice(0, i);
break;
}
}
}
}
if (comma && !zero2)
value = group(value, Infinity);
var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
if (comma && zero2)
value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
switch (align) {
case "<":
value = valuePrefix + value + valueSuffix + padding;
break;
case "=":
value = valuePrefix + padding + value + valueSuffix;
break;
case "^":
value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
break;
default:
value = padding + valuePrefix + value + valueSuffix;
break;
}
return numerals(value);
}
format2.toString = function() {
return specifier + "";
};
return format2;
}
function formatPrefix2(specifier, value) {
var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3];
return function(value2) {
return f(k * value2) + prefix;
};
}
return {
format: newFormat,
formatPrefix: formatPrefix2
};
}
var locale;
var format;
var formatPrefix;
defaultLocale({
thousands: ",",
grouping: [3],
currency: ["$", ""]
});
function defaultLocale(definition) {
locale = formatLocale(definition);
format = locale.format;
formatPrefix = locale.formatPrefix;
return locale;
}
function precisionFixed(step) {
return Math.max(0, -exponent(Math.abs(step)));
}
function precisionPrefix(step, value) {
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));
}
function precisionRound(step, max) {
step = Math.abs(step), max = Math.abs(max) - step;
return Math.max(0, exponent(max) - exponent(step)) + 1;
}
function constants(x) {
return function() {
return x;
};
}
function number(x) {
return +x;
}
var unit = [0, 1];
function identity(x) {
return x;
}
function normalize(a, b) {
return (b -= a = +a) ? function(x) {
return (x - a) / b;
} : constants(isNaN(b) ? NaN : 0.5);
}
function clamper(a, b) {
var t;
if (a > b)
t = a, a = b, b = t;
return function(x) {
return Math.max(a, Math.min(b, x));
};
}
function bimap(domain, range, interpolate2) {
var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
if (d1 < d0)
d0 = normalize(d1, d0), r0 = interpolate2(r1, r0);
else
d0 = normalize(d0, d1), r0 = interpolate2(r0, r1);
return function(x) {
return r0(d0(x));
};
}
function polymap(domain, range, interpolate2) {
var j = Math.min(domain.length, range.length) - 1, d = new Array(j), r = new Array(j), i = -1;
if (domain[j] < domain[0]) {
domain = domain.slice().reverse();
range = range.slice().reverse();
}
while (++i < j) {
d[i] = normalize(domain[i], domain[i + 1]);
r[i] = interpolate2(range[i], range[i + 1]);
}
return function(x) {
var i2 = bisect(domain, x, 1, j) - 1;
return r[i2](d[i2](x));
};
}
function copy(source, target) {
return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
}
function transformer() {
var domain = unit, range = unit, interpolate$1 = interpolate, transform, untransform, unknown, clamp = identity, piecewise, output, input;
function rescale() {
var n = Math.min(domain.length, range.length);
if (clamp !== identity)
clamp = clamper(domain[0], domain[n - 1]);
piecewise = n > 2 ? polymap : bimap;
output = input = null;
return scale;
}
function scale(x) {
return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate$1)))(transform(clamp(x)));
}
scale.invert = function(y) {
return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));
};
scale.domain = function(_) {
return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();
};
scale.range = function(_) {
return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
};
scale.rangeRound = function(_) {
return range = Array.from(_), interpolate$1 = interpolateRound, rescale();
};
scale.clamp = function(_) {
return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;
};
scale.interpolate = function(_) {
return arguments.length ? (interpolate$1 = _, rescale()) : interpolate$1;
};
scale.unknown = function(_) {
return arguments.length ? (unknown = _, scale) : unknown;
};
return function(t, u) {
transform = t, untransform = u;
return rescale();
};
}
function continuous() {
return transformer()(identity, identity);
}
function tickFormat(start, stop, count, specifier) {
var step = tickStep(start, stop, count), precision;
specifier = formatSpecifier(specifier == null ? ",f" : specifier);
switch (specifier.type) {
case "s": {
var value = Math.max(Math.abs(start), Math.abs(stop));
if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value)))
specifier.precision = precision;
return formatPrefix(specifier, value);
}
case "":
case "e":
case "g":
case "p":
case "r": {
if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop)))))
specifier.precision = precision - (specifier.type === "e");
break;
}
case "f":
case "%": {
if (specifier.precision == null && !isNaN(precision = precisionFixed(step)))
specifier.precision = precision - (specifier.type === "%") * 2;
break;
}
}
return format(specifier);
}
function linearish(scale) {
var domain = scale.domain;
scale.ticks = function(count) {
var d = domain();
return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
};
scale.tickFormat = function(count, specifier) {
var d = domain();
return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
};
scale.nice = function(count) {
if (count == null)
count = 10;
var d = domain();
var i0 = 0;
var i1 = d.length - 1;
var start = d[i0];
var stop = d[i1];
var prestep;
var step;
var maxIter = 10;
if (stop < start) {
step = start, start = stop, stop = step;
step = i0, i0 = i1, i1 = step;
}
while (maxIter-- > 0) {
step = tickIncrement(start, stop, count);
if (step === prestep) {
d[i0] = start;
d[i1] = stop;
return domain(d);
} else if (step > 0) {
start = Math.floor(start / step) * step;
stop = Math.ceil(stop / step) * step;
} else if (step < 0) {
start = Math.ceil(start * step) / step;
stop = Math.floor(stop * step) / step;
} else {
break;
}
prestep = step;
}
return scale;
};
return scale;
}
function linear() {
var scale = continuous();
scale.copy = function() {
return copy(scale, linear());
};
initRange.apply(scale, arguments);
return linearish(scale);
}
export {
copy as a,
bisector as b,
continuous as c,
linear as l,
tickStep as t
};

View file

@ -0,0 +1,447 @@
import { $ as un, a0 as I, a1 as U, a2 as Y, a3 as fn } from "./mermaid-9f2aa176.js";
import { i as cn } from "./init-f9637058.js";
function F(n, t) {
return n == null || t == null ? NaN : n < t ? -1 : n > t ? 1 : n >= t ? 0 : NaN;
}
function hn(n, t) {
return n == null || t == null ? NaN : t < n ? -1 : t > n ? 1 : t >= n ? 0 : NaN;
}
function _(n) {
let t, e, r;
n.length !== 2 ? (t = F, e = (u, c) => F(n(u), c), r = (u, c) => n(u) - c) : (t = n === F || n === hn ? n : mn, e = n, r = n);
function i(u, c, o = 0, l = u.length) {
if (o < l) {
if (t(c, c) !== 0)
return l;
do {
const h = o + l >>> 1;
e(u[h], c) < 0 ? o = h + 1 : l = h;
} while (o < l);
}
return o;
}
function f(u, c, o = 0, l = u.length) {
if (o < l) {
if (t(c, c) !== 0)
return l;
do {
const h = o + l >>> 1;
e(u[h], c) <= 0 ? o = h + 1 : l = h;
} while (o < l);
}
return o;
}
function a(u, c, o = 0, l = u.length) {
const h = i(u, c, o, l - 1);
return h > o && r(u[h - 1], c) > -r(u[h], c) ? h - 1 : h;
}
return { left: i, center: a, right: f };
}
function mn() {
return 0;
}
function sn(n) {
return n === null ? NaN : +n;
}
const ln = _(F), dn = ln.right;
_(sn).center;
const gn = dn, yn = Math.sqrt(50), Mn = Math.sqrt(10), pn = Math.sqrt(2);
function R(n, t, e) {
const r = (t - n) / Math.max(0, e), i = Math.floor(Math.log10(r)), f = r / Math.pow(10, i), a = f >= yn ? 10 : f >= Mn ? 5 : f >= pn ? 2 : 1;
let u, c, o;
return i < 0 ? (o = Math.pow(10, -i) / a, u = Math.round(n * o), c = Math.round(t * o), u / o < n && ++u, c / o > t && --c, o = -o) : (o = Math.pow(10, i) * a, u = Math.round(n / o), c = Math.round(t / o), u * o < n && ++u, c * o > t && --c), c < u && 0.5 <= e && e < 2 ? R(n, t, e * 2) : [u, c, o];
}
function wn(n, t, e) {
if (t = +t, n = +n, e = +e, !(e > 0))
return [];
if (n === t)
return [n];
const r = t < n, [i, f, a] = r ? R(t, n, e) : R(n, t, e);
if (!(f >= i))
return [];
const u = f - i + 1, c = new Array(u);
if (r)
if (a < 0)
for (let o = 0; o < u; ++o)
c[o] = (f - o) / -a;
else
for (let o = 0; o < u; ++o)
c[o] = (f - o) * a;
else if (a < 0)
for (let o = 0; o < u; ++o)
c[o] = (i + o) / -a;
else
for (let o = 0; o < u; ++o)
c[o] = (i + o) * a;
return c;
}
function L(n, t, e) {
return t = +t, n = +n, e = +e, R(n, t, e)[2];
}
function Nn(n, t, e) {
t = +t, n = +n, e = +e;
const r = t < n, i = r ? L(t, n, e) : L(n, t, e);
return (r ? -1 : 1) * (i < 0 ? 1 / -i : i);
}
function kn(n, t) {
t || (t = []);
var e = n ? Math.min(t.length, n.length) : 0, r = t.slice(), i;
return function(f) {
for (i = 0; i < e; ++i)
r[i] = n[i] * (1 - f) + t[i] * f;
return r;
};
}
function xn(n) {
return ArrayBuffer.isView(n) && !(n instanceof DataView);
}
function An(n, t) {
var e = t ? t.length : 0, r = n ? Math.min(e, n.length) : 0, i = new Array(r), f = new Array(e), a;
for (a = 0; a < r; ++a)
i[a] = C(n[a], t[a]);
for (; a < e; ++a)
f[a] = t[a];
return function(u) {
for (a = 0; a < r; ++a)
f[a] = i[a](u);
return f;
};
}
function vn(n, t) {
var e = /* @__PURE__ */ new Date();
return n = +n, t = +t, function(r) {
return e.setTime(n * (1 - r) + t * r), e;
};
}
function Sn(n, t) {
var e = {}, r = {}, i;
(n === null || typeof n != "object") && (n = {}), (t === null || typeof t != "object") && (t = {});
for (i in t)
i in n ? e[i] = C(n[i], t[i]) : r[i] = t[i];
return function(f) {
for (i in e)
r[i] = e[i](f);
return r;
};
}
function C(n, t) {
var e = typeof t, r;
return t == null || e === "boolean" ? un(t) : (e === "number" ? I : e === "string" ? (r = U(t)) ? (t = r, Y) : fn : t instanceof U ? Y : t instanceof Date ? vn : xn(t) ? kn : Array.isArray(t) ? An : typeof t.valueOf != "function" && typeof t.toString != "function" || isNaN(t) ? Sn : I)(n, t);
}
function bn(n, t) {
return n = +n, t = +t, function(e) {
return Math.round(n * (1 - e) + t * e);
};
}
function jn(n) {
return Math.abs(n = Math.round(n)) >= 1e21 ? n.toLocaleString("en").replace(/,/g, "") : n.toString(10);
}
function E(n, t) {
if ((e = (n = t ? n.toExponential(t - 1) : n.toExponential()).indexOf("e")) < 0)
return null;
var e, r = n.slice(0, e);
return [
r.length > 1 ? r[0] + r.slice(2) : r,
+n.slice(e + 1)
];
}
function v(n) {
return n = E(Math.abs(n)), n ? n[1] : NaN;
}
function Pn(n, t) {
return function(e, r) {
for (var i = e.length, f = [], a = 0, u = n[0], c = 0; i > 0 && u > 0 && (c + u + 1 > r && (u = Math.max(1, r - c)), f.push(e.substring(i -= u, i + u)), !((c += u + 1) > r)); )
u = n[a = (a + 1) % n.length];
return f.reverse().join(t);
};
}
function zn(n) {
return function(t) {
return t.replace(/[0-9]/g, function(e) {
return n[+e];
});
};
}
var $n = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function D(n) {
if (!(t = $n.exec(n)))
throw new Error("invalid format: " + n);
var t;
return new B({
fill: t[1],
align: t[2],
sign: t[3],
symbol: t[4],
zero: t[5],
width: t[6],
comma: t[7],
precision: t[8] && t[8].slice(1),
trim: t[9],
type: t[10]
});
}
D.prototype = B.prototype;
function B(n) {
this.fill = n.fill === void 0 ? " " : n.fill + "", this.align = n.align === void 0 ? ">" : n.align + "", this.sign = n.sign === void 0 ? "-" : n.sign + "", this.symbol = n.symbol === void 0 ? "" : n.symbol + "", this.zero = !!n.zero, this.width = n.width === void 0 ? void 0 : +n.width, this.comma = !!n.comma, this.precision = n.precision === void 0 ? void 0 : +n.precision, this.trim = !!n.trim, this.type = n.type === void 0 ? "" : n.type + "";
}
B.prototype.toString = function() {
return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
};
function Fn(n) {
n:
for (var t = n.length, e = 1, r = -1, i; e < t; ++e)
switch (n[e]) {
case ".":
r = i = e;
break;
case "0":
r === 0 && (r = e), i = e;
break;
default:
if (!+n[e])
break n;
r > 0 && (r = 0);
break;
}
return r > 0 ? n.slice(0, r) + n.slice(i + 1) : n;
}
var nn;
function Rn(n, t) {
var e = E(n, t);
if (!e)
return n + "";
var r = e[0], i = e[1], f = i - (nn = Math.max(-8, Math.min(8, Math.floor(i / 3))) * 3) + 1, a = r.length;
return f === a ? r : f > a ? r + new Array(f - a + 1).join("0") : f > 0 ? r.slice(0, f) + "." + r.slice(f) : "0." + new Array(1 - f).join("0") + E(n, Math.max(0, t + f - 1))[0];
}
function Z(n, t) {
var e = E(n, t);
if (!e)
return n + "";
var r = e[0], i = e[1];
return i < 0 ? "0." + new Array(-i).join("0") + r : r.length > i + 1 ? r.slice(0, i + 1) + "." + r.slice(i + 1) : r + new Array(i - r.length + 2).join("0");
}
const H = {
"%": (n, t) => (n * 100).toFixed(t),
b: (n) => Math.round(n).toString(2),
c: (n) => n + "",
d: jn,
e: (n, t) => n.toExponential(t),
f: (n, t) => n.toFixed(t),
g: (n, t) => n.toPrecision(t),
o: (n) => Math.round(n).toString(8),
p: (n, t) => Z(n * 100, t),
r: Z,
s: Rn,
X: (n) => Math.round(n).toString(16).toUpperCase(),
x: (n) => Math.round(n).toString(16)
};
function J(n) {
return n;
}
var K = Array.prototype.map, Q = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
function En(n) {
var t = n.grouping === void 0 || n.thousands === void 0 ? J : Pn(K.call(n.grouping, Number), n.thousands + ""), e = n.currency === void 0 ? "" : n.currency[0] + "", r = n.currency === void 0 ? "" : n.currency[1] + "", i = n.decimal === void 0 ? "." : n.decimal + "", f = n.numerals === void 0 ? J : zn(K.call(n.numerals, String)), a = n.percent === void 0 ? "%" : n.percent + "", u = n.minus === void 0 ? "" : n.minus + "", c = n.nan === void 0 ? "NaN" : n.nan + "";
function o(h) {
h = D(h);
var s = h.fill, p = h.align, y = h.sign, S = h.symbol, k = h.zero, b = h.width, T = h.comma, w = h.precision, G = h.trim, d = h.type;
d === "n" ? (T = !0, d = "g") : H[d] || (w === void 0 && (w = 12), G = !0, d = "g"), (k || s === "0" && p === "=") && (k = !0, s = "0", p = "=");
var en = S === "$" ? e : S === "#" && /[boxX]/.test(d) ? "0" + d.toLowerCase() : "", on = S === "$" ? r : /[%p]/.test(d) ? a : "", O = H[d], an = /[defgprs%]/.test(d);
w = w === void 0 ? 6 : /[gprs]/.test(d) ? Math.max(1, Math.min(21, w)) : Math.max(0, Math.min(20, w));
function V(m) {
var N = en, g = on, x, X, j;
if (d === "c")
g = O(m) + g, m = "";
else {
m = +m;
var P = m < 0 || 1 / m < 0;
if (m = isNaN(m) ? c : O(Math.abs(m), w), G && (m = Fn(m)), P && +m == 0 && y !== "+" && (P = !1), N = (P ? y === "(" ? y : u : y === "-" || y === "(" ? "" : y) + N, g = (d === "s" ? Q[8 + nn / 3] : "") + g + (P && y === "(" ? ")" : ""), an) {
for (x = -1, X = m.length; ++x < X; )
if (j = m.charCodeAt(x), 48 > j || j > 57) {
g = (j === 46 ? i + m.slice(x + 1) : m.slice(x)) + g, m = m.slice(0, x);
break;
}
}
}
T && !k && (m = t(m, 1 / 0));
var z = N.length + m.length + g.length, M = z < b ? new Array(b - z + 1).join(s) : "";
switch (T && k && (m = t(M + m, M.length ? b - g.length : 1 / 0), M = ""), p) {
case "<":
m = N + m + g + M;
break;
case "=":
m = N + M + m + g;
break;
case "^":
m = M.slice(0, z = M.length >> 1) + N + m + g + M.slice(z);
break;
default:
m = M + N + m + g;
break;
}
return f(m);
}
return V.toString = function() {
return h + "";
}, V;
}
function l(h, s) {
var p = o((h = D(h), h.type = "f", h)), y = Math.max(-8, Math.min(8, Math.floor(v(s) / 3))) * 3, S = Math.pow(10, -y), k = Q[8 + y / 3];
return function(b) {
return p(S * b) + k;
};
}
return {
format: o,
formatPrefix: l
};
}
var $, tn, rn;
Dn({
thousands: ",",
grouping: [3],
currency: ["$", ""]
});
function Dn(n) {
return $ = En(n), tn = $.format, rn = $.formatPrefix, $;
}
function Tn(n) {
return Math.max(0, -v(Math.abs(n)));
}
function In(n, t) {
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(v(t) / 3))) * 3 - v(Math.abs(n)));
}
function Ln(n, t) {
return n = Math.abs(n), t = Math.abs(t) - n, Math.max(0, v(t) - v(n)) + 1;
}
function qn(n) {
return function() {
return n;
};
}
function Cn(n) {
return +n;
}
var W = [0, 1];
function A(n) {
return n;
}
function q(n, t) {
return (t -= n = +n) ? function(e) {
return (e - n) / t;
} : qn(isNaN(t) ? NaN : 0.5);
}
function Bn(n, t) {
var e;
return n > t && (e = n, n = t, t = e), function(r) {
return Math.max(n, Math.min(t, r));
};
}
function Gn(n, t, e) {
var r = n[0], i = n[1], f = t[0], a = t[1];
return i < r ? (r = q(i, r), f = e(a, f)) : (r = q(r, i), f = e(f, a)), function(u) {
return f(r(u));
};
}
function On(n, t, e) {
var r = Math.min(n.length, t.length) - 1, i = new Array(r), f = new Array(r), a = -1;
for (n[r] < n[0] && (n = n.slice().reverse(), t = t.slice().reverse()); ++a < r; )
i[a] = q(n[a], n[a + 1]), f[a] = e(t[a], t[a + 1]);
return function(u) {
var c = gn(n, u, 1, r) - 1;
return f[c](i[c](u));
};
}
function Vn(n, t) {
return t.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown());
}
function Xn() {
var n = W, t = W, e = C, r, i, f, a = A, u, c, o;
function l() {
var s = Math.min(n.length, t.length);
return a !== A && (a = Bn(n[0], n[s - 1])), u = s > 2 ? On : Gn, c = o = null, h;
}
function h(s) {
return s == null || isNaN(s = +s) ? f : (c || (c = u(n.map(r), t, e)))(r(a(s)));
}
return h.invert = function(s) {
return a(i((o || (o = u(t, n.map(r), I)))(s)));
}, h.domain = function(s) {
return arguments.length ? (n = Array.from(s, Cn), l()) : n.slice();
}, h.range = function(s) {
return arguments.length ? (t = Array.from(s), l()) : t.slice();
}, h.rangeRound = function(s) {
return t = Array.from(s), e = bn, l();
}, h.clamp = function(s) {
return arguments.length ? (a = s ? !0 : A, l()) : a !== A;
}, h.interpolate = function(s) {
return arguments.length ? (e = s, l()) : e;
}, h.unknown = function(s) {
return arguments.length ? (f = s, h) : f;
}, function(s, p) {
return r = s, i = p, l();
};
}
function Un() {
return Xn()(A, A);
}
function Yn(n, t, e, r) {
var i = Nn(n, t, e), f;
switch (r = D(r ?? ",f"), r.type) {
case "s": {
var a = Math.max(Math.abs(n), Math.abs(t));
return r.precision == null && !isNaN(f = In(i, a)) && (r.precision = f), rn(r, a);
}
case "":
case "e":
case "g":
case "p":
case "r": {
r.precision == null && !isNaN(f = Ln(i, Math.max(Math.abs(n), Math.abs(t)))) && (r.precision = f - (r.type === "e"));
break;
}
case "f":
case "%": {
r.precision == null && !isNaN(f = Tn(i)) && (r.precision = f - (r.type === "%") * 2);
break;
}
}
return tn(r);
}
function Zn(n) {
var t = n.domain;
return n.ticks = function(e) {
var r = t();
return wn(r[0], r[r.length - 1], e ?? 10);
}, n.tickFormat = function(e, r) {
var i = t();
return Yn(i[0], i[i.length - 1], e ?? 10, r);
}, n.nice = function(e) {
e == null && (e = 10);
var r = t(), i = 0, f = r.length - 1, a = r[i], u = r[f], c, o, l = 10;
for (u < a && (o = a, a = u, u = o, o = i, i = f, f = o); l-- > 0; ) {
if (o = L(a, u, e), o === c)
return r[i] = a, r[f] = u, t(r);
if (o > 0)
a = Math.floor(a / o) * o, u = Math.ceil(u / o) * o;
else if (o < 0)
a = Math.ceil(a * o) / o, u = Math.floor(u * o) / o;
else
break;
c = o;
}
return n;
}, n;
}
function Hn() {
var n = Un();
return n.copy = function() {
return Vn(n, Hn());
}, cn.apply(n, arguments), Zn(n);
}
export {
Vn as a,
_ as b,
Un as c,
Hn as l,
Nn as t
};

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
import "ts-dedent"; import "ts-dedent";
import { N } from "./mermaid-f47111a7.js"; import { N } from "./mermaid-6dc72991.js";
import "dayjs"; import "dayjs";
import "@braintree/sanitize-url"; import "@braintree/sanitize-url";
import "d3"; import "d3";

View file

@ -1,4 +1,4 @@
import { b9 as f } from "./mermaid-00886c59.js"; import { b9 as f } from "./mermaid-9f2aa176.js";
export { export {
f as default f as default
}; };

View file

@ -1,4 +1,4 @@
import { b9 } from "./mermaid-c5809711.js"; import { b9 } from "./mermaid-dcacb631.js";
export { export {
b9 as default b9 as default
}; };

View file

@ -6863,7 +6863,7 @@
} }
return text2; return text2;
}; };
const sanitizeText$5 = (text2, config2) => { const sanitizeText$6 = (text2, config2) => {
if (!text2) { if (!text2) {
return text2; return text2;
} }
@ -6878,9 +6878,9 @@
}; };
const sanitizeTextOrArray = (a, config2) => { const sanitizeTextOrArray = (a, config2) => {
if (typeof a === "string") { if (typeof a === "string") {
return sanitizeText$5(a, config2); return sanitizeText$6(a, config2);
} }
return a.flat().map((x2) => sanitizeText$5(x2, config2)); return a.flat().map((x2) => sanitizeText$6(x2, config2));
}; };
const hasBreaks = (text2) => { const hasBreaks = (text2) => {
return lineBreakRegex.test(text2); return lineBreakRegex.test(text2);
@ -7011,7 +7011,7 @@
}; };
const common$1 = { const common$1 = {
getRows, getRows,
sanitizeText: sanitizeText$5, sanitizeText: sanitizeText$6,
sanitizeTextOrArray, sanitizeTextOrArray,
hasBreaks, hasBreaks,
splitBreaks, splitBreaks,
@ -9552,7 +9552,7 @@
"deterministicIds": false, "deterministicIds": false,
"fontSize": 16 "fontSize": 16
}; };
const config$3 = { const config$4 = {
...defaultConfigJson, ...defaultConfigJson,
// Set, even though they're `undefined` so that `configKeys` finds these keys // Set, even though they're `undefined` so that `configKeys` finds these keys
// TODO: Should we replace these with `null` so that they can go in the JSON Schema? // TODO: Should we replace these with `null` so that they can go in the JSON Schema?
@ -9782,8 +9782,8 @@
} }
return [...res, prefix + el]; return [...res, prefix + el];
}, []); }, []);
const configKeys = new Set(keyify(config$3, "")); const configKeys = new Set(keyify(config$4, ""));
const defaultConfig$2 = config$3; const defaultConfig$2 = config$4;
const sanitizeDirective = (args) => { const sanitizeDirective = (args) => {
log$1.debug("sanitizeDirective called with", args); log$1.debug("sanitizeDirective called with", args);
if (typeof args !== "object" || args == null) { if (typeof args !== "object" || args == null) {
@ -11464,7 +11464,7 @@
} }
return strlen(children2 = serialize(element2.children, callback)) ? element2.return = element2.value + "{" + children2 + "}" : ""; return strlen(children2 = serialize(element2.children, callback)) ? element2.return = element2.value + "{" + children2 + "}" : "";
} }
const version$1 = "10.9.0"; const version$1 = "10.9.1";
const defaultConfig$1 = Object.freeze(defaultConfig$2); const defaultConfig$1 = Object.freeze(defaultConfig$2);
let siteConfig = assignWithDepth$1({}, defaultConfig$1); let siteConfig = assignWithDepth$1({}, defaultConfig$1);
let configFromInitialize; let configFromInitialize;
@ -11944,22 +11944,22 @@
let accTitle = ""; let accTitle = "";
let diagramTitle = ""; let diagramTitle = "";
let accDescription = ""; let accDescription = "";
const sanitizeText$4 = (txt) => sanitizeText$5(txt, getConfig$2()); const sanitizeText$5 = (txt) => sanitizeText$6(txt, getConfig$2());
const clear$n = () => { const clear$n = () => {
accTitle = ""; accTitle = "";
accDescription = ""; accDescription = "";
diagramTitle = ""; diagramTitle = "";
}; };
const setAccTitle = (txt) => { const setAccTitle = (txt) => {
accTitle = sanitizeText$4(txt).replace(/^\s+/g, ""); accTitle = sanitizeText$5(txt).replace(/^\s+/g, "");
}; };
const getAccTitle = () => accTitle; const getAccTitle = () => accTitle;
const setAccDescription = (txt) => { const setAccDescription = (txt) => {
accDescription = sanitizeText$4(txt).replace(/\n\s+/g, "\n"); accDescription = sanitizeText$5(txt).replace(/\n\s+/g, "\n");
}; };
const getAccDescription = () => accDescription; const getAccDescription = () => accDescription;
const setDiagramTitle = (txt) => { const setDiagramTitle = (txt) => {
diagramTitle = sanitizeText$4(txt); diagramTitle = sanitizeText$5(txt);
}; };
const getDiagramTitle = () => diagramTitle; const getDiagramTitle = () => diagramTitle;
const commonDb = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ const commonDb = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@ -11977,7 +11977,7 @@
const getConfig$1 = getConfig$2; const getConfig$1 = getConfig$2;
const setConfig = setConfig$1; const setConfig = setConfig$1;
const defaultConfig = defaultConfig$1; const defaultConfig = defaultConfig$1;
const sanitizeText$3 = (text2) => sanitizeText$5(text2, getConfig$1()); const sanitizeText$4 = (text2) => sanitizeText$6(text2, getConfig$1());
const setupGraphViewbox = setupGraphViewbox$1; const setupGraphViewbox = setupGraphViewbox$1;
const getCommonDb$1 = () => { const getCommonDb$1 = () => {
return commonDb; return commonDb;
@ -11998,7 +11998,7 @@
log, log,
setLogLevel, setLogLevel,
getConfig$1, getConfig$1,
sanitizeText$3, sanitizeText$4,
setupGraphViewbox, setupGraphViewbox,
getCommonDb$1(), getCommonDb$1(),
() => { () => {
@ -30326,7 +30326,7 @@ ${config2.themeCSS}`;
return c4Type; return c4Type;
}; };
const setC4Type = function(c4TypeParam) { const setC4Type = function(c4TypeParam) {
let sanitizedText = sanitizeText$5(c4TypeParam, getConfig$1()); let sanitizedText = sanitizeText$6(c4TypeParam, getConfig$1());
c4Type = sanitizedText; c4Type = sanitizedText;
}; };
const addRel = function(type2, from2, to, label, techn, descr, sprite, tags2, link2) { const addRel = function(type2, from2, to, label, techn, descr, sprite, tags2, link2) {
@ -30948,7 +30948,7 @@ ${config2.themeCSS}`;
OVER: 2 OVER: 2
}; };
const setTitle = function(txt) { const setTitle = function(txt) {
let sanitizedText = sanitizeText$5(txt, getConfig$1()); let sanitizedText = sanitizeText$6(txt, getConfig$1());
title = sanitizedText; title = sanitizedText;
}; };
const db$g = { const db$g = {
@ -33032,7 +33032,7 @@ ${config2.themeCSS}`;
const parser$u = parser$t; const parser$u = parser$t;
const MERMAID_DOM_ID_PREFIX$1 = "flowchart-"; const MERMAID_DOM_ID_PREFIX$1 = "flowchart-";
let vertexCounter = 0; let vertexCounter = 0;
let config$2 = getConfig$1(); let config$3 = getConfig$1();
let vertices = {}; let vertices = {};
let edges = []; let edges = [];
let classes$3 = {}; let classes$3 = {};
@ -33044,7 +33044,7 @@ ${config2.themeCSS}`;
let direction$3; let direction$3;
let version; let version;
let funs$1 = []; let funs$1 = [];
const sanitizeText$2 = (txt) => common$1.sanitizeText(txt, config$2); const sanitizeText$3 = (txt) => common$1.sanitizeText(txt, config$3);
const lookUpDomId$1 = function(id2) { const lookUpDomId$1 = function(id2) {
const vertexKeys = Object.keys(vertices); const vertexKeys = Object.keys(vertices);
for (const vertexKey of vertexKeys) { for (const vertexKey of vertexKeys) {
@ -33074,8 +33074,8 @@ ${config2.themeCSS}`;
} }
vertexCounter++; vertexCounter++;
if (textObj !== void 0) { if (textObj !== void 0) {
config$2 = getConfig$1(); config$3 = getConfig$1();
txt = sanitizeText$2(textObj.text.trim()); txt = sanitizeText$3(textObj.text.trim());
vertices[id2].labelType = textObj.type; vertices[id2].labelType = textObj.type;
if (txt[0] === '"' && txt[txt.length - 1] === '"') { if (txt[0] === '"' && txt[txt.length - 1] === '"') {
txt = txt.substring(1, txt.length - 1); txt = txt.substring(1, txt.length - 1);
@ -33115,7 +33115,7 @@ ${config2.themeCSS}`;
log$1.info("abc78 Got edge...", edge); log$1.info("abc78 Got edge...", edge);
const linkTextObj = type2.text; const linkTextObj = type2.text;
if (linkTextObj !== void 0) { if (linkTextObj !== void 0) {
edge.text = sanitizeText$2(linkTextObj.text.trim()); edge.text = sanitizeText$3(linkTextObj.text.trim());
if (edge.text[0] === '"' && edge.text[edge.text.length - 1] === '"') { if (edge.text[0] === '"' && edge.text[edge.text.length - 1] === '"') {
edge.text = edge.text.substring(1, edge.text.length - 1); edge.text = edge.text.substring(1, edge.text.length - 1);
} }
@ -33129,12 +33129,12 @@ ${config2.themeCSS}`;
if ((edge == null ? void 0 : edge.length) > 10) { if ((edge == null ? void 0 : edge.length) > 10) {
edge.length = 10; edge.length = 10;
} }
if (edges.length < (config$2.maxEdges ?? 500)) { if (edges.length < (config$3.maxEdges ?? 500)) {
log$1.info("abc78 pushing edge..."); log$1.info("abc78 pushing edge...");
edges.push(edge); edges.push(edge);
} else { } else {
throw new Error( throw new Error(
`Edge limit exceeded. ${edges.length} edges found, but the limit is ${config$2.maxEdges}. `Edge limit exceeded. ${edges.length} edges found, but the limit is ${config$3.maxEdges}.
Initialize mermaid with maxEdges set to a higher number to allow more edges. Initialize mermaid with maxEdges set to a higher number to allow more edges.
You cannot set this config via configuration inside the diagram as it is a secure config. You cannot set this config via configuration inside the diagram as it is a secure config.
@ -33225,7 +33225,7 @@ You have to call mermaid.initialize.`
const setTooltip$1 = function(ids, tooltip) { const setTooltip$1 = function(ids, tooltip) {
ids.split(",").forEach(function(id2) { ids.split(",").forEach(function(id2) {
if (tooltip !== void 0) { if (tooltip !== void 0) {
tooltips[version === "gen-1" ? lookUpDomId$1(id2) : id2] = sanitizeText$2(tooltip); tooltips[version === "gen-1" ? lookUpDomId$1(id2) : id2] = sanitizeText$3(tooltip);
} }
}); });
}; };
@ -33270,7 +33270,7 @@ You have to call mermaid.initialize.`
const setLink$2 = function(ids, linkStr, target) { const setLink$2 = function(ids, linkStr, target) {
ids.split(",").forEach(function(id2) { ids.split(",").forEach(function(id2) {
if (vertices[id2] !== void 0) { if (vertices[id2] !== void 0) {
vertices[id2].link = utils$1.formatUrl(linkStr, config$2); vertices[id2].link = utils$1.formatUrl(linkStr, config$3);
vertices[id2].linkTarget = target; vertices[id2].linkTarget = target;
} }
}); });
@ -33341,7 +33341,7 @@ You have to call mermaid.initialize.`
tooltips = {}; tooltips = {};
firstGraphFlag = true; firstGraphFlag = true;
version = ver; version = ver;
config$2 = getConfig$1(); config$3 = getConfig$1();
clear$n(); clear$n();
}; };
const setGen = (ver) => { const setGen = (ver) => {
@ -33387,7 +33387,7 @@ You have to call mermaid.initialize.`
} }
id2 = id2 || "subGraph" + subCount; id2 = id2 || "subGraph" + subCount;
title2 = title2 || ""; title2 = title2 || "";
title2 = sanitizeText$2(title2); title2 = sanitizeText$3(title2);
subCount = subCount + 1; subCount = subCount + 1;
const subGraph = { const subGraph = {
id: id2, id: id2,
@ -43620,7 +43620,7 @@ You have to call mermaid.initialize.`
const textNode = label.node(); const textNode = label.node();
let text2; let text2;
if (node2.labelType === "markdown") { if (node2.labelType === "markdown") {
text2 = createText(label, sanitizeText$5(decodeEntities(labelText), getConfig$1()), { text2 = createText(label, sanitizeText$6(decodeEntities(labelText), getConfig$1()), {
useHtmlLabels, useHtmlLabels,
width: node2.width || getConfig$1().flowchart.wrappingWidth, width: node2.width || getConfig$1().flowchart.wrappingWidth,
classes: "markdown-node-label" classes: "markdown-node-label"
@ -43628,7 +43628,7 @@ You have to call mermaid.initialize.`
} else { } else {
text2 = textNode.appendChild( text2 = textNode.appendChild(
createLabel$1( createLabel$1(
sanitizeText$5(decodeEntities(labelText), getConfig$1()), sanitizeText$6(decodeEntities(labelText), getConfig$1()),
node2.labelStyle, node2.labelStyle,
false, false,
isNode isNode
@ -52875,15 +52875,15 @@ You have to call mermaid.initialize.`
}; };
let sections$2 = DEFAULT_PIE_DB.sections; let sections$2 = DEFAULT_PIE_DB.sections;
let showData = DEFAULT_PIE_DB.showData; let showData = DEFAULT_PIE_DB.showData;
const config$1 = structuredClone(DEFAULT_PIE_CONFIG); const config$2 = structuredClone(DEFAULT_PIE_CONFIG);
const getConfig = () => structuredClone(config$1); const getConfig = () => structuredClone(config$2);
const clear$b = () => { const clear$b = () => {
sections$2 = structuredClone(DEFAULT_PIE_DB.sections); sections$2 = structuredClone(DEFAULT_PIE_DB.sections);
showData = DEFAULT_PIE_DB.showData; showData = DEFAULT_PIE_DB.showData;
clear$n(); clear$n();
}; };
const addSection$2 = (label, value2) => { const addSection$2 = (label, value2) => {
label = sanitizeText$5(label, getConfig$1()); label = sanitizeText$6(label, getConfig$1());
if (sections$2[label] === void 0) { if (sections$2[label] === void 0) {
sections$2[label] = value2; sections$2[label] = value2;
log$1.debug(`added new section: ${label}, with value: ${value2}`); log$1.debug(`added new section: ${label}, with value: ${value2}`);
@ -54084,9 +54084,9 @@ You have to call mermaid.initialize.`
}; };
} }
} }
const config = getConfig$1(); const config$1 = getConfig$1();
function textSanitizer$1(text2) { function textSanitizer$1(text2) {
return sanitizeText$5(text2.trim(), config); return sanitizeText$6(text2.trim(), config$1);
} }
const quadrantBuilder = new QuadrantBuilder(); const quadrantBuilder = new QuadrantBuilder();
function setQuadrant1Text(textObj) { function setQuadrant1Text(textObj) {
@ -55764,7 +55764,7 @@ You have to call mermaid.initialize.`
} }
function textSanitizer(text2) { function textSanitizer(text2) {
const config2 = getConfig$2(); const config2 = getConfig$2();
return sanitizeText$5(text2.trim(), config2); return sanitizeText$6(text2.trim(), config2);
} }
function setTmpSVGG(SVGG) { function setTmpSVGG(SVGG) {
tmpSVGGroup = SVGG; tmpSVGGroup = SVGG;
@ -58102,7 +58102,7 @@ You have to call mermaid.initialize.`
} }
return { return {
color: color2, color: color2,
text: title2 !== void 0 ? sanitizeText$5(title2.replace(/^:?(?:no)?wrap:/, ""), getConfig$1()) : void 0, text: title2 !== void 0 ? sanitizeText$6(title2.replace(/^:?(?:no)?wrap:/, ""), getConfig$1()) : void 0,
wrap: title2 !== void 0 ? title2.match(/^:?wrap:/) !== null ? true : title2.match(/^:?nowrap:/) !== null ? false : void 0 : void 0 wrap: title2 !== void 0 ? title2.match(/^:?wrap:/) !== null ? true : title2.match(/^:?nowrap:/) !== null ? false : void 0 : void 0
}; };
}; };
@ -58168,7 +58168,7 @@ You have to call mermaid.initialize.`
const addLinks = function(actorId, text2) { const addLinks = function(actorId, text2) {
const actor = getActor(actorId); const actor = getActor(actorId);
try { try {
let sanitizedText = sanitizeText$5(text2.text, getConfig$1()); let sanitizedText = sanitizeText$6(text2.text, getConfig$1());
sanitizedText = sanitizedText.replace(/&amp;/g, "&"); sanitizedText = sanitizedText.replace(/&amp;/g, "&");
sanitizedText = sanitizedText.replace(/&equals;/g, "="); sanitizedText = sanitizedText.replace(/&equals;/g, "=");
const links2 = JSON.parse(sanitizedText); const links2 = JSON.parse(sanitizedText);
@ -58181,7 +58181,7 @@ You have to call mermaid.initialize.`
const actor = getActor(actorId); const actor = getActor(actorId);
try { try {
const links2 = {}; const links2 = {};
let sanitizedText = sanitizeText$5(text2.text, getConfig$1()); let sanitizedText = sanitizeText$6(text2.text, getConfig$1());
var sep2 = sanitizedText.indexOf("@"); var sep2 = sanitizedText.indexOf("@");
sanitizedText = sanitizedText.replace(/&amp;/g, "&"); sanitizedText = sanitizedText.replace(/&amp;/g, "&");
sanitizedText = sanitizedText.replace(/&equals;/g, "="); sanitizedText = sanitizedText.replace(/&equals;/g, "=");
@ -58205,7 +58205,7 @@ You have to call mermaid.initialize.`
const addProperties = function(actorId, text2) { const addProperties = function(actorId, text2) {
const actor = getActor(actorId); const actor = getActor(actorId);
try { try {
let sanitizedText = sanitizeText$5(text2.text, getConfig$1()); let sanitizedText = sanitizeText$6(text2.text, getConfig$1());
const properties = JSON.parse(sanitizedText); const properties = JSON.parse(sanitizedText);
insertProperties(actor, properties); insertProperties(actor, properties);
} catch (e) { } catch (e) {
@ -61305,7 +61305,7 @@ You have to call mermaid.initialize.`
this.memberType = memberType; this.memberType = memberType;
this.visibility = ""; this.visibility = "";
this.classifier = ""; this.classifier = "";
const sanitizedInput = sanitizeText$5(input, getConfig$1()); const sanitizedInput = sanitizeText$6(input, getConfig$1());
this.parseMember(sanitizedInput); this.parseMember(sanitizedInput);
} }
getDisplayDetails() { getDisplayDetails() {
@ -61381,22 +61381,22 @@ You have to call mermaid.initialize.`
let namespaces = {}; let namespaces = {};
let namespaceCounter = 0; let namespaceCounter = 0;
let functions = []; let functions = [];
const sanitizeText$1 = (txt) => common$1.sanitizeText(txt, getConfig$1()); const sanitizeText$2 = (txt) => common$1.sanitizeText(txt, getConfig$1());
const splitClassNameAndType = function(_id) { const splitClassNameAndType = function(_id) {
const id2 = common$1.sanitizeText(_id, getConfig$1()); const id2 = common$1.sanitizeText(_id, getConfig$1());
let genericType = ""; let genericType = "";
let className = id2; let className = id2;
if (id2.indexOf("~") > 0) { if (id2.indexOf("~") > 0) {
const split = id2.split("~"); const split = id2.split("~");
className = sanitizeText$1(split[0]); className = sanitizeText$2(split[0]);
genericType = sanitizeText$1(split[1]); genericType = sanitizeText$2(split[1]);
} }
return { className, type: genericType }; return { className, type: genericType };
}; };
const setClassLabel = function(_id, label) { const setClassLabel = function(_id, label) {
const id2 = common$1.sanitizeText(_id, getConfig$1()); const id2 = common$1.sanitizeText(_id, getConfig$1());
if (label) { if (label) {
label = sanitizeText$1(label); label = sanitizeText$2(label);
} }
const { className } = splitClassNameAndType(id2); const { className } = splitClassNameAndType(id2);
classes$2[className].label = label; classes$2[className].label = label;
@ -61471,7 +61471,7 @@ You have to call mermaid.initialize.`
if (typeof member === "string") { if (typeof member === "string") {
const memberString = member.trim(); const memberString = member.trim();
if (memberString.startsWith("<<") && memberString.endsWith(">>")) { if (memberString.startsWith("<<") && memberString.endsWith(">>")) {
theClass.annotations.push(sanitizeText$1(memberString.substring(2, memberString.length - 2))); theClass.annotations.push(sanitizeText$2(memberString.substring(2, memberString.length - 2)));
} else if (memberString.indexOf(")") > 0) { } else if (memberString.indexOf(")") > 0) {
theClass.methods.push(new ClassMember(memberString, "method")); theClass.methods.push(new ClassMember(memberString, "method"));
} else if (memberString) { } else if (memberString) {
@ -61497,7 +61497,7 @@ You have to call mermaid.initialize.`
if (label.startsWith(":")) { if (label.startsWith(":")) {
label = label.substring(1); label = label.substring(1);
} }
return sanitizeText$1(label.trim()); return sanitizeText$2(label.trim());
}; };
const setCssClass$2 = function(ids, className) { const setCssClass$2 = function(ids, className) {
ids.split(",").forEach(function(_id) { ids.split(",").forEach(function(_id) {
@ -61513,7 +61513,7 @@ You have to call mermaid.initialize.`
const setTooltip = function(ids, tooltip) { const setTooltip = function(ids, tooltip) {
ids.split(",").forEach(function(id2) { ids.split(",").forEach(function(id2) {
if (tooltip !== void 0) { if (tooltip !== void 0) {
classes$2[id2].tooltip = sanitizeText$1(tooltip); classes$2[id2].tooltip = sanitizeText$2(tooltip);
} }
}); });
}; };
@ -61535,7 +61535,7 @@ You have to call mermaid.initialize.`
if (config2.securityLevel === "sandbox") { if (config2.securityLevel === "sandbox") {
classes$2[id2].linkTarget = "_top"; classes$2[id2].linkTarget = "_top";
} else if (typeof target === "string") { } else if (typeof target === "string") {
classes$2[id2].linkTarget = sanitizeText$1(target); classes$2[id2].linkTarget = sanitizeText$2(target);
} else { } else {
classes$2[id2].linkTarget = "_blank"; classes$2[id2].linkTarget = "_blank";
} }
@ -62221,7 +62221,7 @@ g.classGroup line {
__proto__: null, __proto__: null,
diagram: diagram$9 diagram: diagram$9
}, Symbol.toStringTag, { value: "Module" })); }, Symbol.toStringTag, { value: "Module" }));
const sanitizeText = (txt) => common$1.sanitizeText(txt, getConfig$1()); const sanitizeText$1 = (txt) => common$1.sanitizeText(txt, getConfig$1());
let conf$3 = { let conf$3 = {
dividerMargin: 10, dividerMargin: 10,
padding: 5, padding: 5,
@ -62240,7 +62240,7 @@ g.classGroup line {
shape, shape,
id: vertex.id, id: vertex.id,
domId: vertex.domId, domId: vertex.domId,
labelText: sanitizeText(vertex.id), labelText: sanitizeText$1(vertex.id),
labelStyle: "", labelStyle: "",
style: "fill: none; stroke: black", style: "fill: none; stroke: black",
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release // TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
@ -62266,7 +62266,7 @@ g.classGroup line {
const node2 = { const node2 = {
labelStyle: styles2.labelStyle, labelStyle: styles2.labelStyle,
shape, shape,
labelText: sanitizeText(vertexText), labelText: sanitizeText$1(vertexText),
classData: vertex, classData: vertex,
rx: radius, rx: radius,
ry: radius, ry: radius,
@ -62302,7 +62302,7 @@ g.classGroup line {
const node2 = { const node2 = {
labelStyle: styles2.labelStyle, labelStyle: styles2.labelStyle,
shape, shape,
labelText: sanitizeText(vertexText), labelText: sanitizeText$1(vertexText),
noteData: vertex, noteData: vertex,
rx: radius, rx: radius,
ry: radius, ry: radius,
@ -161066,9 +161066,9 @@ g.stateGroup line {
} }
const node2 = { const node2 = {
id: cnt$1++, id: cnt$1++,
nodeId: sanitizeText$5(id2, conf2), nodeId: sanitizeText$6(id2, conf2),
level, level,
descr: sanitizeText$5(descr, conf2), descr: sanitizeText$6(descr, conf2),
type: type2, type: type2,
children: [], children: [],
width: ((_b2 = conf2.mindmap) == null ? void 0 : _b2.maxNodeWidth) ?? defaultConfig$2.mindmap.maxNodeWidth, width: ((_b2 = conf2.mindmap) == null ? void 0 : _b2.maxNodeWidth) ?? defaultConfig$2.mindmap.maxNodeWidth,
@ -161127,10 +161127,10 @@ g.stateGroup line {
const config2 = getConfig$1(); const config2 = getConfig$1();
const node2 = nodes$1[nodes$1.length - 1]; const node2 = nodes$1[nodes$1.length - 1];
if (decoration.icon) { if (decoration.icon) {
node2.icon = sanitizeText$5(decoration.icon, config2); node2.icon = sanitizeText$6(decoration.icon, config2);
} }
if (decoration.class) { if (decoration.class) {
node2.class = sanitizeText$5(decoration.class, config2); node2.class = sanitizeText$6(decoration.class, config2);
} }
}; };
const type2Str = (type2) => { const type2Str = (type2) => {
@ -194890,7 +194890,9 @@ ${prefix}${Math.round(value2 * 100) / 100}${suffix}`;
const FILL_KEYWORD = "fill"; const FILL_KEYWORD = "fill";
const BG_FILL = "bgFill"; const BG_FILL = "bgFill";
const STYLECLASS_SEP = ","; const STYLECLASS_SEP = ",";
const config = getConfig$1();
let classes = {}; let classes = {};
const sanitizeText = (txt) => common$1.sanitizeText(txt, config);
const addStyleClass = function(id2, styleAttributes = "") { const addStyleClass = function(id2, styleAttributes = "") {
if (classes[id2] === void 0) { if (classes[id2] === void 0) {
classes[id2] = { id: id2, styles: [], textStyles: [] }; classes[id2] = { id: id2, styles: [], textStyles: [] };
@ -194932,6 +194934,9 @@ ${prefix}${Math.round(value2 * 100) / 100}${suffix}`;
const blockList = _blockList.flat(); const blockList = _blockList.flat();
const children2 = []; const children2 = [];
for (const block2 of blockList) { for (const block2 of blockList) {
if (block2.label) {
block2.label = sanitizeText(block2.label);
}
if (block2.type === "classDef") { if (block2.type === "classDef") {
addStyleClass(block2.id, block2.css); addStyleClass(block2.id, block2.css);
continue; continue;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,502 @@
import { V as H, W as at, C as lt, D as ct, s as ot, g as ht, b as ut, a as yt, E as ft, d as pt, c as et, l as it, X as gt, U as dt, Y as mt, k as _t } from "./mermaid-9f2aa176.js";
import { d as tt } from "./arc-d1f6357e.js";
import { o as xt } from "./ordinal-5695958c.js";
import { a as kt } from "./array-2ff2c7a6.js";
import { c as F } from "./path-428ebac9.js";
import "./init-f9637058.js";
function vt(e, u) {
return u < e ? -1 : u > e ? 1 : u >= e ? 0 : NaN;
}
function bt(e) {
return e;
}
function St() {
var e = bt, u = vt, E = null, p = F(0), g = F(H), A = F(0);
function y(a) {
var l, d = (a = kt(a)).length, m, I, $ = 0, _ = new Array(d), v = new Array(d), o = +p.apply(this, arguments), T = Math.min(H, Math.max(-H, g.apply(this, arguments) - o)), O, w = Math.min(Math.abs(T) / d, A.apply(this, arguments)), b = w * (T < 0 ? -1 : 1), t;
for (l = 0; l < d; ++l)
(t = v[_[l] = l] = +e(a[l], l, a)) > 0 && ($ += t);
for (u != null ? _.sort(function(i, n) {
return u(v[i], v[n]);
}) : E != null && _.sort(function(i, n) {
return E(a[i], a[n]);
}), l = 0, I = $ ? (T - d * b) / $ : 0; l < d; ++l, o = O)
m = _[l], t = v[m], O = o + (t > 0 ? t * I : 0) + b, v[m] = {
data: a[m],
index: l,
value: t,
startAngle: o,
endAngle: O,
padAngle: w
};
return v;
}
return y.value = function(a) {
return arguments.length ? (e = typeof a == "function" ? a : F(+a), y) : e;
}, y.sortValues = function(a) {
return arguments.length ? (u = a, E = null, y) : u;
}, y.sort = function(a) {
return arguments.length ? (E = a, u = null, y) : E;
}, y.startAngle = function(a) {
return arguments.length ? (p = typeof a == "function" ? a : F(+a), y) : p;
}, y.endAngle = function(a) {
return arguments.length ? (g = typeof a == "function" ? a : F(+a), y) : g;
}, y.padAngle = function(a) {
return arguments.length ? (A = typeof a == "function" ? a : F(+a), y) : A;
}, y;
}
var J = function() {
var e = function(b, t, i, n) {
for (i = i || {}, n = b.length; n--; i[b[n]] = t)
;
return i;
}, u = [1, 3], E = [1, 4], p = [1, 5], g = [1, 6], A = [1, 10, 12, 14, 16, 18, 19, 20, 21, 22], y = [2, 4], a = [1, 5, 10, 12, 14, 16, 18, 19, 20, 21, 22], l = [20, 21, 22], d = [2, 7], m = [1, 12], I = [1, 13], $ = [1, 14], _ = [1, 15], v = [1, 16], o = [1, 17], T = {
trace: function() {
},
yy: {},
symbols_: { error: 2, start: 3, eol: 4, PIE: 5, document: 6, showData: 7, line: 8, statement: 9, txt: 10, value: 11, title: 12, title_value: 13, acc_title: 14, acc_title_value: 15, acc_descr: 16, acc_descr_value: 17, acc_descr_multiline_value: 18, section: 19, NEWLINE: 20, ";": 21, EOF: 22, $accept: 0, $end: 1 },
terminals_: { 2: "error", 5: "PIE", 7: "showData", 10: "txt", 11: "value", 12: "title", 13: "title_value", 14: "acc_title", 15: "acc_title_value", 16: "acc_descr", 17: "acc_descr_value", 18: "acc_descr_multiline_value", 19: "section", 20: "NEWLINE", 21: ";", 22: "EOF" },
productions_: [0, [3, 2], [3, 2], [3, 3], [6, 0], [6, 2], [8, 2], [9, 0], [9, 2], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [4, 1], [4, 1], [4, 1]],
performAction: function(t, i, n, r, c, s, V) {
var x = s.length - 1;
switch (c) {
case 3:
r.setShowData(!0);
break;
case 6:
this.$ = s[x - 1];
break;
case 8:
r.addSection(s[x - 1], r.cleanupValue(s[x]));
break;
case 9:
this.$ = s[x].trim(), r.setDiagramTitle(this.$);
break;
case 10:
this.$ = s[x].trim(), r.setAccTitle(this.$);
break;
case 11:
case 12:
this.$ = s[x].trim(), r.setAccDescription(this.$);
break;
case 13:
r.addSection(s[x].substr(8)), this.$ = s[x].substr(8);
break;
}
},
table: [{ 3: 1, 4: 2, 5: u, 20: E, 21: p, 22: g }, { 1: [3] }, { 3: 7, 4: 2, 5: u, 20: E, 21: p, 22: g }, e(A, y, { 6: 8, 7: [1, 9] }), e(a, [2, 14]), e(a, [2, 15]), e(a, [2, 16]), { 1: [2, 1] }, e(l, d, { 8: 10, 9: 11, 1: [2, 2], 10: m, 12: I, 14: $, 16: _, 18: v, 19: o }), e(A, y, { 6: 18 }), e(A, [2, 5]), { 4: 19, 20: E, 21: p, 22: g }, { 11: [1, 20] }, { 13: [1, 21] }, { 15: [1, 22] }, { 17: [1, 23] }, e(l, [2, 12]), e(l, [2, 13]), e(l, d, { 8: 10, 9: 11, 1: [2, 3], 10: m, 12: I, 14: $, 16: _, 18: v, 19: o }), e(A, [2, 6]), e(l, [2, 8]), e(l, [2, 9]), e(l, [2, 10]), e(l, [2, 11])],
defaultActions: { 7: [2, 1] },
parseError: function(t, i) {
if (i.recoverable)
this.trace(t);
else {
var n = new Error(t);
throw n.hash = i, n;
}
},
parse: function(t) {
var i = this, n = [0], r = [], c = [null], s = [], V = this.table, x = "", f = 0, P = 0, R = 2, M = 1, Y = s.slice.call(arguments, 1), h = Object.create(this.lexer), N = { yy: {} };
for (var B in this.yy)
Object.prototype.hasOwnProperty.call(this.yy, B) && (N.yy[B] = this.yy[B]);
h.setInput(t, N.yy), N.yy.lexer = h, N.yy.parser = this, typeof h.yylloc > "u" && (h.yylloc = {});
var X = h.yylloc;
s.push(X);
var st = h.options && h.options.ranges;
typeof N.yy.parseError == "function" ? this.parseError = N.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
function rt() {
var C;
return C = r.pop() || h.lex() || M, typeof C != "number" && (C instanceof Array && (r = C, C = r.pop()), C = i.symbols_[C] || C), C;
}
for (var k, L, S, Z, z = {}, W, D, Q, j; ; ) {
if (L = n[n.length - 1], this.defaultActions[L] ? S = this.defaultActions[L] : ((k === null || typeof k > "u") && (k = rt()), S = V[L] && V[L][k]), typeof S > "u" || !S.length || !S[0]) {
var q = "";
j = [];
for (W in V[L])
this.terminals_[W] && W > R && j.push("'" + this.terminals_[W] + "'");
h.showPosition ? q = "Parse error on line " + (f + 1) + `:
` + h.showPosition() + `
Expecting ` + j.join(", ") + ", got '" + (this.terminals_[k] || k) + "'" : q = "Parse error on line " + (f + 1) + ": Unexpected " + (k == M ? "end of input" : "'" + (this.terminals_[k] || k) + "'"), this.parseError(q, {
text: h.match,
token: this.terminals_[k] || k,
line: h.yylineno,
loc: X,
expected: j
});
}
if (S[0] instanceof Array && S.length > 1)
throw new Error("Parse Error: multiple actions possible at state: " + L + ", token: " + k);
switch (S[0]) {
case 1:
n.push(k), c.push(h.yytext), s.push(h.yylloc), n.push(S[1]), k = null, P = h.yyleng, x = h.yytext, f = h.yylineno, X = h.yylloc;
break;
case 2:
if (D = this.productions_[S[1]][1], z.$ = c[c.length - D], z._$ = {
first_line: s[s.length - (D || 1)].first_line,
last_line: s[s.length - 1].last_line,
first_column: s[s.length - (D || 1)].first_column,
last_column: s[s.length - 1].last_column
}, st && (z._$.range = [
s[s.length - (D || 1)].range[0],
s[s.length - 1].range[1]
]), Z = this.performAction.apply(z, [
x,
P,
f,
N.yy,
S[1],
c,
s
].concat(Y)), typeof Z < "u")
return Z;
D && (n = n.slice(0, -1 * D * 2), c = c.slice(0, -1 * D), s = s.slice(0, -1 * D)), n.push(this.productions_[S[1]][0]), c.push(z.$), s.push(z._$), Q = V[n[n.length - 2]][n[n.length - 1]], n.push(Q);
break;
case 3:
return !0;
}
}
return !0;
}
}, O = function() {
var b = {
EOF: 1,
parseError: function(i, n) {
if (this.yy.parser)
this.yy.parser.parseError(i, n);
else
throw new Error(i);
},
// resets the lexer, sets new input
setInput: function(t, i) {
return this.yy = i || this.yy || {}, this._input = t, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
},
// consumes and returns one char from the input
input: function() {
var t = this._input[0];
this.yytext += t, this.yyleng++, this.offset++, this.match += t, this.matched += t;
var i = t.match(/(?:\r\n?|\n).*/g);
return i ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), t;
},
// unshifts one char (or a string) into the input
unput: function(t) {
var i = t.length, n = t.split(/(?:\r\n?|\n)/g);
this._input = t + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - i), this.offset -= i;
var r = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), n.length - 1 && (this.yylineno -= n.length - 1);
var c = this.yylloc.range;
return this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: n ? (n.length === r.length ? this.yylloc.first_column : 0) + r[r.length - n.length].length - n[0].length : this.yylloc.first_column - i
}, this.options.ranges && (this.yylloc.range = [c[0], c[0] + this.yyleng - i]), this.yyleng = this.yytext.length, this;
},
// When called from action, caches matched text and appends it on next action
more: function() {
return this._more = !0, this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject: function() {
if (this.options.backtrack_lexer)
this._backtrack = !0;
else
return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
return this;
},
// retain first n characters of the match
less: function(t) {
this.unput(this.match.slice(t));
},
// displays already matched input, i.e. for error messages
pastInput: function() {
var t = this.matched.substr(0, this.matched.length - this.match.length);
return (t.length > 20 ? "..." : "") + t.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput: function() {
var t = this.match;
return t.length < 20 && (t += this._input.substr(0, 20 - t.length)), (t.substr(0, 20) + (t.length > 20 ? "..." : "")).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition: function() {
var t = this.pastInput(), i = new Array(t.length + 1).join("-");
return t + this.upcomingInput() + `
` + i + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match: function(t, i) {
var n, r, c;
if (this.options.backtrack_lexer && (c = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
}, this.options.ranges && (c.yylloc.range = this.yylloc.range.slice(0))), r = t[0].match(/(?:\r\n?|\n).*/g), r && (this.yylineno += r.length), this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: r ? r[r.length - 1].length - r[r.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + t[0].length
}, this.yytext += t[0], this.match += t[0], this.matches = t, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(t[0].length), this.matched += t[0], n = this.performAction.call(this, this.yy, this, i, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), n)
return n;
if (this._backtrack) {
for (var s in c)
this[s] = c[s];
return !1;
}
return !1;
},
// return next match in input
next: function() {
if (this.done)
return this.EOF;
this._input || (this.done = !0);
var t, i, n, r;
this._more || (this.yytext = "", this.match = "");
for (var c = this._currentRules(), s = 0; s < c.length; s++)
if (n = this._input.match(this.rules[c[s]]), n && (!i || n[0].length > i[0].length)) {
if (i = n, r = s, this.options.backtrack_lexer) {
if (t = this.test_match(n, c[s]), t !== !1)
return t;
if (this._backtrack) {
i = !1;
continue;
} else
return !1;
} else if (!this.options.flex)
break;
}
return i ? (t = this.test_match(i, c[r]), t !== !1 ? t : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
},
// return next match that has a token
lex: function() {
var i = this.next();
return i || this.lex();
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin: function(i) {
this.conditionStack.push(i);
},
// pop the previously active lexer condition state off the condition stack
popState: function() {
var i = this.conditionStack.length - 1;
return i > 0 ? this.conditionStack.pop() : this.conditionStack[0];
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules: function() {
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState: function(i) {
return i = this.conditionStack.length - 1 - Math.abs(i || 0), i >= 0 ? this.conditionStack[i] : "INITIAL";
},
// alias for begin(condition)
pushState: function(i) {
this.begin(i);
},
// return the number of states currently on the stack
stateStackSize: function() {
return this.conditionStack.length;
},
options: { "case-insensitive": !0 },
performAction: function(i, n, r, c) {
switch (r) {
case 0:
break;
case 1:
break;
case 2:
return 20;
case 3:
break;
case 4:
break;
case 5:
return this.begin("title"), 12;
case 6:
return this.popState(), "title_value";
case 7:
return this.begin("acc_title"), 14;
case 8:
return this.popState(), "acc_title_value";
case 9:
return this.begin("acc_descr"), 16;
case 10:
return this.popState(), "acc_descr_value";
case 11:
this.begin("acc_descr_multiline");
break;
case 12:
this.popState();
break;
case 13:
return "acc_descr_multiline_value";
case 14:
this.begin("string");
break;
case 15:
this.popState();
break;
case 16:
return "txt";
case 17:
return 5;
case 18:
return 7;
case 19:
return "value";
case 20:
return 22;
}
},
rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:[\s]+)/i, /^(?:title\b)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:pie\b)/i, /^(?:showData\b)/i, /^(?::[\s]*[\d]+(?:\.[\d]+)?)/i, /^(?:$)/i],
conditions: { acc_descr_multiline: { rules: [12, 13], inclusive: !1 }, acc_descr: { rules: [10], inclusive: !1 }, acc_title: { rules: [8], inclusive: !1 }, title: { rules: [6], inclusive: !1 }, string: { rules: [15, 16], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 7, 9, 11, 14, 17, 18, 19, 20], inclusive: !0 } }
};
return b;
}();
T.lexer = O;
function w() {
this.yy = {};
}
return w.prototype = T, T.Parser = w, new w();
}();
J.parser = J;
const Et = J, nt = at.pie, G = {
sections: {},
showData: !1,
config: nt
};
let U = G.sections, K = G.showData;
const At = structuredClone(nt), wt = () => structuredClone(At), $t = () => {
U = structuredClone(G.sections), K = G.showData, ft();
}, Tt = (e, u) => {
e = pt(e, et()), U[e] === void 0 && (U[e] = u, it.debug(`added new section: ${e}, with value: ${u}`));
}, It = () => U, Dt = (e) => (e.substring(0, 1) === ":" && (e = e.substring(1).trim()), Number(e.trim())), Ct = (e) => {
K = e;
}, Ot = () => K, Vt = {
getConfig: wt,
clear: $t,
setDiagramTitle: lt,
getDiagramTitle: ct,
setAccTitle: ot,
getAccTitle: ht,
setAccDescription: ut,
getAccDescription: yt,
addSection: Tt,
getSections: It,
cleanupValue: Dt,
setShowData: Ct,
getShowData: Ot
}, Pt = (e) => `
.pieCircle{
stroke: ${e.pieStrokeColor};
stroke-width : ${e.pieStrokeWidth};
opacity : ${e.pieOpacity};
}
.pieOuterCircle{
stroke: ${e.pieOuterStrokeColor};
stroke-width: ${e.pieOuterStrokeWidth};
fill: none;
}
.pieTitleText {
text-anchor: middle;
font-size: ${e.pieTitleTextSize};
fill: ${e.pieTitleTextColor};
font-family: ${e.fontFamily};
}
.slice {
font-family: ${e.fontFamily};
fill: ${e.pieSectionTextColor};
font-size:${e.pieSectionTextSize};
// fill: white;
}
.legend text {
fill: ${e.pieLegendTextColor};
font-family: ${e.fontFamily};
font-size: ${e.pieLegendTextSize};
}
`, Nt = Pt, Lt = (e) => {
const u = Object.entries(e).map((p) => ({
label: p[0],
value: p[1]
})).sort((p, g) => g.value - p.value);
return St().value(
(p) => p.value
)(u);
}, Ft = (e, u, E, p) => {
it.debug(`rendering pie chart
` + e);
const g = p.db, A = et(), y = gt(g.getConfig(), A.pie), a = 40, l = 18, d = 4, m = 450, I = m, $ = dt(u), _ = $.append("g"), v = g.getSections();
_.attr("transform", "translate(" + I / 2 + "," + m / 2 + ")");
const { themeVariables: o } = A;
let [T] = mt(o.pieOuterStrokeWidth);
T ?? (T = 2);
const O = y.textPosition, w = Math.min(I, m) / 2 - a, b = tt().innerRadius(0).outerRadius(w), t = tt().innerRadius(w * O).outerRadius(w * O);
_.append("circle").attr("cx", 0).attr("cy", 0).attr("r", w + T / 2).attr("class", "pieOuterCircle");
const i = Lt(v), n = [
o.pie1,
o.pie2,
o.pie3,
o.pie4,
o.pie5,
o.pie6,
o.pie7,
o.pie8,
o.pie9,
o.pie10,
o.pie11,
o.pie12
], r = xt(n);
_.selectAll("mySlices").data(i).enter().append("path").attr("d", b).attr("fill", (f) => r(f.data.label)).attr("class", "pieCircle");
let c = 0;
Object.keys(v).forEach((f) => {
c += v[f];
}), _.selectAll("mySlices").data(i).enter().append("text").text((f) => (f.data.value / c * 100).toFixed(0) + "%").attr("transform", (f) => "translate(" + t.centroid(f) + ")").style("text-anchor", "middle").attr("class", "slice"), _.append("text").text(g.getDiagramTitle()).attr("x", 0).attr("y", -(m - 50) / 2).attr("class", "pieTitleText");
const s = _.selectAll(".legend").data(r.domain()).enter().append("g").attr("class", "legend").attr("transform", (f, P) => {
const R = l + d, M = R * r.domain().length / 2, Y = 12 * l, h = P * R - M;
return "translate(" + Y + "," + h + ")";
});
s.append("rect").attr("width", l).attr("height", l).style("fill", r).style("stroke", r), s.data(i).append("text").attr("x", l + d).attr("y", l - d).text((f) => {
const { label: P, value: R } = f.data;
return g.getShowData() ? `${P} [${R}]` : P;
});
const V = Math.max(
...s.selectAll("text").nodes().map((f) => (f == null ? void 0 : f.getBoundingClientRect().width) ?? 0)
), x = I + a + l + d + V;
$.attr("viewBox", `0 0 ${x} ${m}`), _t($, m, x, y.useMaxWidth);
}, Rt = { draw: Ft }, Yt = {
parser: Et,
db: Vt,
renderer: Rt,
styles: Nt
};
export {
Yt as diagram
};

View file

@ -0,0 +1,722 @@
import { B as defaultConfig, q as setDiagramTitle, t as getDiagramTitle, s as setAccTitle, g as getAccTitle, b as setAccDescription, a as getAccDescription, v as clear$1, d as sanitizeText, c as getConfig$1, l as log, C as cleanAndMerge, A as selectSvgElement, D as parseFontSize, i as configureSvgSize } from "./mermaid-6dc72991.js";
import { arc, scaleOrdinal, pie } from "d3";
import "ts-dedent";
import "dayjs";
import "@braintree/sanitize-url";
import "dompurify";
import "khroma";
import "lodash-es/memoize.js";
import "lodash-es/merge.js";
import "stylis";
import "lodash-es/isEmpty.js";
var parser = function() {
var o = function(k, v, o2, l) {
for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
;
return o2;
}, $V0 = [1, 3], $V1 = [1, 4], $V2 = [1, 5], $V3 = [1, 6], $V4 = [1, 10, 12, 14, 16, 18, 19, 20, 21, 22], $V5 = [2, 4], $V6 = [1, 5, 10, 12, 14, 16, 18, 19, 20, 21, 22], $V7 = [20, 21, 22], $V8 = [2, 7], $V9 = [1, 12], $Va = [1, 13], $Vb = [1, 14], $Vc = [1, 15], $Vd = [1, 16], $Ve = [1, 17];
var parser2 = {
trace: function trace() {
},
yy: {},
symbols_: { "error": 2, "start": 3, "eol": 4, "PIE": 5, "document": 6, "showData": 7, "line": 8, "statement": 9, "txt": 10, "value": 11, "title": 12, "title_value": 13, "acc_title": 14, "acc_title_value": 15, "acc_descr": 16, "acc_descr_value": 17, "acc_descr_multiline_value": 18, "section": 19, "NEWLINE": 20, ";": 21, "EOF": 22, "$accept": 0, "$end": 1 },
terminals_: { 2: "error", 5: "PIE", 7: "showData", 10: "txt", 11: "value", 12: "title", 13: "title_value", 14: "acc_title", 15: "acc_title_value", 16: "acc_descr", 17: "acc_descr_value", 18: "acc_descr_multiline_value", 19: "section", 20: "NEWLINE", 21: ";", 22: "EOF" },
productions_: [0, [3, 2], [3, 2], [3, 3], [6, 0], [6, 2], [8, 2], [9, 0], [9, 2], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [4, 1], [4, 1], [4, 1]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
var $0 = $$.length - 1;
switch (yystate) {
case 3:
yy.setShowData(true);
break;
case 6:
this.$ = $$[$0 - 1];
break;
case 8:
yy.addSection($$[$0 - 1], yy.cleanupValue($$[$0]));
break;
case 9:
this.$ = $$[$0].trim();
yy.setDiagramTitle(this.$);
break;
case 10:
this.$ = $$[$0].trim();
yy.setAccTitle(this.$);
break;
case 11:
case 12:
this.$ = $$[$0].trim();
yy.setAccDescription(this.$);
break;
case 13:
yy.addSection($$[$0].substr(8));
this.$ = $$[$0].substr(8);
break;
}
},
table: [{ 3: 1, 4: 2, 5: $V0, 20: $V1, 21: $V2, 22: $V3 }, { 1: [3] }, { 3: 7, 4: 2, 5: $V0, 20: $V1, 21: $V2, 22: $V3 }, o($V4, $V5, { 6: 8, 7: [1, 9] }), o($V6, [2, 14]), o($V6, [2, 15]), o($V6, [2, 16]), { 1: [2, 1] }, o($V7, $V8, { 8: 10, 9: 11, 1: [2, 2], 10: $V9, 12: $Va, 14: $Vb, 16: $Vc, 18: $Vd, 19: $Ve }), o($V4, $V5, { 6: 18 }), o($V4, [2, 5]), { 4: 19, 20: $V1, 21: $V2, 22: $V3 }, { 11: [1, 20] }, { 13: [1, 21] }, { 15: [1, 22] }, { 17: [1, 23] }, o($V7, [2, 12]), o($V7, [2, 13]), o($V7, $V8, { 8: 10, 9: 11, 1: [2, 3], 10: $V9, 12: $Va, 14: $Vb, 16: $Vc, 18: $Vd, 19: $Ve }), o($V4, [2, 6]), o($V7, [2, 8]), o($V7, [2, 9]), o($V7, [2, 10]), o($V7, [2, 11])],
defaultActions: { 7: [2, 1] },
parseError: function parseError(str, hash) {
if (hash.recoverable) {
this.trace(str);
} else {
var error = new Error(str);
error.hash = hash;
throw error;
}
},
parse: function parse(input) {
var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
var args = lstack.slice.call(arguments, 1);
var lexer2 = Object.create(this.lexer);
var sharedState = { yy: {} };
for (var k in this.yy) {
if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
sharedState.yy[k] = this.yy[k];
}
}
lexer2.setInput(input, sharedState.yy);
sharedState.yy.lexer = lexer2;
sharedState.yy.parser = this;
if (typeof lexer2.yylloc == "undefined") {
lexer2.yylloc = {};
}
var yyloc = lexer2.yylloc;
lstack.push(yyloc);
var ranges = lexer2.options && lexer2.options.ranges;
if (typeof sharedState.yy.parseError === "function") {
this.parseError = sharedState.yy.parseError;
} else {
this.parseError = Object.getPrototypeOf(this).parseError;
}
function lex() {
var token;
token = tstack.pop() || lexer2.lex() || EOF;
if (typeof token !== "number") {
if (token instanceof Array) {
tstack = token;
token = tstack.pop();
}
token = self.symbols_[token] || token;
}
return token;
}
var symbol, state, action, r, yyval = {}, p, len, newState, expected;
while (true) {
state = stack[stack.length - 1];
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || typeof symbol == "undefined") {
symbol = lex();
}
action = table[state] && table[state][symbol];
}
if (typeof action === "undefined" || !action.length || !action[0]) {
var errStr = "";
expected = [];
for (p in table[state]) {
if (this.terminals_[p] && p > TERROR) {
expected.push("'" + this.terminals_[p] + "'");
}
}
if (lexer2.showPosition) {
errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
} else {
errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
}
this.parseError(errStr, {
text: lexer2.match,
token: this.terminals_[symbol] || symbol,
line: lexer2.yylineno,
loc: yyloc,
expected
});
}
if (action[0] instanceof Array && action.length > 1) {
throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
}
switch (action[0]) {
case 1:
stack.push(symbol);
vstack.push(lexer2.yytext);
lstack.push(lexer2.yylloc);
stack.push(action[1]);
symbol = null;
{
yyleng = lexer2.yyleng;
yytext = lexer2.yytext;
yylineno = lexer2.yylineno;
yyloc = lexer2.yylloc;
}
break;
case 2:
len = this.productions_[action[1]][1];
yyval.$ = vstack[vstack.length - len];
yyval._$ = {
first_line: lstack[lstack.length - (len || 1)].first_line,
last_line: lstack[lstack.length - 1].last_line,
first_column: lstack[lstack.length - (len || 1)].first_column,
last_column: lstack[lstack.length - 1].last_column
};
if (ranges) {
yyval._$.range = [
lstack[lstack.length - (len || 1)].range[0],
lstack[lstack.length - 1].range[1]
];
}
r = this.performAction.apply(yyval, [
yytext,
yyleng,
yylineno,
sharedState.yy,
action[1],
vstack,
lstack
].concat(args));
if (typeof r !== "undefined") {
return r;
}
if (len) {
stack = stack.slice(0, -1 * len * 2);
vstack = vstack.slice(0, -1 * len);
lstack = lstack.slice(0, -1 * len);
}
stack.push(this.productions_[action[1]][0]);
vstack.push(yyval.$);
lstack.push(yyval._$);
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
stack.push(newState);
break;
case 3:
return true;
}
}
return true;
}
};
var lexer = function() {
var lexer2 = {
EOF: 1,
parseError: function parseError(str, hash) {
if (this.yy.parser) {
this.yy.parser.parseError(str, hash);
} else {
throw new Error(str);
}
},
// resets the lexer, sets new input
setInput: function(input, yy) {
this.yy = yy || this.yy || {};
this._input = input;
this._more = this._backtrack = this.done = false;
this.yylineno = this.yyleng = 0;
this.yytext = this.matched = this.match = "";
this.conditionStack = ["INITIAL"];
this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
};
if (this.options.ranges) {
this.yylloc.range = [0, 0];
}
this.offset = 0;
return this;
},
// consumes and returns one char from the input
input: function() {
var ch = this._input[0];
this.yytext += ch;
this.yyleng++;
this.offset++;
this.match += ch;
this.matched += ch;
var lines = ch.match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno++;
this.yylloc.last_line++;
} else {
this.yylloc.last_column++;
}
if (this.options.ranges) {
this.yylloc.range[1]++;
}
this._input = this._input.slice(1);
return ch;
},
// unshifts one char (or a string) into the input
unput: function(ch) {
var len = ch.length;
var lines = ch.split(/(?:\r\n?|\n)/g);
this._input = ch + this._input;
this.yytext = this.yytext.substr(0, this.yytext.length - len);
this.offset -= len;
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1);
this.matched = this.matched.substr(0, this.matched.length - 1);
if (lines.length - 1) {
this.yylineno -= lines.length - 1;
}
var r = this.yylloc.range;
this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
};
if (this.options.ranges) {
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
}
this.yyleng = this.yytext.length;
return this;
},
// When called from action, caches matched text and appends it on next action
more: function() {
this._more = true;
return this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject: function() {
if (this.options.backtrack_lexer) {
this._backtrack = true;
} else {
return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
return this;
},
// retain first n characters of the match
less: function(n) {
this.unput(this.match.slice(n));
},
// displays already matched input, i.e. for error messages
pastInput: function() {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput: function() {
var next = this.match;
if (next.length < 20) {
next += this._input.substr(0, 20 - next.length);
}
return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition: function() {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match: function(match, indexed_rule) {
var token, lines, backup;
if (this.options.backtrack_lexer) {
backup = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
};
if (this.options.ranges) {
backup.yylloc.range = this.yylloc.range.slice(0);
}
}
lines = match[0].match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno += lines.length;
}
this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
};
this.yytext += match[0];
this.match += match[0];
this.matches = match;
this.yyleng = this.yytext.length;
if (this.options.ranges) {
this.yylloc.range = [this.offset, this.offset += this.yyleng];
}
this._more = false;
this._backtrack = false;
this._input = this._input.slice(match[0].length);
this.matched += match[0];
token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
if (this.done && this._input) {
this.done = false;
}
if (token) {
return token;
} else if (this._backtrack) {
for (var k in backup) {
this[k] = backup[k];
}
return false;
}
return false;
},
// return next match in input
next: function() {
if (this.done) {
return this.EOF;
}
if (!this._input) {
this.done = true;
}
var token, match, tempMatch, index;
if (!this._more) {
this.yytext = "";
this.match = "";
}
var rules = this._currentRules();
for (var i = 0; i < rules.length; i++) {
tempMatch = this._input.match(this.rules[rules[i]]);
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
match = tempMatch;
index = i;
if (this.options.backtrack_lexer) {
token = this.test_match(tempMatch, rules[i]);
if (token !== false) {
return token;
} else if (this._backtrack) {
match = false;
continue;
} else {
return false;
}
} else if (!this.options.flex) {
break;
}
}
}
if (match) {
token = this.test_match(match, rules[index]);
if (token !== false) {
return token;
}
return false;
}
if (this._input === "") {
return this.EOF;
} else {
return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
},
// return next match that has a token
lex: function lex() {
var r = this.next();
if (r) {
return r;
} else {
return this.lex();
}
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin: function begin(condition) {
this.conditionStack.push(condition);
},
// pop the previously active lexer condition state off the condition stack
popState: function popState() {
var n = this.conditionStack.length - 1;
if (n > 0) {
return this.conditionStack.pop();
} else {
return this.conditionStack[0];
}
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules: function _currentRules() {
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
} else {
return this.conditions["INITIAL"].rules;
}
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState: function topState(n) {
n = this.conditionStack.length - 1 - Math.abs(n || 0);
if (n >= 0) {
return this.conditionStack[n];
} else {
return "INITIAL";
}
},
// alias for begin(condition)
pushState: function pushState(condition) {
this.begin(condition);
},
// return the number of states currently on the stack
stateStackSize: function stateStackSize() {
return this.conditionStack.length;
},
options: { "case-insensitive": true },
performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
switch ($avoiding_name_collisions) {
case 0:
break;
case 1:
break;
case 2:
return 20;
case 3:
break;
case 4:
break;
case 5:
this.begin("title");
return 12;
case 6:
this.popState();
return "title_value";
case 7:
this.begin("acc_title");
return 14;
case 8:
this.popState();
return "acc_title_value";
case 9:
this.begin("acc_descr");
return 16;
case 10:
this.popState();
return "acc_descr_value";
case 11:
this.begin("acc_descr_multiline");
break;
case 12:
this.popState();
break;
case 13:
return "acc_descr_multiline_value";
case 14:
this.begin("string");
break;
case 15:
this.popState();
break;
case 16:
return "txt";
case 17:
return 5;
case 18:
return 7;
case 19:
return "value";
case 20:
return 22;
}
},
rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:[\s]+)/i, /^(?:title\b)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:pie\b)/i, /^(?:showData\b)/i, /^(?::[\s]*[\d]+(?:\.[\d]+)?)/i, /^(?:$)/i],
conditions: { "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "title": { "rules": [6], "inclusive": false }, "string": { "rules": [15, 16], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 7, 9, 11, 14, 17, 18, 19, 20], "inclusive": true } }
};
return lexer2;
}();
parser2.lexer = lexer;
function Parser() {
this.yy = {};
}
Parser.prototype = parser2;
parser2.Parser = Parser;
return new Parser();
}();
parser.parser = parser;
const parser$1 = parser;
const DEFAULT_PIE_CONFIG = defaultConfig.pie;
const DEFAULT_PIE_DB = {
sections: {},
showData: false,
config: DEFAULT_PIE_CONFIG
};
let sections = DEFAULT_PIE_DB.sections;
let showData = DEFAULT_PIE_DB.showData;
const config = structuredClone(DEFAULT_PIE_CONFIG);
const getConfig = () => structuredClone(config);
const clear = () => {
sections = structuredClone(DEFAULT_PIE_DB.sections);
showData = DEFAULT_PIE_DB.showData;
clear$1();
};
const addSection = (label, value) => {
label = sanitizeText(label, getConfig$1());
if (sections[label] === void 0) {
sections[label] = value;
log.debug(`added new section: ${label}, with value: ${value}`);
}
};
const getSections = () => sections;
const cleanupValue = (value) => {
if (value.substring(0, 1) === ":") {
value = value.substring(1).trim();
}
return Number(value.trim());
};
const setShowData = (toggle) => {
showData = toggle;
};
const getShowData = () => showData;
const db = {
getConfig,
clear,
setDiagramTitle,
getDiagramTitle,
setAccTitle,
getAccTitle,
setAccDescription,
getAccDescription,
addSection,
getSections,
cleanupValue,
setShowData,
getShowData
};
const getStyles = (options) => `
.pieCircle{
stroke: ${options.pieStrokeColor};
stroke-width : ${options.pieStrokeWidth};
opacity : ${options.pieOpacity};
}
.pieOuterCircle{
stroke: ${options.pieOuterStrokeColor};
stroke-width: ${options.pieOuterStrokeWidth};
fill: none;
}
.pieTitleText {
text-anchor: middle;
font-size: ${options.pieTitleTextSize};
fill: ${options.pieTitleTextColor};
font-family: ${options.fontFamily};
}
.slice {
font-family: ${options.fontFamily};
fill: ${options.pieSectionTextColor};
font-size:${options.pieSectionTextSize};
// fill: white;
}
.legend text {
fill: ${options.pieLegendTextColor};
font-family: ${options.fontFamily};
font-size: ${options.pieLegendTextSize};
}
`;
const styles = getStyles;
const createPieArcs = (sections2) => {
const pieData = Object.entries(sections2).map((element) => {
return {
label: element[0],
value: element[1]
};
}).sort((a, b) => {
return b.value - a.value;
});
const pie$1 = pie().value(
(d3Section) => d3Section.value
);
return pie$1(pieData);
};
const draw = (text, id, _version, diagObj) => {
log.debug("rendering pie chart\n" + text);
const db2 = diagObj.db;
const globalConfig = getConfig$1();
const pieConfig = cleanAndMerge(db2.getConfig(), globalConfig.pie);
const MARGIN = 40;
const LEGEND_RECT_SIZE = 18;
const LEGEND_SPACING = 4;
const height = 450;
const pieWidth = height;
const svg = selectSvgElement(id);
const group = svg.append("g");
const sections2 = db2.getSections();
group.attr("transform", "translate(" + pieWidth / 2 + "," + height / 2 + ")");
const { themeVariables } = globalConfig;
let [outerStrokeWidth] = parseFontSize(themeVariables.pieOuterStrokeWidth);
outerStrokeWidth ?? (outerStrokeWidth = 2);
const textPosition = pieConfig.textPosition;
const radius = Math.min(pieWidth, height) / 2 - MARGIN;
const arcGenerator = arc().innerRadius(0).outerRadius(radius);
const labelArcGenerator = arc().innerRadius(radius * textPosition).outerRadius(radius * textPosition);
group.append("circle").attr("cx", 0).attr("cy", 0).attr("r", radius + outerStrokeWidth / 2).attr("class", "pieOuterCircle");
const arcs = createPieArcs(sections2);
const myGeneratedColors = [
themeVariables.pie1,
themeVariables.pie2,
themeVariables.pie3,
themeVariables.pie4,
themeVariables.pie5,
themeVariables.pie6,
themeVariables.pie7,
themeVariables.pie8,
themeVariables.pie9,
themeVariables.pie10,
themeVariables.pie11,
themeVariables.pie12
];
const color = scaleOrdinal(myGeneratedColors);
group.selectAll("mySlices").data(arcs).enter().append("path").attr("d", arcGenerator).attr("fill", (datum) => {
return color(datum.data.label);
}).attr("class", "pieCircle");
let sum = 0;
Object.keys(sections2).forEach((key) => {
sum += sections2[key];
});
group.selectAll("mySlices").data(arcs).enter().append("text").text((datum) => {
return (datum.data.value / sum * 100).toFixed(0) + "%";
}).attr("transform", (datum) => {
return "translate(" + labelArcGenerator.centroid(datum) + ")";
}).style("text-anchor", "middle").attr("class", "slice");
group.append("text").text(db2.getDiagramTitle()).attr("x", 0).attr("y", -(height - 50) / 2).attr("class", "pieTitleText");
const legend = group.selectAll(".legend").data(color.domain()).enter().append("g").attr("class", "legend").attr("transform", (_datum, index) => {
const height2 = LEGEND_RECT_SIZE + LEGEND_SPACING;
const offset = height2 * color.domain().length / 2;
const horizontal = 12 * LEGEND_RECT_SIZE;
const vertical = index * height2 - offset;
return "translate(" + horizontal + "," + vertical + ")";
});
legend.append("rect").attr("width", LEGEND_RECT_SIZE).attr("height", LEGEND_RECT_SIZE).style("fill", color).style("stroke", color);
legend.data(arcs).append("text").attr("x", LEGEND_RECT_SIZE + LEGEND_SPACING).attr("y", LEGEND_RECT_SIZE - LEGEND_SPACING).text((datum) => {
const { label, value } = datum.data;
if (db2.getShowData()) {
return `${label} [${value}]`;
}
return label;
});
const longestTextWidth = Math.max(
...legend.selectAll("text").nodes().map((node) => (node == null ? void 0 : node.getBoundingClientRect().width) ?? 0)
);
const totalWidth = pieWidth + MARGIN + LEGEND_RECT_SIZE + LEGEND_SPACING + longestTextWidth;
svg.attr("viewBox", `0 0 ${totalWidth} ${height}`);
configureSvgSize(svg, height, totalWidth, pieConfig.useMaxWidth);
};
const renderer = { draw };
const diagram = {
parser: parser$1,
db,
renderer,
styles
};
export {
diagram
};

View file

@ -0,0 +1,772 @@
import { V as tau, W as defaultConfig, C as setDiagramTitle, D as getDiagramTitle, s as setAccTitle, g as getAccTitle, b as setAccDescription, a as getAccDescription, E as clear$1, d as sanitizeText, c as getConfig$1, l as log, X as cleanAndMerge, U as selectSvgElement, Y as parseFontSize, k as configureSvgSize } from "./mermaid-dcacb631.js";
import { d as d3arc } from "./arc-c0f908ab.js";
import { o as ordinal } from "./ordinal-475e0c0c.js";
import { a as array } from "./array-b7dcf730.js";
import { c as constant } from "./path-39bad7e2.js";
import "./init-cc95ec8e.js";
function descending(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
}
function identity(d) {
return d;
}
function d3pie() {
var value = identity, sortValues = descending, sort = null, startAngle = constant(0), endAngle = constant(tau), padAngle = constant(0);
function pie(data) {
var i, n = (data = array(data)).length, j, k, sum = 0, index = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), a1, p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1), v;
for (i = 0; i < n; ++i) {
if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {
sum += v;
}
}
if (sortValues != null)
index.sort(function(i2, j2) {
return sortValues(arcs[i2], arcs[j2]);
});
else if (sort != null)
index.sort(function(i2, j2) {
return sort(data[i2], data[j2]);
});
for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {
j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
data: data[j],
index: i,
value: v,
startAngle: a0,
endAngle: a1,
padAngle: p
};
}
return arcs;
}
pie.value = function(_) {
return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie) : value;
};
pie.sortValues = function(_) {
return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
};
pie.sort = function(_) {
return arguments.length ? (sort = _, sortValues = null, pie) : sort;
};
pie.startAngle = function(_) {
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie) : startAngle;
};
pie.endAngle = function(_) {
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie) : endAngle;
};
pie.padAngle = function(_) {
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie) : padAngle;
};
return pie;
}
var parser = function() {
var o = function(k, v, o2, l) {
for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
;
return o2;
}, $V0 = [1, 3], $V1 = [1, 4], $V2 = [1, 5], $V3 = [1, 6], $V4 = [1, 10, 12, 14, 16, 18, 19, 20, 21, 22], $V5 = [2, 4], $V6 = [1, 5, 10, 12, 14, 16, 18, 19, 20, 21, 22], $V7 = [20, 21, 22], $V8 = [2, 7], $V9 = [1, 12], $Va = [1, 13], $Vb = [1, 14], $Vc = [1, 15], $Vd = [1, 16], $Ve = [1, 17];
var parser2 = {
trace: function trace() {
},
yy: {},
symbols_: { "error": 2, "start": 3, "eol": 4, "PIE": 5, "document": 6, "showData": 7, "line": 8, "statement": 9, "txt": 10, "value": 11, "title": 12, "title_value": 13, "acc_title": 14, "acc_title_value": 15, "acc_descr": 16, "acc_descr_value": 17, "acc_descr_multiline_value": 18, "section": 19, "NEWLINE": 20, ";": 21, "EOF": 22, "$accept": 0, "$end": 1 },
terminals_: { 2: "error", 5: "PIE", 7: "showData", 10: "txt", 11: "value", 12: "title", 13: "title_value", 14: "acc_title", 15: "acc_title_value", 16: "acc_descr", 17: "acc_descr_value", 18: "acc_descr_multiline_value", 19: "section", 20: "NEWLINE", 21: ";", 22: "EOF" },
productions_: [0, [3, 2], [3, 2], [3, 3], [6, 0], [6, 2], [8, 2], [9, 0], [9, 2], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [4, 1], [4, 1], [4, 1]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
var $0 = $$.length - 1;
switch (yystate) {
case 3:
yy.setShowData(true);
break;
case 6:
this.$ = $$[$0 - 1];
break;
case 8:
yy.addSection($$[$0 - 1], yy.cleanupValue($$[$0]));
break;
case 9:
this.$ = $$[$0].trim();
yy.setDiagramTitle(this.$);
break;
case 10:
this.$ = $$[$0].trim();
yy.setAccTitle(this.$);
break;
case 11:
case 12:
this.$ = $$[$0].trim();
yy.setAccDescription(this.$);
break;
case 13:
yy.addSection($$[$0].substr(8));
this.$ = $$[$0].substr(8);
break;
}
},
table: [{ 3: 1, 4: 2, 5: $V0, 20: $V1, 21: $V2, 22: $V3 }, { 1: [3] }, { 3: 7, 4: 2, 5: $V0, 20: $V1, 21: $V2, 22: $V3 }, o($V4, $V5, { 6: 8, 7: [1, 9] }), o($V6, [2, 14]), o($V6, [2, 15]), o($V6, [2, 16]), { 1: [2, 1] }, o($V7, $V8, { 8: 10, 9: 11, 1: [2, 2], 10: $V9, 12: $Va, 14: $Vb, 16: $Vc, 18: $Vd, 19: $Ve }), o($V4, $V5, { 6: 18 }), o($V4, [2, 5]), { 4: 19, 20: $V1, 21: $V2, 22: $V3 }, { 11: [1, 20] }, { 13: [1, 21] }, { 15: [1, 22] }, { 17: [1, 23] }, o($V7, [2, 12]), o($V7, [2, 13]), o($V7, $V8, { 8: 10, 9: 11, 1: [2, 3], 10: $V9, 12: $Va, 14: $Vb, 16: $Vc, 18: $Vd, 19: $Ve }), o($V4, [2, 6]), o($V7, [2, 8]), o($V7, [2, 9]), o($V7, [2, 10]), o($V7, [2, 11])],
defaultActions: { 7: [2, 1] },
parseError: function parseError(str, hash) {
if (hash.recoverable) {
this.trace(str);
} else {
var error = new Error(str);
error.hash = hash;
throw error;
}
},
parse: function parse(input) {
var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
var args = lstack.slice.call(arguments, 1);
var lexer2 = Object.create(this.lexer);
var sharedState = { yy: {} };
for (var k in this.yy) {
if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
sharedState.yy[k] = this.yy[k];
}
}
lexer2.setInput(input, sharedState.yy);
sharedState.yy.lexer = lexer2;
sharedState.yy.parser = this;
if (typeof lexer2.yylloc == "undefined") {
lexer2.yylloc = {};
}
var yyloc = lexer2.yylloc;
lstack.push(yyloc);
var ranges = lexer2.options && lexer2.options.ranges;
if (typeof sharedState.yy.parseError === "function") {
this.parseError = sharedState.yy.parseError;
} else {
this.parseError = Object.getPrototypeOf(this).parseError;
}
function lex() {
var token;
token = tstack.pop() || lexer2.lex() || EOF;
if (typeof token !== "number") {
if (token instanceof Array) {
tstack = token;
token = tstack.pop();
}
token = self.symbols_[token] || token;
}
return token;
}
var symbol, state, action, r, yyval = {}, p, len, newState, expected;
while (true) {
state = stack[stack.length - 1];
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || typeof symbol == "undefined") {
symbol = lex();
}
action = table[state] && table[state][symbol];
}
if (typeof action === "undefined" || !action.length || !action[0]) {
var errStr = "";
expected = [];
for (p in table[state]) {
if (this.terminals_[p] && p > TERROR) {
expected.push("'" + this.terminals_[p] + "'");
}
}
if (lexer2.showPosition) {
errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
} else {
errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
}
this.parseError(errStr, {
text: lexer2.match,
token: this.terminals_[symbol] || symbol,
line: lexer2.yylineno,
loc: yyloc,
expected
});
}
if (action[0] instanceof Array && action.length > 1) {
throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
}
switch (action[0]) {
case 1:
stack.push(symbol);
vstack.push(lexer2.yytext);
lstack.push(lexer2.yylloc);
stack.push(action[1]);
symbol = null;
{
yyleng = lexer2.yyleng;
yytext = lexer2.yytext;
yylineno = lexer2.yylineno;
yyloc = lexer2.yylloc;
}
break;
case 2:
len = this.productions_[action[1]][1];
yyval.$ = vstack[vstack.length - len];
yyval._$ = {
first_line: lstack[lstack.length - (len || 1)].first_line,
last_line: lstack[lstack.length - 1].last_line,
first_column: lstack[lstack.length - (len || 1)].first_column,
last_column: lstack[lstack.length - 1].last_column
};
if (ranges) {
yyval._$.range = [
lstack[lstack.length - (len || 1)].range[0],
lstack[lstack.length - 1].range[1]
];
}
r = this.performAction.apply(yyval, [
yytext,
yyleng,
yylineno,
sharedState.yy,
action[1],
vstack,
lstack
].concat(args));
if (typeof r !== "undefined") {
return r;
}
if (len) {
stack = stack.slice(0, -1 * len * 2);
vstack = vstack.slice(0, -1 * len);
lstack = lstack.slice(0, -1 * len);
}
stack.push(this.productions_[action[1]][0]);
vstack.push(yyval.$);
lstack.push(yyval._$);
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
stack.push(newState);
break;
case 3:
return true;
}
}
return true;
}
};
var lexer = function() {
var lexer2 = {
EOF: 1,
parseError: function parseError(str, hash) {
if (this.yy.parser) {
this.yy.parser.parseError(str, hash);
} else {
throw new Error(str);
}
},
// resets the lexer, sets new input
setInput: function(input, yy) {
this.yy = yy || this.yy || {};
this._input = input;
this._more = this._backtrack = this.done = false;
this.yylineno = this.yyleng = 0;
this.yytext = this.matched = this.match = "";
this.conditionStack = ["INITIAL"];
this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
};
if (this.options.ranges) {
this.yylloc.range = [0, 0];
}
this.offset = 0;
return this;
},
// consumes and returns one char from the input
input: function() {
var ch = this._input[0];
this.yytext += ch;
this.yyleng++;
this.offset++;
this.match += ch;
this.matched += ch;
var lines = ch.match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno++;
this.yylloc.last_line++;
} else {
this.yylloc.last_column++;
}
if (this.options.ranges) {
this.yylloc.range[1]++;
}
this._input = this._input.slice(1);
return ch;
},
// unshifts one char (or a string) into the input
unput: function(ch) {
var len = ch.length;
var lines = ch.split(/(?:\r\n?|\n)/g);
this._input = ch + this._input;
this.yytext = this.yytext.substr(0, this.yytext.length - len);
this.offset -= len;
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1);
this.matched = this.matched.substr(0, this.matched.length - 1);
if (lines.length - 1) {
this.yylineno -= lines.length - 1;
}
var r = this.yylloc.range;
this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
};
if (this.options.ranges) {
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
}
this.yyleng = this.yytext.length;
return this;
},
// When called from action, caches matched text and appends it on next action
more: function() {
this._more = true;
return this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject: function() {
if (this.options.backtrack_lexer) {
this._backtrack = true;
} else {
return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
return this;
},
// retain first n characters of the match
less: function(n) {
this.unput(this.match.slice(n));
},
// displays already matched input, i.e. for error messages
pastInput: function() {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput: function() {
var next = this.match;
if (next.length < 20) {
next += this._input.substr(0, 20 - next.length);
}
return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition: function() {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match: function(match, indexed_rule) {
var token, lines, backup;
if (this.options.backtrack_lexer) {
backup = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
};
if (this.options.ranges) {
backup.yylloc.range = this.yylloc.range.slice(0);
}
}
lines = match[0].match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno += lines.length;
}
this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
};
this.yytext += match[0];
this.match += match[0];
this.matches = match;
this.yyleng = this.yytext.length;
if (this.options.ranges) {
this.yylloc.range = [this.offset, this.offset += this.yyleng];
}
this._more = false;
this._backtrack = false;
this._input = this._input.slice(match[0].length);
this.matched += match[0];
token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
if (this.done && this._input) {
this.done = false;
}
if (token) {
return token;
} else if (this._backtrack) {
for (var k in backup) {
this[k] = backup[k];
}
return false;
}
return false;
},
// return next match in input
next: function() {
if (this.done) {
return this.EOF;
}
if (!this._input) {
this.done = true;
}
var token, match, tempMatch, index;
if (!this._more) {
this.yytext = "";
this.match = "";
}
var rules = this._currentRules();
for (var i = 0; i < rules.length; i++) {
tempMatch = this._input.match(this.rules[rules[i]]);
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
match = tempMatch;
index = i;
if (this.options.backtrack_lexer) {
token = this.test_match(tempMatch, rules[i]);
if (token !== false) {
return token;
} else if (this._backtrack) {
match = false;
continue;
} else {
return false;
}
} else if (!this.options.flex) {
break;
}
}
}
if (match) {
token = this.test_match(match, rules[index]);
if (token !== false) {
return token;
}
return false;
}
if (this._input === "") {
return this.EOF;
} else {
return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
},
// return next match that has a token
lex: function lex() {
var r = this.next();
if (r) {
return r;
} else {
return this.lex();
}
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin: function begin(condition) {
this.conditionStack.push(condition);
},
// pop the previously active lexer condition state off the condition stack
popState: function popState() {
var n = this.conditionStack.length - 1;
if (n > 0) {
return this.conditionStack.pop();
} else {
return this.conditionStack[0];
}
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules: function _currentRules() {
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
} else {
return this.conditions["INITIAL"].rules;
}
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState: function topState(n) {
n = this.conditionStack.length - 1 - Math.abs(n || 0);
if (n >= 0) {
return this.conditionStack[n];
} else {
return "INITIAL";
}
},
// alias for begin(condition)
pushState: function pushState(condition) {
this.begin(condition);
},
// return the number of states currently on the stack
stateStackSize: function stateStackSize() {
return this.conditionStack.length;
},
options: { "case-insensitive": true },
performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
switch ($avoiding_name_collisions) {
case 0:
break;
case 1:
break;
case 2:
return 20;
case 3:
break;
case 4:
break;
case 5:
this.begin("title");
return 12;
case 6:
this.popState();
return "title_value";
case 7:
this.begin("acc_title");
return 14;
case 8:
this.popState();
return "acc_title_value";
case 9:
this.begin("acc_descr");
return 16;
case 10:
this.popState();
return "acc_descr_value";
case 11:
this.begin("acc_descr_multiline");
break;
case 12:
this.popState();
break;
case 13:
return "acc_descr_multiline_value";
case 14:
this.begin("string");
break;
case 15:
this.popState();
break;
case 16:
return "txt";
case 17:
return 5;
case 18:
return 7;
case 19:
return "value";
case 20:
return 22;
}
},
rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:[\s]+)/i, /^(?:title\b)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:pie\b)/i, /^(?:showData\b)/i, /^(?::[\s]*[\d]+(?:\.[\d]+)?)/i, /^(?:$)/i],
conditions: { "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "title": { "rules": [6], "inclusive": false }, "string": { "rules": [15, 16], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 7, 9, 11, 14, 17, 18, 19, 20], "inclusive": true } }
};
return lexer2;
}();
parser2.lexer = lexer;
function Parser() {
this.yy = {};
}
Parser.prototype = parser2;
parser2.Parser = Parser;
return new Parser();
}();
parser.parser = parser;
const parser$1 = parser;
const DEFAULT_PIE_CONFIG = defaultConfig.pie;
const DEFAULT_PIE_DB = {
sections: {},
showData: false,
config: DEFAULT_PIE_CONFIG
};
let sections = DEFAULT_PIE_DB.sections;
let showData = DEFAULT_PIE_DB.showData;
const config = structuredClone(DEFAULT_PIE_CONFIG);
const getConfig = () => structuredClone(config);
const clear = () => {
sections = structuredClone(DEFAULT_PIE_DB.sections);
showData = DEFAULT_PIE_DB.showData;
clear$1();
};
const addSection = (label, value) => {
label = sanitizeText(label, getConfig$1());
if (sections[label] === void 0) {
sections[label] = value;
log.debug(`added new section: ${label}, with value: ${value}`);
}
};
const getSections = () => sections;
const cleanupValue = (value) => {
if (value.substring(0, 1) === ":") {
value = value.substring(1).trim();
}
return Number(value.trim());
};
const setShowData = (toggle) => {
showData = toggle;
};
const getShowData = () => showData;
const db = {
getConfig,
clear,
setDiagramTitle,
getDiagramTitle,
setAccTitle,
getAccTitle,
setAccDescription,
getAccDescription,
addSection,
getSections,
cleanupValue,
setShowData,
getShowData
};
const getStyles = (options) => `
.pieCircle{
stroke: ${options.pieStrokeColor};
stroke-width : ${options.pieStrokeWidth};
opacity : ${options.pieOpacity};
}
.pieOuterCircle{
stroke: ${options.pieOuterStrokeColor};
stroke-width: ${options.pieOuterStrokeWidth};
fill: none;
}
.pieTitleText {
text-anchor: middle;
font-size: ${options.pieTitleTextSize};
fill: ${options.pieTitleTextColor};
font-family: ${options.fontFamily};
}
.slice {
font-family: ${options.fontFamily};
fill: ${options.pieSectionTextColor};
font-size:${options.pieSectionTextSize};
// fill: white;
}
.legend text {
fill: ${options.pieLegendTextColor};
font-family: ${options.fontFamily};
font-size: ${options.pieLegendTextSize};
}
`;
const styles = getStyles;
const createPieArcs = (sections2) => {
const pieData = Object.entries(sections2).map((element) => {
return {
label: element[0],
value: element[1]
};
}).sort((a, b) => {
return b.value - a.value;
});
const pie = d3pie().value(
(d3Section) => d3Section.value
);
return pie(pieData);
};
const draw = (text, id, _version, diagObj) => {
log.debug("rendering pie chart\n" + text);
const db2 = diagObj.db;
const globalConfig = getConfig$1();
const pieConfig = cleanAndMerge(db2.getConfig(), globalConfig.pie);
const MARGIN = 40;
const LEGEND_RECT_SIZE = 18;
const LEGEND_SPACING = 4;
const height = 450;
const pieWidth = height;
const svg = selectSvgElement(id);
const group = svg.append("g");
const sections2 = db2.getSections();
group.attr("transform", "translate(" + pieWidth / 2 + "," + height / 2 + ")");
const { themeVariables } = globalConfig;
let [outerStrokeWidth] = parseFontSize(themeVariables.pieOuterStrokeWidth);
outerStrokeWidth ?? (outerStrokeWidth = 2);
const textPosition = pieConfig.textPosition;
const radius = Math.min(pieWidth, height) / 2 - MARGIN;
const arcGenerator = d3arc().innerRadius(0).outerRadius(radius);
const labelArcGenerator = d3arc().innerRadius(radius * textPosition).outerRadius(radius * textPosition);
group.append("circle").attr("cx", 0).attr("cy", 0).attr("r", radius + outerStrokeWidth / 2).attr("class", "pieOuterCircle");
const arcs = createPieArcs(sections2);
const myGeneratedColors = [
themeVariables.pie1,
themeVariables.pie2,
themeVariables.pie3,
themeVariables.pie4,
themeVariables.pie5,
themeVariables.pie6,
themeVariables.pie7,
themeVariables.pie8,
themeVariables.pie9,
themeVariables.pie10,
themeVariables.pie11,
themeVariables.pie12
];
const color = ordinal(myGeneratedColors);
group.selectAll("mySlices").data(arcs).enter().append("path").attr("d", arcGenerator).attr("fill", (datum) => {
return color(datum.data.label);
}).attr("class", "pieCircle");
let sum = 0;
Object.keys(sections2).forEach((key) => {
sum += sections2[key];
});
group.selectAll("mySlices").data(arcs).enter().append("text").text((datum) => {
return (datum.data.value / sum * 100).toFixed(0) + "%";
}).attr("transform", (datum) => {
return "translate(" + labelArcGenerator.centroid(datum) + ")";
}).style("text-anchor", "middle").attr("class", "slice");
group.append("text").text(db2.getDiagramTitle()).attr("x", 0).attr("y", -(height - 50) / 2).attr("class", "pieTitleText");
const legend = group.selectAll(".legend").data(color.domain()).enter().append("g").attr("class", "legend").attr("transform", (_datum, index) => {
const height2 = LEGEND_RECT_SIZE + LEGEND_SPACING;
const offset = height2 * color.domain().length / 2;
const horizontal = 12 * LEGEND_RECT_SIZE;
const vertical = index * height2 - offset;
return "translate(" + horizontal + "," + vertical + ")";
});
legend.append("rect").attr("width", LEGEND_RECT_SIZE).attr("height", LEGEND_RECT_SIZE).style("fill", color).style("stroke", color);
legend.data(arcs).append("text").attr("x", LEGEND_RECT_SIZE + LEGEND_SPACING).attr("y", LEGEND_RECT_SIZE - LEGEND_SPACING).text((datum) => {
const { label, value } = datum.data;
if (db2.getShowData()) {
return `${label} [${value}]`;
}
return label;
});
const longestTextWidth = Math.max(
...legend.selectAll("text").nodes().map((node) => (node == null ? void 0 : node.getBoundingClientRect().width) ?? 0)
);
const totalWidth = pieWidth + MARGIN + LEGEND_RECT_SIZE + LEGEND_SPACING + longestTextWidth;
svg.attr("viewBox", `0 0 ${totalWidth} ${height}`);
configureSvgSize(svg, height, totalWidth, pieConfig.useMaxWidth);
};
const renderer = { draw };
const diagram = {
parser: parser$1,
db,
renderer,
styles
};
export {
diagram
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,904 @@
import { Z as vt, W as E, l as lt, s as Lt, g as Ct, C as zt, D as bt, a as Et, b as Dt, c as yt, E as It, d as Bt, j as gt, k as wt } from "./mermaid-9f2aa176.js";
import { l as At } from "./linear-9bcf74c4.js";
import "./init-f9637058.js";
var pt = function() {
var e = function($, n, r, o) {
for (r = r || {}, o = $.length; o--; r[$[o]] = n)
;
return r;
}, s = [1, 3], c = [1, 4], x = [1, 5], f = [1, 6], d = [1, 7], l = [1, 5, 13, 15, 17, 19, 20, 25, 27, 28, 29, 30, 31, 32, 33, 34, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], g = [1, 5, 6, 13, 15, 17, 19, 20, 25, 27, 28, 29, 30, 31, 32, 33, 34, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], i = [32, 33, 34], q = [2, 7], b = [1, 13], D = [1, 17], w = [1, 18], I = [1, 19], B = [1, 20], p = [1, 21], H = [1, 22], G = [1, 23], K = [1, 24], at = [1, 25], nt = [1, 26], et = [1, 27], Q = [1, 30], N = [1, 31], T = [1, 32], m = [1, 33], A = [1, 34], t = [1, 35], _ = [1, 36], S = [1, 37], k = [1, 38], F = [1, 39], P = [1, 40], v = [1, 41], L = [1, 42], M = [1, 57], X = [1, 58], C = [5, 22, 26, 32, 33, 34, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51], ht = {
trace: function() {
},
yy: {},
symbols_: { error: 2, start: 3, eol: 4, SPACE: 5, QUADRANT: 6, document: 7, line: 8, statement: 9, axisDetails: 10, quadrantDetails: 11, points: 12, title: 13, title_value: 14, acc_title: 15, acc_title_value: 16, acc_descr: 17, acc_descr_value: 18, acc_descr_multiline_value: 19, section: 20, text: 21, point_start: 22, point_x: 23, point_y: 24, "X-AXIS": 25, "AXIS-TEXT-DELIMITER": 26, "Y-AXIS": 27, QUADRANT_1: 28, QUADRANT_2: 29, QUADRANT_3: 30, QUADRANT_4: 31, NEWLINE: 32, SEMI: 33, EOF: 34, alphaNumToken: 35, textNoTagsToken: 36, STR: 37, MD_STR: 38, alphaNum: 39, PUNCTUATION: 40, AMP: 41, NUM: 42, ALPHA: 43, COMMA: 44, PLUS: 45, EQUALS: 46, MULT: 47, DOT: 48, BRKT: 49, UNDERSCORE: 50, MINUS: 51, $accept: 0, $end: 1 },
terminals_: { 2: "error", 5: "SPACE", 6: "QUADRANT", 13: "title", 14: "title_value", 15: "acc_title", 16: "acc_title_value", 17: "acc_descr", 18: "acc_descr_value", 19: "acc_descr_multiline_value", 20: "section", 22: "point_start", 23: "point_x", 24: "point_y", 25: "X-AXIS", 26: "AXIS-TEXT-DELIMITER", 27: "Y-AXIS", 28: "QUADRANT_1", 29: "QUADRANT_2", 30: "QUADRANT_3", 31: "QUADRANT_4", 32: "NEWLINE", 33: "SEMI", 34: "EOF", 37: "STR", 38: "MD_STR", 40: "PUNCTUATION", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "COMMA", 45: "PLUS", 46: "EQUALS", 47: "MULT", 48: "DOT", 49: "BRKT", 50: "UNDERSCORE", 51: "MINUS" },
productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [9, 0], [9, 2], [9, 1], [9, 1], [9, 1], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [12, 4], [10, 4], [10, 3], [10, 2], [10, 4], [10, 3], [10, 2], [11, 2], [11, 2], [11, 2], [11, 2], [4, 1], [4, 1], [4, 1], [21, 1], [21, 2], [21, 1], [21, 1], [39, 1], [39, 2], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [36, 1], [36, 1], [36, 1]],
performAction: function(n, r, o, h, y, a, it) {
var u = a.length - 1;
switch (y) {
case 12:
this.$ = a[u].trim(), h.setDiagramTitle(this.$);
break;
case 13:
this.$ = a[u].trim(), h.setAccTitle(this.$);
break;
case 14:
case 15:
this.$ = a[u].trim(), h.setAccDescription(this.$);
break;
case 16:
h.addSection(a[u].substr(8)), this.$ = a[u].substr(8);
break;
case 17:
h.addPoint(a[u - 3], a[u - 1], a[u]);
break;
case 18:
h.setXAxisLeftText(a[u - 2]), h.setXAxisRightText(a[u]);
break;
case 19:
a[u - 1].text += " ⟶ ", h.setXAxisLeftText(a[u - 1]);
break;
case 20:
h.setXAxisLeftText(a[u]);
break;
case 21:
h.setYAxisBottomText(a[u - 2]), h.setYAxisTopText(a[u]);
break;
case 22:
a[u - 1].text += " ⟶ ", h.setYAxisBottomText(a[u - 1]);
break;
case 23:
h.setYAxisBottomText(a[u]);
break;
case 24:
h.setQuadrant1Text(a[u]);
break;
case 25:
h.setQuadrant2Text(a[u]);
break;
case 26:
h.setQuadrant3Text(a[u]);
break;
case 27:
h.setQuadrant4Text(a[u]);
break;
case 31:
this.$ = { text: a[u], type: "text" };
break;
case 32:
this.$ = { text: a[u - 1].text + "" + a[u], type: a[u - 1].type };
break;
case 33:
this.$ = { text: a[u], type: "text" };
break;
case 34:
this.$ = { text: a[u], type: "markdown" };
break;
case 35:
this.$ = a[u];
break;
case 36:
this.$ = a[u - 1] + "" + a[u];
break;
}
},
table: [{ 3: 1, 4: 2, 5: s, 6: c, 32: x, 33: f, 34: d }, { 1: [3] }, { 3: 8, 4: 2, 5: s, 6: c, 32: x, 33: f, 34: d }, { 3: 9, 4: 2, 5: s, 6: c, 32: x, 33: f, 34: d }, e(l, [2, 4], { 7: 10 }), e(g, [2, 28]), e(g, [2, 29]), e(g, [2, 30]), { 1: [2, 1] }, { 1: [2, 2] }, e(i, q, { 8: 11, 9: 12, 10: 14, 11: 15, 12: 16, 21: 28, 35: 29, 1: [2, 3], 5: b, 13: D, 15: w, 17: I, 19: B, 20: p, 25: H, 27: G, 28: K, 29: at, 30: nt, 31: et, 37: Q, 38: N, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L }), e(l, [2, 5]), { 4: 43, 32: x, 33: f, 34: d }, e(i, q, { 10: 14, 11: 15, 12: 16, 21: 28, 35: 29, 9: 44, 5: b, 13: D, 15: w, 17: I, 19: B, 20: p, 25: H, 27: G, 28: K, 29: at, 30: nt, 31: et, 37: Q, 38: N, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L }), e(i, [2, 9]), e(i, [2, 10]), e(i, [2, 11]), { 14: [1, 45] }, { 16: [1, 46] }, { 18: [1, 47] }, e(i, [2, 15]), e(i, [2, 16]), { 21: 48, 35: 29, 37: Q, 38: N, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L }, { 21: 49, 35: 29, 37: Q, 38: N, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L }, { 21: 50, 35: 29, 37: Q, 38: N, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L }, { 21: 51, 35: 29, 37: Q, 38: N, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L }, { 21: 52, 35: 29, 37: Q, 38: N, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L }, { 21: 53, 35: 29, 37: Q, 38: N, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L }, { 5: M, 22: [1, 54], 35: 56, 36: 55, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L, 51: X }, e(C, [2, 31]), e(C, [2, 33]), e(C, [2, 34]), e(C, [2, 37]), e(C, [2, 38]), e(C, [2, 39]), e(C, [2, 40]), e(C, [2, 41]), e(C, [2, 42]), e(C, [2, 43]), e(C, [2, 44]), e(C, [2, 45]), e(C, [2, 46]), e(C, [2, 47]), e(l, [2, 6]), e(i, [2, 8]), e(i, [2, 12]), e(i, [2, 13]), e(i, [2, 14]), e(i, [2, 20], { 36: 55, 35: 56, 5: M, 26: [1, 59], 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L, 51: X }), e(i, [2, 23], { 36: 55, 35: 56, 5: M, 26: [1, 60], 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L, 51: X }), e(i, [2, 24], { 36: 55, 35: 56, 5: M, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L, 51: X }), e(i, [2, 25], { 36: 55, 35: 56, 5: M, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L, 51: X }), e(i, [2, 26], { 36: 55, 35: 56, 5: M, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L, 51: X }), e(i, [2, 27], { 36: 55, 35: 56, 5: M, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L, 51: X }), { 23: [1, 61] }, e(C, [2, 32]), e(C, [2, 48]), e(C, [2, 49]), e(C, [2, 50]), e(i, [2, 19], { 35: 29, 21: 62, 37: Q, 38: N, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L }), e(i, [2, 22], { 35: 29, 21: 63, 37: Q, 38: N, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L }), { 24: [1, 64] }, e(i, [2, 18], { 36: 55, 35: 56, 5: M, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L, 51: X }), e(i, [2, 21], { 36: 55, 35: 56, 5: M, 40: T, 41: m, 42: A, 43: t, 44: _, 45: S, 46: k, 47: F, 48: P, 49: v, 50: L, 51: X }), e(i, [2, 17])],
defaultActions: { 8: [2, 1], 9: [2, 2] },
parseError: function(n, r) {
if (r.recoverable)
this.trace(n);
else {
var o = new Error(n);
throw o.hash = r, o;
}
},
parse: function(n) {
var r = this, o = [0], h = [], y = [null], a = [], it = this.table, u = "", st = 0, qt = 0, St = 2, Tt = 1, kt = a.slice.call(arguments, 1), z = Object.create(this.lexer), Z = { yy: {} };
for (var dt in this.yy)
Object.prototype.hasOwnProperty.call(this.yy, dt) && (Z.yy[dt] = this.yy[dt]);
z.setInput(n, Z.yy), Z.yy.lexer = z, Z.yy.parser = this, typeof z.yylloc > "u" && (z.yylloc = {});
var ut = z.yylloc;
a.push(ut);
var Ft = z.options && z.options.ranges;
typeof Z.yy.parseError == "function" ? this.parseError = Z.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
function Pt() {
var Y;
return Y = h.pop() || z.lex() || Tt, typeof Y != "number" && (Y instanceof Array && (h = Y, Y = h.pop()), Y = r.symbols_[Y] || Y), Y;
}
for (var W, J, U, xt, tt = {}, rt, O, mt, ot; ; ) {
if (J = o[o.length - 1], this.defaultActions[J] ? U = this.defaultActions[J] : ((W === null || typeof W > "u") && (W = Pt()), U = it[J] && it[J][W]), typeof U > "u" || !U.length || !U[0]) {
var ft = "";
ot = [];
for (rt in it[J])
this.terminals_[rt] && rt > St && ot.push("'" + this.terminals_[rt] + "'");
z.showPosition ? ft = "Parse error on line " + (st + 1) + `:
` + z.showPosition() + `
Expecting ` + ot.join(", ") + ", got '" + (this.terminals_[W] || W) + "'" : ft = "Parse error on line " + (st + 1) + ": Unexpected " + (W == Tt ? "end of input" : "'" + (this.terminals_[W] || W) + "'"), this.parseError(ft, {
text: z.match,
token: this.terminals_[W] || W,
line: z.yylineno,
loc: ut,
expected: ot
});
}
if (U[0] instanceof Array && U.length > 1)
throw new Error("Parse Error: multiple actions possible at state: " + J + ", token: " + W);
switch (U[0]) {
case 1:
o.push(W), y.push(z.yytext), a.push(z.yylloc), o.push(U[1]), W = null, qt = z.yyleng, u = z.yytext, st = z.yylineno, ut = z.yylloc;
break;
case 2:
if (O = this.productions_[U[1]][1], tt.$ = y[y.length - O], tt._$ = {
first_line: a[a.length - (O || 1)].first_line,
last_line: a[a.length - 1].last_line,
first_column: a[a.length - (O || 1)].first_column,
last_column: a[a.length - 1].last_column
}, Ft && (tt._$.range = [
a[a.length - (O || 1)].range[0],
a[a.length - 1].range[1]
]), xt = this.performAction.apply(tt, [
u,
qt,
st,
Z.yy,
U[1],
y,
a
].concat(kt)), typeof xt < "u")
return xt;
O && (o = o.slice(0, -1 * O * 2), y = y.slice(0, -1 * O), a = a.slice(0, -1 * O)), o.push(this.productions_[U[1]][0]), y.push(tt.$), a.push(tt._$), mt = it[o[o.length - 2]][o[o.length - 1]], o.push(mt);
break;
case 3:
return !0;
}
}
return !0;
}
}, _t = function() {
var $ = {
EOF: 1,
parseError: function(r, o) {
if (this.yy.parser)
this.yy.parser.parseError(r, o);
else
throw new Error(r);
},
// resets the lexer, sets new input
setInput: function(n, r) {
return this.yy = r || this.yy || {}, this._input = n, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
},
// consumes and returns one char from the input
input: function() {
var n = this._input[0];
this.yytext += n, this.yyleng++, this.offset++, this.match += n, this.matched += n;
var r = n.match(/(?:\r\n?|\n).*/g);
return r ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), n;
},
// unshifts one char (or a string) into the input
unput: function(n) {
var r = n.length, o = n.split(/(?:\r\n?|\n)/g);
this._input = n + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - r), this.offset -= r;
var h = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), o.length - 1 && (this.yylineno -= o.length - 1);
var y = this.yylloc.range;
return this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: o ? (o.length === h.length ? this.yylloc.first_column : 0) + h[h.length - o.length].length - o[0].length : this.yylloc.first_column - r
}, this.options.ranges && (this.yylloc.range = [y[0], y[0] + this.yyleng - r]), this.yyleng = this.yytext.length, this;
},
// When called from action, caches matched text and appends it on next action
more: function() {
return this._more = !0, this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject: function() {
if (this.options.backtrack_lexer)
this._backtrack = !0;
else
return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
return this;
},
// retain first n characters of the match
less: function(n) {
this.unput(this.match.slice(n));
},
// displays already matched input, i.e. for error messages
pastInput: function() {
var n = this.matched.substr(0, this.matched.length - this.match.length);
return (n.length > 20 ? "..." : "") + n.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput: function() {
var n = this.match;
return n.length < 20 && (n += this._input.substr(0, 20 - n.length)), (n.substr(0, 20) + (n.length > 20 ? "..." : "")).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition: function() {
var n = this.pastInput(), r = new Array(n.length + 1).join("-");
return n + this.upcomingInput() + `
` + r + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match: function(n, r) {
var o, h, y;
if (this.options.backtrack_lexer && (y = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
}, this.options.ranges && (y.yylloc.range = this.yylloc.range.slice(0))), h = n[0].match(/(?:\r\n?|\n).*/g), h && (this.yylineno += h.length), this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: h ? h[h.length - 1].length - h[h.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + n[0].length
}, this.yytext += n[0], this.match += n[0], this.matches = n, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(n[0].length), this.matched += n[0], o = this.performAction.call(this, this.yy, this, r, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), o)
return o;
if (this._backtrack) {
for (var a in y)
this[a] = y[a];
return !1;
}
return !1;
},
// return next match in input
next: function() {
if (this.done)
return this.EOF;
this._input || (this.done = !0);
var n, r, o, h;
this._more || (this.yytext = "", this.match = "");
for (var y = this._currentRules(), a = 0; a < y.length; a++)
if (o = this._input.match(this.rules[y[a]]), o && (!r || o[0].length > r[0].length)) {
if (r = o, h = a, this.options.backtrack_lexer) {
if (n = this.test_match(o, y[a]), n !== !1)
return n;
if (this._backtrack) {
r = !1;
continue;
} else
return !1;
} else if (!this.options.flex)
break;
}
return r ? (n = this.test_match(r, y[h]), n !== !1 ? n : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
},
// return next match that has a token
lex: function() {
var r = this.next();
return r || this.lex();
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin: function(r) {
this.conditionStack.push(r);
},
// pop the previously active lexer condition state off the condition stack
popState: function() {
var r = this.conditionStack.length - 1;
return r > 0 ? this.conditionStack.pop() : this.conditionStack[0];
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules: function() {
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState: function(r) {
return r = this.conditionStack.length - 1 - Math.abs(r || 0), r >= 0 ? this.conditionStack[r] : "INITIAL";
},
// alias for begin(condition)
pushState: function(r) {
this.begin(r);
},
// return the number of states currently on the stack
stateStackSize: function() {
return this.conditionStack.length;
},
options: { "case-insensitive": !0 },
performAction: function(r, o, h, y) {
switch (h) {
case 0:
break;
case 1:
break;
case 2:
return 32;
case 3:
break;
case 4:
return this.begin("title"), 13;
case 5:
return this.popState(), "title_value";
case 6:
return this.begin("acc_title"), 15;
case 7:
return this.popState(), "acc_title_value";
case 8:
return this.begin("acc_descr"), 17;
case 9:
return this.popState(), "acc_descr_value";
case 10:
this.begin("acc_descr_multiline");
break;
case 11:
this.popState();
break;
case 12:
return "acc_descr_multiline_value";
case 13:
return 25;
case 14:
return 27;
case 15:
return 26;
case 16:
return 28;
case 17:
return 29;
case 18:
return 30;
case 19:
return 31;
case 20:
this.begin("md_string");
break;
case 21:
return "MD_STR";
case 22:
this.popState();
break;
case 23:
this.begin("string");
break;
case 24:
this.popState();
break;
case 25:
return "STR";
case 26:
return this.begin("point_start"), 22;
case 27:
return this.begin("point_x"), 23;
case 28:
this.popState();
break;
case 29:
this.popState(), this.begin("point_y");
break;
case 30:
return this.popState(), 24;
case 31:
return 6;
case 32:
return 43;
case 33:
return "COLON";
case 34:
return 45;
case 35:
return 44;
case 36:
return 46;
case 37:
return 46;
case 38:
return 47;
case 39:
return 49;
case 40:
return 50;
case 41:
return 48;
case 42:
return 41;
case 43:
return 51;
case 44:
return 42;
case 45:
return 5;
case 46:
return 33;
case 47:
return 40;
case 48:
return 34;
}
},
rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?: *x-axis *)/i, /^(?: *y-axis *)/i, /^(?: *--+> *)/i, /^(?: *quadrant-1 *)/i, /^(?: *quadrant-2 *)/i, /^(?: *quadrant-3 *)/i, /^(?: *quadrant-4 *)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:\s*:\s*\[\s*)/i, /^(?:(1)|(0(.\d+)?))/i, /^(?:\s*\] *)/i, /^(?:\s*,\s*)/i, /^(?:(1)|(0(.\d+)?))/i, /^(?: *quadrantChart *)/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s)/i, /^(?:;)/i, /^(?:[!"#$%&'*+,-.`?\\_/])/i, /^(?:$)/i],
conditions: { point_y: { rules: [30], inclusive: !1 }, point_x: { rules: [29], inclusive: !1 }, point_start: { rules: [27, 28], inclusive: !1 }, acc_descr_multiline: { rules: [11, 12], inclusive: !1 }, acc_descr: { rules: [9], inclusive: !1 }, acc_title: { rules: [7], inclusive: !1 }, title: { rules: [5], inclusive: !1 }, md_string: { rules: [21, 22], inclusive: !1 }, string: { rules: [24, 25], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 23, 26, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48], inclusive: !0 } }
};
return $;
}();
ht.lexer = _t;
function ct() {
this.yy = {};
}
return ct.prototype = ht, ht.Parser = ct, new ct();
}();
pt.parser = pt;
const Rt = pt, V = vt();
class Vt {
constructor() {
this.config = this.getDefaultConfig(), this.themeConfig = this.getDefaultThemeConfig(), this.data = this.getDefaultData();
}
getDefaultData() {
return {
titleText: "",
quadrant1Text: "",
quadrant2Text: "",
quadrant3Text: "",
quadrant4Text: "",
xAxisLeftText: "",
xAxisRightText: "",
yAxisBottomText: "",
yAxisTopText: "",
points: []
};
}
getDefaultConfig() {
var s, c, x, f, d, l, g, i, q, b, D, w, I, B, p, H, G, K;
return {
showXAxis: !0,
showYAxis: !0,
showTitle: !0,
chartHeight: ((s = E.quadrantChart) == null ? void 0 : s.chartWidth) || 500,
chartWidth: ((c = E.quadrantChart) == null ? void 0 : c.chartHeight) || 500,
titlePadding: ((x = E.quadrantChart) == null ? void 0 : x.titlePadding) || 10,
titleFontSize: ((f = E.quadrantChart) == null ? void 0 : f.titleFontSize) || 20,
quadrantPadding: ((d = E.quadrantChart) == null ? void 0 : d.quadrantPadding) || 5,
xAxisLabelPadding: ((l = E.quadrantChart) == null ? void 0 : l.xAxisLabelPadding) || 5,
yAxisLabelPadding: ((g = E.quadrantChart) == null ? void 0 : g.yAxisLabelPadding) || 5,
xAxisLabelFontSize: ((i = E.quadrantChart) == null ? void 0 : i.xAxisLabelFontSize) || 16,
yAxisLabelFontSize: ((q = E.quadrantChart) == null ? void 0 : q.yAxisLabelFontSize) || 16,
quadrantLabelFontSize: ((b = E.quadrantChart) == null ? void 0 : b.quadrantLabelFontSize) || 16,
quadrantTextTopPadding: ((D = E.quadrantChart) == null ? void 0 : D.quadrantTextTopPadding) || 5,
pointTextPadding: ((w = E.quadrantChart) == null ? void 0 : w.pointTextPadding) || 5,
pointLabelFontSize: ((I = E.quadrantChart) == null ? void 0 : I.pointLabelFontSize) || 12,
pointRadius: ((B = E.quadrantChart) == null ? void 0 : B.pointRadius) || 5,
xAxisPosition: ((p = E.quadrantChart) == null ? void 0 : p.xAxisPosition) || "top",
yAxisPosition: ((H = E.quadrantChart) == null ? void 0 : H.yAxisPosition) || "left",
quadrantInternalBorderStrokeWidth: ((G = E.quadrantChart) == null ? void 0 : G.quadrantInternalBorderStrokeWidth) || 1,
quadrantExternalBorderStrokeWidth: ((K = E.quadrantChart) == null ? void 0 : K.quadrantExternalBorderStrokeWidth) || 2
};
}
getDefaultThemeConfig() {
return {
quadrant1Fill: V.quadrant1Fill,
quadrant2Fill: V.quadrant2Fill,
quadrant3Fill: V.quadrant3Fill,
quadrant4Fill: V.quadrant4Fill,
quadrant1TextFill: V.quadrant1TextFill,
quadrant2TextFill: V.quadrant2TextFill,
quadrant3TextFill: V.quadrant3TextFill,
quadrant4TextFill: V.quadrant4TextFill,
quadrantPointFill: V.quadrantPointFill,
quadrantPointTextFill: V.quadrantPointTextFill,
quadrantXAxisTextFill: V.quadrantXAxisTextFill,
quadrantYAxisTextFill: V.quadrantYAxisTextFill,
quadrantTitleFill: V.quadrantTitleFill,
quadrantInternalBorderStrokeFill: V.quadrantInternalBorderStrokeFill,
quadrantExternalBorderStrokeFill: V.quadrantExternalBorderStrokeFill
};
}
clear() {
this.config = this.getDefaultConfig(), this.themeConfig = this.getDefaultThemeConfig(), this.data = this.getDefaultData(), lt.info("clear called");
}
setData(s) {
this.data = { ...this.data, ...s };
}
addPoints(s) {
this.data.points = [...s, ...this.data.points];
}
setConfig(s) {
lt.trace("setConfig called with: ", s), this.config = { ...this.config, ...s };
}
setThemeConfig(s) {
lt.trace("setThemeConfig called with: ", s), this.themeConfig = { ...this.themeConfig, ...s };
}
calculateSpace(s, c, x, f) {
const d = this.config.xAxisLabelPadding * 2 + this.config.xAxisLabelFontSize, l = {
top: s === "top" && c ? d : 0,
bottom: s === "bottom" && c ? d : 0
}, g = this.config.yAxisLabelPadding * 2 + this.config.yAxisLabelFontSize, i = {
left: this.config.yAxisPosition === "left" && x ? g : 0,
right: this.config.yAxisPosition === "right" && x ? g : 0
}, q = this.config.titleFontSize + this.config.titlePadding * 2, b = {
top: f ? q : 0
}, D = this.config.quadrantPadding + i.left, w = this.config.quadrantPadding + l.top + b.top, I = this.config.chartWidth - this.config.quadrantPadding * 2 - i.left - i.right, B = this.config.chartHeight - this.config.quadrantPadding * 2 - l.top - l.bottom - b.top, p = I / 2, H = B / 2;
return {
xAxisSpace: l,
yAxisSpace: i,
titleSpace: b,
quadrantSpace: {
quadrantLeft: D,
quadrantTop: w,
quadrantWidth: I,
quadrantHalfWidth: p,
quadrantHeight: B,
quadrantHalfHeight: H
}
};
}
getAxisLabels(s, c, x, f) {
const { quadrantSpace: d, titleSpace: l } = f, {
quadrantHalfHeight: g,
quadrantHeight: i,
quadrantLeft: q,
quadrantHalfWidth: b,
quadrantTop: D,
quadrantWidth: w
} = d, I = !!this.data.xAxisRightText, B = !!this.data.yAxisTopText, p = [];
return this.data.xAxisLeftText && c && p.push({
text: this.data.xAxisLeftText,
fill: this.themeConfig.quadrantXAxisTextFill,
x: q + (I ? b / 2 : 0),
y: s === "top" ? this.config.xAxisLabelPadding + l.top : this.config.xAxisLabelPadding + D + i + this.config.quadrantPadding,
fontSize: this.config.xAxisLabelFontSize,
verticalPos: I ? "center" : "left",
horizontalPos: "top",
rotation: 0
}), this.data.xAxisRightText && c && p.push({
text: this.data.xAxisRightText,
fill: this.themeConfig.quadrantXAxisTextFill,
x: q + b + (I ? b / 2 : 0),
y: s === "top" ? this.config.xAxisLabelPadding + l.top : this.config.xAxisLabelPadding + D + i + this.config.quadrantPadding,
fontSize: this.config.xAxisLabelFontSize,
verticalPos: I ? "center" : "left",
horizontalPos: "top",
rotation: 0
}), this.data.yAxisBottomText && x && p.push({
text: this.data.yAxisBottomText,
fill: this.themeConfig.quadrantYAxisTextFill,
x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + q + w + this.config.quadrantPadding,
y: D + i - (B ? g / 2 : 0),
fontSize: this.config.yAxisLabelFontSize,
verticalPos: B ? "center" : "left",
horizontalPos: "top",
rotation: -90
}), this.data.yAxisTopText && x && p.push({
text: this.data.yAxisTopText,
fill: this.themeConfig.quadrantYAxisTextFill,
x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + q + w + this.config.quadrantPadding,
y: D + g - (B ? g / 2 : 0),
fontSize: this.config.yAxisLabelFontSize,
verticalPos: B ? "center" : "left",
horizontalPos: "top",
rotation: -90
}), p;
}
getQuadrants(s) {
const { quadrantSpace: c } = s, { quadrantHalfHeight: x, quadrantLeft: f, quadrantHalfWidth: d, quadrantTop: l } = c, g = [
{
text: {
text: this.data.quadrant1Text,
fill: this.themeConfig.quadrant1TextFill,
x: 0,
y: 0,
fontSize: this.config.quadrantLabelFontSize,
verticalPos: "center",
horizontalPos: "middle",
rotation: 0
},
x: f + d,
y: l,
width: d,
height: x,
fill: this.themeConfig.quadrant1Fill
},
{
text: {
text: this.data.quadrant2Text,
fill: this.themeConfig.quadrant2TextFill,
x: 0,
y: 0,
fontSize: this.config.quadrantLabelFontSize,
verticalPos: "center",
horizontalPos: "middle",
rotation: 0
},
x: f,
y: l,
width: d,
height: x,
fill: this.themeConfig.quadrant2Fill
},
{
text: {
text: this.data.quadrant3Text,
fill: this.themeConfig.quadrant3TextFill,
x: 0,
y: 0,
fontSize: this.config.quadrantLabelFontSize,
verticalPos: "center",
horizontalPos: "middle",
rotation: 0
},
x: f,
y: l + x,
width: d,
height: x,
fill: this.themeConfig.quadrant3Fill
},
{
text: {
text: this.data.quadrant4Text,
fill: this.themeConfig.quadrant4TextFill,
x: 0,
y: 0,
fontSize: this.config.quadrantLabelFontSize,
verticalPos: "center",
horizontalPos: "middle",
rotation: 0
},
x: f + d,
y: l + x,
width: d,
height: x,
fill: this.themeConfig.quadrant4Fill
}
];
for (const i of g)
i.text.x = i.x + i.width / 2, this.data.points.length === 0 ? (i.text.y = i.y + i.height / 2, i.text.horizontalPos = "middle") : (i.text.y = i.y + this.config.quadrantTextTopPadding, i.text.horizontalPos = "top");
return g;
}
getQuadrantPoints(s) {
const { quadrantSpace: c } = s, { quadrantHeight: x, quadrantLeft: f, quadrantTop: d, quadrantWidth: l } = c, g = At().domain([0, 1]).range([f, l + f]), i = At().domain([0, 1]).range([x + d, d]);
return this.data.points.map((b) => ({
x: g(b.x),
y: i(b.y),
fill: this.themeConfig.quadrantPointFill,
radius: this.config.pointRadius,
text: {
text: b.text,
fill: this.themeConfig.quadrantPointTextFill,
x: g(b.x),
y: i(b.y) + this.config.pointTextPadding,
verticalPos: "center",
horizontalPos: "top",
fontSize: this.config.pointLabelFontSize,
rotation: 0
}
}));
}
getBorders(s) {
const c = this.config.quadrantExternalBorderStrokeWidth / 2, { quadrantSpace: x } = s, {
quadrantHalfHeight: f,
quadrantHeight: d,
quadrantLeft: l,
quadrantHalfWidth: g,
quadrantTop: i,
quadrantWidth: q
} = x;
return [
// top border
{
strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
x1: l - c,
y1: i,
x2: l + q + c,
y2: i
},
// right border
{
strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
x1: l + q,
y1: i + c,
x2: l + q,
y2: i + d - c
},
// bottom border
{
strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
x1: l - c,
y1: i + d,
x2: l + q + c,
y2: i + d
},
// left border
{
strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
x1: l,
y1: i + c,
x2: l,
y2: i + d - c
},
// vertical inner border
{
strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
x1: l + g,
y1: i + c,
x2: l + g,
y2: i + d - c
},
// horizontal inner border
{
strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
x1: l + c,
y1: i + f,
x2: l + q - c,
y2: i + f
}
];
}
getTitle(s) {
if (s)
return {
text: this.data.titleText,
fill: this.themeConfig.quadrantTitleFill,
fontSize: this.config.titleFontSize,
horizontalPos: "top",
verticalPos: "center",
rotation: 0,
y: this.config.titlePadding,
x: this.config.chartWidth / 2
};
}
build() {
const s = this.config.showXAxis && !!(this.data.xAxisLeftText || this.data.xAxisRightText), c = this.config.showYAxis && !!(this.data.yAxisTopText || this.data.yAxisBottomText), x = this.config.showTitle && !!this.data.titleText, f = this.data.points.length > 0 ? "bottom" : this.config.xAxisPosition, d = this.calculateSpace(f, s, c, x);
return {
points: this.getQuadrantPoints(d),
quadrants: this.getQuadrants(d),
axisLabels: this.getAxisLabels(f, s, c, d),
borderLines: this.getBorders(d),
title: this.getTitle(x)
};
}
}
const Wt = yt();
function j(e) {
return Bt(e.trim(), Wt);
}
const R = new Vt();
function Nt(e) {
R.setData({ quadrant1Text: j(e.text) });
}
function Ut(e) {
R.setData({ quadrant2Text: j(e.text) });
}
function Qt(e) {
R.setData({ quadrant3Text: j(e.text) });
}
function Ht(e) {
R.setData({ quadrant4Text: j(e.text) });
}
function Mt(e) {
R.setData({ xAxisLeftText: j(e.text) });
}
function Xt(e) {
R.setData({ xAxisRightText: j(e.text) });
}
function Ot(e) {
R.setData({ yAxisTopText: j(e.text) });
}
function Yt(e) {
R.setData({ yAxisBottomText: j(e.text) });
}
function jt(e, s, c) {
R.addPoints([{ x: s, y: c, text: j(e.text) }]);
}
function Gt(e) {
R.setConfig({ chartWidth: e });
}
function $t(e) {
R.setConfig({ chartHeight: e });
}
function Kt() {
const e = yt(), { themeVariables: s, quadrantChart: c } = e;
return c && R.setConfig(c), R.setThemeConfig({
quadrant1Fill: s.quadrant1Fill,
quadrant2Fill: s.quadrant2Fill,
quadrant3Fill: s.quadrant3Fill,
quadrant4Fill: s.quadrant4Fill,
quadrant1TextFill: s.quadrant1TextFill,
quadrant2TextFill: s.quadrant2TextFill,
quadrant3TextFill: s.quadrant3TextFill,
quadrant4TextFill: s.quadrant4TextFill,
quadrantPointFill: s.quadrantPointFill,
quadrantPointTextFill: s.quadrantPointTextFill,
quadrantXAxisTextFill: s.quadrantXAxisTextFill,
quadrantYAxisTextFill: s.quadrantYAxisTextFill,
quadrantExternalBorderStrokeFill: s.quadrantExternalBorderStrokeFill,
quadrantInternalBorderStrokeFill: s.quadrantInternalBorderStrokeFill,
quadrantTitleFill: s.quadrantTitleFill
}), R.setData({ titleText: bt() }), R.build();
}
const Zt = function() {
R.clear(), It();
}, Jt = {
setWidth: Gt,
setHeight: $t,
setQuadrant1Text: Nt,
setQuadrant2Text: Ut,
setQuadrant3Text: Qt,
setQuadrant4Text: Ht,
setXAxisLeftText: Mt,
setXAxisRightText: Xt,
setYAxisTopText: Ot,
setYAxisBottomText: Yt,
addPoint: jt,
getQuadrantData: Kt,
clear: Zt,
setAccTitle: Lt,
getAccTitle: Ct,
setDiagramTitle: zt,
getDiagramTitle: bt,
getAccDescription: Et,
setAccDescription: Dt
}, te = (e, s, c, x) => {
var T, m, A;
function f(t) {
return t === "top" ? "hanging" : "middle";
}
function d(t) {
return t === "left" ? "start" : "middle";
}
function l(t) {
return `translate(${t.x}, ${t.y}) rotate(${t.rotation || 0})`;
}
const g = yt();
lt.debug(`Rendering quadrant chart
` + e);
const i = g.securityLevel;
let q;
i === "sandbox" && (q = gt("#i" + s));
const D = (i === "sandbox" ? gt(q.nodes()[0].contentDocument.body) : gt("body")).select(`[id="${s}"]`), w = D.append("g").attr("class", "main"), I = ((T = g.quadrantChart) == null ? void 0 : T.chartWidth) || 500, B = ((m = g.quadrantChart) == null ? void 0 : m.chartHeight) || 500;
wt(D, B, I, ((A = g.quadrantChart) == null ? void 0 : A.useMaxWidth) || !0), D.attr("viewBox", "0 0 " + I + " " + B), x.db.setHeight(B), x.db.setWidth(I);
const p = x.db.getQuadrantData(), H = w.append("g").attr("class", "quadrants"), G = w.append("g").attr("class", "border"), K = w.append("g").attr("class", "data-points"), at = w.append("g").attr("class", "labels"), nt = w.append("g").attr("class", "title");
p.title && nt.append("text").attr("x", 0).attr("y", 0).attr("fill", p.title.fill).attr("font-size", p.title.fontSize).attr("dominant-baseline", f(p.title.horizontalPos)).attr("text-anchor", d(p.title.verticalPos)).attr("transform", l(p.title)).text(p.title.text), p.borderLines && G.selectAll("line").data(p.borderLines).enter().append("line").attr("x1", (t) => t.x1).attr("y1", (t) => t.y1).attr("x2", (t) => t.x2).attr("y2", (t) => t.y2).style("stroke", (t) => t.strokeFill).style("stroke-width", (t) => t.strokeWidth);
const et = H.selectAll("g.quadrant").data(p.quadrants).enter().append("g").attr("class", "quadrant");
et.append("rect").attr("x", (t) => t.x).attr("y", (t) => t.y).attr("width", (t) => t.width).attr("height", (t) => t.height).attr("fill", (t) => t.fill), et.append("text").attr("x", 0).attr("y", 0).attr("fill", (t) => t.text.fill).attr("font-size", (t) => t.text.fontSize).attr(
"dominant-baseline",
(t) => f(t.text.horizontalPos)
).attr("text-anchor", (t) => d(t.text.verticalPos)).attr("transform", (t) => l(t.text)).text((t) => t.text.text), at.selectAll("g.label").data(p.axisLabels).enter().append("g").attr("class", "label").append("text").attr("x", 0).attr("y", 0).text((t) => t.text).attr("fill", (t) => t.fill).attr("font-size", (t) => t.fontSize).attr("dominant-baseline", (t) => f(t.horizontalPos)).attr("text-anchor", (t) => d(t.verticalPos)).attr("transform", (t) => l(t));
const N = K.selectAll("g.data-point").data(p.points).enter().append("g").attr("class", "data-point");
N.append("circle").attr("cx", (t) => t.x).attr("cy", (t) => t.y).attr("r", (t) => t.radius).attr("fill", (t) => t.fill), N.append("text").attr("x", 0).attr("y", 0).text((t) => t.text.text).attr("fill", (t) => t.text.fill).attr("font-size", (t) => t.text.fontSize).attr(
"dominant-baseline",
(t) => f(t.text.horizontalPos)
).attr("text-anchor", (t) => d(t.text.verticalPos)).attr("transform", (t) => l(t.text));
}, ee = {
draw: te
}, se = {
parser: Rt,
db: Jt,
renderer: ee,
styles: () => ""
};
export {
se as diagram
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,769 @@
import { c as Te, s as Ce, g as Fe, b as Me, a as De, l as Ne, E as Pe, j as oe, k as Ye, f as ke } from "./mermaid-9f2aa176.js";
import { G as Ue } from "./graph-0ee63739.js";
import { l as Be } from "./layout-fd473db2.js";
import { l as Qe } from "./line-24d93f1b.js";
import "./array-2ff2c7a6.js";
import "./path-428ebac9.js";
var ce = function() {
var e = function(V, i, r, a) {
for (r = r || {}, a = V.length; a--; r[V[a]] = i)
;
return r;
}, t = [1, 3], l = [1, 4], c = [1, 5], u = [1, 6], d = [5, 6, 8, 9, 11, 13, 31, 32, 33, 34, 35, 36, 44, 62, 63], f = [1, 18], h = [2, 7], o = [1, 22], E = [1, 23], R = [1, 24], A = [1, 25], T = [1, 26], N = [1, 27], w = [1, 20], k = [1, 28], x = [1, 29], F = [62, 63], de = [5, 8, 9, 11, 13, 31, 32, 33, 34, 35, 36, 44, 51, 53, 62, 63], fe = [1, 47], pe = [1, 48], ye = [1, 49], _e = [1, 50], Ee = [1, 51], ge = [1, 52], Re = [1, 53], O = [53, 54], M = [1, 64], D = [1, 60], P = [1, 61], Y = [1, 62], U = [1, 63], B = [1, 65], j = [1, 69], z = [1, 70], X = [1, 67], J = [1, 68], m = [5, 8, 9, 11, 13, 31, 32, 33, 34, 35, 36, 44, 62, 63], ie = {
trace: function() {
},
yy: {},
symbols_: { error: 2, start: 3, directive: 4, NEWLINE: 5, RD: 6, diagram: 7, EOF: 8, acc_title: 9, acc_title_value: 10, acc_descr: 11, acc_descr_value: 12, acc_descr_multiline_value: 13, requirementDef: 14, elementDef: 15, relationshipDef: 16, requirementType: 17, requirementName: 18, STRUCT_START: 19, requirementBody: 20, ID: 21, COLONSEP: 22, id: 23, TEXT: 24, text: 25, RISK: 26, riskLevel: 27, VERIFYMTHD: 28, verifyType: 29, STRUCT_STOP: 30, REQUIREMENT: 31, FUNCTIONAL_REQUIREMENT: 32, INTERFACE_REQUIREMENT: 33, PERFORMANCE_REQUIREMENT: 34, PHYSICAL_REQUIREMENT: 35, DESIGN_CONSTRAINT: 36, LOW_RISK: 37, MED_RISK: 38, HIGH_RISK: 39, VERIFY_ANALYSIS: 40, VERIFY_DEMONSTRATION: 41, VERIFY_INSPECTION: 42, VERIFY_TEST: 43, ELEMENT: 44, elementName: 45, elementBody: 46, TYPE: 47, type: 48, DOCREF: 49, ref: 50, END_ARROW_L: 51, relationship: 52, LINE: 53, END_ARROW_R: 54, CONTAINS: 55, COPIES: 56, DERIVES: 57, SATISFIES: 58, VERIFIES: 59, REFINES: 60, TRACES: 61, unqString: 62, qString: 63, $accept: 0, $end: 1 },
terminals_: { 2: "error", 5: "NEWLINE", 6: "RD", 8: "EOF", 9: "acc_title", 10: "acc_title_value", 11: "acc_descr", 12: "acc_descr_value", 13: "acc_descr_multiline_value", 19: "STRUCT_START", 21: "ID", 22: "COLONSEP", 24: "TEXT", 26: "RISK", 28: "VERIFYMTHD", 30: "STRUCT_STOP", 31: "REQUIREMENT", 32: "FUNCTIONAL_REQUIREMENT", 33: "INTERFACE_REQUIREMENT", 34: "PERFORMANCE_REQUIREMENT", 35: "PHYSICAL_REQUIREMENT", 36: "DESIGN_CONSTRAINT", 37: "LOW_RISK", 38: "MED_RISK", 39: "HIGH_RISK", 40: "VERIFY_ANALYSIS", 41: "VERIFY_DEMONSTRATION", 42: "VERIFY_INSPECTION", 43: "VERIFY_TEST", 44: "ELEMENT", 47: "TYPE", 49: "DOCREF", 51: "END_ARROW_L", 53: "LINE", 54: "END_ARROW_R", 55: "CONTAINS", 56: "COPIES", 57: "DERIVES", 58: "SATISFIES", 59: "VERIFIES", 60: "REFINES", 61: "TRACES", 62: "unqString", 63: "qString" },
productions_: [0, [3, 3], [3, 2], [3, 4], [4, 2], [4, 2], [4, 1], [7, 0], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [14, 5], [20, 5], [20, 5], [20, 5], [20, 5], [20, 2], [20, 1], [17, 1], [17, 1], [17, 1], [17, 1], [17, 1], [17, 1], [27, 1], [27, 1], [27, 1], [29, 1], [29, 1], [29, 1], [29, 1], [15, 5], [46, 5], [46, 5], [46, 2], [46, 1], [16, 5], [16, 5], [52, 1], [52, 1], [52, 1], [52, 1], [52, 1], [52, 1], [52, 1], [18, 1], [18, 1], [23, 1], [23, 1], [25, 1], [25, 1], [45, 1], [45, 1], [48, 1], [48, 1], [50, 1], [50, 1]],
performAction: function(i, r, a, n, p, s, W) {
var _ = s.length - 1;
switch (p) {
case 4:
this.$ = s[_].trim(), n.setAccTitle(this.$);
break;
case 5:
case 6:
this.$ = s[_].trim(), n.setAccDescription(this.$);
break;
case 7:
this.$ = [];
break;
case 13:
n.addRequirement(s[_ - 3], s[_ - 4]);
break;
case 14:
n.setNewReqId(s[_ - 2]);
break;
case 15:
n.setNewReqText(s[_ - 2]);
break;
case 16:
n.setNewReqRisk(s[_ - 2]);
break;
case 17:
n.setNewReqVerifyMethod(s[_ - 2]);
break;
case 20:
this.$ = n.RequirementType.REQUIREMENT;
break;
case 21:
this.$ = n.RequirementType.FUNCTIONAL_REQUIREMENT;
break;
case 22:
this.$ = n.RequirementType.INTERFACE_REQUIREMENT;
break;
case 23:
this.$ = n.RequirementType.PERFORMANCE_REQUIREMENT;
break;
case 24:
this.$ = n.RequirementType.PHYSICAL_REQUIREMENT;
break;
case 25:
this.$ = n.RequirementType.DESIGN_CONSTRAINT;
break;
case 26:
this.$ = n.RiskLevel.LOW_RISK;
break;
case 27:
this.$ = n.RiskLevel.MED_RISK;
break;
case 28:
this.$ = n.RiskLevel.HIGH_RISK;
break;
case 29:
this.$ = n.VerifyType.VERIFY_ANALYSIS;
break;
case 30:
this.$ = n.VerifyType.VERIFY_DEMONSTRATION;
break;
case 31:
this.$ = n.VerifyType.VERIFY_INSPECTION;
break;
case 32:
this.$ = n.VerifyType.VERIFY_TEST;
break;
case 33:
n.addElement(s[_ - 3]);
break;
case 34:
n.setNewElementType(s[_ - 2]);
break;
case 35:
n.setNewElementDocRef(s[_ - 2]);
break;
case 38:
n.addRelationship(s[_ - 2], s[_], s[_ - 4]);
break;
case 39:
n.addRelationship(s[_ - 2], s[_ - 4], s[_]);
break;
case 40:
this.$ = n.Relationships.CONTAINS;
break;
case 41:
this.$ = n.Relationships.COPIES;
break;
case 42:
this.$ = n.Relationships.DERIVES;
break;
case 43:
this.$ = n.Relationships.SATISFIES;
break;
case 44:
this.$ = n.Relationships.VERIFIES;
break;
case 45:
this.$ = n.Relationships.REFINES;
break;
case 46:
this.$ = n.Relationships.TRACES;
break;
}
},
table: [{ 3: 1, 4: 2, 6: t, 9: l, 11: c, 13: u }, { 1: [3] }, { 3: 8, 4: 2, 5: [1, 7], 6: t, 9: l, 11: c, 13: u }, { 5: [1, 9] }, { 10: [1, 10] }, { 12: [1, 11] }, e(d, [2, 6]), { 3: 12, 4: 2, 6: t, 9: l, 11: c, 13: u }, { 1: [2, 2] }, { 4: 17, 5: f, 7: 13, 8: h, 9: l, 11: c, 13: u, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: o, 32: E, 33: R, 34: A, 35: T, 36: N, 44: w, 62: k, 63: x }, e(d, [2, 4]), e(d, [2, 5]), { 1: [2, 1] }, { 8: [1, 30] }, { 4: 17, 5: f, 7: 31, 8: h, 9: l, 11: c, 13: u, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: o, 32: E, 33: R, 34: A, 35: T, 36: N, 44: w, 62: k, 63: x }, { 4: 17, 5: f, 7: 32, 8: h, 9: l, 11: c, 13: u, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: o, 32: E, 33: R, 34: A, 35: T, 36: N, 44: w, 62: k, 63: x }, { 4: 17, 5: f, 7: 33, 8: h, 9: l, 11: c, 13: u, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: o, 32: E, 33: R, 34: A, 35: T, 36: N, 44: w, 62: k, 63: x }, { 4: 17, 5: f, 7: 34, 8: h, 9: l, 11: c, 13: u, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: o, 32: E, 33: R, 34: A, 35: T, 36: N, 44: w, 62: k, 63: x }, { 4: 17, 5: f, 7: 35, 8: h, 9: l, 11: c, 13: u, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: o, 32: E, 33: R, 34: A, 35: T, 36: N, 44: w, 62: k, 63: x }, { 18: 36, 62: [1, 37], 63: [1, 38] }, { 45: 39, 62: [1, 40], 63: [1, 41] }, { 51: [1, 42], 53: [1, 43] }, e(F, [2, 20]), e(F, [2, 21]), e(F, [2, 22]), e(F, [2, 23]), e(F, [2, 24]), e(F, [2, 25]), e(de, [2, 49]), e(de, [2, 50]), { 1: [2, 3] }, { 8: [2, 8] }, { 8: [2, 9] }, { 8: [2, 10] }, { 8: [2, 11] }, { 8: [2, 12] }, { 19: [1, 44] }, { 19: [2, 47] }, { 19: [2, 48] }, { 19: [1, 45] }, { 19: [2, 53] }, { 19: [2, 54] }, { 52: 46, 55: fe, 56: pe, 57: ye, 58: _e, 59: Ee, 60: ge, 61: Re }, { 52: 54, 55: fe, 56: pe, 57: ye, 58: _e, 59: Ee, 60: ge, 61: Re }, { 5: [1, 55] }, { 5: [1, 56] }, { 53: [1, 57] }, e(O, [2, 40]), e(O, [2, 41]), e(O, [2, 42]), e(O, [2, 43]), e(O, [2, 44]), e(O, [2, 45]), e(O, [2, 46]), { 54: [1, 58] }, { 5: M, 20: 59, 21: D, 24: P, 26: Y, 28: U, 30: B }, { 5: j, 30: z, 46: 66, 47: X, 49: J }, { 23: 71, 62: k, 63: x }, { 23: 72, 62: k, 63: x }, e(m, [2, 13]), { 22: [1, 73] }, { 22: [1, 74] }, { 22: [1, 75] }, { 22: [1, 76] }, { 5: M, 20: 77, 21: D, 24: P, 26: Y, 28: U, 30: B }, e(m, [2, 19]), e(m, [2, 33]), { 22: [1, 78] }, { 22: [1, 79] }, { 5: j, 30: z, 46: 80, 47: X, 49: J }, e(m, [2, 37]), e(m, [2, 38]), e(m, [2, 39]), { 23: 81, 62: k, 63: x }, { 25: 82, 62: [1, 83], 63: [1, 84] }, { 27: 85, 37: [1, 86], 38: [1, 87], 39: [1, 88] }, { 29: 89, 40: [1, 90], 41: [1, 91], 42: [1, 92], 43: [1, 93] }, e(m, [2, 18]), { 48: 94, 62: [1, 95], 63: [1, 96] }, { 50: 97, 62: [1, 98], 63: [1, 99] }, e(m, [2, 36]), { 5: [1, 100] }, { 5: [1, 101] }, { 5: [2, 51] }, { 5: [2, 52] }, { 5: [1, 102] }, { 5: [2, 26] }, { 5: [2, 27] }, { 5: [2, 28] }, { 5: [1, 103] }, { 5: [2, 29] }, { 5: [2, 30] }, { 5: [2, 31] }, { 5: [2, 32] }, { 5: [1, 104] }, { 5: [2, 55] }, { 5: [2, 56] }, { 5: [1, 105] }, { 5: [2, 57] }, { 5: [2, 58] }, { 5: M, 20: 106, 21: D, 24: P, 26: Y, 28: U, 30: B }, { 5: M, 20: 107, 21: D, 24: P, 26: Y, 28: U, 30: B }, { 5: M, 20: 108, 21: D, 24: P, 26: Y, 28: U, 30: B }, { 5: M, 20: 109, 21: D, 24: P, 26: Y, 28: U, 30: B }, { 5: j, 30: z, 46: 110, 47: X, 49: J }, { 5: j, 30: z, 46: 111, 47: X, 49: J }, e(m, [2, 14]), e(m, [2, 15]), e(m, [2, 16]), e(m, [2, 17]), e(m, [2, 34]), e(m, [2, 35])],
defaultActions: { 8: [2, 2], 12: [2, 1], 30: [2, 3], 31: [2, 8], 32: [2, 9], 33: [2, 10], 34: [2, 11], 35: [2, 12], 37: [2, 47], 38: [2, 48], 40: [2, 53], 41: [2, 54], 83: [2, 51], 84: [2, 52], 86: [2, 26], 87: [2, 27], 88: [2, 28], 90: [2, 29], 91: [2, 30], 92: [2, 31], 93: [2, 32], 95: [2, 55], 96: [2, 56], 98: [2, 57], 99: [2, 58] },
parseError: function(i, r) {
if (r.recoverable)
this.trace(i);
else {
var a = new Error(i);
throw a.hash = r, a;
}
},
parse: function(i) {
var r = this, a = [0], n = [], p = [null], s = [], W = this.table, _ = "", Z = 0, me = 0, Ve = 2, Ie = 1, qe = s.slice.call(arguments, 1), g = Object.create(this.lexer), L = { yy: {} };
for (var re in this.yy)
Object.prototype.hasOwnProperty.call(this.yy, re) && (L.yy[re] = this.yy[re]);
g.setInput(i, L.yy), L.yy.lexer = g, L.yy.parser = this, typeof g.yylloc > "u" && (g.yylloc = {});
var se = g.yylloc;
s.push(se);
var Oe = g.options && g.options.ranges;
typeof L.yy.parseError == "function" ? this.parseError = L.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
function Le() {
var v;
return v = n.pop() || g.lex() || Ie, typeof v != "number" && (v instanceof Array && (n = v, v = n.pop()), v = r.symbols_[v] || v), v;
}
for (var I, C, S, ae, Q = {}, ee, $, be, te; ; ) {
if (C = a[a.length - 1], this.defaultActions[C] ? S = this.defaultActions[C] : ((I === null || typeof I > "u") && (I = Le()), S = W[C] && W[C][I]), typeof S > "u" || !S.length || !S[0]) {
var le = "";
te = [];
for (ee in W[C])
this.terminals_[ee] && ee > Ve && te.push("'" + this.terminals_[ee] + "'");
g.showPosition ? le = "Parse error on line " + (Z + 1) + `:
` + g.showPosition() + `
Expecting ` + te.join(", ") + ", got '" + (this.terminals_[I] || I) + "'" : le = "Parse error on line " + (Z + 1) + ": Unexpected " + (I == Ie ? "end of input" : "'" + (this.terminals_[I] || I) + "'"), this.parseError(le, {
text: g.match,
token: this.terminals_[I] || I,
line: g.yylineno,
loc: se,
expected: te
});
}
if (S[0] instanceof Array && S.length > 1)
throw new Error("Parse Error: multiple actions possible at state: " + C + ", token: " + I);
switch (S[0]) {
case 1:
a.push(I), p.push(g.yytext), s.push(g.yylloc), a.push(S[1]), I = null, me = g.yyleng, _ = g.yytext, Z = g.yylineno, se = g.yylloc;
break;
case 2:
if ($ = this.productions_[S[1]][1], Q.$ = p[p.length - $], Q._$ = {
first_line: s[s.length - ($ || 1)].first_line,
last_line: s[s.length - 1].last_line,
first_column: s[s.length - ($ || 1)].first_column,
last_column: s[s.length - 1].last_column
}, Oe && (Q._$.range = [
s[s.length - ($ || 1)].range[0],
s[s.length - 1].range[1]
]), ae = this.performAction.apply(Q, [
_,
me,
Z,
L.yy,
S[1],
p,
s
].concat(qe)), typeof ae < "u")
return ae;
$ && (a = a.slice(0, -1 * $ * 2), p = p.slice(0, -1 * $), s = s.slice(0, -1 * $)), a.push(this.productions_[S[1]][0]), p.push(Q.$), s.push(Q._$), be = W[a[a.length - 2]][a[a.length - 1]], a.push(be);
break;
case 3:
return !0;
}
}
return !0;
}
}, ve = function() {
var V = {
EOF: 1,
parseError: function(r, a) {
if (this.yy.parser)
this.yy.parser.parseError(r, a);
else
throw new Error(r);
},
// resets the lexer, sets new input
setInput: function(i, r) {
return this.yy = r || this.yy || {}, this._input = i, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
},
// consumes and returns one char from the input
input: function() {
var i = this._input[0];
this.yytext += i, this.yyleng++, this.offset++, this.match += i, this.matched += i;
var r = i.match(/(?:\r\n?|\n).*/g);
return r ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), i;
},
// unshifts one char (or a string) into the input
unput: function(i) {
var r = i.length, a = i.split(/(?:\r\n?|\n)/g);
this._input = i + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - r), this.offset -= r;
var n = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), a.length - 1 && (this.yylineno -= a.length - 1);
var p = this.yylloc.range;
return this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: a ? (a.length === n.length ? this.yylloc.first_column : 0) + n[n.length - a.length].length - a[0].length : this.yylloc.first_column - r
}, this.options.ranges && (this.yylloc.range = [p[0], p[0] + this.yyleng - r]), this.yyleng = this.yytext.length, this;
},
// When called from action, caches matched text and appends it on next action
more: function() {
return this._more = !0, this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject: function() {
if (this.options.backtrack_lexer)
this._backtrack = !0;
else
return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
return this;
},
// retain first n characters of the match
less: function(i) {
this.unput(this.match.slice(i));
},
// displays already matched input, i.e. for error messages
pastInput: function() {
var i = this.matched.substr(0, this.matched.length - this.match.length);
return (i.length > 20 ? "..." : "") + i.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput: function() {
var i = this.match;
return i.length < 20 && (i += this._input.substr(0, 20 - i.length)), (i.substr(0, 20) + (i.length > 20 ? "..." : "")).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition: function() {
var i = this.pastInput(), r = new Array(i.length + 1).join("-");
return i + this.upcomingInput() + `
` + r + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match: function(i, r) {
var a, n, p;
if (this.options.backtrack_lexer && (p = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
}, this.options.ranges && (p.yylloc.range = this.yylloc.range.slice(0))), n = i[0].match(/(?:\r\n?|\n).*/g), n && (this.yylineno += n.length), this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: n ? n[n.length - 1].length - n[n.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + i[0].length
}, this.yytext += i[0], this.match += i[0], this.matches = i, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(i[0].length), this.matched += i[0], a = this.performAction.call(this, this.yy, this, r, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), a)
return a;
if (this._backtrack) {
for (var s in p)
this[s] = p[s];
return !1;
}
return !1;
},
// return next match in input
next: function() {
if (this.done)
return this.EOF;
this._input || (this.done = !0);
var i, r, a, n;
this._more || (this.yytext = "", this.match = "");
for (var p = this._currentRules(), s = 0; s < p.length; s++)
if (a = this._input.match(this.rules[p[s]]), a && (!r || a[0].length > r[0].length)) {
if (r = a, n = s, this.options.backtrack_lexer) {
if (i = this.test_match(a, p[s]), i !== !1)
return i;
if (this._backtrack) {
r = !1;
continue;
} else
return !1;
} else if (!this.options.flex)
break;
}
return r ? (i = this.test_match(r, p[n]), i !== !1 ? i : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
},
// return next match that has a token
lex: function() {
var r = this.next();
return r || this.lex();
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin: function(r) {
this.conditionStack.push(r);
},
// pop the previously active lexer condition state off the condition stack
popState: function() {
var r = this.conditionStack.length - 1;
return r > 0 ? this.conditionStack.pop() : this.conditionStack[0];
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules: function() {
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState: function(r) {
return r = this.conditionStack.length - 1 - Math.abs(r || 0), r >= 0 ? this.conditionStack[r] : "INITIAL";
},
// alias for begin(condition)
pushState: function(r) {
this.begin(r);
},
// return the number of states currently on the stack
stateStackSize: function() {
return this.conditionStack.length;
},
options: { "case-insensitive": !0 },
performAction: function(r, a, n, p) {
switch (n) {
case 0:
return "title";
case 1:
return this.begin("acc_title"), 9;
case 2:
return this.popState(), "acc_title_value";
case 3:
return this.begin("acc_descr"), 11;
case 4:
return this.popState(), "acc_descr_value";
case 5:
this.begin("acc_descr_multiline");
break;
case 6:
this.popState();
break;
case 7:
return "acc_descr_multiline_value";
case 8:
return 5;
case 9:
break;
case 10:
break;
case 11:
break;
case 12:
return 8;
case 13:
return 6;
case 14:
return 19;
case 15:
return 30;
case 16:
return 22;
case 17:
return 21;
case 18:
return 24;
case 19:
return 26;
case 20:
return 28;
case 21:
return 31;
case 22:
return 32;
case 23:
return 33;
case 24:
return 34;
case 25:
return 35;
case 26:
return 36;
case 27:
return 37;
case 28:
return 38;
case 29:
return 39;
case 30:
return 40;
case 31:
return 41;
case 32:
return 42;
case 33:
return 43;
case 34:
return 44;
case 35:
return 55;
case 36:
return 56;
case 37:
return 57;
case 38:
return 58;
case 39:
return 59;
case 40:
return 60;
case 41:
return 61;
case 42:
return 47;
case 43:
return 49;
case 44:
return 51;
case 45:
return 54;
case 46:
return 53;
case 47:
this.begin("string");
break;
case 48:
this.popState();
break;
case 49:
return "qString";
case 50:
return a.yytext = a.yytext.trim(), 62;
}
},
rules: [/^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:(\r?\n)+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:$)/i, /^(?:requirementDiagram\b)/i, /^(?:\{)/i, /^(?:\})/i, /^(?::)/i, /^(?:id\b)/i, /^(?:text\b)/i, /^(?:risk\b)/i, /^(?:verifyMethod\b)/i, /^(?:requirement\b)/i, /^(?:functionalRequirement\b)/i, /^(?:interfaceRequirement\b)/i, /^(?:performanceRequirement\b)/i, /^(?:physicalRequirement\b)/i, /^(?:designConstraint\b)/i, /^(?:low\b)/i, /^(?:medium\b)/i, /^(?:high\b)/i, /^(?:analysis\b)/i, /^(?:demonstration\b)/i, /^(?:inspection\b)/i, /^(?:test\b)/i, /^(?:element\b)/i, /^(?:contains\b)/i, /^(?:copies\b)/i, /^(?:derives\b)/i, /^(?:satisfies\b)/i, /^(?:verifies\b)/i, /^(?:refines\b)/i, /^(?:traces\b)/i, /^(?:type\b)/i, /^(?:docref\b)/i, /^(?:<-)/i, /^(?:->)/i, /^(?:-)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[\w][^\r\n\{\<\>\-\=]*)/i],
conditions: { acc_descr_multiline: { rules: [6, 7], inclusive: !1 }, acc_descr: { rules: [4], inclusive: !1 }, acc_title: { rules: [2], inclusive: !1 }, unqString: { rules: [], inclusive: !1 }, token: { rules: [], inclusive: !1 }, string: { rules: [48, 49], inclusive: !1 }, INITIAL: { rules: [0, 1, 3, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 50], inclusive: !0 } }
};
return V;
}();
ie.lexer = ve;
function ne() {
this.yy = {};
}
return ne.prototype = ie, ie.Parser = ne, new ne();
}();
ce.parser = ce;
const He = ce;
let ue = [], b = {}, K = {}, q = {}, G = {};
const We = {
REQUIREMENT: "Requirement",
FUNCTIONAL_REQUIREMENT: "Functional Requirement",
INTERFACE_REQUIREMENT: "Interface Requirement",
PERFORMANCE_REQUIREMENT: "Performance Requirement",
PHYSICAL_REQUIREMENT: "Physical Requirement",
DESIGN_CONSTRAINT: "Design Constraint"
}, Ke = {
LOW_RISK: "Low",
MED_RISK: "Medium",
HIGH_RISK: "High"
}, Ge = {
VERIFY_ANALYSIS: "Analysis",
VERIFY_DEMONSTRATION: "Demonstration",
VERIFY_INSPECTION: "Inspection",
VERIFY_TEST: "Test"
}, je = {
CONTAINS: "contains",
COPIES: "copies",
DERIVES: "derives",
SATISFIES: "satisfies",
VERIFIES: "verifies",
REFINES: "refines",
TRACES: "traces"
}, ze = (e, t) => (K[e] === void 0 && (K[e] = {
name: e,
type: t,
id: b.id,
text: b.text,
risk: b.risk,
verifyMethod: b.verifyMethod
}), b = {}, K[e]), Xe = () => K, Je = (e) => {
b !== void 0 && (b.id = e);
}, Ze = (e) => {
b !== void 0 && (b.text = e);
}, et = (e) => {
b !== void 0 && (b.risk = e);
}, tt = (e) => {
b !== void 0 && (b.verifyMethod = e);
}, it = (e) => (G[e] === void 0 && (G[e] = {
name: e,
type: q.type,
docRef: q.docRef
}, Ne.info("Added new requirement: ", e)), q = {}, G[e]), nt = () => G, rt = (e) => {
q !== void 0 && (q.type = e);
}, st = (e) => {
q !== void 0 && (q.docRef = e);
}, at = (e, t, l) => {
ue.push({
type: e,
src: t,
dst: l
});
}, lt = () => ue, ot = () => {
ue = [], b = {}, K = {}, q = {}, G = {}, Pe();
}, ct = {
RequirementType: We,
RiskLevel: Ke,
VerifyType: Ge,
Relationships: je,
getConfig: () => Te().req,
addRequirement: ze,
getRequirements: Xe,
setNewReqId: Je,
setNewReqText: Ze,
setNewReqRisk: et,
setNewReqVerifyMethod: tt,
setAccTitle: Ce,
getAccTitle: Fe,
setAccDescription: Me,
getAccDescription: De,
addElement: it,
getElements: nt,
setNewElementType: rt,
setNewElementDocRef: st,
addRelationship: at,
getRelationships: lt,
clear: ot
}, ht = (e) => `
marker {
fill: ${e.relationColor};
stroke: ${e.relationColor};
}
marker.cross {
stroke: ${e.lineColor};
}
svg {
font-family: ${e.fontFamily};
font-size: ${e.fontSize};
}
.reqBox {
fill: ${e.requirementBackground};
fill-opacity: 1.0;
stroke: ${e.requirementBorderColor};
stroke-width: ${e.requirementBorderSize};
}
.reqTitle, .reqLabel{
fill: ${e.requirementTextColor};
}
.reqLabelBox {
fill: ${e.relationLabelBackground};
fill-opacity: 1.0;
}
.req-title-line {
stroke: ${e.requirementBorderColor};
stroke-width: ${e.requirementBorderSize};
}
.relationshipLine {
stroke: ${e.relationColor};
stroke-width: 1;
}
.relationshipLabel {
fill: ${e.relationLabelColor};
}
`, ut = ht, he = {
CONTAINS: "contains",
ARROW: "arrow"
}, dt = (e, t) => {
let l = e.append("defs").append("marker").attr("id", he.CONTAINS + "_line_ending").attr("refX", 0).attr("refY", t.line_height / 2).attr("markerWidth", t.line_height).attr("markerHeight", t.line_height).attr("orient", "auto").append("g");
l.append("circle").attr("cx", t.line_height / 2).attr("cy", t.line_height / 2).attr("r", t.line_height / 2).attr("fill", "none"), l.append("line").attr("x1", 0).attr("x2", t.line_height).attr("y1", t.line_height / 2).attr("y2", t.line_height / 2).attr("stroke-width", 1), l.append("line").attr("y1", 0).attr("y2", t.line_height).attr("x1", t.line_height / 2).attr("x2", t.line_height / 2).attr("stroke-width", 1), e.append("defs").append("marker").attr("id", he.ARROW + "_line_ending").attr("refX", t.line_height).attr("refY", 0.5 * t.line_height).attr("markerWidth", t.line_height).attr("markerHeight", t.line_height).attr("orient", "auto").append("path").attr(
"d",
`M0,0
L${t.line_height},${t.line_height / 2}
M${t.line_height},${t.line_height / 2}
L0,${t.line_height}`
).attr("stroke-width", 1);
}, xe = {
ReqMarkers: he,
insertLineEndings: dt
};
let y = {}, Se = 0;
const Ae = (e, t) => e.insert("rect", "#" + t).attr("class", "req reqBox").attr("x", 0).attr("y", 0).attr("width", y.rect_min_width + "px").attr("height", y.rect_min_height + "px"), we = (e, t, l) => {
let c = y.rect_min_width / 2, u = e.append("text").attr("class", "req reqLabel reqTitle").attr("id", t).attr("x", c).attr("y", y.rect_padding).attr("dominant-baseline", "hanging"), d = 0;
l.forEach((E) => {
d == 0 ? u.append("tspan").attr("text-anchor", "middle").attr("x", y.rect_min_width / 2).attr("dy", 0).text(E) : u.append("tspan").attr("text-anchor", "middle").attr("x", y.rect_min_width / 2).attr("dy", y.line_height * 0.75).text(E), d++;
});
let f = 1.5 * y.rect_padding, h = d * y.line_height * 0.75, o = f + h;
return e.append("line").attr("class", "req-title-line").attr("x1", "0").attr("x2", y.rect_min_width).attr("y1", o).attr("y2", o), {
titleNode: u,
y: o
};
}, $e = (e, t, l, c) => {
let u = e.append("text").attr("class", "req reqLabel").attr("id", t).attr("x", y.rect_padding).attr("y", c).attr("dominant-baseline", "hanging"), d = 0;
const f = 30;
let h = [];
return l.forEach((o) => {
let E = o.length;
for (; E > f && d < 3; ) {
let R = o.substring(0, f);
o = o.substring(f, o.length), E = o.length, h[h.length] = R, d++;
}
if (d == 3) {
let R = h[h.length - 1];
h[h.length - 1] = R.substring(0, R.length - 4) + "...";
} else
h[h.length] = o;
d = 0;
}), h.forEach((o) => {
u.append("tspan").attr("x", y.rect_padding).attr("dy", y.line_height).text(o);
}), u;
}, ft = (e, t, l, c) => {
const u = t.node().getTotalLength(), d = t.node().getPointAtLength(u * 0.5), f = "rel" + Se;
Se++;
const o = e.append("text").attr("class", "req relationshipLabel").attr("id", f).attr("x", d.x).attr("y", d.y).attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(c).node().getBBox();
e.insert("rect", "#" + f).attr("class", "req reqLabelBox").attr("x", d.x - o.width / 2).attr("y", d.y - o.height / 2).attr("width", o.width).attr("height", o.height).attr("fill", "white").attr("fill-opacity", "85%");
}, pt = function(e, t, l, c, u) {
const d = l.edge(H(t.src), H(t.dst)), f = Qe().x(function(o) {
return o.x;
}).y(function(o) {
return o.y;
}), h = e.insert("path", "#" + c).attr("class", "er relationshipLine").attr("d", f(d.points)).attr("fill", "none");
t.type == u.db.Relationships.CONTAINS ? h.attr(
"marker-start",
"url(" + ke.getUrl(y.arrowMarkerAbsolute) + "#" + t.type + "_line_ending)"
) : (h.attr("stroke-dasharray", "10,7"), h.attr(
"marker-end",
"url(" + ke.getUrl(y.arrowMarkerAbsolute) + "#" + xe.ReqMarkers.ARROW + "_line_ending)"
)), ft(e, h, y, `<<${t.type}>>`);
}, yt = (e, t, l) => {
Object.keys(e).forEach((c) => {
let u = e[c];
c = H(c), Ne.info("Added new requirement: ", c);
const d = l.append("g").attr("id", c), f = "req-" + c, h = Ae(d, f);
let o = we(d, c + "_title", [
`<<${u.type}>>`,
`${u.name}`
]);
$e(
d,
c + "_body",
[
`Id: ${u.id}`,
`Text: ${u.text}`,
`Risk: ${u.risk}`,
`Verification: ${u.verifyMethod}`
],
o.y
);
const E = h.node().getBBox();
t.setNode(c, {
width: E.width,
height: E.height,
shape: "rect",
id: c
});
});
}, _t = (e, t, l) => {
Object.keys(e).forEach((c) => {
let u = e[c];
const d = H(c), f = l.append("g").attr("id", d), h = "element-" + d, o = Ae(f, h);
let E = we(f, h + "_title", ["<<Element>>", `${c}`]);
$e(
f,
h + "_body",
[`Type: ${u.type || "Not Specified"}`, `Doc Ref: ${u.docRef || "None"}`],
E.y
);
const R = o.node().getBBox();
t.setNode(d, {
width: R.width,
height: R.height,
shape: "rect",
id: d
});
});
}, Et = (e, t) => (e.forEach(function(l) {
let c = H(l.src), u = H(l.dst);
t.setEdge(c, u, { relationship: l });
}), e), gt = function(e, t) {
t.nodes().forEach(function(l) {
l !== void 0 && t.node(l) !== void 0 && (e.select("#" + l), e.select("#" + l).attr(
"transform",
"translate(" + (t.node(l).x - t.node(l).width / 2) + "," + (t.node(l).y - t.node(l).height / 2) + " )"
));
});
}, H = (e) => e.replace(/\s/g, "").replace(/\./g, "_"), Rt = (e, t, l, c) => {
y = Te().requirement;
const u = y.securityLevel;
let d;
u === "sandbox" && (d = oe("#i" + t));
const h = (u === "sandbox" ? oe(d.nodes()[0].contentDocument.body) : oe("body")).select(`[id='${t}']`);
xe.insertLineEndings(h, y);
const o = new Ue({
multigraph: !1,
compound: !1,
directed: !0
}).setGraph({
rankdir: y.layoutDirection,
marginx: 20,
marginy: 20,
nodesep: 100,
edgesep: 100,
ranksep: 100
}).setDefaultEdgeLabel(function() {
return {};
});
let E = c.db.getRequirements(), R = c.db.getElements(), A = c.db.getRelationships();
yt(E, o, h), _t(R, o, h), Et(A, o), Be(o), gt(h, o), A.forEach(function(x) {
pt(h, x, o, t, c);
});
const T = y.rect_padding, N = h.node().getBBox(), w = N.width + T * 2, k = N.height + T * 2;
Ye(h, k, w, y.useMaxWidth), h.attr("viewBox", `${N.x - T} ${N.y - T} ${w} ${k}`);
}, mt = {
draw: Rt
}, xt = {
parser: He,
db: ct,
renderer: mt,
styles: ut
};
export {
xt as diagram
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,818 @@
import { c as rt, g as mt, s as kt, a as _t, b as xt, D as vt, C as bt, E as wt, f as St, ar as Lt, j as G, t as Et } from "./mermaid-9f2aa176.js";
import { o as At } from "./ordinal-5695958c.js";
import { d as Tt } from "./Tableau10-558cc280.js";
import "./init-f9637058.js";
var tt = function() {
var t = function(m, i, o, c) {
for (o = o || {}, c = m.length; c--; o[m[c]] = i)
;
return o;
}, n = [1, 9], s = [1, 10], a = [1, 5, 10, 12], u = {
trace: function() {
},
yy: {},
symbols_: { error: 2, start: 3, SANKEY: 4, NEWLINE: 5, csv: 6, opt_eof: 7, record: 8, csv_tail: 9, EOF: 10, "field[source]": 11, COMMA: 12, "field[target]": 13, "field[value]": 14, field: 15, escaped: 16, non_escaped: 17, DQUOTE: 18, ESCAPED_TEXT: 19, NON_ESCAPED_TEXT: 20, $accept: 0, $end: 1 },
terminals_: { 2: "error", 4: "SANKEY", 5: "NEWLINE", 10: "EOF", 11: "field[source]", 12: "COMMA", 13: "field[target]", 14: "field[value]", 18: "DQUOTE", 19: "ESCAPED_TEXT", 20: "NON_ESCAPED_TEXT" },
productions_: [0, [3, 4], [6, 2], [9, 2], [9, 0], [7, 1], [7, 0], [8, 5], [15, 1], [15, 1], [16, 3], [17, 1]],
performAction: function(i, o, c, k, b, d, x) {
var E = d.length - 1;
switch (b) {
case 7:
const L = k.findOrCreateNode(d[E - 4].trim().replaceAll('""', '"')), A = k.findOrCreateNode(d[E - 2].trim().replaceAll('""', '"')), N = parseFloat(d[E].trim());
k.addLink(L, A, N);
break;
case 8:
case 9:
case 11:
this.$ = d[E];
break;
case 10:
this.$ = d[E - 1];
break;
}
},
table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, { 5: [1, 3] }, { 6: 4, 8: 5, 15: 6, 16: 7, 17: 8, 18: n, 20: s }, { 1: [2, 6], 7: 11, 10: [1, 12] }, t(s, [2, 4], { 9: 13, 5: [1, 14] }), { 12: [1, 15] }, t(a, [2, 8]), t(a, [2, 9]), { 19: [1, 16] }, t(a, [2, 11]), { 1: [2, 1] }, { 1: [2, 5] }, t(s, [2, 2]), { 6: 17, 8: 5, 15: 6, 16: 7, 17: 8, 18: n, 20: s }, { 15: 18, 16: 7, 17: 8, 18: n, 20: s }, { 18: [1, 19] }, t(s, [2, 3]), { 12: [1, 20] }, t(a, [2, 10]), { 15: 21, 16: 7, 17: 8, 18: n, 20: s }, t([1, 5, 10], [2, 7])],
defaultActions: { 11: [2, 1], 12: [2, 5] },
parseError: function(i, o) {
if (o.recoverable)
this.trace(i);
else {
var c = new Error(i);
throw c.hash = o, c;
}
},
parse: function(i) {
var o = this, c = [0], k = [], b = [null], d = [], x = this.table, E = "", L = 0, A = 0, N = 2, C = 1, j = d.slice.call(arguments, 1), S = Object.create(this.lexer), M = { yy: {} };
for (var $ in this.yy)
Object.prototype.hasOwnProperty.call(this.yy, $) && (M.yy[$] = this.yy[$]);
S.setInput(i, M.yy), M.yy.lexer = S, M.yy.parser = this, typeof S.yylloc > "u" && (S.yylloc = {});
var P = S.yylloc;
d.push(P);
var I = S.options && S.options.ranges;
typeof M.yy.parseError == "function" ? this.parseError = M.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
function g() {
var v;
return v = k.pop() || S.lex() || C, typeof v != "number" && (v instanceof Array && (k = v, v = k.pop()), v = o.symbols_[v] || v), v;
}
for (var w, O, T, V, e = {}, f, l, h, r; ; ) {
if (O = c[c.length - 1], this.defaultActions[O] ? T = this.defaultActions[O] : ((w === null || typeof w > "u") && (w = g()), T = x[O] && x[O][w]), typeof T > "u" || !T.length || !T[0]) {
var _ = "";
r = [];
for (f in x[O])
this.terminals_[f] && f > N && r.push("'" + this.terminals_[f] + "'");
S.showPosition ? _ = "Parse error on line " + (L + 1) + `:
` + S.showPosition() + `
Expecting ` + r.join(", ") + ", got '" + (this.terminals_[w] || w) + "'" : _ = "Parse error on line " + (L + 1) + ": Unexpected " + (w == C ? "end of input" : "'" + (this.terminals_[w] || w) + "'"), this.parseError(_, {
text: S.match,
token: this.terminals_[w] || w,
line: S.yylineno,
loc: P,
expected: r
});
}
if (T[0] instanceof Array && T.length > 1)
throw new Error("Parse Error: multiple actions possible at state: " + O + ", token: " + w);
switch (T[0]) {
case 1:
c.push(w), b.push(S.yytext), d.push(S.yylloc), c.push(T[1]), w = null, A = S.yyleng, E = S.yytext, L = S.yylineno, P = S.yylloc;
break;
case 2:
if (l = this.productions_[T[1]][1], e.$ = b[b.length - l], e._$ = {
first_line: d[d.length - (l || 1)].first_line,
last_line: d[d.length - 1].last_line,
first_column: d[d.length - (l || 1)].first_column,
last_column: d[d.length - 1].last_column
}, I && (e._$.range = [
d[d.length - (l || 1)].range[0],
d[d.length - 1].range[1]
]), V = this.performAction.apply(e, [
E,
A,
L,
M.yy,
T[1],
b,
d
].concat(j)), typeof V < "u")
return V;
l && (c = c.slice(0, -1 * l * 2), b = b.slice(0, -1 * l), d = d.slice(0, -1 * l)), c.push(this.productions_[T[1]][0]), b.push(e.$), d.push(e._$), h = x[c[c.length - 2]][c[c.length - 1]], c.push(h);
break;
case 3:
return !0;
}
}
return !0;
}
}, y = function() {
var m = {
EOF: 1,
parseError: function(o, c) {
if (this.yy.parser)
this.yy.parser.parseError(o, c);
else
throw new Error(o);
},
// resets the lexer, sets new input
setInput: function(i, o) {
return this.yy = o || this.yy || {}, this._input = i, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
},
// consumes and returns one char from the input
input: function() {
var i = this._input[0];
this.yytext += i, this.yyleng++, this.offset++, this.match += i, this.matched += i;
var o = i.match(/(?:\r\n?|\n).*/g);
return o ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), i;
},
// unshifts one char (or a string) into the input
unput: function(i) {
var o = i.length, c = i.split(/(?:\r\n?|\n)/g);
this._input = i + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - o), this.offset -= o;
var k = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), c.length - 1 && (this.yylineno -= c.length - 1);
var b = this.yylloc.range;
return this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: c ? (c.length === k.length ? this.yylloc.first_column : 0) + k[k.length - c.length].length - c[0].length : this.yylloc.first_column - o
}, this.options.ranges && (this.yylloc.range = [b[0], b[0] + this.yyleng - o]), this.yyleng = this.yytext.length, this;
},
// When called from action, caches matched text and appends it on next action
more: function() {
return this._more = !0, this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject: function() {
if (this.options.backtrack_lexer)
this._backtrack = !0;
else
return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
return this;
},
// retain first n characters of the match
less: function(i) {
this.unput(this.match.slice(i));
},
// displays already matched input, i.e. for error messages
pastInput: function() {
var i = this.matched.substr(0, this.matched.length - this.match.length);
return (i.length > 20 ? "..." : "") + i.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput: function() {
var i = this.match;
return i.length < 20 && (i += this._input.substr(0, 20 - i.length)), (i.substr(0, 20) + (i.length > 20 ? "..." : "")).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition: function() {
var i = this.pastInput(), o = new Array(i.length + 1).join("-");
return i + this.upcomingInput() + `
` + o + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match: function(i, o) {
var c, k, b;
if (this.options.backtrack_lexer && (b = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
}, this.options.ranges && (b.yylloc.range = this.yylloc.range.slice(0))), k = i[0].match(/(?:\r\n?|\n).*/g), k && (this.yylineno += k.length), this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: k ? k[k.length - 1].length - k[k.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + i[0].length
}, this.yytext += i[0], this.match += i[0], this.matches = i, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(i[0].length), this.matched += i[0], c = this.performAction.call(this, this.yy, this, o, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), c)
return c;
if (this._backtrack) {
for (var d in b)
this[d] = b[d];
return !1;
}
return !1;
},
// return next match in input
next: function() {
if (this.done)
return this.EOF;
this._input || (this.done = !0);
var i, o, c, k;
this._more || (this.yytext = "", this.match = "");
for (var b = this._currentRules(), d = 0; d < b.length; d++)
if (c = this._input.match(this.rules[b[d]]), c && (!o || c[0].length > o[0].length)) {
if (o = c, k = d, this.options.backtrack_lexer) {
if (i = this.test_match(c, b[d]), i !== !1)
return i;
if (this._backtrack) {
o = !1;
continue;
} else
return !1;
} else if (!this.options.flex)
break;
}
return o ? (i = this.test_match(o, b[k]), i !== !1 ? i : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
},
// return next match that has a token
lex: function() {
var o = this.next();
return o || this.lex();
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin: function(o) {
this.conditionStack.push(o);
},
// pop the previously active lexer condition state off the condition stack
popState: function() {
var o = this.conditionStack.length - 1;
return o > 0 ? this.conditionStack.pop() : this.conditionStack[0];
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules: function() {
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState: function(o) {
return o = this.conditionStack.length - 1 - Math.abs(o || 0), o >= 0 ? this.conditionStack[o] : "INITIAL";
},
// alias for begin(condition)
pushState: function(o) {
this.begin(o);
},
// return the number of states currently on the stack
stateStackSize: function() {
return this.conditionStack.length;
},
options: { "case-insensitive": !0 },
performAction: function(o, c, k, b) {
switch (k) {
case 0:
return this.pushState("csv"), 4;
case 1:
return 10;
case 2:
return 5;
case 3:
return 12;
case 4:
return this.pushState("escaped_text"), 18;
case 5:
return 20;
case 6:
return this.popState("escaped_text"), 18;
case 7:
return 19;
}
},
rules: [/^(?:sankey-beta\b)/i, /^(?:$)/i, /^(?:((\u000D\u000A)|(\u000A)))/i, /^(?:(\u002C))/i, /^(?:(\u0022))/i, /^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i, /^(?:(\u0022)(?!(\u0022)))/i, /^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],
conditions: { csv: { rules: [1, 2, 3, 4, 5, 6, 7], inclusive: !1 }, escaped_text: { rules: [6, 7], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7], inclusive: !0 } }
};
return m;
}();
u.lexer = y;
function p() {
this.yy = {};
}
return p.prototype = u, u.Parser = p, new p();
}();
tt.parser = tt;
const H = tt;
let q = [], Q = [], B = {};
const Mt = () => {
q = [], Q = [], B = {}, wt();
};
class Nt {
constructor(n, s, a = 0) {
this.source = n, this.target = s, this.value = a;
}
}
const Ct = (t, n, s) => {
q.push(new Nt(t, n, s));
};
class Pt {
constructor(n) {
this.ID = n;
}
}
const It = (t) => (t = St.sanitizeText(t, rt()), B[t] || (B[t] = new Pt(t), Q.push(B[t])), B[t]), Ot = () => Q, $t = () => q, jt = () => ({
nodes: Q.map((t) => ({ id: t.ID })),
links: q.map((t) => ({
source: t.source.ID,
target: t.target.ID,
value: t.value
}))
}), zt = {
nodesMap: B,
getConfig: () => rt().sankey,
getNodes: Ot,
getLinks: $t,
getGraph: jt,
addLink: Ct,
findOrCreateNode: It,
getAccTitle: mt,
setAccTitle: kt,
getAccDescription: _t,
setAccDescription: xt,
getDiagramTitle: vt,
setDiagramTitle: bt,
clear: Mt
};
function ot(t, n) {
let s;
if (n === void 0)
for (const a of t)
a != null && (s < a || s === void 0 && a >= a) && (s = a);
else {
let a = -1;
for (let u of t)
(u = n(u, ++a, t)) != null && (s < u || s === void 0 && u >= u) && (s = u);
}
return s;
}
function yt(t, n) {
let s;
if (n === void 0)
for (const a of t)
a != null && (s > a || s === void 0 && a >= a) && (s = a);
else {
let a = -1;
for (let u of t)
(u = n(u, ++a, t)) != null && (s > u || s === void 0 && u >= u) && (s = u);
}
return s;
}
function Z(t, n) {
let s = 0;
if (n === void 0)
for (let a of t)
(a = +a) && (s += a);
else {
let a = -1;
for (let u of t)
(u = +n(u, ++a, t)) && (s += u);
}
return s;
}
function Dt(t) {
return t.target.depth;
}
function Bt(t) {
return t.depth;
}
function Vt(t, n) {
return n - 1 - t.height;
}
function dt(t, n) {
return t.sourceLinks.length ? t.depth : n - 1;
}
function Rt(t) {
return t.targetLinks.length ? t.depth : t.sourceLinks.length ? yt(t.sourceLinks, Dt) - 1 : 0;
}
function Y(t) {
return function() {
return t;
};
}
function lt(t, n) {
return X(t.source, n.source) || t.index - n.index;
}
function at(t, n) {
return X(t.target, n.target) || t.index - n.index;
}
function X(t, n) {
return t.y0 - n.y0;
}
function J(t) {
return t.value;
}
function Ut(t) {
return t.index;
}
function Ft(t) {
return t.nodes;
}
function Wt(t) {
return t.links;
}
function ct(t, n) {
const s = t.get(n);
if (!s)
throw new Error("missing: " + n);
return s;
}
function ut({ nodes: t }) {
for (const n of t) {
let s = n.y0, a = s;
for (const u of n.sourceLinks)
u.y0 = s + u.width / 2, s += u.width;
for (const u of n.targetLinks)
u.y1 = a + u.width / 2, a += u.width;
}
}
function Gt() {
let t = 0, n = 0, s = 1, a = 1, u = 24, y = 8, p, m = Ut, i = dt, o, c, k = Ft, b = Wt, d = 6;
function x() {
const e = { nodes: k.apply(null, arguments), links: b.apply(null, arguments) };
return E(e), L(e), A(e), N(e), S(e), ut(e), e;
}
x.update = function(e) {
return ut(e), e;
}, x.nodeId = function(e) {
return arguments.length ? (m = typeof e == "function" ? e : Y(e), x) : m;
}, x.nodeAlign = function(e) {
return arguments.length ? (i = typeof e == "function" ? e : Y(e), x) : i;
}, x.nodeSort = function(e) {
return arguments.length ? (o = e, x) : o;
}, x.nodeWidth = function(e) {
return arguments.length ? (u = +e, x) : u;
}, x.nodePadding = function(e) {
return arguments.length ? (y = p = +e, x) : y;
}, x.nodes = function(e) {
return arguments.length ? (k = typeof e == "function" ? e : Y(e), x) : k;
}, x.links = function(e) {
return arguments.length ? (b = typeof e == "function" ? e : Y(e), x) : b;
}, x.linkSort = function(e) {
return arguments.length ? (c = e, x) : c;
}, x.size = function(e) {
return arguments.length ? (t = n = 0, s = +e[0], a = +e[1], x) : [s - t, a - n];
}, x.extent = function(e) {
return arguments.length ? (t = +e[0][0], s = +e[1][0], n = +e[0][1], a = +e[1][1], x) : [[t, n], [s, a]];
}, x.iterations = function(e) {
return arguments.length ? (d = +e, x) : d;
};
function E({ nodes: e, links: f }) {
for (const [h, r] of e.entries())
r.index = h, r.sourceLinks = [], r.targetLinks = [];
const l = new Map(e.map((h, r) => [m(h, r, e), h]));
for (const [h, r] of f.entries()) {
r.index = h;
let { source: _, target: v } = r;
typeof _ != "object" && (_ = r.source = ct(l, _)), typeof v != "object" && (v = r.target = ct(l, v)), _.sourceLinks.push(r), v.targetLinks.push(r);
}
if (c != null)
for (const { sourceLinks: h, targetLinks: r } of e)
h.sort(c), r.sort(c);
}
function L({ nodes: e }) {
for (const f of e)
f.value = f.fixedValue === void 0 ? Math.max(Z(f.sourceLinks, J), Z(f.targetLinks, J)) : f.fixedValue;
}
function A({ nodes: e }) {
const f = e.length;
let l = new Set(e), h = /* @__PURE__ */ new Set(), r = 0;
for (; l.size; ) {
for (const _ of l) {
_.depth = r;
for (const { target: v } of _.sourceLinks)
h.add(v);
}
if (++r > f)
throw new Error("circular link");
l = h, h = /* @__PURE__ */ new Set();
}
}
function N({ nodes: e }) {
const f = e.length;
let l = new Set(e), h = /* @__PURE__ */ new Set(), r = 0;
for (; l.size; ) {
for (const _ of l) {
_.height = r;
for (const { source: v } of _.targetLinks)
h.add(v);
}
if (++r > f)
throw new Error("circular link");
l = h, h = /* @__PURE__ */ new Set();
}
}
function C({ nodes: e }) {
const f = ot(e, (r) => r.depth) + 1, l = (s - t - u) / (f - 1), h = new Array(f);
for (const r of e) {
const _ = Math.max(0, Math.min(f - 1, Math.floor(i.call(null, r, f))));
r.layer = _, r.x0 = t + _ * l, r.x1 = r.x0 + u, h[_] ? h[_].push(r) : h[_] = [r];
}
if (o)
for (const r of h)
r.sort(o);
return h;
}
function j(e) {
const f = yt(e, (l) => (a - n - (l.length - 1) * p) / Z(l, J));
for (const l of e) {
let h = n;
for (const r of l) {
r.y0 = h, r.y1 = h + r.value * f, h = r.y1 + p;
for (const _ of r.sourceLinks)
_.width = _.value * f;
}
h = (a - h + p) / (l.length + 1);
for (let r = 0; r < l.length; ++r) {
const _ = l[r];
_.y0 += h * (r + 1), _.y1 += h * (r + 1);
}
O(l);
}
}
function S(e) {
const f = C(e);
p = Math.min(y, (a - n) / (ot(f, (l) => l.length) - 1)), j(f);
for (let l = 0; l < d; ++l) {
const h = Math.pow(0.99, l), r = Math.max(1 - h, (l + 1) / d);
$(f, h, r), M(f, h, r);
}
}
function M(e, f, l) {
for (let h = 1, r = e.length; h < r; ++h) {
const _ = e[h];
for (const v of _) {
let R = 0, z = 0;
for (const { source: F, value: K } of v.targetLinks) {
let W = K * (v.layer - F.layer);
R += T(F, v) * W, z += W;
}
if (!(z > 0))
continue;
let U = (R / z - v.y0) * f;
v.y0 += U, v.y1 += U, w(v);
}
o === void 0 && _.sort(X), P(_, l);
}
}
function $(e, f, l) {
for (let h = e.length, r = h - 2; r >= 0; --r) {
const _ = e[r];
for (const v of _) {
let R = 0, z = 0;
for (const { target: F, value: K } of v.sourceLinks) {
let W = K * (F.layer - v.layer);
R += V(v, F) * W, z += W;
}
if (!(z > 0))
continue;
let U = (R / z - v.y0) * f;
v.y0 += U, v.y1 += U, w(v);
}
o === void 0 && _.sort(X), P(_, l);
}
}
function P(e, f) {
const l = e.length >> 1, h = e[l];
g(e, h.y0 - p, l - 1, f), I(e, h.y1 + p, l + 1, f), g(e, a, e.length - 1, f), I(e, n, 0, f);
}
function I(e, f, l, h) {
for (; l < e.length; ++l) {
const r = e[l], _ = (f - r.y0) * h;
_ > 1e-6 && (r.y0 += _, r.y1 += _), f = r.y1 + p;
}
}
function g(e, f, l, h) {
for (; l >= 0; --l) {
const r = e[l], _ = (r.y1 - f) * h;
_ > 1e-6 && (r.y0 -= _, r.y1 -= _), f = r.y0 - p;
}
}
function w({ sourceLinks: e, targetLinks: f }) {
if (c === void 0) {
for (const { source: { sourceLinks: l } } of f)
l.sort(at);
for (const { target: { targetLinks: l } } of e)
l.sort(lt);
}
}
function O(e) {
if (c === void 0)
for (const { sourceLinks: f, targetLinks: l } of e)
f.sort(at), l.sort(lt);
}
function T(e, f) {
let l = e.y0 - (e.sourceLinks.length - 1) * p / 2;
for (const { target: h, width: r } of e.sourceLinks) {
if (h === f)
break;
l += r + p;
}
for (const { source: h, width: r } of f.targetLinks) {
if (h === e)
break;
l -= r;
}
return l;
}
function V(e, f) {
let l = f.y0 - (f.targetLinks.length - 1) * p / 2;
for (const { source: h, width: r } of f.targetLinks) {
if (h === e)
break;
l += r + p;
}
for (const { target: h, width: r } of e.sourceLinks) {
if (h === f)
break;
l -= r;
}
return l;
}
return x;
}
var et = Math.PI, nt = 2 * et, D = 1e-6, Yt = nt - D;
function it() {
this._x0 = this._y0 = // start of current subpath
this._x1 = this._y1 = null, this._ = "";
}
function gt() {
return new it();
}
it.prototype = gt.prototype = {
constructor: it,
moveTo: function(t, n) {
this._ += "M" + (this._x0 = this._x1 = +t) + "," + (this._y0 = this._y1 = +n);
},
closePath: function() {
this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._ += "Z");
},
lineTo: function(t, n) {
this._ += "L" + (this._x1 = +t) + "," + (this._y1 = +n);
},
quadraticCurveTo: function(t, n, s, a) {
this._ += "Q" + +t + "," + +n + "," + (this._x1 = +s) + "," + (this._y1 = +a);
},
bezierCurveTo: function(t, n, s, a, u, y) {
this._ += "C" + +t + "," + +n + "," + +s + "," + +a + "," + (this._x1 = +u) + "," + (this._y1 = +y);
},
arcTo: function(t, n, s, a, u) {
t = +t, n = +n, s = +s, a = +a, u = +u;
var y = this._x1, p = this._y1, m = s - t, i = a - n, o = y - t, c = p - n, k = o * o + c * c;
if (u < 0)
throw new Error("negative radius: " + u);
if (this._x1 === null)
this._ += "M" + (this._x1 = t) + "," + (this._y1 = n);
else if (k > D)
if (!(Math.abs(c * m - i * o) > D) || !u)
this._ += "L" + (this._x1 = t) + "," + (this._y1 = n);
else {
var b = s - y, d = a - p, x = m * m + i * i, E = b * b + d * d, L = Math.sqrt(x), A = Math.sqrt(k), N = u * Math.tan((et - Math.acos((x + k - E) / (2 * L * A))) / 2), C = N / A, j = N / L;
Math.abs(C - 1) > D && (this._ += "L" + (t + C * o) + "," + (n + C * c)), this._ += "A" + u + "," + u + ",0,0," + +(c * b > o * d) + "," + (this._x1 = t + j * m) + "," + (this._y1 = n + j * i);
}
},
arc: function(t, n, s, a, u, y) {
t = +t, n = +n, s = +s, y = !!y;
var p = s * Math.cos(a), m = s * Math.sin(a), i = t + p, o = n + m, c = 1 ^ y, k = y ? a - u : u - a;
if (s < 0)
throw new Error("negative radius: " + s);
this._x1 === null ? this._ += "M" + i + "," + o : (Math.abs(this._x1 - i) > D || Math.abs(this._y1 - o) > D) && (this._ += "L" + i + "," + o), s && (k < 0 && (k = k % nt + nt), k > Yt ? this._ += "A" + s + "," + s + ",0,1," + c + "," + (t - p) + "," + (n - m) + "A" + s + "," + s + ",0,1," + c + "," + (this._x1 = i) + "," + (this._y1 = o) : k > D && (this._ += "A" + s + "," + s + ",0," + +(k >= et) + "," + c + "," + (this._x1 = t + s * Math.cos(u)) + "," + (this._y1 = n + s * Math.sin(u))));
},
rect: function(t, n, s, a) {
this._ += "M" + (this._x0 = this._x1 = +t) + "," + (this._y0 = this._y1 = +n) + "h" + +s + "v" + +a + "h" + -s + "Z";
},
toString: function() {
return this._;
}
};
function ht(t) {
return function() {
return t;
};
}
function Ht(t) {
return t[0];
}
function Xt(t) {
return t[1];
}
var qt = Array.prototype.slice;
function Qt(t) {
return t.source;
}
function Kt(t) {
return t.target;
}
function Zt(t) {
var n = Qt, s = Kt, a = Ht, u = Xt, y = null;
function p() {
var m, i = qt.call(arguments), o = n.apply(this, i), c = s.apply(this, i);
if (y || (y = m = gt()), t(y, +a.apply(this, (i[0] = o, i)), +u.apply(this, i), +a.apply(this, (i[0] = c, i)), +u.apply(this, i)), m)
return y = null, m + "" || null;
}
return p.source = function(m) {
return arguments.length ? (n = m, p) : n;
}, p.target = function(m) {
return arguments.length ? (s = m, p) : s;
}, p.x = function(m) {
return arguments.length ? (a = typeof m == "function" ? m : ht(+m), p) : a;
}, p.y = function(m) {
return arguments.length ? (u = typeof m == "function" ? m : ht(+m), p) : u;
}, p.context = function(m) {
return arguments.length ? (y = m ?? null, p) : y;
}, p;
}
function Jt(t, n, s, a, u) {
t.moveTo(n, s), t.bezierCurveTo(n = (n + a) / 2, s, n, u, a, u);
}
function te() {
return Zt(Jt);
}
function ee(t) {
return [t.source.x1, t.y0];
}
function ne(t) {
return [t.target.x0, t.y1];
}
function ie() {
return te().source(ee).target(ne);
}
const pt = class st {
static next(n) {
return new st(n + ++st.count);
}
constructor(n) {
this.id = n, this.href = `#${n}`;
}
toString() {
return "url(" + this.href + ")";
}
};
pt.count = 0;
let ft = pt;
const se = {
left: Bt,
right: Vt,
center: Rt,
justify: dt
}, re = function(t, n, s, a) {
const { securityLevel: u, sankey: y } = rt(), p = Lt.sankey;
let m;
u === "sandbox" && (m = G("#i" + n));
const i = u === "sandbox" ? G(m.nodes()[0].contentDocument.body) : G("body"), o = u === "sandbox" ? i.select(`[id="${n}"]`) : G(`[id="${n}"]`), c = (y == null ? void 0 : y.width) ?? p.width, k = (y == null ? void 0 : y.height) ?? p.width, b = (y == null ? void 0 : y.useMaxWidth) ?? p.useMaxWidth, d = (y == null ? void 0 : y.nodeAlignment) ?? p.nodeAlignment, x = (y == null ? void 0 : y.prefix) ?? p.prefix, E = (y == null ? void 0 : y.suffix) ?? p.suffix, L = (y == null ? void 0 : y.showValues) ?? p.showValues, A = a.db.getGraph(), N = se[d], C = 10;
Gt().nodeId((g) => g.id).nodeWidth(C).nodePadding(10 + (L ? 15 : 0)).nodeAlign(N).extent([
[0, 0],
[c, k]
])(A);
const S = At(Tt);
o.append("g").attr("class", "nodes").selectAll(".node").data(A.nodes).join("g").attr("class", "node").attr("id", (g) => (g.uid = ft.next("node-")).id).attr("transform", function(g) {
return "translate(" + g.x0 + "," + g.y0 + ")";
}).attr("x", (g) => g.x0).attr("y", (g) => g.y0).append("rect").attr("height", (g) => g.y1 - g.y0).attr("width", (g) => g.x1 - g.x0).attr("fill", (g) => S(g.id));
const M = ({ id: g, value: w }) => L ? `${g}
${x}${Math.round(w * 100) / 100}${E}` : g;
o.append("g").attr("class", "node-labels").attr("font-family", "sans-serif").attr("font-size", 14).selectAll("text").data(A.nodes).join("text").attr("x", (g) => g.x0 < c / 2 ? g.x1 + 6 : g.x0 - 6).attr("y", (g) => (g.y1 + g.y0) / 2).attr("dy", `${L ? "0" : "0.35"}em`).attr("text-anchor", (g) => g.x0 < c / 2 ? "start" : "end").text(M);
const $ = o.append("g").attr("class", "links").attr("fill", "none").attr("stroke-opacity", 0.5).selectAll(".link").data(A.links).join("g").attr("class", "link").style("mix-blend-mode", "multiply"), P = (y == null ? void 0 : y.linkColor) || "gradient";
if (P === "gradient") {
const g = $.append("linearGradient").attr("id", (w) => (w.uid = ft.next("linearGradient-")).id).attr("gradientUnits", "userSpaceOnUse").attr("x1", (w) => w.source.x1).attr("x2", (w) => w.target.x0);
g.append("stop").attr("offset", "0%").attr("stop-color", (w) => S(w.source.id)), g.append("stop").attr("offset", "100%").attr("stop-color", (w) => S(w.target.id));
}
let I;
switch (P) {
case "gradient":
I = (g) => g.uid;
break;
case "source":
I = (g) => S(g.source.id);
break;
case "target":
I = (g) => S(g.target.id);
break;
default:
I = P;
}
$.append("path").attr("d", ie()).attr("stroke", I).attr("stroke-width", (g) => Math.max(1, g.width)), Et(void 0, o, 0, b);
}, oe = {
draw: re
}, le = (t) => t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g, "").replaceAll(/([\n\r])+/g, `
`).trim(), ae = H.parse.bind(H);
H.parse = (t) => ae(le(t));
const ye = {
parser: H,
db: zt,
renderer: oe
};
export {
ye as diagram
};

View file

@ -0,0 +1,660 @@
import { c as getConfig, g as getAccTitle, s as setAccTitle, a as getAccDescription, b as setAccDescription, t as getDiagramTitle, q as setDiagramTitle, v as clear$1, e as common, K as defaultConfig, o as setupGraphViewbox } from "./mermaid-6dc72991.js";
import { select, scaleOrdinal, schemeTableau10 } from "d3";
import { sankey, sankeyLinkHorizontal, sankeyLeft, sankeyRight, sankeyCenter, sankeyJustify } from "d3-sankey";
import "ts-dedent";
import "dayjs";
import "@braintree/sanitize-url";
import "dompurify";
import "khroma";
import "lodash-es/memoize.js";
import "lodash-es/merge.js";
import "stylis";
import "lodash-es/isEmpty.js";
var parser = function() {
var o = function(k, v, o2, l) {
for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
;
return o2;
}, $V0 = [1, 9], $V1 = [1, 10], $V2 = [1, 5, 10, 12];
var parser2 = {
trace: function trace() {
},
yy: {},
symbols_: { "error": 2, "start": 3, "SANKEY": 4, "NEWLINE": 5, "csv": 6, "opt_eof": 7, "record": 8, "csv_tail": 9, "EOF": 10, "field[source]": 11, "COMMA": 12, "field[target]": 13, "field[value]": 14, "field": 15, "escaped": 16, "non_escaped": 17, "DQUOTE": 18, "ESCAPED_TEXT": 19, "NON_ESCAPED_TEXT": 20, "$accept": 0, "$end": 1 },
terminals_: { 2: "error", 4: "SANKEY", 5: "NEWLINE", 10: "EOF", 11: "field[source]", 12: "COMMA", 13: "field[target]", 14: "field[value]", 18: "DQUOTE", 19: "ESCAPED_TEXT", 20: "NON_ESCAPED_TEXT" },
productions_: [0, [3, 4], [6, 2], [9, 2], [9, 0], [7, 1], [7, 0], [8, 5], [15, 1], [15, 1], [16, 3], [17, 1]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
var $0 = $$.length - 1;
switch (yystate) {
case 7:
const source = yy.findOrCreateNode($$[$0 - 4].trim().replaceAll('""', '"'));
const target = yy.findOrCreateNode($$[$0 - 2].trim().replaceAll('""', '"'));
const value = parseFloat($$[$0].trim());
yy.addLink(source, target, value);
break;
case 8:
case 9:
case 11:
this.$ = $$[$0];
break;
case 10:
this.$ = $$[$0 - 1];
break;
}
},
table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, { 5: [1, 3] }, { 6: 4, 8: 5, 15: 6, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 1: [2, 6], 7: 11, 10: [1, 12] }, o($V1, [2, 4], { 9: 13, 5: [1, 14] }), { 12: [1, 15] }, o($V2, [2, 8]), o($V2, [2, 9]), { 19: [1, 16] }, o($V2, [2, 11]), { 1: [2, 1] }, { 1: [2, 5] }, o($V1, [2, 2]), { 6: 17, 8: 5, 15: 6, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 15: 18, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 18: [1, 19] }, o($V1, [2, 3]), { 12: [1, 20] }, o($V2, [2, 10]), { 15: 21, 16: 7, 17: 8, 18: $V0, 20: $V1 }, o([1, 5, 10], [2, 7])],
defaultActions: { 11: [2, 1], 12: [2, 5] },
parseError: function parseError(str, hash) {
if (hash.recoverable) {
this.trace(str);
} else {
var error = new Error(str);
error.hash = hash;
throw error;
}
},
parse: function parse(input) {
var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
var args = lstack.slice.call(arguments, 1);
var lexer2 = Object.create(this.lexer);
var sharedState = { yy: {} };
for (var k in this.yy) {
if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
sharedState.yy[k] = this.yy[k];
}
}
lexer2.setInput(input, sharedState.yy);
sharedState.yy.lexer = lexer2;
sharedState.yy.parser = this;
if (typeof lexer2.yylloc == "undefined") {
lexer2.yylloc = {};
}
var yyloc = lexer2.yylloc;
lstack.push(yyloc);
var ranges = lexer2.options && lexer2.options.ranges;
if (typeof sharedState.yy.parseError === "function") {
this.parseError = sharedState.yy.parseError;
} else {
this.parseError = Object.getPrototypeOf(this).parseError;
}
function lex() {
var token;
token = tstack.pop() || lexer2.lex() || EOF;
if (typeof token !== "number") {
if (token instanceof Array) {
tstack = token;
token = tstack.pop();
}
token = self.symbols_[token] || token;
}
return token;
}
var symbol, state, action, r, yyval = {}, p, len, newState, expected;
while (true) {
state = stack[stack.length - 1];
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || typeof symbol == "undefined") {
symbol = lex();
}
action = table[state] && table[state][symbol];
}
if (typeof action === "undefined" || !action.length || !action[0]) {
var errStr = "";
expected = [];
for (p in table[state]) {
if (this.terminals_[p] && p > TERROR) {
expected.push("'" + this.terminals_[p] + "'");
}
}
if (lexer2.showPosition) {
errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
} else {
errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
}
this.parseError(errStr, {
text: lexer2.match,
token: this.terminals_[symbol] || symbol,
line: lexer2.yylineno,
loc: yyloc,
expected
});
}
if (action[0] instanceof Array && action.length > 1) {
throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
}
switch (action[0]) {
case 1:
stack.push(symbol);
vstack.push(lexer2.yytext);
lstack.push(lexer2.yylloc);
stack.push(action[1]);
symbol = null;
{
yyleng = lexer2.yyleng;
yytext = lexer2.yytext;
yylineno = lexer2.yylineno;
yyloc = lexer2.yylloc;
}
break;
case 2:
len = this.productions_[action[1]][1];
yyval.$ = vstack[vstack.length - len];
yyval._$ = {
first_line: lstack[lstack.length - (len || 1)].first_line,
last_line: lstack[lstack.length - 1].last_line,
first_column: lstack[lstack.length - (len || 1)].first_column,
last_column: lstack[lstack.length - 1].last_column
};
if (ranges) {
yyval._$.range = [
lstack[lstack.length - (len || 1)].range[0],
lstack[lstack.length - 1].range[1]
];
}
r = this.performAction.apply(yyval, [
yytext,
yyleng,
yylineno,
sharedState.yy,
action[1],
vstack,
lstack
].concat(args));
if (typeof r !== "undefined") {
return r;
}
if (len) {
stack = stack.slice(0, -1 * len * 2);
vstack = vstack.slice(0, -1 * len);
lstack = lstack.slice(0, -1 * len);
}
stack.push(this.productions_[action[1]][0]);
vstack.push(yyval.$);
lstack.push(yyval._$);
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
stack.push(newState);
break;
case 3:
return true;
}
}
return true;
}
};
var lexer = function() {
var lexer2 = {
EOF: 1,
parseError: function parseError(str, hash) {
if (this.yy.parser) {
this.yy.parser.parseError(str, hash);
} else {
throw new Error(str);
}
},
// resets the lexer, sets new input
setInput: function(input, yy) {
this.yy = yy || this.yy || {};
this._input = input;
this._more = this._backtrack = this.done = false;
this.yylineno = this.yyleng = 0;
this.yytext = this.matched = this.match = "";
this.conditionStack = ["INITIAL"];
this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
};
if (this.options.ranges) {
this.yylloc.range = [0, 0];
}
this.offset = 0;
return this;
},
// consumes and returns one char from the input
input: function() {
var ch = this._input[0];
this.yytext += ch;
this.yyleng++;
this.offset++;
this.match += ch;
this.matched += ch;
var lines = ch.match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno++;
this.yylloc.last_line++;
} else {
this.yylloc.last_column++;
}
if (this.options.ranges) {
this.yylloc.range[1]++;
}
this._input = this._input.slice(1);
return ch;
},
// unshifts one char (or a string) into the input
unput: function(ch) {
var len = ch.length;
var lines = ch.split(/(?:\r\n?|\n)/g);
this._input = ch + this._input;
this.yytext = this.yytext.substr(0, this.yytext.length - len);
this.offset -= len;
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1);
this.matched = this.matched.substr(0, this.matched.length - 1);
if (lines.length - 1) {
this.yylineno -= lines.length - 1;
}
var r = this.yylloc.range;
this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
};
if (this.options.ranges) {
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
}
this.yyleng = this.yytext.length;
return this;
},
// When called from action, caches matched text and appends it on next action
more: function() {
this._more = true;
return this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject: function() {
if (this.options.backtrack_lexer) {
this._backtrack = true;
} else {
return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
return this;
},
// retain first n characters of the match
less: function(n) {
this.unput(this.match.slice(n));
},
// displays already matched input, i.e. for error messages
pastInput: function() {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput: function() {
var next = this.match;
if (next.length < 20) {
next += this._input.substr(0, 20 - next.length);
}
return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition: function() {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match: function(match, indexed_rule) {
var token, lines, backup;
if (this.options.backtrack_lexer) {
backup = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
};
if (this.options.ranges) {
backup.yylloc.range = this.yylloc.range.slice(0);
}
}
lines = match[0].match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno += lines.length;
}
this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
};
this.yytext += match[0];
this.match += match[0];
this.matches = match;
this.yyleng = this.yytext.length;
if (this.options.ranges) {
this.yylloc.range = [this.offset, this.offset += this.yyleng];
}
this._more = false;
this._backtrack = false;
this._input = this._input.slice(match[0].length);
this.matched += match[0];
token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
if (this.done && this._input) {
this.done = false;
}
if (token) {
return token;
} else if (this._backtrack) {
for (var k in backup) {
this[k] = backup[k];
}
return false;
}
return false;
},
// return next match in input
next: function() {
if (this.done) {
return this.EOF;
}
if (!this._input) {
this.done = true;
}
var token, match, tempMatch, index;
if (!this._more) {
this.yytext = "";
this.match = "";
}
var rules = this._currentRules();
for (var i = 0; i < rules.length; i++) {
tempMatch = this._input.match(this.rules[rules[i]]);
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
match = tempMatch;
index = i;
if (this.options.backtrack_lexer) {
token = this.test_match(tempMatch, rules[i]);
if (token !== false) {
return token;
} else if (this._backtrack) {
match = false;
continue;
} else {
return false;
}
} else if (!this.options.flex) {
break;
}
}
}
if (match) {
token = this.test_match(match, rules[index]);
if (token !== false) {
return token;
}
return false;
}
if (this._input === "") {
return this.EOF;
} else {
return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
},
// return next match that has a token
lex: function lex() {
var r = this.next();
if (r) {
return r;
} else {
return this.lex();
}
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin: function begin(condition) {
this.conditionStack.push(condition);
},
// pop the previously active lexer condition state off the condition stack
popState: function popState() {
var n = this.conditionStack.length - 1;
if (n > 0) {
return this.conditionStack.pop();
} else {
return this.conditionStack[0];
}
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules: function _currentRules() {
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
} else {
return this.conditions["INITIAL"].rules;
}
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState: function topState(n) {
n = this.conditionStack.length - 1 - Math.abs(n || 0);
if (n >= 0) {
return this.conditionStack[n];
} else {
return "INITIAL";
}
},
// alias for begin(condition)
pushState: function pushState(condition) {
this.begin(condition);
},
// return the number of states currently on the stack
stateStackSize: function stateStackSize() {
return this.conditionStack.length;
},
options: { "case-insensitive": true },
performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
switch ($avoiding_name_collisions) {
case 0:
this.pushState("csv");
return 4;
case 1:
return 10;
case 2:
return 5;
case 3:
return 12;
case 4:
this.pushState("escaped_text");
return 18;
case 5:
return 20;
case 6:
this.popState("escaped_text");
return 18;
case 7:
return 19;
}
},
rules: [/^(?:sankey-beta\b)/i, /^(?:$)/i, /^(?:((\u000D\u000A)|(\u000A)))/i, /^(?:(\u002C))/i, /^(?:(\u0022))/i, /^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i, /^(?:(\u0022)(?!(\u0022)))/i, /^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],
conditions: { "csv": { "rules": [1, 2, 3, 4, 5, 6, 7], "inclusive": false }, "escaped_text": { "rules": [6, 7], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7], "inclusive": true } }
};
return lexer2;
}();
parser2.lexer = lexer;
function Parser() {
this.yy = {};
}
Parser.prototype = parser2;
parser2.Parser = Parser;
return new Parser();
}();
parser.parser = parser;
const parser$1 = parser;
let links = [];
let nodes = [];
let nodesMap = {};
const clear = () => {
links = [];
nodes = [];
nodesMap = {};
clear$1();
};
class SankeyLink {
constructor(source, target, value = 0) {
this.source = source;
this.target = target;
this.value = value;
}
}
const addLink = (source, target, value) => {
links.push(new SankeyLink(source, target, value));
};
class SankeyNode {
constructor(ID) {
this.ID = ID;
}
}
const findOrCreateNode = (ID) => {
ID = common.sanitizeText(ID, getConfig());
if (!nodesMap[ID]) {
nodesMap[ID] = new SankeyNode(ID);
nodes.push(nodesMap[ID]);
}
return nodesMap[ID];
};
const getNodes = () => nodes;
const getLinks = () => links;
const getGraph = () => ({
nodes: nodes.map((node) => ({ id: node.ID })),
links: links.map((link) => ({
source: link.source.ID,
target: link.target.ID,
value: link.value
}))
});
const db = {
nodesMap,
getConfig: () => getConfig().sankey,
getNodes,
getLinks,
getGraph,
addLink,
findOrCreateNode,
getAccTitle,
setAccTitle,
getAccDescription,
setAccDescription,
getDiagramTitle,
setDiagramTitle,
clear
};
const _Uid = class _Uid2 {
static next(name) {
return new _Uid2(name + ++_Uid2.count);
}
constructor(id) {
this.id = id;
this.href = `#${id}`;
}
toString() {
return "url(" + this.href + ")";
}
};
_Uid.count = 0;
let Uid = _Uid;
const alignmentsMap = {
left: sankeyLeft,
right: sankeyRight,
center: sankeyCenter,
justify: sankeyJustify
};
const draw = function(text, id, _version, diagObj) {
const { securityLevel, sankey: conf } = getConfig();
const defaultSankeyConfig = defaultConfig.sankey;
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = select("#i" + id);
}
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
const svg = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select(`[id="${id}"]`);
const width = (conf == null ? void 0 : conf.width) ?? defaultSankeyConfig.width;
const height = (conf == null ? void 0 : conf.height) ?? defaultSankeyConfig.width;
const useMaxWidth = (conf == null ? void 0 : conf.useMaxWidth) ?? defaultSankeyConfig.useMaxWidth;
const nodeAlignment = (conf == null ? void 0 : conf.nodeAlignment) ?? defaultSankeyConfig.nodeAlignment;
const prefix = (conf == null ? void 0 : conf.prefix) ?? defaultSankeyConfig.prefix;
const suffix = (conf == null ? void 0 : conf.suffix) ?? defaultSankeyConfig.suffix;
const showValues = (conf == null ? void 0 : conf.showValues) ?? defaultSankeyConfig.showValues;
const graph = diagObj.db.getGraph();
const nodeAlign = alignmentsMap[nodeAlignment];
const nodeWidth = 10;
const sankey$1 = sankey().nodeId((d) => d.id).nodeWidth(nodeWidth).nodePadding(10 + (showValues ? 15 : 0)).nodeAlign(nodeAlign).extent([
[0, 0],
[width, height]
]);
sankey$1(graph);
const colorScheme = scaleOrdinal(schemeTableau10);
svg.append("g").attr("class", "nodes").selectAll(".node").data(graph.nodes).join("g").attr("class", "node").attr("id", (d) => (d.uid = Uid.next("node-")).id).attr("transform", function(d) {
return "translate(" + d.x0 + "," + d.y0 + ")";
}).attr("x", (d) => d.x0).attr("y", (d) => d.y0).append("rect").attr("height", (d) => {
return d.y1 - d.y0;
}).attr("width", (d) => d.x1 - d.x0).attr("fill", (d) => colorScheme(d.id));
const getText = ({ id: id2, value }) => {
if (!showValues) {
return id2;
}
return `${id2}
${prefix}${Math.round(value * 100) / 100}${suffix}`;
};
svg.append("g").attr("class", "node-labels").attr("font-family", "sans-serif").attr("font-size", 14).selectAll("text").data(graph.nodes).join("text").attr("x", (d) => d.x0 < width / 2 ? d.x1 + 6 : d.x0 - 6).attr("y", (d) => (d.y1 + d.y0) / 2).attr("dy", `${showValues ? "0" : "0.35"}em`).attr("text-anchor", (d) => d.x0 < width / 2 ? "start" : "end").text(getText);
const link = svg.append("g").attr("class", "links").attr("fill", "none").attr("stroke-opacity", 0.5).selectAll(".link").data(graph.links).join("g").attr("class", "link").style("mix-blend-mode", "multiply");
const linkColor = (conf == null ? void 0 : conf.linkColor) || "gradient";
if (linkColor === "gradient") {
const gradient = link.append("linearGradient").attr("id", (d) => (d.uid = Uid.next("linearGradient-")).id).attr("gradientUnits", "userSpaceOnUse").attr("x1", (d) => d.source.x1).attr("x2", (d) => d.target.x0);
gradient.append("stop").attr("offset", "0%").attr("stop-color", (d) => colorScheme(d.source.id));
gradient.append("stop").attr("offset", "100%").attr("stop-color", (d) => colorScheme(d.target.id));
}
let coloring;
switch (linkColor) {
case "gradient":
coloring = (d) => d.uid;
break;
case "source":
coloring = (d) => colorScheme(d.source.id);
break;
case "target":
coloring = (d) => colorScheme(d.target.id);
break;
default:
coloring = linkColor;
}
link.append("path").attr("d", sankeyLinkHorizontal()).attr("stroke", coloring).attr("stroke-width", (d) => Math.max(1, d.width));
setupGraphViewbox(void 0, svg, 0, useMaxWidth);
};
const renderer = {
draw
};
const prepareTextForParsing = (text) => {
const textToParse = text.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g, "").replaceAll(/([\n\r])+/g, "\n").trim();
return textToParse;
};
const originalParse = parser$1.parse.bind(parser$1);
parser$1.parse = (text) => originalParse(prepareTextForParsing(text));
const diagram = {
parser: parser$1,
db,
renderer
};
export {
diagram
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,474 @@
import { d as db, p as parser, s as styles } from "./styles-0784dbeb.js";
import { line, curveBasis, select } from "d3";
import { layout } from "dagre-d3-es/src/dagre/index.js";
import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
import { c as getConfig, u as utils, e as common, l as log, i as configureSvgSize } from "./mermaid-6dc72991.js";
import "ts-dedent";
import "dayjs";
import "@braintree/sanitize-url";
import "dompurify";
import "khroma";
import "lodash-es/memoize.js";
import "lodash-es/merge.js";
import "stylis";
import "lodash-es/isEmpty.js";
const idCache = {};
const set = (key, val) => {
idCache[key] = val;
};
const get = (k) => idCache[k];
const keys = () => Object.keys(idCache);
const size = () => keys().length;
const idCache$1 = {
get,
set,
keys,
size
};
const drawStartState = (g) => g.append("circle").attr("class", "start-state").attr("r", getConfig().state.sizeUnit).attr("cx", getConfig().state.padding + getConfig().state.sizeUnit).attr("cy", getConfig().state.padding + getConfig().state.sizeUnit);
const drawDivider = (g) => g.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", getConfig().state.textHeight).attr("class", "divider").attr("x2", getConfig().state.textHeight * 2).attr("y1", 0).attr("y2", 0);
const drawSimpleState = (g, stateDef) => {
const state = g.append("text").attr("x", 2 * getConfig().state.padding).attr("y", getConfig().state.textHeight + 2 * getConfig().state.padding).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.id);
const classBox = state.node().getBBox();
g.insert("rect", ":first-child").attr("x", getConfig().state.padding).attr("y", getConfig().state.padding).attr("width", classBox.width + 2 * getConfig().state.padding).attr("height", classBox.height + 2 * getConfig().state.padding).attr("rx", getConfig().state.radius);
return state;
};
const drawDescrState = (g, stateDef) => {
const addTspan = function(textEl, txt, isFirst2) {
const tSpan = textEl.append("tspan").attr("x", 2 * getConfig().state.padding).text(txt);
if (!isFirst2) {
tSpan.attr("dy", getConfig().state.textHeight);
}
};
const title = g.append("text").attr("x", 2 * getConfig().state.padding).attr("y", getConfig().state.textHeight + 1.3 * getConfig().state.padding).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.descriptions[0]);
const titleBox = title.node().getBBox();
const titleHeight = titleBox.height;
const description = g.append("text").attr("x", getConfig().state.padding).attr(
"y",
titleHeight + getConfig().state.padding * 0.4 + getConfig().state.dividerMargin + getConfig().state.textHeight
).attr("class", "state-description");
let isFirst = true;
let isSecond = true;
stateDef.descriptions.forEach(function(descr) {
if (!isFirst) {
addTspan(description, descr, isSecond);
isSecond = false;
}
isFirst = false;
});
const descrLine = g.append("line").attr("x1", getConfig().state.padding).attr("y1", getConfig().state.padding + titleHeight + getConfig().state.dividerMargin / 2).attr("y2", getConfig().state.padding + titleHeight + getConfig().state.dividerMargin / 2).attr("class", "descr-divider");
const descrBox = description.node().getBBox();
const width = Math.max(descrBox.width, titleBox.width);
descrLine.attr("x2", width + 3 * getConfig().state.padding);
g.insert("rect", ":first-child").attr("x", getConfig().state.padding).attr("y", getConfig().state.padding).attr("width", width + 2 * getConfig().state.padding).attr("height", descrBox.height + titleHeight + 2 * getConfig().state.padding).attr("rx", getConfig().state.radius);
return g;
};
const addTitleAndBox = (g, stateDef, altBkg) => {
const pad = getConfig().state.padding;
const dblPad = 2 * getConfig().state.padding;
const orgBox = g.node().getBBox();
const orgWidth = orgBox.width;
const orgX = orgBox.x;
const title = g.append("text").attr("x", 0).attr("y", getConfig().state.titleShift).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.id);
const titleBox = title.node().getBBox();
const titleWidth = titleBox.width + dblPad;
let width = Math.max(titleWidth, orgWidth);
if (width === orgWidth) {
width = width + dblPad;
}
let startX;
const graphBox = g.node().getBBox();
if (stateDef.doc)
;
startX = orgX - pad;
if (titleWidth > orgWidth) {
startX = (orgWidth - width) / 2 + pad;
}
if (Math.abs(orgX - graphBox.x) < pad && titleWidth > orgWidth) {
startX = orgX - (titleWidth - orgWidth) / 2;
}
const lineY = 1 - getConfig().state.textHeight;
g.insert("rect", ":first-child").attr("x", startX).attr("y", lineY).attr("class", altBkg ? "alt-composit" : "composit").attr("width", width).attr(
"height",
graphBox.height + getConfig().state.textHeight + getConfig().state.titleShift + 1
).attr("rx", "0");
title.attr("x", startX + pad);
if (titleWidth <= orgWidth) {
title.attr("x", orgX + (width - dblPad) / 2 - titleWidth / 2 + pad);
}
g.insert("rect", ":first-child").attr("x", startX).attr(
"y",
getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding
).attr("width", width).attr("height", getConfig().state.textHeight * 3).attr("rx", getConfig().state.radius);
g.insert("rect", ":first-child").attr("x", startX).attr(
"y",
getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding
).attr("width", width).attr("height", graphBox.height + 3 + 2 * getConfig().state.textHeight).attr("rx", getConfig().state.radius);
return g;
};
const drawEndState = (g) => {
g.append("circle").attr("class", "end-state-outer").attr("r", getConfig().state.sizeUnit + getConfig().state.miniPadding).attr(
"cx",
getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
).attr(
"cy",
getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
);
return g.append("circle").attr("class", "end-state-inner").attr("r", getConfig().state.sizeUnit).attr("cx", getConfig().state.padding + getConfig().state.sizeUnit + 2).attr("cy", getConfig().state.padding + getConfig().state.sizeUnit + 2);
};
const drawForkJoinState = (g, stateDef) => {
let width = getConfig().state.forkWidth;
let height = getConfig().state.forkHeight;
if (stateDef.parentId) {
let tmp = width;
width = height;
height = tmp;
}
return g.append("rect").style("stroke", "black").style("fill", "black").attr("width", width).attr("height", height).attr("x", getConfig().state.padding).attr("y", getConfig().state.padding);
};
const _drawLongText = (_text, x, y, g) => {
let textHeight = 0;
const textElem = g.append("text");
textElem.style("text-anchor", "start");
textElem.attr("class", "noteText");
let text = _text.replace(/\r\n/g, "<br/>");
text = text.replace(/\n/g, "<br/>");
const lines = text.split(common.lineBreakRegex);
let tHeight = 1.25 * getConfig().state.noteMargin;
for (const line2 of lines) {
const txt = line2.trim();
if (txt.length > 0) {
const span = textElem.append("tspan");
span.text(txt);
if (tHeight === 0) {
const textBounds = span.node().getBBox();
tHeight += textBounds.height;
}
textHeight += tHeight;
span.attr("x", x + getConfig().state.noteMargin);
span.attr("y", y + textHeight + 1.25 * getConfig().state.noteMargin);
}
}
return { textWidth: textElem.node().getBBox().width, textHeight };
};
const drawNote = (text, g) => {
g.attr("class", "state-note");
const note = g.append("rect").attr("x", 0).attr("y", getConfig().state.padding);
const rectElem = g.append("g");
const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem);
note.attr("height", textHeight + 2 * getConfig().state.noteMargin);
note.attr("width", textWidth + getConfig().state.noteMargin * 2);
return note;
};
const drawState = function(elem, stateDef) {
const id = stateDef.id;
const stateInfo = {
id,
label: stateDef.id,
width: 0,
height: 0
};
const g = elem.append("g").attr("id", id).attr("class", "stateGroup");
if (stateDef.type === "start") {
drawStartState(g);
}
if (stateDef.type === "end") {
drawEndState(g);
}
if (stateDef.type === "fork" || stateDef.type === "join") {
drawForkJoinState(g, stateDef);
}
if (stateDef.type === "note") {
drawNote(stateDef.note.text, g);
}
if (stateDef.type === "divider") {
drawDivider(g);
}
if (stateDef.type === "default" && stateDef.descriptions.length === 0) {
drawSimpleState(g, stateDef);
}
if (stateDef.type === "default" && stateDef.descriptions.length > 0) {
drawDescrState(g, stateDef);
}
const stateBox = g.node().getBBox();
stateInfo.width = stateBox.width + 2 * getConfig().state.padding;
stateInfo.height = stateBox.height + 2 * getConfig().state.padding;
idCache$1.set(id, stateInfo);
return stateInfo;
};
let edgeCount = 0;
const drawEdge = function(elem, path, relation) {
const getRelationType = function(type) {
switch (type) {
case db.relationType.AGGREGATION:
return "aggregation";
case db.relationType.EXTENSION:
return "extension";
case db.relationType.COMPOSITION:
return "composition";
case db.relationType.DEPENDENCY:
return "dependency";
}
};
path.points = path.points.filter((p) => !Number.isNaN(p.y));
const lineData = path.points;
const lineFunction = line().x(function(d) {
return d.x;
}).y(function(d) {
return d.y;
}).curve(curveBasis);
const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "transition");
let url = "";
if (getConfig().state.arrowMarkerAbsolute) {
url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
url = url.replace(/\(/g, "\\(");
url = url.replace(/\)/g, "\\)");
}
svgPath.attr(
"marker-end",
"url(" + url + "#" + getRelationType(db.relationType.DEPENDENCY) + "End)"
);
if (relation.title !== void 0) {
const label = elem.append("g").attr("class", "stateLabel");
const { x, y } = utils.calcLabelPosition(path.points);
const rows = common.getRows(relation.title);
let titleHeight = 0;
const titleRows = [];
let maxWidth = 0;
let minX = 0;
for (let i = 0; i <= rows.length; i++) {
const title = label.append("text").attr("text-anchor", "middle").text(rows[i]).attr("x", x).attr("y", y + titleHeight);
const boundsTmp = title.node().getBBox();
maxWidth = Math.max(maxWidth, boundsTmp.width);
minX = Math.min(minX, boundsTmp.x);
log.info(boundsTmp.x, x, y + titleHeight);
if (titleHeight === 0) {
const titleBox = title.node().getBBox();
titleHeight = titleBox.height;
log.info("Title height", titleHeight, y);
}
titleRows.push(title);
}
let boxHeight = titleHeight * rows.length;
if (rows.length > 1) {
const heightAdj = (rows.length - 1) * titleHeight * 0.5;
titleRows.forEach((title, i) => title.attr("y", y + i * titleHeight - heightAdj));
boxHeight = titleHeight * rows.length;
}
const bounds = label.node().getBBox();
label.insert("rect", ":first-child").attr("class", "box").attr("x", x - maxWidth / 2 - getConfig().state.padding / 2).attr("y", y - boxHeight / 2 - getConfig().state.padding / 2 - 3.5).attr("width", maxWidth + getConfig().state.padding).attr("height", boxHeight + getConfig().state.padding);
log.info(bounds);
}
edgeCount++;
};
let conf;
const transformationLog = {};
const setConf = function() {
};
const insertMarkers = function(elem) {
elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
};
const draw = function(text, id, _version, diagObj) {
conf = getConfig().state;
const securityLevel = getConfig().securityLevel;
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = select("#i" + id);
}
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
log.debug("Rendering diagram " + text);
const diagram2 = root.select(`[id='${id}']`);
insertMarkers(diagram2);
const rootDoc = diagObj.db.getRootDoc();
renderDoc(rootDoc, diagram2, void 0, false, root, doc, diagObj);
const padding = conf.padding;
const bounds = diagram2.node().getBBox();
const width = bounds.width + padding * 2;
const height = bounds.height + padding * 2;
const svgWidth = width * 1.75;
configureSvgSize(diagram2, height, svgWidth, conf.useMaxWidth);
diagram2.attr(
"viewBox",
`${bounds.x - conf.padding} ${bounds.y - conf.padding} ` + width + " " + height
);
};
const getLabelWidth = (text) => {
return text ? text.length * conf.fontSizeFactor : 1;
};
const renderDoc = (doc, diagram2, parentId, altBkg, root, domDocument, diagObj) => {
const graph = new graphlib.Graph({
compound: true,
multigraph: true
});
let i;
let edgeFreeDoc = true;
for (i = 0; i < doc.length; i++) {
if (doc[i].stmt === "relation") {
edgeFreeDoc = false;
break;
}
}
if (parentId) {
graph.setGraph({
rankdir: "LR",
multigraph: true,
compound: true,
// acyclicer: 'greedy',
ranker: "tight-tree",
ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
nodeSep: edgeFreeDoc ? 1 : 50,
isMultiGraph: true
// ranksep: 5,
// nodesep: 1
});
} else {
graph.setGraph({
rankdir: "TB",
multigraph: true,
compound: true,
// isCompound: true,
// acyclicer: 'greedy',
// ranker: 'longest-path'
ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
nodeSep: edgeFreeDoc ? 1 : 50,
ranker: "tight-tree",
// ranker: 'network-simplex'
isMultiGraph: true
});
}
graph.setDefaultEdgeLabel(function() {
return {};
});
diagObj.db.extract(doc);
const states = diagObj.db.getStates();
const relations = diagObj.db.getRelations();
const keys2 = Object.keys(states);
for (const key of keys2) {
const stateDef = states[key];
if (parentId) {
stateDef.parentId = parentId;
}
let node;
if (stateDef.doc) {
let sub = diagram2.append("g").attr("id", stateDef.id).attr("class", "stateGroup");
node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg, root, domDocument, diagObj);
{
sub = addTitleAndBox(sub, stateDef, altBkg);
let boxBounds = sub.node().getBBox();
node.width = boxBounds.width;
node.height = boxBounds.height + conf.padding / 2;
transformationLog[stateDef.id] = { y: conf.compositTitleSize };
}
} else {
node = drawState(diagram2, stateDef);
}
if (stateDef.note) {
const noteDef = {
descriptions: [],
id: stateDef.id + "-note",
note: stateDef.note,
type: "note"
};
const note = drawState(diagram2, noteDef);
if (stateDef.note.position === "left of") {
graph.setNode(node.id + "-note", note);
graph.setNode(node.id, node);
} else {
graph.setNode(node.id, node);
graph.setNode(node.id + "-note", note);
}
graph.setParent(node.id, node.id + "-group");
graph.setParent(node.id + "-note", node.id + "-group");
} else {
graph.setNode(node.id, node);
}
}
log.debug("Count=", graph.nodeCount(), graph);
let cnt = 0;
relations.forEach(function(relation) {
cnt++;
log.debug("Setting edge", relation);
graph.setEdge(
relation.id1,
relation.id2,
{
relation,
width: getLabelWidth(relation.title),
height: conf.labelHeight * common.getRows(relation.title).length,
labelpos: "c"
},
"id" + cnt
);
});
layout(graph);
log.debug("Graph after layout", graph.nodes());
const svgElem = diagram2.node();
graph.nodes().forEach(function(v) {
if (v !== void 0 && graph.node(v) !== void 0) {
log.warn("Node " + v + ": " + JSON.stringify(graph.node(v)));
root.select("#" + svgElem.id + " #" + v).attr(
"transform",
"translate(" + (graph.node(v).x - graph.node(v).width / 2) + "," + (graph.node(v).y + (transformationLog[v] ? transformationLog[v].y : 0) - graph.node(v).height / 2) + " )"
);
root.select("#" + svgElem.id + " #" + v).attr("data-x-shift", graph.node(v).x - graph.node(v).width / 2);
const dividers = domDocument.querySelectorAll("#" + svgElem.id + " #" + v + " .divider");
dividers.forEach((divider) => {
const parent = divider.parentElement;
let pWidth = 0;
let pShift = 0;
if (parent) {
if (parent.parentElement) {
pWidth = parent.parentElement.getBBox().width;
}
pShift = parseInt(parent.getAttribute("data-x-shift"), 10);
if (Number.isNaN(pShift)) {
pShift = 0;
}
}
divider.setAttribute("x1", 0 - pShift + 8);
divider.setAttribute("x2", pWidth - pShift - 8);
});
} else {
log.debug("No Node " + v + ": " + JSON.stringify(graph.node(v)));
}
});
let stateBox = svgElem.getBBox();
graph.edges().forEach(function(e) {
if (e !== void 0 && graph.edge(e) !== void 0) {
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph.edge(e)));
drawEdge(diagram2, graph.edge(e), graph.edge(e).relation);
}
});
stateBox = svgElem.getBBox();
const stateInfo = {
id: parentId ? parentId : "root",
label: parentId ? parentId : "root",
width: 0,
height: 0
};
stateInfo.width = stateBox.width + 2 * conf.padding;
stateInfo.height = stateBox.height + 2 * conf.padding;
log.debug("Doc rendered", stateInfo, graph);
return stateInfo;
};
const renderer = {
setConf,
draw
};
const diagram = {
parser,
db,
renderer,
styles,
init: (cnf) => {
if (!cnf.state) {
cnf.state = {};
}
cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
db.clear();
}
};
export {
diagram
};

View file

@ -0,0 +1,467 @@
import { d as db, p as parser, s as styles } from "./styles-f80da881.js";
import { c as getConfig, F as curveBasis, A as utils, f as common, l as log, j as d3select, k as configureSvgSize } from "./mermaid-dcacb631.js";
import { G as Graph } from "./graph-fe24fab6.js";
import { l as layout } from "./layout-163b9689.js";
import { l as line } from "./line-87f517ef.js";
import "./array-b7dcf730.js";
import "./path-39bad7e2.js";
const idCache = {};
const set = (key, val) => {
idCache[key] = val;
};
const get = (k) => idCache[k];
const keys = () => Object.keys(idCache);
const size = () => keys().length;
const idCache$1 = {
get,
set,
keys,
size
};
const drawStartState = (g) => g.append("circle").attr("class", "start-state").attr("r", getConfig().state.sizeUnit).attr("cx", getConfig().state.padding + getConfig().state.sizeUnit).attr("cy", getConfig().state.padding + getConfig().state.sizeUnit);
const drawDivider = (g) => g.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", getConfig().state.textHeight).attr("class", "divider").attr("x2", getConfig().state.textHeight * 2).attr("y1", 0).attr("y2", 0);
const drawSimpleState = (g, stateDef) => {
const state = g.append("text").attr("x", 2 * getConfig().state.padding).attr("y", getConfig().state.textHeight + 2 * getConfig().state.padding).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.id);
const classBox = state.node().getBBox();
g.insert("rect", ":first-child").attr("x", getConfig().state.padding).attr("y", getConfig().state.padding).attr("width", classBox.width + 2 * getConfig().state.padding).attr("height", classBox.height + 2 * getConfig().state.padding).attr("rx", getConfig().state.radius);
return state;
};
const drawDescrState = (g, stateDef) => {
const addTspan = function(textEl, txt, isFirst2) {
const tSpan = textEl.append("tspan").attr("x", 2 * getConfig().state.padding).text(txt);
if (!isFirst2) {
tSpan.attr("dy", getConfig().state.textHeight);
}
};
const title = g.append("text").attr("x", 2 * getConfig().state.padding).attr("y", getConfig().state.textHeight + 1.3 * getConfig().state.padding).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.descriptions[0]);
const titleBox = title.node().getBBox();
const titleHeight = titleBox.height;
const description = g.append("text").attr("x", getConfig().state.padding).attr(
"y",
titleHeight + getConfig().state.padding * 0.4 + getConfig().state.dividerMargin + getConfig().state.textHeight
).attr("class", "state-description");
let isFirst = true;
let isSecond = true;
stateDef.descriptions.forEach(function(descr) {
if (!isFirst) {
addTspan(description, descr, isSecond);
isSecond = false;
}
isFirst = false;
});
const descrLine = g.append("line").attr("x1", getConfig().state.padding).attr("y1", getConfig().state.padding + titleHeight + getConfig().state.dividerMargin / 2).attr("y2", getConfig().state.padding + titleHeight + getConfig().state.dividerMargin / 2).attr("class", "descr-divider");
const descrBox = description.node().getBBox();
const width = Math.max(descrBox.width, titleBox.width);
descrLine.attr("x2", width + 3 * getConfig().state.padding);
g.insert("rect", ":first-child").attr("x", getConfig().state.padding).attr("y", getConfig().state.padding).attr("width", width + 2 * getConfig().state.padding).attr("height", descrBox.height + titleHeight + 2 * getConfig().state.padding).attr("rx", getConfig().state.radius);
return g;
};
const addTitleAndBox = (g, stateDef, altBkg) => {
const pad = getConfig().state.padding;
const dblPad = 2 * getConfig().state.padding;
const orgBox = g.node().getBBox();
const orgWidth = orgBox.width;
const orgX = orgBox.x;
const title = g.append("text").attr("x", 0).attr("y", getConfig().state.titleShift).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.id);
const titleBox = title.node().getBBox();
const titleWidth = titleBox.width + dblPad;
let width = Math.max(titleWidth, orgWidth);
if (width === orgWidth) {
width = width + dblPad;
}
let startX;
const graphBox = g.node().getBBox();
if (stateDef.doc)
;
startX = orgX - pad;
if (titleWidth > orgWidth) {
startX = (orgWidth - width) / 2 + pad;
}
if (Math.abs(orgX - graphBox.x) < pad && titleWidth > orgWidth) {
startX = orgX - (titleWidth - orgWidth) / 2;
}
const lineY = 1 - getConfig().state.textHeight;
g.insert("rect", ":first-child").attr("x", startX).attr("y", lineY).attr("class", altBkg ? "alt-composit" : "composit").attr("width", width).attr(
"height",
graphBox.height + getConfig().state.textHeight + getConfig().state.titleShift + 1
).attr("rx", "0");
title.attr("x", startX + pad);
if (titleWidth <= orgWidth) {
title.attr("x", orgX + (width - dblPad) / 2 - titleWidth / 2 + pad);
}
g.insert("rect", ":first-child").attr("x", startX).attr(
"y",
getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding
).attr("width", width).attr("height", getConfig().state.textHeight * 3).attr("rx", getConfig().state.radius);
g.insert("rect", ":first-child").attr("x", startX).attr(
"y",
getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding
).attr("width", width).attr("height", graphBox.height + 3 + 2 * getConfig().state.textHeight).attr("rx", getConfig().state.radius);
return g;
};
const drawEndState = (g) => {
g.append("circle").attr("class", "end-state-outer").attr("r", getConfig().state.sizeUnit + getConfig().state.miniPadding).attr(
"cx",
getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
).attr(
"cy",
getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
);
return g.append("circle").attr("class", "end-state-inner").attr("r", getConfig().state.sizeUnit).attr("cx", getConfig().state.padding + getConfig().state.sizeUnit + 2).attr("cy", getConfig().state.padding + getConfig().state.sizeUnit + 2);
};
const drawForkJoinState = (g, stateDef) => {
let width = getConfig().state.forkWidth;
let height = getConfig().state.forkHeight;
if (stateDef.parentId) {
let tmp = width;
width = height;
height = tmp;
}
return g.append("rect").style("stroke", "black").style("fill", "black").attr("width", width).attr("height", height).attr("x", getConfig().state.padding).attr("y", getConfig().state.padding);
};
const _drawLongText = (_text, x, y, g) => {
let textHeight = 0;
const textElem = g.append("text");
textElem.style("text-anchor", "start");
textElem.attr("class", "noteText");
let text = _text.replace(/\r\n/g, "<br/>");
text = text.replace(/\n/g, "<br/>");
const lines = text.split(common.lineBreakRegex);
let tHeight = 1.25 * getConfig().state.noteMargin;
for (const line2 of lines) {
const txt = line2.trim();
if (txt.length > 0) {
const span = textElem.append("tspan");
span.text(txt);
if (tHeight === 0) {
const textBounds = span.node().getBBox();
tHeight += textBounds.height;
}
textHeight += tHeight;
span.attr("x", x + getConfig().state.noteMargin);
span.attr("y", y + textHeight + 1.25 * getConfig().state.noteMargin);
}
}
return { textWidth: textElem.node().getBBox().width, textHeight };
};
const drawNote = (text, g) => {
g.attr("class", "state-note");
const note = g.append("rect").attr("x", 0).attr("y", getConfig().state.padding);
const rectElem = g.append("g");
const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem);
note.attr("height", textHeight + 2 * getConfig().state.noteMargin);
note.attr("width", textWidth + getConfig().state.noteMargin * 2);
return note;
};
const drawState = function(elem, stateDef) {
const id = stateDef.id;
const stateInfo = {
id,
label: stateDef.id,
width: 0,
height: 0
};
const g = elem.append("g").attr("id", id).attr("class", "stateGroup");
if (stateDef.type === "start") {
drawStartState(g);
}
if (stateDef.type === "end") {
drawEndState(g);
}
if (stateDef.type === "fork" || stateDef.type === "join") {
drawForkJoinState(g, stateDef);
}
if (stateDef.type === "note") {
drawNote(stateDef.note.text, g);
}
if (stateDef.type === "divider") {
drawDivider(g);
}
if (stateDef.type === "default" && stateDef.descriptions.length === 0) {
drawSimpleState(g, stateDef);
}
if (stateDef.type === "default" && stateDef.descriptions.length > 0) {
drawDescrState(g, stateDef);
}
const stateBox = g.node().getBBox();
stateInfo.width = stateBox.width + 2 * getConfig().state.padding;
stateInfo.height = stateBox.height + 2 * getConfig().state.padding;
idCache$1.set(id, stateInfo);
return stateInfo;
};
let edgeCount = 0;
const drawEdge = function(elem, path, relation) {
const getRelationType = function(type) {
switch (type) {
case db.relationType.AGGREGATION:
return "aggregation";
case db.relationType.EXTENSION:
return "extension";
case db.relationType.COMPOSITION:
return "composition";
case db.relationType.DEPENDENCY:
return "dependency";
}
};
path.points = path.points.filter((p) => !Number.isNaN(p.y));
const lineData = path.points;
const lineFunction = line().x(function(d) {
return d.x;
}).y(function(d) {
return d.y;
}).curve(curveBasis);
const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "transition");
let url = "";
if (getConfig().state.arrowMarkerAbsolute) {
url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
url = url.replace(/\(/g, "\\(");
url = url.replace(/\)/g, "\\)");
}
svgPath.attr(
"marker-end",
"url(" + url + "#" + getRelationType(db.relationType.DEPENDENCY) + "End)"
);
if (relation.title !== void 0) {
const label = elem.append("g").attr("class", "stateLabel");
const { x, y } = utils.calcLabelPosition(path.points);
const rows = common.getRows(relation.title);
let titleHeight = 0;
const titleRows = [];
let maxWidth = 0;
let minX = 0;
for (let i = 0; i <= rows.length; i++) {
const title = label.append("text").attr("text-anchor", "middle").text(rows[i]).attr("x", x).attr("y", y + titleHeight);
const boundsTmp = title.node().getBBox();
maxWidth = Math.max(maxWidth, boundsTmp.width);
minX = Math.min(minX, boundsTmp.x);
log.info(boundsTmp.x, x, y + titleHeight);
if (titleHeight === 0) {
const titleBox = title.node().getBBox();
titleHeight = titleBox.height;
log.info("Title height", titleHeight, y);
}
titleRows.push(title);
}
let boxHeight = titleHeight * rows.length;
if (rows.length > 1) {
const heightAdj = (rows.length - 1) * titleHeight * 0.5;
titleRows.forEach((title, i) => title.attr("y", y + i * titleHeight - heightAdj));
boxHeight = titleHeight * rows.length;
}
const bounds = label.node().getBBox();
label.insert("rect", ":first-child").attr("class", "box").attr("x", x - maxWidth / 2 - getConfig().state.padding / 2).attr("y", y - boxHeight / 2 - getConfig().state.padding / 2 - 3.5).attr("width", maxWidth + getConfig().state.padding).attr("height", boxHeight + getConfig().state.padding);
log.info(bounds);
}
edgeCount++;
};
let conf;
const transformationLog = {};
const setConf = function() {
};
const insertMarkers = function(elem) {
elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
};
const draw = function(text, id, _version, diagObj) {
conf = getConfig().state;
const securityLevel = getConfig().securityLevel;
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = d3select("#i" + id);
}
const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
log.debug("Rendering diagram " + text);
const diagram2 = root.select(`[id='${id}']`);
insertMarkers(diagram2);
const rootDoc = diagObj.db.getRootDoc();
renderDoc(rootDoc, diagram2, void 0, false, root, doc, diagObj);
const padding = conf.padding;
const bounds = diagram2.node().getBBox();
const width = bounds.width + padding * 2;
const height = bounds.height + padding * 2;
const svgWidth = width * 1.75;
configureSvgSize(diagram2, height, svgWidth, conf.useMaxWidth);
diagram2.attr(
"viewBox",
`${bounds.x - conf.padding} ${bounds.y - conf.padding} ` + width + " " + height
);
};
const getLabelWidth = (text) => {
return text ? text.length * conf.fontSizeFactor : 1;
};
const renderDoc = (doc, diagram2, parentId, altBkg, root, domDocument, diagObj) => {
const graph = new Graph({
compound: true,
multigraph: true
});
let i;
let edgeFreeDoc = true;
for (i = 0; i < doc.length; i++) {
if (doc[i].stmt === "relation") {
edgeFreeDoc = false;
break;
}
}
if (parentId) {
graph.setGraph({
rankdir: "LR",
multigraph: true,
compound: true,
// acyclicer: 'greedy',
ranker: "tight-tree",
ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
nodeSep: edgeFreeDoc ? 1 : 50,
isMultiGraph: true
// ranksep: 5,
// nodesep: 1
});
} else {
graph.setGraph({
rankdir: "TB",
multigraph: true,
compound: true,
// isCompound: true,
// acyclicer: 'greedy',
// ranker: 'longest-path'
ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
nodeSep: edgeFreeDoc ? 1 : 50,
ranker: "tight-tree",
// ranker: 'network-simplex'
isMultiGraph: true
});
}
graph.setDefaultEdgeLabel(function() {
return {};
});
diagObj.db.extract(doc);
const states = diagObj.db.getStates();
const relations = diagObj.db.getRelations();
const keys2 = Object.keys(states);
for (const key of keys2) {
const stateDef = states[key];
if (parentId) {
stateDef.parentId = parentId;
}
let node;
if (stateDef.doc) {
let sub = diagram2.append("g").attr("id", stateDef.id).attr("class", "stateGroup");
node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg, root, domDocument, diagObj);
{
sub = addTitleAndBox(sub, stateDef, altBkg);
let boxBounds = sub.node().getBBox();
node.width = boxBounds.width;
node.height = boxBounds.height + conf.padding / 2;
transformationLog[stateDef.id] = { y: conf.compositTitleSize };
}
} else {
node = drawState(diagram2, stateDef);
}
if (stateDef.note) {
const noteDef = {
descriptions: [],
id: stateDef.id + "-note",
note: stateDef.note,
type: "note"
};
const note = drawState(diagram2, noteDef);
if (stateDef.note.position === "left of") {
graph.setNode(node.id + "-note", note);
graph.setNode(node.id, node);
} else {
graph.setNode(node.id, node);
graph.setNode(node.id + "-note", note);
}
graph.setParent(node.id, node.id + "-group");
graph.setParent(node.id + "-note", node.id + "-group");
} else {
graph.setNode(node.id, node);
}
}
log.debug("Count=", graph.nodeCount(), graph);
let cnt = 0;
relations.forEach(function(relation) {
cnt++;
log.debug("Setting edge", relation);
graph.setEdge(
relation.id1,
relation.id2,
{
relation,
width: getLabelWidth(relation.title),
height: conf.labelHeight * common.getRows(relation.title).length,
labelpos: "c"
},
"id" + cnt
);
});
layout(graph);
log.debug("Graph after layout", graph.nodes());
const svgElem = diagram2.node();
graph.nodes().forEach(function(v) {
if (v !== void 0 && graph.node(v) !== void 0) {
log.warn("Node " + v + ": " + JSON.stringify(graph.node(v)));
root.select("#" + svgElem.id + " #" + v).attr(
"transform",
"translate(" + (graph.node(v).x - graph.node(v).width / 2) + "," + (graph.node(v).y + (transformationLog[v] ? transformationLog[v].y : 0) - graph.node(v).height / 2) + " )"
);
root.select("#" + svgElem.id + " #" + v).attr("data-x-shift", graph.node(v).x - graph.node(v).width / 2);
const dividers = domDocument.querySelectorAll("#" + svgElem.id + " #" + v + " .divider");
dividers.forEach((divider) => {
const parent = divider.parentElement;
let pWidth = 0;
let pShift = 0;
if (parent) {
if (parent.parentElement) {
pWidth = parent.parentElement.getBBox().width;
}
pShift = parseInt(parent.getAttribute("data-x-shift"), 10);
if (Number.isNaN(pShift)) {
pShift = 0;
}
}
divider.setAttribute("x1", 0 - pShift + 8);
divider.setAttribute("x2", pWidth - pShift - 8);
});
} else {
log.debug("No Node " + v + ": " + JSON.stringify(graph.node(v)));
}
});
let stateBox = svgElem.getBBox();
graph.edges().forEach(function(e) {
if (e !== void 0 && graph.edge(e) !== void 0) {
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph.edge(e)));
drawEdge(diagram2, graph.edge(e), graph.edge(e).relation);
}
});
stateBox = svgElem.getBBox();
const stateInfo = {
id: parentId ? parentId : "root",
label: parentId ? parentId : "root",
width: 0,
height: 0
};
stateInfo.width = stateBox.width + 2 * conf.padding;
stateInfo.height = stateBox.height + 2 * conf.padding;
log.debug("Doc rendered", stateInfo, graph);
return stateInfo;
};
const renderer = {
setConf,
draw
};
const diagram = {
parser,
db,
renderer,
styles,
init: (cnf) => {
if (!cnf.state) {
cnf.state = {};
}
cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
db.clear();
}
};
export {
diagram
};

View file

@ -0,0 +1,275 @@
import { d as N, p as C, s as R } from "./styles-cacbff60.js";
import { c as t, F as U, A as F, f as T, l as b, j as H, k as O } from "./mermaid-9f2aa176.js";
import { G as X } from "./graph-0ee63739.js";
import { l as J } from "./layout-fd473db2.js";
import { l as Y } from "./line-24d93f1b.js";
import "./array-2ff2c7a6.js";
import "./path-428ebac9.js";
const L = {}, $ = (e, i) => {
L[e] = i;
}, v = (e) => L[e], P = () => Object.keys(L), I = () => P().length, _ = {
get: v,
set: $,
keys: P,
size: I
}, j = (e) => e.append("circle").attr("class", "start-state").attr("r", t().state.sizeUnit).attr("cx", t().state.padding + t().state.sizeUnit).attr("cy", t().state.padding + t().state.sizeUnit), q = (e) => e.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", t().state.textHeight).attr("class", "divider").attr("x2", t().state.textHeight * 2).attr("y1", 0).attr("y2", 0), Z = (e, i) => {
const o = e.append("text").attr("x", 2 * t().state.padding).attr("y", t().state.textHeight + 2 * t().state.padding).attr("font-size", t().state.fontSize).attr("class", "state-title").text(i.id), d = o.node().getBBox();
return e.insert("rect", ":first-child").attr("x", t().state.padding).attr("y", t().state.padding).attr("width", d.width + 2 * t().state.padding).attr("height", d.height + 2 * t().state.padding).attr("rx", t().state.radius), o;
}, K = (e, i) => {
const o = function(l, m, w) {
const k = l.append("tspan").attr("x", 2 * t().state.padding).text(m);
w || k.attr("dy", t().state.textHeight);
}, s = e.append("text").attr("x", 2 * t().state.padding).attr("y", t().state.textHeight + 1.3 * t().state.padding).attr("font-size", t().state.fontSize).attr("class", "state-title").text(i.descriptions[0]).node().getBBox(), g = s.height, p = e.append("text").attr("x", t().state.padding).attr(
"y",
g + t().state.padding * 0.4 + t().state.dividerMargin + t().state.textHeight
).attr("class", "state-description");
let a = !0, r = !0;
i.descriptions.forEach(function(l) {
a || (o(p, l, r), r = !1), a = !1;
});
const y = e.append("line").attr("x1", t().state.padding).attr("y1", t().state.padding + g + t().state.dividerMargin / 2).attr("y2", t().state.padding + g + t().state.dividerMargin / 2).attr("class", "descr-divider"), x = p.node().getBBox(), c = Math.max(x.width, s.width);
return y.attr("x2", c + 3 * t().state.padding), e.insert("rect", ":first-child").attr("x", t().state.padding).attr("y", t().state.padding).attr("width", c + 2 * t().state.padding).attr("height", x.height + g + 2 * t().state.padding).attr("rx", t().state.radius), e;
}, Q = (e, i, o) => {
const d = t().state.padding, s = 2 * t().state.padding, g = e.node().getBBox(), p = g.width, a = g.x, r = e.append("text").attr("x", 0).attr("y", t().state.titleShift).attr("font-size", t().state.fontSize).attr("class", "state-title").text(i.id), x = r.node().getBBox().width + s;
let c = Math.max(x, p);
c === p && (c = c + s);
let l;
const m = e.node().getBBox();
i.doc, l = a - d, x > p && (l = (p - c) / 2 + d), Math.abs(a - m.x) < d && x > p && (l = a - (x - p) / 2);
const w = 1 - t().state.textHeight;
return e.insert("rect", ":first-child").attr("x", l).attr("y", w).attr("class", o ? "alt-composit" : "composit").attr("width", c).attr(
"height",
m.height + t().state.textHeight + t().state.titleShift + 1
).attr("rx", "0"), r.attr("x", l + d), x <= p && r.attr("x", a + (c - s) / 2 - x / 2 + d), e.insert("rect", ":first-child").attr("x", l).attr(
"y",
t().state.titleShift - t().state.textHeight - t().state.padding
).attr("width", c).attr("height", t().state.textHeight * 3).attr("rx", t().state.radius), e.insert("rect", ":first-child").attr("x", l).attr(
"y",
t().state.titleShift - t().state.textHeight - t().state.padding
).attr("width", c).attr("height", m.height + 3 + 2 * t().state.textHeight).attr("rx", t().state.radius), e;
}, V = (e) => (e.append("circle").attr("class", "end-state-outer").attr("r", t().state.sizeUnit + t().state.miniPadding).attr(
"cx",
t().state.padding + t().state.sizeUnit + t().state.miniPadding
).attr(
"cy",
t().state.padding + t().state.sizeUnit + t().state.miniPadding
), e.append("circle").attr("class", "end-state-inner").attr("r", t().state.sizeUnit).attr("cx", t().state.padding + t().state.sizeUnit + 2).attr("cy", t().state.padding + t().state.sizeUnit + 2)), D = (e, i) => {
let o = t().state.forkWidth, d = t().state.forkHeight;
if (i.parentId) {
let s = o;
o = d, d = s;
}
return e.append("rect").style("stroke", "black").style("fill", "black").attr("width", o).attr("height", d).attr("x", t().state.padding).attr("y", t().state.padding);
}, tt = (e, i, o, d) => {
let s = 0;
const g = d.append("text");
g.style("text-anchor", "start"), g.attr("class", "noteText");
let p = e.replace(/\r\n/g, "<br/>");
p = p.replace(/\n/g, "<br/>");
const a = p.split(T.lineBreakRegex);
let r = 1.25 * t().state.noteMargin;
for (const y of a) {
const x = y.trim();
if (x.length > 0) {
const c = g.append("tspan");
if (c.text(x), r === 0) {
const l = c.node().getBBox();
r += l.height;
}
s += r, c.attr("x", i + t().state.noteMargin), c.attr("y", o + s + 1.25 * t().state.noteMargin);
}
}
return { textWidth: g.node().getBBox().width, textHeight: s };
}, et = (e, i) => {
i.attr("class", "state-note");
const o = i.append("rect").attr("x", 0).attr("y", t().state.padding), d = i.append("g"), { textWidth: s, textHeight: g } = tt(e, 0, 0, d);
return o.attr("height", g + 2 * t().state.noteMargin), o.attr("width", s + t().state.noteMargin * 2), o;
}, A = function(e, i) {
const o = i.id, d = {
id: o,
label: i.id,
width: 0,
height: 0
}, s = e.append("g").attr("id", o).attr("class", "stateGroup");
i.type === "start" && j(s), i.type === "end" && V(s), (i.type === "fork" || i.type === "join") && D(s, i), i.type === "note" && et(i.note.text, s), i.type === "divider" && q(s), i.type === "default" && i.descriptions.length === 0 && Z(s, i), i.type === "default" && i.descriptions.length > 0 && K(s, i);
const g = s.node().getBBox();
return d.width = g.width + 2 * t().state.padding, d.height = g.height + 2 * t().state.padding, _.set(o, d), d;
};
let G = 0;
const at = function(e, i, o) {
const d = function(r) {
switch (r) {
case N.relationType.AGGREGATION:
return "aggregation";
case N.relationType.EXTENSION:
return "extension";
case N.relationType.COMPOSITION:
return "composition";
case N.relationType.DEPENDENCY:
return "dependency";
}
};
i.points = i.points.filter((r) => !Number.isNaN(r.y));
const s = i.points, g = Y().x(function(r) {
return r.x;
}).y(function(r) {
return r.y;
}).curve(U), p = e.append("path").attr("d", g(s)).attr("id", "edge" + G).attr("class", "transition");
let a = "";
if (t().state.arrowMarkerAbsolute && (a = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, a = a.replace(/\(/g, "\\("), a = a.replace(/\)/g, "\\)")), p.attr(
"marker-end",
"url(" + a + "#" + d(N.relationType.DEPENDENCY) + "End)"
), o.title !== void 0) {
const r = e.append("g").attr("class", "stateLabel"), { x: y, y: x } = F.calcLabelPosition(i.points), c = T.getRows(o.title);
let l = 0;
const m = [];
let w = 0, k = 0;
for (let u = 0; u <= c.length; u++) {
const h = r.append("text").attr("text-anchor", "middle").text(c[u]).attr("x", y).attr("y", x + l), f = h.node().getBBox();
w = Math.max(w, f.width), k = Math.min(k, f.x), b.info(f.x, y, x + l), l === 0 && (l = h.node().getBBox().height, b.info("Title height", l, x)), m.push(h);
}
let E = l * c.length;
if (c.length > 1) {
const u = (c.length - 1) * l * 0.5;
m.forEach((h, f) => h.attr("y", x + f * l - u)), E = l * c.length;
}
const n = r.node().getBBox();
r.insert("rect", ":first-child").attr("class", "box").attr("x", y - w / 2 - t().state.padding / 2).attr("y", x - E / 2 - t().state.padding / 2 - 3.5).attr("width", w + t().state.padding).attr("height", E + t().state.padding), b.info(n);
}
G++;
};
let B;
const z = {}, it = function() {
}, nt = function(e) {
e.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
}, st = function(e, i, o, d) {
B = t().state;
const s = t().securityLevel;
let g;
s === "sandbox" && (g = H("#i" + i));
const p = s === "sandbox" ? H(g.nodes()[0].contentDocument.body) : H("body"), a = s === "sandbox" ? g.nodes()[0].contentDocument : document;
b.debug("Rendering diagram " + e);
const r = p.select(`[id='${i}']`);
nt(r);
const y = d.db.getRootDoc();
W(y, r, void 0, !1, p, a, d);
const x = B.padding, c = r.node().getBBox(), l = c.width + x * 2, m = c.height + x * 2, w = l * 1.75;
O(r, m, w, B.useMaxWidth), r.attr(
"viewBox",
`${c.x - B.padding} ${c.y - B.padding} ` + l + " " + m
);
}, rt = (e) => e ? e.length * B.fontSizeFactor : 1, W = (e, i, o, d, s, g, p) => {
const a = new X({
compound: !0,
multigraph: !0
});
let r, y = !0;
for (r = 0; r < e.length; r++)
if (e[r].stmt === "relation") {
y = !1;
break;
}
o ? a.setGraph({
rankdir: "LR",
multigraph: !0,
compound: !0,
// acyclicer: 'greedy',
ranker: "tight-tree",
ranksep: y ? 1 : B.edgeLengthFactor,
nodeSep: y ? 1 : 50,
isMultiGraph: !0
// ranksep: 5,
// nodesep: 1
}) : a.setGraph({
rankdir: "TB",
multigraph: !0,
compound: !0,
// isCompound: true,
// acyclicer: 'greedy',
// ranker: 'longest-path'
ranksep: y ? 1 : B.edgeLengthFactor,
nodeSep: y ? 1 : 50,
ranker: "tight-tree",
// ranker: 'network-simplex'
isMultiGraph: !0
}), a.setDefaultEdgeLabel(function() {
return {};
}), p.db.extract(e);
const x = p.db.getStates(), c = p.db.getRelations(), l = Object.keys(x);
for (const n of l) {
const u = x[n];
o && (u.parentId = o);
let h;
if (u.doc) {
let f = i.append("g").attr("id", u.id).attr("class", "stateGroup");
h = W(u.doc, f, u.id, !d, s, g, p);
{
f = Q(f, u, d);
let S = f.node().getBBox();
h.width = S.width, h.height = S.height + B.padding / 2, z[u.id] = { y: B.compositTitleSize };
}
} else
h = A(i, u);
if (u.note) {
const f = {
descriptions: [],
id: u.id + "-note",
note: u.note,
type: "note"
}, S = A(i, f);
u.note.position === "left of" ? (a.setNode(h.id + "-note", S), a.setNode(h.id, h)) : (a.setNode(h.id, h), a.setNode(h.id + "-note", S)), a.setParent(h.id, h.id + "-group"), a.setParent(h.id + "-note", h.id + "-group");
} else
a.setNode(h.id, h);
}
b.debug("Count=", a.nodeCount(), a);
let m = 0;
c.forEach(function(n) {
m++, b.debug("Setting edge", n), a.setEdge(
n.id1,
n.id2,
{
relation: n,
width: rt(n.title),
height: B.labelHeight * T.getRows(n.title).length,
labelpos: "c"
},
"id" + m
);
}), J(a), b.debug("Graph after layout", a.nodes());
const w = i.node();
a.nodes().forEach(function(n) {
n !== void 0 && a.node(n) !== void 0 ? (b.warn("Node " + n + ": " + JSON.stringify(a.node(n))), s.select("#" + w.id + " #" + n).attr(
"transform",
"translate(" + (a.node(n).x - a.node(n).width / 2) + "," + (a.node(n).y + (z[n] ? z[n].y : 0) - a.node(n).height / 2) + " )"
), s.select("#" + w.id + " #" + n).attr("data-x-shift", a.node(n).x - a.node(n).width / 2), g.querySelectorAll("#" + w.id + " #" + n + " .divider").forEach((h) => {
const f = h.parentElement;
let S = 0, M = 0;
f && (f.parentElement && (S = f.parentElement.getBBox().width), M = parseInt(f.getAttribute("data-x-shift"), 10), Number.isNaN(M) && (M = 0)), h.setAttribute("x1", 0 - M + 8), h.setAttribute("x2", S - M - 8);
})) : b.debug("No Node " + n + ": " + JSON.stringify(a.node(n)));
});
let k = w.getBBox();
a.edges().forEach(function(n) {
n !== void 0 && a.edge(n) !== void 0 && (b.debug("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(a.edge(n))), at(i, a.edge(n), a.edge(n).relation));
}), k = w.getBBox();
const E = {
id: o || "root",
label: o || "root",
width: 0,
height: 0
};
return E.width = k.width + 2 * B.padding, E.height = k.height + 2 * B.padding, b.debug("Doc rendered", E, a), E;
}, ot = {
setConf: it,
draw: st
}, ut = {
parser: C,
db: N,
renderer: ot,
styles: R,
init: (e) => {
e.state || (e.state = {}), e.state.arrowMarkerAbsolute = e.arrowMarkerAbsolute, N.clear();
}
};
export {
ut as diagram
};

View file

@ -0,0 +1,333 @@
import { D as DEFAULT_STATE_TYPE, a as DIVIDER_TYPE, S as STMT_RELATION, b as STMT_STATE, c as DEFAULT_NESTED_DOC_DIR, p as parser, d as db, s as styles } from "./styles-0784dbeb.js";
import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
import { select } from "d3";
import { l as log, c as getConfig, u as utils, i as configureSvgSize, e as common } from "./mermaid-6dc72991.js";
import { r as render } from "./index-01f381cb.js";
import "ts-dedent";
import "dayjs";
import "@braintree/sanitize-url";
import "dompurify";
import "khroma";
import "lodash-es/memoize.js";
import "lodash-es/merge.js";
import "stylis";
import "lodash-es/isEmpty.js";
import "dagre-d3-es/src/dagre/index.js";
import "dagre-d3-es/src/graphlib/json.js";
import "./edges-066a5561.js";
import "./createText-ca0c5216.js";
import "mdast-util-from-markdown";
const SHAPE_STATE = "rect";
const SHAPE_STATE_WITH_DESC = "rectWithTitle";
const SHAPE_START = "start";
const SHAPE_END = "end";
const SHAPE_DIVIDER = "divider";
const SHAPE_GROUP = "roundedWithTitle";
const SHAPE_NOTE = "note";
const SHAPE_NOTEGROUP = "noteGroup";
const CSS_DIAGRAM = "statediagram";
const CSS_STATE = "state";
const CSS_DIAGRAM_STATE = `${CSS_DIAGRAM}-${CSS_STATE}`;
const CSS_EDGE = "transition";
const CSS_NOTE = "note";
const CSS_NOTE_EDGE = "note-edge";
const CSS_EDGE_NOTE_EDGE = `${CSS_EDGE} ${CSS_NOTE_EDGE}`;
const CSS_DIAGRAM_NOTE = `${CSS_DIAGRAM}-${CSS_NOTE}`;
const CSS_CLUSTER = "cluster";
const CSS_DIAGRAM_CLUSTER = `${CSS_DIAGRAM}-${CSS_CLUSTER}`;
const CSS_CLUSTER_ALT = "cluster-alt";
const CSS_DIAGRAM_CLUSTER_ALT = `${CSS_DIAGRAM}-${CSS_CLUSTER_ALT}`;
const PARENT = "parent";
const NOTE = "note";
const DOMID_STATE = "state";
const DOMID_TYPE_SPACER = "----";
const NOTE_ID = `${DOMID_TYPE_SPACER}${NOTE}`;
const PARENT_ID = `${DOMID_TYPE_SPACER}${PARENT}`;
const G_EDGE_STYLE = "fill:none";
const G_EDGE_ARROWHEADSTYLE = "fill: #333";
const G_EDGE_LABELPOS = "c";
const G_EDGE_LABELTYPE = "text";
const G_EDGE_THICKNESS = "normal";
let nodeDb = {};
let graphItemCount = 0;
const setConf = function(cnf) {
const keys = Object.keys(cnf);
for (const key of keys) {
cnf[key];
}
};
const getClasses = function(text, diagramObj) {
diagramObj.db.extract(diagramObj.db.getRootDocV2());
return diagramObj.db.getClasses();
};
function getClassesFromDbInfo(dbInfoItem) {
if (dbInfoItem === void 0 || dbInfoItem === null) {
return "";
} else {
if (dbInfoItem.classes) {
return dbInfoItem.classes.join(" ");
} else {
return "";
}
}
}
function stateDomId(itemId = "", counter = 0, type = "", typeSpacer = DOMID_TYPE_SPACER) {
const typeStr = type !== null && type.length > 0 ? `${typeSpacer}${type}` : "";
return `${DOMID_STATE}-${itemId}${typeStr}-${counter}`;
}
const setupNode = (g, parent, parsedItem, diagramStates, diagramDb, altFlag) => {
const itemId = parsedItem.id;
const classStr = getClassesFromDbInfo(diagramStates[itemId]);
if (itemId !== "root") {
let shape = SHAPE_STATE;
if (parsedItem.start === true) {
shape = SHAPE_START;
}
if (parsedItem.start === false) {
shape = SHAPE_END;
}
if (parsedItem.type !== DEFAULT_STATE_TYPE) {
shape = parsedItem.type;
}
if (!nodeDb[itemId]) {
nodeDb[itemId] = {
id: itemId,
shape,
description: common.sanitizeText(itemId, getConfig()),
classes: `${classStr} ${CSS_DIAGRAM_STATE}`
};
}
const newNode = nodeDb[itemId];
if (parsedItem.description) {
if (Array.isArray(newNode.description)) {
newNode.shape = SHAPE_STATE_WITH_DESC;
newNode.description.push(parsedItem.description);
} else {
if (newNode.description.length > 0) {
newNode.shape = SHAPE_STATE_WITH_DESC;
if (newNode.description === itemId) {
newNode.description = [parsedItem.description];
} else {
newNode.description = [newNode.description, parsedItem.description];
}
} else {
newNode.shape = SHAPE_STATE;
newNode.description = parsedItem.description;
}
}
newNode.description = common.sanitizeTextOrArray(newNode.description, getConfig());
}
if (newNode.description.length === 1 && newNode.shape === SHAPE_STATE_WITH_DESC) {
newNode.shape = SHAPE_STATE;
}
if (!newNode.type && parsedItem.doc) {
log.info("Setting cluster for ", itemId, getDir(parsedItem));
newNode.type = "group";
newNode.dir = getDir(parsedItem);
newNode.shape = parsedItem.type === DIVIDER_TYPE ? SHAPE_DIVIDER : SHAPE_GROUP;
newNode.classes = newNode.classes + " " + CSS_DIAGRAM_CLUSTER + " " + (altFlag ? CSS_DIAGRAM_CLUSTER_ALT : "");
}
const nodeData = {
labelStyle: "",
shape: newNode.shape,
labelText: newNode.description,
// typeof newNode.description === 'object'
// ? newNode.description[0]
// : newNode.description,
classes: newNode.classes,
style: "",
//styles.style,
id: itemId,
dir: newNode.dir,
domId: stateDomId(itemId, graphItemCount),
type: newNode.type,
padding: 15
//getConfig().flowchart.padding
};
nodeData.centerLabel = true;
if (parsedItem.note) {
const noteData = {
labelStyle: "",
shape: SHAPE_NOTE,
labelText: parsedItem.note.text,
classes: CSS_DIAGRAM_NOTE,
// useHtmlLabels: false,
style: "",
// styles.style,
id: itemId + NOTE_ID + "-" + graphItemCount,
domId: stateDomId(itemId, graphItemCount, NOTE),
type: newNode.type,
padding: 15
//getConfig().flowchart.padding
};
const groupData = {
labelStyle: "",
shape: SHAPE_NOTEGROUP,
labelText: parsedItem.note.text,
classes: newNode.classes,
style: "",
// styles.style,
id: itemId + PARENT_ID,
domId: stateDomId(itemId, graphItemCount, PARENT),
type: "group",
padding: 0
//getConfig().flowchart.padding
};
graphItemCount++;
const parentNodeId = itemId + PARENT_ID;
g.setNode(parentNodeId, groupData);
g.setNode(noteData.id, noteData);
g.setNode(itemId, nodeData);
g.setParent(itemId, parentNodeId);
g.setParent(noteData.id, parentNodeId);
let from = itemId;
let to = noteData.id;
if (parsedItem.note.position === "left of") {
from = noteData.id;
to = itemId;
}
g.setEdge(from, to, {
arrowhead: "none",
arrowType: "",
style: G_EDGE_STYLE,
labelStyle: "",
classes: CSS_EDGE_NOTE_EDGE,
arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
labelpos: G_EDGE_LABELPOS,
labelType: G_EDGE_LABELTYPE,
thickness: G_EDGE_THICKNESS
});
} else {
g.setNode(itemId, nodeData);
}
}
if (parent && parent.id !== "root") {
log.trace("Setting node ", itemId, " to be child of its parent ", parent.id);
g.setParent(itemId, parent.id);
}
if (parsedItem.doc) {
log.trace("Adding nodes children ");
setupDoc(g, parsedItem, parsedItem.doc, diagramStates, diagramDb, !altFlag);
}
};
const setupDoc = (g, parentParsedItem, doc, diagramStates, diagramDb, altFlag) => {
log.trace("items", doc);
doc.forEach((item) => {
switch (item.stmt) {
case STMT_STATE:
setupNode(g, parentParsedItem, item, diagramStates, diagramDb, altFlag);
break;
case DEFAULT_STATE_TYPE:
setupNode(g, parentParsedItem, item, diagramStates, diagramDb, altFlag);
break;
case STMT_RELATION:
{
setupNode(g, parentParsedItem, item.state1, diagramStates, diagramDb, altFlag);
setupNode(g, parentParsedItem, item.state2, diagramStates, diagramDb, altFlag);
const edgeData = {
id: "edge" + graphItemCount,
arrowhead: "normal",
arrowTypeEnd: "arrow_barb",
style: G_EDGE_STYLE,
labelStyle: "",
label: common.sanitizeText(item.description, getConfig()),
arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
labelpos: G_EDGE_LABELPOS,
labelType: G_EDGE_LABELTYPE,
thickness: G_EDGE_THICKNESS,
classes: CSS_EDGE
};
g.setEdge(item.state1.id, item.state2.id, edgeData, graphItemCount);
graphItemCount++;
}
break;
}
});
};
const getDir = (parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
let dir = defaultDir;
if (parsedItem.doc) {
for (let i = 0; i < parsedItem.doc.length; i++) {
const parsedItemDoc = parsedItem.doc[i];
if (parsedItemDoc.stmt === "dir") {
dir = parsedItemDoc.value;
}
}
}
return dir;
};
const draw = async function(text, id, _version, diag) {
log.info("Drawing state diagram (v2)", id);
nodeDb = {};
diag.db.getDirection();
const { securityLevel, state: conf } = getConfig();
const nodeSpacing = conf.nodeSpacing || 50;
const rankSpacing = conf.rankSpacing || 50;
log.info(diag.db.getRootDocV2());
diag.db.extract(diag.db.getRootDocV2());
log.info(diag.db.getRootDocV2());
const diagramStates = diag.db.getStates();
const g = new graphlib.Graph({
multigraph: true,
compound: true
}).setGraph({
rankdir: getDir(diag.db.getRootDocV2()),
nodesep: nodeSpacing,
ranksep: rankSpacing,
marginx: 8,
marginy: 8
}).setDefaultEdgeLabel(function() {
return {};
});
setupNode(g, void 0, diag.db.getRootDocV2(), diagramStates, diag.db, true);
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = select("#i" + id);
}
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
const svg = root.select(`[id="${id}"]`);
const element = root.select("#" + id + " g");
await render(element, g, ["barb"], CSS_DIAGRAM, id);
const padding = 8;
utils.insertTitle(svg, "statediagramTitleText", conf.titleTopMargin, diag.db.getDiagramTitle());
const bounds = svg.node().getBBox();
const width = bounds.width + padding * 2;
const height = bounds.height + padding * 2;
svg.attr("class", CSS_DIAGRAM);
const svgBounds = svg.node().getBBox();
configureSvgSize(svg, height, width, conf.useMaxWidth);
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
log.debug(`viewBox ${vBox}`);
svg.attr("viewBox", vBox);
const labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
for (const label of labels) {
const dim = label.getBBox();
const rect = document.createElementNS("http://www.w3.org/2000/svg", SHAPE_STATE);
rect.setAttribute("rx", 0);
rect.setAttribute("ry", 0);
rect.setAttribute("width", dim.width);
rect.setAttribute("height", dim.height);
label.insertBefore(rect, label.firstChild);
}
};
const renderer = {
setConf,
getClasses,
draw
};
const diagram = {
parser,
db,
renderer,
styles,
init: (cnf) => {
if (!cnf.state) {
cnf.state = {};
}
cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
db.clear();
}
};
export {
diagram
};

View file

@ -0,0 +1,325 @@
import { D as DEFAULT_STATE_TYPE, a as DIVIDER_TYPE, S as STMT_RELATION, b as STMT_STATE, c as DEFAULT_NESTED_DOC_DIR, p as parser, d as db, s as styles } from "./styles-f80da881.js";
import { G as Graph } from "./graph-fe24fab6.js";
import { l as log, c as getConfig, j as d3select, A as utils, k as configureSvgSize, f as common } from "./mermaid-dcacb631.js";
import { r as render } from "./index-fc479858.js";
import "./layout-163b9689.js";
import "./clone-9ea6bfeb.js";
import "./edges-ce5cfb7c.js";
import "./createText-b70fe78a.js";
import "./line-87f517ef.js";
import "./array-b7dcf730.js";
import "./path-39bad7e2.js";
const SHAPE_STATE = "rect";
const SHAPE_STATE_WITH_DESC = "rectWithTitle";
const SHAPE_START = "start";
const SHAPE_END = "end";
const SHAPE_DIVIDER = "divider";
const SHAPE_GROUP = "roundedWithTitle";
const SHAPE_NOTE = "note";
const SHAPE_NOTEGROUP = "noteGroup";
const CSS_DIAGRAM = "statediagram";
const CSS_STATE = "state";
const CSS_DIAGRAM_STATE = `${CSS_DIAGRAM}-${CSS_STATE}`;
const CSS_EDGE = "transition";
const CSS_NOTE = "note";
const CSS_NOTE_EDGE = "note-edge";
const CSS_EDGE_NOTE_EDGE = `${CSS_EDGE} ${CSS_NOTE_EDGE}`;
const CSS_DIAGRAM_NOTE = `${CSS_DIAGRAM}-${CSS_NOTE}`;
const CSS_CLUSTER = "cluster";
const CSS_DIAGRAM_CLUSTER = `${CSS_DIAGRAM}-${CSS_CLUSTER}`;
const CSS_CLUSTER_ALT = "cluster-alt";
const CSS_DIAGRAM_CLUSTER_ALT = `${CSS_DIAGRAM}-${CSS_CLUSTER_ALT}`;
const PARENT = "parent";
const NOTE = "note";
const DOMID_STATE = "state";
const DOMID_TYPE_SPACER = "----";
const NOTE_ID = `${DOMID_TYPE_SPACER}${NOTE}`;
const PARENT_ID = `${DOMID_TYPE_SPACER}${PARENT}`;
const G_EDGE_STYLE = "fill:none";
const G_EDGE_ARROWHEADSTYLE = "fill: #333";
const G_EDGE_LABELPOS = "c";
const G_EDGE_LABELTYPE = "text";
const G_EDGE_THICKNESS = "normal";
let nodeDb = {};
let graphItemCount = 0;
const setConf = function(cnf) {
const keys = Object.keys(cnf);
for (const key of keys) {
cnf[key];
}
};
const getClasses = function(text, diagramObj) {
diagramObj.db.extract(diagramObj.db.getRootDocV2());
return diagramObj.db.getClasses();
};
function getClassesFromDbInfo(dbInfoItem) {
if (dbInfoItem === void 0 || dbInfoItem === null) {
return "";
} else {
if (dbInfoItem.classes) {
return dbInfoItem.classes.join(" ");
} else {
return "";
}
}
}
function stateDomId(itemId = "", counter = 0, type = "", typeSpacer = DOMID_TYPE_SPACER) {
const typeStr = type !== null && type.length > 0 ? `${typeSpacer}${type}` : "";
return `${DOMID_STATE}-${itemId}${typeStr}-${counter}`;
}
const setupNode = (g, parent, parsedItem, diagramStates, diagramDb, altFlag) => {
const itemId = parsedItem.id;
const classStr = getClassesFromDbInfo(diagramStates[itemId]);
if (itemId !== "root") {
let shape = SHAPE_STATE;
if (parsedItem.start === true) {
shape = SHAPE_START;
}
if (parsedItem.start === false) {
shape = SHAPE_END;
}
if (parsedItem.type !== DEFAULT_STATE_TYPE) {
shape = parsedItem.type;
}
if (!nodeDb[itemId]) {
nodeDb[itemId] = {
id: itemId,
shape,
description: common.sanitizeText(itemId, getConfig()),
classes: `${classStr} ${CSS_DIAGRAM_STATE}`
};
}
const newNode = nodeDb[itemId];
if (parsedItem.description) {
if (Array.isArray(newNode.description)) {
newNode.shape = SHAPE_STATE_WITH_DESC;
newNode.description.push(parsedItem.description);
} else {
if (newNode.description.length > 0) {
newNode.shape = SHAPE_STATE_WITH_DESC;
if (newNode.description === itemId) {
newNode.description = [parsedItem.description];
} else {
newNode.description = [newNode.description, parsedItem.description];
}
} else {
newNode.shape = SHAPE_STATE;
newNode.description = parsedItem.description;
}
}
newNode.description = common.sanitizeTextOrArray(newNode.description, getConfig());
}
if (newNode.description.length === 1 && newNode.shape === SHAPE_STATE_WITH_DESC) {
newNode.shape = SHAPE_STATE;
}
if (!newNode.type && parsedItem.doc) {
log.info("Setting cluster for ", itemId, getDir(parsedItem));
newNode.type = "group";
newNode.dir = getDir(parsedItem);
newNode.shape = parsedItem.type === DIVIDER_TYPE ? SHAPE_DIVIDER : SHAPE_GROUP;
newNode.classes = newNode.classes + " " + CSS_DIAGRAM_CLUSTER + " " + (altFlag ? CSS_DIAGRAM_CLUSTER_ALT : "");
}
const nodeData = {
labelStyle: "",
shape: newNode.shape,
labelText: newNode.description,
// typeof newNode.description === 'object'
// ? newNode.description[0]
// : newNode.description,
classes: newNode.classes,
style: "",
//styles.style,
id: itemId,
dir: newNode.dir,
domId: stateDomId(itemId, graphItemCount),
type: newNode.type,
padding: 15
//getConfig().flowchart.padding
};
nodeData.centerLabel = true;
if (parsedItem.note) {
const noteData = {
labelStyle: "",
shape: SHAPE_NOTE,
labelText: parsedItem.note.text,
classes: CSS_DIAGRAM_NOTE,
// useHtmlLabels: false,
style: "",
// styles.style,
id: itemId + NOTE_ID + "-" + graphItemCount,
domId: stateDomId(itemId, graphItemCount, NOTE),
type: newNode.type,
padding: 15
//getConfig().flowchart.padding
};
const groupData = {
labelStyle: "",
shape: SHAPE_NOTEGROUP,
labelText: parsedItem.note.text,
classes: newNode.classes,
style: "",
// styles.style,
id: itemId + PARENT_ID,
domId: stateDomId(itemId, graphItemCount, PARENT),
type: "group",
padding: 0
//getConfig().flowchart.padding
};
graphItemCount++;
const parentNodeId = itemId + PARENT_ID;
g.setNode(parentNodeId, groupData);
g.setNode(noteData.id, noteData);
g.setNode(itemId, nodeData);
g.setParent(itemId, parentNodeId);
g.setParent(noteData.id, parentNodeId);
let from = itemId;
let to = noteData.id;
if (parsedItem.note.position === "left of") {
from = noteData.id;
to = itemId;
}
g.setEdge(from, to, {
arrowhead: "none",
arrowType: "",
style: G_EDGE_STYLE,
labelStyle: "",
classes: CSS_EDGE_NOTE_EDGE,
arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
labelpos: G_EDGE_LABELPOS,
labelType: G_EDGE_LABELTYPE,
thickness: G_EDGE_THICKNESS
});
} else {
g.setNode(itemId, nodeData);
}
}
if (parent && parent.id !== "root") {
log.trace("Setting node ", itemId, " to be child of its parent ", parent.id);
g.setParent(itemId, parent.id);
}
if (parsedItem.doc) {
log.trace("Adding nodes children ");
setupDoc(g, parsedItem, parsedItem.doc, diagramStates, diagramDb, !altFlag);
}
};
const setupDoc = (g, parentParsedItem, doc, diagramStates, diagramDb, altFlag) => {
log.trace("items", doc);
doc.forEach((item) => {
switch (item.stmt) {
case STMT_STATE:
setupNode(g, parentParsedItem, item, diagramStates, diagramDb, altFlag);
break;
case DEFAULT_STATE_TYPE:
setupNode(g, parentParsedItem, item, diagramStates, diagramDb, altFlag);
break;
case STMT_RELATION:
{
setupNode(g, parentParsedItem, item.state1, diagramStates, diagramDb, altFlag);
setupNode(g, parentParsedItem, item.state2, diagramStates, diagramDb, altFlag);
const edgeData = {
id: "edge" + graphItemCount,
arrowhead: "normal",
arrowTypeEnd: "arrow_barb",
style: G_EDGE_STYLE,
labelStyle: "",
label: common.sanitizeText(item.description, getConfig()),
arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
labelpos: G_EDGE_LABELPOS,
labelType: G_EDGE_LABELTYPE,
thickness: G_EDGE_THICKNESS,
classes: CSS_EDGE
};
g.setEdge(item.state1.id, item.state2.id, edgeData, graphItemCount);
graphItemCount++;
}
break;
}
});
};
const getDir = (parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
let dir = defaultDir;
if (parsedItem.doc) {
for (let i = 0; i < parsedItem.doc.length; i++) {
const parsedItemDoc = parsedItem.doc[i];
if (parsedItemDoc.stmt === "dir") {
dir = parsedItemDoc.value;
}
}
}
return dir;
};
const draw = async function(text, id, _version, diag) {
log.info("Drawing state diagram (v2)", id);
nodeDb = {};
diag.db.getDirection();
const { securityLevel, state: conf } = getConfig();
const nodeSpacing = conf.nodeSpacing || 50;
const rankSpacing = conf.rankSpacing || 50;
log.info(diag.db.getRootDocV2());
diag.db.extract(diag.db.getRootDocV2());
log.info(diag.db.getRootDocV2());
const diagramStates = diag.db.getStates();
const g = new Graph({
multigraph: true,
compound: true
}).setGraph({
rankdir: getDir(diag.db.getRootDocV2()),
nodesep: nodeSpacing,
ranksep: rankSpacing,
marginx: 8,
marginy: 8
}).setDefaultEdgeLabel(function() {
return {};
});
setupNode(g, void 0, diag.db.getRootDocV2(), diagramStates, diag.db, true);
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = d3select("#i" + id);
}
const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
const svg = root.select(`[id="${id}"]`);
const element = root.select("#" + id + " g");
await render(element, g, ["barb"], CSS_DIAGRAM, id);
const padding = 8;
utils.insertTitle(svg, "statediagramTitleText", conf.titleTopMargin, diag.db.getDiagramTitle());
const bounds = svg.node().getBBox();
const width = bounds.width + padding * 2;
const height = bounds.height + padding * 2;
svg.attr("class", CSS_DIAGRAM);
const svgBounds = svg.node().getBBox();
configureSvgSize(svg, height, width, conf.useMaxWidth);
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
log.debug(`viewBox ${vBox}`);
svg.attr("viewBox", vBox);
const labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
for (const label of labels) {
const dim = label.getBBox();
const rect = document.createElementNS("http://www.w3.org/2000/svg", SHAPE_STATE);
rect.setAttribute("rx", 0);
rect.setAttribute("ry", 0);
rect.setAttribute("width", dim.width);
rect.setAttribute("height", dim.height);
label.insertBefore(rect, label.firstChild);
}
};
const renderer = {
setConf,
getClasses,
draw
};
const diagram = {
parser,
db,
renderer,
styles,
init: (cnf) => {
if (!cnf.state) {
cnf.state = {};
}
cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
db.clear();
}
};
export {
diagram
};

View file

@ -0,0 +1,190 @@
import { D as H, a as J, S as Q, b as X, c as Z, p as F, d as M, s as I } from "./styles-cacbff60.js";
import { G as tt } from "./graph-0ee63739.js";
import { l as E, c as g, j as $, A as et, k as ot, f as w } from "./mermaid-9f2aa176.js";
import { r as st } from "./index-bb6d8841.js";
import "./layout-fd473db2.js";
import "./clone-afc2f047.js";
import "./edges-16357fde.js";
import "./createText-03b82060.js";
import "./line-24d93f1b.js";
import "./array-2ff2c7a6.js";
import "./path-428ebac9.js";
const h = "rect", C = "rectWithTitle", nt = "start", ct = "end", it = "divider", rt = "roundedWithTitle", lt = "note", at = "noteGroup", _ = "statediagram", dt = "state", Et = `${_}-${dt}`, U = "transition", St = "note", Tt = "note-edge", pt = `${U} ${Tt}`, _t = `${_}-${St}`, ut = "cluster", ft = `${_}-${ut}`, Dt = "cluster-alt", bt = `${_}-${Dt}`, V = "parent", Y = "note", At = "state", N = "----", ht = `${N}${Y}`, v = `${N}${V}`, W = "fill:none", m = "fill: #333", z = "c", j = "text", q = "normal";
let y = {}, d = 0;
const yt = function(t) {
const n = Object.keys(t);
for (const e of n)
t[e];
}, gt = function(t, n) {
return n.db.extract(n.db.getRootDocV2()), n.db.getClasses();
};
function xt(t) {
return t == null ? "" : t.classes ? t.classes.join(" ") : "";
}
function R(t = "", n = 0, e = "", c = N) {
const i = e !== null && e.length > 0 ? `${c}${e}` : "";
return `${At}-${t}${i}-${n}`;
}
const A = (t, n, e, c, i, r) => {
const o = e.id, u = xt(c[o]);
if (o !== "root") {
let T = h;
e.start === !0 && (T = nt), e.start === !1 && (T = ct), e.type !== H && (T = e.type), y[o] || (y[o] = {
id: o,
shape: T,
description: w.sanitizeText(o, g()),
classes: `${u} ${Et}`
});
const s = y[o];
e.description && (Array.isArray(s.description) ? (s.shape = C, s.description.push(e.description)) : s.description.length > 0 ? (s.shape = C, s.description === o ? s.description = [e.description] : s.description = [s.description, e.description]) : (s.shape = h, s.description = e.description), s.description = w.sanitizeTextOrArray(s.description, g())), s.description.length === 1 && s.shape === C && (s.shape = h), !s.type && e.doc && (E.info("Setting cluster for ", o, G(e)), s.type = "group", s.dir = G(e), s.shape = e.type === J ? it : rt, s.classes = s.classes + " " + ft + " " + (r ? bt : ""));
const p = {
labelStyle: "",
shape: s.shape,
labelText: s.description,
// typeof newNode.description === 'object'
// ? newNode.description[0]
// : newNode.description,
classes: s.classes,
style: "",
//styles.style,
id: o,
dir: s.dir,
domId: R(o, d),
type: s.type,
padding: 15
//getConfig().flowchart.padding
};
if (p.centerLabel = !0, e.note) {
const l = {
labelStyle: "",
shape: lt,
labelText: e.note.text,
classes: _t,
// useHtmlLabels: false,
style: "",
// styles.style,
id: o + ht + "-" + d,
domId: R(o, d, Y),
type: s.type,
padding: 15
//getConfig().flowchart.padding
}, a = {
labelStyle: "",
shape: at,
labelText: e.note.text,
classes: s.classes,
style: "",
// styles.style,
id: o + v,
domId: R(o, d, V),
type: "group",
padding: 0
//getConfig().flowchart.padding
};
d++;
const f = o + v;
t.setNode(f, a), t.setNode(l.id, l), t.setNode(o, p), t.setParent(o, f), t.setParent(l.id, f);
let S = o, D = l.id;
e.note.position === "left of" && (S = l.id, D = o), t.setEdge(S, D, {
arrowhead: "none",
arrowType: "",
style: W,
labelStyle: "",
classes: pt,
arrowheadStyle: m,
labelpos: z,
labelType: j,
thickness: q
});
} else
t.setNode(o, p);
}
n && n.id !== "root" && (E.trace("Setting node ", o, " to be child of its parent ", n.id), t.setParent(o, n.id)), e.doc && (E.trace("Adding nodes children "), $t(t, e, e.doc, c, i, !r));
}, $t = (t, n, e, c, i, r) => {
E.trace("items", e), e.forEach((o) => {
switch (o.stmt) {
case X:
A(t, n, o, c, i, r);
break;
case H:
A(t, n, o, c, i, r);
break;
case Q:
{
A(t, n, o.state1, c, i, r), A(t, n, o.state2, c, i, r);
const u = {
id: "edge" + d,
arrowhead: "normal",
arrowTypeEnd: "arrow_barb",
style: W,
labelStyle: "",
label: w.sanitizeText(o.description, g()),
arrowheadStyle: m,
labelpos: z,
labelType: j,
thickness: q,
classes: U
};
t.setEdge(o.state1.id, o.state2.id, u, d), d++;
}
break;
}
});
}, G = (t, n = Z) => {
let e = n;
if (t.doc)
for (let c = 0; c < t.doc.length; c++) {
const i = t.doc[c];
i.stmt === "dir" && (e = i.value);
}
return e;
}, Ct = async function(t, n, e, c) {
E.info("Drawing state diagram (v2)", n), y = {}, c.db.getDirection();
const { securityLevel: i, state: r } = g(), o = r.nodeSpacing || 50, u = r.rankSpacing || 50;
E.info(c.db.getRootDocV2()), c.db.extract(c.db.getRootDocV2()), E.info(c.db.getRootDocV2());
const T = c.db.getStates(), s = new tt({
multigraph: !0,
compound: !0
}).setGraph({
rankdir: G(c.db.getRootDocV2()),
nodesep: o,
ranksep: u,
marginx: 8,
marginy: 8
}).setDefaultEdgeLabel(function() {
return {};
});
A(s, void 0, c.db.getRootDocV2(), T, c.db, !0);
let p;
i === "sandbox" && (p = $("#i" + n));
const l = i === "sandbox" ? $(p.nodes()[0].contentDocument.body) : $("body"), a = l.select(`[id="${n}"]`), f = l.select("#" + n + " g");
await st(f, s, ["barb"], _, n);
const S = 8;
et.insertTitle(a, "statediagramTitleText", r.titleTopMargin, c.db.getDiagramTitle());
const D = a.node().getBBox(), L = D.width + S * 2, P = D.height + S * 2;
a.attr("class", _);
const O = a.node().getBBox();
ot(a, P, L, r.useMaxWidth);
const k = `${O.x - S} ${O.y - S} ${L} ${P}`;
E.debug(`viewBox ${k}`), a.attr("viewBox", k);
const K = document.querySelectorAll('[id="' + n + '"] .edgeLabel .label');
for (const x of K) {
const B = x.getBBox(), b = document.createElementNS("http://www.w3.org/2000/svg", h);
b.setAttribute("rx", 0), b.setAttribute("ry", 0), b.setAttribute("width", B.width), b.setAttribute("height", B.height), x.insertBefore(b, x.firstChild);
}
}, Rt = {
setConf: yt,
getClasses: gt,
draw: Ct
}, Ut = {
parser: F,
db: M,
renderer: Rt,
styles: I,
init: (t) => {
t.state || (t.state = {}), t.state.arrowMarkerAbsolute = t.arrowMarkerAbsolute, M.clear();
}
};
export {
Ut as diagram
};

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more