@zombie-mermaid/svg-renderer 3.2.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/index.cjs +45 -41
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +34 -4
  4. package/dist/index.d.ts +34 -4
  5. package/dist/index.js +2310 -1115
  6. package/dist/index.js.map +1 -1
  7. package/package.json +3 -3
  8. package/src/__tests__/c4-label-clearance-1290.test.ts +112 -0
  9. package/src/__tests__/c4-line-ends-1208.test.ts +52 -0
  10. package/src/__tests__/c4-mermaid-reference.test.ts +56 -17
  11. package/src/__tests__/c4-text-width-1210.test.ts +43 -0
  12. package/src/__tests__/class-component-order-1249.test.ts +40 -0
  13. package/src/__tests__/class-member-right-padding-1238.test.ts +43 -0
  14. package/src/__tests__/class-namespace-1196.test.ts +165 -0
  15. package/src/__tests__/class-namespace-sparse-elk-1196.test.ts +96 -0
  16. package/src/__tests__/class-visibility-markers-1237.test.ts +27 -0
  17. package/src/__tests__/er-attribute-right-padding-1262.test.ts +47 -0
  18. package/src/__tests__/er-default-direction-1250.test.ts +69 -0
  19. package/src/__tests__/er-edge-label-contrast-1244.test.ts +58 -0
  20. package/src/__tests__/sequence-label-clearance-1242.test.ts +162 -0
  21. package/src/__tests__/sequence-nested-activation-1241.test.ts +37 -0
  22. package/src/__tests__/xychart-x-label-overlap-1243.test.ts +62 -0
  23. package/src/c4/arial-widths.ts +59 -0
  24. package/src/c4/layout.ts +234 -44
  25. package/src/c4/metrics.ts +56 -30
  26. package/src/c4/renderer.ts +1 -1
  27. package/src/class/layout.ts +178 -13
  28. package/src/class/renderer.ts +31 -2
  29. package/src/er/layout.ts +20 -4
  30. package/src/er/renderer.ts +10 -1
  31. package/src/layout-engine/back-edges.ts +73 -0
  32. package/src/layout-engine/compound-flat.ts +916 -0
  33. package/src/layout-engine/elk-graph-builder.ts +5 -4
  34. package/src/layout-engine/from-elk.ts +7 -2
  35. package/src/layout-engine/inner-edges.ts +329 -0
  36. package/src/layout-engine/layout-hints.ts +27 -0
  37. package/src/layout-engine/to-elk.ts +170 -20
  38. package/src/layout-engine.ts +38 -1
  39. package/src/registry.ts +2 -2
  40. package/src/renderer.ts +26 -2
  41. package/src/sequence/layout.ts +72 -4
  42. package/src/sequence/renderer.ts +155 -15
  43. package/src/title-gaps.ts +146 -0
  44. package/src/xychart/layout.ts +31 -2
  45. package/src/xychart/renderer.ts +1 -0
package/dist/index.cjs CHANGED
@@ -1,14 +1,16 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("@zombie-mermaid/core"),l=require("elkjs/lib/elk.bundled.js");l=s(l,1);let u=require("@zombie-mermaid/mermaid-parser"),d=require("entities");function f(e){return c.f`M ${e.x} ${e.y}`}function p(e){return f(e[0])+e.slice(1).map(e=>c.f` L ${e.x} ${e.y}`).join(``)}function m(e){if(e.length<3)return p(e);let t=e[e.length-1],n=[f(e[0])],r=(e,t,n)=>c.f` C ${(2*e.x+t.x)/3} ${(2*e.y+t.y)/3},`+c.f` ${(e.x+2*t.x)/3} ${(e.y+2*t.y)/3},`+c.f` ${(e.x+4*t.x+n.x)/6} ${(e.y+4*t.y+n.y)/6}`;n.push(c.f` L ${(5*e[0].x+e[1].x)/6}`+c.f` ${(5*e[0].y+e[1].y)/6}`);for(let t=2;t<e.length;t++)n.push(r(e[t-2],e[t-1],e[t]));return n.push(r(e[e.length-2],t,t)),n.push(c.f` L ${t.x} ${t.y}`),n.join(``)}function h(e){if(e.length<3)return p(e);let t=[f(e[0])];for(let n=1;n<e.length-1;n++){let r=e[n-1],i=e[n],a=e[n+1],o=Math.hypot(i.x-r.x,i.y-r.y),s=Math.hypot(a.x-i.x,a.y-i.y);if(o===0||s===0){t.push(c.f` L ${i.x} ${i.y}`);continue}let l=Math.min(12,o/2,s/2),u=i.x-(i.x-r.x)/o*l,d=i.y-(i.y-r.y)/o*l,f=i.x+(a.x-i.x)/s*l,p=i.y+(a.y-i.y)/s*l;t.push(c.f` L ${u} ${d}`),t.push(c.f` Q ${i.x} ${i.y}, ${f} ${p}`)}let n=e[e.length-1];return t.push(c.f` L ${n.x} ${n.y}`),t.join(``)}function g(e,t){let n=[f(e[0])],r=e.length-1;for(let i=0;i<r;i++){let a=e[i],o=e[i+1];if(i===r-1){n.push(c.f` L ${o.x} ${o.y}`);break}if(t===`before`)n.push(c.f` L ${a.x} ${o.y} L ${o.x} ${o.y}`);else if(t===`after`)n.push(c.f` L ${o.x} ${a.y} L ${o.x} ${o.y}`);else{let e=(a.y+o.y)/2;n.push(c.f` L ${a.x} ${e} L ${o.x} ${e} L ${o.x} ${o.y}`)}}return n.join(``)}function _(e,t=`linear`){if(e.length===0)return``;if(e.length===1)return f(e[0]);switch(t){case`basis`:return m(e);case`natural`:return h(e);case`step`:return g(e,`mid`);case`stepBefore`:return g(e,`before`);case`stepAfter`:return g(e,`after`);default:return p(e)}}var v=null,y=null,b=20;function x(e=b){if(!Number.isInteger(e)||e<1)throw Error(`createLayoutCache: maxSize must be a positive integer, got ${e}`);return{map:new Map,maxSize:e}}function S(e){if(Array.isArray(e))return`[${e.map(S).join(`,`)}]`;if(typeof e==`object`&&e){let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${S(t[e])}`).join(`,`)}}`}return JSON.stringify(e)}function C(){if(v&&y)return y;let e=[],t=globalThis.setTimeout;globalThis.setTimeout=(n,r)=>r===0?(e.push(n),0):t(n,r);let n=globalThis,r=`self`in n,i=n.self;if(r&&n.document===void 0&&delete n.self,v=new l.default,!v)throw Error(`ELKBundled construction unexpectedly produced no instance`);return r&&(n.self=i),globalThis.setTimeout=t,e.forEach(e=>e()),y=v.worker.worker,y}function w(e,t){let n=t,r=n?S(e):void 0;if(n&&r!==void 0){let e=n.map.get(r);if(e)return n.map.delete(r),n.map.set(r,e),e}let i=C(),a,o,s=i.onmessage;if(i.onmessage=e=>{e.data.error?o=e.data.error:a=e.data.data},i.dispatcher.saveDispatch({data:{id:0,cmd:`layout`,graph:e}}),i.onmessage=s,o)throw o;if(!a)throw Error(`ELK layout did not return synchronously`);if(n&&r!==void 0&&(n.map.set(r,a),n.map.size>n.maxSize)){let e=n.map.keys().next().value;e!==void 0&&n.map.delete(e)}return a}function T(e,t,n){return(0,c.measureTextWidth)(e,t,n)}function E(e,t){return e.length*t*.6}var D=`'JetBrains Mono'`,O=`${D}, 'SF Mono', 'Fira Code', ui-monospace, monospace`,k={nodeLabel:13,edgeLabel:11,groupHeader:12};function A(e){return{nodeLabel:e?.nodeLabel??k.nodeLabel,edgeLabel:e?.edgeLabel??k.edgeLabel,groupHeader:e?.groupHeader??k.groupHeader}}var j={nodeLabel:500,edgeLabel:400,groupHeader:600},M=12,N={horizontal:20,vertical:10,diamondExtra:24},P={outerBox:1,innerBox:.75,connector:1},F=`0.35em`,I={width:8,height:5},L={font:`Inter`,padding:40,nodeSpacing:28,layerSpacing:48,mergeEdges:!0,thoroughness:3,fontSizes:k},ee={flowchart:`DOWN`,state:`DOWN`,class:`DOWN`,er:`RIGHT`,c4:`DOWN`};function te(e,t){switch(e){case`LR`:return`RIGHT`;case`RL`:return`LEFT`;case`BT`:return`UP`;case`TD`:case`TB`:return`DOWN`;default:return t}}function ne(e){let t=typeof e==`number`?{top:e,left:e,bottom:e,right:e}:e;return`[top=${t.top},left=${t.left},bottom=${t.bottom},right=${t.right}]`}function re(e){return{"elk.algorithm":`layered`,"elk.direction":e.direction,"elk.spacing.nodeNode":String(e.nodeSpacing),"elk.layered.spacing.nodeNodeBetweenLayers":String(e.layerSpacing),"elk.padding":ne(e.padding),"elk.edgeRouting":`ORTHOGONAL`}}function R(e,t,n){let r={id:e,width:t.width,height:t.height};return n!==void 0&&(r.labels=[{text:n}]),r}var ie={"elk.edgeLabels.inline":`true`,"elk.edgeLabels.placement":`CENTER`};function ae(e,t){let n=(0,c.measureMultilineText)(e,t.fontSize,j.edgeLabel),r={text:e,width:n.width+8,height:n.height+6};return t.layoutOptions&&(r.layoutOptions={...t.layoutOptions}),r}function z(e){let t={id:e.id,sources:[e.source],targets:[e.target]};return e.label&&(t.labels=[ae(e.label,e.labelStyle)]),t}function oe(e){return te(e,ee.flowchart)}function se(e){return{...re(e),"elk.spacing.edgeEdge":`12`,"elk.layered.spacing.edgeEdgeBetweenLayers":`12`,"elk.layered.spacing.edgeNodeBetweenLayers":`12`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`,"elk.contentAlignment":`H_CENTER V_CENTER`}}function ce(e){return{fontSize:e.fontSizes.edgeLabel,layoutOptions:ie}}function le(e,t,n,r){let i=(0,c.measureMultilineText)(t,r,j.nodeLabel),a=i.width+N.horizontal*2,o=i.height+N.vertical*2;if(n===`diamond`){let e=Math.max(a,o)+N.diamondExtra;a=e,o=e}if(n===`circle`||n===`doublecircle`){let e=Math.ceil(Math.sqrt(a*a+o*o))+8;a=n===`doublecircle`?e+12:e,o=a}return n===`hexagon`&&(a+=N.horizontal),(n===`trapezoid`||n===`trapezoid-alt`||n===`parallelogram`||n===`parallelogram-alt`)&&(a+=N.horizontal),n===`asymmetric`&&(a+=12),n===`cylinder`&&(o+=14),n===`state-start`||n===`state-end`?{width:28,height:28}:(a=Math.max(a,60),o=Math.max(o,36),{width:a,height:o})}var ue=` root`;function de(e){for(let t of e)if(t.direction!==void 0||de(t.children))return!0;return!1}function fe(e,t){for(let n of e.nodeIds)t.add(n);for(let n of e.children)fe(n,t)}function pe(e,t){let n=new Set;if(fe(e,n),n.size===0)return!0;let r=t=>n.has(t)||t===e.id;return!t.edges.some(e=>r(e.source)!==r(e.target))}function me(e){let t=new Map;function n(e,r){let i=[...r,e.id];t.set(e.id,i);for(let t of e.children)n(t,i)}for(let t of e)n(t,[]);return t}function he(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return n}function ge(e,t){let n=new Set,r=new Set;for(let t of e.subgraphs)r.add(t.id),ve(t,n,r);let i=ye(e.subgraphs),a=me(e.subgraphs),o=e=>e?a.get(e)??[]:[],s=new Map;s.set(null,[]);let c=[];for(let t=0;t<e.edges.length;t++){let n=e.edges[t],r=i.get(n.source),a=i.get(n.target);if(r&&r===a){let e=s.get(r)??[];s.set(r,e),e.push({index:t,edge:n})}else!r&&!a?s.get(null).push({index:t,edge:n}):c.push({index:t,edge:n,srcChain:o(r),tgtChain:o(a)})}let l=de(e.subgraphs),u=[],d=[],f={...se({direction:oe(e.direction),nodeSpacing:t.nodeSpacing,layerSpacing:t.layerSpacing,padding:t.padding}),"elk.layered.thoroughness":String(L.thoroughness),"elk.layered.highDegreeNodes.treatment":`true`,"elk.layered.highDegreeNodes.threshold":`8`,"elk.layered.compaction.postCompaction.strategy":`LEFT_RIGHT_CONSTRAINT_LOCKING`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,"elk.layered.wrapping.strategy":`OFF`,"elk.hierarchyHandling":l?`SEPARATE`:`INCLUDE_CHILDREN`},p=new Map,m=new Map;function h(e,t){let n=p.get(e)??new Set;p.set(e,n),n.add(t)}function g(e,t){let n=m.get(e)??[];m.set(e,n),n.push(t)}if(l)for(let{index:e,edge:n,srcChain:r,tgtChain:i}of c){let a=he(r,i),o=n.source;if(r.length>a){for(let t=r.length-1;t>=a;t--){let i=r[t],a=`${i}_out_${e}`;h(i,a);let o=t===r.length-1?n.source:`${r[t+1]}_out_${e}`;g(i,{id:`e${e}_s${t}`,sources:[o],targets:[a]})}o=`${r[a]}_out_${e}`}let s=n.target;if(i.length>a){for(let t=a;t<=i.length-1;t++){let r=i[t],a=`${r}_in_${e}`;h(r,a);let o=t===i.length-1?n.target:`${i[t+1]}_in_${e}`;g(r,{id:`e${e}_t${t}`,sources:[a],targets:[o]})}s=`${i[a]}_in_${e}`}g(a>0?r[a-1]:ue,z({id:`e${e}`,source:o,target:s,label:n.label,labelStyle:ce(t)}))}for(let[i,a]of e.nodes)if(!n.has(i)&&!r.has(i)){let e=le(i,a.label,a.shape,t.fontSizes.nodeLabel);u.push(R(i,e,a.label))}for(let n of[...e.subgraphs].reverse())u.push(_e(n,e,t,s,p,m,e.direction));for(let{index:e,edge:n}of s.get(null))n.source!==n.target&&d.push(z({id:`e${e}`,source:n.source,target:n.target,label:n.label,labelStyle:ce(t)}));if(l)for(let e of m.get(ue)??[])d.push(e);else for(let{index:e,edge:n}of c)d.push(z({id:`e${e}`,source:n.source,target:n.target,label:n.label,labelStyle:ce(t)}));return{id:`root`,layoutOptions:f,children:u,edges:d}}function _e(e,t,n,r,i,a,o){let s=e.direction!==void 0&&pe(e,t)?e.direction:o,c=se({direction:oe(s),nodeSpacing:n.nodeSpacing,layerSpacing:n.layerSpacing,padding:{top:44,left:16,bottom:16,right:16}}),l,u=i.get(e.id);u&&u.size>0&&(l=[...u].map(e=>({id:e})));let d=[];for(let r of e.nodeIds){let e=t.nodes.get(r);if(e){let t=le(r,e.label,e.shape,n.fontSizes.nodeLabel);d.push(R(r,t,e.label))}}for(let o of[...e.children].reverse())d.push(_e(o,t,n,r,i,a,s));let f=[],p=r.get(e.id)??[];for(let{index:e,edge:t}of p)t.source!==t.target&&f.push(z({id:`e${e}`,source:t.source,target:t.target,label:t.label,labelStyle:ce(n)}));for(let t of a.get(e.id)??[])f.push(t);return{id:e.id,layoutOptions:c,labels:e.label?[{text:e.label}]:void 0,ports:l,children:d,edges:f}}function ve(e,t,n){for(let n of e.nodeIds)t.add(n);for(let r of e.children)n.add(r.id),ve(r,t,n)}function ye(e){let t=new Map;function n(e){for(let n of e.nodeIds)t.set(n,e.id);for(let t of e.children)n(t)}for(let t of e)n(t);return t}function be(e,t,n){if(e.length<2||t.shape===`rectangle`||t.shape===`rounded`||t.shape===`stadium`)return e;let r=[...e];if(t.shape===`diamond`){if(n)r[0]=xe(e[0],e[1],t);else{let n=e.length-1;r[n]=xe(e[n],e[n-1],t)}}return r}function xe(e,t,n){let r=n.x+n.width/2,i=n.y+n.height/2,a={x:r,y:n.y},o={x:n.x+n.width,y:i},s={x:r,y:n.y+n.height},c={x:n.x,y:i},l=e.x-t.x,u=e.y-t.y;if(Math.abs(l)<Math.abs(u)){let t=e.x;return u>0?t<=r?Ce(t,c,a)??a:Ce(t,a,o)??a:t<=r?Ce(t,s,c)??s:Ce(t,o,s)??s}{let t=e.y;return l>0?t<=i?Se(t,a,c)??c:Se(t,c,s)??c:t<=i?Se(t,a,o)??o:Se(t,o,s)??o}}function Se(e,t,n){let r=n.y-t.y;if(Math.abs(r)<.001)return null;let i=(e-t.y)/r;return i<0||i>1?null:{x:t.x+i*(n.x-t.x),y:e}}function Ce(e,t,n){let r=n.x-t.x;if(Math.abs(r)<.001)return null;let i=(e-t.x)/r;return i<0||i>1?null:{x:e,y:t.y+i*(n.y-t.y)}}function we(e,t,n){if(e.length===0)return;let r=n===`LR`||n===`RL`,i=new Set;for(let e of t)i.add(`${e.source}:${e.target}`),i.add(`${e.target}:${e.source}`);let a=L.layerSpacing*.6,o=[...e].sort((e,t)=>r?e.x-t.x:e.y-t.y),s=[],c=[o[0]];for(let e=1;e<o.length;e++){let t=(r?o[e].x:o[e].y)-(r?o[e-1].x:o[e-1].y),n=c.some(t=>i.has(`${t.id}:${o[e].id}`));t<=a&&!n?c.push(o[e]):(s.push(c),c=[o[e]])}s.push(c);let l=new Map;for(let e of s){if(e.length<=1)continue;let t=e.map(e=>r?e.x:e.y),n=Math.min(...t),i=Math.max(...t);if(i-n<=1)continue;let a=(n+i)/2;for(let t of e){let e=a-(r?t.x:t.y);Math.abs(e)>.5&&(r?t.x=a:t.y=a,l.set(t.id,e))}}if(l.size!==0)for(let e of t){if(e.points.length<2)continue;let t=l.get(e.source),n=l.get(e.target);if(t!=null){let n=e.points[0];r?(n.x+=t,e.points.length>1&&e.points[1].x===n.x-t&&(e.points[1].x+=t)):(n.y+=t,e.points.length>1&&e.points[1].y===n.y-t&&(e.points[1].y+=t))}if(n!=null){let t=e.points[e.points.length-1];if(r){if(t.x+=n,e.points.length>1){let r=e.points[e.points.length-2];r.x===t.x-n&&(r.x+=n)}}else if(t.y+=n,e.points.length>1){let r=e.points[e.points.length-2];r.y===t.y-n&&(r.y+=n)}}}}var Te=.5;function Ee(e,t,n){for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1],o=Math.min(i.x,a.x),s=Math.max(i.x,a.x),c=Math.min(i.y,a.y),l=Math.max(i.y,a.y);for(let e of t){if(n.has(e.id))continue;let t=e.x+Te,r=e.x+e.width-Te,i=e.y+Te,a=e.y+e.height-Te;if(!(t>=r||i>=a)&&o<r&&s>t&&c<a&&l>i)return!1}}return!0}function De(e,t,n){let r=[];for(let i of n)e>=i.x&&e<=i.x+i.width&&t>=i.y&&t<=i.y+i.height&&(r.push(i),r.push(...De(e,t,i.children)));return r}function Oe(e,t,n,r,i){let a=i===`LR`,o=i===`RL`,s=i===`BT`,c=a||o,l=new Set(De(t,n,r).map(e=>e.id)),u=De(c?e:t,c?n:e,r).find(e=>!l.has(e.id));return u?a?u.x-12:o?u.x+u.width+12:s?u.y+u.height+12:u.y-12:e}function ke(e,t,n,r){let i=new Map(t.map(e=>[e.id,e])),a=new Set,o=r===`LR`,s=r===`RL`,c=r===`BT`,l=o||s,u=new Map;for(let t of e){if(t.source===t.target)continue;let e=u.get(t.source)??[];u.set(t.source,e),e.push(t)}for(let[e,d]of u){if(d.length<2)continue;let u=d[0].style;if(d.some(e=>e.label||e.style!==u))continue;let f=i.get(e);if(!f)continue;let p=[];for(let e of d){let t=i.get(e.target);t&&(o?t.x>f.x+f.width:s?t.x+t.width<f.x:c?t.y+t.height<f.y:t.y>f.y+f.height)&&p.push({edge:e,node:t})}if(p.length<2)continue;let m=f.x+f.width/2,h=f.y+f.height/2;if(l){let i=o?f.x+f.width:f.x,s=h,c=i+((o?Math.min(...p.map(e=>e.node.x)):Math.max(...p.map(e=>e.node.x+e.node.width)))-i)/2;c=Oe(c,m,h,n,r);let l=[];for(let{edge:n,node:r}of p){let a=o?r.x:r.x+r.width,u=r.y+r.height/2,d=[{x:i,y:s},{x:c,y:s},{x:c,y:u},{x:a,y:u}];Ee(d,t,new Set([e,r.id]))&&l.push({edge:n,points:d})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t,a.add(e)}else{let i=m,o=c?f.y:f.y+f.height,s=o+((c?Math.max(...p.map(e=>e.node.y+e.node.height)):Math.min(...p.map(e=>e.node.y)))-o)/2;s=Oe(s,m,h,n,r);let l=[];for(let{edge:n,node:r}of p){let a=r.x+r.width/2,u=c?r.y+r.height:r.y,d=[{x:i,y:o},{x:i,y:s},{x:a,y:s},{x:a,y:u}];Ee(d,t,new Set([e,r.id]))&&l.push({edge:n,points:d})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t,a.add(e)}}let d=new Map;for(let t of e){if(a.has(t)||t.source===t.target)continue;let e=d.get(t.target)??[];d.set(t.target,e),e.push(t)}for(let[e,a]of d){if(a.length<2)continue;let u=a[0].style;if(a.some(e=>e.label||e.style!==u))continue;let d=i.get(e);if(!d)continue;let f=[];for(let e of a){let t=i.get(e.source);t&&(o?t.x+t.width<d.x:s?t.x>d.x+d.width:c?t.y>d.y+d.height:t.y+t.height<d.y)&&f.push({edge:e,node:t})}if(f.length<2)continue;let p=d.x+d.width/2,m=d.y+d.height/2;if(l){let i=o?d.x:d.x+d.width,a=m,s=o?Math.max(...f.map(e=>e.node.x+e.node.width)):Math.min(...f.map(e=>e.node.x)),c=s+(i-s)/2;c=Oe(c,p,m,n,r);let l=[];for(let{edge:n,node:r}of f){let s=o?r.x+r.width:r.x,u=r.y+r.height/2,d=[{x:s,y:u},{x:c,y:u},{x:c,y:a},{x:i,y:a}];Ee(d,t,new Set([r.id,e]))&&l.push({edge:n,points:d})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t}else{let i=p,a=c?d.y+d.height:d.y,o=c?Math.min(...f.map(e=>e.node.y)):Math.max(...f.map(e=>e.node.y+e.node.height)),s=o+(a-o)/2;s=Oe(s,p,m,n,r);let l=[];for(let{edge:n,node:r}of f){let o=r.x+r.width/2,u=[{x:o,y:c?r.y:r.y+r.height},{x:o,y:s},{x:i,y:s},{x:i,y:a}];Ee(u,t,new Set([r.id,e]))&&l.push({edge:n,points:u})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t}}}function Ae(e,t=0,n=0){let r=[];if(!e.sections||e.sections.length===0)return r;let i=e.sections[0];if(r.push({x:i.startPoint.x+t,y:i.startPoint.y+n}),i.bendPoints)for(let e of i.bendPoints)r.push({x:e.x+t,y:e.y+n});return r.push({x:i.endPoint.x+t,y:i.endPoint.y+n}),r}function je(e,t=0,n=0){if(!e.labels||e.labels.length===0)return;let r=e.labels[0];if(r.x!=null&&r.y!=null)return{x:r.x+(r.width??0)/2+t,y:r.y+(r.height??0)/2+n}}var Me=16,Ne=28,Pe=18,Fe=28,Ie=10;function Le(e,t){let n=e.x+e.width,r=e.y+e.height/2,i=Math.min(Fe,e.height*.6)/2,a=Ne+t*Pe,o=[];for(let e=0;e<=Me;e++){let t=Math.PI*e/Me;o.push({x:n+a*Math.sin(t),y:r-i*Math.cos(t)})}return{points:o,labelPosition:{x:n+a+Ie,y:r}}}function Re(e,t,n){let r=new Map;for(let i=0;i<e.edges.length;i++){let a=e.edges[i];if(a.source!==a.target)continue;let o=t.get(a.source);if(!o)continue;let s=r.get(o.id)??0;r.set(o.id,s+1);let{points:c,labelPosition:l}=Le(o,s);n.push({source:a.source,target:a.target,label:a.label,style:a.style,hasArrowStart:a.hasArrowStart,hasArrowEnd:a.hasArrowEnd,points:c,labelPosition:a.label?l:void 0,inlineStyle:Xe(i,e),id:a.id,animate:a.animate})}}function ze(e){let t=[];for(let n of e)t.push({x:n.x,y:n.y,right:n.x+n.width,bottom:n.y+n.height}),t.push(...ze(n.children));return t}function Be(e,t,n=!1){let r=[],i=[],a=[],o=new Set;for(let e of t.subgraphs)Ye(e,o);Ve(e,t,o,r,a,0,0);let s=ze(a);We(e,t,i,0,0,s.length>0?{leftX:Math.min(...s.map(e=>e.x))-20,rightX:Math.max(...s.map(e=>e.right))+20}:void 0),we(r,i,t.direction);let c=new Map(r.map(e=>[e.id,e]));Re(t,c,i),n&&ke(i,r,a,t.direction);for(let e of i){let t=c.get(e.source),n=c.get(e.target);t&&(e.points=be(e.points,t,!0)),n&&(e.points=be(e.points,n,!1))}let l=e.width??800,u=e.height??600,d=I.width,f=L.padding;for(let e of i){for(let t of e.points)l=Math.max(l,t.x+d+f),u=Math.max(u,t.y+d+f);e.labelPosition&&(l=Math.max(l,e.labelPosition.x+60+f),u=Math.max(u,e.labelPosition.y+20+f))}return{width:l,height:u,nodes:r,edges:i,groups:a}}function Ve(e,t,n,r,i,a,o){if(e.children)for(let s of e.children){let e=(s.x??0)+a,l=(s.y??0)+o,u=s.width??0,d=s.height??0;if(n.has(s.id)){let a=[];Ve(s,t,n,r,a,e,l);let o=Je(t.subgraphs,s.id);i.push({id:s.id,label:o?.label??``,x:e,y:l,width:u,height:d,children:a})}else{let a=t.nodes.get(s.id);if(a){let n=(0,c.resolveNodeStyle)(s.id,t),i=t.classAssignments.get(s.id);r.push({id:s.id,label:a.label,shape:a.shape,x:e,y:l,width:u,height:d,inlineStyle:n,className:i,interaction:t.interactions.get(s.id)})}s.children&&s.children.length>0&&Ve(s,t,n,r,i,e,l)}}}function He(e){let t=/^e(\d+)$/.exec(e);if(t)return{edgeIndex:parseInt(t[1],10),role:`bridge`};let n=/^e(\d+)_([st])(\d+)$/.exec(e);if(n)return{edgeIndex:parseInt(n[1],10),role:n[2]===`s`?`source`:`target`,level:parseInt(n[3],10)}}function Ue(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++){let r=e[n].x-e[n-1].x,i=e[n].y-e[n-1].y;t+=Math.sqrt(r*r+i*i)}let n=t/2;for(let t=1;t<e.length;t++){let r=e[t].x-e[t-1].x,i=e[t].y-e[t-1].y,a=Math.sqrt(r*r+i*i);if(n<=a){let o=n/a;return{x:e[t-1].x+o*r,y:e[t-1].y+o*i}}n-=a}return e[e.length-1]}function We(e,t,n,r,i,a){let o=new Map;Ge(e,o,0,0);let s=new Map;qe(e,s,0,0,o);let c=0;for(let[e,r]of s){let i=t.edges[e];if(!i)continue;let o=[],s=e=>{!e||e.points.length===0||(o.length>0?o.push(...e.points.slice(1)):o.push(...e.points))},l=[...r.sourceHops.keys()].sort((e,t)=>t-e);for(let e of l)s(r.sourceHops.get(e));s(r.bridge);let u=[...r.targetHops.keys()].sort((e,t)=>e-t);for(let e of u)s(r.targetHops.get(e));let d;i.label&&o.length>=2&&(d=r.bridge?.labelPosition??Ue(o));let f=Ke(o,a,c);f!==o&&c++,i.label&&f!==o&&f.length>=2&&(d=Ue(f)),n.push({source:i.source,target:i.target,label:i.label,style:i.style,hasArrowStart:i.hasArrowStart,hasArrowEnd:i.hasArrowEnd,points:f,labelPosition:d,inlineStyle:Xe(e,t),id:i.id,animate:i.animate})}}function Ge(e,t,n,r){t.set(e.id,{x:n,y:r});for(let i of e.children??[]){let e=i.x??0,a=i.y??0;Ge(i,t,n+e,r+a)}}function Ke(e,t,n=0){if(e.length<2)return e;let r=!1;for(let t=1;t<e.length;t++){let n=Math.abs(e[t].x-e[t-1].x),i=Math.abs(e[t].y-e[t-1].y);if(n>1&&i>1){r=!0;break}}if(!r)return e;let i=[e[0]];for(let r=1;r<e.length;r++){let a=i[i.length-1],o=e[r],s=Math.abs(o.x-a.x),c=Math.abs(o.y-a.y);if(s>1&&c>1){if(t){let e=n%2==0,r=Math.floor(n/2)*12,s=e?t.rightX+r:t.leftX-r;i.push({x:s,y:a.y}),i.push({x:s,y:o.y})}else{let e=(a.y+o.y)/2;i.push({x:a.x,y:e}),i.push({x:o.x,y:e})}}i.push(o)}return i}function qe(e,t,n,r,i){if(e.edges)for(let a of e.edges){let e=He(a.id);if(!e)continue;let{edgeIndex:o}=e,s=a.container,c=s?i.get(s):void 0,l=c?.x??n,u=c?.y??r,d=Ae(a,l,u),f=je(a,l,u),p=t.get(o)??{sourceHops:new Map,targetHops:new Map};t.set(o,p);let m={edgeIndex:o,points:d,labelPosition:f};e.role===`bridge`?p.bridge=m:e.role===`source`?p.sourceHops.set(e.level,m):p.targetHops.set(e.level,m)}if(e.children)for(let a of e.children)qe(a,t,n+(a.x??0),r+(a.y??0),i)}function Je(e,t){for(let n of e){if(n.id===t)return n;let e=Je(n.children,t);if(e)return e}}function Ye(e,t){t.add(e.id);for(let n of e.children)Ye(n,t)}function Xe(e,t){let n,r=t.linkStyles.get(`default`);r&&(n={...r});let i=t.linkStyles.get(e);return i&&(n=n?{...n,...i}:{...i}),n}function Ze(e,t={}){let n={...L,...t,fontSizes:A(t.fontSizes)};return Be(w(ge(e,n),t.layoutCache),e,n.mergeEdges)}function Qe(e,t={}){return ge(e,{...L,...t,fontSizes:A(t.fontSizes)})}function $e(e,t,n=`Inter`,r=!1,i=k,a=`linear`,o,s=!0,l=!0,u,d,f={}){let p=[],m=l&&e.nodes.some(e=>!!(0,c.safeHref)(e.interaction?.href));p.push(V((0,c.svgOpenTag)(e.width,e.height,t,r,u,d,m,f.styleAttribute),o)),p.push((0,c.buildStyleBlock)(n,!1,f.nonce)),s&&e.edges.some(e=>e.animate)&&p.push(et(f.nonce)),p.push(`<defs>`),p.push(tt());let h=new Set;for(let t of e.edges)t.inlineStyle?.stroke&&h.add(t.inlineStyle.stroke);for(let e of h)p.push(nt(e));p.push(`</defs>`);for(let t of e.groups)p.push(at(t,n,i));for(let t of e.edges)p.push(ot(t,a,s));for(let t of e.edges)t.label&&p.push(ct(t,n,i));for(let t of e.nodes)p.push(ft(t,n,i,l));return p.push(`</svg>`),p.join(`
2
- `)}function et(e){return[(0,c.styleOpenTag)(e),` @keyframes zm-edge-dash { to { stroke-dashoffset: -28; } }`,` .edge-animated { animation: zm-edge-dash 1s linear infinite; }`,` @media (prefers-reduced-motion: reduce) {`,` .edge-animated { animation: none; }`,` }`,`</style>`].join(`
3
- `)}function tt(){return rt(`var(--_arrow)`,``)}function nt(e){return rt((0,c.escapeAttr)(e),c.f`-${it(e)}`)}function rt(e,t){let n=I.width,r=I.height,i=n-1,a=c.f`fill="${e}" stroke="${e}" stroke-width="0.75" stroke-linejoin="round"`,o=c.f`<polygon points="0 0, ${n} ${r/2}, 0 ${r}" ${a} />`,s=(e,t)=>c.f` <marker id="${e}" markerWidth="${n}" markerHeight="${r}" refX="${i}" refY="${r/2}" orient="${t}">`+c.f`\n ${o}`+`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("@zombie-mermaid/core"),l=require("elkjs/lib/elk.bundled.js");l=s(l,1);let u=require("@zombie-mermaid/mermaid-parser"),d=require("entities");function f(e){return c.f`M ${e.x} ${e.y}`}function p(e){return f(e[0])+e.slice(1).map(e=>c.f` L ${e.x} ${e.y}`).join(``)}function m(e){if(e.length<3)return p(e);let t=e[e.length-1],n=[f(e[0])],r=(e,t,n)=>c.f` C ${(2*e.x+t.x)/3} ${(2*e.y+t.y)/3},`+c.f` ${(e.x+2*t.x)/3} ${(e.y+2*t.y)/3},`+c.f` ${(e.x+4*t.x+n.x)/6} ${(e.y+4*t.y+n.y)/6}`;n.push(c.f` L ${(5*e[0].x+e[1].x)/6}`+c.f` ${(5*e[0].y+e[1].y)/6}`);for(let t=2;t<e.length;t++)n.push(r(e[t-2],e[t-1],e[t]));return n.push(r(e[e.length-2],t,t)),n.push(c.f` L ${t.x} ${t.y}`),n.join(``)}function h(e){if(e.length<3)return p(e);let t=[f(e[0])];for(let n=1;n<e.length-1;n++){let r=e[n-1],i=e[n],a=e[n+1],o=Math.hypot(i.x-r.x,i.y-r.y),s=Math.hypot(a.x-i.x,a.y-i.y);if(o===0||s===0){t.push(c.f` L ${i.x} ${i.y}`);continue}let l=Math.min(12,o/2,s/2),u=i.x-(i.x-r.x)/o*l,d=i.y-(i.y-r.y)/o*l,f=i.x+(a.x-i.x)/s*l,p=i.y+(a.y-i.y)/s*l;t.push(c.f` L ${u} ${d}`),t.push(c.f` Q ${i.x} ${i.y}, ${f} ${p}`)}let n=e[e.length-1];return t.push(c.f` L ${n.x} ${n.y}`),t.join(``)}function g(e,t){let n=[f(e[0])],r=e.length-1;for(let i=0;i<r;i++){let a=e[i],o=e[i+1];if(i===r-1){n.push(c.f` L ${o.x} ${o.y}`);break}if(t===`before`)n.push(c.f` L ${a.x} ${o.y} L ${o.x} ${o.y}`);else if(t===`after`)n.push(c.f` L ${o.x} ${a.y} L ${o.x} ${o.y}`);else{let e=(a.y+o.y)/2;n.push(c.f` L ${a.x} ${e} L ${o.x} ${e} L ${o.x} ${o.y}`)}}return n.join(``)}function _(e,t=`linear`){if(e.length===0)return``;if(e.length===1)return f(e[0]);switch(t){case`basis`:return m(e);case`natural`:return h(e);case`step`:return g(e,`mid`);case`stepBefore`:return g(e,`before`);case`stepAfter`:return g(e,`after`);default:return p(e)}}var v=null,y=null,b=20;function x(e=b){if(!Number.isInteger(e)||e<1)throw Error(`createLayoutCache: maxSize must be a positive integer, got ${e}`);return{map:new Map,maxSize:e}}function S(e){if(Array.isArray(e))return`[${e.map(S).join(`,`)}]`;if(typeof e==`object`&&e){let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${S(t[e])}`).join(`,`)}}`}return JSON.stringify(e)}function C(){if(v&&y)return y;let e=[],t=globalThis.setTimeout;globalThis.setTimeout=(n,r)=>r===0?(e.push(n),0):t(n,r);let n=globalThis,r=`self`in n,i=n.self;if(r&&n.document===void 0&&delete n.self,v=new l.default,!v)throw Error(`ELKBundled construction unexpectedly produced no instance`);return r&&(n.self=i),globalThis.setTimeout=t,e.forEach(e=>e()),y=v.worker.worker,y}function w(e,t){let n=t,r=n?S(e):void 0;if(n&&r!==void 0){let e=n.map.get(r);if(e)return n.map.delete(r),n.map.set(r,e),e}let i=C(),a,o,s=i.onmessage;if(i.onmessage=e=>{e.data.error?o=e.data.error:a=e.data.data},i.dispatcher.saveDispatch({data:{id:0,cmd:`layout`,graph:e}}),i.onmessage=s,o)throw o;if(!a)throw Error(`ELK layout did not return synchronously`);if(n&&r!==void 0&&(n.map.set(r,a),n.map.size>n.maxSize)){let e=n.map.keys().next().value;e!==void 0&&n.map.delete(e)}return a}function T(e,t,n){return(0,c.measureTextWidth)(e,t,n)}function E(e,t){return e.length*t*.6}var D=`'JetBrains Mono'`,O=`${D}, 'SF Mono', 'Fira Code', ui-monospace, monospace`,k={nodeLabel:13,edgeLabel:11,groupHeader:12};function A(e){return{nodeLabel:e?.nodeLabel??k.nodeLabel,edgeLabel:e?.edgeLabel??k.edgeLabel,groupHeader:e?.groupHeader??k.groupHeader}}var j={nodeLabel:500,edgeLabel:400,groupHeader:600},ee=12,M={horizontal:20,vertical:10,diamondExtra:24},N={outerBox:1,innerBox:.75,connector:1},P=`0.35em`,F={width:8,height:5},I={font:`Inter`,padding:40,nodeSpacing:28,layerSpacing:48,mergeEdges:!0,thoroughness:3,fontSizes:k};function L(e,t){let n=new Map;e.edges.forEach((e,t)=>{if(e.source===e.target)return;let r=n.get(e.source);r?r.push(t):n.set(e.source,[t])});let r=new Set,i=new Set,a=new Set;for(let o of t??e.nodes.keys()){if(i.has(o))continue;let t=[{node:o,next:0}];for(i.add(o),a.add(o);t.length>0;){let o=t[t.length-1],s=n.get(o.node)??[];if(o.next>=s.length){a.delete(o.node),t.pop();continue}let c=s[o.next++],l=e.edges[c].target;a.has(l)?r.add(c):i.has(l)||(i.add(l),a.add(l),t.push({node:l,next:0}))}}return r}var te={flowchart:`DOWN`,state:`DOWN`,class:`DOWN`,er:`DOWN`,c4:`DOWN`};function ne(e,t){switch(e){case`LR`:return`RIGHT`;case`RL`:return`LEFT`;case`BT`:return`UP`;case`TD`:case`TB`:return`DOWN`;default:return t}}function re(e){let t=typeof e==`number`?{top:e,left:e,bottom:e,right:e}:e;return`[top=${t.top},left=${t.left},bottom=${t.bottom},right=${t.right}]`}function ie(e){return{"elk.algorithm":`layered`,"elk.direction":e.direction,"elk.spacing.nodeNode":String(e.nodeSpacing),"elk.layered.spacing.nodeNodeBetweenLayers":String(e.layerSpacing),"elk.padding":re(e.padding),"elk.edgeRouting":`ORTHOGONAL`}}function ae(e,t,n){let r={id:e,width:t.width,height:t.height};return n!==void 0&&(r.labels=[{text:n}]),r}var oe={"elk.edgeLabels.inline":`true`,"elk.edgeLabels.placement":`CENTER`};function se(e,t){let n=(0,c.measureMultilineText)(e,t.fontSize,j.edgeLabel),r={text:e,width:n.width+8,height:n.height+6};return t.layoutOptions&&(r.layoutOptions={...t.layoutOptions}),r}function R(e){let t={id:e.id,sources:[e.source],targets:[e.target]};return e.label&&(t.labels=[se(e.label,e.labelStyle)]),t}var ce={"state-start":`FIRST`},le={"elk.layered.cycleBreaking.strategy":`MODEL_ORDER`,"elk.layered.compaction.postCompaction.strategy":`NONE`};function ue(e){for(let t of e.nodes.values())if(t.shape===`state-start`||t.shape===`state-end`)return!0;return!1}var de={top:44,left:16,bottom:16,right:16},fe=new WeakMap;function pe(e,t){let n=fe.get(e);return n||(n=ue(e)||be(e.subgraphs)?new Set:L(e,t?.walkOrder),fe.set(e,n)),n}function me(e,t){for(let n=0;n<e.edges.length;n++){let r=e.edges[n];if(t.has(r.source)||t.has(r.target))return n}return 1/0}function he(e){return ne(e,te.flowchart)}function ge(e){return{...ie(e),"elk.spacing.edgeEdge":`12`,"elk.layered.spacing.edgeEdgeBetweenLayers":`12`,"elk.layered.spacing.edgeNodeBetweenLayers":`12`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`,"elk.contentAlignment":`H_CENTER V_CENTER`}}function _e(e){return{fontSize:e.fontSizes.edgeLabel,layoutOptions:oe}}function ve(e,t,n,r){let i=(0,c.measureMultilineText)(t,r,j.nodeLabel),a=i.width+M.horizontal*2,o=i.height+M.vertical*2;if(n===`diamond`){let e=Math.max(a,o)+M.diamondExtra;a=e,o=e}if(n===`circle`||n===`doublecircle`){let e=Math.ceil(Math.sqrt(a*a+o*o))+8;a=n===`doublecircle`?e+12:e,o=a}return n===`hexagon`&&(a+=M.horizontal),(n===`trapezoid`||n===`trapezoid-alt`||n===`parallelogram`||n===`parallelogram-alt`)&&(a+=M.horizontal),n===`asymmetric`&&(a+=12),n===`cylinder`&&(o+=14),n===`state-start`||n===`state-end`?{width:28,height:28}:(a=Math.max(a,60),o=Math.max(o,36),{width:a,height:o})}var ye=` root`;function be(e){for(let t of e)if(t.direction!==void 0||be(t.children))return!0;return!1}function xe(e,t){for(let n of e.nodeIds)t.add(n);for(let n of e.children)xe(n,t)}function Se(e,t){let n=new Set;if(xe(e,n),n.size===0)return!0;let r=t=>n.has(t)||t===e.id;return!t.edges.some(e=>r(e.source)!==r(e.target))}function Ce(e){let t=new Map;function n(e,r){let i=[...r,e.id];t.set(e.id,i);for(let t of e.children)n(t,i)}for(let t of e)n(t,[]);return t}function we(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return n}function Te(e,t,n){let r=t,i=new Set,a=new Set;for(let t of e.subgraphs)a.add(t.id),De(t,i,a);let o=Oe(e.subgraphs),s=Ce(e.subgraphs),c=e=>e?s.get(e)??[]:[],l=new Map;l.set(null,[]);let u=[];for(let t=0;t<e.edges.length;t++){let n=e.edges[t],r=o.get(n.source),i=o.get(n.target);if(r&&r===i){let e=l.get(r)??[];l.set(r,e),e.push({index:t,edge:n})}else!r&&!i?l.get(null).push({index:t,edge:n}):u.push({index:t,edge:n,srcChain:c(r),tgtChain:c(i)})}let d=be(e.subgraphs),f=[],p=[],m={...ge({direction:he(e.direction),nodeSpacing:r.nodeSpacing,layerSpacing:r.layerSpacing,padding:r.padding}),"elk.layered.thoroughness":String(I.thoroughness),"elk.layered.highDegreeNodes.treatment":`true`,"elk.layered.highDegreeNodes.threshold":`8`,"elk.layered.compaction.postCompaction.strategy":`LEFT_RIGHT_CONSTRAINT_LOCKING`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,...n?.forceNodeOrder?{"elk.layered.crossingMinimization.forceNodeModelOrder":`true`}:{},...ue(e)?le:{},"elk.layered.wrapping.strategy":`OFF`,"elk.hierarchyHandling":d?`SEPARATE`:`INCLUDE_CHILDREN`},h=new Map,g=new Map;function _(e,t){let n=h.get(e)??new Set;h.set(e,n),n.add(t)}function v(e,t){let n=g.get(e)??[];g.set(e,n),n.push(t)}if(d)for(let{index:e,edge:t,srcChain:n,tgtChain:i}of u){let a=we(n,i),o=t.source;if(n.length>a){for(let r=n.length-1;r>=a;r--){let i=n[r],a=`${i}_out_${e}`;_(i,a);let o=r===n.length-1?t.source:`${n[r+1]}_out_${e}`;v(i,{id:`e${e}_s${r}`,sources:[o],targets:[a]})}o=`${n[a]}_out_${e}`}let s=t.target;if(i.length>a){for(let n=a;n<=i.length-1;n++){let r=i[n],a=`${r}_in_${e}`;_(r,a);let o=n===i.length-1?t.target:`${i[n+1]}_in_${e}`;v(r,{id:`e${e}_t${n}`,sources:[a],targets:[o]})}s=`${i[a]}_in_${e}`}v(a>0?n[a-1]:ye,R({id:`e${e}`,source:o,target:s,label:t.label,labelStyle:_e(r)}))}for(let[t,o]of e.nodes)if(!i.has(t)&&!a.has(t)){let i=ve(t,o.label,o.shape,r.fontSizes.nodeLabel),a=n?.fixedWidths?.get(t);a!==void 0&&(i.width=a);let s=ae(t,i,o.label),c=ue(e)?ce[o.shape]:void 0;c!==void 0&&(s.layoutOptions={"elk.layered.layering.layerConstraint":c}),f.push(s)}let y=ue(e),b=f.length,x=y?e.subgraphs:[...e.subgraphs].reverse();for(let t of x)f.push(Ee(t,e,r,l,h,g,e.direction));if(y&&e.subgraphs.length>0){let t=f.map((t,n)=>{if(n<b)return me(e,new Set([t.id]));let r=e.subgraphs[n-b],i=me(e,new Set([r.id]));if(i!==1/0)return i;let a=new Set;return xe(r,a),me(e,a)}),n=f.map((e,t)=>t).sort((e,n)=>t[e]-t[n]||e-n).map(e=>f[e]);f.splice(0,f.length,...n)}let S=pe(e,n);for(let{index:e,edge:t}of l.get(null)){if(t.source===t.target||n?.detachedEdges?.has(e))continue;let i=R({id:`e${e}`,source:S.has(e)?t.target:t.source,target:S.has(e)?t.source:t.target,label:t.label,labelStyle:_e(r)});n?.looseEdges?.has(e)&&(i.layoutOptions={...i.layoutOptions,"elk.layered.priority.straightness":`0`}),p.push(i)}if(d)for(let e of g.get(ye)??[])p.push(e);else for(let{index:e,edge:t}of u)p.push(R({id:`e${e}`,source:S.has(e)?t.target:t.source,target:S.has(e)?t.source:t.target,label:t.label,labelStyle:_e(r)}));return{id:`root`,layoutOptions:m,children:f,edges:p}}function Ee(e,t,n,r,i,a,o){let s=e.direction!==void 0&&Se(e,t)?e.direction:o,c=ge({direction:he(s),nodeSpacing:n.nodeSpacing,layerSpacing:n.layerSpacing,padding:de}),l,u=i.get(e.id);u&&u.size>0&&(l=[...u].map(e=>({id:e})));let d=[];for(let r of e.nodeIds){let e=t.nodes.get(r);if(e){let t=ve(r,e.label,e.shape,n.fontSizes.nodeLabel);d.push(ae(r,t,e.label))}}for(let o of[...e.children].reverse())d.push(Ee(o,t,n,r,i,a,s));let f=[],p=r.get(e.id)??[],m=pe(t);for(let{index:e,edge:t}of p)t.source!==t.target&&f.push(R({id:`e${e}`,source:m.has(e)?t.target:t.source,target:m.has(e)?t.source:t.target,label:t.label,labelStyle:_e(n)}));for(let t of a.get(e.id)??[])f.push(t);return{id:e.id,layoutOptions:c,labels:e.label?[{text:e.label}]:void 0,ports:l,children:d,edges:f}}function De(e,t,n){for(let n of e.nodeIds)t.add(n);for(let r of e.children)n.add(r.id),De(r,t,n)}function Oe(e){let t=new Map;function n(e){for(let n of e.nodeIds)t.set(n,e.id);for(let t of e.children)n(t)}for(let t of e)n(t);return t}function ke(e,t,n){if(e.length<2||t.shape===`rectangle`||t.shape===`rounded`||t.shape===`stadium`)return e;let r=[...e];if(t.shape===`diamond`){if(n)r[0]=Ae(e[0],e[1],t);else{let n=e.length-1;r[n]=Ae(e[n],e[n-1],t)}}return r}function Ae(e,t,n){let r=n.x+n.width/2,i=n.y+n.height/2,a={x:r,y:n.y},o={x:n.x+n.width,y:i},s={x:r,y:n.y+n.height},c={x:n.x,y:i},l=e.x-t.x,u=e.y-t.y;if(Math.abs(l)<Math.abs(u)){let t=e.x;return u>0?t<=r?Me(t,c,a)??a:Me(t,a,o)??a:t<=r?Me(t,s,c)??s:Me(t,o,s)??s}{let t=e.y;return l>0?t<=i?je(t,a,c)??c:je(t,c,s)??c:t<=i?je(t,a,o)??o:je(t,o,s)??o}}function je(e,t,n){let r=n.y-t.y;if(Math.abs(r)<.001)return null;let i=(e-t.y)/r;return i<0||i>1?null:{x:t.x+i*(n.x-t.x),y:e}}function Me(e,t,n){let r=n.x-t.x;if(Math.abs(r)<.001)return null;let i=(e-t.x)/r;return i<0||i>1?null:{x:e,y:t.y+i*(n.y-t.y)}}function Ne(e,t,n){if(e.length===0)return;let r=n===`LR`||n===`RL`,i=new Set;for(let e of t)i.add(`${e.source}:${e.target}`),i.add(`${e.target}:${e.source}`);let a=I.layerSpacing*.6,o=[...e].sort((e,t)=>r?e.x-t.x:e.y-t.y),s=[],c=[o[0]];for(let e=1;e<o.length;e++){let t=(r?o[e].x:o[e].y)-(r?o[e-1].x:o[e-1].y),n=c.some(t=>i.has(`${t.id}:${o[e].id}`));t<=a&&!n?c.push(o[e]):(s.push(c),c=[o[e]])}s.push(c);let l=new Map;for(let e of s){if(e.length<=1)continue;let t=e.map(e=>r?e.x:e.y),n=Math.min(...t),i=Math.max(...t);if(i-n<=1)continue;let a=(n+i)/2;for(let t of e){let e=a-(r?t.x:t.y);Math.abs(e)>.5&&(r?t.x=a:t.y=a,l.set(t.id,e))}}if(l.size!==0)for(let e of t){if(e.points.length<2)continue;let t=l.get(e.source),n=l.get(e.target);if(t!=null){let n=e.points[0];r?(n.x+=t,e.points.length>1&&e.points[1].x===n.x-t&&(e.points[1].x+=t)):(n.y+=t,e.points.length>1&&e.points[1].y===n.y-t&&(e.points[1].y+=t))}if(n!=null){let t=e.points[e.points.length-1];if(r){if(t.x+=n,e.points.length>1){let r=e.points[e.points.length-2];r.x===t.x-n&&(r.x+=n)}}else if(t.y+=n,e.points.length>1){let r=e.points[e.points.length-2];r.y===t.y-n&&(r.y+=n)}}}}var Pe=.5;function Fe(e,t,n){for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1],o=Math.min(i.x,a.x),s=Math.max(i.x,a.x),c=Math.min(i.y,a.y),l=Math.max(i.y,a.y);for(let e of t){if(n.has(e.id))continue;let t=e.x+Pe,r=e.x+e.width-Pe,i=e.y+Pe,a=e.y+e.height-Pe;if(!(t>=r||i>=a)&&o<r&&s>t&&c<a&&l>i)return!1}}return!0}function Ie(e,t,n){let r=[];for(let i of n)e>=i.x&&e<=i.x+i.width&&t>=i.y&&t<=i.y+i.height&&(r.push(i),r.push(...Ie(e,t,i.children)));return r}function Le(e,t,n,r,i){let a=i===`LR`,o=i===`RL`,s=i===`BT`,c=a||o,l=new Set(Ie(t,n,r).map(e=>e.id)),u=Ie(c?e:t,c?n:e,r).find(e=>!l.has(e.id));return u?a?u.x-12:o?u.x+u.width+12:s?u.y+u.height+12:u.y-12:e}function Re(e,t,n,r){let i=new Map(t.map(e=>[e.id,e])),a=new Set,o=r===`LR`,s=r===`RL`,c=r===`BT`,l=o||s,u=new Map;for(let t of e){if(t.source===t.target)continue;let e=u.get(t.source)??[];u.set(t.source,e),e.push(t)}for(let[e,d]of u){if(d.length<2)continue;let u=d[0].style;if(d.some(e=>e.label||e.style!==u))continue;let f=i.get(e);if(!f)continue;let p=[];for(let e of d){let t=i.get(e.target);t&&(o?t.x>f.x+f.width:s?t.x+t.width<f.x:c?t.y+t.height<f.y:t.y>f.y+f.height)&&p.push({edge:e,node:t})}if(p.length<2)continue;let m=f.x+f.width/2,h=f.y+f.height/2;if(l){let i=o?f.x+f.width:f.x,s=h,c=i+((o?Math.min(...p.map(e=>e.node.x)):Math.max(...p.map(e=>e.node.x+e.node.width)))-i)/2;c=Le(c,m,h,n,r);let l=[];for(let{edge:n,node:r}of p){let a=o?r.x:r.x+r.width,u=r.y+r.height/2,d=[{x:i,y:s},{x:c,y:s},{x:c,y:u},{x:a,y:u}];Fe(d,t,new Set([e,r.id]))&&l.push({edge:n,points:d})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t,a.add(e)}else{let i=m,o=c?f.y:f.y+f.height,s=o+((c?Math.max(...p.map(e=>e.node.y+e.node.height)):Math.min(...p.map(e=>e.node.y)))-o)/2;s=Le(s,m,h,n,r);let l=[];for(let{edge:n,node:r}of p){let a=r.x+r.width/2,u=c?r.y+r.height:r.y,d=[{x:i,y:o},{x:i,y:s},{x:a,y:s},{x:a,y:u}];Fe(d,t,new Set([e,r.id]))&&l.push({edge:n,points:d})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t,a.add(e)}}let d=new Map;for(let t of e){if(a.has(t)||t.source===t.target)continue;let e=d.get(t.target)??[];d.set(t.target,e),e.push(t)}for(let[e,a]of d){if(a.length<2)continue;let u=a[0].style;if(a.some(e=>e.label||e.style!==u))continue;let d=i.get(e);if(!d)continue;let f=[];for(let e of a){let t=i.get(e.source);t&&(o?t.x+t.width<d.x:s?t.x>d.x+d.width:c?t.y>d.y+d.height:t.y+t.height<d.y)&&f.push({edge:e,node:t})}if(f.length<2)continue;let p=d.x+d.width/2,m=d.y+d.height/2;if(l){let i=o?d.x:d.x+d.width,a=m,s=o?Math.max(...f.map(e=>e.node.x+e.node.width)):Math.min(...f.map(e=>e.node.x)),c=s+(i-s)/2;c=Le(c,p,m,n,r);let l=[];for(let{edge:n,node:r}of f){let s=o?r.x+r.width:r.x,u=r.y+r.height/2,d=[{x:s,y:u},{x:c,y:u},{x:c,y:a},{x:i,y:a}];Fe(d,t,new Set([r.id,e]))&&l.push({edge:n,points:d})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t}else{let i=p,a=c?d.y+d.height:d.y,o=c?Math.min(...f.map(e=>e.node.y)):Math.max(...f.map(e=>e.node.y+e.node.height)),s=o+(a-o)/2;s=Le(s,p,m,n,r);let l=[];for(let{edge:n,node:r}of f){let o=r.x+r.width/2,u=[{x:o,y:c?r.y:r.y+r.height},{x:o,y:s},{x:i,y:s},{x:i,y:a}];Fe(u,t,new Set([r.id,e]))&&l.push({edge:n,points:u})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t}}}function ze(e,t=0,n=0){let r=[];if(!e.sections||e.sections.length===0)return r;let i=e.sections[0];if(r.push({x:i.startPoint.x+t,y:i.startPoint.y+n}),i.bendPoints)for(let e of i.bendPoints)r.push({x:e.x+t,y:e.y+n});return r.push({x:i.endPoint.x+t,y:i.endPoint.y+n}),r}function Be(e,t=0,n=0){if(!e.labels||e.labels.length===0)return;let r=e.labels[0];if(r.x!=null&&r.y!=null)return{x:r.x+(r.width??0)/2+t,y:r.y+(r.height??0)/2+n}}var Ve=16,He=28,Ue=18,We=28,Ge=10;function Ke(e,t){let n=e.x+e.width,r=e.y+e.height/2,i=Math.min(We,e.height*.6)/2,a=He+t*Ue,o=[];for(let e=0;e<=Ve;e++){let t=Math.PI*e/Ve;o.push({x:n+a*Math.sin(t),y:r-i*Math.cos(t)})}return{points:o,labelPosition:{x:n+a+Ge,y:r}}}function qe(e,t,n){let r=new Map;for(let i=0;i<e.edges.length;i++){let a=e.edges[i];if(a.source!==a.target)continue;let o=t.get(a.source);if(!o)continue;let s=r.get(o.id)??0;r.set(o.id,s+1);let{points:c,labelPosition:l}=Ke(o,s);n.push({source:a.source,target:a.target,label:a.label,style:a.style,hasArrowStart:a.hasArrowStart,hasArrowEnd:a.hasArrowEnd,points:c,labelPosition:a.label?l:void 0,inlineStyle:at(i,e),id:a.id,animate:a.animate})}}function Je(e){let t=[];for(let n of e)t.push({x:n.x,y:n.y,right:n.x+n.width,bottom:n.y+n.height}),t.push(...Je(n.children));return t}function Ye(e,t,n=!1){let r=[],i=[],a=[],o=new Set;for(let e of t.subgraphs)it(e,o);Xe(e,t,o,r,a,0,0);let s=Je(a);$e(e,t,i,0,0,s.length>0?{leftX:Math.min(...s.map(e=>e.x))-20,rightX:Math.max(...s.map(e=>e.right))+20}:void 0),Ne(r,i,t.direction);let c=new Map(r.map(e=>[e.id,e]));qe(t,c,i),n&&Re(i,r,a,t.direction);for(let e of i){let t=c.get(e.source),n=c.get(e.target);t&&(e.points=ke(e.points,t,!0)),n&&(e.points=ke(e.points,n,!1))}let l=e.width??800,u=e.height??600,d=F.width,f=I.padding;for(let e of i){for(let t of e.points)l=Math.max(l,t.x+d+f),u=Math.max(u,t.y+d+f);e.labelPosition&&(l=Math.max(l,e.labelPosition.x+60+f),u=Math.max(u,e.labelPosition.y+20+f))}return{width:l,height:u,nodes:r,edges:i,groups:a}}function Xe(e,t,n,r,i,a,o){if(e.children)for(let s of e.children){let e=(s.x??0)+a,l=(s.y??0)+o,u=s.width??0,d=s.height??0;if(n.has(s.id)){let a=[];Xe(s,t,n,r,a,e,l);let o=rt(t.subgraphs,s.id);i.push({id:s.id,label:o?.label??``,x:e,y:l,width:u,height:d,children:a})}else{let a=t.nodes.get(s.id);if(a){let n=(0,c.resolveNodeStyle)(s.id,t),i=t.classAssignments.get(s.id);r.push({id:s.id,label:a.label,shape:a.shape,x:e,y:l,width:u,height:d,inlineStyle:n,className:i,interaction:t.interactions.get(s.id)})}s.children&&s.children.length>0&&Xe(s,t,n,r,i,e,l)}}}function Ze(e){let t=/^e(\d+)$/.exec(e);if(t)return{edgeIndex:parseInt(t[1],10),role:`bridge`};let n=/^e(\d+)_([st])(\d+)$/.exec(e);if(n)return{edgeIndex:parseInt(n[1],10),role:n[2]===`s`?`source`:`target`,level:parseInt(n[3],10)}}function Qe(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++){let r=e[n].x-e[n-1].x,i=e[n].y-e[n-1].y;t+=Math.sqrt(r*r+i*i)}let n=t/2;for(let t=1;t<e.length;t++){let r=e[t].x-e[t-1].x,i=e[t].y-e[t-1].y,a=Math.sqrt(r*r+i*i);if(n<=a){let o=n/a;return{x:e[t-1].x+o*r,y:e[t-1].y+o*i}}n-=a}return e[e.length-1]}function $e(e,t,n,r,i,a){let o=new Map;et(e,o,0,0);let s=new Map;nt(e,s,0,0,o);let c=0;for(let[e,r]of s){let i=t.edges[e];if(!i)continue;let o=[],s=e=>{!e||e.points.length===0||(o.length>0?o.push(...e.points.slice(1)):o.push(...e.points))},l=[...r.sourceHops.keys()].sort((e,t)=>t-e);for(let e of l)s(r.sourceHops.get(e));s(r.bridge);let u=[...r.targetHops.keys()].sort((e,t)=>e-t);for(let e of u)s(r.targetHops.get(e));let d;i.label&&o.length>=2&&(d=r.bridge?.labelPosition??Qe(o));let f=tt(o,a,c);f!==o&&c++,i.label&&f!==o&&f.length>=2&&(d=Qe(f)),n.push({source:i.source,target:i.target,label:i.label,style:i.style,hasArrowStart:i.hasArrowStart,hasArrowEnd:i.hasArrowEnd,points:pe(t).has(e)?[...f].reverse():f,labelPosition:d,inlineStyle:at(e,t),id:i.id,animate:i.animate})}}function et(e,t,n,r){t.set(e.id,{x:n,y:r});for(let i of e.children??[]){let e=i.x??0,a=i.y??0;et(i,t,n+e,r+a)}}function tt(e,t,n=0){if(e.length<2)return e;let r=!1;for(let t=1;t<e.length;t++){let n=Math.abs(e[t].x-e[t-1].x),i=Math.abs(e[t].y-e[t-1].y);if(n>1&&i>1){r=!0;break}}if(!r)return e;let i=[e[0]];for(let r=1;r<e.length;r++){let a=i[i.length-1],o=e[r],s=Math.abs(o.x-a.x),c=Math.abs(o.y-a.y);if(s>1&&c>1){if(t){let e=n%2==0,r=Math.floor(n/2)*12,s=e?t.rightX+r:t.leftX-r;i.push({x:s,y:a.y}),i.push({x:s,y:o.y})}else{let e=(a.y+o.y)/2;i.push({x:a.x,y:e}),i.push({x:o.x,y:e})}}i.push(o)}return i}function nt(e,t,n,r,i){if(e.edges)for(let a of e.edges){let e=Ze(a.id);if(!e)continue;let{edgeIndex:o}=e,s=a.container,c=s?i.get(s):void 0,l=c?.x??n,u=c?.y??r,d=ze(a,l,u),f=Be(a,l,u),p=t.get(o)??{sourceHops:new Map,targetHops:new Map};t.set(o,p);let m={edgeIndex:o,points:d,labelPosition:f};e.role===`bridge`?p.bridge=m:e.role===`source`?p.sourceHops.set(e.level,m):p.targetHops.set(e.level,m)}if(e.children)for(let a of e.children)nt(a,t,n+(a.x??0),r+(a.y??0),i)}function rt(e,t){for(let n of e){if(n.id===t)return n;let e=rt(n.children,t);if(e)return e}}function it(e,t){t.add(e.id);for(let n of e.children)it(n,t)}function at(e,t){let n,r=t.linkStyles.get(`default`);r&&(n={...r});let i=t.linkStyles.get(e);return i&&(n=n?{...n,...i}:{...i}),n}var ot=10,st=14,ct=14,lt=10,ut=24,dt=400,ft=new Set([`rectangle`,`rounded`,`subroutine`]);function pt(e){let t=e===`TD`||e===`TB`||e===`BT`,n=e===`BT`||e===`RL`?-1:1;return{span:e=>{let[r,i]=t?[e.y,e.y+e.height]:[e.x,e.x+e.width],a=n*r,o=n*i;return{a0:Math.min(a,o),a1:Math.max(a,o),c0:t?e.x:e.y,c1:t?e.x+e.width:e.y+e.height}},toPoint:({a:e,c:r})=>t?{x:r,y:n*e}:{x:n*e,y:r}}}function mt(e,t,n){let r=Math.min(e.a,t.a),i=Math.max(e.a,t.a),a=Math.min(e.c,t.c),o=Math.max(e.c,t.c);return i>n.a0&&r<n.a1&&o>n.c0&&a<n.c1}var ht=(e,t)=>({a0:e.a0-t,a1:e.a1+t,c0:e.c0-t,c1:e.c1+t});function gt(e,t){let n=e.span({x:t.x,y:t.y,width:0,height:0});return{a:n.a0,c:n.c0}}function _t(e,t,n){let r=e.c===t.c;for(let i=1;i<n.length;i++){let a=n[i-1],o=n[i];if(a.c===o.c===r){if(r){let n=Math.abs(e.c-a.c),r=Math.min(Math.max(e.a,t.a),Math.max(a.a,o.a))-Math.max(Math.min(e.a,t.a),Math.min(a.a,o.a));if(n<st&&r>0)return!0}else{let n=Math.abs(e.a-a.a),r=Math.min(Math.max(e.c,t.c),Math.max(a.c,o.c))-Math.max(Math.min(e.c,t.c),Math.min(a.c,o.c));if(n<st&&r>0)return!0}}}return!1}function vt(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.a===n.a&&e.c===n.c||t.push(n)}for(let e=t.length-2;e>0;e--){let n=t[e-1],r=t[e],i=t[e+1];(n.a===r.a&&r.a===i.a||n.c===r.c&&r.c===i.c)&&t.splice(e,1)}return t}var yt=e=>{let t=0;for(let n=1;n<e.length;n++)t+=Math.abs(e[n].a-e[n-1].a)+Math.abs(e[n].c-e[n-1].c);return t};function bt(e,t,n,r,i,a=[]){let o=pt(i),s=o.span(e),c=o.span(t),l=s.a1<=c.a0,u=c.a1<=s.a0;if(!l&&!u)return;let d=o.span(r),f={a0:d.a0+lt,a1:d.a1-lt,c0:d.c0+lt,c1:d.c1-lt},p=a.map(e=>e.map(e=>gt(o,e))),m=n.map(e=>ht(o.span(e),ot)),h=e=>(e.c0+e.c1)/2,g=e=>(e.a0+e.a1)/2,_=e=>ft.has(e.shape),v=e=>{for(let t of e)if(t.a<f.a0||t.a>f.a1||t.c<f.c0||t.c>f.c1)return!1;for(let t=1;t<e.length;t++){let n=e[t-1],r=e[t];if(n.a!==r.a&&n.c!==r.c||m.some(e=>mt(n,r,e))||mt(n,r,s)||mt(n,r,c)||p.some(e=>_t(n,r,e)))return!1}return!0},y=new Set([h(s),h(c),f.c0,f.c1]);for(let e of m)y.add(e.c0-1),y.add(e.c1+1);for(let e of[s,c])y.add(e.c0-ot),y.add(e.c1+ot);let b=(e,t,n)=>_(e)?n>=t.c0+4&&n<=t.c1-4:Math.abs(n-h(t))<.5,x=[];if(l){let n=(c.a0-s.a1)/2,r=s.a1+Math.min(ct,n),i=c.a0-Math.min(ct,n);for(let n of y){b(e,s,n)&&b(t,c,n)&&x.push([{a:s.a1,c:n},{a:c.a0,c:n}]),x.push([{a:s.a1,c:h(s)},{a:r,c:h(s)},{a:r,c:n},{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}]),b(t,c,n)&&x.push([{a:s.a1,c:h(s)},{a:r,c:h(s)},{a:r,c:n},{a:c.a0,c:n}]),b(e,s,n)&&x.push([{a:s.a1,c:n},{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}]);let a=n>=s.c1?s.c1:n<=s.c0?s.c0:void 0;if(a!==void 0){let e=b(t,c,n)?[{a:c.a0,c:n}]:[{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}];x.push([{a:g(s),c:a},{a:g(s),c:n},...e])}}}else for(let t of y){let n=t>=c.c1?c.c1:t<=c.c0?c.c0:void 0;if(n===void 0)continue;b(e,s,t)&&x.push([{a:s.a0,c:t},{a:g(c),c:t},{a:g(c),c:n}]);let r=n===c.c1?s.c1:s.c0;x.push([{a:g(s),c:r},{a:g(s),c:t},{a:g(c),c:t},{a:g(c),c:n}])}let S,C=1/0;for(let t of x){let n=vt(t);if(n.length<2||!v(n))continue;let r=e.shape===`diamond`&&n[0].a===s.a1?dt:0,i=yt(n)+ut*(n.length-2)+r;i<C&&(S=n,C=i)}return S?.map(o.toPoint)}function xt(e){let t={x:e[0].x,y:e[0].y},n=-1;for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r],o=Math.abs(a.x-i.x)+Math.abs(a.y-i.y);o>n&&(n=o,t={x:(i.x+a.x)/2,y:(i.y+a.y)/2})}return t}var St=`__zm_spine__`,Ct=8,wt=6,Tt=12,Et=4,Dt=4,Ot=.25,kt=.02,At=40,jt=e=>e===`TD`||e===`TB`||e===`BT`,z=e=>e.startsWith(St);function Mt(e){return e.flatMap(e=>[e,...Mt(e.children)])}function B(e){let t=new Set(e.nodeIds);for(let n of e.children)for(let e of B(n))t.add(e);return t}function Nt(e){if(e.subgraphs.length===0||ue(e)||be(e.subgraphs))return!1;for(let t of e.nodes.keys())if(z(t))return!1;for(let t of e.edges)if(!e.nodes.has(t.source)||!e.nodes.has(t.target))return!1;let t=Mt(e.subgraphs);return!t.some(t=>e.nodes.has(t.id))&&t.every(t=>[...B(t)].some(t=>e.nodes.has(t)))}function Pt(e,t){let n=jt(t),r=e=>n?[e.y,e.y+e.height]:[e.x,e.x+e.width],i=[...e].sort((e,t)=>{let[n,i]=r(e),[a,o]=r(t);return(n+i)/2-(a+o)/2}),a=[];for(let e of i){let[t,n]=r(e),i=a[a.length-1];i&&t<i.end?(i.end=Math.min(i.end,n),i.ids.push(e.id)):a.push({end:n,ids:[e.id]})}(t===`BT`||t===`RL`)&&a.reverse();let o=new Map;return a.forEach((e,t)=>e.ids.forEach(e=>o.set(e,t))),o}function Ft(e,t,n){let r={ghosts:[],edges:[]};for(let i of e){let e=[...B(i)].filter(e=>t.has(e));if(e.length===0)continue;let a=e.map(e=>t.get(e)),o=Math.min(...a),s=Math.max(...a),c=new Map;for(let a=o;a<=s;a++){let o=e.filter(e=>t.get(e)===a).sort((e,t)=>n(e)-n(t));if(o.length>0)c.set(a,o[0]);else{let e=`${St}${i.id}__${a}`;r.ghosts.push({id:e,subgraph:i.id}),c.set(a,e)}}for(let e=o;e<s;e++){let t=c.get(e),n=c.get(e+1);!z(t)&&!z(n)||r.edges.push({source:t,target:n,style:`invisible`,hasArrowStart:!1,hasArrowEnd:!1})}}return r}function It(e,t,n,r=()=>!1){let i=e=>{let n=[...B(e)].filter(e=>t.has(e)).map(e=>t.get(e));return n.length>0?[Math.min(...n),Math.max(...n)]:void 0},a=e=>{let t=[...B(e)].filter(e=>n.has(e)).map(e=>n.get(e));return t.reduce((e,t)=>e+t,0)/t.length},o=e.map(e=>({sg:e,at:i(e)})).filter(e=>!!e.at).sort((e,t)=>e.at[0]-t.at[0]),s=[],c=-1/0;for(let{sg:e,at:t}of o){let n=s[s.length-1];n&&t[0]<=c?(n.push(e),c=Math.max(c,t[1])):(s.push([e]),c=t[1])}for(let t of s){if(t.length<2||t.some((e,n)=>t.slice(n+1).some(t=>r(e,t))))continue;let i=[...t].sort((t,n)=>e.indexOf(n)-e.indexOf(t)),o=t.map(a).sort((e,t)=>e-t),s=i.map((e,t)=>o[t]-a(e));i.forEach((e,t)=>{for(let r of B(e))n.has(r)&&n.set(r,n.get(r)+s[t])})}for(let i of e)It(i.children,t,n,r)}function Lt(e,t,n,r,i){let a=new Map(t);for(let t of r){let r=B(t);for(let e of i.get(t.id)??[])r.add(e);let o=[...r].filter(e=>a.has(e)),s=o.filter(e=>n.has(e));if(s.length===0)continue;let c=Math.min(...s.map(e=>n.get(e))),l=Math.max(...s.map(e=>n.get(e))),u=o.map(e=>a.get(e)),d=Math.min(...u),f=Math.max(...u),p=(d+f)/2,m=0;for(let t of e){if(r.has(t)||z(t))continue;let e=n.get(t);if(e===void 0||e<c||e>l)continue;m++;let i=a.get(t);a.set(t,i<=p?Math.min(i,d)-1-m*.001:Math.max(i,f)+1+m*.001)}}let o=new Map(e.map((e,t)=>[e,t]));return[...e].sort((e,t)=>a.get(e)-a.get(t)||o.get(e)-o.get(t))}var Rt=(e,t)=>t>=Math.min(...e)&&t<=Math.max(...e);function zt(e,t,n){let r=e=>{let i=e.children.map(r),a=[...[...B(e)].flatMap(e=>{let n=t.get(e);return n?[n]:[]}),...i],o=Math.min(...a.map(e=>e.x))-de.left,s=Math.min(...a.map(e=>e.y))-de.top,l=Math.max(...a.map(e=>e.x+e.width))+de.right,u=Math.max(...a.map(e=>e.y+e.height))+de.bottom,d=(0,c.measureMultilineText)(e.label,n.groupHeader,j.groupHeader).width+24;return{id:e.id,label:e.label,x:o,y:s,width:Math.max(l-o,d),height:u-s,children:i}};return e.map(r)}var Bt=e=>e.flatMap(e=>[e,...Bt(e.children)]);function Vt(e,t,n,r,i,a){let o=jt(r),s=new Map(Mt(t).map(e=>[e.id,B(e)])),c=new Map,l=!1,u=[],d=e=>o?[e.x,e.x+e.width]:[e.y,e.y+e.height],f=e=>o?[e.y,e.y+e.height]:[e.x,e.x+e.width],p=([e,t],[n,r])=>Math.max(0,Math.min(t,r)-Math.max(e,n)),m=e=>({x:e.x-At,y:e.y-At,width:e.width+80,height:e.height+80}),h=(e,t)=>p(f(e),f(t))>0?p(d(e),d(t)):0,g=Bt(e),_=new Map(g.map(e=>[e,m(e)])),v=(e,t,n,r)=>{let i=p(d(e),d(t)),a=p(f(e),f(t));if(i<=0||a<=0)return;let s=i<=a,c=s===o,l=e=>c?e.x:e.y,m=e=>c?e.x+e.width:e.y+e.height,h=e=>(l(e)+m(e))/2,g=h(n)<=h(r)?n:r;u.push({axis:c?`x`:`y`,amount:s?i:a,after:m(g)})};for(let e of g){let t=s.get(e.id),r=[...t].filter(e=>a.has(e)).map(e=>a.get(e)),o=new Set(r);for(let[s,u]of n){if(t.has(s))continue;if(o.has(a.get(s))||!Rt(r,a.get(s))){v(_.get(e),u,e,u);continue}let n=h(_.get(e),u);n<=0||(i.has(e.id)?c.set(e.id,Math.max(c.get(e.id)??0,n)):l=!0)}}let y=(e,t)=>Bt(e.children).includes(t);for(let e=0;e<g.length;e++)for(let t=e+1;t<g.length;t++){let n=g[e],r=g[t];y(n,r)||y(r,n)||v(_.get(n),r,n,r)}return{penetration:c,stuck:l,requests:u}}function Ht(e,t,n){let r=[...e.nodes.keys()],i={...e,subgraphs:[]},a=t(i),o=Pt(a.nodes,e.direction),s=jt(e.direction),c=new Map(a.nodes.map(e=>[e.id,e])),l=e=>{let t=c.get(e);return s?t.x:t.y},u=Mt(e.subgraphs),d=Ft(u,o,l),f=new Map;for(let e of d.ghosts)f.set(e.subgraph,[...f.get(e.subgraph)??[],e.id]);let p=new Map(a.nodes.map(e=>[e.id,l(e.id)]));It(e.subgraphs,o,p,(t,n)=>{let r=B(t),i=B(n),a=(t,n)=>e.edges.some(e=>t.has(e.source)&&n.has(e.target));return a(r,i)&&a(i,r)});for(let e of d.ghosts){let t=[...B(u.find(t=>t.id===e.subgraph))].filter(e=>p.has(e)).map(e=>p.get(e));p.set(e.id,t.reduce((e,t)=>e+t,0)/t.length)}let m=new Map(e.nodes);for(let e of d.ghosts)m.set(e.id,{id:e.id,label:` `,shape:`rectangle`});let h=Lt([...m.keys()],p,o,u,f),g={...i,nodes:new Map(h.map(e=>[e,m.get(e)])),edges:[...e.edges,...d.edges]},_=new Set(d.edges.map((t,n)=>e.edges.length+n)),v=i=>{let a=new Map,s=new Map;for(let c=0;;c++){let l=new Map(d.ghosts.map(e=>[e.id,Ct+(a.get(e.subgraph)??0)])),p=t(g,{fixedWidths:l,looseEdges:_,detachedEdges:i,walkOrder:r,forceNodeOrder:!0}),m=new Map(p.nodes.filter(e=>!z(e.id)).map(e=>[e.id,e])),h=zt(e.subgraphs,m,n),v=Vt(h,e.subgraphs,m,e.direction,new Set(f.keys()),o),{penetration:y,stuck:b}=v;if(b)return;if(y.size===0){for(let t=0;v.requests.length>0;t++){if(t===Tt)return;Gt(v.requests.reduce((e,t)=>t.amount>e.amount?t:e),[...m.values()],p.edges),h=zt(e.subgraphs,m,n),v=Vt(h,e.subgraphs,m,e.direction,new Set(f.keys()),o)}let t=Wt(e,i,m,h,u);return t&&Kt(p,[...m.values()],h,t)}if(c===wt)return;for(let[e,t]of y){let n=a.get(e)??0,r=s.get(e),i=r?(r.overlap-t)/(n-r.width):0,o=i>kt?i:Ot;s.set(e,{width:n,overlap:t}),a.set(e,n+t/o+Dt)}}},y=Ut(e,d,o,u);return(y.size>0?v(y):void 0)??v(new Set)}function Ut(e,t,n,r){let i=r.map(e=>{let t=B(e);return{inside:t,layers:new Set([...t].filter(e=>n.has(e)).map(e=>n.get(e)))}}),a=e=>{let t=n.get(e.source),r=n.get(e.target);return t===void 0||r===void 0||e.source===e.target?!1:i.some(({inside:n,layers:i})=>n.has(e.source)&&n.has(e.target)&&Array.from({length:Math.max(0,Math.abs(r-t)-1)},(e,n)=>Math.min(t,r)+1+n).some(e=>!i.has(e)))},o=new Set;e.edges.forEach((e,t)=>{a(e)&&o.add(t)});let s=new Map,c=e=>{e.source!==e.target&&(s.set(e.source,(s.get(e.source)??0)+1),s.set(e.target,(s.get(e.target)??0)+1))};e.edges.forEach((e,t)=>{o.has(t)||c(e)}),t.edges.forEach(c);for(let t of[...o]){let n=e.edges[t];(!s.get(n.source)||!s.get(n.target))&&o.delete(t)}return o}function Wt(e,t,n,r,i){let a=new Map(Bt(r).map(e=>[e.id,e])),o=[];for(let r of t){let t=e.edges[r],s=n.get(t.source),c=n.get(t.target),l=i.filter(e=>{let n=B(e);return n.has(t.source)&&n.has(t.target)}).sort((e,t)=>B(e).size-B(t).size)[0],u=l&&a.get(l.id);if(!s||!c||!u)return;let d=bt(s,c,[...n.values()].filter(e=>e!==s&&e!==c),u,e.direction,o.map(e=>e.points));if(!d)return;o.push({source:t.source,target:t.target,label:t.label,style:t.style,hasArrowStart:t.hasArrowStart,hasArrowEnd:t.hasArrowEnd,points:d,labelPosition:t.label?xt(d):void 0,inlineStyle:at(r,e),id:t.id,animate:t.animate})}return o}function Gt(e,t,n){let{axis:r,amount:i,after:a}=e,o=i+Et,s=t.filter(e=>e[r]>=a),c=Math.min(...s.map(e=>e[r]));for(let e of s)e[r]+=o;let l=e=>{e[r]>=c&&(e[r]+=o)};for(let e of n)e.points.forEach(l),e.labelPosition&&l(e.labelPosition)}function Kt(e,t,n,r){let i=[...e.edges.filter(e=>!z(e.source)&&!z(e.target)),...r],a=Bt(n),o=[...t.map(e=>e.x),...a.map(e=>e.x),...i.flatMap(e=>e.points.map(e=>e.x))],s=[...t.map(e=>e.y),...a.map(e=>e.y),...i.flatMap(e=>e.points.map(e=>e.y))],c=I.padding-Math.min(...o),l=I.padding-Math.min(...s);for(let e of t)e.x+=c,e.y+=l;for(let e of a)e.x+=c,e.y+=l;for(let e of i){for(let t of e.points)t.x+=c,t.y+=l;e.labelPosition&&(e.labelPosition.x+=c,e.labelPosition.y+=l)}let u=0,d=0;for(let e of t)u=Math.max(u,e.x+e.width+I.padding),d=Math.max(d,e.y+e.height+I.padding);for(let e of a)u=Math.max(u,e.x+e.width+I.padding),d=Math.max(d,e.y+e.height+I.padding);for(let e of i){for(let t of e.points)u=Math.max(u,t.x+F.width+I.padding),d=Math.max(d,t.y+F.width+I.padding);e.labelPosition&&(u=Math.max(u,e.labelPosition.x+60+I.padding),d=Math.max(d,e.labelPosition.y+20+I.padding))}return{...e,nodes:t,edges:i,groups:n,width:u,height:d}}function qt(e,t={}){return Jt(e,t)}function Jt(e,t,n){let r={...I,...t,fontSizes:A(t.fontSizes)};return Ye(w(Te(e,r,n),t.layoutCache),e,r.mergeEdges)}function Yt(e,t={}){if(Nt(e)){let n=Ht(e,(e,n)=>Jt(e,t,n),A(t.fontSizes));if(n)return n}return qt(e,t)}function Xt(e,t={}){return Te(e,{...I,...t,fontSizes:A(t.fontSizes)})}var Zt=12,Qt=2;function $t(e){return e.flatMap(e=>[e,...$t(e.children)])}function en(e,t){let n=t.groupHeader+16;return $t(e).filter(e=>e.label!==``).map(e=>{let r=(0,c.measureMultilineText)(e.label,t.groupHeader,j.groupHeader);return{x:e.x+Zt-Qt,y:e.y+n/2-r.height/2-Qt,width:r.width+4,height:r.height+4}})}function tn(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=[-r,r,-i,i],o=[e.x-n.x,n.x+n.width-e.x,e.y-n.y,n.y+n.height-e.y],s=0,c=1;for(let e=0;e<4;e++){let t=a[e],n=o[e];if(t===0){if(n<0)return!1}else{let e=n/t;if(t<0?s=Math.max(s,e):c=Math.min(c,e),s>c)return!1}}return!0}function nn(e,t){let n=e.points;for(let e=0;e+1<n.length;e++)if(t.some(t=>tn(n[e],n[e+1],t)))return!0;return!1}function rn(e){let t=2166136261;for(let n of e.map(e=>`${e.x},${e.y},${e.width},${e.height}`).join(`;`))t=Math.imul(t^n.charCodeAt(0),16777619);return(t>>>0).toString(36)}function an(e,t,n){let r=`zm-title-gap-${rn(e)}`;return{id:r,markup:` <mask id="${r}" maskUnits="userSpaceOnUse" x="0" y="0" width="${t}" height="${n}">\n <rect x="0" y="0" width="${t}" height="${n}" fill="#fff" />\n${e.map(e=>` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" fill="#000" />`).join(`
2
+ `)}\n </mask>`}}function on(e,t,n=`Inter`,r=!1,i=k,a=`linear`,o,s=!0,l=!0,u,d,f={}){let p=[],m=l&&e.nodes.some(e=>!!(0,c.safeHref)(e.interaction?.href));p.push(nr((0,c.svgOpenTag)(e.width,e.height,t,r,u,d,m,f.styleAttribute),o)),p.push((0,c.buildStyleBlock)(n,!1,f.nonce)),s&&e.edges.some(e=>e.animate)&&p.push(sn(f.nonce)),p.push(`<defs>`),p.push(cn());let h=new Set;for(let t of e.edges)t.inlineStyle?.stroke&&h.add(t.inlineStyle.stroke);for(let e of h)p.push(ln(e));let g=en(e.groups,i),_=new Set(e.edges.filter(e=>nn(e,g))),v;if(_.size>0){let t=an(g,e.width,e.height);v=t.id,p.push(t.markup)}p.push(`</defs>`);for(let t of e.groups)p.push(fn(t,n,i));for(let t of e.edges)p.push(pn(t,a,s,_.has(t)?v:void 0));for(let t of e.edges)t.label&&p.push(hn(t,n,i));for(let t of e.nodes)p.push(yn(t,n,i,l));return p.push(`</svg>`),p.join(`
3
+ `)}function sn(e){return[(0,c.styleOpenTag)(e),` @keyframes zm-edge-dash { to { stroke-dashoffset: -28; } }`,` .edge-animated { animation: zm-edge-dash 1s linear infinite; }`,` @media (prefers-reduced-motion: reduce) {`,` .edge-animated { animation: none; }`,` }`,`</style>`].join(`
4
+ `)}function cn(){return un(`var(--_arrow)`,``)}function ln(e){return un((0,c.escapeAttr)(e),c.f`-${dn(e)}`)}function un(e,t){let n=F.width,r=F.height,i=n-1,a=c.f`fill="${e}" stroke="${e}" stroke-width="0.75" stroke-linejoin="round"`,o=c.f`<polygon points="0 0, ${n} ${r/2}, 0 ${r}" ${a} />`,s=(e,t)=>c.f` <marker id="${e}" markerWidth="${n}" markerHeight="${r}" refX="${i}" refY="${r/2}" orient="${t}">`+c.f`\n ${o}`+`
4
5
  </marker>`;return s(c.f`arrowhead${t}`,`auto`)+`
5
- `+s(c.f`arrowhead-start${t}`,`auto-start-reverse`)}function it(e){return e.replace(/[^a-zA-Z0-9]/g,e=>e.charCodeAt(0).toString(16))}function at(e,t,n){let r=n.groupHeader+16,i=[];i.push(c.f`<g class="subgraph" data-id="${(0,c.escapeAttr)(e.id)}" data-label="${(0,c.escapeAttr)(e.label)}">`),i.push(c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+c.f`rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${P.outerBox}" />`),i.push(c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${r}" `+c.f`rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${P.outerBox}" />`),i.push(` `+(0,c.renderMultilineText)(e.label,e.x+12,e.y+r/2,n.groupHeader,c.f`font-size="${n.groupHeader}" font-weight="${j.groupHeader}" fill="var(--_text-sec)"`));for(let r of e.children)i.push(at(r,t,n));return i.push(`</g>`),i.join(`
6
- `)}function ot(e,t,n=!0){if(e.points.length<2)return``;let r=n&&(e.animate??!1),i=t!==`linear`,a=e.style===`invisible`,o=e.style===`dotted`?` stroke-dasharray="4 4"`:``,s=e.style===`thick`?P.connector*2:P.connector,l=a?`none`:(0,c.escapeAttr)(e.inlineStyle?.stroke??`var(--_line)`),u=(0,c.escapeAttr)(e.inlineStyle?.[`stroke-width`]??String(s)),d=e.inlineStyle?.stroke?c.f`-${it(e.inlineStyle.stroke)}`:``,f=``;a||(e.hasArrowEnd&&(f+=c.f` marker-end="url(#arrowhead${d})"`),e.hasArrowStart&&(f+=c.f` marker-start="url(#arrowhead-start${d})"`));let p=[c.f`class="edge${r?` edge-animated`:``}"`,c.f`data-from="${(0,c.escapeAttr)(e.source)}"`,c.f`data-to="${(0,c.escapeAttr)(e.target)}"`,c.f`data-style="${e.style}"`,c.f`data-arrow-start="${e.hasArrowStart}"`,c.f`data-arrow-end="${e.hasArrowEnd}"`];e.label&&p.push(c.f`data-label="${(0,c.escapeAttr)(e.label)}"`),e.id&&p.push(c.f`data-id="${(0,c.escapeAttr)(e.id)}"`);let m=r&&!o?` stroke-dasharray="8 6"`:``,h=i?c.f`d="${_(e.points,t)}"`:c.f`points="${st(e.points)}"`;return c.f`<${i?`path`:`polyline`} ${p.join(` `)} ${h} `+c.f`fill="none" stroke="${l}" `+c.f`stroke-width="${u}"${o}${m}${f} />`}function st(e){return e.map(e=>c.f`${e.x},${e.y}`).join(` `)}function ct(e,t,n){if(!e.label)return``;let r=e.label,i=e.labelPosition??ut(e.points),a=(0,c.measureMultilineText)(r,n.edgeLabel,j.edgeLabel),o=(0,c.renderMultilineTextWithBackground)(r,i.x,i.y,a.width,a.height,n.edgeLabel,8,c.f`text-anchor="middle" font-size="${n.edgeLabel}" font-weight="${j.edgeLabel}" fill="var(--_text-sec)"`,`rx="2" ry="2" fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="1"`);return c.f`<g class="edge-label" data-from="${(0,c.escapeAttr)(e.source)}" data-to="${(0,c.escapeAttr)(e.target)}" data-label="${(0,c.escapeAttr)(r)}">\n`+c.f` ${o.replace(/\n/g,`
7
- `)}\n`+`</g>`}function lt(e,t){let n=e[t];if(!n)throw Error(c.f`edgeMidpoint: missing point at index ${t}`);return n}function ut(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++)t+=dt(lt(e,n-1),lt(e,n));let n=t/2;for(let t=1;t<e.length;t++){let r=lt(e,t-1),i=lt(e,t),a=dt(r,i);if(n<=a){let e=n/a;return{x:r.x+e*(i.x-r.x),y:r.y+e*(i.y-r.y)}}n-=a}return e[e.length-1]}function dt(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function ft(e,t,n,r=!0){let i=pt(e),a=qt(e,t,n),o=[],s=(0,c.sanitizeClassName)(e.className),l=s?c.f`node ${s}`:`node`,u=e.interaction,d=[c.f`class="${l}"`,c.f`data-id="${(0,c.escapeAttr)(e.id)}"`,c.f`data-label="${(0,c.escapeAttr)(e.label)}"`,c.f`data-shape="${e.shape}"`];o.push(c.f`<g ${d.join(` `)}>`);let f=r?(0,c.safeHref)(u?.href):void 0,p=f?` `:` `;if(f){let e=u?.target?c.f` target="${(0,c.escapeAttr)(u.target)}"`:``;o.push(c.f` <a href="${(0,c.escapeAttr)(f)}"${e}>`)}return r&&u?.tooltip&&o.push(c.f`${p}<title>${(0,c.escapeXml)(u.tooltip)}</title>`),o.push(c.f`${p}${i.replace(/\n/g,c.f`\n${p}`)}`),a&&o.push(c.f`${p}${a.replace(/\n/g,c.f`\n${p}`)}`),f&&o.push(` </a>`),o.push(`</g>`),o.join(`
8
- `)}function pt(e){let{x:t,y:n,width:r,height:i,shape:a,inlineStyle:o}=e,s=(0,c.escapeAttr)(o?.fill??`var(--_node-fill)`),l=(0,c.escapeAttr)(o?.stroke??`var(--_node-stroke)`),u=(0,c.escapeAttr)(o?.[`stroke-width`]??String(P.innerBox));switch(a){case`diamond`:return vt(t,n,r,i,s,l,u);case`rounded`:return ht(t,n,r,i,s,l,u);case`stadium`:return gt(t,n,r,i,s,l,u);case`circle`:return _t(t,n,r,i,s,l,u);case`subroutine`:return yt(t,n,r,i,s,l,u);case`doublecircle`:return bt(t,n,r,i,s,l,u);case`hexagon`:return xt(t,n,r,i,s,l,u);case`cylinder`:return St(t,n,r,i,s,l,u);case`asymmetric`:return Ct(t,n,r,i,s,l,u);case`trapezoid`:return wt(t,n,r,i,s,l,u);case`trapezoid-alt`:return Tt(t,n,r,i,s,l,u);case`parallelogram`:return Et(t,n,r,i,s,l,u);case`parallelogram-alt`:return Dt(t,n,r,i,s,l,u);case`state-start`:return Gt(t,n,r,i);case`state-end`:return Kt(t,n,r,i);case`document`:return Ot(t,n,r,i,s,l,u);case`stacked-document`:return kt(t,n,r,i,s,l,u,!0);case`stacked-process`:return kt(t,n,r,i,s,l,u,!1);case`card`:return At(t,n,r,i,s,l,u);case`lined-process`:return jt(t,n,r,i,s,l,u);case`divided-process`:return Mt(t,n,r,i,s,l,u);case`window-pane`:return Nt(t,n,r,i,s,l,u);case`triangle`:return Pt(t,n,r,i,s,l,u,!1);case`flipped-triangle`:return Pt(t,n,r,i,s,l,u,!0);case`filled-circle`:return Ft(t,n,r,i,l);case`crossed-circle`:return It(t,n,r,i,s,l,u);case`fork-join`:return Lt(t,n,r,i,l);case`notched-pentagon`:return Rt(t,n,r,i,s,l,u);case`sloped-rectangle`:return zt(t,n,r,i,s,l,u);case`flag`:return Bt(t,n,r,i,s,l,u);case`bow-tie-rectangle`:return Vt(t,n,r,i,s,l,u);case`half-rounded-rectangle`:return Ht(t,n,r,i,s,l,u);case`brace`:return Ut(t,n,r,i,s,l,u,`left`);case`brace-right`:return Ut(t,n,r,i,s,l,u,`right`);case`braces`:return Ut(t,n,r,i,s,l,u,`both`);case`bolt`:return Wt(t,n,r,i,s,l,u);case`text`:case`anchor`:return``;default:return mt(t,n,r,i,s,l,u)}}function mt(e,t,n,r,i,a,o){return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+c.f`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ht(e,t,n,r,i,a,o){return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+c.f`rx="6" ry="6" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function gt(e,t,n,r,i,a,o){let s=r/2;return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+c.f`rx="${s}" ry="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function _t(e,t,n,r,i,a,o){let s=e+n/2,l=t+r/2,u=Math.min(n,r)/2;return c.f`<circle cx="${s}" cy="${l}" r="${u}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function vt(e,t,n,r,i,a,o){let s=e+n/2,l=t+r/2,u=n/2,d=r/2,f=[c.f`${s},${l-d}`,c.f`${s+u},${l}`,c.f`${s},${l+d}`,c.f`${s-u},${l}`].join(` `);return c.f`<polygon points="${f}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function yt(e,t,n,r,i,a,o){return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+c.f`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<line x1="${e+8}" y1="${t}" x2="${e+8}" y2="${t+r}" `+c.f`stroke="${a}" stroke-width="${o}" />`+c.f`\n<line x1="${e+n-8}" y1="${t}" x2="${e+n-8}" y2="${t+r}" `+c.f`stroke="${a}" stroke-width="${o}" />`}function bt(e,t,n,r,i,a,o){let s=e+n/2,l=t+r/2,u=Math.min(n,r)/2,d=u-5;return c.f`<circle cx="${s}" cy="${l}" r="${u}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<circle cx="${s}" cy="${l}" r="${d}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function xt(e,t,n,r,i,a,o){let s=r/4,l=[c.f`${e+s},${t}`,c.f`${e+n-s},${t}`,c.f`${e+n},${t+r/2}`,c.f`${e+n-s},${t+r}`,c.f`${e+s},${t+r}`,c.f`${e},${t+r/2}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function St(e,t,n,r,i,a,o){let s=e+n/2,l=t+7,u=r-14;return c.f`<rect x="${e}" y="${l}" width="${n}" height="${u}" `+c.f`fill="${i}" stroke="none" />`+c.f`\n<line x1="${e}" y1="${l}" x2="${e}" y2="${l+u}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<line x1="${e+n}" y1="${l}" x2="${e+n}" y2="${l+u}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<ellipse cx="${s}" cy="${t+r-7}" rx="${n/2}" ry="${7}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<ellipse cx="${s}" cy="${l}" rx="${n/2}" ry="${7}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Ct(e,t,n,r,i,a,o){let s=[c.f`${e+12},${t}`,c.f`${e+n},${t}`,c.f`${e+n},${t+r}`,c.f`${e+12},${t+r}`,c.f`${e},${t+r/2}`].join(` `);return c.f`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function wt(e,t,n,r,i,a,o){let s=n*.15,l=[c.f`${e+s},${t}`,c.f`${e+n-s},${t}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Tt(e,t,n,r,i,a,o){let s=n*.15,l=[c.f`${e},${t}`,c.f`${e+n},${t}`,c.f`${e+n-s},${t+r}`,c.f`${e+s},${t+r}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Et(e,t,n,r,i,a,o){let s=n*.15,l=[c.f`${e+s},${t}`,c.f`${e+n},${t}`,c.f`${e+n-s},${t+r}`,c.f`${e},${t+r}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Dt(e,t,n,r,i,a,o){let s=n*.15,l=[c.f`${e},${t}`,c.f`${e+n-s},${t}`,c.f`${e+n},${t+r}`,c.f`${e+s},${t+r}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function B(e,t,n){return c.f`fill="${e}" stroke="${t}" stroke-width="${n}"`}function Ot(e,t,n,r,i,a,o){let s=Math.min(10,r*.16),l=t+r-s,u=c.f`M ${e} ${t} L ${e+n} ${t} L ${e+n} ${l} `+c.f`C ${e+n*.75} ${l+s*1.8} ${e+n*.25} ${l-s*.8} ${e} ${l} Z`;return c.f`<path d="${u}" ${B(i,a,o)} />`}function kt(e,t,n,r,i,a,o,s){let l=n-10,u=r-10,d=[];for(let n=2;n>=1;n--)d.push(c.f`<rect x="${e+5*n}" y="${t+5*(2-n)}" width="${l}" height="${u}" `+c.f`${B(i,a,o)} />`);return d.push(s?Ot(e,t+10,l,u,i,a,o):c.f`<rect x="${e}" y="${t+10}" width="${l}" height="${u}" ${B(i,a,o)} />`),d.join(`
9
- `)}function At(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),l=[c.f`${e+s},${t}`,c.f`${e+n},${t}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`,c.f`${e},${t+s}`].join(` `);return c.f`<polygon points="${l}" ${B(i,a,o)} />`}function jt(e,t,n,r,i,a,o){let s=Math.min(12,n*.12);return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${B(i,a,o)} />\n`+c.f`<line x1="${e+s}" y1="${t}" x2="${e+s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />`}function Mt(e,t,n,r,i,a,o){let s=t+Math.min(16,r*.3);return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${B(i,a,o)} />\n`+c.f`<line x1="${e}" y1="${s}" x2="${e+n}" y2="${s}" stroke="${a}" stroke-width="${o}" />`}function Nt(e,t,n,r,i,a,o){let s=e+Math.min(16,n*.16),l=t+Math.min(14,r*.28);return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${B(i,a,o)} />\n`+c.f`<line x1="${s}" y1="${t}" x2="${s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />\n`+c.f`<line x1="${e}" y1="${l}" x2="${e+n}" y2="${l}" stroke="${a}" stroke-width="${o}" />`}function Pt(e,t,n,r,i,a,o,s){let l=s?[c.f`${e},${t}`,c.f`${e+n},${t}`,c.f`${e+n/2},${t+r}`]:[c.f`${e+n/2},${t}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`];return c.f`<polygon points="${l.join(` `)}" ${B(i,a,o)} />`}function Ft(e,t,n,r,i){let a=Math.min(n,r)/2-2;return c.f`<circle cx="${e+n/2}" cy="${t+r/2}" r="${a}" fill="${i}" stroke="${i}" />`}function It(e,t,n,r,i,a,o){let s=e+n/2,l=t+r/2,u=Math.min(n,r)/2-2,d=u/Math.SQRT2;return c.f`<circle cx="${s}" cy="${l}" r="${u}" ${B(i,a,o)} />\n`+c.f`<line x1="${s-d}" y1="${l-d}" x2="${s+d}" y2="${l+d}" stroke="${a}" stroke-width="${o}" />\n`+c.f`<line x1="${s+d}" y1="${l-d}" x2="${s-d}" y2="${l+d}" stroke="${a}" stroke-width="${o}" />`}function Lt(e,t,n,r,i){let a=Math.min(8,r);return c.f`<rect x="${e}" y="${t+(r-a)/2}" width="${n}" height="${a}" fill="${i}" stroke="${i}" />`}function Rt(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),l=[c.f`${e+s},${t}`,c.f`${e+n-s},${t}`,c.f`${e+n},${t+s}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`,c.f`${e},${t+s}`].join(` `);return c.f`<polygon points="${l}" ${B(i,a,o)} />`}function zt(e,t,n,r,i,a,o){let s=Math.min(12,r*.3),l=[c.f`${e},${t+s}`,c.f`${e+n},${t}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`].join(` `);return c.f`<polygon points="${l}" ${B(i,a,o)} />`}function Bt(e,t,n,r,i,a,o){let s=Math.min(8,r*.14),l=c.f`M ${e} ${t+s} `+c.f`C ${e+n*.25} ${t-s} ${e+n*.75} ${t+s*2} ${e+n} ${t+s} `+c.f`L ${e+n} ${t+r-s} `+c.f`C ${e+n*.75} ${t+r+s} ${e+n*.25} ${t+r-s*2} ${e} ${t+r-s} Z`;return c.f`<path d="${l}" ${B(i,a,o)} />`}function Vt(e,t,n,r,i,a,o){let s=Math.min(14,n*.12),l=c.f`M ${e+s} ${t} L ${e+n} ${t} `+c.f`Q ${e+n-s*1.4} ${t+r/2} ${e+n} ${t+r} `+c.f`L ${e+s} ${t+r} `+c.f`Q ${e+s*1.4} ${t+r/2} ${e+s} ${t} Z`;return c.f`<path d="${l}" ${B(i,a,o)} />`}function Ht(e,t,n,r,i,a,o){let s=r/2,l=Math.max(0,n-s),u=c.f`M ${e} ${t} L ${e+l} ${t} `+c.f`A ${s} ${s} 0 0 1 ${e+l} ${t+r} `+c.f`L ${e} ${t+r} Z`;return c.f`<path d="${u}" ${B(i,a,o)} />`}function Ut(e,t,n,r,i,a,o,s){let l=Math.min(10,n*.12),u=[c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" fill="none" stroke="none" />`],d=c.f`M ${e+l} ${t} Q ${e} ${t} ${e} ${t+r*.25} `+c.f`Q ${e} ${t+r/2} ${e-l*.4} ${t+r/2} `+c.f`Q ${e} ${t+r/2} ${e} ${t+r*.75} `+c.f`Q ${e} ${t+r} ${e+l} ${t+r}`,f=c.f`M ${e+n-l} ${t} Q ${e+n} ${t} ${e+n} ${t+r*.25} `+c.f`Q ${e+n} ${t+r/2} ${e+n+l*.4} ${t+r/2} `+c.f`Q ${e+n} ${t+r/2} ${e+n} ${t+r*.75} `+c.f`Q ${e+n} ${t+r} ${e+n-l} ${t+r}`;return(s===`left`||s===`both`)&&u.push(c.f`<path d="${d}" fill="none" stroke="${a}" stroke-width="${o}" />`),(s===`right`||s===`both`)&&u.push(c.f`<path d="${f}" fill="none" stroke="${a}" stroke-width="${o}" />`),u.join(`
10
- `)}function Wt(e,t,n,r,i,a,o){let s=[c.f`${e+n*.42},${t}`,c.f`${e+n},${t}`,c.f`${e+n*.62},${t+r*.42}`,c.f`${e+n},${t+r*.42}`,c.f`${e+n*.3},${t+r}`,c.f`${e+n*.5},${t+r*.55}`,c.f`${e},${t+r*.55}`].join(` `);return c.f`<polygon points="${s}" ${B(i,a,o)} />`}function Gt(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2;return c.f`<circle cx="${i}" cy="${a}" r="${o}" fill="var(--_text)" stroke="none" />`}function Kt(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2,s=o-4;return c.f`<circle cx="${i}" cy="${a}" r="${o}" `+c.f`fill="none" stroke="var(--_text)" stroke-width="${P.innerBox*2}" />`+c.f`\n<circle cx="${i}" cy="${a}" r="${s}" fill="var(--_text)" stroke="none" />`}function qt(e,t,n){if((e.shape===`state-start`||e.shape===`state-end`)&&!e.label)return``;let r=e.x+e.width/2,i=e.y+e.height/2,a=(0,c.escapeAttr)(e.inlineStyle?.color??(0,c.getReadableTextColor)(e.inlineStyle?.fill,`var(--_text)`)),o=c.f`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="${j.nodeLabel}" fill="${a}"`,s=e.inlineStyle?.[`font-family`];return s&&(o+=c.f` style="font-family: ${(0,c.escapeAttr)(s)};"`),(0,c.renderMultilineText)(e.label,r,i,n.nodeLabel,o)}function Jt(e){return(0,c.escapeAttr)(e).replace(/\r/g,`&#13;`).replace(/\n/g,`&#10;`).replace(/\t/g,`&#9;`)}function V(e,t){return t===void 0?e:e.replace(`<svg `,c.f`<svg data-src="${Jt(t)}" `)}var Yt=class{raw=new Map;resolved=new Map;inProgress=new Set;declare(e,t){this.raw.set(e,t),this.resolved.delete(e)}lookup(e){if(this.resolved.has(e))return this.resolved.get(e);let t=this.raw.get(e);if(t===void 0||this.inProgress.has(e))return;this.inProgress.add(e);let n=nn(t,this).trim();this.inProgress.delete(e);let r=!/\bvar\(|\bcolor-mix\(/.test(n);return this.resolved.set(e,r?n:void 0),r?n:void 0}};function Xt(e,t){let n=0;for(let r=t;r<e.length;r++){let t=e[r];if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r}return-1}function Zt(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}var Qt=`(?<![\\w-])(var|color-mix)\\(`;function $t(e,t){let[n,...r]=Zt(e),i=(n??``).trim(),a=t.lookup(i);return a===void 0?r.length>0?r.join(`,`).trim():null:a}function en(e){let t=e.trim().split(/\s+/),n,r;for(let e of t)if(/^[\d.]+%$/.test(e)){if(r!==void 0)return null;r=Number(e.slice(0,-1))}else{if(n!==void 0)return null;n=e}return n===void 0?null:{color:n,pct:r}}function tn(e){let t=Zt(e);if(t.length!==3)return null;let[n,r,i]=t;if(n===void 0||r===void 0||i===void 0||!/^\s*in\s+srgb\s*$/i.test(n))return null;let a=en(r),o=en(i);if(!a||!o)return null;let s=(0,c.parseCssColor)(a.color),l=(0,c.parseCssColor)(o.color);if(!s||!l)return null;let u=(0,c.mixSrgb)(s,l,a.pct,o.pct);return u?(0,c.formatCssColor)(u):null}function nn(e,t){let n=``,r=0,i=new RegExp(Qt,`g`),a;for(;(a=i.exec(e))!==null;){let o=a[1];if(o===void 0)continue;let s=a.index,c=s+o.length,l=Xt(e,c);if(l===-1)break;let u=nn(e.slice(c+1,l),t),d=o===`var`?$t(u,t):tn(u);n+=e.slice(r,s),n+=d??`${o}(${u})`,r=l+1,i.lastIndex=r}return n+e.slice(r)}function rn(e,t){let n=new Yt;for(let[e,r]of Object.entries(t))n.declare(e,r);return nn(e,n)}var an=/(--[\w-]+)\s*:\s*([^;{}]+)/g,on=/(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g,sn=new Set([`data-src`]);function cn(e,t){an.lastIndex=0;let n;for(;(n=an.exec(e))!==null;){let[,e,r]=n;e!==void 0&&r!==void 0&&t.declare(e,r.trim())}}function ln(e,t){return e.replace(on,(e,n,r,i,a)=>{if(sn.has(r))return e;let o=a[0]??`"`;return`${n}${r}${i}${o}${nn(a.slice(1,-1),t)}${o}`})}function un(e,t){let n=new Yt;n.declare(`--bg`,t.bg),n.declare(`--fg`,t.fg),t.line&&n.declare(`--line`,t.line),t.accent&&n.declare(`--accent`,t.accent),t.muted&&n.declare(`--muted`,t.muted),t.surface&&n.declare(`--surface`,t.surface),t.border&&n.declare(`--border`,t.border);for(let t of e.matchAll(/<style[^>]*>([\s\S]*?)<\/style>/g)){let e=t[1];e!==void 0&&cn(e,n)}for(let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)){let e=t[1];e!==void 0&&cn(e.slice(1,-1),n)}let r=``,i=0;for(;i<e.length;){let t=e.indexOf(`<`,i);if(t===-1)break;if(r+=e.slice(i,t),e.startsWith(`<style`,t)){let a=e.indexOf(`>`,t),o=e.indexOf(`</style>`,t);if(a===-1||o===-1)break;r+=e.slice(t,a+1),r+=nn(e.slice(a+1,o),n),r+=`</style>`,i=o+8;continue}let a=-1,o=null;for(let n=t+1;n<e.length;n++){let t=e[n];if(o!==null)t===o&&(o=null);else if(t===`"`||t===`'`)o=t;else if(t===`>`){a=n;break}}if(a===-1)break;let s=e.slice(t,a+1);r+=s.startsWith(`<!`)||s.startsWith(`<?`)||s.startsWith(`</`)?s:ln(s,n),i=a+1}return r+e.slice(i)}var H={padding:40,boxPadX:8,headerBaseHeight:32,annotationHeight:16,memberRowHeight:20,sectionPadY:8,emptySectionHeight:8,minWidth:120,memberFontSize:11,memberFontWeight:400,nodeSpacing:40,layerSpacing:60,notePadX:10,notePadY:6};function dn(e){return`note ${e}`}function fn(e){return`${e} link`}function pn(e,t){let n=new Map,r=new Map,i=A(t.fontSizes);for(let t of e.classes){let e=t.annotation?H.headerBaseHeight+H.annotationHeight:H.headerBaseHeight,r=t.attributes.length>0?t.attributes.length*H.memberRowHeight+H.sectionPadY:H.emptySectionHeight,a=t.methods.length>0?t.methods.length*H.memberRowHeight+H.sectionPadY:H.emptySectionHeight,o=T(t.label,i.nodeLabel,j.nodeLabel),s=gn(t.attributes),c=gn(t.methods),l=Math.max(H.minWidth,o+H.boxPadX*2,s+H.boxPadX*2,c+H.boxPadX*2),u=e+r+a;n.set(t.id,{width:l,height:u,headerHeight:e,attrHeight:r,methodHeight:a})}let a=[];for(let[e,t]of n)a.push(R(e,t));let o={fontSize:i.edgeLabel},s=[];for(let[t,n]of e.relationships.entries())s.push(z({id:`e${t}`,source:n.from,target:n.to,label:n.label,labelStyle:o}));let l=new Set(n.keys());for(let[t,n]of e.notes.entries()){let e=dn(t),u=(0,c.measureMultilineText)(n.text,i.edgeLabel,j.edgeLabel),d={width:u.width+H.notePadX*2,height:u.height+H.notePadY*2};r.set(e,d),a.push(R(e,d)),n.forClass!==void 0&&l.has(n.forClass)&&s.push(z({id:fn(e),source:e,target:n.forClass,labelStyle:o}))}return{elkGraph:{id:`root`,layoutOptions:{...re({direction:te(void 0,ee.class),nodeSpacing:H.nodeSpacing,layerSpacing:H.layerSpacing,padding:H.padding}),"elk.edgeLabels.placement":`CENTER`},children:a,edges:s},classSizes:n,noteSizes:r}}function mn(e,t,n,r){let i=new Map;for(let e of t.classes)i.set(e.id,e);let a=[];for(let r of e.children??[]){let e=i.get(r.id);if(e){let i=n.get(e.id);if(!i)throw Error(`Missing computed size for class "${e.id}"`);a.push({id:e.id,label:e.label,annotation:e.annotation,attributes:e.attributes,methods:e.methods,x:r.x??0,y:r.y??0,width:r.width??i.width,height:r.height??i.height,headerHeight:i.headerHeight,attrHeight:i.attrHeight,methodHeight:i.methodHeight,interaction:t.interactions.get(e.id),inlineStyle:(0,c.resolveNodeStyle)(e.id,t),className:t.classAssignments.get(e.id)})}}let o=[],s=e.edges??[];for(let[e,n]of t.relationships.entries()){let t=s[e];if(!t)throw Error(`Missing ELK edge for relationship ${e}`);let r=Ae(t),i=je(t);o.push({from:n.from,to:n.to,type:n.type,markerAt:n.markerAt,label:n.label,fromCardinality:n.fromCardinality,toCardinality:n.toCardinality,points:r,labelPosition:i})}let l=new Map;for(let e of s.slice(t.relationships.length))l.set(e.id,e);let u=new Map;for(let t of e.children??[])u.set(t.id,t);let d=[];for(let[e,n]of t.notes.entries()){let t=dn(e),i=u.get(t),a=r.get(t);if(!i||!a)throw Error(`Missing layout for note ${e}`);let o=l.get(fn(t));d.push({id:t,text:n.text,...o&&n.forClass!==void 0?{forClass:n.forClass}:{},x:i.x??0,y:i.y??0,width:i.width??a.width,height:i.height??a.height,...o?{linkPoints:Ae(o)}:{}})}return{width:e.width??600,height:e.height??400,classes:a,relationships:o,notes:d}}function hn(e,t={}){if(e.classes.length===0&&e.notes.length===0)return{width:0,height:0,classes:[],relationships:[],notes:[]};let{elkGraph:n,classSizes:r,noteSizes:i}=pn(e,t);return mn(w(n,t.layoutCache),e,r,i)}function gn(e){if(e.length===0)return 0;let t=0;for(let n of e){let e=E((0,u.formatClassMember)(n),H.memberFontSize);e>t&&(t=e)}return t}var _n={memberSize:11,memberWeight:400,annotationSize:10,annotationWeight:500};function vn(e,t,n=`Inter`,r=!1,i=k,a,o,s,l=!0,u={}){let d=[],f=l&&e.classes.some(e=>!!(0,c.safeHref)(e.interaction?.href));d.push(V((0,c.svgOpenTag)(e.width,e.height,t,r,o,s,f,u.styleAttribute),a)),d.push((0,c.buildStyleBlock)(n,!0,u.nonce)),d.push(`<defs>`),d.push(yn()),d.push(`</defs>`);for(let t of e.relationships)d.push(wn(t));for(let t of e.notes)d.push(Cn(t));for(let t of e.classes)d.push(bn(t,i,l));for(let t of e.notes)d.push(Sn(t,i));for(let t of e.relationships)d.push(Dn(t,i));return d.push(`</svg>`),d.join(`
11
- `)}function yn(){return` <marker id="cls-inherit" markerWidth="12" markerHeight="10" refX="12" refY="5" orient="auto-start-reverse">
6
+ `+s(c.f`arrowhead-start${t}`,`auto-start-reverse`)}function dn(e){return e.replace(/[^a-zA-Z0-9]/g,e=>e.charCodeAt(0).toString(16))}function fn(e,t,n){let r=n.groupHeader+16,i=[];i.push(c.f`<g class="subgraph" data-id="${(0,c.escapeAttr)(e.id)}" data-label="${(0,c.escapeAttr)(e.label)}">`),i.push(c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+c.f`rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${N.outerBox}" />`),i.push(c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${r}" `+c.f`rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${N.outerBox}" />`),i.push(` `+(0,c.renderMultilineText)(e.label,e.x+12,e.y+r/2,n.groupHeader,c.f`font-size="${n.groupHeader}" font-weight="${j.groupHeader}" fill="var(--_text-sec)"`));for(let r of e.children)i.push(fn(r,t,n));return i.push(`</g>`),i.join(`
7
+ `)}function pn(e,t,n=!0,r){if(e.points.length<2)return``;let i=n&&(e.animate??!1),a=t!==`linear`,o=e.style===`invisible`,s=e.style===`dotted`?` stroke-dasharray="4 4"`:``,l=e.style===`thick`?N.connector*2:N.connector,u=o?`none`:(0,c.escapeAttr)(e.inlineStyle?.stroke??`var(--_line)`),d=(0,c.escapeAttr)(e.inlineStyle?.[`stroke-width`]??String(l)),f=e.inlineStyle?.stroke?c.f`-${dn(e.inlineStyle.stroke)}`:``,p=``;o||(e.hasArrowEnd&&(p+=c.f` marker-end="url(#arrowhead${f})"`),e.hasArrowStart&&(p+=c.f` marker-start="url(#arrowhead-start${f})"`));let m=[c.f`class="edge${i?` edge-animated`:``}"`,c.f`data-from="${(0,c.escapeAttr)(e.source)}"`,c.f`data-to="${(0,c.escapeAttr)(e.target)}"`,c.f`data-style="${e.style}"`,c.f`data-arrow-start="${e.hasArrowStart}"`,c.f`data-arrow-end="${e.hasArrowEnd}"`];e.label&&m.push(c.f`data-label="${(0,c.escapeAttr)(e.label)}"`),e.id&&m.push(c.f`data-id="${(0,c.escapeAttr)(e.id)}"`);let h=i&&!s?` stroke-dasharray="8 6"`:``,g=a?c.f`d="${_(e.points,t)}"`:c.f`points="${mn(e.points)}"`;return c.f`<${a?`path`:`polyline`} ${m.join(` `)} ${g} `+c.f`fill="none" stroke="${u}" `+c.f`stroke-width="${d}"${s}${h}${p}`+(r?c.f` mask="url(#${r})"`:``)+` />`}function mn(e){return e.map(e=>c.f`${e.x},${e.y}`).join(` `)}function hn(e,t,n){if(!e.label)return``;let r=e.label,i=e.labelPosition??_n(e.points),a=(0,c.measureMultilineText)(r,n.edgeLabel,j.edgeLabel),o=(0,c.renderMultilineTextWithBackground)(r,i.x,i.y,a.width,a.height,n.edgeLabel,8,c.f`text-anchor="middle" font-size="${n.edgeLabel}" font-weight="${j.edgeLabel}" fill="var(--_text-sec)"`,`rx="2" ry="2" fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="1"`);return c.f`<g class="edge-label" data-from="${(0,c.escapeAttr)(e.source)}" data-to="${(0,c.escapeAttr)(e.target)}" data-label="${(0,c.escapeAttr)(r)}">\n`+c.f` ${o.replace(/\n/g,`
8
+ `)}\n`+`</g>`}function gn(e,t){let n=e[t];if(!n)throw Error(c.f`edgeMidpoint: missing point at index ${t}`);return n}function _n(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++)t+=vn(gn(e,n-1),gn(e,n));let n=t/2;for(let t=1;t<e.length;t++){let r=gn(e,t-1),i=gn(e,t),a=vn(r,i);if(n<=a){let e=n/a;return{x:r.x+e*(i.x-r.x),y:r.y+e*(i.y-r.y)}}n-=a}return e[e.length-1]}function vn(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function yn(e,t,n,r=!0){let i=bn(e),a=er(e,t,n),o=[],s=(0,c.sanitizeClassName)(e.className),l=s?c.f`node ${s}`:`node`,u=e.interaction,d=[c.f`class="${l}"`,c.f`data-id="${(0,c.escapeAttr)(e.id)}"`,c.f`data-label="${(0,c.escapeAttr)(e.label)}"`,c.f`data-shape="${e.shape}"`];o.push(c.f`<g ${d.join(` `)}>`);let f=r?(0,c.safeHref)(u?.href):void 0,p=f?` `:` `;if(f){let e=u?.target?c.f` target="${(0,c.escapeAttr)(u.target)}"`:``;o.push(c.f` <a href="${(0,c.escapeAttr)(f)}"${e}>`)}return r&&u?.tooltip&&o.push(c.f`${p}<title>${(0,c.escapeXml)(u.tooltip)}</title>`),o.push(c.f`${p}${i.replace(/\n/g,c.f`\n${p}`)}`),a&&o.push(c.f`${p}${a.replace(/\n/g,c.f`\n${p}`)}`),f&&o.push(` </a>`),o.push(`</g>`),o.join(`
9
+ `)}function bn(e){let{x:t,y:n,width:r,height:i,shape:a,inlineStyle:o}=e,s=(0,c.escapeAttr)(o?.fill??`var(--_node-fill)`),l=(0,c.escapeAttr)(o?.stroke??`var(--_node-stroke)`),u=(0,c.escapeAttr)(o?.[`stroke-width`]??String(N.innerBox));switch(a){case`diamond`:return Tn(t,n,r,i,s,l,u);case`rounded`:return Sn(t,n,r,i,s,l,u);case`stadium`:return Cn(t,n,r,i,s,l,u);case`circle`:return wn(t,n,r,i,s,l,u);case`subroutine`:return En(t,n,r,i,s,l,u);case`doublecircle`:return Dn(t,n,r,i,s,l,u);case`hexagon`:return On(t,n,r,i,s,l,u);case`cylinder`:return kn(t,n,r,i,s,l,u);case`asymmetric`:return An(t,n,r,i,s,l,u);case`trapezoid`:return jn(t,n,r,i,s,l,u);case`trapezoid-alt`:return Mn(t,n,r,i,s,l,u);case`parallelogram`:return Nn(t,n,r,i,s,l,u);case`parallelogram-alt`:return Pn(t,n,r,i,s,l,u);case`state-start`:return Qn(t,n,r,i);case`state-end`:return $n(t,n,r,i);case`document`:return Fn(t,n,r,i,s,l,u);case`stacked-document`:return In(t,n,r,i,s,l,u,!0);case`stacked-process`:return In(t,n,r,i,s,l,u,!1);case`card`:return Ln(t,n,r,i,s,l,u);case`lined-process`:return Rn(t,n,r,i,s,l,u);case`divided-process`:return zn(t,n,r,i,s,l,u);case`window-pane`:return Bn(t,n,r,i,s,l,u);case`triangle`:return Vn(t,n,r,i,s,l,u,!1);case`flipped-triangle`:return Vn(t,n,r,i,s,l,u,!0);case`filled-circle`:return Hn(t,n,r,i,l);case`crossed-circle`:return Un(t,n,r,i,s,l,u);case`fork-join`:return Wn(t,n,r,i,l);case`notched-pentagon`:return Gn(t,n,r,i,s,l,u);case`sloped-rectangle`:return Kn(t,n,r,i,s,l,u);case`flag`:return qn(t,n,r,i,s,l,u);case`bow-tie-rectangle`:return Jn(t,n,r,i,s,l,u);case`half-rounded-rectangle`:return Yn(t,n,r,i,s,l,u);case`brace`:return Xn(t,n,r,i,s,l,u,`left`);case`brace-right`:return Xn(t,n,r,i,s,l,u,`right`);case`braces`:return Xn(t,n,r,i,s,l,u,`both`);case`bolt`:return Zn(t,n,r,i,s,l,u);case`text`:case`anchor`:return``;default:return xn(t,n,r,i,s,l,u)}}function xn(e,t,n,r,i,a,o){return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+c.f`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Sn(e,t,n,r,i,a,o){return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+c.f`rx="6" ry="6" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Cn(e,t,n,r,i,a,o){let s=r/2;return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+c.f`rx="${s}" ry="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function wn(e,t,n,r,i,a,o){let s=e+n/2,l=t+r/2,u=Math.min(n,r)/2;return c.f`<circle cx="${s}" cy="${l}" r="${u}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Tn(e,t,n,r,i,a,o){let s=e+n/2,l=t+r/2,u=n/2,d=r/2,f=[c.f`${s},${l-d}`,c.f`${s+u},${l}`,c.f`${s},${l+d}`,c.f`${s-u},${l}`].join(` `);return c.f`<polygon points="${f}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function En(e,t,n,r,i,a,o){return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+c.f`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<line x1="${e+8}" y1="${t}" x2="${e+8}" y2="${t+r}" `+c.f`stroke="${a}" stroke-width="${o}" />`+c.f`\n<line x1="${e+n-8}" y1="${t}" x2="${e+n-8}" y2="${t+r}" `+c.f`stroke="${a}" stroke-width="${o}" />`}function Dn(e,t,n,r,i,a,o){let s=e+n/2,l=t+r/2,u=Math.min(n,r)/2,d=u-5;return c.f`<circle cx="${s}" cy="${l}" r="${u}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<circle cx="${s}" cy="${l}" r="${d}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function On(e,t,n,r,i,a,o){let s=r/4,l=[c.f`${e+s},${t}`,c.f`${e+n-s},${t}`,c.f`${e+n},${t+r/2}`,c.f`${e+n-s},${t+r}`,c.f`${e+s},${t+r}`,c.f`${e},${t+r/2}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function kn(e,t,n,r,i,a,o){let s=e+n/2,l=t+7,u=r-14;return c.f`<rect x="${e}" y="${l}" width="${n}" height="${u}" `+c.f`fill="${i}" stroke="none" />`+c.f`\n<line x1="${e}" y1="${l}" x2="${e}" y2="${l+u}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<line x1="${e+n}" y1="${l}" x2="${e+n}" y2="${l+u}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<ellipse cx="${s}" cy="${t+r-7}" rx="${n/2}" ry="${7}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<ellipse cx="${s}" cy="${l}" rx="${n/2}" ry="${7}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function An(e,t,n,r,i,a,o){let s=[c.f`${e+12},${t}`,c.f`${e+n},${t}`,c.f`${e+n},${t+r}`,c.f`${e+12},${t+r}`,c.f`${e},${t+r/2}`].join(` `);return c.f`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function jn(e,t,n,r,i,a,o){let s=n*.15,l=[c.f`${e+s},${t}`,c.f`${e+n-s},${t}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Mn(e,t,n,r,i,a,o){let s=n*.15,l=[c.f`${e},${t}`,c.f`${e+n},${t}`,c.f`${e+n-s},${t+r}`,c.f`${e+s},${t+r}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Nn(e,t,n,r,i,a,o){let s=n*.15,l=[c.f`${e+s},${t}`,c.f`${e+n},${t}`,c.f`${e+n-s},${t+r}`,c.f`${e},${t+r}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Pn(e,t,n,r,i,a,o){let s=n*.15,l=[c.f`${e},${t}`,c.f`${e+n-s},${t}`,c.f`${e+n},${t+r}`,c.f`${e+s},${t+r}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function V(e,t,n){return c.f`fill="${e}" stroke="${t}" stroke-width="${n}"`}function Fn(e,t,n,r,i,a,o){let s=Math.min(10,r*.16),l=t+r-s,u=c.f`M ${e} ${t} L ${e+n} ${t} L ${e+n} ${l} `+c.f`C ${e+n*.75} ${l+s*1.8} ${e+n*.25} ${l-s*.8} ${e} ${l} Z`;return c.f`<path d="${u}" ${V(i,a,o)} />`}function In(e,t,n,r,i,a,o,s){let l=n-10,u=r-10,d=[];for(let n=2;n>=1;n--)d.push(c.f`<rect x="${e+5*n}" y="${t+5*(2-n)}" width="${l}" height="${u}" `+c.f`${V(i,a,o)} />`);return d.push(s?Fn(e,t+10,l,u,i,a,o):c.f`<rect x="${e}" y="${t+10}" width="${l}" height="${u}" ${V(i,a,o)} />`),d.join(`
10
+ `)}function Ln(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),l=[c.f`${e+s},${t}`,c.f`${e+n},${t}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`,c.f`${e},${t+s}`].join(` `);return c.f`<polygon points="${l}" ${V(i,a,o)} />`}function Rn(e,t,n,r,i,a,o){let s=Math.min(12,n*.12);return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${V(i,a,o)} />\n`+c.f`<line x1="${e+s}" y1="${t}" x2="${e+s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />`}function zn(e,t,n,r,i,a,o){let s=t+Math.min(16,r*.3);return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${V(i,a,o)} />\n`+c.f`<line x1="${e}" y1="${s}" x2="${e+n}" y2="${s}" stroke="${a}" stroke-width="${o}" />`}function Bn(e,t,n,r,i,a,o){let s=e+Math.min(16,n*.16),l=t+Math.min(14,r*.28);return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${V(i,a,o)} />\n`+c.f`<line x1="${s}" y1="${t}" x2="${s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />\n`+c.f`<line x1="${e}" y1="${l}" x2="${e+n}" y2="${l}" stroke="${a}" stroke-width="${o}" />`}function Vn(e,t,n,r,i,a,o,s){let l=s?[c.f`${e},${t}`,c.f`${e+n},${t}`,c.f`${e+n/2},${t+r}`]:[c.f`${e+n/2},${t}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`];return c.f`<polygon points="${l.join(` `)}" ${V(i,a,o)} />`}function Hn(e,t,n,r,i){let a=Math.min(n,r)/2-2;return c.f`<circle cx="${e+n/2}" cy="${t+r/2}" r="${a}" fill="${i}" stroke="${i}" />`}function Un(e,t,n,r,i,a,o){let s=e+n/2,l=t+r/2,u=Math.min(n,r)/2-2,d=u/Math.SQRT2;return c.f`<circle cx="${s}" cy="${l}" r="${u}" ${V(i,a,o)} />\n`+c.f`<line x1="${s-d}" y1="${l-d}" x2="${s+d}" y2="${l+d}" stroke="${a}" stroke-width="${o}" />\n`+c.f`<line x1="${s+d}" y1="${l-d}" x2="${s-d}" y2="${l+d}" stroke="${a}" stroke-width="${o}" />`}function Wn(e,t,n,r,i){let a=Math.min(8,r);return c.f`<rect x="${e}" y="${t+(r-a)/2}" width="${n}" height="${a}" fill="${i}" stroke="${i}" />`}function Gn(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),l=[c.f`${e+s},${t}`,c.f`${e+n-s},${t}`,c.f`${e+n},${t+s}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`,c.f`${e},${t+s}`].join(` `);return c.f`<polygon points="${l}" ${V(i,a,o)} />`}function Kn(e,t,n,r,i,a,o){let s=Math.min(12,r*.3),l=[c.f`${e},${t+s}`,c.f`${e+n},${t}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`].join(` `);return c.f`<polygon points="${l}" ${V(i,a,o)} />`}function qn(e,t,n,r,i,a,o){let s=Math.min(8,r*.14),l=c.f`M ${e} ${t+s} `+c.f`C ${e+n*.25} ${t-s} ${e+n*.75} ${t+s*2} ${e+n} ${t+s} `+c.f`L ${e+n} ${t+r-s} `+c.f`C ${e+n*.75} ${t+r+s} ${e+n*.25} ${t+r-s*2} ${e} ${t+r-s} Z`;return c.f`<path d="${l}" ${V(i,a,o)} />`}function Jn(e,t,n,r,i,a,o){let s=Math.min(14,n*.12),l=c.f`M ${e+s} ${t} L ${e+n} ${t} `+c.f`Q ${e+n-s*1.4} ${t+r/2} ${e+n} ${t+r} `+c.f`L ${e+s} ${t+r} `+c.f`Q ${e+s*1.4} ${t+r/2} ${e+s} ${t} Z`;return c.f`<path d="${l}" ${V(i,a,o)} />`}function Yn(e,t,n,r,i,a,o){let s=r/2,l=Math.max(0,n-s),u=c.f`M ${e} ${t} L ${e+l} ${t} `+c.f`A ${s} ${s} 0 0 1 ${e+l} ${t+r} `+c.f`L ${e} ${t+r} Z`;return c.f`<path d="${u}" ${V(i,a,o)} />`}function Xn(e,t,n,r,i,a,o,s){let l=Math.min(10,n*.12),u=[c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" fill="none" stroke="none" />`],d=c.f`M ${e+l} ${t} Q ${e} ${t} ${e} ${t+r*.25} `+c.f`Q ${e} ${t+r/2} ${e-l*.4} ${t+r/2} `+c.f`Q ${e} ${t+r/2} ${e} ${t+r*.75} `+c.f`Q ${e} ${t+r} ${e+l} ${t+r}`,f=c.f`M ${e+n-l} ${t} Q ${e+n} ${t} ${e+n} ${t+r*.25} `+c.f`Q ${e+n} ${t+r/2} ${e+n+l*.4} ${t+r/2} `+c.f`Q ${e+n} ${t+r/2} ${e+n} ${t+r*.75} `+c.f`Q ${e+n} ${t+r} ${e+n-l} ${t+r}`;return(s===`left`||s===`both`)&&u.push(c.f`<path d="${d}" fill="none" stroke="${a}" stroke-width="${o}" />`),(s===`right`||s===`both`)&&u.push(c.f`<path d="${f}" fill="none" stroke="${a}" stroke-width="${o}" />`),u.join(`
11
+ `)}function Zn(e,t,n,r,i,a,o){let s=[c.f`${e+n*.42},${t}`,c.f`${e+n},${t}`,c.f`${e+n*.62},${t+r*.42}`,c.f`${e+n},${t+r*.42}`,c.f`${e+n*.3},${t+r}`,c.f`${e+n*.5},${t+r*.55}`,c.f`${e},${t+r*.55}`].join(` `);return c.f`<polygon points="${s}" ${V(i,a,o)} />`}function Qn(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2;return c.f`<circle cx="${i}" cy="${a}" r="${o}" fill="var(--_text)" stroke="none" />`}function $n(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2,s=o-4;return c.f`<circle cx="${i}" cy="${a}" r="${o}" `+c.f`fill="none" stroke="var(--_text)" stroke-width="${N.innerBox*2}" />`+c.f`\n<circle cx="${i}" cy="${a}" r="${s}" fill="var(--_text)" stroke="none" />`}function er(e,t,n){if((e.shape===`state-start`||e.shape===`state-end`)&&!e.label)return``;let r=e.x+e.width/2,i=e.y+e.height/2,a=(0,c.escapeAttr)(e.inlineStyle?.color??(0,c.getReadableTextColor)(e.inlineStyle?.fill,`var(--_text)`)),o=c.f`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="${j.nodeLabel}" fill="${a}"`,s=e.inlineStyle?.[`font-family`];return s&&(o+=c.f` style="font-family: ${(0,c.escapeAttr)(s)};"`),(0,c.renderMultilineText)(e.label,r,i,n.nodeLabel,o)}function tr(e){return(0,c.escapeAttr)(e).replace(/\r/g,`&#13;`).replace(/\n/g,`&#10;`).replace(/\t/g,`&#9;`)}function nr(e,t){return t===void 0?e:e.replace(`<svg `,c.f`<svg data-src="${tr(t)}" `)}var rr=class{raw=new Map;resolved=new Map;inProgress=new Set;declare(e,t){this.raw.set(e,t),this.resolved.delete(e)}lookup(e){if(this.resolved.has(e))return this.resolved.get(e);let t=this.raw.get(e);if(t===void 0||this.inProgress.has(e))return;this.inProgress.add(e);let n=ur(t,this).trim();this.inProgress.delete(e);let r=!/\bvar\(|\bcolor-mix\(/.test(n);return this.resolved.set(e,r?n:void 0),r?n:void 0}};function ir(e,t){let n=0;for(let r=t;r<e.length;r++){let t=e[r];if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r}return-1}function ar(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}var or=`(?<![\\w-])(var|color-mix)\\(`;function sr(e,t){let[n,...r]=ar(e),i=(n??``).trim(),a=t.lookup(i);return a===void 0?r.length>0?r.join(`,`).trim():null:a}function cr(e){let t=e.trim().split(/\s+/),n,r;for(let e of t)if(/^[\d.]+%$/.test(e)){if(r!==void 0)return null;r=Number(e.slice(0,-1))}else{if(n!==void 0)return null;n=e}return n===void 0?null:{color:n,pct:r}}function lr(e){let t=ar(e);if(t.length!==3)return null;let[n,r,i]=t;if(n===void 0||r===void 0||i===void 0||!/^\s*in\s+srgb\s*$/i.test(n))return null;let a=cr(r),o=cr(i);if(!a||!o)return null;let s=(0,c.parseCssColor)(a.color),l=(0,c.parseCssColor)(o.color);if(!s||!l)return null;let u=(0,c.mixSrgb)(s,l,a.pct,o.pct);return u?(0,c.formatCssColor)(u):null}function ur(e,t){let n=``,r=0,i=new RegExp(or,`g`),a;for(;(a=i.exec(e))!==null;){let o=a[1];if(o===void 0)continue;let s=a.index,c=s+o.length,l=ir(e,c);if(l===-1)break;let u=ur(e.slice(c+1,l),t),d=o===`var`?sr(u,t):lr(u);n+=e.slice(r,s),n+=d??`${o}(${u})`,r=l+1,i.lastIndex=r}return n+e.slice(r)}function dr(e,t){let n=new rr;for(let[e,r]of Object.entries(t))n.declare(e,r);return ur(e,n)}var fr=/(--[\w-]+)\s*:\s*([^;{}]+)/g,pr=/(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g,mr=new Set([`data-src`]);function hr(e,t){fr.lastIndex=0;let n;for(;(n=fr.exec(e))!==null;){let[,e,r]=n;e!==void 0&&r!==void 0&&t.declare(e,r.trim())}}function gr(e,t){return e.replace(pr,(e,n,r,i,a)=>{if(mr.has(r))return e;let o=a[0]??`"`;return`${n}${r}${i}${o}${ur(a.slice(1,-1),t)}${o}`})}function _r(e,t){let n=new rr;n.declare(`--bg`,t.bg),n.declare(`--fg`,t.fg),t.line&&n.declare(`--line`,t.line),t.accent&&n.declare(`--accent`,t.accent),t.muted&&n.declare(`--muted`,t.muted),t.surface&&n.declare(`--surface`,t.surface),t.border&&n.declare(`--border`,t.border);for(let t of e.matchAll(/<style[^>]*>([\s\S]*?)<\/style>/g)){let e=t[1];e!==void 0&&hr(e,n)}for(let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)){let e=t[1];e!==void 0&&hr(e.slice(1,-1),n)}let r=``,i=0;for(;i<e.length;){let t=e.indexOf(`<`,i);if(t===-1)break;if(r+=e.slice(i,t),e.startsWith(`<style`,t)){let a=e.indexOf(`>`,t),o=e.indexOf(`</style>`,t);if(a===-1||o===-1)break;r+=e.slice(t,a+1),r+=ur(e.slice(a+1,o),n),r+=`</style>`,i=o+8;continue}let a=-1,o=null;for(let n=t+1;n<e.length;n++){let t=e[n];if(o!==null)t===o&&(o=null);else if(t===`"`||t===`'`)o=t;else if(t===`>`){a=n;break}}if(a===-1)break;let s=e.slice(t,a+1);r+=s.startsWith(`<!`)||s.startsWith(`<?`)||s.startsWith(`</`)?s:gr(s,n),i=a+1}return r+e.slice(i)}var H={padding:40,boxPadX:8,headerBaseHeight:32,annotationHeight:16,memberRowHeight:20,sectionPadY:8,emptySectionHeight:8,minWidth:120,memberFontSize:11,memberFontWeight:400,nodeSpacing:40,layerSpacing:60,notePadX:10,notePadY:6,namespaceTitleHeight:28,namespacePad:16,namespaceTitleFontSize:12};function vr(e){return`note ${e}`}function yr(e){return`${e} link`}function br(e){return`namespace ${e}`}function xr(e){let t=new Set(e.classes.map(e=>e.id)),n=new Set,r=[];for(let[i,a]of e.namespaces.entries()){let e=[];for(let r of a.classIds)!t.has(r)||n.has(r)||(n.add(r),e.push(r));e.length>0&&r.push({id:br(i),name:a.name,classIds:e})}return r}function Sr(e,t){let n=new Map,r=new Map,i=A(t.fontSizes);for(let t of e.classes){let e=t.annotation?H.headerBaseHeight+H.annotationHeight:H.headerBaseHeight,r=t.attributes.length>0?t.attributes.length*H.memberRowHeight+H.sectionPadY:H.emptySectionHeight,a=t.methods.length>0?t.methods.length*H.memberRowHeight+H.sectionPadY:H.emptySectionHeight,o=T(t.label,i.nodeLabel,j.nodeLabel),s=Er(t.attributes),c=Er(t.methods),l=Math.max(H.minWidth,o+H.boxPadX*2,s+H.boxPadX*2,c+H.boxPadX*2),u=e+r+a;n.set(t.id,{width:l,height:u,headerHeight:e,attrHeight:r,methodHeight:a})}let a=xr(e),o=new Map;for(let e of a)for(let t of e.classIds)o.set(t,e.id);let s=new Map,l=[];for(let e of a){let t=T(e.name,H.namespaceTitleFontSize,j.groupHeader)+H.namespacePad*2,n={id:e.id,children:[],layoutOptions:{"elk.padding":re({top:H.namespaceTitleHeight+H.namespacePad/2,left:H.namespacePad,bottom:H.namespacePad,right:H.namespacePad}),"elk.nodeSize.constraints":`MINIMUM_SIZE`,"elk.nodeSize.minimum":`(${Math.ceil(t)}, 0)`}};s.set(e.id,n),l.push(n)}for(let[e,t]of n){let n=ae(e,t),r=s.get(o.get(e)??``);r?.children?r.children.push(n):l.push(n)}let u={fontSize:i.edgeLabel},d=[];for(let[t,n]of e.relationships.entries())d.push(R({id:`e${t}`,source:n.from,target:n.to,label:n.label,labelStyle:u}));let f=new Set(n.keys());for(let[t,n]of e.notes.entries()){let e=vr(t),a=(0,c.measureMultilineText)(n.text,i.edgeLabel,j.edgeLabel),o={width:a.width+H.notePadX*2,height:a.height+H.notePadY*2};r.set(e,o),l.push(ae(e,o)),n.forClass!==void 0&&f.has(n.forClass)&&d.push(R({id:yr(e),source:e,target:n.forClass,labelStyle:u}))}return{elkGraph:{id:`root`,layoutOptions:{...ie({direction:ne(void 0,te.class),nodeSpacing:H.nodeSpacing,layerSpacing:H.layerSpacing,padding:H.padding}),"elk.edgeLabels.placement":`CENTER`,"elk.hierarchyHandling":`INCLUDE_CHILDREN`,"elk.separateConnectedComponents":`false`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`},children:l,edges:d},classSizes:n,noteSizes:r,namespaces:a}}function Cr(e,t,n,r,i){let a=new Map;for(let e of t.classes)a.set(e.id,e);let o=new Set(i.map(e=>e.id)),s=new Map,l=[];for(let t of e.children??[])if(o.has(t.id)){let e=t.x??0,n=t.y??0;s.set(t.id,{x:e,y:n});for(let r of t.children??[])l.push({...r,x:(r.x??0)+e,y:(r.y??0)+n})}else l.push(t);let u=e=>{let t=e.container;return t&&s.get(t)||{x:0,y:0}},d=[];for(let t of i){let n=(e.children??[]).find(e=>e.id===t.id);n&&d.push({name:t.name,classIds:t.classIds,x:n.x??0,y:n.y??0,width:n.width??0,height:n.height??0})}let f=[];for(let e of l){let r=a.get(e.id);if(r){let i=n.get(r.id);if(!i)throw Error(`Missing computed size for class "${r.id}"`);f.push({id:r.id,label:r.label,annotation:r.annotation,attributes:r.attributes,methods:r.methods,x:e.x??0,y:e.y??0,width:e.width??i.width,height:e.height??i.height,headerHeight:i.headerHeight,attrHeight:i.attrHeight,methodHeight:i.methodHeight,interaction:t.interactions.get(r.id),inlineStyle:(0,c.resolveNodeStyle)(r.id,t),className:t.classAssignments.get(r.id)})}}let p=[],m=e.edges??[];for(let[e,n]of t.relationships.entries()){let t=m[e];if(!t)throw Error(`Missing ELK edge for relationship ${e}`);let r=u(t),i=ze(t,r.x,r.y),a=Be(t,r.x,r.y);p.push({from:n.from,to:n.to,type:n.type,markerAt:n.markerAt,label:n.label,fromCardinality:n.fromCardinality,toCardinality:n.toCardinality,points:i,labelPosition:a})}let h=new Map;for(let e of m.slice(t.relationships.length))h.set(e.id,e);let g=new Map;for(let e of l)g.set(e.id,e);let _=[];for(let[e,n]of t.notes.entries()){let t=vr(e),i=g.get(t),a=r.get(t);if(!i||!a)throw Error(`Missing layout for note ${e}`);let o=h.get(yr(t));_.push({id:t,text:n.text,...o&&n.forClass!==void 0?{forClass:n.forClass}:{},x:i.x??0,y:i.y??0,width:i.width??a.width,height:i.height??a.height,...o?{linkPoints:ze(o,u(o).x,u(o).y)}:{}})}return{width:e.width??600,height:e.height??400,classes:f,relationships:p,notes:_,namespaces:d}}function wr(e,t={}){if(e.classes.length===0&&e.notes.length===0)return{width:0,height:0,classes:[],relationships:[],notes:[],namespaces:[]};let{elkGraph:n,classSizes:r,noteSizes:i,namespaces:a}=Sr(e,t);return Cr(w(n,t.layoutCache),e,r,i,a)}function Tr(e){return e.length*Math.ceil(E(`M`,H.memberFontSize))}function Er(e){if(e.length===0)return 0;let t=0;for(let n of e){let e=Tr((0,u.formatClassMember)(n));e>t&&(t=e)}return t}var Dr={memberSize:11,memberWeight:400,annotationSize:10,annotationWeight:500};function Or(e,t,n=`Inter`,r=!1,i=k,a,o,s,l=!0,u={}){let d=[],f=l&&e.classes.some(e=>!!(0,c.safeHref)(e.interaction?.href));d.push(nr((0,c.svgOpenTag)(e.width,e.height,t,r,o,s,f,u.styleAttribute),a)),d.push((0,c.buildStyleBlock)(n,!0,u.nonce)),d.push(`<defs>`),d.push(Ar()),d.push(`</defs>`);for(let t of e.namespaces)d.push(kr(t));for(let t of e.relationships)d.push(Lr(t));for(let t of e.notes)d.push(Ir(t));for(let t of e.classes)d.push(jr(t,i,l));for(let t of e.notes)d.push(Fr(t,i));for(let t of e.relationships)d.push(Br(t,i));return d.push(`</svg>`),d.join(`
12
+ `)}function kr(e){let{x:t,y:n,width:r,height:i}=e,a=H.namespaceTitleHeight,o=N.outerBox;return[c.f`<g class="class-namespace" data-id="${(0,c.escapeAttr)(e.name)}" data-label="${(0,c.escapeAttr)(e.name)}">`,c.f` <rect x="${t}" y="${n}" width="${r}" height="${i}" rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${o}" />`,c.f` <rect x="${t}" y="${n}" width="${r}" height="${a}" rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${o}" />`,c.f` <text x="${t+H.namespacePad}" y="${n+a/2}" dy="${P}" font-size="${H.namespaceTitleFontSize}" font-weight="${j.groupHeader}" fill="var(--_text-sec)">${Ur(e.name)}</text>`,`</g>`].join(`
13
+ `)}function Ar(){return` <marker id="cls-inherit" markerWidth="12" markerHeight="10" refX="12" refY="5" orient="auto-start-reverse">
12
14
  <polygon points="0 0, 12 5, 0 10" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="1.5" />
13
15
  </marker>
14
16
  <marker id="cls-composition" markerWidth="18" markerHeight="14" refX="16.5" refY="7" orient="auto-start-reverse">
@@ -19,38 +21,40 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
19
21
  </marker>
20
22
  <marker id="cls-arrow" markerWidth="8" markerHeight="6" refX="8" refY="3" orient="auto-start-reverse">
21
23
  <polyline points="0 0, 8 3, 0 6" fill="none" stroke="var(--_arrow)" stroke-width="1.5" />
22
- </marker>`}function bn(e,t,n=!0){let{x:r,y:i,width:a,height:o,headerHeight:s,attrHeight:l,inlineStyle:u}=e,d=[],f=e.interaction,p=(0,c.escapeAttr)(u?.fill??`var(--_node-fill)`),m=(0,c.escapeAttr)(u?.stroke??`var(--_node-stroke)`),h=(0,c.escapeAttr)(u?.[`stroke-width`]??String(P.outerBox)),g=u?.fill?p:`var(--_group-hdr)`,_=u?.color?(0,c.escapeAttr)(u.color):u?.fill?(0,c.escapeAttr)((0,c.getReadableTextColor)(u.fill,`var(--_text)`)):void 0,v=e.annotation?c.f` data-annotation="${(0,c.escapeAttr)(e.annotation)}"`:``,y=(0,c.sanitizeClassName)(e.className),b=[c.f`class="${y?c.f`class-node ${y}`:`class-node`}"`,c.f`data-id="${(0,c.escapeAttr)(e.id)}"`,c.f`data-label="${(0,c.escapeAttr)(e.label)}"`];d.push(c.f`<g ${b.join(` `)}${v}>`);let x=n?(0,c.safeHref)(f?.href):void 0;if(x){let e=f?.target?c.f` target="${(0,c.escapeAttr)(f.target)}"`:``;d.push(c.f` <a href="${(0,c.escapeAttr)(x)}"${e}>`)}n&&f?.tooltip&&d.push(c.f` <title>${An(f.tooltip)}</title>`),d.push(c.f` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+c.f`rx="0" ry="0" fill="${p}" stroke="${m}" stroke-width="${h}" />`),d.push(c.f` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+c.f`rx="0" ry="0" fill="${g}" stroke="${m}" stroke-width="${h}" />`);let S=i+s/2;if(e.annotation){let t=i+12;d.push(c.f` <text x="${r+a/2}" y="${t}" text-anchor="middle" dy="${F}" `+c.f`font-size="${_n.annotationSize}" font-weight="${_n.annotationWeight}" `+c.f`font-style="italic" fill="${_??`var(--_text-muted)`}">&lt;&lt;${An(e.annotation)}&gt;&gt;</text>`),S=i+s/2+6}d.push(` `+(0,c.renderMultilineText)(e.label,r+a/2,S,t.nodeLabel,c.f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${_??`var(--_text)`}"`));let C=i+s;d.push(c.f` <line x1="${r}" y1="${C}" x2="${r+a}" y2="${C}" `+c.f`stroke="${m}" stroke-width="${P.innerBox}" />`);for(let t=0;t<e.attributes.length;t++){let n=e.attributes[t],i=C+4+t*20+10;d.push(` `+xn(n,r+H.boxPadX,i,_))}let w=C+l;d.push(c.f` <line x1="${r}" y1="${w}" x2="${r+a}" y2="${w}" `+c.f`stroke="${m}" stroke-width="${P.innerBox}" />`);for(let t=0;t<e.methods.length;t++){let n=e.methods[t],i=w+4+t*20+10;d.push(` `+xn(n,r+H.boxPadX,i,_))}return x&&d.push(` </a>`),d.push(`</g>`),d.join(`
23
- `)}function xn(e,t,n,r){let i=e.isAbstract?` font-style="italic"`:``,a=e.isStatic?` text-decoration="underline"`:``,o=r??`var(--_text-faint)`,s=r??`var(--_text-sec)`,l=r??`var(--_text-muted)`,u=[];e.visibility&&u.push(c.f`<tspan fill="${o}">${An(e.visibility)} </tspan>`);let d=e.isMethod?c.f`${e.name}(${e.params||``})`:e.name;return u.push(c.f`<tspan fill="${s}">${An(d)}</tspan>`),e.type&&(u.push(c.f`<tspan fill="${o}">: </tspan>`),u.push(c.f`<tspan fill="${l}">${An(e.type)}</tspan>`)),c.f`<text x="${t}" y="${n}" class="mono" dy="${F}" `+c.f`font-size="${_n.memberSize}" font-weight="${_n.memberWeight}"${i}${a}>`+c.f`${u.join(``)}</text>`}var U=6;function Sn(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.forClass===void 0?``:c.f` data-for="${(0,c.escapeAttr)(e.forClass)}"`,s=[c.f`${n},${r}`,c.f`${n+i-U},${r}`,c.f`${n+i},${r+U}`,c.f`${n+i},${r+a}`,c.f`${n},${r+a}`].join(` `),l=c.f`${n+i-U},${r} ${n+i},${r+U} `+c.f`${n+i-U},${r+U}`;return c.f`<g class="class-note"${o}>`+c.f`\n <polygon points="${s}" `+c.f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${P.innerBox}" />`+c.f`\n <polygon points="${l}" `+c.f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${P.innerBox}" />`+c.f`\n ${(0,c.renderMultilineText)(e.text,n+i/2,r+a/2,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`)}`+`
24
- </g>`}function Cn(e){if(!e.linkPoints||e.linkPoints.length<2)return``;let t=e.linkPoints.map(e=>c.f`${e.x},${e.y}`).join(` `),n=e.forClass===void 0?``:c.f` data-for="${(0,c.escapeAttr)(e.forClass)}"`;return c.f`<polyline class="class-note-link"${n} points="${t}" `+c.f`fill="none" stroke="var(--_line)" stroke-width="${P.connector}" stroke-dasharray="2 3" />`}function wn(e){if(e.points.length<2)return``;let t=e.points.map(e=>c.f`${e.x},${e.y}`).join(` `),n=e.type===`dependency`||e.type===`realization`?` stroke-dasharray="6 4"`:``,r=Tn(e.type,e.markerAt),i=[`class="class-relationship"`,c.f`data-from="${(0,c.escapeAttr)(e.from)}"`,c.f`data-to="${(0,c.escapeAttr)(e.to)}"`,c.f`data-type="${e.type}"`,c.f`data-marker-at="${e.markerAt}"`];return e.label&&i.push(c.f`data-label="${(0,c.escapeAttr)(e.label)}"`),e.fromCardinality&&i.push(c.f`data-from-cardinality="${(0,c.escapeAttr)(e.fromCardinality)}"`),e.toCardinality&&i.push(c.f`data-to-cardinality="${(0,c.escapeAttr)(e.toCardinality)}"`),c.f`<polyline ${i.join(` `)} points="${t}" fill="none" stroke="var(--_line)" `+c.f`stroke-width="${P.connector}"${n}${r} />`}function Tn(e,t){let n=En(e);return n?t===`from`?c.f` marker-start="url(#${n})"`:c.f` marker-end="url(#${n})"`:``}function En(e){switch(e){case`inheritance`:case`realization`:return`cls-inherit`;case`composition`:return`cls-composition`;case`aggregation`:return`cls-aggregation`;case`association`:case`dependency`:return`cls-arrow`;default:return null}}function Dn(e,t){if(!e.label&&!e.fromCardinality&&!e.toCardinality||e.points.length<2)return``;let n=[];if(e.label){let r=e.labelPosition??On(e.points);n.push((0,c.renderMultilineText)(e.label,r.x,r.y-8,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`))}if(e.fromCardinality&&e.points.length>=2){let r=e.points[0],i=e.points[1],a=kn(r,i);n.push((0,c.renderMultilineText)(e.fromCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`))}if(e.toCardinality&&e.points.length>=2){let r=e.points[e.points.length-1],i=e.points[e.points.length-2],a=kn(r,i);n.push((0,c.renderMultilineText)(e.toCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`))}return n.join(`
25
- `)}function On(e){return e.length===0?{x:0,y:0}:e[Math.floor(e.length/2)]}function kn(e,t){let n=t.x-e.x,r=t.y-e.y;return Math.abs(n)>Math.abs(r)?{x:n>0?14:-14,y:-10}:{x:-14,y:r>0?14:-14}}var An=c.escapeXml,W={padding:40,boxPadX:14,headerHeight:34,rowHeight:22,minWidth:140,attrFontSize:11,attrFontWeight:400,nodeSpacing:70,layerSpacing:90};function jn(e,t){let n=new Map,r=A(t.fontSizes);for(let t of e.entities){let e=T(t.label,r.nodeLabel,j.nodeLabel),i=0;for(let e of t.attributes){let t=E(`${e.type} ${e.name}${e.keys.length>0?` `+e.keys.join(`,`):``}`,W.attrFontSize);t>i&&(i=t)}let a=Math.max(W.minWidth,e+W.boxPadX*2,i+W.boxPadX*2),o=W.headerHeight+Math.max(t.attributes.length,1)*W.rowHeight;n.set(t.id,{width:a,height:o})}let i=[];for(let[e,t]of n)i.push(R(e,t));let a={fontSize:r.edgeLabel},o=[];for(let[t,n]of e.relationships.entries())o.push(z({id:`e${t}`,source:n.entity1,target:n.entity2,label:n.label,labelStyle:a}));return{elkGraph:{id:`root`,layoutOptions:{...re({direction:te(e.direction,ee.er),nodeSpacing:W.nodeSpacing,layerSpacing:W.layerSpacing,padding:W.padding}),"elk.edgeLabels.placement":`CENTER`},children:i,edges:o},entitySizes:n}}function Mn(e,t,n){let r=new Map;for(let e of t.entities)r.set(e.id,e);let i=[];for(let t of e.children??[]){let e=r.get(t.id);if(e){let r=n.get(e.id);if(!r)throw Error(`Missing computed size for entity "${e.id}"`);i.push({id:e.id,label:e.label,attributes:e.attributes,x:t.x??0,y:t.y??0,width:t.width??r.width,height:t.height??r.height,headerHeight:W.headerHeight,rowHeight:W.rowHeight})}}let a=[];for(let[n,r]of(e.edges??[]).entries()){let e=t.relationships[n],i=Ae(r);a.push({entity1:e.entity1,entity2:e.entity2,cardinality1:e.cardinality1,cardinality2:e.cardinality2,label:e.label,identifying:e.identifying,points:i})}return{width:e.width??600,height:e.height??400,entities:i,relationships:a}}function Nn(e,t={}){if(e.entities.length===0)return{width:0,height:0,entities:[],relationships:[]};let{elkGraph:n,entitySizes:r}=jn(e,t);return Mn(w(n,t.layoutCache),e,r)}var G={attrSize:11,attrWeight:400,keySize:9,keyWeight:600};function Pn(e,t,n=`Inter`,r=!1,i=k,a,o,s,l={}){let u=[];u.push(V((0,c.svgOpenTag)(e.width,e.height,t,r,o,s,void 0,l.styleAttribute),a)),u.push((0,c.buildStyleBlock)(n,!0,l.nonce)),u.push(`<defs>`),u.push(`</defs>`);for(let t of e.relationships)u.push(Ln(t));for(let t of e.entities)u.push(Fn(t,i));for(let t of e.relationships)u.push(zn(t));for(let t of e.relationships)u.push(Rn(t,i));return u.push(`</svg>`),u.join(`
26
- `)}function Fn(e,t){let{id:n,x:r,y:i,width:a,height:o,headerHeight:s,rowHeight:l,label:u,attributes:d}=e,f=[];f.push(c.f`<g class="entity" data-id="${(0,c.escapeAttr)(n)}" data-label="${(0,c.escapeAttr)(u)}">`),f.push(c.f` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+c.f`rx="0" ry="0" fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${P.outerBox}" />`),f.push(c.f` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+c.f`rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${P.outerBox}" />`),f.push(` `+(0,c.renderMultilineText)(u,r+a/2,i+s/2,t.nodeLabel,c.f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="var(--_text)"`));let p=i+s;f.push(c.f` <line x1="${r}" y1="${p}" x2="${r+a}" y2="${p}" `+c.f`stroke="var(--_node-stroke)" stroke-width="${P.innerBox}" />`);for(let e=0;e<d.length;e++){let t=d[e],n=p+e*l+l/2;f.push(` `+In(t,r,n,a).replace(/\n/g,`
27
- `))}return d.length===0&&f.push(c.f` <text x="${r+a/2}" y="${p+l/2}" text-anchor="middle" dy="${F}" `+c.f`font-size="${G.attrSize}" fill="var(--_text-faint)" font-style="italic">(no attributes)</text>`),f.push(`</g>`),f.join(`
28
- `)}function In(e,t,n,r){let i=[],a=e.comment&&e.comment.length>0;if(e.comment&&e.comment.length>0){let t=e.comment.replace(/<br\s*\/?>/gi,`
29
- `);i.push(c.f`<g><title>${Hn(t)}</title>`)}let o=0;e.keys.length>0&&(o=T(e.keys.join(`,`),G.keySize,G.keyWeight)+8,i.push(c.f`<rect x="${t+6}" y="${n-7}" width="${o}" height="14" rx="2" ry="2" `+`fill="var(--_key-badge)" />`),i.push(c.f`<text x="${t+6+o/2}" y="${n}" text-anchor="middle" dy="${F}" `+c.f`font-size="${G.keySize}" font-weight="${G.keyWeight}" fill="var(--_text-sec)">${e.keys.join(`,`)}</text>`));let s=t+8+(o>0?o+6:0);i.push(c.f`<text x="${s}" y="${n}" class="mono" dy="${F}" `+c.f`font-size="${G.attrSize}" font-weight="${G.attrWeight}">`+c.f`<tspan fill="var(--_text-muted)">${Hn(e.type)}</tspan></text>`);let l=t+r-8;return i.push(c.f`<text x="${l}" y="${n}" class="mono" text-anchor="end" dy="${F}" `+c.f`font-size="${G.attrSize}" font-weight="${G.attrWeight}">`+c.f`<tspan fill="var(--_text-sec)">${Hn(e.name)}</tspan></text>`),a&&i.push(`</g>`),i.join(`
30
- `)}function Ln(e){if(e.points.length<2)return``;let t=e.points.map(e=>c.f`${e.x},${e.y}`).join(` `),n=e.identifying?``:` stroke-dasharray="6 4"`,r=e.label?c.f` data-label="${(0,c.escapeAttr)(e.label)}"`:``,i=[`class="er-relationship"`,c.f`data-entity1="${(0,c.escapeAttr)(e.entity1)}"`,c.f`data-entity2="${(0,c.escapeAttr)(e.entity2)}"`,c.f`data-cardinality1="${e.cardinality1}"`,c.f`data-cardinality2="${e.cardinality2}"`,c.f`data-identifying="${e.identifying}"`];return c.f`<polyline ${i.join(` `)}${r} points="${t}" fill="none" stroke="var(--_line)" `+c.f`stroke-width="${P.connector}"${n} />`}function Rn(e,t){if(!e.label||e.points.length<2)return``;let n=Vn(e.points),r=(0,c.measureMultilineText)(e.label,t.edgeLabel,j.edgeLabel),i=r.width+8,a=r.height+6;return c.f`<rect x="${n.x-i/2}" y="${n.y-a/2}" width="${i}" height="${a}" rx="2" ry="2" `+`fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="0.5" />`+c.f`\n${(0,c.renderMultilineText)(e.label,n.x,n.y,t.edgeLabel,c.f`text-anchor="middle" font-size="${t.edgeLabel}" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`)}`}function zn(e){if(e.points.length<2)return``;let t=[],n=e.points[0],r=e.points[1];t.push(Bn(n,r,e.cardinality1));let i=e.points[e.points.length-1],a=e.points[e.points.length-2];return t.push(Bn(i,a,e.cardinality2)),t.join(`
31
- `)}function Bn(e,t,n){let r=[],i=P.connector+.25,a=e.x-t.x,o=e.y-t.y,s=Math.sqrt(a*a+o*o);if(s===0)return``;let l=a/s,u=o/s,d=-u,f=l,p=e.x-l*4,m=e.y-u*4,h=e.x-l*16,g=e.y-u*16,_=n===`one`||n===`zero-one`,v=n===`many`||n===`zero-many`,y=n===`zero-one`||n===`zero-many`;if(_){r.push(c.f`<line x1="${p+d*6}" y1="${m+f*6}" `+c.f`x2="${p-d*6}" y2="${m-f*6}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`);let e=p-l*4,t=m-u*4;r.push(c.f`<line x1="${e+d*6}" y1="${t+f*6}" `+c.f`x2="${e-d*6}" y2="${t-f*6}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`)}if(v){let e=p,t=m;r.push(c.f`<line x1="${e+d*7}" y1="${t+f*7}" `+c.f`x2="${h}" y2="${g}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`),r.push(c.f`<line x1="${e}" y1="${t}" `+c.f`x2="${h}" y2="${g}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`),r.push(c.f`<line x1="${e-d*7}" y1="${t-f*7}" `+c.f`x2="${h}" y2="${g}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`)}if(n===`many`){let t=e.x-l*20,n=e.y-u*20;r.push(c.f`<line x1="${t+d*6}" y1="${n+f*6}" `+c.f`x2="${t-d*6}" y2="${n-f*6}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`)}if(y){let t=v?20:12,n=e.x-l*t,a=e.y-u*t;r.push(c.f`<circle cx="${n}" cy="${a}" r="4" `+c.f`fill="var(--bg)" stroke="var(--_line)" stroke-width="${i}" />`)}return r.join(`
32
- `)}function Vn(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++){let r=e[n].x-e[n-1].x,i=e[n].y-e[n-1].y;t+=Math.sqrt(r*r+i*i)}if(t===0)return e[0];let n=t/2,r=0;for(let t=1;t<e.length;t++){let i=e[t].x-e[t-1].x,a=e[t].y-e[t-1].y,o=Math.sqrt(i*i+a*a);if(r+o>=n){let s=o>0?(n-r)/o:0;return{x:e[t-1].x+i*s,y:e[t-1].y+a*s}}r+=o}return e[e.length-1]}var Hn=c.escapeXml,Un={padding:30,actorGap:140,actorHeight:40,actorPadX:16,headerGap:20,messageRowHeight:40,selfMessageHeight:30,activationWidth:10,blockPadX:10,blockPadTop:40,blockPadBottom:8,blockHeaderExtra:28,dividerExtra:24,noteWidth:60,notePadX:12,notePadY:6,noteGap:10,noteOffsetAfterMessage:8,noteStackGap:4,boxPad:10};function Wn(e){return e+8}function Gn(e){return{...Un,actorHeight:e?.actorHeight??Un.actorHeight,headerGap:e?.headerGap??Un.headerGap,messageRowHeight:e?.messageRowHeight??Un.messageRowHeight,noteOffsetAfterMessage:e?.noteOffsetAfterMessage??Un.noteOffsetAfterMessage,noteStackGap:e?.noteStackGap??Un.noteStackGap}}function Kn(e,t={}){if(e.actors.length===0)return{width:0,height:0,actors:[],lifelines:[],messages:[],activations:[],blocks:[],notes:[],boxes:[]};let n=Gn(t.sequence),r=A(t.fontSizes),i=e.actors.map(e=>{let t=T(e.label,r.nodeLabel,j.nodeLabel);return Math.max(t+n.actorPadX*2,80)}),a=[],o=n.padding+i[0]/2;for(let t=0;t<e.actors.length;t++){if(t>0){let e=Math.max(n.actorGap,(i[t-1]+i[t])/2+40);o+=e}a.push(o)}let s=new Map;for(let t=0;t<e.actors.length;t++)s.set(e.actors[t].id,t);let c=e.boxes.filter(e=>e.actorIds.length>0),l=c.some(e=>e.label!==``),u=c.length===0?0:n.boxPad+(l?Wn(r.edgeLabel):0),d=n.padding+u,f=e.actors.map((e,t)=>({id:e.id,label:e.label,type:e.type,x:a[t],y:d,width:i[t],height:n.actorHeight})),p=c.map(e=>{let t=e.actorIds.map(e=>s.get(e)??0),r=Math.min(...t),o=Math.max(...t),c=a[r]-i[r]/2-n.boxPad,l=a[o]+i[o]/2+n.boxPad,u={label:e.label,x:c,y:n.padding,width:l-c,height:0};return e.color!==void 0&&(u.color=e.color),u}),m=d+n.actorHeight+n.headerGap,h=[],g=new Map;for(let t of e.blocks){let e=g.get(t.startIndex)??0;g.set(t.startIndex,Math.max(e,n.blockHeaderExtra));for(let e of t.dividers){let t=g.get(e.index)??0;g.set(e.index,Math.max(t,n.dividerExtra))}}let _=new Map;for(let t of e.notes){let e=_.get(t.afterIndex)??[];e.push(t),_.set(t.afterIndex,e)}let v=[],y=_.get(-1);if(y&&y.length>0){let e=m;for(let t of y){let o=Math.max(n.noteWidth,T(t.text,r.edgeLabel,j.edgeLabel)+n.notePadX*2),c=r.edgeLabel+n.notePadY*2,l=s.get(t.actorIds[0]??``)??0,u;if(t.position===`left`)u=a[l]-i[l]/2-o-n.noteGap;else if(t.position===`right`)u=a[l]+i[l]/2+n.noteGap;else if(t.actorIds.length>1){let e=s.get(t.actorIds[t.actorIds.length-1]??``)??l;u=(a[l]+a[e])/2-o/2}else u=a[l]-o/2;v.push({text:t.text,x:u,y:e,width:o,height:c,position:t.position,actors:t.actorIds}),e+=c+n.noteStackGap}m=Math.max(m,e+n.messageRowHeight/2)}let b=new Map,x=[];function S(e,t){let n=b.get(e)??[];b.set(e,n);let r=n.length;n.push({startY:t,depth:r})}function C(e,t){let r=b.get(e);if(!r||r.length===0)return;let{startY:i,depth:o}=r.pop(),c=s.get(e)??0,l=o*4;x.push({actorId:e,x:a[c]-n.activationWidth/2+l,topY:i,bottomY:t,width:n.activationWidth})}let w=new Map;for(let t of e.activations){let e=w.get(t.afterIndex)??[];e.push(t),w.set(t.afterIndex,e)}function E(e,t){for(let n of w.get(e)??[])n.kind===`start`?S(n.actorId,t):C(n.actorId,t)}E(-1,m);for(let t=0;t<e.messages.length;t++){let o=e.messages[t],c=s.get(o.from)??0,l=s.get(o.to)??0,u=o.from===o.to,d=g.get(t)??0;d>0&&(m+=d);let f=a[c],p=a[l],y=!u&&e.actors[l].createdAt===t;if(y){let e=i[l]/2;p+=f<p?-e:e}h.push({from:o.from,to:o.to,label:o.label,lineStyle:o.lineStyle,arrowHead:o.arrowHead,x1:f,x2:p,y:m,isSelf:u,bidirectional:o.bidirectional??!1,seqNumber:o.seqNumber}),o.activate&&S(o.to,m),o.deactivate&&C(o.from,m),E(t,m),m+=u?n.selfMessageHeight+n.messageRowHeight:n.messageRowHeight,y&&(m+=n.actorHeight/2);let b=_.get(t);if(b&&b.length>0){let e=u?n.selfMessageHeight:0,o=h[t].y+e+n.noteOffsetAfterMessage;for(let e of b){let t=Math.max(n.noteWidth,T(e.text,r.edgeLabel,j.edgeLabel)+n.notePadX*2),c=r.edgeLabel+n.notePadY*2,l=s.get(e.actorIds[0]??``)??0,u;if(e.position===`left`)u=a[l]-i[l]/2-t-n.noteGap;else if(e.position===`right`)u=a[l]+i[l]/2+n.noteGap;else if(e.actorIds.length>1){let n=s.get(e.actorIds[e.actorIds.length-1]??``)??l;u=(a[l]+a[n])/2-t/2}else u=a[l]-t/2;v.push({text:e.text,x:u,y:o,width:t,height:c,position:e.position,actors:e.actorIds}),o+=c+n.noteStackGap}m=Math.max(m,o+n.messageRowHeight/2)}}for(let[e,t]of b)for(let{startY:r,depth:i}of t){let t=s.get(e)??0,o=i*4;x.push({actorId:e,x:a[t]-n.activationWidth/2+o,topY:r,bottomY:m-n.messageRowHeight/2,width:n.activationWidth})}let D=e.blocks.map(t=>{let o=h[t.startIndex],c=h[t.endIndex],l=(o?.y??m)-n.blockPadTop,u=(c?.y??m)+n.blockPadBottom+12,d=new Set;for(let n=t.startIndex;n<=t.endIndex;n++){let t=e.messages[n];t&&(d.add(s.get(t.from)??0),d.add(s.get(t.to)??0))}if(d.size===0)for(let t=0;t<e.actors.length;t++)d.add(t);let f=Math.min(...d),p=Math.max(...d),g=a[f]-i[f]/2-n.blockPadX,_=a[p]+i[p]/2+n.blockPadX,v=t.dividers.map(e=>{let t=h[e.index],n=t?.y??m,i=28;if(e.label&&t?.label){let n=T(`[${e.label}]`,r.edgeLabel,j.edgeLabel),a=g+8,o=a+n,s=T(t.label,r.edgeLabel,j.edgeLabel),c=t.isSelf?t.x1+36:(t.x1+t.x2)/2-s/2,l=c+s;o>c&&a<l&&(i=36)}return{y:n-i,label:e.label}});return{type:t.type,label:t.label,x:g,y:l,width:_-g,height:u-l,dividers:v}}),O=v,k=m+n.padding,M=n.padding,N=0;for(let e of f)M=Math.min(M,e.x-e.width/2),N=Math.max(N,e.x+e.width/2);for(let e of D)M=Math.min(M,e.x),N=Math.max(N,e.x+e.width);for(let e of O)M=Math.min(M,e.x),N=Math.max(N,e.x+e.width);for(let e of p)M=Math.min(M,e.x),N=Math.max(N,e.x+e.width);for(let e of h)if(e.isSelf&&e.label){let t=e.x1+30+8,n=T(e.label,r.edgeLabel,j.edgeLabel);N=Math.max(N,t+n+8)}let P=M<n.padding?n.padding-M:0;if(P>0){for(let e of f)e.x+=P;for(let e of h)e.x1+=P,e.x2+=P;for(let e of x)e.x+=P;for(let e of D)e.x+=P;for(let e of O)e.x+=P;for(let e of p)e.x+=P;for(let e=0;e<a.length;e++)a[e]+=P}for(let t=0;t<e.actors.length;t++){let r=e.actors[t].createdAt;r!==void 0&&(f[t].y=(h[r]?.y??m)-n.actorHeight/2)}let F=e.actors.map((e,t)=>{let r=e.destroyedAt,i={actorId:e.id,x:a[t],topY:f[t].y+n.actorHeight,bottomY:r===void 0?k-n.padding:h[r]?.y??m};return r!==void 0&&(i.destroyed=!0),i});for(let e of p)e.height=k-n.padding+n.boxPad-e.y;let I=N+P+n.padding;return{width:Math.max(I,200),height:Math.max(k,100),actors:f,lifelines:F,messages:h,activations:x,blocks:D,notes:O,boxes:p}}function qn(e,t,n=`Inter`,r=!1,i=k,a,o,s,l={}){let u=[];u.push(V((0,c.svgOpenTag)(e.width,e.height,t,r,o,s,void 0,l.styleAttribute),a)),u.push((0,c.buildStyleBlock)(n,!1,l.nonce)),u.push(`<defs>`),u.push(Jn()),u.push(`</defs>`);for(let t of e.boxes)u.push(nr(t,i));for(let t of e.blocks)u.push(rr(t,i));for(let t of e.lifelines)u.push(Xn(t));for(let t of e.activations)u.push(Qn(t));for(let t of e.messages)u.push($n(t,i));for(let t of e.notes)u.push(ir(t,i));for(let t of e.actors)u.push(Yn(t,i));return u.push(`</svg>`),u.join(`
33
- `)}function Jn(){let e=I.width,t=I.height;return c.f` <marker id="seq-arrow" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t/2}" orient="auto-start-reverse">`+c.f`\n <polygon points="0 0, ${e} ${t/2}, 0 ${t}" fill="var(--_arrow)" />`+`
24
+ </marker>`}function jr(e,t,n=!0){let{x:r,y:i,width:a,height:o,headerHeight:s,attrHeight:l,inlineStyle:u}=e,d=[],f=e.interaction,p=(0,c.escapeAttr)(u?.fill??`var(--_node-fill)`),m=(0,c.escapeAttr)(u?.stroke??`var(--_node-stroke)`),h=(0,c.escapeAttr)(u?.[`stroke-width`]??String(N.outerBox)),g=u?.fill?p:`var(--_group-hdr)`,_=u?.color?(0,c.escapeAttr)(u.color):u?.fill?(0,c.escapeAttr)((0,c.getReadableTextColor)(u.fill,`var(--_text)`)):void 0,v=e.annotation?c.f` data-annotation="${(0,c.escapeAttr)(e.annotation)}"`:``,y=(0,c.sanitizeClassName)(e.className),b=[c.f`class="${y?c.f`class-node ${y}`:`class-node`}"`,c.f`data-id="${(0,c.escapeAttr)(e.id)}"`,c.f`data-label="${(0,c.escapeAttr)(e.label)}"`];d.push(c.f`<g ${b.join(` `)}${v}>`);let x=n?(0,c.safeHref)(f?.href):void 0;if(x){let e=f?.target?c.f` target="${(0,c.escapeAttr)(f.target)}"`:``;d.push(c.f` <a href="${(0,c.escapeAttr)(x)}"${e}>`)}n&&f?.tooltip&&d.push(c.f` <title>${Ur(f.tooltip)}</title>`),d.push(c.f` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+c.f`rx="0" ry="0" fill="${p}" stroke="${m}" stroke-width="${h}" />`),d.push(c.f` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+c.f`rx="0" ry="0" fill="${g}" stroke="${m}" stroke-width="${h}" />`);let S=i+s/2;if(e.annotation){let t=i+12;d.push(c.f` <text x="${r+a/2}" y="${t}" text-anchor="middle" dy="${P}" `+c.f`font-size="${Dr.annotationSize}" font-weight="${Dr.annotationWeight}" `+c.f`font-style="italic" fill="${_??`var(--_text-muted)`}">&lt;&lt;${Ur(e.annotation)}&gt;&gt;</text>`),S=i+s/2+6}d.push(` `+(0,c.renderMultilineText)(e.label,r+a/2,S,t.nodeLabel,c.f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${_??`var(--_text)`}"`));let C=i+s;d.push(c.f` <line x1="${r}" y1="${C}" x2="${r+a}" y2="${C}" `+c.f`stroke="${m}" stroke-width="${N.innerBox}" />`);for(let t=0;t<e.attributes.length;t++){let n=e.attributes[t],i=C+4+t*20+10;d.push(` `+Nr(n,r+H.boxPadX,i,_))}let w=C+l;d.push(c.f` <line x1="${r}" y1="${w}" x2="${r+a}" y2="${w}" `+c.f`stroke="${m}" stroke-width="${N.innerBox}" />`);for(let t=0;t<e.methods.length;t++){let n=e.methods[t],i=w+4+t*20+10;d.push(` `+Nr(n,r+H.boxPadX,i,_))}return x&&d.push(` </a>`),d.push(`</g>`),d.join(`
25
+ `)}var Mr=700;function Nr(e,t,n,r){let i=e.isAbstract?` font-style="italic"`:``,a=e.isStatic?` text-decoration="underline"`:``,o=r??`var(--_text-faint)`,s=r??`var(--_text-sec)`,l=r??`var(--_text-muted)`,u=[];e.visibility&&u.push(c.f`<tspan fill="${s}" font-weight="${Mr}">${Ur(e.visibility)}</tspan><tspan fill="${o}"> </tspan>`);let d=e.isMethod?c.f`${e.name}(${e.params||``})`:e.name;return u.push(c.f`<tspan fill="${s}">${Ur(d)}</tspan>`),e.type&&(u.push(c.f`<tspan fill="${o}">: </tspan>`),u.push(c.f`<tspan fill="${l}">${Ur(e.type)}</tspan>`)),c.f`<text x="${t}" y="${n}" class="mono" dy="${P}" `+c.f`font-size="${Dr.memberSize}" font-weight="${Dr.memberWeight}"${i}${a}>`+c.f`${u.join(``)}</text>`}var Pr=6;function Fr(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.forClass===void 0?``:c.f` data-for="${(0,c.escapeAttr)(e.forClass)}"`,s=[c.f`${n},${r}`,c.f`${n+i-Pr},${r}`,c.f`${n+i},${r+Pr}`,c.f`${n+i},${r+a}`,c.f`${n},${r+a}`].join(` `),l=c.f`${n+i-Pr},${r} ${n+i},${r+Pr} `+c.f`${n+i-Pr},${r+Pr}`;return c.f`<g class="class-note"${o}>`+c.f`\n <polygon points="${s}" `+c.f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${N.innerBox}" />`+c.f`\n <polygon points="${l}" `+c.f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${N.innerBox}" />`+c.f`\n ${(0,c.renderMultilineText)(e.text,n+i/2,r+a/2,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`)}`+`
26
+ </g>`}function Ir(e){if(!e.linkPoints||e.linkPoints.length<2)return``;let t=e.linkPoints.map(e=>c.f`${e.x},${e.y}`).join(` `),n=e.forClass===void 0?``:c.f` data-for="${(0,c.escapeAttr)(e.forClass)}"`;return c.f`<polyline class="class-note-link"${n} points="${t}" `+c.f`fill="none" stroke="var(--_line)" stroke-width="${N.connector}" stroke-dasharray="2 3" />`}function Lr(e){if(e.points.length<2)return``;let t=e.points.map(e=>c.f`${e.x},${e.y}`).join(` `),n=e.type===`dependency`||e.type===`realization`?` stroke-dasharray="6 4"`:``,r=Rr(e.type,e.markerAt),i=[`class="class-relationship"`,c.f`data-from="${(0,c.escapeAttr)(e.from)}"`,c.f`data-to="${(0,c.escapeAttr)(e.to)}"`,c.f`data-type="${e.type}"`,c.f`data-marker-at="${e.markerAt}"`];return e.label&&i.push(c.f`data-label="${(0,c.escapeAttr)(e.label)}"`),e.fromCardinality&&i.push(c.f`data-from-cardinality="${(0,c.escapeAttr)(e.fromCardinality)}"`),e.toCardinality&&i.push(c.f`data-to-cardinality="${(0,c.escapeAttr)(e.toCardinality)}"`),c.f`<polyline ${i.join(` `)} points="${t}" fill="none" stroke="var(--_line)" `+c.f`stroke-width="${N.connector}"${n}${r} />`}function Rr(e,t){let n=zr(e);return n?t===`from`?c.f` marker-start="url(#${n})"`:c.f` marker-end="url(#${n})"`:``}function zr(e){switch(e){case`inheritance`:case`realization`:return`cls-inherit`;case`composition`:return`cls-composition`;case`aggregation`:return`cls-aggregation`;case`association`:case`dependency`:return`cls-arrow`;default:return null}}function Br(e,t){if(!e.label&&!e.fromCardinality&&!e.toCardinality||e.points.length<2)return``;let n=[];if(e.label){let r=e.labelPosition??Vr(e.points);n.push((0,c.renderMultilineText)(e.label,r.x,r.y-8,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`))}if(e.fromCardinality&&e.points.length>=2){let r=e.points[0],i=e.points[1],a=Hr(r,i);n.push((0,c.renderMultilineText)(e.fromCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`))}if(e.toCardinality&&e.points.length>=2){let r=e.points[e.points.length-1],i=e.points[e.points.length-2],a=Hr(r,i);n.push((0,c.renderMultilineText)(e.toCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`))}return n.join(`
27
+ `)}function Vr(e){return e.length===0?{x:0,y:0}:e[Math.floor(e.length/2)]}function Hr(e,t){let n=t.x-e.x,r=t.y-e.y;return Math.abs(n)>Math.abs(r)?{x:n>0?14:-14,y:-10}:{x:-14,y:r>0?14:-14}}var Ur=c.escapeXml,U={padding:40,boxPadX:14,headerHeight:34,rowHeight:22,minWidth:140,attrFontSize:11,attrFontWeight:400,nodeSpacing:70,layerSpacing:90};function Wr(e){return e.length*Math.ceil(E(`M`,U.attrFontSize))}function Gr(e,t){let n=new Map,r=A(t.fontSizes);for(let t of e.entities){let e=T(t.label,r.nodeLabel,j.nodeLabel),i=0;for(let e of t.attributes){let t=Wr(`${e.type} ${e.name}${e.keys.length>0?` `+e.keys.join(`,`):``}`);t>i&&(i=t)}let a=Math.max(U.minWidth,e+U.boxPadX*2,i+U.boxPadX*2),o=U.headerHeight+Math.max(t.attributes.length,1)*U.rowHeight;n.set(t.id,{width:a,height:o})}let i=[];for(let[e,t]of n)i.push(ae(e,t));let a={fontSize:r.edgeLabel},o=[];for(let[t,n]of e.relationships.entries())o.push(R({id:`e${t}`,source:n.entity1,target:n.entity2,label:n.label,labelStyle:a}));return{elkGraph:{id:`root`,layoutOptions:{...ie({direction:ne(e.direction,te.er),nodeSpacing:U.nodeSpacing,layerSpacing:U.layerSpacing,padding:U.padding}),"elk.edgeLabels.placement":`CENTER`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`},children:i,edges:o},entitySizes:n}}function Kr(e,t,n){let r=new Map;for(let e of t.entities)r.set(e.id,e);let i=[];for(let t of e.children??[]){let e=r.get(t.id);if(e){let r=n.get(e.id);if(!r)throw Error(`Missing computed size for entity "${e.id}"`);i.push({id:e.id,label:e.label,attributes:e.attributes,x:t.x??0,y:t.y??0,width:t.width??r.width,height:t.height??r.height,headerHeight:U.headerHeight,rowHeight:U.rowHeight})}}let a=[];for(let[n,r]of(e.edges??[]).entries()){let e=t.relationships[n],i=ze(r);a.push({entity1:e.entity1,entity2:e.entity2,cardinality1:e.cardinality1,cardinality2:e.cardinality2,label:e.label,identifying:e.identifying,points:i})}return{width:e.width??600,height:e.height??400,entities:i,relationships:a}}function qr(e,t={}){if(e.entities.length===0)return{width:0,height:0,entities:[],relationships:[]};let{elkGraph:n,entitySizes:r}=Gr(e,t);return Kr(w(n,t.layoutCache),e,r)}var Jr=70,W={attrSize:11,attrWeight:400,keySize:9,keyWeight:600};function Yr(e,t,n=`Inter`,r=!1,i=k,a,o,s,l={}){let u=[];u.push(nr((0,c.svgOpenTag)(e.width,e.height,t,r,o,s,void 0,l.styleAttribute),a)),u.push((0,c.buildStyleBlock)(n,!0,l.nonce)),u.push(`<defs>`),u.push(`</defs>`);for(let t of e.relationships)u.push(Qr(t));for(let t of e.entities)u.push(Xr(t,i));for(let t of e.relationships)u.push(ei(t));for(let t of e.relationships)u.push($r(t,i));return u.push(`</svg>`),u.join(`
28
+ `)}function Xr(e,t){let{id:n,x:r,y:i,width:a,height:o,headerHeight:s,rowHeight:l,label:u,attributes:d}=e,f=[];f.push(c.f`<g class="entity" data-id="${(0,c.escapeAttr)(n)}" data-label="${(0,c.escapeAttr)(u)}">`),f.push(c.f` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+c.f`rx="0" ry="0" fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${N.outerBox}" />`),f.push(c.f` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+c.f`rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${N.outerBox}" />`),f.push(` `+(0,c.renderMultilineText)(u,r+a/2,i+s/2,t.nodeLabel,c.f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="var(--_text)"`));let p=i+s;f.push(c.f` <line x1="${r}" y1="${p}" x2="${r+a}" y2="${p}" `+c.f`stroke="var(--_node-stroke)" stroke-width="${N.innerBox}" />`);for(let e=0;e<d.length;e++){let t=d[e],n=p+e*l+l/2;f.push(` `+Zr(t,r,n,a).replace(/\n/g,`
29
+ `))}return d.length===0&&f.push(c.f` <text x="${r+a/2}" y="${p+l/2}" text-anchor="middle" dy="${P}" `+c.f`font-size="${W.attrSize}" fill="var(--_text-faint)" font-style="italic">(no attributes)</text>`),f.push(`</g>`),f.join(`
30
+ `)}function Zr(e,t,n,r){let i=[],a=e.comment&&e.comment.length>0;if(e.comment&&e.comment.length>0){let t=e.comment.replace(/<br\s*\/?>/gi,`
31
+ `);i.push(c.f`<g><title>${ri(t)}</title>`)}let o=0;e.keys.length>0&&(o=T(e.keys.join(`,`),W.keySize,W.keyWeight)+8,i.push(c.f`<rect x="${t+6}" y="${n-7}" width="${o}" height="14" rx="2" ry="2" `+`fill="var(--_key-badge)" />`),i.push(c.f`<text x="${t+6+o/2}" y="${n}" text-anchor="middle" dy="${P}" `+c.f`font-size="${W.keySize}" font-weight="${W.keyWeight}" fill="var(--_text-sec)">${e.keys.join(`,`)}</text>`));let s=t+8+(o>0?o+6:0);i.push(c.f`<text x="${s}" y="${n}" class="mono" dy="${P}" `+c.f`font-size="${W.attrSize}" font-weight="${W.attrWeight}">`+c.f`<tspan fill="var(--_text-muted)">${ri(e.type)}</tspan></text>`);let l=t+r-8;return i.push(c.f`<text x="${l}" y="${n}" class="mono" text-anchor="end" dy="${P}" `+c.f`font-size="${W.attrSize}" font-weight="${W.attrWeight}">`+c.f`<tspan fill="var(--_text-sec)">${ri(e.name)}</tspan></text>`),a&&i.push(`</g>`),i.join(`
32
+ `)}function Qr(e){if(e.points.length<2)return``;let t=e.points.map(e=>c.f`${e.x},${e.y}`).join(` `),n=e.identifying?``:` stroke-dasharray="6 4"`,r=e.label?c.f` data-label="${(0,c.escapeAttr)(e.label)}"`:``,i=[`class="er-relationship"`,c.f`data-entity1="${(0,c.escapeAttr)(e.entity1)}"`,c.f`data-entity2="${(0,c.escapeAttr)(e.entity2)}"`,c.f`data-cardinality1="${e.cardinality1}"`,c.f`data-cardinality2="${e.cardinality2}"`,c.f`data-identifying="${e.identifying}"`];return c.f`<polyline ${i.join(` `)}${r} points="${t}" fill="none" stroke="var(--_line)" `+c.f`stroke-width="${N.connector}"${n} />`}function $r(e,t){if(!e.label||e.points.length<2)return``;let n=ni(e.points),r=(0,c.measureMultilineText)(e.label,t.edgeLabel,j.edgeLabel),i=r.width+8,a=r.height+6;return c.f`<rect x="${n.x-i/2}" y="${n.y-a/2}" width="${i}" height="${a}" rx="2" ry="2" `+`fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="0.5" />`+c.f`\n${(0,c.renderMultilineText)(e.label,n.x,n.y,t.edgeLabel,c.f`text-anchor="middle" font-size="${t.edgeLabel}" font-weight="${j.edgeLabel}" fill="color-mix(in srgb, var(--fg) ${Jr}%, var(--bg))"`)}`}function ei(e){if(e.points.length<2)return``;let t=[],n=e.points[0],r=e.points[1];t.push(ti(n,r,e.cardinality1));let i=e.points[e.points.length-1],a=e.points[e.points.length-2];return t.push(ti(i,a,e.cardinality2)),t.join(`
33
+ `)}function ti(e,t,n){let r=[],i=N.connector+.25,a=e.x-t.x,o=e.y-t.y,s=Math.sqrt(a*a+o*o);if(s===0)return``;let l=a/s,u=o/s,d=-u,f=l,p=e.x-l*4,m=e.y-u*4,h=e.x-l*16,g=e.y-u*16,_=n===`one`||n===`zero-one`,v=n===`many`||n===`zero-many`,y=n===`zero-one`||n===`zero-many`;if(_){r.push(c.f`<line x1="${p+d*6}" y1="${m+f*6}" `+c.f`x2="${p-d*6}" y2="${m-f*6}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`);let e=p-l*4,t=m-u*4;r.push(c.f`<line x1="${e+d*6}" y1="${t+f*6}" `+c.f`x2="${e-d*6}" y2="${t-f*6}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`)}if(v){let e=p,t=m;r.push(c.f`<line x1="${e+d*7}" y1="${t+f*7}" `+c.f`x2="${h}" y2="${g}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`),r.push(c.f`<line x1="${e}" y1="${t}" `+c.f`x2="${h}" y2="${g}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`),r.push(c.f`<line x1="${e-d*7}" y1="${t-f*7}" `+c.f`x2="${h}" y2="${g}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`)}if(n===`many`){let t=e.x-l*20,n=e.y-u*20;r.push(c.f`<line x1="${t+d*6}" y1="${n+f*6}" `+c.f`x2="${t-d*6}" y2="${n-f*6}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`)}if(y){let t=v?20:12,n=e.x-l*t,a=e.y-u*t;r.push(c.f`<circle cx="${n}" cy="${a}" r="4" `+c.f`fill="var(--bg)" stroke="var(--_line)" stroke-width="${i}" />`)}return r.join(`
34
+ `)}function ni(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++){let r=e[n].x-e[n-1].x,i=e[n].y-e[n-1].y;t+=Math.sqrt(r*r+i*i)}if(t===0)return e[0];let n=t/2,r=0;for(let t=1;t<e.length;t++){let i=e[t].x-e[t-1].x,a=e[t].y-e[t-1].y,o=Math.sqrt(i*i+a*a);if(r+o>=n){let s=o>0?(n-r)/o:0;return{x:e[t-1].x+i*s,y:e[t-1].y+a*s}}r+=o}return e[e.length-1]}var ri=c.escapeXml,ii={padding:30,actorGap:140,actorHeight:40,actorPadX:16,headerGap:20,messageRowHeight:40,selfMessageHeight:30,activationWidth:10,blockPadX:10,blockPadTop:40,blockPadBottom:8,blockHeaderExtra:28,dividerExtra:24,noteWidth:60,notePadX:12,notePadY:6,noteGap:10,noteOffsetAfterMessage:8,noteStackGap:4,boxPad:10};function ai(e){return e+8}var oi=14,si=4;function ci(e,t,n){return 14+(0,c.measureMultilineText)(e,t,n).height/2}function li(e){return{...ii,actorHeight:e?.actorHeight??ii.actorHeight,headerGap:e?.headerGap??ii.headerGap,messageRowHeight:e?.messageRowHeight??ii.messageRowHeight,noteOffsetAfterMessage:e?.noteOffsetAfterMessage??ii.noteOffsetAfterMessage,noteStackGap:e?.noteStackGap??ii.noteStackGap}}function ui(e,t={}){if(e.actors.length===0)return{width:0,height:0,actors:[],lifelines:[],messages:[],activations:[],blocks:[],notes:[],boxes:[]};let n=li(t.sequence),r=A(t.fontSizes),i=e.actors.map(e=>{let t=T(e.label,r.nodeLabel,j.nodeLabel);return Math.max(t+n.actorPadX*2,80)}),a=[],o=n.padding+i[0]/2;for(let t=0;t<e.actors.length;t++){if(t>0){let e=Math.max(n.actorGap,(i[t-1]+i[t])/2+40);o+=e}a.push(o)}let s=new Map;for(let t=0;t<e.actors.length;t++)s.set(e.actors[t].id,t);let c=e.boxes.filter(e=>e.actorIds.length>0),l=c.some(e=>e.label!==``),u=c.length===0?0:n.boxPad+(l?ai(r.edgeLabel):0),d=n.padding+u,f=e.actors.map((e,t)=>({id:e.id,label:e.label,type:e.type,x:a[t],y:d,width:i[t],height:n.actorHeight})),p=c.map(e=>{let t=e.actorIds.map(e=>s.get(e)??0),r=Math.min(...t),o=Math.max(...t),c=a[r]-i[r]/2-n.boxPad,l=a[o]+i[o]/2+n.boxPad,u={label:e.label,x:c,y:n.padding,width:l-c,height:0};return e.color!==void 0&&(u.color=e.color),u}),m=e.actors.map(e=>e.type===`actor`?ci(e.label,r.nodeLabel,j.nodeLabel):0),h=Math.max(0,...e.actors.map((e,t)=>e.createdAt===void 0?m[t]:0)),g=r.edgeLabel+12,_=d+n.actorHeight+Math.max(n.headerGap,h>0?h+si+g:0),v=[],y=new Map;for(let t of e.blocks){let e=y.get(t.startIndex)??0;y.set(t.startIndex,Math.max(e,n.blockHeaderExtra));for(let e of t.dividers){let t=y.get(e.index)??0;y.set(e.index,Math.max(t,n.dividerExtra))}}let b=new Map;for(let t of e.notes){let e=b.get(t.afterIndex)??[];e.push(t),b.set(t.afterIndex,e)}let x=[],S=b.get(-1);if(S&&S.length>0){let e=_;for(let t of S){let o=Math.max(n.noteWidth,T(t.text,r.edgeLabel,j.edgeLabel)+n.notePadX*2),c=r.edgeLabel+n.notePadY*2,l=s.get(t.actorIds[0]??``)??0,u;if(t.position===`left`)u=a[l]-i[l]/2-o-n.noteGap;else if(t.position===`right`)u=a[l]+i[l]/2+n.noteGap;else if(t.actorIds.length>1){let e=s.get(t.actorIds[t.actorIds.length-1]??``)??l;u=(a[l]+a[e])/2-o/2}else u=a[l]-o/2;x.push({text:t.text,x:u,y:e,width:o,height:c,position:t.position,actors:t.actorIds}),e+=c+n.noteStackGap}_=Math.max(_,e+n.messageRowHeight/2)}let C=new Map,w=[],E=n.activationWidth/2;function D(e,t){let n=C.get(e)??[];C.set(e,n);let r=n.length;n.push({startY:t,depth:r})}function O(e,t){let r=C.get(e);if(!r||r.length===0)return;let{startY:i,depth:o}=r.pop(),c=s.get(e)??0,l=o*E;w.push({actorId:e,x:a[c]-n.activationWidth/2+l,topY:i,bottomY:t,width:n.activationWidth,depth:o})}let k=new Map;for(let t of e.activations){let e=k.get(t.afterIndex)??[];e.push(t),k.set(t.afterIndex,e)}function ee(e,t){for(let n of k.get(e)??[])n.kind===`start`?D(n.actorId,t):O(n.actorId,t)}ee(-1,_);for(let t=0;t<e.messages.length;t++){let o=e.messages[t],c=s.get(o.from)??0,l=s.get(o.to)??0,u=o.from===o.to,d=y.get(t)??0;d>0&&(_+=d);let f=a[c],p=a[l],m=!u&&e.actors[l].createdAt===t;if(m){let e=i[l]/2;p+=f<p?-e:e}v.push({from:o.from,to:o.to,label:o.label,lineStyle:o.lineStyle,arrowHead:o.arrowHead,x1:f,x2:p,y:_,isSelf:u,bidirectional:o.bidirectional??!1,seqNumber:o.seqNumber}),o.activate&&D(o.to,_),o.deactivate&&O(o.from,_),ee(t,_),_+=u?n.selfMessageHeight+n.messageRowHeight:n.messageRowHeight,m&&(_+=n.actorHeight/2);let h=b.get(t);if(h&&h.length>0){let e=u?n.selfMessageHeight:0,o=v[t].y+e+n.noteOffsetAfterMessage;for(let e of h){let t=Math.max(n.noteWidth,T(e.text,r.edgeLabel,j.edgeLabel)+n.notePadX*2),c=r.edgeLabel+n.notePadY*2,l=s.get(e.actorIds[0]??``)??0,u;if(e.position===`left`)u=a[l]-i[l]/2-t-n.noteGap;else if(e.position===`right`)u=a[l]+i[l]/2+n.noteGap;else if(e.actorIds.length>1){let n=s.get(e.actorIds[e.actorIds.length-1]??``)??l;u=(a[l]+a[n])/2-t/2}else u=a[l]-t/2;x.push({text:e.text,x:u,y:o,width:t,height:c,position:e.position,actors:e.actorIds}),o+=c+n.noteStackGap}_=Math.max(_,o+n.messageRowHeight/2)}}for(let[e,t]of C)for(let{startY:r,depth:i}of t){let t=s.get(e)??0,o=i*E;w.push({actorId:e,x:a[t]-n.activationWidth/2+o,topY:r,bottomY:_-n.messageRowHeight/2,width:n.activationWidth,depth:i})}w.sort((e,t)=>e.depth-t.depth);let M=e.blocks.map(t=>{let o=v[t.startIndex],c=v[t.endIndex],l=(o?.y??_)-n.blockPadTop,u=(c?.y??_)+n.blockPadBottom+12,d=new Set;for(let n=t.startIndex;n<=t.endIndex;n++){let t=e.messages[n];t&&(d.add(s.get(t.from)??0),d.add(s.get(t.to)??0))}if(d.size===0)for(let t=0;t<e.actors.length;t++)d.add(t);let f=Math.min(...d),p=Math.max(...d),m=a[f]-i[f]/2-n.blockPadX,h=a[p]+i[p]/2+n.blockPadX,g=t.dividers.map(e=>{let t=v[e.index],n=t?.y??_,i=28;if(e.label&&t?.label){let n=T(`[${e.label}]`,r.edgeLabel,j.edgeLabel),a=m+8,o=a+n,s=T(t.label,r.edgeLabel,j.edgeLabel),c=t.isSelf?t.x1+36:(t.x1+t.x2)/2-s/2,l=c+s;o>c&&a<l&&(i=36)}return{y:n-i,label:e.label}});return{type:t.type,label:t.label,x:m,y:l,width:h-m,height:u-l,dividers:g}}),N=x,P=_+n.padding,F=n.padding,I=0;for(let e of f)F=Math.min(F,e.x-e.width/2),I=Math.max(I,e.x+e.width/2);for(let e of M)F=Math.min(F,e.x),I=Math.max(I,e.x+e.width);for(let e of N)F=Math.min(F,e.x),I=Math.max(I,e.x+e.width);for(let e of p)F=Math.min(F,e.x),I=Math.max(I,e.x+e.width);for(let e of v)if(e.isSelf&&e.label){let t=e.x1+30+8,n=T(e.label,r.edgeLabel,j.edgeLabel);I=Math.max(I,t+n+8)}let L=F<n.padding?n.padding-F:0;if(L>0){for(let e of f)e.x+=L;for(let e of v)e.x1+=L,e.x2+=L;for(let e of w)e.x+=L;for(let e of M)e.x+=L;for(let e of N)e.x+=L;for(let e of p)e.x+=L;for(let e=0;e<a.length;e++)a[e]+=L}for(let t=0;t<e.actors.length;t++){let r=e.actors[t].createdAt;r!==void 0&&(f[t].y=(v[r]?.y??_)-n.actorHeight/2)}let te=e.actors.map((e,t)=>{let r=e.destroyedAt,i={actorId:e.id,x:a[t],topY:f[t].y+n.actorHeight+(m[t]>0?m[t]+si:0),bottomY:r===void 0?P-n.padding:v[r]?.y??_};return r!==void 0&&(i.destroyed=!0),i});for(let e of p)e.height=P-n.padding+n.boxPad-e.y;let ne=I+L+n.padding;return{width:Math.max(ne,200),height:Math.max(P,100),actors:f,lifelines:te,messages:v,activations:w,blocks:M,notes:N,boxes:p}}function di(e,t,n=`Inter`,r=!1,i=k,a,o,s,l={}){let u=[];u.push(nr((0,c.svgOpenTag)(e.width,e.height,t,r,o,s,void 0,l.styleAttribute),a)),u.push((0,c.buildStyleBlock)(n,!1,l.nonce)),u.push(`<defs>`),u.push(fi()),u.push(`</defs>`);for(let t of e.boxes)u.push(Ai(t,i));for(let t of e.blocks)u.push(ji(t,i));let d=Si(e,i);for(let t of e.lifelines)u.push(wi(t,d));for(let t of e.activations)u.push(Ei(t));for(let t of e.messages)u.push(Di(t,i));for(let t of e.notes)u.push(Mi(t,i));for(let t of e.actors)u.push(pi(t,i));return u.push(`</svg>`),u.join(`
35
+ `)}function fi(){let e=F.width,t=F.height;return c.f` <marker id="seq-arrow" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t/2}" orient="auto-start-reverse">`+c.f`\n <polygon points="0 0, ${e} ${t/2}, 0 ${t}" fill="var(--_arrow)" />`+`
34
36
  </marker>`+c.f`\n <marker id="seq-arrow-open" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t/2}" orient="auto-start-reverse">`+c.f`\n <polyline points="0 0, ${e} ${t/2}, 0 ${t}" fill="none" stroke="var(--_arrow)" stroke-width="1" />`+`
35
- </marker>`}function Yn(e,t){let{id:n,x:r,y:i,width:a,height:o,label:s,type:l}=e,u=[];if(u.push(c.f`<g class="actor" data-id="${(0,c.escapeAttr)(n)}" data-label="${(0,c.escapeAttr)(s)}" data-type="${l}">`),l===`actor`){let e=o/24*.9,n=r-12*e,a=i+(o-24*e)/2,l=P.outerBox/e,d=`var(--_line)`;u.push(c.f` <g transform="translate(${n},${a}) scale(${e})">`+c.f`\n <path d="M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z" fill="none" stroke="${d}" stroke-width="${l}" />`+c.f`\n <path d="M15 10C15 11.6569 13.6569 13 12 13C10.3431 13 9 11.6569 9 10C9 8.34315 10.3431 7 12 7C13.6569 7 15 8.34315 15 10Z" fill="none" stroke="${d}" stroke-width="${l}" />`+c.f`\n <path d="M5.62842 18.3563C7.08963 17.0398 9.39997 16 12 16C14.6 16 16.9104 17.0398 18.3716 18.3563" fill="none" stroke="${d}" stroke-width="${l}" />`+`
36
- </g>`),u.push(` `+(0,c.renderMultilineText)(s,r,i+o+14,t.nodeLabel,c.f`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${j.nodeLabel}" fill="var(--_text)"`))}else{let e=r-a/2;u.push(c.f` <rect x="${e}" y="${i}" width="${a}" height="${o}" rx="4" ry="4" `+c.f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${P.outerBox}" />`),u.push(` `+(0,c.renderMultilineText)(s,r,i+o/2,t.nodeLabel,c.f`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${j.nodeLabel}" fill="var(--_text)"`))}return u.push(`</g>`),u.join(`
37
- `)}function Xn(e){let t=c.f`<line class="lifeline" data-actor="${(0,c.escapeAttr)(e.actorId)}" `+c.f`x1="${e.x}" y1="${e.topY}" x2="${e.x}" y2="${e.bottomY}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`;if(!e.destroyed)return t;let{x:n,bottomY:r}=e,i=Zn;return t+c.f`\n<path class="destroy" data-actor="${(0,c.escapeAttr)(e.actorId)}" `+c.f`d="M${n-i} ${r-i} L${n+i} ${r+i} M${n+i} ${r-i} L${n-i} ${r+i}" `+c.f`fill="none" stroke="var(--_line)" stroke-width="${P.outerBox}" stroke-linecap="round" />`}var Zn=8;function Qn(e){return c.f`<rect class="activation" data-actor="${(0,c.escapeAttr)(e.actorId)}" `+c.f`x="${e.x}" y="${e.topY}" width="${e.width}" height="${e.bottomY-e.topY}" `+c.f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${P.innerBox}" />`}function $n(e,t){let n=[],r=e.lineStyle===`dashed`?` stroke-dasharray="6 4"`:``,i=e.arrowHead===`filled`?`seq-arrow`:`seq-arrow-open`,a=e.bidirectional?c.f` marker-start="url(#${i})"`:``;if(n.push(c.f`<g class="message" data-from="${(0,c.escapeAttr)(e.from)}" data-to="${(0,c.escapeAttr)(e.to)}" `+c.f`data-label="${(0,c.escapeAttr)(e.label)}" data-line-style="${e.lineStyle}" `+c.f`data-arrow-head="${e.arrowHead}" data-self="${e.isSelf}" data-bidirectional="${e.bidirectional}">`),e.isSelf)n.push(c.f` <polyline points="${e.x1},${e.y} ${e.x1+30},${e.y} ${e.x1+30},${e.y+20} ${e.x2},${e.y+20}" `+c.f`fill="none" stroke="var(--_line)" stroke-width="${P.connector}"${r} marker-end="url(#${i})"${a} />`),n.push(` `+(0,c.renderMultilineText)(e.label,e.x1+30+8,e.y+10,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`));else{n.push(c.f` <line x1="${e.x1}" y1="${e.y}" x2="${e.x2}" y2="${e.y}" `+c.f`stroke="var(--_line)" stroke-width="${P.connector}"${r} marker-end="url(#${i})"${a} />`);let o=(e.x1+e.x2)/2;n.push(` `+(0,c.renderMultilineText)(e.label,o,e.y-10,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`))}return e.seqNumber!==void 0&&n.push(` `+er(e,t)),n.push(`</g>`),n.join(`
38
- `)}function er(e,t){let n=Math.max(t.edgeLabel-2,8),r=e.bidirectional?e.x1+Math.sign(e.x2-e.x1)*(8+I.width):e.x1;return`<g class="seq-number">`+c.f`<circle cx="${r}" cy="${e.y}" r="${8}" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="${P.innerBox}" />`+(0,c.renderMultilineText)(String(e.seqNumber),r,e.y,n,c.f`font-size="${n}" text-anchor="middle" font-weight="${j.edgeLabel}" fill="var(--_arrow)"`)+`</g>`}var tr=35;function nr(e,t){let n=e.label?c.f` data-label="${(0,c.escapeAttr)(e.label)}"`:``,r=e.color===void 0?``:c.f` data-color="${(0,c.escapeAttr)(e.color)}"`,i=e.color===void 0?`none`:c.f`color-mix(in srgb, ${(0,c.escapeAttr)(e.color)} ${tr}%, var(--bg))`,a=[c.f`<g class="participant-box"${n}${r}>`,c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="4" ry="4" `+c.f`fill="${i}" stroke="var(--_node-stroke)" stroke-width="${P.innerBox}" />`];return e.label&&a.push(` `+(0,c.renderMultilineText)(e.label,e.x+e.width/2,e.y+Wn(t.edgeLabel)/2,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${j.groupHeader}" fill="var(--_text-sec)"`)),a.push(`</g>`),a.join(`
39
- `)}function rr(e,t){let n=[],r=e.label?c.f` data-label="${(0,c.escapeAttr)(e.label)}"`:``;n.push(c.f`<g class="block" data-type="${(0,c.escapeAttr)(e.type)}"${r}>`),n.push(c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+c.f`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${P.outerBox}" />`);let i=c.f`${e.type}${e.label?c.f` [${e.label}]`:``}`,a=i.split(`
40
- `)[0],o=T(a,t.edgeLabel,j.groupHeader)+16;n.push(c.f` <rect x="${e.x}" y="${e.y}" width="${o}" height="${18}" `+c.f`fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${P.outerBox}" />`),n.push(` `+(0,c.renderMultilineText)(i,e.x+6,e.y+9,t.edgeLabel,c.f`font-size="${t.edgeLabel}" font-weight="${j.groupHeader}" fill="var(--_text-sec)"`));for(let r of e.dividers)n.push(c.f` <line x1="${e.x}" y1="${r.y}" x2="${e.x+e.width}" y2="${r.y}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`),r.label&&n.push(` `+(0,c.renderMultilineText)(c.f`[${r.label}]`,e.x+8,r.y+14,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`));return n.push(`</g>`),n.join(`
41
- `)}function ir(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.actors&&e.actors.length>0?c.f` data-actors="${e.actors.map(c.escapeAttr).join(`,`)}"`:``,s=e.position?c.f` data-position="${(0,c.escapeAttr)(e.position)}"`:``,l=[c.f`${n},${r}`,c.f`${n+i-6},${r}`,c.f`${n+i},${r+6}`,c.f`${n+i},${r+a}`,c.f`${n},${r+a}`].join(` `);return c.f`<g class="note"${s}${o}>`+c.f`\n <polygon points="${l}" `+c.f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${P.innerBox}" />`+c.f`\n <polygon points="${n+i-6},${r} ${n+i},${r+6} ${n+i-6},${r+6}" `+c.f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${P.innerBox}" />`+c.f`\n ${(0,c.renderMultilineText)(e.text,n+i/2,r+a/2,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`)}`+`
42
- </g>`}var K={plotWidth:600,plotHeight:340,padding:22,titleFontSize:18,titleFontWeight:600,titleHeight:42,axisLabelFontSize:14,axisLabelFontWeight:400,axisTitleFontSize:15,axisTitleFontWeight:500,xLabelHeight:38,yLabelWidth:58,yLabelGap:18,axisTitlePad:30,tickLength:4,barPadRatio:.2,barGroupGap:0,maxBarWidth:40,legendFontSize:14,legendFontWeight:400,legendHeight:28,legendSwatchW:14,legendSwatchH:14,legendGap:6,legendItemGap:16};function ar(e,t={}){return e.horizontal?sr(e):or(e)}function or(e){let t=!!e.title,n=!!e.xAxis.title,r=!!e.yAxis.title,i=e.series.length>1,a=e.yAxis.range;if(!a)throw Error(`XY chart: y-axis range was not set by the parser`);let o=pr(a.min,a.max),s=mr(o),c=Math.max(...s.map(e=>T(e,K.axisLabelFontSize,K.axisLabelFontWeight)),K.yLabelWidth),l=K.padding+(t?K.titleHeight:0)+(i?K.legendHeight:0),u=K.padding+K.xLabelHeight+(n?K.axisTitlePad:0),d=K.padding+c+K.yLabelGap+(r?K.axisTitlePad:0),f=K.padding,p=K.plotWidth,m=K.plotHeight,h=d+p+f,g=l+m+u,_={x:d,y:l,width:p,height:m},v=cr(e),y=e=>d+(e+.5)*(p/v),b=p/v,x=e=>{let t=(e-a.min)/(a.max-a.min||1);return l+m-t*m},S=ur(e,y,l+m,b),C=o.map((e,t)=>({label:s[t],x:d,y:x(e),tx:d-K.tickLength,ty:x(e),labelX:d-K.yLabelGap,labelY:x(e),textAnchor:`end`})),w=o.map(e=>({x1:d,y1:x(e),x2:d+p,y2:x(e)})),E=lr(e,v),D=e.series.map((e,t)=>t),O=dr(e,y,x,b,a.min,E,D),k=fr(e,y,x,E,D),A=K.padding+(t?K.titleHeight:0)+K.legendHeight/2,j=i?gr(e,h/2,A,D):[],M={x1:d,y1:l+m,x2:d+p,y2:l+m},N={x1:d,y1:l,x2:d,y2:l+m},P={ticks:S,line:M,...e.xAxis.title?{title:{text:e.xAxis.title,x:d+p/2,y:g-K.padding}}:{}},F={ticks:C,line:N,...e.yAxis.title?{title:{text:e.yAxis.title,x:K.padding+4,y:l+m/2,rotate:-90}}:{}};return{width:h,height:g,title:e.title?{text:e.title,x:h/2,y:K.padding+K.titleFontSize}:void 0,xAxis:P,yAxis:F,plotArea:_,bars:O,lines:k,gridLines:w,legend:j}}function sr(e){let t=!!e.title,n=!!e.xAxis.title,r=!!e.yAxis.title,i=e.series.length>1,a=e.yAxis.range;if(!a)throw Error(`XY chart: y-axis range was not set by the parser`);let o=pr(a.min,a.max),s=mr(o),c=cr(e),l=lr(e,c),u=Math.max(...l.map(e=>T(e,K.axisLabelFontSize,K.axisLabelFontWeight)),40),d=K.padding+(t?K.titleHeight:0)+(i?K.legendHeight:0),f=K.padding+K.xLabelHeight+(r?K.axisTitlePad:0),p=K.padding+u+K.yLabelGap+(n?K.axisTitlePad:0),m=K.padding,h=K.plotWidth,g=K.plotHeight,_=p+h+m,v=d+g+f,y={x:p,y:d,width:h,height:g},b=e=>{let t=(e-a.min)/(a.max-a.min||1);return p+t*h},x=g/c,S=e=>d+(e+.5)*x,C=o.map((e,t)=>({label:s[t],x:b(e),y:d+g,tx:b(e),ty:d+g+K.tickLength,labelX:b(e),labelY:d+g+18,textAnchor:`middle`})),w=l.map((e,t)=>({label:e,x:p,y:S(t),tx:p-K.tickLength,ty:S(t),labelX:p-K.yLabelGap,labelY:S(t),textAnchor:`end`})),E=o.map(e=>({x1:b(e),y1:d,x2:b(e),y2:d+g})),D=e.series.map((e,t)=>t),O=e.series.filter(e=>e.type===`bar`).length,k=[];if(O>0){let t=x*(1-K.barPadRatio),n=O>1?(t-(O-1)*K.barGroupGap)/O:t,r=Math.min(n,K.maxBarWidth),i=O>1?r*O+K.barGroupGap*(O-1):r,o=0,s=0;for(let t of e.series){if(t.type!==`bar`){s++;continue}for(let e=0;e<t.data.length;e++){let n=S(e)-i/2+o*(r+K.barGroupGap),c=b(Math.max(t.data[e],a.min)),u=b(Math.max(0,a.min));k.push({x:Math.min(u,c),y:n,width:Math.abs(c-u),height:r,value:t.data[e],label:l[e],seriesIndex:o,colorIndex:D[s]})}o++,s++}}let A=[],j=0,M=0;for(let t of e.series){if(t.type!==`line`){M++;continue}let e=t.data.map((e,t)=>({x:b(e),y:S(t),value:e,label:l[t]}));A.push({points:e,seriesIndex:j,colorIndex:D[M]}),j++,M++}let N={x1:p,y1:d+g,x2:p+h,y2:d+g},P={x1:p,y1:d,x2:p,y2:d+g},F={ticks:C,line:N,...e.yAxis.title?{title:{text:e.yAxis.title,x:p+h/2,y:v-K.padding}}:{}},I={ticks:w,line:P,...e.xAxis.title?{title:{text:e.xAxis.title,x:K.padding+4,y:d+g/2,rotate:-90}}:{}},L=e.title?{text:e.title,x:_/2,y:K.padding+K.titleFontSize}:void 0,ee=K.padding+(t?K.titleHeight:0)+K.legendHeight/2;return{width:_,height:v,horizontal:!0,title:L,xAxis:F,yAxis:I,plotArea:y,bars:k,lines:A,gridLines:E,legend:i?gr(e,_/2,ee,D):[]}}function cr(e){if(e.xAxis.categories)return e.xAxis.categories.length;for(let t of e.series)if(t.data.length>0)return t.data.length;return 1}function lr(e,t){if(e.xAxis.categories)return e.xAxis.categories;if(e.xAxis.range){let{min:n,max:r}=e.xAxis.range,i=t>1?(r-n)/(t-1):0;return Array.from({length:t},(e,t)=>hr(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}function ur(e,t,n,r){return lr(e,cr(e)).map((e,r)=>({label:e,x:t(r),y:n,tx:t(r),ty:n+K.tickLength,labelX:t(r),labelY:n+18,textAnchor:`middle`}))}function dr(e,t,n,r,i,a,o){let s=e.series.filter(e=>e.type===`bar`).length;if(s===0)return[];let c=r*(1-K.barPadRatio),l=s>1?(c-(s-1)*K.barGroupGap)/s:c,u=Math.min(l,K.maxBarWidth),d=s>1?u*s+K.barGroupGap*(s-1):u,f=[],p=0,m=0;for(let r of e.series){if(r.type!==`bar`){m++;continue}for(let e=0;e<r.data.length;e++){let s=t(e)-d/2+p*(u+K.barGroupGap),c=n(r.data[e]),l=n(Math.max(0,i));f.push({x:s,y:Math.min(c,l),width:u,height:Math.abs(l-c),value:r.data[e],label:a[e],seriesIndex:p,colorIndex:o[m]})}p++,m++}return f}function fr(e,t,n,r,i){let a=[],o=0,s=0;for(let c of e.series){if(c.type!==`line`){s++;continue}let e=c.data.map((e,i)=>({x:t(i),y:n(e),value:e,label:r[i]}));a.push({points:e,seriesIndex:o,colorIndex:i[s]}),o++,s++}return a}function pr(e,t){let n=t-e;if(n<=0)return[e];let r=n/6,i=10**Math.floor(Math.log10(r)),a=r/i,o;o=a<=1.5?i:a<=3?2*i:a<=7?5*i:10*i;let s=Math.ceil(e/o)*o,c=[];for(let e=s;e<=t+o*.001;e+=o)c.push(Math.round(e*1e10)/1e10);return c}function mr(e){let t=e.length>1?Math.abs(e[1]-e[0]):0,n=t>0&&t<1?Math.ceil(-Math.log10(t)-1e-9):0;return e.map(e=>String(Number.isInteger(e)&&n===0?e:Number(e.toFixed(n))))}function hr(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function gr(e,t,n,r){let i=[],a=0,o=0;for(let t=0;t<e.series.length;t++){let s=e.series[t],c=s.type===`bar`?`Bar ${a+1}`:`Line ${o+1}`;i.push({label:c,x:0,y:n,type:s.type,seriesIndex:s.type===`bar`?a:o,colorIndex:r[t]}),s.type===`bar`?a++:o++}let s=i.map(e=>{let t=T(e.label,K.legendFontSize,K.legendFontWeight);return K.legendSwatchW+K.legendGap+t}),c=t-(s.reduce((e,t)=>e+t,0)+(i.length-1)*K.legendItemGap)/2;for(let e=0;e<i.length;e++)i[e].x=c,c+=s[e]+K.legendItemGap;return i}var q={titleSize:18,titleWeight:600,axisTitleSize:15,axisTitleWeight:500,labelSize:14,labelWeight:400,legendSize:14,legendWeight:400,dotRadius:5,lineWidth:2.5,barRadius:8},J={fontSize:15,fontWeight:500,height:32,padX:14,offsetY:12,rx:8,minY:4,pointerSize:6};function _r(e,t,n=`Inter`,r=!1,i=!1,a,o,s,l={}){let u=[],d=Math.max(0,...e.bars.map(e=>e.colorIndex),...e.lines.map(e=>e.colorIndex)),f=V((0,c.svgOpenTag)(e.width,e.height,t,r,o,s,void 0,l.styleAttribute).replace(`<svg `,`<svg data-xychart-colors="${d}" `),a);u.push(f),u.push((0,c.buildStyleBlock)(n,!1,l.nonce));let p=Math.max(...e.lines.map(e=>e.points.length),0),m=p>0&&p<=12,{style:h,defs:g}=vr(e,i,m,t.accent,t.bg,l.nonce);u.push(h),g&&u.push(g);let{plotArea:_}=e,v=e.xAxis.ticks.map(e=>e.x),y=e.horizontal?e.yAxis.ticks.map(e=>e.y):e.gridLines.map(e=>e.y1),b=v.length>1?Math.abs(v[1]-v[0]):_.width/6,x=y.length>1?Math.abs(y[1]-y[0]):_.height/6,S=b/Math.max(1,Math.round(b/20)),C=x/Math.max(1,Math.round(x/20)),w=v[0]??_.x,T=y[0]??_.y,E=w-Math.ceil((w-_.x)/S)*S,D=T-Math.ceil((T-_.y)/C)*C;for(let e=D;e<=_.y+_.height+.5;e+=C)for(let t=E;t<=_.x+_.width+.5;t+=S)u.push(`<circle cx="${Y(t)}" cy="${Y(e)}" r="1.5" class="xychart-grid"/>`);let O=[];for(let t of e.bars){let n=` data-value="${t.value}"${t.label?` data-label="${X(t.label)}"`:``}`,r=e.horizontal?br(t.x,t.y,t.width,t.height,q.barRadius):yr(t.x,t.y,t.width,t.height,q.barRadius);if(u.push(`<path d="${r}" class="xychart-bar xychart-color-${t.colorIndex}"${n}/>`),i){let e=wr(t.value),n=t.label?`${t.label}: ${e}`:e,r=Cr(t.x+t.width/2,t.y,e);O.push(`<g class="xychart-bar-group"><rect x="${Y(t.x)}" y="${Y(t.y)}" width="${Y(t.width)}" height="${Y(t.height)}" fill="transparent"/><title>${X(n)}</title>`+r+`</g>`)}}for(let t of e.lines){if(t.points.length===0)continue;let e=xr(t.points);u.push(`<path d="${e}" class="xychart-line-shadow xychart-color-${t.colorIndex}" transform="translate(0,2)"/>`),u.push(`<path d="${e}" class="xychart-line xychart-color-${t.colorIndex}"/>`)}let k=[];if(i||m){let t=new Map;for(let n of e.legend)n.type===`line`&&t.set(n.seriesIndex,n.label);let n=new Map;for(let t of e.lines)for(let e of t.points){let r=Y(e.x),i=n.get(r)??[];n.set(r,i),i.push({x:e.x,y:e.y,value:e.value,label:e.label,seriesIndex:t.seriesIndex,colorIndex:t.colorIndex})}for(let e of n.values()){let n=e[0].x,r=e[0].label||``;if(i&&e.length>1){let i=Math.min(...e.map(e=>e.y)),a=Math.max(...e.map(e=>e.y)),o=q.dotRadius*3,s=`<rect x="${Y(n-o)}" y="${Y(i-o)}" width="${Y(o*2)}" height="${Y(a-i+o*2)}" fill="transparent" class="xychart-hit"/>`,c=e.map(e=>({text:wr(e.value),legendLabel:t.get(e.seriesIndex)||`Line ${e.seriesIndex+1}`})),l=Sr(n,i-q.dotRadius,r,c),u=c.map(e=>e.text),d=r?`${r}: ${u.join(` · `)}`:u.join(` · `),f=`<g class="xychart-dot-group">${s}`;for(let t of e){let e=` data-value="${t.value}"${t.label?` data-label="${X(t.label)}"`:``}`;f+=`<circle cx="${Y(t.x)}" cy="${Y(t.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`}f+=`<title>${X(d)}</title>${l}</g>`,k.push(f)}else if(i){let t=e[0],r=` data-value="${t.value}"${t.label?` data-label="${X(t.label)}"`:``}`,i=wr(t.value),a=t.label?`${t.label}: ${i}`:i,o=Cr(n,t.y-q.dotRadius,i),s=m?`<circle cx="${Y(n)}" cy="${Y(t.y)}" r="${q.dotRadius*3}" fill="transparent" class="xychart-hit"/>`:``;k.push(`<g class="xychart-dot-group">${s}<circle cx="${Y(t.x)}" cy="${Y(t.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${r}/><title>${X(a)}</title>${o}</g>`)}else for(let t of e){let e=` data-value="${t.value}"${t.label?` data-label="${X(t.label)}"`:``}`;u.push(`<circle cx="${Y(t.x)}" cy="${Y(t.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`)}}}for(let t of e.xAxis.ticks)u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${q.labelSize}" font-weight="${q.labelWeight}" dy="${F}" class="xychart-label">${X(t.label)}</text>`);for(let t of e.yAxis.ticks)u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${q.labelSize}" font-weight="${q.labelWeight}" dy="${F}" class="xychart-label">${X(t.label)}</text>`);if(e.xAxis.title){let t=e.xAxis.title,n=t.rotate?` transform="rotate(${t.rotate},${t.x},${t.y})"`:``;u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${q.axisTitleSize}" font-weight="${q.axisTitleWeight}" dy="${F}" class="xychart-axis-title">${X(t.text)}</text>`)}if(e.yAxis.title){let t=e.yAxis.title,n=t.rotate?` transform="rotate(${t.rotate},${t.x},${t.y})"`:``;u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${q.axisTitleSize}" font-weight="${q.axisTitleWeight}" dy="${F}" class="xychart-axis-title">${X(t.text)}</text>`)}e.title&&u.push(`<text x="${e.title.x}" y="${e.title.y}" text-anchor="middle" font-size="${q.titleSize}" font-weight="${q.titleWeight}" dy="${F}" class="xychart-title">${X(e.title.text)}</text>`);for(let t of e.legend){if(t.type===`bar`)u.push(`<rect x="${t.x}" y="${t.y-7}" width="14" height="14" rx="3" class="xychart-bar xychart-color-${t.colorIndex}"/>`);else{let e=t.y;u.push(`<line x1="${t.x}" y1="${e}" x2="${t.x+14}" y2="${e}" stroke-width="${q.lineWidth}" stroke-linecap="round" class="xychart-legend-line xychart-color-${t.colorIndex}"/>`)}u.push(`<text x="${t.x+14+6}" y="${t.y}" text-anchor="start" font-size="${q.legendSize}" font-weight="${q.legendWeight}" dy="${F}" class="xychart-label">${X(t.label)}</text>`)}for(let e of O)u.push(e);for(let e of k)u.push(e);return u.push(`</svg>`),u.join(`
43
- `)}function vr(e,t,n,r,i,a){let o=r??u.CHART_ACCENT_FALLBACK,s=new Set;for(let t of e.bars)s.add(t.colorIndex);for(let t of e.lines)s.add(t.colorIndex);let l=[];for(let e of[...s].sort((e,t)=>e-t)){let t=e===0?`var(--accent, ${u.CHART_ACCENT_FALLBACK})`:(0,u.getSeriesColor)(e,o,i);l.push(` --xychart-color-${e}: ${t};`),l.push(` --xychart-bar-fill-${e}: color-mix(in srgb, var(--bg) 75%, var(--xychart-color-${e}) 25%);`)}let d=[];for(let e of[...s].sort((e,t)=>e-t)){let t=`var(--xychart-color-${e})`;d.push(` .xychart-bar.xychart-color-${e} { stroke: ${t}; fill: var(--xychart-bar-fill-${e}); }`),d.push(` path.xychart-color-${e}, line.xychart-color-${e} { stroke: ${t}; }`),d.push(` circle.xychart-color-${e} { fill: ${t}; }`)}let f=t?`
37
+ </marker>`}function pi(e,t){let{id:n,x:r,y:i,width:a,height:o,label:s,type:l}=e,u=[];if(u.push(c.f`<g class="actor" data-id="${(0,c.escapeAttr)(n)}" data-label="${(0,c.escapeAttr)(s)}" data-type="${l}">`),l===`actor`){let e=o/24*.9,n=r-12*e,a=i+(o-24*e)/2,l=N.outerBox/e,d=`var(--_line)`;u.push(c.f` <g transform="translate(${n},${a}) scale(${e})">`+c.f`\n <path d="M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z" fill="none" stroke="${d}" stroke-width="${l}" />`+c.f`\n <path d="M15 10C15 11.6569 13.6569 13 12 13C10.3431 13 9 11.6569 9 10C9 8.34315 10.3431 7 12 7C13.6569 7 15 8.34315 15 10Z" fill="none" stroke="${d}" stroke-width="${l}" />`+c.f`\n <path d="M5.62842 18.3563C7.08963 17.0398 9.39997 16 12 16C14.6 16 16.9104 17.0398 18.3716 18.3563" fill="none" stroke="${d}" stroke-width="${l}" />`+`
38
+ </g>`),u.push(` `+(0,c.renderMultilineText)(s,r,i+o+14,t.nodeLabel,c.f`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${j.nodeLabel}" fill="var(--_text)"`))}else{let e=r-a/2;u.push(c.f` <rect x="${e}" y="${i}" width="${a}" height="${o}" rx="4" ry="4" `+c.f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${N.outerBox}" />`),u.push(` `+(0,c.renderMultilineText)(s,r,i+o/2,t.nodeLabel,c.f`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${j.nodeLabel}" fill="var(--_text)"`))}return u.push(`</g>`),u.join(`
39
+ `)}var mi=30,hi=20,gi=8,_i=10,vi=18,yi=3,bi=2,xi=3;function Si(e,t){let n=[],r=e=>(0,c.measureMultilineText)(e,t.edgeLabel,j.edgeLabel),i=(e,t,i)=>{let a=r(e);n.push({x0:t-a.width/2,x1:t+a.width/2,y0:i-a.height/2,y1:i+a.height/2})},a=(e,t,i)=>{let a=r(e);n.push({x0:t,x1:t+a.width,y0:i-a.height/2,y1:i+a.height/2})};for(let t of e.messages)t.label&&(t.isSelf?a(t.label,t.x1+mi+gi,t.y+hi/2):i(t.label,(t.x1+t.x2)/2,t.y-_i));for(let r of e.blocks){let e=T(`${r.type}${r.label?` [${r.label}]`:``}`.split(`
40
+ `)[0]??``,t.edgeLabel,j.groupHeader)+16;n.push({x0:r.x,x1:r.x+e,y0:r.y,y1:r.y+vi});for(let e of r.dividers)e.label&&a(`[${e.label}]`,r.x+8,e.y+14)}return n}function Ci(e,t){let n=t.filter(t=>e.x>t.x0-yi&&e.x<t.x1+yi&&t.y1+bi>e.topY&&t.y0-bi<e.bottomY).map(e=>[e.y0-bi,e.y1+bi]).sort((e,t)=>e[0]-t[0]),r=[],i=e.topY;for(let[e,t]of n)e-i>=xi&&r.push([i,e]),i=Math.max(i,t);return e.bottomY-i>=xi&&r.push([i,e.bottomY]),r.length>0?r:[[e.topY,e.bottomY]]}function wi(e,t){let n=Ci(e,t).map(([t,n])=>c.f`<line class="lifeline" data-actor="${(0,c.escapeAttr)(e.actorId)}" `+c.f`x1="${e.x}" y1="${t}" x2="${e.x}" y2="${n}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`).join(`
41
+ `);if(!e.destroyed)return n;let{x:r,bottomY:i}=e,a=Ti;return n+c.f`\n<path class="destroy" data-actor="${(0,c.escapeAttr)(e.actorId)}" `+c.f`d="M${r-a} ${i-a} L${r+a} ${i+a} M${r+a} ${i-a} L${r-a} ${i+a}" `+c.f`fill="none" stroke="var(--_line)" stroke-width="${N.outerBox}" stroke-linecap="round" />`}var Ti=8;function Ei(e){return c.f`<rect class="activation" data-actor="${(0,c.escapeAttr)(e.actorId)}" `+c.f`x="${e.x}" y="${e.topY}" width="${e.width}" height="${e.bottomY-e.topY}" `+c.f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${N.innerBox}" />`}function Di(e,t){let n=[],r=e.lineStyle===`dashed`?` stroke-dasharray="6 4"`:``,i=e.arrowHead===`filled`?`seq-arrow`:`seq-arrow-open`,a=e.bidirectional?c.f` marker-start="url(#${i})"`:``;if(n.push(c.f`<g class="message" data-from="${(0,c.escapeAttr)(e.from)}" data-to="${(0,c.escapeAttr)(e.to)}" `+c.f`data-label="${(0,c.escapeAttr)(e.label)}" data-line-style="${e.lineStyle}" `+c.f`data-arrow-head="${e.arrowHead}" data-self="${e.isSelf}" data-bidirectional="${e.bidirectional}">`),e.isSelf){let o=mi,s=hi,l=gi;n.push(c.f` <polyline points="${e.x1},${e.y} ${e.x1+o},${e.y} ${e.x1+o},${e.y+s} ${e.x2},${e.y+s}" `+c.f`fill="none" stroke="var(--_line)" stroke-width="${N.connector}"${r} marker-end="url(#${i})"${a} />`),n.push(` `+(0,c.renderMultilineText)(e.label,e.x1+o+l,e.y+s/2,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`))}else{n.push(c.f` <line x1="${e.x1}" y1="${e.y}" x2="${e.x2}" y2="${e.y}" `+c.f`stroke="var(--_line)" stroke-width="${N.connector}"${r} marker-end="url(#${i})"${a} />`);let o=(e.x1+e.x2)/2;n.push(` `+(0,c.renderMultilineText)(e.label,o,e.y-_i,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`))}return e.seqNumber!==void 0&&n.push(` `+Oi(e,t)),n.push(`</g>`),n.join(`
42
+ `)}function Oi(e,t){let n=Math.max(t.edgeLabel-2,8),r=e.bidirectional?e.x1+Math.sign(e.x2-e.x1)*(8+F.width):e.x1;return`<g class="seq-number">`+c.f`<circle cx="${r}" cy="${e.y}" r="${8}" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="${N.innerBox}" />`+(0,c.renderMultilineText)(String(e.seqNumber),r,e.y,n,c.f`font-size="${n}" text-anchor="middle" font-weight="${j.edgeLabel}" fill="var(--_arrow)"`)+`</g>`}var ki=35;function Ai(e,t){let n=e.label?c.f` data-label="${(0,c.escapeAttr)(e.label)}"`:``,r=e.color===void 0?``:c.f` data-color="${(0,c.escapeAttr)(e.color)}"`,i=e.color===void 0?`none`:c.f`color-mix(in srgb, ${(0,c.escapeAttr)(e.color)} ${ki}%, var(--bg))`,a=[c.f`<g class="participant-box"${n}${r}>`,c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="4" ry="4" `+c.f`fill="${i}" stroke="var(--_node-stroke)" stroke-width="${N.innerBox}" />`];return e.label&&a.push(` `+(0,c.renderMultilineText)(e.label,e.x+e.width/2,e.y+ai(t.edgeLabel)/2,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${j.groupHeader}" fill="var(--_text-sec)"`)),a.push(`</g>`),a.join(`
43
+ `)}function ji(e,t){let n=[],r=e.label?c.f` data-label="${(0,c.escapeAttr)(e.label)}"`:``;n.push(c.f`<g class="block" data-type="${(0,c.escapeAttr)(e.type)}"${r}>`),n.push(c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+c.f`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${N.outerBox}" />`);let i=c.f`${e.type}${e.label?c.f` [${e.label}]`:``}`,a=i.split(`
44
+ `)[0],o=T(a,t.edgeLabel,j.groupHeader)+16,s=vi;n.push(c.f` <rect x="${e.x}" y="${e.y}" width="${o}" height="${s}" `+c.f`fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${N.outerBox}" />`),n.push(` `+(0,c.renderMultilineText)(i,e.x+6,e.y+s/2,t.edgeLabel,c.f`font-size="${t.edgeLabel}" font-weight="${j.groupHeader}" fill="var(--_text-sec)"`));for(let r of e.dividers)n.push(c.f` <line x1="${e.x}" y1="${r.y}" x2="${e.x+e.width}" y2="${r.y}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`),r.label&&n.push(` `+(0,c.renderMultilineText)(c.f`[${r.label}]`,e.x+8,r.y+14,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`));return n.push(`</g>`),n.join(`
45
+ `)}function Mi(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.actors&&e.actors.length>0?c.f` data-actors="${e.actors.map(c.escapeAttr).join(`,`)}"`:``,s=e.position?c.f` data-position="${(0,c.escapeAttr)(e.position)}"`:``,l=[c.f`${n},${r}`,c.f`${n+i-6},${r}`,c.f`${n+i},${r+6}`,c.f`${n+i},${r+a}`,c.f`${n},${r+a}`].join(` `);return c.f`<g class="note"${s}${o}>`+c.f`\n <polygon points="${l}" `+c.f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${N.innerBox}" />`+c.f`\n <polygon points="${n+i-6},${r} ${n+i},${r+6} ${n+i-6},${r+6}" `+c.f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${N.innerBox}" />`+c.f`\n ${(0,c.renderMultilineText)(e.text,n+i/2,r+a/2,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${j.edgeLabel}" fill="var(--_text-muted)"`)}`+`
46
+ </g>`}var G={plotWidth:600,plotHeight:340,padding:22,titleFontSize:18,titleFontWeight:600,titleHeight:42,axisLabelFontSize:14,axisLabelFontWeight:400,axisTitleFontSize:15,axisTitleFontWeight:500,xLabelHeight:38,yLabelWidth:58,yLabelGap:18,axisTitlePad:30,tickLength:4,barPadRatio:.2,barGroupGap:0,maxBarWidth:40,legendFontSize:14,legendFontWeight:400,legendHeight:28,legendSwatchW:14,legendSwatchH:14,legendGap:6,legendItemGap:16};function Ni(e,t={}){return e.horizontal?Fi(e):Pi(e)}function Pi(e){let t=!!e.title,n=!!e.xAxis.title,r=!!e.yAxis.title,i=e.series.length>1,a=e.yAxis.range;if(!a)throw Error(`XY chart: y-axis range was not set by the parser`);let o=Ui(a.min,a.max),s=Wi(o),c=Math.max(...s.map(e=>T(e,G.axisLabelFontSize,G.axisLabelFontWeight)),G.yLabelWidth),l=G.padding+(t?G.titleHeight:0)+(i?G.legendHeight:0),u=G.padding+G.xLabelHeight+(n?G.axisTitlePad:0),d=G.padding+c+G.yLabelGap+(r?G.axisTitlePad:0),f=G.padding,p=G.plotWidth,m=G.plotHeight,h=d+p+f,g=l+m+u,_={x:d,y:l,width:p,height:m},v=Ii(e),y=e=>d+(e+.5)*(p/v),b=p/v,x=e=>{let t=(e-a.min)/(a.max-a.min||1);return l+m-t*m},S=Bi(e,y,l+m,b),C=o.map((e,t)=>({label:s[t],x:d,y:x(e),tx:d-G.tickLength,ty:x(e),labelX:d-G.yLabelGap,labelY:x(e),textAnchor:`end`})),w=o.map(e=>({x1:d,y1:x(e),x2:d+p,y2:x(e)})),E=Li(e,v),D=e.series.map((e,t)=>t),O=Vi(e,y,x,b,a.min,E,D),k=Hi(e,y,x,E,D),A=G.padding+(t?G.titleHeight:0)+G.legendHeight/2,j=i?Ki(e,h/2,A,D):[],ee={x1:d,y1:l+m,x2:d+p,y2:l+m},M={x1:d,y1:l,x2:d,y2:l+m},N={ticks:S,line:ee,...e.xAxis.title?{title:{text:e.xAxis.title,x:d+p/2,y:g-G.padding}}:{}},P={ticks:C,line:M,...e.yAxis.title?{title:{text:e.yAxis.title,x:G.padding+4,y:l+m/2,rotate:-90}}:{}};return{width:h,height:g,title:e.title?{text:e.title,x:h/2,y:G.padding+G.titleFontSize}:void 0,xAxis:N,yAxis:P,plotArea:_,bars:O,lines:k,gridLines:w,legend:j}}function Fi(e){let t=!!e.title,n=!!e.xAxis.title,r=!!e.yAxis.title,i=e.series.length>1,a=e.yAxis.range;if(!a)throw Error(`XY chart: y-axis range was not set by the parser`);let o=Ui(a.min,a.max),s=Wi(o),c=Ii(e),l=Li(e,c),u=Math.max(...l.map(e=>T(e,G.axisLabelFontSize,G.axisLabelFontWeight)),40),d=G.padding+(t?G.titleHeight:0)+(i?G.legendHeight:0),f=G.padding+G.xLabelHeight+(r?G.axisTitlePad:0),p=G.padding+u+G.yLabelGap+(n?G.axisTitlePad:0),m=G.padding,h=G.plotWidth,g=G.plotHeight,_=p+h+m,v=d+g+f,y={x:p,y:d,width:h,height:g},b=e=>{let t=(e-a.min)/(a.max-a.min||1);return p+t*h},x=g/c,S=e=>d+(e+.5)*x,C=o.map((e,t)=>({label:s[t],x:b(e),y:d+g,tx:b(e),ty:d+g+G.tickLength,labelX:b(e),labelY:d+g+18,textAnchor:`middle`})),w=l.map((e,t)=>({label:e,x:p,y:S(t),tx:p-G.tickLength,ty:S(t),labelX:p-G.yLabelGap,labelY:S(t),textAnchor:`end`})),E=o.map(e=>({x1:b(e),y1:d,x2:b(e),y2:d+g})),D=e.series.map((e,t)=>t),O=e.series.filter(e=>e.type===`bar`).length,k=[];if(O>0){let t=x*(1-G.barPadRatio),n=O>1?(t-(O-1)*G.barGroupGap)/O:t,r=Math.min(n,G.maxBarWidth),i=O>1?r*O+G.barGroupGap*(O-1):r,o=0,s=0;for(let t of e.series){if(t.type!==`bar`){s++;continue}for(let e=0;e<t.data.length;e++){let n=S(e)-i/2+o*(r+G.barGroupGap),c=b(Math.max(t.data[e],a.min)),u=b(Math.max(0,a.min));k.push({x:Math.min(u,c),y:n,width:Math.abs(c-u),height:r,value:t.data[e],label:l[e],seriesIndex:o,colorIndex:D[s]})}o++,s++}}let A=[],j=0,ee=0;for(let t of e.series){if(t.type!==`line`){ee++;continue}let e=t.data.map((e,t)=>({x:b(e),y:S(t),value:e,label:l[t]}));A.push({points:e,seriesIndex:j,colorIndex:D[ee]}),j++,ee++}let M={x1:p,y1:d+g,x2:p+h,y2:d+g},N={x1:p,y1:d,x2:p,y2:d+g},P={ticks:C,line:M,...e.yAxis.title?{title:{text:e.yAxis.title,x:p+h/2,y:v-G.padding}}:{}},F={ticks:w,line:N,...e.xAxis.title?{title:{text:e.xAxis.title,x:G.padding+4,y:d+g/2,rotate:-90}}:{}},I=e.title?{text:e.title,x:_/2,y:G.padding+G.titleFontSize}:void 0,L=G.padding+(t?G.titleHeight:0)+G.legendHeight/2;return{width:_,height:v,horizontal:!0,title:I,xAxis:P,yAxis:F,plotArea:y,bars:k,lines:A,gridLines:E,legend:i?Ki(e,_/2,L,D):[]}}function Ii(e){if(e.xAxis.categories)return e.xAxis.categories.length;for(let t of e.series)if(t.data.length>0)return t.data.length;return 1}function Li(e,t){if(e.xAxis.categories)return e.xAxis.categories;if(e.xAxis.range){let{min:n,max:r}=e.xAxis.range,i=t>1?(r-n)/(t-1):0;return Array.from({length:t},(e,t)=>Gi(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var Ri=8;function zi(e,t){let n=e.map(e=>T(e,G.axisLabelFontSize,G.axisLabelFontWeight));for(let r=1;r<e.length;r++){let i=!0;for(let a=0;a+r<e.length;a+=r)if(r*t-(n[a]+n[a+r])/2<Ri){i=!1;break}if(i)return r}return Math.max(1,e.length)}function Bi(e,t,n,r){let i=Li(e,Ii(e)),a=zi(i,r);return i.map((e,r)=>({label:r%a===0?e:``,x:t(r),y:n,tx:t(r),ty:n+G.tickLength,labelX:t(r),labelY:n+18,textAnchor:`middle`}))}function Vi(e,t,n,r,i,a,o){let s=e.series.filter(e=>e.type===`bar`).length;if(s===0)return[];let c=r*(1-G.barPadRatio),l=s>1?(c-(s-1)*G.barGroupGap)/s:c,u=Math.min(l,G.maxBarWidth),d=s>1?u*s+G.barGroupGap*(s-1):u,f=[],p=0,m=0;for(let r of e.series){if(r.type!==`bar`){m++;continue}for(let e=0;e<r.data.length;e++){let s=t(e)-d/2+p*(u+G.barGroupGap),c=n(r.data[e]),l=n(Math.max(0,i));f.push({x:s,y:Math.min(c,l),width:u,height:Math.abs(l-c),value:r.data[e],label:a[e],seriesIndex:p,colorIndex:o[m]})}p++,m++}return f}function Hi(e,t,n,r,i){let a=[],o=0,s=0;for(let c of e.series){if(c.type!==`line`){s++;continue}let e=c.data.map((e,i)=>({x:t(i),y:n(e),value:e,label:r[i]}));a.push({points:e,seriesIndex:o,colorIndex:i[s]}),o++,s++}return a}function Ui(e,t){let n=t-e;if(n<=0)return[e];let r=n/6,i=10**Math.floor(Math.log10(r)),a=r/i,o;o=a<=1.5?i:a<=3?2*i:a<=7?5*i:10*i;let s=Math.ceil(e/o)*o,c=[];for(let e=s;e<=t+o*.001;e+=o)c.push(Math.round(e*1e10)/1e10);return c}function Wi(e){let t=e.length>1?Math.abs(e[1]-e[0]):0,n=t>0&&t<1?Math.ceil(-Math.log10(t)-1e-9):0;return e.map(e=>String(Number.isInteger(e)&&n===0?e:Number(e.toFixed(n))))}function Gi(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function Ki(e,t,n,r){let i=[],a=0,o=0;for(let t=0;t<e.series.length;t++){let s=e.series[t],c=s.type===`bar`?`Bar ${a+1}`:`Line ${o+1}`;i.push({label:c,x:0,y:n,type:s.type,seriesIndex:s.type===`bar`?a:o,colorIndex:r[t]}),s.type===`bar`?a++:o++}let s=i.map(e=>{let t=T(e.label,G.legendFontSize,G.legendFontWeight);return G.legendSwatchW+G.legendGap+t}),c=t-(s.reduce((e,t)=>e+t,0)+(i.length-1)*G.legendItemGap)/2;for(let e=0;e<i.length;e++)i[e].x=c,c+=s[e]+G.legendItemGap;return i}var K={titleSize:18,titleWeight:600,axisTitleSize:15,axisTitleWeight:500,labelSize:14,labelWeight:400,legendSize:14,legendWeight:400,dotRadius:5,lineWidth:2.5,barRadius:8},q={fontSize:15,fontWeight:500,height:32,padX:14,offsetY:12,rx:8,minY:4,pointerSize:6};function qi(e,t,n=`Inter`,r=!1,i=!1,a,o,s,l={}){let u=[],d=Math.max(0,...e.bars.map(e=>e.colorIndex),...e.lines.map(e=>e.colorIndex)),f=nr((0,c.svgOpenTag)(e.width,e.height,t,r,o,s,void 0,l.styleAttribute).replace(`<svg `,`<svg data-xychart-colors="${d}" `),a);u.push(f),u.push((0,c.buildStyleBlock)(n,!1,l.nonce));let p=Math.max(...e.lines.map(e=>e.points.length),0),m=p>0&&p<=12,{style:h,defs:g}=Ji(e,i,m,t.accent,t.bg,l.nonce);u.push(h),g&&u.push(g);let{plotArea:_}=e,v=e.xAxis.ticks.map(e=>e.x),y=e.horizontal?e.yAxis.ticks.map(e=>e.y):e.gridLines.map(e=>e.y1),b=v.length>1?Math.abs(v[1]-v[0]):_.width/6,x=y.length>1?Math.abs(y[1]-y[0]):_.height/6,S=b/Math.max(1,Math.round(b/20)),C=x/Math.max(1,Math.round(x/20)),w=v[0]??_.x,T=y[0]??_.y,E=w-Math.ceil((w-_.x)/S)*S,D=T-Math.ceil((T-_.y)/C)*C;for(let e=D;e<=_.y+_.height+.5;e+=C)for(let t=E;t<=_.x+_.width+.5;t+=S)u.push(`<circle cx="${J(t)}" cy="${J(e)}" r="1.5" class="xychart-grid"/>`);let O=[];for(let t of e.bars){let n=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`,r=e.horizontal?Xi(t.x,t.y,t.width,t.height,K.barRadius):Yi(t.x,t.y,t.width,t.height,K.barRadius);if(u.push(`<path d="${r}" class="xychart-bar xychart-color-${t.colorIndex}"${n}/>`),i){let e=ea(t.value),n=t.label?`${t.label}: ${e}`:e,r=$i(t.x+t.width/2,t.y,e);O.push(`<g class="xychart-bar-group"><rect x="${J(t.x)}" y="${J(t.y)}" width="${J(t.width)}" height="${J(t.height)}" fill="transparent"/><title>${Y(n)}</title>`+r+`</g>`)}}for(let t of e.lines){if(t.points.length===0)continue;let e=Zi(t.points);u.push(`<path d="${e}" class="xychart-line-shadow xychart-color-${t.colorIndex}" transform="translate(0,2)"/>`),u.push(`<path d="${e}" class="xychart-line xychart-color-${t.colorIndex}"/>`)}let k=[];if(i||m){let t=new Map;for(let n of e.legend)n.type===`line`&&t.set(n.seriesIndex,n.label);let n=new Map;for(let t of e.lines)for(let e of t.points){let r=J(e.x),i=n.get(r)??[];n.set(r,i),i.push({x:e.x,y:e.y,value:e.value,label:e.label,seriesIndex:t.seriesIndex,colorIndex:t.colorIndex})}for(let e of n.values()){let n=e[0].x,r=e[0].label||``;if(i&&e.length>1){let i=Math.min(...e.map(e=>e.y)),a=Math.max(...e.map(e=>e.y)),o=K.dotRadius*3,s=`<rect x="${J(n-o)}" y="${J(i-o)}" width="${J(o*2)}" height="${J(a-i+o*2)}" fill="transparent" class="xychart-hit"/>`,c=e.map(e=>({text:ea(e.value),legendLabel:t.get(e.seriesIndex)||`Line ${e.seriesIndex+1}`})),l=Qi(n,i-K.dotRadius,r,c),u=c.map(e=>e.text),d=r?`${r}: ${u.join(` · `)}`:u.join(` · `),f=`<g class="xychart-dot-group">${s}`;for(let t of e){let e=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`;f+=`<circle cx="${J(t.x)}" cy="${J(t.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`}f+=`<title>${Y(d)}</title>${l}</g>`,k.push(f)}else if(i){let t=e[0],r=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`,i=ea(t.value),a=t.label?`${t.label}: ${i}`:i,o=$i(n,t.y-K.dotRadius,i),s=m?`<circle cx="${J(n)}" cy="${J(t.y)}" r="${K.dotRadius*3}" fill="transparent" class="xychart-hit"/>`:``;k.push(`<g class="xychart-dot-group">${s}<circle cx="${J(t.x)}" cy="${J(t.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${r}/><title>${Y(a)}</title>${o}</g>`)}else for(let t of e){let e=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`;u.push(`<circle cx="${J(t.x)}" cy="${J(t.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`)}}}for(let t of e.xAxis.ticks)t.label!==``&&u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${K.labelSize}" font-weight="${K.labelWeight}" dy="${P}" class="xychart-label">${Y(t.label)}</text>`);for(let t of e.yAxis.ticks)u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${K.labelSize}" font-weight="${K.labelWeight}" dy="${P}" class="xychart-label">${Y(t.label)}</text>`);if(e.xAxis.title){let t=e.xAxis.title,n=t.rotate?` transform="rotate(${t.rotate},${t.x},${t.y})"`:``;u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${K.axisTitleSize}" font-weight="${K.axisTitleWeight}" dy="${P}" class="xychart-axis-title">${Y(t.text)}</text>`)}if(e.yAxis.title){let t=e.yAxis.title,n=t.rotate?` transform="rotate(${t.rotate},${t.x},${t.y})"`:``;u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${K.axisTitleSize}" font-weight="${K.axisTitleWeight}" dy="${P}" class="xychart-axis-title">${Y(t.text)}</text>`)}e.title&&u.push(`<text x="${e.title.x}" y="${e.title.y}" text-anchor="middle" font-size="${K.titleSize}" font-weight="${K.titleWeight}" dy="${P}" class="xychart-title">${Y(e.title.text)}</text>`);for(let t of e.legend){if(t.type===`bar`)u.push(`<rect x="${t.x}" y="${t.y-7}" width="14" height="14" rx="3" class="xychart-bar xychart-color-${t.colorIndex}"/>`);else{let e=t.y;u.push(`<line x1="${t.x}" y1="${e}" x2="${t.x+14}" y2="${e}" stroke-width="${K.lineWidth}" stroke-linecap="round" class="xychart-legend-line xychart-color-${t.colorIndex}"/>`)}u.push(`<text x="${t.x+14+6}" y="${t.y}" text-anchor="start" font-size="${K.legendSize}" font-weight="${K.legendWeight}" dy="${P}" class="xychart-label">${Y(t.label)}</text>`)}for(let e of O)u.push(e);for(let e of k)u.push(e);return u.push(`</svg>`),u.join(`
47
+ `)}function Ji(e,t,n,r,i,a){let o=r??u.CHART_ACCENT_FALLBACK,s=new Set;for(let t of e.bars)s.add(t.colorIndex);for(let t of e.lines)s.add(t.colorIndex);let l=[];for(let e of[...s].sort((e,t)=>e-t)){let t=e===0?`var(--accent, ${u.CHART_ACCENT_FALLBACK})`:(0,u.getSeriesColor)(e,o,i);l.push(` --xychart-color-${e}: ${t};`),l.push(` --xychart-bar-fill-${e}: color-mix(in srgb, var(--bg) 75%, var(--xychart-color-${e}) 25%);`)}let d=[];for(let e of[...s].sort((e,t)=>e-t)){let t=`var(--xychart-color-${e})`;d.push(` .xychart-bar.xychart-color-${e} { stroke: ${t}; fill: var(--xychart-bar-fill-${e}); }`),d.push(` path.xychart-color-${e}, line.xychart-color-${e} { stroke: ${t}; }`),d.push(` circle.xychart-color-${e} { fill: ${t}; }`)}let f=t?`
44
48
  .xychart-tip { opacity: 0; pointer-events: none; }
45
49
  .xychart-tip-bg { fill: var(--_text); filter: drop-shadow(0 1px 3px color-mix(in srgb, var(--fg) 20%, transparent)); }
46
- .xychart-tip-text { fill: var(--bg); font-size: ${J.fontSize}px; font-weight: ${J.fontWeight}; }
50
+ .xychart-tip-text { fill: var(--bg); font-size: ${q.fontSize}px; font-weight: ${q.fontWeight}; }
47
51
  .xychart-tip-ptr { fill: var(--_text); }
48
52
  .xychart-bar-group:hover .xychart-tip,
49
53
  .xychart-dot-group:hover .xychart-tip { opacity: 1; }`:``,p=l.length>0?`\n svg {\n${l.join(`
50
54
  `)}\n }`:``;return{style:`${(0,c.styleOpenTag)(a)}
51
55
  .xychart-grid { fill: var(--_inner-stroke); stroke: none; opacity: 0.65; }
52
56
  .xychart-bar { stroke-width: 1.5; }
53
- .xychart-line { fill: none; stroke-width: ${q.lineWidth}; stroke-linecap: round; stroke-linejoin: round; }
57
+ .xychart-line { fill: none; stroke-width: ${K.lineWidth}; stroke-linecap: round; stroke-linejoin: round; }
54
58
  .xychart-line-shadow { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.12; }
55
59
  .xychart-dot { stroke: var(--bg); stroke-width: 2; }
56
60
  .xychart-label { fill: var(--_text-muted); }
@@ -58,12 +62,12 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
58
62
  .xychart-title { fill: var(--_text); }${p}
59
63
  ${d.join(`
60
64
  `)}${f}
61
- </style>`,defs:``}}function yr(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${Y(e)},${Y(t)} h${Y(n)} v${Y(r)} h${Y(-n)} Z`:[`M${Y(e)},${Y(t+a)}`,`Q${Y(e)},${Y(t)} ${Y(e+a)},${Y(t)}`,`L${Y(e+n-a)},${Y(t)}`,`Q${Y(e+n)},${Y(t)} ${Y(e+n)},${Y(t+a)}`,`L${Y(e+n)},${Y(t+r-a)}`,`Q${Y(e+n)},${Y(t+r)} ${Y(e+n-a)},${Y(t+r)}`,`L${Y(e+a)},${Y(t+r)}`,`Q${Y(e)},${Y(t+r)} ${Y(e)},${Y(t+r-a)}`,`Z`].join(` `)}function br(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${Y(e)},${Y(t)} h${Y(n)} v${Y(r)} h${Y(-n)} Z`:[`M${Y(e+a)},${Y(t)}`,`L${Y(e+n-a)},${Y(t)}`,`Q${Y(e+n)},${Y(t)} ${Y(e+n)},${Y(t+a)}`,`L${Y(e+n)},${Y(t+r-a)}`,`Q${Y(e+n)},${Y(t+r)} ${Y(e+n-a)},${Y(t+r)}`,`L${Y(e+a)},${Y(t+r)}`,`Q${Y(e)},${Y(t+r)} ${Y(e)},${Y(t+r-a)}`,`L${Y(e)},${Y(t+a)}`,`Q${Y(e)},${Y(t)} ${Y(e+a)},${Y(t)}`,`Z`].join(` `)}function xr(e){if(e.length===0)return``;if(e.length===1)return`M${Y(e[0].x)},${Y(e[0].y)}`;if(e.length===2)return`M${Y(e[0].x)},${Y(e[0].y)} L${Y(e[1].x)},${Y(e[1].y)}`;let t=e.length,n=[],r=[];for(let i=0;i<t-1;i++)n.push(e[i+1].x-e[i].x),r.push(n[i]===0?0:(e[i+1].y-e[i].y)/n[i]);let i=Array(t).fill(0);for(let e=1;e<t-1;e++){let t=r[e-1],a=r[e];if(t*a<=0)continue;let o=2*n[e]+n[e-1],s=n[e]+2*n[e-1];i[e]=(o+s)/(o/t+s/a)}let a=(e,t,n,r)=>{let i=((2*e+t)*n-e*r)/(e+t);return i*n<=0?i=0:n*r<=0&&Math.abs(i)>3*Math.abs(n)&&(i=3*n),i};i[0]=a(n[0],n[1],r[0],r[1]),i[t-1]=a(n[t-2],n[t-3],r[t-2],r[t-3]);let o=`M${Y(e[0].x)},${Y(e[0].y)}`;for(let r=0;r<t-1;r++){let t=n[r]/3,a=e[r].x+t,s=e[r].y+i[r]*t,c=e[r+1].x-t,l=e[r+1].y-i[r+1]*t;o+=` C${Y(a)},${Y(s)} ${Y(c)},${Y(l)} ${Y(e[r+1].x)},${Y(e[r+1].y)}`}return o}function Sr(e,t,n,r){let i=T(n,J.fontSize,600),a=Math.max(...r.map(e=>{let t=T(e.legendLabel,J.fontSize,J.fontWeight),n=T(e.text,J.fontSize,J.fontWeight);return t+10+n})),o=Math.max(i,a)+J.padX*2,s=26+r.length*20+6,c=Math.max(J.minY,t-J.offsetY-s-J.pointerSize),l=e-o/2,u=e,d=c+s,f=J.pointerSize,p=`<polygon points="${Y(u-f)},${Y(d)} ${Y(u+f)},${Y(d)} ${Y(u)},${Y(d+f)}" class="xychart-tip xychart-tip-ptr"/>`,m=`<rect x="${Y(l)}" y="${Y(c)}" width="${Y(o)}" height="${s}" rx="${J.rx}" class="xychart-tip xychart-tip-bg"/>`;m+=p;let h=c+6+10;m+=`<text x="${Y(e)}" y="${Y(h)}" text-anchor="middle" font-weight="600" font-size="${J.fontSize}" dy="${F}" class="xychart-tip xychart-tip-text">${X(n)}</text>`;let g=l+J.padX,_=l+o-J.padX;for(let e of r)h+=20,m+=`<text x="${Y(g)}" y="${Y(h)}" text-anchor="start" font-size="${J.fontSize}" font-weight="${J.fontWeight}" dy="${F}" class="xychart-tip xychart-tip-text">${X(e.legendLabel)}</text>`,m+=`<text x="${Y(_)}" y="${Y(h)}" text-anchor="end" font-size="${J.fontSize}" font-weight="${J.fontWeight}" dy="${F}" class="xychart-tip xychart-tip-text">${X(e.text)}</text>`;return m}function Cr(e,t,n){let r=T(n,J.fontSize,J.fontWeight)+J.padX*2,i=J.height,a=Math.max(J.minY,t-J.offsetY-i-J.pointerSize),o=e-r/2,s=e,c=a+i/2,l=e,u=a+i,d=J.pointerSize,f=`<polygon points="${Y(l-d)},${Y(u)} ${Y(l+d)},${Y(u)} ${Y(l)},${Y(u+d)}" class="xychart-tip xychart-tip-ptr"/>`;return`<rect x="${Y(o)}" y="${Y(a)}" width="${Y(r)}" height="${i}" rx="${J.rx}" class="xychart-tip xychart-tip-bg"/>`+f+`<text x="${Y(s)}" y="${Y(c)}" text-anchor="middle" dy="${F}" class="xychart-tip xychart-tip-text">${X(n)}</text>`}function wr(e){return Number.isInteger(e)?e.toLocaleString(`en-US`):e.toFixed(+(Math.abs(e)<10))}function Y(e){return String(Math.round(e*10)/10)}function X(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}var Z={width:216,diagramMarginX:50,diagramMarginY:10,shapeMargin:50,shapePadding:20,shapeInRow:4,boundaryInRow:2,nextLinePaddingX:0,screenWidth:1440,nameSize:14,typeSize:10.5,descrSize:11.5,messageSize:12,boundarySize:14,nameLine:15.35,typeLine:15.72,descrLine:17.1,descrExtraLine:12.48,textScale:.922,boundaryLabelHeight:18,boundaryTypeHeight:16.1,boundaryDescrHeight:14.4,rootHeadingHeight:47,titleExtra:60,cornerRadius:12,strokeWidth:2,personRx:38.232,personHeadRadius:49.68,personPillTop:85.946,personPillTopPerExtraWidth:.4,dbTrim:3.91,queueExtra:10},Tr=Z.width-Z.shapePadding;function Er(e,t,n,r){let i=[];for(let a of e.split(`
62
- `)){let e=``;for(let o of a.split(/\s+/).filter(Boolean)){let a=e?`${e} ${o}`:o;e&&T(a,n,r)*Z.textScale>t?(i.push(e),e=o):e=a}i.push(e)}return i}function Dr(e){let t=e/Z.width;return{rx:Z.personRx*t,headRadius:Z.personHeadRadius*t,pillTop:Z.personPillTop+Z.personPillTopPerExtraWidth*(e-Z.width)}}function Or(e,t){return e*Z.nameLine+Z.typeLine+kr(t)}function kr(e){return e===0?0:Z.descrLine+(e-1)*Z.descrExtraLine}function Ar(e){let t=e/2;return{rx:t,ry:t/(2.5+e/50)}}function jr(e){let t=e/2;return{rx:t/(2.5+e/50),ry:t}}function Mr(e,t,n){return T(e,t,n)*Z.textScale}function Nr(e,t,n,r){let i=Or(t,n),a=i+2*Z.shapePadding,o=Math.max(Z.width,r+2*Z.shapePadding);if(e.kind===`person`)return{width:o,height:Dr(o).pillTop+a,textHeight:i};if(e.shape===`db`){let{ry:e}=Ar(o);return{width:o,height:a+2*e-Z.dbTrim,textHeight:i}}if(e.shape===`queue`){let e=i+Z.queueExtra,{rx:t}=jr(e);return{width:o+3*t,height:e,textHeight:i}}return{width:o,height:a,textHeight:i}}function Pr(e){let t=`#ffffff`;if(e.external)switch(e.kind){case`person`:return{fill:`#686868`,stroke:`#8a8a8a`,text:t};case`system`:return{fill:`#999999`,stroke:`#8a8a8a`,text:t};case`container`:return{fill:`#b3b3b3`,stroke:`#a6a6a6`,text:t};case`component`:return{fill:`#cccccc`,stroke:`#bfbfbf`,text:t}}switch(e.kind){case`person`:return{fill:`#08427b`,stroke:`#073b6f`,text:t};case`system`:return{fill:`#1168bd`,stroke:`#3c7fc0`,text:t};case`container`:return{fill:`#438dd5`,stroke:`#3c7fc0`,text:t};case`component`:return{fill:`#85bbf0`,stroke:`#78a8d8`,text:t}}}function Fr(){return{next:{cnt:0}}}function Ir(e,t,n,r,i){e.next.startx=e.startx=t,e.next.stopx=e.stopx=n,e.next.starty=e.starty=r,e.next.stopy=e.stopy=i}function Q(e,t,n,r){let i=e[t];e[t]=i===void 0?n:r(n,i)}function Lr(e,t){e.next.cnt+=1;let n=Z.shapeMargin,r=e.next.startx===e.next.stopx?e.next.stopx+n:e.next.stopx+n*2,i=r+t.width,a=e.next.starty+n*2,o=a+t.height;(r>=e.widthLimit||i>=e.widthLimit||e.next.cnt>Z.shapeInRow)&&(r=e.next.startx+n+Z.nextLinePaddingX,a=e.next.stopy+n*2,e.next.stopx=i=r+t.width,e.next.starty=e.next.stopy,e.next.stopy=o=a+t.height,e.next.cnt=1),t.x=r,t.y=a,Q(e,`startx`,r,Math.min),Q(e,`starty`,a,Math.min),Q(e,`stopx`,i,Math.max),Q(e,`stopy`,o,Math.max),Q(e.next,`startx`,r,Math.min),Q(e.next,`starty`,a,Math.min),Q(e.next,`stopx`,i,Math.max),Q(e.next,`stopy`,o,Math.max)}function Rr(e){let t=Er(e.label,Tr,Z.nameSize,700),n=e.description?Er(e.description,Tr,Z.descrSize,400):[],r=Math.max(...t.map(e=>Mr(e,Z.nameSize,700)),Mr((0,u.c4TypeLine)(e),Z.typeSize,400),...n.map(e=>Mr(e,Z.descrSize,400)));return{el:e,nameLines:t,descriptionLines:n,x:0,y:0,...Nr(e,t.length,n.length,r)}}function zr(e){let t=new Set,n=new Map(e.elements.map(e=>[e.alias,e])),r=e=>{let i=e.elementAliases.flatMap(e=>{t.add(e);let r=n.get(e);return r?[r]:[]});return{alias:e.alias,boundary:e,elements:i,children:e.children.map(r)}},i=e.boundaries.map(r);return{alias:`global`,elements:e.elements.filter(e=>!t.has(e.alias)),children:i}}function Br(e){let t=new Map,n=[],r=Z.diagramMarginX,i=Z.diagramMarginY,a=(e,n)=>{for(let r of n){let n=Rr(r);t.set(r.alias,n),Lr(e,n)}e.stopx+=Z.shapeMargin,e.stopy+=Z.shapeMargin},o=(e,t,s)=>{let c=Fr();c.widthLimit=e.widthLimit/Math.min(Z.boundaryInRow,t.length);for(let[l,d]of t.entries()){let t=d.boundary,f=0,p=f+8;f=p+Z.boundaryLabelHeight;let m;t&&(0,u.c4BoundaryTypeLine)(t)&&(m=f+5,f=m+Z.boundaryTypeHeight);let h;if(t?.description&&(h=f+20,f=h+Z.boundaryDescrHeight),t||(f=Z.rootHeadingHeight),l===0||l%Z.boundaryInRow===0){let t=e.startx+Z.diagramMarginX,n=e.stopy+Z.diagramMarginY+f;Ir(c,t,t,n,n)}else{let e=c.stopx===c.startx?c.startx:c.stopx+Z.diagramMarginX;Ir(c,e,e,c.starty,c.starty)}if(d.elements.length>0&&a(c,d.elements),d.children.length>0&&o(c,d.children,s+1),t){let e=c.stopx-c.startx,r=c.stopy-c.starty;e===0&&(e=Z.width),r===0&&(r=f+Z.shapeMargin),n.push({alias:t.alias,label:t.label,...t.type?{type:t.type}:{},...t.description?{description:t.description}:{},x:c.startx,y:c.starty,width:e,height:r,depth:s,labelY:p,...m===void 0?{}:{typeY:m},...h===void 0?{}:{descrY:h}})}e.stopy=Math.max(c.stopy+Z.shapeMargin,e.stopy),e.stopx=Math.max(c.stopx+Z.shapeMargin,e.stopx),r=Math.max(r,e.stopx),i=Math.max(i,e.stopy)}},s=Fr();return Ir(s,Z.diagramMarginX,Z.diagramMarginX,Z.diagramMarginY,Z.diagramMarginY),s.widthLimit=Z.screenWidth,o(s,[e],-1),{elements:t,boundaries:n,maxX:r,maxY:i}}function Vr(e,t){let n=e.x+e.width/2,r=e.y+e.height/2,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(i===0&&a===0)return{x:n,y:r};let c,l;if(Math.abs(a)*o>Math.abs(i)*s){let e=a<0?-s:s;c=e*i/a,l=e}else{let e=i<0?-o:o;c=e,l=e*a/i}return{x:n+c,y:r+l}}function Hr(e,t){let n=Dr(e.width),r=e.x+e.width/2,i=e.y+e.height/2,a=e.y+n.headRadius,o=e.y+n.pillTop,s=e.y+e.height,c=(t,i)=>{if(Math.hypot(t-r,i-a)<=n.headRadius)return!0;if(i<o||i>s)return!1;let c=Math.min(n.rx,(s-o)/2),l=e.x+c,u=e.x+e.width-c,d=Math.min(Math.max(i,o+c),s-c),f=Math.min(Math.max(t,l),u);return t>=e.x&&t<=e.x+e.width&&Math.hypot(t-f,i-d)<=c},l=Math.hypot(t.x-r,t.y-i);if(l===0||!c(r,i))return Vr(e,t);let u=(t.x-r)/l,d=(t.y-i)/l,f=e=>c(r+u*e,i+d*e),p=0,m=.5;for(;f(m)&&m<e.width+e.height;)p=m,m+=.5;for(let e=0;e<30;e++){let e=(p+m)/2;f(e)?p=e:m=e}return{x:r+u*p,y:i+d*p}}function Ur(e,t){return e.el?.kind===`person`?Hr(e,t):Vr(e,t)}var Wr=e=>({x:e.x+e.width/2,y:e.y+e.height/2});function Gr(e,t,n,r){let i=n.get(e.from),a=n.get(e.to),o=Ur(i,Wr(a)),s=Ur(a,Wr(i)),c=s.x-o.x,l=s.y-o.y,d=e=>({x:e.x,y:e.y+r}),f={...e,points:[d(o),d(s)]};if(t>0&&(f.curve=d({x:o.x+c/2-c/4,y:o.y+l/2})),(0,u.c4RelLabelLines)(e).length>0){let t={x:Math.min(o.x,s.x)+Math.abs(c)/2,y:Math.min(o.y,s.y)+Math.abs(l)/2},n=(0,u.c4RelLabelLines)(e)[0],r=e.label!==``||e.index!==void 0?Mr(n??``,Z.messageSize,400):0;if(f.labelPosition=d({x:t.x+r/2,y:t.y}),e.technology){let n=Mr(`[${e.technology}]`,Z.messageSize,400);f.technologyX=t.x+Math.max(r,n)/2}}return f}function Kr(e,t={}){if(e.elements.length===0&&e.boundaries.length===0){let t={variant:e.variant,width:0,height:0,elements:[],boundaries:[],relationships:[]};return e.title&&(t.title=e.title),t}let n=Br(zr(e)),r=e.title?Z.titleExtra:0,i=Z.diagramMarginY+r,a=e.elements.flatMap(e=>{let t=n.elements.get(e.alias);return t?[{...e,x:t.x,y:t.y+i,width:t.width,height:t.height,nameLines:t.nameLines,descriptionLines:t.descriptionLines}]:[]}),o=[...n.boundaries].sort((e,t)=>e.depth-t.depth).map(e=>({...e,y:e.y+i})),s=new Map;for(let e of n.elements.values())s.set(e.el.alias,e);for(let e of n.boundaries)s.set(e.alias,e);let c=e.relationships.map((e,t)=>Gr(e,t,s,i)),l=n.maxX+Z.diagramMarginX,u=n.maxY+Z.diagramMarginY+r,d={variant:e.variant,width:l,height:u,elements:a,boundaries:o,relationships:c};return e.title&&(d.title=e.title,d.titlePosition={x:(n.maxX-Z.diagramMarginX)/2-4*Z.diagramMarginX,y:Z.diagramMarginY+Z.diagramMarginY+i}),d}function qr(e,t,n=`Inter`,r=!1,i=k,a,o,s,l={}){let u=[];u.push(V((0,c.svgOpenTag)(e.width,e.height,t,r,o??e.title,s,void 0,l.styleAttribute),a)),u.push((0,c.buildStyleBlock)(n,!1,l.nonce)),e.title&&e.titlePosition&&u.push(c.f`<text class="c4-title" x="${e.titlePosition.x}" y="${e.titlePosition.y}" dy="${F}" `+c.f`font-size="16" fill="var(--_text)">${(0,c.escapeXml)(e.title)}</text>`);for(let t of e.boundaries)u.push(Jr(t));for(let t of e.elements)u.push(Yr(t));for(let t of e.relationships)u.push(ei(t)),u.push(ti(t));return u.push(`</svg>`),u.filter(Boolean).join(`
63
- `)}function $(e,t,n,r,i){return c.f` <text x="${t}" y="${n}" text-anchor="middle" dy="${F}" font-size="${r}" `+c.f`${i}>${(0,c.escapeXml)(e)}</text>`}function Jr(e){let t=[];t.push(c.f`<g class="c4-boundary" data-id="${(0,c.escapeAttr)(e.alias)}" data-label="${(0,c.escapeAttr)(e.label)}" data-depth="${e.depth}">`),t.push(c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="2.5" ry="2.5" `+`fill="none" stroke="var(--_text)" stroke-width="1" stroke-dasharray="7,7" />`);let n=e.x+e.width/2;t.push($(e.label,n,e.y+(e.labelY??8),Z.boundarySize+2,`font-weight="700" fill="var(--_text)"`));let r=(0,u.c4BoundaryTypeLine)({alias:e.alias,label:e.label,...e.type?{type:e.type}:{},elementAliases:[],children:[]});return r&&e.typeY!==void 0&&t.push($(r,n,e.y+e.typeY,Z.boundarySize,`fill="var(--_text)"`)),e.description&&e.descrY!==void 0&&t.push($(e.description,n,e.y+e.descrY,Z.boundarySize-2,`fill="var(--_text)"`)),t.push(`</g>`),t.join(`
64
- `)}function Yr(e){let t=Pr(e),{x:n,y:r,width:i,height:a}=e,o=n+i/2,s=Or(e.nameLines.length,e.descriptionLines.length),l=[];l.push(c.f`<g class="c4-element" data-id="${(0,c.escapeAttr)(e.alias)}" data-kind="${e.kind}" data-shape="${e.shape}" `+c.f`data-external="${e.external}" data-label="${(0,c.escapeAttr)(e.label)}">`);let d,f=o;if(e.kind===`person`)l.push(...Xr(e,t)),d=r+Dr(i).pillTop+Z.shapePadding;else if(e.shape===`db`){l.push(...Zr(e,t));let{ry:n}=Ar(i);d=r+(2*n+a)/2-s/2}else if(e.shape===`queue`){l.push(...Qr(e,t));let{rx:n}=jr(a);f=o-n,d=r+a/2-s/2}else l.push(c.f` <rect x="${n}" y="${r}" width="${i}" height="${a}" rx="${Z.cornerRadius}" ry="${Z.cornerRadius}" `+c.f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${Z.strokeWidth}" />`),d=r+Z.shapePadding;let p=d;for(let n of e.nameLines)l.push($(n,f,p+Z.nameLine/2,Z.nameSize,c.f`font-weight="700" fill="${t.text}"`)),p+=Z.nameLine;return l.push($((0,u.c4TypeLine)(e),f,p+Z.typeLine/2,Z.typeSize,c.f`fill="${t.text}"`)),p+=Z.typeLine,e.descriptionLines.forEach((e,n)=>{l.push($(e,f,p+Z.descrLine/2+n*Z.descrExtraLine,Z.descrSize,c.f`fill="${t.text}"`))}),p+=kr(e.descriptionLines.length),l.push(`</g>`),l.join(`
65
- `)}function Xr(e,t){let{x:n,width:r}=e,{rx:i,headRadius:a,pillTop:o}=Dr(r),s=e.y,l=n+r/2,u=s+o,d=e.y+e.height-u,f=c.f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${Z.strokeWidth}"`;return[c.f` <rect x="${n}" y="${u}" width="${r}" height="${d}" rx="${i}" ry="${i}" ${f} />`,c.f` <circle cx="${l}" cy="${s+a}" r="${a}" ${f} />`]}function Zr(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=Ar(i),l=c.f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${Z.strokeWidth}"`;return[c.f` <path d="M ${n} ${r+s} L ${n} ${r+a-s} A ${o} ${s} 0 0 0 ${n+i} ${r+a-s} L ${n+i} ${r+s} Z" ${l} />`,c.f` <ellipse cx="${n+o}" cy="${r+s}" rx="${o}" ry="${s}" ${l} />`]}function Qr(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=jr(a),l=c.f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${Z.strokeWidth}"`;return[c.f` <path d="M ${n+i-o} ${r} H ${n+o} A ${o} ${s} 0 0 0 ${n+o} ${r+a} H ${n+i-o} Z" ${l} />`,c.f` <ellipse cx="${n+i-o}" cy="${r+s}" rx="${o}" ry="${s}" ${l} />`]}function $r(e,t){let n=e.x-t.x,r=e.y-t.y,i=Math.hypot(n,r);if(i===0)return``;let a=n/i,o=r/i,s=e.x-a*10,l=e.y-o*10;return c.f`<polygon class="c4-arrowhead" points="${e.x},${e.y} ${s-o*5},${l+a*5} ${s+o*5},${l-a*5}" `+`fill="var(--_text)" />`}function ei(e){let[t,n]=[e.points[0],e.points[e.points.length-1]];if(!t||!n||t===n)return``;let r=[`class="c4-relationship"`,c.f`data-from="${(0,c.escapeAttr)(e.from)}"`,c.f`data-to="${(0,c.escapeAttr)(e.to)}"`];e.label&&r.push(c.f`data-label="${(0,c.escapeAttr)(e.label)}"`),e.technology&&r.push(c.f`data-technology="${(0,c.escapeAttr)(e.technology)}"`);let i=e.curve?c.f`M ${t.x},${t.y} Q ${e.curve.x},${e.curve.y} ${n.x},${n.y}`:c.f`M ${t.x},${t.y} L ${n.x},${n.y}`,a=c.f`<path ${r.join(` `)} d="${i}" fill="none" stroke="var(--_text)" stroke-width="1" />`,o=e.curve??t,s=e.curve??n,l=$r(n,o),u=$r(t,s);return[a,...e.bidirectional?[l,u]:[e.reversed?u:l]].filter(Boolean).join(`
66
- `)}function ti(e){let t=(0,u.c4RelLabelLines)(e);if(t.length===0||!e.labelPosition)return``;let{x:n,y:r}=e.labelPosition,i=[c.f`<g class="c4-relationship-label" data-from="${(0,c.escapeAttr)(e.from)}" data-to="${(0,c.escapeAttr)(e.to)}">`];return t.forEach((a,o)=>{let s=e.technology!==void 0&&o===t.length-1,c=r+(o===0?0:Z.messageSize+5);i.push($(a,s&&e.technologyX!==void 0?e.technologyX:n,c,Z.messageSize,s?`font-style="italic" fill="var(--_text)"`:`fill="var(--_text)"`))}),i.push(`</g>`),i.join(`
67
- `)}function ni(e){let t=e.trim();return t.length>=2&&(t[0]===`"`&&t[t.length-1]===`"`||t[0]===`'`&&t[t.length-1]===`'`)?t.slice(1,-1):t}var ri=`"graph <dir>"/"flowchart <dir>" (dir: TD, TB, LR, BT, RL), "stateDiagram-v2", "sequenceDiagram", "classDiagram", "erDiagram", "xychart-beta", "C4Context"/"C4Container"/"C4Component"/"C4Dynamic"/"C4Deployment", "architecture-beta"`;function ii(e){let t=e.trim().toLowerCase();if(/^sequence/.test(t))return`sequenceDiagram`;if(/^class/.test(t))return`classDiagram`;if(/^er/.test(t))return`erDiagram`;if(/^xychart/.test(t))return`xychart-beta`;if(/^state/.test(t))return`stateDiagram-v2`}var ai=/^(?:[\w-]+@)?<?(?:-{2,}|={2,}|-\.+-?|~{3,})/;function oi(e){let t=[];for(let n of e)n.forEach((e,n)=>{if(n===0&&t.length>0&&ai.test(e.text)){let n=t[t.length-1];t[t.length-1]={text:`${n.text} ${e.text}`,line:n.line}}else t.push(e)});return t}function si(e){let t=(0,c.extractInitConfig)(e.split(`
68
- `).map(e=>e.trim())),n=oi((0,c.splitStatementsByLine)(e));if(n.length===0)throw Error(`Empty mermaid diagram`);let r=n[0],i=/^stateDiagram(-v2)?\s*$/i.test(r.text)?li(n):ci(n);return i.initConfig=t,i}function ci(e){let t=e[0];if(t===void 0)throw Error(`parseFlowchart called with no lines`);let n=t.text,r=n.match(/^(?:graph|flowchart)\s+(TD|TB|LR|BT|RL)\s*$/i);if(!r){let e=n.match(/^(?:graph|flowchart)\b\s*(.*)$/i);if(e){let r=e[1].trim();throw Error(r.length>0?`Line ${t.line}: Invalid direction "${r}" in header "${n}". Expected one of: TD, TB, LR, BT, RL.`:`Line ${t.line}: Missing direction in header "${n}". Expected e.g. "graph TD" or "flowchart LR" — one of: TD, TB, LR, BT, RL.`)}let r=ii(n),i=r&&r.toLowerCase()!==n.trim().toLowerCase()?` Did you mean "${r}"?`:``;throw Error(`Line ${t.line}: Invalid mermaid header: "${n}".${i} Supported headers: ${ri}.`)}let i={direction:(0,c.toDirection)(r[1]),nodes:new Map,edges:[],subgraphs:[],classDefs:new Map,classAssignments:new Map,nodeStyles:new Map,linkStyles:new Map,interactions:new Map},a=[];for(let t=1;t<e.length;t++){let n=e[t].text;if((0,c.tryApplyClassDef)(n,i)||(0,c.tryApplyClassAssignment)(n,i)||(0,c.tryApplyStyleStatement)(n,i))continue;if(/^click\s+/i.test(n)){Si(n,i);continue}if(wi(n,i))continue;let r=n.match(/^linkStyle\s+(default|[\d,\s]+)\s+(.+)$/);if(r){let e=r[1].trim(),t=(0,c.parseStyleProps)(r[2]);if(e==="default")i.linkStyles.set(`default`,{...i.linkStyles.get(`default`),...t});else{let n=e.split(`,`).map(e=>parseInt(e.trim(),10));for(let e of n)isNaN(e)||i.linkStyles.set(e,{...i.linkStyles.get(e),...t})}continue}let o=n.match(/^direction\s+(TD|TB|LR|BT|RL)\s*$/i);if(o&&a.length>0){a[a.length-1].direction=(0,c.toDirection)(o[1]);continue}let s=n.match(/^subgraph\s+(.+)$/);if(s){let e=s[1].trim(),t=e.match(/^([^\s[]+)\s*\[(.+)\]$/),n,r;t?(n=t[1],r=(0,c.normalizeBrTags)(ni(t[2]))):(r=(0,c.normalizeBrTags)(ni(e)),n=r.replace(/\s+/g,`_`).replace(/[^\p{L}\p{N}_-]/gu,``));let i={id:n,label:r,nodeIds:[],children:[]};a.push(i);continue}if(n===`end`){let e=a.pop();e&&(a.length>0?a[a.length-1].children.push(e):i.subgraphs.push(e));continue}Oi(n,i,a)}return i}function li(e){let t={direction:`TD`,nodes:new Map,edges:[],subgraphs:[],classDefs:new Map,classAssignments:new Map,nodeStyles:new Map,linkStyles:new Map,interactions:new Map},n=[],r=new Set,i=0,a=0;for(let o=1;o<e.length;o++){let s=e[o].text;if((0,c.tryApplyClassDef)(s,t)||(0,c.tryApplyClassAssignment)(s,t)||(0,c.tryApplyStyleStatement)(s,t))continue;let l=s.match(/^direction\s+(TD|TB|LR|BT|RL)\s*$/i);if(l){n.length>0?n[n.length-1].direction=(0,c.toDirection)(l[1]):t.direction=(0,c.toDirection)(l[1]);continue}let u=s.match(/^linkStyle\s+(default|[\d,\s]+)\s+(.+)$/);if(u){let e=u[1].trim(),n=(0,c.parseStyleProps)(u[2]);if(e==="default")t.linkStyles.set(`default`,{...t.linkStyles.get(`default`),...n});else{let r=e.split(`,`).map(e=>parseInt(e.trim(),10));for(let e of r)isNaN(e)||t.linkStyles.set(e,{...t.linkStyles.get(e),...n})}continue}if(wi(s,t))continue;let d=s.match(/^state\s+(?:"([^"]+)"\s+as\s+)?([\w\p{L}]+)\s*\{$/u);if(d){let e=d[1]??d[2],i=d[2],a={id:i,label:e,nodeIds:[],children:[]};n.push(a),r.add(i),t.nodes.delete(i);continue}if(s===`}`){let e=n.pop();e&&(n.length>0?n[n.length-1].children.push(e):t.subgraphs.push(e));continue}let f=s.match(/^state\s+"([^"]+)"\s+as\s+([\w\p{L}]+)\s*$/u);if(f){let e=(0,c.normalizeBrTags)(f[1]),r=f[2];ui(t,n,r,e);continue}let p=s.match(/^(\[\*\]|[\w\p{L}-]+)(?::::([\w][\w-]*))?\s*(?:([\w-]+)@)?-->\s*(\[\*\]|[\w\p{L}-]+)(?::::([\w][\w-]*))?(?:\s*:\s*(.+))?$/u);if(p){let e=p[1],o=p[2],s=p[3],l=p[4],u=p[5],d=p[6]?.trim(),f=d?(0,c.normalizeBrTags)(d):void 0;e===`[*]`?(i++,e=`_start${i>1?i:``}`,di(t,n,{id:e,label:``,shape:`state-start`})):r.has(e)||fi(t,n,e),l===`[*]`?(a++,l=`_end${a>1?a:``}`,di(t,n,{id:l,label:``,shape:`state-end`})):r.has(l)||fi(t,n,l),o!==void 0&&t.classAssignments.set(e,o),u!==void 0&&t.classAssignments.set(l,u),t.edges.push({source:e,target:l,label:f,style:`solid`,hasArrowStart:!1,hasArrowEnd:!0,...s===void 0?{}:{id:s}});continue}let m=s.match(/^([\w\p{L}-]+):::([\w][\w-]*)\s*$/u);if(m){let e=m[1];r.has(e)||fi(t,n,e),t.classAssignments.set(e,m[2]);continue}let h=s.match(/^([\w\p{L}-]+)\s*:\s*(.+)$/u);if(h){let e=h[1];ui(t,n,e,(0,c.normalizeBrTags)(h[2].trim()));continue}}for(let e of t.classAssignments.keys())!t.nodes.has(e)&&!r.has(e)&&fi(t,[],e);return t}function ui(e,t,n,r){let i=e.nodes.get(n);i&&(i.label=r),di(e,t,{id:n,label:r,shape:`rounded`})}function di(e,t,n){if(e.nodes.has(n.id)||e.nodes.set(n.id,n),t.length>0){let e=t[t.length-1];e.nodeIds.includes(n.id)||e.nodeIds.push(n.id)}}function fi(e,t,n){if(!e.nodes.has(n))di(e,t,{id:n,label:n,shape:`rounded`});else if(t.length>0){let e=t[t.length-1];e.nodeIds.includes(n)||e.nodeIds.push(n)}}var pi=/^(<|o|x)?(-{2,}|={2,}|-\.+-|~{3,})(>|o|x)?(?:\|([^|]*)\|)?/,mi=new Set([`--`,`==`]);function hi(e){if(e===`o`)return`circle`;if(e===`x`)return`cross`}var gi=/^(<|o|x)?(--|-\.|==)\s+(.+?)\s+(-{2,}[>ox]|={2,}[>ox]|\.+-[>ox]|-{3,}|={3,}|-\.+-)/,_i=[{regex:/^([\w\p{L}-]+)\(\(\(((?:"[^"]*"|(?!\)\)\)).)+)\)\)\)/u,shape:`doublecircle`},{regex:/^([\w\p{L}-]+)\(\[((?:"[^"]*"|(?!\]\)).)+)\]\)/u,shape:`stadium`},{regex:/^([\w\p{L}-]+)\(\(((?:"[^"]*"|(?!\)\)).)+)\)\)/u,shape:`circle`},{regex:/^([\w\p{L}-]+)\[\[((?:"[^"]*"|(?!\]\]).)+)\]\]/u,shape:`subroutine`},{regex:/^([\w\p{L}-]+)\[\(((?:"[^"]*"|(?!\)\]).)+)\)\]/u,shape:`cylinder`},{regex:/^([\w\p{L}-]+)\[\/((?:"[^"]*"|(?![\\/]\]).)+)([\\/])\]/u,shape:e=>e===`\\`?`trapezoid`:`parallelogram`},{regex:/^([\w\p{L}-]+)\[\\((?:"[^"]*"|(?![\\/]\]).)+)([\\/])\]/u,shape:e=>e===`/`?`trapezoid-alt`:`parallelogram-alt`},{regex:/^([\w\p{L}-]+)>((?:"[^"]*"|(?!\]).)+)\]/u,shape:`asymmetric`},{regex:/^([\w\p{L}-]+)\{\{((?:"[^"]*"|(?!\}\}).)+)\}\}/u,shape:`hexagon`},{regex:/^([\w\p{L}-]+)\[((?:"[^"]*"|(?!\]).)+)\]/u,shape:`rectangle`},{regex:/^([\w\p{L}-]+)\(((?:"[^"]*"|(?!\)).)+)\)/u,shape:`rounded`},{regex:/^([\w\p{L}-]+)\{((?:"[^"]*"|(?!\}).)+)\}/u,shape:`diamond`}],vi=/^([\w\p{L}]+(?:-[\w\p{L}]+)*)/u,yi=/^([\w\p{L}-]+)(?=@\{)/u;function bi(e){if(e.shape)return(0,u.resolveShapeName)(e.shape)??`rectangle`;if(e.icon!==void 0||e.img!==void 0)switch(e.form?.toLowerCase()){case`circle`:return`circle`;case`rounded`:return`rounded`;default:return`rectangle`}return`rectangle`}function xi(e,t){return t.label!==void 0&&t.label.length>0?t.label:t.icon?t.icon:t.img?t.img:e}function Si(e,t){(0,c.applyClickStatement)(e,t.interactions)}var Ci=/^([\w-]+)(?=@\{)/;function wi(e,t){let n=e.match(Ci);if(!n||!t.edges.some(e=>e.id===n[1]))return!1;let r=(0,u.matchExpandedBlock)(e.slice(n[1].length));return r?(Ti(t,n[1],(0,u.parseExpandedMeta)(r.body)),!0):!1}function Ti(e,t,n){for(let r of e.edges)r.id===t&&(n.animate!==void 0&&(r.animate=n.animate.toLowerCase()!==`false`),n.animation!==void 0&&(r.animate=!0))}var Ei=/^:::([\w][\w-]*)/,Di=/^([\w\p{L}-]+):::([\w][\w-]*)/u;function Oi(e,t,n){let r=e.trim(),i=ki(r,t,n);if(!i||i.ids.length===0)return;r=i.remaining.trim();let a=i.ids;for(;r.length>0;){let e,i,o,s,l,u,d,f=r.match(/^([\w-]+)@(?=[-=<~ox])/);f&&(d=f[1],r=r.slice(f[0].length));let p=r.match(pi),m=p?.[2],h=p?.[1],g=p?.[3];if(p&&m!==void 0&&!(h===void 0&&g===void 0&&mi.has(m))){e=h!==void 0,l=hi(h);let t=p[4]?.trim();s=t?(0,c.normalizeBrTags)(t):void 0,r=r.slice(p[0].length).trim(),i=Ni(m),o=g!==void 0,u=hi(g)}else{let t=r.match(gi);if(!t)break;e=!!t[1],l=hi(t[1]);let n=t[3].trim();s=n?(0,c.normalizeBrTags)(n):void 0;let a=t[2],d=t[4];r=r.slice(t[0].length).trim(),i=Pi(a,d),u=hi(d.slice(-1)),o=d.endsWith(`>`)||u!==void 0}let _=ki(r,t,n);if(!_||_.ids.length===0)break;r=_.remaining.trim();for(let n of a)for(let r of _.ids)t.edges.push({source:n,target:r,label:s,style:i,hasArrowStart:e,hasArrowEnd:o,...l===void 0?{}:{startMarker:l},...u===void 0?{}:{endMarker:u},...d===void 0?{}:{id:d}});a=_.ids}}function ki(e,t,n){let r=Ai(e,t,n);if(!r)return null;let i=[r.id],a=r.remaining.trim();for(;a.startsWith(`&`);){a=a.slice(1).trim();let e=Ai(a,t,n);if(!e)break;i.push(e.id),a=e.remaining.trim()}return{ids:i,remaining:a}}function Ai(e,t,n){let r=null,i=e,a,o=i.match(Di);o&&(a=o[2],i=o[1]+i.slice(o[0].length));let s=i.match(yi);if(s){let e=s[1],a=(0,u.matchExpandedBlock)(i.slice(e.length));if(a){let o=(0,u.parseExpandedMeta)(a.body);ji(t,n,{id:e,label:(0,c.normalizeBrTags)(xi(e,o)),shape:bi(o)}),r=e,i=i.slice(e.length+a.length)}}if(r===null)for(let{regex:e,shape:a}of _i){let o=i.match(e);if(o){r=o[1];let e=(0,c.normalizeBrTags)(o[2]),s=typeof a==`function`?a(o[3]??``):a;ji(t,n,{id:r,label:e,shape:s}),i=i.slice(o[0].length);break}}if(r===null){let e=i.match(vi);e&&(r=e[1],t.nodes.has(r)||ji(t,n,{id:r,label:r,shape:`rectangle`}),i=i.slice(e[0].length))}if(r===null)return null;a&&t.classAssignments.set(r,a);let l=i.match(Ei);return l&&(t.classAssignments.set(r,l[1]),i=i.slice(l[0].length)),{id:r,remaining:i}}function ji(e,t,n){e.nodes.has(n.id)||e.nodes.set(n.id,n),Mi(t,n.id)}function Mi(e,t){if(e.length>0){let n=e[e.length-1];n.nodeIds.includes(t)||n.nodeIds.push(t)}}function Ni(e){return e.startsWith(`~`)?`invisible`:e.includes(`.`)?`dotted`:e.startsWith(`=`)?`thick`:`solid`}function Pi(e,t){return e.includes(`.`)||t.includes(`.`)?`dotted`:e.startsWith(`=`)||t.startsWith(`=`)?`thick`:`solid`}var Fi={type:`xychart`,parse:u.parseXYChart,layoutForSvg:ar,renderSvg(e,t,n){let r=n.interactivity===void 0?n.interactive??!1:n.interactivity===`full`;return _r(e,t.colors,t.font,t.transparent,r,t.embedSource,t.title,t.decorative,t.emit)}},Ii={type:`sequence`,parse:u.parseSequenceDiagram,layoutForSvg:Kn,renderSvg(e,t){return qn(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}};function Li(e){return(e.interactivity??`static`)!==`none`}function Ri(e){return(e.interactivity??`static`)===`full`}var zi={type:`class`,parse:u.parseClassDiagram,layoutForSvg:hn,renderSvg(e,t,n){return vn(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,Li(n),t.emit)}},Bi={type:`er`,parse:u.parseErDiagram,layoutForSvg(e,t){return Nn((0,c.withDirectionOverride)(e,t.direction),t)},renderSvg(e,t){return Pn(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},Vi={type:`flowchart`,parse:(e,t)=>si(t),layoutForSvg(e,t){return{graph:Ze((0,c.withDirectionOverride)(e,t.direction),t),curve:t.curve??e.initConfig?.curve??`linear`}},renderSvg(e,t,n){return $e(e.graph,t.colors,t.font,t.transparent,t.fontSizes,e.curve,t.embedSource,Ri(n),Li(n),t.title,t.decorative,t.emit)}},Hi={type:`c4`,parse:u.parseC4Diagram,layoutForSvg(e,t){return Kr(e,t)},renderSvg(e,t){return qr(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},Ui={xychart:Fi,er:Bi,sequence:Ii,class:zi,flowchart:Vi,architecture:{type:`architecture`,parse:u.parseArchitecture,layoutForSvg(e,t){return{graph:Ze((0,c.withDirectionOverride)((0,u.architectureToGraph)(e),t.direction),t),curve:t.curve??`linear`}},renderSvg:Vi.renderSvg},c4:Hi};function Wi(e){return{bg:e.bg??c.DEFAULTS.bg,fg:e.fg??c.DEFAULTS.fg,line:e.line,accent:e.accent,muted:e.muted,surface:e.surface,border:e.border}}function Gi(e={}){return(0,c.themeStyleDeclarations)(Wi(e),e.transparent)}function Ki(e){return{nonce:e.nonce,styleAttribute:e.styleAttribute}}function qi(e,t={}){let n=Ji(e,t);return t.resolveColors?un(n,Wi(t)):n}function Ji(e,t){let n=(0,d.decodeXML)(e),r=Wi(t),i=t.font??`Inter`;(0,c.setMonospaceMetrics)((0,c.isMonospaceFont)(i));let a=t.transparent??!1,o=A(t.fontSizes),s=(0,c.detectDiagramType)(n),l=t.embedSource?e:void 0,u=t.title,f=t.decorative,p=Ki(t),m=(0,c.splitStatements)(n),h=Ui[s],g=h.parse(m,n),_=h.layoutForSvg(g,t),v={colors:r,font:i,transparent:a,fontSizes:o,embedSource:l,title:u,decorative:f,emit:p};return h.renderSvg(_,v,t)}async function Yi(e,t={}){return qi(e,t)}var Xi=qi,Zi=Yi;exports.ARROW_HEAD=I,exports.CLS=H,exports.ELK_DIRECTION_FALLBACK=ee,exports.FONT_SIZES=k,exports.FONT_WEIGHTS=j,exports.GROUP_HEADER_CONTENT_PAD=M,exports.INLINE_CENTERED_EDGE_LABEL=ie,exports.MONO_FONT=D,exports.MONO_FONT_STACK=O,exports.NODE_PADDING=N,exports.STROKE_WIDTHS=P,exports.TEXT_BASELINE_SHIFT=F,exports.baseElkLayoutOptions=re,exports.boxLabelHeight=Wn,exports.buildElkEdge=z,exports.buildElkEdgeLabel=ae,exports.buildElkLeafNode=R,exports.classNoteId=dn,exports.clipEdgeToShape=be,exports.convertToElkFormat=Qe,exports.createLayoutCache=x,exports.directionToElk=te,exports.elkLayoutSync=w,exports.elkPadding=ne,exports.estimateMonoTextWidth=E,exports.estimateTextWidth=T,exports.evaluateCssColorValue=rn,exports.extractEdgeLabelPosition=je,exports.extractEdgePoints=Ae,exports.formatTickLabels=mr,exports.layoutClassDiagramSync=hn,exports.layoutErDiagramSync=Nn,exports.layoutGraphSync=Ze,exports.layoutSequenceDiagram=Kn,exports.layoutXYChart=ar,exports.niceTickValues=pr,exports.pointsToPath=_,exports.renderClassSvg=vn,exports.renderErSvg=Pn,exports.renderMermaid=Zi,exports.renderMermaidSVG=qi,exports.renderMermaidSVGAsync=Yi,exports.renderMermaidSync=Xi,exports.renderSequenceSvg=qn,exports.renderSvg=$e,exports.renderXYChartSvg=_r,exports.resolveCssColors=un,exports.resolveFontSizes=A,exports.smoothCurvePath=xr,exports.themeCssVariables=Gi,exports.withDataSrc=V;
65
+ </style>`,defs:``}}function Yi(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${J(e)},${J(t)} h${J(n)} v${J(r)} h${J(-n)} Z`:[`M${J(e)},${J(t+a)}`,`Q${J(e)},${J(t)} ${J(e+a)},${J(t)}`,`L${J(e+n-a)},${J(t)}`,`Q${J(e+n)},${J(t)} ${J(e+n)},${J(t+a)}`,`L${J(e+n)},${J(t+r-a)}`,`Q${J(e+n)},${J(t+r)} ${J(e+n-a)},${J(t+r)}`,`L${J(e+a)},${J(t+r)}`,`Q${J(e)},${J(t+r)} ${J(e)},${J(t+r-a)}`,`Z`].join(` `)}function Xi(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${J(e)},${J(t)} h${J(n)} v${J(r)} h${J(-n)} Z`:[`M${J(e+a)},${J(t)}`,`L${J(e+n-a)},${J(t)}`,`Q${J(e+n)},${J(t)} ${J(e+n)},${J(t+a)}`,`L${J(e+n)},${J(t+r-a)}`,`Q${J(e+n)},${J(t+r)} ${J(e+n-a)},${J(t+r)}`,`L${J(e+a)},${J(t+r)}`,`Q${J(e)},${J(t+r)} ${J(e)},${J(t+r-a)}`,`L${J(e)},${J(t+a)}`,`Q${J(e)},${J(t)} ${J(e+a)},${J(t)}`,`Z`].join(` `)}function Zi(e){if(e.length===0)return``;if(e.length===1)return`M${J(e[0].x)},${J(e[0].y)}`;if(e.length===2)return`M${J(e[0].x)},${J(e[0].y)} L${J(e[1].x)},${J(e[1].y)}`;let t=e.length,n=[],r=[];for(let i=0;i<t-1;i++)n.push(e[i+1].x-e[i].x),r.push(n[i]===0?0:(e[i+1].y-e[i].y)/n[i]);let i=Array(t).fill(0);for(let e=1;e<t-1;e++){let t=r[e-1],a=r[e];if(t*a<=0)continue;let o=2*n[e]+n[e-1],s=n[e]+2*n[e-1];i[e]=(o+s)/(o/t+s/a)}let a=(e,t,n,r)=>{let i=((2*e+t)*n-e*r)/(e+t);return i*n<=0?i=0:n*r<=0&&Math.abs(i)>3*Math.abs(n)&&(i=3*n),i};i[0]=a(n[0],n[1],r[0],r[1]),i[t-1]=a(n[t-2],n[t-3],r[t-2],r[t-3]);let o=`M${J(e[0].x)},${J(e[0].y)}`;for(let r=0;r<t-1;r++){let t=n[r]/3,a=e[r].x+t,s=e[r].y+i[r]*t,c=e[r+1].x-t,l=e[r+1].y-i[r+1]*t;o+=` C${J(a)},${J(s)} ${J(c)},${J(l)} ${J(e[r+1].x)},${J(e[r+1].y)}`}return o}function Qi(e,t,n,r){let i=T(n,q.fontSize,600),a=Math.max(...r.map(e=>{let t=T(e.legendLabel,q.fontSize,q.fontWeight),n=T(e.text,q.fontSize,q.fontWeight);return t+10+n})),o=Math.max(i,a)+q.padX*2,s=26+r.length*20+6,c=Math.max(q.minY,t-q.offsetY-s-q.pointerSize),l=e-o/2,u=e,d=c+s,f=q.pointerSize,p=`<polygon points="${J(u-f)},${J(d)} ${J(u+f)},${J(d)} ${J(u)},${J(d+f)}" class="xychart-tip xychart-tip-ptr"/>`,m=`<rect x="${J(l)}" y="${J(c)}" width="${J(o)}" height="${s}" rx="${q.rx}" class="xychart-tip xychart-tip-bg"/>`;m+=p;let h=c+6+10;m+=`<text x="${J(e)}" y="${J(h)}" text-anchor="middle" font-weight="600" font-size="${q.fontSize}" dy="${P}" class="xychart-tip xychart-tip-text">${Y(n)}</text>`;let g=l+q.padX,_=l+o-q.padX;for(let e of r)h+=20,m+=`<text x="${J(g)}" y="${J(h)}" text-anchor="start" font-size="${q.fontSize}" font-weight="${q.fontWeight}" dy="${P}" class="xychart-tip xychart-tip-text">${Y(e.legendLabel)}</text>`,m+=`<text x="${J(_)}" y="${J(h)}" text-anchor="end" font-size="${q.fontSize}" font-weight="${q.fontWeight}" dy="${P}" class="xychart-tip xychart-tip-text">${Y(e.text)}</text>`;return m}function $i(e,t,n){let r=T(n,q.fontSize,q.fontWeight)+q.padX*2,i=q.height,a=Math.max(q.minY,t-q.offsetY-i-q.pointerSize),o=e-r/2,s=e,c=a+i/2,l=e,u=a+i,d=q.pointerSize,f=`<polygon points="${J(l-d)},${J(u)} ${J(l+d)},${J(u)} ${J(l)},${J(u+d)}" class="xychart-tip xychart-tip-ptr"/>`;return`<rect x="${J(o)}" y="${J(a)}" width="${J(r)}" height="${i}" rx="${q.rx}" class="xychart-tip xychart-tip-bg"/>`+f+`<text x="${J(s)}" y="${J(c)}" text-anchor="middle" dy="${P}" class="xychart-tip xychart-tip-text">${Y(n)}</text>`}function ea(e){return Number.isInteger(e)?e.toLocaleString(`en-US`):e.toFixed(+(Math.abs(e)<10))}function J(e){return String(Math.round(e*10)/10)}function Y(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}var ta=2048,na=[569,569,727,1139,1139,1821,1366,391,682,682,797,1196,569,682,569,569,1139,1139,1139,1139,1139,1139,1139,1139,1139,1139,569,569,1196,1196,1196,1139,2079,1366,1366,1479,1479,1366,1251,1593,1479,569,1024,1366,1139,1706,1479,1593,1366,1593,1479,1366,1251,1479,1366,1933,1366,1366,1251,569,569,569,961,1139,682,1139,1139,1024,1139,1139,569,1139,1139,455,455,1024,455,1706,1139,1139,1139,1139,682,1024,569,1139,1024,1479,1024,1024,1024,684,532,684,1196],ra=[569,682,971,1139,1139,1821,1479,487,682,682,797,1196,569,682,569,569,1139,1139,1139,1139,1139,1139,1139,1139,1139,1139,682,682,1196,1196,1196,1251,1992,1479,1479,1479,1479,1366,1251,1593,1479,569,1139,1479,1251,1706,1479,1593,1366,1593,1479,1366,1251,1479,1366,1933,1366,1366,1251,682,569,682,1196,1139,682,1139,1251,1139,1251,1139,682,1251,1251,569,569,1139,569,1821,1251,1251,1251,1251,797,1139,682,1251,1139,1593,1139,1139,1024,801,573,801,1196];function ia(e,t){let n=e.codePointAt(0);if(!(n<32||n>126))return(t?ra:na)[n-32]/ta}var X={width:216,diagramMarginX:50,diagramMarginY:10,shapeMargin:50,shapePadding:20,shapeInRow:4,boundaryInRow:2,nextLinePaddingX:0,screenWidth:1440,nameSize:14,typeSize:10.5,descrSize:11.5,messageSize:12,boundarySize:14,nameLine:15.35,typeLine:15.72,descrLine:17.1,descrExtraLine:12.48,textScale:.922,boundaryLabelHeight:18,boundaryTypeHeight:16.1,boundaryDescrHeight:14.4,rootHeadingHeight:47,titleExtra:60,cornerRadius:12,strokeWidth:2,personRx:.177,personRxMaxOfHeight:.45,personHeadRatio:.23,personHeadMin:16,personHeadMax:56,personHeadOverlap:.27,dbTrim:3.91,queueExtra:10},aa=X.width-2*X.shapePadding;function oa(e,t,n){let r=[];for(let i of e.split(`
66
+ `)){let e=``;for(let a of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${a}`:a;e&&Z(i,n,400)>t?(r.push(e),e=a):e=i}r.push(e)}return r}function sa(e,t){let n=Math.min(Math.max(e*X.personHeadRatio,X.personHeadMin),X.personHeadMax),r=n*(2-X.personHeadOverlap),i=t===void 0?1/0:t-r;return{rx:Math.min(e*X.personRx,i*X.personRxMaxOfHeight),headRadius:n,pillTop:r}}function ca(e,t){return e*X.nameLine+X.typeLine+la(t)}function la(e){return e===0?0:X.descrLine+(e-1)*X.descrExtraLine}function ua(e){let t=e/2;return{rx:t,ry:t/(2.5+e/50)}}function da(e){let t=e/2;return{rx:t/(2.5+e/50),ry:t}}function Z(e,t,n){let r=0;for(let i of e){let e=ia(i,n>=600);r+=e===void 0?T(i,t,n)*X.textScale:e*t}return r}function fa(e,t,n,r){let i=ca(t,n),a=i+2*X.shapePadding,o=Math.max(X.width,r+2*X.shapePadding);if(e.kind===`person`)return{width:o,height:sa(o).pillTop+a,textHeight:i};if(e.shape===`db`){let{ry:e}=ua(o);return{width:o,height:a+2*e-X.dbTrim,textHeight:i}}if(e.shape===`queue`){let e=i+X.queueExtra,{rx:t}=da(e);return{width:o+3*t,height:e,textHeight:i}}return{width:o,height:a,textHeight:i}}function pa(e){let t=`#ffffff`;if(e.external)switch(e.kind){case`person`:return{fill:`#686868`,stroke:`#8a8a8a`,text:t};case`system`:return{fill:`#999999`,stroke:`#8a8a8a`,text:t};case`container`:return{fill:`#b3b3b3`,stroke:`#a6a6a6`,text:t};case`component`:return{fill:`#cccccc`,stroke:`#bfbfbf`,text:t}}switch(e.kind){case`person`:return{fill:`#08427b`,stroke:`#073b6f`,text:t};case`system`:return{fill:`#1168bd`,stroke:`#3c7fc0`,text:t};case`container`:return{fill:`#438dd5`,stroke:`#3c7fc0`,text:t};case`component`:return{fill:`#85bbf0`,stroke:`#78a8d8`,text:t}}}function ma(){return{next:{cnt:0}}}function ha(e,t,n,r,i){e.next.startx=e.startx=t,e.next.stopx=e.stopx=n,e.next.starty=e.starty=r,e.next.stopy=e.stopy=i}function Q(e,t,n,r){let i=e[t];e[t]=i===void 0?n:r(n,i)}function ga(e,t){e.next.cnt+=1;let n=X.shapeMargin,r=e.next.startx===e.next.stopx?e.next.stopx+n:e.next.stopx+n*2,i=r+t.width,a=e.next.starty+n*2,o=a+t.height;(r>=e.widthLimit||i>=e.widthLimit||e.next.cnt>X.shapeInRow)&&(r=e.next.startx+n+X.nextLinePaddingX,a=e.next.stopy+n*2,e.next.stopx=i=r+t.width,e.next.starty=e.next.stopy,e.next.stopy=o=a+t.height,e.next.cnt=1),t.x=r,t.y=a,Q(e,`startx`,r,Math.min),Q(e,`starty`,a,Math.min),Q(e,`stopx`,i,Math.max),Q(e,`stopy`,o,Math.max),Q(e.next,`startx`,r,Math.min),Q(e.next,`starty`,a,Math.min),Q(e.next,`stopx`,i,Math.max),Q(e.next,`stopy`,o,Math.max)}function _a(e){let t=oa(e.label,aa,X.nameSize),n=e.description?oa(e.description,aa,X.descrSize):[],r=Math.max(...t.map(e=>Z(e,X.nameSize,700)),Z((0,u.c4TypeLine)(e),X.typeSize,400),...n.map(e=>Z(e,X.descrSize,400)));return{el:e,nameLines:t,descriptionLines:n,x:0,y:0,...fa(e,t.length,n.length,r)}}function va(e){let t=new Set,n=new Map(e.elements.map(e=>[e.alias,e])),r=e=>{let i=e.elementAliases.flatMap(e=>{t.add(e);let r=n.get(e);return r?[r]:[]});return{alias:e.alias,boundary:e,elements:i,children:e.children.map(r)}},i=e.boundaries.map(r);return{alias:`global`,elements:e.elements.filter(e=>!t.has(e.alias)),children:i}}function ya(e){let t=new Map,n=[],r=X.diagramMarginX,i=X.diagramMarginY,a=(e,n)=>{for(let r of n){let n=_a(r);t.set(r.alias,n),ga(e,n)}e.stopx+=X.shapeMargin,e.stopy+=X.shapeMargin},o=(e,t,s)=>{let c=ma();c.widthLimit=e.widthLimit/Math.min(X.boundaryInRow,t.length);for(let[l,d]of t.entries()){let t=d.boundary,f=0,p=f+8;f=p+X.boundaryLabelHeight;let m;t&&(0,u.c4BoundaryTypeLine)(t)&&(m=f+5,f=m+X.boundaryTypeHeight);let h;if(t?.description&&(h=f+20,f=h+X.boundaryDescrHeight),t||(f=X.rootHeadingHeight),l===0||l%X.boundaryInRow===0){let t=e.startx+X.diagramMarginX,n=e.stopy+X.diagramMarginY+f;ha(c,t,t,n,n)}else{let e=c.stopx===c.startx?c.startx:c.stopx+X.diagramMarginX;ha(c,e,e,c.starty,c.starty)}if(d.elements.length>0&&a(c,d.elements),d.children.length>0&&o(c,d.children,s+1),t){let e=c.stopx-c.startx,r=c.stopy-c.starty;e===0&&(e=X.width),r===0&&(r=f+X.shapeMargin),n.push({alias:t.alias,label:t.label,...t.type?{type:t.type}:{},...t.description?{description:t.description}:{},x:c.startx,y:c.starty,width:e,height:r,depth:s,labelY:p,...m===void 0?{}:{typeY:m},...h===void 0?{}:{descrY:h}})}e.stopy=Math.max(c.stopy+X.shapeMargin,e.stopy),e.stopx=Math.max(c.stopx+X.shapeMargin,e.stopx),r=Math.max(r,e.stopx),i=Math.max(i,e.stopy)}},s=ma();return ha(s,X.diagramMarginX,X.diagramMarginX,X.diagramMarginY,X.diagramMarginY),s.widthLimit=X.screenWidth,o(s,[e],-1),{elements:t,boundaries:n,maxX:r,maxY:i}}function ba(e,t){let n=e.x+e.width/2,r=e.y+e.height/2,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(i===0&&a===0)return{x:n,y:r};let c,l;if(Math.abs(a)*o>Math.abs(i)*s){let e=a<0?-s:s;c=e*i/a,l=e}else{let e=i<0?-o:o;c=e,l=e*a/i}return{x:n+c,y:r+l}}function xa(e,t){let n=sa(e.width,e.height),r=e.x+e.width/2,i=e.y+e.height/2,a=e.width,o=e.height,s=-o/2+n.headRadius,c=-o/2+n.pillTop,l=n.rx,u=(e,t,n,r,i,a)=>Array.from({length:r},(o,s)=>{let c=(i+s*(a-i)/(r-1))*Math.PI/180;return{x:e-n*Math.cos(c),y:t-n*Math.sin(c)}}),d=Math.asin(Math.min(1,(c-s)/n.headRadius))*180/Math.PI,f=[...u(0,s,n.headRadius,24,180+d,-d),...u(-a/2+l,c+l,l,12,90,0),...u(-a/2+l,o/2-l,l,12,360,270),...u(a/2-l,o/2-l,l,12,270,180),...u(a/2-l,c+l,l,12,180,90)];return Ca({x:r,y:i},t,f.map(e=>({x:r+e.x,y:i+e.y})))}function Sa(e,t,n,r){let i=t.y-e.y,a=e.x-t.x,o=t.x*e.y-e.x*t.y,s=i*n.x+a*n.y+o,c=i*r.x+a*r.y+o;if(s!==0&&c!==0&&s*c>0)return;let l=r.y-n.y,u=n.x-r.x,d=r.x*n.y-n.x*r.y,f=l*e.x+u*e.y+d,p=l*t.x+u*t.y+d;if(f!==0&&p!==0&&f*p>0)return;let m=i*u-l*a;if(m===0)return;let h=Math.abs(m/2),g=a*d-u*o,_=g<0?(g-h)/m:(g+h)/m;return g=l*o-i*d,{x:_,y:g<0?(g-h)/m:(g+h)/m}}function Ca(e,t,n){let r,i=1/0;return n.forEach((a,o)=>{let s=Sa(e,t,a,n[(o+1)%n.length]);if(!s)return;let c=Math.hypot(s.x-t.x,s.y-t.y);c<i&&(r=s,i=c)}),r??e}var wa=1e-6;function Ta(e,t){let n=ba(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=ua(e.width),s=n.x-r,c=Math.abs(s)<e.width/2-wa||Math.abs(Math.abs(s)-e.width/2)<=wa&&Math.abs(n.y-i)>e.height/2-o;if(a===0||!c)return n;let l=o*o*(1-s*s/(a*a)),u=o-(l>0?Math.sqrt(l):l);return t.y-i>0&&(u=-u),{x:n.x,y:n.y+u}}function Ea(e,t){let n=ba(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=da(e.height),s=n.y-i,c=Math.abs(s)<e.height/2-wa||Math.abs(Math.abs(s)-e.height/2)<=wa&&Math.abs(n.x-r)>e.width/2-a;if(o===0||!c)return n;let l=a*a*(1-s*s/(o*o)),u=a-Math.sqrt(Math.abs(l));return t.x-r>0&&(u=-u),{x:n.x+u,y:n.y}}function Da(e,t){let n=e.el;return n?.kind===`person`?xa(e,t):n?.shape===`db`?Ta(e,t):n?.shape===`queue`?Ea(e,t):ba(e,t)}var Oa=e=>({x:e.x+e.width/2,y:e.y+e.height/2});function ka(e,t,n,r){let i=n.get(e.from),a=n.get(e.to),o=Da(i,Oa(a)),s=Da(a,Oa(i)),c=s.x-o.x,l=s.y-o.y,d=e=>({x:e.x,y:e.y+r}),f={...e,points:[d(o),d(s)]};if(t>0&&(f.curve=d({x:o.x+c/2-c/4,y:o.y+l/2})),(0,u.c4RelLabelLines)(e).length>0){let t={x:Math.min(o.x,s.x)+Math.abs(c)/2,y:Math.min(o.y,s.y)+Math.abs(l)/2},n=(0,u.c4RelLabelLines)(e)[0],r=e.label!==``||e.index!==void 0?Z(n??``,X.messageSize,400):0;if(f.labelPosition=d({x:t.x+r/2,y:t.y}),e.technology){let n=Z(`[${e.technology}]`,X.messageSize,400);f.technologyX=t.x+Math.max(r,n)/2}}return f}var Aa=2,ja=2;function Ma(e,t){let n=e.labelPosition;return n?(0,u.c4RelLabelLines)(e).map((r,i,a)=>({cx:(e.technology!==void 0&&i===a.length-1&&e.technologyX!==void 0?e.technologyX:n.x)+t,cy:n.y+(i===0?0:X.messageSize+5),w:Z(r,X.messageSize,400),h:X.messageSize})):[]}var Na=(e,t)=>Math.abs(e.cx-t.cx)<(e.w+t.w)/2+Aa&&Math.abs(e.cy-t.cy)<(e.h+t.h)/2+Aa;function Pa(e,t,n){let r=e.points[0],i=e.points[e.points.length-1];if(!e.labelPosition||!r||!i)return;let a=i.x-r.x,o=i.y-r.y,s=Math.hypot(a,o);if(s===0)return;let c=a/s,l=o/s,u=r=>{let i=Ma(e,r*c).map(e=>({...e,cy:e.cy+r*l}));return i.some(e=>[...t,...n].some(t=>Na(e,t)))?void 0:i};for(let t=0;t<=s/2;t+=ja)for(let r of t===0?[1]:[1,-1]){let i=u(r*t);if(i){t!==0&&(e.labelPosition={x:e.labelPosition.x+r*t*c,y:e.labelPosition.y+r*t*l},e.technologyX!==void 0&&(e.technologyX+=r*t*c)),n.push(...i);return}}n.push(...Ma(e,0))}function Fa(e,t={}){if(e.elements.length===0&&e.boundaries.length===0){let t={variant:e.variant,width:0,height:0,elements:[],boundaries:[],relationships:[]};return e.title&&(t.title=e.title),t}let n=ya(va(e)),r=e.title?X.titleExtra:0,i=X.diagramMarginY+r,a=e.elements.flatMap(e=>{let t=n.elements.get(e.alias);return t?[{...e,x:t.x,y:t.y+i,width:t.width,height:t.height,nameLines:t.nameLines,descriptionLines:t.descriptionLines}]:[]}),o=[...n.boundaries].sort((e,t)=>e.depth-t.depth).map(e=>({...e,y:e.y+i})),s=new Map;for(let e of n.elements.values())s.set(e.el.alias,e);for(let e of n.boundaries)s.set(e.alias,e);let c=e.relationships.map((e,t)=>ka(e,t,s,i)),l=a.map(e=>({cx:e.x+e.width/2,cy:e.y+e.height/2,w:e.width+12,h:e.height+12})),u=[];for(let e of c)Pa(e,l,u);let d=n.maxX+X.diagramMarginX,f=n.maxY+X.diagramMarginY+r,p={variant:e.variant,width:d,height:f,elements:a,boundaries:o,relationships:c};return e.title&&(p.title=e.title,p.titlePosition={x:(n.maxX-X.diagramMarginX)/2-4*X.diagramMarginX,y:X.diagramMarginY+X.diagramMarginY+i}),p}function Ia(e,t,n=`Inter`,r=!1,i=k,a,o,s,l={}){let u=[];u.push(nr((0,c.svgOpenTag)(e.width,e.height,t,r,o??e.title,s,void 0,l.styleAttribute),a)),u.push((0,c.buildStyleBlock)(n,!1,l.nonce)),e.title&&e.titlePosition&&u.push(c.f`<text class="c4-title" x="${e.titlePosition.x}" y="${e.titlePosition.y}" dy="${P}" `+c.f`font-size="16" fill="var(--_text)">${(0,c.escapeXml)(e.title)}</text>`);for(let t of e.boundaries)u.push(La(t));for(let t of e.elements)u.push(Ra(t));for(let t of e.relationships)u.push(Ua(t)),u.push(Wa(t));return u.push(`</svg>`),u.filter(Boolean).join(`
67
+ `)}function $(e,t,n,r,i){return c.f` <text x="${t}" y="${n}" text-anchor="middle" dy="${P}" font-size="${r}" `+c.f`${i}>${(0,c.escapeXml)(e)}</text>`}function La(e){let t=[];t.push(c.f`<g class="c4-boundary" data-id="${(0,c.escapeAttr)(e.alias)}" data-label="${(0,c.escapeAttr)(e.label)}" data-depth="${e.depth}">`),t.push(c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="2.5" ry="2.5" `+`fill="none" stroke="var(--_text)" stroke-width="1" stroke-dasharray="7,7" />`);let n=e.x+e.width/2;t.push($(e.label,n,e.y+(e.labelY??8),X.boundarySize+2,`font-weight="700" fill="var(--_text)"`));let r=(0,u.c4BoundaryTypeLine)({alias:e.alias,label:e.label,...e.type?{type:e.type}:{},elementAliases:[],children:[]});return r&&e.typeY!==void 0&&t.push($(r,n,e.y+e.typeY,X.boundarySize,`fill="var(--_text)"`)),e.description&&e.descrY!==void 0&&t.push($(e.description,n,e.y+e.descrY,X.boundarySize-2,`fill="var(--_text)"`)),t.push(`</g>`),t.join(`
68
+ `)}function Ra(e){let t=pa(e),{x:n,y:r,width:i,height:a}=e,o=n+i/2,s=ca(e.nameLines.length,e.descriptionLines.length),l=[];l.push(c.f`<g class="c4-element" data-id="${(0,c.escapeAttr)(e.alias)}" data-kind="${e.kind}" data-shape="${e.shape}" `+c.f`data-external="${e.external}" data-label="${(0,c.escapeAttr)(e.label)}">`);let d,f=o;if(e.kind===`person`)l.push(...za(e,t)),d=r+sa(i).pillTop+X.shapePadding;else if(e.shape===`db`){l.push(...Ba(e,t));let{ry:n}=ua(i);d=r+(2*n+a)/2-s/2}else if(e.shape===`queue`){l.push(...Va(e,t));let{rx:n}=da(a);f=o-n,d=r+a/2-s/2}else l.push(c.f` <rect x="${n}" y="${r}" width="${i}" height="${a}" rx="${X.cornerRadius}" ry="${X.cornerRadius}" `+c.f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${X.strokeWidth}" />`),d=r+X.shapePadding;let p=d;for(let n of e.nameLines)l.push($(n,f,p+X.nameLine/2,X.nameSize,c.f`font-weight="700" fill="${t.text}"`)),p+=X.nameLine;return l.push($((0,u.c4TypeLine)(e),f,p+X.typeLine/2,X.typeSize,c.f`fill="${t.text}"`)),p+=X.typeLine,e.descriptionLines.forEach((e,n)=>{l.push($(e,f,p+X.descrLine/2+n*X.descrExtraLine,X.descrSize,c.f`fill="${t.text}"`))}),p+=la(e.descriptionLines.length),l.push(`</g>`),l.join(`
69
+ `)}function za(e,t){let{x:n,width:r}=e,{rx:i,headRadius:a,pillTop:o}=sa(r,e.height),s=e.y,l=n+r/2,u=s+o,d=e.y+e.height-u,f=c.f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${X.strokeWidth}"`;return[c.f` <rect x="${n}" y="${u}" width="${r}" height="${d}" rx="${i}" ry="${i}" ${f} />`,c.f` <circle cx="${l}" cy="${s+a}" r="${a}" ${f} />`]}function Ba(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=ua(i),l=c.f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${X.strokeWidth}"`;return[c.f` <path d="M ${n} ${r+s} L ${n} ${r+a-s} A ${o} ${s} 0 0 0 ${n+i} ${r+a-s} L ${n+i} ${r+s} Z" ${l} />`,c.f` <ellipse cx="${n+o}" cy="${r+s}" rx="${o}" ry="${s}" ${l} />`]}function Va(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=da(a),l=c.f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${X.strokeWidth}"`;return[c.f` <path d="M ${n+i-o} ${r} H ${n+o} A ${o} ${s} 0 0 0 ${n+o} ${r+a} H ${n+i-o} Z" ${l} />`,c.f` <ellipse cx="${n+i-o}" cy="${r+s}" rx="${o}" ry="${s}" ${l} />`]}function Ha(e,t){let n=e.x-t.x,r=e.y-t.y,i=Math.hypot(n,r);if(i===0)return``;let a=n/i,o=r/i,s=e.x-a*10,l=e.y-o*10;return c.f`<polygon class="c4-arrowhead" points="${e.x},${e.y} ${s-o*5},${l+a*5} ${s+o*5},${l-a*5}" `+`fill="var(--_text)" />`}function Ua(e){let[t,n]=[e.points[0],e.points[e.points.length-1]];if(!t||!n||t===n)return``;let r=[`class="c4-relationship"`,c.f`data-from="${(0,c.escapeAttr)(e.from)}"`,c.f`data-to="${(0,c.escapeAttr)(e.to)}"`];e.label&&r.push(c.f`data-label="${(0,c.escapeAttr)(e.label)}"`),e.technology&&r.push(c.f`data-technology="${(0,c.escapeAttr)(e.technology)}"`);let i=e.curve?c.f`M ${t.x},${t.y} Q ${e.curve.x},${e.curve.y} ${n.x},${n.y}`:c.f`M ${t.x},${t.y} L ${n.x},${n.y}`,a=c.f`<path ${r.join(` `)} d="${i}" fill="none" stroke="var(--_text)" stroke-width="1" />`,o=e.curve??t,s=e.curve??n,l=Ha(n,o),u=Ha(t,s);return[a,...e.bidirectional?[l,u]:[e.reversed?u:l]].filter(Boolean).join(`
70
+ `)}function Wa(e){let t=(0,u.c4RelLabelLines)(e);if(t.length===0||!e.labelPosition)return``;let{x:n,y:r}=e.labelPosition,i=[c.f`<g class="c4-relationship-label" data-from="${(0,c.escapeAttr)(e.from)}" data-to="${(0,c.escapeAttr)(e.to)}">`];return t.forEach((a,o)=>{let s=e.technology!==void 0&&o===t.length-1,c=r+(o===0?0:X.messageSize+5);i.push($(a,s&&e.technologyX!==void 0?e.technologyX:n,c,X.messageSize,s?`font-style="italic" fill="var(--_text)"`:`fill="var(--_text)"`))}),i.push(`</g>`),i.join(`
71
+ `)}function Ga(e){let t=e.trim();return t.length>=2&&(t[0]===`"`&&t[t.length-1]===`"`||t[0]===`'`&&t[t.length-1]===`'`)?t.slice(1,-1):t}var Ka=`"graph <dir>"/"flowchart <dir>" (dir: TD, TB, LR, BT, RL), "stateDiagram-v2", "sequenceDiagram", "classDiagram", "erDiagram", "xychart-beta", "C4Context"/"C4Container"/"C4Component"/"C4Dynamic"/"C4Deployment", "architecture-beta"`;function qa(e){let t=e.trim().toLowerCase();if(/^sequence/.test(t))return`sequenceDiagram`;if(/^class/.test(t))return`classDiagram`;if(/^er/.test(t))return`erDiagram`;if(/^xychart/.test(t))return`xychart-beta`;if(/^state/.test(t))return`stateDiagram-v2`}var Ja=/^(?:[\w-]+@)?<?(?:-{2,}|={2,}|-\.+-?|~{3,})/;function Ya(e){let t=[];for(let n of e)n.forEach((e,n)=>{if(n===0&&t.length>0&&Ja.test(e.text)){let n=t[t.length-1];t[t.length-1]={text:`${n.text} ${e.text}`,line:n.line}}else t.push(e)});return t}function Xa(e){let t=(0,c.extractInitConfig)(e.split(`
72
+ `).map(e=>e.trim())),n=Ya((0,c.splitStatementsByLine)(e));if(n.length===0)throw Error(`Empty mermaid diagram`);let r=n[0],i=/^stateDiagram(-v2)?\s*$/i.test(r.text)?Qa(n):Za(n);return i.initConfig=t,i}function Za(e){let t=e[0];if(t===void 0)throw Error(`parseFlowchart called with no lines`);let n=t.text,r=n.match(/^(?:graph|flowchart)\s+(TD|TB|LR|BT|RL)\s*$/i);if(!r){let e=n.match(/^(?:graph|flowchart)\b\s*(.*)$/i);if(e){let r=e[1].trim();throw Error(r.length>0?`Line ${t.line}: Invalid direction "${r}" in header "${n}". Expected one of: TD, TB, LR, BT, RL.`:`Line ${t.line}: Missing direction in header "${n}". Expected e.g. "graph TD" or "flowchart LR" — one of: TD, TB, LR, BT, RL.`)}let r=qa(n),i=r&&r.toLowerCase()!==n.trim().toLowerCase()?` Did you mean "${r}"?`:``;throw Error(`Line ${t.line}: Invalid mermaid header: "${n}".${i} Supported headers: ${Ka}.`)}let i={direction:(0,c.toDirection)(r[1]),nodes:new Map,edges:[],subgraphs:[],classDefs:new Map,classAssignments:new Map,nodeStyles:new Map,linkStyles:new Map,interactions:new Map},a=[];for(let t=1;t<e.length;t++){let n=e[t].text;if((0,c.tryApplyClassDef)(n,i)||(0,c.tryApplyClassAssignment)(n,i)||(0,c.tryApplyStyleStatement)(n,i))continue;if(/^click\s+/i.test(n)){fo(n,i);continue}if(mo(n,i))continue;let r=n.match(/^linkStyle\s+(default|[\d,\s]+)\s+(.+)$/);if(r){let e=r[1].trim(),t=(0,c.parseStyleProps)(r[2]);if(e==="default")i.linkStyles.set(`default`,{...i.linkStyles.get(`default`),...t});else{let n=e.split(`,`).map(e=>parseInt(e.trim(),10));for(let e of n)isNaN(e)||i.linkStyles.set(e,{...i.linkStyles.get(e),...t})}continue}let o=n.match(/^direction\s+(TD|TB|LR|BT|RL)\s*$/i);if(o&&a.length>0){a[a.length-1].direction=(0,c.toDirection)(o[1]);continue}let s=n.match(/^subgraph\s+(.+)$/);if(s){let e=s[1].trim(),t=e.match(/^([^\s[]+)\s*\[(.+)\]$/),n,r;t?(n=t[1],r=(0,c.normalizeBrTags)(Ga(t[2]))):(r=(0,c.normalizeBrTags)(Ga(e)),n=r.replace(/\s+/g,`_`).replace(/[^\p{L}\p{N}_-]/gu,``));let i={id:n,label:r,nodeIds:[],children:[]};a.push(i);continue}if(n===`end`){let e=a.pop();e&&(a.length>0?a[a.length-1].children.push(e):i.subgraphs.push(e));continue}vo(n,i,a)}return i}function Qa(e){let t={direction:`TD`,nodes:new Map,edges:[],subgraphs:[],classDefs:new Map,classAssignments:new Map,nodeStyles:new Map,linkStyles:new Map,interactions:new Map},n=[],r=new Set,i=0,a=0;for(let o=1;o<e.length;o++){let s=e[o].text;if((0,c.tryApplyClassDef)(s,t)||(0,c.tryApplyClassAssignment)(s,t)||(0,c.tryApplyStyleStatement)(s,t))continue;let l=s.match(/^direction\s+(TD|TB|LR|BT|RL)\s*$/i);if(l){n.length>0?n[n.length-1].direction=(0,c.toDirection)(l[1]):t.direction=(0,c.toDirection)(l[1]);continue}let u=s.match(/^linkStyle\s+(default|[\d,\s]+)\s+(.+)$/);if(u){let e=u[1].trim(),n=(0,c.parseStyleProps)(u[2]);if(e==="default")t.linkStyles.set(`default`,{...t.linkStyles.get(`default`),...n});else{let r=e.split(`,`).map(e=>parseInt(e.trim(),10));for(let e of r)isNaN(e)||t.linkStyles.set(e,{...t.linkStyles.get(e),...n})}continue}if(mo(s,t))continue;let d=s.match(/^state\s+(?:"([^"]+)"\s+as\s+)?([\w\p{L}]+)\s*\{$/u);if(d){let e=d[1]??d[2],i=d[2],a={id:i,label:e,nodeIds:[],children:[]};n.push(a),r.add(i),t.nodes.delete(i);continue}if(s===`}`){let e=n.pop();e&&(n.length>0?n[n.length-1].children.push(e):t.subgraphs.push(e));continue}let f=s.match(/^state\s+"([^"]+)"\s+as\s+([\w\p{L}]+)\s*$/u);if(f){let e=(0,c.normalizeBrTags)(f[1]),r=f[2];$a(t,n,r,e);continue}let p=s.match(/^(\[\*\]|[\w\p{L}-]+)(?::::([\w][\w-]*))?\s*(?:([\w-]+)@)?-->\s*(\[\*\]|[\w\p{L}-]+)(?::::([\w][\w-]*))?(?:\s*:\s*(.+))?$/u);if(p){let e=p[1],o=p[2],s=p[3],l=p[4],u=p[5],d=p[6]?.trim(),f=d?(0,c.normalizeBrTags)(d):void 0;e===`[*]`?(i++,e=`_start${i>1?i:``}`,eo(t,n,{id:e,label:``,shape:`state-start`})):r.has(e)||to(t,n,e),l===`[*]`?(a++,l=`_end${a>1?a:``}`,eo(t,n,{id:l,label:``,shape:`state-end`})):r.has(l)||to(t,n,l),o!==void 0&&t.classAssignments.set(e,o),u!==void 0&&t.classAssignments.set(l,u),t.edges.push({source:e,target:l,label:f,style:`solid`,hasArrowStart:!1,hasArrowEnd:!0,...s===void 0?{}:{id:s}});continue}let m=s.match(/^([\w\p{L}-]+):::([\w][\w-]*)\s*$/u);if(m){let e=m[1];r.has(e)||to(t,n,e),t.classAssignments.set(e,m[2]);continue}let h=s.match(/^([\w\p{L}-]+)\s*:\s*(.+)$/u);if(h){let e=h[1];$a(t,n,e,(0,c.normalizeBrTags)(h[2].trim()));continue}}for(let e of t.classAssignments.keys())!t.nodes.has(e)&&!r.has(e)&&to(t,[],e);return t}function $a(e,t,n,r){let i=e.nodes.get(n);i&&(i.label=r),eo(e,t,{id:n,label:r,shape:`rounded`})}function eo(e,t,n){if(e.nodes.has(n.id)||e.nodes.set(n.id,n),t.length>0){let e=t[t.length-1];e.nodeIds.includes(n.id)||e.nodeIds.push(n.id)}}function to(e,t,n){if(!e.nodes.has(n))eo(e,t,{id:n,label:n,shape:`rounded`});else if(t.length>0){let e=t[t.length-1];e.nodeIds.includes(n)||e.nodeIds.push(n)}}var no=/^(<|o|x)?(-{2,}|={2,}|-\.+-|~{3,})(>|o|x)?(?:\|([^|]*)\|)?/,ro=new Set([`--`,`==`]);function io(e){if(e===`o`)return`circle`;if(e===`x`)return`cross`}var ao=/^(<|o|x)?(--|-\.|==)\s+(.+?)\s+(-{2,}[>ox]|={2,}[>ox]|\.+-[>ox]|-{3,}|={3,}|-\.+-)/,oo=[{regex:/^([\w\p{L}-]+)\(\(\(((?:"[^"]*"|(?!\)\)\)).)+)\)\)\)/u,shape:`doublecircle`},{regex:/^([\w\p{L}-]+)\(\[((?:"[^"]*"|(?!\]\)).)+)\]\)/u,shape:`stadium`},{regex:/^([\w\p{L}-]+)\(\(((?:"[^"]*"|(?!\)\)).)+)\)\)/u,shape:`circle`},{regex:/^([\w\p{L}-]+)\[\[((?:"[^"]*"|(?!\]\]).)+)\]\]/u,shape:`subroutine`},{regex:/^([\w\p{L}-]+)\[\(((?:"[^"]*"|(?!\)\]).)+)\)\]/u,shape:`cylinder`},{regex:/^([\w\p{L}-]+)\[\/((?:"[^"]*"|(?![\\/]\]).)+)([\\/])\]/u,shape:e=>e===`\\`?`trapezoid`:`parallelogram`},{regex:/^([\w\p{L}-]+)\[\\((?:"[^"]*"|(?![\\/]\]).)+)([\\/])\]/u,shape:e=>e===`/`?`trapezoid-alt`:`parallelogram-alt`},{regex:/^([\w\p{L}-]+)>((?:"[^"]*"|(?!\]).)+)\]/u,shape:`asymmetric`},{regex:/^([\w\p{L}-]+)\{\{((?:"[^"]*"|(?!\}\}).)+)\}\}/u,shape:`hexagon`},{regex:/^([\w\p{L}-]+)\[((?:"[^"]*"|(?!\]).)+)\]/u,shape:`rectangle`},{regex:/^([\w\p{L}-]+)\(((?:"[^"]*"|(?!\)).)+)\)/u,shape:`rounded`},{regex:/^([\w\p{L}-]+)\{((?:"[^"]*"|(?!\}).)+)\}/u,shape:`diamond`}],so=/^([\w\p{L}]+(?:-[\w\p{L}]+)*)/u,co=/^([\w\p{L}-]+)(?=@\{)/u;function lo(e){if(e.shape)return(0,u.resolveShapeName)(e.shape)??`rectangle`;if(e.icon!==void 0||e.img!==void 0)switch(e.form?.toLowerCase()){case`circle`:return`circle`;case`rounded`:return`rounded`;default:return`rectangle`}return`rectangle`}function uo(e,t){return t.label!==void 0&&t.label.length>0?t.label:t.icon?t.icon:t.img?t.img:e}function fo(e,t){(0,c.applyClickStatement)(e,t.interactions)}var po=/^([\w-]+)(?=@\{)/;function mo(e,t){let n=e.match(po);if(!n||!t.edges.some(e=>e.id===n[1]))return!1;let r=(0,u.matchExpandedBlock)(e.slice(n[1].length));return r?(ho(t,n[1],(0,u.parseExpandedMeta)(r.body)),!0):!1}function ho(e,t,n){for(let r of e.edges)r.id===t&&(n.animate!==void 0&&(r.animate=n.animate.toLowerCase()!==`false`),n.animation!==void 0&&(r.animate=!0))}var go=/^:::([\w][\w-]*)/,_o=/^([\w\p{L}-]+):::([\w][\w-]*)/u;function vo(e,t,n){let r=e.trim(),i=yo(r,t,n);if(!i||i.ids.length===0)return;r=i.remaining.trim();let a=i.ids;for(;r.length>0;){let e,i,o,s,l,u,d,f=r.match(/^([\w-]+)@(?=[-=<~ox])/);f&&(d=f[1],r=r.slice(f[0].length));let p=r.match(no),m=p?.[2],h=p?.[1],g=p?.[3];if(p&&m!==void 0&&!(h===void 0&&g===void 0&&ro.has(m))){e=h!==void 0,l=io(h);let t=p[4]?.trim();s=t?(0,c.normalizeBrTags)(t):void 0,r=r.slice(p[0].length).trim(),i=wo(m),o=g!==void 0,u=io(g)}else{let t=r.match(ao);if(!t)break;e=!!t[1],l=io(t[1]);let n=t[3].trim();s=n?(0,c.normalizeBrTags)(n):void 0;let a=t[2],d=t[4];r=r.slice(t[0].length).trim(),i=To(a,d),u=io(d.slice(-1)),o=d.endsWith(`>`)||u!==void 0}let _=yo(r,t,n);if(!_||_.ids.length===0)break;r=_.remaining.trim();for(let n of a)for(let r of _.ids)t.edges.push({source:n,target:r,label:s,style:i,hasArrowStart:e,hasArrowEnd:o,...l===void 0?{}:{startMarker:l},...u===void 0?{}:{endMarker:u},...d===void 0?{}:{id:d}});a=_.ids}}function yo(e,t,n){let r=bo(e,t,n);if(!r)return null;let i=[r.id],a=r.remaining.trim();for(;a.startsWith(`&`);){a=a.slice(1).trim();let e=bo(a,t,n);if(!e)break;i.push(e.id),a=e.remaining.trim()}return{ids:i,remaining:a}}function bo(e,t,n){let r=null,i=e,a,o=i.match(_o);o&&(a=o[2],i=o[1]+i.slice(o[0].length));let s=i.match(co);if(s){let e=s[1],a=(0,u.matchExpandedBlock)(i.slice(e.length));if(a){let o=(0,u.parseExpandedMeta)(a.body);xo(t,n,{id:e,label:(0,c.normalizeBrTags)(uo(e,o)),shape:lo(o)}),r=e,i=i.slice(e.length+a.length)}}if(r===null)for(let{regex:e,shape:a}of oo){let o=i.match(e);if(o){r=o[1];let e=(0,c.normalizeBrTags)(o[2]),s=typeof a==`function`?a(o[3]??``):a;xo(t,n,{id:r,label:e,shape:s}),i=i.slice(o[0].length);break}}if(r===null){let e=i.match(so);e&&(r=e[1],t.nodes.has(r)?So(t,n,r)||Co(n,r):xo(t,n,{id:r,label:r,shape:`rectangle`}),i=i.slice(e[0].length))}if(r===null)return null;a&&t.classAssignments.set(r,a);let l=i.match(go);return l&&(t.classAssignments.set(r,l[1]),i=i.slice(l[0].length)),{id:r,remaining:i}}function xo(e,t,n){e.nodes.has(n.id)||e.nodes.set(n.id,n),Co(t,n.id)}function So(e,t,n){let r=e=>e.nodeIds.includes(n)||e.children.some(r);return e.subgraphs.some(r)||t.some(r)}function Co(e,t){if(e.length>0){let n=e[e.length-1];n.nodeIds.includes(t)||n.nodeIds.push(t)}}function wo(e){return e.startsWith(`~`)?`invisible`:e.includes(`.`)?`dotted`:e.startsWith(`=`)?`thick`:`solid`}function To(e,t){return e.includes(`.`)||t.includes(`.`)?`dotted`:e.startsWith(`=`)||t.startsWith(`=`)?`thick`:`solid`}var Eo={type:`xychart`,parse:u.parseXYChart,layoutForSvg:Ni,renderSvg(e,t,n){let r=n.interactivity===void 0?n.interactive??!1:n.interactivity===`full`;return qi(e,t.colors,t.font,t.transparent,r,t.embedSource,t.title,t.decorative,t.emit)}},Do={type:`sequence`,parse:u.parseSequenceDiagram,layoutForSvg:ui,renderSvg(e,t){return di(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}};function Oo(e){return(e.interactivity??`static`)!==`none`}function ko(e){return(e.interactivity??`static`)===`full`}var Ao={type:`class`,parse:u.parseClassDiagram,layoutForSvg:wr,renderSvg(e,t,n){return Or(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,Oo(n),t.emit)}},jo={type:`er`,parse:u.parseErDiagram,layoutForSvg(e,t){return qr((0,c.withDirectionOverride)(e,t.direction),t)},renderSvg(e,t){return Yr(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},Mo={type:`flowchart`,parse:(e,t)=>Xa(t),layoutForSvg(e,t){return{graph:Yt((0,c.withDirectionOverride)(e,t.direction),t),curve:t.curve??e.initConfig?.curve??`linear`}},renderSvg(e,t,n){return on(e.graph,t.colors,t.font,t.transparent,t.fontSizes,e.curve,t.embedSource,ko(n),Oo(n),t.title,t.decorative,t.emit)}},No={type:`c4`,parse:u.parseC4Diagram,layoutForSvg(e,t){return Fa(e,t)},renderSvg(e,t){return Ia(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},Po={xychart:Eo,er:jo,sequence:Do,class:Ao,flowchart:Mo,architecture:{type:`architecture`,parse:u.parseArchitecture,layoutForSvg(e,t){return{graph:qt((0,c.withDirectionOverride)((0,u.architectureToGraph)(e),t.direction),t),curve:t.curve??`linear`}},renderSvg:Mo.renderSvg},c4:No};function Fo(e){return{bg:e.bg??c.DEFAULTS.bg,fg:e.fg??c.DEFAULTS.fg,line:e.line,accent:e.accent,muted:e.muted,surface:e.surface,border:e.border}}function Io(e={}){return(0,c.themeStyleDeclarations)(Fo(e),e.transparent)}function Lo(e){return{nonce:e.nonce,styleAttribute:e.styleAttribute}}function Ro(e,t={}){let n=zo(e,t);return t.resolveColors?_r(n,Fo(t)):n}function zo(e,t){let n=(0,d.decodeXML)(e),r=Fo(t),i=t.font??`Inter`;(0,c.setMonospaceMetrics)((0,c.isMonospaceFont)(i));let a=t.transparent??!1,o=A(t.fontSizes),s=(0,c.detectDiagramType)(n),l=t.embedSource?e:void 0,u=t.title,f=t.decorative,p=Lo(t),m=(0,c.splitStatements)(n),h=Po[s],g=h.parse(m,n),_=h.layoutForSvg(g,t),v={colors:r,font:i,transparent:a,fontSizes:o,embedSource:l,title:u,decorative:f,emit:p};return h.renderSvg(_,v,t)}async function Bo(e,t={}){return Ro(e,t)}var Vo=Ro,Ho=Bo;exports.ACTOR_LABEL_OFFSET=oi,exports.ARROW_HEAD=F,exports.CLS=H,exports.ELK_DIRECTION_FALLBACK=te,exports.FONT_SIZES=k,exports.FONT_WEIGHTS=j,exports.GROUP_HEADER_CONTENT_PAD=ee,exports.INLINE_CENTERED_EDGE_LABEL=oe,exports.MONO_FONT=D,exports.MONO_FONT_STACK=O,exports.NODE_PADDING=M,exports.STROKE_WIDTHS=N,exports.TEXT_BASELINE_SHIFT=P,exports.baseElkLayoutOptions=ie,exports.boxLabelHeight=ai,exports.buildElkEdge=R,exports.buildElkEdgeLabel=se,exports.buildElkLeafNode=ae,exports.classNoteId=vr,exports.clipEdgeToShape=ke,exports.convertToElkFormat=Xt,exports.createLayoutCache=x,exports.directionToElk=ne,exports.elkLayoutSync=w,exports.elkPadding=re,exports.estimateMonoTextWidth=E,exports.estimateTextWidth=T,exports.evaluateCssColorValue=dr,exports.extractEdgeLabelPosition=Be,exports.extractEdgePoints=ze,exports.formatTickLabels=Wi,exports.layoutClassDiagramSync=wr,exports.layoutErDiagramSync=qr,exports.layoutFlowchartSync=Yt,exports.layoutGraphSync=qt,exports.layoutSequenceDiagram=ui,exports.layoutXYChart=Ni,exports.niceTickValues=Ui,exports.pointsToPath=_,exports.renderClassSvg=Or,exports.renderErSvg=Yr,exports.renderMermaid=Ho,exports.renderMermaidSVG=Ro,exports.renderMermaidSVGAsync=Bo,exports.renderMermaidSync=Vo,exports.renderSequenceSvg=di,exports.renderSvg=on,exports.renderXYChartSvg=qi,exports.resolveCssColors=_r,exports.resolveFontSizes=A,exports.smoothCurvePath=Zi,exports.themeCssVariables=Io,exports.withDataSrc=nr,exports.xLabelStep=zi;
69
73
  //# sourceMappingURL=index.cjs.map